@evcraddock/slug-cli 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,46 @@
1
+ # slug CLI
2
+
3
+ Foundation package for the `slug` command-line tool. Release instructions are documented in [../docs/cli-release.md](../docs/cli-release.md).
4
+
5
+ ## Development
6
+
7
+ From the repository root:
8
+
9
+ ```bash
10
+ npm run test --workspace @evcraddock/slug-cli
11
+ npm run typecheck --workspace @evcraddock/slug-cli
12
+ ```
13
+
14
+ Run locally with Node's TypeScript loader:
15
+
16
+ ```bash
17
+ node --import tsx cli/src/index.ts --help
18
+ ```
19
+
20
+ ## Site initialization
21
+
22
+ Create a standalone site with:
23
+
24
+ ```bash
25
+ slug init ./my-site --name my-site --site-title "My Site"
26
+ ```
27
+
28
+ Run `slug init --help` for template options. In repository-local development, `slug init` copies `template/site` directly. Installed CLI releases download the matching versioned template asset from the Forgejo release unless `--template-url` or `--template-dir` is provided.
29
+
30
+ ## Login and configuration
31
+
32
+ Run `slug login` to open the site's browser auth flow, paste the generated API key, verify it, and save the config. Use `slug doctor` to check configured site reachability and compatibility. Use `slug --config ./dev.slug.yaml login` to run with a specific config file.
33
+
34
+ The CLI stores YAML config at `${XDG_CONFIG_HOME:-~/.config}/slug/config.yaml` by default. Tests and isolated runs can set `SLUG_CONFIG_HOME` to override the config directory. `slug config show` reports whether an API key is configured without printing the key.
35
+
36
+ Use `slug site config show` to read supported runtime site configuration through the Slugkit API. Use `slug site config set <field> <value>` to update supported fields such as `name`, `url`, `tagline`, `description`, `homepage.intro`, and `homepage.body`.
37
+
38
+ Use `slug post list`, `slug post show <slug>`, `slug post create`, `slug post edit <slug>`, `slug post publish <slug>`, `slug post unpublish <slug>`, and `slug post delete <slug>` to manage posts through the Slugkit posts API.
39
+
40
+ Use `slug tag list` to list tags and post usage counts through the Slugkit tags API.
41
+
42
+ Example config:
43
+
44
+ ```yaml
45
+ apiBaseUrl: https://example.com/api/v1
46
+ ```
@@ -0,0 +1,18 @@
1
+ import { ExitCode } from "./errors.js";
2
+ import { type OutputWriter } from "./output.js";
3
+ export interface CommandContext {
4
+ args: string[];
5
+ configPath: string;
6
+ packageVersion: string;
7
+ writer: OutputWriter;
8
+ fetchImpl?: typeof fetch;
9
+ openUrl?: (url: string) => Promise<void> | void;
10
+ prompt?: (message: string) => Promise<string> | string;
11
+ templateSiteDirectory?: string | null;
12
+ templateAssetBaseUrl?: string;
13
+ }
14
+ export interface CommandResult {
15
+ exitCode: ExitCode;
16
+ }
17
+ export declare function runCommand(context: CommandContext): Promise<CommandResult>;
18
+ export declare function createBrowserAuthUrl(apiBaseUrl: string): string;