readfirst 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -13,9 +13,9 @@ No server, no account, no model calls. It reads your git checkout and `.readfirs
13
13
  ## Start
14
14
 
15
15
  ```sh
16
- npx readfirst init # first map from your folders: one group per folder, media folders ignored
17
- npx readfirst prompt # a brief for your coding agent to fill in titles, checks, risks and rules
18
- npx readfirst check # every tracked file is in exactly one group (or ignored); rules point at real files
16
+ npx readfirst init --agent # first map from your folders, checks from your scripts, plus the line for CLAUDE.md / AGENTS.md
17
+ npx readfirst prompt # a brief for your coding agent to fill in titles, checks, risks and rules
18
+ npx readfirst check # every tracked file is in exactly one group (or ignored); rules point at real files
19
19
  ```
20
20
 
21
21
  Commit `.readfirst/map.json`. From then on:
@@ -29,7 +29,7 @@ npx readfirst fix # after moving code: place new files, drop patt
29
29
 
30
30
  ### Tell your agent to use it
31
31
 
32
- Add this to `CLAUDE.md`, `AGENTS.md` or `.cursorrules`:
32
+ `init --agent` adds this to your `CLAUDE.md`, `AGENTS.md` or `.cursorrules` (or a new `AGENTS.md`); or add it yourself:
33
33
 
34
34
  ```md
35
35
  Before changing a file, run `npx readfirst read <file>` and follow what it says: keep the rules, read the risks, run the
@@ -37,6 +37,15 @@ checks it lists. Before you finish, run `npx readfirst diff` and run every check
37
37
  When you learn something a newcomer would get wrong, add it as a risk in .readfirst/map.json.
38
38
  ```
39
39
 
40
+ ### Or let Claude Code pick it up by itself
41
+
42
+ ```sh
43
+ npx readfirst hook --install
44
+ ```
45
+
46
+ adds a hook to `.claude/settings.json`. Before each Edit or Write, Claude Code gets the rules, risks and checks for that
47
+ file as context, once per file per session. Nothing to remember, and the edit is never blocked.
48
+
40
49
  ## On every pull request (GitHub Action)
41
50
 
42
51
  ```yaml
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "readfirst",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "What to read and check before you (or your AI agent) change a file: project rules, risks and tests tied to code.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/cli.mjs CHANGED
@@ -1,14 +1,16 @@
1
1
  // readfirst: what to read and check before changing a file.
2
- // readfirst init write a first .readfirst/map.json from the file tree
2
+ // readfirst init [--agent] write a first .readfirst/map.json from the file tree (and the agent-notes line)
3
3
  // readfirst prompt the brief for a coding agent to fill in titles, checks, risks and rules
4
4
  // readfirst check the map covers every tracked file and is well formed
5
5
  // readfirst fix place new files and drop patterns for deleted ones, then check
6
6
  // readfirst read <file>... the read list for files you are about to change
7
7
  // readfirst diff [--base <ref>] the read list for the files changed since <ref> (default: origin/main, else main)
8
+ // readfirst hook [--install] a Claude Code PreToolUse hook: the read list for the file an Edit or Write is about to change
8
9
  // Options: --root <dir> (default: the current git repository), --json, --limit <n>.
9
10
  import { execFileSync } from 'node:child_process';
10
11
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
11
- import { join } from 'node:path';
12
+ import { tmpdir } from 'node:os';
13
+ import { isAbsolute, join, relative } from 'node:path';
12
14
  import { importEdges } from './imports.mjs';
13
15
  import { assertMap, draftMap, fixMap, MAP_PATH, mapProblems } from './map.mjs';
14
16
  import { agentBrief } from './prompt.mjs';
@@ -16,14 +18,16 @@ import { emptyList, readList, toMarkdown } from './readlist.mjs';
16
18
 
17
19
  const HELP = `readfirst — what to read and check before changing a file
18
20
 
19
- readfirst init write a first ${MAP_PATH} from the file tree
21
+ readfirst init [--agent] write a first ${MAP_PATH} from the file tree
20
22
  readfirst prompt brief for your coding agent to fill in the map
21
23
  readfirst check check the map covers every tracked file
22
24
  readfirst fix place new files, drop patterns for deleted ones
23
25
  readfirst read <file>... read list for files you are about to change
24
26
  readfirst diff [--base <ref>] read list for files changed since <ref>
27
+ readfirst hook [--install] Claude Code hook: the read list before each edit (--install adds it to .claude/settings.json)
25
28
 
26
- Options: --root <dir>, --json, --limit <n>, --force (init: replace the map)`;
29
+ Options: --root <dir>, --json, --limit <n>, --force (init: replace the map),
30
+ --agent (init: add the read-first line to CLAUDE.md / AGENTS.md / .cursorrules)`;
27
31
 
28
32
  function parse(argv) {
29
33
  const args = { _: [], json: false };
@@ -31,6 +35,8 @@ function parse(argv) {
31
35
  const a = argv[i];
32
36
  if (a === '--json') args.json = true;
33
37
  else if (a === '--force') args.force = true;
38
+ else if (a === '--agent') args.agent = true;
39
+ else if (a === '--install') args.install = true;
34
40
  else if (a === '-h' || a === '--help') args.help = true;
35
41
  else if (a.startsWith('--')) { const v = argv[++i]; if (v === undefined) throw new Error(`${a} needs a value`); args[a.slice(2)] = v; }
36
42
  else args._.push(a);
@@ -60,6 +66,33 @@ function loadMap(root, files) {
60
66
  return assertMap(readMapFile(root), files);
61
67
  }
62
68
 
69
+ // read and diff keep working while the map is only behind the code (new files in no group, patterns for deleted files):
70
+ // they warn and point at `readfirst fix`. A map that is broken in itself still stops them.
71
+ function loadMapLenient(root, files, io) {
72
+ const map = readMapFile(root);
73
+ const broken = mapProblems(map, files, { placement: false });
74
+ if (broken.length) throw new Error(`${MAP_PATH} has problems:\n- ${broken.join('\n- ')}`);
75
+ const behind = mapProblems(map, files);
76
+ if (behind.length) io.err(`note: ${MAP_PATH} is behind the code (${behind.length} problem${behind.length > 1 ? 's' : ''}); \`readfirst fix\` repairs most of it.\n`);
77
+ return map;
78
+ }
79
+
80
+ // The one line that makes a coding agent use readfirst, added to the agent notes the project already has (CLAUDE.md,
81
+ // AGENTS.md, .cursorrules), or to a new AGENTS.md when it has none. A file that already mentions readfirst is left alone.
82
+ export const AGENT_LINE = 'Before changing a file, run `npx readfirst read <file>` and follow what it says: keep the rules, read the risks, run the checks it lists. Before you finish, run `npx readfirst diff` and run every check it lists. When you learn something a newcomer would get wrong, add it as a risk in .readfirst/map.json.';
83
+ function addAgentLine(root) {
84
+ const notes = ['CLAUDE.md', 'AGENTS.md', '.cursorrules'].filter((f) => existsSync(join(root, f)));
85
+ const wrote = [];
86
+ for (const f of notes.length ? notes : ['AGENTS.md']) {
87
+ const at = join(root, f);
88
+ const now = existsSync(at) ? readFileSync(at, 'utf8') : '';
89
+ if (/readfirst/u.test(now)) continue;
90
+ writeFileSync(at, `${now}${now && !now.endsWith('\n') ? '\n' : ''}${now ? '\n' : ''}${AGENT_LINE}\n`);
91
+ wrote.push(f);
92
+ }
93
+ return wrote;
94
+ }
95
+
63
96
  function changedFiles(root, base) {
64
97
  const ref = base ?? ['origin/main', 'main', 'origin/master', 'master'].find((r) => { try { git(root, 'rev-parse', '--verify', '--quiet', r); return true; } catch { return false; } });
65
98
  if (!ref) throw new Error('no base branch found: pass --base <ref>');
@@ -71,10 +104,72 @@ function changedFiles(root, base) {
71
104
  return { ref, files: [...names].sort() };
72
105
  }
73
106
 
74
- export function main(argv, io = { out: (s) => process.stdout.write(s), err: (s) => process.stderr.write(s) }) {
107
+ // The read list as a few factual lines for an agent's context: rules, risks and checks, nothing else.
108
+ export function brief(list) {
109
+ const lines = [];
110
+ for (const r of list.rules) lines.push(`Rule ${r.id}: ${r.rule}${r.why ? ` (why: ${r.why})` : ''}`);
111
+ for (const r of list.risks) lines.push(`Risk: ${r.text}`);
112
+ for (const c of list.checks) lines.push(`Check to run after the change: ${c.run}${c.why ? ` (${c.why})` : ''}`);
113
+ if (list.tests.length) lines.push(`Tests that reach this file: ${list.tests.slice(0, 5).map((t) => t.path).join(', ')}`);
114
+ return lines;
115
+ }
116
+
117
+ // Claude Code PreToolUse hook. Reads the hook's JSON on stdin; for an Edit, Write or MultiEdit of a file the map covers,
118
+ // prints the read list as additionalContext, once per file per session. Never blocks the edit: any problem means no output.
119
+ export function runHook(input, { now = Date.now(), stateDir = tmpdir() } = {}) {
120
+ try {
121
+ const event = JSON.parse(input);
122
+ const file = event.tool_input?.file_path;
123
+ if (!file || !/^(?:Edit|Write|MultiEdit)$/u.test(event.tool_name ?? '')) return null;
124
+ const cwd = event.cwd ?? process.cwd();
125
+ const root = git(cwd, 'rev-parse', '--show-toplevel').trim();
126
+ const path = (isAbsolute(file) ? relative(root, file) : file).replace(/\\/gu, '/');
127
+ if (path.startsWith('..') || path === MAP_PATH || !existsSync(join(root, MAP_PATH))) return null;
128
+ const seenAt = join(stateDir, `readfirst-hook-${String(event.session_id ?? 'none').replace(/[^\w-]/gu, '')}.json`);
129
+ let seen = {};
130
+ try { seen = JSON.parse(readFileSync(seenAt, 'utf8')); } catch { seen = {}; }
131
+ if (seen[path] && now - seen[path] < 6 * 3600_000) return null;
132
+ const files = repoFiles(root);
133
+ const map = readMapFile(root);
134
+ if (mapProblems(map, files, { placement: false }).length) return null;
135
+ const list = readList({ map, files: files.includes(path) ? files : [...files, path].sort(), imports: importEdges(files, readText(root)), targets: [path], limit: 10 });
136
+ const lines = brief(list);
137
+ seen[path] = now;
138
+ try { writeFileSync(seenAt, JSON.stringify(seen)); } catch { /* best effort */ }
139
+ if (!lines.length) return null;
140
+ const shown = lines.slice(0, 12);
141
+ if (lines.length > shown.length) shown.push(`${lines.length - shown.length} more in \`npx readfirst read ${path}\``);
142
+ return JSON.stringify({ hookSpecificOutput: { hookEventName: 'PreToolUse', additionalContext: `readfirst notes for ${path} (from ${MAP_PATH}):\n- ${shown.join('\n- ')}` } });
143
+ } catch {
144
+ return null;
145
+ }
146
+ }
147
+
148
+ export const HOOK_COMMAND = 'npx --yes readfirst hook';
149
+ // Adds the hook to the project's .claude/settings.json, keeping everything already there.
150
+ export function installHook(root) {
151
+ const at = join(root, '.claude', 'settings.json');
152
+ let settings = {};
153
+ if (existsSync(at)) {
154
+ try { settings = JSON.parse(readFileSync(at, 'utf8')); } catch { throw new Error('.claude/settings.json is not valid JSON; fix it first'); }
155
+ }
156
+ const pre = ((settings.hooks ??= {}).PreToolUse ??= []);
157
+ if (pre.some((m) => (m.hooks ?? []).some((h) => /readfirst hook/u.test(h.command ?? '')))) return false;
158
+ pre.push({ matcher: 'Edit|Write|MultiEdit', hooks: [{ type: 'command', command: HOOK_COMMAND, timeout: 15 }] });
159
+ mkdirSync(join(root, '.claude'), { recursive: true });
160
+ writeFileSync(at, `${JSON.stringify(settings, null, 2)}\n`);
161
+ return true;
162
+ }
163
+
164
+ export function main(argv, io = { out: (s) => process.stdout.write(s), err: (s) => process.stderr.write(s) }, stdin = () => readFileSync(0, 'utf8')) {
75
165
  const args = parse(argv);
76
166
  const [cmd, ...rest] = args._;
77
167
  if (args.help || !cmd) { io.out(`${HELP}\n`); return cmd || args.help ? 0 : 2; }
168
+ if (cmd === 'hook' && !args.install) {
169
+ const out = runHook(stdin());
170
+ if (out) io.out(`${out}\n`);
171
+ return 0;
172
+ }
78
173
  const root = args.root ?? git(process.cwd(), 'rev-parse', '--show-toplevel').trim();
79
174
  const files = repoFiles(root);
80
175
  const commit = (() => { try { return git(root, 'rev-parse', 'HEAD').trim(); } catch { return null; } })();
@@ -82,10 +177,17 @@ export function main(argv, io = { out: (s) => process.stdout.write(s), err: (s)
82
177
  if (cmd === 'init') {
83
178
  const at = join(root, MAP_PATH);
84
179
  if (existsSync(at) && args.force !== true) throw new Error(`${MAP_PATH} already exists (pass --force to replace it)`);
85
- const map = draftMap(files);
180
+ const map = draftMap(files, readText(root));
86
181
  mkdirSync(join(root, '.readfirst'), { recursive: true });
87
182
  writeFileSync(at, `${JSON.stringify(map, null, 2)}\n`);
88
- io.out(`wrote ${MAP_PATH}: ${map.groups.length} groups, ${map.ignore.length} ignored folders.\nNext: run \`readfirst prompt\` and give the brief to your coding agent, or fill in titles, checks, risks and rules by hand.\n`);
183
+ const checks = map.groups.find((g) => g.checks.length)?.checks ?? [];
184
+ io.out(`wrote ${MAP_PATH}: ${map.groups.length} groups${checks.length ? `, checks found: ${checks.map((c) => c.run).join(', ')}` : ''}.\n`);
185
+ if (args.agent) {
186
+ const wrote = addAgentLine(root);
187
+ io.out(wrote.length ? `added the read-first line to ${wrote.join(', ')}.\n` : 'your agent notes already mention readfirst.\n');
188
+ io.out('Using Claude Code? `readfirst hook --install` hands it the read list automatically before each edit.\n');
189
+ }
190
+ io.out(`Next: run \`readfirst prompt\` and give the brief to your coding agent, or fill in titles, checks, risks and rules by hand.${args.agent ? '' : '\nTip: `readfirst init --agent` also adds the one line your coding agent needs to CLAUDE.md or AGENTS.md.'}\n`);
89
191
  return 0;
90
192
  }
91
193
  if (cmd === 'prompt') {
@@ -98,6 +200,10 @@ export function main(argv, io = { out: (s) => process.stdout.write(s), err: (s)
98
200
  else io.out(problems.length ? `${MAP_PATH} has ${problems.length} problem(s):\n- ${problems.join('\n- ')}\n` : `${MAP_PATH} is good: ${files.length} files.\n`);
99
201
  return problems.length ? 1 : 0;
100
202
  }
203
+ if (cmd === 'hook') {
204
+ io.out(installHook(root) ? 'added the readfirst hook to .claude/settings.json: Claude Code now sees the read list before each edit.\n' : '.claude/settings.json already has the readfirst hook.\n');
205
+ return 0;
206
+ }
101
207
  if (cmd === 'fix') {
102
208
  const { map, changes, problems } = fixMap(readMapFile(root), files);
103
209
  if (changes.length) writeFileSync(join(root, MAP_PATH), `${JSON.stringify(map, null, 2)}\n`);
@@ -109,7 +215,7 @@ export function main(argv, io = { out: (s) => process.stdout.write(s), err: (s)
109
215
  return problems.length ? 1 : 0;
110
216
  }
111
217
  if (cmd === 'read' || cmd === 'diff') {
112
- const map = loadMap(root, files);
218
+ const map = loadMapLenient(root, files, io);
113
219
  let targets = rest;
114
220
  if (cmd === 'diff') {
115
221
  const changed = changedFiles(root, args.base);
package/src/map.mjs CHANGED
@@ -43,7 +43,7 @@ const checkList = (v, where, p) => {
43
43
  };
44
44
 
45
45
  // Problems with the map against the list of tracked files. An empty list means the map is good.
46
- export function mapProblems(map, files) {
46
+ export function mapProblems(map, files, { placement = true } = {}) {
47
47
  const p = [];
48
48
  if (!isRecord(map)) return ['map: a JSON object'];
49
49
  only(map, ['format', 'groups', 'rules', 'ignore'], 'map', p);
@@ -90,7 +90,7 @@ export function mapProblems(map, files) {
90
90
  }
91
91
  }
92
92
  if (map.ignore !== undefined) strings(map.ignore, 'ignore', p);
93
- if (p.length) return p;
93
+ if (p.length || !placement) return p;
94
94
 
95
95
  // Placement: each tracked file in exactly one group or ignored; each group pattern matches something.
96
96
  const ignored = matcher(map.ignore ?? []);
@@ -121,7 +121,7 @@ export const groupOf = (map, path) => map.groups.find((g) => matcher(g.files)(pa
121
121
  // that code belong there; "ignore" is left for a person to fill with what nothing depends on. Titles and risks are left
122
122
  // for a person or an agent to write.
123
123
  const MEDIA = /\.(?:png|jpe?g|gif|webp|svg|ico|mp3|wav|ogg|m4a|flac|mp4|webm|mov|woff2?|ttf|otf|eot|glb|gltf|fbx|blend|zip|pdf)$/iu;
124
- export function draftMap(files) {
124
+ export function draftMap(files, read = () => null) {
125
125
  const nested = new Set(['src', 'lib', 'app', 'packages', 'apps']);
126
126
  const keyOf = (path) => {
127
127
  const parts = path.split('/');
@@ -133,6 +133,7 @@ export function draftMap(files) {
133
133
  const groups = new Map();
134
134
  const ignore = new Set();
135
135
  const byFolder = new Map();
136
+ const projectChecks = draftChecks(files, read);
136
137
  for (const f of files) {
137
138
  if (f === MAP_PATH) continue;
138
139
  const { key, pattern } = keyOf(f);
@@ -148,7 +149,7 @@ export function draftMap(files) {
148
149
  const title = media
149
150
  ? `TODO: what loads the media files in ${slot.pattern} (binary, not read)`
150
151
  : `TODO: what ${slot.pattern ?? 'the top-level files'} ${slot.pattern ? 'is' : 'are'} for`;
151
- groups.set(id, { id, title, files: prev ? [...prev.files, ...patterns] : patterns, checks: [], risks: [] });
152
+ groups.set(id, { id, title, files: prev ? [...prev.files, ...patterns] : patterns, checks: media ? [] : projectChecks, risks: [] });
152
153
  }
153
154
  // A nested pattern ("src/a/**") and the parent's loose files ("src/x.js") must not overlap; loose files under a nested root
154
155
  // become their own group.
@@ -217,3 +218,27 @@ export function fixMap(map, files) {
217
218
  }
218
219
  return { map: out, changes, problems: mapProblems(out, files) };
219
220
  }
221
+
222
+ // The project's own check commands, found in its build files, so a first map already says what to run. Repository-wide
223
+ // on purpose: narrowing a check to the group it covers is left to a person or an agent.
224
+ export function draftChecks(files, read = () => null) {
225
+ const has = new Set(files);
226
+ const out = [];
227
+ const add = (run, why) => { if (!out.some((c) => c.run === run)) out.push({ run, why }); };
228
+ if (has.has('package.json')) {
229
+ let scripts = {};
230
+ try { scripts = JSON.parse(read('package.json') ?? '{}').scripts ?? {}; } catch { scripts = {}; }
231
+ const pm = has.has('pnpm-lock.yaml') ? 'pnpm' : has.has('yarn.lock') ? 'yarn' : has.has('bun.lockb') || has.has('bun.lock') ? 'bun' : 'npm';
232
+ const run = (name) => (pm === 'npm' ? (name === 'test' ? 'npm test' : `npm run ${name}`) : `${pm} ${name === 'test' && pm !== 'bun' ? 'test' : `run ${name}`}`);
233
+ const placeholder = /no test specified/u;
234
+ if (typeof scripts.test === 'string' && !placeholder.test(scripts.test)) add(run('test'), 'the test suite');
235
+ for (const name of ['typecheck', 'type-check', 'check-types', 'lint']) if (typeof scripts[name] === 'string') add(run(name), name === 'lint' ? 'lint rules' : 'types');
236
+ }
237
+ const makefile = has.has('Makefile') ? read('Makefile') ?? '' : '';
238
+ if (/^test:/mu.test(makefile)) add('make test', 'the test suite (Makefile)');
239
+ if (has.has('go.mod')) add('go test ./...', 'the Go tests');
240
+ if (has.has('Cargo.toml')) add('cargo test', 'the Rust tests');
241
+ const py = has.has('pyproject.toml') || has.has('setup.py') || has.has('pytest.ini');
242
+ if (py && files.some((f) => /(?:^|\/)(?:test_[^/]*|[^/]*_test)\.py$/u.test(f))) add('pytest', 'the Python tests');
243
+ return out;
244
+ }
package/src/prompt.mjs CHANGED
@@ -19,7 +19,8 @@ Do this:
19
19
  3. Add "rules": promises the code must keep, each {"id": "kebab-id", "rule": "...", "why": "...", "files": [...],
20
20
  "checks": [{"run": "..."}]}. Take them from comments, docs, tests and commit messages. Only write rules you can point to
21
21
  in the code or docs. Ask the user for the ones only they know.
22
- 4. Run \`npx readfirst check\` until it says the map is good, then show the user the diff of ${MAP_PATH}.
22
+ 4. Run \`npx readfirst check\` until it says the map is good (\`npx readfirst fix\` places new files and drops dead
23
+ patterns for you), then show the user the diff of ${MAP_PATH}.
23
24
 
24
25
  Current groups: ${map.groups.map((g) => `${g.id} (${g.files.join(', ')})`).join('; ')}.
25
26
  `;
package/src/readlist.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  // The read list for files someone is about to change: the rules that cover them, the risks written for their group,
2
2
  // the checks to run (the group's commands, the rules' commands, and the tests that import them), and who uses them.
3
- import { groupOf, matcher, MAP_PATH } from './map.mjs';
3
+ import { fixMap, groupOf, matcher, MAP_PATH } from './map.mjs';
4
4
 
5
5
  export const READ_LIST_FORMAT = 'readfirst/read-list@1';
6
6
  const TEST = /(^|\/)(?:tests?|__tests__|spec|e2e)\/|\.(?:test|spec)\.[cm]?[jt]sx?$|(^|\/)test[-_][^/]*\.(?:[cm]?[jt]sx?|py)$|_test\.(?:py|go)$/u;
@@ -26,6 +26,12 @@ export function readList({ map, files, imports, targets, commit = null, limit =
26
26
  out[kind].push(row);
27
27
  };
28
28
  const indirect = new Set();
29
+ // Where `readfirst fix` would put files that are in no group; worked out only when such a file is asked about.
30
+ let fixes = null;
31
+ const suggestFor = (target) => {
32
+ fixes ??= (() => { try { return fixMap(map, files).changes.map((c) => c.match(/^groups\.([^:]+): added (.+)$/u)).filter(Boolean).map((m) => ({ group: m[1], target: m[2] })); } catch { return []; } })();
33
+ return fixes.find((c) => target === c.target || (c.target.endsWith('/**') && target.startsWith(c.target.slice(0, -2))));
34
+ };
29
35
 
30
36
  for (const raw of targets) {
31
37
  const target = raw.replace(/^\.\//u, '').replace(/\\/gu, '/');
@@ -38,7 +44,8 @@ export function readList({ map, files, imports, targets, commit = null, limit =
38
44
  const group = groupOf(map, target);
39
45
  out.targets.push({ path: target, group: group?.id ?? null, status: group ? 'IN_MAP' : ignored(target) ? 'IGNORED' : 'NO_GROUP' });
40
46
  if (!group) {
41
- out.notCovered.push({ path: target, why: ignored(target) ? 'ignored by the map' : 'in no group: run `readfirst check`' });
47
+ const suggest = ignored(target) ? null : suggestFor(target);
48
+ out.notCovered.push({ path: target, why: ignored(target) ? 'ignored by the map' : suggest ? `in no group: \`readfirst fix\` would add it to group ${suggest.group}` : 'in no group: run `readfirst check`' });
42
49
  } else {
43
50
  for (const r of group.risks ?? []) if (!r.files || matcher(r.files)(target)) note('risks', `${group.id}\0${r.text}`, { group: group.id, text: r.text }, target);
44
51
  for (const c of group.checks ?? []) note('checks', c.run, { run: c.run, why: c.why ?? `checks for ${group.title}`, from: `group ${group.id}` }, target);