@pdlc-os/pdlc 0.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.
@@ -0,0 +1,371 @@
1
+ ---
2
+ description: Initialize PDLC for this project (run once)
3
+ ---
4
+
5
+ You are initializing the PDLC (Product Development Lifecycle) plugin for this project. Follow every step below in order. Do not skip steps.
6
+
7
+ ---
8
+
9
+ ## Step 1 — Check prerequisites
10
+
11
+ **1a. Verify Beads is installed.**
12
+
13
+ Run: `bd --version`
14
+
15
+ If the command is not found, stop and tell the user:
16
+
17
+ > "Beads (`bd`) is not installed. Please install it first:
18
+ > - npm: `npm install -g @beads/bd`
19
+ > - Homebrew: `brew install beads`
20
+ >
21
+ > Once installed, re-run `/pdlc init`."
22
+
23
+ Do not proceed until `bd --version` succeeds.
24
+
25
+ **1b. Verify a git repository exists.**
26
+
27
+ Run: `git status`
28
+
29
+ If the command returns a "not a git repository" error, stop and tell the user:
30
+
31
+ > "No git repository found. Please run `git init` (and make at least one commit) before running `/pdlc init`."
32
+
33
+ Do not proceed until `git status` succeeds.
34
+
35
+ ---
36
+
37
+ ## Step 2 — Detect brownfield repository
38
+
39
+ Check whether this is an existing repository with pre-existing source code, or a brand new empty project.
40
+
41
+ Run:
42
+ ```bash
43
+ git log --oneline -1 2>/dev/null && git ls-files | grep -v '^docs/pdlc/' | grep -v '^\.' | head -20
44
+ ```
45
+
46
+ **If the output shows no files** (empty repo or only dotfiles/config): this is a **greenfield project**. Skip to Step 3.
47
+
48
+ **If the output shows existing source files** (any `.js`, `.ts`, `.py`, `.rb`, `.go`, `.rs`, `.java`, `.cs`, `.html`, `.css`, or similar): this is a **brownfield project**.
49
+
50
+ For a brownfield project, tell the user:
51
+
52
+ > "I can see this repository already contains code. I can perform a deep scan of the existing codebase to automatically generate your memory bank with real content — existing features, architecture, decisions, and tech debt — rather than starting from blank templates.
53
+ >
54
+ > **Would you like me to scan the existing repository before we continue?** (yes/no)
55
+ >
56
+ > - **Yes** — I'll analyse the codebase and pre-populate your memory files. You'll review and approve my findings before anything is written.
57
+ > - **No** — We'll continue with the standard Socratic questions and blank templates."
58
+
59
+ **If the user says yes:** run the full `skills/repo-scan.md` protocol now. The repo scan will:
60
+ 1. Map the repo structure and read key files
61
+ 2. Synthesise findings into a structured summary
62
+ 3. Present the summary for your review and approval
63
+ 4. Use approved findings to pre-populate all memory files in Step 5
64
+
65
+ After the repo scan completes and the user approves the findings, **skip Step 4 (Socratic questions) and go directly to Step 5**, using the scan-generated files instead of template stubs. The scan findings are treated as pre-filled answers.
66
+
67
+ **If the user says no:** continue to Step 3 as normal.
68
+
69
+ ---
70
+
71
+ ## Step 3 — Create the directory structure
72
+
73
+ Create the following directories (use `mkdir -p` to create all levels at once):
74
+
75
+ ```
76
+ docs/pdlc/memory/episodes/
77
+ docs/pdlc/prds/plans/
78
+ docs/pdlc/design/
79
+ docs/pdlc/reviews/
80
+ ```
81
+
82
+ Run these commands:
83
+ ```bash
84
+ mkdir -p docs/pdlc/memory/episodes
85
+ mkdir -p docs/pdlc/prds/plans
86
+ mkdir -p docs/pdlc/design
87
+ mkdir -p docs/pdlc/reviews
88
+ ```
89
+
90
+ Confirm each directory was created. Tell the user which directories were created.
91
+
92
+ ---
93
+
94
+ ## Step 4 — Socratic initialization
95
+
96
+ > **Skip this step if the user accepted the brownfield repo scan in Step 2.** The scan already generated the memory files. Jump to Step 6.
97
+
98
+
99
+
100
+ Before asking the first question, print this notice in blue text using ANSI escape codes:
101
+
102
+ ```
103
+ \x1b[34mTip: You can type 'skip' at any time to stop the questions and proceed with whatever information has been collected so far.\x1b[0m
104
+ ```
105
+
106
+ Ask the user the following questions **one at a time**. Wait for a complete answer before asking the next question. Do not batch questions together.
107
+
108
+ After each answer, check: **if the user's response is exactly `skip` (case-insensitive), stop asking questions immediately and proceed to Step 5 using whatever answers have been collected.** Leave unanswered fields as placeholders in the generated files.
109
+
110
+ Ask each question exactly as written:
111
+
112
+ 1. "What is the name of your project?"
113
+ 2. "In one sentence, what problem does it solve?"
114
+ 3. "Who is your primary target user? (Describe them in 2–3 sentences: who they are, what they want, what frustrates them.)"
115
+ 4. "What tech stack are you using? (e.g. Next.js + PostgreSQL + Vercel, or Rails + React + Heroku)"
116
+ 5. "What are your non-negotiable architectural constraints, if any? (e.g. 'all business logic in service layer', 'no raw SQL in controllers', or 'none' if you have no constraints yet)"
117
+ 6. "Which test layers do you want to enforce as required gates — meaning Construction cannot move to Operation unless these pass? Choose from: Unit, Integration, E2E, Performance, Accessibility, Visual Regression. (Default: Unit + Integration. You can change this later in CONSTITUTION.md.)"
118
+ 7. "Are there any Tier 2 safety actions you want to auto-approve for your team? Tier 2 actions normally pause and wait for confirmation. Examples you might downgrade: 'running DB migrations in production' or 'external API calls that post/send'. List them or say 'none'."
119
+
120
+ Store all answers. You will use them to fill in the memory files below.
121
+
122
+ ---
123
+
124
+ ## Step 5 — Generate memory files
125
+
126
+ Using the answers from Step 3, create all 7 memory files. Use today's date (ISO format: YYYY-MM-DD) wherever a date is required.
127
+
128
+ ### 4a. `docs/pdlc/memory/CONSTITUTION.md`
129
+
130
+ Create this file based on the `templates/CONSTITUTION.md` structure. Fill in the following from the user's answers:
131
+
132
+ - **Project name** (header and metadata): from question 1
133
+ - **Tech Stack table** (Section 1): parse the tech stack answer from question 4 and fill in rows. Infer reasonable layer labels. Leave rationale cells blank if none given.
134
+ - **Architectural Constraints** (Section 3): use the answer from question 5. If "none", leave the placeholder bullets.
135
+ - **Test Gates** (Section 7): check the boxes the user selected in question 6. Uncheck all others.
136
+ - **Safety Guardrail Overrides** (Section 8): populate the table with any items from question 7. If "none", leave the placeholder row.
137
+ - Set `Last updated:` to today's date.
138
+
139
+ Leave all other sections with their default placeholder text — do not remove comments or examples.
140
+
141
+ ### 4b. `docs/pdlc/memory/INTENT.md`
142
+
143
+ Create this file based on the `templates/INTENT.md` structure. Fill in:
144
+
145
+ - **Project name**: from question 1
146
+ - **Problem Statement**: expand the one-sentence answer from question 2 into a 2–4 sentence description. Stay faithful to the user's answer — do not invent new problems.
147
+ - **Target User (Persona)**: use the answer from question 3. Format as "**Primary: [persona label]**" followed by the description.
148
+ - **Core Value Proposition**: draft one sentence in the "Only [product] lets [user] [achieve outcome]" format, derived from questions 1–3.
149
+ - **Created** and **Last updated**: today's date.
150
+
151
+ Leave the success metrics table and out-of-scope / constraints sections with placeholder text.
152
+
153
+ ### 4c. `docs/pdlc/memory/STATE.md`
154
+
155
+ Create this file based on the `templates/STATE.md` structure. Set:
156
+
157
+ - **Current Phase**: `Initialization`
158
+ - **Current Feature**: `none`
159
+ - **Active Beads Task**: `none`
160
+ - **Current Sub-phase**: `none`
161
+ - **Last Checkpoint**: `Initialization / — / [today's date]T00:00:00Z`
162
+ - **Phase History table**: one row — today's timestamp, event `init`, Phase `Initialization`, Sub-phase `—`, Feature `none`
163
+ - **Last updated**: today's date and time (ISO 8601)
164
+
165
+ ### 4d. `docs/pdlc/memory/ROADMAP.md`
166
+
167
+ Create this file with stub content:
168
+
169
+ ```markdown
170
+ # Roadmap
171
+
172
+ **Project:** [project name from question 1]
173
+ **Last updated:** [today's date]
174
+
175
+ ---
176
+
177
+ ## Current Focus
178
+
179
+ <!-- Populated after first /pdlc brainstorm session. -->
180
+
181
+ ---
182
+
183
+ ## Planned Features
184
+
185
+ <!-- Add features here as they are defined via /pdlc brainstorm. -->
186
+
187
+ | # | Feature | Status | Target |
188
+ |---|---------|--------|--------|
189
+ | — | — | — | — |
190
+
191
+ ---
192
+
193
+ ## Completed Features
194
+
195
+ <!-- Auto-populated from docs/pdlc/memory/episodes/index.md after each ship. -->
196
+
197
+ <!-- None yet. -->
198
+ ```
199
+
200
+ ### 4e. `docs/pdlc/memory/DECISIONS.md`
201
+
202
+ Create this file with stub content:
203
+
204
+ ```markdown
205
+ # Architectural Decision Log
206
+
207
+ **Project:** [project name from question 1]
208
+ **Last updated:** [today's date]
209
+
210
+ <!-- Decisions recorded here use a lightweight ADR format.
211
+ Each entry: what was decided, why, what was considered and rejected.
212
+ PDLC agents (Neo, Phantom, Jarvis) append entries here during Build and Review.
213
+ Do not delete entries — mark superseded decisions as [SUPERSEDED by ADR-NNN]. -->
214
+
215
+ ---
216
+
217
+ <!-- No decisions recorded yet. The first entries will appear after /pdlc brainstorm. -->
218
+ ```
219
+
220
+ ### 4f. `docs/pdlc/memory/CHANGELOG.md`
221
+
222
+ Create this file with stub content:
223
+
224
+ ```markdown
225
+ # Changelog
226
+
227
+ **Project:** [project name from question 1]
228
+
229
+ <!-- Format: Conventional — newest entries at top.
230
+ Each entry added by Jarvis during the Ship sub-phase.
231
+ Format per release:
232
+
233
+ ## v[X.Y.Z] — [YYYY-MM-DD]
234
+ ### Added
235
+ - ...
236
+ ### Changed
237
+ - ...
238
+ ### Fixed
239
+ - ...
240
+ ### Breaking Changes
241
+ - ... (only if applicable)
242
+ -->
243
+
244
+ ---
245
+
246
+ <!-- No releases yet. -->
247
+ ```
248
+
249
+ ### 4g. `docs/pdlc/memory/OVERVIEW.md`
250
+
251
+ Create this file based on the `templates/OVERVIEW.md` structure. Fill in:
252
+
253
+ - **Project name**: from question 1
254
+ - **Project Summary**: a 1–2 sentence description derived from questions 1–3.
255
+ - **Last updated**: today's date
256
+
257
+ Leave the Active Functionality, Shipped Features, Architecture Summary, Known Tech Debt, and Decision Log Summary sections with their default placeholder text.
258
+
259
+ ---
260
+
261
+ ## Step 6 — Create the episodes index
262
+
263
+ Create `docs/pdlc/memory/episodes/index.md` with this content:
264
+
265
+ ```markdown
266
+ # Episode Index
267
+
268
+ **Project:** [project name from question 1]
269
+ **Last updated:** [today's date]
270
+
271
+ <!-- This file is the searchable index of all PDLC feature episodes.
272
+ Each row is auto-appended by PDLC during the Reflect sub-phase after a feature ships.
273
+ Do not edit manually. -->
274
+
275
+ | # | Feature | Date Shipped | Episode File | PR | Status |
276
+ |---|---------|-------------|--------------|-----|--------|
277
+ | — | — | — | — | — | — |
278
+ ```
279
+
280
+ ---
281
+
282
+ ## Step 7 — Initialize Beads
283
+
284
+ Run: `bd init --quiet`
285
+
286
+ This creates the `.beads/` directory in the project root, which stores the task graph locally.
287
+
288
+ If `bd init` fails, show the user the error output and tell them:
289
+
290
+ > "Beads initialization failed. Check the error above. Common causes: permissions issue in the project directory, or `bd` version mismatch. Re-run `bd init` manually to debug."
291
+
292
+ If `bd init` succeeds, continue.
293
+
294
+ ---
295
+
296
+ ## Step 8 — Update STATE.md
297
+
298
+ Update `docs/pdlc/memory/STATE.md`:
299
+
300
+ - **Current Phase**: `Initialization Complete — Ready for /pdlc brainstorm`
301
+ - **Last Checkpoint**: `Initialization / Complete / [today's datetime ISO 8601]`
302
+ - **Last updated**: now
303
+
304
+ Append a row to the Phase History table:
305
+ ```
306
+ | [now] | init_complete | Initialization Complete | — | none |
307
+ ```
308
+
309
+ ---
310
+
311
+ ## Step 9 — Print initialization summary
312
+
313
+ Print a clear summary to the user.
314
+
315
+ **For greenfield projects (no repo scan):**
316
+
317
+ ```
318
+ PDLC initialized successfully. ✓
319
+
320
+ Files created:
321
+ docs/pdlc/memory/CONSTITUTION.md
322
+ docs/pdlc/memory/INTENT.md
323
+ docs/pdlc/memory/STATE.md
324
+ docs/pdlc/memory/ROADMAP.md
325
+ docs/pdlc/memory/DECISIONS.md
326
+ docs/pdlc/memory/CHANGELOG.md
327
+ docs/pdlc/memory/OVERVIEW.md
328
+ docs/pdlc/memory/episodes/index.md
329
+
330
+ Directories created:
331
+ docs/pdlc/memory/episodes/
332
+ docs/pdlc/prds/plans/
333
+ docs/pdlc/design/
334
+ docs/pdlc/reviews/
335
+
336
+ Beads initialized: .beads/ created in project root.
337
+
338
+ Next step: run /pdlc brainstorm [feature-name] to start your first feature.
339
+ ```
340
+
341
+ **For brownfield projects (repo scan ran):**
342
+
343
+ ```
344
+ PDLC initialized successfully with repo scan. ✓
345
+
346
+ Memory bank pre-populated from existing codebase:
347
+ docs/pdlc/memory/CONSTITUTION.md ← tech stack + observed constraints filled in
348
+ docs/pdlc/memory/INTENT.md ← inferred from README + code (review & verify)
349
+ docs/pdlc/memory/STATE.md
350
+ docs/pdlc/memory/ROADMAP.md
351
+ docs/pdlc/memory/DECISIONS.md ← [N] pre-PDLC decisions recorded (inferred)
352
+ docs/pdlc/memory/CHANGELOG.md ← pre-PDLC baseline entry added
353
+ docs/pdlc/memory/OVERVIEW.md ← existing features documented
354
+ docs/pdlc/memory/episodes/index.md
355
+
356
+ Beads initialized: .beads/ created in project root.
357
+
358
+ ⚠ Inferred content is marked "(inferred — please verify)" throughout.
359
+ Review INTENT.md and OVERVIEW.md before your first /pdlc brainstorm session.
360
+
361
+ Next step: run /pdlc brainstorm [feature-name] to start your first feature.
362
+ ```
363
+
364
+ Replace counts (e.g. `[N] decisions`) with actual numbers from the scan.
365
+
366
+ ---
367
+
368
+ ## Safety notes
369
+
370
+ - This command is safe to run only once. If `docs/pdlc/memory/CONSTITUTION.md` already exists, warn the user: "PDLC appears to already be initialized (docs/pdlc/memory/CONSTITUTION.md exists). Re-running init will overwrite the memory files. Are you sure? (yes/no)" — wait for confirmation before proceeding.
371
+ - Changing `CONSTITUTION.md` after init is a Tier 2 safety event. Remind the user of this at the end of the summary if they asked to set non-default architectural constraints.