agjan 0.0.29 → 0.0.31
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 +4 -3
- package/dist/adapters/claude-code.js +39 -1
- package/dist/adapters/copilot.js +34 -1
- package/dist/baseline.js +3 -4
- package/dist/cli.js +7 -3
- package/dist/commands/areas.js +47 -0
- package/dist/commands/lint.js +2 -2
- package/dist/commands/map.js +6 -1
- package/dist/commands/review.js +3 -3
- package/dist/commands/setup.js +19 -16
- package/dist/commands/status.js +26 -10
- package/dist/commands/team.js +16 -12
- package/dist/commands/workflow.js +10 -9
- package/dist/config.js +55 -49
- package/dist/defaults-file.js +5 -3
- package/dist/imports.js +4 -6
- package/dist/mcp-config.js +1 -1
- package/dist/mcp.js +31 -3
- package/dist/review.js +12 -7
- package/dist/schema.js +4 -0
- package/dist/teams.js +141 -37
- package/dist/terminal.js +3 -0
- package/dist/validate.js +3 -3
- package/dist/worker.js +120 -0
- package/dist/workflow-view.js +25 -15
- package/docs/guide.md +76 -30
- package/docs/workflows-and-teams.md +53 -18
- package/kit/hooks/guard.mjs +55 -2
- package/kit/presets/generic.json +26 -0
- package/kit/presets/sap-btp.json +34 -0
- package/kit/skills/agjan-build/SKILL.md +9 -3
- package/kit/skills/agjan-design/SKILL.md +14 -11
- package/kit/skills/agjan-discover/SKILL.md +6 -0
- package/kit/skills/agjan-fix/SKILL.md +6 -0
- package/kit/skills/agjan-map/SKILL.md +14 -5
- package/kit/skills/agjan-spec/SKILL.md +6 -0
- package/kit/skills/agjan-worker/SKILL.md +36 -0
- package/kit/skills/agjan-worker/references/hand-off.md +32 -0
- package/kit/skills/backend-developer/SKILL.md +50 -0
- package/kit/skills/solution-architect/SKILL.md +54 -0
- package/kit/skills/technical-architect/SKILL.md +50 -0
- package/kit/skills/ui-developer/SKILL.md +48 -0
- package/kit/templates/project.md +3 -14
- package/package.json +1 -1
- package/schemas/config.defaults.json +8 -10
- package/schemas/config.schema.json +53 -53
- package/kit/domains/btp/domain.json +0 -29
package/README.md
CHANGED
|
@@ -34,8 +34,9 @@ agjan guides an AI coding agent through **Spec, Design, Build and Verify**:
|
|
|
34
34
|
- **Cost is measurable.** `agjan report` shows time per step, waiting time at gates, and
|
|
35
35
|
the actual models and tokens from the host's own session records.
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
Each project describes its own technical areas (`agjan init --preset generic` for any
|
|
38
|
+
stack). The `sap-btp` preset and its skills cover SAP BTP development: CAP Node.js, SAP
|
|
39
|
+
Fiori elements and freestyle UI5 in TypeScript, and BTP architecture.
|
|
39
40
|
|
|
40
41
|
## Why agjan
|
|
41
42
|
|
|
@@ -88,7 +89,7 @@ Fiori or BTP, in general or about files you name: `/agjan-ask`.
|
|
|
88
89
|
|
|
89
90
|
- [User guide](docs/guide.md): setup, workflow, commands, configuration, hosts, CI,
|
|
90
91
|
troubleshooting
|
|
91
|
-
- [Workflows, teams,
|
|
92
|
+
- [Workflows, teams, roles and skills](docs/workflows-and-teams.md): the terms and how
|
|
92
93
|
they fit together
|
|
93
94
|
- [Design](docs/design.md): every decision and its reason
|
|
94
95
|
- [Host experiments](docs/host-experiments.md): what was verified on each host, and how
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { stringify as toYaml } from 'yaml';
|
|
2
2
|
import { skillBody } from '../managed.js';
|
|
3
|
-
import { agentModel } from '../config.js';
|
|
3
|
+
import { agentModel, workerModel } from '../config.js';
|
|
4
4
|
/**
|
|
5
5
|
* Claude Code adapter (design 13): the generated reviewer agents and the deny rules for
|
|
6
6
|
* the human-only commands. Results of the host experiments shape both
|
|
@@ -89,6 +89,41 @@ function qaAgent(model, skill) {
|
|
|
89
89
|
skillBody(skill),
|
|
90
90
|
].join('\n');
|
|
91
91
|
}
|
|
92
|
+
/** The worker agents (decision 100), one per tier: a role's stage, with its own context and model. */
|
|
93
|
+
export const WORKERS = [
|
|
94
|
+
{ name: 'agjan-worker', tier: 'balanced' },
|
|
95
|
+
{ name: 'agjan-worker-deep', tier: 'deep' },
|
|
96
|
+
];
|
|
97
|
+
/**
|
|
98
|
+
* A worker agent: the agjan-worker skill, the tools to read, edit and run commands, and the
|
|
99
|
+
* agjan server in the worker role (role_context), scoped to this agent.
|
|
100
|
+
*/
|
|
101
|
+
function workerAgent(name, tier, model, skill) {
|
|
102
|
+
const frontmatter = {
|
|
103
|
+
name,
|
|
104
|
+
description: `agjan's worker (${tier} tier): does one stage of a unit for a role of the team. Use only when ` +
|
|
105
|
+
'`npx agjan status` shows a hand off to this agent; name the stage, the unit and for build the task.',
|
|
106
|
+
tools: 'Read, Grep, Glob, Edit, Write, Bash, mcp__agjan__role_context',
|
|
107
|
+
...(model ? { model } : {}),
|
|
108
|
+
mcpServers: [
|
|
109
|
+
{
|
|
110
|
+
agjan: {
|
|
111
|
+
type: 'stdio',
|
|
112
|
+
command: 'npx',
|
|
113
|
+
args: ['--no-install', 'agjan', 'mcp', '--host', HOST, '--isolation', 'agent', '--role', 'worker'],
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
],
|
|
117
|
+
};
|
|
118
|
+
return [
|
|
119
|
+
'---',
|
|
120
|
+
toYaml(frontmatter, { lineWidth: 0 }).trimEnd(),
|
|
121
|
+
'---',
|
|
122
|
+
'<!-- Generated by agjan sync from the agjan-worker skill. Do not edit; run agjan sync. -->',
|
|
123
|
+
'',
|
|
124
|
+
skillBody(skill),
|
|
125
|
+
].join('\n');
|
|
126
|
+
}
|
|
92
127
|
function reviewerAgent(name, tier, model, skill) {
|
|
93
128
|
const frontmatter = {
|
|
94
129
|
name,
|
|
@@ -125,6 +160,9 @@ export function plan(config, skills) {
|
|
|
125
160
|
content: reviewerAgent(name, tier, agentModel(config, HOST, tier), skill),
|
|
126
161
|
}));
|
|
127
162
|
items.push({ kind: 'file', path: '.claude/agents/agjan-qa.md', content: qaAgent(agentModel(config, HOST, 'qa'), skills['qa-tester/SKILL.md']) });
|
|
163
|
+
for (const { name, tier } of WORKERS) {
|
|
164
|
+
items.push({ kind: 'file', path: `.claude/agents/${name}.md`, content: workerAgent(name, tier, workerModel(config, HOST, tier), skills['agjan-worker/SKILL.md']) });
|
|
165
|
+
}
|
|
128
166
|
items.push({
|
|
129
167
|
kind: 'json',
|
|
130
168
|
path: '.claude/settings.json',
|
package/dist/adapters/copilot.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { stringify as toYaml } from 'yaml';
|
|
2
2
|
import { skillBody } from '../managed.js';
|
|
3
|
-
import { agentModel } from '../config.js';
|
|
3
|
+
import { agentModel, workerModel } from '../config.js';
|
|
4
4
|
/**
|
|
5
5
|
* GitHub Copilot adapter (design 13), verified with the Copilot CLI
|
|
6
6
|
* (docs/host-experiments.md): reviewer agents in `.github/agents/` with the agjan MCP
|
|
@@ -20,6 +20,36 @@ const REVIEWERS = [
|
|
|
20
20
|
{ name: 'agjan-reviewer', tier: 'balanced' },
|
|
21
21
|
{ name: 'agjan-reviewer-deep', tier: 'deep' },
|
|
22
22
|
];
|
|
23
|
+
/** The worker agents (decision 100), one per tier, with the agjan server in the worker role. */
|
|
24
|
+
const WORKERS = [
|
|
25
|
+
{ name: 'agjan-worker', tier: 'balanced' },
|
|
26
|
+
{ name: 'agjan-worker-deep', tier: 'deep' },
|
|
27
|
+
];
|
|
28
|
+
function workerAgent(name, tier, model, skill) {
|
|
29
|
+
const frontmatter = {
|
|
30
|
+
name,
|
|
31
|
+
description: `agjan's worker (${tier} tier): does one stage of a unit for a role of the team. Use only when ` +
|
|
32
|
+
'`npx agjan status` shows a hand off to this agent; name the stage, the unit and for build the task.',
|
|
33
|
+
tools: ['read', 'search', 'edit', 'shell', 'agjan/role_context'],
|
|
34
|
+
...(model ? { model } : {}),
|
|
35
|
+
'mcp-servers': {
|
|
36
|
+
agjan: {
|
|
37
|
+
type: 'local',
|
|
38
|
+
command: 'npx',
|
|
39
|
+
args: ['--no-install', 'agjan', 'mcp', '--host', HOST, '--isolation', 'agent', '--role', 'worker'],
|
|
40
|
+
tools: ['*'],
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
return [
|
|
45
|
+
'---',
|
|
46
|
+
toYaml(frontmatter, { lineWidth: 0 }).trimEnd(),
|
|
47
|
+
'---',
|
|
48
|
+
'<!-- Generated by agjan sync from the agjan-worker skill. Do not edit; run agjan sync. -->',
|
|
49
|
+
'',
|
|
50
|
+
skillBody(skill),
|
|
51
|
+
].join('\n');
|
|
52
|
+
}
|
|
23
53
|
/**
|
|
24
54
|
* The QA agent (decision 81): the qa-tester skill, `edit` and `shell` for its tests
|
|
25
55
|
* (Copilot CLI 1.0.100 tested), and the agjan server in the QA role, scoped to it.
|
|
@@ -105,6 +135,9 @@ export function plan(config, skills) {
|
|
|
105
135
|
content: reviewerAgent(name, tier, agentModel(config, HOST, tier), skill),
|
|
106
136
|
}));
|
|
107
137
|
items.push({ kind: 'file', path: '.github/agents/agjan-qa.agent.md', content: qaAgent(agentModel(config, HOST, 'qa'), skills['qa-tester/SKILL.md']) });
|
|
138
|
+
for (const { name, tier } of WORKERS) {
|
|
139
|
+
items.push({ kind: 'file', path: `.github/agents/${name}.agent.md`, content: workerAgent(name, tier, workerModel(config, HOST, tier), skills['agjan-worker/SKILL.md']) });
|
|
140
|
+
}
|
|
108
141
|
items.push({ kind: 'file', path: HOOK_FILE, content: hookConfig() });
|
|
109
142
|
return items;
|
|
110
143
|
}
|
package/dist/baseline.js
CHANGED
|
@@ -10,13 +10,12 @@ import { PROJECT_MD } from './fix.js';
|
|
|
10
10
|
/**
|
|
11
11
|
* The baseline (design 8.6): agjan-docs/project.md, written by people and agents, and
|
|
12
12
|
* agjan-docs/baseline.json, written by `agjan baseline refresh`, with the hashes of the
|
|
13
|
-
*
|
|
13
|
+
* project's watched files (`watched`: models, services, app manifests, deployment descriptors).
|
|
14
14
|
*/
|
|
15
15
|
export const BASELINE_FILE = `${FEATURES_DIR}/baseline.json`;
|
|
16
|
-
/** Required `##` headings of project.md:
|
|
16
|
+
/** Required `##` headings of project.md: the overview, one per area (its title), conventions and the do-not-touch list. */
|
|
17
17
|
export function projectHeadings(config) {
|
|
18
|
-
|
|
19
|
-
return config.domains.includes('btp') ? ['Overview', 'CAP', 'Fiori', 'BTP', 'Conventions', 'Do-not-touch list'] : general;
|
|
18
|
+
return ['Overview', ...Object.values(config.areas).map((a) => a.title), 'Conventions', 'Do-not-touch list'];
|
|
20
19
|
}
|
|
21
20
|
export function projectProblems(root, config) {
|
|
22
21
|
const file = join(root, PROJECT_MD);
|
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 areasCommand from './commands/areas.js';
|
|
17
18
|
import * as workflowCommand from './commands/workflow.js';
|
|
18
19
|
import * as importCommand from './commands/import.js';
|
|
19
20
|
import * as branch from './commands/branch.js';
|
|
@@ -58,6 +59,7 @@ const COMMANDS = {
|
|
|
58
59
|
map: mapCommand.map,
|
|
59
60
|
discover: discoverCommand.discover,
|
|
60
61
|
team: teamCommand.run,
|
|
62
|
+
areas: areasCommand.run,
|
|
61
63
|
workflow: workflowCommand.run,
|
|
62
64
|
import: importCommand.run,
|
|
63
65
|
baseline: mapCommand.baseline,
|
|
@@ -72,7 +74,7 @@ Closed beta (0.x); the user guide is in this package: docs/guide.md
|
|
|
72
74
|
Usage: agjan <command> [options]
|
|
73
75
|
|
|
74
76
|
Setup (human):
|
|
75
|
-
init <folder | .> [--hosts claude-code,copilot] [--
|
|
77
|
+
init <folder | .> [--hosts claude-code,copilot] [--preset generic|sap-btp] [--base <ref>]
|
|
76
78
|
[--no-hook] [--no-ci] [--prepare] [--copilot-mcp | --no-copilot-mcp]
|
|
77
79
|
[--models balanced=<m>,deep=<m>,qa=<m>] [--commit | --no-commit] [--yes] [--no-install] [--pm npm|pnpm|yarn|bun] [--dry-run]
|
|
78
80
|
set up agjan: <folder> is created (git init, package.json,
|
|
@@ -121,11 +123,13 @@ Agent and human:
|
|
|
121
123
|
import <git url> --commit <id> [--dry-run] | import list | import remove <name>
|
|
122
124
|
(human) skills and teams from another repository, at an
|
|
123
125
|
exact commit; shown first, confirmed in a terminal
|
|
126
|
+
areas [--json] the project's areas (agjan.config.json): each one's skills,
|
|
127
|
+
tests, verify commands and linter
|
|
124
128
|
team list | team show <name> the teams a unit can start with (new, fix start, discover
|
|
125
|
-
start take --team) and
|
|
129
|
+
start take --team) and the skills of each role
|
|
126
130
|
workflow list [--json] | workflow show <workflow> [--team <name>] [--light] [--json]
|
|
127
131
|
the workflows, and one as this project runs it: each step,
|
|
128
|
-
the agent that does it, its
|
|
132
|
+
the agent that does it, its role's skills, the review
|
|
129
133
|
tiers and rounds, your gates
|
|
130
134
|
baseline refresh record the watched files in baseline.json
|
|
131
135
|
skill <spec|design|build|verify>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { parseArgs } from 'node:util';
|
|
4
|
+
import { UsageError } from '../errors.js';
|
|
5
|
+
/** What is wrong with the project's areas: skills that are not installed (`check` reports it). */
|
|
6
|
+
export function areaProblems(root, config) {
|
|
7
|
+
return Object.values(config.areas).flatMap((a) => a.skills.filter((s) => !existsSync(join(root, '.claude', 'skills', s, 'SKILL.md'))).map((s) => `areas.${a.name}: no skill '${s}' in .claude/skills/`));
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* agjan areas [--json] (decision 98): the project's areas as agjan.config.json defines them,
|
|
11
|
+
* with each one's skills, tests, verify commands and linter. The workflow skills read it to
|
|
12
|
+
* choose a design's areas and the skills of each.
|
|
13
|
+
*/
|
|
14
|
+
export function run(ctx, argv) {
|
|
15
|
+
const { values, positionals } = parseArgs({ args: argv, allowPositionals: true, options: { json: { type: 'boolean' } } });
|
|
16
|
+
if (positionals.length)
|
|
17
|
+
throw new UsageError('usage: agjan areas [--json]');
|
|
18
|
+
const c = ctx.config;
|
|
19
|
+
const rows = Object.values(c.areas).map((a) => ({
|
|
20
|
+
name: a.name,
|
|
21
|
+
title: a.title,
|
|
22
|
+
description: a.description,
|
|
23
|
+
skills: a.skills,
|
|
24
|
+
tests: c.tests[a.name] ?? [],
|
|
25
|
+
implicit: c.scope.implicit[a.name] ?? [],
|
|
26
|
+
verify: c.verify[a.name] ?? {},
|
|
27
|
+
lint: c.lint[a.name] ?? null,
|
|
28
|
+
}));
|
|
29
|
+
if (values.json) {
|
|
30
|
+
ctx.out(JSON.stringify({ schema: 1, areas: rows }, null, 2));
|
|
31
|
+
return 0;
|
|
32
|
+
}
|
|
33
|
+
const s = ctx.style;
|
|
34
|
+
for (const r of rows) {
|
|
35
|
+
ctx.out(`${s.bold(r.name)}${r.title !== r.name ? ` (${r.title})` : ''}${r.description ? s.gray(` ${r.description}`) : ''}`);
|
|
36
|
+
ctx.out(` skills ${r.skills.length ? r.skills.map((n) => `.claude/skills/${n}/SKILL.md`).join(', ') : s.gray('none')}`);
|
|
37
|
+
ctx.out(` tests ${r.tests.join(', ') || s.gray('none')}`);
|
|
38
|
+
const commands = Object.entries(r.verify).filter(([k]) => k !== 'results').map(([k, v]) => `${k}: ${v}`);
|
|
39
|
+
ctx.out(` verify ${commands.join('; ') || s.gray('npm test')}`);
|
|
40
|
+
if (r.lint)
|
|
41
|
+
ctx.out(` lint ${r.lint.command} in ${r.lint.in}`);
|
|
42
|
+
}
|
|
43
|
+
const problems = areaProblems(ctx.root, c);
|
|
44
|
+
for (const p of problems)
|
|
45
|
+
ctx.out(`${s.red('problem')} ${p}`);
|
|
46
|
+
return problems.length ? 1 : 0;
|
|
47
|
+
}
|
package/dist/commands/lint.js
CHANGED
|
@@ -39,8 +39,8 @@ export function lintTargets(files, lint) {
|
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
41
41
|
* agjan lint [--all] [--base <ref>]: runs each area's linter from the command line
|
|
42
|
-
* (`lint` in
|
|
43
|
-
* also checks manifest.json), in every folder with changed files and on those files.
|
|
42
|
+
* (`areas.<area>.lint` in agjan.config.json; the sap-btp preset runs the UI5 linter for
|
|
43
|
+
* fiori, which also checks manifest.json), in every folder with changed files and on those files.
|
|
44
44
|
* --all lints the whole folders. It needs no MCP server, so it runs on every host.
|
|
45
45
|
* Exit code 1 when a linter reports problems or cannot run.
|
|
46
46
|
*/
|
package/dist/commands/map.js
CHANGED
|
@@ -12,6 +12,11 @@ import { AgjanError, UsageError } from '../errors.js';
|
|
|
12
12
|
const TEMPLATE = new URL('../../kit/templates/project.md', import.meta.url);
|
|
13
13
|
/** Map runs need finding ids but no unique key: their findings stay in their own folder. */
|
|
14
14
|
const MAP_KEY = 'MAP';
|
|
15
|
+
/** project.md from the template: a heading per area of the project, with what it describes (decision 98). */
|
|
16
|
+
export function projectTemplate(config) {
|
|
17
|
+
const areas = Object.values(config.areas).map((a) => `## ${a.title}\n\n${a.description ? `${a.description}\n\n` : ''}`).join('');
|
|
18
|
+
return readFileSync(TEMPLATE, 'utf8').replace('{{areas}}\n', areas);
|
|
19
|
+
}
|
|
15
20
|
/** agjan map start: a record folder for this map run, and project.md from the template if absent. */
|
|
16
21
|
function start(ctx, requested) {
|
|
17
22
|
const root = ctx.root;
|
|
@@ -35,7 +40,7 @@ function start(ctx, requested) {
|
|
|
35
40
|
appendLog(dir, ctx.now(), 'step', { stage: 'map', skill: 'agjan-map' });
|
|
36
41
|
ctx.out(`created ${FEATURES_DIR}/maps/${id}/`);
|
|
37
42
|
if (!existsSync(join(root, PROJECT_MD))) {
|
|
38
|
-
writeFileSync(join(root, PROJECT_MD),
|
|
43
|
+
writeFileSync(join(root, PROJECT_MD), projectTemplate(ctx.config));
|
|
39
44
|
ctx.out(`created ${PROJECT_MD} from the template`);
|
|
40
45
|
}
|
|
41
46
|
return 0;
|
package/dist/commands/review.js
CHANGED
|
@@ -8,12 +8,12 @@ import { reviewerFor, roundState } from '../review-policy.js';
|
|
|
8
8
|
import { unitWorkflow } from '../customization.js';
|
|
9
9
|
import { highlightMarkdown, tone } from '../ui.js';
|
|
10
10
|
import { AgjanError, UsageError } from '../errors.js';
|
|
11
|
-
/** agjan mcp [--host <name>] [--isolation agent|fork|none] [--role review|qa]: the agjan MCP server on stdio. */
|
|
11
|
+
/** agjan mcp [--host <name>] [--isolation agent|fork|none] [--role review|qa|worker]: the agjan MCP server on stdio. */
|
|
12
12
|
export function mcp(ctx, argv) {
|
|
13
13
|
const { values } = parseArgs({ args: argv, options: { host: { type: 'string' }, isolation: { type: 'string' }, role: { type: 'string' } } });
|
|
14
14
|
const role = values.role ?? 'review';
|
|
15
|
-
if (role !== 'review' && role !== 'qa')
|
|
16
|
-
throw new UsageError('--role must be review or
|
|
15
|
+
if (role !== 'review' && role !== 'qa' && role !== 'worker')
|
|
16
|
+
throw new UsageError('--role must be review, qa or worker');
|
|
17
17
|
const isolation = values.isolation ?? 'unknown';
|
|
18
18
|
if (!['agent', 'shared', 'fork', 'none', 'unknown'].includes(isolation)) {
|
|
19
19
|
throw new UsageError('--isolation must be agent, shared, fork or none');
|
package/dist/commands/setup.js
CHANGED
|
@@ -4,7 +4,8 @@ import { homedir } from 'node:os';
|
|
|
4
4
|
import { basename, dirname, join, relative, resolve } from 'node:path';
|
|
5
5
|
import { fileURLToPath } from 'node:url';
|
|
6
6
|
import { parseArgs } from 'node:util';
|
|
7
|
-
import {
|
|
7
|
+
import { areaProblems } from './areas.js';
|
|
8
|
+
import { AGENT_TIERS, CONFIG_FILE, MODEL_TIERS, SESSION_MODEL, agentModel, loadConfig, loadPreset, presetIds, resolveAreas } from '../config.js';
|
|
8
9
|
import { LEGACY_MODELS as CLAUDE_LEGACY } from '../adapters/claude-code.js';
|
|
9
10
|
import { LEGACY_MODELS as COPILOT_LEGACY } from '../adapters/copilot.js';
|
|
10
11
|
import { readJson, writeJson } from '../json-file.js';
|
|
@@ -227,7 +228,8 @@ const INIT_USAGE = [
|
|
|
227
228
|
' . set up the current folder, keeping what is in it',
|
|
228
229
|
'',
|
|
229
230
|
' --hosts <host,...> claude-code, copilot (asked for on a terminal when left out)',
|
|
230
|
-
' --
|
|
231
|
+
' --preset <id> what agjan.config.json starts with: generic (any stack) or sap-btp (asked for on a terminal; default generic)',
|
|
232
|
+
' --language en --base <ref> --no-hook --no-ci --prepare',
|
|
231
233
|
' --copilot-mcp | --no-copilot-mcp',
|
|
232
234
|
' --models balanced=<m>,deep=<m>,qa=<m> set the reviewer models without asking (default: asked about on a terminal)',
|
|
233
235
|
' --commit | --no-commit commit the setup (a new repository: on main; else on chore/set-up-agjan) or leave it to you',
|
|
@@ -300,7 +302,7 @@ function scaffold(ctx, target, found, { install, manager }) {
|
|
|
300
302
|
}
|
|
301
303
|
}
|
|
302
304
|
/**
|
|
303
|
-
* agjan init <folder | .> --hosts claude-code,copilot [--
|
|
305
|
+
* agjan init <folder | .> --hosts claude-code,copilot [--preset generic|sap-btp] [--language en] [--base <ref>]
|
|
304
306
|
* [--no-hook] [--no-ci] [--prepare] [--copilot-mcp | --no-copilot-mcp]
|
|
305
307
|
* [--models balanced=<m>,deep=<m>,qa=<m>] [--commit | --no-commit] [--yes] [--no-install] [--pm npm|pnpm|yarn|bun] [--dry-run]
|
|
306
308
|
*/
|
|
@@ -309,7 +311,7 @@ export async function init(ctx, argv) {
|
|
|
309
311
|
args: argv,
|
|
310
312
|
allowPositionals: true,
|
|
311
313
|
options: {
|
|
312
|
-
|
|
314
|
+
preset: { type: 'string' },
|
|
313
315
|
hosts: { type: 'string' },
|
|
314
316
|
language: { type: 'string' },
|
|
315
317
|
base: { type: 'string' },
|
|
@@ -339,9 +341,8 @@ export async function init(ctx, argv) {
|
|
|
339
341
|
if (values.pm && !PACKAGE_MANAGERS.includes(values.pm))
|
|
340
342
|
throw new UsageError(`--pm must be one of ${PACKAGE_MANAGERS.join(', ')}`);
|
|
341
343
|
const found = planScaffold(ctx, target);
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
loadDomain(d);
|
|
344
|
+
if (values.preset)
|
|
345
|
+
loadPreset(values.preset);
|
|
345
346
|
const supported = Object.keys(ADAPTERS);
|
|
346
347
|
const chosen = list(values.hosts);
|
|
347
348
|
for (const h of chosen ?? [])
|
|
@@ -361,15 +362,14 @@ export async function init(ctx, argv) {
|
|
|
361
362
|
const hosts = chosen ?? await ctx.select('Which hosts should agjan set up?', supported.map((id) => ({ id, label: id })));
|
|
362
363
|
if (!hosts)
|
|
363
364
|
throw new UsageError(`no host chosen and no terminal to ask on; pass --hosts <host,...> (supported: ${supported.join(', ')})`);
|
|
365
|
+
// The preset: what agjan.config.json starts with (decision 98); without a terminal, generic.
|
|
366
|
+
const preset = loadPreset(values.preset ?? await ctx.choose('Which preset should agjan.config.json start with?', presetIds().map((id) => ({ id, label: `${id}: ${loadPreset(id).title}` }))) ?? 'generic');
|
|
364
367
|
const flagged = parseModels(values.models, hosts);
|
|
365
368
|
// Enter takes the recommended answer (yes); without a terminal the default (no) applies.
|
|
366
369
|
const flag = (yes, no) => (values[yes] ? true : values[no] ? false : null);
|
|
367
370
|
// Copilot loads the project's .mcp.json only in folders it remembers as trusted; its
|
|
368
371
|
// user configuration loads everywhere (decision 72).
|
|
369
|
-
const areas =
|
|
370
|
-
const resolved = { id: `${d}:${a}`, domain: d, name: a, role: area.role };
|
|
371
|
-
return [[a, resolved], [`${d}:${a}`, resolved]];
|
|
372
|
-
})));
|
|
372
|
+
const areas = resolveAreas(preset.config.areas);
|
|
373
373
|
const offered = mcpServers({ areas }).servers;
|
|
374
374
|
const copilotMcp = hosts.includes('copilot') && Object.keys(offered).length > 0 && (flag('copilot-mcp', 'no-copilot-mcp') ??
|
|
375
375
|
(ctx.out(...copilotMcpOffer(ctx, offered)), ask(ctx, 'Add them to your Copilot configuration?', { defaultYes: true })) ?? false);
|
|
@@ -388,6 +388,7 @@ export async function init(ctx, argv) {
|
|
|
388
388
|
['Project', [`${s.bold(positionals[0])} ${s.gray(found.exists ? '(existing folder)' : `(new folder${found.repo ? '' : ', git repository'}, package.json)`)}`]],
|
|
389
389
|
['agjan', [`${ctx.kit} pinned in devDependencies, ${values['no-install'] ? s.yellow(`not installed (${manager} install later)`) : `installed with ${manager}`}`]],
|
|
390
390
|
['Hosts', [hosts.join(', ')]],
|
|
391
|
+
['Preset', [`${preset.id} ${s.gray(`(areas ${Object.keys(areas).join(', ')})`)}`]],
|
|
391
392
|
...(hosts.includes('copilot') && Object.keys(offered).length ? [['Copilot servers', [copilotMcp ? `add ${Object.keys(offered).join(', ')} to your Copilot configuration` : s.gray('not added')]]] : []),
|
|
392
393
|
['Reviewer models', modelParts(ctx, { hosts, models })],
|
|
393
394
|
['Commit', [wantCommit ? `"${SETUP_COMMIT}" ${firstCommit ? 'on main' : `on a new branch, ${SETUP_BRANCH}`}` : s.yellow(`not now${values['no-commit'] ? '' : blocker ? `: ${blocker}` : ''}`)]],
|
|
@@ -401,14 +402,14 @@ export async function init(ctx, argv) {
|
|
|
401
402
|
const config = {
|
|
402
403
|
$schema: './node_modules/agjan/schemas/config.schema.json',
|
|
403
404
|
kit: ctx.kit,
|
|
404
|
-
domains,
|
|
405
405
|
hosts,
|
|
406
406
|
language: values.language ?? 'en',
|
|
407
407
|
models,
|
|
408
408
|
git: { ...(values.base ? { base: values.base } : {}) },
|
|
409
|
+
...preset.config,
|
|
409
410
|
};
|
|
410
411
|
writeJson(join(root, CONFIG_FILE), config);
|
|
411
|
-
ctx.out('', `${s.bold('agjan init')}: ${CONFIG_FILE} (
|
|
412
|
+
ctx.out('', `${s.bold('agjan init')}: ${CONFIG_FILE} (preset ${preset.id}; hosts ${hosts.join(', ')})`);
|
|
412
413
|
printResults(ctx, doSync(ctx, { force: false }));
|
|
413
414
|
if (copilotMcp)
|
|
414
415
|
addToCopilot(ctx, loadConfig(root));
|
|
@@ -620,7 +621,7 @@ export async function doctor(ctx) {
|
|
|
620
621
|
fail('configuration', error.message.replace(/\n\s*/g, ' '));
|
|
621
622
|
}
|
|
622
623
|
if (config) {
|
|
623
|
-
ok('configuration', `
|
|
624
|
+
ok('configuration', `areas ${Object.keys(config.areas).join(', ')}; hosts ${config.hosts.join(', ')}`);
|
|
624
625
|
if (raw.kit !== ctx.kit)
|
|
625
626
|
warn('kit version', `project records ${raw.kit}, installed ${ctx.kit}; run: npx agjan sync`);
|
|
626
627
|
const local = readJson(join(root, 'node_modules', 'agjan', 'package.json'));
|
|
@@ -691,9 +692,11 @@ export async function doctor(ctx) {
|
|
|
691
692
|
else
|
|
692
693
|
warn('ui tests', `skipped (optional): ${browser.reason}; enable: ${browser.enable}`);
|
|
693
694
|
}
|
|
694
|
-
else
|
|
695
|
-
ok('ui tests', `none (optional: Playwright, a ${UI_SCRIPT} script
|
|
695
|
+
else {
|
|
696
|
+
ok('ui tests', `none (optional: Playwright, a ${UI_SCRIPT} script)`);
|
|
696
697
|
}
|
|
698
|
+
for (const p of areaProblems(root, config))
|
|
699
|
+
warn('areas', `${p}; add the skill or run: npx agjan sync`);
|
|
697
700
|
ok('reviewer models', `${config.hosts.map((h) => `${h}: ${AGENT_TIERS.map((t) => `${t} ${agentModel(config, h, t) ?? 'session model'}`).join(', ')}`).join('; ')}${config.hosts.every((h) => !agentModel(config, h, 'deep')) ? ' (a deep reviewer on another model family than the main agent catches other things: npx agjan models set deep <model>)' : ''}`);
|
|
698
701
|
ok('branches', 'agents ask you, then run npx agjan branch');
|
|
699
702
|
const autoDefault = readAutoDefault(root);
|
package/dist/commands/status.js
CHANGED
|
@@ -13,7 +13,7 @@ import { acResults, loadResults } from '../test-results.js';
|
|
|
13
13
|
import { testRunState } from '../test-run.js';
|
|
14
14
|
import { workflowOf } from '../workflow.js';
|
|
15
15
|
import { proposalProblems, proposalReview } from '../discovery.js';
|
|
16
|
-
import { mainRole,
|
|
16
|
+
import { mainRole, rolesFor, stageOwner, unitTeam } from '../teams.js';
|
|
17
17
|
import { finalSteps, unitModel } from '../progress-view.js';
|
|
18
18
|
import { splitNow } from '../story.js';
|
|
19
19
|
import { verification } from '../readiness.js';
|
|
@@ -23,7 +23,7 @@ import { QA_STEP, qaState, qaTestFiles } from '../qa.js';
|
|
|
23
23
|
import { extraGateState, extraReviewState, extrasOf, pendingExtras, unitWorkflow } from '../customization.js';
|
|
24
24
|
/**
|
|
25
25
|
* The unit's team and what the main agent works with in it (decision 92): the skills of its
|
|
26
|
-
* role and the team's own roles for it, then each
|
|
26
|
+
* role and the team's own roles for it, then each role's instructions, which the workflow
|
|
27
27
|
* skills tell the main agent to follow (the reviewer and QA agent get theirs in their contexts).
|
|
28
28
|
*/
|
|
29
29
|
function teamRow(ctx, unit) {
|
|
@@ -34,24 +34,39 @@ function teamRow(ctx, unit) {
|
|
|
34
34
|
const skills = mainSkills(ctx, team.team, unit.kind);
|
|
35
35
|
const changed = team.changed ? ctx.style.yellow(' (its definition changed since this unit started)') : '';
|
|
36
36
|
row(ctx, 'team', `${team.name}${skills.length ? ctx.style.gray(` · ${role}: ${skills.join(', ')}`) : ''}${changed}`);
|
|
37
|
-
for (const p of
|
|
37
|
+
for (const p of mainRoles(ctx, team.team, unit.kind)) {
|
|
38
38
|
if (p.instructions)
|
|
39
39
|
row(ctx, 'follow', `${p.role}: ${p.instructions}`);
|
|
40
40
|
}
|
|
41
|
+
// The role the team gives the current stage (decision 100): a worker's, or the main agent's own.
|
|
42
|
+
const owner = currentOwner(ctx, unit, team.team);
|
|
43
|
+
if (owner?.agent === 'worker') {
|
|
44
|
+
const each = owner.stage === 'build' ? ': one request per task (.claude/skills/agjan-worker/references/hand-off.md)' : ' (.claude/skills/agjan-worker/references/hand-off.md)';
|
|
45
|
+
row(ctx, 'hand off', `${owner.stage} → ${owner.role} (agent ${owner.worker})${ctx.style.gray(each)}`);
|
|
46
|
+
}
|
|
47
|
+
else if (owner) {
|
|
48
|
+
row(ctx, 'role', `${owner.stage}: you work as ${owner.role}${owner.skills.length ? ctx.style.gray(` · ${owner.skills.join(', ')}`) : ''}${owner.instructions ? `; ${owner.instructions.replace(/\s+/g, ' ')}` : ''}`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/** The stage a unit is at, as a team gives it to a role: a feature's spec, design or build; a fix, map or proposal. */
|
|
52
|
+
function currentOwner(ctx, unit, team) {
|
|
53
|
+
// A feature in Verify (or done) is the main agent's again: its build stage is over.
|
|
54
|
+
const stage = unit.kind === 'feature' ? shownStage(ctx, unit) : unit.kind === 'discovery' ? 'proposal' : unit.kind;
|
|
55
|
+
return stageOwner(ctx.config, team, stage);
|
|
41
56
|
}
|
|
42
|
-
/** The main agent
|
|
43
|
-
function
|
|
57
|
+
/** The roles the main agent works as: role, skills and instructions (one line). */
|
|
58
|
+
function mainRoles(ctx, team, kind) {
|
|
44
59
|
if (!team)
|
|
45
60
|
return [];
|
|
46
|
-
return
|
|
61
|
+
return rolesFor(ctx.config, team, kind, 'main').map(({ role, skills, instructions }) => ({
|
|
47
62
|
role,
|
|
48
|
-
skills
|
|
49
|
-
...(
|
|
63
|
+
skills,
|
|
64
|
+
...(instructions?.trim() ? { instructions: instructions.trim().replace(/\s+/g, ' ') } : {}),
|
|
50
65
|
}));
|
|
51
66
|
}
|
|
52
67
|
/** The skills the main agent works with: its role's, then those of the team's own roles for it. */
|
|
53
68
|
function mainSkills(ctx, team, kind) {
|
|
54
|
-
return team ? [...new Set(
|
|
69
|
+
return team ? [...new Set(rolesFor(ctx.config, team, kind, 'main').flatMap((p) => p.skills))] : [];
|
|
55
70
|
}
|
|
56
71
|
/** `, workflow hotfix` for a unit of a workflow of the project's own (decision 95). */
|
|
57
72
|
function workflowNote(unit) {
|
|
@@ -467,7 +482,8 @@ function json(ctx, slugs) {
|
|
|
467
482
|
...((() => {
|
|
468
483
|
const team = unitTeam(ctx.config, unit.approvals.feature.team);
|
|
469
484
|
const role = mainRole(unit.kind);
|
|
470
|
-
|
|
485
|
+
const owner = team ? currentOwner(ctx, unit, team.team) : null;
|
|
486
|
+
return team ? { team: { name: team.name, changed: team.changed, role, skills: mainSkills(ctx, team.team, unit.kind), roles: mainRoles(ctx, team.team, unit.kind), ...(owner ? { stage: owner } : {}) } } : {};
|
|
471
487
|
})()),
|
|
472
488
|
...(verified ? { verified: verified.problems.length === 0, accepted: verified.accepted, problems: verified.problems } : {}),
|
|
473
489
|
};
|
package/dist/commands/team.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { parseArgs } from 'node:util';
|
|
2
2
|
import { UsageError } from '../errors.js';
|
|
3
3
|
import { workflowNames } from '../customization.js';
|
|
4
|
-
import { BUILT_IN_TEAMS, ROLES, allTeams, defaultTeam,
|
|
4
|
+
import { BUILT_IN_TEAMS, ROLES, allTeams, defaultTeam, roleDefinition, teamProblems, workerAgentName } from '../teams.js';
|
|
5
5
|
const USAGE = 'usage: agjan team list | agjan team show <name>';
|
|
6
6
|
/**
|
|
7
7
|
* agjan team list | show <name> (decision 92): the teams a unit can start with, the default
|
|
8
|
-
* per workflow, and
|
|
8
|
+
* per workflow, and the skills each role works with in a team. A team is chosen when a unit starts
|
|
9
9
|
* (`--team` on new, fix start, discover start), else the workflow's default.
|
|
10
10
|
*/
|
|
11
11
|
export function run(ctx, argv) {
|
|
@@ -28,20 +28,24 @@ export function run(ctx, argv) {
|
|
|
28
28
|
if (!team)
|
|
29
29
|
throw new UsageError(problems[0]);
|
|
30
30
|
ctx.out(`${s.bold(name)}: ${team.description}`);
|
|
31
|
-
// The built-in roles first, then the team's own
|
|
32
|
-
const
|
|
33
|
-
const roles = [...ROLES.filter((r) => team.personas[r]), ...Object.keys(team.personas).filter((r) => !ROLES.includes(r))];
|
|
31
|
+
// The built-in roles first, then the team's own.
|
|
32
|
+
const roles = [...ROLES.filter((r) => team.roles[r]), ...Object.keys(team.roles).filter((r) => !ROLES.includes(r))];
|
|
34
33
|
const width = Math.max(12, ...roles.filter((r) => !ROLES.includes(r)).map((r) => r.length + 2));
|
|
35
34
|
ctx.out(` ${'workflows'.padEnd(width)}${team.workflows.join(', ')}`);
|
|
36
35
|
for (const role of roles) {
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
const what = team.roles[role];
|
|
37
|
+
const def = roleDefinition(ctx.config, role);
|
|
38
|
+
const stages = Object.entries(team.stages ?? {}).filter(([, r]) => r === role).map(([st]) => st);
|
|
39
|
+
const note = ROLES.includes(role) ? ''
|
|
40
|
+
: def?.agent === 'worker' ? `its own agent, ${workerAgentName(def.tier)}${stages.length ? `, does ${stages.join(', ')}` : ''}`
|
|
41
|
+
: `reaches the ${def?.agent ?? 'unknown'} agent${stages.length ? `, does ${stages.join(', ')}` : ''}`;
|
|
42
|
+
ctx.out(` ${role.padEnd(width)}${what.skills.join(', ')}${note ? s.gray(` (${note})`) : ''}`);
|
|
43
|
+
if (what.instructions?.trim())
|
|
44
|
+
ctx.out(` ${''.padEnd(width)}${s.gray(what.instructions.trim().replace(/\s+/g, ' '))}`);
|
|
43
45
|
}
|
|
44
|
-
|
|
46
|
+
if (team.stages && Object.keys(team.stages).length)
|
|
47
|
+
ctx.out(` ${'stages'.padEnd(width)}${Object.entries(team.stages).map(([st, r]) => `${st} → ${r}`).join(', ')}`);
|
|
48
|
+
ctx.out(s.gray(' The workflow decides the steps, reviews and gates; a team adds what its agents work with and who writes each stage.'));
|
|
45
49
|
for (const p of problems)
|
|
46
50
|
ctx.out(` ${s.red('problem')} ${p}`);
|
|
47
51
|
return problems.length ? 1 : 0;
|
|
@@ -30,7 +30,7 @@ const SOURCE = { 'built-in': 'built in', imported: 'imported', project: 'agjan.c
|
|
|
30
30
|
/**
|
|
31
31
|
* agjan workflow list | show <kind> (decision 90): the workflows with their default teams, and
|
|
32
32
|
* one of them as this project runs it: each stage's steps, the agent that does each, the
|
|
33
|
-
*
|
|
33
|
+
* skills its roles work with, the review tiers and rounds, and the person's gates. `--json` is for
|
|
34
34
|
* tools; the list then also gives the teams, for choosing one.
|
|
35
35
|
*/
|
|
36
36
|
export function run(ctx, argv) {
|
|
@@ -38,7 +38,7 @@ export function run(ctx, argv) {
|
|
|
38
38
|
const s = ctx.style;
|
|
39
39
|
if (positionals[0] === 'list' && positionals.length === 1 && values.json) {
|
|
40
40
|
const workflows = workflowNames(ctx.config).map((name) => listed(ctx, name));
|
|
41
|
-
const teams = Object.entries(allTeams(ctx.config)).map(([name, t]) => ({ name, description: t.description, workflows: t.workflows, source: teamSource(ctx.config, name),
|
|
41
|
+
const teams = Object.entries(allTeams(ctx.config)).map(([name, t]) => ({ name, description: t.description, workflows: t.workflows, source: teamSource(ctx.config, name), roles: t.roles }));
|
|
42
42
|
ctx.out(JSON.stringify({ schema: 1, workflows, teams }, null, 2));
|
|
43
43
|
return 0;
|
|
44
44
|
}
|
|
@@ -74,6 +74,7 @@ export function run(ctx, argv) {
|
|
|
74
74
|
ctx.out('', s.bold(stage.name));
|
|
75
75
|
for (const step of stage.steps) {
|
|
76
76
|
const details = [
|
|
77
|
+
step.handoff ? `the main agent hands it to ${step.role}` : '',
|
|
77
78
|
step.extra ? `extra ${step.review ? 'review' : 'gate'} ${step.review?.step ?? step.gate?.name}` : '',
|
|
78
79
|
step.review ? `${step.review.tier}${step.review.per ? `, per ${step.review.per}` : ''}, up to ${step.review.rounds} rounds` : '',
|
|
79
80
|
step.gate ? step.gate.command : '',
|
|
@@ -86,15 +87,15 @@ export function run(ctx, argv) {
|
|
|
86
87
|
// Each role once, with the agent it reaches: the built-in roles first, then the team's own.
|
|
87
88
|
const seen = new Map();
|
|
88
89
|
for (const step of view.stages.flatMap((st) => st.steps))
|
|
89
|
-
for (const
|
|
90
|
-
if (!seen.has(
|
|
91
|
-
seen.set(
|
|
90
|
+
for (const r of step.roles)
|
|
91
|
+
if (!seen.has(r.role))
|
|
92
|
+
seen.set(r.role, { agent: step.handoff ? step.agent : step.actor === 'main' ? 'main agent' : step.actor === 'qa' ? 'QA agent' : 'reviewer', what: r });
|
|
92
93
|
if (view.team && seen.size) {
|
|
93
94
|
ctx.out('', s.bold(`What the agents work with (team ${view.team.name})`));
|
|
94
|
-
for (const [role, { agent,
|
|
95
|
-
ctx.out(` ${role.padEnd(21)} ${
|
|
96
|
-
if (
|
|
97
|
-
ctx.out(` ${''.padEnd(21)} ${s.gray(
|
|
95
|
+
for (const [role, { agent, what }] of seen) {
|
|
96
|
+
ctx.out(` ${role.padEnd(21)} ${what.skills.length ? what.skills.join(', ') : s.gray('no skills')}${s.gray(` (${agent}${what.description ? `: ${what.description}` : ''})`)}`);
|
|
97
|
+
if (what.instructions?.trim())
|
|
98
|
+
ctx.out(` ${''.padEnd(21)} ${s.gray(what.instructions.trim().replace(/\s+/g, ' '))}`);
|
|
98
99
|
}
|
|
99
100
|
}
|
|
100
101
|
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}`));
|