@accord-dev/accord 0.7.0 → 0.7.1
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 +10 -10
- package/dist/cli.js +173 -35
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ Accord adds a small, fixed folder to your repository. Before an agent writes cod
|
|
|
8
8
|
|
|
9
9
|
BA, designer, developer and reviewer are four stages a ticket passes through, not four job titles. One person can pass through all four, or four people on a team can divide them. No gate reads who anyone is, so the same rules hold either way.
|
|
10
10
|
|
|
11
|
-
Released: `@accord-dev/accord@0.7.
|
|
11
|
+
Released: `@accord-dev/accord@0.7.1` on npm. See [docs/design.md](https://github.com/ngothanhluan/accord/blob/main/docs/design.md) for the design and the reasoning behind it.
|
|
12
12
|
|
|
13
13
|
## The problem
|
|
14
14
|
|
|
@@ -37,13 +37,13 @@ AI coding agents produce features that pass their own tests and still miss what
|
|
|
37
37
|
Node 22.12 or newer. Run accord through npx with an exact version, so nothing needs installing:
|
|
38
38
|
|
|
39
39
|
```sh
|
|
40
|
-
npx --yes @accord-dev/accord@0.7.
|
|
40
|
+
npx --yes @accord-dev/accord@0.7.1 <command>
|
|
41
41
|
```
|
|
42
42
|
|
|
43
43
|
Or install it globally and run `accord <command>`:
|
|
44
44
|
|
|
45
45
|
```sh
|
|
46
|
-
npm i -g @accord-dev/accord@0.7.
|
|
46
|
+
npm i -g @accord-dev/accord@0.7.1
|
|
47
47
|
```
|
|
48
48
|
|
|
49
49
|
The global install must be the same version the repository pins (see [Version pin](#8-version-pin-and-upgrading)).
|
|
@@ -53,7 +53,7 @@ The global install must be the same version the repository pins (see [Version pi
|
|
|
53
53
|
In the repository root:
|
|
54
54
|
|
|
55
55
|
```sh
|
|
56
|
-
npx --yes @accord-dev/accord@0.7.
|
|
56
|
+
npx --yes @accord-dev/accord@0.7.1 init
|
|
57
57
|
```
|
|
58
58
|
|
|
59
59
|
`init` asks nothing and takes no options. It never overwrites `accord/config.yml`, the product files or the workflow when they exist. The skill, agent and pane copies are accord's own and are rewritten to this version, and the hooks are merged into existing settings. Each path is printed as `created`, `skipped`, `appended`, `updated`, `unchanged` or `overwrote local edits`. It writes:
|
|
@@ -76,7 +76,7 @@ git commit -m "accord init"
|
|
|
76
76
|
git push
|
|
77
77
|
```
|
|
78
78
|
|
|
79
|
-
Teammates get the same skills, hooks and pane by pulling. The skills run a bare `accord` command. In Claude Code, the session hook tells the agent to run it through `npx` at the pinned version when `accord` is not on PATH. In Codex, Cursor and Copilot there is no such hook, so each person installs the pinned version globally (`npm i -g @accord-dev/accord@0.7.
|
|
79
|
+
Teammates get the same skills, hooks and pane by pulling. The skills run a bare `accord` command. In Claude Code, the session hook tells the agent to run it through `npx` at the pinned version when `accord` is not on PATH. In Codex, Cursor and Copilot there is no such hook, so each person installs the pinned version globally (`npm i -g @accord-dev/accord@0.7.1`).
|
|
80
80
|
|
|
81
81
|
### 4. Make the accord check a merge gate
|
|
82
82
|
|
|
@@ -128,14 +128,14 @@ In Claude Code, the pane shows the dashboard beside the chat.
|
|
|
128
128
|
After you change `runtimes:`, write the copies again and commit what it prints:
|
|
129
129
|
|
|
130
130
|
```sh
|
|
131
|
-
npx --yes @accord-dev/accord@0.7.
|
|
131
|
+
npx --yes @accord-dev/accord@0.7.1 skills sync
|
|
132
132
|
```
|
|
133
133
|
|
|
134
134
|
`skills sync` deletes no copy you may still use. When you remove a runtime, it lists the copies it no longer writes, and you delete them yourself. The one file it deletes is `.claude/agents/accord-architect.md`, an agent accord no longer has, and only while its marker shows nobody edited it: it prints `removed` for it, and lists an edited copy with the others.
|
|
135
135
|
|
|
136
136
|
### 7. CLI commands for people and CI
|
|
137
137
|
|
|
138
|
-
The skills call the CLI for you. These are the commands most useful to run by hand or in CI. Bare `accord` needs the global install at the pinned version; without it, put `npx --yes @accord-dev/accord@0.7.
|
|
138
|
+
The skills call the CLI for you. These are the commands most useful to run by hand or in CI. Bare `accord` needs the global install at the pinned version; without it, put `npx --yes @accord-dev/accord@0.7.1` in place of `accord`. Run `accord --help` for the full list, and `accord <command> --help` for each one.
|
|
139
139
|
|
|
140
140
|
| Command | What it does |
|
|
141
141
|
|---|---|
|
|
@@ -157,15 +157,15 @@ The skills call the CLI for you. These are the commands most useful to run by ha
|
|
|
157
157
|
|
|
158
158
|
### 8. Version pin and upgrading
|
|
159
159
|
|
|
160
|
-
`accord/config.yml` pins an exact version in its `accord:` key, and the CI workflow and Claude Code hooks use the same one. Every command that reads the repository refuses with exit 2 when the running version differs (on a version mismatch the `prompt-expansion` and `pre-tool-use` hooks only warn, so the prompt or the agent dispatch goes on), and names the command to run instead, with the pinned version in place of 0.7.
|
|
160
|
+
`accord/config.yml` pins an exact version in its `accord:` key, and the CI workflow and Claude Code hooks use the same one. Every command that reads the repository refuses with exit 2 when the running version differs (on a version mismatch the `prompt-expansion` and `pre-tool-use` hooks only warn, so the prompt or the agent dispatch goes on), and names the command to run instead, with the pinned version in place of 0.7.1:
|
|
161
161
|
|
|
162
162
|
```sh
|
|
163
|
-
npx --yes @accord-dev/accord@0.7.
|
|
163
|
+
npx --yes @accord-dev/accord@0.7.1 <command>
|
|
164
164
|
```
|
|
165
165
|
|
|
166
166
|
There is no flag or environment variable that skips the check. Only `--version`, `--help` and `upgrade` run regardless.
|
|
167
167
|
|
|
168
|
-
`/accord` says when a newer release is out. `/accord upgrade` runs `upgrade` as the newer version, which pushes a branch `upgrade/<version>` from the remote default branch with one commit that moves the pin and regenerates the skill files. Your checkout is not touched; merge the pull request to upgrade. A repository still pinned to 0.1.0 runs `npx --yes @accord-dev/accord@0.7.
|
|
168
|
+
`/accord` says when a newer release is out. `/accord upgrade` runs `upgrade` as the newer version, which pushes a branch `upgrade/<version>` from the remote default branch with one commit that moves the pin and regenerates the skill files. Your checkout is not touched; merge the pull request to upgrade. A repository still pinned to 0.1.0 runs `npx --yes @accord-dev/accord@0.7.1 upgrade` once by hand.
|
|
169
169
|
|
|
170
170
|
Exit codes:
|
|
171
171
|
|
package/dist/cli.js
CHANGED
|
@@ -22230,7 +22230,7 @@ const templates = {
|
|
|
22230
22230
|
"glossary.md": "# Glossary\n\n<!-- BA. One term per entry: the word the team actually uses and its business meaning. Agents and tickets use these terms verbatim. -->\n\n- **Sample term** — what the term means to the business, in one sentence\n- **Another sample term** — replace both entries with the words your team actually uses\n",
|
|
22231
22231
|
"prototype-header.html": "<!--\naccord prototype for ticket TICKET-ID\nDerived from: <list the stylesheets or token files this prototype was built from, one per line>\nRule: use only colours and spacing from those files; the token rule (lint) warns on hard-coded values\nOwner: designer (assets/<id>/ is designer-owned)\n-->\n<!doctype html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\">\n<title>TICKET-ID prototype</title>\n</head>\n<body>\n</body>\n</html>\n",
|
|
22232
22232
|
"ruleset.md": "# accord rules\n\nThese hold for every reply here, for the main session and every accord agent.\n\n1. Ask about intent, never guess it. A question that touches the intent, a veto, an acceptance criterion, or\n a public interface stops the work until the owner answers. Any other decision you take is a Ruling,\n `Ruling: <what> — <why> — <cost if wrong>`. The main session writes it to the ticket's ledger; an accord\n agent lists its Rulings in its report and never writes the ledger unless its own instructions say so.\n2. When the owner corrects you, write the correction verbatim under the ticket's `## Corrections` before\n doing anything else. A correction that exists only in the conversation is lost at the next compaction.\n3. Scope is impact: every caller, test, fixture, config entry, and export the change must reach. Anything\n beyond that is extra, and extra is not done.\n4. Take the lightest change that fully works: does it need to exist; is it already in the repository; the\n standard library or platform; an installed dependency; then the minimum new code. Never cut validation at\n trust boundaries, data-loss handling, security, accessibility, or anything the owner asked for.\n5. Evidence before claims. Say something works only after running what proves it, and show the output. Whoever\n made a change never grades it.\n6. Tests: one behaviour test per acceptance criterion, named by its `@test:<id>` tag, written first, at the\n cheapest layer that observes the behaviour. Any other test names a risk with `risk:<kind>`. No test that\n restates the implementation or only asserts on mocks.\n7. End every reply with one or two lines: what was skipped, what was not checked, and any risk the owner\n must know. When your instructions fix the shape of your report, these lines go inside that report, within\n its limits.\n8. Every commit, by the main session or any agent, follows `accord/product/conventions.md` when that file exists.\n\nRun accord as `{{invocation}}` when `accord` is not on PATH.\n",
|
|
22233
|
-
"security.md": "# Security review\n\n<!-- One pattern or check per list line. Pattern: `- <id>: path <entry>[, <entry>…] — <what it guards>` or `- <id>: line /<regex>/[i] — <what it guards>`. An id matches `^[a-z0-9][a-z0-9-]*$`. A path entry ending in `/` is a folder prefix, an entry with no `/` is a file name at any depth, any other entry is one exact path; there is no glob. A line regex is a JavaScript regular expression whose only allowed flag is `i`. Checklist: `- <id>: <check>`. A change that matches a pattern needs the security reviewer, who reads the checklist. A default is removed only by a `- Removed: <id> — <reason>` line under `## Removed`, with the owner's yes; `security-config` cannot be removed, so a change to this file always calls the security reviewer. A team adds a pattern or a check by adding a line with a new id. -->\n\n## Patterns\n\n- spawn: line /\\b(spawn|spawnSync|exec|execSync|execFile|execFileSync|fork|child_process|subprocess|Popen|os\\.system)\\b/ — process spawn\n- file-write: line /\\b(writeFile|writeFileSync|appendFile|appendFileSync|createWriteStream|rmSync|rmdirSync|unlink|unlinkSync|rename|renameSync|copyFile|copyFileSync|symlink|symlinkSync)\\b/ — file writes\n- built-path: line /\\b(join|resolve|normalize)\\s*\\(.*\\b(input|argv|args?|params?|query|body|req|request)\\b/ — paths built from input\n- ci-workflow: path .github/workflows/ — CI workflow files\n- manifest: path package.json, package-lock.json, npm-shrinkwrap.json, yarn.lock, pnpm-lock.yaml, requirements.txt, pyproject.toml, poetry.lock, go.mod, go.sum, Cargo.toml, Cargo.lock, Gemfile, Gemfile.lock — dependency manifests\n- secret-name: line /\\b(secrets?|tokens?|passwords?|passwd|api[_-]?keys?|credentials?|private[_-]?keys?|auth|authn|authz|authenticat\\w*|authori[sz]\\w*)\\b/i — auth and secret or token names\n- security-config: path accord/product/security.md, accord/config.yml — the security trigger list
|
|
22233
|
+
"security.md": "# Security review\n\n<!-- One pattern or check per list line. Pattern: `- <id>: path <entry>[, <entry>…] — <what it guards>` or `- <id>: line /<regex>/[i] — <what it guards>`. An id matches `^[a-z0-9][a-z0-9-]*$`. A path entry ending in `/` is a folder prefix, an entry with no `/` is a file name at any depth, any other entry is one exact path; there is no glob. A line regex is a JavaScript regular expression whose only allowed flag is `i`. Checklist: `- <id>: <check>`. A change that matches a pattern needs the security reviewer, who reads the checklist. A default is removed only by a `- Removed: <id> — <reason>` line under `## Removed`, with the owner's yes; `security-config` cannot be removed, so a change to this file always calls the security reviewer. A team adds a pattern or a check by adding a line with a new id. -->\n\n## Patterns\n\n- spawn: line /\\b(spawn|spawnSync|exec|execSync|execFile|execFileSync|fork|child_process|subprocess|Popen|os\\.system)\\b/ — process spawn\n- file-write: line /\\b(writeFile|writeFileSync|appendFile|appendFileSync|createWriteStream|rmSync|rmdirSync|unlink|unlinkSync|rename|renameSync|copyFile|copyFileSync|symlink|symlinkSync)\\b/ — file writes\n- built-path: line /\\b(join|resolve|normalize)\\s*\\(.*\\b(input|argv|args?|params?|query|body|req|request)\\b/ — paths built from input\n- ci-workflow: path .github/workflows/ — CI workflow files\n- manifest: path package.json, package-lock.json, npm-shrinkwrap.json, yarn.lock, pnpm-lock.yaml, requirements.txt, pyproject.toml, poetry.lock, go.mod, go.sum, Cargo.toml, Cargo.lock, Gemfile, Gemfile.lock — dependency manifests\n- secret-name: line /\\b(secrets?|tokens?|passwords?|passwd|api[_-]?keys?|credentials?|private[_-]?keys?|auth|authn|authz|authenticat\\w*|authori[sz]\\w*)\\b/i — auth and secret or token names\n- security-config: path accord/product/security.md, accord/config.yml, .gitattributes — the security trigger list, the generated paths it skips and the diff attributes that can hide a file from the scan\n\n## Checklist\n\n- injection: no input reaches a shell, a query or an eval unescaped; a command runs with an argument list, never a joined string\n- path-traversal: no path built from input leaves its root through .., an absolute path or a link before it is read or written\n- secrets: no secret, token or key is written to a file, a log, an error message or a commit\n- untrusted-input: input from a file, the network, an environment variable or another process is checked before use\n- ci-permissions: a workflow asks only the permissions it needs and never runs a fork's code with secrets\n- new-dependencies: each new dependency is needed, maintained and pinned\n- hook-commands: a hook or script command takes no text a user or a repository controls\n- authorisation: each action checks that its caller may perform it\n\n## Removed\n\n<!-- - Removed: <id> — <reason> -->\n",
|
|
22234
22234
|
"ticket-build.md": "---\nid: \"TICKET-ID\" # equals the file name: tickets/<id>.md\ntitle: \"Short title in business language\"\ntype: story # epic | story | bug. story and bug touch code and need at least one tagged scenario\nstatus: draft # draft | open | archived | dropped. Document lifecycle only; work status stays in the tracker. draft blocks Ready\n# The epic this ticket belongs to. Grouping is by parent; there is no per-epic folder.\n# parent: \"EPIC-ID\"\n# Ids in the tracker, a map keyed by adapter name; values are strings.\n# tracker: { github-issues: \"1234\" }\n# When true, Ready requires a design reference; the Intent note below says which one this profile expects.\nui: false\n# Optional design reference URL. Allowed on epics too.\n# design: \"https://example.com/design/...\"\n# Unconfirmed assumptions block Ready.\n# assumptions:\n# - { text: \"...\", confirmed: false }\n# Written by `gate ready`; never edit by hand.\n# ac_hash:\n# Developer self-test ticks, e.g. [ac-1, ac-2]. Only the developer writes it.\n# Always the last key so developer hunks stay far from BA hunks.\n# verified: []\n# The AC hash the ticks above were made against, copied from ac_hash at the moment of ticking.\n# verified_hash:\n# The commit sha those ticks were made against. Done fails unless both still equal the current values; a human writes both by hand.\n# verified_commit:\n---\n\n## Intent\n<!-- BA. Why, for whom, how success is measured, and explicit non-goals. About five lines.\nDescribe observable behaviour in business language; never name tables, endpoints, libraries, or screens.\nTerms go in product/glossary.md; rules already decided go in product/business-rules.md.\nIf the story has a screen, set ui: true in the frontmatter. Ready then requires a design link in design:. -->\n\n## Requirements\n<!-- BA. One EARS line per requirement: WHEN <trigger> the system SHALL <response>, and its siblings. 5 to 15 lines. -->\n\n## Acceptance criteria\n<!-- BA. One fenced gherkin block; every scenario tagged @ac-n with a unique n; 2 to 5 scenarios.\nA bug is written as Given the situation, When the action, Then the correct result.\nA scenario that is not @ui also carries one @test:<id> tag, where <id> is the case id from the test report (classname#name, spaces as -); add it after Ready, it is outside the AC hash. -->\n```gherkin\nFeature: TICKET-ID\n\n @ac-1\n Scenario: <observable outcome>\n Given ...\n When ...\n Then ...\n```\n\n## Open questions\n<!-- BA. `- [ ]` items; Ready stays blocked while any is unchecked. -->\n\n## Plan\n<!-- Developer fills this in. BA leaves it empty.\nA short plan only. Evidence goes to tickets/<id>/verification.md, written by the fresh review context, not by the agent that wrote the code. -->\n\n## Verification notes\n<!-- Developer, at Done. One \"### @ac-n <scenario name>\" block per ticked scenario, a few lines each: what was run and what was seen. This section stays last; evidence with a result lives in tickets/<id>/verification.md. -->\n",
|
|
22235
22235
|
"ticket-lane-r.md": "---\nid: \"TICKET-ID\" # equals the file name: tickets/<id>.md\ntitle: \"Short title in business language\"\ntype: story # story | bug\nstatus: draft # draft | open | archived | dropped. Document lifecycle only; work status stays in the tracker\nlane: R # R: a question answered by a research record, with a timebox and a token budget\n# Tickets that must reach done before this one can start.\n# depends_on: [\"OTHER-ID\"]\n# How the dashboard ranks this ticket: high | medium | low; absent means medium.\n# priority: medium\n# Ids in the tracker, a map keyed by adapter name; values are strings.\n# tracker: { github-issues: \"1234\" }\nui: false\n# Written by `gate ready`; never edit by hand.\n# ac_hash:\n---\n\n## Question\n<!-- One line: the question the research answers. -->\n\n## Timebox\n<!-- One line: <n> minutes or <n> hours. -->\n\n## Token budget\n<!-- One line: <n> weighted tokens; n may end in k or M. -->\n\n## Decisions\n<!-- The owner sets the timebox and the token budget; quote the answer: - D-01 Timebox <n> hours, token budget <n> weighted tokens — \"<the owner's sentence>\" -->\n\n## Vetoes\n<!-- Optional: what the owner forbids, in the owner's own words, one item per line. -->\n\n## Corrections\n<!-- Optional: every correction the owner makes, verbatim, appended and never edited. -->\n",
|
|
22236
22236
|
"ticket-lane-s.md": "---\nid: \"TICKET-ID\" # equals the file name: tickets/<id>.md\ntitle: \"Short title in business language\"\ntype: story # story | bug\nstatus: draft # draft | open | archived | dropped. Document lifecycle only; work status stays in the tracker\nlane: S # S: one small change, worked from this ticket alone\n# Tickets that must reach done before this one can start.\n# depends_on: [\"OTHER-ID\"]\n# How the dashboard ranks this ticket: high | medium | low; absent means medium.\n# priority: medium\n# Ids in the tracker, a map keyed by adapter name; values are strings.\n# tracker: { github-issues: \"1234\" }\nui: false\n# Written by `gate ready`; never edit by hand.\n# ac_hash:\n---\n\n## Understood\n<!-- One line: the change, as the request was understood. -->\n\n## Done when\n<!-- One line: the observable result that ends the work. -->\n\n## Scope\n<!-- One repository path per line, never a folder: every file the change is expected to touch, tests and new files included. -->\n",
|
|
@@ -22383,6 +22383,8 @@ const DEFAULT_SECURITY = parseSecurityFile(templates["security.md"]);
|
|
|
22383
22383
|
const SECURITY_FILE = "accord/product/security.md";
|
|
22384
22384
|
/** The one default no `Removed:` line takes out: D-06's control, that removing a default is a visible, reviewed change, depends on it. */
|
|
22385
22385
|
const UNREMOVABLE = "security-config";
|
|
22386
|
+
/** The path entries an earlier release's template gave a default that has since changed, so a security.md `accord init` wrote under that release still reads clean (the current default applies). */
|
|
22387
|
+
const EARLIER_ENTRIES = { "security-config": [["accord/product/security.md", "accord/config.yml"]] };
|
|
22386
22388
|
const sameValue = (a, b) => a.kind === b.kind && (a.kind === "path" ? (a.entries ?? []).length === (b.entries ?? []).length && (a.entries ?? []).every((e, i) => e === (b.entries ?? [])[i]) : a.source === b.source && (a.flags ?? "") === (b.flags ?? ""));
|
|
22387
22389
|
/**
|
|
22388
22390
|
* ST-LN-36 D-06: the patterns in force are the defaults, plus each pattern of the file whose id is not a default id, minus each default a
|
|
@@ -22400,7 +22402,10 @@ function mergeSecurity(file) {
|
|
|
22400
22402
|
if (d === void 0) {
|
|
22401
22403
|
teamIds.add(p.id);
|
|
22402
22404
|
added.push(p);
|
|
22403
|
-
} else if (!sameValue(p, d)
|
|
22405
|
+
} else if (!sameValue(p, d) && !(EARLIER_ENTRIES[p.id] ?? []).some((e) => sameValue(p, {
|
|
22406
|
+
...d,
|
|
22407
|
+
entries: e
|
|
22408
|
+
}))) problems.push({
|
|
22404
22409
|
line: p.line,
|
|
22405
22410
|
reason: `"${p.id}" is a default pattern with another kind or value, so the default applies; remove it with a "- Removed: ${p.id} — <reason>" line and add your own under a new id`
|
|
22406
22411
|
});
|
|
@@ -25397,8 +25402,8 @@ const skills$1 = {
|
|
|
25397
25402
|
"plan/critique.md": "---\nkind: reference\n---\n\n# The critique loop\n\nThe main session keeps every critic finding in\n`accord/tickets/<id>/plan-review.md`: one `## Round <n> (whole)` or\n`## Round <n> (diff)` section per round, each finding on one line as\n`<n>. <Must|Should|Nice> — <finding> — <state>`. The state is `open`,\n`fixed`, `deferred` for a Nice, `unverified: <reason>`, `withdrawn`,\n`repeated as <round>.<n>` when a critic carries it on under that number,\n`open, owner: \"<the owner's words>\"` for a fix the owner said to apply,\nor `owner: \"<the owner's words>\"` for one the owner dropped. After the\nstate the session copies the critic's marks, each as ` — <mark>`:\n`rests on: <the ticket line>`, `risk: data-loss` or `risk: security`,\n`test: <id>`, `command: <command>`. The separator is always ` — `, never a hyphen, and a risk is written exactly ` — risk: security` or ` — risk: data-loss` after the finding's text: accord reads a risk from that mark slot only, never from the finding's words, a note or a reason. A mark slot whose value does not parse (`risks: security`, `risk: data_loss`, `risk: security` in backticks or quotes) is a record problem, and `accord round <id> --plan` refuses it on a plan record written under accord 0.4.1 or later. A value that is no kind (`risk: none`) is prose. A finding stays `open` or `unverified` until a critic lists it after `fixed:` or\n`withdrawn:`, or the owner drops it; the planner's word alone closes\nnothing. A round with no findings says `No findings`. Only the sections\nafter the last `## Closed` line count; step 8 of the skill appends that\nline.\n\n`plan-review.md` starts with the line `Round record: 1`, above every heading; its only headings are `## Round <n> (whole)`, `## Round <n> (diff)` and `## Closed`. Before each round, and before step 8 of the skill appends `## Closed`, run `accord round <id> --plan`: exit 0 gives the round's number and the cap; it counts only the rounds after the last `## Closed` line: from accord 0.4.1 `accord round <id> --plan` counts at most three rounds, prints `stop: report to owner` from round 3 on a round that still reports a Should or a Must, and after any round whose Must + Should count did not fall from the round before, and on a third round that reports any finding; a ticket claimed under an older accord keeps five rounds and the stop from round 3 (`accord round <id> --plan` prints `of 5` for it), and a fifth round that reports any finding stops it. On a stop, stop and report to the owner what it prints, as `./ask.md` says, and ask whether to change course, accept the open findings, or allow more rounds. Write the answer as the last line `verdict: accepted-by-owner \"<the owner's sentence>\"` in `plan-review.md`, which ends the loop as step 4 says; or, to allow more rounds, as the ledger Ruling `Ruling: the owner allows <n> more plan critique rounds after round <r> of cycle <k> — \"<the owner's sentence>\" — <cost if wrong>`, with r and k as the stop printed them; or, for a change of course, as that same Ruling with n the rounds the owner gives the reworked plan, then the re-plan. A round after the stop, allowed by the owner, that reports no findings clears it. Never append `## Closed` while a stop holds. On a `refused:` that says the loop has ended, the loop is over: go to step 7 of the skill, or at step 8 append `## Closed`. On any other `refused:`, fix what it names and run it again.\n\n1. **Read.** Round 1 reads the output of `accord round <id> --plan` that\n the paragraph above runs before each round: when it holds\n `Critics: plan checker`, dispatch as below; when it holds no `Critics:`\n line, the ticket was claimed under an older accord: dispatch round 1 as\n `./legacy-round1.md` says, and every later round as below. Round 1 is\n `whole`. Judge from the ticket and the plan\n whether the ticket touches auth, money, migration, or data deletion,\n or the plan touches a path under `sensitive:` in `accord/config.yml`.\n Dispatch in parallel, each in a fresh context, mode `plan`, with the\n paths of the ticket and `plan.md`:\n - one `accord-critic`, no lens, the plan checker, which runs every\n check of its fixed checklist, for a plan of any size;\n - one more `accord-critic`, lens `security`, when the ticket touches\n auth, money, migration, or data deletion, or the plan touches a path\n under `sensitive:` in `accord/config.yml`.\n\n The security critic runs in round 1 only; later rounds, whole or diff,\n verify its fixes, and a finding marked `risk: data-loss` or\n `risk: security` blocks in every round. The plan checker and every\n `diff` critic check the plan against every Decision and every\n Correction of the ticket.\n\n Merge and de-duplicate their findings into one round, numbered within\n it, before the planner gets them. After a round that reports a Must,\n or that leaves a Must from an earlier round open or unverified (its\n section holds a Must, or `<m>` is above zero in step 5), the next\n round is `whole`, even when the owner dropped that Must: one\n `accord-critic` in a fresh context, no lens, mode `plan`, with the\n paths of the ticket, `plan.md`, and `plan-review.md`. After any other\n round the next is `diff`: write\n `git diff <that round's commit> -- accord/tickets/<id>/plan.md`, which\n holds the planner's fix, into a file outside the working tree, and\n dispatch one `accord-critic` in a fresh context, mode `diff`, with the\n paths of the ticket, `plan.md`, that file, and `plan-review.md`. A\n `diff` critic never reads the whole plan.\n2. **Record.** Append the round's section to `plan-review.md` and mark\n each new finding `open`. Mark `fixed` each finding a critic lists\n after `fixed:`, and `withdrawn` each one it lists after `withdrawn:`.\n When a new finding starts `repeats <round>.<n>:`, mark that earlier\n finding `repeated as <this round>.<n>`. A Nice goes to the ledger\n under `## Deferred`, marked `deferred`, and never to the planner.\n From round 2 (accord 0.4.1 and later), and from round 1 under the plan\n checker or the security critic when `accord round <id> --plan` refuses round 2 naming such a\n finding, a new Must or Should with none of the marks above is marked\n `deferred` too and goes to the ledger\n under `## Deferred` as\n `- plan <r>.<n>[ cycle <k>]: <finding> — failing case: <case>`\n (` cycle <k>` from cycle 2 on), never to the planner. A finding with a\n `risk:` mark is never deferred: it blocks in every round. A finding of\n the security critic with none of the marks is never deferred silently:\n ask that critic once for its `rests on:` line (`risk: security` for a\n security finding), and name any finding it still leaves unmarked to the\n owner with its deferral.\n3. **Owner.** A finding whose proposed fix relies on an API cited only\n by a URL outside the repository goes to the owner at once, as\n `./ask.md` says: show the finding, the fix, and the URL, and ask\n whether to apply or drop it. On apply its state becomes\n `open, owner: \"<the owner's words>\"`: it goes to the planner with\n those words, which confirm the API, and closes only when a critic\n lists it after `fixed:`. On drop its state becomes\n `owner: \"<the owner's words>\"`, which closes it.\n4. **Converged.** The loop ends only on a round that reports no Must\n and no Should and leaves no Must or Should open or unverified, or on\n the owner's acceptance after a stop, the last line\n `verdict: accepted-by-owner \"<the owner's sentence>\"` of\n `plan-review.md`, and only when the last `accord gate plan <id>`\n passed (after an acceptance, run it once more): go to step 7 of the\n skill.\n5. **Fix.** Otherwise commit `plan.md` and `plan-review.md` with the\n subject that `accord subject plan_round <id> round <n>, <m> Must, <s> Should` prints, where `<m>` and\n `<s>` count the Musts and the Shoulds after the last `## Closed` line\n that are `open` or `unverified` once this round is recorded; the next\n `diff` round reads from that commit. Dispatch `accord-planner` with the\n ticket path, the baseline, the mode, the path of `plan-review.md`, and\n every Must and Should that is `open` or `unverified`, never a Nice,\n each labelled `<round>.<n>` and listed with the owner's words it holds.\n The planner fixes every one and replies by that label. Write each\n `unverified: <reason>` it replies into the state of the finding with that\n label; a finding it reports fixed stays `open` until a critic lists it\n after `fixed:`. Tell the planner to change only the lines a finding\n needs, inside the tasks it names (`Task <n>` or `the preamble`).\n From accord 0.4.1, `accord round <id> --plan` lists the `plan.md`\n hunks outside the tasks the open findings of the cycle name and refuses\n them; on that refusal narrow the fix, or ask the owner, as `./ask.md`\n says, and write under `## Rulings` in the ledger\n `Ruling: the owner allows the plan fix after round <r> of cycle <k> to change <places> — \"<the owner's sentence>\" — <cost if wrong>`,\n where `<places>` is `Task <n>[, Task <m>…]`, `the preamble` or\n `the whole plan`; a re-plan after a change of course needs that Ruling\n with `the whole plan`. Then go back to step 4 of the skill.\n",
|
|
25398
25403
|
"plan/legacy-round1.md": "---\nkind: reference\n---\n\n# Round 1 of the plan critique of a ticket claimed under an older accord\n\nRead this file only when `accord round <id> --plan` printed no `Critics:`\nline at round 1: the ticket was claimed under an older accord, and step 1 of\n`./critique.md` sent you here. Round 1 dispatches as below; every later\nround, the record, the owner, convergence and the fix are those of\n`./critique.md`, and the cap and stop are what `accord round <id> --plan`\nprints for this ticket (five rounds and the stop from round 3).\n\nCount the `## Task` sections of `plan.md` and judge from the ticket and the\nplan whether the ticket touches auth, money, migration, or data deletion, or\nthe plan touches a path under `sensitive:` in `accord/config.yml`. Dispatch\nin parallel, each in a fresh context, mode `plan`, with the paths of the\nticket and `plan.md`:\n\n- one `accord-critic` with no named checks for a plan of one to three tasks;\n- two critics for a plan of four or more tasks, one told to run only the\n first, second, third, fifth and seventh checks under `Mode plan:` and one\n only the fourth and sixth;\n- one more critic, lens `security`, for a plan of any size whose ticket\n touches auth, money, migration, or data deletion, or whose plan touches a\n path under `sensitive:` in `accord/config.yml`, so at most three.\n\nA critic running every check or the first group, and every `diff` critic,\nchecks the plan against every Decision and every Correction of the ticket.\n\nThen merge and de-duplicate their findings into one round, numbered within\nit, as step 1 of `./critique.md` says.\n",
|
|
25399
25404
|
"review/SKILL.md": "---\nname: accord-review\ndescription: Use when every task of a lane M ticket has a ledger line and the work needs review. Dispatches reviewers on the review package, fixes patch findings through fresh executors until no Must is open and every Should is fixed, runs one final reviewer, and records each round in review.md.\nlicense: MIT\nargument-hint: \"[ticket id]\"\nkind: skill\nloads: [review/record.md, review/security.md, shared/ask.md]\n---\n\nThis stage reviews the built work against the ticket until it converges.\nYou run it in the main session and orchestrate: reviewers find, executors\nfix.\n\n## Steps\n\n1. Run `accord anchor`. When it prints `stages off for lane <L>:` naming review, do not run this stage: tell the\n owner so in one line and go to the stage it names next, `accord-verify`.\n\n2. **Package.** Run `accord review-package <id>` into a file outside the working tree. After a round with a head in\n `review.md`, it holds the commits, the stat, and the diff after that head, without what a merge brought in from\n the default branch; before round 1, from the plan's `baseline:` (when the plan stage is off there is none: from the default branch). It prints `Head: <sha>` for the round's heading,\n and lists under `## Undeclared files` every changed file no task's `files:` line names, and under\n `## Interface signs` each sign of a new interface the branch adds.\n\n3. **Reviewers.** Choose by the unit's diff size and risk:\n - up to about 500 changed lines: one `accord-reviewer`, lens `both`;\n - about 500 to 1500: an `intent` and a `quality` reviewer, in parallel;\n - over about 1500: split by area times lens, plus one `integration` reviewer reading only the\n interfaces and links between areas;\n - a security trigger in the package: add a `security` reviewer, as `./security.md` says.\n\n Name the lens in each dispatch. Every reviewer gets the paths of the ticket file, the review\n package, and `accord/tickets/<id>/ledger.md`. The executor's report is context, never evidence.\n\n4. **Classify.** De-duplicate the findings, then mark each one `patch`, `plan-gap`, or `intent-gap`.\n - Fix every Must and Should marked `patch` through `accord-build`'s executor path. Commit the round to `review.md` as\n `./record.md` says. Write a brief file outside the working tree: copy the ticket file byte\n for byte (never retype it), then append the findings to fix and ask for one `places checked: <n>: <path>[:<line>], …` line per finding. Dispatch a fresh `accord-executor` with its path and\n step 6's `model`, and route its stops as `accord-build` does.\n - When it reports, run the `tests.affected` command over the files the fix touched, or `tests.full`\n when `tests.affected` is not configured or finds no test file. If it fails, dispatch a fresh\n executor with the same brief plus the failing output, in the same round.\n - Copy every Ruling in its report, and each file outside the plan you accept, or that the fix changed with no\n finding of the round in it, as a Ruling naming the file and its reason, into\n `accord/tickets/<id>/ledger.md` under `## Rulings`; commit the ledger.\n - After every fix round, a Should-only one included, re-review only the fix diff:\n `accord review-package <id>` into a file outside the working tree, one\n reviewer, lens `both`, given the findings it re-checks and asked for one line each,\n `<r>.<n>: ADDRESSED <path>:<line>` or `<r>.<n>: NOT ADDRESSED <path>:<line>`; record its answers as `./record.md` says.\n - A plan gap goes back to `accord-plan` as a re-plan, where the critic runs again; with the plan stage off, stop and ask the owner.\n - An intent gap stops the run and asks the owner.\n - Nice findings go to the ledger under `## Deferred`, not fixed.\n\n5. **Converged** means no Must or Should is open, every fixed finding is answered `addressed:` (a NOT ADDRESSED one is reopened, as `./record.md` says), and that command passes; a finding deferred\n under `./record.md`'s evidence rule, with its `## Deferred` line, does not block it.\n\n6. **Cap.** Run `accord round <id>` before each round and before the verdict. Exit 0 prints `Round: <n> of <cap>` and\n `Fix executor model: <model>`. It counts at most five rounds, after verify counted from the first round after it, and\n tiers up from `escalation.fix_round_tier_up`. On `stop: report to owner` (a Should or a Must from round 3, or the cap)\n or `refused:`, act as `./record.md` says; never report the work finished. On `Re-review:`, re-review first; past the cap, on the owner's Ruling.\n\n7. **Final review.** After convergence, one fresh `accord-final-reviewer` reads the whole ticket once, from\n `accord review-package <id> --base <the plan's baseline:>` (when the plan stage is off, `--base <the default branch>`), its round headed `(final review)` (over about 1500\n changed lines, dispatch it with lens `integration`). If it finds a Must or a Should: one fix and one scoped re-review, as in\n step 4. If a Must or a Should is still open after that (a NOT ADDRESSED one is), stop and ask the owner.\n\n8. **Record.** Write every round to `accord/tickets/<id>/review.md` as `./record.md` says, ending `verdict: converged`, or,\n when the owner accepts any stop with findings still open, `verdict: accepted-by-owner` followed by the owner's sentence\n quoted. Commit it.\n\n9. Next: `accord-verify`.\n\n## Rules\n\n- Every agent receives the ticket verbatim, by file path, never a summary: an executor gets it inside\n its brief.\n- The main session orchestrates and never edits product code.\n- Anything touching intent, a veto, an acceptance criterion, or a public interface stops the run and\n asks the owner. Every other decision is a Ruling in `accord/tickets/<id>/ledger.md` under\n `## Rulings`: `Ruling: <what> — <why> — <cost if wrong>`. Read `./ask.md` before any question to the\n owner.\n",
|
|
25400
|
-
"review/record.md": "---\nkind: reference\n---\n\n# The review record\n\n`accord/tickets/<id>/review.md` holds one section per review round, in\norder, and ends with the verdict.\n\nIts first line is `Round record: 2`, above every heading, and its only headings are `## Round <n> head <sha>` and `## Return from verify <sha>`. A record whose first round was committed while `accord/config.yml` pinned accord 0.3.0 or earlier keeps its `Round record: 1` and its `## Round <n>` headings, without heads or marks, and its old packages: after committing a round, note the HEAD sha, and re-review a round with a Must with `accord review-package <id> --base <the noted sha>`; when `accord anchor` prints `Review base: <sha>`, build the package with `accord review-package <id> --base <sha>`. The marks, evidence, grounds, `## Deferred` line and fix-file rules below bind a `Round record: 2` record only; a version 1 record keeps its old rules.\n\n```\n## Round <n> head <sha>\n\nMust|Should|Nice <n> [patch|plan-gap|intent-gap]: <finding> — <path>[:<line>] | none — fixed in <sha> | deferred | open[ — <mark>]…\n```\n\n- One `## Round <n> head <sha>` section per round, the final review included, each\n listing that round's findings after merging and de-duplication, numbered\n within the round.\n- `<sha>` is the `Head: <sha>` line `accord review-package` printed for that round, the last commit it\n reviewed; accord checks in git that it lies between the previous round's head and the round's record. The\n heading ends ` (added code round 1)` when `accord round` printed `Added code:` before the round, and\n ` (final review)` on the final review, which is the last round or the one before it, until an owner allowance\n gives more rounds.\n- Each finding carries its severity, its class, what it is, where it is (one repository path, with `:<line>` when known, or\n `none`), and what became of it: `fixed in <sha>` with the fix commit, `deferred`\n for a Nice finding, or for a Must or Should only as the evidence rule below allows, written to the ledger under\n `## Deferred`, or `open`.\n- A finding line starts with its severity word, `Must`, `Should` or `Nice`, never two of them or a question mark: accord refuses a round record whose severity it cannot read.\n- After its state a finding line carries its marks, each after ` — `: `carried from <r>.<n>` when round `<r>` of\n this cycle reported it as finding `<n>`; `risk: data-loss` or `risk: security`; `test: <test id>` or\n `command: <command>` when a failing test or a command reproduces it; `rests on: ac-<n>`, `rests on: D-<nn>`,\n `rests on: Veto \"<quote>\"`, `rests on: Correction \"<quote>\"` (from accord 0.4.1) or `rests on: Intent \"<quote>\"`, a quote\n of at least three words from that section.\n- From accord 0.6.0 a finding `fixed in <sha>` also carries `checked: <path>[:<line>], …`, the places the executor's\n `places checked: <n>: …` line for that finding lists, copied (at least one real place: `none`, `n/a`, `-`, `TBD` or a\n `<…>` slot is refused). A fix's re-review is the next round of its cycle not headed `(added code round 1)`, or, for\n the last round of a cycle that `## Return from verify` closed, round 1 of the next cycle. Give that round's reviewer the\n fixed findings it re-checks; it answers each, `<r>.<n>: ADDRESSED <path>:<line>` or `<r>.<n>: NOT ADDRESSED <path>:<line> — <what still fails>`;\n write that answer on the finding it answers, in round `<r>`, as `addressed: <path>:<line>` or `not addressed: <path>:<line>`\n (an added-code round's reviewer may answer too, but is not asked to). `fixed in <sha>` records the fix only: a finding\n closes on its `addressed:` answer, never on `fixed in` alone. A NOT ADDRESSED finding is written again as an open\n finding, then fixed and re-reviewed like any other: within a cycle marked `carried from <r>.<n>`, in a round up to its\n re-review; across a cycle in round 1 of the next cycle, with no `carried from`, located in the same file (the finding's\n or the answer's) and at least as severe. A ticket claimed before 0.6.0 and a version 1 record keep their rules.\n- Rounds are counted within the cycle. From round 2 (accord 0.4.1 and later; round 3 before it) a Must or Should not\n carried from an earlier round, whose location is not a file the previous round's fix changed, blocks only with\n `test:`, `command:` or a `risk:` mark (from accord 0.6.0 only with a `risk:` mark, as the outside-diff rule below says). Otherwise write it `deferred` and add the line\n `- review <r>.<n> cycle <k>: <finding> — failing case: <case>` under `## Deferred` in the ledger (` cycle <k>` from\n cycle 2 on; before accord 0.4.1 the line ends at `<finding>`); it then leaves the stop from round 3.\n- The final review's own findings are asked no `test:`, `command:` or ticket line, though `accord round` still\n counts it as a round.\n- For a finding in a file that code reviewed in an `(added code round 1)` round changed, the count restarts at\n that round, per finding file; every other finding keeps the ticket's count.\n- The grounds rule uses the same count: from round 2 (accord 0.4.1 and later; round 3 and Shoulds only before it) a\n new Must or Should also needs `rests on:`, `test:`, `command:` or a `risk:` mark; without one, write it `deferred`\n with the ledger line above ending ` — failing case: <case>` (before accord 0.4.1 a Should is written as a Nice). A\n `risk:` finding is never deferred: it blocks in every round.\n- From accord 0.6.0 a Must or Should the re-review reports outside the fix diff (in a file the fix it re-reviews did not\n change, an `(added code round 1)` round in between not replacing that fix, or located `none`; not carried, not in an\n `(added code round 1)` or `(final review)` round, no `risk:` mark) is\n written `deferred` with the line `- review <r>.<n>[ cycle <k>]: <finding> — failing case: <case>` under `## Deferred`, and\n starts no round. A `risk: data-loss` or `risk: security` finding is never deferred, in any round: it stays an open numbered finding.\n- From accord 0.6.0 `accord round` and `accord gate done` refuse a fixed finding with no `checked:` mark, a fix with no\n answer once its re-review round exists, a NOT ADDRESSED finding not written again as above, and an outside-diff finding\n left open. A fix whose re-review round has not run yet is listed on `accord round`'s `Re-review:` line, and\n `accord gate done` refuses it: run that round before the verdict.\n- A round's fix is every commit after its head, up to the next round's head or, after the last round, to the\n last commit, but merges of the default branch, a debug episode's commits and commits that change only the\n ticket's records. Each file a fix changes is the location of a finding of that round, or a Ruling under\n `## Rulings` in the ledger names its path with a reason; a copy `accord skills sync` writes and a path under\n `generated:` in `accord/config.yml` need neither.\n- Each round is written as it ends, the final review included, with every finding `open`, and committed before any fix executor is dispatched; each state then becomes `fixed in <sha>` or `deferred`.\n- A round with no findings says `No findings`.\n- Every `Confirmed wording-only: <path>` and `Not an interface: <path> — <reason>` line a reviewer reports is copied verbatim, one per line, into that round's section. Only the last `## Round` is read for them, so the last round, the final review, carries every one that still holds.\n- Each round section but the final review's carries one line outside any finding, `Security: no pattern matched` or `Security: lens security ran`, as `./security.md` says. From accord 0.7.0 `accord round` and `accord gate done` refuse a round section with no `Security:` line, and a round whose package had triggers needs the second.\n\n`accord round <id>` reads this record. A round at or after `escalation.fix_round_tier_up` in `accord/config.yml` (default 4) dispatches a fresh executor one model tier above the executor's configured model, passed as `model` on the dispatch itself: `haiku`, then `sonnet`, then `opus`; `opus` stays `opus`. `accord round` prints that model as `Fix executor model: <model>`; pass it on every fix executor dispatch of the round. On `refused:`, fix what it names and run `accord round <id>` again.\n\nOn `stop: report to owner`, printed from round 3 for a round that still reports a Should or a Must, and at the cap, show the owner what it prints: the open findings and the Approach. Say whether the open findings trace to the ticket or the plan, and ask whether to change course, accept the open findings, or allow more rounds; never report the work finished. Write the owner's answer in one of three forms:\n\n- accepting the open findings: the last line of `review.md` is `verdict: accepted-by-owner \"<the owner's sentence>\"`;\n- allowing more rounds: under `## Rulings` in the ledger, `Ruling: the owner allows <n> more review rounds after round <r> of cycle <k> — \"<the owner's sentence>\" — <cost if wrong>`, with r and k as the stop printed them;\n- changing course: that same Ruling, with n the number of review rounds the owner names for the reworked code, written before a re-plan through `accord-plan`; after the rework the review goes on in the same cycle.\n\nAfter a stop, `verdict: converged` needs a round after it, allowed by the owner, that reports no findings.\n\nBefore writing the verdict, run `accord round <id>`. Exit 0, or a stop whose only `Reason:` is that the cap is reached and no owner Ruling allows more, lets the verdict be written; any other stop goes to the owner as above first. When exit 0 also prints `Added code:` (after a `(final review)` round, only code added after that round counts), run that round first, headed `(added code round 1)`, before the verdict. When it prints `Re-review:`, run that re-review round, given the fixes it names, before the verdict; at the cap `accord round` stops instead, naming them, and that round needs the owner's Ruling allowing one more round (`verdict: accepted-by-owner` answers no fix).\n\nThe single last line of the file is the verdict:\n\n- `verdict: converged` when, after the final review, no Must or Should is open, every fixed finding is answered `addressed:`, and the test command passes\n (a ticket claimed before 0.6.0: every Should is fixed, no answer needed): `tests.affected` over\n the files the fix touched, or `tests.full` when `tests.affected` is not\n configured or finds no test file; a Must or Should deferred under the\n evidence rule, with its `## Deferred` line, does not block it;\n- `verdict: accepted-by-owner \"<the owner's sentence>\"` when the run\n stopped with findings still open, at the cap or after the final\n re-review, and the owner accepted them, quoting what the owner said.\n\nNothing follows the verdict line until a return from verify.\n\nBack from verify, or back at review for any change made after the verdict, `accord anchor` prints `Review base: <sha>` while `review.md` ends with its verdict. Then, before the next round, run `git log -1 --format=%H -- accord/tickets/<id>/review.md` and append `## Return from verify <sha>` with the sha it prints; accord confirms from git that `review.md` ended with its verdict at that commit. The rounds after it are a new cycle counted from 1; a model tier once raised stays raised.\n",
|
|
25401
|
-
"review/security.md": "---\nkind: reference\n---\n\n# The security reviewer\n\nA round of review adds one more reviewer when the repository's list of risky patterns matches the round's diff. The list\nis `accord/product/security.md` (accord's defaults when the repository has none): a team adds a pattern under a new id,\nand removes a default only with a `- Removed: <id> — <reason>` line written on the owner's yes. A finding marked\n`risk: security` blocks in every round, whatever the list says.\n\n## Steps, in every round but
|
|
25405
|
+
"review/record.md": "---\nkind: reference\n---\n\n# The review record\n\n`accord/tickets/<id>/review.md` holds one section per review round, in\norder, and ends with the verdict.\n\nIts first line is `Round record: 2`, above every heading, and its only headings are `## Round <n> head <sha>` and `## Return from verify <sha>`. A record whose first round was committed while `accord/config.yml` pinned accord 0.3.0 or earlier keeps its `Round record: 1` and its `## Round <n>` headings, without heads or marks, and its old packages: after committing a round, note the HEAD sha, and re-review a round with a Must with `accord review-package <id> --base <the noted sha>`; when `accord anchor` prints `Review base: <sha>`, build the package with `accord review-package <id> --base <sha>`. The marks, evidence, grounds, `## Deferred` line and fix-file rules below bind a `Round record: 2` record only; a version 1 record keeps its old rules.\n\n```\n## Round <n> head <sha>\n\nMust|Should|Nice <n> [patch|plan-gap|intent-gap]: <finding> — <path>[:<line>] | none — fixed in <sha> | deferred | open[ — <mark>]…\n```\n\n- One `## Round <n> head <sha>` section per round, the final review included, each\n listing that round's findings after merging and de-duplication, numbered\n within the round.\n- `<sha>` is the `Head: <sha>` line `accord review-package` printed for that round, the last commit it\n reviewed; accord checks in git that it lies between the previous round's head and the round's record. The\n heading ends ` (added code round 1)` when `accord round` printed `Added code:` before the round, and\n ` (final review)` on the final review, which is the last round or the one before it, until an owner allowance\n gives more rounds.\n- Each finding carries its severity, its class, what it is, where it is (one repository path, with `:<line>` when known, or\n `none`), and what became of it: `fixed in <sha>` with the fix commit, `deferred`\n for a Nice finding, or for a Must or Should only as the evidence rule below allows, written to the ledger under\n `## Deferred`, or `open`.\n- A finding line starts with its severity word, `Must`, `Should` or `Nice`, never two of them or a question mark: accord refuses a round record whose severity it cannot read.\n- After its state a finding line carries its marks, each after ` — `: `carried from <r>.<n>` when round `<r>` of\n this cycle reported it as finding `<n>`; `risk: data-loss` or `risk: security`; `test: <test id>` or\n `command: <command>` when a failing test or a command reproduces it; `rests on: ac-<n>`, `rests on: D-<nn>`,\n `rests on: Veto \"<quote>\"`, `rests on: Correction \"<quote>\"` (from accord 0.4.1) or `rests on: Intent \"<quote>\"`, a quote\n of at least three words from that section.\n- From accord 0.6.0 a finding `fixed in <sha>` also carries `checked: <path>[:<line>], …`, the places the executor's\n `places checked: <n>: …` line for that finding lists, copied (at least one real place: `none`, `n/a`, `-`, `TBD` or a\n `<…>` slot is refused). A fix's re-review is the next round of its cycle not headed `(added code round 1)`, or, for\n the last round of a cycle that `## Return from verify` closed, round 1 of the next cycle. Give that round's reviewer the\n fixed findings it re-checks; it answers each, `<r>.<n>: ADDRESSED <path>:<line>` or `<r>.<n>: NOT ADDRESSED <path>:<line> — <what still fails>`;\n write that answer on the finding it answers, in round `<r>`, as `addressed: <path>:<line>` or `not addressed: <path>:<line>`\n (an added-code round's reviewer may answer too, but is not asked to). `fixed in <sha>` records the fix only: a finding\n closes on its `addressed:` answer, never on `fixed in` alone. A NOT ADDRESSED finding is written again as an open\n finding, then fixed and re-reviewed like any other: within a cycle marked `carried from <r>.<n>`, in a round up to its\n re-review; across a cycle in round 1 of the next cycle, with no `carried from`, located in the same file (the finding's\n or the answer's) and at least as severe. A ticket claimed before 0.6.0 and a version 1 record keep their rules.\n- Rounds are counted within the cycle. From round 2 (accord 0.4.1 and later; round 3 before it) a Must or Should not\n carried from an earlier round, whose location is not a file the previous round's fix changed, blocks only with\n `test:`, `command:` or a `risk:` mark (from accord 0.6.0 only with a `risk:` mark, as the outside-diff rule below says). Otherwise write it `deferred` and add the line\n `- review <r>.<n> cycle <k>: <finding> — failing case: <case>` under `## Deferred` in the ledger (` cycle <k>` from\n cycle 2 on; before accord 0.4.1 the line ends at `<finding>`); it then leaves the stop from round 3.\n- The final review's own findings are asked no `test:`, `command:` or ticket line, though `accord round` still\n counts it as a round.\n- For a finding in a file that code reviewed in an `(added code round 1)` round changed, the count restarts at\n that round, per finding file; every other finding keeps the ticket's count.\n- The grounds rule uses the same count: from round 2 (accord 0.4.1 and later; round 3 and Shoulds only before it) a\n new Must or Should also needs `rests on:`, `test:`, `command:` or a `risk:` mark; without one, write it `deferred`\n with the ledger line above ending ` — failing case: <case>` (before accord 0.4.1 a Should is written as a Nice). A\n `risk:` finding is never deferred: it blocks in every round.\n- From accord 0.6.0 a Must or Should the re-review reports outside the fix diff (in a file the fix it re-reviews did not\n change, an `(added code round 1)` round in between not replacing that fix, or located `none`; not carried, not in an\n `(added code round 1)` or `(final review)` round, no `risk:` mark) is\n written `deferred` with the line `- review <r>.<n>[ cycle <k>]: <finding> — failing case: <case>` under `## Deferred`, and\n starts no round. A `risk: data-loss` or `risk: security` finding is never deferred, in any round: it stays an open numbered finding.\n- From accord 0.6.0 `accord round` and `accord gate done` refuse a fixed finding with no `checked:` mark, a fix with no\n answer once its re-review round exists, a NOT ADDRESSED finding not written again as above, and an outside-diff finding\n left open. A fix whose re-review round has not run yet is listed on `accord round`'s `Re-review:` line, and\n `accord gate done` refuses it: run that round before the verdict.\n- A round's fix is every commit after its head, up to the next round's head or, after the last round, to the\n last commit, but merges of the default branch, a debug episode's commits and commits that change only the\n ticket's records. Each file a fix changes is the location of a finding of that round, or a Ruling under\n `## Rulings` in the ledger names its path with a reason; a copy `accord skills sync` writes and a path under\n `generated:` in `accord/config.yml` need neither.\n- Each round is written as it ends, the final review included, with every finding `open`, and committed before any fix executor is dispatched; each state then becomes `fixed in <sha>` or `deferred`.\n- A round with no findings says `No findings`.\n- Every `Confirmed wording-only: <path>` and `Not an interface: <path> — <reason>` line a reviewer reports is copied verbatim, one per line, into that round's section. Only the last `## Round` is read for them, so the last round, the final review, carries every one that still holds.\n- Each round section but a final review that follows a round of its stretch carries one line outside any finding, `Security: no pattern matched` or `Security: lens security ran`, as `./security.md` says. From accord 0.7.0 `accord round` and `accord gate done` refuse a round section with no `Security:` line, and a round whose package had triggers needs the second.\n\n`accord round <id>` reads this record. A round at or after `escalation.fix_round_tier_up` in `accord/config.yml` (default 4) dispatches a fresh executor one model tier above the executor's configured model, passed as `model` on the dispatch itself: `haiku`, then `sonnet`, then `opus`; `opus` stays `opus`. `accord round` prints that model as `Fix executor model: <model>`; pass it on every fix executor dispatch of the round. On `refused:`, fix what it names and run `accord round <id>` again.\n\nOn `stop: report to owner`, printed from round 3 for a round that still reports a Should or a Must, and at the cap, show the owner what it prints: the open findings and the Approach. Say whether the open findings trace to the ticket or the plan, and ask whether to change course, accept the open findings, or allow more rounds; never report the work finished. Write the owner's answer in one of three forms:\n\n- accepting the open findings: the last line of `review.md` is `verdict: accepted-by-owner \"<the owner's sentence>\"`;\n- allowing more rounds: under `## Rulings` in the ledger, `Ruling: the owner allows <n> more review rounds after round <r> of cycle <k> — \"<the owner's sentence>\" — <cost if wrong>`, with r and k as the stop printed them;\n- changing course: that same Ruling, with n the number of review rounds the owner names for the reworked code, written before a re-plan through `accord-plan`; after the rework the review goes on in the same cycle.\n\nAfter a stop, `verdict: converged` needs a round after it, allowed by the owner, that reports no findings.\n\nBefore writing the verdict, run `accord round <id>`. Exit 0, or a stop whose only `Reason:` is that the cap is reached and no owner Ruling allows more, lets the verdict be written; any other stop goes to the owner as above first. When exit 0 also prints `Added code:` (after a `(final review)` round, only code added after that round counts), run that round first, headed `(added code round 1)`, before the verdict. When it prints `Re-review:`, run that re-review round, given the fixes it names, before the verdict; at the cap `accord round` stops instead, naming them, and that round needs the owner's Ruling allowing one more round (`verdict: accepted-by-owner` answers no fix).\n\nThe single last line of the file is the verdict:\n\n- `verdict: converged` when, after the final review, no Must or Should is open, every fixed finding is answered `addressed:`, and the test command passes\n (a ticket claimed before 0.6.0: every Should is fixed, no answer needed): `tests.affected` over\n the files the fix touched, or `tests.full` when `tests.affected` is not\n configured or finds no test file; a Must or Should deferred under the\n evidence rule, with its `## Deferred` line, does not block it;\n- `verdict: accepted-by-owner \"<the owner's sentence>\"` when the run\n stopped with findings still open, at the cap or after the final\n re-review, and the owner accepted them, quoting what the owner said.\n\nNothing follows the verdict line until a return from verify.\n\nBack from verify, or back at review for any change made after the verdict, `accord anchor` prints `Review base: <sha>` while `review.md` ends with its verdict. Then, before the next round, run `git log -1 --format=%H -- accord/tickets/<id>/review.md` and append `## Return from verify <sha>` with the sha it prints; accord confirms from git that `review.md` ended with its verdict at that commit. The rounds after it are a new cycle counted from 1; a model tier once raised stays raised.\n",
|
|
25406
|
+
"review/security.md": "---\nkind: reference\n---\n\n# The security reviewer\n\nA round of review adds one more reviewer when the repository's list of risky patterns matches the round's diff. The list\nis `accord/product/security.md` (accord's defaults when the repository has none): a team adds a pattern under a new id,\nand removes a default only with a `- Removed: <id> — <reason>` line written on the owner's yes. A finding marked\n`risk: security` blocks in every round, whatever the list says.\n\n## Steps, in every round but a final review that follows a round\n\n1. **Read the list.** The round's review package, from `accord review-package <id>`, has a `## Security triggers`\n section. In round 1 you always read it. A later round's package is the last fix's diff, so it lists a trigger only when that\n fix touched a matched line or path.\n\n2. **No trigger.** When the section says `(none: no pattern matched)`, dispatch no security reviewer and write the line\n `Security: no pattern matched` in the round's section of `review.md`.\n\n3. **A trigger.** Any trigger, a `(cannot tell: …)` line included, means: run `accord review-package <id> --security`\n into a file outside the working tree, and dispatch one more fresh `accord-reviewer`, lens `security`, beside the\n round's other reviewers. Give it the paths of the ticket file, that file and `accord/tickets/<id>/ledger.md`. It\n checks every hunk under `## Matched hunks` against every item under `## Checklist`. Write the line\n `Security: lens security ran` in the round's section.\n\n4. **Its findings** join the round's like any reviewer's, a security defect marked `risk: security`, and are fixed and\n re-reviewed like the round's other findings. When a fix touches a matched line or path, the re-review round's package lists the\n trigger again, and the security reviewer runs again.\n\n## The final review\n\nA `(final review)` round that follows a round of its stretch (a stretch ends at the cycle's last round or where an owner allowance\nstarts a new one) asks none of this and writes no `Security:` line. A fix the final review makes is reviewed at the\nre-review round after it, whose package lists that fix's triggers and which follows the steps above. A `(final review)` round\nwith no earlier round in its stretch, a ticket's only round for one, is asked like any round: follow the steps above for it.\n\n## The record\n\nEvery other round section, a lone final review included, carries exactly one `Security:` line, `Security: no pattern matched` included, so that the\nrecord shows the decision was made. From accord 0.7.0:\n\n- `accord round` and `accord gate done` refuse a round whose package had triggers and whose section lacks\n `Security: lens security ran`, naming the triggers. Run `accord review-package <id> --security --round <k>` for the\n round they name, dispatch the security reviewer on it, write the line, and commit.\n- They also refuse a round section, a final review that follows a round of its stretch excepted, with no `Security:` line. The refusal says the package\n had no trigger: write `Security: no pattern matched` and commit.\n\nA ticket claimed before 0.7.0 keeps its earlier rules.\n",
|
|
25402
25407
|
"shared/ask.md": "---\nkind: reference\n---\n\n# Asking the owner\n\nA question that needs context to be understood is asked in plain chat, never in\na question dialog, because the dialog hides the chat written before it: a few\nplain sentences of context, then the question, then lettered options, each\nsaying what happens if it is chosen, the recommended one first, with one\nsentence on why it is recommended. A question dialog is used only when the\nquestion and its options are understood on their own in one line, such as\n'Commit now?'.\n\nAsk multiple choice when you can list two to four exclusive options, each with\na consequence drawn from the code or the ticket; ask an open question, with no\noptions, when the answer is in the owner's head, such as why, for whom, what\nsuccess looks like, or what hurts today; offer a short menu only when the owner\nis stuck on an open question.\n\nExplain in plain words for an owner who reads no code: a file path or a symbol\nis only a pointer, never the explanation, and every id such as ac-2 or D-03\ncarries a short gloss.\n",
|
|
25403
25408
|
"shared/failure.md": "---\nkind: reference\n---\n\n# A failure found after verify\n\nA failure is found after verify when ticket <id> has reached verify\n(`accord anchor` prints `verify` or `done`, or the ticket has\na `verified_commit:` or an `accord/tickets/<id>/verification.md`, so a\nticket back at `review` for an earlier fix counts), its pull request is\nnot merged (`gh pr view <branch> --json state` does not print `MERGED`),\nand either\nsomeone reports a failure in its work, with or without the failing\ncommand and its output, or verify finds a failed check on that pull\nrequest. A failure after the merge is not one: it needs a new bug ticket.\n\nA lane S ticket (`accord anchor` prints `Lane: S`) never reaches verify, so a failure in its work is not one: continue it as the\naccord skill's lane S steps say, and the fix gets another review round.\n\n1. Never judge the cause yourself, and never dispatch a fix outside\n `accord-debug`: no executor, no edit, and no Ruling in place of a\n root cause.\n2. When this session is not in that ticket's worktree, first run\n `accord worktree open <id> --continue` and follow the accord skill's\n `./worktree.md`, then Continue's step 2 only; after a `stop:` line,\n ask the owner to type, in the session opened there, `/accord <id> `\n followed by the report, in place of the line it prints, and stop here.\n When it printed `enter:`, or this session is already in that worktree,\n in place of Continue's steps 3 and 4, load\n `accord-debug` for that ticket: a new episode, or the open one when\n no `## Resolved` follows the last `## Episode` heading of `debug.md`. Pass the debugger the report as given;\n when it names no failing command or output, say so, and the debugger\n finds them itself, for a failed check with\n `gh run view <run-id> --log-failed`.\n3. A failure only another operating system shows (a CI check, or a test\n skipped here): its red is the CI log, and its green is that check\n passing at the next verify. Give the debugger, and the executor in\n its brief, the failing check's log as the failing output, and say\n the reproduction test is skipped on this operating system. After\n the fix, go on to the stage `accord anchor` prints, without\n `## Resolved` (`done`: `accord-verify` at step 6, whose Finish\n closes the episode). The episode stays open\n across that verify and keeps its count of failed fixes: the check\n passing there resolves it, the check failing there counts one failed\n fix in it.\n4. After the fix, `accord anchor` prints `review` and a `Review base:`\n line: the fix gets its own review round, then verify runs again.\n",
|
|
25404
25409
|
"shared/finish.md": "---\nkind: reference\n---\n\n# Reporting a finished ticket\n\nThe last message of a finished ticket has three parts, in this order, and nothing else.\n\n1. One verdict line: `✅ <id> DONE — PR #<n> ready, waiting for your merge: <url>`, with `<n>` and `<url>` from\n `gh pr list --head <branch> --state open --json number,url`; a merged pull request is not open. When no pull request is open, because `gh` is missing or the owner\n is to open it: `✅ <id> DONE — branch <branch> pushed, open its pull request`. Never merge the pull request\n and never write that it is merged: merging waits for the owner.\n2. At most four status lines: the facts the owner needs about this finish, such as the tests, CI, the accord check's verdict\n on the tick commit when verify gave one, the review's verdict, and what was skipped or not checked. The closing lines on what was skipped go here, within this limit.\n3. `Next:`, then one to three suggestions. Run `accord dashboard` now and read its last line: each suggestion,\n one per line, is an action it names, written as its command: `[Continue <id>]` as `/accord continue <id>`,\n `[Pick up <id>]` as `/accord pick-up <id>`, `[New request]` as `/accord <request>`. Leave out an action on the\n ticket just finished. The first ends with `(recommended)`. Never suggest an action the dashboard does not print.\n\nAfter this message, end the turn. Never wait for the merge, and never remove the ticket's worktree or branches by\nhand: once the owner merges the pull request, the next session start, resume or /clear, or the next `/accord`,\nremoves them. A /clear in this finishing session keeps its worktree (`kept <path>: this session's worktree`): the\nfolder goes only after this session has ended, at a session started in another folder, so tell the owner to close\nthis session once the pull request is merged.\n",
|
|
@@ -25833,7 +25838,24 @@ function listed$1(triggers) {
|
|
|
25833
25838
|
return triggers.length > 5 ? `${shown}, and ${triggers.length - 5} more` : shown;
|
|
25834
25839
|
}
|
|
25835
25840
|
/**
|
|
25836
|
-
* The
|
|
25841
|
+
* The record indexes (`j`, 1-based, cycles flattened) of the rounds the security rule leaves out: a `(final review)` round with a round that is not one before it in its own stretch (D-10).
|
|
25842
|
+
* A final review with no such round before it, a ticket's only round for one, is asked like any round: the mark alone never removes a round from the rule.
|
|
25843
|
+
*/
|
|
25844
|
+
function securityExemptRounds(snapshot, id) {
|
|
25845
|
+
const rec = workOf(snapshot, id)?.rounds;
|
|
25846
|
+
const out = /* @__PURE__ */ new Set();
|
|
25847
|
+
if (rec === void 0) return out;
|
|
25848
|
+
const placed = placedRounds(rec);
|
|
25849
|
+
const allowances = allowancesOf(snapshot, id, "review");
|
|
25850
|
+
for (const at of placed) {
|
|
25851
|
+
if (at.round.final !== true) continue;
|
|
25852
|
+
const { start } = stretchOf(allowances, at.cycle, rec.cycles[at.cycle - 1].rounds.length, at.p);
|
|
25853
|
+
if (placed.some((q) => q.cycle === at.cycle && q.p >= start && q.p < at.p && q.round.final !== true)) out.add(at.j);
|
|
25854
|
+
}
|
|
25855
|
+
return out;
|
|
25856
|
+
}
|
|
25857
|
+
/**
|
|
25858
|
+
* The security record problems of the review record, in record line order: a round (not an exempt final review) whose package had triggers and that records no `Security: lens security ran`, a
|
|
25837
25859
|
* `Security:` line that is neither form, and a round with no trigger that records no `Security:` line at all. None when the rule does not apply (securityOn) or the host supplied no fact.
|
|
25838
25860
|
*/
|
|
25839
25861
|
function securityProblems(snapshot, id) {
|
|
@@ -25851,8 +25873,9 @@ function securityProblems(snapshot, id) {
|
|
|
25851
25873
|
reason: `the security review cannot be checked: the host read the triggers of ${fact.rounds.length} rounds and review.md records ${placed.length}`
|
|
25852
25874
|
}];
|
|
25853
25875
|
const out = [];
|
|
25876
|
+
const exempt = securityExemptRounds(snapshot, id);
|
|
25854
25877
|
for (const at of placed) {
|
|
25855
|
-
if (at.
|
|
25878
|
+
if (exempt.has(at.j)) continue;
|
|
25856
25879
|
const where = `round ${at.p} of cycle ${at.cycle}`;
|
|
25857
25880
|
const triggers = fact.rounds[at.j - 1].triggers;
|
|
25858
25881
|
if (triggers.length > 0 && at.round.security !== "ran") out.push({
|
|
@@ -26447,6 +26470,14 @@ const toldAt = (p) => `round ${p.p} of cycle ${p.cycle}`;
|
|
|
26447
26470
|
function stretchEnds(cutAfter, rounds) {
|
|
26448
26471
|
return [.../* @__PURE__ */ new Set([...cutAfter.filter((r) => r >= 1 && r < rounds), rounds])].sort((a, b) => a - b);
|
|
26449
26472
|
}
|
|
26473
|
+
/** The stretch of position `p` (1-based) in a cycle of `count` rounds: its first and last position, cut after each round an owner allowance of that cycle names. */
|
|
26474
|
+
function stretchOf(allowances, cycle, count, p) {
|
|
26475
|
+
const ends = stretchEnds(allowances.filter((a) => a.cycle === cycle).map((a) => a.after), count);
|
|
26476
|
+
return {
|
|
26477
|
+
start: (ends.filter((e) => e < p).pop() ?? 0) + 1,
|
|
26478
|
+
end: ends.find((e) => e >= p) ?? count
|
|
26479
|
+
};
|
|
26480
|
+
}
|
|
26450
26481
|
function versionProblems(facts, placed) {
|
|
26451
26482
|
if (pinAllowsV1(facts.pin, facts.basePin)) return [];
|
|
26452
26483
|
const below = pinAllowsV1(facts.pin) ? ` below ${facts.basePin} at ${short(facts.baseAt)}, the commit this branch started from` : "";
|
|
@@ -26493,10 +26524,7 @@ function scopeProblems(snapshot, id) {
|
|
|
26493
26524
|
else if (finals.length > 0) {
|
|
26494
26525
|
const allowances = allowancesOf(snapshot, id, "review");
|
|
26495
26526
|
for (const p of finals) {
|
|
26496
|
-
const
|
|
26497
|
-
const ends = stretchEnds(allowances.filter((a) => a.cycle === p.cycle).map((a) => a.after), count);
|
|
26498
|
-
const end = ends.find((e) => e >= p.p) ?? count;
|
|
26499
|
-
const start = (ends.filter((e) => e < p.p).pop() ?? 0) + 1;
|
|
26527
|
+
const { start, end } = stretchOf(allowances, p.cycle, rec.cycles[p.cycle - 1].rounds.length, p.p);
|
|
26500
26528
|
if (finals.some((q) => q.cycle === p.cycle && q.p >= start && q.p < p.p) || p.p < end - 1) add(p.round.line, `${toldAt(p)} is headed (final review), but a final review is the last round of its stretch or the one before it, once per stretch; a stretch ends at the cycle's last round or at a round an owner allowance names`);
|
|
26501
26529
|
}
|
|
26502
26530
|
}
|
|
@@ -30186,6 +30214,10 @@ function diffFiles(diffText) {
|
|
|
30186
30214
|
return files;
|
|
30187
30215
|
}
|
|
30188
30216
|
const MAX_LINE = 2e3;
|
|
30217
|
+
/** The label of the trigger a cut line gets: the cap guards the patterns against backtracking, so a line over it is never scanned whole and says so (fail closed). */
|
|
30218
|
+
const LONG_LINE = `line longer than ${MAX_LINE} characters, not fully scanned`;
|
|
30219
|
+
const UNREADABLE = "too large to read as text, so its lines were not scanned";
|
|
30220
|
+
const tooLong = (text) => text.length > MAX_LINE;
|
|
30189
30221
|
const MARKDOWN = /\.(md|mdx|markdown)$/i;
|
|
30190
30222
|
const TEST_FOLDER = /* @__PURE__ */ new Set([
|
|
30191
30223
|
"test",
|
|
@@ -30269,7 +30301,15 @@ function securityTriggers(spec, diffText, changed, options) {
|
|
|
30269
30301
|
if (f.binary || f.path === void 0 || skipped(f.path)) continue;
|
|
30270
30302
|
const scanLines = (lines, removed) => {
|
|
30271
30303
|
for (const l of lines) {
|
|
30272
|
-
const head = l.text
|
|
30304
|
+
const head = tooLong(l.text) ? l.text.slice(0, MAX_LINE) : l.text;
|
|
30305
|
+
if (tooLong(l.text)) add({
|
|
30306
|
+
path: f.path,
|
|
30307
|
+
line: l.line,
|
|
30308
|
+
...removed ? { removed: true } : {},
|
|
30309
|
+
pattern: "",
|
|
30310
|
+
label: LONG_LINE,
|
|
30311
|
+
cannot: true
|
|
30312
|
+
});
|
|
30273
30313
|
for (const { p, re } of lineRes) if (re.test(head)) add({
|
|
30274
30314
|
path: f.path,
|
|
30275
30315
|
line: l.line,
|
|
@@ -30288,10 +30328,18 @@ function securityTriggers(spec, diffText, changed, options) {
|
|
|
30288
30328
|
label: "",
|
|
30289
30329
|
cannot: true
|
|
30290
30330
|
});
|
|
30331
|
+
for (const path of options.unreadable ?? []) add({
|
|
30332
|
+
path,
|
|
30333
|
+
pattern: "",
|
|
30334
|
+
label: UNREADABLE,
|
|
30335
|
+
cannot: true
|
|
30336
|
+
});
|
|
30291
30337
|
return [...out.values()].sort((a, b) => cmp$4(a.path, b.path) || (a.line ?? 0) - (b.line ?? 0) || cmp$4(a.pattern, b.pattern) || Number(a.removed === true) - Number(b.removed === true));
|
|
30292
30338
|
}
|
|
30293
30339
|
/** The line form of a trigger, as `accord review-package` prints it. */
|
|
30294
30340
|
function triggerText(t) {
|
|
30341
|
+
if (t.cannot === true && t.line !== void 0) return `${t.path}:${t.line}${t.removed === true ? " (removed)" : ""}: (cannot tell: ${t.label})`;
|
|
30342
|
+
if (t.cannot === true && t.label !== "") return `(cannot tell: ${t.path}: ${t.label})`;
|
|
30295
30343
|
if (t.cannot === true) return `(cannot tell: ${t.path} is not in the diff text)`;
|
|
30296
30344
|
if (t.line === void 0) return `${t.path}: ${t.pattern} (${t.label})`;
|
|
30297
30345
|
return `${t.path}:${t.line}${t.removed === true ? " (removed)" : ""}: ${t.pattern} (${t.label})`;
|
|
@@ -30304,15 +30352,20 @@ function triggerText(t) {
|
|
|
30304
30352
|
*/
|
|
30305
30353
|
function matchedHunks(spec, diffText, changed, options) {
|
|
30306
30354
|
const cap = options.cap ?? 300;
|
|
30307
|
-
const triggers = securityTriggers(spec, diffText, changed, {
|
|
30355
|
+
const triggers = securityTriggers(spec, diffText, changed, {
|
|
30356
|
+
generated: options.generated,
|
|
30357
|
+
unreadable: options.unreadable
|
|
30358
|
+
});
|
|
30308
30359
|
const pathHit = new Set(triggers.filter((t) => t.cannot !== true && t.line === void 0).map((t) => t.path));
|
|
30309
30360
|
const lineRes = compileLines(spec);
|
|
30310
30361
|
const holds = (h) => [...h.added, ...h.removed].some((l) => {
|
|
30311
|
-
|
|
30312
|
-
return lineRes.some(({ re }) => re.test(
|
|
30362
|
+
if (tooLong(l.text)) return true;
|
|
30363
|
+
return lineRes.some(({ re }) => re.test(l.text));
|
|
30313
30364
|
});
|
|
30314
30365
|
const blocks = [];
|
|
30315
|
-
|
|
30366
|
+
const files = diffFiles(diffText);
|
|
30367
|
+
for (const f of files) {
|
|
30368
|
+
if (f.binary && f.path !== void 0 && files.some((g) => !g.binary && g.path === f.path)) continue;
|
|
30316
30369
|
const name = f.path ?? f.oldPath;
|
|
30317
30370
|
const byPath = f.path !== void 0 && pathHit.has(f.path) || f.oldPath !== void 0 && pathHit.has(f.oldPath);
|
|
30318
30371
|
const content = f.binary || f.path === void 0 || contentSkipped(f.path, options.generated) ? /* @__PURE__ */ new Set() : new Set(f.hunks.filter(holds));
|
|
@@ -30335,7 +30388,7 @@ function matchedHunks(spec, diffText, changed, options) {
|
|
|
30335
30388
|
text: lines.join("\n")
|
|
30336
30389
|
});
|
|
30337
30390
|
}
|
|
30338
|
-
for (const t of triggers) if (t.cannot === true) blocks.push({
|
|
30391
|
+
for (const t of triggers) if (t.cannot === true && t.line === void 0) blocks.push({
|
|
30339
30392
|
key: t.path,
|
|
30340
30393
|
text: triggerText(t)
|
|
30341
30394
|
});
|
|
@@ -31843,7 +31896,7 @@ function mergeHooks(existing, entries) {
|
|
|
31843
31896
|
//#region package.json
|
|
31844
31897
|
var package_default = {
|
|
31845
31898
|
name: "@accord-dev/accord",
|
|
31846
|
-
version: "0.7.
|
|
31899
|
+
version: "0.7.1",
|
|
31847
31900
|
type: "module",
|
|
31848
31901
|
license: "MIT",
|
|
31849
31902
|
repository: {
|
|
@@ -40517,7 +40570,7 @@ function packageDiff(root, o) {
|
|
|
40517
40570
|
const { base, head, def } = o;
|
|
40518
40571
|
if (!REF.test(base)) throw new UsageError("not a git ref: " + base);
|
|
40519
40572
|
if (!REF.test(head)) throw new UsageError("not a git ref: " + head);
|
|
40520
|
-
const git = (args) => execFileSync("git", args, {
|
|
40573
|
+
const git = (args, maxBuffer = 67108864) => execFileSync("git", args, {
|
|
40521
40574
|
cwd: root,
|
|
40522
40575
|
encoding: "utf8",
|
|
40523
40576
|
stdio: [
|
|
@@ -40525,17 +40578,18 @@ function packageDiff(root, o) {
|
|
|
40525
40578
|
"pipe",
|
|
40526
40579
|
"pipe"
|
|
40527
40580
|
],
|
|
40528
|
-
maxBuffer
|
|
40581
|
+
maxBuffer
|
|
40529
40582
|
});
|
|
40530
40583
|
const NO_QUOTE = ["-c", "core.quotePath=false"];
|
|
40531
|
-
const
|
|
40584
|
+
const PREFIXES = ["--src-prefix=a/", "--dst-prefix=b/"];
|
|
40585
|
+
const gitLog = (args, max) => git([
|
|
40532
40586
|
...NO_QUOTE,
|
|
40533
40587
|
"-c",
|
|
40534
40588
|
"log.showSignature=false",
|
|
40535
40589
|
"log",
|
|
40536
40590
|
"--no-show-signature",
|
|
40537
40591
|
...args
|
|
40538
|
-
]);
|
|
40592
|
+
], max);
|
|
40539
40593
|
const range = base + "..." + head;
|
|
40540
40594
|
const short = def?.replace(/^refs\/(remotes|heads)\//, "");
|
|
40541
40595
|
let excluded = false;
|
|
@@ -40558,17 +40612,20 @@ function packageDiff(root, o) {
|
|
|
40558
40612
|
excluded = count(["^" + def]) !== count([]);
|
|
40559
40613
|
} catch {}
|
|
40560
40614
|
}
|
|
40561
|
-
const
|
|
40615
|
+
const overBuffer = (e) => e.code === "ENOBUFS";
|
|
40616
|
+
const log = (args, paths = [], max) => {
|
|
40562
40617
|
const full = (extra) => gitLog([
|
|
40563
40618
|
...args,
|
|
40564
40619
|
...extra,
|
|
40565
40620
|
base + ".." + head,
|
|
40566
40621
|
"^" + def,
|
|
40567
|
-
"--"
|
|
40568
|
-
|
|
40622
|
+
"--",
|
|
40623
|
+
...paths
|
|
40624
|
+
], max);
|
|
40569
40625
|
try {
|
|
40570
40626
|
return full(["--remerge-diff"]);
|
|
40571
|
-
} catch {
|
|
40627
|
+
} catch (e) {
|
|
40628
|
+
if (overBuffer(e)) throw e;
|
|
40572
40629
|
if (!o.allowPlainLog) throw new UsageError(`cannot diff ${range}: git cannot show a merge's own changes (git log --remerge-diff needs git 2.36 or newer)`);
|
|
40573
40630
|
return full([]);
|
|
40574
40631
|
}
|
|
@@ -40579,6 +40636,70 @@ function packageDiff(root, o) {
|
|
|
40579
40636
|
const commits = text.slice(1).split("\n");
|
|
40580
40637
|
return commits.map((c, i) => i < commits.length - 1 ? c + "\n" : c).reverse().join("");
|
|
40581
40638
|
};
|
|
40639
|
+
const withBinaryText = (diff) => {
|
|
40640
|
+
const paths = /* @__PURE__ */ new Set();
|
|
40641
|
+
for (const f of diffFiles(diff)) if (f.binary) {
|
|
40642
|
+
for (const p of [f.path, f.oldPath]) if (p !== void 0) paths.add(p);
|
|
40643
|
+
}
|
|
40644
|
+
const unread = [];
|
|
40645
|
+
if (paths.size === 0) return {
|
|
40646
|
+
diff,
|
|
40647
|
+
unread
|
|
40648
|
+
};
|
|
40649
|
+
const sorted = [...paths].sort();
|
|
40650
|
+
const specs = sorted.map((p) => ":(literal)" + p);
|
|
40651
|
+
const text = [];
|
|
40652
|
+
const limit = o.textLimit ?? 67108864;
|
|
40653
|
+
const read = (batch) => {
|
|
40654
|
+
try {
|
|
40655
|
+
return excluded ? log([
|
|
40656
|
+
"--no-color",
|
|
40657
|
+
"--no-ext-diff",
|
|
40658
|
+
...PREFIXES,
|
|
40659
|
+
"--text",
|
|
40660
|
+
"--no-renames",
|
|
40661
|
+
"--full-history",
|
|
40662
|
+
"-p",
|
|
40663
|
+
"-U10",
|
|
40664
|
+
"--format="
|
|
40665
|
+
], batch, limit) : git([
|
|
40666
|
+
...NO_QUOTE,
|
|
40667
|
+
"diff",
|
|
40668
|
+
"--no-color",
|
|
40669
|
+
"--no-ext-diff",
|
|
40670
|
+
...PREFIXES,
|
|
40671
|
+
"--text",
|
|
40672
|
+
"--no-renames",
|
|
40673
|
+
"-U10",
|
|
40674
|
+
range,
|
|
40675
|
+
"--",
|
|
40676
|
+
...batch
|
|
40677
|
+
], limit);
|
|
40678
|
+
} catch (e) {
|
|
40679
|
+
if (!overBuffer(e)) throw e;
|
|
40680
|
+
if (batch.length > 1) return batch.map((p) => read([p])).join("\n");
|
|
40681
|
+
unread.push(sorted[specs.indexOf(batch[0])]);
|
|
40682
|
+
return "";
|
|
40683
|
+
}
|
|
40684
|
+
};
|
|
40685
|
+
for (let i = 0; i < specs.length;) {
|
|
40686
|
+
let size = 0;
|
|
40687
|
+
const batch = [];
|
|
40688
|
+
while (i < specs.length && (batch.length === 0 || size + specs[i].length < 16e3)) {
|
|
40689
|
+
size += specs[i].length + 1;
|
|
40690
|
+
batch.push(specs[i++]);
|
|
40691
|
+
}
|
|
40692
|
+
const out = read(batch);
|
|
40693
|
+
for (const section of out.split(/^(?=diff --git )/m)) {
|
|
40694
|
+
if (!section.startsWith("diff --git ")) continue;
|
|
40695
|
+
if (!section.split("\n").some((l) => (l[0] === "+" || l[0] === "-") && l.includes("\0"))) text.push(section.trimEnd());
|
|
40696
|
+
}
|
|
40697
|
+
}
|
|
40698
|
+
return {
|
|
40699
|
+
diff: text.length === 0 ? diff : diff + "\n" + text.join("\n"),
|
|
40700
|
+
unread
|
|
40701
|
+
};
|
|
40702
|
+
};
|
|
40582
40703
|
const result = {
|
|
40583
40704
|
diff: "",
|
|
40584
40705
|
changed: [],
|
|
@@ -40615,6 +40736,7 @@ function packageDiff(root, o) {
|
|
|
40615
40736
|
result.diff = (excluded ? oldestFirst([
|
|
40616
40737
|
"--no-color",
|
|
40617
40738
|
"--no-ext-diff",
|
|
40739
|
+
...PREFIXES,
|
|
40618
40740
|
"-p",
|
|
40619
40741
|
"-U10"
|
|
40620
40742
|
]) : git([
|
|
@@ -40622,10 +40744,14 @@ function packageDiff(root, o) {
|
|
|
40622
40744
|
"diff",
|
|
40623
40745
|
"--no-color",
|
|
40624
40746
|
"--no-ext-diff",
|
|
40747
|
+
...PREFIXES,
|
|
40625
40748
|
"-U10",
|
|
40626
40749
|
range,
|
|
40627
40750
|
"--"
|
|
40628
40751
|
])).trimEnd();
|
|
40752
|
+
const withText = withBinaryText(result.diff);
|
|
40753
|
+
result.diff = withText.diff;
|
|
40754
|
+
if (withText.unread.length > 0) result.unread = withText.unread.sort();
|
|
40629
40755
|
result.changed = excluded ? [...new Set(log([
|
|
40630
40756
|
"--no-renames",
|
|
40631
40757
|
"--name-only",
|
|
@@ -40704,8 +40830,9 @@ function factsFor(root, snapshot, id) {
|
|
|
40704
40830
|
const spec = securitySpec(snapshot);
|
|
40705
40831
|
const generated = snapshot.config?.generated ?? [];
|
|
40706
40832
|
const def = defaultRefOf(root);
|
|
40833
|
+
const exempt = securityExemptRounds(snapshot, id);
|
|
40707
40834
|
return { rounds: ranges.rounds.map((r, k) => {
|
|
40708
|
-
if (
|
|
40835
|
+
if (exempt.has(k + 1)) return {
|
|
40709
40836
|
head: r.head,
|
|
40710
40837
|
triggers: []
|
|
40711
40838
|
};
|
|
@@ -40722,7 +40849,10 @@ function factsFor(root, snapshot, id) {
|
|
|
40722
40849
|
}
|
|
40723
40850
|
return {
|
|
40724
40851
|
head: r.head,
|
|
40725
|
-
triggers: securityTriggers(spec, pkg.diff, pkg.changed, {
|
|
40852
|
+
triggers: securityTriggers(spec, pkg.diff, pkg.changed, {
|
|
40853
|
+
generated,
|
|
40854
|
+
unreadable: pkg.unread
|
|
40855
|
+
}).map(triggerText)
|
|
40726
40856
|
};
|
|
40727
40857
|
}) };
|
|
40728
40858
|
} catch (e) {
|
|
@@ -41720,11 +41850,14 @@ const NONE = "(none: no pattern matched)";
|
|
|
41720
41850
|
* ST-LN-36 D-05 (4): the security sections of a package, from its own diff text and changed list so they run no git command of their own. `triggers` is the `## Security triggers`
|
|
41721
41851
|
* text; with `full`, `checklist` (every item in force, default and team) and `hunks` (matchedHunks, or the none line) are read too.
|
|
41722
41852
|
*/
|
|
41723
|
-
function securitySections(s, diffText, changed, full) {
|
|
41853
|
+
function securitySections(s, diffText, changed, full, unreadable) {
|
|
41724
41854
|
try {
|
|
41725
41855
|
const spec = securitySpec(s);
|
|
41726
41856
|
const generated = s.config?.generated ?? [];
|
|
41727
|
-
let triggers = securityTriggers(spec, diffText, changed, {
|
|
41857
|
+
let triggers = securityTriggers(spec, diffText, changed, {
|
|
41858
|
+
generated,
|
|
41859
|
+
unreadable
|
|
41860
|
+
}).map(triggerText).join("\n") || NONE;
|
|
41728
41861
|
const unread = spec.problems.length;
|
|
41729
41862
|
if (unread > 0) triggers += `\n(accord/product/security.md: ${unread} ${unread === 1 ? "line" : "lines"} not read; run accord lint)`;
|
|
41730
41863
|
if (!full) return {
|
|
@@ -41735,7 +41868,10 @@ function securitySections(s, diffText, changed, full) {
|
|
|
41735
41868
|
return {
|
|
41736
41869
|
triggers,
|
|
41737
41870
|
checklist: spec.checklist.map((c) => `- ${c.id}: ${c.text}`).join("\n") || "(none)",
|
|
41738
|
-
hunks: matchedHunks(spec, diffText, changed, {
|
|
41871
|
+
hunks: matchedHunks(spec, diffText, changed, {
|
|
41872
|
+
generated,
|
|
41873
|
+
unreadable
|
|
41874
|
+
}).join("\n") || NONE
|
|
41739
41875
|
};
|
|
41740
41876
|
} catch (e) {
|
|
41741
41877
|
const unread = cannot(e instanceof Error ? e.message : String(e));
|
|
@@ -41759,7 +41895,7 @@ const securityText = (title, sec) => [
|
|
|
41759
41895
|
const abbrev = (ref) => /^[0-9a-f]{40,64}$/.test(ref) ? ref.slice(0, 12) : ref;
|
|
41760
41896
|
/**
|
|
41761
41897
|
* `--security --round <k>`: the security package of the k-th `## Round` section of review.md, over the range the security record rule reads (securityRoundRanges), so a session refused for a
|
|
41762
|
-
* skipped security review can review exactly that round. A `(final review)` round has none (D-10): its fix is reviewed at the re-review round after it.
|
|
41898
|
+
* skipped security review can review exactly that round. A `(final review)` round that follows a round of its stretch has none (D-10): its fix is reviewed at the re-review round after it.
|
|
41763
41899
|
*/
|
|
41764
41900
|
function securityRoundPackage(ctx, id, asked) {
|
|
41765
41901
|
if (!/^[1-9][0-9]*$/.test(asked)) throw new UsageError(`--round takes a round number, 1 or more: ${asked}`);
|
|
@@ -41771,7 +41907,7 @@ function securityRoundPackage(ctx, id, asked) {
|
|
|
41771
41907
|
const n = ranges.rounds.length;
|
|
41772
41908
|
throw new UsageError(n === 0 ? `--round ${k}: review.md of ${id} records no round` : `--round ${k}: review.md of ${id} records ${n} ${n === 1 ? "round" : "rounds"}`);
|
|
41773
41909
|
}
|
|
41774
|
-
if (
|
|
41910
|
+
if (securityExemptRounds(ctx.snapshot, id).has(k)) throw new UsageError(`--round ${k} is a (final review) round that follows a round of its stretch, which has no security package of its own (D-10); its fix is reviewed at the re-review round after it`);
|
|
41775
41911
|
const range = `${abbrev(at.base)}...${abbrev(at.head)}`;
|
|
41776
41912
|
let pkg;
|
|
41777
41913
|
try {
|
|
@@ -41785,7 +41921,7 @@ function securityRoundPackage(ctx, id, asked) {
|
|
|
41785
41921
|
if (e instanceof UsageError) throw e;
|
|
41786
41922
|
throw new UsageError(`cannot diff round ${k} (${range}): ${why(e)}`);
|
|
41787
41923
|
}
|
|
41788
|
-
ctx.stdout.write(securityText(`# Security package: ${id} (${range})\nHead: ${abbrev(at.head)}`, securitySections(ctx.snapshot, pkg.diff, pkg.changed, true)));
|
|
41924
|
+
ctx.stdout.write(securityText(`# Security package: ${id} (${range})\nHead: ${abbrev(at.head)}`, securitySections(ctx.snapshot, pkg.diff, pkg.changed, true, pkg.unread)));
|
|
41789
41925
|
return 0;
|
|
41790
41926
|
}
|
|
41791
41927
|
function reviewPackage(ctx, id, options) {
|
|
@@ -41892,6 +42028,7 @@ function reviewPackage(ctx, id, options) {
|
|
|
41892
42028
|
let label;
|
|
41893
42029
|
let diffText;
|
|
41894
42030
|
let changedFiles;
|
|
42031
|
+
let unread;
|
|
41895
42032
|
try {
|
|
41896
42033
|
const pkg = packageDiff(ctx.root, {
|
|
41897
42034
|
base,
|
|
@@ -41913,6 +42050,7 @@ function reviewPackage(ctx, id, options) {
|
|
|
41913
42050
|
];
|
|
41914
42051
|
diffText = pkg.diff;
|
|
41915
42052
|
changedFiles = changed;
|
|
42053
|
+
unread = pkg.unread;
|
|
41916
42054
|
const undeclared = undeclaredFiles(s, id, changed);
|
|
41917
42055
|
parts.splice(parts.indexOf("## Diff"), 0, "## Undeclared files", undeclared === void 0 ? "(no plan)" : undeclared.join("\n") || "(none)");
|
|
41918
42056
|
} catch (e) {
|
|
@@ -41938,10 +42076,10 @@ function reviewPackage(ctx, id, options) {
|
|
|
41938
42076
|
shown.push("## Interface signs", "error" in f ? cannot(f.error) : signs?.map((x) => `${x.path}: ${x.sign}`).join("\n") || "(none)");
|
|
41939
42077
|
if (options.security === true) {
|
|
41940
42078
|
const at = parts[0].indexOf("\nHead: ");
|
|
41941
|
-
ctx.stdout.write(securityText(`# Security package: ${id} (${label})${at < 0 ? "" : parts[0].slice(at)}`, securitySections(s, diffText, changedFiles, true)));
|
|
42079
|
+
ctx.stdout.write(securityText(`# Security package: ${id} (${label})${at < 0 ? "" : parts[0].slice(at)}`, securitySections(s, diffText, changedFiles, true, unread)));
|
|
41942
42080
|
return 0;
|
|
41943
42081
|
}
|
|
41944
|
-
shown.push("## Security triggers", securitySections(s, diffText, changedFiles, false).triggers);
|
|
42082
|
+
shown.push("## Security triggers", securitySections(s, diffText, changedFiles, false, unread).triggers);
|
|
41945
42083
|
parts.splice(parts.indexOf("## Stat"), 0, ...shown);
|
|
41946
42084
|
ctx.stdout.write(parts.join("\n\n") + "\n");
|
|
41947
42085
|
return 0;
|