docks-kit 0.1.3 → 0.1.5

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.
@@ -3,6 +3,7 @@
3
3
  "tools": {
4
4
  "jq": { "kind": "required", "note": "deployed Claude hooks/statusline assets" },
5
5
  "curl": { "kind": "required", "note": "installers + usage fetch" },
6
+ "git": { "kind": "check", "note": "plugin marketplaces (claude/codex clone them) + kit checkout updates" },
6
7
  "node": { "kind": "check", "note": "hosts npm globals (agent-browser, LSP servers)" },
7
8
  "npm": { "kind": "check", "note": "npm-global installer" },
8
9
  "claude": { "kind": "check", "floor": "2.1.170", "note": "kit floor — `best` alias + Fable 5 need >=2.1.170 (mirrors settings minimumVersion)" },
@@ -520,6 +520,11 @@ function syncPlugins(ctx: Ctx, claudeDir: string): void {
520
520
  warn("claude CLI not in PATH — skipping plugin reconcile (run /plugin marketplace add + /plugin install manually)")
521
521
  return
522
522
  }
523
+ if (!commandExists("git")) {
524
+ const hint = process.platform === "win32" ? "winget install Git.Git (then open a new terminal)" : "install git via your package manager"
525
+ warn(`git not found — plugin marketplaces are git repos, so every plugin operation would fail. Skipping plugin passes. Install: ${hint}, then re-run sync`)
526
+ return
527
+ }
523
528
 
524
529
  const repoSettings = readJsonFile(repoSettingsFile)
525
530
  const repoObj = repoSettings !== undefined && isObject(repoSettings) ? repoSettings : {}
@@ -397,6 +397,11 @@ function syncPlugins(ctx: Ctx, sotConfig: string): void {
397
397
  )
398
398
  return
399
399
  }
400
+ if (!commandExists("git")) {
401
+ const hint = process.platform === "win32" ? "winget install Git.Git (then open a new terminal)" : "install git via your package manager"
402
+ warn(`git not found — Codex plugin marketplaces are git repos, so plugin refresh would fail. Skipping. Install: ${hint}, then re-run sync`)
403
+ return
404
+ }
400
405
 
401
406
  let refreshed = 0
402
407
  let failed = 0
@@ -5,7 +5,7 @@
5
5
  * and the snapshot write.
6
6
  */
7
7
  import { spawnSync } from "node:child_process"
8
- import { cpSync, existsSync, lstatSync, mkdirSync, readFileSync, readlinkSync, rmSync, statSync, symlinkSync, writeFileSync } from "node:fs"
8
+ import { cpSync, existsSync, lstatSync, mkdirSync, readFileSync, readlinkSync, realpathSync, rmdirSync, rmSync, statSync, symlinkSync, unlinkSync, writeFileSync } from "node:fs"
9
9
  import { tmpdir } from "node:os"
10
10
  import { capture, commandExists, isExecutable, p, which } from "./exec"
11
11
  import type { Ctx } from "./index"
@@ -136,11 +136,17 @@ function healClaudeSymlink(ctx: Ctx, skillsDir: string, base: string): boolean {
136
136
  if (linkStat?.isSymbolicLink() === true) {
137
137
  const current = safeReadlink(claudeLink)
138
138
  if (current === relTarget) return false
139
+ // win32: `npx skills add` creates absolute symlinks/junctions — any link
140
+ // that RESOLVES to the canonical dir is healthy, not stale.
141
+ if (process.platform === "win32" && realpathEquals(claudeLink, canonical)) return false
139
142
  if (ctx.dryRun) {
140
143
  echo(`[dry-run] would replace stale Claude symlink: ~/.claude/skills/${base} -> ${current} (correct: ${relTarget})`)
141
144
  return true
142
145
  }
143
- rmSync(claudeLink, { force: true })
146
+ if (!removeLink(claudeLink)) {
147
+ warn(`could not remove stale link ~/.claude/skills/${base} — remove it manually, then re-run sync`)
148
+ return false
149
+ }
144
150
  } else if (linkStat !== undefined) {
145
151
  warn(`~/.claude/skills/${base} exists as a real path (not a symlink) — leaving alone; remove manually if it's stale`)
146
152
  return false
@@ -169,9 +175,34 @@ function safeReadlink(path: string): string {
169
175
  }
170
176
  }
171
177
 
178
+ function realpathEquals(a: string, b: string): boolean {
179
+ try {
180
+ return realpathSync(a) === realpathSync(b)
181
+ } catch {
182
+ return false
183
+ }
184
+ }
185
+
186
+ /**
187
+ * Remove a symlink/junction without crashing: Bun's rmSync throws EFAULT on
188
+ * win32 directory symlinks. unlink handles file symlinks, rmdir handles
189
+ * dir symlinks/junctions, rmSync is the POSIX catch-all.
190
+ */
191
+ function removeLink(path: string): boolean {
192
+ for (const rm of [() => unlinkSync(path), () => rmdirSync(path), () => rmSync(path, { force: true })]) {
193
+ try {
194
+ rm()
195
+ return true
196
+ } catch {
197
+ // try the next removal shape
198
+ }
199
+ }
200
+ return lstat(path) === undefined
201
+ }
202
+
172
203
  /** skills::_link_or_copy — real symlink preferred, copy fallback (Windows). */
173
204
  export function linkOrCopy(target: string, link: string): boolean {
174
- rmSync(link, { force: true })
205
+ removeLink(link)
175
206
  try {
176
207
  symlinkSync(target, link, process.platform === "win32" ? "dir" : undefined)
177
208
  } catch {
@@ -72,6 +72,8 @@ export function installedVersion(ctx: Ctx, tool: string): string {
72
72
  const m = /effect-solutions@([0-9][0-9.]*)/.exec(capture(bunbin, ["pm", "-g", "ls"]))
73
73
  return m?.[1] ?? ""
74
74
  }
75
+ case "git":
76
+ return firstLineField(capture("git", ["--version"]), 2)
75
77
  case "node":
76
78
  return capture("node", ["--version"]).replace(/^v/, "")
77
79
  case "npm":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docks-kit",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
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",