@vib795/agent-memory 0.1.8 → 0.1.9

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.
Files changed (3) hide show
  1. package/package.json +1 -1
  2. package/src/cli.js +14 -1
  3. package/src/setup.js +14 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vib795/agent-memory",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "Durable cross-repo knowledge graph for GitHub Copilot and Claude Code. Markdown source of truth, disposable SQLite index, zero runtime dependencies.",
5
5
  "keywords": [
6
6
  "github-copilot",
package/src/cli.js CHANGED
@@ -565,7 +565,20 @@ function main(argv) {
565
565
  try {
566
566
  result = fn(opts);
567
567
  } catch (err) {
568
- result = { ok: false, error: err.message, text: `Error: ${err.message}` };
568
+ // err.message on its own loses the syscall and the path, which is the whole
569
+ // difference between "Path is a directory" and knowing which path and which
570
+ // operation. A user hitting this on a machine you cannot log into should be able
571
+ // to paste one line and have it be enough; a stack is one env var further.
572
+ const detail = [err.code, err.syscall, err.path].filter(Boolean).join(' ');
573
+ const line = detail ? `Error: ${err.message} [${detail}]` : `Error: ${err.message}`;
574
+ result = {
575
+ ok: false,
576
+ error: err.message,
577
+ code: err.code ?? null,
578
+ syscall: err.syscall ?? null,
579
+ path: err.path ?? null,
580
+ text: process.env.AGENT_MEMORY_DEBUG ? `${line}\n${err.stack}` : line,
581
+ };
569
582
  }
570
583
 
571
584
  if (opts.json) {
package/src/setup.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import {
2
- mkdirSync, rmSync, existsSync, lstatSync, symlinkSync, cpSync, readlinkSync, readFileSync,
2
+ mkdirSync, rmSync, rmdirSync, existsSync, lstatSync, symlinkSync, cpSync, readlinkSync, readFileSync,
3
3
  } from 'node:fs';
4
4
  import { join, dirname, resolve } from 'node:path';
5
5
  import { fileURLToPath } from 'node:url';
@@ -45,8 +45,19 @@ function isLink(path) {
45
45
  function clear(path) {
46
46
  // A stale symlink must be removed as a link rather than followed, or clearing it
47
47
  // would delete the packaged skills on the other end.
48
- if (isLink(path)) rmSync(path, { force: true });
49
- else if (existsSync(path)) rmSync(path, { recursive: true, force: true });
48
+ if (isLink(path)) {
49
+ try {
50
+ rmSync(path, { force: true });
51
+ } catch {
52
+ // A Windows directory junction reports as a symbolic link but deletes like a
53
+ // directory, and rmSync without `recursive` can reject it as EISDIR. rmdirSync
54
+ // removes the junction itself and never descends, so the skills on the other
55
+ // end stay put — which is exactly what passing `recursive` here would risk.
56
+ rmdirSync(path);
57
+ }
58
+ } else if (existsSync(path)) {
59
+ rmSync(path, { recursive: true, force: true });
60
+ }
50
61
  }
51
62
 
52
63
  /**