@swarmcraftai/cli 0.5.0 → 0.5.1
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/CHANGELOG.md +6 -0
- package/README.md +88 -128
- package/dist/main.cjs +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to the SwarmCraft CLI are documented in this file.
|
|
4
4
|
|
|
5
|
+
## 0.5.1
|
|
6
|
+
|
|
7
|
+
- Refreshes the npm README around customer installation and common workflows, with native PowerShell commands, Node/npm verification, managed-machine recovery and VS Code restart guidance.
|
|
8
|
+
- Clarifies that WSL is not required for the SwarmCraft CLI and that AI-provider prerequisites are separate.
|
|
9
|
+
- Command behavior and the editor/Setup capability contract remain unchanged from 0.5.0.
|
|
10
|
+
|
|
5
11
|
## 0.5.0
|
|
6
12
|
|
|
7
13
|
- Adds deterministic `operate init`, `operate validate`, and `operate status` commands for local operational work, with Codex and Copilot guidance for Work, Automate, and Formalise.
|
package/README.md
CHANGED
|
@@ -1,190 +1,150 @@
|
|
|
1
1
|
# SwarmCraft CLI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[SwarmCraft](https://swarmcraft.ai) helps you use AI to get operational work done, automate repeatable tasks, and build applications. It gives your AI assistant shared skills and structured workflows while you keep control of your knowledge, records, and code.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
The CLI brings SwarmCraft workflows to your terminal. Use it to prepare a local repository for operational work or run implementation tasks from your SwarmCraft project board with an AI coding agent. You can inspect progress, resume interrupted runs, and collect support diagnostics.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Prerequisites
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
- Node.js 20.19 or newer, npm, and Git.
|
|
10
|
+
- A SwarmCraft account and a project with tasks ready to implement.
|
|
11
|
+
- A local Git repository with unrelated changes committed or stashed.
|
|
12
|
+
- Codex CLI or GitHub Copilot CLI installed and configured, or SwarmCraft Managed AI credits.
|
|
10
13
|
|
|
11
|
-
|
|
14
|
+
On macOS and Windows, start with [SwarmCraft Setup](https://swarmcraft.ai/docs/set-up-and-connect/use-swarmcraft-setup) to prepare your environment.
|
|
12
15
|
|
|
13
|
-
##
|
|
14
|
-
|
|
15
|
-
- Package name: `@swarmcraftai/cli`
|
|
16
|
-
- Installed command: `swarmcraft`
|
|
17
|
-
- Supported runtime target: Node.js 20.19 or newer
|
|
18
|
-
- Local run artifact location: `.swarmcraft/runs/<run-id>` inside the selected customer workspace
|
|
19
|
-
- Public package contents: bundled CLI runtime, README, package metadata, and license
|
|
20
|
-
- Shared workspace packages are bundled into the CLI artifact; customers do not install `@swarmcraft/packet-workflow` or `@swarmcraft/repo-seed` directly.
|
|
21
|
-
|
|
22
|
-
## Implemented Module Ownership
|
|
23
|
-
|
|
24
|
-
- `src/main.ts` is the executable composition root: it dispatches parsed commands, prompts where compatibility requires it, prints outcomes, and selects exit behavior.
|
|
25
|
-
- `src/commands/command-catalog.ts` owns stable command names, usage text, and help lookup; `src/commands/arguments.ts` owns syntax-only argument parsing and repeated option access.
|
|
26
|
-
- `src/apiClient.ts` maps API transport contracts; `src/sessionStore.ts` is the only owner of the owner-only local credential file.
|
|
27
|
-
- `src/workspace.ts` owns workspace validation and contained file/git operations. `src/runtime/workspace-paths.ts` rejects absolute, traversal, escaped run, manifest, log, and support-artifact targets.
|
|
28
|
-
- `src/runtime/process.ts` provides shell-free argument-array execution. Only `runTrustedShellAgentCommand` may invoke a shell for a deliberately supplied custom-agent template; API content and credentials must never be interpolated into it.
|
|
29
|
-
- `src/bootstrap.ts`, `src/discovery.ts`, and `src/oneShot.ts` compose the seed, immutable discovery-package, and packet execution workflows.
|
|
30
|
-
- `src/operation/` owns Operate filesystem/Git preflight, shared-seed reconciliation, local inspection, and content-safe status; `src/commands/operate-commands.ts` owns its session validation, cancellation, output, and exit codes.
|
|
31
|
-
- `src/workflows/agent-execution.ts` owns approved credential injection, trusted template quoting, and optional cost capture. `src/artifacts/run-manifest.ts` owns contained paths and atomic resume-manifest persistence.
|
|
32
|
-
- `src/supportBundle.ts` exposes only allow-listed delegation facts and recursively redacts secret-bearing keys.
|
|
33
|
-
|
|
34
|
-
All customer run artifacts remain below `.swarmcraft/runs/<run-id>`. Workspace-relative reads, writes, removals, packet paths, discovery sources, logs, manifests, diagnostics, and support bundles are resolved through the containment boundary before access.
|
|
35
|
-
|
|
36
|
-
## Distribution
|
|
37
|
-
|
|
38
|
-
The first public distribution channel is npm:
|
|
16
|
+
## Install
|
|
39
17
|
|
|
40
18
|
```bash
|
|
41
19
|
npm install -g @swarmcraftai/cli
|
|
42
20
|
swarmcraft --help
|
|
43
21
|
```
|
|
44
22
|
|
|
45
|
-
|
|
23
|
+
For one-off use, run `npx @swarmcraftai/cli --help`.
|
|
46
24
|
|
|
47
|
-
|
|
48
|
-
npx @swarmcraftai/cli --help
|
|
49
|
-
```
|
|
25
|
+
## Native Windows installation
|
|
50
26
|
|
|
51
|
-
|
|
27
|
+
WSL is not required for the SwarmCraft CLI. In PowerShell:
|
|
52
28
|
|
|
53
|
-
```
|
|
54
|
-
|
|
29
|
+
```powershell
|
|
30
|
+
node --version
|
|
31
|
+
npm.cmd --version
|
|
32
|
+
npm.cmd install -g @swarmcraftai/cli
|
|
33
|
+
swarmcraft.cmd --version
|
|
34
|
+
swarmcraft.cmd operate init --help
|
|
35
|
+
Get-Command node, npm.cmd, swarmcraft.cmd
|
|
36
|
+
npm.cmd prefix -g
|
|
55
37
|
```
|
|
56
38
|
|
|
57
|
-
|
|
39
|
+
Use a supported Node.js LTS release meeting the minimum above. Confirm the npm global prefix is on your user PATH, then fully quit and reopen VS Code. A window reload may retain the old PATH. Use `.cmd` commands instead of changing PowerShell execution policy. If software installation or the prefix is restricted, use your organisation's approved installation or user-writable prefix; preserve managed runtimes and npm registry/authentication settings.
|
|
58
40
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
```bash
|
|
62
|
-
pnpm cli:dev -- --help
|
|
63
|
-
pnpm cli:check
|
|
64
|
-
```
|
|
41
|
+
The extension needs an installed CLI; one-off `npx` execution does not satisfy that requirement. See the [manual setup checklist](https://swarmcraft.ai/docs/set-up-and-connect/manual-setup-checklist). AI providers have separate platform and authentication requirements.
|
|
65
42
|
|
|
66
|
-
|
|
43
|
+
PowerShell uses different line continuation from Bash. Run the multiline examples below on one line, using `swarmcraft.cmd`, for example:
|
|
67
44
|
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
pnpm check
|
|
71
|
-
pnpm release:smoke
|
|
45
|
+
```powershell
|
|
46
|
+
swarmcraft.cmd one-shot --project YOUR_PROJECT_ID --workspace . --agent-provider codex --task-limit 1 --max-agent-requests 100 --commit-policy done
|
|
72
47
|
```
|
|
73
48
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
## Current Commands
|
|
49
|
+
## Run your first task
|
|
77
50
|
|
|
78
|
-
|
|
51
|
+
Sign in and find your project ID:
|
|
79
52
|
|
|
80
53
|
```bash
|
|
81
|
-
swarmcraft auth login --email
|
|
82
|
-
swarmcraft
|
|
83
|
-
swarmcraft projects list --delegation <delegation-id>
|
|
84
|
-
swarmcraft discovery prepare --workspace <path>
|
|
85
|
-
swarmcraft discovery validate --workspace <path>
|
|
86
|
-
swarmcraft discovery support-bundle --workspace <path> --run <run-id>
|
|
87
|
-
swarmcraft init --project <project-id> --workspace <path> --agent-provider codex --delegation <delegation-id>
|
|
88
|
-
swarmcraft one-shot --project <project-id> --workspace <path> --agent-provider codex --delegation <delegation-id>
|
|
89
|
-
swarmcraft one-shot --project <project-id> --workspace <path> --agent-provider codex --run-id <known-run-id>
|
|
90
|
-
swarmcraft resume --run <run-id> --workspace <path> --delegation <delegation-id>
|
|
91
|
-
swarmcraft status --run <run-id> --workspace <path> --delegation <delegation-id>
|
|
92
|
-
swarmcraft delegation end --delegation <delegation-id>
|
|
54
|
+
swarmcraft auth login --email you@example.com
|
|
55
|
+
swarmcraft projects list
|
|
93
56
|
```
|
|
94
57
|
|
|
95
|
-
|
|
58
|
+
Login prompts for your password and any required verification code. Your CLI session is saved in `~/.swarmcraft/cli-session.json`; keep this file private.
|
|
96
59
|
|
|
97
|
-
|
|
60
|
+
From your project's local Git repository, check your setup:
|
|
98
61
|
|
|
99
62
|
```bash
|
|
100
|
-
swarmcraft
|
|
101
|
-
swarmcraft operate init --workspace /path/to/repository --agent-provider codex
|
|
102
|
-
swarmcraft operate init --workspace /path/to/existing-repository --agent-provider copilot --adopt
|
|
103
|
-
swarmcraft operate validate --workspace /path/to/repository --json
|
|
104
|
-
swarmcraft operate status --workspace /path/to/repository --json
|
|
63
|
+
swarmcraft doctor --workspace . --agent-provider codex
|
|
105
64
|
```
|
|
106
65
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
Initialization validates the saved CLI session against `GET /auth/me` before creating or modifying the target. Expired sessions use the existing refresh flow. The API origin comes from the saved session; there is no workspace-controlled API override. Credentials remain in the existing owner-only session file. Initial session/connectivity failure leaves the target untouched.
|
|
110
|
-
|
|
111
|
-
Seed activities are reported through `POST /telemetry/operate-events` with closed classifications and a random occurrence UUID. The UUID and new/adopted classification are stored in ignored `.swarmcraft/runs/operate-init.json` so rerunning initialization reuses the same occurrence. Reporting failure produces a visible warning and does not undo local work; rerun initialization to retry. There is no background uploader or server registration. `--client-surface vscode-extension` is available for extension delegation.
|
|
112
|
-
|
|
113
|
-
Validation and status are offline and use `@swarmcraft/operation-contract` for model/record checks, reviewed knowledge links, and formalisation digests. They also report ignored authoritative files and tracked raw/scratch files without exposing file contents or ignore patterns. Inventory is capped at 20,000 paths, individual text reads at 2 MB, and loaded evidence at 20 MB. Output includes only safe codes, capabilities, version, and evidence states. Discovery/project presence indicates local artifacts, not verified server connectivity. Automation presence does not imply approved readiness; repeatability remains `NOT_ASSESSED`.
|
|
114
|
-
|
|
115
|
-
Both commands accept `--json`. Exit codes are 0 for success, 2 for sign-in required, 3 for invalid/missing operation evidence, 4 for workspace/option/conflict failures, 5 for session-verification connectivity failure, and 130 for cancellation. After interruption, rerun initialization to reconcile; seed state is written last and owner edits are preserved.
|
|
116
|
-
|
|
117
|
-
## Agent Providers And Local Models
|
|
118
|
-
|
|
119
|
-
SwarmCraft does not require a particular hosted model. The CLI delegates each packet stage to the selected Codex or GitHub Copilot CLI, and `--agent-command` can override the default provider command to select any model that the underlying agent supports. This includes local models served by Ollama.
|
|
120
|
-
|
|
121
|
-
Before starting a local-model run, start Ollama and pull an agent-capable coding model. Local models used through GitHub Copilot CLI must support tool calling and streaming; a large context window is strongly recommended. Model capability and output quality vary, so begin with one task and a bounded request count.
|
|
122
|
-
|
|
123
|
-
Run GitHub Copilot CLI against a local Ollama model without a GitHub-hosted model request:
|
|
66
|
+
Replace `<project-id>` with an ID from the project list, then run one task:
|
|
124
67
|
|
|
125
68
|
```bash
|
|
126
69
|
swarmcraft one-shot \
|
|
127
70
|
--project <project-id> \
|
|
128
|
-
--workspace
|
|
129
|
-
--agent-provider
|
|
130
|
-
--agent-command 'COPILOT_PROVIDER_BASE_URL=http://localhost:11434/v1 COPILOT_MODEL=qwen3-coder:30b COPILOT_OFFLINE=true copilot --allow-all-tools --no-ask-user -p {command}' \
|
|
71
|
+
--workspace . \
|
|
72
|
+
--agent-provider codex \
|
|
131
73
|
--task-limit 1 \
|
|
132
|
-
--max-agent-requests
|
|
74
|
+
--max-agent-requests 100 \
|
|
75
|
+
--commit-policy done
|
|
133
76
|
```
|
|
134
77
|
|
|
135
|
-
|
|
78
|
+
This prepares repository guidance and task files, runs the agent, and syncs task updates to SwarmCraft. Accepted tasks move to `done`; `--commit-policy done` creates a local commit for each completed task. Omit that option to leave changes uncommitted. Review the resulting changes before sharing them.
|
|
79
|
+
|
|
80
|
+
The CLI refuses a dirty workspace by default. Use `--allow-dirty` only when you intend to include existing local changes in the run. The request limit bounds agent calls, not monetary cost.
|
|
81
|
+
|
|
82
|
+
For preparation without running an agent:
|
|
136
83
|
|
|
137
84
|
```bash
|
|
138
|
-
swarmcraft
|
|
139
|
-
--project <project-id> \
|
|
140
|
-
--workspace <path> \
|
|
141
|
-
--agent-provider codex \
|
|
142
|
-
--agent-command 'codex exec --sandbox workspace-write --oss --local-provider ollama --model qwen3-coder:30b {command}' \
|
|
143
|
-
--task-limit 1 \
|
|
144
|
-
--max-agent-requests 1
|
|
85
|
+
swarmcraft init --project <project-id> --workspace . --agent-provider codex
|
|
145
86
|
```
|
|
146
87
|
|
|
147
|
-
|
|
88
|
+
`init` writes guidance and task files for review and leaves those changes uncommitted. Commit or otherwise resolve them before starting a run that requires a clean workspace. Updates preserve your edits to generated guidance and report conflicts that need attention.
|
|
89
|
+
|
|
90
|
+
## Choose an agent
|
|
91
|
+
|
|
92
|
+
- **Codex:** use `--agent-provider codex`.
|
|
93
|
+
- **GitHub Copilot:** use `--agent-provider copilot`.
|
|
94
|
+
- **SwarmCraft Managed AI:** use `--agent-provider managed` with `one-shot`. The CLI shows your credit balance and an estimated stage range before starting. If credits run out, add credits and resume the blocked run.
|
|
95
|
+
- **Custom commands and local models:** `--agent-command` overrides the provider command and supports models available through your agent, including local models. The template is executed through a shell, so use only commands you trust. Keep secrets out of command text; use `--agent-env-file` with `--agent-api-key-env-name` for provider credentials.
|
|
148
96
|
|
|
149
|
-
|
|
97
|
+
Codex, Copilot, and custom providers use your own provider setup and are outside the Managed AI fee.
|
|
150
98
|
|
|
151
|
-
|
|
99
|
+
## Inspect and resume work
|
|
152
100
|
|
|
153
|
-
|
|
101
|
+
Use the run ID printed by the CLI:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
swarmcraft status --run <run-id> --workspace .
|
|
105
|
+
swarmcraft resume --run <run-id> --workspace .
|
|
106
|
+
```
|
|
154
107
|
|
|
155
|
-
|
|
108
|
+
Run records and agent logs are stored in `.swarmcraft/runs/<run-id>/`, including `manifest.json` and the `logs/` directory. Treat these files as potentially sensitive.
|
|
156
109
|
|
|
157
|
-
|
|
110
|
+
If a run reached its request limit, raise the total ceiling when resuming:
|
|
158
111
|
|
|
159
|
-
|
|
112
|
+
```bash
|
|
113
|
+
swarmcraft resume --run <run-id> --workspace . --max-agent-requests 200
|
|
114
|
+
```
|
|
160
115
|
|
|
161
|
-
|
|
116
|
+
## Other workflows
|
|
162
117
|
|
|
163
|
-
|
|
118
|
+
For local operational work, initialize Work, Automate, and Formalise skills:
|
|
164
119
|
|
|
165
|
-
|
|
120
|
+
```bash
|
|
121
|
+
swarmcraft operate init --workspace /path/to/repository --agent-provider codex
|
|
122
|
+
swarmcraft operate validate --workspace /path/to/repository
|
|
123
|
+
swarmcraft operate status --workspace /path/to/repository
|
|
124
|
+
```
|
|
166
125
|
|
|
167
|
-
|
|
126
|
+
Use `--adopt` to initialize an existing nonempty repository. Initialization previews the files and creates a local commit containing the seed changes. It preserves owner edits and does not push or run an agent. Validation and status work offline; both accept `--json`.
|
|
168
127
|
|
|
169
|
-
|
|
128
|
+
For a workspace that has completed [Deep Discovery review](https://swarmcraft.ai/docs/discover-and-plan/complete-deep-discovery), prepare and validate its package:
|
|
170
129
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
If the next bounded call cannot be funded, the local run is marked blocked and can be resumed
|
|
176
|
-
after credits are added. Codex, Copilot, and custom customer-supplied providers remain outside
|
|
177
|
-
the Managed AI fee.
|
|
130
|
+
```bash
|
|
131
|
+
swarmcraft discovery prepare --workspace .
|
|
132
|
+
swarmcraft discovery validate --workspace .
|
|
133
|
+
```
|
|
178
134
|
|
|
179
|
-
|
|
135
|
+
Preparation requires reviewed discovery documents and confirmed source selections. It creates a local package and a preview of the selected content; upload requires separate consent. If review or source checks fail, correct the reported issue and prepare again.
|
|
180
136
|
|
|
181
|
-
|
|
137
|
+
## Help and troubleshooting
|
|
182
138
|
|
|
183
139
|
```bash
|
|
184
|
-
swarmcraft
|
|
185
|
-
swarmcraft one-shot --
|
|
186
|
-
swarmcraft doctor --workspace
|
|
187
|
-
swarmcraft support-bundle --run <run-id> --workspace
|
|
140
|
+
swarmcraft --help
|
|
141
|
+
swarmcraft one-shot --help
|
|
142
|
+
swarmcraft doctor --workspace . --agent-provider codex
|
|
143
|
+
swarmcraft support-bundle --run <run-id> --workspace .
|
|
188
144
|
```
|
|
189
145
|
|
|
190
|
-
|
|
146
|
+
Run `swarmcraft auth login` again if your session has expired. For Discovery diagnostics, use `swarmcraft discovery support-bundle --workspace . --run <run-id>`.
|
|
147
|
+
|
|
148
|
+
Support bundles redact credentials; Discovery bundles exclude source and package content. Review any diagnostic files before sharing them.
|
|
149
|
+
|
|
150
|
+
See the [one-shot walkthrough](https://swarmcraft.ai/docs/build-and-ship/deliver-with-the-one-shot-cli), [troubleshooting guide](https://swarmcraft.ai/docs/help-and-reference/troubleshoot-swarmcraft), or [contact support](https://swarmcraft.ai/login?next=%2Fapp%2Fsupport).
|
package/dist/main.cjs
CHANGED
|
@@ -66770,7 +66770,7 @@ var import_packet_workflow6 = __toESM(require_dist(), 1);
|
|
|
66770
66770
|
// package.json
|
|
66771
66771
|
var package_default = {
|
|
66772
66772
|
name: "@swarmcraftai/cli",
|
|
66773
|
-
version: "0.5.
|
|
66773
|
+
version: "0.5.1",
|
|
66774
66774
|
description: "Prepare repositories and run packet-based SwarmCraft agent workflows from the terminal.",
|
|
66775
66775
|
license: "SEE LICENSE IN LICENSE.txt",
|
|
66776
66776
|
type: "module",
|
package/package.json
CHANGED