graphify-openspec-bridge 1.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 klc
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,148 @@
1
+ # graphify-openspec-bridge
2
+
3
+ **OpenSpec + Graphify = codebase-aware AI workflow.**
4
+
5
+ Bridge your OpenSpec change proposals with your codebase's knowledge graph. Every artifact—proposal, specs, design, tasks—is grounded in real code structure instead of guesswork.
6
+
7
+ ```mermaid
8
+ flowchart LR
9
+ A[OpenSpec Change] --> B[graphify-augmented Schema]
10
+ B --> C[Graphify Query]
11
+ C --> D[Knowledge Graph]
12
+ D --> E[Code-aware Artifacts]
13
+ E --> F[Better AI Output]
14
+ ```
15
+
16
+ ## Features
17
+
18
+ - **Graphify-first workflow** — 5-artifact pipeline: proposal → explore → specs → design → tasks
19
+ - **Exploration step** — dedicated artifact for graphify query results before design
20
+ - **CLI diagnostics** — check runtime, dependency, and project health
21
+ - **Zero-config install** — single command copies schema + configures OpenSpec
22
+
23
+ ## Install
24
+
25
+ ### One-liner
26
+
27
+ ```bash
28
+ npx graphify-openspec-bridge install ./my-project --with-config
29
+ ```
30
+
31
+ ### Global install
32
+
33
+ ```bash
34
+ npm install -g graphify-openspec-bridge
35
+
36
+ # Alias: gob
37
+ gob install ./my-project --with-config
38
+ ```
39
+
40
+ ### Prerequisites
41
+
42
+ | Tool | Install |
43
+ |------|---------|
44
+ | [OpenSpec CLI](https://github.com/Fission-AI/OpenSpec) | `npm install -g @fission-ai/openspec` |
45
+ | [Graphify](https://github.com/safishamsi/graphify) | `pipx install graphifyy` |
46
+ | Node.js 16+ | `node --version` |
47
+
48
+ ## Quick Start
49
+
50
+ ```bash
51
+ # 1. Check your project is ready
52
+ gob check
53
+
54
+ # 2. Install the graphify-augmented schema
55
+ gob install --with-config
56
+
57
+ # 3. Validate
58
+ gob validate
59
+
60
+ # 4. Start a codebase-aware change
61
+ openspec new change my-feature --schema graphify-augmented
62
+
63
+ # 5. Before writing the proposal, explore your codebase
64
+ openspec new artifact explore # runs graphify query/path/explain
65
+ ```
66
+
67
+ ## CLI Reference
68
+
69
+ ### `check [path]`
70
+
71
+ Check runtime (Node.js), dependencies (OpenSpec, Graphify), and project state (config, schema, graph).
72
+
73
+ ```bash
74
+ gob check ~/my-project
75
+ ```
76
+
77
+ Output:
78
+
79
+ ```
80
+ Runtime
81
+ ✓ Node.js v24.12.0
82
+
83
+ Dependencies
84
+ ✓ openspec 1.3.1
85
+ ✓ graphify 0.8.19
86
+
87
+ Project
88
+ ✓ openspec/config.yaml
89
+ ✓ openspec/schemas/graphify-augmented/ (schema.yaml + 5 templates)
90
+ ✓ graphify-out/graph.json (2304 nodes, 2408 edges)
91
+
92
+ Status: Ready
93
+ ```
94
+
95
+ ### `install [path] [--with-config]`
96
+
97
+ Copy the `graphify-augmented` schema to a project's `openspec/schemas/` directory.
98
+
99
+ | Flag | Effect |
100
+ |------|--------|
101
+ | `--with-config` | Also update `openspec/config.yaml` with graphify context + rules |
102
+
103
+ ### `validate`
104
+
105
+ Run `openspec schema validate graphify-augmented` to verify the schema is correctly installed.
106
+
107
+ ### `version`
108
+
109
+ Print package version.
110
+
111
+ ### `help`
112
+
113
+ Show usage information.
114
+
115
+ ## Schema: graphify-augmented
116
+
117
+ The schema follows this workflow:
118
+
119
+ ```
120
+ proposal (why) → explore (graph) → specs (what) → design (how) → tasks (do)
121
+ ```
122
+
123
+ | Artifact | Description | Graphify Usage |
124
+ |----------|-------------|----------------|
125
+ | **proposal** | Business motivation, capabilities | `graphify query <domain>` for codebase context |
126
+ | **explore** | Knowledge graph deep-dive | `query` + `path` + `explain` — maps affected areas |
127
+ | **specs** | Detailed requirements | References exploration findings |
128
+ | **design** | Technical architecture | `graphify path` to verify connections |
129
+ | **tasks** | Implementation checklist | Tasks annotated with graph node references |
130
+ | **apply** | Execute tasks | Auto-runs `graphify update .` on completion |
131
+
132
+ ## Development
133
+
134
+ ```bash
135
+ git clone https://github.com/klc/graphify-openspec-bridge
136
+ cd graphify-openspec-bridge
137
+ npm link
138
+ gob check
139
+ ```
140
+
141
+ ## Related
142
+
143
+ - [OpenSpec](https://github.com/Fission-AI/OpenSpec) — AI-native spec-driven development
144
+ - [Graphify](https://github.com/safishamsi/graphify) — turn any folder into a queryable knowledge graph
145
+
146
+ ## License
147
+
148
+ MIT
@@ -0,0 +1,393 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ const fs = require('fs');
5
+ const path = require('path');
6
+ const { execSync } = require('child_process');
7
+ const os = require('os');
8
+
9
+ // ── Config ──────────────────────────────────────────────────────────────────
10
+ const PKG = JSON.parse(
11
+ fs.readFileSync(path.join(__dirname, '..', 'package.json'), 'utf8')
12
+ );
13
+ const VERSION = PKG.version;
14
+ const NAME = PKG.name;
15
+ const SCHEMA_DIR = 'openspec/schemas/graphify-augmented';
16
+
17
+ // ── Helpers ─────────────────────────────────────────────────────────────────
18
+
19
+ function color(code, s) {
20
+ // Skip color if piped or NO_COLOR
21
+ if (!process.stdout.isTTY || process.env.NO_COLOR) return s;
22
+ return `\x1b[${code}m${s}\x1b[0m`;
23
+ }
24
+ const green = s => color('32', s);
25
+ const red = s => color('31', s);
26
+ const yellow = s => color('33', s);
27
+ const dim = s => color('90', s);
28
+ const bold = s => color('1', s);
29
+
30
+ function which(name) {
31
+ // `which` on Unix, `where` on Windows
32
+ const cmd = os.platform() === 'win32' ? 'where' : 'which';
33
+ try {
34
+ const out = execSync(`${cmd} ${name}`, { encoding: 'utf8', stdio: ['pipe', 'pipe', 'pipe'] }).trim();
35
+ return out.split('\n')[0]; // first match
36
+ } catch {
37
+ return null;
38
+ }
39
+ }
40
+
41
+ function execVersion(name, args = ['--version']) {
42
+ try {
43
+ return execSync(`${name} ${args.join(' ')}`, { encoding: 'utf8', stdio: ['pipe', 'pipe', 'pipe'] }).trim();
44
+ } catch {
45
+ return null;
46
+ }
47
+ }
48
+
49
+ function resolveTarget(targetPath) {
50
+ return targetPath ? path.resolve(targetPath) : process.cwd();
51
+ }
52
+
53
+ // ── Check logic ─────────────────────────────────────────────────────────────
54
+
55
+ function checkRuntime() {
56
+ const v = process.versions.node;
57
+ const major = parseInt(v.split('.')[0], 10);
58
+ const ok = major >= 16;
59
+ return { name: 'Node.js', version: `v${v}`, ok };
60
+ }
61
+
62
+ function checkTool(name) {
63
+ const loc = which(name);
64
+ if (!loc) return { name, ok: false, version: null, path: null };
65
+ let version = null;
66
+ try {
67
+ version = execVersion(name);
68
+ } catch { /* ignore */ }
69
+ return { name, ok: true, version: version || '?', path: loc };
70
+ }
71
+
72
+ function checkProject(targetPath) {
73
+ const results = [];
74
+
75
+ // config.yaml
76
+ const configPath = path.join(targetPath, 'openspec', 'config.yaml');
77
+ const hasConfig = fs.existsSync(configPath);
78
+ results.push({
79
+ label: 'openspec/config.yaml',
80
+ ok: hasConfig,
81
+ detail: hasConfig ? 'exists' : 'missing — run openspec init'
82
+ });
83
+
84
+ // Schema installed
85
+ const schemaPath = path.join(targetPath, 'openspec', 'schemas', 'graphify-augmented', 'schema.yaml');
86
+ const hasSchema = fs.existsSync(schemaPath);
87
+ const templatesDir = path.join(targetPath, 'openspec', 'schemas', 'graphify-augmented', 'templates');
88
+ const templateCount = fs.existsSync(templatesDir)
89
+ ? fs.readdirSync(templatesDir).filter(f => f.endsWith('.md')).length
90
+ : 0;
91
+ results.push({
92
+ label: `openspec/schemas/graphify-augmented/`,
93
+ ok: hasSchema && templateCount === 5,
94
+ detail: hasSchema
95
+ ? `schema.yaml + ${templateCount} templates`
96
+ : 'schema not installed'
97
+ });
98
+
99
+ // graphify-out/graph.json
100
+ const graphPath = path.join(targetPath, 'graphify-out', 'graph.json');
101
+ const hasGraph = fs.existsSync(graphPath);
102
+ let graphDetail = 'not found — run /graphify .';
103
+ if (hasGraph) {
104
+ try {
105
+ const g = JSON.parse(fs.readFileSync(graphPath, 'utf8'));
106
+ const nodes = g.nodes ? g.nodes.length : '?';
107
+ const edges = g.links ? g.links.length : '?';
108
+ graphDetail = `${nodes} nodes, ${edges} edges`;
109
+ } catch {
110
+ graphDetail = 'exists (parse error)';
111
+ }
112
+ }
113
+ results.push({
114
+ label: 'graphify-out/graph.json',
115
+ ok: hasGraph,
116
+ detail: graphDetail
117
+ });
118
+
119
+ return results;
120
+ }
121
+
122
+ // ── Commands ────────────────────────────────────────────────────────────────
123
+
124
+ function cmdCheck(argv) {
125
+ const target = resolveTarget(argv[0]);
126
+
127
+ console.log('');
128
+ console.log(bold(`${NAME} v${VERSION} — check`));
129
+ console.log('');
130
+
131
+ // Runtime
132
+ const rt = checkRuntime();
133
+ console.log(` ${bold('Runtime')}`);
134
+ console.log(` ${rt.ok ? green('✓') : red('✗')} ${rt.name} ${dim(rt.version)}`);
135
+ console.log('');
136
+
137
+ // Dependencies
138
+ console.log(` ${bold('Dependencies')}`);
139
+ const deps = ['openspec', 'graphify'].map(checkTool);
140
+ for (const d of deps) {
141
+ const icon = d.ok ? green('✓') : red('✗');
142
+ const hint = d.ok ? dim(d.path) : dim(`install: ${d.name === 'graphify' ? 'pipx install graphifyy' : 'npm install -g @fission-ai/openspec'}`);
143
+ console.log(` ${icon} ${d.name} ${d.version ? dim(d.version) : ''} ${hint}`);
144
+ }
145
+ console.log('');
146
+
147
+ // Project
148
+ const projectExists = fs.existsSync(path.join(target, 'openspec'));
149
+ if (projectExists) {
150
+ console.log(` ${bold('Project')} ${dim(target)}`);
151
+ const checks = checkProject(target);
152
+ for (const c of checks) {
153
+ const icon = c.ok ? green('✓') : red('✗');
154
+ console.log(` ${icon} ${c.label} ${dim(c.detail)}`);
155
+ }
156
+ } else {
157
+ console.log(` ${yellow('⚠')} ${bold('Project')} ${dim(target)}`);
158
+ console.log(` ${dim('not an OpenSpec project — run openspec init')}`);
159
+ }
160
+
161
+ // Summary
162
+ const allOk = rt.ok && deps.every(d => d.ok) && projectExists && checkProject(target).every(c => c.ok);
163
+ console.log('');
164
+ console.log(allOk ? green('Status: Ready') : yellow('Status: Needs attention'));
165
+ console.log('');
166
+ process.exit(allOk ? 0 : 1);
167
+ }
168
+
169
+ function cmdInstall(argv) {
170
+ const target = resolveTarget(argv[0]);
171
+ const withConfig = argv.includes('--with-config');
172
+
173
+ console.log('');
174
+ console.log(bold(`${NAME} v${VERSION} — install`));
175
+ console.log(` ${dim('Target: ' + target)}`);
176
+ console.log('');
177
+
178
+ // Source schema directory (within this package)
179
+ const srcSchema = path.join(__dirname, '..', SCHEMA_DIR);
180
+ const dstSchema = path.join(target, 'openspec', 'schemas', 'graphify-augmented');
181
+
182
+ if (!fs.existsSync(srcSchema)) {
183
+ console.log(` ${red('✗')} Schema source not found: ${srcSchema}`);
184
+ console.log('');
185
+ process.exit(1);
186
+ }
187
+
188
+ // Create target directory
189
+ fs.mkdirSync(dstSchema, { recursive: true });
190
+ fs.mkdirSync(path.join(dstSchema, 'templates'), { recursive: true });
191
+
192
+ // Copy schema.yaml
193
+ try {
194
+ fs.copyFileSync(
195
+ path.join(srcSchema, 'schema.yaml'),
196
+ path.join(dstSchema, 'schema.yaml')
197
+ );
198
+ } catch (e) {
199
+ console.log(` ${red('✗')} Failed to copy schema.yaml: ${e.message}`);
200
+ process.exit(1);
201
+ }
202
+
203
+ // Copy templates
204
+ const srcTemplates = path.join(srcSchema, 'templates');
205
+ const dstTemplates = path.join(dstSchema, 'templates');
206
+ const templates = fs.readdirSync(srcTemplates).filter(f => f.endsWith('.md'));
207
+ let copied = 1; // schema.yaml
208
+ for (const t of templates) {
209
+ try {
210
+ fs.copyFileSync(path.join(srcTemplates, t), path.join(dstTemplates, t));
211
+ copied++;
212
+ } catch (e) {
213
+ console.log(` ${yellow('⚠')} Failed to copy ${t}: ${e.message}`);
214
+ }
215
+ }
216
+
217
+ console.log(` ${green('✓')} Schema files copied (${copied} files)`);
218
+ console.log(` ${dim(dstSchema)}`);
219
+ console.log('');
220
+
221
+ // --with-config
222
+ if (withConfig) {
223
+ const configPath = path.join(target, 'openspec', 'config.yaml');
224
+
225
+ // Backup existing
226
+ if (fs.existsSync(configPath)) {
227
+ const bak = configPath + '.bak';
228
+ try {
229
+ fs.copyFileSync(configPath, bak);
230
+ console.log(` ${green('✓')} Backup: config.yaml → config.yaml.bak`);
231
+ } catch (e) {
232
+ console.log(` ${yellow('⚠')} Backup failed: ${e.message}`);
233
+ }
234
+ }
235
+
236
+ const contextBlock = `context: |
237
+ This project uses graphify knowledge graph for codebase awareness.
238
+ Graph file: graphify-out/graph.json
239
+ GRAPH_REPORT.md: graphify-out/GRAPH_REPORT.md
240
+ Interactive viz: graphify-out/graph.html
241
+
242
+ Commands:
243
+ graphify query "<question>" - BFS traversal, broad context
244
+ graphify path "<A>" "<B>" - shortest path between concepts
245
+ graphify explain "<node>" - deep-dive on a node
246
+
247
+ rules:
248
+ proposal:
249
+ - Run \`graphify query "<domain>"\` BEFORE writing proposal
250
+ - Include Graph Context section with god nodes and communities
251
+ explore:
252
+ - Run ALL three: graphify query, graphify path, graphify explain
253
+ - Document confidence tags for each edge
254
+ specs:
255
+ - Reference exploration.md findings when defining requirements
256
+ design:
257
+ - Run \`graphify path\` to verify architectural connections
258
+ tasks:
259
+ - Annotate tasks with graph nodes: [Node: NodeName]
260
+ `;
261
+
262
+ // Check if config exists and has schema line
263
+ const configContent = fs.existsSync(configPath) ? fs.readFileSync(configPath, 'utf8') : '';
264
+ const hasSchemaLine = configContent.includes('schema:');
265
+
266
+ let newConfig = '';
267
+ if (hasSchemaLine) {
268
+ // Replace schema line, append context
269
+ newConfig = configContent.replace(/^schema:.*$/m, 'schema: graphify-augmented');
270
+ // Append context if not already there
271
+ if (!configContent.includes('graphify knowledge graph')) {
272
+ newConfig += '\n' + contextBlock;
273
+ }
274
+ } else {
275
+ newConfig = 'schema: graphify-augmented\n\n' + contextBlock;
276
+ }
277
+
278
+ try {
279
+ fs.writeFileSync(configPath, newConfig, 'utf8');
280
+ console.log(` ${green('✓')} config.yaml updated (schema: graphify-augmented + context + rules)`);
281
+ } catch (e) {
282
+ console.log(` ${red('✗')} Failed to update config.yaml: ${e.message}`);
283
+ }
284
+ console.log('');
285
+ }
286
+
287
+ // Summary
288
+ console.log(` ${green('✓')} Install complete`);
289
+ console.log('');
290
+ console.log(` ${bold('Next steps:')}`);
291
+ console.log(` openspec schema validate graphify-augmented`);
292
+ console.log(` openspec new change <name> --schema graphify-augmented`);
293
+ console.log('');
294
+ }
295
+
296
+ function cmdValidate() {
297
+ console.log('');
298
+ console.log(bold(`${NAME} v${VERSION} — validate`));
299
+ console.log('');
300
+
301
+ const openspecPath = which('openspec');
302
+ if (!openspecPath) {
303
+ console.log(` ${red('✗')} OpenSpec CLI not found`);
304
+ console.log(` ${dim('Install: npm install -g @fission-ai/openspec')}`);
305
+ console.log('');
306
+ process.exit(1);
307
+ }
308
+
309
+ try {
310
+ const out = execSync('openspec schema validate graphify-augmented', {
311
+ encoding: 'utf8',
312
+ stdio: ['pipe', 'pipe', 'pipe']
313
+ });
314
+ console.log(out.trim());
315
+ console.log('');
316
+ console.log(` ${green('✓')} Schema is valid`);
317
+ console.log('');
318
+ } catch (e) {
319
+ console.log(` ${red('✗')} Validation failed:`);
320
+ console.log(` ${dim(e.stderr ? e.stderr.trim() : e.message)}`);
321
+ console.log('');
322
+ process.exit(1);
323
+ }
324
+ }
325
+
326
+ function cmdHelp() {
327
+ console.log(`
328
+ ${bold(NAME)} v${VERSION}
329
+
330
+ Bridge between OpenSpec and Graphify — codebase-aware OpenSpec workflow.
331
+
332
+ ${bold('Usage:')}
333
+ ${dim('graphify-openspec-bridge')} ${green('<command>')} ${yellow('[options]')}
334
+ ${dim('gob')} ${green('<command>')} ${yellow('[options]')}
335
+
336
+ ${bold('Commands:')}
337
+ ${green('check')} ${yellow('[path]')} Check runtime, deps, and project state
338
+ ${green('install')} ${yellow('[path]')} ${yellow('[--with-config]')} Install schema to project
339
+ ${green('validate')} Validate schema installation
340
+ ${green('version')} Show version
341
+ ${green('help')} Show this help
342
+
343
+ ${bold('Examples:')}
344
+ ${dim('# Check current project')}
345
+ gob check
346
+
347
+ ${dim('# Check specific project')}
348
+ gob check ~/my-project
349
+
350
+ ${dim('# Install schema')}
351
+ gob install ~/my-project
352
+
353
+ ${dim('# Install with config update')}
354
+ gob install ~/my-project --with-config
355
+
356
+ ${dim('# Validate schema')}
357
+ gob validate
358
+
359
+ ${bold('Docs:')} https://github.com/klc/graphify-openspec-bridge
360
+ `);
361
+ }
362
+
363
+ function cmdVersion() {
364
+ console.log(`${NAME} v${VERSION}`);
365
+ }
366
+
367
+ // ── Main ────────────────────────────────────────────────────────────────────
368
+
369
+ const args = process.argv.slice(2);
370
+ const cmd = args[0] || 'help';
371
+
372
+ switch (cmd) {
373
+ case 'check':
374
+ cmdCheck(args.slice(1));
375
+ break;
376
+ case 'install':
377
+ cmdInstall(args.slice(1));
378
+ break;
379
+ case 'validate':
380
+ cmdValidate();
381
+ break;
382
+ case 'version':
383
+ case '--version':
384
+ case '-v':
385
+ cmdVersion();
386
+ break;
387
+ case 'help':
388
+ case '--help':
389
+ case '-h':
390
+ default:
391
+ cmdHelp();
392
+ break;
393
+ }
@@ -0,0 +1,170 @@
1
+ name: graphify-augmented
2
+ version: 1
3
+ description: Graphify-augmented workflow - every artifact grounded in your codebase's knowledge graph. Adds an explore step between proposal and design for codebase-aware specs, designs, and tasks.
4
+
5
+ artifacts:
6
+ - id: proposal
7
+ generates: proposal.md
8
+ description: Initial proposal document outlining the change
9
+ template: proposal.md
10
+ instruction: |
11
+ Before writing the proposal, run `graphify query "<domain>"` to understand the codebase landscape relevant to this change. Find the god nodes and communities that this change will affect.
12
+
13
+ Then create the proposal document that establishes WHY this change is needed.
14
+
15
+ Sections:
16
+ - **Why**: 1-2 sentences on the problem or opportunity. What problem does this solve? Why now?
17
+ - **What Changes**: Bullet list of changes. Be specific about new capabilities, modifications, or removals. Mark breaking changes with **BREAKING**.
18
+ - **Capabilities**: Identify which specs will be created or modified:
19
+ - **New Capabilities**: List capabilities being introduced. Each becomes a new `specs/<name>/spec.md`. Use kebab-case names (e.g., `user-auth`, `data-export`).
20
+ - **Modified Capabilities**: List existing capabilities whose REQUIREMENTS are changing (not just implementation details). Each needs a delta spec file. Check `openspec/specs/` for existing spec names. Leave empty if no requirement changes.
21
+ - **Graph Context**: Summarize key graphify findings - which communities, god nodes, and code areas are relevant
22
+ - **Impact**: Affected code, APIs, dependencies, or systems
23
+
24
+ IMPORTANT: The Capabilities section is critical. It creates the contract between
25
+ proposal and specs phases. Research existing specs before filling this in.
26
+ Each capability listed here will need a corresponding spec file.
27
+
28
+ Keep it concise (1-2 pages). Focus on the "why" not the "how" -
29
+ implementation details belong in design.md.
30
+
31
+ This is the foundation - specs, design, and tasks all build on this.
32
+ requires: []
33
+
34
+ - id: explore
35
+ generates: exploration.md
36
+ description: Graphify exploration of relevant codebase areas
37
+ template: explore.md
38
+ instruction: |
39
+ Run graphify queries to map the codebase areas affected by this change. This artifact captures the knowledge graph exploration results that subsequent artifacts will reference.
40
+
41
+ Required graphify commands (run each and document results):
42
+
43
+ 1. **`graphify query "<change domain>"`** - Broad context. Find god nodes, relevant communities, and all code areas related to this change. Document the key nodes and their relationships.
44
+
45
+ 2. **`graphify path <concept_A> <concept_B>`** - Relationship mapping. Trace connections between the main components this change touches. Document each hop with its relation and confidence level.
46
+
47
+ 3. **`graphify explain <key_concept>`** - Deep dive on critical components. Document the node's degree, connections, source files, and what its neighbors reveal.
48
+
49
+ If a concept has no matching node, note that as a gap - this means the graph doesn't cover that area yet.
50
+
51
+ Document all findings in the template below. Each finding should include the source file location and confidence tag (EXTRACTED/INFERRED/AMBIGUOUS).
52
+ requires:
53
+ - proposal
54
+
55
+ - id: specs
56
+ generates: "specs/**/*.md"
57
+ description: Detailed specifications for the change
58
+ template: spec.md
59
+ instruction: |
60
+ Read exploration.md to understand the codebase context. Use the graph findings to identify all affected components, interfaces, and data flows.
61
+
62
+ Create one spec file per capability listed in the proposal's Capabilities section.
63
+ - New capabilities: use the exact kebab-case name from the proposal (specs/<capability>/spec.md).
64
+ - Modified capabilities: use the existing spec folder name from openspec/specs/<capability>/ when creating the delta spec at specs/<capability>/spec.md.
65
+
66
+ Delta operations (use ## headers):
67
+ - **ADDED Requirements**: New capabilities
68
+ - **MODIFIED Requirements**: Changed behavior - MUST include full updated content
69
+ - **REMOVED Requirements**: Deprecated features - MUST include **Reason** and **Migration**
70
+ - **RENAMED Requirements**: Name changes only - use FROM:/TO: format
71
+
72
+ Format requirements:
73
+ - Each requirement: `### Requirement: <name>` followed by description
74
+ - Use SHALL/MUST for normative requirements (avoid should/may)
75
+ - Each scenario: `#### Scenario: <name>` with WHEN/THEN format
76
+ - **CRITICAL**: Scenarios MUST use exactly 4 hashtags (`####`). Using 3 hashtags or bullets will fail silently.
77
+ - Every requirement MUST have at least one scenario.
78
+
79
+ MODIFIED requirements workflow:
80
+ 1. Locate the existing requirement in openspec/specs/<capability>/spec.md
81
+ 2. Copy the ENTIRE requirement block (from `### Requirement:` through all scenarios)
82
+ 3. Paste under `## MODIFIED Requirements` and edit to reflect new behavior
83
+ 4. Ensure header text matches exactly (whitespace-insensitive)
84
+
85
+ Common pitfall: Using MODIFIED with partial content loses detail at archive time.
86
+ If adding new concerns without changing existing behavior, use ADDED instead.
87
+
88
+ Specs should be testable - each scenario is a potential test case.
89
+ requires:
90
+ - proposal
91
+ - explore
92
+
93
+ - id: design
94
+ generates: design.md
95
+ description: Technical design document with implementation details
96
+ template: design.md
97
+ instruction: |
98
+ Reference exploration.md for codebase relationships. Run graphify queries to verify architectural understanding before writing.
99
+
100
+ Before writing, optionally run:
101
+ - `graphify path <component_A> <component_B>` to verify how two components connect
102
+ - `graphify explain <key_component>` to deep-dive on critical modules
103
+
104
+ When to include design.md (create only if any apply):
105
+ - Cross-cutting change (multiple services/modules) or new architectural pattern
106
+ - New external dependency or significant data model changes
107
+ - Security, performance, or migration complexity
108
+ - Ambiguity that benefits from technical decisions before coding
109
+
110
+ Sections:
111
+ - **Context**: Background, current state, constraints, stakeholders. Reference graph communities from exploration.md.
112
+ - **Goals / Non-Goals**: What this design achieves and explicitly excludes
113
+ - **Decisions**: Key technical choices with rationale (why X over Y?). Include alternatives considered for each decision.
114
+ - **Risks / Trade-offs**: Known limitations, things that could go wrong. Format: [Risk] → Mitigation
115
+ - **Graph Verification**: How graphify queries confirmed (or challenged) architectural assumptions
116
+ - **Migration Plan**: Steps to deploy, rollback strategy (if applicable)
117
+ - **Open Questions**: Outstanding decisions or unknowns to resolve
118
+
119
+ Focus on architecture and approach, not line-by-line implementation.
120
+ Reference the proposal for motivation and specs for requirements.
121
+ requires:
122
+ - explore
123
+ - proposal
124
+
125
+ - id: tasks
126
+ generates: tasks.md
127
+ description: Implementation checklist with trackable tasks
128
+ template: tasks.md
129
+ instruction: |
130
+ Create the task list that breaks down the implementation work. Each task should reference the graph nodes and source files identified in exploration.md.
131
+
132
+ **IMPORTANT: Follow the template below exactly.** The apply phase parses
133
+ checkbox format to track progress. Tasks not using `- [ ]` won't be tracked.
134
+
135
+ Guidelines:
136
+ - Group related tasks under ## numbered headings
137
+ - Each task MUST be a checkbox: `- [ ] X.Y Task description`
138
+ - Tasks should be small enough to complete in one session
139
+ - Order tasks by dependency (what must be done first?)
140
+ - If applicable, annotate tasks with the graph nodes they affect: `[Node: NodeName]`
141
+
142
+ Example:
143
+ ```
144
+ ## 1. Setup
145
+
146
+ - [ ] 1.1 Create new module structure [Node: ModuleStructure]
147
+ - [ ] 1.2 Add dependencies to package.json
148
+
149
+ ## 2. Core Implementation
150
+
151
+ - [ ] 2.1 Implement data export function [Node: DataExportService]
152
+ - [ ] 2.2 Add CSV formatting utilities
153
+ ```
154
+
155
+ Reference specs for what needs to be built, design for how to build it.
156
+ Each task should be verifiable - you know when it's done.
157
+ requires:
158
+ - specs
159
+ - design
160
+
161
+ apply:
162
+ requires: [tasks]
163
+ tracks: tasks.md
164
+ instruction: |
165
+ Read context files, work through pending tasks, mark complete as you go.
166
+ Pause if you hit blockers or need clarification.
167
+
168
+ After all tasks are complete, ALWAYS run `graphify update .` to keep the
169
+ knowledge graph current with the new code. This ensures future artifacts
170
+ see the latest codebase structure.
@@ -0,0 +1,27 @@
1
+ ## Context
2
+
3
+ <!-- Background and current state. Reference graph communities from exploration.md. -->
4
+
5
+ ## Goals / Non-Goals
6
+
7
+ **Goals:**
8
+ <!-- What this design aims to achieve -->
9
+
10
+ **Non-Goals:**
11
+ <!-- What is explicitly out of scope -->
12
+
13
+ ## Decisions
14
+
15
+ <!-- Key design decisions and rationale -->
16
+
17
+ ## Graph Verification
18
+
19
+ <!-- How graphify queries confirmed or challenged architectural assumptions.
20
+ Run: graphify path <component_A> <component_B> to verify connections. -->
21
+
22
+ - **Verified**: <!-- connections confirmed by graph -->
23
+ - **Challenged**: <!-- assumptions the graph contradicted -->
24
+
25
+ ## Risks / Trade-offs
26
+
27
+ <!-- Known risks and trade-offs -->
@@ -0,0 +1,75 @@
1
+ ## Domain Overview
2
+
3
+ <!--
4
+ Run: graphify query "<change domain>"
5
+ Document the broad codebase context: god nodes, relevant communities, key relationships.
6
+ -->
7
+
8
+ ### Communities
9
+
10
+ | Community | Nodes | Relevance |
11
+ |-----------|-------|-----------|
12
+ | <!-- community name --> | <!-- key nodes --> | <!-- why relevant --> |
13
+
14
+ ### God Nodes
15
+
16
+ <!-- Most-connected concepts in the affected area -->
17
+
18
+ | Node | Degree | Source File |
19
+ |------|--------|-------------|
20
+ | <!-- node name --> | <!-- degree --> | <!-- source location --> |
21
+
22
+ ## Path Analysis
23
+
24
+ <!--
25
+ Run: graphify path <concept_A> <concept_B>
26
+ Trace connections between main components this change touches.
27
+ -->
28
+
29
+ ### Path: <concept_A> → <concept_B>
30
+
31
+ | Hop | Relation | Confidence | Source |
32
+ |-----|----------|------------|--------|
33
+ | <!-- node A --> | <!-- relation --> | <!-- EXTRACTED/INFERRED --> | <!-- file --> |
34
+ | <!-- node B --> | <!-- relation --> | <!-- EXTRACTED/INFERRED --> | <!-- file --> |
35
+
36
+ ### Path: <concept_C> → <concept_D>
37
+
38
+ <!-- Repeat for each critical path -->
39
+
40
+ ## Deep Dives
41
+
42
+ <!--
43
+ Run: graphify explain <key_concept>
44
+ Deep-dive on critical components.
45
+ -->
46
+
47
+ ### <Concept Name>
48
+
49
+ - **Degree**: <!-- number of connections -->
50
+ - **Type**: <!-- code/document/paper -->
51
+ - **Source**: <!-- source file -->
52
+ - **Connections**: <!-- key neighbors with relations -->
53
+
54
+ <!-- Repeat for each key concept -->
55
+
56
+ ## Graph Gaps
57
+
58
+ <!-- Nodes or concepts that DON'T exist in the graph.
59
+ This means the codebase area is not yet mapped. -->
60
+
61
+ - <!-- missing concept -->
62
+
63
+ ## Key Findings
64
+
65
+ <!-- Surprising connections, architectural insights, risks discovered via graph -->
66
+
67
+ 1. <!-- finding -->
68
+ 2. <!-- finding -->
69
+
70
+ ## Suggested Queries
71
+
72
+ <!-- Questions the graph can answer for the next phases -->
73
+
74
+ - `graphify query "..."` — <!-- what it reveals -->
75
+ - `graphify path "..." "..."` — <!-- what it connects -->
@@ -0,0 +1,33 @@
1
+ ## Why
2
+
3
+ <!-- Explain the motivation for this change. What problem does this solve? Why now?
4
+ After running graphify query "<domain>", note relevant findings here. -->
5
+
6
+ ## What Changes
7
+
8
+ <!-- Describe what will change. Be specific about new capabilities, modifications, or removals. -->
9
+
10
+ ## Capabilities
11
+
12
+ ### New Capabilities
13
+ <!-- Capabilities being introduced. Replace <name> with kebab-case identifier (e.g., user-auth, data-export, api-rate-limiting). Each creates specs/<name>/spec.md -->
14
+ - `<name>`: <brief description of what this capability covers>
15
+
16
+ ### Modified Capabilities
17
+ <!-- Existing capabilities whose REQUIREMENTS are changing (not just implementation).
18
+ Only list here if spec-level behavior changes. Each needs a delta spec file.
19
+ Use existing spec names from openspec/specs/. Leave empty if no requirement changes. -->
20
+ - `<existing-name>`: <what requirement is changing>
21
+
22
+ ## Graph Context
23
+
24
+ <!-- Summarize key graphify findings that inform this proposal.
25
+ Which communities, god nodes, and code areas are relevant to this change? -->
26
+
27
+ - **Relevant Communities**: <!-- community labels -->
28
+ - **Key God Nodes**: <!-- node names with source files -->
29
+ - **Critical Paths**: <!-- graphify path findings -->
30
+
31
+ ## Impact
32
+
33
+ <!-- Affected code, APIs, dependencies, systems -->
@@ -0,0 +1,10 @@
1
+ ## ADDED Requirements
2
+
3
+ ### Requirement: <!-- requirement name -->
4
+ <!-- requirement text -->
5
+
6
+ #### Scenario: <!-- scenario name -->
7
+ - **WHEN** <!-- condition -->
8
+ - **THEN** <!-- expected outcome -->
9
+
10
+ **Graph References:** <!-- nodes from exploration.md that relate to this requirement -->
@@ -0,0 +1,9 @@
1
+ ## 1. <!-- Task Group Name -->
2
+
3
+ - [ ] 1.1 <!-- Task description --> <!-- [Node: NodeName] -->
4
+ - [ ] 1.2 <!-- Task description -->
5
+
6
+ ## 2. <!-- Task Group Name -->
7
+
8
+ - [ ] 2.1 <!-- Task description -->
9
+ - [ ] 2.2 <!-- Task description --> <!-- [Node: NodeName] -->
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "graphify-openspec-bridge",
3
+ "version": "1.0.0",
4
+ "description": "Bridge between OpenSpec and Graphify - codebase-aware OpenSpec workflow with knowledge graph integration",
5
+ "keywords": [
6
+ "openspec",
7
+ "graphify",
8
+ "knowledge-graph",
9
+ "schema",
10
+ "workflow",
11
+ "ai-coding"
12
+ ],
13
+ "homepage": "https://github.com/klc/graphify-openspec-bridge",
14
+ "bugs": {
15
+ "url": "https://github.com/klc/graphify-openspec-bridge/issues"
16
+ },
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/klc/graphify-openspec-bridge.git"
20
+ },
21
+ "license": "MIT",
22
+ "author": "klc",
23
+ "type": "commonjs",
24
+ "main": "index.js",
25
+ "bin": {
26
+ "graphify-openspec-bridge": "bin/graphify-openspec-bridge.js",
27
+ "gob": "bin/graphify-openspec-bridge.js"
28
+ },
29
+ "files": [
30
+ "bin/",
31
+ "openspec/"
32
+ ],
33
+ "scripts": {
34
+ "test": "echo \"Error: no test specified\" && exit 1"
35
+ },
36
+ "engines": {
37
+ "node": ">=16"
38
+ }
39
+ }