@saydone/dab 0.0.0-stage → 0.1.2
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.md +62 -0
- package/CHANGELOG.md +52 -0
- package/CHANGELOG.zh.md +52 -0
- package/LICENSE +21 -0
- package/README.i18n.yaml +55 -0
- package/README.md +157 -2
- package/README.zh.md +158 -0
- package/dist/adapter/claude-code/adapter.d.ts +10 -0
- package/dist/adapter/claude-code/adapter.js +226 -0
- package/dist/adapter/claude-code/adapter.js.map +1 -0
- package/dist/adapter/claude-code/adoption.d.ts +58 -0
- package/dist/adapter/claude-code/adoption.js +749 -0
- package/dist/adapter/claude-code/adoption.js.map +1 -0
- package/dist/adapter/claude-code/hooks.d.ts +10 -0
- package/dist/adapter/claude-code/hooks.js +58 -0
- package/dist/adapter/claude-code/hooks.js.map +1 -0
- package/dist/adapter/claude-code/instructions.d.ts +26 -0
- package/dist/adapter/claude-code/instructions.js +235 -0
- package/dist/adapter/claude-code/instructions.js.map +1 -0
- package/dist/adapter/claude-code/options.d.ts +12 -0
- package/dist/adapter/claude-code/options.js +27 -0
- package/dist/adapter/claude-code/options.js.map +1 -0
- package/dist/adapter/claude-code/policy-compile.d.ts +30 -0
- package/dist/adapter/claude-code/policy-compile.js +293 -0
- package/dist/adapter/claude-code/policy-compile.js.map +1 -0
- package/dist/adapter/claude-code/projection.d.ts +36 -0
- package/dist/adapter/claude-code/projection.js +272 -0
- package/dist/adapter/claude-code/projection.js.map +1 -0
- package/dist/adapter/claude-code/settings-plan.d.ts +12 -0
- package/dist/adapter/claude-code/settings-plan.js +64 -0
- package/dist/adapter/claude-code/settings-plan.js.map +1 -0
- package/dist/adapter/claude-code/settings.d.ts +21 -0
- package/dist/adapter/claude-code/settings.js +58 -0
- package/dist/adapter/claude-code/settings.js.map +1 -0
- package/dist/adapter/claude-code/version.d.ts +8 -0
- package/dist/adapter/claude-code/version.js +32 -0
- package/dist/adapter/claude-code/version.js.map +1 -0
- package/dist/adapter/registry.d.ts +3 -0
- package/dist/adapter/registry.js +8 -0
- package/dist/adapter/registry.js.map +1 -0
- package/dist/adapter/types.d.ts +70 -0
- package/dist/adapter/types.js +2 -0
- package/dist/adapter/types.js.map +1 -0
- package/dist/cli.d.ts +12 -0
- package/dist/cli.js +260 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/detect.d.ts +44 -0
- package/dist/commands/detect.js +543 -0
- package/dist/commands/detect.js.map +1 -0
- package/dist/commands/init.d.ts +48 -0
- package/dist/commands/init.js +727 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/normalize.d.ts +106 -0
- package/dist/commands/normalize.js +715 -0
- package/dist/commands/normalize.js.map +1 -0
- package/dist/commands/policy-explain.d.ts +47 -0
- package/dist/commands/policy-explain.js +283 -0
- package/dist/commands/policy-explain.js.map +1 -0
- package/dist/core/command.d.ts +13 -0
- package/dist/core/command.js +68 -0
- package/dist/core/command.js.map +1 -0
- package/dist/core/compare.d.ts +7 -0
- package/dist/core/compare.js +16 -0
- package/dist/core/compare.js.map +1 -0
- package/dist/core/diagnostics.d.ts +15 -0
- package/dist/core/diagnostics.js +65 -0
- package/dist/core/diagnostics.js.map +1 -0
- package/dist/core/errors.d.ts +25 -0
- package/dist/core/errors.js +45 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/exit-codes.d.ts +8 -0
- package/dist/core/exit-codes.js +8 -0
- package/dist/core/exit-codes.js.map +1 -0
- package/dist/core/fs-atomic.d.ts +13 -0
- package/dist/core/fs-atomic.js +113 -0
- package/dist/core/fs-atomic.js.map +1 -0
- package/dist/core/gitignore.d.ts +6 -0
- package/dist/core/gitignore.js +54 -0
- package/dist/core/gitignore.js.map +1 -0
- package/dist/core/hash.d.ts +1 -0
- package/dist/core/hash.js +5 -0
- package/dist/core/hash.js.map +1 -0
- package/dist/core/json.d.ts +3 -0
- package/dist/core/json.js +21 -0
- package/dist/core/json.js.map +1 -0
- package/dist/core/markdown-links.d.ts +5 -0
- package/dist/core/markdown-links.js +37 -0
- package/dist/core/markdown-links.js.map +1 -0
- package/dist/core/paths.d.ts +12 -0
- package/dist/core/paths.js +152 -0
- package/dist/core/paths.js.map +1 -0
- package/dist/core/platform.d.ts +1 -0
- package/dist/core/platform.js +7 -0
- package/dist/core/platform.js.map +1 -0
- package/dist/core/practice-paths.d.ts +73 -0
- package/dist/core/practice-paths.js +310 -0
- package/dist/core/practice-paths.js.map +1 -0
- package/dist/core/security.d.ts +2 -0
- package/dist/core/security.js +101 -0
- package/dist/core/security.js.map +1 -0
- package/dist/core/semver.d.ts +9 -0
- package/dist/core/semver.js +32 -0
- package/dist/core/semver.js.map +1 -0
- package/dist/core/skill-marker.d.ts +28 -0
- package/dist/core/skill-marker.js +57 -0
- package/dist/core/skill-marker.js.map +1 -0
- package/dist/core/version-check.d.ts +10 -0
- package/dist/core/version-check.js +28 -0
- package/dist/core/version-check.js.map +1 -0
- package/dist/core/version-compare.d.ts +8 -0
- package/dist/core/version-compare.js +23 -0
- package/dist/core/version-compare.js.map +1 -0
- package/dist/core/version.d.ts +2 -0
- package/dist/core/version.js +13 -0
- package/dist/core/version.js.map +1 -0
- package/dist/core/yaml.d.ts +4 -0
- package/dist/core/yaml.js +24 -0
- package/dist/core/yaml.js.map +1 -0
- package/dist/detect/ancestor-claude-md.d.ts +1 -0
- package/dist/detect/ancestor-claude-md.js +33 -0
- package/dist/detect/ancestor-claude-md.js.map +1 -0
- package/dist/detect/checklist.d.ts +42 -0
- package/dist/detect/checklist.js +137 -0
- package/dist/detect/checklist.js.map +1 -0
- package/dist/detect/checks.d.ts +13 -0
- package/dist/detect/checks.js +537 -0
- package/dist/detect/checks.js.map +1 -0
- package/dist/detect/practice.d.ts +43 -0
- package/dist/detect/practice.js +782 -0
- package/dist/detect/practice.js.map +1 -0
- package/dist/detect/preflight.d.ts +21 -0
- package/dist/detect/preflight.js +408 -0
- package/dist/detect/preflight.js.map +1 -0
- package/dist/docs/budgets.d.ts +2 -0
- package/dist/docs/budgets.js +57 -0
- package/dist/docs/budgets.js.map +1 -0
- package/dist/docs/cli.d.ts +7 -0
- package/dist/docs/cli.js +102 -0
- package/dist/docs/cli.js.map +1 -0
- package/dist/docs/config.d.ts +8 -0
- package/dist/docs/config.js +82 -0
- package/dist/docs/config.js.map +1 -0
- package/dist/docs/doc-sync.d.ts +10 -0
- package/dist/docs/doc-sync.js +33 -0
- package/dist/docs/doc-sync.js.map +1 -0
- package/dist/docs/files.d.ts +1 -0
- package/dist/docs/files.js +42 -0
- package/dist/docs/files.js.map +1 -0
- package/dist/docs/links.d.ts +3 -0
- package/dist/docs/links.js +90 -0
- package/dist/docs/links.js.map +1 -0
- package/dist/docs/markdown.d.ts +55 -0
- package/dist/docs/markdown.js +227 -0
- package/dist/docs/markdown.js.map +1 -0
- package/dist/docs/notes.d.ts +2 -0
- package/dist/docs/notes.js +175 -0
- package/dist/docs/notes.js.map +1 -0
- package/dist/docs/pairing.d.ts +45 -0
- package/dist/docs/pairing.js +472 -0
- package/dist/docs/pairing.js.map +1 -0
- package/dist/docs/wrap.d.ts +2 -0
- package/dist/docs/wrap.js +98 -0
- package/dist/docs/wrap.js.map +1 -0
- package/dist/init/adoption.d.ts +138 -0
- package/dist/init/adoption.js +747 -0
- package/dist/init/adoption.js.map +1 -0
- package/dist/init/ai-proposal.d.ts +15 -0
- package/dist/init/ai-proposal.js +164 -0
- package/dist/init/ai-proposal.js.map +1 -0
- package/dist/init/docs-language.d.ts +12 -0
- package/dist/init/docs-language.js +110 -0
- package/dist/init/docs-language.js.map +1 -0
- package/dist/init/managed-skills.d.ts +81 -0
- package/dist/init/managed-skills.js +407 -0
- package/dist/init/managed-skills.js.map +1 -0
- package/dist/init/minimal-source.d.ts +14 -0
- package/dist/init/minimal-source.js +42 -0
- package/dist/init/minimal-source.js.map +1 -0
- package/dist/init/practice-authoring.d.ts +5 -0
- package/dist/init/practice-authoring.js +36 -0
- package/dist/init/practice-authoring.js.map +1 -0
- package/dist/init/practice-docs.d.ts +13 -0
- package/dist/init/practice-docs.js +278 -0
- package/dist/init/practice-docs.js.map +1 -0
- package/dist/init/practice.d.ts +78 -0
- package/dist/init/practice.js +528 -0
- package/dist/init/practice.js.map +1 -0
- package/dist/init/scanner.d.ts +22 -0
- package/dist/init/scanner.js +190 -0
- package/dist/init/scanner.js.map +1 -0
- package/dist/init/skill-templates.d.ts +7 -0
- package/dist/init/skill-templates.js +25 -0
- package/dist/init/skill-templates.js.map +1 -0
- package/dist/init/templates.d.ts +53 -0
- package/dist/init/templates.js +254 -0
- package/dist/init/templates.js.map +1 -0
- package/dist/model/agents-md.d.ts +6 -0
- package/dist/model/agents-md.js +41 -0
- package/dist/model/agents-md.js.map +1 -0
- package/dist/model/agents.d.ts +12 -0
- package/dist/model/agents.js +346 -0
- package/dist/model/agents.js.map +1 -0
- package/dist/model/diagnostics-codes.d.ts +34 -0
- package/dist/model/diagnostics-codes.js +35 -0
- package/dist/model/diagnostics-codes.js.map +1 -0
- package/dist/model/facts.d.ts +10 -0
- package/dist/model/facts.js +36 -0
- package/dist/model/facts.js.map +1 -0
- package/dist/model/frontmatter.d.ts +17 -0
- package/dist/model/frontmatter.js +97 -0
- package/dist/model/frontmatter.js.map +1 -0
- package/dist/model/hooks.d.ts +2 -0
- package/dist/model/hooks.js +175 -0
- package/dist/model/hooks.js.map +1 -0
- package/dist/model/memory.d.ts +3 -0
- package/dist/model/memory.js +165 -0
- package/dist/model/memory.js.map +1 -0
- package/dist/model/policy.d.ts +8 -0
- package/dist/model/policy.js +46 -0
- package/dist/model/policy.js.map +1 -0
- package/dist/model/project-manifest.d.ts +26 -0
- package/dist/model/project-manifest.js +210 -0
- package/dist/model/project-manifest.js.map +1 -0
- package/dist/model/rules.d.ts +2 -0
- package/dist/model/rules.js +98 -0
- package/dist/model/rules.js.map +1 -0
- package/dist/model/schemas.d.ts +379 -0
- package/dist/model/schemas.js +310 -0
- package/dist/model/schemas.js.map +1 -0
- package/dist/model/scope.d.ts +29 -0
- package/dist/model/scope.js +204 -0
- package/dist/model/scope.js.map +1 -0
- package/dist/model/skills.d.ts +12 -0
- package/dist/model/skills.js +181 -0
- package/dist/model/skills.js.map +1 -0
- package/dist/model/types.d.ts +87 -0
- package/dist/model/types.js +2 -0
- package/dist/model/types.js.map +1 -0
- package/package.json +60 -4
- package/skills/dab-architecture-writing/SKILL.md +58 -0
- package/skills/dab-decision-notes/SKILL.md +57 -0
- package/skills/dab-doc-writing/SKILL.md +58 -0
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { readdir } from 'node:fs/promises';
|
|
2
|
+
import { basename, join, relative } from 'node:path';
|
|
3
|
+
import { lstatOrNull, readTextFile } from '../core/fs-atomic.js';
|
|
4
|
+
import { toPosix } from '../core/paths.js';
|
|
5
|
+
import { pathProblemFrom } from '../core/practice-paths.js';
|
|
6
|
+
async function exists(path) {
|
|
7
|
+
return (await lstatOrNull(path)) !== null;
|
|
8
|
+
}
|
|
9
|
+
async function readPackageJson(root) {
|
|
10
|
+
const path = join(root, 'package.json');
|
|
11
|
+
if (!(await exists(path))) {
|
|
12
|
+
return { exists: false, diagnostics: [] };
|
|
13
|
+
}
|
|
14
|
+
try {
|
|
15
|
+
const value = JSON.parse(await readTextFile(path));
|
|
16
|
+
return { value, exists: true, diagnostics: [] };
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
return {
|
|
20
|
+
exists: true,
|
|
21
|
+
diagnostics: [{
|
|
22
|
+
code: 'scan.package-json',
|
|
23
|
+
severity: 'warning',
|
|
24
|
+
message: 'package.json is not valid JSON',
|
|
25
|
+
file: 'package.json',
|
|
26
|
+
hint: 'DAB continued with conservative defaults.',
|
|
27
|
+
}],
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
async function detectPackageManager(root, hasPackageJson) {
|
|
32
|
+
for (const [file, manager] of [
|
|
33
|
+
['pnpm-lock.yaml', 'pnpm'],
|
|
34
|
+
['package-lock.json', 'npm'],
|
|
35
|
+
['yarn.lock', 'yarn'],
|
|
36
|
+
['bun.lockb', 'bun'],
|
|
37
|
+
]) {
|
|
38
|
+
if (await exists(join(root, file))) {
|
|
39
|
+
return manager;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return hasPackageJson ? 'npm' : 'none';
|
|
43
|
+
}
|
|
44
|
+
async function detectLanguage(root, hasPackageJson) {
|
|
45
|
+
if (await exists(join(root, 'tsconfig.json'))) {
|
|
46
|
+
return 'typescript';
|
|
47
|
+
}
|
|
48
|
+
if (hasPackageJson) {
|
|
49
|
+
return 'javascript';
|
|
50
|
+
}
|
|
51
|
+
if (await exists(join(root, 'pyproject.toml'))
|
|
52
|
+
|| await exists(join(root, 'setup.py'))
|
|
53
|
+
|| await exists(join(root, 'requirements.txt'))) {
|
|
54
|
+
return 'python';
|
|
55
|
+
}
|
|
56
|
+
if (await exists(join(root, 'go.mod'))) {
|
|
57
|
+
return 'go';
|
|
58
|
+
}
|
|
59
|
+
if (await exists(join(root, 'Cargo.toml'))) {
|
|
60
|
+
return 'rust';
|
|
61
|
+
}
|
|
62
|
+
return 'generic';
|
|
63
|
+
}
|
|
64
|
+
async function detectSourceDirs(root) {
|
|
65
|
+
const dirs = [];
|
|
66
|
+
for (const name of ['src', 'app', 'lib', 'packages', 'test', 'tests']) {
|
|
67
|
+
const info = await lstatOrNull(join(root, name));
|
|
68
|
+
if (info?.isDirectory() === true) {
|
|
69
|
+
dirs.push(name);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return dirs;
|
|
73
|
+
}
|
|
74
|
+
function scriptCommand(manager, script) {
|
|
75
|
+
switch (manager) {
|
|
76
|
+
case 'pnpm':
|
|
77
|
+
return `pnpm ${script}`;
|
|
78
|
+
case 'npm':
|
|
79
|
+
return script === 'test' ? 'npm test' : `npm run ${script}`;
|
|
80
|
+
case 'yarn':
|
|
81
|
+
return `yarn ${script}`;
|
|
82
|
+
case 'bun':
|
|
83
|
+
return `bun run ${script}`;
|
|
84
|
+
case 'none':
|
|
85
|
+
return undefined;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
async function nodeCommands(manager, packageJson) {
|
|
89
|
+
const scripts = packageJson?.scripts ?? {};
|
|
90
|
+
return {
|
|
91
|
+
...(scripts.test === undefined ? {} : { test: scriptCommand(manager, 'test') }),
|
|
92
|
+
...(scripts.build === undefined ? {} : { build: scriptCommand(manager, 'build') }),
|
|
93
|
+
...(scripts.lint === undefined ? {} : { lint: scriptCommand(manager, 'lint') }),
|
|
94
|
+
...(scripts.typecheck === undefined ? {} : { typecheck: scriptCommand(manager, 'typecheck') }),
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
async function pythonCommands(root) {
|
|
98
|
+
let pyproject = '';
|
|
99
|
+
const pyprojectPath = join(root, 'pyproject.toml');
|
|
100
|
+
if (await exists(pyprojectPath)) {
|
|
101
|
+
pyproject = await readTextFile(pyprojectPath);
|
|
102
|
+
}
|
|
103
|
+
const hasPytest = pyproject.includes('[tool.pytest')
|
|
104
|
+
|| await exists(join(root, 'pytest.ini'))
|
|
105
|
+
|| await exists(join(root, 'conftest.py'));
|
|
106
|
+
const hasRuff = pyproject.includes('[tool.ruff') || await exists(join(root, 'ruff.toml'));
|
|
107
|
+
const hasMypy = pyproject.includes('[tool.mypy') || await exists(join(root, 'mypy.ini'));
|
|
108
|
+
return {
|
|
109
|
+
...(hasPytest ? { test: 'python -m pytest' } : {}),
|
|
110
|
+
...(hasRuff ? { lint: 'ruff check .' } : {}),
|
|
111
|
+
...(hasMypy ? { typecheck: 'mypy .' } : {}),
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
async function existingAgentFiles(root) {
|
|
115
|
+
const dir = join(root, '.agents/agents');
|
|
116
|
+
let entries;
|
|
117
|
+
try {
|
|
118
|
+
entries = await readdir(dir, { withFileTypes: true });
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
// A regular file at `.agents/agents` raises ENOTDIR instead of ENOENT. The
|
|
122
|
+
// command source-parent probe reports that layout as `path.conflict`, so
|
|
123
|
+
// the scan itself stays empty instead of failing with an internal error.
|
|
124
|
+
if (error.code === 'ENOENT') {
|
|
125
|
+
return [];
|
|
126
|
+
}
|
|
127
|
+
if (pathProblemFrom(error) !== undefined) {
|
|
128
|
+
return [];
|
|
129
|
+
}
|
|
130
|
+
throw error;
|
|
131
|
+
}
|
|
132
|
+
return entries
|
|
133
|
+
.filter((entry) => entry.isFile() && entry.name.endsWith('.md'))
|
|
134
|
+
.map((entry) => toPosix(relative(root, join(dir, entry.name))))
|
|
135
|
+
.sort();
|
|
136
|
+
}
|
|
137
|
+
function slugify(value) {
|
|
138
|
+
const slug = value
|
|
139
|
+
.toLowerCase()
|
|
140
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
141
|
+
.replace(/^-+|-+$/g, '');
|
|
142
|
+
return slug.length === 0 ? 'project' : slug;
|
|
143
|
+
}
|
|
144
|
+
export async function scanProject(root) {
|
|
145
|
+
const packageFile = await readPackageJson(root);
|
|
146
|
+
const packageManager = await detectPackageManager(root, packageFile.exists);
|
|
147
|
+
const language = await detectLanguage(root, packageFile.exists);
|
|
148
|
+
const sourceDirs = await detectSourceDirs(root);
|
|
149
|
+
let commands;
|
|
150
|
+
switch (language) {
|
|
151
|
+
case 'typescript':
|
|
152
|
+
case 'javascript':
|
|
153
|
+
commands = await nodeCommands(packageManager, packageFile.value);
|
|
154
|
+
break;
|
|
155
|
+
case 'python':
|
|
156
|
+
commands = await pythonCommands(root);
|
|
157
|
+
break;
|
|
158
|
+
case 'go':
|
|
159
|
+
commands = {
|
|
160
|
+
test: 'go test ./...',
|
|
161
|
+
build: 'go build ./...',
|
|
162
|
+
lint: 'go vet ./...',
|
|
163
|
+
};
|
|
164
|
+
break;
|
|
165
|
+
case 'rust':
|
|
166
|
+
commands = {
|
|
167
|
+
test: 'cargo test',
|
|
168
|
+
build: 'cargo build',
|
|
169
|
+
lint: 'cargo clippy -- -D warnings',
|
|
170
|
+
};
|
|
171
|
+
break;
|
|
172
|
+
case 'generic':
|
|
173
|
+
commands = {};
|
|
174
|
+
break;
|
|
175
|
+
}
|
|
176
|
+
const projectName = packageFile.value?.name ?? basename(root);
|
|
177
|
+
return {
|
|
178
|
+
projectName,
|
|
179
|
+
projectId: slugify(projectName),
|
|
180
|
+
language,
|
|
181
|
+
packageManager,
|
|
182
|
+
commands,
|
|
183
|
+
sourceDirs,
|
|
184
|
+
hasAgentsMd: await exists(join(root, 'AGENTS.md')),
|
|
185
|
+
hasClaudeSettings: await exists(join(root, '.claude/settings.json')),
|
|
186
|
+
existingAgents: await existingAgentFiles(root),
|
|
187
|
+
diagnostics: packageFile.diagnostics,
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
//# sourceMappingURL=scanner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scanner.js","sourceRoot":"","sources":["../../src/init/scanner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAoC5D,KAAK,UAAU,MAAM,CAAC,IAAY;IAChC,OAAO,CAAC,MAAM,WAAW,CAAC,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC;AAC5C,CAAC;AAED,KAAK,UAAU,eAAe,CAAC,IAAY;IAKzC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;IACxC,IAAI,CAAC,CAAC,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;QAC1B,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,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C;YACjE,MAAM;QACR,KAAK,QAAQ;YACX,QAAQ,GAAG,MAAM,cAAc,CAAC,IAAI,CAAC,CAAC;YACtC,MAAM;QACR,KAAK,IAAI;YACP,QAAQ,GAAG;gBACT,IAAI,EAAE,eAAe;gBACrB,KAAK,EAAE,gBAAgB;gBACvB,IAAI,EAAE,cAAc;aACrB,CAAC;YACF,MAAM;QACR,KAAK,MAAM;YACT,QAAQ,GAAG;gBACT,IAAI,EAAE,YAAY;gBAClB,KAAK,EAAE,aAAa;gBACpB,IAAI,EAAE,6BAA6B;aACpC,CAAC;YACF,MAAM;QACR,KAAK,SAAS;YACZ,QAAQ,GAAG,EAAE,CAAC;YACd,MAAM;IACV,CAAC;IAED,MAAM,WAAW,GAAG,WAAW,CAAC,KAAK,EAAE,IAAI,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC9D,OAAO;QACL,WAAW;QACX,SAAS,EAAE,OAAO,CAAC,WAAW,CAAC;QAC/B,QAAQ;QACR,cAAc;QACd,QAAQ;QACR,UAAU;QACV,WAAW,EAAE,MAAM,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QAClD,iBAAiB,EAAE,MAAM,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,uBAAuB,CAAC,CAAC;QACpE,cAAc,EAAE,MAAM,kBAAkB,CAAC,IAAI,CAAC;QAC9C,WAAW,EAAE,WAAW,CAAC,WAAW;KACrC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { hashSkillBody, insertSkillMarker, parseSkillMarker, removeSkillMarker, stripMarker, type SkillMarker } from '../core/skill-marker.ts';
|
|
2
|
+
export declare const AUTHORING_SKILL_NAMES: readonly ['dab-doc-writing', 'dab-architecture-writing', 'dab-decision-notes'];
|
|
3
|
+
export type AuthoringSkillName = (typeof AUTHORING_SKILL_NAMES)[number];
|
|
4
|
+
export declare function loadAuthoringSkillTemplate(name: AuthoringSkillName): Promise<string>;
|
|
5
|
+
export declare function renderAuthoringSkill(name: AuthoringSkillName, version: string): Promise<string>;
|
|
6
|
+
export { hashSkillBody, insertSkillMarker, parseSkillMarker, removeSkillMarker, stripMarker };
|
|
7
|
+
export type { SkillMarker };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { dirname, join } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { hashSkillBody, insertSkillMarker, parseSkillMarker, removeSkillMarker, stripMarker, } from '../core/skill-marker.js';
|
|
5
|
+
export const AUTHORING_SKILL_NAMES = [
|
|
6
|
+
'dab-doc-writing',
|
|
7
|
+
'dab-architecture-writing',
|
|
8
|
+
'dab-decision-notes',
|
|
9
|
+
];
|
|
10
|
+
// From both `src/init/` and `dist/init/`, `../..` is the package root, where
|
|
11
|
+
// the published `skills/` directory lives.
|
|
12
|
+
const PACKAGE_ROOT = join(dirname(fileURLToPath(import.meta.url)), '..', '..');
|
|
13
|
+
export async function loadAuthoringSkillTemplate(name) {
|
|
14
|
+
return readFile(join(PACKAGE_ROOT, 'skills', name, 'SKILL.md'), 'utf8');
|
|
15
|
+
}
|
|
16
|
+
export async function renderAuthoringSkill(name, version) {
|
|
17
|
+
const template = await loadAuthoringSkillTemplate(name);
|
|
18
|
+
return insertSkillMarker(template, {
|
|
19
|
+
name,
|
|
20
|
+
version,
|
|
21
|
+
sha256: hashSkillBody(template),
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
export { hashSkillBody, insertSkillMarker, parseSkillMarker, removeSkillMarker, stripMarker };
|
|
25
|
+
//# sourceMappingURL=skill-templates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill-templates.js","sourceRoot":"","sources":["../../src/init/skill-templates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,GAEZ,MAAM,yBAAyB,CAAC;AAEjC,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,iBAAiB;IACjB,0BAA0B;IAC1B,oBAAoB;CACZ,CAAC;AAIX,6EAA6E;AAC7E,2CAA2C;AAC3C,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAE/E,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC9C,IAAwB;IAExB,OAAO,QAAQ,CAAC,IAAI,CAAC,YAAY,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,CAAC;AAC1E,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,IAAwB,EACxB,OAAe;IAEf,MAAM,QAAQ,GAAG,MAAM,0BAA0B,CAAC,IAAI,CAAC,CAAC;IACxD,OAAO,iBAAiB,CAAC,QAAQ,EAAE;QACjC,IAAI;QACJ,OAAO;QACP,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC;KAChC,CAAC,CAAC;AACL,CAAC;AAED,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { ScanResult } from './scanner.ts';
|
|
2
|
+
import type { AiProposalAgent } from './ai-proposal.ts';
|
|
3
|
+
import type { Scope } from '../model/scope.ts';
|
|
4
|
+
/** Documentation files that root AGENTS.md may link in its Documentation section. */
|
|
5
|
+
export interface DocumentationLinks {
|
|
6
|
+
agents: boolean;
|
|
7
|
+
architecture: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface RenderAgentsMdOptions {
|
|
10
|
+
/**
|
|
11
|
+
* Project scope only: root AGENTS.md links the documentation scaffold. The
|
|
12
|
+
* core pack derives each link from non-policy-skipped planner anchors, so a
|
|
13
|
+
* link is never added to a document that is not planned or already present.
|
|
14
|
+
*/
|
|
15
|
+
documentation?: DocumentationLinks;
|
|
16
|
+
}
|
|
17
|
+
export declare function renderAgentsMd(scan: ScanResult, added?: string, options?: RenderAgentsMdOptions): string;
|
|
18
|
+
export declare function renderImplementerAgent(): string;
|
|
19
|
+
export declare function renderReviewerAgent(): string;
|
|
20
|
+
export declare function renderFeatureDeliverySkill(scan: ScanResult): string;
|
|
21
|
+
export declare function renderDocSyncSkill(): string;
|
|
22
|
+
export declare function renderGeneratedFilesRule(): string;
|
|
23
|
+
export declare function renderTestingRule(): string;
|
|
24
|
+
export declare function renderProjectPolicy(): string;
|
|
25
|
+
export declare function renderClaudeCodePolicy(): string;
|
|
26
|
+
export declare function renderDabYaml(scan: ScanResult, scope: Scope, options?: {
|
|
27
|
+
profile?: 'generic' | 'feature';
|
|
28
|
+
docsLanguage?: 'auto' | 'en' | 'zh';
|
|
29
|
+
}): string;
|
|
30
|
+
export declare function renderAgentFromProposal(agent: AiProposalAgent): string;
|
|
31
|
+
export declare function templateFiles(scan: ScanResult, scope: Scope, aiAddition?: string, options?: {
|
|
32
|
+
profile?: 'generic' | 'feature';
|
|
33
|
+
documentation?: DocumentationLinks;
|
|
34
|
+
}): Record<string, string>;
|
|
35
|
+
export declare const TEMPLATE_PROJECTIONS: readonly [{
|
|
36
|
+
readonly source: '.agents/agents/implementer.md';
|
|
37
|
+
readonly target: '.claude/agents/implementer.md';
|
|
38
|
+
}, {
|
|
39
|
+
readonly source: '.agents/agents/reviewer.md';
|
|
40
|
+
readonly target: '.claude/agents/reviewer.md';
|
|
41
|
+
}, {
|
|
42
|
+
readonly source: '.agents/skills/feature-delivery';
|
|
43
|
+
readonly target: '.claude/skills/feature-delivery';
|
|
44
|
+
}, {
|
|
45
|
+
readonly source: '.agents/skills/doc-sync';
|
|
46
|
+
readonly target: '.claude/skills/doc-sync';
|
|
47
|
+
}, {
|
|
48
|
+
readonly source: '.agents/rules/generated-files.md';
|
|
49
|
+
readonly target: '.claude/rules/generated-files.md';
|
|
50
|
+
}, {
|
|
51
|
+
readonly source: '.agents/rules/testing.md';
|
|
52
|
+
readonly target: '.claude/rules/testing.md';
|
|
53
|
+
}];
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import { stringify } from 'yaml';
|
|
2
|
+
function commandOrTodo(command) {
|
|
3
|
+
return command ?? 'TODO: add a command';
|
|
4
|
+
}
|
|
5
|
+
function documentationSection(links) {
|
|
6
|
+
const items = [];
|
|
7
|
+
if (links.agents) {
|
|
8
|
+
items.push('- [docs/AGENTS.md](docs/AGENTS.md)');
|
|
9
|
+
}
|
|
10
|
+
if (links.architecture) {
|
|
11
|
+
items.push('- [docs/architecture.md](docs/architecture.md)');
|
|
12
|
+
}
|
|
13
|
+
return items.length === 0 ? '' : `\n## Documentation\n\n${items.join('\n')}\n`;
|
|
14
|
+
}
|
|
15
|
+
export function renderAgentsMd(scan, added, options = {}) {
|
|
16
|
+
const sources = scan.sourceDirs.length === 0 ? 'not detected' : scan.sourceDirs.join(', ');
|
|
17
|
+
const addition = added === undefined || added.trim().length === 0
|
|
18
|
+
? ''
|
|
19
|
+
: `\n${added.trim()}\n`;
|
|
20
|
+
const documentation = options.documentation === undefined
|
|
21
|
+
? ''
|
|
22
|
+
: documentationSection(options.documentation);
|
|
23
|
+
return `# ${scan.projectName}
|
|
24
|
+
|
|
25
|
+
## Project map
|
|
26
|
+
|
|
27
|
+
- Language: ${scan.language}
|
|
28
|
+
- Package manager: ${scan.packageManager}
|
|
29
|
+
- Source directories: ${sources}
|
|
30
|
+
- Authored agent configuration: \`.agents/\`
|
|
31
|
+
- Generated Claude Code configuration: \`.claude/\`
|
|
32
|
+
|
|
33
|
+
## Commands
|
|
34
|
+
|
|
35
|
+
- Test: \`${commandOrTodo(scan.commands.test)}\`
|
|
36
|
+
- Build: \`${commandOrTodo(scan.commands.build)}\`
|
|
37
|
+
- Lint: \`${commandOrTodo(scan.commands.lint)}\`
|
|
38
|
+
- Typecheck: \`${commandOrTodo(scan.commands.typecheck)}\`
|
|
39
|
+
|
|
40
|
+
## DAB rules
|
|
41
|
+
|
|
42
|
+
- \`AGENTS.md\` and \`.agents/\` are the only authored agent configuration.
|
|
43
|
+
- \`.claude/\` is generated. Do not edit it by hand; run \`dab normalize\`.
|
|
44
|
+
- Use the \`feature-delivery\` skill for scoped feature work.
|
|
45
|
+
- Durable team knowledge lives in \`.agents/notes/\` and project docs; personal auto memory stays machine-local.
|
|
46
|
+
- Read \`.agents/rules/testing.md\` and \`.agents/rules/generated-files.md\` before changing those areas.
|
|
47
|
+
|
|
48
|
+
## Working agreement
|
|
49
|
+
|
|
50
|
+
1. Read the relevant skill before starting.
|
|
51
|
+
2. Write a failing test before implementation.
|
|
52
|
+
3. Run the test command above and report the exact result.
|
|
53
|
+
4. Run \`dab detect\` before handing off configuration changes.
|
|
54
|
+
5. Update project documentation when a user-facing behavior changes.
|
|
55
|
+
${documentation}${addition}`;
|
|
56
|
+
}
|
|
57
|
+
export function renderImplementerAgent() {
|
|
58
|
+
return `---
|
|
59
|
+
name: implementer
|
|
60
|
+
description: Implements one scoped feature task with tests and verification.
|
|
61
|
+
tools: Read, Grep, Glob, Edit, Write, Bash
|
|
62
|
+
---
|
|
63
|
+
You implement one scoped task at a time.
|
|
64
|
+
|
|
65
|
+
- Read the task and the relevant skill before changing files.
|
|
66
|
+
- Write a failing test before production code, then make it pass.
|
|
67
|
+
- Keep changes inside the requested scope.
|
|
68
|
+
- Run the project test command and report the exact result.
|
|
69
|
+
- Update project documentation when behavior changes.
|
|
70
|
+
`;
|
|
71
|
+
}
|
|
72
|
+
export function renderReviewerAgent() {
|
|
73
|
+
return `---
|
|
74
|
+
name: reviewer
|
|
75
|
+
description: Reviews a change for correctness, missing tests and unauthorized scope.
|
|
76
|
+
tools: Read, Grep, Glob, Bash
|
|
77
|
+
disallowedTools: Edit, Write, NotebookEdit
|
|
78
|
+
permissionMode: plan
|
|
79
|
+
---
|
|
80
|
+
You review a change without editing it.
|
|
81
|
+
|
|
82
|
+
- Check correctness, failure handling and test coverage.
|
|
83
|
+
- Check for changes outside the requested scope.
|
|
84
|
+
- Run the relevant tests when needed.
|
|
85
|
+
- Report findings by severity with concrete file and line references.
|
|
86
|
+
- Do not approve a change whose tests were not run.
|
|
87
|
+
`;
|
|
88
|
+
}
|
|
89
|
+
export function renderFeatureDeliverySkill(scan) {
|
|
90
|
+
return `---
|
|
91
|
+
name: feature-delivery
|
|
92
|
+
description: Delivers one scoped feature with failing tests, implementation, docs and verification.
|
|
93
|
+
---
|
|
94
|
+
# Feature delivery
|
|
95
|
+
|
|
96
|
+
1. Read \`AGENTS.md\` and the task input.
|
|
97
|
+
2. Locate the smallest relevant module and test file.
|
|
98
|
+
3. Write a failing test that expresses the required behavior.
|
|
99
|
+
4. Run \`${commandOrTodo(scan.commands.test)}\` and confirm the new test fails for the expected reason.
|
|
100
|
+
5. Implement the smallest change that makes the test pass.
|
|
101
|
+
6. Run \`${commandOrTodo(scan.commands.test)}\` again and report the exact result.
|
|
102
|
+
7. Update documentation when the behavior is user-facing.
|
|
103
|
+
8. Summarize changed files, tests and any remaining risk.
|
|
104
|
+
`;
|
|
105
|
+
}
|
|
106
|
+
export function renderDocSyncSkill() {
|
|
107
|
+
return `---
|
|
108
|
+
name: doc-sync
|
|
109
|
+
description: Updates project documentation and runs the documentation gates.
|
|
110
|
+
---
|
|
111
|
+
# Documentation sync
|
|
112
|
+
|
|
113
|
+
1. Identify the documentation affected by the change.
|
|
114
|
+
2. Update the affected documentation in the same change.
|
|
115
|
+
3. Keep headings, lists, tables, code blocks and inline code structurally identical.
|
|
116
|
+
4. Run the repository's documentation gate and fix every failure.
|
|
117
|
+
`;
|
|
118
|
+
}
|
|
119
|
+
export function renderGeneratedFilesRule() {
|
|
120
|
+
return `---
|
|
121
|
+
paths: [".claude/**"]
|
|
122
|
+
---
|
|
123
|
+
Generated files under \`.claude/\` are owned by DAB.
|
|
124
|
+
|
|
125
|
+
- Do not edit them by hand.
|
|
126
|
+
- Change \`AGENTS.md\` or \`.agents/\` and run \`dab normalize\`.
|
|
127
|
+
- Use \`dab detect\` to inspect drift.
|
|
128
|
+
`;
|
|
129
|
+
}
|
|
130
|
+
export function renderTestingRule() {
|
|
131
|
+
return `---
|
|
132
|
+
paths: ["src/**", "test/**", "tests/**"]
|
|
133
|
+
---
|
|
134
|
+
Write a failing test before production code.
|
|
135
|
+
|
|
136
|
+
- The test must fail for the expected reason before the implementation exists.
|
|
137
|
+
- Run the project test command after the change.
|
|
138
|
+
- Do not weaken a test to make an unrelated failure disappear.
|
|
139
|
+
`;
|
|
140
|
+
}
|
|
141
|
+
export function renderProjectPolicy() {
|
|
142
|
+
return `version: 1
|
|
143
|
+
defaultMode: default
|
|
144
|
+
read:
|
|
145
|
+
deny:
|
|
146
|
+
- .env
|
|
147
|
+
- .env.*
|
|
148
|
+
- secrets/**
|
|
149
|
+
write:
|
|
150
|
+
deny:
|
|
151
|
+
- .claude/settings.json
|
|
152
|
+
- .claude/settings.local.json
|
|
153
|
+
- .claude/CLAUDE.md
|
|
154
|
+
- .claude/agents/**
|
|
155
|
+
- .claude/skills/**
|
|
156
|
+
- .claude/rules/**
|
|
157
|
+
execute:
|
|
158
|
+
deny:
|
|
159
|
+
- sudo
|
|
160
|
+
- rm -rf /
|
|
161
|
+
ask:
|
|
162
|
+
- git push
|
|
163
|
+
- npm publish
|
|
164
|
+
capabilities:
|
|
165
|
+
deny: []
|
|
166
|
+
`;
|
|
167
|
+
}
|
|
168
|
+
export function renderClaudeCodePolicy() {
|
|
169
|
+
return `version: 1
|
|
170
|
+
provider: claude-code
|
|
171
|
+
permissions:
|
|
172
|
+
allow: []
|
|
173
|
+
ask: []
|
|
174
|
+
deny:
|
|
175
|
+
- Bash(git reset --hard:*)
|
|
176
|
+
- Bash(git clean -fdx:*)
|
|
177
|
+
`;
|
|
178
|
+
}
|
|
179
|
+
export function renderDabYaml(scan, scope, options = {}) {
|
|
180
|
+
const profile = options.profile ?? 'generic';
|
|
181
|
+
const docsLanguage = options.docsLanguage ?? 'auto';
|
|
182
|
+
return `version: 2
|
|
183
|
+
scope: ${scope}
|
|
184
|
+
project:
|
|
185
|
+
id: ${JSON.stringify(scan.projectId)}
|
|
186
|
+
name: ${JSON.stringify(scan.projectName)}
|
|
187
|
+
profile: ${profile}
|
|
188
|
+
docs:
|
|
189
|
+
language: ${docsLanguage}
|
|
190
|
+
targets:
|
|
191
|
+
- provider: claude-code
|
|
192
|
+
enabled: true
|
|
193
|
+
options:
|
|
194
|
+
minVersion: 2.1.277
|
|
195
|
+
instructions: symlink
|
|
196
|
+
paths:
|
|
197
|
+
agents: .agents
|
|
198
|
+
claude: .claude
|
|
199
|
+
`;
|
|
200
|
+
}
|
|
201
|
+
export function renderAgentFromProposal(agent) {
|
|
202
|
+
const frontmatter = stringify({
|
|
203
|
+
name: agent.name,
|
|
204
|
+
description: agent.description,
|
|
205
|
+
}).trimEnd();
|
|
206
|
+
return `---
|
|
207
|
+
${frontmatter}
|
|
208
|
+
---
|
|
209
|
+
${agent.body.trim()}
|
|
210
|
+
`;
|
|
211
|
+
}
|
|
212
|
+
export function templateFiles(scan, scope, aiAddition, options = {}) {
|
|
213
|
+
const agentsMd = scope === 'global' ? '.agents/AGENTS.md' : 'AGENTS.md';
|
|
214
|
+
const manifest = scope === 'global' ? '.agents/dab.yaml' : 'dab.yaml';
|
|
215
|
+
return {
|
|
216
|
+
[agentsMd]: renderAgentsMd(scan, aiAddition, options.documentation === undefined ? {} : { documentation: options.documentation }),
|
|
217
|
+
[manifest]: renderDabYaml(scan, scope, { profile: options.profile ?? 'generic' }),
|
|
218
|
+
'.agents/agents/implementer.md': renderImplementerAgent(),
|
|
219
|
+
'.agents/agents/reviewer.md': renderReviewerAgent(),
|
|
220
|
+
'.agents/skills/feature-delivery/SKILL.md': renderFeatureDeliverySkill(scan),
|
|
221
|
+
'.agents/skills/doc-sync/SKILL.md': renderDocSyncSkill(),
|
|
222
|
+
'.agents/rules/generated-files.md': renderGeneratedFilesRule(),
|
|
223
|
+
'.agents/rules/testing.md': renderTestingRule(),
|
|
224
|
+
'.agents/policies/project.yaml': renderProjectPolicy(),
|
|
225
|
+
'.agents/adapters/claude-code.yaml': renderClaudeCodePolicy(),
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
export const TEMPLATE_PROJECTIONS = [
|
|
229
|
+
{
|
|
230
|
+
source: '.agents/agents/implementer.md',
|
|
231
|
+
target: '.claude/agents/implementer.md',
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
source: '.agents/agents/reviewer.md',
|
|
235
|
+
target: '.claude/agents/reviewer.md',
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
source: '.agents/skills/feature-delivery',
|
|
239
|
+
target: '.claude/skills/feature-delivery',
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
source: '.agents/skills/doc-sync',
|
|
243
|
+
target: '.claude/skills/doc-sync',
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
source: '.agents/rules/generated-files.md',
|
|
247
|
+
target: '.claude/rules/generated-files.md',
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
source: '.agents/rules/testing.md',
|
|
251
|
+
target: '.claude/rules/testing.md',
|
|
252
|
+
},
|
|
253
|
+
];
|
|
254
|
+
//# sourceMappingURL=templates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/init/templates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAKjC,SAAS,aAAa,CAAC,OAA2B;IAChD,OAAO,OAAO,IAAI,qBAAqB,CAAC;AAC1C,CAAC;AAiBD,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AC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC;QACE,MAAM,EAAE,+BAA+B;QACvC,MAAM,EAAE,+BAA+B;KACxC;IACD;QACE,MAAM,EAAE,4BAA4B;QACpC,MAAM,EAAE,4BAA4B;KACrC;IACD;QACE,MAAM,EAAE,iCAAiC;QACzC,MAAM,EAAE,iCAAiC;KAC1C;IACD;QACE,MAAM,EAAE,yBAAyB;QACjC,MAAM,EAAE,yBAAyB;KAClC;IACD;QACE,MAAM,EAAE,kCAAkC;QAC1C,MAAM,EAAE,kCAAkC;KAC3C;IACD;QACE,MAAM,EAAE,0BAA0B;QAClC,MAAM,EAAE,0BAA0B;KACnC;CACO,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Diagnostic } from '../core/diagnostics.ts';
|
|
2
|
+
export interface AgentsMdCheck {
|
|
3
|
+
lineCount: number;
|
|
4
|
+
diagnostics: Diagnostic[];
|
|
5
|
+
}
|
|
6
|
+
export declare function checkAgentsMd(scopeRoot: string, instructions: string, maxLines?: number): Promise<AgentsMdCheck>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { relative } from 'node:path';
|
|
2
|
+
import { lstatOrNull, readTextFile } from '../core/fs-atomic.js';
|
|
3
|
+
import { toPosix } from '../core/paths.js';
|
|
4
|
+
import { DiagnosticCodes } from './diagnostics-codes.js';
|
|
5
|
+
function countLines(text) {
|
|
6
|
+
if (text.length === 0) {
|
|
7
|
+
return 0;
|
|
8
|
+
}
|
|
9
|
+
return text.replace(/\n$/, '').split('\n').length;
|
|
10
|
+
}
|
|
11
|
+
export async function checkAgentsMd(scopeRoot, instructions, maxLines = 200) {
|
|
12
|
+
const file = toPosix(relative(scopeRoot, instructions));
|
|
13
|
+
if ((await lstatOrNull(instructions)) === null) {
|
|
14
|
+
return {
|
|
15
|
+
lineCount: 0,
|
|
16
|
+
diagnostics: [
|
|
17
|
+
{
|
|
18
|
+
code: DiagnosticCodes.agentsMdMissing,
|
|
19
|
+
severity: 'warning',
|
|
20
|
+
message: 'AGENTS.md is missing',
|
|
21
|
+
file,
|
|
22
|
+
hint: 'Run "dab init" or author AGENTS.md as the project instruction source.',
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
const text = await readTextFile(instructions);
|
|
28
|
+
const lineCount = countLines(text);
|
|
29
|
+
const diagnostics = [];
|
|
30
|
+
if (lineCount > maxLines) {
|
|
31
|
+
diagnostics.push({
|
|
32
|
+
code: DiagnosticCodes.agentsMdTooLarge,
|
|
33
|
+
severity: 'warning',
|
|
34
|
+
message: `AGENTS.md has ${lineCount} lines; the budget is ${maxLines}`,
|
|
35
|
+
file,
|
|
36
|
+
hint: 'Move long procedures into skills, architecture into docs, and durable facts into .agents/notes/ (optional advanced: .agents/memory/).',
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
return { lineCount, diagnostics };
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=agents-md.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agents-md.js","sourceRoot":"","sources":["../../src/model/agents-md.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAOzD,SAAS,UAAU,CAAC,IAAY;IAC9B,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,OAAO,CAAC,CAAC;IACX,CAAC;IACD,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC;AACpD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,SAAiB,EACjB,YAAoB,EACpB,QAAQ,GAAG,GAAG;IAEd,MAAM,IAAI,GAAG,OAAO,CAAC,QAAQ,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC;IACxD,IAAI,CAAC,MAAM,WAAW,CAAC,YAAY,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QAC/C,OAAO;YACL,SAAS,EAAE,CAAC;YACZ,WAAW,EAAE;gBACX;oBACE,IAAI,EAAE,eAAe,CAAC,eAAe;oBACrC,QAAQ,EAAE,SAAS;oBACnB,OAAO,EAAE,sBAAsB;oBAC/B,IAAI;oBACJ,IAAI,EAAE,uEAAuE;iBAC9E;aACF;SACF,CAAC;IACJ,CAAC;IAED,MAAM,IAAI,GAAG,MAAM,YAAY,CAAC,YAAY,CAAC,CAAC;IAC9C,MAAM,SAAS,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;IACnC,MAAM,WAAW,GAAiB,EAAE,CAAC;IACrC,IAAI,SAAS,GAAG,QAAQ,EAAE,CAAC;QACzB,WAAW,CAAC,IAAI,CAAC;YACf,IAAI,EAAE,eAAe,CAAC,gBAAgB;YACtC,QAAQ,EAAE,SAAS;YACnB,OAAO,EAAE,iBAAiB,SAAS,yBAAyB,QAAQ,EAAE;YACtE,IAAI;YACJ,IAAI,EAAE,uIAAuI;SAC9I,CAAC,CAAC;IACL,CAAC;IACD,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Diagnostic } from '../core/diagnostics.ts';
|
|
2
|
+
import type { AgentDefinition, DiscoveryResult } from './types.ts';
|
|
3
|
+
export interface AgentSourceResult {
|
|
4
|
+
item?: AgentDefinition;
|
|
5
|
+
diagnostics: Diagnostic[];
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Validate one agent file for adoption. Returns an item only when the source has
|
|
9
|
+
* no error diagnostics; warnings (such as unknown frontmatter) are preserved.
|
|
10
|
+
*/
|
|
11
|
+
export declare function validateAgentSource(root: string, file: string): Promise<AgentSourceResult>;
|
|
12
|
+
export declare function discoverAgents(root: string, agentsDir: string): Promise<DiscoveryResult<AgentDefinition>>;
|