@hagicode/cli 0.1.0-dev.59.1.47fc04a → 0.1.0-dev.61.1.fa6f884
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 +6 -2
- package/dist/chunks/main-Clq-nCsH.js +271 -0
- package/dist/cli.js +1 -1
- package/dist/main.js +1 -1
- package/package.json +1 -1
- package/resources/saga/manifest.json +1 -1
- package/resources/saga/prompts/run.md +1 -1
- package/skills/hagi/SKILL.md +1 -1
- package/skills/hagi/references/cli-usage.md +3 -2
- package/skills/hagi/references/saga.md +20 -1
- package/dist/chunks/main-nHMH-5Rj.js +0 -266
package/dist/cli.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./chunks/main-
|
|
2
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./chunks/main-Clq-nCsH.js");s.runCli().then(e=>{e!==0&&(process.exitCode=e)}).catch(e=>{const n=e instanceof Error?e.stack??e.message:String(e);process.stderr.write(`${n}
|
|
3
3
|
`),process.exitCode=s.EXIT_CODES.UNKNOWN});
|
package/dist/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/main-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/main-Clq-nCsH.js");exports.createCliApp=e.createCliApp;exports.runCli=e.runCli;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hagicode/cli",
|
|
3
|
-
"version": "0.1.0-dev.
|
|
3
|
+
"version": "0.1.0-dev.61.1.fa6f884",
|
|
4
4
|
"description": "HagiCode CLI for project, proposal, vault, chat, and AutoTask management.",
|
|
5
5
|
"homepage": "https://github.com/HagiCode-org/cli#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"research": "2504283ea845440c7909ff1da20bfb70f846d55ca16565740168848cfb8060b1",
|
|
9
9
|
"acceptance": "11ca06794d0ec19e87d1a4e883a67014563e9750b9fa62a8bedd43a69d52ca65",
|
|
10
10
|
"plan": "6573a02a36ab2d6995c2e4740d2c8771a41e77e5179145d0a2b8e30023816916",
|
|
11
|
-
"run": "
|
|
11
|
+
"run": "3a3ae5bc64ab66faefda08fabe97c41b990266740fe749aee4ea29d822d5c131",
|
|
12
12
|
"amend": "be621d1221a85656851548aee1e9e9d78480288bd856baf1bdbf50cb3317f49b"
|
|
13
13
|
}
|
|
14
14
|
}
|
|
@@ -34,7 +34,7 @@ The run's options may name these, with the defaults shown:
|
|
|
34
34
|
- **Fan out.** Dispatch each remaining ready item by creating its implementation Worker, one after another, each behind its own quota check (step 2). Workers never tick or block items themselves: the orchestrator is the only writer of the Saga record.
|
|
35
35
|
For each Worker:
|
|
36
36
|
- Before each implementation, verification and tuning Worker, not once per item, run the quota check of step 2 for the provider that Worker spends.
|
|
37
|
-
- Create each Worker with `hagi saga session create --saga <saga> --path <root> --title "<ITEM> <role>" --role <role> --master <your session id> --item <ITEM>`, where `<role>` is `implementation` or `verification`. This command takes the token from `SAGA_EXECUTION_TOKEN`, set to the token that `claim` printed, and refuses `--token`. It creates the chat session with its Saga metadata and records it in `sessions.md`. Then give the Worker its instructions below.
|
|
37
|
+
- Create each Worker with `hagi saga session create --saga <saga> --path <root> --title "<ITEM> <role>" --role <role> --master <your session id> --item <ITEM>`, plus `--hero <hero>` when the run input names the hero that Worker runs, where `<role>` is `implementation` or `verification`. This command takes the token from `SAGA_EXECUTION_TOKEN`, set to the token that `claim` printed, and refuses `--token`. It creates the chat session with its Saga metadata and records it in `sessions.md`. Then give the Worker its instructions below.
|
|
38
38
|
- An implementation worker writes code and tests only. Give it the goal, the item, the scope and the safety rules, the project root and its report path.
|
|
39
39
|
- A separate verification worker runs the item's command from `acceptance.md` in the project root, writes the output to `<root>/.hagicode/sagas/<saga>/runtime/evidence/<ITEM>.log`, and writes `<root>/.hagicode/sagas/<saga>/runtime/reports/<ITEM>.md` with the line `Status: PASS` (or `状态: PASS`) only if the exit code is 0. It changes no files.
|
|
40
40
|
- Only `hagi saga tick <saga> <ITEM> --path <root> --token <token>` ticks an item. It refuses without a PASS report and an evidence file.
|
package/skills/hagi/SKILL.md
CHANGED
|
@@ -90,7 +90,7 @@ The current top-level command families are:
|
|
|
90
90
|
- `agent`
|
|
91
91
|
- `saga`
|
|
92
92
|
|
|
93
|
-
`hagi saga` provides `init`, `new`, `list`, `status`, and `items`, plus the write and check commands `claim`, `assert-owner`, `release`, `freeze`, `check`, `tick`, `block`, `set-status`, `amend`, and `archive`,
|
|
93
|
+
`hagi saga` provides `init`, `new`, `list`, `status`, and `items`, plus the write and check commands `claim`, `assert-owner`, `release`, `freeze`, `check`, `tick`, `block`, `set-status`, `amend`, and `archive`, `session create`, which creates a Saga Worker chat session and records it; `session list`, which reads the Worker records without a token; and `log append`, which appends one line to the orchestrator log under the execution token. Mutating commands take `--token` or `SAGA_EXECUTION_TOKEN`; `session create` takes only `SAGA_EXECUTION_TOKEN`. With `--path`, these operate on host-local files without reading backend configuration or calling the API, except `session create`, which calls the backend to find the registered project; `--project-id` resolves a project through the backend. Creating a Worker changes state, so run `session create` only when the user or a Saga run explicitly asks for it. See [`references/saga.md`](references/saga.md) for initialization, creation, offline behavior, and read-only query guarantees.
|
|
94
94
|
|
|
95
95
|
`project repositories --id <project-id>` is read-only. It lists one project's repositories with each path relative to the project root (for example `repos/cli`). Those paths are the values a proposal's `Repository scope` names; see [`references/proposal-flow.md`](references/proposal-flow.md#repository-scope).
|
|
96
96
|
|
|
@@ -92,7 +92,7 @@ hagi
|
|
|
92
92
|
|-- project list | repositories | create | update | delete
|
|
93
93
|
| `-- monospecs show | init | set | validate | reload | clone | remove-checkout
|
|
94
94
|
|-- proposal list | create | optimize-description | generate | annotate | execute | archive | status | complete | send | get | messages
|
|
95
|
-
|-- saga init | new | list | status | items | claim | assert-owner | release | freeze | check | tick | block | set-status | amend | archive | session create
|
|
95
|
+
|-- saga init | new | list | status | items | claim | assert-owner | release | freeze | check | tick | block | set-status | amend | archive | session create | session list | log append
|
|
96
96
|
|-- vault list | create | update | delete
|
|
97
97
|
| `-- files list | preview
|
|
98
98
|
|-- chat list | create | archive | delete | send
|
|
@@ -225,7 +225,8 @@ Start one only when the user asked for it. See [super-commit.md](super-commit.md
|
|
|
225
225
|
|
|
226
226
|
- `schema` (human view) lists the target scope, commands and parameters, with each required parameter marked `yes`, then the requirements, scenes, endpoint and an example command. `--json` adds the input JSON Schema and the example request body.
|
|
227
227
|
- `create` needs `--title`, `--project-id`, and either `--task-id` or `--prompt-id`. `--input <file|->` needs `--task-id`. The input must be a JSON object. The CLI does not check its keys; the backend does, and it rejects a key that the schema does not list and a missing required value. A rejection is printed unchanged and no session is reported.
|
|
228
|
-
- `create --json` prints `{ session, presetTaskId, promptId, requested }`. Read the session id from `session.sessionId`.
|
|
228
|
+
- `create --json` prints `{ session, presetTaskId, promptId, requested }`. Read the session id from `session.sessionId`. `requested` carries `heroId` or `heroName` when a Hero was given, and `session.chatHero` names the Hero the backend bound when it returns one.
|
|
229
|
+
- `create --hero <name-or-id>` picks the Hero. A GUID is sent as `heroId`; any other value is sent as `heroName` (trimmed, matched without regard to case). Give `--hero` or `--hero-id`, not both: that is a usage error (exit `2`) and sends nothing. A blank value is also exit `2`. An unknown name, or both fields in one request, fails with the backend's message and creates no session. Needs a backend that includes the `hero_name` field; an older backend ignores the name and runs its default Hero.
|
|
229
230
|
|
|
230
231
|
Example `input.json` for a task with one required input:
|
|
231
232
|
|
|
@@ -184,6 +184,12 @@ Set `SAGA_EXECUTION_TOKEN` to the token that `claim` printed, then create a Work
|
|
|
184
184
|
hagi saga session create --saga demo --path "./My Project" --title "T1 implementation" --role implementation --master orchestrator-1 --item T1 --json
|
|
185
185
|
```
|
|
186
186
|
|
|
187
|
+
To bind the Worker to a Hero, add `--hero <name-or-id>`, for example `--hero Nova` or a Hero ID:
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
hagi saga session create --saga demo --path "./My Project" --title "T1 implementation" --role implementation --master orchestrator-1 --item T1 --hero Nova --json
|
|
191
|
+
```
|
|
192
|
+
|
|
187
193
|
- The command creates one ordinary chat session in the project and appends one line to `runtime/sessions.md`. It sends
|
|
188
194
|
no message and does not archive the session; `hagi chat archive --session-id <id>` stays a separate step.
|
|
189
195
|
- Required and nonblank: `--saga <id>`, `--title <title>`, `--role implementation|verification`, and `--master <session-id>`
|
|
@@ -198,6 +204,12 @@ hagi saga session create --saga demo --path "./My Project" --title "T1 implement
|
|
|
198
204
|
names the path or the matching IDs, and creates nothing. `--project-id` looks the project up directly.
|
|
199
205
|
- After the project and the Saga are resolved, the owner check of `assert-owner` runs with the token. A Saga without a lock
|
|
200
206
|
still passes once a token is set. A wrong token is a refusal (code `1`), and an unknown Saga is code `24`.
|
|
207
|
+
- `--hero <name-or-id>` is optional. A GUID is sent as `heroId`; any other nonblank value is sent as `heroName`, matched
|
|
208
|
+
like Hero names (trimmed, case-insensitive). A blank value is a usage error (code `2`), and no file is touched. Without
|
|
209
|
+
`--hero` the request is the same as before. The Hero is never written to `userMetadata` or `sessions.md`. A Hero the
|
|
210
|
+
backend rejects (an unknown name, a name and an ID together, or a disabled Hero) fails with the backend's message, the
|
|
211
|
+
record line is not written, and no Worker is recorded. With `--json` the `session.chatHero` object names the Hero the
|
|
212
|
+
backend bound, and the human result shows it on a `hero` line. An older backend ignores the name and runs its default Hero.
|
|
201
213
|
- The new session's `userMetadata` holds `saga.id` (the Saga), `saga.role` (always `worker`), `saga.worker` (the `--role`
|
|
202
214
|
value), `saga.master` (the `--master` value), and `saga.item` only when `--item` is given. The backend checks the key
|
|
203
215
|
format (`^[a-z][a-z0-9._-]{0,63}$`), at most 16 entries, and value length (1 to 512 characters). The metadata is
|
|
@@ -210,7 +222,14 @@ hagi saga session create --saga demo --path "./My Project" --title "T1 implement
|
|
|
210
222
|
- If the append fails after the session was created, the command exits `1` and names the created session ID, in the
|
|
211
223
|
human output and as `session.sessionId` in `--json` with `ok` false.
|
|
212
224
|
- `--json` success is one object: `{ "sagaId": "demo", "command": "session create", "ok": true, "session": { "sessionId": "...", "userMetadata": { ... } }, "record": "<path to sessions.md>" }`.
|
|
213
|
-
- Exit codes: `0` created and recorded; `1` refused, or the record failed after creation; `2` usage error; `24` Saga not found.
|
|
225
|
+
- Exit codes: `0` created and recorded; `1` refused, or the record failed after creation; `2` usage error; `20` the backend rejected the request, as with a Hero it cannot bind; `24` Saga not found.
|
|
226
|
+
|
|
227
|
+
### Run records
|
|
228
|
+
|
|
229
|
+
Two commands replace the hand-written steps of the run prompt. Both take the Saga's path, as the other local Saga commands do.
|
|
230
|
+
|
|
231
|
+
- `hagi saga session list <saga-id> --path <root> [--json]` lists the Worker records in `runtime/sessions.md`: session ID, UTC creation time, role, item (`null` for `-`) and title, in file order. It is read-only and needs no token. A Saga with no `sessions.md` lists nothing and exits `0`. An unknown Saga exits `24`. `--json` returns `{ "sagaId", "command": "session list", "ok": true, "sessions": [...] }`.
|
|
232
|
+
- `hagi saga log append <saga-id> --message <text> --path <root>` appends one line, `- <UTC time> | <message>`, to `runtime/orchestrator-log.md`. It needs the execution token of the Saga owner, from `SAGA_EXECUTION_TOKEN` or `--token`, and refuses a token that does not match the lock with exit `1`. Whitespace and line breaks in the message collapse to one line. A blank message is a usage error (exit `2`) before any file or token check. The runtime directory is created when missing, and a redirected log file is refused before any byte is written.
|
|
214
233
|
|
|
215
234
|
## Items, amendments, and archive
|
|
216
235
|
|