commonswarm 0.1.63 → 0.1.64
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/cswarm.cjs +57 -39
- package/package.json +1 -1
package/cswarm.cjs
CHANGED
|
@@ -16388,6 +16388,7 @@ __export(cli_exports, {
|
|
|
16388
16388
|
clampTurnBudgetToCredential: () => clampTurnBudgetToCredential,
|
|
16389
16389
|
claudeUserPromptHookSnippet: () => claudeUserPromptHookSnippet,
|
|
16390
16390
|
describeAudience: () => describeAudience,
|
|
16391
|
+
isCliMain: () => isCliMain,
|
|
16391
16392
|
listenerFailureMessage: () => listenerFailureMessage,
|
|
16392
16393
|
listenerHostLimits: () => listenerHostLimits,
|
|
16393
16394
|
listenerMainHostLimits: () => listenerMainHostLimits,
|
|
@@ -43838,6 +43839,7 @@ function classifyClaudeCanaryFailure(detail, typedReasonCode, peerError) {
|
|
|
43838
43839
|
}
|
|
43839
43840
|
|
|
43840
43841
|
// src/cli.ts
|
|
43842
|
+
var import_node_url = require("node:url");
|
|
43841
43843
|
var import_meta = {};
|
|
43842
43844
|
function loadHostClaude() {
|
|
43843
43845
|
return Promise.resolve().then(() => (init_claude(), claude_exports));
|
|
@@ -43964,8 +43966,8 @@ var BOOLEAN_FLAGS = /* @__PURE__ */ new Set([
|
|
|
43964
43966
|
]);
|
|
43965
43967
|
var UUID_RE25 = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
43966
43968
|
function packageVersion() {
|
|
43967
|
-
if ("0.1.
|
|
43968
|
-
return "0.1.
|
|
43969
|
+
if ("0.1.64".length > 0) {
|
|
43970
|
+
return "0.1.64";
|
|
43969
43971
|
}
|
|
43970
43972
|
try {
|
|
43971
43973
|
const value = JSON.parse(
|
|
@@ -50141,54 +50143,69 @@ function exitCodeFor(error) {
|
|
|
50141
50143
|
function safeParagraph(message) {
|
|
50142
50144
|
return message.replace(/\u001b\[[0-?]*[ -/]*[@-~]/g, "").replace(/[\u0000-\u0009\u000b-\u001f\u007f-\u009f\u202a-\u202e\u2066-\u2069]/g, " ").slice(0, 2e3);
|
|
50143
50145
|
}
|
|
50144
|
-
|
|
50145
|
-
if (
|
|
50146
|
-
|
|
50147
|
-
return;
|
|
50146
|
+
function isCliMain() {
|
|
50147
|
+
if (typeof require !== "undefined" && typeof module !== "undefined" && require.main === module) {
|
|
50148
|
+
return true;
|
|
50148
50149
|
}
|
|
50149
|
-
if (
|
|
50150
|
-
|
|
50151
|
-
|
|
50152
|
-
|
|
50153
|
-
return;
|
|
50150
|
+
if (!process.argv[1]) return false;
|
|
50151
|
+
try {
|
|
50152
|
+
const script = (0, import_node_fs6.realpathSync)(process.argv[1]);
|
|
50153
|
+
const modulePath = (0, import_node_fs6.realpathSync)((0, import_node_url.fileURLToPath)(import_meta.url));
|
|
50154
|
+
return script === modulePath;
|
|
50155
|
+
} catch {
|
|
50156
|
+
return false;
|
|
50154
50157
|
}
|
|
50155
|
-
|
|
50156
|
-
|
|
50157
|
-
|
|
50158
|
-
|
|
50159
|
-
|
|
50160
|
-
|
|
50158
|
+
}
|
|
50159
|
+
if (isCliMain()) {
|
|
50160
|
+
main().catch((error) => {
|
|
50161
|
+
if (process.argv[2] === "hook" && process.argv[3] === "check") {
|
|
50162
|
+
process.exitCode = 0;
|
|
50163
|
+
return;
|
|
50164
|
+
}
|
|
50165
|
+
if (error instanceof RenewalReauthorisationRequired || error instanceof RenewalRevoked || error instanceof RenewalSuspended) {
|
|
50166
|
+
process.stderr.write(`${safeParagraph(error.message)}
|
|
50161
50167
|
`);
|
|
50162
|
-
|
|
50163
|
-
|
|
50168
|
+
process.exitCode = 1;
|
|
50169
|
+
return;
|
|
50170
|
+
}
|
|
50171
|
+
if (error instanceof WorkspaceCliError) {
|
|
50172
|
+
const structured = error.structured();
|
|
50173
|
+
const verb = process.argv[2];
|
|
50174
|
+
const json = process.argv.includes("--json") && (verb === "status" || verb === "workspaces" || verb === "use" || verb === "working-on" || verb === "note" || verb === "ask" || verb === "reply" || verb === "receipt" || verb === "feed" || verb === "inbox" || verb === "file" || verb === "brain");
|
|
50175
|
+
if (json) {
|
|
50176
|
+
process.stdout.write(`${JSON.stringify(structured, null, 2)}
|
|
50177
|
+
`);
|
|
50178
|
+
} else {
|
|
50179
|
+
process.stderr.write(`cswarm: ${error.message}
|
|
50164
50180
|
`);
|
|
50165
|
-
|
|
50166
|
-
|
|
50167
|
-
|
|
50168
|
-
|
|
50169
|
-
|
|
50170
|
-
|
|
50171
|
-
|
|
50172
|
-
|
|
50181
|
+
const projects = structured.projects;
|
|
50182
|
+
if (Array.isArray(projects) && projects.length > 0) {
|
|
50183
|
+
process.stderr.write("Available workspaces:\n");
|
|
50184
|
+
for (const project of projects) {
|
|
50185
|
+
if (!project || typeof project !== "object") continue;
|
|
50186
|
+
const row = project;
|
|
50187
|
+
process.stderr.write(
|
|
50188
|
+
`- ${String(row.name)} (${String(row.workspace_id)}) \u2014 ${String(row.role)}
|
|
50173
50189
|
`
|
|
50174
|
-
|
|
50190
|
+
);
|
|
50191
|
+
}
|
|
50175
50192
|
}
|
|
50176
50193
|
}
|
|
50194
|
+
process.exitCode = 1;
|
|
50195
|
+
return;
|
|
50177
50196
|
}
|
|
50178
|
-
|
|
50179
|
-
|
|
50180
|
-
}
|
|
50181
|
-
if (error instanceof UsageError) {
|
|
50182
|
-
process.stderr.write(`cswarm: ${safeError(error)}
|
|
50197
|
+
if (error instanceof UsageError) {
|
|
50198
|
+
process.stderr.write(`cswarm: ${safeError(error)}
|
|
50183
50199
|
${usage()}
|
|
50184
50200
|
`);
|
|
50185
|
-
|
|
50186
|
-
|
|
50187
|
-
|
|
50188
|
-
|
|
50201
|
+
process.exitCode = 1;
|
|
50202
|
+
return;
|
|
50203
|
+
}
|
|
50204
|
+
process.stderr.write(`cswarm: ${safeError(error)}
|
|
50189
50205
|
`);
|
|
50190
|
-
|
|
50191
|
-
});
|
|
50206
|
+
process.exitCode = exitCodeFor(error);
|
|
50207
|
+
});
|
|
50208
|
+
}
|
|
50192
50209
|
// Annotate the CommonJS export names for ESM import in node:
|
|
50193
50210
|
0 && (module.exports = {
|
|
50194
50211
|
CHANNEL_SUBCOMMAND_NAMES,
|
|
@@ -50198,6 +50215,7 @@ ${usage()}
|
|
|
50198
50215
|
clampTurnBudgetToCredential,
|
|
50199
50216
|
claudeUserPromptHookSnippet,
|
|
50200
50217
|
describeAudience,
|
|
50218
|
+
isCliMain,
|
|
50201
50219
|
listenerFailureMessage,
|
|
50202
50220
|
listenerHostLimits,
|
|
50203
50221
|
listenerMainHostLimits,
|