cadet-agent 0.43.0 → 0.43.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,37 +1,37 @@
1
- {
2
- "name": "cadet-agent",
3
- "version": "0.43.0",
4
- "description": "Cross-IDE agent framework for Unity/C# game-development — one-command install",
5
- "type": "module",
6
- "bin": {
7
- "cadet-agent": "bin/cli.mjs"
8
- },
9
- "scripts": {
10
- "test": "node --test test/*.test.mjs",
11
- "lint": "lychee --offline --include-fragments \"**/*.md\"",
12
- "verify": "npm test && npm run lint"
13
- },
14
- "files": [
15
- "bin/",
16
- "src/"
17
- ],
18
- "keywords": [
19
- "cadet",
20
- "cadet-agent",
21
- "unity",
22
- "game-development",
23
- "ai-agent",
24
- "copilot",
25
- "cursor",
26
- "claude-code"
27
- ],
28
- "license": "CC-BY-4.0",
29
- "repository": {
30
- "type": "git",
31
- "url": "git+https://github.com/naishtech/cadet-agent.git"
32
- },
33
- "homepage": "https://github.com/naishtech/cadet-agent#readme",
34
- "engines": {
35
- "node": ">=18.0.0"
36
- }
37
- }
1
+ {
2
+ "name": "cadet-agent",
3
+ "version": "0.43.1",
4
+ "description": "Cross-IDE agent framework for Unity/C# game-development — one-command install",
5
+ "type": "module",
6
+ "bin": {
7
+ "cadet-agent": "bin/cli.mjs"
8
+ },
9
+ "scripts": {
10
+ "test": "node --test test/*.test.mjs",
11
+ "lint": "lychee --offline --include-fragments \"**/*.md\"",
12
+ "verify": "npm test && npm run lint"
13
+ },
14
+ "files": [
15
+ "bin/",
16
+ "src/"
17
+ ],
18
+ "keywords": [
19
+ "cadet",
20
+ "cadet-agent",
21
+ "unity",
22
+ "game-development",
23
+ "ai-agent",
24
+ "copilot",
25
+ "cursor",
26
+ "claude-code"
27
+ ],
28
+ "license": "CC-BY-4.0",
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "git+https://github.com/naishtech/cadet-agent.git"
32
+ },
33
+ "homepage": "https://github.com/naishtech/cadet-agent#readme",
34
+ "engines": {
35
+ "node": ">=18.0.0"
36
+ }
37
+ }
@@ -7,9 +7,8 @@
7
7
  * evidence freshness before any phase transition.
8
8
  */
9
9
 
10
- import { readFileSync, writeFileSync, renameSync, copyFileSync, existsSync, mkdtempSync, rmSync } from 'node:fs';
11
- import { join, dirname } from 'node:path';
12
- import { tmpdir } from 'node:os';
10
+ import { readFileSync, writeFileSync, renameSync, copyFileSync, existsSync, rmSync } from 'node:fs';
11
+ import { join } from 'node:path';
13
12
  import {
14
13
  PHASES, GATES, TRANSITIONS, EVIDENCE_STATUSES, DEFAULT_STRICT_CLOSURE,
15
14
  EXCEPTION_CATEGORIES, EXCEPTION_EXPIRY_DAYS, EXCEPTION_REQUIRES_REVIEW_NOTE,
@@ -802,9 +801,12 @@ export function migrateStateFile(statePath, { backup = true, to = null, keep = '
802
801
 
803
802
  const from = raw.version ?? raw.stateVersion;
804
803
  const backupPath = `${statePath}.v${from}.bak`;
805
- const dir = dirname(statePath);
806
- const tmpDir = mkdtempSync(join(tmpdir(), 'cadet-state-'));
807
- const tmpPath = join(tmpDir, 'state.json');
804
+ // The temp file is a sibling of the target, never a file in the OS temp
805
+ // directory: `renameSync` is atomic only within one filesystem, and a project
806
+ // on a different volume than the temp dir (temp on C:, project on D:/E: — the
807
+ // common Windows layout) fails the rename outright with EXDEV. A sibling
808
+ // rename is same-volume by construction, so the swap cannot half-land.
809
+ const tmpPath = `${statePath}.tmp-${process.pid}-${Date.now()}`;
808
810
  try {
809
811
  writeFileSync(tmpPath, JSON.stringify(state, null, 2) + '\n', 'utf-8');
810
812
  // Validate BEFORE writing anything to the real tree. The backup is an
@@ -835,7 +837,7 @@ export function migrateStateFile(statePath, { backup = true, to = null, keep = '
835
837
  // A failed rename leaves the original in place.
836
838
  renameSync(tmpPath, statePath);
837
839
  } finally {
838
- rmSync(tmpDir, { recursive: true, force: true });
840
+ rmSync(tmpPath, { force: true });
839
841
  }
840
842
  return { migrated: true, statePath, state, archived, archivedHistory, promoted, droppedHistory, backupPath };
841
843
  }