Initialize pwdev-prd
STEP 0 — Language Configuration
This is the initialization command, so language setup is mandatory here (not silent).
Read .planning/config.json — if lang already exists, show current setting and ask:
Idioma atual / Current language: {lang}
Deseja manter? / Keep it? (y/n)
If yes → proceed. If no → go to step 2.
If no config or user wants to change, always ask explicitly:
Em qual idioma deseja trabalhar? / Which language would you like to use?
1. Portugues (PT-BR)
2. English (EN)
Wait for the user's response.
Save the choice to .planning/config.json:
- If file exists, merge the
lang field (do not overwrite other fields).
- If file does not exist, create it:
{
"lang": "pt-BR"
}
Confirm:
pt-BR: "Idioma definido: Portugues (PT-BR)"
en: "Language set: English (EN)"
All subsequent output in this command must follow the resolved language.
Technical terms (API, CRUD, REST, endpoint) always stay in English regardless of language choice.
STEP 0.1 — Model Profile (informational only)
The interview runs inline on the session model, and the only subagent
(pwdev-prd:roadmap) declares model: inherit — pwdev-prd never resolves a model. Do NOT configure
model_profile here:
- If
.planning/config.json already has model_profile (set by pwdev-code
or pwdev-feat), leave it untouched — it belongs to plugins with subagents.
- If it's absent, skip silently — nothing in this plugin reads it.
STEP 1 — Check if already initialized
if [ -d ".planning/prds" ]; then
echo "ALREADY_INITIALIZED"
ls .planning/prds/ 2>/dev/null
else
echo "NEW"
fi
If already initialized:
⚠️ pwdev-prd already initialized.
Workspace: .planning/prds/
Existing PRDs: [list]
Use /pwdev-prd:create to start a new PRD.
STEP 2 — Create workspace
mkdir -p .planning/prds
STEP 2.1 — Audit Trail (opt-in, disabled by default)
The audit trail records all commands, decisions, and artifacts in a local SQLite database.
It is disabled by default and the database file is never versioned (added to .gitignore).
Read .planning/config.json — if audit field already exists, show current setting and ask:
- PT-BR:
Trilha de auditoria atual: {enabled/disabled}. Deseja manter? (s/n)
- EN:
Current audit trail: {enabled/disabled}. Keep it? (y/n)
If yes → proceed (skip to step 3 if disabled). If no → go to step 2.
If no config or user wants to change, ask:
PT-BR:
Deseja ativar a trilha de auditoria SQLite? (registra comandos, decisoes e artefatos)
O arquivo .db nao e versionado (adicionado ao .gitignore).
1. Sim — ativar auditoria
2. Nao — desativar (padrao)
Escolha (1-2, padrao: 2):
EN:
Enable SQLite audit trail? (records commands, decisions, and artifacts)
The .db file is not versioned (added to .gitignore).
1. Yes — enable audit
2. No — disable (default)
Choose (1-2, default: 2):
Save the choice to .planning/config.json — merge "audit": true or "audit": false.
If audit is enabled and sqlite3 is available:
if command -v sqlite3 >/dev/null 2>&1 && [ ! -f ".planning/pwdev-audit.db" ]; then
sqlite3 .planning/pwdev-audit.db "
CREATE TABLE IF NOT EXISTS events (
id INTEGER PRIMARY KEY AUTOINCREMENT,
timestamp TEXT NOT NULL DEFAULT (datetime('now')),
session_id TEXT, plugin TEXT NOT NULL, command TEXT NOT NULL,
agent TEXT, model TEXT, phase TEXT, action TEXT NOT NULL,
target TEXT, detail TEXT, duration_ms INTEGER
);
CREATE TABLE IF NOT EXISTS decisions (
id INTEGER PRIMARY KEY AUTOINCREMENT, event_id INTEGER REFERENCES events(id),
timestamp TEXT NOT NULL DEFAULT (datetime('now')), phase TEXT NOT NULL,
decision TEXT NOT NULL, rationale TEXT, alternatives TEXT, reversible INTEGER DEFAULT 1
);
CREATE TABLE IF NOT EXISTS artifacts (
id INTEGER PRIMARY KEY AUTOINCREMENT, event_id INTEGER REFERENCES events(id),
path TEXT NOT NULL, type TEXT NOT NULL, phase TEXT, status TEXT DEFAULT 'active',
created_at TEXT NOT NULL DEFAULT (datetime('now')), archived_at TEXT
);
CREATE TABLE IF NOT EXISTS config_changes (
id INTEGER PRIMARY KEY AUTOINCREMENT, timestamp TEXT NOT NULL DEFAULT (datetime('now')),
field TEXT NOT NULL, old_value TEXT, new_value TEXT NOT NULL, changed_by TEXT
);
CREATE INDEX IF NOT EXISTS idx_events_timestamp ON events(timestamp);
CREATE INDEX IF NOT EXISTS idx_events_plugin ON events(plugin);
CREATE INDEX IF NOT EXISTS idx_events_command ON events(command);
"
fi
(Full schema reference: <plugin-root>/references/audit-schema.md.
The database is SHARED with pwdev-code/pwdev-feat — any plugin's init may
create it. Once the DB exists, recording is automatic via the plugin's
hooks — no inline INSERTs.)
Ensure .planning/pwdev-audit.db is in .gitignore:
if ! grep -q "pwdev-audit.db" .gitignore 2>/dev/null; then
printf '\n# PWDEV audit trail (not versioned)\n.planning/pwdev-audit.db\n.planning/pwdev-audit.db-journal\n.planning/pwdev-audit.db-wal\n.planning/.audit-tmp/\n' >> .gitignore
fi
Log the initialization event and config changes (best-effort):
sh "<plugin-root>/scripts/audit-log.sh" event init "" completed .planning/prds/ ""
sh "<plugin-root>/scripts/audit-log.sh" config lang "$OLD_LANG" "$NEW_LANG" init
sh "<plugin-root>/scripts/audit-log.sh" config audit "$OLD_AUDIT" "$NEW_AUDIT" init
If audit is disabled, skip silently. Confirm:
- PT-BR:
Trilha de auditoria: **{ativada/desativada}**
- EN:
Audit trail: **{enabled/disabled}**
STEP 3 — Summary
✅ pwdev-prd initialized
📁 Workspace created:
.planning/prds/ # PRDs will be stored here
└── {slug}/
├── PRD.md # Structured PRD document
└── prd.json # Optional JSON export
🚀 Next steps:
/pwdev-prd:create "feature or system description"
/pwdev-prd:list → View existing PRDs
Prohibitions
- NEVER overwrite existing
.planning/prds/ without confirmation
Language: resolve lang per references/language.md before any human-facing output. Paths <plugin-root>/..., references/, scripts/, templates/ are relative to the plugin root; tool names, subagent dispatch and the command form to show the user depend on the runtime (references/runtime.md).
1---2name: prd-init3description: >4 Use when the user wants to set up pwdev-prd in a project — 'inicializar o pwdev-prd', 'init5 prd', 'configurar PRDs' — creating the .planning/prds/ workspace and choosing language and the6 optional SQLite audit trail. Do NOT use to write a PRD (prd-create).7metadata:8 source: https://skillmd.com/skills/pwdev-solucoes/prd-init9 version: 3.0.010---1112# Initialize pwdev-prd1314## STEP 0 — Language Configuration1516This is the initialization command, so language setup is **mandatory** here (not silent).17181. Read `.planning/config.json` — if `lang` already exists, show current setting and ask:19 ```20 Idioma atual / Current language: {lang}21 Deseja manter? / Keep it? (y/n)22 ```23 If yes → proceed. If no → go to step 2.24252. If no config or user wants to change, **always ask explicitly**:26 ```27 Em qual idioma deseja trabalhar? / Which language would you like to use?2829 1. Portugues (PT-BR)30 2. English (EN)31 ```32 Wait for the user's response.33343. Save the choice to `.planning/config.json`:35 - If file exists, merge the `lang` field (do not overwrite other fields).36 - If file does not exist, create it:37 ```json38 {39 "lang": "pt-BR"40 }41 ```42434. Confirm:44 - `pt-BR`: "Idioma definido: **Portugues (PT-BR)**"45 - `en`: "Language set: **English (EN)**"4647All subsequent output in this command must follow the resolved language.4849Technical terms (API, CRUD, REST, endpoint) always stay in English regardless of language choice.5051## STEP 0.1 — Model Profile (informational only)5253The interview runs inline on the session model, and the only subagent54(`pwdev-prd:roadmap`) declares `model: inherit` — pwdev-prd never resolves a model. Do NOT configure55`model_profile` here:5657- If `.planning/config.json` already has `model_profile` (set by pwdev-code58 or pwdev-feat), leave it untouched — it belongs to plugins with subagents.59- If it's absent, skip silently — nothing in this plugin reads it.6061## STEP 1 — Check if already initialized6263```bash64if [ -d ".planning/prds" ]; then65 echo "ALREADY_INITIALIZED"66 ls .planning/prds/ 2>/dev/null67else68 echo "NEW"69fi70```7172If already initialized:73```74⚠️ pwdev-prd already initialized.75 Workspace: .planning/prds/76 Existing PRDs: [list]77 Use /pwdev-prd:create to start a new PRD.78```7980## STEP 2 — Create workspace8182```bash83mkdir -p .planning/prds84```8586## STEP 2.1 — Audit Trail (opt-in, disabled by default)8788The audit trail records all commands, decisions, and artifacts in a local SQLite database.89It is **disabled by default** and the database file is **never versioned** (added to `.gitignore`).90911. Read `.planning/config.json` — if `audit` field already exists, show current setting and ask:92 - PT-BR: `Trilha de auditoria atual: {enabled/disabled}. Deseja manter? (s/n)`93 - EN: `Current audit trail: {enabled/disabled}. Keep it? (y/n)`94 If yes → proceed (skip to step 3 if disabled). If no → go to step 2.95962. If no config or user wants to change, ask:9798 **PT-BR:**99 ```100 Deseja ativar a trilha de auditoria SQLite? (registra comandos, decisoes e artefatos)101 O arquivo .db nao e versionado (adicionado ao .gitignore).102103 1. Sim — ativar auditoria104 2. Nao — desativar (padrao)105106 Escolha (1-2, padrao: 2):107 ```108109 **EN:**110 ```111 Enable SQLite audit trail? (records commands, decisions, and artifacts)112 The .db file is not versioned (added to .gitignore).113114 1. Yes — enable audit115 2. No — disable (default)116117 Choose (1-2, default: 2):118 ```1191203. Save the choice to `.planning/config.json` — merge `"audit": true` or `"audit": false`.1211224. If audit is **enabled** and `sqlite3` is available:123124 ```bash125 if command -v sqlite3 >/dev/null 2>&1 && [ ! -f ".planning/pwdev-audit.db" ]; then126 sqlite3 .planning/pwdev-audit.db "127 CREATE TABLE IF NOT EXISTS events (128 id INTEGER PRIMARY KEY AUTOINCREMENT,129 timestamp TEXT NOT NULL DEFAULT (datetime('now')),130 session_id TEXT, plugin TEXT NOT NULL, command TEXT NOT NULL,131 agent TEXT, model TEXT, phase TEXT, action TEXT NOT NULL,132 target TEXT, detail TEXT, duration_ms INTEGER133 );134 CREATE TABLE IF NOT EXISTS decisions (135 id INTEGER PRIMARY KEY AUTOINCREMENT, event_id INTEGER REFERENCES events(id),136 timestamp TEXT NOT NULL DEFAULT (datetime('now')), phase TEXT NOT NULL,137 decision TEXT NOT NULL, rationale TEXT, alternatives TEXT, reversible INTEGER DEFAULT 1138 );139 CREATE TABLE IF NOT EXISTS artifacts (140 id INTEGER PRIMARY KEY AUTOINCREMENT, event_id INTEGER REFERENCES events(id),141 path TEXT NOT NULL, type TEXT NOT NULL, phase TEXT, status TEXT DEFAULT 'active',142 created_at TEXT NOT NULL DEFAULT (datetime('now')), archived_at TEXT143 );144 CREATE TABLE IF NOT EXISTS config_changes (145 id INTEGER PRIMARY KEY AUTOINCREMENT, timestamp TEXT NOT NULL DEFAULT (datetime('now')),146 field TEXT NOT NULL, old_value TEXT, new_value TEXT NOT NULL, changed_by TEXT147 );148 CREATE INDEX IF NOT EXISTS idx_events_timestamp ON events(timestamp);149 CREATE INDEX IF NOT EXISTS idx_events_plugin ON events(plugin);150 CREATE INDEX IF NOT EXISTS idx_events_command ON events(command);151 "152 fi153 ```154155 (Full schema reference: `<plugin-root>/references/audit-schema.md`.156 The database is SHARED with pwdev-code/pwdev-feat — any plugin's init may157 create it. Once the DB exists, recording is automatic via the plugin's158 hooks — no inline INSERTs.)159160 Ensure `.planning/pwdev-audit.db` is in `.gitignore`:161 ```bash162 if ! grep -q "pwdev-audit.db" .gitignore 2>/dev/null; then163 printf '\n# PWDEV audit trail (not versioned)\n.planning/pwdev-audit.db\n.planning/pwdev-audit.db-journal\n.planning/pwdev-audit.db-wal\n.planning/.audit-tmp/\n' >> .gitignore164 fi165 ```166167 Log the initialization event and config changes (best-effort):168 ```bash169 sh "<plugin-root>/scripts/audit-log.sh" event init "" completed .planning/prds/ ""170 sh "<plugin-root>/scripts/audit-log.sh" config lang "$OLD_LANG" "$NEW_LANG" init171 sh "<plugin-root>/scripts/audit-log.sh" config audit "$OLD_AUDIT" "$NEW_AUDIT" init172 ```1731745. If audit is **disabled**, skip silently. Confirm:175 - PT-BR: `Trilha de auditoria: **{ativada/desativada}**`176 - EN: `Audit trail: **{enabled/disabled}**`177178## STEP 3 — Summary179180```181✅ pwdev-prd initialized182183📁 Workspace created:184 .planning/prds/ # PRDs will be stored here185 └── {slug}/186 ├── PRD.md # Structured PRD document187 └── prd.json # Optional JSON export188189🚀 Next steps:190 /pwdev-prd:create "feature or system description"191 /pwdev-prd:list → View existing PRDs192```193194## Prohibitions195- NEVER overwrite existing `.planning/prds/` without confirmation196197Language: resolve `lang` per `references/language.md` before any human-facing output. Paths `<plugin-root>/...`, `references/`, `scripts/`, `templates/` are relative to the plugin root; tool names, subagent dispatch and the command form to show the user depend on the runtime (`references/runtime.md`).