ai-engineering-loop 1.14.0 → 1.16.0
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/.agents/{workflows/ai-engineering-loop.md → skills/ai-engineering-loop/SKILL.md} +9 -7
- package/{.gemini → .agents}/skills/ai-engineering-loop/references/loop-deliver.md +1 -0
- package/.agents/skills/ai-engineering-loop/references/loop-hosts.md +48 -0
- package/.agents/skills/ai-engineering-loop/references/loop-maker.md +13 -0
- package/{.gemini → .agents}/skills/ai-engineering-loop/references/loop-review.md +2 -0
- package/.claude/skills/ai-engineering-loop/SKILL.md +10 -11
- package/.claude/skills/ai-engineering-loop/references/loop-deliver.md +1 -0
- package/.claude/skills/ai-engineering-loop/references/loop-hosts.md +48 -0
- package/.claude/skills/ai-engineering-loop/references/loop-maker.md +6 -1
- package/.claude/skills/ai-engineering-loop/references/loop-review.md +2 -0
- package/CHANGELOG.md +83 -0
- package/README.md +54 -6
- package/adapters/README.md +22 -0
- package/adapters/dot/README.md +19 -9
- package/adapters/dot/gitlab.md +49 -0
- package/adapters/dot/mattermost.md +10 -0
- package/adapters/dot/skills/dot-dev-workflow/SKILL.md +27 -5
- package/adapters/dot/sonar.md +90 -0
- package/adapters/generate-adapter/SKILL.md +6 -5
- package/adapters/{dot → quality}/skills/task-impact-inquiry/SKILL.md +10 -7
- package/agents/instruction-only/AGENTS.md +24 -0
- package/bin/ai-engineering-loop.js +320 -34
- package/core/grill-policy.md +1 -1
- package/core/orchestration-model.md +11 -0
- package/core/runtime-safety.md +2 -1
- package/lib/adapter-check.js +102 -0
- package/lib/adapter-detect.js +125 -0
- package/lib/auto-update.js +3 -1
- package/lib/cli-args.js +11 -0
- package/lib/doctor.js +13 -17
- package/lib/gates.js +28 -1
- package/lib/generate-adapter.js +6 -30
- package/lib/host-skill-build.js +25 -15
- package/lib/hosts/agent-formats.js +135 -0
- package/lib/hosts/commands.js +126 -0
- package/lib/hosts/detect.js +56 -0
- package/lib/hosts/doctor.js +77 -0
- package/lib/hosts/redetect.js +60 -0
- package/lib/hosts/registry.js +298 -0
- package/lib/hosts/table.js +43 -0
- package/lib/orchestration.js +39 -6
- package/lib/run-abandon.js +116 -0
- package/lib/studio-server.js +1 -0
- package/lib/sync-hosts.js +156 -112
- package/package.json +2 -3
- package/schemas/report.schema.json +52 -5
- package/.agents/devil-advocate.md +0 -79
- package/.agents/judge.md +0 -58
- package/.claude/commands/ai-engineering-loop.md +0 -11
- package/.gemini/skills/ai-engineering-loop/SKILL.md +0 -61
- package/.gemini/skills/ai-engineering-loop/references/loop-maker.md +0 -8
- package/.gemini/skills/animate/RECIPES.md +0 -324
- package/.gemini/skills/animate/SKILL.md +0 -207
- package/.gemini/skills/animate-expo/RECIPES.md +0 -385
- package/.gemini/skills/animate-expo/SKILL.md +0 -263
- package/.gemini/skills/animation-vocabulary/SKILL.md +0 -181
- package/.gemini/skills/apple-design/SKILL.md +0 -290
- package/.gemini/skills/ask-sonner/API.md +0 -64
- package/.gemini/skills/ask-sonner/SKILL.md +0 -88
- package/.gemini/skills/backend-development/SKILL.md +0 -272
- package/.gemini/skills/backend-development/references/api-design-guidelines.md +0 -95
- package/.gemini/skills/backend-development/references/query-and-database-best-practices.md +0 -53
- package/.gemini/skills/backend-development/references/security-checklist.md +0 -60
- package/.gemini/skills/emil-design-eng/SKILL.md +0 -674
- package/.gemini/skills/find-animation-opportunities/SKILL.md +0 -140
- package/.gemini/skills/improve-animations/AUDIT.md +0 -115
- package/.gemini/skills/improve-animations/PLAN-TEMPLATE.md +0 -73
- package/.gemini/skills/improve-animations/SKILL.md +0 -109
- package/.gemini/skills/mobile-native/SKILL.md +0 -311
- package/.gemini/skills/pick-ui-library/SKILL.md +0 -85
- package/.gemini/skills/prototype/PICKER.md +0 -197
- package/.gemini/skills/prototype/SKILL.md +0 -98
- package/.gemini/skills/review-animations/SKILL.md +0 -120
- package/.gemini/skills/review-animations/STANDARDS.md +0 -187
- package/.gemini/skills/write-swift/SKILL.md +0 -396
- package/.grok/commands/ai-engineering-loop.md +0 -11
- package/.grok/skills/ai-engineering-loop/SKILL.md +0 -62
- package/.grok/skills/ai-engineering-loop/references/loop-commands.md +0 -20
- package/.grok/skills/ai-engineering-loop/references/loop-deliver.md +0 -8
- package/.grok/skills/ai-engineering-loop/references/loop-goal.md +0 -10
- package/.grok/skills/ai-engineering-loop/references/loop-maker.md +0 -8
- package/.grok/skills/ai-engineering-loop/references/loop-review.md +0 -18
- package/.grok/skills/ai-engineering-loop/references/loop-risky.md +0 -9
- package/.grok/skills/ai-engineering-loop/references/loop-verify.md +0 -20
- package/.grok/skills/animate/RECIPES.md +0 -324
- package/.grok/skills/animate/SKILL.md +0 -207
- package/.grok/skills/animate-expo/RECIPES.md +0 -385
- package/.grok/skills/animate-expo/SKILL.md +0 -263
- package/.grok/skills/animation-vocabulary/SKILL.md +0 -181
- package/.grok/skills/apple-design/SKILL.md +0 -290
- package/.grok/skills/ask-sonner/API.md +0 -64
- package/.grok/skills/ask-sonner/SKILL.md +0 -88
- package/.grok/skills/backend-development/SKILL.md +0 -272
- package/.grok/skills/backend-development/references/api-design-guidelines.md +0 -95
- package/.grok/skills/backend-development/references/query-and-database-best-practices.md +0 -53
- package/.grok/skills/backend-development/references/security-checklist.md +0 -60
- package/.grok/skills/emil-design-eng/SKILL.md +0 -674
- package/.grok/skills/find-animation-opportunities/SKILL.md +0 -140
- package/.grok/skills/improve-animations/AUDIT.md +0 -115
- package/.grok/skills/improve-animations/PLAN-TEMPLATE.md +0 -73
- package/.grok/skills/improve-animations/SKILL.md +0 -109
- package/.grok/skills/mobile-native/SKILL.md +0 -311
- package/.grok/skills/pick-ui-library/SKILL.md +0 -85
- package/.grok/skills/prototype/PICKER.md +0 -197
- package/.grok/skills/prototype/SKILL.md +0 -98
- package/.grok/skills/review-animations/SKILL.md +0 -120
- package/.grok/skills/review-animations/STANDARDS.md +0 -187
- package/.grok/skills/write-swift/SKILL.md +0 -396
- /package/{.gemini → .agents}/skills/ai-engineering-loop/references/loop-commands.md +0 -0
- /package/{.gemini → .agents}/skills/ai-engineering-loop/references/loop-goal.md +0 -0
- /package/{.gemini → .agents}/skills/ai-engineering-loop/references/loop-risky.md +0 -0
- /package/{.gemini → .agents}/skills/ai-engineering-loop/references/loop-verify.md +0 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// Adapter checks shared by `doctor` and the `deliver` preflight (#63).
|
|
4
|
+
// Each check: { id, passed, detail, level: 'error' | 'warn' }.
|
|
5
|
+
// `error` = Stage 8 cannot follow this adapter; `warn` = it may fail late.
|
|
6
|
+
|
|
7
|
+
const fs = require('fs');
|
|
8
|
+
const path = require('path');
|
|
9
|
+
const { spawnSync } = require('child_process');
|
|
10
|
+
const { SHIPPED_TYPES, detectAdapterHints } = require('./generate-adapter.js');
|
|
11
|
+
const { DOT_GITLAB_HOST } = require('./adapter-detect.js');
|
|
12
|
+
|
|
13
|
+
const KNOWN_TYPES = [...SHIPPED_TYPES, 'custom'];
|
|
14
|
+
const CUSTOM_SPEC = '.ai-engineering-loop/adapter/delivery.md';
|
|
15
|
+
|
|
16
|
+
function editDistance(a, b) {
|
|
17
|
+
const row = Array.from({ length: b.length + 1 }, (_, i) => i);
|
|
18
|
+
for (let i = 1; i <= a.length; i += 1) {
|
|
19
|
+
let prev = row[0];
|
|
20
|
+
row[0] = i;
|
|
21
|
+
for (let j = 1; j <= b.length; j += 1) {
|
|
22
|
+
const next = row[j];
|
|
23
|
+
row[j] = Math.min(row[j] + 1, row[j - 1] + 1, prev + (a[i - 1] === b[j - 1] ? 0 : 1));
|
|
24
|
+
prev = next;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return row[b.length];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function nearestType(value) {
|
|
31
|
+
const ranked = KNOWN_TYPES
|
|
32
|
+
.map((type) => ({ type, distance: editDistance(String(value || '').toLowerCase(), type) }))
|
|
33
|
+
.sort((a, b) => a.distance - b.distance);
|
|
34
|
+
return ranked[0].distance <= 2 ? ranked[0].type : null;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Which CLI must be logged in for a type, or null.
|
|
38
|
+
function toolFor(type) {
|
|
39
|
+
if (type === 'github') return { bin: 'gh', args: ['auth', 'status'], label: 'gh auth status' };
|
|
40
|
+
if (type === 'gitlab') return { bin: 'glab', args: ['auth', 'status'], label: 'glab auth status' };
|
|
41
|
+
if (type === 'dot') {
|
|
42
|
+
return { bin: 'glab', args: ['auth', 'status', '--hostname', DOT_GITLAB_HOST], label: `glab auth status --hostname ${DOT_GITLAB_HOST}` };
|
|
43
|
+
}
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function defaultRun(bin, args) {
|
|
48
|
+
return spawnSync(bin, args, { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'], timeout: 15000 });
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function check(id, passed, detail, level = 'error') {
|
|
52
|
+
return { id, passed: Boolean(passed), detail, level };
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// projectDir: the repo being delivered. packageRoot: where adapters/ ships.
|
|
56
|
+
function checkAdapter(projectDir, { packageRoot = path.join(__dirname, '..'), run = defaultRun } = {}) {
|
|
57
|
+
const checks = [];
|
|
58
|
+
const adapterFile = path.join(projectDir, '.ai-engineering-loop', 'adapter.md');
|
|
59
|
+
if (!fs.existsSync(adapterFile)) {
|
|
60
|
+
checks.push(check('adapter-config', false, 'no .ai-engineering-loop/adapter.md; run init or generate-adapter', 'warn'));
|
|
61
|
+
return checks;
|
|
62
|
+
}
|
|
63
|
+
const hints = detectAdapterHints(projectDir);
|
|
64
|
+
const type = hints.existingType;
|
|
65
|
+
if (!KNOWN_TYPES.includes(type)) {
|
|
66
|
+
const near = nearestType(type);
|
|
67
|
+
checks.push(check(
|
|
68
|
+
'adapter-type',
|
|
69
|
+
false,
|
|
70
|
+
`unknown adapter_type "${type || '(empty)'}"; known: ${KNOWN_TYPES.join(' | ')}${near ? `; did you mean "${near}"?` : ''}`
|
|
71
|
+
));
|
|
72
|
+
return checks;
|
|
73
|
+
}
|
|
74
|
+
checks.push(check('adapter-type', true, `adapter_type "${type}"`));
|
|
75
|
+
|
|
76
|
+
const spec = type === 'custom' ? path.join(projectDir, CUSTOM_SPEC) : path.join(packageRoot, 'adapters', type, 'README.md');
|
|
77
|
+
const specLabel = type === 'custom' ? CUSTOM_SPEC : `adapters/${type}/README.md`;
|
|
78
|
+
checks.push(check('adapter-spec', fs.existsSync(spec), fs.existsSync(spec) ? `${specLabel} present` : `missing ${specLabel}`));
|
|
79
|
+
|
|
80
|
+
const tool = toolFor(type);
|
|
81
|
+
if (tool) {
|
|
82
|
+
const result = run(tool.bin, tool.args);
|
|
83
|
+
let detail;
|
|
84
|
+
if (result.error && result.error.code === 'ENOENT') detail = `${tool.bin} not installed (needed by adapter "${type}")`;
|
|
85
|
+
else if (result.error) detail = `${tool.label} failed: ${result.error.message}`;
|
|
86
|
+
else if (result.status !== 0) detail = `${tool.bin} not logged in: \`${tool.label}\` exited ${result.status}`;
|
|
87
|
+
else detail = `${tool.label} ok`;
|
|
88
|
+
checks.push(check('adapter-auth', !result.error && result.status === 0, detail, 'warn'));
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (hints.recommended !== type && type !== 'custom') {
|
|
92
|
+
checks.push(check(
|
|
93
|
+
'adapter-detected',
|
|
94
|
+
false,
|
|
95
|
+
`configured "${type}" but the repo looks like "${hints.recommended}" (${hints.reason}); rerun generate-adapter if that is wrong`,
|
|
96
|
+
'warn'
|
|
97
|
+
));
|
|
98
|
+
}
|
|
99
|
+
return checks;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
module.exports = { KNOWN_TYPES, CUSTOM_SPEC, checkAdapter, nearestType, toolFor };
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// One adapter detector for `init`, `generate-adapter` and Studio (#62).
|
|
4
|
+
// Priority: origin remote host -> CI files -> standard.
|
|
5
|
+
|
|
6
|
+
const fs = require('fs');
|
|
7
|
+
const path = require('path');
|
|
8
|
+
|
|
9
|
+
const DOT_GITLAB_HOST = 'gitlab.dot.co.id';
|
|
10
|
+
|
|
11
|
+
function readFileSafe(file) {
|
|
12
|
+
try {
|
|
13
|
+
return fs.readFileSync(file, 'utf8');
|
|
14
|
+
} catch {
|
|
15
|
+
return '';
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Returns the git config text for rootDir. Follows a `.git` file
|
|
20
|
+
// (`gitdir: ...`) and its `commondir`, so linked worktrees work.
|
|
21
|
+
function readGitConfig(rootDir) {
|
|
22
|
+
const dotGit = path.join(rootDir, '.git');
|
|
23
|
+
let stat;
|
|
24
|
+
try {
|
|
25
|
+
stat = fs.statSync(dotGit);
|
|
26
|
+
} catch {
|
|
27
|
+
return '';
|
|
28
|
+
}
|
|
29
|
+
if (stat.isDirectory()) return readFileSafe(path.join(dotGit, 'config'));
|
|
30
|
+
const match = readFileSafe(dotGit).match(/^gitdir:\s*(.+)$/m);
|
|
31
|
+
if (!match) return '';
|
|
32
|
+
const gitDir = path.resolve(rootDir, match[1].trim());
|
|
33
|
+
const common = readFileSafe(path.join(gitDir, 'commondir')).trim();
|
|
34
|
+
const configDir = common ? path.resolve(gitDir, common) : gitDir;
|
|
35
|
+
return readFileSafe(path.join(configDir, 'config'));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Remote URLs in config order: [{ name, url }].
|
|
39
|
+
function parseRemotes(configText) {
|
|
40
|
+
const remotes = [];
|
|
41
|
+
let current = null;
|
|
42
|
+
for (const raw of String(configText || '').split(/\r?\n/)) {
|
|
43
|
+
const line = raw.trim();
|
|
44
|
+
const section = line.match(/^\[\s*([^\s\]"]+)(?:\s+"([^"]*)")?\s*\]$/);
|
|
45
|
+
if (section) {
|
|
46
|
+
current = section[1].toLowerCase() === 'remote' ? section[2] : null;
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
if (current === null || current === undefined) continue;
|
|
50
|
+
const kv = line.match(/^url\s*=\s*(.+)$/i);
|
|
51
|
+
if (kv && !remotes.some((remote) => remote.name === current)) {
|
|
52
|
+
remotes.push({ name: current, url: kv[1].trim() });
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return remotes;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// `origin` first, otherwise the first remote.
|
|
59
|
+
function readGitRemote(rootDir) {
|
|
60
|
+
const remotes = parseRemotes(readGitConfig(rootDir));
|
|
61
|
+
const origin = remotes.find((remote) => remote.name === 'origin');
|
|
62
|
+
const chosen = origin || remotes[0];
|
|
63
|
+
return chosen ? { name: chosen.name, url: chosen.url } : { name: '', url: '' };
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function remoteHost(url) {
|
|
67
|
+
const value = String(url || '').trim();
|
|
68
|
+
if (!value) return '';
|
|
69
|
+
const withScheme = value.match(/^[a-z][a-z0-9+.-]*:\/\/(?:[^@/]*@)?([^/:]+)/i);
|
|
70
|
+
if (withScheme) return withScheme[1].toLowerCase();
|
|
71
|
+
const scp = value.match(/^(?:[^@/]+@)?([^/:]+):/);
|
|
72
|
+
return scp ? scp[1].toLowerCase() : '';
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Adapter type for a remote URL, or null when the host says nothing.
|
|
76
|
+
function typeFromRemote(url) {
|
|
77
|
+
const host = remoteHost(url);
|
|
78
|
+
if (!host) return null;
|
|
79
|
+
if (host === DOT_GITLAB_HOST) return 'dot';
|
|
80
|
+
if (host === 'github.com') return 'github';
|
|
81
|
+
if (host.includes('gitlab')) return 'gitlab';
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function detectCi(rootDir) {
|
|
86
|
+
if (fs.existsSync(path.join(rootDir, '.github', 'workflows'))) return 'GitHub Actions';
|
|
87
|
+
if (fs.existsSync(path.join(rootDir, '.gitlab-ci.yml'))) return 'GitLab CI';
|
|
88
|
+
return 'none';
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const CI_TYPES = { 'GitHub Actions': 'github', 'GitLab CI': 'gitlab' };
|
|
92
|
+
|
|
93
|
+
function detectAdapter(rootDir) {
|
|
94
|
+
const remote = readGitRemote(rootDir);
|
|
95
|
+
const ciProvider = detectCi(rootDir);
|
|
96
|
+
const fromRemote = typeFromRemote(remote.url);
|
|
97
|
+
if (fromRemote) {
|
|
98
|
+
return {
|
|
99
|
+
type: fromRemote,
|
|
100
|
+
reason: `remote ${remote.name} host ${remoteHost(remote.url)}`,
|
|
101
|
+
remote: remote.url,
|
|
102
|
+
ciProvider
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
if (CI_TYPES[ciProvider]) {
|
|
106
|
+
return { type: CI_TYPES[ciProvider], reason: `CI: ${ciProvider}`, remote: remote.url, ciProvider };
|
|
107
|
+
}
|
|
108
|
+
return {
|
|
109
|
+
type: 'standard',
|
|
110
|
+
reason: remote.url ? `remote host ${remoteHost(remote.url) || '(unknown)'} not recognized; no CI files` : 'no remote; no CI files',
|
|
111
|
+
remote: remote.url,
|
|
112
|
+
ciProvider
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
module.exports = {
|
|
117
|
+
DOT_GITLAB_HOST,
|
|
118
|
+
detectAdapter,
|
|
119
|
+
detectCi,
|
|
120
|
+
parseRemotes,
|
|
121
|
+
readGitConfig,
|
|
122
|
+
readGitRemote,
|
|
123
|
+
remoteHost,
|
|
124
|
+
typeFromRemote
|
|
125
|
+
};
|
package/lib/auto-update.js
CHANGED
|
@@ -435,7 +435,9 @@ function consumeSummary(home = homeDir()) {
|
|
|
435
435
|
const last = state.lastApplied;
|
|
436
436
|
if (!last || last.shown) return null;
|
|
437
437
|
writeState({ ...state, lastApplied: { ...last, shown: true } }, home);
|
|
438
|
-
const pending = last.pending && last.pending.length
|
|
438
|
+
const pending = last.pending && last.pending.length
|
|
439
|
+
? `, ${last.pending.length} pending (active run; if abandoned: ai-engineering-loop run --abandon --reason "<why>" --by <name> in that project)`
|
|
440
|
+
: '';
|
|
439
441
|
const failed = last.failed && last.failed.length ? `, ${last.failed.length} failed` : '';
|
|
440
442
|
return `ai-engineering-loop updated ${last.from} -> ${last.to}; hosts ${last.hosts}; ${last.refreshed}/${last.total} projects refreshed${pending}${failed}.`;
|
|
441
443
|
}
|
package/lib/cli-args.js
CHANGED
|
@@ -13,8 +13,12 @@ const WRITER_COMMANDS = Object.freeze({
|
|
|
13
13
|
init: { flags: [], valued: [], positionals: [] },
|
|
14
14
|
refresh: { flags: ['--non-destructive', '--json'], valued: [], positionals: [] },
|
|
15
15
|
'sync-hosts': { flags: ['--dry-run', '--prune', '--json'], valued: ['--pack'], positionals: [] },
|
|
16
|
+
setup: { flags: ['--yes', '--json'], valued: ['--hosts', '--mode'], positionals: [] },
|
|
17
|
+
hosts: { flags: ['--json'], valued: [], positionals: null },
|
|
16
18
|
update: { flags: ['--json', '--yes', '--background', '--force', '--no-pin'], valued: ['--channel', '--pin'], positionals: ['check', 'plan', 'apply', 'auto', 'policy', 'rollback', ...['off', 'notify', 'patch', 'minor', 'all']] },
|
|
17
19
|
projects: { flags: ['--json'], valued: ['--root', '--depth'], positionals: null },
|
|
20
|
+
// `run --abandon` (issue #46) is a writer; plain `run` takes free text.
|
|
21
|
+
'run:abandon': { flags: ['--abandon', '--yes', '--json'], valued: ['--run', '--reason', '--by'], positionals: [] },
|
|
18
22
|
migrate: { flags: ['--json', '--dry-run'], valued: ['--from'], positionals: [] },
|
|
19
23
|
verify: { flags: ['--json', '--serial', '--shell'], valued: ['--run', '--cmd', '--timeout-ms'], positionals: [] },
|
|
20
24
|
'review-pack': { flags: ['--json'], valued: ['--run', '--base', '--profile'], positionals: [] },
|
|
@@ -28,6 +32,12 @@ function beforeSeparator(args) {
|
|
|
28
32
|
return index === -1 ? args : args.slice(0, index);
|
|
29
33
|
}
|
|
30
34
|
|
|
35
|
+
// `run --abandon ...` is checked as its own writer command.
|
|
36
|
+
function effectiveCommand(command, rest) {
|
|
37
|
+
if (command === 'run' && beforeSeparator(rest).includes('--abandon')) return 'run:abandon';
|
|
38
|
+
return command;
|
|
39
|
+
}
|
|
40
|
+
|
|
31
41
|
function wantsCommandHelp(command, rest) {
|
|
32
42
|
const scoped = beforeSeparator(rest);
|
|
33
43
|
// `run` takes free-text task words; only a leading help flag counts.
|
|
@@ -78,6 +88,7 @@ module.exports = {
|
|
|
78
88
|
HELP_FLAGS,
|
|
79
89
|
WRITER_COMMANDS,
|
|
80
90
|
beforeSeparator,
|
|
91
|
+
effectiveCommand,
|
|
81
92
|
wantsCommandHelp,
|
|
82
93
|
unknownWriterArgs,
|
|
83
94
|
commandHelp
|
package/lib/doctor.js
CHANGED
|
@@ -5,6 +5,7 @@ const path = require('path');
|
|
|
5
5
|
const { loadEvaluationCases } = require('./evaluation.js');
|
|
6
6
|
const { auditPackage } = require('./package-audit.js');
|
|
7
7
|
const { listRecipes, loadRecipe, validateRecipe } = require('./recipe.js');
|
|
8
|
+
const { checkAdapter } = require('./adapter-check.js');
|
|
8
9
|
|
|
9
10
|
const REQUIRED_HOST_ASSETS = [
|
|
10
11
|
'.claude/skills/ai-engineering-loop/SKILL.md',
|
|
@@ -18,27 +19,17 @@ const REQUIRED_HOST_ASSETS = [
|
|
|
18
19
|
'.claude/skills/review-animations/SKILL.md',
|
|
19
20
|
'.claude/agents/devil-advocate.md',
|
|
20
21
|
'.claude/agents/judge.md',
|
|
21
|
-
'.grok/skills/ai-engineering-loop/SKILL.md',
|
|
22
|
-
'.grok/skills/ai-engineering-loop/references/loop-review.md',
|
|
23
|
-
'.grok/skills/backend-development/SKILL.md',
|
|
24
|
-
'.grok/skills/emil-design-eng/SKILL.md',
|
|
25
|
-
'.grok/skills/animate/SKILL.md',
|
|
26
|
-
'.grok/skills/review-animations/SKILL.md',
|
|
27
22
|
'.grok/agents/devil-advocate.md',
|
|
28
23
|
'.grok/agents/judge.md',
|
|
29
|
-
'.
|
|
30
|
-
'.
|
|
31
|
-
'.gemini/skills/backend-development/SKILL.md',
|
|
32
|
-
'.gemini/skills/emil-design-eng/SKILL.md',
|
|
33
|
-
'.gemini/skills/animate/SKILL.md',
|
|
34
|
-
'.gemini/skills/review-animations/SKILL.md',
|
|
35
|
-
'.agents/workflows/ai-engineering-loop.md',
|
|
24
|
+
'.agents/skills/ai-engineering-loop/SKILL.md',
|
|
25
|
+
'.agents/skills/ai-engineering-loop/references/loop-hosts.md',
|
|
36
26
|
'.agents/skills/backend-development/SKILL.md',
|
|
37
27
|
'.agents/skills/emil-design-eng/SKILL.md',
|
|
38
28
|
'.agents/skills/animate/SKILL.md',
|
|
39
29
|
'.agents/skills/review-animations/SKILL.md',
|
|
40
|
-
'
|
|
41
|
-
'
|
|
30
|
+
'agents/shared/devil-advocate.body.md',
|
|
31
|
+
'agents/shared/judge.body.md',
|
|
32
|
+
'agents/instruction-only/AGENTS.md'
|
|
42
33
|
];
|
|
43
34
|
|
|
44
35
|
const REQUIRED_SCHEMAS = [
|
|
@@ -60,7 +51,7 @@ function check(id, passed, detail) {
|
|
|
60
51
|
return { id, passed: Boolean(passed), detail };
|
|
61
52
|
}
|
|
62
53
|
|
|
63
|
-
function runDoctor(rootDir = path.join(__dirname, '..')) {
|
|
54
|
+
function runDoctor(rootDir = path.join(__dirname, '..'), { projectDir = null, run } = {}) {
|
|
64
55
|
const checks = [];
|
|
65
56
|
const nodeMajor = Number(process.versions.node.split('.')[0]);
|
|
66
57
|
checks.push(check('node-version', nodeMajor >= 18, `Node ${process.versions.node}; required >=18`));
|
|
@@ -144,8 +135,13 @@ function runDoctor(rootDir = path.join(__dirname, '..')) {
|
|
|
144
135
|
(process.platform === 'win32' || (fs.statSync(binPath).mode & 0o111) !== 0);
|
|
145
136
|
checks.push(check('cli-executable', executable, executable ? 'CLI is executable' : 'CLI executable bit is missing'));
|
|
146
137
|
|
|
138
|
+
// Project adapter (#63): only where a project has been initialized.
|
|
139
|
+
if (projectDir && fs.existsSync(path.join(projectDir, '.ai-engineering-loop'))) {
|
|
140
|
+
checks.push(...checkAdapter(projectDir, { packageRoot: rootDir, ...(run ? { run } : {}) }));
|
|
141
|
+
}
|
|
142
|
+
|
|
147
143
|
return {
|
|
148
|
-
ok: checks.every((item) => item.passed),
|
|
144
|
+
ok: checks.every((item) => item.passed || item.level === 'warn'),
|
|
149
145
|
checks
|
|
150
146
|
};
|
|
151
147
|
}
|
package/lib/gates.js
CHANGED
|
@@ -6,8 +6,33 @@ const path = require('path');
|
|
|
6
6
|
const {
|
|
7
7
|
validateVerificationEvidence,
|
|
8
8
|
validateFindingLedger,
|
|
9
|
-
computeJudgeVerdict
|
|
9
|
+
computeJudgeVerdict,
|
|
10
|
+
EXECUTION_MODES,
|
|
11
|
+
resolveExecutionModeId
|
|
10
12
|
} = require('./orchestration.js');
|
|
13
|
+
|
|
14
|
+
// Optional `review` block in REPORT_ONLY report.json (#57). Absent = legacy
|
|
15
|
+
// report, accepted. Present = must be truthful and non-contradictory.
|
|
16
|
+
function validateReportReview(review) {
|
|
17
|
+
const errors = [];
|
|
18
|
+
if (review === undefined) return errors;
|
|
19
|
+
if (!review || typeof review !== 'object' || Array.isArray(review)) return ['review must be an object'];
|
|
20
|
+
const modeId = resolveExecutionModeId(review.executionMode);
|
|
21
|
+
const mode = EXECUTION_MODES[modeId];
|
|
22
|
+
if (!review.executionMode || !mode) {
|
|
23
|
+
errors.push(`review.executionMode must be one of ${Object.keys(EXECUTION_MODES).join(', ')}`);
|
|
24
|
+
return errors;
|
|
25
|
+
}
|
|
26
|
+
const native = String(review.nativeSubagent || '').toUpperCase();
|
|
27
|
+
if (native && !['AVAILABLE', 'UNAVAILABLE'].includes(native)) errors.push('review.nativeSubagent must be AVAILABLE or UNAVAILABLE');
|
|
28
|
+
if (mode.isIndependentExecutionProven) {
|
|
29
|
+
if (review.reviewer !== 'devil-advocate') errors.push('review.reviewer must be devil-advocate for an independent report review');
|
|
30
|
+
if (!String(review.childId || '').trim()) errors.push(`review.childId (the reviewer's own subagent/result id) is required for ${modeId}`);
|
|
31
|
+
} else if (native === 'AVAILABLE' && !String(review.reason || '').trim()) {
|
|
32
|
+
errors.push(`review.reason is required: ${modeId} was used although native subagent invocation is AVAILABLE`);
|
|
33
|
+
}
|
|
34
|
+
return errors;
|
|
35
|
+
}
|
|
11
36
|
const {
|
|
12
37
|
RUN_STATES,
|
|
13
38
|
RUN_MODES,
|
|
@@ -317,6 +342,7 @@ function applyGate(rootDir, gate, { runId, transitionOptions = {} } = {}) {
|
|
|
317
342
|
else if (value.recommendations.some((item) => !String(item || '').trim())) {
|
|
318
343
|
reportErrors.push('recommendations must contain non-empty strings');
|
|
319
344
|
}
|
|
345
|
+
reportErrors.push(...validateReportReview(value.review));
|
|
320
346
|
if (reportErrors.length) throw gateError('Report gate failed', reportErrors);
|
|
321
347
|
return transitionRun(rootDir, run.runId, RUN_STATES.REPORTED, {
|
|
322
348
|
gate,
|
|
@@ -471,6 +497,7 @@ function applyGate(rootDir, gate, { runId, transitionOptions = {} } = {}) {
|
|
|
471
497
|
|
|
472
498
|
module.exports = {
|
|
473
499
|
GATE_FILES,
|
|
500
|
+
validateReportReview,
|
|
474
501
|
artifactPath,
|
|
475
502
|
hashContent,
|
|
476
503
|
hashFile,
|
package/lib/generate-adapter.js
CHANGED
|
@@ -2,41 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
const fs = require('fs');
|
|
4
4
|
const path = require('path');
|
|
5
|
+
const { detectAdapter, typeFromRemote } = require('./adapter-detect.js');
|
|
5
6
|
|
|
6
7
|
const SHIPPED_TYPES = ['standard', 'github', 'gitlab', 'dot'];
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
const gitConfig = path.join(rootDir, '.git', 'config');
|
|
10
|
-
try {
|
|
11
|
-
const text = fs.readFileSync(gitConfig, 'utf8');
|
|
12
|
-
const match = text.match(/url\s*=\s*(.*)/);
|
|
13
|
-
return match ? match[1].trim() : '';
|
|
14
|
-
} catch {
|
|
15
|
-
return '';
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function detectCi(rootDir) {
|
|
20
|
-
if (fs.existsSync(path.join(rootDir, '.github', 'workflows'))) {
|
|
21
|
-
return 'GitHub Actions';
|
|
22
|
-
}
|
|
23
|
-
if (fs.existsSync(path.join(rootDir, '.gitlab-ci.yml'))) {
|
|
24
|
-
return 'GitLab CI';
|
|
25
|
-
}
|
|
26
|
-
return 'none';
|
|
27
|
-
}
|
|
28
|
-
|
|
9
|
+
// Kept for callers that only have a URL. Same rules as the shared detector.
|
|
29
10
|
function recommendType(remote) {
|
|
30
|
-
|
|
31
|
-
if (url.includes('github.com')) return 'github';
|
|
32
|
-
if (url.includes('gitlab')) return 'gitlab';
|
|
33
|
-
return 'standard';
|
|
11
|
+
return typeFromRemote(remote) || 'standard';
|
|
34
12
|
}
|
|
35
13
|
|
|
36
14
|
function detectAdapterHints(rootDir) {
|
|
37
|
-
const remote =
|
|
38
|
-
const ciProvider = detectCi(rootDir);
|
|
39
|
-
const recommended = recommendType(remote);
|
|
15
|
+
const { type: recommended, reason, remote, ciProvider } = detectAdapter(rootDir);
|
|
40
16
|
let existingType = '';
|
|
41
17
|
const adapterPath = path.join(rootDir, '.ai-engineering-loop', 'adapter.md');
|
|
42
18
|
try {
|
|
@@ -46,7 +22,7 @@ function detectAdapterHints(rootDir) {
|
|
|
46
22
|
} catch {
|
|
47
23
|
/* missing */
|
|
48
24
|
}
|
|
49
|
-
return { remote, ciProvider, recommended, existingType };
|
|
25
|
+
return { remote, ciProvider, recommended, reason, existingType };
|
|
50
26
|
}
|
|
51
27
|
|
|
52
28
|
function adapterMarkdown({ type, remote, ciProvider, defaultBranch = 'main' }) {
|
|
@@ -91,7 +67,7 @@ function formatGenerateAdapterReport(hints, { version, wrote } = {}) {
|
|
|
91
67
|
'Detected',
|
|
92
68
|
`- remote: ${hints.remote || '(none)'}`,
|
|
93
69
|
`- ci: ${hints.ciProvider}`,
|
|
94
|
-
`- recommended: ${hints.recommended}`,
|
|
70
|
+
`- recommended: ${hints.recommended}${hints.reason ? ` (${hints.reason})` : ''}`,
|
|
95
71
|
`- existing: ${hints.existingType || '(none)'}`,
|
|
96
72
|
`Shipped: ${SHIPPED_TYPES.join(' | ')}`,
|
|
97
73
|
'Next: load skill generate-adapter. Ask Q1-Q5. Wait.',
|
package/lib/host-skill-build.js
CHANGED
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
// Host skill build (
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
3
|
+
// Host skill build (issues #35, #48). One template plus one overlay produces a
|
|
4
|
+
// single host-neutral ai-engineering-loop skill and its references/. The same
|
|
5
|
+
// bytes are written to every output directory, so a host that reads several
|
|
6
|
+
// skill folders (Grok, Cursor, OpenCode, Amp, Augment) only ever sees identical
|
|
7
|
+
// copies. Host-specific spawn rules live in references/loop-hosts.md. The
|
|
8
|
+
// generated files are committed (they ship in the npm package); a drift test
|
|
9
|
+
// fails when a generated file is edited by hand instead of skill-src/.
|
|
7
10
|
|
|
8
11
|
const fs = require('fs');
|
|
9
12
|
const path = require('path');
|
|
10
13
|
|
|
11
14
|
const SOURCE_DIR = 'skill-src/ai-engineering-loop';
|
|
12
|
-
const HOSTS = Object.freeze(['claude', 'grok', 'gemini', 'antigravity']);
|
|
13
15
|
const SKILL_CHAR_LIMIT = 4000;
|
|
16
|
+
// Compact digest for instruction-only hosts (#60), served by `docs AGENTS`.
|
|
17
|
+
const DIGEST_SOURCE = 'digest.md';
|
|
18
|
+
const DIGEST_PATH = 'agents/instruction-only/AGENTS.md';
|
|
19
|
+
const DIGEST_BYTE_LIMIT = 2048;
|
|
14
20
|
const GENERATED_NOTE = '<!-- Generated from skill-src/ by npm run build:skills; do not edit. -->';
|
|
15
21
|
|
|
16
22
|
function readText(file) {
|
|
@@ -61,18 +67,21 @@ function buildHostSkills(root = path.join(__dirname, '..')) {
|
|
|
61
67
|
const refDir = path.join(src, 'references');
|
|
62
68
|
const references = fs.readdirSync(refDir).filter((f) => f.endsWith('.md')).sort()
|
|
63
69
|
.map((name) => ({ name, content: readText(path.join(refDir, name)) }));
|
|
70
|
+
const overlay = parseOverlay(readText(path.join(src, 'overlay.md')));
|
|
71
|
+
const dirs = String(overlay.outputs || '').split(',').map((d) => d.trim()).filter(Boolean);
|
|
72
|
+
if (!dirs.length) throw new Error('overlay needs "@@ outputs: <dir>[, <dir>]"');
|
|
73
|
+
const body = insertNote(render(template, overlay, 'overlay').replace(/\n{3,}/g, '\n\n').replace(/\s*$/, '\n'));
|
|
64
74
|
const outputs = [];
|
|
65
|
-
for (const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
outputs.push({ host, path: overlay.output, content: insertNote(body), kind: 'skill' });
|
|
70
|
-
if (overlay.references) {
|
|
71
|
-
for (const ref of references) {
|
|
72
|
-
outputs.push({ host, path: path.posix.join(overlay.references, ref.name), content: ref.content, kind: 'reference' });
|
|
73
|
-
}
|
|
75
|
+
for (const dir of dirs) {
|
|
76
|
+
outputs.push({ path: path.posix.join(dir, 'SKILL.md'), content: body, kind: 'skill' });
|
|
77
|
+
for (const ref of references) {
|
|
78
|
+
outputs.push({ path: path.posix.join(dir, 'references', ref.name), content: ref.content, kind: 'reference' });
|
|
74
79
|
}
|
|
75
80
|
}
|
|
81
|
+
const digest = `${GENERATED_NOTE}\n${readText(path.join(src, DIGEST_SOURCE)).replace(/\s*$/, '\n')}`;
|
|
82
|
+
const bytes = Buffer.byteLength(digest, 'utf8');
|
|
83
|
+
if (bytes > DIGEST_BYTE_LIMIT) throw new Error(`${DIGEST_PATH}: ${bytes} bytes > ${DIGEST_BYTE_LIMIT}`);
|
|
84
|
+
outputs.push({ path: DIGEST_PATH, content: digest, kind: 'digest' });
|
|
76
85
|
return outputs;
|
|
77
86
|
}
|
|
78
87
|
|
|
@@ -111,8 +120,9 @@ function writeHostSkills(root = path.join(__dirname, '..')) {
|
|
|
111
120
|
|
|
112
121
|
module.exports = {
|
|
113
122
|
SOURCE_DIR,
|
|
114
|
-
HOSTS,
|
|
115
123
|
SKILL_CHAR_LIMIT,
|
|
124
|
+
DIGEST_PATH,
|
|
125
|
+
DIGEST_BYTE_LIMIT,
|
|
116
126
|
GENERATED_NOTE,
|
|
117
127
|
parseOverlay,
|
|
118
128
|
buildHostSkills,
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// Reviewer subagents (devil-advocate, judge) rendered per host format (#48+).
|
|
4
|
+
// One body (agents/shared/<name>.body.md) and one description per agent; each
|
|
5
|
+
// formatter only adds the host's frontmatter or wrapper, so the reviewer
|
|
6
|
+
// contract stays identical everywhere.
|
|
7
|
+
|
|
8
|
+
const fs = require('fs');
|
|
9
|
+
const path = require('path');
|
|
10
|
+
|
|
11
|
+
const AGENTS = Object.freeze(['devil-advocate', 'judge']);
|
|
12
|
+
|
|
13
|
+
function readText(file) {
|
|
14
|
+
return fs.readFileSync(file, 'utf8').replace(/\r\n?/g, '\n');
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// Description comes from the canonical Claude agent file so it is written once.
|
|
18
|
+
function agentSpec(root, name) {
|
|
19
|
+
if (!AGENTS.includes(name)) throw new Error(`Unknown reviewer agent "${name}"`);
|
|
20
|
+
const body = readText(path.join(root, 'agents', 'shared', `${name}.body.md`)).replace(/\s+$/, '\n');
|
|
21
|
+
const claude = readText(path.join(root, '.claude', 'agents', `${name}.md`));
|
|
22
|
+
const line = claude.split('\n').find((l) => l.startsWith('description:'));
|
|
23
|
+
if (!line) throw new Error(`.claude/agents/${name}.md has no description`);
|
|
24
|
+
return { name, description: line.slice('description:'.length).trim(), body };
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function frontmatter(fields) {
|
|
28
|
+
const lines = Object.entries(fields).map(([key, value]) => {
|
|
29
|
+
if (Array.isArray(value)) return `${key}:\n${value.map((v) => ` - ${v}`).join('\n')}`;
|
|
30
|
+
return `${key}: ${value}`;
|
|
31
|
+
});
|
|
32
|
+
return `---\n${lines.join('\n')}\n---\n\n`;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// TOML multi-line literal string: no escapes, so the body must not contain '''.
|
|
36
|
+
function tomlLiteral(text) {
|
|
37
|
+
if (text.includes("'''")) throw new Error("agent body must not contain ''' for codex-toml");
|
|
38
|
+
return `'''\n${text}'''`;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function tomlString(text) {
|
|
42
|
+
return JSON.stringify(text);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const FORMATS = Object.freeze({
|
|
46
|
+
// Canonical files committed in the repo (their frontmatter is host-tuned).
|
|
47
|
+
// https://code.claude.com/docs/en/sub-agents
|
|
48
|
+
'claude-md': { file: (name) => `${name}.md`, src: (name) => `.claude/agents/${name}.md` },
|
|
49
|
+
// https://docs.x.ai/build/features/subagents
|
|
50
|
+
'grok-md': { file: (name) => `${name}.md`, src: (name) => `.grok/agents/${name}.md` },
|
|
51
|
+
// https://developers.openai.com/codex/subagents: name, description,
|
|
52
|
+
// developer_instructions required; reviewers run read-only.
|
|
53
|
+
'codex-toml': {
|
|
54
|
+
file: (name) => `${name}.toml`,
|
|
55
|
+
render: (spec) => [
|
|
56
|
+
`name = ${tomlString(spec.name)}`,
|
|
57
|
+
`description = ${tomlString(spec.description)}`,
|
|
58
|
+
'sandbox_mode = "read-only"',
|
|
59
|
+
`developer_instructions = ${tomlLiteral(spec.body)}`,
|
|
60
|
+
''
|
|
61
|
+
].join('\n')
|
|
62
|
+
},
|
|
63
|
+
// https://geminicli.com/docs/core/subagents/: tools omitted = inherit.
|
|
64
|
+
'gemini-md': {
|
|
65
|
+
file: (name) => `${name}.md`,
|
|
66
|
+
render: (spec) => frontmatter({ name: spec.name, description: spec.description, kind: 'local' }) + spec.body
|
|
67
|
+
},
|
|
68
|
+
// https://cursor.com/docs/subagents
|
|
69
|
+
'cursor-md': {
|
|
70
|
+
file: (name) => `${name}.md`,
|
|
71
|
+
render: (spec) => frontmatter({ name: spec.name, description: spec.description, model: 'inherit', readonly: true }) + spec.body
|
|
72
|
+
},
|
|
73
|
+
// https://opencode.ai/docs/agents/: file name is the agent name; reviewers never edit.
|
|
74
|
+
'opencode-md': {
|
|
75
|
+
file: (name) => `${name}.md`,
|
|
76
|
+
render: (spec) => `---\ndescription: ${spec.description}\nmode: subagent\npermission:\n edit: deny\n---\n\n${spec.body}`
|
|
77
|
+
},
|
|
78
|
+
// https://docs.factory.ai/harness/subagents: Task subagent_type targets.
|
|
79
|
+
'factory-md': {
|
|
80
|
+
file: (name) => `${name}.md`,
|
|
81
|
+
render: (spec) => frontmatter({ name: spec.name, description: spec.description, model: 'inherit', tools: 'read-only' }) + spec.body
|
|
82
|
+
},
|
|
83
|
+
// https://docs.augmentcode.com/cli/subagents: tools omitted = all tools.
|
|
84
|
+
'augment-md': {
|
|
85
|
+
file: (name) => `${name}.md`,
|
|
86
|
+
render: (spec) => frontmatter({ name: spec.name, description: spec.description }) + spec.body
|
|
87
|
+
},
|
|
88
|
+
// Qwen Code docs (qwenlm.github.io/qwen-code-docs, Features > Subagents): approvalMode plan = no edits.
|
|
89
|
+
'qwen-md': {
|
|
90
|
+
file: (name) => `${name}.md`,
|
|
91
|
+
render: (spec) => frontmatter({ name: spec.name, description: spec.description, model: 'inherit', approvalMode: 'plan' }) + spec.body
|
|
92
|
+
},
|
|
93
|
+
// https://kiro.dev/docs/cli/custom-agents/configuration-reference/ (Markdown agents, CLI V3 / IDE 1.0).
|
|
94
|
+
'kiro-md': {
|
|
95
|
+
file: (name) => `${name}.md`,
|
|
96
|
+
render: (spec) => frontmatter({ name: spec.name, description: spec.description, tools: ['read'] }) + spec.body
|
|
97
|
+
},
|
|
98
|
+
// https://junie.jetbrains.com/docs/junie-cli-subagents.html (tool names from the documented examples).
|
|
99
|
+
'junie-md': {
|
|
100
|
+
file: (name) => `${name}.md`,
|
|
101
|
+
render: (spec) => frontmatter({ name: spec.name, description: spec.description, tools: ['Read', 'Grep'] }) + spec.body
|
|
102
|
+
},
|
|
103
|
+
// https://docs.github.com/en/copilot/reference/custom-agents-configuration
|
|
104
|
+
'copilot-agent-md': {
|
|
105
|
+
file: (name) => `${name}.agent.md`,
|
|
106
|
+
render: (spec) => frontmatter({ name: spec.name, description: spec.description }) + spec.body
|
|
107
|
+
},
|
|
108
|
+
// https://antigravity.google/docs/subagents (tool names from the documented example only:
|
|
109
|
+
// an unknown tool name can hang the subagent).
|
|
110
|
+
'antigravity-md': {
|
|
111
|
+
file: (name) => `${name}.md`,
|
|
112
|
+
render: (spec) => frontmatter({
|
|
113
|
+
name: spec.name,
|
|
114
|
+
description: spec.description,
|
|
115
|
+
tools: ['view_file', 'grep_search', 'run_command'],
|
|
116
|
+
subagent: true,
|
|
117
|
+
mainAgent: false
|
|
118
|
+
}) + spec.body
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
function renderAgent(root, format, name) {
|
|
123
|
+
const fmt = FORMATS[format];
|
|
124
|
+
if (!fmt) throw new Error(`Unknown agent format "${format}"`);
|
|
125
|
+
if (fmt.src) return readText(path.join(root, fmt.src(name)));
|
|
126
|
+
return fmt.render(agentSpec(root, name));
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function agentFileName(format, name) {
|
|
130
|
+
const fmt = FORMATS[format];
|
|
131
|
+
if (!fmt) throw new Error(`Unknown agent format "${format}"`);
|
|
132
|
+
return fmt.file(name);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
module.exports = { AGENTS, FORMATS, agentSpec, renderAgent, agentFileName };
|