godpowers 1.6.14 → 1.6.16

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,220 @@
1
+ /**
2
+ * Source System Sync-Back
3
+ *
4
+ * Writes Godpowers progress back to detected GSD, BMAD, and Superpowers
5
+ * projects through managed companion files and optional managed fences.
6
+ */
7
+
8
+ const fs = require('fs');
9
+ const path = require('path');
10
+ const crypto = require('crypto');
11
+
12
+ const state = require('./state');
13
+
14
+ const FENCE_BEGIN = '<!-- godpowers:source-sync:begin -->';
15
+ const FENCE_END = '<!-- godpowers:source-sync:end -->';
16
+
17
+ const SYSTEM_TARGETS = {
18
+ gsd: {
19
+ companionCandidates: ['.planning/GODPOWERS-SYNC.md', '.gsd/GODPOWERS-SYNC.md'],
20
+ pointerCandidates: ['.planning/STATE.md']
21
+ },
22
+ bmad: {
23
+ companionCandidates: ['_bmad-output/GODPOWERS-SYNC.md', '.bmad/GODPOWERS-SYNC.md'],
24
+ pointerCandidates: ['_bmad-output/project-context.md']
25
+ },
26
+ superpowers: {
27
+ companionCandidates: ['docs/superpowers/GODPOWERS-SYNC.md', '.superpowers/GODPOWERS-SYNC.md'],
28
+ pointerCandidates: []
29
+ }
30
+ };
31
+
32
+ function rel(projectRoot, absPath) {
33
+ return path.relative(projectRoot, absPath).split(path.sep).join('/');
34
+ }
35
+
36
+ function sha(input) {
37
+ return `sha256:${crypto.createHash('sha256').update(input).digest('hex')}`;
38
+ }
39
+
40
+ function readFenced(filePath) {
41
+ if (!fs.existsSync(filePath)) {
42
+ return { exists: false, before: '', fenced: '', after: '' };
43
+ }
44
+ const content = fs.readFileSync(filePath, 'utf8');
45
+ const beginIdx = content.indexOf(FENCE_BEGIN);
46
+ const endIdx = content.indexOf(FENCE_END);
47
+ if (beginIdx === -1 || endIdx === -1 || endIdx < beginIdx) {
48
+ return { exists: true, before: content, fenced: '', after: '' };
49
+ }
50
+ return {
51
+ exists: true,
52
+ before: content.slice(0, beginIdx),
53
+ fenced: content.slice(beginIdx + FENCE_BEGIN.length, endIdx),
54
+ after: content.slice(endIdx + FENCE_END.length)
55
+ };
56
+ }
57
+
58
+ function writeFenced(filePath, sectionContent) {
59
+ const parsed = readFenced(filePath);
60
+ const block = `${FENCE_BEGIN}\n${sectionContent}\n${FENCE_END}`;
61
+ let next;
62
+ if (!parsed.exists) {
63
+ next = `${block}\n`;
64
+ } else if (parsed.fenced === '') {
65
+ const sep = parsed.before.endsWith('\n\n') ? '' : (parsed.before.endsWith('\n') ? '\n' : '\n\n');
66
+ next = `${parsed.before}${sep}${block}\n`;
67
+ } else {
68
+ next = `${parsed.before}${block}${parsed.after}`;
69
+ }
70
+ fs.mkdirSync(path.dirname(filePath), { recursive: true });
71
+ fs.writeFileSync(filePath, next);
72
+ return {
73
+ written: true,
74
+ hadFenceBefore: parsed.exists && parsed.fenced !== ''
75
+ };
76
+ }
77
+
78
+ function firstExisting(projectRoot, candidates) {
79
+ for (const candidate of candidates) {
80
+ if (fs.existsSync(path.join(projectRoot, candidate))) return candidate;
81
+ }
82
+ return candidates[0];
83
+ }
84
+
85
+ function readArtifact(projectRoot, relPath) {
86
+ const full = path.join(projectRoot, relPath);
87
+ if (!fs.existsSync(full)) return null;
88
+ return fs.readFileSync(full, 'utf8');
89
+ }
90
+
91
+ function summarizeArtifact(projectRoot, relPath, label) {
92
+ const content = readArtifact(projectRoot, relPath);
93
+ if (!content) return `- [HYPOTHESIS] ${label}: missing.`;
94
+ const headings = content
95
+ .split('\n')
96
+ .map((line) => line.trim())
97
+ .filter((line) => /^#{1,3}\s+/.test(line))
98
+ .map((line) => line.replace(/^#{1,3}\s+/, ''))
99
+ .slice(0, 6);
100
+ if (headings.length === 0) {
101
+ return `- [HYPOTHESIS] ${label}: present at ${relPath}.`;
102
+ }
103
+ return `- [HYPOTHESIS] ${label}: ${headings.join('; ')}. Source: ${relPath}.`;
104
+ }
105
+
106
+ function progressLines(projectRoot) {
107
+ const current = state.read(projectRoot);
108
+ const lines = [];
109
+ lines.push('# Godpowers Sync-Back');
110
+ lines.push('');
111
+ lines.push('- [DECISION] This file is managed by Godpowers source sync.');
112
+ lines.push('- [DECISION] It lets the prior planning system see current Godpowers progress without Godpowers rewriting source-system documents.');
113
+ lines.push('- [DECISION] Edit Godpowers artifacts, then run `/god-sync` or `/god-migrate --sync-back` to refresh this file.');
114
+ lines.push('');
115
+
116
+ if (current) {
117
+ const summary = state.progressSummary(current);
118
+ lines.push('## Progress');
119
+ lines.push('');
120
+ lines.push(`- [HYPOTHESIS] Godpowers progress is ${summary.percent}% with ${summary.completed} of ${summary.total} steps complete.`);
121
+ if (summary.current) {
122
+ lines.push(`- [HYPOTHESIS] Current Godpowers step is ${summary.current.tierLabel}: ${summary.current.subStepLabel} with status ${summary.current.status}.`);
123
+ }
124
+ }
125
+
126
+ lines.push('');
127
+ lines.push('## Current Godpowers Artifacts');
128
+ lines.push('');
129
+ lines.push(summarizeArtifact(projectRoot, '.godpowers/prd/PRD.md', 'PRD'));
130
+ lines.push(summarizeArtifact(projectRoot, '.godpowers/arch/ARCH.md', 'Architecture'));
131
+ lines.push(summarizeArtifact(projectRoot, '.godpowers/roadmap/ROADMAP.md', 'Roadmap'));
132
+ lines.push(summarizeArtifact(projectRoot, '.godpowers/stack/DECISION.md', 'Stack'));
133
+ lines.push(summarizeArtifact(projectRoot, '.godpowers/build/STATE.md', 'Build state'));
134
+ lines.push('');
135
+ lines.push('## Return Path');
136
+ lines.push('');
137
+ lines.push('- [DECISION] If the project returns to GSD, BMAD, or Superpowers, use this file as a migration note rather than treating it as a native source-system artifact.');
138
+ lines.push('- [OPEN QUESTION] Confirm which Godpowers decisions should be copied into native source-system documents before switching systems. Owner: user. Due: before switching systems.');
139
+ lines.push('');
140
+ return lines.join('\n');
141
+ }
142
+
143
+ function pointerContent(companionPath) {
144
+ return [
145
+ '## Godpowers Sync-Back Pointer',
146
+ '',
147
+ `- [DECISION] Current Godpowers progress is summarized in \`${companionPath}\`.`,
148
+ '- [DECISION] This fenced pointer is managed by Godpowers and may be refreshed by `/god-sync`.',
149
+ ''
150
+ ].join('\n');
151
+ }
152
+
153
+ function updateStateSync(projectRoot, results, contentHash) {
154
+ const current = state.read(projectRoot);
155
+ if (!current || !Array.isArray(current['source-systems'])) return null;
156
+ const now = new Date().toISOString();
157
+ const byId = new Set(results.map((result) => result.system));
158
+ current['source-systems'] = current['source-systems'].map((system) => {
159
+ if (!byId.has(system.id)) return system;
160
+ return {
161
+ ...system,
162
+ 'last-sync-back-hash': contentHash,
163
+ 'last-sync-back-at': now
164
+ };
165
+ });
166
+ state.write(projectRoot, current);
167
+ return current;
168
+ }
169
+
170
+ function run(projectRoot, opts = {}) {
171
+ const current = state.read(projectRoot);
172
+ const configured = current && Array.isArray(current['source-systems'])
173
+ ? current['source-systems']
174
+ : [];
175
+ const systems = configured.filter((system) => system['sync-back-enabled'] !== false);
176
+ const content = progressLines(projectRoot);
177
+ const contentHash = sha(content);
178
+ const results = [];
179
+
180
+ for (const system of systems) {
181
+ const targets = SYSTEM_TARGETS[system.id];
182
+ if (!targets) continue;
183
+ const companionRel = firstExisting(projectRoot, targets.companionCandidates);
184
+ const companionFull = path.join(projectRoot, companionRel);
185
+ const companionResult = writeFenced(companionFull, content);
186
+ const pointerResults = [];
187
+
188
+ for (const pointerRel of targets.pointerCandidates) {
189
+ const pointerFull = path.join(projectRoot, pointerRel);
190
+ if (!fs.existsSync(pointerFull)) continue;
191
+ const pointerResult = writeFenced(pointerFull, pointerContent(companionRel));
192
+ pointerResults.push({ path: pointerRel, ...pointerResult });
193
+ }
194
+
195
+ results.push({
196
+ system: system.id,
197
+ name: system.name,
198
+ companion: companionRel,
199
+ companionWritten: companionResult.written,
200
+ pointers: pointerResults
201
+ });
202
+ }
203
+
204
+ const nextState = updateStateSync(projectRoot, results, contentHash);
205
+ return {
206
+ hash: contentHash,
207
+ results,
208
+ state: nextState
209
+ };
210
+ }
211
+
212
+ module.exports = {
213
+ run,
214
+ progressLines,
215
+ readFenced,
216
+ writeFenced,
217
+ FENCE_BEGIN,
218
+ FENCE_END,
219
+ SYSTEM_TARGETS
220
+ };
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "godpowers",
3
- "version": "1.6.14",
4
- "description": "AI-powered development system: 108 slash commands and 40 specialist agents that take a project from raw idea to hardened production. Runs inside Claude Code, Codex, Cursor, Windsurf, Gemini, and 10+ other AI coding tools.",
3
+ "version": "1.6.16",
4
+ "description": "AI-powered development system: 109 slash commands and 40 specialist agents that take a project from raw idea to hardened production. Runs inside Claude Code, Codex, Cursor, Windsurf, Gemini, and 10+ other AI coding tools.",
5
5
  "bin": {
6
6
  "godpowers": "./bin/install.js"
7
7
  },
8
8
  "scripts": {
9
- "test": "node scripts/validate-skills.js && node scripts/test-doc-surface-counts.js && bash scripts/smoke.sh && node scripts/test-runtime.js && node scripts/test-router.js && node scripts/test-recipes.js && node scripts/test-context-writer.js && node scripts/test-pillars.js && node scripts/test-artifact-linter.js && node scripts/test-artifact-diff.js && node scripts/test-design-foundation.js && node scripts/test-linkage.js && node scripts/test-impact.js && node scripts/test-reverse-sync.js && node scripts/test-integration.js && node scripts/test-cross-artifact.js && node scripts/test-awesome-design.js && node scripts/test-skillui-bridge.js && node scripts/test-runtime-verification.js && node scripts/test-agent-browser.js && node scripts/test-mode-d.js && node scripts/test-runtime-heuristics.js && node scripts/test-agent-validator.js && node scripts/test-story-validator.js && node scripts/test-state.js && node scripts/test-dashboard.js && node scripts/test-automation-providers.js && node scripts/test-intent.js && node scripts/test-events.js && node scripts/test-golden-artifacts.js && node scripts/test-install-smoke.js && node scripts/test-checkpoint.js && node scripts/test-extensions.js && node scripts/test-event-reader.js && node scripts/test-state-lock.js && node scripts/test-cost-saver.js && node scripts/test-budget-onoff.js && node scripts/test-workflow-runner.js && npm run test:e2e && node scripts/test-otel-exporter.js && node scripts/test-extensions-publish.js",
9
+ "test": "node scripts/validate-skills.js && node scripts/test-doc-surface-counts.js && bash scripts/smoke.sh && node scripts/test-runtime.js && node scripts/test-router.js && node scripts/test-recipes.js && node scripts/test-context-writer.js && node scripts/test-pillars.js && node scripts/test-artifact-linter.js && node scripts/test-artifact-diff.js && node scripts/test-design-foundation.js && node scripts/test-linkage.js && node scripts/test-impact.js && node scripts/test-reverse-sync.js && node scripts/test-planning-systems.js && node scripts/test-feature-awareness.js && node scripts/test-integration.js && node scripts/test-cross-artifact.js && node scripts/test-awesome-design.js && node scripts/test-skillui-bridge.js && node scripts/test-runtime-verification.js && node scripts/test-agent-browser.js && node scripts/test-mode-d.js && node scripts/test-runtime-heuristics.js && node scripts/test-agent-validator.js && node scripts/test-story-validator.js && node scripts/test-state.js && node scripts/test-dashboard.js && node scripts/test-automation-providers.js && node scripts/test-intent.js && node scripts/test-events.js && node scripts/test-golden-artifacts.js && node scripts/test-install-smoke.js && node scripts/test-checkpoint.js && node scripts/test-extensions.js && node scripts/test-event-reader.js && node scripts/test-state-lock.js && node scripts/test-cost-saver.js && node scripts/test-budget-onoff.js && node scripts/test-workflow-runner.js && npm run test:e2e && node scripts/test-otel-exporter.js && node scripts/test-extensions-publish.js",
10
10
  "prepublishOnly": "npm test",
11
11
  "validate-skills": "node scripts/validate-skills.js",
12
12
  "test:surface": "node scripts/test-doc-surface-counts.js",
@@ -0,0 +1,61 @@
1
+ apiVersion: godpowers/v1
2
+ kind: CommandRouting
3
+ metadata:
4
+ command: /god-migrate
5
+ description: Detect and migrate GSD, BMAD, and Superpowers planning context
6
+ tier: 0
7
+
8
+ prerequisites:
9
+ required: []
10
+ recommended:
11
+ - command: /god-init
12
+ when: .godpowers-state-missing
13
+
14
+ execution:
15
+ spawns: []
16
+ context: current
17
+ reads:
18
+ - .planning/**
19
+ - .gsd/**
20
+ - _bmad-output/**
21
+ - .bmad/**
22
+ - docs/superpowers/**
23
+ writes:
24
+ - .godpowers/prep/IMPORTED-CONTEXT.md
25
+ - .godpowers/prd/PRD.md
26
+ - .godpowers/arch/ARCH.md
27
+ - .godpowers/roadmap/ROADMAP.md
28
+ - .godpowers/stack/DECISION.md
29
+ - .godpowers/build/STATE.md
30
+ - .godpowers/state.json
31
+ - .planning/GODPOWERS-SYNC.md
32
+ - .gsd/GODPOWERS-SYNC.md
33
+ - _bmad-output/GODPOWERS-SYNC.md
34
+ - .bmad/GODPOWERS-SYNC.md
35
+ - docs/superpowers/GODPOWERS-SYNC.md
36
+ local-runtime:
37
+ - lib/planning-systems.importPlanningContext
38
+ - lib/source-sync.run
39
+ conditional-spawns:
40
+ - agent: god-greenfieldifier
41
+ when: low-confidence-or-conflicting-import
42
+
43
+ standards:
44
+ gate-on-failure: pause-for-user
45
+
46
+ success-path:
47
+ next-recommended: /god-audit
48
+ alternatives:
49
+ - command: /god-prd
50
+ when: imported-prd-seed-needs-hardening
51
+ - command: /god-roadmap
52
+ when: imported-roadmap-seed-needs-hardening
53
+ - command: /god-sync
54
+ when: user-only-wants-sync-back
55
+
56
+ failure-path:
57
+ on-error: /god-doctor
58
+
59
+ endoff:
60
+ state-update: source-systems imported and sync-back timestamps updated
61
+ events: [migration.detected, artifact.imported, source-sync.updated]
@@ -74,6 +74,89 @@
74
74
  "description": "Slot for linkage map summary. Authoritative file is .godpowers/linkage.json.",
75
75
  "additionalProperties": true
76
76
  },
77
+ "source-systems": {
78
+ "type": "array",
79
+ "description": "Detected external planning systems imported into Godpowers and eligible for managed sync-back.",
80
+ "items": {
81
+ "type": "object",
82
+ "required": ["id", "name", "confidence", "files", "import-hash"],
83
+ "properties": {
84
+ "id": {
85
+ "type": "string",
86
+ "enum": ["gsd", "bmad", "superpowers", "other"]
87
+ },
88
+ "name": { "type": "string" },
89
+ "confidence": {
90
+ "type": "string",
91
+ "enum": ["high", "medium", "low"]
92
+ },
93
+ "markers": {
94
+ "type": "array",
95
+ "items": { "type": "string" }
96
+ },
97
+ "files": {
98
+ "type": "array",
99
+ "items": { "type": "string" }
100
+ },
101
+ "import-hash": {
102
+ "type": "string",
103
+ "pattern": "^sha256:[a-f0-9]{64}$"
104
+ },
105
+ "imported-at": {
106
+ "type": "string",
107
+ "format": "date-time"
108
+ },
109
+ "sync-back-enabled": {
110
+ "type": "boolean",
111
+ "default": true
112
+ },
113
+ "last-sync-back-hash": {
114
+ "anyOf": [
115
+ {
116
+ "type": "string",
117
+ "pattern": "^sha256:[a-f0-9]{64}$"
118
+ },
119
+ { "type": "null" }
120
+ ]
121
+ },
122
+ "last-sync-back-at": {
123
+ "type": "string",
124
+ "format": "date-time"
125
+ },
126
+ "conflict-count": {
127
+ "type": "integer",
128
+ "minimum": 0
129
+ }
130
+ },
131
+ "additionalProperties": false
132
+ }
133
+ },
134
+ "godpowers-features": {
135
+ "type": "object",
136
+ "description": "Installed Godpowers feature awareness recorded for this project.",
137
+ "required": ["feature-set-version", "runtime-version", "known"],
138
+ "properties": {
139
+ "feature-set-version": {
140
+ "type": "integer",
141
+ "minimum": 1
142
+ },
143
+ "runtime-version": {
144
+ "type": "string",
145
+ "pattern": "^(unknown|\\d+\\.\\d+\\.\\d+)$"
146
+ },
147
+ "known": {
148
+ "type": "array",
149
+ "items": {
150
+ "type": "string"
151
+ }
152
+ },
153
+ "last-awareness-refresh-at": {
154
+ "type": "string",
155
+ "format": "date-time"
156
+ }
157
+ },
158
+ "additionalProperties": false
159
+ },
77
160
  "yolo-decisions": {
78
161
  "type": "array",
79
162
  "description": "Auto-decisions made under --yolo. Mirrored to YOLO-DECISIONS.md.",
@@ -33,10 +33,12 @@ the Godpowers fences off, check status, or refresh on demand.
33
33
 
34
34
  1. Verify `.godpowers/` exists. If not, suggest `/god-init` first.
35
35
  2. Read `.godpowers/state.json`.
36
- 3. Call `lib/pillars.detect(projectRoot)`.
37
- 4. If Pillars is absent or partial, call `lib/pillars.init(projectRoot)`.
38
- 5. Spawn `god-context-writer` agent with the requested mode.
39
- 6. Report results.
36
+ 3. Call `lib/feature-awareness.run(projectRoot)` to record current runtime
37
+ features and refresh managed AI-tool awareness safely.
38
+ 4. Call `lib/pillars.detect(projectRoot)`.
39
+ 5. If Pillars is absent or partial, call `lib/pillars.init(projectRoot)`.
40
+ 6. Spawn `god-context-writer` agent with the requested mode.
41
+ 7. Report results.
40
42
 
41
43
  ## What gets written
42
44
 
@@ -136,6 +138,14 @@ When `/god-sync` runs (after a project run, or any sync), `god-updater` calls th
136
138
  with `refresh` to keep `AGENTS.md` content aligned with the latest project
137
139
  state (mode, scale, completed tiers, active artifacts).
138
140
 
141
+ For existing projects after a Godpowers upgrade, `/god-context refresh`
142
+ auto-invokes `lib/feature-awareness.run(projectRoot)`. Report it as:
143
+
144
+ ```
145
+ Agent: none, local runtime only
146
+ Why: this path records current runtime features and refreshes managed context fences
147
+ ```
148
+
139
149
  You can disable the Godpowers fences by running `/god-context off`. Pillars
140
150
  remains because it is the native context contract for Godpowers projects.
141
151
 
@@ -146,7 +156,7 @@ The fenced content contains:
146
156
  - Mode (greenfield/brownfield/audit) and scale
147
157
  - A short list of completed-tier artifact paths
148
158
  - Quarterback rule reminder
149
- - Top 4 useful slash commands
159
+ - Short useful slash command list
150
160
 
151
161
  It does NOT contain:
152
162
  - Secrets, credentials, API keys
@@ -32,6 +32,8 @@ Run a system-state diagnostic. Build nothing. Touch nothing. Report only.
32
32
  5. Is the reflog (`.godpowers/log`) parseable?
33
33
  6. Are there entries in `.godpowers/.trash/`?
34
34
  7. Do declared linkage entries point at real code files?
35
+ 8. Does `state.json` know the current Godpowers feature set?
36
+ 9. Are managed AI-tool context fences present when tools are detected?
35
37
 
36
38
  ### External integration health
37
39
  1. Is impeccable present? `node_modules/impeccable` or `~/.claude/skills/impeccable`?
@@ -46,13 +48,14 @@ Plain-text report grouped by severity:
46
48
  GODPOWERS DOCTOR
47
49
 
48
50
  Install: claude (~/.claude/)
49
- [OK] 108 skills installed
51
+ [OK] 109 skills installed
50
52
  [OK] 40 agents installed
51
53
  [OK] VERSION matches (1.6.6)
52
54
  [WARN] routing/god-doctor.yaml exists but skill file did not until now
53
55
 
54
56
  Project: /Users/.../my-project/.godpowers/
55
57
  [OK] state.json valid
58
+ [WARN] feature awareness stale -> run /god-context refresh
56
59
  [WARN] PRD declared but .godpowers/prd/PRD.md missing -> run /god-prd
57
60
  [INFO] 2 entries in .trash/; run /god-restore to review
58
61
 
@@ -96,12 +99,29 @@ Skip install checks. Useful inside the project.
96
99
  ### `/god-doctor --fix`
97
100
  Attempt to repair detected issues automatically (only for safe categories: regenerate missing routing YAMLs, repair PROGRESS.md from state.json, etc.). Pauses before any destructive change.
98
101
 
102
+ ## Feature Awareness
103
+
104
+ For initialized projects, `/god-doctor` calls `lib/feature-awareness.detect`
105
+ as a read-only diagnostic. It reports:
106
+ - runtime version recorded in `state.json`
107
+ - missing current Godpowers feature IDs
108
+ - missing managed AI-tool context fences
109
+ - unimported GSD, BMAD, or Superpowers evidence that should route to
110
+ `/god-migrate`
111
+ - `god-greenfieldifier` recommendation when migration evidence is low
112
+ confidence or conflicting
113
+
114
+ `/god-doctor --fix` may call `lib/feature-awareness.run(projectRoot)` because
115
+ that helper writes only safe state metadata and managed context fences.
116
+
99
117
  ## Implementation
100
118
 
101
119
  Built-in, no spawned agent. Reads:
102
120
  - `<runtime>/GODPOWERS_VERSION` (compare to package.json)
103
121
  - `<runtime>/skills/` and `<runtime>/agents/` listings
104
122
  - `.godpowers/state.json`, `intent.yaml`, `log`, `linkage.json`
123
+ - `lib/feature-awareness.detect(projectRoot)` for existing-project upgrade
124
+ awareness
105
125
  - `bin/install.js` VERSION constant
106
126
 
107
127
  ## Exit codes
@@ -44,6 +44,13 @@ needs to specify a mode.
44
44
  - If any are detected, summarize useful signals into
45
45
  `.godpowers/prep/IMPORTED-CONTEXT.md` as preparation context.
46
46
  Do not treat external planning-system files as source of truth.
47
+ - Auto-invoke `lib/planning-systems.importPlanningContext(projectRoot)`
48
+ when GSD, Superpowers, or BMAD context is detected. Report this as
49
+ `Agent: none, local runtime only`.
50
+ - If import confidence is low, more than one source system appears to
51
+ conflict, or canonical Godpowers seed artifacts cannot be created from
52
+ available evidence, spawn `god-greenfieldifier` to produce a controlled
53
+ migration plan before rewriting any canonical artifact.
47
54
  - Detect whether early design preparation is warranted:
48
55
  - UI frameworks or app models: React, Next, Vue, Nuxt, Svelte,
49
56
  SvelteKit, Astro, Remix, Angular, Solid, Flutter, Electron, Tauri
@@ -109,6 +116,9 @@ needs to specify a mode.
109
116
  - Write `.godpowers/prep/INITIAL-FINDINGS.md`
110
117
  - Run planning-system context detection for GSD, Superpowers, and BMAD
111
118
  - Write `.godpowers/prep/IMPORTED-CONTEXT.md` when useful context exists
119
+ - Run automatic planning-system import through
120
+ `lib/planning-systems.importPlanningContext(projectRoot)` and record
121
+ detected source systems under `state.json` `source-systems`
112
122
  - Initialize native Pillars context and record Pillars health in
113
123
  `INITIAL-FINDINGS.md`
114
124
  - For brownfield: schedule preflight before archaeology + reconstruction
@@ -0,0 +1,146 @@
1
+ ---
2
+ name: god-migrate
3
+ description: |
4
+ Detect GSD, BMAD, and Superpowers planning systems, migrate useful context
5
+ into Godpowers prep and seed artifacts, and sync Godpowers progress back to
6
+ the prior system through managed companion files.
7
+
8
+ Triggers on: "god migrate", "/god-migrate", "migrate from gsd",
9
+ "migrate from bmad", "migrate from superpowers", "sync back to gsd",
10
+ "sync back to bmad", "sync back to superpowers"
11
+ ---
12
+
13
+ # /god-migrate
14
+
15
+ Detect and migrate adjacent planning systems into Godpowers.
16
+
17
+ ## When To Use
18
+
19
+ - A project already has GSD `.planning/` or `.gsd/` context.
20
+ - A project already has BMAD `_bmad/`, `_bmad-output/`, `.bmad-core/`, or
21
+ `.bmad/` context.
22
+ - A project already has Superpowers specs, plans, or project-local skills.
23
+ - The user wants a reversible migration path into Godpowers.
24
+ - The user wants current Godpowers progress written back to the prior planning
25
+ system before returning to it.
26
+
27
+ ## Auto-Invoke Contract
28
+
29
+ `/god-init` auto-invokes the import path when it detects GSD, BMAD, or
30
+ Superpowers context. It must show this visible status card:
31
+
32
+ ```
33
+ Auto-invoked:
34
+ Trigger: /god-init planning-system detection
35
+ Agent: none, local runtime only
36
+ Local syncs:
37
+ + planning-system-import: <detected systems, written seeds, or no-op>
38
+ Artifacts: .godpowers/prep/IMPORTED-CONTEXT.md and optional seed artifacts
39
+ ```
40
+
41
+ `/god-sync` auto-invokes sync-back when `state.json` contains enabled
42
+ `source-systems` entries. It must show this visible status card:
43
+
44
+ ```
45
+ Auto-invoked:
46
+ Trigger: /god-sync source-system sync-back
47
+ Agent: none, local runtime only
48
+ Local syncs:
49
+ + source-sync: <written companion files, pointer fences, or no-op>
50
+ Artifacts: <.planning/GODPOWERS-SYNC.md, _bmad-output/GODPOWERS-SYNC.md, docs/superpowers/GODPOWERS-SYNC.md>
51
+ ```
52
+
53
+ If the import has low confidence, multiple conflicting systems, or missing
54
+ canonical Godpowers seeds after import, spawn `god-greenfieldifier` with a
55
+ fresh context and this instruction:
56
+
57
+ ```
58
+ This project has imported external planning-system context. Read
59
+ .godpowers/prep/IMPORTED-CONTEXT.md and .godpowers/state.json. Produce a
60
+ controlled migration plan that converts imported hypotheses into Godpowers
61
+ artifacts without overwriting source-system files outside managed fences.
62
+ ```
63
+
64
+ ## Runtime Calls
65
+
66
+ ### Import
67
+
68
+ Call:
69
+
70
+ ```
71
+ lib/planning-systems.importPlanningContext(projectRoot, {
72
+ syncBackEnabled: true
73
+ })
74
+ ```
75
+
76
+ This:
77
+ - detects GSD, BMAD, and Superpowers sources
78
+ - writes `.godpowers/prep/IMPORTED-CONTEXT.md`
79
+ - writes missing Godpowers seed artifacts when enough source evidence exists
80
+ - marks those seed artifacts as `imported` in `state.json`
81
+ - records detected systems under `state.json` `source-systems`
82
+
83
+ ### Sync-Back
84
+
85
+ Call:
86
+
87
+ ```
88
+ lib/source-sync.run(projectRoot)
89
+ ```
90
+
91
+ This:
92
+ - reads current Godpowers state and artifacts
93
+ - writes a managed companion file in the prior planning system
94
+ - writes pointer fences only when a safe native state file already exists
95
+ - updates `last-sync-back-hash` and `last-sync-back-at` in `state.json`
96
+
97
+ ## Source Mapping
98
+
99
+ | Source system | Import evidence | Godpowers destination | Sync-back destination |
100
+ |---|---|---|---|
101
+ | GSD | `.planning/PROJECT.md`, `REQUIREMENTS.md`, `ROADMAP.md`, `STATE.md`, phase files | prep context, PRD seed, roadmap seed, build-state seed | `.planning/GODPOWERS-SYNC.md` |
102
+ | GSD 2 | `.gsd/` files | prep context and seeds when source files are readable | `.gsd/GODPOWERS-SYNC.md` |
103
+ | BMAD | `_bmad-output/planning-artifacts/PRD.md`, `architecture.md`, epics, stories, sprint status | prep context, PRD seed, arch seed, roadmap seed | `_bmad-output/GODPOWERS-SYNC.md` |
104
+ | Superpowers | `docs/superpowers/specs/*.md`, `docs/superpowers/plans/*.md`, project-local skills | prep context, PRD seed, roadmap seed, build-state seed | `docs/superpowers/GODPOWERS-SYNC.md` |
105
+
106
+ ## Guardrails
107
+
108
+ - Do not delete, move, or rewrite GSD, BMAD, or Superpowers files.
109
+ - Do not treat imported content as authoritative until a Godpowers artifact or
110
+ the user confirms it.
111
+ - Do not write outside Godpowers-owned fences in source-system files.
112
+ - Do not overwrite existing Godpowers artifacts unless the user passes
113
+ `--force` and the command shows a diff or clear file list first.
114
+ - If conflicts appear, pause or spawn `god-greenfieldifier` for a controlled
115
+ migration plan.
116
+
117
+ ## Output
118
+
119
+ ```
120
+ Migration complete.
121
+
122
+ Detected:
123
+ + GSD: high confidence, 12 files
124
+ + BMAD: not detected
125
+ + Superpowers: medium confidence, 2 files
126
+
127
+ Imported:
128
+ + .godpowers/prep/IMPORTED-CONTEXT.md
129
+ + .godpowers/prd/PRD.md (imported seed)
130
+ + .godpowers/roadmap/ROADMAP.md (imported seed)
131
+
132
+ Sync-back:
133
+ + .planning/GODPOWERS-SYNC.md
134
+
135
+ Auto-spawn:
136
+ + god-greenfieldifier: skipped, import confidence high and no conflicts
137
+
138
+ Suggested next:
139
+ /god-audit to score imported seeds before treating them as authoritative.
140
+ ```
141
+
142
+ ## Locking
143
+
144
+ Acquire the state lock with scope `migration.source-systems` before writing
145
+ `.godpowers/prep/IMPORTED-CONTEXT.md`, seed artifacts, source-system companion
146
+ files, or `state.json`.