docks-kit 0.15.0 → 0.15.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/README.md CHANGED
@@ -134,7 +134,7 @@ Details: `docks-kit docs platforms`.
134
134
  Tagging `cli-v*` builds four standalone binaries (Linux x64/arm64 and macOS
135
135
  x64/arm64) plus `SHA256SUMS` and attaches them to the GitHub release; npm
136
136
  publishes the exact package tarball through trusted publishing with OIDC provenance.
137
- Package `docks-kit` 0.15.0 bundles the CLI + generated payload, so npm releases
137
+ Package `docks-kit` 0.15.1 bundles the CLI + generated payload, so npm releases
138
138
  are versioned config snapshots without shipping the authoring `SoT/` tree.
139
139
 
140
140
  ## Deeper docs
@@ -74,6 +74,24 @@ docks-kit update # autodetect + update + install-missing-only sync
74
74
  docks-kit update --no-sync # update only
75
75
  ```
76
76
 
77
+ `docks-kit update` resolves the kit home in this order:
78
+
79
+ 1. The explicit `DOCKS_KIT_HOME` value comes first when set. It must name a
80
+ directory whose `package.json` has the name `docks-kit`. An invalid value
81
+ causes an error instead of a fallback.
82
+ 2. The CLI uses the nearest kit root at or above its own module directory.
83
+ 3. Next, the CLI uses the nearest kit root at or above the directory that holds
84
+ the executable. A standalone binary inside `<checkout>/cli/dist` therefore
85
+ resolves to the checkout.
86
+ 4. Next, the CLI uses the nearest kit root at or above the current working
87
+ directory, but only as a fallback.
88
+ 5. Otherwise, the CLI uses the directory that holds the executable.
89
+
90
+ Sources 2 and 3 identify the installation that is running. A globally installed
91
+ `docks-kit` updates the global package even when you run it from inside a
92
+ docks-kit checkout. `DOCKS_KIT_HOME` lets you target a specific checkout on
93
+ purpose.
94
+
77
95
  Autodetection: a kit home with `.git` is a checkout (requires a clean
78
96
  worktree and an upstream; `git pull --ff-only`, re-runs
79
97
  `bun install --frozen-lockfile` when the lockfile changed); a kit home
@@ -1,7 +1,7 @@
1
1
  // Generated by cli/scripts/generate-sot-payload.ts. DO NOT EDIT.
2
2
  // Edit SoT/, notification.mp3, or package.json, then run: bun cli/scripts/generate-sot-payload.ts
3
3
 
4
- export const GENERATED_PACKAGE_VERSION = "0.15.0"
4
+ export const GENERATED_PACKAGE_VERSION = "0.15.1"
5
5
 
6
6
  export const GENERATED_PAYLOAD_TEXT = {
7
7
  "SoT/.agents/skills.txt": "# Universal AI-agent skill manifest intentionally empty.\n# Global skill discovery is opt-in: add one <owner>/<repo> slug per line.\n# EngineNative ignores comments and blank lines.\n",
@@ -10,26 +10,52 @@ const isKitHome = (dir: string): boolean => {
10
10
  }
11
11
  }
12
12
 
13
- /**
14
- * Resolve the optional checkout/package home used for display and updates:
15
- * DOCKS_KIT_HOME env → nearest ancestor of cwd (repo-checkout usage)
16
- * the package's own root (bunx / bun add -g usage) → standalone executable
17
- * directory. Payload availability is independent of this location.
18
- */
19
- export const kitHome = (): string => {
20
- const env = process.env["DOCKS_KIT_HOME"]
21
- if (env !== undefined && env !== "") {
22
- if (isKitHome(env)) return resolve(env)
23
- throw new Error(`DOCKS_KIT_HOME=${env} is not a docks-kit package root (package.json name must be "docks-kit")`)
24
- }
25
- let dir = process.cwd()
13
+ const findKitHome = (start: string | undefined): string | undefined => {
14
+ if (start === undefined || start === "") return undefined
15
+ let dir = resolve(start)
26
16
  for (;;) {
27
17
  if (isKitHome(dir)) return dir
28
18
  const parent = dirname(dir)
29
- if (parent === dir) break
19
+ if (parent === dir) return undefined
30
20
  dir = parent
31
21
  }
32
- const packageRoot = resolve(import.meta.dir, "..", "..")
33
- if (isKitHome(packageRoot)) return packageRoot
34
- return dirname(process.execPath)
35
22
  }
23
+
24
+ export interface KitHomeSources {
25
+ readonly env: string | undefined
26
+ /** `import.meta.dir` is a Bun extension, so a non-Bun loader leaves it undefined. */
27
+ readonly moduleDir: string | undefined
28
+ readonly execPath: string
29
+ readonly cwd: string
30
+ }
31
+
32
+ /**
33
+ * Resolve DOCKS_KIT_HOME, then the nearest kit ancestor of the module,
34
+ * executable, or working directory, then the executable directory. Running
35
+ * installation sources take priority so an unrelated checkout cannot replace
36
+ * the installation that is executing.
37
+ */
38
+ export const resolveKitHome = (sources: KitHomeSources): string => {
39
+ if (sources.env !== undefined && sources.env !== "") {
40
+ const envHome = resolve(sources.env)
41
+ if (isKitHome(envHome)) return envHome
42
+ throw new Error(
43
+ `DOCKS_KIT_HOME=${sources.env} is not a docks-kit package root (package.json name must be "docks-kit")`
44
+ )
45
+ }
46
+
47
+ return (
48
+ findKitHome(sources.moduleDir) ??
49
+ findKitHome(dirname(sources.execPath)) ??
50
+ findKitHome(sources.cwd) ??
51
+ dirname(sources.execPath)
52
+ )
53
+ }
54
+
55
+ export const kitHome = (): string =>
56
+ resolveKitHome({
57
+ env: process.env["DOCKS_KIT_HOME"],
58
+ moduleDir: import.meta.dir,
59
+ execPath: process.execPath,
60
+ cwd: process.cwd()
61
+ })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docks-kit",
3
- "version": "0.15.0",
3
+ "version": "0.15.1",
4
4
  "description": "Portable AI coding agent config kit — SoT sync engine + typed CLI for Claude Code, Codex, and universal agent skills",
5
5
  "type": "module",
6
6
  "license": "MIT",