agjan 0.0.23 → 0.0.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -88,6 +88,8 @@ Fiori or BTP, in general or about files you name: `/agjan-ask`.
88
88
 
89
89
  - [User guide](docs/guide.md): setup, workflow, commands, configuration, hosts, CI,
90
90
  troubleshooting
91
+ - [Workflows, teams, personas and skills](docs/workflows-and-teams.md): the terms and how
92
+ they fit together
91
93
  - [Design](docs/design.md): every decision and its reason
92
94
  - [Host experiments](docs/host-experiments.md): what was verified on each host, and how
93
95
  - [End-to-end run](docs/e2e-run.md): a guided trial on a sample CAP and Fiori app
package/dist/browser.js CHANGED
@@ -1,11 +1,13 @@
1
1
  import { spawnSync } from 'node:child_process';
2
+ import { platform } from 'node:os';
2
3
  import { join } from 'node:path';
3
4
  import { readJson } from './json-file.js';
4
5
  /**
5
6
  * UI tests are optional (design decision 75): they run in Playwright's Chromium where it
6
7
  * can start, and are skipped with the reason where it cannot. On macOS and Windows,
7
8
  * `npx playwright install chromium` is all it needs; on Linux, Chromium also needs system
8
- * libraries, which only an administrator adds. agjan never installs them.
9
+ * libraries, which only an administrator adds. agjan installs nothing on its own: `init` and
10
+ * `doctor` offer the steps on a terminal and run one only when the user says yes.
9
11
  */
10
12
  /** The npm script that runs a project's UI tests. */
11
13
  export const UI_SCRIPT = 'test:ui';
@@ -18,20 +20,16 @@ await browser.close();`;
18
20
  export function hasUiTests(root) {
19
21
  return Boolean(readJson(join(root, 'package.json'))?.scripts?.[UI_SCRIPT]);
20
22
  }
21
- /**
22
- * Starts and closes Chromium from the project. Returns { ready: true } or { ready: false,
23
- * reason, enable }. AGJAN_BROWSER_PROBE names a Node script that replaces the probe (tests).
24
- */
25
23
  export function probeBrowser(root) {
26
24
  const fake = process.env.AGJAN_BROWSER_PROBE;
27
25
  const run = spawnSync(process.execPath, fake ? [fake] : ['--input-type=module', '-e', PROBE], { cwd: root, encoding: 'utf8', timeout: 120_000 });
28
26
  if (run.status === 0)
29
27
  return { ready: true };
30
28
  if (run.status === 3)
31
- return { ready: false, reason: '@playwright/test is not installed', enable: 'npm install' };
29
+ return { ready: false, reason: '@playwright/test is not installed', enable: 'npm install', missing: 'package' };
32
30
  const output = `${run.stderr ?? ''}${run.stdout ?? ''}`;
33
31
  if (/Executable doesn't exist|playwright install/i.test(output) && !/install-deps|missing dependencies/i.test(output)) {
34
- return { ready: false, reason: 'Chromium is not downloaded', enable: 'npx playwright install chromium (no admin rights needed)' };
32
+ return { ready: false, reason: 'Chromium is not downloaded', enable: 'npx playwright install chromium (no admin rights needed)', missing: 'download' };
35
33
  }
36
34
  const library = /error while loading shared libraries: (\S+?):/.exec(output)?.[1];
37
35
  if (library || /missing dependencies|install-deps/i.test(output)) {
@@ -39,8 +37,27 @@ export function probeBrowser(root) {
39
37
  ready: false,
40
38
  reason: `Chromium cannot start: this Linux system lacks its libraries${library ? ` (${library})` : ''}`,
41
39
  enable: 'whoever maintains the machine or container image adds them once, for example with `npx playwright install-deps chromium` run as root in its Dockerfile',
40
+ missing: 'libraries',
42
41
  };
43
42
  }
44
43
  const first = output.split('\n').map((l) => l.trim()).find((l) => l && !l.startsWith('at ')) ?? (run.error ? run.error.message : `exit code ${run.status}`);
45
- return { ready: false, reason: `Chromium cannot start: ${first.replace(/^\w*Error: /, '')}`, enable: 'npx playwright install chromium, then npx agjan doctor' };
44
+ return { ready: false, reason: `Chromium cannot start: ${first.replace(/^\w*Error: /, '')}`, enable: 'npx playwright install chromium, then npx agjan doctor', missing: 'other' };
45
+ }
46
+ /** The Dockerfile line that keeps the system libraries across container rebuilds. */
47
+ export const DEPS_DOCKERFILE_LINE = 'RUN npx playwright install-deps chromium';
48
+ /** The command that adds the system libraries, or null when this user cannot run it unattended. */
49
+ export function depsCommand() {
50
+ if (platform() !== 'linux')
51
+ return null;
52
+ const install = ['npx', 'playwright', 'install-deps', 'chromium'];
53
+ if (process.getuid?.() === 0)
54
+ return { command: install[0], args: install.slice(1), shown: install.join(' ') };
55
+ // sudo -n never asks for a password: it fails at once where one would be needed.
56
+ if (spawnSync('sudo', ['-n', 'true'], { stdio: 'ignore' }).status !== 0)
57
+ return null;
58
+ return { command: 'sudo', args: ['-n', 'env', `PATH=${process.env.PATH ?? ''}`, ...install], shown: `sudo ${install.join(' ')}` };
59
+ }
60
+ /** Runs a setup command from the project with its output shown; true when it succeeded. */
61
+ export function runVisible(root, command, args) {
62
+ return spawnSync(command, args, { cwd: root, stdio: 'inherit' }).status === 0;
46
63
  }
package/dist/cli.js CHANGED
@@ -14,6 +14,7 @@ import * as fix from './commands/fix.js';
14
14
  import * as mapCommand from './commands/map.js';
15
15
  import * as discoverCommand from './commands/discover.js';
16
16
  import * as teamCommand from './commands/team.js';
17
+ import * as workflowCommand from './commands/workflow.js';
17
18
  import * as importCommand from './commands/import.js';
18
19
  import * as branch from './commands/branch.js';
19
20
  import * as progress from './commands/progress.js';
@@ -57,6 +58,7 @@ const COMMANDS = {
57
58
  map: mapCommand.map,
58
59
  discover: discoverCommand.discover,
59
60
  team: teamCommand.run,
61
+ workflow: workflowCommand.run,
60
62
  import: importCommand.run,
61
63
  baseline: mapCommand.baseline,
62
64
  mcp: review.mcp,
@@ -119,6 +121,10 @@ Agent and human:
119
121
  exact commit; shown first, confirmed in a terminal
120
122
  team list | team show <name> the teams a unit can start with (new, fix start, discover
121
123
  start take --team) and what their personas work with
124
+ workflow list [--json] | workflow show <feature|fix|map|discovery> [--team <name>] [--light] [--json]
125
+ the workflows, and one as this project runs it: each step,
126
+ the agent that does it, its persona's skills, the review
127
+ tiers and rounds, your gates
122
128
  baseline refresh record the watched files in baseline.json
123
129
  skill <spec|design|build|verify>
124
130
  print the workflow skill (auto mode: the next skill of the run)
@@ -19,7 +19,7 @@ import { blink, mark, pad, tone, verdictColor } from '../ui.js';
19
19
  import { PINNED, mcpServers } from '../mcp-config.js';
20
20
  import { addCommand, addCopilotServers, copilotServers } from '../copilot-mcp.js';
21
21
  import { AGENTS, FOLLOW, OTHER, copilotModels, hostModels, modelChoices } from '../model-choices.js';
22
- import { UI_SCRIPT, hasUiTests, probeBrowser } from '../browser.js';
22
+ import { DEPS_DOCKERFILE_LINE, UI_SCRIPT, depsCommand, hasUiTests, probeBrowser, runVisible } from '../browser.js';
23
23
  import { readAutoDefault } from '../auto.js';
24
24
  const CI_FILE = '.github/workflows/agjan.yml';
25
25
  const CI_TEMPLATE = new URL('../../kit/templates/agjan-ci.yml', import.meta.url);
@@ -429,6 +429,7 @@ export async function init(ctx, argv) {
429
429
  ctx.out(` ${pad(tone(s, 'created'), 'created', 14)} ${CI_FILE}`);
430
430
  }
431
431
  }
432
+ offerBrowser(ctx, root);
432
433
  let committed = null;
433
434
  if (wantCommit) {
434
435
  const result = commitSetup(root, { firstCommit });
@@ -449,6 +450,53 @@ export async function init(ctx, argv) {
449
450
  }));
450
451
  return 0;
451
452
  }
453
+ /**
454
+ * Offers to make Chromium start, for a project that has UI tests: the download (no admin rights)
455
+ * and, on Linux, the system libraries (sudo). Asks first and only on a terminal; with no terminal
456
+ * or an answer of no, nothing is installed. `--yes` never covers it.
457
+ */
458
+ function offerBrowser(ctx, root) {
459
+ if (!hasUiTests(root))
460
+ return;
461
+ const s = ctx.style;
462
+ let changed = false;
463
+ let previous = '';
464
+ for (let step = 0; step < 2; step++) {
465
+ const browser = probeBrowser(root);
466
+ if (browser.ready || browser.missing === previous)
467
+ break; // what was just done did not help: do not ask again
468
+ previous = browser.missing;
469
+ if (browser.missing === 'download') {
470
+ if (!ask(ctx, `UI tests: ${browser.reason}. Download it now (npx playwright install chromium, no admin rights)?`, { defaultYes: true }))
471
+ return;
472
+ if (!runVisible(root, 'npx', ['playwright', 'install', 'chromium']))
473
+ return void ctx.out('', s.yellow('The download failed; the UI tests stay skipped.'));
474
+ }
475
+ else if (browser.missing === 'libraries') {
476
+ const deps = depsCommand();
477
+ if (!deps) {
478
+ if (ctx.isTTY)
479
+ ctx.out('', `${s.bold('ui tests')}: ${browser.reason}.`, ` Installing them needs root: run \`npx playwright install-deps chromium\` as root, and add \`${DEPS_DOCKERFILE_LINE}\``, ' to the Dockerfile so a rebuilt container keeps them.');
480
+ return;
481
+ }
482
+ if (!ask(ctx, `UI tests: ${browser.reason}. Install them now (${deps.shown})? It changes this machine.`, { defaultYes: false })) {
483
+ if (ctx.isTTY)
484
+ ctx.out('', ` To keep them across container rebuilds, add \`${DEPS_DOCKERFILE_LINE}\` to the Dockerfile.`);
485
+ return;
486
+ }
487
+ if (!runVisible(root, deps.command, deps.args))
488
+ return void ctx.out('', s.yellow('The installation failed; the UI tests stay skipped.'));
489
+ }
490
+ else {
491
+ return;
492
+ }
493
+ changed = true;
494
+ }
495
+ if (!changed)
496
+ return;
497
+ const last = probeBrowser(root);
498
+ ctx.out('', last.ready ? `${s.bold('ui tests')}: Chromium starts now` : s.yellow(`ui tests: still skipped: ${last.reason}`));
499
+ }
452
500
  function addPrepare(root) {
453
501
  const file = join(root, 'package.json');
454
502
  const pkg = readJson(file);
@@ -666,5 +714,7 @@ export async function doctor(ctx) {
666
714
  const failed = rows.filter((r) => r[0] === 'fail').length;
667
715
  const warned = rows.filter((r) => r[0] === 'warn').length;
668
716
  ctx.out(`${s.bold('agjan doctor')}: ${verdictColor(s, failed, warned)(`${failed} failure(s), ${warned} warning(s)`)}`);
717
+ if (root)
718
+ offerBrowser(ctx, root);
669
719
  return failed ? 1 : 0;
670
720
  }
@@ -0,0 +1,73 @@
1
+ import { parseArgs } from 'node:util';
2
+ import { UsageError } from '../errors.js';
3
+ import { allTeams, defaultTeam } from '../teams.js';
4
+ import { WORKFLOWS } from '../workflow.js';
5
+ import { resolveWorkflow, teamSource } from '../workflow-view.js';
6
+ const USAGE = 'usage: agjan workflow list [--json] | agjan workflow show <feature|fix|map|discovery> [--team <name>] [--light] [--json]';
7
+ const SOURCE = { 'built-in': 'built in', imported: 'imported', project: 'agjan.config.json' };
8
+ /**
9
+ * agjan workflow list | show <kind> (decision 90): the workflows with their default teams, and
10
+ * one of them as this project runs it: each stage's steps, the agent that does each, the
11
+ * persona it works with, the review tiers and rounds, and the person's gates. `--json` is for
12
+ * tools; the list then also gives the teams, for choosing one.
13
+ */
14
+ export function run(ctx, argv) {
15
+ const { values, positionals } = parseArgs({ args: argv, allowPositionals: true, options: { team: { type: 'string' }, light: { type: 'boolean' }, json: { type: 'boolean' } } });
16
+ const s = ctx.style;
17
+ if (positionals[0] === 'list' && positionals.length === 1 && values.json) {
18
+ const workflows = Object.values(WORKFLOWS).map((w) => ({ kind: w.kind, name: w.name, skill: `/${w.skill}`, stages: w.stages, team: defaultTeam(ctx.config, w.kind) }));
19
+ const teams = Object.entries(allTeams(ctx.config)).map(([name, t]) => ({ name, description: t.description, workflows: t.workflows, source: teamSource(ctx.config, name) }));
20
+ ctx.out(JSON.stringify({ schema: 1, workflows, teams }, null, 2));
21
+ return 0;
22
+ }
23
+ if (positionals[0] === 'list' && positionals.length === 1) {
24
+ for (const w of Object.values(WORKFLOWS)) {
25
+ ctx.out(`${s.bold(w.kind.padEnd(11))} /${w.skill.padEnd(16)} ${w.stages.join(' → ').padEnd(30)} ${s.gray(`team ${defaultTeam(ctx.config, w.kind) ?? '-'}`)}`);
26
+ }
27
+ return 0;
28
+ }
29
+ if (positionals[0] !== 'show' || positionals.length !== 2)
30
+ throw new UsageError(USAGE);
31
+ const kind = positionals[1];
32
+ if (!WORKFLOWS[kind])
33
+ throw new UsageError(`no workflow '${positionals[1]}' (workflows: ${Object.keys(WORKFLOWS).join(', ')})`);
34
+ const view = resolveWorkflow(ctx.root, ctx.config, kind, { team: values.team, light: values.light });
35
+ if (values.json) {
36
+ // The team's problems are in the data; tools read them there.
37
+ ctx.out(JSON.stringify(view, null, 2));
38
+ return 0;
39
+ }
40
+ const mode = view.workflow.mode ? ` (${view.workflow.mode})` : '';
41
+ ctx.out(`${s.bold(`${view.workflow.name} workflow`)}${mode}, started with ${view.workflow.skill}`);
42
+ if (view.team) {
43
+ ctx.out(`team ${s.bold(view.team.name)} ${s.gray(`(${SOURCE[view.team.source]}${view.team.default ? ', the default' : ''})`)}`);
44
+ if (view.team.description)
45
+ ctx.out(` ${s.gray(view.team.description)}`);
46
+ }
47
+ for (const stage of view.stages) {
48
+ ctx.out('', s.bold(stage.name));
49
+ for (const step of stage.steps) {
50
+ const details = [
51
+ step.review ? `${step.review.tier}${step.review.per ? `, per ${step.review.per}` : ''}, up to ${step.review.rounds} rounds` : '',
52
+ step.gate ? step.gate.command : '',
53
+ step.off ? `skipped: ${step.off}` : '',
54
+ ].filter(Boolean);
55
+ const does = step.off ? s.gray(step.does) : step.does;
56
+ ctx.out(` ${step.agent.padEnd(21)} ${does}${details.length ? s.gray(` (${details.join('; ')})`) : ''}`);
57
+ }
58
+ }
59
+ const roles = [...new Set(view.stages.flatMap((st) => st.steps).filter((st) => st.role).map((st) => st.role))];
60
+ if (view.team && roles.length) {
61
+ ctx.out('', s.bold(`What the agents work with (team ${view.team.name})`));
62
+ for (const role of roles) {
63
+ const persona = view.stages.flatMap((st) => st.steps).find((st) => st.role === role)?.persona;
64
+ ctx.out(` ${role.padEnd(21)} ${persona?.skills.length ? persona.skills.join(', ') : s.gray('no persona')}`);
65
+ if (persona?.instructions?.trim())
66
+ ctx.out(` ${''.padEnd(21)} ${s.gray(persona.instructions.trim().replace(/\s+/g, ' '))}`);
67
+ }
68
+ }
69
+ ctx.out('', s.gray(`Every workflow keeps: ${view.controls.join(', ')}. A team adds knowledge; it cannot remove a step.`));
70
+ for (const p of view.team?.problems ?? [])
71
+ ctx.out(`${s.red('problem')} ${p}`);
72
+ return view.team?.problems.length ? 1 : 0;
73
+ }
package/dist/config.js CHANGED
@@ -23,7 +23,7 @@ export function agentModel(config, host, tier) {
23
23
  return value && value !== SESSION_MODEL ? value : undefined;
24
24
  }
25
25
  /** Package defaults. Domain defaults and project overrides are layered on top. */
26
- const DEFAULTS = {
26
+ export const DEFAULTS = {
27
27
  domains: ['btp'],
28
28
  hosts: ['claude-code'],
29
29
  language: 'en',
@@ -0,0 +1,33 @@
1
+ import { DEFAULTS, merge } from './config.js';
2
+ import { DEFAULT_TIERS } from './review-policy.js';
3
+ /**
4
+ * agjan's default settings as data: schemas/config.defaults.json, shipped in the package next
5
+ * to config.schema.json, so tools that do not run agjan (agjan Studio) can show what a setting
6
+ * is when agjan.config.json leaves it out. test/unit/defaults-file.test.ts keeps the file in
7
+ * step with the code; scripts/defaults.ts writes it.
8
+ */
9
+ export const DEFAULTS_FILE = 'schemas/config.defaults.json';
10
+ /**
11
+ * Defaults that are not in DEFAULTS because the code reads them where they apply:
12
+ * git.branches (status, branch), review.qa (qa.ts: on unless "off"), agent.script_edits
13
+ * (the guard hook: deny unless "allow").
14
+ */
15
+ export const IMPLICIT_DEFAULTS = {
16
+ git: { branches: 'new' },
17
+ review: { qa: 'on' },
18
+ agent: { script_edits: 'deny' },
19
+ };
20
+ /** The tier of each review step; `qa` is the QA agent's own tier, not a review.tiers value. */
21
+ function reviewTiers() {
22
+ return Object.fromEntries(Object.entries(DEFAULT_TIERS).filter(([, tier]) => ['fast', 'balanced', 'deep'].includes(tier)));
23
+ }
24
+ export function defaultsDocument() {
25
+ return {
26
+ description: "agjan's defaults for agjan.config.json. Domains add their own on top (kit/domains/<id>/domain.json: per area implicit, tests, verify, lint; application, risk_paths and protected are appended), and the project's file overrides both. Objects merge, arrays replace. Review steps without a tier use balanced.",
27
+ format: 1,
28
+ defaults: merge(merge(DEFAULTS, IMPLICIT_DEFAULTS), { review: { tiers: reviewTiers() } }),
29
+ };
30
+ }
31
+ export function defaultsFileText() {
32
+ return `${JSON.stringify(defaultsDocument(), null, 2)}\n`;
33
+ }
@@ -0,0 +1,67 @@
1
+ import { BUILT_IN_TEAMS, allTeams, defaultTeam, mainRole, teamProblems } from './teams.js';
2
+ import { DEFAULT_TIERS, reviewerFor, roundLimit, stepKind } from './review-policy.js';
3
+ import { WORKFLOWS } from './workflow.js';
4
+ /** Where a team comes from: agjan, an imported package (`<package>/<team>`), or the project's configuration. */
5
+ export function teamSource(config, name) {
6
+ if (name.includes('/'))
7
+ return 'imported';
8
+ return BUILT_IN_TEAMS[name] && !config.teams?.[name] ? 'built-in' : 'project';
9
+ }
10
+ /**
11
+ * The workflow `kind` with the team named (else its default) and, for a feature, the full or
12
+ * the light track (full by default).
13
+ */
14
+ export function resolveWorkflow(root, config, kind, options = {}) {
15
+ const workflow = WORKFLOWS[kind];
16
+ const mode = kind === 'feature' ? (options.light ? 'light' : 'full') : null;
17
+ const fallback = defaultTeam(config, kind);
18
+ const name = options.team ?? fallback;
19
+ const team = name ? (allTeams(config)[name] ?? null) : null;
20
+ const roleOf = { main: mainRole(kind), reviewer: 'reviewer', qa: 'tester', human: null };
21
+ const qaOff = config.review?.qa === 'off';
22
+ const stages = workflow.track.map((stage) => ({
23
+ name: stage.name,
24
+ steps: stage.steps
25
+ .filter((step) => !step.mode || step.mode === mode)
26
+ .map((step) => {
27
+ const role = roleOf[step.actor];
28
+ const resolved = {
29
+ actor: step.actor,
30
+ agent: step.actor === 'main' ? 'main agent' : 'you',
31
+ does: step.does,
32
+ role,
33
+ persona: role ? (team?.personas[role] ?? null) : null,
34
+ };
35
+ if (step.review) {
36
+ const kindOfStep = stepKind(step.review);
37
+ resolved.agent = reviewerFor(config, step.review);
38
+ resolved.review = {
39
+ step: step.review,
40
+ tier: step.review === 'qa' ? 'qa' : (config.review?.tiers?.[kindOfStep] ?? DEFAULT_TIERS[kindOfStep] ?? 'balanced'),
41
+ rounds: roundLimit(config),
42
+ ...(step.review === 'build:' ? { per: config.review?.build === 'task' ? 'task' : 'area' } : {}),
43
+ };
44
+ if (step.review === 'qa' && qaOff)
45
+ resolved.off = 'review.qa is off';
46
+ }
47
+ if (step.gate)
48
+ resolved.gate = { name: step.gate, command: `npx agjan approve ${step.gate}` };
49
+ return resolved;
50
+ }),
51
+ }));
52
+ return {
53
+ schema: 1,
54
+ workflow: { kind, name: workflow.name, skill: `/${workflow.skill}`, end: workflow.end, mode },
55
+ team: name
56
+ ? {
57
+ name,
58
+ description: team?.description ?? '',
59
+ source: teamSource(config, name),
60
+ default: name === fallback,
61
+ problems: teamProblems(root, config, name, kind),
62
+ }
63
+ : null,
64
+ stages,
65
+ controls: workflow.controls,
66
+ };
67
+ }
package/dist/workflow.js CHANGED
@@ -13,6 +13,42 @@ export const WORKFLOWS = {
13
13
  endGate: 'verify',
14
14
  writes: 'tasks',
15
15
  controls: ['independent-review', 'stamped-approvals', 'scope-check', 'human-decision'],
16
+ track: [
17
+ {
18
+ name: 'Spec',
19
+ steps: [
20
+ { actor: 'main', does: 'writes the spec: what and why, with testable acceptance criteria' },
21
+ { actor: 'reviewer', does: 'reviews the spec', review: 'spec', mode: 'full' },
22
+ { actor: 'human', does: 'approve the spec', gate: 'spec', mode: 'full' },
23
+ ],
24
+ },
25
+ {
26
+ name: 'Design',
27
+ steps: [
28
+ { actor: 'main', does: 'writes the design: how, split into build tasks with file paths' },
29
+ { actor: 'reviewer', does: 'reviews the design', review: 'design', mode: 'full' },
30
+ { actor: 'reviewer', does: 'reviews the spec and the design together', review: 'design:light', mode: 'light' },
31
+ { actor: 'human', does: 'approve the design', gate: 'design', mode: 'full' },
32
+ { actor: 'human', does: 'approve the spec and the design together', gate: 'spec design', mode: 'light' },
33
+ ],
34
+ },
35
+ {
36
+ name: 'Build',
37
+ steps: [
38
+ { actor: 'main', does: 'builds each task, one commit per task, within the approved paths' },
39
+ { actor: 'reviewer', does: 'reviews the build', review: 'build:' },
40
+ ],
41
+ },
42
+ {
43
+ name: 'Verify',
44
+ steps: [
45
+ { actor: 'main', does: 'runs the full checks and records the test run' },
46
+ { actor: 'qa', does: "writes and runs tests from the spec's acceptance criteria", review: 'qa', mode: 'full' },
47
+ { actor: 'reviewer', does: 'reviews the whole change', review: 'verify' },
48
+ { actor: 'human', does: 'accept the feature, then merge the pull request', gate: 'verify' },
49
+ ],
50
+ },
51
+ ],
16
52
  },
17
53
  fix: {
18
54
  kind: 'fix',
@@ -26,6 +62,23 @@ export const WORKFLOWS = {
26
62
  end: 'merge',
27
63
  writes: 'fix-rules',
28
64
  controls: ['independent-review', 'stamped-approvals', 'scope-check', 'human-decision'],
65
+ track: [
66
+ {
67
+ name: 'Fix',
68
+ steps: [
69
+ { actor: 'main', does: 'fixes the defect in existing files, within the fix limits' },
70
+ { actor: 'main', does: 'checks the fix against the limits and protected paths' },
71
+ ],
72
+ },
73
+ {
74
+ name: 'Review',
75
+ steps: [
76
+ { actor: 'reviewer', does: 'reviews the fix', review: 'fix' },
77
+ { actor: 'main', does: 'records the fix' },
78
+ { actor: 'human', does: 'review and merge the pull request' },
79
+ ],
80
+ },
81
+ ],
29
82
  },
30
83
  map: {
31
84
  kind: 'map',
@@ -39,6 +92,22 @@ export const WORKFLOWS = {
39
92
  end: 'merge',
40
93
  writes: 'project-map',
41
94
  controls: ['independent-review', 'stamped-approvals', 'scope-check', 'human-decision'],
95
+ track: [
96
+ {
97
+ name: 'Map',
98
+ steps: [
99
+ { actor: 'main', does: 'describes the application in project.md, with pointers to real files' },
100
+ { actor: 'main', does: 'records the watched files in baseline.json' },
101
+ ],
102
+ },
103
+ {
104
+ name: 'Review',
105
+ steps: [
106
+ { actor: 'reviewer', does: 'reviews the map', review: 'map' },
107
+ { actor: 'human', does: 'review and merge the pull request' },
108
+ ],
109
+ },
110
+ ],
42
111
  },
43
112
  discovery: {
44
113
  kind: 'discovery',
@@ -53,6 +122,20 @@ export const WORKFLOWS = {
53
122
  endGate: 'proposal',
54
123
  writes: 'own-folder',
55
124
  controls: ['independent-review', 'stamped-approvals', 'scope-check', 'human-decision'],
125
+ track: [
126
+ {
127
+ name: 'Proposal',
128
+ steps: [{ actor: 'main', does: 'prepares the proposal: context, options, a recommendation; changes no code' }],
129
+ },
130
+ {
131
+ name: 'Review',
132
+ steps: [{ actor: 'reviewer', does: 'reviews the proposal', review: 'proposal' }],
133
+ },
134
+ {
135
+ name: 'Approval',
136
+ steps: [{ actor: 'human', does: 'approve the proposal', gate: 'proposal' }],
137
+ },
138
+ ],
56
139
  },
57
140
  };
58
141
  export function workflowOf(kind) {
@@ -79,5 +162,16 @@ export function workflowProblems(workflow) {
79
162
  problems.push(`${workflow.kind}: ends with an acceptance but names no gate of its own for it`);
80
163
  if (!workflow.stages.length)
81
164
  problems.push(`${workflow.kind}: no stages`);
165
+ const names = workflow.track.map((t) => t.name);
166
+ if (names.join() !== workflow.stages.join())
167
+ problems.push(`${workflow.kind}: the track's stages (${names.join(', ')}) are not the workflow's (${workflow.stages.join(', ')})`);
168
+ for (const step of workflow.track.flatMap((t) => t.steps)) {
169
+ if (step.review && !workflow.reviewSteps.includes(step.review))
170
+ problems.push(`${workflow.kind}: the track names an unknown review step '${step.review}'`);
171
+ if (step.gate && !workflow.gates.includes(step.gate))
172
+ problems.push(`${workflow.kind}: the track names an unknown gate '${step.gate}'`);
173
+ }
174
+ if (!workflow.track.some((t) => t.steps.some((step) => step.actor === 'human')))
175
+ problems.push(`${workflow.kind}: no step of the track is the person's`);
82
176
  return problems;
83
177
  }
package/docs/guide.md CHANGED
@@ -237,7 +237,11 @@ ask (its description is `npx agjan pr-summary`); you review and merge.
237
237
  choose an action), the agents also write Playwright tests (`test/ui/`, the script
238
238
  `test:ui`), and `npx agjan ui-test` runs them in Chromium as each test user. Where Chromium
239
239
  cannot start, it says why and skips them, and the agent tells you which ACs to try by
240
- hand. agjan never installs anything with admin rights:
240
+ hand. `npx agjan init` and `npx agjan doctor` check this for a project with a `test:ui`
241
+ script and, in your terminal, offer to fix it: the Chromium download (no admin rights) and,
242
+ on Linux, the system libraries (`sudo npx playwright install-deps chromium`, only with
243
+ passwordless sudo or as root, and only after your explicit yes; `--yes` does not cover it).
244
+ Agents and CI never install anything with admin rights:
241
245
 
242
246
  - macOS and Windows: `npx playwright install chromium` is all it needs.
243
247
  - Linux, dev containers: Chromium also needs system libraries. Whoever maintains the
@@ -404,7 +408,8 @@ and CI waits for your approval. To build the recommendation, start a feature wit
404
408
  ## Teams
405
409
 
406
410
  A team decides what knowledge the agents bring to a unit of work; the workflow decides the
407
- steps, reviews and gates, and a team cannot remove any of them. Three are built in:
411
+ steps, reviews and gates, and a team cannot remove any of them. [Workflows, teams, personas and
412
+ skills](workflows-and-teams.md) defines the terms. Three teams are built in:
408
413
 
409
414
  | Team | Workflows | Implementer or analyst | Reviewer | Tester |
410
415
  |---|---|---|---|---|
@@ -438,6 +443,10 @@ starts no agent of its own: the implementer's skills reach the main agent throug
438
443
  the reviewer's and the tester's through their review and QA contexts. If the team's
439
444
  definition changes while a unit is under way, `status` and `check` say so.
440
445
  `npx agjan team list` lists the teams, `npx agjan team show <name>` their personas.
446
+ `npx agjan workflow show feature` shows the whole workflow as your project runs it: each
447
+ step, the agent that does it and the skills it works with, the review tier and rounds from
448
+ your configuration, and your gates (`--team <name>` for another team, `--light` for a light
449
+ feature).
441
450
 
442
451
  ### Importing skills and teams
443
452
 
@@ -518,6 +527,7 @@ Run `npx agjan --help` for the full list.
518
527
  | `approve proposal` | you, in a terminal | decide on a discovery's recommendation |
519
528
  | `import <git url> --commit <id> [--dry-run]` · `import list` · `import remove <name>` | you, in a terminal | skills and teams from another repository at an exact commit, shown before they are written |
520
529
  | `team list` · `team show <name>` | anyone | the teams, the default per workflow, and what a team's personas work with |
530
+ | `workflow list [--json]` · `workflow show <workflow> [--team <name>] [--light] [--json]` | anyone, tools | the workflows, and one as this project runs it: each step, the agent that does it, the skills it works with, review tiers and rounds, your gates |
521
531
  | `status --json` | tools | per unit: its workflow, stage, whose turn, what is next and the command or skill for it, and for a feature in Build whether it is verified and what blocks it |
522
532
  | `progress [--open]` | anyone | regenerate the progress pages, print the overview, open the HTML page |
523
533
  | `branch <name>` · `--list` · `--use <name>` | agent (after asking you with `git.branches: "ask"`) | create the branch of a unit, list the existing branches, or switch to one |
@@ -0,0 +1,114 @@
1
+ # Workflows, teams, personas and skills
2
+
3
+ agjan separates **how** work is done from **who** does it. A workflow fixes the steps,
4
+ reviews and approvals. A team decides what knowledge the agents bring to those steps. This
5
+ page defines the four terms and how they fit together; the [user guide](guide.md#teams)
6
+ shows how to use them.
7
+
8
+ - [The four terms](#the-four-terms)
9
+ - [How they fit together](#how-they-fit-together)
10
+ - [The workflows](#the-workflows)
11
+ - [Which roles each workflow needs](#which-roles-each-workflow-needs)
12
+ - [Example: the built-in teams](#example-the-built-in-teams)
13
+
14
+ ## The four terms
15
+
16
+ | Term | What it is | Examples | Where it is defined |
17
+ |---|---|---|---|
18
+ | **Workflow** | A kind of work and its fixed steps: stages, independent reviews, the approvals you give, and what it may change. | feature, fix, map, discovery | Built into agjan; a project cannot change it. |
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; a persona does not exist on its own. |
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
+
23
+ There are four **roles**, and a persona fills one of them:
24
+
25
+ | Role | What it does |
26
+ |---|---|
27
+ | implementer | Builds a feature or a fix (the main agent). |
28
+ | analyst | Maps an existing application or prepares a decision (the main agent). |
29
+ | reviewer | Reviews every step independently, read-only (the reviewer agents). |
30
+ | tester | Tests the built feature against its acceptance criteria (the QA agent). |
31
+
32
+ A **unit** is one piece of work that runs a workflow: one feature, one fix, one map run or
33
+ one discovery.
34
+
35
+ ## How they fit together
36
+
37
+ ```text
38
+ WORKFLOW feature · fix · map · discovery
39
+ │ built into agjan; the steps every team follows
40
+ │
41
+ │ many-to-many: a team serves one or more workflows, a workflow has one or more teams
42
+ │ one default team per workflow; exactly one team per unit
43
+ ▼
44
+ TEAM sap-delivery · sap-maintenance · sap-discovery · your own
45
+ │
46
+ │ one persona per role the workflow needs
47
+ ▼
48
+ PERSONA implementer · analyst · reviewer · tester
49
+ │
50
+ │ many-to-many: a persona lists its skills; a skill is reused by many personas
51
+ ▼
52
+ SKILL cap-developer · fiori-developer · btp-architect · solution-reviewer · qa-tester · ...
53
+ ```
54
+
55
+ The rules behind the arrows:
56
+
57
+ - A team lists the workflows it serves (`sap-maintenance` serves both fix and map), and
58
+ several teams may serve the same workflow.
59
+ - Each workflow has one **default** team: the one `team.<workflow>` names in
60
+ `agjan.config.json`, otherwise the first team that serves it.
61
+ - Each unit runs with **exactly one** team: the default, or the one named with `--team`
62
+ when the unit starts. The unit records the team and a hash of its definition, so a later
63
+ change to the team is reported.
64
+ - A team has one persona per role, and must fill every role its workflows need with at
65
+ least one skill.
66
+ - A persona starts no agent of its own. Its skills and instructions go to the agent that
67
+ already does that job: the main agent, the reviewer or the QA agent.
68
+ - A team cannot remove a step. Every workflow keeps an independent review, approvals
69
+ stamped by a script, scope checks, and a person who decides at the end.
70
+
71
+ ## The workflows
72
+
73
+ | Workflow | Use it for | Started with | Stages | Your decision |
74
+ |---|---|---|---|---|
75
+ | feature | New or changed behaviour, spec-driven | `/agjan-spec` | Spec, Design, Build, Verify | Approve spec and design, accept the result, merge |
76
+ | fix | A small fix within limits, existing files only | `/agjan-fix` | Fix, Review | Review and merge the pull request |
77
+ | map | Describing an existing application in `project.md` | `/agjan-map` | Map, Review | Review and merge the pull request |
78
+ | discovery | A decision before any spec: options and a recommendation, no code | `/agjan-discover` | Proposal, Review, Approval | Approve the proposal |
79
+
80
+ ## Which roles each workflow needs
81
+
82
+ | Workflow | implementer | analyst | reviewer | tester |
83
+ |---|---|---|---|---|
84
+ | feature | the main agent builds | | reviews every stage | the QA agent tests |
85
+ | fix | the main agent fixes | | reviews the fix | |
86
+ | map | | the main agent maps | reviews the map | |
87
+ | discovery | | the main agent proposes | reviews the proposal | |
88
+
89
+ ## Example: the built-in teams
90
+
91
+ agjan ships three teams for SAP CAP, Fiori and BTP projects. The same skills appear in
92
+ several personas: that is the many-to-many link between personas and skills.
93
+
94
+ ```text
95
+ feature ────► sap-delivery
96
+ implementer: cap-developer, fiori-developer, btp-architect
97
+ reviewer: solution-reviewer, cap-developer, fiori-developer, btp-architect
98
+ tester: qa-tester
99
+
100
+ fix ──┐
101
+ map ──┴─────► sap-maintenance
102
+ implementer: cap-developer, fiori-developer (fix)
103
+ analyst: cap-developer, fiori-developer, btp-architect (map)
104
+ reviewer: solution-reviewer, cap-developer, fiori-developer
105
+
106
+ discovery ──► sap-discovery
107
+ analyst: btp-architect, cap-developer, fiori-developer
108
+ reviewer: solution-reviewer, btp-architect
109
+ ```
110
+
111
+ To define your own team, import one, or make it a workflow's default, see
112
+ [Teams](guide.md#teams) in the user guide. `npx agjan team list` lists the teams of a
113
+ project, `npx agjan team show <name>` their personas, and `npx agjan workflow show <workflow>`
114
+ every step of a workflow with the agent and the skills that do it in your project.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agjan",
3
- "version": "0.0.23",
3
+ "version": "0.0.26",
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",
@@ -38,6 +38,7 @@
38
38
  "kit/",
39
39
  "schemas/",
40
40
  "docs/guide.md",
41
+ "docs/workflows-and-teams.md",
41
42
  "docs/brand/",
42
43
  "NOTICE"
43
44
  ],
@@ -0,0 +1,66 @@
1
+ {
2
+ "description": "agjan's defaults for agjan.config.json. Domains add their own on top (kit/domains/<id>/domain.json: per area implicit, tests, verify, lint; application, risk_paths and protected are appended), and the project's file overrides both. Objects merge, arrays replace. Review steps without a tier use balanced.",
3
+ "format": 1,
4
+ "defaults": {
5
+ "domains": [
6
+ "btp"
7
+ ],
8
+ "hosts": [
9
+ "claude-code"
10
+ ],
11
+ "language": "en",
12
+ "git": {
13
+ "base": null,
14
+ "branches": "new"
15
+ },
16
+ "scope": {
17
+ "implicit": {}
18
+ },
19
+ "risk_paths": [],
20
+ "application": [],
21
+ "tests": {},
22
+ "fix": {
23
+ "max_total": 80,
24
+ "max_per_file": 50,
25
+ "protected": [],
26
+ "ignored": [
27
+ "package-lock.json",
28
+ "**/package-lock.json",
29
+ "gen/**",
30
+ "dist/**"
31
+ ]
32
+ },
33
+ "verify": {},
34
+ "lint": {},
35
+ "build": {
36
+ "fix_attempts": 3
37
+ },
38
+ "review": {
39
+ "build": "area",
40
+ "rounds": 3,
41
+ "qa": "on",
42
+ "tiers": {
43
+ "spec": "balanced",
44
+ "design:light": "balanced",
45
+ "design": "deep",
46
+ "build": "balanced",
47
+ "verify": "deep",
48
+ "fix": "balanced",
49
+ "map": "balanced",
50
+ "proposal": "deep"
51
+ }
52
+ },
53
+ "test_evidence": "run",
54
+ "ci": {
55
+ "policy_changes": "warn",
56
+ "untracked_changes": "fail"
57
+ },
58
+ "limits": {
59
+ "spec_kb": 12,
60
+ "design_kb": 20
61
+ },
62
+ "agent": {
63
+ "script_edits": "deny"
64
+ }
65
+ }
66
+ }