agjan 0.0.28 → 0.0.29
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/commands/models.js +4 -1
- package/dist/commands/review.js +2 -1
- package/dist/commands/status.js +3 -2
- package/dist/commands/workflow.js +5 -1
- package/dist/config.js +11 -0
- package/dist/customization.js +26 -0
- package/dist/progress-view.js +3 -2
- package/dist/progress.js +4 -2
- package/dist/qa.js +4 -2
- package/dist/review-policy.js +78 -12
- package/dist/review.js +2 -2
- package/dist/workflow-skill.js +6 -2
- package/dist/workflow-view.js +20 -10
- package/docs/guide.md +29 -0
- package/docs/workflows-and-teams.md +2 -1
- package/kit/skills/agjan-verify/SKILL.md +1 -1
- package/package.json +1 -1
- package/schemas/config.schema.json +20 -0
package/dist/commands/models.js
CHANGED
|
@@ -18,7 +18,10 @@ function stepsOf(config, tier) {
|
|
|
18
18
|
if (tier === 'qa')
|
|
19
19
|
return 'tests from the spec in Verify';
|
|
20
20
|
const kinds = Object.keys(DEFAULT_TIERS).filter((kind) => kind !== 'qa' && reviewerFor(config, kind) === AGENTS[tier].agent);
|
|
21
|
-
|
|
21
|
+
// Workflows whose own review.tiers send a step to another agent than the project's.
|
|
22
|
+
const own = Object.keys(config.workflows ?? {}).flatMap((name) => Object.keys(config.workflows[name].review?.tiers ?? {}).filter((kind) => reviewerFor(config, kind, name) === AGENTS[tier].agent && reviewerFor(config, kind) !== AGENTS[tier].agent).map((kind) => `${kind} (${name})`));
|
|
23
|
+
const all = [...kinds, ...own];
|
|
24
|
+
return all.length ? `reviews ${all.join(', ')}` : 'no steps (review.tiers)';
|
|
22
25
|
}
|
|
23
26
|
/** Model names grouped by family, for reading: Claude, GPT, Gemini, the others. */
|
|
24
27
|
function families(models) {
|
package/dist/commands/review.js
CHANGED
|
@@ -5,6 +5,7 @@ import { buildContextText, parseStep } from '../review.js';
|
|
|
5
5
|
import { loadFeature, selectFeature } from '../feature.js';
|
|
6
6
|
import { appendLog } from '../log.js';
|
|
7
7
|
import { reviewerFor, roundState } from '../review-policy.js';
|
|
8
|
+
import { unitWorkflow } from '../customization.js';
|
|
8
9
|
import { highlightMarkdown, tone } from '../ui.js';
|
|
9
10
|
import { AgjanError, UsageError } from '../errors.js';
|
|
10
11
|
/** agjan mcp [--host <name>] [--isolation agent|fork|none] [--role review|qa]: the agjan MCP server on stdio. */
|
|
@@ -75,7 +76,7 @@ export function report(ctx, argv) {
|
|
|
75
76
|
// The reviewer's isolation matters to the user only when it is missing.
|
|
76
77
|
const isolated = record.reviewer?.isolation === 'agent';
|
|
77
78
|
if (values.full || !isolated) {
|
|
78
|
-
out.push(`- reviewer: ${reviewerFor(ctx.config, record.step)} on ${record.reviewer?.host ?? 'unknown host'}, ${isolated ? 'isolated' : `⚠️ isolation ${record.reviewer?.isolation ?? 'unknown'}`}`);
|
|
79
|
+
out.push(`- reviewer: ${reviewerFor(ctx.config, record.step, unitWorkflow(feature))} on ${record.reviewer?.host ?? 'unknown host'}, ${isolated ? 'isolated' : `⚠️ isolation ${record.reviewer?.isolation ?? 'unknown'}`}`);
|
|
79
80
|
}
|
|
80
81
|
const order = { blocker: 0, major: 1, minor: 2 };
|
|
81
82
|
const sorted = [...record.findings].sort((a, b) => order[a.severity] - order[b.severity]);
|
package/dist/commands/status.js
CHANGED
|
@@ -75,9 +75,10 @@ function reviewNext(ctx, feature, step) {
|
|
|
75
75
|
return `the ${step} review is still blocked after ${state.round} of ${state.limit} rounds: ask the user whether to run another round (yes: npx agjan review extend ${step}) or to stop and take over (fix with them, accept findings, or change the documents)`;
|
|
76
76
|
}
|
|
77
77
|
const round = state.round ? `, round ${state.next} of ${state.limit}` : '';
|
|
78
|
+
const reviewer = reviewerFor(ctx.config, step, unitWorkflow(feature));
|
|
78
79
|
if (step === QA_STEP)
|
|
79
|
-
return `QA (step qa) with ${
|
|
80
|
-
return `review step ${step} with ${
|
|
80
|
+
return `QA (step qa) with ${reviewer}${round}`;
|
|
81
|
+
return `review step ${step} with ${reviewer}${round}`;
|
|
81
82
|
}
|
|
82
83
|
/**
|
|
83
84
|
* What a pending extra of the workflow needs (decision 95): an extra review is run like the
|
|
@@ -22,6 +22,8 @@ function listed(ctx, name) {
|
|
|
22
22
|
extraStages: STAGES[base],
|
|
23
23
|
team: defaultTeam(ctx.config, name),
|
|
24
24
|
extras: { reviews: extras.reviews.map((r) => r.id), gates: extras.gates.map((g) => g.id) },
|
|
25
|
+
/** The workflow's own review settings (`workflows.<name>.review`), as written; `workflow show` resolves them. */
|
|
26
|
+
review: { ...(ctx.config.workflows?.[name]?.review ?? {}) },
|
|
25
27
|
};
|
|
26
28
|
}
|
|
27
29
|
const SOURCE = { 'built-in': 'built in', imported: 'imported', project: 'agjan.config.json' };
|
|
@@ -95,7 +97,9 @@ export function run(ctx, argv) {
|
|
|
95
97
|
ctx.out(` ${''.padEnd(21)} ${s.gray(persona.instructions.trim().replace(/\s+/g, ' '))}`);
|
|
96
98
|
}
|
|
97
99
|
}
|
|
98
|
-
|
|
100
|
+
const own = Object.entries(view.review.override).map(([key, value]) => (typeof value === 'object' && value ? Object.entries(value).map(([k, v]) => `${key}.${k} ${v}`).join(', ') : `${key} ${value}`));
|
|
101
|
+
ctx.out('', s.gray(own.length ? `Review settings of this workflow (workflows.${name}.review): ${own.join(', ')}; the others are the project's (review) or agjan's defaults.` : `Review settings: the project's (review) or agjan's defaults; workflows.${name}.review overrides them for this workflow.`));
|
|
102
|
+
ctx.out(s.gray(`Every workflow keeps: ${view.controls.join(', ')}. A team adds knowledge; it cannot remove a step.`));
|
|
99
103
|
for (const p of view.team?.problems ?? [])
|
|
100
104
|
ctx.out(`${s.red('problem')} ${p}`);
|
|
101
105
|
return view.team?.problems.length ? 1 : 0;
|
package/dist/config.js
CHANGED
|
@@ -64,6 +64,16 @@ export function loadDomain(id) {
|
|
|
64
64
|
throw new AgjanError(`unknown domain '${id}'`);
|
|
65
65
|
return domain;
|
|
66
66
|
}
|
|
67
|
+
/** The project's own `review` settings (agjan.config.json as written), by the configuration loadConfig made of it. */
|
|
68
|
+
const writtenReview = new WeakMap();
|
|
69
|
+
/**
|
|
70
|
+
* Whether agjan.config.json itself sets `review.<key>` (so a resolved value is the project's,
|
|
71
|
+
* not agjan's default); undefined for a configuration loadConfig did not make.
|
|
72
|
+
*/
|
|
73
|
+
export function projectSetsReview(config, key) {
|
|
74
|
+
const written = writtenReview.get(config);
|
|
75
|
+
return written ? written[key] !== undefined : undefined;
|
|
76
|
+
}
|
|
67
77
|
/**
|
|
68
78
|
* Loads the effective configuration of the project at `root`: package defaults, then
|
|
69
79
|
* the enabled domains' defaults, then agjan.config.json. Also resolves the areas of all
|
|
@@ -121,6 +131,7 @@ export function loadConfig(root) {
|
|
|
121
131
|
config.teams = { ...imported, ...(config.teams ?? {}) };
|
|
122
132
|
config.domains = domainIds;
|
|
123
133
|
config.areas = areas;
|
|
134
|
+
writtenReview.set(config, isObject(project.review) ? project.review : {});
|
|
124
135
|
return config;
|
|
125
136
|
}
|
|
126
137
|
/**
|
package/dist/customization.js
CHANGED
|
@@ -78,6 +78,32 @@ export function workflowConfigProblems(config) {
|
|
|
78
78
|
if (r.role && !roles(r.role))
|
|
79
79
|
problems.push(`${where}.reviews.${r.id}: role '${r.role}' does not reach the reviewer (the reviewer, or a role under "roles" with agent "reviewer")`);
|
|
80
80
|
}
|
|
81
|
+
if (base && w.review)
|
|
82
|
+
problems.push(...workflowReviewProblems(where, base, w.review));
|
|
83
|
+
}
|
|
84
|
+
return problems;
|
|
85
|
+
}
|
|
86
|
+
/** The review steps of a built-in workflow by kind: `build:` is `build`. */
|
|
87
|
+
export function reviewKinds(base) {
|
|
88
|
+
return WORKFLOWS[base].reviewSteps.map((s) => (s === 'build:' ? 'build' : s));
|
|
89
|
+
}
|
|
90
|
+
/** Keys of `workflows.<name>.review` that its base does not have: a step it has no review of, QA or build reviews outside a feature. */
|
|
91
|
+
function workflowReviewProblems(where, base, review) {
|
|
92
|
+
const problems = [];
|
|
93
|
+
const kinds = reviewKinds(base);
|
|
94
|
+
for (const key of Object.keys(review.step_rounds ?? {})) {
|
|
95
|
+
if (!kinds.includes(key))
|
|
96
|
+
problems.push(`${where}.review.step_rounds: '${key}' is not a review step of ${base} (${kinds.join(', ')})`);
|
|
97
|
+
}
|
|
98
|
+
const tiered = kinds.filter((k) => k !== 'qa');
|
|
99
|
+
for (const key of Object.keys(review.tiers ?? {})) {
|
|
100
|
+
if (!tiered.includes(key))
|
|
101
|
+
problems.push(`${where}.review.tiers: '${key}' is not a review step of ${base} with a tier (${tiered.join(', ')})`);
|
|
102
|
+
}
|
|
103
|
+
if (base !== 'feature') {
|
|
104
|
+
for (const key of ['qa', 'build'])
|
|
105
|
+
if (review[key] !== undefined)
|
|
106
|
+
problems.push(`${where}.review.${key}: only a feature-based workflow has ${key === 'qa' ? 'a QA step' : 'build reviews'}`);
|
|
81
107
|
}
|
|
82
108
|
return problems;
|
|
83
109
|
}
|
package/dist/progress-view.js
CHANGED
|
@@ -7,6 +7,7 @@ import { readLog } from './log.js';
|
|
|
7
7
|
import { buildProgress, headHistory, prefetchFiles, repoMemo, verifyState } from './progress.js';
|
|
8
8
|
import { verification } from './readiness.js';
|
|
9
9
|
import { reviewerFor, roundLimit } from './review-policy.js';
|
|
10
|
+
import { unitWorkflow } from './customization.js';
|
|
10
11
|
import { acTestFiles } from './tests-map.js';
|
|
11
12
|
import { acResults, loadResults } from './test-results.js';
|
|
12
13
|
import { freshReview } from './fix.js';
|
|
@@ -198,7 +199,7 @@ export function unitModel(ctx, slug, { onBase = false, now = Date.now(), memo =
|
|
|
198
199
|
round: r.round,
|
|
199
200
|
verdict: r.verdict,
|
|
200
201
|
at: r.at_utc,
|
|
201
|
-
tier: { 'agjan-reviewer-deep': 'deep', 'agjan-qa': 'qa' }[reviewerFor(config, r.step)] ?? 'balanced',
|
|
202
|
+
tier: { 'agjan-reviewer-deep': 'deep', 'agjan-qa': 'qa' }[reviewerFor(config, r.step, unitWorkflow(unit))] ?? 'balanced',
|
|
202
203
|
host: r.reviewer?.host ?? null,
|
|
203
204
|
isolation: r.reviewer?.isolation ?? null,
|
|
204
205
|
findings: (r.findings ?? []).map((f) => f.id),
|
|
@@ -322,7 +323,7 @@ export function unitModel(ctx, slug, { onBase = false, now = Date.now(), memo =
|
|
|
322
323
|
decisions: shown,
|
|
323
324
|
reviewers,
|
|
324
325
|
humans,
|
|
325
|
-
roundLimits: Object.fromEntries([...new Set(reviews.map((r) => r.step))].map((step) => [step, roundLimit(config, step)])),
|
|
326
|
+
roundLimits: Object.fromEntries([...new Set(reviews.map((r) => r.step))].map((step) => [step, roundLimit(config, step, unitWorkflow(unit))])),
|
|
326
327
|
stats: {
|
|
327
328
|
activeMs: steps.reduce((t, s) => t + (s.to - s.from), 0),
|
|
328
329
|
waitingMs: gates.reduce((t, s) => t + (s.to - s.from), 0),
|
package/dist/progress.js
CHANGED
|
@@ -3,6 +3,8 @@ import { resolveArea } from './config.js';
|
|
|
3
3
|
import { matcher } from './scope.js';
|
|
4
4
|
import { latestReview, stillBlocked } from './feature.js';
|
|
5
5
|
import { isRecord, treeHash } from './review.js';
|
|
6
|
+
import { resolveBuild } from './review-policy.js';
|
|
7
|
+
import { unitWorkflow } from './customization.js';
|
|
6
8
|
export function repoMemo() {
|
|
7
9
|
return { files: new Map(), ancestry: new Map(), texts: new Map() };
|
|
8
10
|
}
|
|
@@ -94,7 +96,7 @@ function reviewedSince(root, feature, step, sha, memo) {
|
|
|
94
96
|
}
|
|
95
97
|
/**
|
|
96
98
|
* Tasks with their state, the next task, and the build reviews that are due
|
|
97
|
-
* (design 7.3): per completed area by default, per task with `review.build: task
|
|
99
|
+
* (design 7.3): per completed area by default, per task with `review.build: task` (the unit's workflow's, else the project's), and
|
|
98
100
|
* always per task for tasks whose commit touched a risk path.
|
|
99
101
|
*/
|
|
100
102
|
export function buildProgress(root, config, feature, options = {}) {
|
|
@@ -109,7 +111,7 @@ export function buildProgress(root, config, feature, options = {}) {
|
|
|
109
111
|
const dueReviews = () => {
|
|
110
112
|
const isRisk = matcher(config.risk_paths ?? []);
|
|
111
113
|
const due = [];
|
|
112
|
-
const perTask = config.
|
|
114
|
+
const perTask = resolveBuild(config, unitWorkflow(feature)).value === 'task';
|
|
113
115
|
for (const task of list.filter((t) => t.commit)) {
|
|
114
116
|
const risky = filesOf(root, task.commit, memo).some(isRisk);
|
|
115
117
|
if ((perTask || risky) && !reviewedSince(root, feature, `build:${task.id}`, task.commit, memo)) {
|
package/dist/qa.js
CHANGED
|
@@ -4,6 +4,8 @@ import { dirname, join } from 'node:path';
|
|
|
4
4
|
import { contentIds } from './git.js';
|
|
5
5
|
import { writeJson } from './json-file.js';
|
|
6
6
|
import { FEATURES_DIR, latestReview, stillBlocked } from './feature.js';
|
|
7
|
+
import { resolveQa } from './review-policy.js';
|
|
8
|
+
import { unitWorkflow } from './customization.js';
|
|
7
9
|
/**
|
|
8
10
|
* The QA step (design decision 81): in Verify, the QA agent (`agjan-qa`, the qa-tester
|
|
9
11
|
* skill) writes and runs tests from the spec alone, without the design, the diff or the
|
|
@@ -38,9 +40,9 @@ export function writeQaGuard(root, config, slug) {
|
|
|
38
40
|
mkdirSync(dirname(file), { recursive: true });
|
|
39
41
|
writeJson(file, qaGuard(config, slug));
|
|
40
42
|
}
|
|
41
|
-
/** QA runs for full-mode features unless the project turns it off (`review.qa: "off"`). */
|
|
43
|
+
/** QA runs for full-mode features unless the unit's workflow or the project turns it off (`review.qa: "off"`). */
|
|
42
44
|
export function qaApplies(config, feature) {
|
|
43
|
-
return feature.kind === 'feature' && feature.design?.parsed.mode === 'full' && config.
|
|
45
|
+
return feature.kind === 'feature' && feature.design?.parsed.mode === 'full' && resolveQa(config, unitWorkflow(feature)).value !== 'off';
|
|
44
46
|
}
|
|
45
47
|
function filesUnder(root, dir) {
|
|
46
48
|
const abs = join(root, dir);
|
package/dist/review-policy.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Review settings from agjan.config.json (design 7.3, 7.4): which reviewer agent runs a
|
|
3
3
|
* step (`review.tiers`), how many correction rounds a step gets (`review.rounds`, or its
|
|
4
|
-
* kind's own under `review.step_rounds`),
|
|
4
|
+
* kind's own under `review.step_rounds`), whether QA runs (`review.qa`), each also per
|
|
5
|
+
* workflow under `workflows.<name>.review` over the project's, and
|
|
5
6
|
* how many attempts the main agent has for failing deterministic checks
|
|
6
7
|
* (`build.fix_attempts`). `agjan status` shows them; the skills follow `status`.
|
|
7
8
|
*/
|
|
8
9
|
import { stillBlocked } from './feature.js';
|
|
9
10
|
import { readLog } from './log.js';
|
|
10
|
-
import {
|
|
11
|
+
import { projectSetsReview } from './config.js';
|
|
12
|
+
import { findExtraReview, unitWorkflow } from './customization.js';
|
|
11
13
|
/** Default tier per kind of review step. */
|
|
12
14
|
export const DEFAULT_TIERS = {
|
|
13
15
|
spec: 'balanced',
|
|
@@ -24,20 +26,84 @@ export const DEFAULT_TIERS = {
|
|
|
24
26
|
export function stepKind(step) {
|
|
25
27
|
return step.startsWith('build:') ? 'build' : step;
|
|
26
28
|
}
|
|
27
|
-
/**
|
|
28
|
-
|
|
29
|
+
/** A value of the project's `review`: agjan's default when agjan.config.json does not set it (loadConfig merged it in). */
|
|
30
|
+
function projectValue(config, key, value) {
|
|
31
|
+
return { value, source: projectSetsReview(config, key) === false ? 'default' : 'project' };
|
|
32
|
+
}
|
|
33
|
+
function workflowReview(config, workflow) {
|
|
34
|
+
return workflow ? config.workflows?.[workflow]?.review : undefined;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The tier of a step in `workflow`: the workflow's `review.tiers`, else the project's
|
|
38
|
+
* `review.tiers`, else an extra review step's own (decision 95), else agjan's default.
|
|
39
|
+
*/
|
|
40
|
+
export function resolveTier(config, step, workflow) {
|
|
29
41
|
const kind = stepKind(step);
|
|
30
|
-
|
|
42
|
+
const own = workflowReview(config, workflow)?.tiers?.[kind];
|
|
43
|
+
if (own)
|
|
44
|
+
return { value: own, source: 'workflow' };
|
|
45
|
+
const project = config.review?.tiers?.[kind];
|
|
46
|
+
if (project)
|
|
47
|
+
return { value: project, source: 'project' };
|
|
48
|
+
const extra = findExtraReview(config, kind)?.tier;
|
|
49
|
+
if (extra)
|
|
50
|
+
return { value: extra, source: 'workflow' };
|
|
51
|
+
return { value: DEFAULT_TIERS[kind] ?? 'balanced', source: 'default' };
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The round limit of a review step in `workflow`. The workflow's settings come first: its
|
|
55
|
+
* `review.step_rounds` for the step's kind, then (when it sets `review.rounds`) an extra
|
|
56
|
+
* step's own `rounds` and the workflow's `review.rounds`. Then the project's: its
|
|
57
|
+
* `review.step_rounds`, an extra step's own `rounds`, its `review.rounds`; else 3.
|
|
58
|
+
*/
|
|
59
|
+
export function resolveRounds(config, step, workflow) {
|
|
60
|
+
const kind = step ? stepKind(step) : undefined;
|
|
61
|
+
const wf = workflowReview(config, workflow);
|
|
62
|
+
const extra = kind ? findExtraReview(config, kind)?.rounds : undefined;
|
|
63
|
+
const own = kind ? wf?.step_rounds?.[kind] : undefined;
|
|
64
|
+
if (own !== undefined)
|
|
65
|
+
return { value: own, source: 'workflow' };
|
|
66
|
+
if (wf?.rounds !== undefined)
|
|
67
|
+
return { value: extra ?? wf.rounds, source: 'workflow' };
|
|
68
|
+
const project = kind ? config.review?.step_rounds?.[kind] : undefined;
|
|
69
|
+
if (project !== undefined)
|
|
70
|
+
return { value: project, source: 'project' };
|
|
71
|
+
if (extra !== undefined)
|
|
72
|
+
return { value: extra, source: 'workflow' };
|
|
73
|
+
if (config.review?.rounds !== undefined)
|
|
74
|
+
return projectValue(config, 'rounds', config.review.rounds);
|
|
75
|
+
return { value: 3, source: 'default' };
|
|
76
|
+
}
|
|
77
|
+
/** Whether the QA step runs in `workflow` (feature-based): the workflow's `review.qa`, else the project's, else on. */
|
|
78
|
+
export function resolveQa(config, workflow) {
|
|
79
|
+
const own = workflowReview(config, workflow)?.qa;
|
|
80
|
+
if (own)
|
|
81
|
+
return { value: own, source: 'workflow' };
|
|
82
|
+
if (config.review?.qa)
|
|
83
|
+
return projectValue(config, 'qa', config.review.qa);
|
|
84
|
+
return { value: 'on', source: 'default' };
|
|
85
|
+
}
|
|
86
|
+
/** How builds are reviewed in `workflow` (feature-based): per area or per task. */
|
|
87
|
+
export function resolveBuild(config, workflow) {
|
|
88
|
+
const own = workflowReview(config, workflow)?.build;
|
|
89
|
+
if (own)
|
|
90
|
+
return { value: own, source: 'workflow' };
|
|
91
|
+
if (config.review?.build)
|
|
92
|
+
return projectValue(config, 'build', config.review.build);
|
|
93
|
+
return { value: 'area', source: 'default' };
|
|
94
|
+
}
|
|
95
|
+
/** The tier of a step (in `workflow`, the unit's; see resolveTier). */
|
|
96
|
+
export function tierOf(config, step, workflow) {
|
|
97
|
+
return resolveTier(config, step, workflow).value;
|
|
31
98
|
}
|
|
32
99
|
/** The generated reviewer agent for a step. There is no fast agent; `fast` uses the balanced one. */
|
|
33
|
-
export function reviewerFor(config, step) {
|
|
34
|
-
const tier = tierOf(config, step);
|
|
100
|
+
export function reviewerFor(config, step, workflow) {
|
|
101
|
+
const tier = tierOf(config, step, workflow);
|
|
35
102
|
return tier === 'qa' ? 'agjan-qa' : tier === 'deep' ? 'agjan-reviewer-deep' : 'agjan-reviewer';
|
|
36
103
|
}
|
|
37
|
-
/** The round limit of a review step
|
|
38
|
-
export function roundLimit(config, step) {
|
|
39
|
-
|
|
40
|
-
return own ?? config.review?.rounds ?? 3;
|
|
104
|
+
/** The round limit of a review step (in `workflow`, the unit's; see resolveRounds). */
|
|
105
|
+
export function roundLimit(config, step, workflow) {
|
|
106
|
+
return resolveRounds(config, step, workflow).value;
|
|
41
107
|
}
|
|
42
108
|
export function fixAttempts(config) {
|
|
43
109
|
return config.build?.fix_attempts ?? 3;
|
|
@@ -81,7 +147,7 @@ export function roundState(feature, config, step) {
|
|
|
81
147
|
const records = feature.reviews.records.filter((r) => r.step === step);
|
|
82
148
|
const last = records.at(-1) ?? null;
|
|
83
149
|
const extra = extraRounds(feature, step);
|
|
84
|
-
const limit = roundLimit(config, step) + extra;
|
|
150
|
+
const limit = roundLimit(config, step, unitWorkflow(feature)) + extra;
|
|
85
151
|
const round = last?.round ?? 0;
|
|
86
152
|
// Exhausted: still blocked, and the next round would pass the limit; a loop that an approval
|
|
87
153
|
// or a passing verify review closed starts again at round 1 (nextRound).
|
package/dist/review.js
CHANGED
|
@@ -18,7 +18,7 @@ import { proposalProblems } from './discovery.js';
|
|
|
18
18
|
import { personaText, personasFor, unitTeam } from './teams.js';
|
|
19
19
|
import { LOG_FILE, appendLog } from './log.js';
|
|
20
20
|
import { AgjanError } from './errors.js';
|
|
21
|
-
import { nextRound, roundState } from './review-policy.js';
|
|
21
|
+
import { nextRound, resolveQa, roundState } from './review-policy.js';
|
|
22
22
|
import { designProblems, documentProblems } from './validate.js';
|
|
23
23
|
import { QA_STEP, qaApplies, qaDirs, writeQaGuard, qaProblem, qaState, qaTestFiles, qaTestsHash } from './qa.js';
|
|
24
24
|
import { buildProgress } from './progress.js';
|
|
@@ -542,7 +542,7 @@ export function recordReview(root, config, input, recorder) {
|
|
|
542
542
|
export function createQaContext(root, config, { feature: slug }) {
|
|
543
543
|
const feature = loadFeature(root, slug);
|
|
544
544
|
if (!qaApplies(config, feature))
|
|
545
|
-
throw new AgjanError(`QA does not apply to ${slug}: it runs for full-mode features (review.qa is ${config.
|
|
545
|
+
throw new AgjanError(`QA does not apply to ${slug}: it runs for full-mode features (review.qa is ${resolveQa(config, unitWorkflow(feature)).value})`);
|
|
546
546
|
if (feature.stage !== 'build' || !feature.spec)
|
|
547
547
|
throw new AgjanError(`${slug} is not in Build yet; QA runs in Verify`);
|
|
548
548
|
const progress = buildProgress(root, config, feature);
|
package/dist/workflow-skill.js
CHANGED
|
@@ -4,7 +4,7 @@ import { WORKFLOWS } from './workflow.js';
|
|
|
4
4
|
* The skill of a workflow of the project's own (decision 95): `agjan sync` writes it to
|
|
5
5
|
* `.claude/skills/agjan-<name>/SKILL.md`, generated from the configuration, so nobody writes
|
|
6
6
|
* agent instructions for it by hand. It follows the base workflow's skill, starts the unit
|
|
7
|
-
* with `--workflow`, and names the workflow's extra review steps and gates.
|
|
7
|
+
* with `--workflow`, and names the workflow's extra review steps and gates and its own review settings.
|
|
8
8
|
*/
|
|
9
9
|
export function workflowSkill(config, name) {
|
|
10
10
|
const base = baseOf(config, name);
|
|
@@ -33,8 +33,12 @@ export function workflowSkill(config, name) {
|
|
|
33
33
|
'',
|
|
34
34
|
`1. Start the unit with \`--workflow ${name}\`: \`${start}\`. Everything else it says about starting (the branch, the key, asking the user) stays.`,
|
|
35
35
|
`2. The extra review steps and gates below belong to this workflow. \`npx agjan status\` names each when it is due (\`next\`), and the stage's gate or the acceptance waits for them. \`npx agjan workflow show ${name}\` shows the whole workflow.`,
|
|
36
|
-
'',
|
|
37
36
|
];
|
|
37
|
+
const review = Object.entries(definition.review ?? {}).map(([key, value]) => (typeof value === 'object' ? Object.entries(value).map(([k, v]) => `${key}.${k} ${v}`).join(', ') : `${key} ${value}`));
|
|
38
|
+
if (review.length) {
|
|
39
|
+
lines.push(`3. This workflow has review settings of its own (\`workflows.${name}.review\`: ${review.join(', ')}). Where the ${workflow.name} skill speaks of the project's \`review\` settings (round limits, tiers, QA), its units use these instead; follow the reviewer agent and the round limit that \`npx agjan status\` names for each review.`);
|
|
40
|
+
}
|
|
41
|
+
lines.push('');
|
|
38
42
|
if (reviews.length) {
|
|
39
43
|
lines.push('## Extra review steps', '');
|
|
40
44
|
for (const r of reviews)
|
package/dist/workflow-view.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BUILT_IN_TEAMS, allTeams, defaultTeam, mainRole, personasFor, teamProblems } from './teams.js';
|
|
2
|
-
import {
|
|
2
|
+
import { resolveBuild, resolveQa, resolveRounds, resolveTier, reviewerFor } from './review-policy.js';
|
|
3
3
|
import { baseOf, extrasOf } from './customization.js';
|
|
4
4
|
import { AgjanError } from './errors.js';
|
|
5
5
|
import { WORKFLOWS } from './workflow.js';
|
|
@@ -40,7 +40,8 @@ export function resolveWorkflow(root, config, workflowName, options = {}) {
|
|
|
40
40
|
const fallback = defaultTeam(config, workflowName);
|
|
41
41
|
const name = options.team ?? fallback;
|
|
42
42
|
const team = name ? (allTeams(config)[name] ?? null) : null;
|
|
43
|
-
const
|
|
43
|
+
const qa = resolveQa(config, workflowName);
|
|
44
|
+
const build = resolveBuild(config, workflowName);
|
|
44
45
|
const extras = extrasOf(config, workflowName);
|
|
45
46
|
const stages = workflow.track.map((stage) => ({
|
|
46
47
|
name: stage.name,
|
|
@@ -58,15 +59,19 @@ export function resolveWorkflow(root, config, workflowName, options = {}) {
|
|
|
58
59
|
personas: personaEntries(config, personas),
|
|
59
60
|
};
|
|
60
61
|
if (step.review) {
|
|
61
|
-
resolved.agent = reviewerFor(config, step.review);
|
|
62
|
+
resolved.agent = reviewerFor(config, step.review, workflowName);
|
|
63
|
+
const tier = step.review === 'qa' ? { value: 'qa', source: 'default' } : resolveTier(config, step.review, workflowName);
|
|
64
|
+
const rounds = resolveRounds(config, step.review, workflowName);
|
|
65
|
+
const per = step.review === 'build:' ? build : null;
|
|
62
66
|
resolved.review = {
|
|
63
67
|
step: step.review,
|
|
64
|
-
tier:
|
|
65
|
-
rounds:
|
|
66
|
-
...(
|
|
68
|
+
tier: tier.value,
|
|
69
|
+
rounds: rounds.value,
|
|
70
|
+
...(per ? { per: per.value } : {}),
|
|
71
|
+
source: { tier: tier.source, rounds: rounds.source, ...(per ? { per: per.source } : {}) },
|
|
67
72
|
};
|
|
68
|
-
if (step.review === 'qa' &&
|
|
69
|
-
resolved.off = 'review.qa is off
|
|
73
|
+
if (step.review === 'qa' && qa.value === 'off')
|
|
74
|
+
resolved.off = `${qa.source === 'workflow' ? `workflows.${workflowName}.review.qa` : 'review.qa'} is off`;
|
|
70
75
|
}
|
|
71
76
|
if (step.gate)
|
|
72
77
|
resolved.gate = { name: step.gate, command: `npx agjan approve ${step.gate}` };
|
|
@@ -82,12 +87,12 @@ export function resolveWorkflow(root, config, workflowName, options = {}) {
|
|
|
82
87
|
const persona = team?.personas[role] ?? null;
|
|
83
88
|
const step = {
|
|
84
89
|
actor: 'reviewer',
|
|
85
|
-
agent: reviewerFor(config, r.id),
|
|
90
|
+
agent: reviewerFor(config, r.id, workflowName),
|
|
86
91
|
does: r.description,
|
|
87
92
|
role,
|
|
88
93
|
persona,
|
|
89
94
|
personas: role === 'reviewer' && team ? personaEntries(config, personasFor(config, team, kind, 'reviewer')) : persona ? personaEntries(config, [{ role, persona }]) : [],
|
|
90
|
-
review: { step: r.id, tier:
|
|
95
|
+
review: ((tier, rounds) => ({ step: r.id, tier: tier.value, rounds: rounds.value, source: { tier: tier.source, rounds: rounds.source } }))(resolveTier(config, r.id, workflowName), resolveRounds(config, r.id, workflowName)),
|
|
91
96
|
extra: true,
|
|
92
97
|
};
|
|
93
98
|
// Right after the stage's reviews (its own, then earlier extras); else before its gate.
|
|
@@ -123,6 +128,11 @@ export function resolveWorkflow(root, config, workflowName, options = {}) {
|
|
|
123
128
|
problems: teamProblems(root, config, name, workflowName),
|
|
124
129
|
}
|
|
125
130
|
: null,
|
|
131
|
+
review: {
|
|
132
|
+
rounds: resolveRounds(config, undefined, workflowName),
|
|
133
|
+
...(kind === 'feature' ? { qa, build } : {}),
|
|
134
|
+
override: { ...(config.workflows?.[workflowName]?.review ?? {}) },
|
|
135
|
+
},
|
|
126
136
|
stages,
|
|
127
137
|
controls: workflow.controls,
|
|
128
138
|
};
|
package/docs/guide.md
CHANGED
|
@@ -568,6 +568,34 @@ lowercase letters, digits and `-`, unique across all workflows, and not one of a
|
|
|
568
568
|
(`check` reports mistakes). `npx agjan workflow list` and `npx agjan workflow show <workflow>`
|
|
569
569
|
show the result, extras marked.
|
|
570
570
|
|
|
571
|
+
### Review settings per workflow
|
|
572
|
+
|
|
573
|
+
`workflows.<name>.review` gives one workflow review settings of its own, in the shapes of the
|
|
574
|
+
project's `review`: `rounds`, `step_rounds`, `tiers`, and for a feature-based workflow `qa` and
|
|
575
|
+
`build`. Each one it does not set falls back to the project's `review`, then to agjan's default,
|
|
576
|
+
so a `hotfix` can have fewer rounds and a cheaper reviewer than `fix`:
|
|
577
|
+
|
|
578
|
+
```json
|
|
579
|
+
{
|
|
580
|
+
"review": { "rounds": 3 },
|
|
581
|
+
"workflows": {
|
|
582
|
+
"hotfix": { "base": "fix", "review": { "rounds": 1, "tiers": { "fix": "fast" } } },
|
|
583
|
+
"feature": { "review": { "qa": "off", "step_rounds": { "design": 5 } } }
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
```
|
|
587
|
+
|
|
588
|
+
A unit uses the settings of the workflow it recorded at its start: `status` names its reviewer
|
|
589
|
+
agent and round limit, and the skills follow `status`. The workflow's settings come before the
|
|
590
|
+
project's: its `step_rounds` for the step, then its `rounds` (an extra review's own `rounds` still
|
|
591
|
+
comes first), then the project's `step_rounds` and `rounds`. Tiers: the workflow's, the project's,
|
|
592
|
+
an extra review's own, the default. A workflow of your own does not take its base's settings
|
|
593
|
+
(`workflows.fix.review` is not `hotfix`'s). Keys of `step_rounds` and `tiers` are the base's
|
|
594
|
+
review steps (`tiers.spec` on a fix-based workflow is a mistake `check` reports), and `qa` and
|
|
595
|
+
`build` exist only on a feature-based one. `npx agjan workflow show <workflow> --json` gives each
|
|
596
|
+
review's resolved tier and rounds with where each comes from (`workflow`, `project` or `default`);
|
|
597
|
+
`models` (per host and tier) stays project-wide.
|
|
598
|
+
|
|
571
599
|
## Asking questions
|
|
572
600
|
|
|
573
601
|
**`/agjan-ask`** answers a general question about SAP CAP, Fiori and UI5, SAP BTP,
|
|
@@ -671,6 +699,7 @@ is wrong, so a typo is never a silent default.
|
|
|
671
699
|
| `review.rounds` | correction rounds per review step (default 3); if blockers remain, the agent asks you whether to run another round (one more per yes, recorded with `npx agjan review extend <step>`) or to stop |
|
|
672
700
|
| `review.step_rounds.<step>` | the round limit of one kind of review step (`spec`, `design:light`, `design`, `build`, `qa`, `verify`, `fix`, `map`, `proposal`) over `review.rounds`, for example `{ "design": 5 }` |
|
|
673
701
|
| `review.qa` | `on` (default) or `off`: the QA step in Verify for full-mode features |
|
|
702
|
+
| `workflows.<name>.review` | review settings of one workflow (`rounds`, `step_rounds`, `tiers`, `qa`, `build`) over the project's `review` ([Review settings per workflow](#review-settings-per-workflow)) |
|
|
674
703
|
| `test_evidence` | `run` (default): CI and the acceptance need a passing `agjan test` run on the change; `names`: a test whose name contains the AC id is enough |
|
|
675
704
|
| `review.tiers.<step>` | `balanced` or `deep` per step kind (`spec`, `design:light`, `design`, `build`, `verify`, `fix`, `map`); decides which reviewer agent runs it. Defaults: `deep` for `design` and `verify`, else `balanced`; `fast` uses the balanced agent |
|
|
676
705
|
| `build.fix_attempts` | attempts for failing deterministic checks before the agent stops (default 3) |
|
|
@@ -70,7 +70,8 @@ The rules behind the arrows:
|
|
|
70
70
|
- A persona starts no agent of its own. Its skills and instructions go to the agent that
|
|
71
71
|
already does that job: the main agent, the reviewer or the QA agent.
|
|
72
72
|
- How many rounds each review gets is a setting: `review.rounds` for all, and
|
|
73
|
-
`review.step_rounds` for one kind of step (for example 5 for the design review).
|
|
73
|
+
`review.step_rounds` for one kind of step (for example 5 for the design review). A workflow
|
|
74
|
+
can have its own under `workflows.<name>.review` (rounds, tiers, QA), over the project's.
|
|
74
75
|
- A team cannot remove a step. Every workflow keeps an independent review, approvals
|
|
75
76
|
stamped by a script, scope checks, and a person who decides at the end.
|
|
76
77
|
- A project can add extra review steps and gates to a workflow, and define workflows of its
|
|
@@ -74,7 +74,7 @@ since the baseline, and commit both.
|
|
|
74
74
|
|
|
75
75
|
## 5. QA (step `qa`)
|
|
76
76
|
|
|
77
|
-
For full-mode features (unless `review.qa
|
|
77
|
+
For full-mode features (unless `review.qa`, the workflow's or the project's, is `off`; `npx agjan status` shows a `qa`
|
|
78
78
|
row), a tester checks the feature from the spec alone before the final review: the
|
|
79
79
|
`agjan-qa` agent writes tests into `test/qa/<slug>/` (and `test/ui/qa/<slug>/`), runs
|
|
80
80
|
them and records the result. Its tests stay in the project as regression tests.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agjan",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.29",
|
|
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",
|
|
@@ -108,6 +108,26 @@
|
|
|
108
108
|
},
|
|
109
109
|
"additionalProperties": false
|
|
110
110
|
}
|
|
111
|
+
},
|
|
112
|
+
"review": {
|
|
113
|
+
"description": "This workflow's own review settings over the project's \"review\": each one not set falls back to it, then to agjan's default. Keys of step_rounds and tiers are the base's review steps; qa and build only for a feature-based workflow (agjan check reports others).",
|
|
114
|
+
"type": "object",
|
|
115
|
+
"properties": {
|
|
116
|
+
"build": { "enum": ["area", "task"] },
|
|
117
|
+
"rounds": { "type": "integer", "minimum": 1 },
|
|
118
|
+
"step_rounds": {
|
|
119
|
+
"type": "object",
|
|
120
|
+
"propertyNames": { "enum": ["spec", "design:light", "design", "build", "qa", "verify", "fix", "map", "proposal"] },
|
|
121
|
+
"additionalProperties": { "type": "integer", "minimum": 1 }
|
|
122
|
+
},
|
|
123
|
+
"tiers": {
|
|
124
|
+
"type": "object",
|
|
125
|
+
"propertyNames": { "enum": ["spec", "design:light", "design", "build", "verify", "fix", "map", "proposal"] },
|
|
126
|
+
"additionalProperties": { "enum": ["fast", "balanced", "deep"] }
|
|
127
|
+
},
|
|
128
|
+
"qa": { "enum": ["on", "off"] }
|
|
129
|
+
},
|
|
130
|
+
"additionalProperties": false
|
|
111
131
|
}
|
|
112
132
|
},
|
|
113
133
|
"additionalProperties": false
|