@moxxy/plugin-self-update 0.41.3 → 0.42.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moxxy/plugin-self-update",
3
- "version": "0.41.3",
3
+ "version": "0.42.1",
4
4
  "description": "Model-callable self-update: guardrailed, transactional editing of moxxy's own plugins/skills (Tier 1, hot-reloaded) and core packages (Tier 2, build+overlay+restart). Every change is approval-gated, verified, and auto-rolled-back on failure. Disable to lock the code base.",
5
5
  "keywords": [
6
6
  "moxxy",
@@ -43,14 +43,14 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "zod": "^3.25.76",
46
- "@moxxy/sdk": "0.41.3"
46
+ "@moxxy/sdk": "0.42.1"
47
47
  },
48
48
  "devDependencies": {
49
- "@types/node": "^22.10.0",
49
+ "@types/node": "^22.20.5",
50
50
  "typescript": "^6.0.3",
51
- "vitest": "^4.1.11",
52
- "@moxxy/tsconfig": "0.0.0",
53
- "@moxxy/vitest-preset": "0.0.0"
51
+ "vitest": "^5.0.3",
52
+ "@moxxy/vitest-preset": "0.0.0",
53
+ "@moxxy/tsconfig": "0.0.0"
54
54
  },
55
55
  "scripts": {
56
56
  "build": "tsc -p tsconfig.json",
@@ -3,6 +3,7 @@ import * as os from 'node:os';
3
3
  import * as path from 'node:path';
4
4
  import { pathToFileURL } from 'node:url';
5
5
  import { afterEach, describe, expect, it } from 'vitest';
6
+ import { canSymlink } from '@moxxy/vitest-preset/platform';
6
7
  import {
7
8
  countCorruptCoreTxns,
8
9
  coreTxnDir,
@@ -25,10 +26,11 @@ import {
25
26
  type CoreInstallInfo,
26
27
  type CoreJournal,
27
28
  } from './core-update.js';
29
+ import { removeDir } from '@moxxy/vitest-preset/fs';
28
30
 
29
31
  const tempDirs: string[] = [];
30
32
  afterEach(async () => {
31
- await Promise.all(tempDirs.splice(0).map((d) => fs.rm(d, { recursive: true, force: true })));
33
+ await Promise.all(tempDirs.splice(0).map((d) => removeDir(d)));
32
34
  });
33
35
 
34
36
  async function tmp(): Promise<string> {
@@ -80,7 +82,7 @@ describe('safeRepoPath', () => {
80
82
  expect(safeRepoPath('/repo', 'packages/core/src/a.ts')).toBe(path.resolve('/repo', 'packages/core/src/a.ts'));
81
83
  });
82
84
 
83
- it('refuses a path that traverses a symlink out of the repo', async () => {
85
+ it.skipIf(!canSymlink)('refuses a path that traverses a symlink out of the repo', async () => {
84
86
  const repo = await tmp();
85
87
  const outside = await tmp();
86
88
  await fs.writeFile(path.join(outside, 'secret'), 'top secret\n', 'utf8');
@@ -97,14 +99,15 @@ describe('safeRepoPath', () => {
97
99
  expect(p.endsWith(path.join('packages', 'core', 'src', 'a.ts'))).toBe(true);
98
100
  });
99
101
 
100
- it('accepts an ABSOLUTE in-repo path even when the repo root traverses a symlink', async () => {
102
+ it.skipIf(!canSymlink)('accepts an ABSOLUTE in-repo path even when the repo root traverses a symlink', async () => {
101
103
  // Regression: when the repo root resolves through a symlink (the norm on
102
104
  // macOS, where the tmp dir lives under /var→/private/var, and anywhere
103
105
  // $HOME/.moxxy is symlinked), a legitimate absolute path *inside* the repo
104
106
  // must not be misread as escaping. The realpath re-check must anchor the
105
107
  // already-validated in-repo segments onto realRoot, not re-resolve the raw
106
108
  // (possibly absolute) input against it.
107
- const base = await tmp();
109
+ // Realpath first: a Windows temp dir can come back in its 8.3 short form.
110
+ const base = await fs.realpath(await tmp());
108
111
  const realTarget = path.join(base, 'real-repo');
109
112
  await fs.mkdir(path.join(realTarget, 'packages', 'core', 'src'), { recursive: true });
110
113
  // A symlink to the repo root: the raw path differs from its realpath on
package/src/index.test.ts CHANGED
@@ -7,10 +7,11 @@ import { asSessionId, asTurnId, type ToolContext, type ToolDef } from '@moxxy/sd
7
7
  import { buildSelfUpdatePlugin, type SelfUpdateDeps, type SkipInfo } from './index.js';
8
8
  import { readJournal } from './transaction.js';
9
9
  import { writeCoreJournal } from './core-update.js';
10
+ import { removeDir } from '@moxxy/vitest-preset/fs';
10
11
 
11
12
  const tempDirs: string[] = [];
12
13
  afterEach(async () => {
13
- await Promise.all(tempDirs.splice(0).map((d) => fs.rm(d, { recursive: true, force: true })));
14
+ await Promise.all(tempDirs.splice(0).map((d) => removeDir(d)));
14
15
  });
15
16
 
16
17
  /**
@@ -15,10 +15,11 @@ import {
15
15
  restoreSnapshot,
16
16
  writeJournal,
17
17
  } from './transaction.js';
18
+ import { removeDir } from '@moxxy/vitest-preset/fs';
18
19
 
19
20
  const tempDirs: string[] = [];
20
21
  afterEach(async () => {
21
- await Promise.all(tempDirs.splice(0).map((d) => fs.rm(d, { recursive: true, force: true })));
22
+ await Promise.all(tempDirs.splice(0).map((d) => removeDir(d)));
22
23
  });
23
24
 
24
25
  async function makeMoxxyDir(): Promise<string> {
@@ -4,10 +4,11 @@ import * as path from 'node:path';
4
4
  import { afterEach, describe, expect, it } from 'vitest';
5
5
  import { verifyPluginBuild, verifySkillFile } from './verify.js';
6
6
  import { resolveTarget } from './transaction.js';
7
+ import { removeDir } from '@moxxy/vitest-preset/fs';
7
8
 
8
9
  const tempDirs: string[] = [];
9
10
  afterEach(async () => {
10
- await Promise.all(tempDirs.splice(0).map((d) => fs.rm(d, { recursive: true, force: true })));
11
+ await Promise.all(tempDirs.splice(0).map((d) => removeDir(d)));
11
12
  });
12
13
 
13
14
  async function tempPluginDir(): Promise<string> {