@ia-ccun/code-agent-cli 0.0.52 → 0.0.53-beta.2
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/bin/cli.js +97 -69
- package/config/agent/bin/README.md +102 -0
- package/config/agent/extensions/aicode-advisor.ts +197 -61
- package/config/agent/extensions/aicode-banner.ts +101 -0
- package/config/agent/extensions/aicode-btw.ts +677 -183
- package/config/agent/extensions/aicode-cd.ts +1017 -0
- package/config/agent/extensions/aicode-grillMe.ts +198 -0
- package/config/agent/extensions/aicode-pets.ts +351 -0
- package/config/agent/extensions/aicode-plan.ts +2 -0
- package/config/agent/extensions/aicode-safety-guard.ts +555 -0
- package/config/agent/extensions/aicode-tips.ts +69 -30
- package/config/agent/extensions/aicode-todo-progress.ts +547 -0
- package/config/agent/extensions/context-monitor.ts +30 -15
- package/config/agent/extensions/context.ts +132 -60
- package/config/agent/extensions/custom-footer.ts +0 -5
- package/config/agent/extensions/custom.ts +119 -109
- package/config/agent/extensions/error-monitor.ts +38 -51
- package/config/agent/extensions/goal.ts +8 -6
- package/config/agent/extensions/msg-debug.ts +103 -112
- package/config/agent/extensions/ponytail.ts +441 -0
- package/config/agent/extensions/review.ts +365 -164
- package/config/agent/extensions/tps.ts +87 -0
- package/config/agent/extensions/working-msg.ts +164 -51
- package/config/agent/help.md +0 -7
- package/config/agent/models.json +7 -7
- package/config/agent/settings.json +2 -1
- package/config/agent/skills/chroma/LICENSE +21 -0
- package/config/agent/skills/chroma/chroma-local/SKILL.md +165 -0
- package/config/agent/skills/chroma/chroma-local/cli.md +48 -0
- package/config/agent/skills/chroma/chroma-local/data-model.md +103 -0
- package/config/agent/skills/chroma/chroma-local/error-handling/python.md +166 -0
- package/config/agent/skills/chroma/chroma-local/error-handling/typescript.md +231 -0
- package/config/agent/skills/chroma/chroma-local/local-chroma/python.md +95 -0
- package/config/agent/skills/chroma/chroma-local/local-chroma/typescript.md +101 -0
- package/config/agent/skills/chroma/chroma-local/metadata/python.md +154 -0
- package/config/agent/skills/chroma/chroma-local/metadata/typescript.md +153 -0
- package/config/agent/skills/chroma/chroma-local/querying/python.md +147 -0
- package/config/agent/skills/chroma/chroma-local/querying/typescript.md +157 -0
- package/config/agent/skills/chroma/chroma-local/regex/python.md +69 -0
- package/config/agent/skills/chroma/chroma-local/regex/typescript.md +71 -0
- package/config/agent/skills/chroma/chroma-local/understanding-a-codebase.md +80 -0
- package/config/agent/skills/chroma/chroma-local/updating-deleting/python.md +159 -0
- package/config/agent/skills/chroma/chroma-local/updating-deleting/typescript.md +228 -0
- package/config/agent/skills/milvus-skill/LICENSE +202 -0
- package/config/agent/skills/milvus-skill/README.md +37 -0
- package/config/agent/skills/milvus-skill/SKILL.md +259 -0
- package/config/agent/skills/milvus-skill/references/collection.md +86 -0
- package/config/agent/skills/milvus-skill/references/database.md +24 -0
- package/config/agent/skills/milvus-skill/references/index.md +69 -0
- package/config/agent/skills/milvus-skill/references/partition.md +29 -0
- package/config/agent/skills/milvus-skill/references/patterns.md +150 -0
- package/config/agent/skills/milvus-skill/references/user-role.md +90 -0
- package/config/agent/skills/milvus-skill/references/vector.md +247 -0
- package/config/agent/skills/ponytail/SKILL.md +100 -0
- package/config/agent/skills/ponytail-audit/SKILL.md +40 -0
- package/config/agent/skills/ponytail-debt/SKILL.md +44 -0
- package/config/agent/skills/ponytail-help/SKILL.md +68 -0
- package/config/agent/skills/ponytail-review/SKILL.md +56 -0
- package/config/agent/skills/zread/README.md +115 -0
- package/config/agent/skills/zread/SKILL.md +103 -0
- package/config/agent/skills/zread/references/stdio-protocol.md +312 -0
- package/dist/banner.d.ts.map +1 -1
- package/dist/banner.js +8 -1
- package/dist/banner.js.map +1 -1
- package/dist/config-loader.d.ts.map +1 -1
- package/dist/config-loader.js +9 -2
- package/dist/config-loader.js.map +1 -1
- package/package.json +7 -7
- package/scripts/postinstall.js +58 -1
- package/scripts/regression/README.md +224 -0
- package/scripts/regression/cases/01-version-and-deps.sh +94 -0
- package/scripts/regression/cases/02-extension-loading.sh +130 -0
- package/scripts/regression/cases/03-rpc-protocol.sh +259 -0
- package/scripts/regression/cases/04-prompt-stream.sh +130 -0
- package/scripts/regression/cases/05-slash-commands-and-skills.sh +119 -0
- package/scripts/regression/cases/06-tool-execution.sh +115 -0
- package/scripts/regression/cases/07-pi-new-features.sh +141 -0
- package/scripts/regression/lib/common.sh +287 -0
- package/scripts/regression/results/.last_pid +1 -0
- package/scripts/regression/results/.last_workdir +1 -0
- package/scripts/regression/results/02-extension-loading.log +18 -0
- package/scripts/regression/results/03-prompt-stream.log +16 -0
- package/scripts/regression/results/03-rpc-protocol.log +27 -0
- package/scripts/regression/results/04-slash-commands-and-skills.log +11 -0
- package/scripts/regression/results/05-tool-execution.log +8 -0
- package/scripts/regression/results/06-pi-new-features.log +29 -0
- package/scripts/regression/run-all.sh +187 -0
- package/config/agent/dangerous-patterns.json +0 -106
- package/config/agent/extensions/bash-check.ts +0 -227
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ponytail-debt
|
|
3
|
+
description: >
|
|
4
|
+
Harvest every `ponytail:` comment in the codebase into a debt ledger, so the
|
|
5
|
+
deliberate shortcuts and deferrals ponytail leaves behind get tracked instead
|
|
6
|
+
of rotting into "later means never". Use when the user says "ponytail debt",
|
|
7
|
+
"/ponytail-debt", "what did ponytail defer", "list the shortcuts", "ponytail
|
|
8
|
+
ledger", or "what did we mark to do later". One-shot report, changes nothing.
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
Every deliberate ponytail shortcut is marked with a `ponytail:` comment naming
|
|
12
|
+
its ceiling and upgrade path. This collects them into one ledger so a deferral
|
|
13
|
+
can't quietly become permanent.
|
|
14
|
+
|
|
15
|
+
## Scan
|
|
16
|
+
|
|
17
|
+
Grep the repo for comment markers, skipping `node_modules`, `.git`, and build
|
|
18
|
+
output:
|
|
19
|
+
|
|
20
|
+
`grep -rnE '(#|//) ?ponytail:' .` (add other comment prefixes if your stack uses them)
|
|
21
|
+
|
|
22
|
+
Each hit is one ledger row. The comment prefix keeps prose that merely mentions
|
|
23
|
+
the convention out of the ledger.
|
|
24
|
+
|
|
25
|
+
## Output
|
|
26
|
+
|
|
27
|
+
One row per marker, grouped by file:
|
|
28
|
+
|
|
29
|
+
`<file>:<line> — <what was simplified>. ceiling: <the limit named>. upgrade: <the trigger to revisit>.`
|
|
30
|
+
|
|
31
|
+
The convention is `ponytail: <ceiling>, <upgrade path>`, so pull the ceiling
|
|
32
|
+
and the trigger straight from the comment. Want an owner per row too? add
|
|
33
|
+
`git blame -L<line>,<line>`.
|
|
34
|
+
|
|
35
|
+
Flag the rot risk: any `ponytail:` comment that names no upgrade path or
|
|
36
|
+
trigger gets a `no-trigger` tag, those are the ones that silently rot.
|
|
37
|
+
|
|
38
|
+
End with `<N> markers, <M> with no trigger.` Nothing found: `No ponytail: debt. Clean ledger.`
|
|
39
|
+
|
|
40
|
+
## Boundaries
|
|
41
|
+
|
|
42
|
+
Reads and reports only, changes nothing. To persist it, ask and it writes the
|
|
43
|
+
ledger to a file (e.g. `PONYTAIL-DEBT.md`). One-shot. "stop ponytail-debt" or
|
|
44
|
+
"normal mode" to revert.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ponytail-help
|
|
3
|
+
description: >
|
|
4
|
+
Quick-reference card for all ponytail modes, skills, and commands.
|
|
5
|
+
One-shot display, not a persistent mode. Trigger: /ponytail-help,
|
|
6
|
+
"ponytail help", "what ponytail commands", "how do I use ponytail".
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Ponytail Help
|
|
10
|
+
|
|
11
|
+
Display this reference card when invoked. One-shot, do NOT change mode,
|
|
12
|
+
write flag files, or persist anything.
|
|
13
|
+
|
|
14
|
+
## Levels
|
|
15
|
+
|
|
16
|
+
| Level | Trigger | What change |
|
|
17
|
+
|-------|---------|-------------|
|
|
18
|
+
| **Lite** | `/ponytail lite` | Build what's asked, name the lazier alternative in one line. |
|
|
19
|
+
| **Full** | `/ponytail` | The ladder enforced: YAGNI → stdlib → native → one line → minimum. Default. |
|
|
20
|
+
| **Ultra** | `/ponytail ultra` | YAGNI extremist. Deletion before addition. Challenges requirements before building. |
|
|
21
|
+
|
|
22
|
+
Level sticks until changed or session end.
|
|
23
|
+
|
|
24
|
+
## Skills
|
|
25
|
+
|
|
26
|
+
| Skill | Trigger | What it does |
|
|
27
|
+
|-------|---------|--------------|
|
|
28
|
+
| **ponytail** | `/ponytail` | Lazy mode itself. Simplest solution that works. |
|
|
29
|
+
| **ponytail-review** | `/ponytail-review` | Over-engineering review: `L42: yagni: factory, one product. Inline.` |
|
|
30
|
+
| **ponytail-help** | `/ponytail-help` | This card. |
|
|
31
|
+
|
|
32
|
+
Codex uses `@ponytail`, `@ponytail-review`, and `@ponytail-help`; Claude Code
|
|
33
|
+
and OpenCode use the slash-command forms above (OpenCode ships `/ponytail` and
|
|
34
|
+
`/ponytail-review`).
|
|
35
|
+
|
|
36
|
+
## Deactivate
|
|
37
|
+
|
|
38
|
+
Say "stop ponytail" or "normal mode". Resume anytime with `/ponytail`.
|
|
39
|
+
`/ponytail off` also works.
|
|
40
|
+
|
|
41
|
+
## Configure Default Mode
|
|
42
|
+
|
|
43
|
+
Default mode = `full`, auto-active every session. Change it:
|
|
44
|
+
|
|
45
|
+
**Environment variable** (highest priority):
|
|
46
|
+
```bash
|
|
47
|
+
export PONYTAIL_DEFAULT_MODE=ultra
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**Config file** (`~/.config/ponytail/config.json`, Windows: `%APPDATA%\ponytail\config.json`):
|
|
51
|
+
```json
|
|
52
|
+
{ "defaultMode": "lite" }
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Set `"off"` to disable auto-activation on session start, activate manually
|
|
56
|
+
with `/ponytail` when wanted.
|
|
57
|
+
|
|
58
|
+
Resolution: env var > config file > `full`.
|
|
59
|
+
|
|
60
|
+
## Update
|
|
61
|
+
|
|
62
|
+
Enable auto-update once: open `/plugin`, go to Marketplaces, pick ponytail, Enable auto-update. Claude Code then pulls new versions at startup (run `/reload-plugins` when it prompts). Manual refresh: `/plugin marketplace update ponytail` then `/reload-plugins`.
|
|
63
|
+
|
|
64
|
+
If `/plugin` is not recognized, your Claude Code is out of date. Update it (`npm install -g @anthropic-ai/claude-code@latest`, or `brew upgrade claude-code`) and restart. Other hosts use their own update flow.
|
|
65
|
+
|
|
66
|
+
## More
|
|
67
|
+
|
|
68
|
+
Full docs + examples: https://github.com/DietrichGebert/ponytail
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ponytail-review
|
|
3
|
+
description: >
|
|
4
|
+
Code review focused exclusively on over-engineering. Finds what to delete:
|
|
5
|
+
reinvented standard library, unneeded dependencies, speculative abstractions,
|
|
6
|
+
dead flexibility. One line per finding: location, what to cut, what replaces
|
|
7
|
+
it. Use when the user says "review for over-engineering", "what can we
|
|
8
|
+
delete", "is this over-engineered", "simplify review", or invokes
|
|
9
|
+
/ponytail-review. Complements correctness-focused review, this one only
|
|
10
|
+
hunts complexity.
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
Review diffs for unnecessary complexity. One line per finding: location, what
|
|
14
|
+
to cut, what replaces it. The diff's best outcome is getting shorter.
|
|
15
|
+
|
|
16
|
+
## Format
|
|
17
|
+
|
|
18
|
+
`L<line>: <tag> <what>. <replacement>.`, or `<file>:L<line>: ...` for
|
|
19
|
+
multi-file diffs.
|
|
20
|
+
|
|
21
|
+
Tags:
|
|
22
|
+
|
|
23
|
+
- `delete:` dead code, unused flexibility, speculative feature. Replacement: nothing.
|
|
24
|
+
- `stdlib:` hand-rolled thing the standard library ships. Name the function.
|
|
25
|
+
- `native:` dependency or code doing what the platform already does. Name the feature.
|
|
26
|
+
- `yagni:` abstraction with one implementation, config nobody sets, layer with one caller.
|
|
27
|
+
- `shrink:` same logic, fewer lines. Show the shorter form.
|
|
28
|
+
|
|
29
|
+
## Examples
|
|
30
|
+
|
|
31
|
+
❌ "This EmailValidator class might be more complex than necessary, have you
|
|
32
|
+
considered whether all these validation rules are needed at this stage?"
|
|
33
|
+
|
|
34
|
+
✅ `L12-38: stdlib: 27-line validator class. "@" in email, 1 line, real validation is the confirmation mail.`
|
|
35
|
+
|
|
36
|
+
✅ `L4: native: moment.js imported for one format call. Intl.DateTimeFormat, 0 deps.`
|
|
37
|
+
|
|
38
|
+
✅ `repo.py:L88: yagni: AbstractRepository with one implementation. Inline it until a second one exists.`
|
|
39
|
+
|
|
40
|
+
✅ `L52-71: delete: retry wrapper around an idempotent local call. Nothing replaces it.`
|
|
41
|
+
|
|
42
|
+
✅ `L30-44: shrink: manual loop builds dict. dict(zip(keys, values)), 1 line.`
|
|
43
|
+
|
|
44
|
+
## Scoring
|
|
45
|
+
|
|
46
|
+
End with the only metric that matters: `net: -<N> lines possible.`
|
|
47
|
+
|
|
48
|
+
If there is nothing to cut, say `Lean already. Ship.` and stop.
|
|
49
|
+
|
|
50
|
+
## Boundaries
|
|
51
|
+
|
|
52
|
+
Complexity only, correctness bugs, security holes, and performance go to a
|
|
53
|
+
normal review pass, not this one. A single smoke test or `assert`-based
|
|
54
|
+
self-check is the ponytail minimum, not bloat, never flag it for deletion.
|
|
55
|
+
Does not apply the fixes, only lists them.
|
|
56
|
+
"stop ponytail-review" or "normal mode": revert to verbose review style.
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# Zread Skill
|
|
2
|
+
|
|
3
|
+
This repository contains a skill for `zread`, a CLI that generates wiki-style
|
|
4
|
+
documentation for code repositories.
|
|
5
|
+
|
|
6
|
+
The skill is meant for one job: help an agent understand an unfamiliar codebase
|
|
7
|
+
through `zread` output instead of re-reading the entire repository file by file.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
### 1. Install the zread CLI
|
|
12
|
+
|
|
13
|
+
Install `zread` first. There are two supported installation methods:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install -g zread_cli
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
or
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
brew tap ZreadAI/homebrew-tap
|
|
23
|
+
brew install zread
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Then verify the installation:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
zread version
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### 2. Install this skill
|
|
33
|
+
|
|
34
|
+
Ask your AI agent to install the skill from GitHub:
|
|
35
|
+
|
|
36
|
+
```text
|
|
37
|
+
install this skill https://github.com/ZreadAI/zread-skill
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
If you prefer to install it manually, copy this directory into your local
|
|
41
|
+
skills directory:
|
|
42
|
+
|
|
43
|
+
| Agent | Skills directory |
|
|
44
|
+
| ----------- | ----------------------- |
|
|
45
|
+
| Claude Code | `~/.claude/skills/` |
|
|
46
|
+
| OpenClaw | `~/.openclaw/skills/` |
|
|
47
|
+
| Codex | `~/.agents/skills/` |
|
|
48
|
+
|
|
49
|
+
Example:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
cp -R zread ~/.claude/skills/zread
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Your final layout should look like this:
|
|
56
|
+
|
|
57
|
+
```text
|
|
58
|
+
<skills-dir>/zread/
|
|
59
|
+
SKILL.md
|
|
60
|
+
README.md
|
|
61
|
+
references/
|
|
62
|
+
stdio-protocol.md
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Once the folder is in place, an agent that supports `SKILL.md`-based skills can
|
|
66
|
+
load and use it.
|
|
67
|
+
|
|
68
|
+
## Features
|
|
69
|
+
|
|
70
|
+
- Read existing `./.zread/wiki/` output instead of crawling source files again
|
|
71
|
+
- Guide an agent to run `zread generate` safely when documentation does not
|
|
72
|
+
exist yet
|
|
73
|
+
- Use `--stdio` as the default mode for agent automation, instead of parsing
|
|
74
|
+
the interactive TUI
|
|
75
|
+
- Explain the role of `current`, `versions`, and `drafts` in zread output
|
|
76
|
+
- Include a reference for the `zread --stdio` JSON-line protocol
|
|
77
|
+
|
|
78
|
+
## When To Use
|
|
79
|
+
|
|
80
|
+
Use this skill when you want to:
|
|
81
|
+
|
|
82
|
+
- understand an unfamiliar repository quickly
|
|
83
|
+
- read an existing zread-generated wiki
|
|
84
|
+
- generate a repository overview or project wiki
|
|
85
|
+
- serve docs locally with `zread browse`
|
|
86
|
+
- drive `zread` programmatically from a script or agent
|
|
87
|
+
|
|
88
|
+
## How It Works
|
|
89
|
+
|
|
90
|
+
The skill follows a simple workflow:
|
|
91
|
+
|
|
92
|
+
1. If `./.zread/wiki/current` exists, read the generated wiki files directly.
|
|
93
|
+
2. If no wiki exists, run `zread generate` only when the user wants docs to be
|
|
94
|
+
generated.
|
|
95
|
+
3. Before generation, confirm with the user because generation consumes LLM
|
|
96
|
+
tokens and writes under `./.zread/`.
|
|
97
|
+
4. In automated workflows, use `--stdio`.
|
|
98
|
+
|
|
99
|
+
## Repository Layout
|
|
100
|
+
|
|
101
|
+
- `SKILL.md`: the skill definition, trigger conditions, and operating rules
|
|
102
|
+
- `references/stdio-protocol.md`: the `zread --stdio` machine protocol
|
|
103
|
+
- `appmap.log`: local artifact, not part of the skill itself
|
|
104
|
+
|
|
105
|
+
## zread Output
|
|
106
|
+
|
|
107
|
+
After a successful generation, zread typically writes:
|
|
108
|
+
|
|
109
|
+
- `./.zread/wiki/current`: the active wiki version id
|
|
110
|
+
- `./.zread/wiki/versions/<id>/wiki.json`: the generated page index
|
|
111
|
+
- `./.zread/wiki/versions/<id>/<file>`: the actual markdown pages
|
|
112
|
+
- `./.zread/wiki/drafts/`: unfinished generation state
|
|
113
|
+
|
|
114
|
+
If you need to integrate with `zread` programmatically, see
|
|
115
|
+
[references/stdio-protocol.md](./references/stdio-protocol.md).
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: zread
|
|
3
|
+
description: Produce and consume a wiki-style knowledge base for a code repository via the `zread` CLI and its on-disk output under `./.zread/wiki/`. Use this skill whenever the user wants to understand, onboard onto, explore, summarize, map, or get an overview of an unfamiliar codebase; asks for architecture docs, a project wiki, a repo walkthrough, module/package explanations, or "what does this repo do"; wants to generate, regenerate, resume, browse, or serve code documentation locally; or mentions zread / zread.ai directly. Also use it proactively before diving into a large unknown repo — if `./.zread/wiki/current` exists, read the generated pages instead of crawling source file-by-file; if it doesn't, consider offering to run `zread generate`. The trigger is the intent (understand a codebase through generated docs), not the literal word "zread".
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# zread skill
|
|
7
|
+
|
|
8
|
+
`zread` is a CLI that generates wiki documentation from code in the current
|
|
9
|
+
workspace using an LLM. Output lives under `./.zread/wiki/` in the workspace;
|
|
10
|
+
public repos can also be viewed at https://zread.ai.
|
|
11
|
+
|
|
12
|
+
This skill is intended for agent use. Read generated files directly from disk,
|
|
13
|
+
and use `--stdio` as the default mode for any zread command instead of trying
|
|
14
|
+
to parse the human TUI.
|
|
15
|
+
|
|
16
|
+
## On-disk layout (read these directly)
|
|
17
|
+
|
|
18
|
+
Always run `zread` from the workspace root. After a successful generation:
|
|
19
|
+
|
|
20
|
+
- `./.zread/wiki/current` — text file containing the active version id
|
|
21
|
+
(e.g. `2026-03-12-010203`).
|
|
22
|
+
- `./.zread/wiki/versions/<id>/wiki.json` — TOC: `{id, generated_at, language,
|
|
23
|
+
pages: [{slug, title, file, section, group, level}]}`.
|
|
24
|
+
- `./.zread/wiki/versions/<id>/<file>` — page markdown referenced by `pages[*].file`.
|
|
25
|
+
- `./.zread/wiki/drafts/` — in-progress generation; presence means a previous
|
|
26
|
+
run did not finish. `drafts/wiki.json` exists once the catalog phase
|
|
27
|
+
completed.
|
|
28
|
+
- `~/.zread/config.yaml` — global config (LLM provider, language, concurrency).
|
|
29
|
+
- `~/.zread/login.json` — presence indicates the user has logged in.
|
|
30
|
+
|
|
31
|
+
To answer questions about a codebase that already has zread output, read these
|
|
32
|
+
files directly with the file tools — do not invoke `zread browse`.
|
|
33
|
+
|
|
34
|
+
## Commands
|
|
35
|
+
|
|
36
|
+
| Command | Purpose | Key flags |
|
|
37
|
+
|---|---|---|
|
|
38
|
+
| `zread generate` | Generate wiki for cwd | `-y/--yes`, `--draft resume\|clear\|cancel`, `--skip-failed`, `--stdio` |
|
|
39
|
+
| `zread browse` | Serve docs at http://localhost:9681+ and open browser | `--generate`, `--version <id>`, `--host`, `--port`, `--stdio` |
|
|
40
|
+
| `zread login` | OAuth into BigModel/Z.AI to obtain an API key | `--custom`, `--model`, `--stdio` |
|
|
41
|
+
| `zread config` | Edit `~/.zread/config.yaml` | `--stdio` |
|
|
42
|
+
| `zread update` | Self-update CLI | `--stdio` |
|
|
43
|
+
| `zread version` | Print version | `--stdio` |
|
|
44
|
+
|
|
45
|
+
`--stdio` is supported on every command and turns the process into a JSON-line
|
|
46
|
+
machine protocol on stdin/stdout. See
|
|
47
|
+
[references/stdio-protocol.md](./references/stdio-protocol.md) for the wire
|
|
48
|
+
format (events, `waiting_for`, `done`, `quit`). Load it whenever zread is
|
|
49
|
+
invoked from another program/agent.
|
|
50
|
+
|
|
51
|
+
## Decision tree for an AI agent
|
|
52
|
+
|
|
53
|
+
1. **User wants to read existing wiki content?**
|
|
54
|
+
- Check `./.zread/wiki/current`. If present, read `wiki.json` and the page
|
|
55
|
+
markdown directly. No CLI invocation needed.
|
|
56
|
+
- For known *public* GitHub repos, prefer the `mcp__zread__*` tools
|
|
57
|
+
(`get_repo_structure`, `read_file`, `search_doc`) over running the CLI.
|
|
58
|
+
|
|
59
|
+
2. **User wants to (re)generate docs?**
|
|
60
|
+
- Confirm with the user first — `generate` is long-running, calls an LLM,
|
|
61
|
+
and writes files. Get explicit consent in unfamiliar directories.
|
|
62
|
+
- Verify `~/.zread/login.json` exists or `~/.zread/config.yaml` has an
|
|
63
|
+
`llm.api_key`. If neither, run `zread login` first.
|
|
64
|
+
- If `./.zread/wiki/drafts/` exists, decide:
|
|
65
|
+
- resume previous run → `zread generate --draft resume -y`
|
|
66
|
+
- throw away and start fresh → `zread generate --draft clear -y`
|
|
67
|
+
- Otherwise: `zread generate -y`.
|
|
68
|
+
- To not block on a few failing pages: add `--skip-failed`.
|
|
69
|
+
|
|
70
|
+
3. **User wants to view docs in a browser?**
|
|
71
|
+
- `zread browse` (add `--generate` to bootstrap if no wiki exists yet).
|
|
72
|
+
|
|
73
|
+
4. **User wants to script zread / consume output programmatically?**
|
|
74
|
+
- Use `--stdio` and follow stdio-protocol.md. Do not screen-scrape the TUI.
|
|
75
|
+
|
|
76
|
+
## Non-interactive invocation rules
|
|
77
|
+
|
|
78
|
+
- Always pass `-y` to `generate` when running unattended; otherwise it stops
|
|
79
|
+
at a catalog confirmation gate.
|
|
80
|
+
- Always set `--draft` explicitly when a draft may exist, so the command does
|
|
81
|
+
not prompt.
|
|
82
|
+
- For any command run from another agent/script, use `--stdio` so output is
|
|
83
|
+
parseable JSON instead of ANSI TUI frames.
|
|
84
|
+
- `zread` writes logs to `~/.zread/log/zread.log` — read this if a run fails
|
|
85
|
+
silently.
|
|
86
|
+
|
|
87
|
+
## Safety / blast radius
|
|
88
|
+
|
|
89
|
+
- `generate` consumes LLM tokens (real cost) and can run for many minutes on
|
|
90
|
+
large repos. Confirm before launching.
|
|
91
|
+
- `generate` writes only under `./.zread/` and does not commit anything to
|
|
92
|
+
git. It is safe to delete `./.zread/wiki/drafts/` to recover from a stuck
|
|
93
|
+
state.
|
|
94
|
+
- `update` replaces the zread binary in place and is hard to reverse — only
|
|
95
|
+
run it when the user explicitly asks.
|
|
96
|
+
- `login` opens a browser for OAuth; do not run it in a non-interactive
|
|
97
|
+
context unless the user has asked for it.
|
|
98
|
+
|
|
99
|
+
## Reference files
|
|
100
|
+
|
|
101
|
+
- [references/stdio-protocol.md](./references/stdio-protocol.md) — JSON-line
|
|
102
|
+
wire protocol shared by every command's `--stdio` mode. Load when
|
|
103
|
+
programmatically driving zread.
|