@vib795/agent-memory 0.1.7 → 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.
package/install.ps1 CHANGED
@@ -37,8 +37,25 @@ if (-not $node) {
37
37
 
38
38
  Write-Host ""
39
39
  Write-Host "Linking the CLI" -ForegroundColor Cyan
40
- & npm install -g $source 2>&1 | Out-Null
41
- if ($LASTEXITCODE -eq 0) {
40
+ # npm writes its warnings to stderr, and `2>&1` turns each one into an ErrorRecord,
41
+ # which $ErrorActionPreference = 'Stop' then treats as terminating. A managed npm
42
+ # config makes that certain rather than unlikely: an unknown key such as `always-auth`
43
+ # produces a warning on every single npm invocation, so this step could never succeed
44
+ # on the desktops this script exists for. It aborted the whole install — no fallback
45
+ # message, no doctor, no closing instructions — over a warning about an unrelated
46
+ # config key. Scope the preference to this one call.
47
+ $previousPreference = $ErrorActionPreference
48
+ $ErrorActionPreference = 'Continue'
49
+ try {
50
+ & npm install -g $source 2>&1 | Out-Null
51
+ $npmExit = $LASTEXITCODE
52
+ } catch {
53
+ $npmExit = 1
54
+ } finally {
55
+ $ErrorActionPreference = $previousPreference
56
+ }
57
+
58
+ if ($npmExit -eq 0) {
42
59
  Write-Host " [npm] agent-memory installed globally" -ForegroundColor Green
43
60
  } else {
44
61
  # A global install failing on a managed desktop is common and not worth aborting
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vib795/agent-memory",
3
- "version": "0.1.7",
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
  /**