@hagicode/cli 0.2.0 → 0.4.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 +102 -10
- package/dist/chunks/main-CyDpMd__.js +175 -0
- package/dist/cli.js +1 -1
- package/dist/main.js +1 -1
- package/package.json +13 -7
- package/dist/chunks/main-ESbnuxzK.js +0 -138
package/README.md
CHANGED
|
@@ -94,7 +94,7 @@ If none of the three is set, the command exits with code `2` and sends no backen
|
|
|
94
94
|
|
|
95
95
|
Operation commands send requests without a credential by default. Pass `--token` (or set `HAGI_API_TOKEN`) only when your backend requires one.
|
|
96
96
|
|
|
97
|
-
When the backend cannot be reached, the CLI names the base URL and exits with code `60`. A backend
|
|
97
|
+
When the backend cannot be reached, the CLI names the base URL and exits with code `60`. A backend failure is reported differently: it prints the HTTP-equivalent status of the gRPC status and the backend error message, and exits with a status-mapped code.
|
|
98
98
|
|
|
99
99
|
```text
|
|
100
100
|
$ hagi --base-url http://127.0.0.1:1 project list
|
|
@@ -109,11 +109,12 @@ $ echo $?
|
|
|
109
109
|
```text
|
|
110
110
|
hagi
|
|
111
111
|
|-- project list | repositories | create | update | delete
|
|
112
|
-
|
|
112
|
+
| `-- monospecs show | init | set | validate | reload | clone | remove-checkout
|
|
113
|
+
|-- proposal list | create | optimize-description | generate | annotate | execute | archive | status | complete | send | get | messages
|
|
113
114
|
|-- vault list | create | update | delete
|
|
114
115
|
| `-- files list | preview
|
|
115
116
|
|-- chat list | create | archive | delete | send
|
|
116
|
-
|-- hagitask list | schema | create | send
|
|
117
|
+
|-- hagitask list | schema | create | send | get | messages
|
|
117
118
|
|-- plan list | get | create | update | enable | disable | delete | run
|
|
118
119
|
`-- skills local list | enable | disable | uninstall
|
|
119
120
|
gallery search | detail | install
|
|
@@ -175,6 +176,39 @@ Delete the demo project:
|
|
|
175
176
|
hagi project delete --id "$DEMO_PROJECT_ID"
|
|
176
177
|
```
|
|
177
178
|
|
|
179
|
+
## MonoSpecs Commands
|
|
180
|
+
|
|
181
|
+
`project monospecs` manages a project's MonoSpecs configuration (`monospecs.yaml`) and the local checkouts of its repositories. The CLI only sends requests: the backend reads and writes the files and runs Git on its own host, so `--base-url` may point at a remote backend.
|
|
182
|
+
|
|
183
|
+
| Command | Purpose |
|
|
184
|
+
| --- | --- |
|
|
185
|
+
| `show --id <id>` | Print the version, repo directory, config path, commit-when-archive flag and one row per repository with its local Git state. `--yaml` adds the YAML preview. |
|
|
186
|
+
| `init --id <id>` | Initialize the configuration. An initialized project returns its existing document. |
|
|
187
|
+
| `set --id <id>` | Change metadata or repositories. Options: `--version`, `--repo-directory`, `--commit-when-archive <true\|false>`, repeatable `--add-repository <path>` and `--remove-repository <path>`, and `--clone`. `--url`, `--name`, `--display-name` and `--type` apply to a single `--add-repository`. |
|
|
188
|
+
| `validate --id <id>` | Validate the configuration. Exits `30` and still prints every error when it is invalid. |
|
|
189
|
+
| `reload --id <id>` | Reread `monospecs.yaml` on the backend host and refresh the Git state. |
|
|
190
|
+
| `clone --id <id>` | Clone configured repositories that are missing. Repeatable `--path <path>` selects repositories; `--include-optional` adds optional ones when no `--path` is given. |
|
|
191
|
+
| `remove-checkout --id <id> --path <path>` | Delete the local checkout of one configured repository. `--force` allows a checkout with uncommitted changes, unpushed commits or no upstream branch. |
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
hagi project monospecs show --id "$PROJECT_ID"
|
|
195
|
+
hagi project monospecs set --id "$PROJECT_ID" --commit-when-archive true
|
|
196
|
+
hagi project monospecs set --id "$PROJECT_ID" --add-repository repos/api --url https://github.com/example/api.git --clone
|
|
197
|
+
hagi project monospecs set --id "$PROJECT_ID" --remove-repository repos/api
|
|
198
|
+
hagi project monospecs validate --id "$PROJECT_ID" --json
|
|
199
|
+
hagi project monospecs clone --id "$PROJECT_ID" --path repos/web
|
|
200
|
+
hagi project monospecs remove-checkout --id "$PROJECT_ID" --path repos/web
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Safety rules:
|
|
204
|
+
|
|
205
|
+
- `set` reads the current document, applies only the options given and saves the complete document. Local Git state (branch, sync state and similar) is never written back; `code` and `metadata` are kept.
|
|
206
|
+
- `set` rejects a duplicate `--add-repository`, a `--remove-repository` that is not configured, and companion options with more than one addition, before anything is saved. With `--clone`, the configuration is saved first; a failed clone leaves it saved and exits `30`.
|
|
207
|
+
- `clone` and `remove-checkout` act only on repositories listed in the configuration. The backend confines paths to the project root and clones only over `https`, `http`, `ssh` and `git`, so a `file://` URL or a plain path is reported as `failed`.
|
|
208
|
+
- `remove-checkout` refuses a checkout with uncommitted changes, unpushed commits or no upstream unless `--force` is given, and it never removes a path that is not a standalone repository root. It deletes a directory on the backend host and leaves `monospecs.yaml` unchanged.
|
|
209
|
+
|
|
210
|
+
Exit codes for these commands: `2` usage error (no request was sent), `20` backend validation error (every field error is listed), `24` project not found, `29` another clone or removal is running or a checkout is blocked, `30` invalid configuration or a failed clone.
|
|
211
|
+
|
|
178
212
|
## Proposal Commands
|
|
179
213
|
|
|
180
214
|
List proposal sessions for the example project:
|
|
@@ -226,6 +260,17 @@ hagi proposal complete --session-id "$PROPOSAL_ID"
|
|
|
226
260
|
hagi proposal archive --session-id "$PROPOSAL_ID"
|
|
227
261
|
```
|
|
228
262
|
|
|
263
|
+
### Follow a Run
|
|
264
|
+
|
|
265
|
+
`proposal get` reads one session. With `--wait` it polls until the status settles, so the next lifecycle command runs at the right time. `proposal messages` reads the session's messages, newest first.
|
|
266
|
+
|
|
267
|
+
```bash
|
|
268
|
+
hagi proposal get --session-id "$PROPOSAL_ID" --wait --json
|
|
269
|
+
hagi proposal messages --session-id "$PROPOSAL_ID" --last 1 --json
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
The options are the same as `hagitask get`. WaitingForReply counts as settled, because a person must answer. Which stage each command starts is in [references/openspec-workflow.md](skills/hagi/references/openspec-workflow.md).
|
|
273
|
+
|
|
229
274
|
### Explicit Lifecycle Sequence
|
|
230
275
|
|
|
231
276
|
The CLI keeps proposal lifecycle actions explicit and non-interactive. Each command maps to one backend action:
|
|
@@ -323,8 +368,8 @@ hagi hagitask list --json
|
|
|
323
368
|
`hagitask schema` shows one task's target scope, commands, parameters, requirements and scenes. Each required parameter is marked `yes`. The `--json` output adds the input JSON Schema and an example request body:
|
|
324
369
|
|
|
325
370
|
```bash
|
|
326
|
-
hagi hagitask schema --task-id
|
|
327
|
-
hagi hagitask schema --task-id
|
|
371
|
+
hagi hagitask schema --task-id <task-id>
|
|
372
|
+
hagi hagitask schema --task-id <task-id> --json
|
|
328
373
|
```
|
|
329
374
|
|
|
330
375
|
Write the input file. Its keys are the parameter keys the schema lists under `inputs`, plus the `targets` and `targetScopes` keys when the schema's scope lists targets. For example, `input.json` for a task with one required input:
|
|
@@ -341,17 +386,28 @@ Create the session from that task and input. The new id is read from `session.se
|
|
|
341
386
|
|
|
342
387
|
```bash
|
|
343
388
|
HAGITASK_ID=$(hagi hagitask create \
|
|
344
|
-
--title "Auto
|
|
389
|
+
--title "Auto task" \
|
|
345
390
|
--project-id "$PROJECT_ID" \
|
|
346
|
-
--task-id
|
|
391
|
+
--task-id <task-id> \
|
|
347
392
|
--input input.json \
|
|
393
|
+
--json | json_field '.session.sessionId')
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
Super Commit is a prompt, not a preset task. It has no schema and takes no `--input`. Start it with its prompt id, and pass the Git options it accepts:
|
|
397
|
+
|
|
398
|
+
```bash
|
|
399
|
+
SUPER_COMMIT_ID=$(hagi hagitask create \
|
|
400
|
+
--title "Commit the CLI changes" \
|
|
401
|
+
--project-id "$PROJECT_ID" \
|
|
402
|
+
--prompt-id auto-compose-commit.en-US \
|
|
348
403
|
--repository-path repos/cli \
|
|
349
|
-
--need-push \
|
|
350
404
|
--target-branch-mode new-custom \
|
|
351
405
|
--target-branch-name feature/cli-completion \
|
|
352
406
|
--json | json_field '.session.sessionId')
|
|
353
407
|
```
|
|
354
408
|
|
|
409
|
+
Start a Super Commit only when the user asked for it. Add `--need-push` only when the user asked for a push. See [references/super-commit.md](skills/hagi/references/super-commit.md) for the options, the branch modes, the result and the explicit-request rule.
|
|
410
|
+
|
|
355
411
|
Use `--prompt-id` instead of `--task-id` for a prompt template with no structured input. `--input` needs `--task-id`. Input is read from a file, or from stdin with `--input -`. The CLI only checks that the input is a JSON object. The backend checks the keys and values. It rejects a key that the schema does not list, and a missing required value. Its error is printed unchanged, and no session is reported as created. `--hero-selection-mode` takes `first` (the default) or `random`.
|
|
356
412
|
|
|
357
413
|
The backend must have a hero available for the task's script. Without one, `hagitask create` fails with a 400 whose error is `no-executable-hero`.
|
|
@@ -362,6 +418,15 @@ Send a follow-up message to the HagiTask session:
|
|
|
362
418
|
hagi hagitask send --session-id "$HAGITASK_ID" --content "Retry with a smaller diff"
|
|
363
419
|
```
|
|
364
420
|
|
|
421
|
+
Read one HagiTask session, or wait until its status settles, and read its messages:
|
|
422
|
+
|
|
423
|
+
```bash
|
|
424
|
+
hagi hagitask get --session-id "$SUPER_COMMIT_ID" --wait --timeout 900 --json
|
|
425
|
+
hagi hagitask messages --session-id "$SUPER_COMMIT_ID" --last 1 --json
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
`hagitask get` reads one session. With `--wait` it polls every `--interval` seconds (default 5) until the status is no longer Optimizing, Openspecing, Executing or Archiving. `--timeout` (default 900) and `--grace` (default 10, `0` disables) are seconds, and `--timeout`, `--interval` and `--grace` need `--wait`. `--interval` must be less than `--timeout`. A timeout exits `31` and prints the last status. `hagitask messages --last <n>` reads the n newest messages; `--json` prints the list unchanged.
|
|
429
|
+
|
|
365
430
|
**Migration from AutoTask:** `hagi hagitask create` and `hagi hagitask send` replace `hagi autotask create` and `hagi autotask send`. There is no `autotask` alias, so an `autotask` command now fails as an unknown command. Read the task schema with `hagitask schema` to find the input keys that replace the old flags.
|
|
366
431
|
|
|
367
432
|
## Plan Commands
|
|
@@ -519,6 +584,26 @@ hagi skills gallery search --query react --json
|
|
|
519
584
|
hagi skills gallery detail --id vercel-react-best-practices --source vercel-labs/agent-skills
|
|
520
585
|
```
|
|
521
586
|
|
|
587
|
+
`gallery detail` also shows third-party audit ratings for the skill, supplied by skills.sh (providers such as `ath`, `socket` and `snyk`). In `--json` output every detail field is unchanged and an `audit` object is added. It lists one entry per provider that supplied data; `risk`, `alerts`, `score` and `analyzedAt` appear only when the backend has them:
|
|
588
|
+
|
|
589
|
+
```json
|
|
590
|
+
{
|
|
591
|
+
"id": "vercel-react-best-practices",
|
|
592
|
+
"source": "vercel-labs/agent-skills",
|
|
593
|
+
"...": "all other detail fields",
|
|
594
|
+
"audit": {
|
|
595
|
+
"providers": [
|
|
596
|
+
{ "provider": "ath", "risk": "low", "alerts": 0, "score": 92, "analyzedAt": "2026-10-30T08:00:00Z" },
|
|
597
|
+
{ "provider": "socket", "risk": "medium", "alerts": 2 }
|
|
598
|
+
]
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
```
|
|
602
|
+
|
|
603
|
+
In human output the detail table is followed by one line per provider, for example `skills.sh audit (socket): risk=medium, alerts=2, score=--, analyzedAt=--`, where `--` marks a value the backend did not supply.
|
|
604
|
+
|
|
605
|
+
The audit is best-effort. If the audit call fails, times out or has no data, the detail still prints and the command exits `0`; in `--json` output `audit.providers` is then `[]`, never missing. The backend bounds the audit wait, and the CLI adds no timeout of its own. A failure of the detail call itself fails the command as before, and the audit never hides it. The audit does not change the install command preview or whether the skill is installable.
|
|
606
|
+
|
|
522
607
|
Start a managed install of a gallery skill. This writes the skill into your local skill directories, so run it only when you intend to install it:
|
|
523
608
|
|
|
524
609
|
```bash
|
|
@@ -551,9 +636,15 @@ The CLI resolves runtime settings centrally before every command. Explicit flags
|
|
|
551
636
|
| `HAGI_API_TOKEN` | Bearer token attached as `Authorization: Bearer <token>`. |
|
|
552
637
|
| `HAGI_API_LANG` | Shared `Accept-Language` header value. |
|
|
553
638
|
|
|
639
|
+
## Backend Transport
|
|
640
|
+
|
|
641
|
+
The CLI talks to the backend over gRPC-Web only. It appends `/grpc` to the base URL (for example `http://127.0.0.1:35167/grpc`) and calls the `hagicode.*.v1` services; no REST route is used. gRPC-Web runs over HTTP/1.1, so it works against the plain-HTTP local backend and through reverse proxies. The bearer token, `Accept-Language` and the `X-Hagi-Client` marker travel as request headers. The backend therefore has to expose its `/grpc` endpoints.
|
|
642
|
+
|
|
643
|
+
gRPC status codes keep the exit codes below: `InvalidArgument` is `20`, `Unauthenticated` `21`, `PermissionDenied` `23`, `NotFound` `24`, `FailedPrecondition`, `AlreadyExists` and `Aborted` `29`, other client-side statuses `40`, and `Internal`, `Unavailable`, `DeadlineExceeded` and the rest `50`. The status line in error output (`status=404`) shows the HTTP-equivalent number.
|
|
644
|
+
|
|
554
645
|
## Exit Codes
|
|
555
646
|
|
|
556
|
-
Stable non-zero exits used by the CLI:
|
|
647
|
+
Stable non-zero exits used by the CLI. The HTTP numbers are the equivalents of the gRPC status the backend answered with:
|
|
557
648
|
|
|
558
649
|
| Exit code | Meaning |
|
|
559
650
|
| --- | --- |
|
|
@@ -563,7 +654,8 @@ Stable non-zero exits used by the CLI:
|
|
|
563
654
|
| `23` | HTTP 403 |
|
|
564
655
|
| `24` | HTTP 404 |
|
|
565
656
|
| `29` | HTTP 409 |
|
|
566
|
-
| `30` | Operation failed: the backend returned a refusal, for example `skills local enable` or `disable` on a name that is not a built-in skill |
|
|
657
|
+
| `30` | Operation failed: the backend returned a refusal, for example `skills local enable` or `disable` on a name that is not a built-in skill, an invalid MonoSpecs configuration from `project monospecs validate`, or a failed clone from `project monospecs clone` or `set --clone` |
|
|
658
|
+
| `31` | Wait timed out: `--wait` on `proposal get` or `hagitask get` reached `--timeout` before the session settled. The last status is printed. Not a success, and not a backend error |
|
|
567
659
|
| `40` | Other HTTP 4xx |
|
|
568
660
|
| `50` | HTTP 5xx |
|
|
569
661
|
| `60` | Transport or connection failure |
|