@drawbridge/drawbridge-agents 0.1.1 → 0.1.3
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/.root-template/.mcp.json +4 -0
- package/README.md +8 -7
- package/bin/graph.js +30 -7
- package/claude/CLAUDE.md +2 -0
- package/conventions/git-branching.md +19 -0
- package/conventions/graphify.md +17 -14
- package/conventions/superpowers-docs.md +19 -0
- package/graph/README.md +9 -5
- package/hooks/drift-check.js +3 -3
- package/package.json +1 -1
package/.root-template/.mcp.json
CHANGED
package/README.md
CHANGED
|
@@ -87,13 +87,14 @@ and the knowledge graph from drifting. Everything below is committed **only in t
|
|
|
87
87
|
reaches consumers without committing anything to them (see "Isolation").
|
|
88
88
|
|
|
89
89
|
- **Family knowledge graph (Graphify).** `npx drawbridge-agents-graph` runs code-only AST
|
|
90
|
-
extraction over every `drawbridge-*` repo and
|
|
91
|
-
|
|
92
|
-
`graphify query "…" --graph
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
`graphify
|
|
96
|
-
|
|
90
|
+
extraction over every `drawbridge-*` repo and writes the merged graph to the committed, shared
|
|
91
|
+
location `drawbridge-docs/knowledge/graphs/global.json`. Agents query it with the `graphify` CLI
|
|
92
|
+
(e.g. `graphify query "…" --graph ../drawbridge-docs/knowledge/graphs/global.json`) instead of
|
|
93
|
+
grepping; refreshing is rebuild + commit in docs + `git pull` (no npm/publish cycle). The
|
|
94
|
+
runtime is a per-machine Python tool — `npm run sync` installs it
|
|
95
|
+
(`bin/preflight-graphify.js`); set `DRAWBRIDGE_SKIP_GRAPHIFY=1` to skip in CI/headless. We
|
|
96
|
+
deliberately do **not** run `graphify install` (it would rewrite `CLAUDE.md`); the optional
|
|
97
|
+
`graphify-mcp` server is available if you prefer MCP.
|
|
97
98
|
- **Docs linkage + validator.** Feature code carries `@story <domain>/<slug>` / `@doc
|
|
98
99
|
reference/<file>#<anchor>` anchors (see `conventions/docs-linkage.md`).
|
|
99
100
|
`npx drawbridge-agents-check-docs` scans every repo and fails if any anchor no longer resolves
|
package/bin/graph.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// Builds the family knowledge graph: runs graphify's headless AST extraction over every
|
|
3
|
-
// drawbridge-* repo (plus drawbridge-docs and the shared @drawbridge/* packages)
|
|
4
|
-
//
|
|
5
|
-
// query. Code-only (local AST, no API key). See conventions/graphify.md.
|
|
3
|
+
// drawbridge-* repo (plus drawbridge-docs and the shared @drawbridge/* packages) into graphify's
|
|
4
|
+
// global graph, then copies it to drawbridge-docs/knowledge/graphs/global.json — the committed,
|
|
5
|
+
// shared graph agents query. Code-only (local AST, no API key). See conventions/graphify.md.
|
|
6
6
|
//
|
|
7
7
|
// A semantic build (adds doc/paper content + INFERRED edges) needs an LLM backend: drop
|
|
8
8
|
// --code-only and set an API key (e.g. ANTHROPIC_API_KEY) — slower and costs LLM calls.
|
|
@@ -12,8 +12,24 @@ const path = require('path')
|
|
|
12
12
|
const { execFileSync } = require('child_process')
|
|
13
13
|
|
|
14
14
|
const packageRoot = path.resolve(__dirname, '..')
|
|
15
|
-
const familyRoot = path.resolve(packageRoot, '..')
|
|
16
15
|
const buildDir = path.join(os.homedir(), '.graphify', 'build')
|
|
16
|
+
const globalGraph = path.join(os.homedir(), '.graphify', 'global-graph.json')
|
|
17
|
+
|
|
18
|
+
// The family root is the directory that contains drawbridge-docs. Walk up from cwd so this works
|
|
19
|
+
// whether run from the agents repo or via npx from inside a consumer's node_modules.
|
|
20
|
+
const findFamilyRoot = () => {
|
|
21
|
+
let dir = process.env.INIT_CWD || process.cwd()
|
|
22
|
+
for (let i = 0; i < 8; i++) {
|
|
23
|
+
if (fs.existsSync(path.join(dir, 'drawbridge-docs'))) return dir
|
|
24
|
+
const parent = path.dirname(dir)
|
|
25
|
+
if (parent === dir) break
|
|
26
|
+
dir = parent
|
|
27
|
+
}
|
|
28
|
+
return path.resolve(packageRoot, '..')
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const familyRoot = findFamilyRoot()
|
|
32
|
+
const docsGraph = path.join(familyRoot, 'drawbridge-docs', 'knowledge', 'graphs', 'global.json')
|
|
17
33
|
|
|
18
34
|
// The canonical family list lives in the shared settings template — single source of truth.
|
|
19
35
|
const settings = JSON.parse(fs.readFileSync(path.join(packageRoot, '.claude-template', 'settings.json'), 'utf8'))
|
|
@@ -52,10 +68,17 @@ for (const name of repos) {
|
|
|
52
68
|
[ 'extract', repoPath, '--out', path.join(buildDir, name), '--global', '--as', name, '--code-only' ],
|
|
53
69
|
{ stdio: 'inherit' }
|
|
54
70
|
)
|
|
71
|
+
// graphify still drops a graphify-out/ in the target repo despite --out; remove it so the
|
|
72
|
+
// build never dirties a source repo (the incremental cache lives under ~/.graphify/build).
|
|
73
|
+
fs.rmSync(path.join(repoPath, 'graphify-out'), { recursive: true, force: true })
|
|
55
74
|
built.push(name)
|
|
56
75
|
}
|
|
57
76
|
|
|
58
|
-
|
|
77
|
+
// Publish the merged global graph to the committed, shared location in drawbridge-docs.
|
|
78
|
+
fs.mkdirSync(path.dirname(docsGraph), { recursive: true })
|
|
79
|
+
fs.copyFileSync(globalGraph, docsGraph)
|
|
80
|
+
|
|
59
81
|
console.log(`drawbridge-agents-graph: built cross-repo graph from ${ built.length } repo(s)`)
|
|
60
|
-
console.log(`
|
|
61
|
-
console.log('
|
|
82
|
+
console.log(` written to: ${ docsGraph }`)
|
|
83
|
+
console.log(' commit it in drawbridge-docs so the team shares one graph, then: git pull')
|
|
84
|
+
console.log(' query it: graphify query "<question>" --graph ' + docsGraph)
|
package/claude/CLAUDE.md
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Branch naming (gitflow)
|
|
2
|
+
|
|
3
|
+
Branches use the **full gitflow prefixes, always spelled out**. Never use abbreviations.
|
|
4
|
+
|
|
5
|
+
| Prefix | Use |
|
|
6
|
+
| --- | --- |
|
|
7
|
+
| `feature/<name>` | New features / changes (branched from `develop`) |
|
|
8
|
+
| `bugfix/<name>` | Non-urgent bug fixes |
|
|
9
|
+
| `hotfix/<name>` | Urgent production fixes (branched from `main`) |
|
|
10
|
+
| `release/<version>` | Release preparation |
|
|
11
|
+
| `chore/<name>` | Maintenance — dependency bumps, config, cleanup |
|
|
12
|
+
| `support/<name>` | Long-lived support branches |
|
|
13
|
+
|
|
14
|
+
- **Never** abbreviate: no `feat/`, `fix/`, `ci/`, `docs/`, `refactor/`, etc. Use the full word
|
|
15
|
+
(`feature/`, `bugfix/`, `chore/`, …).
|
|
16
|
+
- `<name>` is a short kebab-case description (e.g. `feature/ecosystem-knowledge-graphify`,
|
|
17
|
+
`chore/agents-devdep`).
|
|
18
|
+
- Branch from `develop` for normal work (see the integration-branch convention); `main`-only
|
|
19
|
+
repos like `drawbridge-docs` branch from `main`.
|
package/conventions/graphify.md
CHANGED
|
@@ -7,31 +7,34 @@ shared packages — built by [Graphify](https://github.com/Graphify-Labs/graphif
|
|
|
7
7
|
|
|
8
8
|
When you need to trace behaviour that spans repos (api ↔ sync ↔ stripe ↔ app-web, who emits an
|
|
9
9
|
event, what depends on a package), **query the graph instead of grepping 16 directories**. The
|
|
10
|
-
cross-repo graph
|
|
10
|
+
cross-repo graph is committed in drawbridge-docs at
|
|
11
|
+
`drawbridge-docs/knowledge/graphs/global.json` — a sibling of every repo, so point the CLI at it:
|
|
11
12
|
|
|
12
13
|
```sh
|
|
13
|
-
graphify query "what connects sync change streams to the billing meter?" --graph
|
|
14
|
-
graphify path "drawbridge-app-web" "drawbridge-stripe" --graph
|
|
15
|
-
graphify explain "closeDraw" --graph
|
|
16
|
-
graphify affected "closeDraw" --graph
|
|
14
|
+
graphify query "what connects sync change streams to the billing meter?" --graph ../drawbridge-docs/knowledge/graphs/global.json
|
|
15
|
+
graphify path "drawbridge-app-web" "drawbridge-stripe" --graph ../drawbridge-docs/knowledge/graphs/global.json
|
|
16
|
+
graphify explain "closeDraw" --graph ../drawbridge-docs/knowledge/graphs/global.json
|
|
17
|
+
graphify affected "closeDraw" --graph ../drawbridge-docs/knowledge/graphs/global.json
|
|
17
18
|
```
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
`git pull` in drawbridge-docs gets you the current shared graph. It spans all sibling repos
|
|
21
|
+
(code, via local AST); a semantic build additionally pulls in doc prose and richer INFERRED
|
|
22
|
+
edges — see "Refreshing it".
|
|
21
23
|
|
|
22
24
|
## Refreshing it
|
|
23
25
|
|
|
24
|
-
The graph is as fresh as the last build. After a change that alters cross-repo
|
|
25
|
-
rebuild it:
|
|
26
|
+
The graph is as fresh as the last committed build. After a change that alters cross-repo
|
|
27
|
+
structure, rebuild and commit it:
|
|
26
28
|
|
|
27
29
|
```sh
|
|
28
|
-
npx drawbridge-agents-graph
|
|
30
|
+
npx drawbridge-agents-graph # rebuilds -> drawbridge-docs/knowledge/graphs/global.json
|
|
31
|
+
cd ../drawbridge-docs && git add knowledge/graphs && git commit -m "chore: refresh knowledge graph"
|
|
29
32
|
```
|
|
30
33
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
Other developers just `git pull` drawbridge-docs. The drift-check hook nudges when tracked
|
|
35
|
+
source has changed since the committed graph was last built. For a semantic build that also
|
|
36
|
+
indexes docs, run `graphify extract <repo> --global --as <repo>` with an LLM backend / API key
|
|
37
|
+
set (slower, costs LLM calls).
|
|
35
38
|
|
|
36
39
|
## Runtime
|
|
37
40
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Superpowers working docs live in drawbridge-docs
|
|
2
|
+
|
|
3
|
+
All superpowers **plans** and **specs** — the outputs of the brainstorming / writing-plans /
|
|
4
|
+
spec workflows — live in one canonical place, at the **root** of drawbridge-docs:
|
|
5
|
+
|
|
6
|
+
```
|
|
7
|
+
drawbridge-docs/superpowers/plans/YYYY-MM-DD-<slug>.md
|
|
8
|
+
drawbridge-docs/superpowers/specs/YYYY-MM-DD-<slug>.md
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
This is the **only** allowed home for these working docs. Rules:
|
|
12
|
+
|
|
13
|
+
- Do **not** create or keep superpowers plans/specs (or `docs/superpowers/`, `docs/plans/`)
|
|
14
|
+
inside any other repo. When you finalize a plan or spec, write it under
|
|
15
|
+
`../drawbridge-docs/superpowers/{plans,specs}/`, not the repo you're working in.
|
|
16
|
+
- When plan mode or a superpowers skill produces a plan/spec, the finalized document goes into
|
|
17
|
+
drawbridge-docs — regardless of which repo the work targets. Note the target repo in the doc.
|
|
18
|
+
- `.superpowers/` (brainstorm scratch — server state, HTML mockups) is ephemeral. **Never commit
|
|
19
|
+
it**; it belongs in `.gitignore`.
|
package/graph/README.md
CHANGED
|
@@ -2,9 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
The cross-repo knowledge graph is built by `npx drawbridge-agents-graph` (`bin/graph.js`), which
|
|
4
4
|
runs [Graphify](https://github.com/Graphify-Labs/graphify) headless AST extraction over every
|
|
5
|
-
`drawbridge-*` repo and
|
|
6
|
-
`~/.graphify/global-graph.json` (per machine, not committed).
|
|
5
|
+
`drawbridge-*` repo and writes the merged graph to the **committed, shared** location:
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
```
|
|
8
|
+
drawbridge-docs/knowledge/graphs/global.json
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
That committed file is what agents query (`--graph ../drawbridge-docs/knowledge/graphs/global.json`)
|
|
12
|
+
and is shared via `git pull` — see `conventions/graphify.md`. There are no graph artifacts in
|
|
13
|
+
this package directory; per-repo extraction output is redirected to `~/.graphify/build/` so it
|
|
14
|
+
never litters the source repos.
|
package/hooks/drift-check.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
// Blocks (must fix) on unresolved @story/@doc tags; nudges (non-blocking) on a stale graph or
|
|
4
4
|
// likely doc drift. Gated so it never fires on trivial turns. See conventions/docs-linkage.md.
|
|
5
5
|
const fs = require('fs')
|
|
6
|
-
const os = require('os')
|
|
7
6
|
const path = require('path')
|
|
8
7
|
const { execFileSync } = require('child_process')
|
|
9
8
|
|
|
@@ -70,10 +69,11 @@ const run = () => {
|
|
|
70
69
|
// 2. Graph freshness (non-blocking nudge) — a full re-extract is expensive, so alert rather
|
|
71
70
|
// than block on every edit turn. Flip to block() if you want it enforced hard.
|
|
72
71
|
if (!skipGraph) {
|
|
73
|
-
|
|
72
|
+
// The shared graph is committed in drawbridge-docs (a sibling of this repo).
|
|
73
|
+
const docsGraph = path.join(path.dirname(cwd), 'drawbridge-docs', 'knowledge', 'graphs', 'global.json')
|
|
74
74
|
let builtAt = 0
|
|
75
75
|
try {
|
|
76
|
-
builtAt = fs.statSync(
|
|
76
|
+
builtAt = fs.statSync(docsGraph).mtimeMs
|
|
77
77
|
} catch (error) {
|
|
78
78
|
builtAt = 0
|
|
79
79
|
}
|
package/package.json
CHANGED