agjan 0.0.18 → 0.0.20

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/dist/cli.js CHANGED
@@ -17,6 +17,9 @@ import * as progress from './commands/progress.js';
17
17
  import * as lint from './commands/lint.js';
18
18
  import * as uiTest from './commands/ui-test.js';
19
19
  import * as models from './commands/models.js';
20
+ import * as findings from './commands/findings.js';
21
+ import * as summary from './commands/summary.js';
22
+ import * as skill from './commands/skill.js';
20
23
  import { onEvent } from './log.js';
21
24
  import { refreshAfterEvent } from './progress-view.js';
22
25
  const COMMANDS = {
@@ -39,6 +42,9 @@ const COMMANDS = {
39
42
  reject: gates.reject,
40
43
  auto: gates.auto,
41
44
  review: review.run,
45
+ findings: findings.run,
46
+ summary: summary.run,
47
+ skill: skill.run,
42
48
  log: log.run,
43
49
  'pr-summary': prSummary.run,
44
50
  report: report.run,
@@ -96,6 +102,13 @@ Agent and human:
96
102
  fast path for small changes (record folder under fixes/)
97
103
  map start start mapping an existing application (project.md)
98
104
  baseline refresh record the watched files in baseline.json
105
+ skill <spec|design|build|verify>
106
+ print the workflow skill (auto mode: the next skill of the run)
107
+ summary [--feature <s>] what has been done so far in plain words, ending with what the
108
+ work waits for
109
+ findings [--all] [--feature <s>]
110
+ the open findings by severity (--all: with resolved and
111
+ accepted ones), and how to decide each
99
112
  review show [--step <step>] list review records, or print a step's review context
100
113
  review report [--step <step>] the latest review round for the user: verdict, findings,
101
114
  rounds, what happens next (agents show it after each review)
@@ -0,0 +1,67 @@
1
+ import { parseArgs } from 'node:util';
2
+ import { changedFeatures, listFeatures, loadFeature } from '../feature.js';
3
+ import { UsageError } from '../errors.js';
4
+ import { markLine, pad } from '../ui.js';
5
+ const SEVERITIES = ['blocker', 'major', 'minor'];
6
+ const WIDTH = 100;
7
+ /** Words joined into lines of at most `width` characters. */
8
+ function wrap(text, width) {
9
+ const lines = [];
10
+ let line = '';
11
+ for (const word of text.replace(/\s+/g, ' ').trim().split(' ')) {
12
+ if (line && line.length + 1 + word.length > width) {
13
+ lines.push(line);
14
+ line = word;
15
+ }
16
+ else
17
+ line = line ? `${line} ${word}` : word;
18
+ }
19
+ if (line)
20
+ lines.push(line);
21
+ return lines;
22
+ }
23
+ /** The number in a finding id (`TLR-F12` -> 12), to list findings in the order they were raised. */
24
+ function order(f) {
25
+ return Number(/(\d+)$/.exec(f.id)?.[1] ?? 0);
26
+ }
27
+ function describe(ctx, feature, all) {
28
+ const s = ctx.style;
29
+ const shown = feature.findings.filter((f) => all || f.status === 'open');
30
+ const open = feature.findings.filter((f) => f.status === 'open');
31
+ ctx.out('', `${s.bold(feature.slug)} ${s.gray(`(${feature.key})`)} ${open.length ? s.yellow(`${open.length} open`) : s.green('no open findings')}${all ? s.gray(`, ${feature.findings.length} in all`) : ''}`);
32
+ const color = { blocker: s.red, major: s.yellow, minor: s.gray };
33
+ for (const severity of SEVERITIES) {
34
+ const group = shown.filter((f) => f.severity === severity).sort((a, b) => order(a) - order(b));
35
+ if (!group.length)
36
+ continue;
37
+ ctx.out('', ` ${color[severity](s.bold(severity))} ${s.gray(`(${group.length})`)}`);
38
+ for (const f of group) {
39
+ const status = f.status === 'open' ? '' : ` ${s.gray(`[${f.status}${f.status === 'accepted' ? `: ${feature.approvals.accepted.find((a) => a.finding === f.id)?.reason ?? ''}` : ''}]`)}`;
40
+ ctx.out(` ${pad(s.bold(f.id), f.id, 10)}${s.gray(f.step)}${f.file ? s.gray(` ${f.file}${f.line ? `:${f.line}` : ''}`) : ''}${status}`);
41
+ for (const line of wrap(f.issue, WIDTH))
42
+ ctx.out(` ${' '.repeat(10)}${line}`);
43
+ }
44
+ }
45
+ }
46
+ /**
47
+ * agjan findings [--all] [--feature <slug>]: the findings still open, by severity (every
48
+ * finding with its status with --all), for the feature(s) this branch changed.
49
+ */
50
+ export function run(ctx, argv) {
51
+ const { values } = parseArgs({ args: argv, options: { all: { type: 'boolean' }, feature: { type: 'string' } } });
52
+ const root = ctx.root;
53
+ if (values.feature && !listFeatures(root).includes(values.feature))
54
+ throw new UsageError(`no feature '${values.feature}'`);
55
+ const slugs = values.feature ? [values.feature] : changedFeatures(root, ctx.config);
56
+ for (const line of markLine(ctx.style, ctx.kit, 'findings'))
57
+ ctx.out(line);
58
+ if (slugs.length === 0) {
59
+ ctx.out('no changed feature on this branch (pass --feature <slug>; agjan status --all lists every feature)');
60
+ return 0;
61
+ }
62
+ for (const slug of slugs)
63
+ describe(ctx, loadFeature(root, slug), Boolean(values.all));
64
+ const s = ctx.style;
65
+ ctx.out('', s.gray('Only an open blocker stops a gate. For each finding: ask the agent for a fix, accept it with'), s.gray('npx agjan accept <id> --reason "<why>" (in your terminal), or leave it open as a follow-up.'));
66
+ return 0;
67
+ }
@@ -92,7 +92,9 @@ async function commitRecord(ctx, feature, values, proposal) {
92
92
  return ctx.out(`${s.green('committed')} ${s.gray(sha)} ${message}`);
93
93
  }
94
94
  function reviewLine(ctx, review) {
95
- const notes = review.findings?.length ? `, ${review.findings.length} finding(s)` : '';
95
+ // The findings raised in this one round, not the ones open in all: the next line counts those.
96
+ const n = review.findings?.length ?? 0;
97
+ const notes = n ? `, raised ${n} finding${n === 1 ? '' : 's'}` : '';
96
98
  return `review ${review.id} ${review.step} round ${review.round}: ${tone(ctx.style, review.verdict)}${notes}`;
97
99
  }
98
100
  function specGateProblems(feature) {
@@ -263,6 +265,17 @@ async function approveCombined(ctx, feature, values) {
263
265
  await commitRecord(ctx, feature, values, proposedMessage(feature, 'spec design') || `${feature.key}: approve spec and design`);
264
266
  return 0;
265
267
  }
268
+ /** What accepting leaves open, so it is not accepted blind: counts by severity and where the list is. */
269
+ export function openFindingsLine(feature) {
270
+ const open = feature.findings.filter((f) => f.status === 'open');
271
+ if (!open.length)
272
+ return 'findings none open';
273
+ const counts = ['blocker', 'major', 'minor'].flatMap((s) => {
274
+ const n = open.filter((f) => f.severity === s).length;
275
+ return n ? [`${n} ${s}`] : [];
276
+ });
277
+ return `findings ${open.length} open (${counts.join(', ')}): npx agjan findings lists them`;
278
+ }
266
279
  async function approveVerify(ctx, feature, values) {
267
280
  const record = ready('accept the feature', gateReadiness(ctx, feature, 'verify'));
268
281
  const manual = feature.spec.parsed.acs.filter((ac) => ac.verification === 'manual').map((ac) => ac.id);
@@ -271,6 +284,7 @@ async function approveVerify(ctx, feature, values) {
271
284
  `change ${short(record.tree_hash)} (the files the verify review saw)`,
272
285
  reviewLine(ctx, record),
273
286
  manual.length ? `manual ${manual.join(', ')}: confirm that you tried them` : 'manual none (every AC has an automated test)',
287
+ openFindingsLine(feature),
274
288
  ];
275
289
  if (!(await confirmGate(ctx, feature, `accept the feature${previous}: implemented and verified`, lines)))
276
290
  return 1;
@@ -56,7 +56,7 @@ export function run(ctx, argv) {
56
56
  const next = gate === 'spec' ? 'agjan-design' : 'agjan-build';
57
57
  ctx.out(`${ctx.style.green(`approved ${gate} automatically`)} (auto mode, switched on by ${feature.approvals.auto.by})`);
58
58
  ctx.out(`commit the feature's documents (${message || `${feature.key}: approve ${gate} (auto mode)`}), then continue without stopping:`);
59
- ctx.out(`your next action is the shell command: cat .claude/skills/${next}/SKILL.md (then follow it).`);
59
+ ctx.out(`your next action is the shell command: npx agjan skill ${next.replace('agjan-', '')} (it prints the skill; then follow it).`);
60
60
  ctx.out('A reply without a tool call ends your run: put any note for the user into the same reply as that command.');
61
61
  ctx.out(`Do not tell the user to run /${next}: in auto mode you run it, now.`);
62
62
  }
@@ -189,13 +189,19 @@ function nextSteps(ctx, hosts, left) {
189
189
  ? `Commit the setup: ${s.cyan(`git add -A && git commit -m "${SETUP_COMMIT}"`)}`
190
190
  : `Commit the setup on a branch of its own and merge it with a PR: ${s.cyan(`git switch -c ${SETUP_BRANCH} && git add -A && git commit -m "${SETUP_COMMIT}"`)}`);
191
191
  }
192
- if (hosts.includes('claude-code')) {
192
+ // The doctor checks the setup, so it runs before the host is started. With Claude Code it
193
+ // also checks that the folder is trusted there, which only the host can do: it runs last.
194
+ const claude = hosts.includes('claude-code');
195
+ if (!claude)
196
+ steps.push(`Run: ${s.cyan('npx agjan doctor')}`);
197
+ if (claude) {
193
198
  steps.push("Open this folder once in Claude Code and trust it: the reviewer's agjan tools load only in trusted folders.");
194
199
  }
195
200
  if (hosts.includes('copilot')) {
196
201
  steps.push(`Start ${s.cyan('copilot')} in this folder and trust it.`);
197
202
  }
198
- steps.push(`Run: ${s.cyan('npx agjan doctor')}`);
203
+ if (claude)
204
+ steps.push(`Run: ${s.cyan('npx agjan doctor')} ${s.gray('(it also checks that Claude Code trusts the folder)')}`);
199
205
  return ['', s.bold('Next steps:'), ...steps.map((text, i) => ` ${i + 1}. ${text}`)];
200
206
  }
201
207
  /**
@@ -0,0 +1,22 @@
1
+ import { existsSync, readFileSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ import { AgjanError, UsageError } from '../errors.js';
4
+ export const HANDOFF_SKILLS = ['spec', 'design', 'build', 'verify'];
5
+ /**
6
+ * agjan skill <spec|design|build|verify>: prints the project's workflow skill, then a closing
7
+ * reminder. In auto mode the agent moves from one skill to the next within one run; reading a
8
+ * long skill and then ending the reply with a summary is how that run breaks (seen twice with
9
+ * Copilot), so what the agent reads last says that its next action is a tool call.
10
+ */
11
+ export function run(ctx, argv) {
12
+ const [name, ...rest] = argv;
13
+ if (!name || rest.length || !HANDOFF_SKILLS.includes(name)) {
14
+ throw new UsageError(`usage: agjan skill <${HANDOFF_SKILLS.join('|')}>`);
15
+ }
16
+ const file = join(ctx.root, '.claude', 'skills', `agjan-${name}`, 'SKILL.md');
17
+ if (!existsSync(file))
18
+ throw new AgjanError(`${file} does not exist; run 'npx agjan sync' to restore the skills`);
19
+ ctx.out(readFileSync(file, 'utf8').trimEnd());
20
+ ctx.out('', '---', `agjan: you are in the middle of one run (auto mode): you came here from the previous skill, and /agjan-${name} is yours to carry out now.`, 'Your next action is a tool call, not a message: run `npx agjan status`, then follow the skill above from its first step.', 'Do not summarize what was done so far and do not ask the user to run anything: the user gets the summary when the run ends (`npx agjan summary`). A reply without a tool call ends your run.');
21
+ return 0;
22
+ }
@@ -103,7 +103,7 @@ function nextInBuild(ctx, feature, progress) {
103
103
  function findingCount(ctx, open) {
104
104
  const blockers = open.filter((f) => f.severity === 'blocker').length;
105
105
  const text = `${open.length} open, ${blockers} blocker(s)`;
106
- return blockers ? ctx.style.red(text) : ctx.style.yellow(text);
106
+ return `${blockers ? ctx.style.red(text) : ctx.style.yellow(text)} ${ctx.style.gray('(npx agjan findings lists them)')}`;
107
107
  }
108
108
  /** A fix or a map run: its checks, its review, and the next step. */
109
109
  function describeRecord(ctx, unit, onBase = false) {
@@ -0,0 +1,37 @@
1
+ import { parseArgs } from 'node:util';
2
+ import { changedFeatures, listFeatures } from '../feature.js';
3
+ import { UsageError } from '../errors.js';
4
+ import { unitModel } from '../progress-view.js';
5
+ import { storyEnd, storyItems } from '../story.js';
6
+ import { markLine } from '../ui.js';
7
+ /**
8
+ * agjan summary [--feature <slug>]: what has been done so far, in plain words and in order
9
+ * (requirement, spec, reviews, revisions, design, build, checks), ending with what the work
10
+ * waits for. The agents put it into their final message; anyone can run it at any time.
11
+ */
12
+ export function run(ctx, argv) {
13
+ const { values } = parseArgs({ args: argv, options: { feature: { type: 'string' } } });
14
+ const root = ctx.root;
15
+ if (values.feature && !listFeatures(root).includes(values.feature))
16
+ throw new UsageError(`no feature '${values.feature}'`);
17
+ const slugs = values.feature ? [values.feature] : changedFeatures(root, ctx.config);
18
+ const s = ctx.style;
19
+ for (const line of markLine(s, ctx.kit, 'summary'))
20
+ ctx.out(line);
21
+ if (!slugs.length) {
22
+ ctx.out('no changed feature on this branch (pass --feature <slug>; agjan status --all lists every feature)');
23
+ return 0;
24
+ }
25
+ for (const slug of slugs) {
26
+ const model = unitModel(ctx, slug, { now: Date.parse(ctx.now()) });
27
+ ctx.out('', `${s.bold(model.slug)} ${s.gray(`(${model.key})`)}`, '');
28
+ for (const item of storyItems(model))
29
+ ctx.out(` ${s.green('✔')} ${item.text}`);
30
+ const end = storyEnd(model);
31
+ const mark = end.turn === 'you' ? s.violet('⏳') : end.turn === 'agent' ? s.cyan('▶') : s.green('✔');
32
+ ctx.out(` ${mark} ${s.bold(end.text)}`);
33
+ if (end.next)
34
+ ctx.out(` ${s.gray('Your next step:')} ${s.cyan(end.next)}`);
35
+ }
36
+ return 0;
37
+ }
@@ -269,6 +269,7 @@ export function unitModel(ctx, slug, { onBase = false, now = Date.now() } = {})
269
269
  now: stage.now,
270
270
  optional: stage.turn === 'done' ? finalSteps(ctx.root, unit, { accepted: true }).optional : [],
271
271
  start: iso(start),
272
+ created: unit.approvals.feature.created_at_utc,
272
273
  end: iso(end),
273
274
  last: iso(last),
274
275
  host,
package/dist/review.js CHANGED
@@ -132,7 +132,7 @@ function reviewHistory(feature) {
132
132
  if (feature.reviews.records.length === 0)
133
133
  return '(none)';
134
134
  return feature.reviews.records
135
- .map((r) => `- ${r.id} ${r.step} round ${r.round}: ${r.verdict}, ${r.findings?.length ?? 0} finding(s)`)
135
+ .map((r) => `- ${r.id} ${r.step} round ${r.round}: ${r.verdict}, raised ${r.findings?.length ?? 0} finding(s)`)
136
136
  .join('\n');
137
137
  }
138
138
  function openFindings(feature, steps) {
package/dist/story.js ADDED
@@ -0,0 +1,110 @@
1
+ const PLAIN_SEVERITY = { blocker: 'blocking', major: 'important', minor: 'minor' };
2
+ /** "3 findings (1 important, 2 minor)", or "no findings". */
3
+ function findingsText(model, ids) {
4
+ if (!ids.length)
5
+ return 'no findings';
6
+ const count = {};
7
+ for (const id of ids)
8
+ count[model.findings[id].severity] = (count[model.findings[id].severity] ?? 0) + 1;
9
+ const parts = ['blocker', 'major', 'minor'].filter((k) => count[k]).map((k) => `${count[k]} ${PLAIN_SEVERITY[k]}`);
10
+ return `${ids.length} finding${ids.length === 1 ? '' : 's'} (${parts.join(', ')})`;
11
+ }
12
+ /** What a review step is called in a sentence the first time, again, and what is revised after it. */
13
+ function subject(step) {
14
+ if (step === 'spec')
15
+ return { name: 'the spec', first: 'Spec reviewed', again: 'Spec reviewed again', revised: 'Spec revised', clean: 'no findings' };
16
+ if (step === 'design')
17
+ return { name: 'the design', first: 'Design reviewed', again: 'Design reviewed again', revised: 'Design revised', clean: 'no findings' };
18
+ if (step === 'design:light')
19
+ return { name: 'the spec and design', first: 'Spec and design reviewed', again: 'Spec and design reviewed again', revised: 'Spec and design revised', clean: 'no findings' };
20
+ if (step === 'qa')
21
+ return { name: 'the independent tests', first: 'Independent tests written from the spec', again: 'Independent tests run again', revised: 'Code fixed', clean: 'all passed' };
22
+ if (step === 'verify')
23
+ return { name: 'the final check', first: 'Final check', again: 'Final check repeated', revised: 'Code fixed', clean: 'everything checks out' };
24
+ const part = step.replace(/^build:/, '');
25
+ return { name: `the code (${part})`, first: `Code checked (${part})`, again: `Code checked again (${part})`, revised: `Code revised (${part})`, clean: 'no findings' };
26
+ }
27
+ /** The part of an e-mail address before the `@`: names read better than addresses. */
28
+ const who = (by) => by.split('@')[0];
29
+ /** The chronological list of what has been done, from the progress model. */
30
+ export function storyItems(model) {
31
+ const items = [];
32
+ const t = (iso) => Date.parse(iso);
33
+ const add = (at, text, rank = 5) => items.push({ at: typeof at === 'number' ? at : t(at), text, rank });
34
+ // The time the unit was created, not the first logged event: `agjan new` logs nothing.
35
+ add(model.created && model.created < model.start ? model.created : model.start, model.kind === 'feature' ? 'Requirement received' : model.kind === 'fix' ? 'Change requested' : 'Mapping of the project started', 0);
36
+ // Before the first review of a step, its document was prepared.
37
+ const firstReview = (steps) => model.reviews.filter((r) => steps.includes(r.step)).map((r) => t(r.at)).sort((a, b) => a - b)[0];
38
+ const specAt = firstReview(['spec']) ?? (model.mode === 'light' ? firstReview(['design:light']) : undefined);
39
+ if (specAt !== undefined)
40
+ add(specAt - 2, 'Draft spec prepared', 2);
41
+ const designAt = firstReview(['design', 'design:light']);
42
+ if (designAt !== undefined)
43
+ add(designAt - 2, `Design prepared (${model.tasks.length} task${model.tasks.length === 1 ? '' : 's'})`, 2);
44
+ for (const e of model.events) {
45
+ if (e.event === 'auto-on')
46
+ add(e.at, 'Auto mode switched on: spec and design are approved automatically after their review', 1);
47
+ if (e.event === 'auto-off')
48
+ add(e.at, 'Auto mode switched off');
49
+ if (e.event === 'amendment-proposed')
50
+ add(e.at, `Scope change proposed${e.amendment ? ` (${e.amendment})` : ''}`);
51
+ if (e.event === 'round-granted')
52
+ add(e.at, `You allowed another review round for ${subject(String(e.step)).name}`);
53
+ }
54
+ // Reviews: a later review of the same step means the work was revised in between.
55
+ const seen = new Map();
56
+ for (const r of [...model.reviews].sort((a, b) => t(a.at) - t(b.at))) {
57
+ const words = subject(r.step);
58
+ const before = seen.get(r.step) ?? 0;
59
+ seen.set(r.step, before + 1);
60
+ if (before)
61
+ add(t(r.at) - 1, words.revised, 3);
62
+ const fixed = r.resolves.length ? `; ${r.resolves.length} earlier finding${r.resolves.length === 1 ? '' : 's'} fixed` : '';
63
+ add(r.at, `${before ? words.again : words.first}: ${r.findings.length ? findingsText(model, r.findings) : words.clean}${fixed}`, 4);
64
+ }
65
+ for (const d of model.decisions) {
66
+ const auto = d.by.startsWith('auto mode');
67
+ const approved = /^approved (spec and design|spec|design)$/.exec(d.what);
68
+ if (approved)
69
+ add(d.at, `${approved[1][0].toUpperCase()}${approved[1].slice(1)} approved ${auto ? 'automatically (auto mode)' : `by ${who(d.by)}`}`);
70
+ else if (d.what === 'accepted the feature')
71
+ add(d.at, `Feature accepted by ${who(d.by)}`);
72
+ else if (d.what.startsWith('accepted '))
73
+ add(d.at, `${d.what.replace('accepted ', 'Finding ')} accepted by ${who(d.by)}${d.detail ? `: ${d.detail}` : ''}`);
74
+ else if (d.what.startsWith('rejected '))
75
+ add(d.at, `${d.what[0].toUpperCase()}${d.what.slice(1)} by ${who(d.by)}${d.detail ? `: ${d.detail}` : ''}`);
76
+ else if (d.what.startsWith('approved amendment'))
77
+ add(d.at, `Scope change approved by ${who(d.by)}`);
78
+ }
79
+ for (const task of model.tasks) {
80
+ if (!task.done)
81
+ continue;
82
+ const at = Math.max(...model.commits.filter((c) => task.commits.includes(c.sha)).map((c) => t(c.at)), 0);
83
+ if (at)
84
+ add(at, `Built: ${task.title}`, 6);
85
+ }
86
+ return items.sort((a, b) => a.at - b.at || a.rank - b.rank);
87
+ }
88
+ /** The command or skill in a "now" text, and the text without it. */
89
+ function splitNow(now) {
90
+ const command = /\((npx agjan [^)]+)\)/.exec(now)?.[1] ?? /(\/agjan-[a-z-]+)/.exec(now)?.[1] ?? null;
91
+ const text = now
92
+ .replace(/\s*\(npx agjan [^)]+\)/, '')
93
+ .replace(/:\s*\/agjan-[a-z-]+.*$/, '')
94
+ .replace(/^verified:\s*/, '')
95
+ .replace(/ in a terminal/g, '')
96
+ .trim();
97
+ return { text, command };
98
+ }
99
+ /** What the story ends with: who or what the work waits for. */
100
+ export function storyEnd(model) {
101
+ if (model.turn === 'merged')
102
+ return { turn: 'merged', text: 'Merged', next: null };
103
+ if (model.turn === 'done')
104
+ return { turn: 'done', text: 'Done: built, verified and accepted', next: null };
105
+ const { text, command } = splitNow(model.now);
106
+ if (model.turn === 'you')
107
+ return { turn: 'you', text: `Now waiting for you: ${text}`, next: command };
108
+ const auto = /^auto mode:\s*(.*)$/.exec(text);
109
+ return { turn: model.turn, text: auto ? `Next, by itself (auto mode): ${auto[1].replace(/ is next$/, '')}` : `Now in progress: ${text}`, next: null };
110
+ }
package/docs/guide.md CHANGED
@@ -124,6 +124,8 @@ your terminal:
124
124
  ```sh
125
125
  npx agjan status # what is ready and what blocks it
126
126
  npx agjan review show # the reviews and findings
127
+ npx agjan findings # only the open findings, by severity
128
+ npx agjan summary # what has been done so far, in plain words
127
129
  npx agjan review report # the latest round, short: verdict, findings, what happens next
128
130
  npx agjan approve spec design # light mode; full mode: approve spec, later approve design
129
131
  ```
@@ -132,6 +134,17 @@ After every review the agent shows you that short report in its message: the ver
132
134
  findings by severity (🔴 blocker, 🟠 major, 🟡 minor), what the round resolved, the rounds
133
135
  of the loop so far (`LVR-R1 ⛔ → LVR-R2 ✅`) and what the agent does next.
134
136
 
137
+ **Which findings stay open.** `npx agjan findings` lists the open ones by severity (and `approve verify` shows how many are open before you type the key), with the
138
+ file and what is wrong (`--all` adds resolved and accepted ones). Only an open blocker stops a
139
+ gate; majors and minors do not.
140
+ Minors are left open on purpose (fixing them would need another review round, which can
141
+ raise more). To keep the list honest: a reviewer does not file a finding that an open one
142
+ already covers; severity follows the harm (a contradiction of an AC, or a requirement no AC
143
+ covers, is never minor); and before the final review `/agjan-verify` fixes the majors it
144
+ agrees with, settles each "Unverified" finding with one command or test, and leaves the
145
+ other minors for the PR summary. A major it did not fix, and the reason, is in its final
146
+ message.
147
+
135
148
  `approve` shows a summary and asks you to type the feature key. It refuses when the
136
149
  latest review did not see the current files or has open blockers. After recording the
137
150
  approval it offers to commit the feature folder, with the message the agent proposed
@@ -260,6 +273,31 @@ cannot switch it on: like `approve`, it needs your terminal, and the guard denie
260
273
 
261
274
  ### Following the progress
262
275
 
276
+ **`npx agjan summary`** tells what has been done so far in plain words, in order, ending
277
+ with what the work waits for:
278
+
279
+ ```text
280
+ team-leave-requests (TLR)
281
+
282
+ ✔ Requirement received
283
+ ✔ Draft spec prepared
284
+ ✔ Spec reviewed: 3 findings (1 important, 2 minor)
285
+ ✔ Spec revised
286
+ ✔ Spec reviewed again: no findings; 3 earlier findings fixed
287
+ ✔ Spec approved automatically (auto mode)
288
+ ✔ Design prepared (5 tasks)
289
+ …
290
+ ✔ Built: Fiori elements app for managers
291
+ ✔ Independent tests written from the spec: all passed
292
+ ✔ Final check: everything checks out
293
+ ⏳ Now waiting for you: check TLR-AC11 by hand, then accept it
294
+ Your next step: npx agjan approve verify
295
+ ```
296
+
297
+ The agent shows it in its message when the build is done (manual mode) and with its final
298
+ message after the verification. Anyone can run it at any time (`--feature <slug>` for another
299
+ feature). The technical timeline, with rounds and commits, is below.
300
+
263
301
  agjan keeps a progress page for every unit and regenerates it after every event it
264
302
  records (step, review, approval, amendment, fix record):
265
303
 
@@ -328,6 +366,8 @@ Run `npx agjan --help` for the full list.
328
366
  | `check [--staged \| --ci] [--base <ref>]` | anyone, hook, CI | enforce the rules |
329
367
  | `lint [--all]` | anyone | the area linters (UI5 linter for Fiori apps) on the changed files |
330
368
  | `ui-test [--require]` | anyone | the Playwright UI tests where Chromium can start; otherwise the reason, and a skip |
369
+ | `findings [--all] [--feature <slug>]` | anyone | the open findings by severity, each with file and issue |
370
+ | `summary [--feature <slug>]` | anyone | what has been done so far in plain words, and what the work waits for |
331
371
  | `review show [--step <step>]` | anyone | review records, or the material a reviewer gets |
332
372
  | `review report [--step <step>]` | anyone | the latest review round as a short report (agents show it after each review) |
333
373
  | `pr-summary`, `report` | anyone | PR description; `report.md` with time and tokens |
@@ -8,6 +8,12 @@ description: Build an approved agjan design task by task, within the approved pa
8
8
  Implement `tasks.md` in order. The approved design is the contract: build what it says,
9
9
  where it says.
10
10
 
11
+ ## Arriving in auto mode
12
+
13
+ In auto mode you reach this skill from the previous one within one run, through `npx agjan skill build`.
14
+ Then start step 1 at once, with a tool call: no summary of the work so far first (the user gets it
15
+ when the run ends, `npx agjan summary`), and no request to run `/agjan-build`: you are running it.
16
+
11
17
  ## 1. Preconditions
12
18
 
13
19
  `npx agjan status` must show `stage: build` (spec and design approved). Otherwise stop
@@ -55,13 +61,19 @@ Do not change it silently; `agjan check` fails on it.
55
61
 
56
62
  ## 4. Done
57
63
 
58
- When `npx agjan status` says all tasks are done and reviewed, tell the user to run
59
- `/agjan-verify`. In auto mode (`npx agjan status` shows `auto on`) do not stop: your next
60
- action is the shell command `cat .claude/skills/agjan-verify/SKILL.md` (it works on every
61
- host), then follow that skill; put a one-line note for the user into the same reply, since
62
- a reply without a tool call ends your run. Do not end your reply with "run `/agjan-verify`":
63
- in auto mode that is your next action. Its final acceptance, `npx agjan approve
64
- verify`, stays with the user in every mode.
64
+ When `npx agjan status` says all tasks are done and reviewed:
65
+
66
+ - **Manual mode:** put the output of `npx agjan summary` into your message unchanged, in a
67
+ code block (what has been done so far, in plain words, and what the work waits for), then
68
+ tell the user to run `/agjan-verify`.
69
+ - **Auto mode** (`npx agjan status` shows `auto on`): do not stop. Your next action is the
70
+ shell command `npx agjan skill verify` (it works on every host), then
71
+ follow that skill; put a one-line note for the user into the same reply, since a reply
72
+ without a tool call ends your run. Do not end your reply with "run `/agjan-verify`": in
73
+ auto mode that is your next action. The summary comes in the final message of
74
+ `/agjan-verify`.
75
+
76
+ Its final acceptance, `npx agjan approve verify`, stays with the user in every mode.
65
77
 
66
78
  ## Never
67
79
 
@@ -8,6 +8,12 @@ description: Full-mode agjan design. After the spec is approved, the role skills
8
8
  Answer the approved spec technically: areas, decisions, tasks. Light changes are
9
9
  designed by `/agjan-spec`; this skill is for full mode.
10
10
 
11
+ ## Arriving in auto mode
12
+
13
+ In auto mode you reach this skill from the previous one within one run, through `npx agjan skill design`.
14
+ Then start step 1 at once, with a tool call: no summary of the work so far first (the user gets it
15
+ when the run ends, `npx agjan summary`), and no request to run `/agjan-design`: you are running it.
16
+
11
17
  ## 1. Preconditions
12
18
 
13
19
  Run `npx agjan status`. The spec must be `approved`. If it is not, stop and tell the
@@ -99,7 +105,7 @@ passing one.
99
105
  automatically. Commit the feature folder with the message it gives, show the user the
100
106
  last review report and one line that the gate passed in auto mode, and
101
107
  continue without stopping: your next action is the shell command
102
- `cat .claude/skills/agjan-build/SKILL.md` (it works on every host), then follow that skill.
108
+ `npx agjan skill build` (it works on every host), then follow that skill.
103
109
  Put the one line for the user into the same reply as that command: a reply without a
104
110
  tool call ends your run, and the user has to start it again. Do not end your reply with
105
111
  "run `/agjan-build`": in auto mode that is your next action, not the user's.
@@ -135,8 +135,8 @@ with it yourself right away (step 3 below), otherwise the user runs `/agjan-desi
135
135
  automatically (it says `approved … automatically`). Commit the feature folder with the
136
136
  message it gives, show the user the `npx agjan review report` of the last review and
137
137
  one line that the gate passed in auto mode, and continue without stopping: your next
138
- action is the shell command `cat .claude/skills/agjan-design/SKILL.md` (it works on
139
- every host; `agjan-build` after `spec design`), then follow that skill. Put the one line
138
+ action is the shell command `npx agjan skill design` (it works on every host;
139
+ `npx agjan skill build` after the combined gate `spec design`), then follow that skill. Put the one line
140
140
  for the user into the same reply as that command: a reply without a tool call ends
141
141
  your run, and the user has to start it again.
142
142
  Do not end your reply with "run `/agjan-design`" (or `/agjan-build`): in auto mode that
@@ -8,6 +8,12 @@ description: Verify a built agjan feature. Full build, tests and lint, the basel
8
8
  Prove that the feature is complete and consistent, and hand it to the human, who
9
9
  accepts it (Gate 3, `npx agjan approve verify`).
10
10
 
11
+ ## Arriving in auto mode
12
+
13
+ In auto mode you reach this skill from the previous one within one run, through `npx agjan skill verify`.
14
+ Then start step 1 at once, with a tool call: no summary of the work so far first (the user gets it
15
+ when the run ends, `npx agjan summary`), and no request to run `/agjan-verify`: you are running it.
16
+
11
17
  ## 1. Preconditions
12
18
 
13
19
  `npx agjan status` must say `next: all tasks done and reviewed`. Otherwise stop and
@@ -78,6 +84,26 @@ them and records the result. Its tests stay in the project as regression tests.
78
84
  The final review (next section) waits until QA has passed, and so do `check --ci` and
79
85
  the acceptance.
80
86
 
87
+ ## 5b. Settle what is open
88
+
89
+ Before the final review, read the open findings of all steps (`npx agjan status`, `npx agjan
90
+ review show`) and clear what you can within the approved task paths, so the user gets a short
91
+ list:
92
+
93
+ 1. **Majors:** fix those you agree with, in new commits with the subject of the task they
94
+ belong to (`<KEY>-<id>: …`); a fix makes that area's build review due again, so do it before
95
+ the final review. For one you disagree with, keep your reason for the final message.
96
+ 2. **"Unverified:" findings** about the app's behavior: settle each with one command or test,
97
+ for example a request with `curl`, a test that does what the finding doubts (a `PATCH` of a
98
+ draft, a call as the user the rule excludes), or the UI test run. Add a test to the area's
99
+ tests when it is worth keeping. The final review then lists the finding in `resolves` when
100
+ it is fixed or disproved. Do not remove working code on the strength of an unverified claim.
101
+ 3. **Findings about the spec or the design** are not fixed here. Mention the ones that matter
102
+ in the final message; a change to the spec is a revision (`/agjan-spec`, section 7).
103
+ 4. **Other minors** stay open: they go to the user in the PR summary. Do not chase style.
104
+
105
+ Do not start extra review rounds for minors.
106
+
81
107
  ## 6. Final review (step `verify`, deep)
82
108
 
83
109
  Everything must be committed. When all your edits are saved, delegate, on its own (not in parallel with other tool calls), to the reviewer agent that `npx agjan status` names for the step (default `agjan-reviewer-deep`), with exactly this prompt (Claude Code: the Agent tool with that subagent type; GitHub Copilot: the task tool with that custom agent and a short `name`, for example `spec review`):
@@ -101,8 +127,11 @@ Any change after the final review makes it stale; review again after the last ch
101
127
  - Finish with `npx agjan status --done`. Your final message starts with its output,
102
128
  **verbatim, in a code block**: it says that the feature is verified, what was met, and
103
129
  the user's turn: try it, check the manual ACs by hand, and accept it in their terminal
104
- with `npx agjan approve verify`. After it, add only what the user must know that it does
105
- not say (for example what you could not check yourself). Then stop: never run
130
+ with `npx agjan approve verify`. Then the output of `npx agjan summary`, verbatim, in a
131
+ second code block: the story of the whole work in plain words, ending with what it waits
132
+ for. After it, add only what the user must know that it does
133
+ not say (for example what you could not check yourself, a major you left open and why, or
134
+ an "Unverified" finding you could not settle). Then stop: never run
106
135
  `agjan approve` yourself, also in auto mode: the acceptance is always the user's.
107
136
  Opening a pull request is optional, done only when the user
108
137
  asks (its description is the output of `npx agjan pr-summary`).
@@ -70,6 +70,13 @@ service LeaveService {
70
70
  the project's `@sap/cds` version with `search_docs`). Validation that must hold for
71
71
  saved data therefore belongs in `before CREATE/UPDATE` handlers of the active entity, or
72
72
  better in annotations; `SAVE` on `Entity.drafts` runs before the activation.
73
+ - **Draft authorization is derived; grant nothing for draft events.** The grants of the
74
+ active entity decide: `CREATE` lets a user create a new draft and then edit (`PATCH`),
75
+ discard and activate it; `UPDATE` lets a user open an active row for editing (`EDIT`) and
76
+ then edit, discard and activate that draft. Only the user who created a draft can edit
77
+ it. So an entity that users only create through the app needs `READ` and `CREATE`, and
78
+ `PATCH` on the draft is allowed by them: do not add `UPDATE` "for the draft", and do not
79
+ treat a `403` on a draft `PATCH` as likely.
73
80
  - `SELECT.from(Entity)` reads active data, `SELECT.from(Entity.drafts)` draft data. Do
74
81
  not filter on draft properties by hand.
75
82
  - Introducing drafts changes how handlers run; it is a design decision.
@@ -62,7 +62,9 @@ describe('LeaveService', () => {
62
62
  saves it, and that is where `@assert`, `@mandatory` and `before CREATE` handlers answer
63
63
  400. Test the activation, not only the first `POST`. Active rows have the key
64
64
  `(ID=…,IsActiveEntity=true)`; a list read returns drafts too unless you filter
65
- `IsActiveEntity eq true`.
65
+ `IsActiveEntity eq true`. Between the two, `PATCH` a field of the draft as the same user:
66
+ that is the call the Fiori form makes while editing, and it shows the authorization and
67
+ the draft-time checks the user will meet.
66
68
  - Every `where` of an `@restrict` gets a test with a user of the role whom the condition
67
69
  excludes (here `manager2`, a manager of another team), for every operation it guards,
68
70
  including bound actions.
@@ -125,6 +125,10 @@ service LeaveService {
125
125
  }
126
126
  ```
127
127
 
128
+ - In the example, `employee` can create a request and then edit it as a draft with only
129
+ `READ` and `CREATE`: draft events are authorized from the grants of the active entity
130
+ (`CREATE` covers creating, editing, discarding and activating the user's own new draft;
131
+ `UPDATE` would cover editing existing active rows). See `services.md`, Drafts.
128
132
  - Project configuration goes into the `cds` section of `package.json`, where `cds init`
129
133
  and `cds add` put it; use `.cdsrc.json` only if the project already uses it. Personal,
130
134
  local settings belong in `.cdsrc-private.json`, which is not committed.
@@ -189,6 +189,9 @@ actions (approve, reject).
189
189
  (`@odata.draft.enabled` on `LeaveRequests` in `srv/leave-service.cds`), or in the app's
190
190
  annotations file (`annotate service.Incidents with @odata.draft.enabled;`, as the
191
191
  incidents app does).
192
+ - Authorization needs nothing extra for the draft: the user who may `CREATE` the entity may
193
+ edit their new draft, and `UPDATE` covers editing existing rows (cap-developer
194
+ `services.md`, Drafts).
192
195
  - What changes: keys include `IsActiveEntity`; `POST` creates a draft and
193
196
  `draftActivate` saves it, which is when `@assert`, `@mandatory` and `before CREATE`
194
197
  handlers run. `@restrict` grants (`CREATE`, `UPDATE`) apply to the draft events too.
@@ -35,11 +35,30 @@ Severity:
35
35
  - `major`: a real problem that should be fixed, but does not make the result wrong.
36
36
  - `minor`: style, wording, small improvements.
37
37
 
38
+ Severity follows the harm, not the wish for a pass. These are never `minor`:
39
+
40
+ - The document or the code contradicts an AC or a rule the spec states (for example another
41
+ status code, text or rule than the AC says): at least `major`, and `blocker` when the AC
42
+ cannot be met as written.
43
+ - A requirement the spec states (an authorization rule, a validation, a limit) that no AC
44
+ covers, or an AC that no test exercises: `major`.
45
+
46
+ Do not lower a real defect to `minor` to let the step pass.
47
+
38
48
  Each finding states the file and line where possible (with the repository paths the
39
49
  review context uses), the issue in one or two sentences, and a concrete suggestion. In
40
50
  `resolves`, list the ids of earlier open findings that the current material has fixed;
41
51
  only those.
42
52
 
53
+ ## Open findings are not filed again
54
+
55
+ The review context lists the findings that are still open under "Open findings". Read it
56
+ before you write yours. If an open finding already covers an issue (the same cause, or the
57
+ same place), do not file it again, not even when a later step shows it from another side:
58
+ it stays open until the material fixes it, and then you list its id in `resolves`. File a
59
+ new finding only for what no open finding covers. Repeating one only makes the list longer
60
+ and hides what is new.
61
+
43
62
  ## Technical claims need evidence
44
63
 
45
64
  A finding that says an API, annotation, configuration or syntax is wrong must name its
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agjan",
3
- "version": "0.0.18",
3
+ "version": "0.0.20",
4
4
  "description": "Agentic engineering harness for AI coding agents: role agents, human approval gates, independent review and CI-enforced checks. SAP BTP first.",
5
5
  "keywords": [
6
6
  "agentic-engineering",