@antoneeo/agentic-sdlc-skill 1.10.0 → 1.12.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/README.md CHANGED
@@ -1,87 +1,88 @@
1
- # Agentic SDLC Skill for Claude Code, Gemini CLI & Codex
2
-
3
- `agentic-sdlc` is a Documentation-First SDLC protocol for AI coding agents. It supports Claude Code, Codex, Gemini CLI, Cursor/Windsurf-style project instructions, and optional devPNT governance.
4
-
5
- ## Key Features
6
-
7
- - **Risk-proportional workflow**: L1/L2/L3/Spike triage avoids heavyweight process for trivial work.
8
- - **Vision-guided governance**: Standalone projects use `ai_docs/vision/`; Hybrid projects use devPNT `M-VISION` as the milestone north star.
9
- - **Standalone complete**: works fully with local `ai_docs/` without requiring devPNT.
10
- - **devPNT symbiosis**: when devPNT is available, Master Plan, Action Plan, M-VISION, and governed artifacts become the authoritative planning layer.
11
- - **Installed support files**: Claude, Codex, and Gemini receive the full skill folder, including `templates.md`, `guides.md`, `tdd.md`, `debugging.md`, `elicitation.md`, `review.md`, `dispatch.md`, `ENFORCEMENT.md`, and `scripts/sdlc_check.py`; an agent-global KB at `~/.agentic-sdlc` shares the same engine cross-project.
12
- - **Mechanical checks**: optional validator for document structure, generated feature history, stale audit areas, and protected-path gates.
13
-
14
- ## Installation
15
-
16
- ### Via npm
17
-
18
- ```bash
19
- npm install -g @antoneeo/agentic-sdlc-skill@latest
20
- agentic-sdlc-install-skill
21
- ```
22
-
23
- The installer copies `skills/agentic-sdlc-skill/` recursively into native skill locations:
24
-
25
- - Claude Code: `~/.claude/skills/agentic-sdlc/`
26
- - Codex: `~/.codex/skills/agentic-sdlc/`
27
- - Gemini CLI: `~/.gemini/skills/agentic-sdlc/`
28
-
29
- Restart the relevant agent, or reload skills where the CLI supports it.
30
-
31
- The global package also exposes:
32
-
33
- ```bash
34
- agentic-sdlc-init
35
- ```
36
-
37
- Run it inside a project to create `ai_docs/`, Vision documents, strategic docs, audit plan, and agent protocol files (`AGENTS.md`, `CLAUDE.md`, `GEMINI.md`, `.cursorrules`).
38
-
39
- ## Runtime Shape
40
-
41
- The actual runtime skill is the folder:
42
-
43
- ```text
44
- skills/agentic-sdlc-skill/
45
- ├── SKILL.md
46
- ├── templates.md
47
- ├── guides.md
48
- ├── tdd.md
49
- ├── debugging.md
50
- ├── elicitation.md
51
- ├── review.md
52
- ├── dispatch.md
53
- ├── ENFORCEMENT.md
54
- └── scripts/
55
- └── sdlc_check.py
56
- ```
57
-
58
- `SKILL.md` is the entrypoint. Supporting files are loaded or executed only when the agent needs them.
59
-
60
- ## Standalone vs Hybrid
61
-
62
- Standalone:
63
-
64
- - `ai_docs/` is the source of truth.
65
- - Vision, analysis, audit, handoff, test strategy, and feature history are maintained locally.
66
-
67
- Hybrid/devPNT:
68
-
69
- - devPNT governs `M-VISION`, Master Plan, Action Plan, and versioned artifacts.
70
- - `ai_docs/` remains useful as readable context, fallback, handoff, or shadow copy.
71
- - Divergence between user request, local Vision, and devPNT `M-VISION` must be surfaced before implementation.
72
-
73
- ## Gemini Extension Alternative
74
-
75
- You can still install this folder as a Gemini extension:
76
-
77
- ```bash
78
- gemini extensions install .
79
- ```
80
-
81
- For native Gemini Agent Skills, the npm installer now copies the skill folder into `~/.gemini/skills/agentic-sdlc/`.
82
-
83
- ## Created By
84
-
85
- Created by **Antonio Pinto** ([GitHub](https://github.com/Antoneeo)).
86
-
87
- (c) 2026 Antonio Pinto. All rights reserved.
1
+ # Agentic SDLC Skill for Claude Code, Gemini CLI, Google Antigravity & Codex
2
+
3
+ `agentic-sdlc` is a Documentation-First SDLC protocol for AI coding agents. It supports Claude Code, Codex, Gemini CLI, Google Antigravity 2.0, Cursor/Windsurf-style project instructions, and optional devPNT governance.
4
+
5
+ ## Key Features
6
+
7
+ - **Risk-proportional workflow**: L1/L2/L3/Spike triage avoids heavyweight process for trivial work.
8
+ - **Vision-guided governance**: Standalone projects use `ai_docs/vision/`; Hybrid projects use devPNT `M-VISION` as the milestone north star.
9
+ - **Standalone complete**: works fully with local `ai_docs/` without requiring devPNT.
10
+ - **devPNT symbiosis**: when devPNT is available, Master Plan, Action Plan, M-VISION, and governed artifacts become the authoritative planning layer.
11
+ - **Installed support files**: Claude, Codex, Gemini, and Google Antigravity receive the full skill folder, including `templates.md`, `guides.md`, `tdd.md`, `debugging.md`, `elicitation.md`, `review.md`, `dispatch.md`, `ENFORCEMENT.md`, and `scripts/sdlc_check.py`; an agent-global KB at `~/.agentic-sdlc` shares the same engine cross-project.
12
+ - **Mechanical checks**: optional validator for document structure, generated feature history, stale audit areas, and protected-path gates.
13
+
14
+ ## Installation
15
+
16
+ ### Via npm
17
+
18
+ ```bash
19
+ npm install -g @antoneeo/agentic-sdlc-skill@latest
20
+ agentic-sdlc-install-skill
21
+ ```
22
+
23
+ The installer copies `skills/agentic-sdlc-skill/` recursively into native skill locations:
24
+
25
+ - Claude Code: `~/.claude/skills/agentic-sdlc/`
26
+ - Codex: `~/.codex/skills/agentic-sdlc/`
27
+ - Gemini CLI: `~/.gemini/skills/agentic-sdlc/`
28
+ - Google Antigravity: `~/.gemini/config/skills/agentic-sdlc/` (detected distinctly from Gemini CLI; override the home with `ANTIGRAVITY_HOME`)
29
+
30
+ Restart the relevant agent, or reload skills where the CLI supports it.
31
+
32
+ The global package also exposes:
33
+
34
+ ```bash
35
+ agentic-sdlc-init
36
+ ```
37
+
38
+ Run it inside a project to create `ai_docs/`, Vision documents, strategic docs, audit plan, and agent protocol files (`AGENTS.md` — also the Antigravity CLI surface, `CLAUDE.md`, `GEMINI.md`, `.cursorrules`).
39
+
40
+ ## Runtime Shape
41
+
42
+ The actual runtime skill is the folder:
43
+
44
+ ```text
45
+ skills/agentic-sdlc-skill/
46
+ ├── SKILL.md
47
+ ├── templates.md
48
+ ├── guides.md
49
+ ├── tdd.md
50
+ ├── debugging.md
51
+ ├── elicitation.md
52
+ ├── review.md
53
+ ├── dispatch.md
54
+ ├── ENFORCEMENT.md
55
+ └── scripts/
56
+ └── sdlc_check.py
57
+ ```
58
+
59
+ `SKILL.md` is the entrypoint. Supporting files are loaded or executed only when the agent needs them.
60
+
61
+ ## Standalone vs Hybrid
62
+
63
+ Standalone:
64
+
65
+ - `ai_docs/` is the source of truth.
66
+ - Vision, analysis, audit, handoff, test strategy, and feature history are maintained locally.
67
+
68
+ Hybrid/devPNT:
69
+
70
+ - devPNT governs `M-VISION`, Master Plan, Action Plan, and versioned artifacts.
71
+ - `ai_docs/` remains useful as readable context, fallback, handoff, or shadow copy.
72
+ - Divergence between user request, local Vision, and devPNT `M-VISION` must be surfaced before implementation.
73
+
74
+ ## Gemini Extension Alternative
75
+
76
+ You can still install this folder as a Gemini extension:
77
+
78
+ ```bash
79
+ gemini extensions install .
80
+ ```
81
+
82
+ For native Gemini Agent Skills, the npm installer now copies the skill folder into `~/.gemini/skills/agentic-sdlc/`.
83
+
84
+ ## Created By
85
+
86
+ Created by **Antonio Pinto** ([GitHub](https://github.com/Antoneeo)).
87
+
88
+ (c) 2026 Antonio Pinto. All rights reserved.
@@ -1,6 +1,6 @@
1
- {
2
- "name": "agentic-sdlc-skill",
3
- "version": "1.10.0",
4
- "description": "Documentation-First SDLC protocol with triage, Vision governance and optional devPNT integration.",
5
- "author": "Antonio Pinto (https://github.com/Antoneeo)"
6
- }
1
+ {
2
+ "name": "agentic-sdlc-skill",
3
+ "version": "1.12.0",
4
+ "description": "Documentation-First SDLC protocol with triage, Vision governance and optional devPNT integration.",
5
+ "author": "Antonio Pinto (https://github.com/Antoneeo)"
6
+ }
package/package.json CHANGED
@@ -1,43 +1,46 @@
1
- {
2
- "name": "@antoneeo/agentic-sdlc-skill",
3
- "version": "1.10.0",
4
- "description": "Documentation-First SDLC protocol for Claude Code, Gemini CLI and Codex with risk triage, Vision governance, installed support files and optional devPNT integration.",
5
- "keywords": [
6
- "claude-code",
7
- "claude-skill",
8
- "gemini-cli",
9
- "skill",
10
- "sdlc",
11
- "documentation",
12
- "ai-agent"
13
- ],
14
- "author": "Antonio Pinto (https://github.com/Antoneeo)",
15
- "license": "MIT",
16
- "publishConfig": {
17
- "access": "public"
18
- },
19
- "bin": {
20
- "agentic-sdlc-init": "scripts/init.js",
21
- "agentic-sdlc-install-skill": "scripts/postinstall.js"
22
- },
23
- "scripts": {
24
- "postinstall": "node scripts/postinstall.js",
25
- "preuninstall": "node scripts/preuninstall.js"
26
- },
27
- "files": [
28
- "skills/agentic-sdlc-skill/SKILL.md",
29
- "skills/agentic-sdlc-skill/templates.md",
30
- "skills/agentic-sdlc-skill/guides.md",
31
- "skills/agentic-sdlc-skill/tdd.md",
32
- "skills/agentic-sdlc-skill/debugging.md",
33
- "skills/agentic-sdlc-skill/elicitation.md",
34
- "skills/agentic-sdlc-skill/review.md",
35
- "skills/agentic-sdlc-skill/dispatch.md",
36
- "skills/agentic-sdlc-skill/ENFORCEMENT.md",
37
- "skills/agentic-sdlc-skill/scripts/sdlc_check.py",
38
- "gemini-extension.json",
39
- "README.md",
40
- "CHANGELOG.md",
41
- "scripts"
42
- ]
43
- }
1
+ {
2
+ "name": "@antoneeo/agentic-sdlc-skill",
3
+ "version": "1.12.0",
4
+ "description": "Documentation-First SDLC protocol for Claude Code, Gemini CLI, Google Antigravity and Codex with risk triage, Vision governance, installed support files and optional devPNT integration.",
5
+ "keywords": [
6
+ "claude-code",
7
+ "claude-skill",
8
+ "gemini-cli",
9
+ "skill",
10
+ "sdlc",
11
+ "documentation",
12
+ "ai-agent"
13
+ ],
14
+ "author": "Antonio Pinto (https://github.com/Antoneeo)",
15
+ "license": "MIT",
16
+ "publishConfig": {
17
+ "access": "public"
18
+ },
19
+ "bin": {
20
+ "agentic-sdlc-init": "scripts/init.js",
21
+ "agentic-sdlc-install-skill": "scripts/postinstall.js"
22
+ },
23
+ "scripts": {
24
+ "postinstall": "node scripts/postinstall.js",
25
+ "preuninstall": "node scripts/preuninstall.js"
26
+ },
27
+ "files": [
28
+ "skills/agentic-sdlc-skill/SKILL.md",
29
+ "skills/agentic-sdlc-skill/templates.md",
30
+ "skills/agentic-sdlc-skill/guides.md",
31
+ "skills/agentic-sdlc-skill/tdd.md",
32
+ "skills/agentic-sdlc-skill/debugging.md",
33
+ "skills/agentic-sdlc-skill/elicitation.md",
34
+ "skills/agentic-sdlc-skill/review.md",
35
+ "skills/agentic-sdlc-skill/dispatch.md",
36
+ "skills/agentic-sdlc-skill/ENFORCEMENT.md",
37
+ "skills/agentic-sdlc-skill/scripts/sdlc_check.py",
38
+ "gemini-extension.json",
39
+ "README.md",
40
+ "CHANGELOG.md",
41
+ "scripts/lib.js",
42
+ "scripts/init.js",
43
+ "scripts/postinstall.js",
44
+ "scripts/preuninstall.js"
45
+ ]
46
+ }
package/scripts/init.js CHANGED
@@ -1,153 +1,154 @@
1
- #!/usr/bin/env node
2
-
3
- const fs = require('fs');
4
- const path = require('path');
5
- const { execSync } = require('child_process');
6
- const { SKILL_SOURCE, CLIENTS, clientDetected, loadTemplates, templateFor } = require('./lib');
7
-
8
- const cwd = process.cwd();
9
-
10
- // 1. Directory layout (canonical ai_docs structure, including reference/)
11
- const directories = [
12
- 'ai_docs',
13
- 'ai_docs/vision',
14
- 'ai_docs/vision/features',
15
- 'ai_docs/reference',
16
- 'ai_docs/strategic',
17
- 'ai_docs/audit',
18
- 'ai_docs/solutions',
19
- ].map((d) => path.join(cwd, d));
20
-
21
- // 2. Project protocol (thin pointer — the operating contract is the skill).
22
- // Deliberately short: duplicating the skill's rules here made them drift.
23
- const protocolContent = `# Agentic SDLC — Project Protocol (pointer)
24
-
25
- This project follows the Agentic SDLC Documentation-First process. The full
26
- operating contract is the \`agentic-sdlc\` skill (installed in your agent's
27
- skills directory); this file is only the minimal always-on pointer.
28
-
29
- ## Rule Zero — Triage every request
30
- - L1 Trivial: ~10 lines, 1-2 files, no API/dependency/behavior change. Implement + run existing tests; no docs.
31
- - L2 Small: clear root cause, at most 3 files, low risk. Mini-analysis in the reply; tests mandatory.
32
- - L3 Significant: >3 files, APIs/contracts, new dependency, user-visible behavior, security-sensitive area, or architectural change. Full workflow via the skill: Vision Gate -> ANALYSIS -> plan -> implement -> test -> closure.
33
- - Spike: time-boxed exploration; outcome in \`ai_docs/solutions/SPIKE_[topic].md\`; reclassify for production.
34
- - Security-sensitive areas (external input parsing, authN/authZ, crypto, network, personal data, filesystem) are never L1.
35
- - When in doubt, pick the higher level. Declare the chosen level when starting.
36
-
37
- ## Where things live
38
- - Vision (gate for L3): \`ai_docs/vision/\` — \`Status: DRAFT\` informs, \`Status: APPROVED\` binds.
39
- - Feature analyses: \`ai_docs/solutions/ANALYSIS_[feature].md\` (frontmatter = feature state).
40
- - Must-reads: \`ai_docs/README.md\`; full generated manifest: \`ai_docs/INDEX.md\`.
41
- - If devPNT is available for this project, its M-VISION / plans / governed artifacts take over (Hybrid mode — see the skill).
42
-
43
- ## Closure gate
44
- Docs travel in the same commit/PR as the code they describe. If the project
45
- adopts the validator, \`python <skill_dir>/scripts/sdlc_check.py check\` must be
46
- CLEAN before declaring work done.
47
-
48
- If the agentic-sdlc skill is not available in this client, ask the user to install it:
49
- \`npm i -g @antoneeo/agentic-sdlc-skill && agentic-sdlc-install-skill\`
50
- `;
51
-
52
- console.log('🚀 Initializing Agentic SDLC workflow...');
53
-
54
- // 3. Load templates from the single source (skill's templates.md)
55
- let sections;
56
- try {
57
- sections = loadTemplates();
58
- } catch (err) {
59
- console.error(`❌ Cannot load templates: ${err.message}`);
60
- process.exit(1);
61
- }
62
-
63
- // audit_plan: the template block carries illustrative rows; a fresh project
64
- // starts from a single root PENDING row instead.
65
- function initialAuditPlan() {
66
- const tpl = templateFor(sections, 'audit_plan.md');
67
- const lines = tpl.split('\n');
68
- const sepIdx = lines.findIndex((l) => /^\|[-\s|:]+\|$/.test(l.trim()));
69
- if (sepIdx === -1) return tpl; // unexpected shape: keep the template as-is
70
- return lines.slice(0, sepIdx + 1).join('\n') + '\n| / | PENDING | - | Initial analysis |\n';
71
- }
72
-
73
- let seedFiles;
74
- try {
75
- seedFiles = [
76
- ['ai_docs/README.md', templateFor(sections, 'ai_docs/README.md')],
77
- ['ai_docs/vision/project_vision.md', templateFor(sections, 'project_vision.md')],
78
- ['ai_docs/vision/roadmap.md', templateFor(sections, 'vision/roadmap.md')],
79
- ['ai_docs/vision/principles.md', templateFor(sections, 'principles.md')],
80
- ['ai_docs/strategic/architecture.md', templateFor(sections, 'architecture.md and existing_features.md', 0)],
81
- ['ai_docs/strategic/existing_features.md', templateFor(sections, 'architecture.md and existing_features.md', 1)],
82
- ['ai_docs/audit/audit_plan.md', initialAuditPlan()],
83
- // NOTE: features_history.md and INDEX.md are NOT seeded — they are
84
- // generated by `sdlc_check.py index` and would immediately fail validate.
85
- ];
86
- } catch (err) {
87
- console.error(`❌ ${err.message}`);
88
- process.exit(1);
89
- }
90
-
91
- // 4. Create directories
92
- directories.forEach((dir) => {
93
- if (!fs.existsSync(dir)) {
94
- fs.mkdirSync(dir, { recursive: true });
95
- console.log(`📁 Created directory: ${path.relative(cwd, dir)}`);
96
- }
97
- });
98
-
99
- // 5. Write seed files (never overwrite)
100
- const writeIfNotExists = (relPath, content, description) => {
101
- const filePath = path.join(cwd, relPath);
102
- if (!fs.existsSync(filePath)) {
103
- fs.writeFileSync(filePath, content, 'utf8');
104
- console.log(`📄 Created file: ${relPath}${description ? ` (${description})` : ''}`);
105
- return true;
106
- }
107
- console.log(`⏭️ Skipped: ${relPath} already exists.`);
108
- return false;
109
- };
110
-
111
- seedFiles.forEach(([relPath, content]) => writeIfNotExists(relPath, content));
112
-
113
- // 6. Client discovery and protocol pointers
114
- console.log('\n--- Environment Analysis ---');
115
-
116
- const protocolFiles = {
117
- claude: 'CLAUDE.md',
118
- gemini: 'GEMINI.md',
119
- codex: 'AGENTS.md',
120
- };
121
-
122
- for (const client of CLIENTS) {
123
- if (clientDetected(client)) {
124
- console.log(`✅ ${client.label} detected.`);
125
- writeIfNotExists(protocolFiles[client.key], protocolContent, `${client.label} protocol pointer`);
126
- }
127
- }
128
-
129
- // Cursor/Windsurf (always recommended)
130
- writeIfNotExists('.cursorrules', protocolContent, 'Cursor/Windsurf rules');
131
-
132
- // 7. Generate ai_docs/INDEX.md so the very first `validate` is already clean.
133
- // The manifest is generated, never seeded: delegate to the validator if Python is available.
134
- const validator = path.join(SKILL_SOURCE, 'scripts', 'sdlc_check.py');
135
- let indexed = false;
136
- for (const py of ['python', 'python3', 'py']) {
137
- try {
138
- execSync(`${py} "${validator}" index --root "${cwd}"`, { stdio: 'ignore' });
139
- console.log('📇 Generated ai_docs/INDEX.md (document manifest).');
140
- indexed = true;
141
- break;
142
- } catch (e) { /* try the next interpreter */ }
143
- }
144
- if (!indexed) {
145
- console.log('ℹ️ Python not found: generate the manifest later with '
146
- + '"python <skill_dir>/scripts/sdlc_check.py index" (validate reports it until then).');
147
- }
148
-
149
- console.log('\n✅ Setup completed successfully!');
150
- console.log('💡 Next steps:');
151
- console.log(' 1. Make sure the agentic-sdlc skill is installed (agentic-sdlc-install-skill).');
152
- console.log(' 2. Restart/open the project in your AI client so it reads the protocol pointer.');
153
- console.log(' 3. Start with an audit following ai_docs/audit/audit_plan.md.');
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+ const { execSync } = require('child_process');
6
+ const { SKILL_SOURCE, CLIENTS, clientDetected, loadTemplates, templateFor } = require('./lib');
7
+
8
+ const cwd = process.cwd();
9
+
10
+ // 1. Directory layout (canonical ai_docs structure, including reference/)
11
+ const directories = [
12
+ 'ai_docs',
13
+ 'ai_docs/vision',
14
+ 'ai_docs/vision/features',
15
+ 'ai_docs/reference',
16
+ 'ai_docs/strategic',
17
+ 'ai_docs/audit',
18
+ 'ai_docs/solutions',
19
+ ].map((d) => path.join(cwd, d));
20
+
21
+ // 2. Project protocol (thin pointer — the operating contract is the skill).
22
+ // Deliberately short: duplicating the skill's rules here made them drift.
23
+ const protocolContent = `# Agentic SDLC — Project Protocol (pointer)
24
+
25
+ This project follows the Agentic SDLC Documentation-First process. The full
26
+ operating contract is the \`agentic-sdlc\` skill (installed in your agent's
27
+ skills directory); this file is only the minimal always-on pointer.
28
+
29
+ ## Rule Zero — Triage every request
30
+ - L1 Trivial: ~10 lines, 1-2 files, no API/dependency/behavior change. Implement + run existing tests; no docs.
31
+ - L2 Small: clear root cause, at most 3 files, low risk. Mini-analysis in the reply; tests mandatory.
32
+ - L3 Significant: >3 files, APIs/contracts, new dependency, user-visible behavior, security-sensitive area, or architectural change. Full workflow via the skill: Vision Gate -> ANALYSIS -> plan -> implement -> test -> closure.
33
+ - Spike: time-boxed exploration; outcome in \`ai_docs/solutions/SPIKE_[topic].md\`; reclassify for production.
34
+ - Security-sensitive areas (external input parsing, authN/authZ, crypto, network, personal data, filesystem) are never L1.
35
+ - When in doubt, pick the higher level. Declare the chosen level when starting.
36
+
37
+ ## Where things live
38
+ - Vision (gate for L3): \`ai_docs/vision/\` — \`Status: DRAFT\` informs, \`Status: APPROVED\` binds.
39
+ - Feature analyses: \`ai_docs/solutions/ANALYSIS_[feature].md\` (frontmatter = feature state).
40
+ - Must-reads: \`ai_docs/README.md\`; full generated manifest: \`ai_docs/INDEX.md\`.
41
+ - If devPNT is available for this project, its M-VISION / plans / governed artifacts take over (Hybrid mode — see the skill).
42
+
43
+ ## Closure gate
44
+ Docs travel in the same commit/PR as the code they describe. If the project
45
+ adopts the validator, \`python <skill_dir>/scripts/sdlc_check.py check\` must be
46
+ CLEAN before declaring work done.
47
+
48
+ If the agentic-sdlc skill is not available in this client, ask the user to install it:
49
+ \`npm i -g @antoneeo/agentic-sdlc-skill && agentic-sdlc-install-skill\`
50
+ `;
51
+
52
+ console.log('🚀 Initializing Agentic SDLC workflow...');
53
+
54
+ // 3. Load templates from the single source (skill's templates.md)
55
+ let sections;
56
+ try {
57
+ sections = loadTemplates();
58
+ } catch (err) {
59
+ console.error(`❌ Cannot load templates: ${err.message}`);
60
+ process.exit(1);
61
+ }
62
+
63
+ // audit_plan: the template block carries illustrative rows; a fresh project
64
+ // starts from a single root PENDING row instead.
65
+ function initialAuditPlan() {
66
+ const tpl = templateFor(sections, 'audit_plan.md');
67
+ const lines = tpl.split('\n');
68
+ const sepIdx = lines.findIndex((l) => /^\|[-\s|:]+\|$/.test(l.trim()));
69
+ if (sepIdx === -1) return tpl; // unexpected shape: keep the template as-is
70
+ return lines.slice(0, sepIdx + 1).join('\n') + '\n| / | PENDING | - | Initial analysis |\n';
71
+ }
72
+
73
+ let seedFiles;
74
+ try {
75
+ seedFiles = [
76
+ ['ai_docs/README.md', templateFor(sections, 'ai_docs/README.md')],
77
+ ['ai_docs/vision/project_vision.md', templateFor(sections, 'project_vision.md')],
78
+ ['ai_docs/vision/roadmap.md', templateFor(sections, 'vision/roadmap.md')],
79
+ ['ai_docs/vision/principles.md', templateFor(sections, 'principles.md')],
80
+ ['ai_docs/strategic/architecture.md', templateFor(sections, 'architecture.md and existing_features.md', 0)],
81
+ ['ai_docs/strategic/existing_features.md', templateFor(sections, 'architecture.md and existing_features.md', 1)],
82
+ ['ai_docs/audit/audit_plan.md', initialAuditPlan()],
83
+ // NOTE: features_history.md and INDEX.md are NOT seeded — they are
84
+ // generated by `sdlc_check.py index` and would immediately fail validate.
85
+ ];
86
+ } catch (err) {
87
+ console.error(`❌ ${err.message}`);
88
+ process.exit(1);
89
+ }
90
+
91
+ // 4. Create directories
92
+ directories.forEach((dir) => {
93
+ if (!fs.existsSync(dir)) {
94
+ fs.mkdirSync(dir, { recursive: true });
95
+ console.log(`📁 Created directory: ${path.relative(cwd, dir)}`);
96
+ }
97
+ });
98
+
99
+ // 5. Write seed files (never overwrite)
100
+ const writeIfNotExists = (relPath, content, description) => {
101
+ const filePath = path.join(cwd, relPath);
102
+ if (!fs.existsSync(filePath)) {
103
+ fs.writeFileSync(filePath, content, 'utf8');
104
+ console.log(`📄 Created file: ${relPath}${description ? ` (${description})` : ''}`);
105
+ return true;
106
+ }
107
+ console.log(`⏭️ Skipped: ${relPath} already exists.`);
108
+ return false;
109
+ };
110
+
111
+ seedFiles.forEach(([relPath, content]) => writeIfNotExists(relPath, content));
112
+
113
+ // 6. Client discovery and protocol pointers
114
+ console.log('\n--- Environment Analysis ---');
115
+
116
+ const protocolFiles = {
117
+ claude: 'CLAUDE.md',
118
+ gemini: 'GEMINI.md',
119
+ codex: 'AGENTS.md',
120
+ antigravity: 'AGENTS.md', // Antigravity CLI reads AGENTS.md; single protocolContent reused.
121
+ };
122
+
123
+ for (const client of CLIENTS) {
124
+ if (clientDetected(client)) {
125
+ console.log(`✅ ${client.label} detected.`);
126
+ writeIfNotExists(protocolFiles[client.key], protocolContent, `${client.label} protocol pointer`);
127
+ }
128
+ }
129
+
130
+ // Cursor/Windsurf (always recommended)
131
+ writeIfNotExists('.cursorrules', protocolContent, 'Cursor/Windsurf rules');
132
+
133
+ // 7. Generate ai_docs/INDEX.md so the very first `validate` is already clean.
134
+ // The manifest is generated, never seeded: delegate to the validator if Python is available.
135
+ const validator = path.join(SKILL_SOURCE, 'scripts', 'sdlc_check.py');
136
+ let indexed = false;
137
+ for (const py of ['python', 'python3', 'py']) {
138
+ try {
139
+ execSync(`${py} "${validator}" index --root "${cwd}"`, { stdio: 'ignore' });
140
+ console.log('📇 Generated ai_docs/INDEX.md (document manifest).');
141
+ indexed = true;
142
+ break;
143
+ } catch (e) { /* try the next interpreter */ }
144
+ }
145
+ if (!indexed) {
146
+ console.log('ℹ️ Python not found: generate the manifest later with '
147
+ + '"python <skill_dir>/scripts/sdlc_check.py index" (validate reports it until then).');
148
+ }
149
+
150
+ console.log('\n✅ Setup completed successfully!');
151
+ console.log('💡 Next steps:');
152
+ console.log(' 1. Make sure the agentic-sdlc skill is installed (agentic-sdlc-install-skill).');
153
+ console.log(' 2. Restart/open the project in your AI client so it reads the protocol pointer.');
154
+ console.log(' 3. Start with an audit following ai_docs/audit/audit_plan.md.');