@cleocode/worktree 2026.5.124 → 2026.5.126

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.
@@ -0,0 +1,57 @@
1
+ // SPDX-License-Identifier: MIT
2
+ // Copyright (c) 2026 kryptobaseddev
3
+ //
4
+ // Native-addon loader for @cleocode/worktree-napi.
5
+ //
6
+ // Resolution order:
7
+ // 1. A `worktree-napi.<triple>.node` file co-located with this loader.
8
+ // Release publishing copies this loader and the built .node files into
9
+ // @cleocode/worktree/native so the existing @cleocode/worktree trusted
10
+ // publisher owns the whole native distribution.
11
+ //
12
+ // If the co-located binary is unavailable we throw a descriptive error pointing
13
+ // at the missing bundled path and local build command.
14
+
15
+ const { existsSync } = require('node:fs');
16
+ const { join } = require('node:path');
17
+
18
+ function tripleName() {
19
+ const { platform, arch } = process;
20
+ if (platform === 'linux' && arch === 'x64') return 'linux-x64-gnu';
21
+ if (platform === 'linux' && arch === 'arm64') return 'linux-arm64-gnu';
22
+ if (platform === 'darwin' && arch === 'arm64') return 'darwin-arm64';
23
+ if (platform === 'darwin' && arch === 'x64') {
24
+ throw new Error(
25
+ '@cleocode/worktree-napi: macOS x64 prebuilds are not published. ' +
26
+ 'Use an arm64 Node.js runtime on Apple Silicon or build locally with ' +
27
+ '`pnpm dlx @napi-rs/cli@3 build --release` inside `crates/worktree-napi/`.'
28
+ );
29
+ }
30
+ if (platform === 'win32' && arch === 'x64') return 'win32-x64-msvc';
31
+ throw new Error(
32
+ `@cleocode/worktree-napi: unsupported platform/arch ${platform}/${arch}`
33
+ );
34
+ }
35
+
36
+ const triple = tripleName();
37
+ const localPath = join(__dirname, `worktree-napi.${triple}.node`);
38
+
39
+ let nativeBinding;
40
+
41
+ if (existsSync(localPath)) {
42
+ nativeBinding = require(localPath);
43
+ } else {
44
+ throw new Error(
45
+ `@cleocode/worktree-napi: missing native binding for ${triple} at ${localPath}. ` +
46
+ `The @cleocode/worktree package must include \`native/worktree-napi.${triple}.node\`; ` +
47
+ `for local development, run \`pnpm dlx @napi-rs/cli@3 build --release\` inside ` +
48
+ `\`crates/worktree-napi/\` and rename the output to \`worktree-napi.${triple}.node\`.`
49
+ );
50
+ }
51
+
52
+ // Static named-export re-binding so Node.js can detect the export shape
53
+ // when this CJS module is imported from an ESM consumer (e.g. compiled
54
+ // @cleocode/worktree under "type": "module"). Without this, ESM named
55
+ // imports like `import { copyPathsParallel } from './native/worktree-napi.cjs'`
56
+ // throw "does not provide an export named ..." at module link time.
57
+ module.exports = nativeBinding;
package/package.json CHANGED
@@ -1,19 +1,14 @@
1
1
  {
2
2
  "name": "@cleocode/worktree",
3
- "version": "2026.5.124",
3
+ "version": "2026.5.126",
4
4
  "private": false,
5
5
  "type": "module",
6
- "description": "Native CLEO worktree backend SDK — createWorktree, destroyWorktree, listWorktrees, pruneWorktrees with XDG path canon and declarative hooks (T1161)",
6
+ "description": "Native CLEO worktree backend SDK",
7
7
  "main": "dist/index.js",
8
8
  "types": "dist/index.d.ts",
9
- "exports": {
10
- ".": {
11
- "types": "./dist/index.d.ts",
12
- "import": "./dist/index.js"
13
- }
14
- },
15
9
  "files": [
16
10
  "dist/",
11
+ "native/",
17
12
  "README.md"
18
13
  ],
19
14
  "keywords": [
@@ -30,17 +25,14 @@
30
25
  "author": "CLEO Code <hello@cleocode.dev>",
31
26
  "license": "MIT",
32
27
  "dependencies": {
33
- "@cleocode/contracts": "2026.5.124",
34
- "@cleocode/paths": "2026.5.124"
35
- },
36
- "optionalDependencies": {
37
- "@cleocode/worktree-napi": "2026.5.124"
28
+ "@cleocode/contracts": "2026.5.126",
29
+ "@cleocode/paths": "2026.5.126"
38
30
  },
39
31
  "devDependencies": {
40
32
  "@types/node": "^24.3.0",
41
33
  "typescript": "^6.0.2",
42
34
  "vitest": "^4.1.4",
43
- "@cleocode/core": "2026.5.124"
35
+ "@cleocode/core": "2026.5.126"
44
36
  },
45
37
  "repository": {
46
38
  "type": "git",