@zenera/cli 1.1.16 → 1.1.18

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.
Files changed (71) hide show
  1. package/README.md +110 -19
  2. package/dist/banner.d.ts +19 -0
  3. package/dist/banner.js +12 -9
  4. package/dist/catalog.js +19 -20
  5. package/dist/command.d.ts +3 -0
  6. package/dist/commands/check.js +5 -1
  7. package/dist/commands/index.js +4 -1
  8. package/dist/commands/init.js +42 -7
  9. package/dist/commands/inspect.js +77 -13
  10. package/dist/commands/key.js +49 -1
  11. package/dist/commands/memory.js +16 -3
  12. package/dist/commands/meta.d.ts +3 -0
  13. package/dist/commands/meta.js +596 -0
  14. package/dist/commands/run.js +64 -35
  15. package/dist/engine.d.ts +15 -0
  16. package/dist/engine.js +26 -1
  17. package/dist/env.d.ts +20 -0
  18. package/dist/env.js +65 -0
  19. package/dist/home.d.ts +2 -0
  20. package/dist/home.js +2 -0
  21. package/dist/keys.d.ts +2 -0
  22. package/dist/keys.js +2 -0
  23. package/dist/main.js +1 -1
  24. package/dist/meta.d.ts +221 -0
  25. package/dist/meta.js +695 -0
  26. package/dist/podman.js +64 -2
  27. package/dist/projects.d.ts +9 -1
  28. package/dist/projects.js +19 -2
  29. package/dist/resolve.js +7 -1
  30. package/dist/sandbox.d.ts +11 -0
  31. package/dist/sandbox.js +24 -4
  32. package/dist/scaffold.d.ts +6 -0
  33. package/dist/scaffold.js +56 -15
  34. package/dist/session.d.ts +10 -0
  35. package/dist/session.js +19 -1
  36. package/dist/term.d.ts +7 -0
  37. package/dist/term.js +8 -1
  38. package/dist/tui/app.js +33 -5
  39. package/dist/tui/wrap.d.ts +1 -1
  40. package/dist/tui/wrap.js +1 -1
  41. package/dist/validate.js +57 -15
  42. package/package.json +3 -2
  43. package/templates/editor/.github/copilot-instructions.md +313 -94
  44. package/templates/editor/.github/prompts/project-review.prompt.md +74 -0
  45. package/templates/editor/.github/prompts/spec-apply-feedback.prompt.md +142 -0
  46. package/templates/editor/.github/prompts/spec-sync-project.prompt.md +392 -0
  47. package/templates/editor/.github/skills/zen-cli/references/check.md +6 -3
  48. package/templates/editor/.github/skills/zen-cli/references/frame.md +5 -3
  49. package/templates/editor/.github/skills/zen-cli/references/inspect.md +4 -3
  50. package/templates/editor/.github/skills/zen-cli/references/memory.md +14 -0
  51. package/templates/editor/.github/skills/zen-cli/references/projects.md +19 -2
  52. package/templates/editor/.github/skills/zen-cli/references/run.md +75 -16
  53. package/templates/editor/.github/skills/zen-cli/references/sandbox.md +6 -0
  54. package/templates/editor/.github/skills/zen-memory/SKILL.md +153 -33
  55. package/templates/editor/.github/skills/zen-memory/scripts/check-instructions.sh +115 -0
  56. package/templates/editor/.github/skills/zen-review/SKILL.md +123 -0
  57. package/templates/editor/.github/skills/zen-review/scripts/check-paths.sh +119 -0
  58. package/templates/editor/.github/skills/zen-review/scripts/review.sh +104 -0
  59. package/templates/editor/.github/skills/zen-spec-sync/SKILL.md +197 -0
  60. package/templates/editor/.github/skills/zen-spec-sync/scripts/snapshot.sh +200 -0
  61. package/templates/editor/.vscode/settings.json +44 -4
  62. package/templates/parts/memory-terms.yaml.tmpl +16 -0
  63. package/templates/parts/memory.yaml.tmpl +12 -0
  64. package/templates/project/SPECIFICATION.md.tmpl +32 -2
  65. package/templates/project/agents/memory-instructions.md +278 -0
  66. package/templates/project/agents.yaml.tmpl +12 -3
  67. package/templates/project/env +28 -0
  68. package/templates/project/gitignore +4 -4
  69. package/templates/editor/.github/prompts/review-project.prompt.md +0 -36
  70. package/templates/editor/.github/prompts/sync-with-spec.prompt.md +0 -205
  71. /package/templates/project/{INSTRUCTIONS.md → agents/instructions.md} +0 -0
@@ -0,0 +1,28 @@
1
+ # This project's environment.
2
+ #
3
+ # `zen run` reads this file before it loads the project, and forwards every
4
+ # name in it into the sandbox — so a command the agent runs sees the same
5
+ # variables the run does. Values are forwarded by name, never written onto a
6
+ # command line, and `--no-keys` withholds the whole file. `zen meta` reads it
7
+ # too, for the one variable below that is addressed to it.
8
+ #
9
+ # Precedence: what is already set in your shell wins, then this file, then the
10
+ # keyring (`zen key add`). So this is the place for what belongs to *this*
11
+ # project — the credential one of its tools needs, the address of the service
12
+ # it talks to — and the keyring is the place for what belongs to you.
13
+ #
14
+ # It is in .gitignore, and should stay there. Everything else in the project is
15
+ # meant to be read, copied and shared; this is the one file that is not.
16
+ #
17
+ # A credential *file* — GOOGLE_APPLICATION_CREDENTIALS — may be named by a path
18
+ # relative to this directory. It is mounted into the sandbox where the agent
19
+ # can read it, which is worth knowing before you point at one.
20
+
21
+ # OPENAI_API_KEY=
22
+ # ACME_API_TOKEN=
23
+ # ACME_BASE_URL=https://api.example.test
24
+
25
+ # Which model `zen meta` runs the meta agent on, for this project only. A zen
26
+ # ref — `vertex/gemini-3.8-flash`, `openai/gpt-5.6-sol` — not a provider's wire
27
+ # name. `zen meta model` shows where the answer came from.
28
+ # ZENERA_META_MODEL=
@@ -2,10 +2,10 @@
2
2
  # None of it is source.
3
3
  sessions/
4
4
 
5
- # Memory is worth keeping: `graph.json` and `files/` are what the agents
6
- # learned, and they diff. The vectors are not — they are derived from the
7
- # graph and can be rebuilt with `zen memory reembed`.
8
- memory/vectors.*
5
+ # Memory is worth keeping: `graph.json`, `files/` and the vectors are what the
6
+ # agents learned. The vectors are binary, but nothing rebuilds them from the
7
+ # graph, so a clone without them recalls by term overlap until every node is
8
+ # written again. Only the lock is runtime state.
9
9
  memory/.lock
10
10
 
11
11
  # Scratch, inside the workspace so the sandbox can reach it.
@@ -1,36 +0,0 @@
1
- ---
2
- mode: agent
3
- description: Review the project against the checklist before committing.
4
- ---
5
-
6
- Review this project the way a maintainer would, then report. Read
7
- `agents.yaml`, `INSTRUCTIONS.md`, every file under `agents/prompts/` and the
8
- skill descriptions under `agents/skills/` before saying anything.
9
-
10
- Work the checklist in §9 of the copilot instructions. In particular:
11
-
12
- - **Loads.** Run `zen check`. Nothing else in this review matters if it fails.
13
- - **One job each.** Can you state every agent's job in one sentence? If not,
14
- say which agent and what the two jobs are.
15
- - **Prompts.** Second person, imperative, failure paths stated, no hedging, no
16
- politeness padding, no meta-talk about the runtime. Nothing in
17
- `INSTRUCTIONS.md` that is true of only one agent.
18
- - **Facts.** Any number, threshold, fee or date living in a prompt is in the
19
- wrong file. Name it and say which skill it belongs in.
20
- - **Paths.** Work the checklist in §2.5 over `INSTRUCTIONS.md`,
21
- `agents/prompts/*.md` and `agents/skills/*/SKILL.md`. Every absolute path must
22
- be under `/workspace`, `/assets`, `/skills` or `/memory`; nothing may name a
23
- project file the agent cannot open, and nothing may assume the workspace is
24
- this directory.
25
- - **Skill descriptions.** Each one a condition, not a title; no two overlapping.
26
- - **Tools.** Every grant justified by the agent's job; nothing mutating held by
27
- an agent that only reads; every granted tool mentioned by the prompt.
28
- - **Routing.** Handoff targets have descriptions written for the model. No
29
- ping-pong edges. No router that answers.
30
- - **Models.** Each agent on the cheapest tier that is right, not the safest.
31
- - **Cache.** Nothing volatile - dates, ids, counts - in the stable prefix.
32
- - **Secrets.** No key inlined anywhere; `.env` ignored, `sessions/` ignored.
33
-
34
- Report as a list of findings, each naming the file and the line, ordered by how
35
- much it will cost to leave. Say plainly if you find nothing worth changing.
36
- Do not edit anything unless I ask.
@@ -1,205 +0,0 @@
1
- ---
2
- description: Bring the project into compliance with SPECIFICATION.md, and record every open question in SPECIFICATION-FEEDBACK.md.
3
- ---
4
-
5
- Make this project match `SPECIFICATION.md`. The specification is the intent;
6
- the files are the implementation. Where they disagree, the specification wins -
7
- except where it is ambiguous, contradictory or impossible, which is what
8
- `SPECIFICATION-FEEDBACK.md` is for.
9
-
10
- ## 1. Read before changing anything
11
-
12
- Read, in this order, and do not edit until all of it is read:
13
-
14
- 1. `SPECIFICATION.md` - what the system is meant to be.
15
- 2. `agents.yaml` - providers, models, embeddings, agents, tools, handoffs,
16
- skills, sandbox.
17
- 3. `INSTRUCTIONS.md` and every file under `agents/prompts/`.
18
- 4. Every `agents/skills/*/SKILL.md`, plus what each skill folder ships.
19
- 5. `assets/`, `sandbox/Dockerfile` and every script under `scripts/`, starting
20
- with `scripts/_setup.sh`.
21
- 6. `SPECIFICATION-FEEDBACK.md`, if it exists - do not re-raise something already
22
- open there.
23
-
24
- Run `zen check` first and record what it said. A project that does not load is
25
- the first thing to fix.
26
-
27
- ## 2. Build the difference
28
-
29
- Produce a difference list before touching a file. For every item in the
30
- specification, decide which of these it is:
31
-
32
- - **present and correct** - leave it alone
33
- - **missing** - the specification asks for it and nothing implements it
34
- - **divergent** - implemented, but not as specified
35
- - **extra** - implemented, and the specification does not ask for it
36
- - **unclear** - the specification does not say enough to implement it
37
-
38
- Check at least: the model and embedding ids and which agent uses which; that
39
- every agent named in the specification exists with that job and no second job;
40
- handoff edges and fork permissions; the tools each agent holds; every skill the
41
- specification implies; and every setup step, index or asset it depends on.
42
-
43
- Then build the difference the other way, because the list above can only find
44
- what the specification asked for and nothing implements. Read `INSTRUCTIONS.md`,
45
- each `agents/prompts/*.md` and each `SKILL.md` **line by line**, and for every
46
- line name the specification item it serves. A line serving none is an **extra** -
47
- the category covers a single sentence in a prompt, not only a whole file. Three
48
- things to look for while reading, none of which the forward pass can see:
49
-
50
- - **A line that contradicts another file.** One prompt against another, a prompt
51
- against `INSTRUCTIONS.md`, or a prompt against `agents.yaml` - an instruction
52
- to use a tool the agent does not hold, to hand to an agent that is not in its
53
- `handoffs:`, or to load a skill outside its `allow:`.
54
- - **A line that asks for something the system already supplies.** A question put
55
- to the user about a value that arrives from the environment, a file or an
56
- earlier step is unanswerable, and the answer would be discarded.
57
- - **A line the agent cannot carry out** - naming a path it cannot reach, a tool
58
- it was not granted, or an agent it cannot transfer to.
59
-
60
- These are bugs whatever the specification says: fix them in place and report each
61
- one. An extra that is merely unspecified is reported under `➕`, not removed.
62
-
63
- ## 3. Change the smallest thing that closes the gap
64
-
65
- Apply the fixes in the order the copilot instructions prefer: a prompt or skill
66
- edit over a new skill, a new skill over a new agent, a tool grant over asking
67
- the model to compute or remember. Specifically:
68
-
69
- - A behaviour gap is a prompt or skill edit, not a new agent.
70
- - A fact, rate, threshold or command surface goes in a skill, never in a prompt.
71
- - Arithmetic or a fixed transformation goes in a script under the skill folder,
72
- called by its absolute `/skills/<name>/…` path.
73
- - A capability gap is a `tools:` grant plus the prompt line that says when to
74
- use it. A granted tool no prompt mentions is not implemented.
75
- - A toolchain the work always needs goes in `sandbox/Dockerfile`, not in a
76
- prompt that installs it every run.
77
- - If the project has a `sandbox/Dockerfile`, pin `@zenera/cli` and `@zenera/rag`
78
- in it to the version of `zen` in hand. Read that version with `zen --version`
79
- and write it into the `npm install -g` line, so the CLI an agent runs inside
80
- the container is the same one that built it. An unpinned name drifts away from
81
- the host on the next image build; a stale pin is a mismatch nothing reports.
82
-
83
- Never delete an **extra** without saying so. Report it, say why the
84
- specification does not cover it, and leave it unless I tell you to remove it.
85
-
86
- Do not invent a value the specification does not state - a model id, a limit, a
87
- retry count, a file path. That is an entry in `SPECIFICATION-FEEDBACK.md`, not a
88
- guess.
89
-
90
- ## 4. Every setup step is a script
91
-
92
- Anything the project needs done before it can run - building an index, fetching
93
- a document, generating a file, warming the sandbox image - is a shell script,
94
- not a paragraph of instructions for a human.
95
-
96
- - One step per file, under `scripts/`, named after the step:
97
- `scripts/build-schema-index.sh`, `scripts/fetch-api-docs.sh`.
98
- - `scripts/_setup.sh` is the **only** entry point - the leading underscore is
99
- what separates the runner from the steps it runs. It runs the steps in the
100
- order they depend on each other and is the single command that initialises the
101
- project. `zen init` writes it; adding a step is adding `scripts/<name>.sh` and
102
- its name to the `STEPS` list at the top of it. Consolidate any setup script
103
- that lives elsewhere into this shape, including one left at the project root.
104
- - Every script starts `set -eu`, works from any working directory
105
- (`cd "$(dirname "$0")/.."` first), needs no arguments, and exits non-zero on
106
- failure so `scripts/_setup.sh` stops rather than continuing on a broken step.
107
- - **Re-entrancy is required.** Running `scripts/_setup.sh` a second time must be
108
- safe. A step whose output is present and newer than its inputs prints that it
109
- is up to date and exits **3**, which is how the runner tells `skipped` from
110
- `ok`; otherwise it redoes the work idempotently, writing
111
- to a temporary path and moving it into place so an interrupted run never leaves
112
- a half-built artefact behind. `scripts/_setup.sh --force` redoes everything,
113
- and reaches each step as `$FORCE=1`.
114
- - **It must be watchable.** `scripts/_setup.sh` tees each step's output to
115
- `.tmp/logs/setup-<step>.log`, prints a heartbeat line while a long step runs,
116
- and finishes with one line per step: `ok`, `skipped`, or `failed`.
117
- - **Everything transient goes under `.tmp/`** - logs, scratch files, downloads,
118
- test output, and the temporary path a step writes to before moving its
119
- artefact into place. Nothing else in the tree is a scratch directory, and
120
- `.tmp/` is git-ignored: add it to `.gitignore` if it is not there already.
121
- Deleting `.tmp/` must leave the project runnable and `scripts/_setup.sh`
122
- re-runnable.
123
- - Steps that need credentials run on the host, not in the sandbox. Read keys
124
- from the environment or `.env`; never inline one into a script.
125
- - Anything the sandbox always needs belongs in `sandbox/Dockerfile`, not in a
126
- setup script that installs it again on every run.
127
-
128
- ## 5. Write `SPECIFICATION-FEEDBACK.md`
129
-
130
- Create or update `SPECIFICATION-FEEDBACK.md` at the project root whenever
131
- anything in the
132
- specification is unclear, contradictory, impossible, or wrong. If there is
133
- nothing to raise, say so in the chat and do not create the file.
134
-
135
- Group entries under these headings, and omit a heading that has no entries.
136
- The file is scanned before it is read, so keep the emoji on every heading:
137
-
138
- ```markdown
139
- # Feedback on SPECIFICATION.md
140
-
141
- ## 🛑 Blocking - cannot implement without an answer
142
-
143
- ## ❓ Ambiguous - implemented one way, confirm the choice
144
-
145
- ## ⚡ Contradictions
146
-
147
- ## ✏️ Errors and typos
148
-
149
- ## ➕ Out of scope - implemented but unspecified
150
- ```
151
-
152
- Each entry is one bullet, opening with the emoji of the heading it sits under,
153
- then four parts in this order:
154
-
155
- - **What the specification says**, quoted, with the section it is in.
156
- - **Why it cannot be implemented as written** - the specific gap, not "unclear".
157
- - **What was done in the meantime**, or "nothing - blocked".
158
- - **The question**, phrased so a one-line answer unblocks it.
159
-
160
- Use no other emoji anywhere in the file - one per entry is what makes them
161
- scannable. Keep entries factual and short. Do not editorialise about the
162
- specification's quality, do not restate the runtime, and do not copy the whole
163
- section in.
164
- Append to the existing file rather than rewriting it; strike an entry only when
165
- this pass has actually resolved it, and say in the chat which ones you closed.
166
-
167
- ## 6. Run `scripts/_setup.sh` and watch it finish
168
-
169
- After `zen check` passes, run `scripts/_setup.sh` yourself. A pass is not done
170
- until it has run to completion in this session.
171
-
172
- It is slow - an embedding index is minutes, not seconds - so start it in the
173
- background and follow the logs instead of waiting blind:
174
-
175
- - Tail `.tmp/logs/setup-*.log` and check the output artefact is still growing.
176
- - **Wait in a loop, never in one long sleep.** Sleep at most 30 seconds at a
177
- time, then check the log and say what it shows, and repeat until the step
178
- finishes. A single long block makes the run unwatchable and hides a failure
179
- that happened in the first ten seconds.
180
- - Report progress as you go: which step is running, how long it has been going,
181
- what the last log line said.
182
- - Do not kill a quiet step. Confirm the process is dead or the log and the
183
- output have both stopped growing before calling it stuck.
184
- - On failure, read that step's log, fix the cause, and run `scripts/_setup.sh`
185
- again - re-running is the fix path, not a reset. If the same step fails twice
186
- for the same reason, stop and raise it in `SPECIFICATION-FEEDBACK.md`.
187
- - Prove re-entrancy: once it has succeeded, run `scripts/_setup.sh` once more and
188
- check that every step reports `skipped` rather than rebuilding.
189
-
190
- ## 7. Verify and report
191
-
192
- Run `zen check` again and fix whatever it names rather than working around it.
193
- It validates structure and says nothing about the prose, so work §9 of the
194
- copilot instructions as a checklist afterwards and report each group pass or
195
- fail. Then report in the chat:
196
-
197
- - what changed, file by file, and which specification item each change closes
198
- - every prompt or skill line that served no specification item, and what became
199
- of it - corrected, or reported and left alone
200
- - the outcome of every `scripts/_setup.sh` step, and what each one produced
201
- - what is still open, with a pointer to its `SPECIFICATION-FEEDBACK.md` entry
202
- - anything you found that the specification does not cover at all
203
-
204
- Do not report a specification item as done unless the file that implements it
205
- exists, `zen check` passes, and `scripts/_setup.sh` completed every step it owns.