Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions start-cli/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
title: Start CLI
homepage: https://github.com/Start9Labs/start-cli
tagline: |
Official command-line tool for StartOS service packaging
description: |
Start CLI is the official command-line tool for StartOS - a sovereignty-first
operating system. Essential for building and packaging services into .s9pk
(StartOS Service Package) format, remotely managing StartOS nodes, and
integrating with CI/CD pipelines.
---

```sh
start-cli --help
```

Start CLI enables developers to:

- Build and package services into .s9pk format for StartOS
- Remotely manage StartOS nodes (install, update, backup services)
- Integrate StartOS development with CI/CD workflows
- List, monitor and control services on StartOS systems

## Cheat Sheet

### Initialize developer key
```sh
start-cli init
```

### Authanticate login to your StartOS
```sh
start-cli auth login
```

### List installed services
```sh
start-cli package list
```

### Check version
```sh
start-cli --version
```
Empty file added start-cli/install.ps1
Empty file.
61 changes: 61 additions & 0 deletions start-cli/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/bin/bash
set -e
set -u

# Package-specific variables
pkg_cmd_name="start-cli"
pkg_dst_cmd="$HOME/.local/bin/start-cli"
pkg_dst="$HOME/.local/opt/start-cli"
pkg_dst_bin="$HOME/.local/opt/start-cli/bin"

# These will be set by webi
pkg_src_cmd="$HOME/.local/opt/start-cli-v$WEBI_VERSION/bin/start-cli"
pkg_src_bin="$HOME/.local/opt/start-cli-v$WEBI_VERSION/bin"
pkg_src="$HOME/.local/opt/start-cli-v$WEBI_VERSION"

pkg_get_current_version() {
# 'start-cli version' outputs: start-cli v0.4.0-alpha.9
echo "$(start-cli --version 2>/dev/null | head -n 1 | cut -d ' ' -f 2 | sed 's/v//')" || echo ""
}

pkg_install() {
# Create the versioned directory
mkdir -p "$(dirname $pkg_src_cmd)"

# Move the binary from temp directory to the final location
if [ -f "$WEBI_TMP/start-cli" ]; then
mv "$WEBI_TMP/start-cli" "$pkg_src_cmd"
elif [ -f "$WEBI_TMP/start-cli-"*"/start-cli" ]; then
mv "$WEBI_TMP/start-cli-"*"/start-cli" "$pkg_src_cmd"
else
echo "Error: Could not find start-cli binary in temp directory"
exit 1
fi

# Make it executable
chmod +x "$pkg_src_cmd"
}

pkg_link() {
# Remove any existing symlinks or files
rm -f "$pkg_dst_cmd"

# Create the symlink
ln -s "$pkg_src_cmd" "$pkg_dst_cmd"
}

pkg_post_install() {
# Add to PATH
webi_path_add "$pkg_dst_bin"

# Ensure the local bin directory is in PATH for immediate use
webi_path_add "$HOME/.local/bin"
}

pkg_done_message() {
echo "Installed 'start-cli' v$WEBI_VERSION to $pkg_src_cmd"
echo ""
echo "Try it out:"
echo " start-cli --help"
echo " start-cli --version"
}
55 changes: 55 additions & 0 deletions start-cli/releases.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/usr/bin/env node

'use strict';

var github = require('../_common/github.js');
var owner = 'Start9Labs';
var repo = 'start-cli';

module.exports = function (request) {
return github(request, owner, repo).then(function (all) {
// Filter and map releases for start-cli's naming convention
all.releases = all.releases.filter(function (rel) {
var filename = rel.name;

// Only include .tar.gz binary files
if (!filename.endsWith('.tar.gz')) {
return false;
}

// Map start-cli naming to webi os/arch format
if (filename.includes('aarch64-apple-darwin')) {
rel.os = 'macos';
rel.arch = 'arm64';
rel.ext = 'tar.gz';
return true;
} else if (filename.includes('x86_64-apple-darwin')) {
rel.os = 'macos';
rel.arch = 'amd64';
rel.ext = 'tar.gz';
return true;
} else if (filename.includes('aarch64-unknown-linux-gnu')) {
rel.os = 'linux';
rel.arch = 'arm64';
rel.ext = 'tar.gz';
return true;
} else if (filename.includes('x86_64-unknown-linux-gnu')) {
rel.os = 'linux';
rel.arch = 'amd64';
rel.ext = 'tar.gz';
return true;
}

return false;
});

return all;
});
};

if (module === require.main) {
module.exports().then(function (all) {
all = require('../_webi/normalize.js')(all);
console.info(JSON.stringify(all, null, 2));
});
}