@aabadin/project-memory-context 0.2.9 → 0.2.12

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,13 +1,24 @@
1
1
  #!/usr/bin/env node
2
2
  import { spawn } from 'node:child_process';
3
- import { dirname, resolve } from 'node:path';
3
+ import { dirname, resolve, join } from 'node:path';
4
4
  import { fileURLToPath } from 'node:url';
5
+ import { existsSync, readFileSync, writeFileSync } from 'node:fs';
6
+ import { tmpdir } from 'node:os';
5
7
 
6
8
  const __dirname = dirname(fileURLToPath(import.meta.url));
7
9
  const PACKAGE_ROOT = resolve(__dirname, '..');
8
10
 
9
11
  // graph-explorer lives INSIDE the package: tools/pmc-graph-explorer/
10
12
  const GRAPH_EXPLORER_PATH = resolve(PACKAGE_ROOT, 'tools/pmc-graph-explorer/server.mjs');
13
+ const PID_FILE = join(tmpdir(), 'pmc-graph-explorer.pid');
14
+
15
+ // Kill previous server instance if running
16
+ if (existsSync(PID_FILE)) {
17
+ try {
18
+ const pid = parseInt(readFileSync(PID_FILE, 'utf8').trim(), 10);
19
+ if (pid) process.kill(pid, 'SIGKILL');
20
+ } catch { /* already dead or invalid pid */ }
21
+ }
11
22
 
12
23
  const child = spawn(process.execPath, [GRAPH_EXPLORER_PATH], {
13
24
  env: { ...process.env, PMC_PROJECT_ROOT: process.cwd() },
@@ -16,4 +27,5 @@ const child = spawn(process.execPath, [GRAPH_EXPLORER_PATH], {
16
27
  shell: false,
17
28
  });
18
29
 
19
- child.unref();
30
+ writeFileSync(PID_FILE, String(child.pid), 'utf8');
31
+ child.unref();
package/cli/bootstrap.mjs CHANGED
@@ -114,10 +114,10 @@ async function runStageA(projectRoot) {
114
114
  const graphOutDir = resolve(projectRoot, '.planning', 'project-memory-context', 'graph');
115
115
  const graphifyOutDir = resolve(projectRoot, 'graphify-out');
116
116
 
117
- const r = spawnSync(`"${graphifyExe}"`, ['update', projectRoot], {
117
+ log(` Using graphify: ${graphifyExe}`);
118
+ const r = spawnSync(graphifyExe, ['update', projectRoot], {
118
119
  cwd: projectRoot,
119
120
  stdio: 'inherit',
120
- shell: true,
121
121
  });
122
122
 
123
123
  if (r.status === 0) {
package/cli/sanitize.mjs CHANGED
@@ -60,10 +60,9 @@ async function runGraphifyUpdate(projectRoot) {
60
60
  const graphOutDir = resolve(projectRoot, '.planning', 'project-memory-context', 'graph');
61
61
 
62
62
  log('Running graphify update (structural AST)...');
63
- const r = spawnSync(`"${graphifyExe}"`, ['update', `"${projectRoot}"`], {
63
+ const r = spawnSync(graphifyExe, ['update', projectRoot], {
64
64
  cwd: projectRoot,
65
65
  stdio: 'inherit',
66
- shell: true,
67
66
  });
68
67
 
69
68
  if (r.status !== 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aabadin/project-memory-context",
3
- "version": "0.2.9",
3
+ "version": "0.2.12",
4
4
  "description": "Portable project memory context CLI — bootstraps semantic enrichment workflows for any AI coding agent.",
5
5
  "license": "GPL-3.0-or-later",
6
6
  "type": "module",
@@ -14,7 +14,7 @@ Open the PMC Graph Explorer to visualize the enrichment graph. The server runs o
14
14
  Start the graph explorer server using the globally installed PMC CLI:
15
15
 
16
16
  ```bash
17
- npx --yes --package @aabadin/project-memory-context pmc-view-context
17
+ pmc view-context
18
18
  ```
19
19
 
20
20
  Then open http://localhost:3001 in your browser.