squadrant 0.11.1 → 0.11.3
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 +1 -1
- package/dist/index.js +161 -47
- package/dist/index.js.map +1 -1
- package/dist/squadrantd.js +2 -2
- package/dist/squadrantd.js.map +1 -1
- package/package.json +1 -1
- package/scripts/migrate-to-squadrant.sh +49 -23
package/package.json
CHANGED
|
@@ -223,30 +223,56 @@ else
|
|
|
223
223
|
note "no $CLAUDE_PROJECTS dir — skipping session/memory preservation"
|
|
224
224
|
fi
|
|
225
225
|
|
|
226
|
-
step "4.6 Rewrite stale 'cockpit
|
|
227
|
-
#
|
|
228
|
-
#
|
|
229
|
-
#
|
|
230
|
-
#
|
|
231
|
-
#
|
|
226
|
+
step "4.6 Rewrite stale 'cockpit' tokens in Claude Code settings files (this repo, global ~/.claude, AND every registered project)"
|
|
227
|
+
# Settings files written on disk BEFORE the rebrand still invoke the removed
|
|
228
|
+
# `cockpit` binary — every Stop/PostToolUse hook fails "cockpit: command not
|
|
229
|
+
# found" — and reference old ~/.config/cockpit script paths and the cockpit-hub
|
|
230
|
+
# vault in permission allowlists. Rewrite three exact tokens in place:
|
|
231
|
+
# cockpit crew _hook -> squadrant crew _hook (the failing hook command)
|
|
232
|
+
# .config/cockpit -> .config/squadrant (write-status/read-handoff paths)
|
|
233
|
+
# cockpit-hub -> squadrant-hub (spoke-vault Read allowlist)
|
|
234
|
+
# Token-scoped (NOT a blanket cockpit->squadrant) so unrelated patterns like
|
|
232
235
|
# Bash(cockpit:*) are left untouched. Idempotent (a second run matches nothing).
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
236
|
+
# Earlier versions swept only this repo + global ~/.claude and ORPHANED every
|
|
237
|
+
# registered project, so the per-project files are read from config.json here.
|
|
238
|
+
CFG_FOR_HOOKS="$NEW_CONFIG/config.json"; [ -f "$CFG_FOR_HOOKS" ] || CFG_FOR_HOOKS="$OLD_CONFIG/config.json"
|
|
239
|
+
DRY_RUN="$DRY_RUN" NEW_REPO="$NEW_REPO" HOME_DIR="$HOME" CFG="$CFG_FOR_HOOKS" python3 - <<'PY'
|
|
240
|
+
import json, os
|
|
241
|
+
dry = os.environ["DRY_RUN"] == "1"
|
|
242
|
+
repo, home, cfg = os.environ["NEW_REPO"], os.environ["HOME_DIR"], os.environ["CFG"]
|
|
243
|
+
SUBS = [("cockpit crew _hook", "squadrant crew _hook"),
|
|
244
|
+
(".config/cockpit", ".config/squadrant"),
|
|
245
|
+
("cockpit-hub", "squadrant-hub")]
|
|
246
|
+
files = [f"{repo}/.claude/settings.json", f"{repo}/.claude/settings.local.json",
|
|
247
|
+
f"{home}/.claude/settings.json", f"{home}/.claude/settings.local.json"]
|
|
248
|
+
if os.path.isfile(cfg):
|
|
249
|
+
try:
|
|
250
|
+
for p in json.load(open(cfg)).get("projects", {}).values():
|
|
251
|
+
path = p.get("path") if isinstance(p, dict) else None
|
|
252
|
+
if path:
|
|
253
|
+
files.append(os.path.join(path, ".claude", "settings.json"))
|
|
254
|
+
files.append(os.path.join(path, ".claude", "settings.local.json"))
|
|
255
|
+
except (ValueError, OSError) as e:
|
|
256
|
+
print(f" · could not read registered projects from {cfg}: {e}")
|
|
257
|
+
fixed = 0
|
|
258
|
+
for f in files:
|
|
259
|
+
if not os.path.isfile(f):
|
|
260
|
+
continue
|
|
261
|
+
text = open(f, encoding="utf-8").read()
|
|
262
|
+
if "cockpit" not in text:
|
|
263
|
+
continue
|
|
264
|
+
new = text
|
|
265
|
+
for a, b in SUBS:
|
|
266
|
+
new = new.replace(a, b)
|
|
267
|
+
if new == text:
|
|
268
|
+
continue
|
|
269
|
+
print(f" $ {'would rewrite' if dry else 'rewrite'} {f}")
|
|
270
|
+
if not dry:
|
|
271
|
+
json.loads(new) # guard: only write back valid JSON
|
|
272
|
+
open(f, "w", encoding="utf-8").write(new)
|
|
273
|
+
fixed += 1
|
|
274
|
+
print(f" · {'would rewrite' if dry else 'rewrote'} cockpit tokens in {fixed} settings file(s)")
|
|
275
|
+
PY
|
|
250
276
|
|
|
251
277
|
step "5. Remove old launchd plist (the rebuilt daemon installs com.squadrant.daemon.plist on first run)"
|
|
252
278
|
[ -f "$OLD_PLIST" ] && run "rm -f '$OLD_PLIST'" || note "old plist absent"
|