codechart 0.8.0 → 0.9.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/CHANGELOG.md +10 -0
- package/README.md +13 -1
- package/config.schema.json +47 -0
- package/dist/cli.js +1046 -453
- package/dist/server.js +5 -4
- package/package.json +1 -1
- package/skills/codechart/SKILL.md +10 -2
- package/skills/codechart/release-guide.md +37 -0
- package/templates/codechart.yaml +7 -0
package/dist/server.js
CHANGED
|
@@ -33,16 +33,17 @@ var JSON_ESCAPE = new RegExp(`[\\u007f-\\u009f\\u200b-\\u200f\\u2028\\u2029\\u20
|
|
|
33
33
|
var HIDDEN = new RegExp(`[\\u0000-\\u001f\\u007f-\\u009f\\u200b-\\u200f\\u202a-\\u202e\\u2060-\\u2069\\ufeff${EXTRA}]`, "u");
|
|
34
34
|
|
|
35
35
|
// src/rules/git-files.ts
|
|
36
|
-
function
|
|
37
|
-
if (platform !== "win32") return
|
|
36
|
+
function trustedBinary(name, platform = process.platform, env = process.env, exists = existsSync2) {
|
|
37
|
+
if (platform !== "win32") return name;
|
|
38
38
|
for (const raw of (env.PATH ?? env.Path ?? "").split(";")) {
|
|
39
39
|
const dir = raw.replace(/^"(.*)"$/, "$1");
|
|
40
40
|
if (!win32.isAbsolute(dir)) continue;
|
|
41
|
-
const file = win32.join(dir,
|
|
41
|
+
const file = win32.join(dir, `${name}.exe`);
|
|
42
42
|
if (exists(file)) return file;
|
|
43
43
|
}
|
|
44
|
-
throw new Error(
|
|
44
|
+
throw new Error(`${name} not found on PATH`);
|
|
45
45
|
}
|
|
46
|
+
var gitBinary = (platform, env, exists) => trustedBinary("git", platform, env, exists);
|
|
46
47
|
var gitPath;
|
|
47
48
|
var SAFE_ARGS = ["--no-optional-locks", "-c", "core.fsmonitor=false", "-c", "protocol.allow=never"];
|
|
48
49
|
var OutputTooLarge = class extends Error {
|
package/package.json
CHANGED
|
@@ -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). Also when the user asks for a map for a product owner or non-technical reader (step 6).'
|
|
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), or is preparing a release: version bump, changelog, release notes, tag (step 7).'
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# codechart
|
|
@@ -24,7 +24,7 @@ From the repo root, in the same Bash call as your first read of the change (`git
|
|
|
24
24
|
|
|
25
25
|
Single-quote every value. Only paste values made of letters, digits, spaces and `. _ / @ : + = , - [ ] ( ) ~ ^` that don't start with `-`; otherwise don't run it and tell the user why. Range unclear: ask once. Exit 2: fix the command.
|
|
26
26
|
|
|
27
|
-
Output is JSON: `pathMatches` lists matched path rules with `diagram`, `output`, `context`; `judgeBuiltins` names the built-ins below. No path match is normal. Unless the output has `toJudge` or `final` (below), always judge the built-ins (output `auto`) on the change or plan:
|
|
27
|
+
Output is JSON: `pathMatches` lists matched path rules with `diagram`, `output`, `context`; `judgeBuiltins` names the built-ins below. No path match is normal. A `release` object (`action`, `branch`, `version`, `path`) means a release branch: see step 7. Unless the output has `toJudge` or `final` (below), always judge the built-ins (output `auto`) on the change or plan:
|
|
28
28
|
- `related-files` (map, context `short`): more than 2 changed files depend on each other
|
|
29
29
|
- `behaviour-flow` (flow): the change adds or alters behaviour with at least 2 decisions or edge cases a reader would want to see
|
|
30
30
|
|
|
@@ -123,3 +123,11 @@ Only when the user asks for a map for a product owner, a non-technical reader or
|
|
|
123
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
124
|
|
|
125
125
|
The owner's reply, pasted ending in `codechart review ·`, goes through step 5; see the guide for what to do with it.
|
|
126
|
+
|
|
127
|
+
## 7. Release map
|
|
128
|
+
|
|
129
|
+
A PDF of what is already in main, for sales and stakeholders. It holds only facts you checked in the code, the PR text or the diff; never in a PR description.
|
|
130
|
+
|
|
131
|
+
Make one when the user asks (a release map, "what's in the next release", release notes for sales) or when `check` printed `release` (step 1): `action` `suggest`: end your reply with one line, once per conversation: "codechart can make a release map (a PDF of what's new, for sales): ask me."; `draw`: make it now, once; `done`: mention its `path` once and draw nothing. With no `release` in the output, when the user is preparing a release (version bump, changelog, release notes, tag) and didn't ask, end with that same line, once per conversation.
|
|
132
|
+
|
|
133
|
+
Run `codechart release-context`, write the spec as [release-guide.md](release-guide.md) says, then `codechart render --md - <<'EOF'` as in step 2, no diff flags and no `--tech`. Anything you can't confirm: ask the developer in chat before rendering, or leave it out; never guess. Reply with the printed PDF path and page link. Printed no PDF (no Chromium-based browser): say so and give the page link; Save as PDF from the browser.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Release map spec
|
|
2
|
+
|
|
3
|
+
For step 7 of [SKILL.md](SKILL.md). `codechart render` prints the page to a PDF for sales and stakeholders. Nobody reviews it: it shows what is already in main, so every sentence is a plain-words fact you checked in the code, the PR text or the diff. `codechart schema --release` prints the JSON Schema.
|
|
4
|
+
|
|
5
|
+
## Gather
|
|
6
|
+
|
|
7
|
+
Run `codechart release-context` (the merged changes since the last `v*` tag; `--since <tag>` to choose). Read the PR text, the tech map and the diff of each change you are unsure about. Group the changes into features a customer would name; one section per feature, up to 12. Leave out chores, dependency bumps, CI and release commits unless a user can see the effect.
|
|
8
|
+
|
|
9
|
+
## Shape
|
|
10
|
+
|
|
11
|
+
```json
|
|
12
|
+
{ "diagram": "release", "title": "What is new in Shop 2.0", "version": "2.0.0", "date": "2026-11-09", "since": "1.4.0",
|
|
13
|
+
"summary": "Customers get money back faster, and managers approve large refunds.",
|
|
14
|
+
"sections": [
|
|
15
|
+
{ "id": "refunds", "title": "Faster refunds", "change": "new", "pr": 41,
|
|
16
|
+
"summary": "Support agents give back part of a payment without asking a manager first.",
|
|
17
|
+
"journeys": [
|
|
18
|
+
{ "id": "J1", "name": "Support agent gives back part of a payment", "who": "Support agent",
|
|
19
|
+
"now": [{ "text": "Agent passes it to a manager", "change": "removed" }],
|
|
20
|
+
"after": [{ "text": "Agent enters the amount and a reason", "change": "new" }] }],
|
|
21
|
+
"rules": [{ "id": "R1", "name": "Manager approval", "after": "A refund above 100 euros waits for the agent's manager." }],
|
|
22
|
+
"data": [{ "id": "D1", "name": "Refund reason", "what": "Why each refund was given", "why": "So finance can review refunds later" }] },
|
|
23
|
+
{ "id": "receipts", "title": "Receipts no longer go to spam", "change": "fixed", "summary": "Receipt emails reach the inbox again." }] }
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
- `change`: `new` (did not exist), `changed` (works differently), `fixed` (was wrong, now works). `pr` is optional and not shown. `since` is the previous version. `date` is `YYYY-MM-DD`.
|
|
27
|
+
- Items are the business map's without `links`, `evidence` and `questions`: no tech map, no trust tag, nothing for anyone to answer. A spec with `questions` or `evidence` is refused. Per section at most 4 journeys, 6 rules, 4 saved data items; a small fix may be just a summary.
|
|
28
|
+
- Ids unique across the whole page, section ids included.
|
|
29
|
+
- Write the items as [business-guide.md](business-guide.md) says: plain words, steps today vs after, the number and the exception, what is kept and why. The render refuses code, file names, paths, URLs, setting names, secrets and ids.
|
|
30
|
+
|
|
31
|
+
## Only checked facts
|
|
32
|
+
|
|
33
|
+
For every sentence, number and exception, re-read the code, the PR text or the diff behind it and confirm it. If you can't: ask the developer in chat before rendering, or leave it out. Never guess, and never write "probably" or soften it into something vaguer. Check that each section's `change` matches what the PRs did.
|
|
34
|
+
|
|
35
|
+
## After rendering
|
|
36
|
+
|
|
37
|
+
Reply with the PDF path and the page link from the printed output. The PDF needs a Chromium-based browser (Chrome, Chromium, Edge, Brave); without one the render prints a warning and keeps the page, which can be saved as a PDF from any browser's print window. To change the PDF, fix the spec and render again.
|
package/templates/codechart.yaml
CHANGED
|
@@ -15,6 +15,13 @@
|
|
|
15
15
|
# open: auto (auto | always | never; auto opens new HTML in your browser inside VS Code-based editors, whose links show the source)
|
|
16
16
|
# Also global only: updateCheck: true (look up the newest codechart on npm at most once a day; false turns it off)
|
|
17
17
|
|
|
18
|
+
# release: # release maps
|
|
19
|
+
# product: My Product # product name on the cover (default: the repo name)
|
|
20
|
+
# logo: docs/logo.svg # repo-relative .svg or .png, at most 200 KB
|
|
21
|
+
# branches: ["v[0-9]*", "release-*", "release/*"] # on these branches `codechart check` tells the agent about the release map
|
|
22
|
+
# auto: suggest # suggest | draw | off: offer a release map, draw it, or stay quiet on those branches
|
|
23
|
+
# Global only: release.browser: /path/to/chrome # Chromium-based browser that prints the PDF (default: Chrome, Chromium, Edge or Brave where they are usually installed)
|
|
24
|
+
|
|
18
25
|
# useBuiltinRules: true # common migration and model paths, "more than 2 changed files depend on each other", and behaviour-flow
|
|
19
26
|
|
|
20
27
|
# Rules run top-down, before the built-in ones; per diagram type, for each file the first matching path rule wins.
|