@akjamie/agentic-sdlc 1.2.0 → 1.4.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.
Files changed (48) hide show
  1. package/LICENSE +201 -21
  2. package/README.md +239 -302
  3. package/assets/commands/asdlc-apply.md +24 -0
  4. package/assets/commands/asdlc-approve.md +21 -0
  5. package/assets/commands/asdlc-archive.md +21 -0
  6. package/assets/commands/asdlc-doctor.md +24 -0
  7. package/assets/commands/asdlc-lint.md +30 -0
  8. package/assets/commands/asdlc-new.md +29 -0
  9. package/assets/commands/asdlc-pr.md +25 -0
  10. package/assets/commands/asdlc-status.md +23 -0
  11. package/assets/commands/asdlc-test.md +20 -0
  12. package/assets/commands/asdlc-verify.md +29 -0
  13. package/assets/schema/risk-assessment.schema.json +225 -0
  14. package/assets/skills/asdlc-apply/SKILL.md +43 -18
  15. package/assets/skills/asdlc-new/SKILL.md +15 -1
  16. package/assets/skills/asdlc-verify/SKILL.md +16 -6
  17. package/package.json +2 -2
  18. package/src/assess/ai_judge.js +163 -0
  19. package/src/assess/decide.js +164 -0
  20. package/src/assess/governance.js +53 -0
  21. package/src/assess/index.js +183 -0
  22. package/src/assess/render.js +71 -0
  23. package/src/assess/rules/builtin.js +195 -0
  24. package/src/assess/schema.js +148 -0
  25. package/src/assess/store.js +138 -0
  26. package/src/assess/vectors/v1_intent.js +80 -0
  27. package/src/assess/vectors/v2_security.js +131 -0
  28. package/src/assess/vectors/v3_topology.js +107 -0
  29. package/src/cli.js +91 -89
  30. package/src/commands/apply.js +103 -36
  31. package/src/commands/assess.js +57 -0
  32. package/src/commands/doctor.js +33 -18
  33. package/src/commands/init.js +5 -64
  34. package/src/commands/lint.js +9 -2
  35. package/src/commands/new.js +19 -2
  36. package/src/commands/pr.js +27 -3
  37. package/src/commands/skills.js +7 -19
  38. package/src/commands/status.js +169 -8
  39. package/src/commands/update.js +4 -3
  40. package/src/commands/upgrade.js +1 -1
  41. package/src/commands/verify.js +109 -15
  42. package/src/lib/fs.js +26 -3
  43. package/src/lib/level.js +118 -0
  44. package/src/lib/paths.js +3 -1
  45. package/src/lib/prtype.js +17 -4
  46. package/src/lib/risk.js +50 -0
  47. package/src/lib/schema.js +4 -0
  48. package/src/lib/tools.js +313 -0
@@ -0,0 +1,313 @@
1
+ import path from 'node:path';
2
+ import { exists, listDir, copyTree, ensureDir, readText, writeText } from './fs.js';
3
+ import { skillsAssetDir, commandsAssetDir } from './paths.js';
4
+ import { log } from './log.js';
5
+
6
+ export const TOOL_REGISTRY = {
7
+ claude: {
8
+ id: 'claude',
9
+ name: 'Claude Code',
10
+ tier: 1,
11
+ detectDir: '.claude',
12
+ skillsDir: '.claude/skills',
13
+ commandsDir: '.claude/commands',
14
+ commandExt: '.md',
15
+ commandFormat: 'markdown',
16
+ },
17
+ opencode: {
18
+ id: 'opencode',
19
+ name: 'OpenCode',
20
+ tier: 1,
21
+ detectDir: '.opencode',
22
+ skillsDir: '.opencode/skills',
23
+ commandsDir: '.opencode/commands',
24
+ commandExt: '.md',
25
+ commandFormat: 'markdown',
26
+ },
27
+ pi: {
28
+ id: 'pi',
29
+ name: 'Pi (oh-my-pi)',
30
+ tier: 1,
31
+ detectDir: '.pi',
32
+ skillsDir: '.pi/skills',
33
+ commandsDir: '.pi/prompts',
34
+ commandExt: '.md',
35
+ commandFormat: 'markdown',
36
+ },
37
+ antigravity: {
38
+ id: 'antigravity',
39
+ name: 'Google Antigravity',
40
+ tier: 1,
41
+ detectDir: '.agents',
42
+ detectAliases: ['.antigravity'],
43
+ skillsDir: '.agents/skills',
44
+ commandsDir: '.agents/workflows',
45
+ commandExt: '.md',
46
+ commandFormat: 'markdown',
47
+ },
48
+ 'github-copilot': {
49
+ id: 'github-copilot',
50
+ name: 'GitHub Copilot',
51
+ tier: 1,
52
+ detectDir: '.github',
53
+ skillsDir: '.github/skills',
54
+ commandsDir: '.github/prompts',
55
+ commandExt: '.prompt.md',
56
+ commandFormat: 'prompt-md',
57
+ },
58
+ cursor: {
59
+ id: 'cursor',
60
+ name: 'Cursor',
61
+ tier: 2,
62
+ detectDir: '.cursor',
63
+ skillsDir: '.cursor/skills',
64
+ commandsDir: '.cursor/commands',
65
+ commandExt: '.md',
66
+ commandFormat: 'markdown',
67
+ },
68
+ trae: {
69
+ id: 'trae',
70
+ name: 'Trae',
71
+ tier: 2,
72
+ detectDir: '.trae',
73
+ skillsDir: '.trae/skills',
74
+ commandsDir: '.trae/commands',
75
+ commandExt: '.md',
76
+ commandFormat: 'markdown',
77
+ },
78
+ windsurf: {
79
+ id: 'windsurf',
80
+ name: 'Windsurf / Devin Desktop',
81
+ tier: 2,
82
+ detectDir: '.windsurf',
83
+ detectAliases: ['.devin'],
84
+ skillsDir: '.windsurf/skills',
85
+ commandsDir: '.windsurf/workflows',
86
+ commandExt: '.md',
87
+ commandFormat: 'markdown',
88
+ },
89
+ gemini: {
90
+ id: 'gemini',
91
+ name: 'Gemini CLI',
92
+ tier: 2,
93
+ detectDir: '.gemini',
94
+ skillsDir: '.gemini/skills',
95
+ commandsDir: '.gemini/commands/asdlc',
96
+ commandExt: '.toml',
97
+ commandFormat: 'toml',
98
+ },
99
+ codex: {
100
+ id: 'codex',
101
+ name: 'Codex',
102
+ tier: 2,
103
+ detectDir: '.codex',
104
+ skillsDir: '.codex/skills',
105
+ commandsDir: '.codex/commands',
106
+ commandExt: '.md',
107
+ commandFormat: 'markdown',
108
+ },
109
+ zed: {
110
+ id: 'zed',
111
+ name: 'Zed',
112
+ tier: 2,
113
+ detectDir: '.zed',
114
+ skillsDir: '.zed/skills',
115
+ commandsDir: '.zed/commands',
116
+ commandExt: '.md',
117
+ commandFormat: 'markdown',
118
+ },
119
+ dsh: {
120
+ id: 'dsh',
121
+ name: 'DSH Agent',
122
+ tier: 2,
123
+ detectDir: '.dsh',
124
+ skillsDir: '.dsh/skills',
125
+ commandsDir: '.dsh/commands',
126
+ commandExt: '.md',
127
+ commandFormat: 'markdown',
128
+ },
129
+ agents: {
130
+ id: 'agents',
131
+ name: 'Generic Agents',
132
+ tier: 2,
133
+ detectDir: '.agents',
134
+ skillsDir: '.agents/skills',
135
+ commandsDir: '.agents/workflows',
136
+ commandExt: '.md',
137
+ commandFormat: 'markdown',
138
+ },
139
+ };
140
+
141
+ /**
142
+ * Detect AI agent tools configured in this repository
143
+ */
144
+ export function detectTools(repoRoot) {
145
+ const detected = new Set();
146
+ for (const tool of Object.values(TOOL_REGISTRY)) {
147
+ if (exists(path.join(repoRoot, tool.detectDir))) {
148
+ detected.add(tool.id);
149
+ }
150
+ if (tool.detectAliases) {
151
+ for (const alias of tool.detectAliases) {
152
+ if (exists(path.join(repoRoot, alias))) {
153
+ detected.add(tool.id);
154
+ }
155
+ }
156
+ }
157
+ }
158
+ return Array.from(detected);
159
+ }
160
+
161
+ /**
162
+ * Resolve tool definition by ID, alias, or directory name
163
+ */
164
+ export function getToolDefinition(toolIdentifier) {
165
+ if (!toolIdentifier) return null;
166
+ const clean = String(toolIdentifier).toLowerCase().replace(/^\./, '');
167
+ if (TOOL_REGISTRY[clean]) return TOOL_REGISTRY[clean];
168
+
169
+ for (const tool of Object.values(TOOL_REGISTRY)) {
170
+ if (tool.detectDir === `.${clean}` || (tool.detectAliases && tool.detectAliases.includes(`.${clean}`))) {
171
+ return tool;
172
+ }
173
+ }
174
+ return null;
175
+ }
176
+
177
+ /**
178
+ * Install bundled skills into all detected or specified agent tools
179
+ */
180
+ export function installSkills(repoRoot, tools = []) {
181
+ if (!exists(skillsAssetDir)) return;
182
+ const count = listDir(skillsAssetDir).filter((d) => d.isDirectory()).length;
183
+ const targetDirs = new Set(['.agents/skills']);
184
+
185
+ // If user has an explicit .antigravity folder, copy skills there too
186
+ if (exists(path.join(repoRoot, '.antigravity'))) {
187
+ targetDirs.add('.antigravity/skills');
188
+ }
189
+
190
+ for (const t of tools) {
191
+ const def = getToolDefinition(t);
192
+ if (def) {
193
+ targetDirs.add(def.skillsDir);
194
+ if (def.detectAliases) {
195
+ for (const alias of def.detectAliases) {
196
+ if (exists(path.join(repoRoot, alias))) {
197
+ targetDirs.add(path.join(alias, 'skills').replace(/\\/g, '/'));
198
+ }
199
+ }
200
+ }
201
+ } else {
202
+ const clean = String(t).toLowerCase().replace(/^\./, '');
203
+ if (clean) targetDirs.add(`.${clean}/skills`);
204
+ }
205
+ }
206
+
207
+ for (const dir of targetDirs) {
208
+ const dest = path.join(repoRoot, dir);
209
+ copyTree(skillsAssetDir, dest);
210
+ log.ok(`installed bundled skills (${count} skills) -> ${dir}/`);
211
+ }
212
+ }
213
+
214
+ /**
215
+ * Format markdown command template for a specific tool format
216
+ */
217
+ function formatCommandContent(baseContent, baseName, format) {
218
+ if (format === 'prompt-md') {
219
+ // GitHub Copilot uses .prompt.md with standard YAML frontmatter
220
+ return baseContent;
221
+ }
222
+ if (format === 'toml') {
223
+ // Gemini CLI uses TOML command definitions
224
+ const descMatch = baseContent.match(/^description:\s*["']?([\s\S]*?)["']?$/m);
225
+ const desc = descMatch ? descMatch[1].trim() : `Execute ${baseName}`;
226
+ const cleanBody = baseContent.replace(/^---[\s\S]*?---\r?\n/, '').trim();
227
+ return `description = "${desc.replace(/"/g, '\\"')}"\n\nprompt = """\n${cleanBody}\n"""\n`;
228
+ }
229
+ return baseContent;
230
+ }
231
+
232
+ /**
233
+ * Install slash commands and workflows across detected or specified tools
234
+ */
235
+ export function installCommands(repoRoot, tools = []) {
236
+ if (!exists(commandsAssetDir)) return;
237
+ const commandFiles = listDir(commandsAssetDir).filter((f) => !f.isDirectory() && f.name.endsWith('.md'));
238
+ if (commandFiles.length === 0) return;
239
+
240
+ const targetTools = new Set(['agents']);
241
+ for (const t of tools) {
242
+ const def = getToolDefinition(t);
243
+ if (def) targetTools.add(def.id);
244
+ }
245
+
246
+ // Also check if .antigravity exists on disk
247
+ const hasAntigravityAlias = exists(path.join(repoRoot, '.antigravity'));
248
+
249
+ for (const toolId of targetTools) {
250
+ const def = TOOL_REGISTRY[toolId];
251
+ if (!def) continue;
252
+
253
+ const destDir = path.join(repoRoot, def.commandsDir);
254
+ ensureDir(destDir);
255
+
256
+ for (const cmdFile of commandFiles) {
257
+ const baseName = cmdFile.name.replace(/\.md$/, '');
258
+ const rawContent = readText(path.join(commandsAssetDir, cmdFile.name));
259
+ const targetContent = formatCommandContent(rawContent, baseName, def.commandFormat);
260
+ const targetFileName = `${baseName}${def.commandExt}`;
261
+ writeText(path.join(destDir, targetFileName), targetContent);
262
+ }
263
+ log.ok(`installed slash commands (${commandFiles.length} commands) -> ${def.commandsDir}/`);
264
+
265
+ // If antigravity alias folder exists, mirror workflows there too
266
+ if (toolId === 'antigravity' && hasAntigravityAlias) {
267
+ const aliasDir = path.join(repoRoot, '.antigravity', 'workflows');
268
+ ensureDir(aliasDir);
269
+ for (const cmdFile of commandFiles) {
270
+ const rawContent = readText(path.join(commandsAssetDir, cmdFile.name));
271
+ writeText(path.join(aliasDir, cmdFile.name), rawContent);
272
+ }
273
+ log.ok(`installed slash commands (${commandFiles.length} commands) -> .antigravity/workflows/`);
274
+ }
275
+ }
276
+ }
277
+
278
+ /**
279
+ * Audit tool health for asdlc doctor
280
+ */
281
+ export function checkToolHealth(repoRoot, toolId) {
282
+ const def = TOOL_REGISTRY[toolId];
283
+ if (!def) return null;
284
+
285
+ const skillsPath = path.join(repoRoot, def.skillsDir);
286
+ const commandsPath = path.join(repoRoot, def.commandsDir);
287
+
288
+ const skillsOk = exists(skillsPath) && listDir(skillsPath).length > 0;
289
+ const commandsOk = exists(commandsPath) && listDir(commandsPath).length > 0;
290
+
291
+ let status = 'pass';
292
+ let detail = `skills + commands installed (${def.commandsDir})`;
293
+
294
+ if (!skillsOk && !commandsOk) {
295
+ status = 'warn';
296
+ detail = 'missing skills and commands (run `asdlc init`)';
297
+ } else if (!skillsOk) {
298
+ status = 'warn';
299
+ detail = `missing skills in ${def.skillsDir} (run 'asdlc init')`;
300
+ } else if (!commandsOk) {
301
+ status = 'warn';
302
+ detail = `missing commands in ${def.commandsDir} (run 'asdlc init')`;
303
+ }
304
+
305
+ return {
306
+ id: def.id,
307
+ name: def.name,
308
+ status,
309
+ detail,
310
+ skillsOk,
311
+ commandsOk,
312
+ };
313
+ }