diff --git a/start-cli/README.md b/start-cli/README.md new file mode 100644 index 00000000..92e3d386 --- /dev/null +++ b/start-cli/README.md @@ -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 +``` \ No newline at end of file diff --git a/start-cli/install.ps1 b/start-cli/install.ps1 new file mode 100644 index 00000000..e69de29b diff --git a/start-cli/install.sh b/start-cli/install.sh new file mode 100644 index 00000000..df006cd6 --- /dev/null +++ b/start-cli/install.sh @@ -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" +} diff --git a/start-cli/releases.js b/start-cli/releases.js new file mode 100644 index 00000000..66cc600d --- /dev/null +++ b/start-cli/releases.js @@ -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)); + }); +}