@hagicode/cli 0.1.0-dev.49.1.aa038f5 → 0.1.0-dev.50.1.674e23d
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 +9 -6
- package/dist/chunks/{main-D5eiMFz8.js → main-BHYpWMTH.js} +127 -125
- package/dist/cli.js +1 -1
- package/dist/main.js +1 -1
- package/package.json +1 -1
- package/resources/saga/manifest.json +11 -9
- package/skills/hagi/SKILL.md +1 -0
- package/skills/hagi/references/cli-usage.md +1 -0
- package/skills/hagi/references/local-development.md +4 -2
- package/skills/hagi/references/saga.md +48 -15
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-BHYpWMTH.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-BHYpWMTH.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.50.1.674e23d",
|
|
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": {
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
{
|
|
2
|
-
"schemaVersion":
|
|
3
|
-
"
|
|
4
|
-
".gitignore": "b43c8b58f191b9e0a0b54b6938c0aa4685d70b8f4ae2294c83a9ad6e728b7c0a"
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
2
|
+
"schemaVersion": 2,
|
|
3
|
+
"install": {
|
|
4
|
+
".gitignore": "b43c8b58f191b9e0a0b54b6938c0aa4685d70b8f4ae2294c83a9ad6e728b7c0a"
|
|
5
|
+
},
|
|
6
|
+
"methods": {
|
|
7
|
+
"goal": "a545b01c9f6010df661f02cf62ef9bcae527ccf329f304ea82ffdda239b118df",
|
|
8
|
+
"research": "2504283ea845440c7909ff1da20bfb70f846d55ca16565740168848cfb8060b1",
|
|
9
|
+
"acceptance": "11ca06794d0ec19e87d1a4e883a67014563e9750b9fa62a8bedd43a69d52ca65",
|
|
10
|
+
"plan": "bcc4c0509f2971083775db2b3678f41c55f16e69deba2d994d3ed636f314d917",
|
|
11
|
+
"run": "aaf8a667c163afea0796a8c80d5760ee689923a76b0c7f1855e55405d9b0b5d0",
|
|
12
|
+
"amend": "be621d1221a85656851548aee1e9e9d78480288bd856baf1bdbf50cb3317f49b"
|
|
11
13
|
}
|
|
12
14
|
}
|
package/skills/hagi/SKILL.md
CHANGED
|
@@ -12,6 +12,7 @@ Use this skill when the user asks to:
|
|
|
12
12
|
- enable or disable a built-in skill
|
|
13
13
|
- run or verify the `hagi` CLI
|
|
14
14
|
- run, explain, or verify local `saga init`, `saga new`, `saga list`, `saga status`, or `saga items` operations
|
|
15
|
+
- read a published Saga method (`goal`, `research`, `acceptance`, `plan`, `run`, `amend`) with `saga method <name>`
|
|
15
16
|
- run, explain, or verify local Saga ownership, checks, and writes: `claim`, `assert-owner`, `release`, `freeze`, `check`, `tick`, `block`, `set-status`, `amend`, `archive`, and `session create` (Saga Worker chat sessions)
|
|
16
17
|
- explain or execute `project`, `proposal`, `chat`, `hagitask`, `vault`, `plan`, `skills`, or `saga` commands
|
|
17
18
|
- explain the OpenSpec workflow behind `proposal` commands, which stage each command starts, or how to follow a run until it settles
|
|
@@ -119,6 +119,7 @@ Shared `--base-url`, `--token`, `--lang`, and `--json` options are accepted.
|
|
|
119
119
|
|
|
120
120
|
```bash
|
|
121
121
|
hagi saga init --path "./My Project"
|
|
122
|
+
hagi saga method run --json
|
|
122
123
|
hagi saga new demo --path "./My Project" --json
|
|
123
124
|
hagi saga list --path "./My Project"
|
|
124
125
|
hagi saga status demo --project-id <project-id> --json
|
|
@@ -67,8 +67,10 @@ types of every removed route. When a proto DTO changes, edit or add the matching
|
|
|
67
67
|
|
|
68
68
|
The Saga resources are owned by this repository. `resources/saga/` contains the six method prompt files, `.gitignore`,
|
|
69
69
|
and `manifest.json`; there is no standalone Saga tool and no sync step. Keep the bytes raw: do not render templates or
|
|
70
|
-
normalize line endings. The manifest uses schema version `
|
|
71
|
-
|
|
70
|
+
normalize line endings. The manifest uses schema version `2` with two maps: `install` lists `.gitignore`, and `methods`
|
|
71
|
+
maps each method name (`goal`, `research`, `acceptance`, `plan`, `run`, `amend`) to the digest of `prompts/<name>.md`.
|
|
72
|
+
Paths are sorted POSIX relative paths and every digest is lowercase SHA-256. The manifest does not hash itself. Only
|
|
73
|
+
`.gitignore` is installed into a project; the methods are read from the package with `hagi saga method`.
|
|
72
74
|
|
|
73
75
|
After editing a prompt, update its digest in `manifest.json`. `tests/runtime/saga/assets.test.ts` fails on any mismatch
|
|
74
76
|
between the files and the manifest, and `pnpm run pack:check` verifies the published contents.
|
|
@@ -14,13 +14,15 @@ hagi saga init --path "./My Project"
|
|
|
14
14
|
hagi saga init --path "./My Project" --force --json
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
Initialization installs
|
|
18
|
-
|
|
17
|
+
Initialization installs only the ignore rule under `.hagicode/sagas/.gitignore`. It creates no `prompts/` directory and
|
|
18
|
+
never installs method prompts into the project: the six bundled method prompts are read from the CLI package with
|
|
19
|
+
`hagi saga method <name>` (see [Published methods](#published-methods)). It does not repair or overwrite existing Saga
|
|
20
|
+
contracts, metadata, or runtime records.
|
|
19
21
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
Existing project-local `prompts/` files from an earlier installation are left in place. Initialization does not read,
|
|
23
|
+
compare, replace, or report them, so it never flags them as outdated or as conflicts. `--force` is still accepted, so
|
|
24
|
+
existing scripts keep working, but it changes nothing: no managed resource can be replaced or conflict any more. The
|
|
25
|
+
command prints each file's `created`, `unchanged`, or `merged` outcome and exits `0`. Forced initialization never discards custom `.gitignore` entries.
|
|
24
26
|
|
|
25
27
|
The `.gitignore` rule `**/runtime/` is merged as a separate exact line. Existing bytes, line endings, and entries are
|
|
26
28
|
preserved; LF and CRLF files are supported, and repeated initialization does not append duplicate rules.
|
|
@@ -30,8 +32,38 @@ regular files, and that writes will not replace unsafe hard-linked resources. Re
|
|
|
30
32
|
failures rather than followed outside the selected project. Exact resources are not rewritten on repeat runs, preserving
|
|
31
33
|
their modes and modification times.
|
|
32
34
|
|
|
33
|
-
With `--json`, stdout contains the installation root, `force` setting, per-file `path`/`outcome` entries, and
|
|
34
|
-
conflicts.
|
|
35
|
+
With `--json`, stdout contains the installation root, the `force` setting, per-file `path`/`outcome` entries, and an
|
|
36
|
+
empty `conflicts` array. The `files` array holds only the `.gitignore` entry.
|
|
37
|
+
|
|
38
|
+
## Published methods
|
|
39
|
+
|
|
40
|
+
The six method prompts (`goal`, `research`, `acceptance`, `plan`, `run`, `amend`) ship inside the installed CLI package,
|
|
41
|
+
not in the project. Read one with:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
hagi saga method run
|
|
45
|
+
hagi saga method run --json
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Plain output prints the method bytes unchanged. `--json` prints `{ "name", "sha256", "content" }`, where `sha256` is the
|
|
49
|
+
lowercase SHA-256 of the same bytes. The command takes no `--path` or `--project-id`, reads no backend or project file,
|
|
50
|
+
writes nothing, and works before a project has any Saga files. An unknown name, or a selector flag, exits `2`. Before
|
|
51
|
+
returning any method, the CLI verifies every bundled resource against `resources/saga/manifest.json`; a missing or
|
|
52
|
+
modified resource exits `30`, names the file, and prints no method content.
|
|
53
|
+
|
|
54
|
+
`freeze` records the six digests in a `methods:` section of `contract.lock`, for revision 1 and for every later
|
|
55
|
+
revision. The CLI computes the digests itself. A repeat freeze on an unchanged contract leaves the lock untouched,
|
|
56
|
+
including a lock written before this section existed, and `revisions/rN.lock` keeps its own section byte for byte.
|
|
57
|
+
|
|
58
|
+
`check --phase run --json` adds `methods: { "recorded", "drift": [{ "name", "recorded", "current" }] }` when a lock exists.
|
|
59
|
+
`recorded` is `false` for a lock without the section, and then `drift` is empty. Drift means the installed CLI's method
|
|
60
|
+
differs from the one the Saga was frozen under, which is expected after a CLI upgrade. It is a notice only: it never adds
|
|
61
|
+
an error, never changes the exit code, and never writes a file. Human output prints one `notice:` line per drifted method.
|
|
62
|
+
`execute` tells the user which methods changed and continues only after confirmation; a changed digest is not treated as
|
|
63
|
+
tampering. The plan phase never reports methods.
|
|
64
|
+
|
|
65
|
+
Project-local `prompts/` files are no longer used by any command. `execute` leaves them in place, ignores them, and says in
|
|
66
|
+
its report that they may be deleted.
|
|
35
67
|
|
|
36
68
|
## Create and inspect Sagas
|
|
37
69
|
|
|
@@ -56,8 +88,9 @@ The `--json` result identifies the Saga directory and includes the metadata writ
|
|
|
56
88
|
}
|
|
57
89
|
```
|
|
58
90
|
|
|
59
|
-
The human result names
|
|
60
|
-
|
|
91
|
+
The human result names `hagi saga method goal` as the way to read the planning method, and the four planning files to
|
|
92
|
+
write: `goal.md`, `research.md`, `acceptance.md`, and `progress.md`. `status` gives the same direction for the next artifact,
|
|
93
|
+
for example `hagi saga method research`.
|
|
61
94
|
|
|
62
95
|
Then inspect the Saga with the read-only commands:
|
|
63
96
|
|
|
@@ -119,7 +152,7 @@ least one active item, every active item has an acceptance `cmd:`, and every acc
|
|
|
119
152
|
and the proof of every ticked item (an evidence file and a `Status: PASS` or `状态: PASS` report). Any other `--phase`
|
|
120
153
|
value is a usage error (code `2`). Checks write nothing.
|
|
121
154
|
|
|
122
|
-
`freeze` writes `contract.lock` revision 1 for a valid first contract. A repeat on an unchanged contract exits `0`, reports
|
|
155
|
+
`freeze` writes `contract.lock` revision 1 for a valid first contract, including the `methods:` section. A repeat on an unchanged contract exits `0`, reports
|
|
123
156
|
the existing revision, and leaves the lock bytes intact. After a contract change, freeze writes revision N+1 only when an
|
|
124
157
|
amendment is merged into `rN+1` and no frozen item disappeared without a superseded row. The previous lock moves to
|
|
125
158
|
`revisions/rN.lock`, each ticked item whose acceptance command changed is reopened, and its evidence and report move to
|
|
@@ -202,7 +235,7 @@ is replaced atomically, so a concurrent reader always sees a complete document.
|
|
|
202
235
|
| `0` | Success. |
|
|
203
236
|
| `1` | Refusal or failed check. Every reason is printed; nothing was changed. |
|
|
204
237
|
| `2` | Usage error: bad selector, missing or invalid argument, or `--token` with `--project-id` (with either selector for `session create`). |
|
|
205
|
-
| `4` |
|
|
238
|
+
| `4` | Reserved. `init` no longer produces conflicts, so no current command returns it. |
|
|
206
239
|
| `24` | Saga or project not found. |
|
|
207
240
|
| `30` | Operation failed, including a `new` collision. |
|
|
208
241
|
|
|
@@ -217,11 +250,11 @@ Human output prints a one-line outcome and one line per refusal reason.
|
|
|
217
250
|
|
|
218
251
|
## Runtime ignore precondition
|
|
219
252
|
|
|
220
|
-
Before any command writes a file under a Saga's `runtime/` directory (`claim`, `set-status`, `tick`, `block`,
|
|
221
|
-
`freeze` that moves history), it makes sure `.hagicode/sagas/.gitignore` ignores runtime directories. An existing
|
|
253
|
+
Before any command writes a file under a Saga's `runtime/` directory (`claim`, `set-status`, `tick`, `block`, `session create`,
|
|
254
|
+
and a `freeze` that moves history), it makes sure `.hagicode/sagas/.gitignore` ignores runtime directories. An existing
|
|
222
255
|
`**/runtime/` line is kept byte for byte; otherwise `**/runtime/` is appended with the file's line endings.
|
|
223
256
|
If the ignore file cannot be written, the command stops before `runtime/` is created.
|
|
224
257
|
|
|
225
258
|
## Read-only projection and ownership
|
|
226
259
|
|
|
227
|
-
Every write and check command is implemented by the CLI and never executes a separate tool. The CLI installs only the
|
|
260
|
+
Every write and check command is implemented by the CLI and never executes a separate tool. The CLI installs only the ignore rule and reads the method prompts from its own package; there is no installed tool to run.
|