codechart 0.1.3 → 0.2.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 CHANGED
@@ -108,26 +108,42 @@ That's it. Open your coding agent in any repo and try:
108
108
 
109
109
  Needs Node 22.12+. `install-skill` finds the agents you use and asks which ones get the skill. Existing installs are skipped (`--force` updates them). Skip the question with `--agent codex,gemini`, or use `--dir <skills folder>` for anything else.
110
110
 
111
+ ### Optional: help agents remember it
112
+
113
+ Agents load a skill only when they think of it, and in long sessions they sometimes don't. `install-skill` then offers two opt-ins (both off by default; flags skip the question):
114
+
115
+ - **Reminder line** (`--reminder`): one line in your agents' global instructions file (`~/.claude/CLAUDE.md`, `~/.config/opencode/AGENTS.md`, `~/.codex/AGENTS.md`, `~/.gemini/GEMINI.md`) asking them to use codechart for changes that touch 3+ files or add branching behaviour. It sits between `<!-- codechart -->` markers.
116
+ - **Claude Code hook** (`--hook`): adds `codechart hook prompt` (UserPromptSubmit) and `codechart hook stop` (Stop) to `~/.claude/settings.json`. When a turn changed 3+ files and the reply has no diagram, Claude is asked once to follow the skill. Files you had already changed before the turn don't count.
117
+
118
+ ### Uninstall
119
+
120
+ ```bash
121
+ codechart uninstall && npm uninstall -g codechart
122
+ ```
123
+
124
+ `codechart uninstall` removes the skill, the reminder lines and the hooks (`--skill`, `--reminder`, `--hook` to pick some). npm can't run it for you: it has no uninstall scripts since v7. Skill folders holding other files keep them.
125
+
111
126
  **Works with** any agent that supports [Agent Skills](https://agentskills.io): Codex, Gemini CLI, GitHub Copilot, Cursor, OpenCode, Goose, Amp, Windsurf, Cline, Roo Code, Kiro, Junie, Factory Droid and Claude Code.
112
127
 
113
128
  ## What you get
114
129
 
115
130
  ### Maps: what changed and how it connects
116
131
 
117
- Tables, columns, enums, models, endpoints, components, config and env vars, grouped by layer and marked as new, changed, context or config. They work for **plans** too, so you can catch a wrong design before any code exists.
132
+ Tables, columns, enums, models, endpoints, components, config and env vars, grouped by layer and marked as new, changed, context or config. They work for **plans** too, so you can catch a wrong design before any code exists. A plan that changes existing code opens as **Now** and **After plan** side by side: same positions, panning together, with what the plan removes in red and what it adds in green.
118
133
 
119
134
  ### Flows: what the code actually does
120
135
 
121
- Decisions, edge cases and outcomes, each pointing at the source lines that implement it. Branches the agent didn't verify go under `gaps` instead of being drawn.
136
+ Decisions, edge cases and outcomes, each pointing at the source lines that implement it. Branches the agent didn't verify go under `gaps` instead of being drawn. A plan that changes existing behaviour also opens as **Now** and **After plan** side by side.
122
137
 
123
138
  ### Terminal first, page when it helps
124
139
 
125
- Small diagrams stay in the reply. Big ones, or rules you mark `output: both`, also get the self-contained HTML page: zoom, pan, light and dark themes, nothing loaded from the internet.
140
+ Small diagrams stay in the reply. Big ones, or rules you mark `output: both`, also get the self-contained HTML page: zoom, pan, light and dark themes, nothing loaded from the internet. In a change summary, clicking a node shows what changed in its file, read from git, so the agent spends no tokens on it.
126
141
 
127
142
  ## Why you can trust the diagram
128
143
 
129
144
  - **The agent writes data, codechart draws.** LLMs misalign hand-drawn ASCII, so the agent only describes nodes and links. Layout is code.
130
145
  - **Flows are anchored to real code.** Every step that exists in code names its `file:line` or quotes the line. If the line doesn't exist, the render fails and the agent has to fix it.
146
+ - **Map claims are checked.** Each node's file must exist, a quoted line must be in it, and in a change summary every new, changed or removed node must be in the git diff. A mismatch opens the output with a `✗` line; when everything matches, the footer just says `✓ 10 checked`.
131
147
  - **Gaps are explicit.** Whatever the agent didn't read is listed under `gaps`, not guessed.
132
148
  - **Validated input.** Specs are checked against a schema, with clear errors the agent can act on.
133
149
 
@@ -142,6 +158,8 @@ The CLI is small: a 46.5 kB package, 5 runtime dependencies, and a cold start ar
142
158
  - No network calls, no telemetry.
143
159
  - No shell: only read-only `git` and your OS opener, called with argument arrays.
144
160
  - HTML pages load nothing external, and all text is escaped. They're saved to `~/.cache/codechart`, never to your repo.
161
+ - A summary page rendered with `--git`, `--since` or `--commit` holds your code: each changed node's panel shows the start of its diff. Share such a page only where you'd share the diff.
162
+ - The optional hook keeps, per session, the names and content hashes of your changed files in `~/.cache/codechart/turns` (removed after 7 days), never their contents.
145
163
  - Audited before release across 8 areas, including untrusted repos and prompt-injected specs. See [docs/security-review.md](docs/security-review.md) and [SECURITY.md](SECURITY.md).
146
164
 
147
165
  ## Configure
@@ -191,11 +209,13 @@ Rules have a `name` plus exactly one of `paths` (globs: `*`, `**`, `?`, `[..]`;
191
209
  | Command | Purpose |
192
210
  |---|---|
193
211
  | `codechart check` | Which rules apply to changed files. `--files <csv>`, `--git`, `--commit <sha>`, `--since <base>` (+ `--head <ref>`), `--matched <csv>` |
194
- | `codechart render <spec>` | Render a spec (JSON file or `-` for stdin). `--output auto\|cli\|web\|both`, `--theme auto\|light\|dark`, `--open`, `--md`, `--at <rev>` |
212
+ | `codechart render <spec>` | Render a spec (JSON file or `-` for stdin). `--output auto\|cli\|web\|both`, `--theme auto\|light\|dark`, `--open`, `--md`, `--at <rev>`; `--git`, `--commit <sha>`, `--since <base>` (+ `--head <ref>`) to check claims against the diff; `--strict` to exit 1 on a mismatch |
195
213
  | `codechart schema` | Spec JSON schema; `--flow` for flow specs, `--config` for the config file |
196
214
  | `codechart config` | Config in effect and where each value comes from (`--json`) |
197
215
  | `codechart init` | Write a commented starter `.codechart.yaml` at the git root (`--force` to overwrite) |
198
- | `codechart install-skill` | Install the skill for the agents found in your home folder. `--agent <names>`, `--dir <path>`, `--force` to overwrite |
216
+ | `codechart install-skill` | Install the skill for the agents found in your home folder. `--agent <names>`, `--dir <path>`, `--force` to overwrite, `--reminder`, `--hook` |
217
+ | `codechart uninstall` | Remove the skill, reminder lines and hooks; `--skill`, `--reminder`, `--hook` to pick some |
218
+ | `codechart hook prompt\|stop` | Run by the Claude Code hook; reads the hook's JSON on stdin |
199
219
 
200
220
  </details>
201
221
 
@@ -204,6 +224,9 @@ Rules have a `name` plus exactly one of `paths` (globs: `*`, `**`, `?`, `[..]`;
204
224
  **My agent isn't on the list.**
205
225
  If it loads `SKILL.md` skills, run `codechart install-skill --dir <its skills folder>`. If not, the CLI still works for any agent that can run a command and write JSON: point it at `codechart schema` and `codechart render`.
206
226
 
227
+ **My agent asks permission for every render, even though I allowed `codechart`.**
228
+ The skill pipes the spec in with a heredoc (`codechart render --md - <<'EOF'`). In Claude Code, an allow rule like `Bash(codechart:*)` didn't cover that in our tests, so Claude Code asks before each render: approve it.
229
+
207
230
  **Will it draw a diagram for every tiny change?**
208
231
  No. One-file text, comment, formatting or version-bump changes are skipped. Flows only appear for logic with 2+ decisions or edge cases, or when you ask for one.
209
232