patchcord 0.5.126 → 0.5.127
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 +20 -5
- package/package.json +1 -1
package/bin/patchcord.mjs
CHANGED
|
@@ -934,11 +934,26 @@ if (cmd === "login" || cmd === "orchestrator" || cmd === "teamlead" || cmd === "
|
|
|
934
934
|
const accountCall = async (method, path, body) => {
|
|
935
935
|
let m = await requireAuth();
|
|
936
936
|
let r = await _httpJSON(method, `${m.baseUrl}${path}`, m.token, body);
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
937
|
+
// NEVER delete the stored credential on a request-level failure. The account
|
|
938
|
+
// token (pcm-) does not expire, and a 401/403 is almost never proof it is bad:
|
|
939
|
+
// - 401 can be transient (server restart / DB blip surfaces as a false
|
|
940
|
+
// "invalid main token"). Deleting it would strand a headless agent that
|
|
941
|
+
// cannot open a browser login.
|
|
942
|
+
// - 403 means THIS action is forbidden (namespace/role) — it says nothing
|
|
943
|
+
// about credential validity.
|
|
944
|
+
// Surface the error and stop. If the token is genuinely revoked, the user
|
|
945
|
+
// runs `patchcord login` — an explicit, human action, never automatic.
|
|
946
|
+
if (r.status === "401") {
|
|
947
|
+
console.error(`patchcord: account request returned HTTP 401. Your login was NOT deleted. If this keeps happening, run \`patchcord login\`.`);
|
|
948
|
+
process.exit(1);
|
|
949
|
+
}
|
|
950
|
+
if (r.status === "403") {
|
|
951
|
+
const reason = (r.json && (r.json.error || r.json.message)) || (r.body || "").slice(0, 200) || "forbidden";
|
|
952
|
+
console.error(`patchcord: request forbidden (HTTP 403): ${reason}`);
|
|
953
|
+
process.exit(1);
|
|
954
|
+
}
|
|
955
|
+
if (r.status === "503") {
|
|
956
|
+
console.error(`patchcord: server temporarily unavailable (HTTP 503). Retry in a moment.`);
|
|
942
957
|
process.exit(1);
|
|
943
958
|
}
|
|
944
959
|
return { ...r, m };
|
package/package.json
CHANGED