patchcord 0.6.27 → 0.6.28
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/.claude-plugin/plugin.json +1 -1
- package/bin/patchcord.mjs +37 -3
- package/package.json +1 -1
package/bin/patchcord.mjs
CHANGED
|
@@ -16,7 +16,9 @@ const cmd = process.argv[2];
|
|
|
16
16
|
|
|
17
17
|
/** Write a file then chmod 0600 (token-bearing configs must not be group/world readable). */
|
|
18
18
|
function writeSecureFile(path, contents) {
|
|
19
|
-
|
|
19
|
+
// mode applies at creation (no umask window for fresh files); the explicit
|
|
20
|
+
// chmod also repairs pre-existing files that were created too permissive.
|
|
21
|
+
writeFileSync(path, contents, { mode: 0o600 });
|
|
20
22
|
try { chmodSync(path, 0o600); } catch {}
|
|
21
23
|
return path;
|
|
22
24
|
}
|
|
@@ -184,6 +186,9 @@ team (run from the project root):
|
|
|
184
186
|
provisioned agents (server view)
|
|
185
187
|
patchcord team blueprint current --namespace <ns> [--json]
|
|
186
188
|
fetch current team blueprint revision
|
|
189
|
+
patchcord team blueprint push --namespace <ns> --file <blueprint.json> [--json]
|
|
190
|
+
create/update a team blueprint (first push
|
|
191
|
+
to a new namespace claims it — first-provision)
|
|
187
192
|
patchcord team status reconcile folder ↔ identity ↔ tmux ↔ token
|
|
188
193
|
patchcord team launch launch each worker in mux
|
|
189
194
|
|
|
@@ -725,7 +730,10 @@ if (cmd === "whoami") {
|
|
|
725
730
|
if (json.whoami) {
|
|
726
731
|
console.log(`self: ${json.whoami}`);
|
|
727
732
|
} else {
|
|
728
|
-
|
|
733
|
+
// Empty self-description is a NORMAL state for a healthy identity — a
|
|
734
|
+
// fresh mux-v2 seat once fail-closed reading "(empty …)" as "not
|
|
735
|
+
// provisioned". Say explicitly that identity is fine.
|
|
736
|
+
console.log(`self-description: (not set — optional; your identity ${json.agent}@${json.namespace} is fully provisioned. Set one with: patchcord whoami --propose "<text>")`);
|
|
729
737
|
}
|
|
730
738
|
console.log();
|
|
731
739
|
console.log(`tip: \`patchcord agents\` returns whoami for all peers.`);
|
|
@@ -1637,7 +1645,33 @@ you design the team, provision its agents, launch them, and manage them.
|
|
|
1637
1645
|
console.log(`canonical_json: ${JSON.stringify(json.canonical_json)}`);
|
|
1638
1646
|
process.exit(0);
|
|
1639
1647
|
}
|
|
1640
|
-
|
|
1648
|
+
if (bsub === "push") {
|
|
1649
|
+
const ns = flagVal("namespace");
|
|
1650
|
+
const file = flagVal("file");
|
|
1651
|
+
const idem = flagVal("idempotency-key");
|
|
1652
|
+
const wantJson = process.argv.includes("--json");
|
|
1653
|
+
if (!ns || !file) { console.error("Usage: patchcord team blueprint push --namespace <ns> --file <blueprint.json> [--idempotency-key k] [--json]"); process.exit(1); }
|
|
1654
|
+
let doc;
|
|
1655
|
+
try { doc = JSON.parse(readFileSync(file, "utf-8")); }
|
|
1656
|
+
catch (e) { console.error(`cannot read blueprint file: ${e.message}`); process.exit(1); }
|
|
1657
|
+
// First POST for an unowned namespace IS first-provision (server claims
|
|
1658
|
+
// the namespace atomically when PATCHCORD_BLUEPRINT_ATOMIC_CREATE is on).
|
|
1659
|
+
const payload = { canonical_json: doc };
|
|
1660
|
+
if (idem) payload.idempotency_key = idem;
|
|
1661
|
+
const { status, json, body } = await accountCall("POST", `/api/team/${encodeURIComponent(ns)}/blueprint/revisions`, payload);
|
|
1662
|
+
if (status !== "201" && status !== "200") {
|
|
1663
|
+
console.error(`blueprint push failed (HTTP ${status}): ${(json && (json.error || JSON.stringify(json.detail))) || body || ""}`);
|
|
1664
|
+
process.exit(1);
|
|
1665
|
+
}
|
|
1666
|
+
if (wantJson) {
|
|
1667
|
+
process.stdout.write(JSON.stringify({ ...json, created: status === "201" }) + "\n");
|
|
1668
|
+
process.exit(0);
|
|
1669
|
+
}
|
|
1670
|
+
console.log(`${status === "201" ? "created" : "unchanged (dedup)"} revision_uid: ${json.revision_uid}`);
|
|
1671
|
+
console.log(`sha256: ${json.sha256}`);
|
|
1672
|
+
process.exit(0);
|
|
1673
|
+
}
|
|
1674
|
+
console.error("Usage: patchcord team blueprint <current|push> --namespace <ns> [--json]");
|
|
1641
1675
|
process.exit(1);
|
|
1642
1676
|
}
|
|
1643
1677
|
if (sub === "status") {
|
package/package.json
CHANGED