@drawbridge/drawbridge-agents 0.1.6 → 0.1.7

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.
@@ -1,14 +1,22 @@
1
1
  #!/usr/bin/env node
2
- // Ensures the graphify runtime is installed (required for the family knowledge graph) and
3
- // registers its MCP server with the local assistant. Called by drawbridge-agents-sync.
4
- // Set DRAWBRIDGE_SKIP_GRAPHIFY=1 to skip in CI / headless environments.
2
+ // Ensures the graphify runtime is available for the family knowledge graph. NON-FATAL by design:
3
+ // if graphify can't be found or installed, warn and continue — `npm run sync` must never be
4
+ // blocked by it (the drift hook nudges separately, and the graph is built on demand).
5
+ // Set DRAWBRIDGE_SKIP_GRAPHIFY=1 to skip silently.
5
6
  const { execFileSync } = require('child_process')
7
+ const os = require('os')
8
+ const path = require('path')
6
9
 
7
10
  if (process.env.DRAWBRIDGE_SKIP_GRAPHIFY === '1') {
8
11
  console.log('drawbridge-agents-sync: DRAWBRIDGE_SKIP_GRAPHIFY set — skipping graphify preflight')
9
12
  process.exit(0)
10
13
  }
11
14
 
15
+ // npm runs scripts under a minimal shell (sh), so tools installed by uv/pipx into ~/.local/bin
16
+ // are often not on PATH. Add common user-bin dirs so an installed graphify is still found.
17
+ const extra = [ path.join(os.homedir(), '.local', 'bin'), '/opt/homebrew/bin' ]
18
+ process.env.PATH = [ ...extra, process.env.PATH || '' ].join(path.delimiter)
19
+
12
20
  const has = (cmd) => {
13
21
  try {
14
22
  execFileSync(cmd, [ '--version' ], { stdio: 'ignore' })
@@ -18,37 +26,30 @@ const has = (cmd) => {
18
26
  }
19
27
  }
20
28
 
21
- if (!has('graphify')) {
22
- console.log('drawbridge-agents-sync: graphify runtime not found, attempting install...')
23
- const attempts = [
24
- [ 'uv', [ 'tool', 'install', 'graphifyy' ] ],
25
- [ 'pipx', [ 'install', 'graphifyy' ] ],
26
- [ 'pip', [ 'install', '--user', 'graphifyy' ] ],
27
- [ 'pip3', [ 'install', '--user', 'graphifyy' ] ]
28
- ]
29
- for (const [ cmd, args ] of attempts) {
30
- if (!has(cmd)) continue
31
- try {
32
- execFileSync(cmd, args, { stdio: 'inherit' })
33
- break
34
- } catch (error) {
35
- // try the next installer
36
- }
37
- }
38
- if (!has('graphify')) {
39
- console.error([
40
- 'drawbridge-agents-sync: could not install the graphify runtime automatically.',
41
- 'Install it, then re-run npm run sync:',
42
- ' uv tool install graphifyy (recommended)',
43
- ' pipx install graphifyy',
44
- ' pip install --user graphifyy',
45
- 'Or set DRAWBRIDGE_SKIP_GRAPHIFY=1 to skip (CI / headless only).'
46
- ].join('\n'))
47
- process.exit(1)
29
+ if (has('graphify')) {
30
+ console.log('drawbridge-agents-sync: graphify runtime ready')
31
+ process.exit(0)
32
+ }
33
+
34
+ // Best-effort install if a Python tool installer is available; never fail if none is.
35
+ for (const [ cmd, args ] of [
36
+ [ 'uv', [ 'tool', 'install', 'graphifyy' ] ],
37
+ [ 'pipx', [ 'install', 'graphifyy' ] ],
38
+ [ 'pip', [ 'install', '--user', 'graphifyy' ] ],
39
+ [ 'pip3', [ 'install', '--user', 'graphifyy' ] ]
40
+ ]) {
41
+ if (!has(cmd)) continue
42
+ try {
43
+ execFileSync(cmd, args, { stdio: 'inherit' })
44
+ break
45
+ } catch (error) {
46
+ // try the next installer
48
47
  }
49
48
  }
50
49
 
51
- // Note: we deliberately do NOT run `graphify install` — it writes a graphify section into the
52
- // repo's CLAUDE.md and a PreToolUse hook, which would mutate a committed file and clash with the
53
- // shared CLAUDE.md. Agents use the graphify CLI directly (see conventions/graphify.md).
54
- console.log('drawbridge-agents-sync: graphify runtime ready (run `npx drawbridge-agents-graph` to build the graph)')
50
+ if (has('graphify')) {
51
+ console.log('drawbridge-agents-sync: graphify runtime installed')
52
+ } else {
53
+ console.warn('drawbridge-agents-sync: graphify not found (optional) — install with `uv tool install graphifyy` to enable the family knowledge graph. Continuing.')
54
+ }
55
+ process.exit(0)
@@ -90,9 +90,13 @@ const migrateOldDelivery = () => {
90
90
  }
91
91
  }
92
92
 
93
- // 3. Ensure the graphify runtime is present + reachable (hard-fails if it can't be).
93
+ // 3. Ensure the graphify runtime is present (best-effort, never blocks sync).
94
94
  const graphifyPreflight = () => {
95
- execFileSync('node', [ path.join(packageRoot, 'bin', 'preflight-graphify.js') ], { stdio: 'inherit' })
95
+ try {
96
+ execFileSync('node', [ path.join(packageRoot, 'bin', 'preflight-graphify.js') ], { stdio: 'inherit' })
97
+ } catch (error) {
98
+ console.warn('drawbridge-agents-sync: graphify preflight skipped (' + error.message + ')')
99
+ }
96
100
  }
97
101
 
98
102
  mirrorTemplates()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drawbridge/drawbridge-agents",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Shared agent-instruction content (rules, code style, conventions) for the drawbridge-* monorepo.",
5
5
  "license": "UNLICENSED",
6
6
  "publishConfig": {