@dzhechkov/p-replicator 1.0.1 → 1.1.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 (19) hide show
  1. package/README.md +25 -3
  2. package/package.json +6 -3
  3. package/src/commands/doctor.js +2 -2
  4. package/src/commands/list.js +1 -1
  5. package/templates/.claude/rules/replicate-pipeline.md +13 -1
  6. package/templates/.claude/rules/skill-interface-protocol.md +148 -0
  7. package/templates/.claude/skills/cc-toolkit-generator-enhanced/SKILL.md +116 -63
  8. package/templates/.claude/skills/cc-toolkit-generator-enhanced/modules/01-detect-parse.md +329 -0
  9. package/templates/.claude/skills/cc-toolkit-generator-enhanced/modules/02-analyze-map.md +449 -0
  10. package/templates/.claude/skills/cc-toolkit-generator-enhanced/modules/03-generate-p0.md +630 -0
  11. package/templates/.claude/skills/cc-toolkit-generator-enhanced/modules/04-generate-p1.md +537 -0
  12. package/templates/.claude/skills/cc-toolkit-generator-enhanced/modules/05-generate-p2p3.md +512 -0
  13. package/templates/.claude/skills/cc-toolkit-generator-enhanced/modules/06-package-deliver.md +710 -0
  14. package/templates/.claude/skills/cc-toolkit-generator-enhanced/modules/07-harvest-feedback.md +286 -0
  15. package/templates/.claude/skills/cc-toolkit-generator-enhanced/modules/08-skill-composition.md +378 -0
  16. package/templates/.claude/skills/cc-toolkit-generator-enhanced/modules/09-cross-project-learning.md +461 -0
  17. package/templates/.claude/skills/cc-toolkit-generator-enhanced/modules/README.md +83 -0
  18. package/templates/.claude/skills/cc-toolkit-generator-enhanced/references/maturity-integration.md +198 -0
  19. package/templates/.claude/skills/pipeline-forge/references/self-extracted-patterns.md +260 -0
@@ -0,0 +1,329 @@
1
+ # Module: Detect & Parse
2
+
3
+ Phase 1 of the CC-Toolkit-Generator Enhanced pipeline.
4
+ Scans the documentation directory, detects the pipeline type, identifies project
5
+ characteristics, and builds the Internal Project Model (IPM) used by all
6
+ subsequent modules.
7
+
8
+ ---
9
+
10
+ ## Input
11
+
12
+ | Parameter | Type | Description |
13
+ |-----------|------|-------------|
14
+ | `docs_path` | string | Path to documentation directory. In Claude.ai context this is `/mnt/user-data/uploads/`. In Claude Code / replicate context this is `docs/` (project root). |
15
+
16
+ No prior module output is required. This is the foundation module.
17
+
18
+ ---
19
+
20
+ ## Process
21
+
22
+ ### Step 1: Scan for Documents
23
+
24
+ Scan `docs_path` recursively and catalog every file by category.
25
+
26
+ ```
27
+ SCAN docs_path FOR:
28
+ # SPARC pipeline files (top-level or docs/)
29
+ PRD.md
30
+ Solution_Strategy.md
31
+ Specification.md
32
+ Pseudocode.md
33
+ Architecture.md
34
+ Refinement.md
35
+ Completion.md
36
+ Research_Findings.md
37
+ Final_Summary.md
38
+ CLAUDE.md # base CLAUDE.md from docs, if present
39
+
40
+ # idea2prd-manual pipeline files
41
+ docs/prd/PRD.md
42
+ docs/ddd/strategic/ # bounded-contexts.md, context-map.md
43
+ docs/ddd/tactical/ # aggregates/, entities/, value-objects/, events/, repositories/
44
+ docs/adr/*.md # ADR-001-*.md, ADR-002-*.md, ...
45
+ docs/c4/*.mermaid # context.mermaid, container.mermaid, component.mermaid
46
+ docs/pseudocode/*.pseudo
47
+ docs/tests/*.feature # Gherkin scenarios
48
+ docs/fitness/*.md # fitness-functions.md
49
+ docs/completion/COMPLETION_CHECKLIST.md
50
+ docs/INDEX.md
51
+
52
+ # .ai-context integration files
53
+ .ai-context/README.md
54
+ .ai-context/architecture-summary.md
55
+ .ai-context/key-decisions.md
56
+ .ai-context/domain-glossary.md
57
+ .ai-context/bounded-contexts.md
58
+ .ai-context/coding-standards.md
59
+ .ai-context/fitness-rules.md
60
+ .ai-context/pseudocode-index.md
61
+ ```
62
+
63
+ If **no documents found at all**: halt and ask the user to upload SPARC or
64
+ idea2prd documentation.
65
+
66
+ ### Step 2: Detect Pipeline Type
67
+
68
+ Apply the following detection logic in priority order:
69
+
70
+ ```python
71
+ def detect_pipeline(docs_path: str) -> str:
72
+ has_ddd = exists(f"{docs_path}/docs/ddd/")
73
+ has_ai_context = exists(f"{docs_path}/.ai-context/")
74
+ has_gherkin = glob(f"{docs_path}/docs/tests/*.feature")
75
+ has_adr = len(glob(f"{docs_path}/docs/adr/*.md")) > 5
76
+ has_sparc_arch = exists(f"{docs_path}/Architecture.md")
77
+ has_sparc_sol = exists(f"{docs_path}/Solution_Strategy.md")
78
+
79
+ if has_ddd and has_ai_context:
80
+ return "IDEA2PRD_FULL" # Complete idea2prd-manual output
81
+ elif has_ddd or has_adr:
82
+ return "IDEA2PRD_PARTIAL" # Partial idea2prd output
83
+ elif has_sparc_arch and has_sparc_sol:
84
+ return "SPARC" # Full SPARC documentation set
85
+ elif has_sparc_arch:
86
+ return "SPARC_MINIMAL" # Architecture.md only
87
+ else:
88
+ return "MINIMAL" # Basic PRD only, or mixed
89
+ ```
90
+
91
+ | Pipeline | Minimum Docs | Typical File Count |
92
+ |----------|-------------|-------------------|
93
+ | IDEA2PRD_FULL | `docs/ddd/` + `.ai-context/` | 30-50 files |
94
+ | IDEA2PRD_PARTIAL | `docs/ddd/` or `docs/adr/` (>5) | 15-30 files |
95
+ | SPARC | `Architecture.md` + `Solution_Strategy.md` | 8-11 files |
96
+ | SPARC_MINIMAL | `Architecture.md` only | 2-5 files |
97
+ | MINIMAL | PRD.md only | 1-3 files |
98
+
99
+ ### Step 3: Detect Project Characteristics
100
+
101
+ Scan detected documents for four characteristic flags. These drive conditional
102
+ generation in later modules.
103
+
104
+ #### 3a. `has_external_apis`
105
+
106
+ ```
107
+ SCAN Architecture.md, Specification.md, ADR-*-integration.md,
108
+ context-map.md, repositories/*.md FOR:
109
+ keywords: "API", "integration", "external", "REST", "GraphQL",
110
+ "webhook", "third-party", "OAuth", "Stripe", "Twilio",
111
+ "SendGrid", "OpenAI", "payment", "SMS"
112
+
113
+ IF any keyword found → has_external_apis = true
114
+ ```
115
+
116
+ #### 3b. `has_database`
117
+
118
+ ```
119
+ SCAN Architecture.md, Specification.md, docker-compose.yml,
120
+ ADR-*-data.md, repositories/*.md FOR:
121
+ keywords: "PostgreSQL", "Postgres", "MongoDB", "MySQL", "Redis",
122
+ "database", "Prisma", "TypeORM", "Drizzle", "Knex",
123
+ "migration", "schema", "SQLite"
124
+
125
+ IF any keyword found → has_database = true
126
+ ALSO EXTRACT: db_type (postgres|mongo|mysql|redis|sqlite)
127
+ orm_name (prisma|typeorm|drizzle|knex|raw)
128
+ ```
129
+
130
+ #### 3c. `monorepo_packages`
131
+
132
+ ```
133
+ SCAN Architecture.md FOR:
134
+ - Monorepo structure section
135
+ - packages/ or apps/ directory listings
136
+ - Workspace configuration references
137
+
138
+ EXTRACT: list of package names and paths
139
+ e.g. ["packages/shared", "packages/backend", "packages/frontend"]
140
+
141
+ IF structure mentions single app (e.g. "Next.js app") →
142
+ monorepo_packages = ["apps/web"] or similar minimal list
143
+ ```
144
+
145
+ #### 3d. `docker_services`
146
+
147
+ ```
148
+ SCAN Architecture.md, docker-compose.yml, Completion.md FOR:
149
+ - Docker Compose service definitions
150
+ - Service names and ports
151
+
152
+ EXTRACT: list of service names
153
+ e.g. ["frontend", "backend", "postgres", "redis"]
154
+ ```
155
+
156
+ ### Step 4: Build Internal Project Model (IPM)
157
+
158
+ Assemble all detection results into a structured IPM object:
159
+
160
+ ```
161
+ IPM = {
162
+ pipeline_type: "SPARC" | "SPARC_MINIMAL" | "IDEA2PRD_FULL" |
163
+ "IDEA2PRD_PARTIAL" | "MINIMAL",
164
+
165
+ detected_docs: {
166
+ sparc: {
167
+ prd: path | null,
168
+ solution_strategy: path | null,
169
+ specification: path | null,
170
+ pseudocode: path | null,
171
+ architecture: path | null,
172
+ refinement: path | null,
173
+ completion: path | null,
174
+ research_findings: path | null,
175
+ final_summary: path | null,
176
+ claude_md: path | null
177
+ },
178
+ idea2prd: {
179
+ prd: path | null,
180
+ ddd_strategic: [paths] | [],
181
+ ddd_tactical: {
182
+ aggregates: [paths] | [],
183
+ entities: [paths] | [],
184
+ value_objects: [paths] | [],
185
+ events: [paths] | [],
186
+ repositories: [paths] | []
187
+ },
188
+ adrs: [paths] | [],
189
+ c4_diagrams: [paths] | [],
190
+ pseudocode: [paths] | [],
191
+ gherkin_tests: [paths] | [],
192
+ fitness: [paths] | [],
193
+ completion: path | null
194
+ },
195
+ ai_context: {
196
+ readme: path | null,
197
+ architecture: path | null,
198
+ key_decisions: path | null,
199
+ domain_glossary: path | null,
200
+ bounded_contexts: path | null,
201
+ coding_standards: path | null,
202
+ fitness_rules: path | null,
203
+ pseudocode_index: path | null
204
+ }
205
+ },
206
+
207
+ project_characteristics: {
208
+ has_external_apis: bool,
209
+ has_database: bool,
210
+ db_type: string | null,
211
+ orm_name: string | null,
212
+ monorepo_packages: [string],
213
+ docker_services: [string],
214
+
215
+ // Derived flags (computed from detected_docs)
216
+ has_ddd: bool, // detected_docs.idea2prd.ddd_strategic non-empty
217
+ has_ddd_strategic: bool, // same as has_ddd (alias for readability)
218
+ has_gherkin: bool, // detected_docs.idea2prd.gherkin_tests non-empty
219
+ has_fitness: bool, // detected_docs.idea2prd.fitness non-empty
220
+ has_adr: bool, // detected_docs.idea2prd.adr length > 0
221
+ has_c4: bool, // detected_docs.idea2prd.c4 non-empty
222
+ has_ai_context: bool, // detected_docs.ai_context.readme non-null
223
+ has_pseudocode: bool, // detected_docs.sparc.pseudocode OR idea2prd.pseudocode non-null
224
+ has_authentication: bool // keywords "auth", "login", "JWT", "OAuth" found in docs
225
+ },
226
+
227
+ metadata: {
228
+ total_docs_found: int,
229
+ scan_timestamp: ISO-8601 string,
230
+ docs_path: string
231
+ }
232
+ }
233
+ ```
234
+
235
+ ### Step 5: MANUAL Mode Checkpoint (optional)
236
+
237
+ In MANUAL mode, present the detection results for user review:
238
+
239
+ ```
240
+ ================================================================
241
+ CHECKPOINT 1: Document Detection Review
242
+ ================================================================
243
+
244
+ Pipeline Detected: SPARC
245
+ Documents Found: 11 files
246
+
247
+ SPARC Documents:
248
+ [x] PRD.md docs/PRD.md
249
+ [x] Solution_Strategy.md docs/Solution_Strategy.md
250
+ [x] Specification.md docs/Specification.md
251
+ [x] Pseudocode.md docs/Pseudocode.md
252
+ [x] Architecture.md docs/Architecture.md
253
+ [x] Refinement.md docs/Refinement.md
254
+ [x] Completion.md docs/Completion.md
255
+ [x] Research_Findings.md docs/Research_Findings.md
256
+ [x] Final_Summary.md docs/Final_Summary.md
257
+ [ ] CLAUDE.md (not found)
258
+
259
+ Project Characteristics:
260
+ has_external_apis: true (found: "Stripe", "OpenAI" in Architecture.md)
261
+ has_ddd: false (no docs/ddd/ found)
262
+ has_authentication: true (found: "JWT", "OAuth" in Specification.md)
263
+ has_database: true (PostgreSQL via Prisma)
264
+ monorepo_packages: packages/shared, packages/backend, packages/frontend
265
+ docker_services: frontend, backend, postgres
266
+
267
+ Commands: "ok" to proceed | "add [doc]" | "remove [doc]"
268
+ ================================================================
269
+ ```
270
+
271
+ Wait for user confirmation before passing IPM to Module 02.
272
+
273
+ ---
274
+
275
+ ## Output
276
+
277
+ | Field | Type | Description |
278
+ |-------|------|-------------|
279
+ | `ipm` | IPM object | Complete Internal Project Model as defined in Step 4 |
280
+
281
+ The IPM is the sole output of this module. It is consumed by:
282
+ - **Module 02 (Analyze & Map)** -- to determine scoring rules and instrument mapping
283
+ - **Module 03 (Generate P0)** -- to select conditional P0 items and fill templates
284
+ - **Module 04+ (Generate P1-P3)** -- to select optional instruments
285
+
286
+ ---
287
+
288
+ ## Quality Gate
289
+
290
+ All of the following must be satisfied before the IPM is considered valid:
291
+
292
+ | Check | Condition | Action on Failure |
293
+ |-------|-----------|-------------------|
294
+ | Minimum docs | SPARC: at least `PRD.md` + `Architecture.md` present | Halt. Ask user to upload missing docs. |
295
+ | Minimum docs | idea2prd: at least `docs/ddd/` directory present | Halt. Ask user to upload missing docs. |
296
+ | Pipeline resolved | `pipeline_type` is not ambiguous | If mixed signals, default to "SPARC" with unified mapping. |
297
+ | Characteristics scanned | All 4 characteristic flags have been evaluated | Re-scan if any flag is missing. |
298
+ | Paths valid | Every path in `detected_docs` points to an existing file | Remove invalid paths, log warnings. |
299
+ | Total docs > 0 | `metadata.total_docs_found` > 0 | Halt. No documents to process. |
300
+
301
+ ---
302
+
303
+ ## Dependencies
304
+
305
+ None. This is the foundation module with no upstream dependencies.
306
+
307
+ Files read during execution are the user's uploaded documentation, not skill
308
+ reference files.
309
+
310
+ ---
311
+
312
+ ## Reusability
313
+
314
+ This module can be reused by **any skill that needs to detect documentation type
315
+ and build a project model**, including:
316
+
317
+ - **Pipeline validation tools** that need to verify doc completeness
318
+ - **Documentation generators** that need to know what source material exists
319
+ - **Project analysis skills** that need to classify project type
320
+ - **Migration tools** that convert between documentation formats (e.g. SPARC to idea2prd)
321
+
322
+ The detection logic (Step 2) and characteristic scanning (Step 3) are
323
+ independent of the toolkit generator and can operate standalone. The IPM
324
+ schema (Step 4) serves as a universal interchange format for project metadata.
325
+
326
+ To reuse only the detection logic without the full IPM build:
327
+ 1. Run Steps 1-2 to get `pipeline_type`
328
+ 2. Optionally run Step 3 for characteristic flags
329
+ 3. Skip Step 4 if the full IPM structure is not needed