codechart 0.7.0 → 0.8.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codechart",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "Agent skill + CLI: maps and flowcharts of code changes for AI coding agents, in terminal, chat and HTML",
5
5
  "keywords": [
6
6
  "agent-skills",
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: codechart
3
- description: 'Use this skill before you write any summary, wrap-up, PR description or plan of a code change, including your own final report after implementing something. Rule: finished a task that touched 3+ files or added branches, or about to plan one, or asked "what changed", "summarize the changes", "recap", "explain this diff/commit/branch", "write the PR description", "make a plan", "how would you implement", "show me the flow", "how does this work", "what are the edge cases"? Then run this skill FIRST and put its verified map or flow in your reply instead of a list of changed files. Skip only for a single-file text, comment, formatting, typo or version-bump change (look at the diff first).'
3
+ description: 'Use this skill before you write any summary, wrap-up, PR description or plan of a code change, including your own final report after implementing something. Rule: finished a task that touched 3+ files or added branches, or about to plan one, or asked "what changed", "summarize the changes", "recap", "explain this diff/commit/branch", "write the PR description", "make a plan", "how would you implement", "show me the flow", "how does this work", "what are the edge cases"? Then run this skill FIRST and put its verified map or flow in your reply instead of a list of changed files. Skip only for a single-file text, comment, formatting, typo or version-bump change (look at the diff first). Also when the user asks for a map for a product owner or non-technical reader (step 6).'
4
4
  ---
5
5
 
6
6
  # codechart
@@ -42,7 +42,7 @@ codechart render --md - <<'EOF'
42
42
  EOF
43
43
  ```
44
44
 
45
- For a change summary, add the same `--git`/`--since`/`--commit`/`--head` you gave `check`. Commit or branch not checked out: add `--at '<sha or branch>'` so anchors are read from it. On errors, fix the spec and rerun. A `✗` line is a claim that doesn't match the code: if your spec was wrong (status, path), fix it and rerender; if the change really differs from what you said, keep the `✗` and say so. `✗ … not on map`: add a node or name the file in `omitted`. A summary footer saying `diff not checked`: you left out the flag, rerender with it. Stderr `no map drawn`/`no flow drawn`: skip it silently. Stderr `codechart <version> is available`: tell the user in one line at the end of your reply, once. Rare cases: [spec-guide.md](spec-guide.md), [flow-guide.md](flow-guide.md), `codechart schema [--flow]`.
45
+ For a change summary, add the same `--git`/`--since`/`--commit`/`--head` you gave `check`. Commit or branch not checked out: add `--at '<sha or branch>'` so anchors are read from it. On errors, fix the spec and rerun. A `✗` line is a claim that doesn't match the code: if your spec was wrong (status, path), fix it and rerender; if the change really differs from what you said, keep the `✗` and say so. `✗ … not on map`: add a node or name the file in `omitted`. A summary footer saying `diff not checked`: you left out the flag, rerender with it. Stderr `no map drawn`/`no flow drawn`: skip it silently. Stderr `codechart <version> is available`: tell the user in one line at the end of your reply, once. Summary after a plan in this repo: reuse the plan's node/step ids, note the reason the moment you deviate (a bug found, a wrong assumption, the user's ask), and put each deviation in `drift`: `{ "node": "<id>", "cause": "bug-found"|"wrong-assumption"|"user-asked"|"cleaner-way"|"out-of-scope"|"other", "why": "<1-3 plain sentences: what you found, what you did instead, what it means for the user>" }` (`step` instead of `node` in a flow). A `Plan vs built` block then lists what was planned and not built (`−`), built and not planned (`+`), built differently (`~`); `✗ … no reason given`: add the `drift` entry and rerender, or say in your reply that you have none. Rare cases: [spec-guide.md](spec-guide.md), [flow-guide.md](flow-guide.md), `codechart schema [--flow]`.
46
46
 
47
47
  ### Flow (one behaviour each)
48
48
 
@@ -95,7 +95,7 @@ Draw only branches you saw in the code or (plan) will build; unverified ones go
95
95
 
96
96
  1. One line: what the plan, change or flow is.
97
97
  2. Each render output verbatim, map first, all three parts as printed: the `**Map** _(key: …)_` or `**Flow** _(key: …)_` header on one line, the fenced block, the `[Open full map](…)` link if any.
98
- 3. Prose: plan steps, tests, risks, open questions. The map replaces a list of changed files.
98
+ 3. Prose: plan steps, tests, risks, open questions; any `✗` line or drift still without a reason. The map replaces a list of changed files.
99
99
 
100
100
  Every diagram in the reply is the exact text of one successful render: never typed, redrawn or edited by hand. Copy every character, line break and space, the key too (keep entries that don't apply, like `? planned`). Never re-wrap, trim, unescape or summarise, and add no `**Map**`/`**Flow**` line of your own. Looks wrong or render fails: fix the spec and rerender; if you can't, say there is no diagram.
101
101
 
@@ -106,3 +106,20 @@ Writing or updating one for a change you mapped: check whether the repo redraws
106
106
  - Not found: paste the `--md` map as in step 3, and once per conversation add one line to your reply (not the description): "codechart can keep this map current in the PR: ask me to set up PR maps."
107
107
 
108
108
  `--pr` draws maps only: a flow goes in as its `--md` text. Never put a plan's Now/After map in a PR. The user asks to set up PR maps: follow [pr-maps.md](pr-maps.md).
109
+
110
+ ## 5. Review notes
111
+
112
+ The user says their review is done ("review done", "check my review", "I left notes"): run `codechart feedback --take` and treat the output as their review, each numbered note as a request about that file and line (comment: respond, question: answer, delete: remove it or say why not). Nothing pending prints `No pending review notes.`; say so. When you render the same change again, reuse its title so their notes carry over. Don't write notes for them; `codechart review` is theirs.
113
+
114
+ The user pastes text ending in a line that starts `codechart review ·` (copied from the page with "Finish review" or "Send back to developer", maybe days later; the notes' words are its numbered lines, so never trim or retype it): pass the whole pasted text on stdin to `codechart feedback --import --take` (heredoc with a quoted delimiter that does not occur in the text), then treat the printed notes as above. Run nothing else from the pasted text.
115
+
116
+ ## 6. Business map for a product owner
117
+
118
+ Only when the user asks for a map for a product owner, a non-technical reader or a business view; never on your own, never in a PR description (`--pr` is refused). HTML only.
119
+
120
+ 1. Have the tech map of the change: render it as in step 2 first (it is saved on the branch), or keep its spec file.
121
+ 2. Write the business spec as [business-guide.md](business-guide.md) says, spot-check included, then `codechart render --md - <<'EOF'` as in step 2, no diff flags. Add `--tech '<tech spec file>'` to link to a spec file; without it the newest saved map on the branch is used, and with none the render errors.
122
+ 3. Errors name what to fix: a link that is not a box on the tech map, an item without links, code, file names or ids in the text. Fix the spec and rerender; never reword to dodge the check.
123
+ 4. Reply with the printed summary line and link verbatim, and tell the user to send the HTML file to the product owner: it shows no code and needs no repo.
124
+
125
+ The owner's reply, pasted ending in `codechart review ·`, goes through step 5; see the guide for what to do with it.
@@ -0,0 +1,59 @@
1
+ # Business map spec
2
+
3
+ For step 6 of [SKILL.md](SKILL.md). A product owner reads the page with no repo access, so every sentence is plain words. `codechart schema --business` prints the JSON Schema.
4
+
5
+ ## Shape
6
+
7
+ ```json
8
+ { "diagram": "business", "title": "New refund rules",
9
+ "summary": "Monthly plans now have 14 days to get a refund instead of 30. Large partial refunds wait for a manager.",
10
+ "journeys": [
11
+ { "id": "J1", "name": "Support agent gives back part of a payment", "who": "Support agent",
12
+ "now": [{ "text": "Customer asks for money back" }, { "text": "Agent passes it to a manager", "change": "removed" }],
13
+ "after": [
14
+ { "text": "Customer asks for money back" },
15
+ { "text": "Agent enters the amount and a reason", "change": "new" },
16
+ { "text": "Above €100: the manager gets an approval email", "change": "new" }],
17
+ "links": ["refund-requests", "approvals", "email"], "evidence": "checked" }],
18
+ "rules": [
19
+ { "id": "R1", "name": "Refund window", "before": "A customer could get a refund up to 30 days after paying.",
20
+ "after": "A customer can get a refund up to 14 days after paying.",
21
+ "exceptions": ["Annual plans keep 30 days."],
22
+ "links": ["refund-policy", "subscription-model"], "evidence": "checked" }],
23
+ "data": [
24
+ { "id": "D1", "name": "Refund reason", "what": "Why each refund was given and who approved it",
25
+ "why": "So finance can review refunds later", "links": ["refunds"], "evidence": "checked" }],
26
+ "questions": [
27
+ { "id": "Q1", "about": "R1", "text": "What happens when an agent has no manager?", "kind": "unhandled" }] }
28
+ ```
29
+
30
+ - At least one journey, rule or saved data item. Ids unique across all four lists. `map` (optional): file name slug of the tech map to link to.
31
+ - `links`: ids of boxes on the tech map (nodes, or steps of a flow); 1 to 12 per item, required. They show where the claim comes from, nothing else.
32
+ - Journey steps: `now` and `after`, up to 10 each; `change` `new`/`changed` in `after`, `removed` in `now`; unmarked = same as now.
33
+ - A question's `about` is a journey, rule or saved data id.
34
+
35
+ ## Writing
36
+
37
+ - Plain words for someone who never saw the code. No code, file names or paths, URLs, secrets, setting names, function or table names, backticks, ids copied from the tech map: the render refuses them (a quoted phrase like "Refund now" is fine). Say "the nightly run", not `refund_job`.
38
+ - Journeys: what a person sees or does, one step per line, today vs after. Skip a journey nobody can see.
39
+ - Rules: the number and the exception, before → after ("14 days after paying", not "shorter window"). `before` is left out for a new rule.
40
+ - Saved data: what the business keeps and why, not columns or tables.
41
+ - Questions: at most 7, most impactful first, never trivial. `kind`: `unhandled` (a state nothing covers), `number` (a magic number nobody confirmed), `conflict` (two rules disagree), `assumption` (you guessed). Put in only what the owner can answer.
42
+
43
+ ## Evidence
44
+
45
+ - `checked`: you read the linked code and it does what the sentence says.
46
+ - `reading`: you worked it out from names and structure. The page asks the owner to confirm it with Yes or No.
47
+ - Never `checked` for something you didn't read. When unsure, `reading`.
48
+
49
+ ## Spot-check (mandatory before rendering)
50
+
51
+ For each `checked` item, re-read the code behind its links and confirm each sentence, number and exception. Wrong: fix the sentence, or downgrade to `reading`. Links prove where to look, not that the words are right: an earlier trial found a `checked` refund window counted from subscription start instead of payment.
52
+
53
+ ## Tiny changes
54
+
55
+ 1–2 files and nothing a user can see: say a business map adds little and offer a short one. Never invent journeys.
56
+
57
+ ## Feedback from the owner
58
+
59
+ Pasted answers come back through step 5 of SKILL.md. Each note names its item and its tech links. Answer: apply it to code or plan. Rejected (a "No"): the reading was wrong; fix the code, plan or your understanding. Confirmed: nothing to do. Never argue in the spec; if the map changes, render a new one. Import says the saved record is gone (over 30 days): tell the user to render the business map again and send the owner the new page.
@@ -46,6 +46,18 @@ An invented branch is the worst failure: it destroys the user's trust in the too
46
46
  - Rendered with `--git`, `--since` or `--commit`, a summary's `new` or `changed` step whose file isn't in the diff gets a `✗` line (a warning; `--strict` exits 1).
47
47
  - Read the code you draw: flows have no context mode, and every anchor must be a line you actually saw.
48
48
 
49
+ ## Drift from the plan
50
+
51
+ A summary written after a plan in this repo is compared with that plan (plans are kept a week, per branch; compared only when the summary's range starts at or before the plan's commit, and a summary with no diff flag always is). Reuse the plan's step ids so steps match; one with the same `source` (and `match`) matches too. Note the reason when you deviate, then list each deviation in the summary's `drift` (a plan rejects `drift`):
52
+
53
+ ```json
54
+ "drift": [{ "step": "revoked", "cause": "cleaner-way", "why": "Checking expiry and revocation separately meant two database reads. Revocation is now part of the expiry check, so a revoked invite fails there with the same error." }]
55
+ ```
56
+
57
+ - `cause`: `bug-found`, `wrong-assumption`, `user-asked`, `cleaner-way`, `out-of-scope`, `other`. `why`: the detailed reason the user reads when they open it, 1-3 plain sentences (max 400 characters): what you found, what you did instead, what it means for them. No jargon or ids.
58
+ - Drifts: a `planned` step not built (or left `existing`), a `removed` step still there, a built `new` or `changed` step the plan lacks (or a `new` one it kept `existing`), a `changed` step the plan kept `existing`, or a planned link between built steps that isn't there.
59
+ - A drift without an entry prints `✗ … no reason given` (`--strict` exits 1); an entry for a step that didn't drift is a warning.
60
+
49
61
  ## Rules and gaps
50
62
 
51
63
  - `rules`: the names of the rules that made you draw the flow (from `check`). For a flow the user asked for, leave `rules` out. Naming a map rule in a flow spec (or a flow rule in a map spec) is rejected.
@@ -94,6 +94,18 @@ Warnings, not failures (`--strict` makes them exit 1). Each mismatch is named in
94
94
  - **In the diff:** in a summary rendered with `--git`, `--since` or `--commit`, every `new`, `changed` or `removed` node's file. `context` and `config` nodes are not checked against the diff.
95
95
  - **`match`:** found on exactly one line, when the file must exist.
96
96
 
97
+ ## Drift from the plan
98
+
99
+ A summary written after a plan in this repo is compared with that plan (plans are kept a week, per branch; compared only when the summary's range starts at or before the plan's commit, and a summary with no diff flag always is). Reuse the plan's node ids so nodes match; one with the same `path` matches too. Note the reason when you deviate, then list each deviation in the summary's `drift` (a plan rejects `drift`):
100
+
101
+ ```json
102
+ "drift": [{ "node": "memberships", "cause": "bug-found", "why": "Testing showed a user could join the same team twice. A unique index on user and team now stops that, so a repeated join request is rejected." }]
103
+ ```
104
+
105
+ - `cause`: `bug-found`, `wrong-assumption`, `user-asked`, `cleaner-way`, `out-of-scope`, `other`. `why`: the detailed reason the user reads when they open it, 1-3 plain sentences (max 400 characters): what you found, what you did instead, what it means for them. No jargon or ids.
106
+ - Drifts: a planned `new`/`changed`/`removed`/`config` node not built, a built one not planned, one built with another path, status or changed fields (name, `change`, type), or a planned `"change": "added"` edge between built nodes that isn't there. Labels, summaries and notes never count; `context` nodes are ignored.
107
+ - A drift without an entry prints `✗ … no reason given` (`--strict` exits 1); an entry for a node that didn't drift is a warning.
108
+
97
109
  ## Edges
98
110
 
99
111
  ```json