agjan 0.0.26 → 0.0.28
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 +7 -5
- package/dist/commands/check.js +14 -2
- package/dist/commands/discover.js +7 -3
- package/dist/commands/fix.js +8 -4
- package/dist/commands/gates.js +76 -3
- package/dist/commands/log.js +3 -2
- package/dist/commands/map.js +10 -5
- package/dist/commands/new.js +8 -4
- package/dist/commands/status.js +83 -9
- package/dist/commands/team.js +14 -9
- package/dist/commands/workflow.js +45 -16
- package/dist/customization.js +172 -0
- package/dist/imports.js +10 -0
- package/dist/plan.js +3 -1
- package/dist/progress-view.js +4 -2
- package/dist/review-policy.js +14 -6
- package/dist/review.js +19 -6
- package/dist/teams.js +84 -24
- package/dist/workflow-skill.js +61 -0
- package/dist/workflow-view.js +77 -15
- package/docs/guide.md +87 -1
- package/docs/workflows-and-teams.md +14 -5
- package/kit/skills/agjan-build/SKILL.md +16 -0
- package/kit/skills/agjan-design/SKILL.md +16 -0
- package/kit/skills/agjan-discover/SKILL.md +17 -1
- package/kit/skills/agjan-fix/SKILL.md +16 -0
- package/kit/skills/agjan-map/SKILL.md +16 -0
- package/kit/skills/agjan-spec/SKILL.md +16 -0
- package/kit/skills/agjan-verify/SKILL.md +16 -0
- package/package.json +1 -1
- package/schemas/approvals.schema.json +2 -1
- package/schemas/config.schema.json +84 -8
- package/schemas/reviews.schema.json +1 -1
package/dist/teams.js
CHANGED
|
@@ -3,8 +3,12 @@ import { join } from 'node:path';
|
|
|
3
3
|
import { hashText } from './hash.js';
|
|
4
4
|
import { AgjanError } from './errors.js';
|
|
5
5
|
import { WORKFLOWS } from './workflow.js';
|
|
6
|
+
import { baseOf } from './customization.js';
|
|
6
7
|
export const ROLES = ['implementer', 'reviewer', 'tester', 'analyst'];
|
|
7
|
-
|
|
8
|
+
export const ROLE_AGENTS = ['main', 'reviewer', 'qa'];
|
|
9
|
+
/** The agent each built-in role reaches; implementer and analyst are the main agent in different workflows. */
|
|
10
|
+
const BUILT_IN_AGENT = { implementer: 'main', analyst: 'main', reviewer: 'reviewer', tester: 'qa' };
|
|
11
|
+
/** The built-in roles a workflow needs. */
|
|
8
12
|
const ROLES_OF = {
|
|
9
13
|
feature: ['implementer', 'reviewer', 'tester'],
|
|
10
14
|
fix: ['implementer', 'reviewer'],
|
|
@@ -40,16 +44,55 @@ export const BUILT_IN_TEAMS = {
|
|
|
40
44
|
},
|
|
41
45
|
},
|
|
42
46
|
};
|
|
43
|
-
/**
|
|
47
|
+
/** A team definition with every persona resolved; a name with no persona under `personas` gives no skills (`teamProblems` reports it). */
|
|
48
|
+
function resolveTeam(config, team) {
|
|
49
|
+
const personas = Object.fromEntries(Object.entries(team.personas ?? {}).map(([role, p]) => [role, typeof p === 'string' ? (config.personas?.[p] ?? { skills: [] }) : p]));
|
|
50
|
+
return { description: team.description, workflows: team.workflows, personas };
|
|
51
|
+
}
|
|
52
|
+
/** The built-in teams with the imported ones (loadConfig puts them in) and the project's own on top, resolved. */
|
|
44
53
|
export function allTeams(config) {
|
|
45
|
-
|
|
54
|
+
const defined = { ...BUILT_IN_TEAMS, ...(config.teams ?? {}) };
|
|
55
|
+
return Object.fromEntries(Object.entries(defined).map(([name, team]) => [name, resolveTeam(config, team)]));
|
|
56
|
+
}
|
|
57
|
+
/** The agent a role's persona reaches: a built-in role's, or the one its definition under `roles` names. */
|
|
58
|
+
export function roleAgent(config, role) {
|
|
59
|
+
return BUILT_IN_AGENT[role] ?? config.roles?.[role]?.agent ?? null;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* The personas an agent works with in a workflow: the built-in role's first (the implementer or
|
|
63
|
+
* analyst for the main agent, the reviewer, the tester), then the team's own roles for that agent.
|
|
64
|
+
*/
|
|
65
|
+
export function personasFor(config, team, kind, agent) {
|
|
66
|
+
const builtIn = agent === 'main' ? mainRole(kind) : agent === 'reviewer' ? 'reviewer' : 'tester';
|
|
67
|
+
const out = [];
|
|
68
|
+
if (team.personas[builtIn])
|
|
69
|
+
out.push({ role: builtIn, persona: team.personas[builtIn] });
|
|
70
|
+
for (const [role, persona] of Object.entries(team.personas)) {
|
|
71
|
+
if (!ROLES.includes(role) && roleAgent(config, role) === agent)
|
|
72
|
+
out.push({ role, persona });
|
|
73
|
+
}
|
|
74
|
+
return out;
|
|
46
75
|
}
|
|
47
|
-
/**
|
|
48
|
-
|
|
49
|
-
|
|
76
|
+
/**
|
|
77
|
+
* The default team of a workflow: the project's choice (`team.<workflow>`), else the first
|
|
78
|
+
* that serves it; a workflow of the project's own falls back to its base's default.
|
|
79
|
+
*/
|
|
80
|
+
export function defaultTeam(config, workflow) {
|
|
81
|
+
const chosen = config.team?.[workflow];
|
|
50
82
|
if (chosen)
|
|
51
83
|
return chosen;
|
|
52
|
-
|
|
84
|
+
const serving = Object.entries(allTeams(config)).find(([, t]) => t.workflows.includes(workflow))?.[0];
|
|
85
|
+
if (serving)
|
|
86
|
+
return serving;
|
|
87
|
+
const base = baseOf(config, workflow);
|
|
88
|
+
return base && base !== workflow ? defaultTeam(config, base) : null;
|
|
89
|
+
}
|
|
90
|
+
/** Whether a team serves a workflow: by name, or, for a workflow of the project's own, its base. */
|
|
91
|
+
export function serves(config, team, workflow) {
|
|
92
|
+
if (team.workflows.includes(workflow))
|
|
93
|
+
return true;
|
|
94
|
+
const base = baseOf(config, workflow);
|
|
95
|
+
return Boolean(base && base !== workflow && team.workflows.includes(base));
|
|
53
96
|
}
|
|
54
97
|
/** JSON with the keys of every object sorted: the same definition always gives the same text. */
|
|
55
98
|
function canonical(value) {
|
|
@@ -66,39 +109,56 @@ export function teamHash(team) {
|
|
|
66
109
|
}
|
|
67
110
|
/** What is wrong with a team, for the workflow it would run (or all it serves). */
|
|
68
111
|
export function teamProblems(root, config, name, kind) {
|
|
112
|
+
const definition = config.teams?.[name] ?? BUILT_IN_TEAMS[name];
|
|
69
113
|
const team = allTeams(config)[name];
|
|
70
|
-
if (!team)
|
|
114
|
+
if (!definition || !team)
|
|
71
115
|
return [`no team '${name}' (built in: ${Object.keys(BUILT_IN_TEAMS).join(', ')}; or define it under "teams" in agjan.config.json)`];
|
|
72
116
|
const problems = [];
|
|
73
117
|
if (!team.workflows?.length)
|
|
74
118
|
problems.push(`team '${name}' serves no workflow`);
|
|
75
119
|
for (const w of team.workflows ?? [])
|
|
76
|
-
if (!
|
|
120
|
+
if (!baseOf(config, w))
|
|
77
121
|
problems.push(`team '${name}': unknown workflow '${w}'`);
|
|
78
|
-
if (kind && !team
|
|
79
|
-
problems.push(`team '${name}' does not serve the ${WORKFLOWS[kind]
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
122
|
+
if (kind && !serves(config, team, kind))
|
|
123
|
+
problems.push(`team '${name}' does not serve the ${WORKFLOWS[kind]?.name ?? kind} workflow (it serves: ${team.workflows.join(', ')})`);
|
|
124
|
+
const custom = Object.keys(config.roles ?? {});
|
|
125
|
+
for (const [role, ref] of Object.entries(definition.personas ?? {})) {
|
|
126
|
+
const agent = roleAgent(config, role);
|
|
127
|
+
if (!agent)
|
|
128
|
+
problems.push(`team '${name}': unknown role '${role}' (roles: ${[...ROLES, ...custom].join(', ')}; or define it under "roles")`);
|
|
129
|
+
if (typeof ref === 'string' && !config.personas?.[ref])
|
|
130
|
+
problems.push(`team '${name}', ${role}: no persona '${ref}' under "personas"`);
|
|
131
|
+
for (const skill of team.personas[role]?.skills ?? []) {
|
|
84
132
|
if (!existsSync(join(root, '.claude', 'skills', skill, 'SKILL.md')))
|
|
85
133
|
problems.push(`team '${name}', ${role}: no skill '${skill}' in .claude/skills/`);
|
|
86
134
|
}
|
|
135
|
+
// A role whose agent has no step in any of the team's workflows would never be used.
|
|
136
|
+
if (agent && !ROLES.includes(role) && !(team.workflows ?? []).some((w) => WORKFLOWS[baseOf(config, w) ?? '']?.track.some((t) => t.steps.some((s) => s.actor === agent)))) {
|
|
137
|
+
problems.push(`team '${name}', ${role}: its agent (${agent}) has no step in ${team.workflows.join(', ')}`);
|
|
138
|
+
}
|
|
87
139
|
}
|
|
140
|
+
for (const role of custom)
|
|
141
|
+
if (ROLES.includes(role))
|
|
142
|
+
problems.push(`roles: '${role}' is a built-in role`);
|
|
88
143
|
for (const w of team.workflows ?? []) {
|
|
89
|
-
for (const role of ROLES_OF[w] ?? []) {
|
|
144
|
+
for (const role of ROLES_OF[baseOf(config, w) ?? ''] ?? []) {
|
|
90
145
|
if (!team.personas?.[role]?.skills?.length)
|
|
91
146
|
problems.push(`team '${name}' serves ${w} but has no ${role} with skills`);
|
|
92
147
|
}
|
|
93
148
|
}
|
|
94
149
|
return problems;
|
|
95
150
|
}
|
|
96
|
-
/**
|
|
97
|
-
export function personaText(
|
|
98
|
-
if (!
|
|
151
|
+
/** The personas an agent works with, as it reads them: per role, the skill files, then the instructions. */
|
|
152
|
+
export function personaText(config, team, personas) {
|
|
153
|
+
if (!personas.length)
|
|
99
154
|
return null;
|
|
100
|
-
|
|
101
|
-
|
|
155
|
+
return personas
|
|
156
|
+
.map(({ role, persona }) => {
|
|
157
|
+
const what = config.roles?.[role]?.description;
|
|
158
|
+
const skills = persona.skills.map((s) => `- \`.claude/skills/${s}/SKILL.md\` (and the references its table names for your topic)`).join('\n');
|
|
159
|
+
return [`Team ${team}, ${role}${what ? ` (${what})` : ''}. Work with these skills:`, skills, persona.instructions?.trim() ? `\n${persona.instructions.trim()}` : ''].join('\n').trim();
|
|
160
|
+
})
|
|
161
|
+
.join('\n\n');
|
|
102
162
|
}
|
|
103
163
|
/** The role of the main agent in a workflow: it implements, or (map run, discovery) it analyses. */
|
|
104
164
|
export function mainRole(kind) {
|
|
@@ -116,11 +176,11 @@ export function unitTeam(config, recorded) {
|
|
|
116
176
|
* it does not exist or does not serve the workflow; missing skills are `check`'s to report
|
|
117
177
|
* (`agjan sync` installs the built-in ones).
|
|
118
178
|
*/
|
|
119
|
-
export function chooseTeam(root, config,
|
|
120
|
-
const name = explicit ?? defaultTeam(config,
|
|
179
|
+
export function chooseTeam(root, config, workflow, explicit) {
|
|
180
|
+
const name = explicit ?? defaultTeam(config, workflow);
|
|
121
181
|
if (!name)
|
|
122
182
|
return null;
|
|
123
|
-
const problems = teamProblems(root, config, name,
|
|
183
|
+
const problems = teamProblems(root, config, name, workflow).filter((p) => !p.includes('in .claude/skills/'));
|
|
124
184
|
if (problems.length)
|
|
125
185
|
throw new AgjanError(problems.join('; '));
|
|
126
186
|
return { name, hash: teamHash(allTeams(config)[name]) };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { START, extrasOf, workflowNames, baseOf } from './customization.js';
|
|
2
|
+
import { WORKFLOWS } from './workflow.js';
|
|
3
|
+
/**
|
|
4
|
+
* The skill of a workflow of the project's own (decision 95): `agjan sync` writes it to
|
|
5
|
+
* `.claude/skills/agjan-<name>/SKILL.md`, generated from the configuration, so nobody writes
|
|
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.
|
|
8
|
+
*/
|
|
9
|
+
export function workflowSkill(config, name) {
|
|
10
|
+
const base = baseOf(config, name);
|
|
11
|
+
if (!base || base === name)
|
|
12
|
+
return null;
|
|
13
|
+
const definition = config.workflows?.[name] ?? {};
|
|
14
|
+
const workflow = WORKFLOWS[base];
|
|
15
|
+
const { reviews, gates } = extrasOf(config, name);
|
|
16
|
+
const what = (definition.description ?? `The ${name} workflow`).replace(/\s+/g, ' ').trim();
|
|
17
|
+
const start = `${START[base]} --workflow ${name}`;
|
|
18
|
+
const lines = [
|
|
19
|
+
'---',
|
|
20
|
+
`name: agjan-${name}`,
|
|
21
|
+
`description: ${what.replace(/[\r\n]/g, ' ')} (the project's own agjan workflow, based on ${workflow.name}).`,
|
|
22
|
+
'---',
|
|
23
|
+
'',
|
|
24
|
+
`# /agjan-${name}`,
|
|
25
|
+
'',
|
|
26
|
+
what,
|
|
27
|
+
'',
|
|
28
|
+
`This is the project's own workflow \`${name}\`, based on agjan's ${workflow.name} workflow. It is generated from \`workflows.${name}\` in \`agjan.config.json\` by \`agjan sync\`; change it there, not here.`,
|
|
29
|
+
'',
|
|
30
|
+
'## How to run it',
|
|
31
|
+
'',
|
|
32
|
+
`Follow the skill of the ${workflow.name} workflow, \`.claude/skills/${workflow.skill}/SKILL.md\` (read it now), step by step, with these changes:`,
|
|
33
|
+
'',
|
|
34
|
+
`1. Start the unit with \`--workflow ${name}\`: \`${start}\`. Everything else it says about starting (the branch, the key, asking the user) stays.`,
|
|
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
|
+
];
|
|
38
|
+
if (reviews.length) {
|
|
39
|
+
lines.push('## Extra review steps', '');
|
|
40
|
+
for (const r of reviews)
|
|
41
|
+
lines.push(`- \`${r.id}\`, in the ${r.stage} stage: ${r.description.replace(/\s+/g, ' ')}`);
|
|
42
|
+
lines.push('', `Run an extra review step like the stage's own review: when all your edits are saved (and, after Build, committed), delegate, on its own, to the reviewer agent that \`npx agjan status\` names for it, with the prompt \`Review step <step> of <the unit's kind> <slug>.\`; read the result with \`npx agjan review show\`, show the user \`npx agjan review report\`, and fix its blockers within the round limit, as for the stage's own review.`, '');
|
|
43
|
+
}
|
|
44
|
+
if (gates.length) {
|
|
45
|
+
lines.push('## Extra gates', '');
|
|
46
|
+
for (const g of gates)
|
|
47
|
+
lines.push(`- \`${g.id}\`, in the ${g.stage} stage: ${g.description.replace(/\s+/g, ' ')}`);
|
|
48
|
+
lines.push('', 'An extra gate is the user\'s decision. When `npx agjan status` names it, request it (`npx agjan log --gate-requested <gate> --message "<commit message>"`) and ask the user to run `npx agjan approve <gate>` in a terminal; never run it yourself. Continue after the approval.', '');
|
|
49
|
+
}
|
|
50
|
+
return `${lines.join('\n').trimEnd()}\n`;
|
|
51
|
+
}
|
|
52
|
+
/** The generated skills of the project's own workflows, as { 'agjan-<name>/SKILL.md': content }. */
|
|
53
|
+
export function workflowSkillFiles(config) {
|
|
54
|
+
const out = {};
|
|
55
|
+
for (const name of workflowNames(config)) {
|
|
56
|
+
const text = workflowSkill(config, name);
|
|
57
|
+
if (text)
|
|
58
|
+
out[`agjan-${name}/SKILL.md`] = text;
|
|
59
|
+
}
|
|
60
|
+
return out;
|
|
61
|
+
}
|
package/dist/workflow-view.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { BUILT_IN_TEAMS, allTeams, defaultTeam, mainRole, teamProblems } from './teams.js';
|
|
2
|
-
import {
|
|
1
|
+
import { BUILT_IN_TEAMS, allTeams, defaultTeam, mainRole, personasFor, teamProblems } from './teams.js';
|
|
2
|
+
import { reviewerFor, roundLimit, tierOf } from './review-policy.js';
|
|
3
|
+
import { baseOf, extrasOf } from './customization.js';
|
|
4
|
+
import { AgjanError } from './errors.js';
|
|
3
5
|
import { WORKFLOWS } from './workflow.js';
|
|
4
6
|
/** Where a team comes from: agjan, an imported package (`<package>/<team>`), or the project's configuration. */
|
|
5
7
|
export function teamSource(config, name) {
|
|
@@ -7,38 +9,60 @@ export function teamSource(config, name) {
|
|
|
7
9
|
return 'imported';
|
|
8
10
|
return BUILT_IN_TEAMS[name] && !config.teams?.[name] ? 'built-in' : 'project';
|
|
9
11
|
}
|
|
12
|
+
/** The track stage an extra of `stage` shows in: the stage itself for a feature; the review (or approval) stage otherwise. */
|
|
13
|
+
function trackStage(kind, stage, gate) {
|
|
14
|
+
if (kind === 'feature')
|
|
15
|
+
return stage.charAt(0).toUpperCase() + stage.slice(1);
|
|
16
|
+
return kind === 'discovery' && gate ? 'Approval' : 'Review';
|
|
17
|
+
}
|
|
18
|
+
/** Persona entries of a role list as the JSON gives them. */
|
|
19
|
+
function personaEntries(config, personas) {
|
|
20
|
+
return personas.map(({ role, persona }) => ({
|
|
21
|
+
role,
|
|
22
|
+
...(config.roles?.[role]?.description ? { description: config.roles[role].description } : {}),
|
|
23
|
+
skills: persona.skills,
|
|
24
|
+
...(persona.instructions ? { instructions: persona.instructions } : {}),
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
10
27
|
/**
|
|
11
|
-
*
|
|
12
|
-
* the light track (full by
|
|
28
|
+
* A workflow (built-in, or the project's own on a built-in base, decision 95) with the team
|
|
29
|
+
* named (else its default) and, for a feature, the full or the light track (full by
|
|
30
|
+
* default). The workflow's extra reviews follow the stage's own reviews; its extra gates come
|
|
31
|
+
* before the stage's own gate.
|
|
13
32
|
*/
|
|
14
|
-
export function resolveWorkflow(root, config,
|
|
33
|
+
export function resolveWorkflow(root, config, workflowName, options = {}) {
|
|
34
|
+
const kind = baseOf(config, workflowName);
|
|
35
|
+
if (!kind)
|
|
36
|
+
throw new AgjanError(`no workflow '${workflowName}'`);
|
|
15
37
|
const workflow = WORKFLOWS[kind];
|
|
38
|
+
const own = workflowName !== kind;
|
|
16
39
|
const mode = kind === 'feature' ? (options.light ? 'light' : 'full') : null;
|
|
17
|
-
const fallback = defaultTeam(config,
|
|
40
|
+
const fallback = defaultTeam(config, workflowName);
|
|
18
41
|
const name = options.team ?? fallback;
|
|
19
42
|
const team = name ? (allTeams(config)[name] ?? null) : null;
|
|
20
|
-
const roleOf = { main: mainRole(kind), reviewer: 'reviewer', qa: 'tester', human: null };
|
|
21
43
|
const qaOff = config.review?.qa === 'off';
|
|
44
|
+
const extras = extrasOf(config, workflowName);
|
|
22
45
|
const stages = workflow.track.map((stage) => ({
|
|
23
46
|
name: stage.name,
|
|
24
47
|
steps: stage.steps
|
|
25
48
|
.filter((step) => !step.mode || step.mode === mode)
|
|
26
49
|
.map((step) => {
|
|
27
|
-
const
|
|
50
|
+
const personas = team && step.actor !== 'human' ? personasFor(config, team, kind, step.actor) : [];
|
|
51
|
+
const builtIn = step.actor === 'main' ? mainRole(kind) : step.actor === 'reviewer' ? 'reviewer' : step.actor === 'qa' ? 'tester' : null;
|
|
28
52
|
const resolved = {
|
|
29
53
|
actor: step.actor,
|
|
30
54
|
agent: step.actor === 'main' ? 'main agent' : 'you',
|
|
31
55
|
does: step.does,
|
|
32
|
-
role,
|
|
33
|
-
persona:
|
|
56
|
+
role: builtIn,
|
|
57
|
+
persona: builtIn ? (team?.personas[builtIn] ?? null) : null,
|
|
58
|
+
personas: personaEntries(config, personas),
|
|
34
59
|
};
|
|
35
60
|
if (step.review) {
|
|
36
|
-
const kindOfStep = stepKind(step.review);
|
|
37
61
|
resolved.agent = reviewerFor(config, step.review);
|
|
38
62
|
resolved.review = {
|
|
39
63
|
step: step.review,
|
|
40
|
-
tier: step.review === 'qa' ? 'qa' : (config.review
|
|
41
|
-
rounds: roundLimit(config),
|
|
64
|
+
tier: step.review === 'qa' ? 'qa' : tierOf(config, step.review),
|
|
65
|
+
rounds: roundLimit(config, step.review),
|
|
42
66
|
...(step.review === 'build:' ? { per: config.review?.build === 'task' ? 'task' : 'area' } : {}),
|
|
43
67
|
};
|
|
44
68
|
if (step.review === 'qa' && qaOff)
|
|
@@ -49,16 +73,54 @@ export function resolveWorkflow(root, config, kind, options = {}) {
|
|
|
49
73
|
return resolved;
|
|
50
74
|
}),
|
|
51
75
|
}));
|
|
76
|
+
// The workflow's extras (decision 95): reviews after the stage's own, gates before its gate.
|
|
77
|
+
for (const r of extras.reviews) {
|
|
78
|
+
const stage = stages.find((st) => st.name === trackStage(kind, r.stage, false));
|
|
79
|
+
if (!stage)
|
|
80
|
+
continue;
|
|
81
|
+
const role = r.role ?? 'reviewer';
|
|
82
|
+
const persona = team?.personas[role] ?? null;
|
|
83
|
+
const step = {
|
|
84
|
+
actor: 'reviewer',
|
|
85
|
+
agent: reviewerFor(config, r.id),
|
|
86
|
+
does: r.description,
|
|
87
|
+
role,
|
|
88
|
+
persona,
|
|
89
|
+
personas: role === 'reviewer' && team ? personaEntries(config, personasFor(config, team, kind, 'reviewer')) : persona ? personaEntries(config, [{ role, persona }]) : [],
|
|
90
|
+
review: { step: r.id, tier: tierOf(config, r.id), rounds: roundLimit(config, r.id) },
|
|
91
|
+
extra: true,
|
|
92
|
+
};
|
|
93
|
+
// Right after the stage's reviews (its own, then earlier extras); else before its gate.
|
|
94
|
+
const lastReview = stage.steps.findLastIndex((x) => x.actor === 'reviewer' || x.actor === 'qa');
|
|
95
|
+
const human = stage.steps.findIndex((x) => x.actor === 'human');
|
|
96
|
+
stage.steps.splice(lastReview !== -1 ? lastReview + 1 : human === -1 ? stage.steps.length : human, 0, step);
|
|
97
|
+
}
|
|
98
|
+
for (const g of extras.gates) {
|
|
99
|
+
const stage = stages.find((st) => st.name === trackStage(kind, g.stage, true));
|
|
100
|
+
if (!stage)
|
|
101
|
+
continue;
|
|
102
|
+
const step = { actor: 'human', agent: 'you', does: g.description, role: null, persona: null, personas: [], gate: { name: g.id, command: `npx agjan approve ${g.id}` }, extra: true };
|
|
103
|
+
const human = stage.steps.findIndex((x) => x.actor === 'human' && !x.extra);
|
|
104
|
+
stage.steps.splice(human === -1 ? stage.steps.length : human, 0, step);
|
|
105
|
+
}
|
|
52
106
|
return {
|
|
53
107
|
schema: 1,
|
|
54
|
-
workflow: {
|
|
108
|
+
workflow: {
|
|
109
|
+
kind: workflowName,
|
|
110
|
+
base: kind,
|
|
111
|
+
name: own ? workflowName : workflow.name,
|
|
112
|
+
...(own && config.workflows?.[workflowName]?.description ? { description: config.workflows[workflowName].description } : {}),
|
|
113
|
+
skill: `/agjan-${own ? workflowName : workflow.skill.replace(/^agjan-/, '')}`,
|
|
114
|
+
end: workflow.end,
|
|
115
|
+
mode,
|
|
116
|
+
},
|
|
55
117
|
team: name
|
|
56
118
|
? {
|
|
57
119
|
name,
|
|
58
120
|
description: team?.description ?? '',
|
|
59
121
|
source: teamSource(config, name),
|
|
60
122
|
default: name === fallback,
|
|
61
|
-
problems: teamProblems(root, config, name,
|
|
123
|
+
problems: teamProblems(root, config, name, workflowName),
|
|
62
124
|
}
|
|
63
125
|
: null,
|
|
64
126
|
stages,
|
package/docs/guide.md
CHANGED
|
@@ -14,6 +14,7 @@ structure around the agents you already use (Claude Code, GitHub Copilot).
|
|
|
14
14
|
- [Small changes and existing applications](#small-changes-and-existing-applications)
|
|
15
15
|
- [Exploring a decision first](#exploring-a-decision-first)
|
|
16
16
|
- [Teams](#teams)
|
|
17
|
+
- [Your own workflows](#your-own-workflows)
|
|
17
18
|
- [Asking questions](#asking-questions)
|
|
18
19
|
- [Commands](#commands)
|
|
19
20
|
- [Configuration](#configuration)
|
|
@@ -437,9 +438,43 @@ included), and make it the default for a workflow:
|
|
|
437
438
|
}
|
|
438
439
|
```
|
|
439
440
|
|
|
441
|
+
**Your own roles and shared personas.** Next to implementer, reviewer, tester and analyst you can
|
|
442
|
+
define roles under `roles`; each reaches one of the agents that already run (`main`, `reviewer`,
|
|
443
|
+
`qa`), which then works with that role's persona as well. A persona used by several teams can be
|
|
444
|
+
defined once under `personas` and named in each team:
|
|
445
|
+
|
|
446
|
+
```json
|
|
447
|
+
{
|
|
448
|
+
"roles": {
|
|
449
|
+
"security-reviewer": { "agent": "reviewer", "description": "checks our security standard" }
|
|
450
|
+
},
|
|
451
|
+
"personas": {
|
|
452
|
+
"company-reviewer": { "skills": ["solution-reviewer"], "instructions": "Cite file and line." }
|
|
453
|
+
},
|
|
454
|
+
"teams": {
|
|
455
|
+
"company-delivery": {
|
|
456
|
+
"description": "Delivery with our security standard",
|
|
457
|
+
"workflows": ["feature"],
|
|
458
|
+
"personas": {
|
|
459
|
+
"implementer": { "skills": ["cap-developer", "fiori-developer"] },
|
|
460
|
+
"reviewer": "company-reviewer",
|
|
461
|
+
"security-reviewer": { "skills": ["company-security"] },
|
|
462
|
+
"tester": { "skills": ["qa-tester"] }
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
},
|
|
466
|
+
"review": { "step_rounds": { "design": 5 } }
|
|
467
|
+
}
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
Here every review of a company-delivery unit works with both the reviewer's and the security
|
|
471
|
+
reviewer's skills, and the design review gets up to 5 rounds. A role adds knowledge to an agent's
|
|
472
|
+
existing steps; it starts no agent and adds no step. Imported packages use the built-in roles,
|
|
473
|
+
with their personas written out.
|
|
474
|
+
|
|
440
475
|
A unit starts with the workflow's default team, or the one you name (`--team` on `new`,
|
|
441
476
|
`fix start`, `discover start`), and records it with a hash of its definition. A persona
|
|
442
|
-
starts no agent of its own: the implementer's skills reach the main agent through `status
|
|
477
|
+
starts no agent of its own: the implementer's or analyst's skills and instructions reach the main agent through `status` (its `team` and `follow` rows),
|
|
443
478
|
the reviewer's and the tester's through their review and QA contexts. If the team's
|
|
444
479
|
definition changes while a unit is under way, `status` and `check` say so.
|
|
445
480
|
`npx agjan team list` lists the teams, `npx agjan team show <name>` their personas.
|
|
@@ -486,6 +521,53 @@ fails when an imported file was changed by hand, and CI reports `agjan.imports.j
|
|
|
486
521
|
`npx agjan import remove acme` takes everything out, `npx agjan import list` shows what is
|
|
487
522
|
imported. Agents cannot run `import`.
|
|
488
523
|
|
|
524
|
+
## Your own workflows
|
|
525
|
+
|
|
526
|
+
The built-in workflows keep their steps, but a project can add to them and define workflows of
|
|
527
|
+
its own, under `workflows` in `agjan.config.json`:
|
|
528
|
+
|
|
529
|
+
- **Extra review steps** review what a stage produced (the spec, the design, the build, the whole
|
|
530
|
+
change, the fix, the map, the proposal) with a focus of their own, by the reviewer agent at
|
|
531
|
+
their own tier and round limit, optionally with the persona of one of your roles.
|
|
532
|
+
- **Extra gates** are a person's approval in a terminal (`npx agjan approve <gate>`), stamped like
|
|
533
|
+
the built-in gates: a later change to the stage's documents, or to the files in Build, Verify,
|
|
534
|
+
a fix or a map run, makes the approval stale.
|
|
535
|
+
- **Workflows of your own** run on a built-in one (`base`) with extras of their own: a `hotfix`
|
|
536
|
+
based on `fix`, an `adr` based on `discovery`, a `secure-feature` based on `feature`.
|
|
537
|
+
|
|
538
|
+
```json
|
|
539
|
+
{
|
|
540
|
+
"workflows": {
|
|
541
|
+
"feature": {
|
|
542
|
+
"gates": [{ "id": "po-signoff", "stage": "spec", "description": "The product owner signs off the spec" }],
|
|
543
|
+
"reviews": [{ "id": "security", "stage": "build", "description": "Check the change against our security standard", "role": "security-reviewer", "tier": "deep" }]
|
|
544
|
+
},
|
|
545
|
+
"hotfix": {
|
|
546
|
+
"base": "fix",
|
|
547
|
+
"description": "An urgent production fix, signed off by the on-call lead",
|
|
548
|
+
"reviews": [{ "id": "ops-check", "stage": "fix", "description": "Check rollback and monitoring" }],
|
|
549
|
+
"gates": [{ "id": "lead-signoff", "stage": "fix", "description": "The on-call lead signs off" }]
|
|
550
|
+
}
|
|
551
|
+
},
|
|
552
|
+
"team": { "hotfix": "ops-team" }
|
|
553
|
+
}
|
|
554
|
+
```
|
|
555
|
+
|
|
556
|
+
Extras are required where the stage's own requirements are: an extra review or gate of Spec,
|
|
557
|
+
Design or a discovery's proposal before that stage's gate, of Build and Verify before the
|
|
558
|
+
acceptance (`approve verify`), of a fix or a map run in CI. `npx agjan status` names each one when
|
|
559
|
+
it is due; the workflow skills tell the agent to run an extra review like the stage's own and to
|
|
560
|
+
hand an extra gate to you. A workflow of your own is started by name (`npx agjan new <slug> --key
|
|
561
|
+
<KEY> --workflow secure-feature`, `fix start … --workflow hotfix`, `map start --workflow …`,
|
|
562
|
+
`discover start … --workflow adr`); the unit records it. `agjan sync` writes its skill,
|
|
563
|
+
`/agjan-<name>`, generated from the configuration; remove the folder yourself when you remove the
|
|
564
|
+
workflow. Teams serve it by name, else its base's default team works for it.
|
|
565
|
+
|
|
566
|
+
Extras add to a workflow; nothing can remove a built-in step, review, gate or control. Names are
|
|
567
|
+
lowercase letters, digits and `-`, unique across all workflows, and not one of agjan's own
|
|
568
|
+
(`check` reports mistakes). `npx agjan workflow list` and `npx agjan workflow show <workflow>`
|
|
569
|
+
show the result, extras marked.
|
|
570
|
+
|
|
489
571
|
## Asking questions
|
|
490
572
|
|
|
491
573
|
**`/agjan-ask`** answers a general question about SAP CAP, Fiori and UI5, SAP BTP,
|
|
@@ -587,6 +669,7 @@ is wrong, so a typo is never a silent default.
|
|
|
587
669
|
| `fix` | `max_total`, `max_per_file`, `protected`, `ignored`, `new_file_paths` |
|
|
588
670
|
| `review.build` | `area` (default: one build review per completed area) or `task` |
|
|
589
671
|
| `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
|
+
| `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 }` |
|
|
590
673
|
| `review.qa` | `on` (default) or `off`: the QA step in Verify for full-mode features |
|
|
591
674
|
| `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 |
|
|
592
675
|
| `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 |
|
|
@@ -595,6 +678,9 @@ is wrong, so a typo is never a silent default.
|
|
|
595
678
|
| `limits.spec_kb`, `limits.design_kb` | soft size limits; `check` warns above them (defaults 12 and 20 KB; design covers `design.md` and `tasks.md`) |
|
|
596
679
|
| `models.<host>.<tier>` | model of the reviewer agents per tier (`balanced`, `deep`); `"session"` (the default, written by `init` so you see it) runs the reviewer on the model of the session that starts it. Set it with `npx agjan models set deep <model>` in your terminal (`npx agjan models` lists the settings and, for Copilot, the models it offers). A deep reviewer on another model family than the main agent (for example `gpt-6-sol` while the main agent runs on Claude) misses other things than the main agent. Model names differ per host (Claude Code: `sonnet`, `opus` or a full id; Copilot: for example `claude-opus-5.5`). Copilot uses the agent file's model unless the session was started with `--model`, which overrides it. `doctor` shows what each reviewer runs on |
|
|
597
680
|
| `mcp.servers.<name>` | documentation MCP servers: `command`, `args`, `env`, `areas`, `enabled` |
|
|
681
|
+
| `teams`, `team` | your own teams, and the default team per workflow ([Teams](#teams)) |
|
|
682
|
+
| `roles`, `personas` | your own roles, each reaching the main agent, the reviewer or the QA agent, and named personas teams refer to ([Teams](#teams)) |
|
|
683
|
+
| `workflows` | extra review steps and gates for the built-in workflows, and workflows of your own based on them ([Your own workflows](#your-own-workflows)) |
|
|
598
684
|
| `ci.policy_changes`, `ci.untracked_changes` | `warn` or `fail` in `check --ci`; CI reads them from the base branch, so a pull request cannot lower them for itself |
|
|
599
685
|
|
|
600
686
|
`npx agjan status` prints the language, the round limit and the attempts in its first
|
|
@@ -15,12 +15,12 @@ shows how to use them.
|
|
|
15
15
|
|
|
16
16
|
| Term | What it is | Examples | Where it is defined |
|
|
17
17
|
|---|---|---|---|
|
|
18
|
-
| **Workflow** | A kind of work and its
|
|
18
|
+
| **Workflow** | A kind of work and its steps: stages, independent reviews, the approvals you give, and what it may change. | feature, fix, map, discovery; your own, such as a hotfix | Built into agjan; a project adds review steps and gates under `workflows`, and workflows of its own based on a built-in one. |
|
|
19
19
|
| **Team** | A named group of personas for one or more workflows. It decides the knowledge, never the steps. | sap-delivery, sap-maintenance, sap-discovery | Built into agjan, imported from a package, or in the project's `agjan.config.json`. |
|
|
20
|
-
| **Persona** | A role inside a team, with the skills (and optional instructions) that role works with. | the reviewer of sap-delivery | Inside its team
|
|
20
|
+
| **Persona** | A role inside a team, with the skills (and optional instructions) that role works with. | the reviewer of sap-delivery | Inside its team, or defined once under `personas` in `agjan.config.json` and named by several teams. |
|
|
21
21
|
| **Skill** | A folder of instructions and references an agent reads for a specialty. | cap-developer, solution-reviewer, qa-tester | `.claude/skills/<name>/SKILL.md`: agjan's own, the project's own, or imported. |
|
|
22
22
|
|
|
23
|
-
There are four **roles**, and a persona fills one of them:
|
|
23
|
+
There are four built-in **roles**, and a persona fills one of them:
|
|
24
24
|
|
|
25
25
|
| Role | What it does |
|
|
26
26
|
|---|---|
|
|
@@ -29,6 +29,10 @@ There are four **roles**, and a persona fills one of them:
|
|
|
29
29
|
| reviewer | Reviews every step independently, read-only (the reviewer agents). |
|
|
30
30
|
| tester | Tests the built feature against its acceptance criteria (the QA agent). |
|
|
31
31
|
|
|
32
|
+
A project can add its own roles under `roles`, such as a `security-reviewer`. Each one reaches an
|
|
33
|
+
agent that already runs (the main agent, the reviewer or the QA agent), which then works with that
|
|
34
|
+
role's persona as well. A role adds knowledge; it never adds an agent or a step.
|
|
35
|
+
|
|
32
36
|
A **unit** is one piece of work that runs a workflow: one feature, one fix, one map run or
|
|
33
37
|
one discovery.
|
|
34
38
|
|
|
@@ -61,12 +65,17 @@ The rules behind the arrows:
|
|
|
61
65
|
- Each unit runs with **exactly one** team: the default, or the one named with `--team`
|
|
62
66
|
when the unit starts. The unit records the team and a hash of its definition, so a later
|
|
63
67
|
change to the team is reported.
|
|
64
|
-
- A team has one persona per role, and must fill every role its workflows need with
|
|
65
|
-
least one skill.
|
|
68
|
+
- A team has one persona per role, and must fill every built-in role its workflows need with
|
|
69
|
+
at least one skill. Its own roles are optional extras for the same agents.
|
|
66
70
|
- A persona starts no agent of its own. Its skills and instructions go to the agent that
|
|
67
71
|
already does that job: the main agent, the reviewer or the QA agent.
|
|
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).
|
|
68
74
|
- A team cannot remove a step. Every workflow keeps an independent review, approvals
|
|
69
75
|
stamped by a script, scope checks, and a person who decides at the end.
|
|
76
|
+
- A project can add extra review steps and gates to a workflow, and define workflows of its
|
|
77
|
+
own on a built-in base (a `hotfix` on `fix`): see [Your own workflows](guide.md#your-own-workflows).
|
|
78
|
+
They add steps; they never remove one.
|
|
70
79
|
|
|
71
80
|
## The workflows
|
|
72
81
|
|
|
@@ -8,6 +8,22 @@ 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
|
+
## Your team
|
|
12
|
+
|
|
13
|
+
Once the unit exists, `npx agjan status` shows its team: the `team` row lists the skills
|
|
14
|
+
your role works with (read them next to the ones this skill names), and each `follow` row is
|
|
15
|
+
an instruction of your team for you. Follow those instructions; where one conflicts with this
|
|
16
|
+
skill or with the user, this skill and the user win.
|
|
17
|
+
|
|
18
|
+
## Your workflow's extras
|
|
19
|
+
|
|
20
|
+
The project can add review steps and gates to this workflow (`npx agjan workflow show
|
|
21
|
+
<workflow>` lists them). When `npx agjan status` names a due review step this skill does not
|
|
22
|
+
name, run it like this skill's own reviews: delegate it, on its own, to the reviewer agent
|
|
23
|
+
`status` names, with the prompt `Review step <step> of <the unit's kind> <slug>.`, and fix its
|
|
24
|
+
blockers within the round limit. A gate it names is the user's: request it (`npx agjan log
|
|
25
|
+
--gate-requested <gate>`) and ask them to run `npx agjan approve <gate>` in a terminal.
|
|
26
|
+
|
|
11
27
|
## Arriving in auto mode
|
|
12
28
|
|
|
13
29
|
In auto mode you reach this skill from the previous one within one run, through `npx agjan skill build`.
|
|
@@ -8,6 +8,22 @@ 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
|
+
## Your team
|
|
12
|
+
|
|
13
|
+
Once the unit exists, `npx agjan status` shows its team: the `team` row lists the skills
|
|
14
|
+
your role works with (read them next to the ones this skill names), and each `follow` row is
|
|
15
|
+
an instruction of your team for you. Follow those instructions; where one conflicts with this
|
|
16
|
+
skill or with the user, this skill and the user win.
|
|
17
|
+
|
|
18
|
+
## Your workflow's extras
|
|
19
|
+
|
|
20
|
+
The project can add review steps and gates to this workflow (`npx agjan workflow show
|
|
21
|
+
<workflow>` lists them). When `npx agjan status` names a due review step this skill does not
|
|
22
|
+
name, run it like this skill's own reviews: delegate it, on its own, to the reviewer agent
|
|
23
|
+
`status` names, with the prompt `Review step <step> of <the unit's kind> <slug>.`, and fix its
|
|
24
|
+
blockers within the round limit. A gate it names is the user's: request it (`npx agjan log
|
|
25
|
+
--gate-requested <gate>`) and ask them to run `npx agjan approve <gate>` in a terminal.
|
|
26
|
+
|
|
11
27
|
## Arriving in auto mode
|
|
12
28
|
|
|
13
29
|
In auto mode you reach this skill from the previous one within one run, through `npx agjan skill design`.
|
|
@@ -11,6 +11,22 @@ You answer it like an SAP consultant preparing a workshop: options, trade-offs a
|
|
|
11
11
|
recommendation the user can approve. You change no code; building the recommendation is a
|
|
12
12
|
feature afterwards (`/agjan-spec`).
|
|
13
13
|
|
|
14
|
+
## Your team
|
|
15
|
+
|
|
16
|
+
Once the unit exists, `npx agjan status` shows its team: the `team` row lists the skills
|
|
17
|
+
your role works with (read them next to the ones this skill names), and each `follow` row is
|
|
18
|
+
an instruction of your team for you. Follow those instructions; where one conflicts with this
|
|
19
|
+
skill or with the user, this skill and the user win.
|
|
20
|
+
|
|
21
|
+
## Your workflow's extras
|
|
22
|
+
|
|
23
|
+
The project can add review steps and gates to this workflow (`npx agjan workflow show
|
|
24
|
+
<workflow>` lists them). When `npx agjan status` names a due review step this skill does not
|
|
25
|
+
name, run it like this skill's own reviews: delegate it, on its own, to the reviewer agent
|
|
26
|
+
`status` names, with the prompt `Review step <step> of <the unit's kind> <slug>.`, and fix its
|
|
27
|
+
blockers within the round limit. A gate it names is the user's: request it (`npx agjan log
|
|
28
|
+
--gate-requested <gate>`) and ask them to run `npx agjan approve <gate>` in a terminal.
|
|
29
|
+
|
|
14
30
|
## 1. Start
|
|
15
31
|
|
|
16
32
|
- If you are on the base branch, the work needs a branch of its own. `npx agjan status`
|
|
@@ -34,7 +50,7 @@ Otherwise do not ask: state your assumptions in the Context.
|
|
|
34
50
|
- The application: `agjan-docs/project.md`, then the files that matter for the question
|
|
35
51
|
(models, services, `mta.yaml`, `xs-security.json`, app manifests). Read; never change.
|
|
36
52
|
- agjan's knowledge: the skills of your role in the discovery's team (`npx agjan status`,
|
|
37
|
-
`team` row; by default btp-architect, cap-developer, fiori-developer; read their tables and
|
|
53
|
+
`team` row, see Your team; by default btp-architect, cap-developer, fiori-developer; read their tables and
|
|
38
54
|
only the matching references) and the source list
|
|
39
55
|
`.claude/skills/agjan-ask/references/sources.md`.
|
|
40
56
|
- The documentation servers configured for the project and, where your host can and the
|
|
@@ -8,6 +8,22 @@ description: Fast path for a small agjan change (a bug fix, a label, a small cor
|
|
|
8
8
|
A small change to existing files, checked by script and reviewed, without Spec and
|
|
9
9
|
Design. A human still reviews and merges the pull request.
|
|
10
10
|
|
|
11
|
+
## Your team
|
|
12
|
+
|
|
13
|
+
Once the unit exists, `npx agjan status` shows its team: the `team` row lists the skills
|
|
14
|
+
your role works with (read them next to the ones this skill names), and each `follow` row is
|
|
15
|
+
an instruction of your team for you. Follow those instructions; where one conflicts with this
|
|
16
|
+
skill or with the user, this skill and the user win.
|
|
17
|
+
|
|
18
|
+
## Your workflow's extras
|
|
19
|
+
|
|
20
|
+
The project can add review steps and gates to this workflow (`npx agjan workflow show
|
|
21
|
+
<workflow>` lists them). When `npx agjan status` names a due review step this skill does not
|
|
22
|
+
name, run it like this skill's own reviews: delegate it, on its own, to the reviewer agent
|
|
23
|
+
`status` names, with the prompt `Review step <step> of <the unit's kind> <slug>.`, and fix its
|
|
24
|
+
blockers within the round limit. A gate it names is the user's: request it (`npx agjan log
|
|
25
|
+
--gate-requested <gate>`) and ask them to run `npx agjan approve <gate>` in a terminal.
|
|
26
|
+
|
|
11
27
|
## 1. Is it a fix?
|
|
12
28
|
|
|
13
29
|
A fix changes existing files only (new files only for tests), stays within the
|