opencode-swarm 7.3.7 → 7.4.0
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 +2 -0
- package/dist/agents/prompt-namespace.test.d.ts +1 -0
- package/dist/cli/index.js +170 -11
- package/dist/commands/clashes-with-native-cc.test.d.ts +10 -0
- package/dist/commands/conflict-registry.d.ts +85 -0
- package/dist/commands/conflict-registry.structural.test.d.ts +1 -0
- package/dist/commands/conflict-registry.test.d.ts +5 -0
- package/dist/commands/registry.d.ts +11 -0
- package/dist/config/constants.d.ts +1 -0
- package/dist/config/constants.security.test.d.ts +1 -0
- package/dist/hooks/cc-command-intercept.d.ts +46 -0
- package/dist/hooks/cc-command-intercept.test.d.ts +1 -0
- package/dist/hooks/full-auto-intercept.d.ts +0 -24
- package/dist/hooks/index.d.ts +1 -0
- package/dist/index.js +498 -155
- package/dist/mutation/engine.d.ts +0 -13
- package/dist/mutation/generator.d.ts +0 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -229,6 +229,8 @@ All 41 subcommands at a glance:
|
|
|
229
229
|
|
|
230
230
|
Use `/swarm help` to see all available commands categorized by function. Use `/swarm help <command>` for detailed usage information on a specific command.
|
|
231
231
|
|
|
232
|
+
Nine commands display a ⚠️ warning in help output because they share names with Claude Code built-in slash commands (e.g., `/plan`, `/reset`, `/status`). The warning reminds you to always use `/swarm <command>` — the bare CC command does something different and sometimes destructive. See [docs/commands.md#claude-code-command-conflicts](docs/commands.md#claude-code-command-conflicts) for the full conflict registry.
|
|
233
|
+
|
|
232
234
|
See [docs/commands.md](docs/commands.md) for the full reference (41 commands).
|
|
233
235
|
|
|
234
236
|
## Command Aliases
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/cli/index.js
CHANGED
|
@@ -34,7 +34,7 @@ var package_default;
|
|
|
34
34
|
var init_package = __esm(() => {
|
|
35
35
|
package_default = {
|
|
36
36
|
name: "opencode-swarm",
|
|
37
|
-
version: "7.
|
|
37
|
+
version: "7.4.0",
|
|
38
38
|
description: "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
|
|
39
39
|
main: "dist/index.js",
|
|
40
40
|
types: "dist/index.d.ts",
|
|
@@ -15993,7 +15993,40 @@ var init_tool_names = __esm(() => {
|
|
|
15993
15993
|
});
|
|
15994
15994
|
|
|
15995
15995
|
// src/config/constants.ts
|
|
15996
|
-
|
|
15996
|
+
function freezeSet(items) {
|
|
15997
|
+
const set2 = new Set(items);
|
|
15998
|
+
const proxy = new Proxy(set2, {
|
|
15999
|
+
get(target, prop) {
|
|
16000
|
+
if (prop === "add" || prop === "delete" || prop === "clear") {
|
|
16001
|
+
return () => {
|
|
16002
|
+
throw new TypeError("CLAUDE_CODE_NATIVE_COMMANDS is readonly");
|
|
16003
|
+
};
|
|
16004
|
+
}
|
|
16005
|
+
if (prop === "forEach") {
|
|
16006
|
+
return (callback, thisArg) => {
|
|
16007
|
+
const wrapped = (v, k) => callback.call(thisArg ?? undefined, v, k, proxy);
|
|
16008
|
+
return set2.forEach(wrapped);
|
|
16009
|
+
};
|
|
16010
|
+
}
|
|
16011
|
+
const value = Reflect.get(target, prop);
|
|
16012
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
16013
|
+
},
|
|
16014
|
+
set() {
|
|
16015
|
+
throw new TypeError("CLAUDE_CODE_NATIVE_COMMANDS is readonly");
|
|
16016
|
+
},
|
|
16017
|
+
deleteProperty() {
|
|
16018
|
+
throw new TypeError("CLAUDE_CODE_NATIVE_COMMANDS is readonly");
|
|
16019
|
+
},
|
|
16020
|
+
defineProperty() {
|
|
16021
|
+
throw new TypeError("CLAUDE_CODE_NATIVE_COMMANDS is readonly");
|
|
16022
|
+
},
|
|
16023
|
+
setPrototypeOf() {
|
|
16024
|
+
throw new TypeError("CLAUDE_CODE_NATIVE_COMMANDS is readonly");
|
|
16025
|
+
}
|
|
16026
|
+
});
|
|
16027
|
+
return proxy;
|
|
16028
|
+
}
|
|
16029
|
+
var QA_AGENTS, PIPELINE_AGENTS, ORCHESTRATOR_NAME = "architect", ALL_SUBAGENT_NAMES, ALL_AGENT_NAMES, OPENCODE_NATIVE_AGENTS, CLAUDE_CODE_NATIVE_COMMANDS, AGENT_TOOL_MAP, DEFAULT_AGENT_CONFIGS;
|
|
15997
16030
|
var init_constants = __esm(() => {
|
|
15998
16031
|
init_tool_names();
|
|
15999
16032
|
QA_AGENTS = ["reviewer", "critic", "critic_oversight"];
|
|
@@ -16026,6 +16059,113 @@ var init_constants = __esm(() => {
|
|
|
16026
16059
|
"title",
|
|
16027
16060
|
"summary"
|
|
16028
16061
|
]);
|
|
16062
|
+
CLAUDE_CODE_NATIVE_COMMANDS = freezeSet([
|
|
16063
|
+
"clear",
|
|
16064
|
+
"new",
|
|
16065
|
+
"reset",
|
|
16066
|
+
"resume",
|
|
16067
|
+
"continue",
|
|
16068
|
+
"exit",
|
|
16069
|
+
"quit",
|
|
16070
|
+
"compact",
|
|
16071
|
+
"fork",
|
|
16072
|
+
"branch",
|
|
16073
|
+
"undo",
|
|
16074
|
+
"checkpoint",
|
|
16075
|
+
"rewind",
|
|
16076
|
+
"rename",
|
|
16077
|
+
"doctor",
|
|
16078
|
+
"help",
|
|
16079
|
+
"status",
|
|
16080
|
+
"statusline",
|
|
16081
|
+
"cost",
|
|
16082
|
+
"usage",
|
|
16083
|
+
"stats",
|
|
16084
|
+
"context",
|
|
16085
|
+
"debug",
|
|
16086
|
+
"insights",
|
|
16087
|
+
"recap",
|
|
16088
|
+
"release-notes",
|
|
16089
|
+
"heapdump",
|
|
16090
|
+
"powerup",
|
|
16091
|
+
"config",
|
|
16092
|
+
"settings",
|
|
16093
|
+
"model",
|
|
16094
|
+
"effort",
|
|
16095
|
+
"fast",
|
|
16096
|
+
"theme",
|
|
16097
|
+
"color",
|
|
16098
|
+
"keybindings",
|
|
16099
|
+
"privacy-settings",
|
|
16100
|
+
"init",
|
|
16101
|
+
"focus",
|
|
16102
|
+
"sandbox",
|
|
16103
|
+
"terminal-setup",
|
|
16104
|
+
"permissions",
|
|
16105
|
+
"allowed-tools",
|
|
16106
|
+
"security-review",
|
|
16107
|
+
"fewer-permission-prompts",
|
|
16108
|
+
"plugin",
|
|
16109
|
+
"reload-plugins",
|
|
16110
|
+
"hooks",
|
|
16111
|
+
"mcp",
|
|
16112
|
+
"ide",
|
|
16113
|
+
"chrome",
|
|
16114
|
+
"desktop",
|
|
16115
|
+
"app",
|
|
16116
|
+
"mobile",
|
|
16117
|
+
"ios",
|
|
16118
|
+
"android",
|
|
16119
|
+
"remote-control",
|
|
16120
|
+
"rc",
|
|
16121
|
+
"remote-env",
|
|
16122
|
+
"login",
|
|
16123
|
+
"logout",
|
|
16124
|
+
"review",
|
|
16125
|
+
"pr-comments",
|
|
16126
|
+
"agents",
|
|
16127
|
+
"batch",
|
|
16128
|
+
"loop",
|
|
16129
|
+
"proactive",
|
|
16130
|
+
"claude-api",
|
|
16131
|
+
"schedule",
|
|
16132
|
+
"routines",
|
|
16133
|
+
"autofix-pr",
|
|
16134
|
+
"plan",
|
|
16135
|
+
"diff",
|
|
16136
|
+
"export",
|
|
16137
|
+
"copy",
|
|
16138
|
+
"feedback",
|
|
16139
|
+
"bug",
|
|
16140
|
+
"btw",
|
|
16141
|
+
"add-dir",
|
|
16142
|
+
"memory",
|
|
16143
|
+
"skills",
|
|
16144
|
+
"upgrade",
|
|
16145
|
+
"vim",
|
|
16146
|
+
"voice",
|
|
16147
|
+
"extra-usage",
|
|
16148
|
+
"install-github-app",
|
|
16149
|
+
"install-slack-app",
|
|
16150
|
+
"passes",
|
|
16151
|
+
"setup-bedrock",
|
|
16152
|
+
"install",
|
|
16153
|
+
"tasks",
|
|
16154
|
+
"history",
|
|
16155
|
+
"term",
|
|
16156
|
+
"teleport",
|
|
16157
|
+
"ultrareview",
|
|
16158
|
+
"ultraplan",
|
|
16159
|
+
"web-setup",
|
|
16160
|
+
"setup-vertex",
|
|
16161
|
+
"tui",
|
|
16162
|
+
"simplify",
|
|
16163
|
+
"summary",
|
|
16164
|
+
"stickers",
|
|
16165
|
+
"tp",
|
|
16166
|
+
"team-onboarding",
|
|
16167
|
+
"bashes"
|
|
16168
|
+
]);
|
|
16029
16169
|
AGENT_TOOL_MAP = {
|
|
16030
16170
|
architect: [
|
|
16031
16171
|
"checkpoint",
|
|
@@ -47063,6 +47203,9 @@ function buildHelpText() {
|
|
|
47063
47203
|
for (const cmd of catLines) {
|
|
47064
47204
|
const entry = COMMAND_REGISTRY[cmd];
|
|
47065
47205
|
lines.push(`- \`/swarm ${cmd}\` \u2014 ${entry.description}`);
|
|
47206
|
+
if (entry.clashesWithNativeCcCommand) {
|
|
47207
|
+
lines.push(` \u26A0\uFE0F Name conflicts with CC built-in \`${entry.clashesWithNativeCcCommand}\` \u2014 always use \`/swarm ${cmd}\``);
|
|
47208
|
+
}
|
|
47066
47209
|
if (entry.args) {
|
|
47067
47210
|
lines.push(` Args: \`${entry.args}\``);
|
|
47068
47211
|
}
|
|
@@ -47092,6 +47235,9 @@ function buildHelpText() {
|
|
|
47092
47235
|
if (entry.aliasOf || entry.subcommandOf)
|
|
47093
47236
|
continue;
|
|
47094
47237
|
lines.push(`- \`/swarm ${cmd}\` \u2014 ${entry.description}`);
|
|
47238
|
+
if (entry.clashesWithNativeCcCommand) {
|
|
47239
|
+
lines.push(` \u26A0\uFE0F Name conflicts with CC built-in \`${entry.clashesWithNativeCcCommand}\` \u2014 always use \`/swarm ${cmd}\``);
|
|
47240
|
+
}
|
|
47095
47241
|
if (entry.args) {
|
|
47096
47242
|
lines.push(` Args: \`${entry.args}\``);
|
|
47097
47243
|
}
|
|
@@ -47103,6 +47249,10 @@ function buildHelpText() {
|
|
|
47103
47249
|
lines.push("### Deprecated Commands", "");
|
|
47104
47250
|
for (const { name, aliasOf } of deprecatedAliases) {
|
|
47105
47251
|
lines.push(`- \`/swarm ${name}\` \u2192 Use \`/swarm ${aliasOf}\``);
|
|
47252
|
+
const aliasEntry = COMMAND_REGISTRY[name];
|
|
47253
|
+
if (aliasEntry?.clashesWithNativeCcCommand) {
|
|
47254
|
+
lines.push(` \u26A0\uFE0F Name conflicts with CC built-in \`${aliasEntry.clashesWithNativeCcCommand}\` \u2014 always use \`/swarm ${aliasOf}\``);
|
|
47255
|
+
}
|
|
47106
47256
|
}
|
|
47107
47257
|
}
|
|
47108
47258
|
return lines.join(`
|
|
@@ -47410,17 +47560,20 @@ var init_registry = __esm(() => {
|
|
|
47410
47560
|
status: {
|
|
47411
47561
|
handler: (ctx) => handleStatusCommand(ctx.directory, ctx.agents),
|
|
47412
47562
|
description: "Show current swarm state",
|
|
47413
|
-
category: "core"
|
|
47563
|
+
category: "core",
|
|
47564
|
+
clashesWithNativeCcCommand: "/status"
|
|
47414
47565
|
},
|
|
47415
47566
|
plan: {
|
|
47416
47567
|
handler: (ctx) => handlePlanCommand(ctx.directory, ctx.args),
|
|
47417
47568
|
description: "Show plan (optionally filter by phase number)",
|
|
47418
|
-
category: "core"
|
|
47569
|
+
category: "core",
|
|
47570
|
+
clashesWithNativeCcCommand: "/plan"
|
|
47419
47571
|
},
|
|
47420
47572
|
agents: {
|
|
47421
47573
|
handler: (ctx) => Promise.resolve(handleAgentsCommand(ctx.agents, undefined)),
|
|
47422
47574
|
description: "List registered agents",
|
|
47423
|
-
category: "core"
|
|
47575
|
+
category: "core",
|
|
47576
|
+
clashesWithNativeCcCommand: "/agents"
|
|
47424
47577
|
},
|
|
47425
47578
|
help: {
|
|
47426
47579
|
handler: (ctx) => handleHelpCommand(ctx),
|
|
@@ -47432,12 +47585,14 @@ var init_registry = __esm(() => {
|
|
|
47432
47585
|
history: {
|
|
47433
47586
|
handler: (ctx) => handleHistoryCommand(ctx.directory, ctx.args),
|
|
47434
47587
|
description: "Show completed phases summary",
|
|
47435
|
-
category: "utility"
|
|
47588
|
+
category: "utility",
|
|
47589
|
+
clashesWithNativeCcCommand: "/history"
|
|
47436
47590
|
},
|
|
47437
47591
|
config: {
|
|
47438
47592
|
handler: (ctx) => handleConfigCommand(ctx.directory, ctx.args),
|
|
47439
47593
|
description: "Show current resolved configuration",
|
|
47440
|
-
category: "config"
|
|
47594
|
+
category: "config",
|
|
47595
|
+
clashesWithNativeCcCommand: "/config"
|
|
47441
47596
|
},
|
|
47442
47597
|
"config doctor": {
|
|
47443
47598
|
handler: (ctx) => handleDoctorCommand(ctx.directory, ctx.args),
|
|
@@ -47492,7 +47647,8 @@ var init_registry = __esm(() => {
|
|
|
47492
47647
|
description: "Export plan and context as JSON",
|
|
47493
47648
|
args: "",
|
|
47494
47649
|
details: "Exports the current plan and context as JSON to stdout. Useful for piping to external tools or debugging swarm state.",
|
|
47495
|
-
category: "utility"
|
|
47650
|
+
category: "utility",
|
|
47651
|
+
clashesWithNativeCcCommand: "/export"
|
|
47496
47652
|
},
|
|
47497
47653
|
evidence: {
|
|
47498
47654
|
handler: (ctx) => handleEvidenceCommand(ctx.directory, ctx.args),
|
|
@@ -47524,7 +47680,8 @@ var init_registry = __esm(() => {
|
|
|
47524
47680
|
description: "Run config doctor checks",
|
|
47525
47681
|
category: "diagnostics",
|
|
47526
47682
|
aliasOf: "config doctor",
|
|
47527
|
-
deprecated: true
|
|
47683
|
+
deprecated: true,
|
|
47684
|
+
clashesWithNativeCcCommand: "/doctor"
|
|
47528
47685
|
},
|
|
47529
47686
|
info: {
|
|
47530
47687
|
handler: (ctx) => handleStatusCommand(ctx.directory, ctx.agents),
|
|
@@ -47658,7 +47815,8 @@ var init_registry = __esm(() => {
|
|
|
47658
47815
|
description: "Clear swarm state files [--confirm]",
|
|
47659
47816
|
details: "DELETES plan.md, context.md, and summaries/ directory from .swarm/. Stops background automation and clears in-memory queues. SAFETY: requires --confirm flag \u2014 without it, displays a warning and tips to export first.",
|
|
47660
47817
|
args: "--confirm (required)",
|
|
47661
|
-
category: "utility"
|
|
47818
|
+
category: "utility",
|
|
47819
|
+
clashesWithNativeCcCommand: "/reset"
|
|
47662
47820
|
},
|
|
47663
47821
|
"reset-session": {
|
|
47664
47822
|
handler: (ctx) => handleResetSessionCommand(ctx.directory, ctx.args),
|
|
@@ -47743,7 +47901,8 @@ var init_registry = __esm(() => {
|
|
|
47743
47901
|
description: "Manage project checkpoints [save|restore|delete|list] <label>",
|
|
47744
47902
|
details: "save: creates named snapshot of current .swarm/ state. restore: soft-resets to checkpoint by overwriting current .swarm/ files. delete: removes named checkpoint. list: shows all checkpoints with timestamps. All subcommands require a label except list.",
|
|
47745
47903
|
args: "<save|restore|delete|list> <label>",
|
|
47746
|
-
category: "utility"
|
|
47904
|
+
category: "utility",
|
|
47905
|
+
clashesWithNativeCcCommand: "/checkpoint"
|
|
47747
47906
|
}
|
|
47748
47907
|
};
|
|
47749
47908
|
VALID_COMMANDS = Object.keys(COMMAND_REGISTRY);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Task 1.3: clashesWithNativeCcCommand field + buildHelpText() conflict warnings
|
|
3
|
+
* Structural tests verifying:
|
|
4
|
+
* 1. CommandEntry type accepts the new optional field
|
|
5
|
+
* 2. All 9 conflicting commands have the field set correctly
|
|
6
|
+
* 3. buildHelpText() outputs conflict warnings for CRITICAL commands
|
|
7
|
+
* 4. buildHelpText() does NOT output false conflict warnings
|
|
8
|
+
* 5. doctor deprecated alias has clashesWithNativeCcCommand: '/doctor'
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Conflict registry — pure data module mapping Claude Code commands to swarm commands.
|
|
3
|
+
* No I/O, no side effects. Used for disambiguation warnings in shortcut routing.
|
|
4
|
+
*/
|
|
5
|
+
export type ConflictSeverity = 'CRITICAL' | 'HIGH' | 'MEDIUM';
|
|
6
|
+
export interface CommandConflict {
|
|
7
|
+
/** swarm subcommand name (no leading slash) */
|
|
8
|
+
swarmCommand: string;
|
|
9
|
+
/** CC command with leading slash, e.g. '/plan' */
|
|
10
|
+
ccCommand: string;
|
|
11
|
+
severity: ConflictSeverity;
|
|
12
|
+
/** What the CC command does */
|
|
13
|
+
ccBehavior: string;
|
|
14
|
+
/** What the swarm command does */
|
|
15
|
+
swarmBehavior: string;
|
|
16
|
+
/** Starts with "Use /swarm" or "NEVER invoke" */
|
|
17
|
+
disambiguationNote: string;
|
|
18
|
+
}
|
|
19
|
+
export declare const CLAUDE_CODE_CONFLICTS: readonly [{
|
|
20
|
+
readonly swarmCommand: "plan";
|
|
21
|
+
readonly ccCommand: "/plan";
|
|
22
|
+
readonly severity: "CRITICAL";
|
|
23
|
+
readonly ccBehavior: "Enters Claude Code plan mode — Claude proposes all actions before executing them";
|
|
24
|
+
readonly swarmBehavior: "Displays the current .swarm/plan.md task list";
|
|
25
|
+
readonly disambiguationNote: "Use /swarm plan to read the swarm task plan. NEVER invoke the bare /plan command — it enters Claude Code plan mode and blocks execution.";
|
|
26
|
+
}, {
|
|
27
|
+
readonly swarmCommand: "reset";
|
|
28
|
+
readonly ccCommand: "/reset";
|
|
29
|
+
readonly severity: "CRITICAL";
|
|
30
|
+
readonly ccBehavior: "Alias for /clear — wipes the entire conversation context window";
|
|
31
|
+
readonly swarmBehavior: "Clears .swarm state files (requires --confirm flag)";
|
|
32
|
+
readonly disambiguationNote: "Use /swarm reset --confirm to clear swarm state. NEVER invoke the bare /reset or /clear command — it destroys the conversation context.";
|
|
33
|
+
}, {
|
|
34
|
+
readonly swarmCommand: "checkpoint";
|
|
35
|
+
readonly ccCommand: "/checkpoint";
|
|
36
|
+
readonly severity: "CRITICAL";
|
|
37
|
+
readonly ccBehavior: "Alias for /rewind — restores conversation and code to a prior state";
|
|
38
|
+
readonly swarmBehavior: "Manages named swarm project snapshots (save|restore|delete|list)";
|
|
39
|
+
readonly disambiguationNote: "Use /swarm checkpoint <save|restore|list> to manage swarm snapshots. NEVER invoke the bare /checkpoint command — it reverts the conversation history.";
|
|
40
|
+
}, {
|
|
41
|
+
readonly swarmCommand: "status";
|
|
42
|
+
readonly ccCommand: "/status";
|
|
43
|
+
readonly severity: "HIGH";
|
|
44
|
+
readonly ccBehavior: "Shows Claude Code version, active model, account, and API connectivity";
|
|
45
|
+
readonly swarmBehavior: "Shows current swarm state: active phase, task counts, registered agents";
|
|
46
|
+
readonly disambiguationNote: "Use /swarm status to check swarm progress. Do not confuse with Claude Code /status (which shows Claude version/connectivity).";
|
|
47
|
+
}, {
|
|
48
|
+
readonly swarmCommand: "agents";
|
|
49
|
+
readonly ccCommand: "/agents";
|
|
50
|
+
readonly severity: "HIGH";
|
|
51
|
+
readonly ccBehavior: "Manages Claude Code subagent configurations and teams";
|
|
52
|
+
readonly swarmBehavior: "Lists registered swarm plugin agents with model, temperature, and guardrail info";
|
|
53
|
+
readonly disambiguationNote: "Use /swarm agents to list swarm plugin agents. Do not confuse with Claude Code /agents (which manages Claude subagent configs).";
|
|
54
|
+
}, {
|
|
55
|
+
readonly swarmCommand: "config";
|
|
56
|
+
readonly ccCommand: "/config";
|
|
57
|
+
readonly severity: "HIGH";
|
|
58
|
+
readonly ccBehavior: "Opens Claude Code settings interface (alias: /settings)";
|
|
59
|
+
readonly swarmBehavior: "Shows the current resolved opencode-swarm plugin configuration";
|
|
60
|
+
readonly disambiguationNote: "Use /swarm config to view swarm plugin config. Do not confuse with Claude Code /config (which opens Claude settings).";
|
|
61
|
+
}, {
|
|
62
|
+
readonly swarmCommand: "export";
|
|
63
|
+
readonly ccCommand: "/export";
|
|
64
|
+
readonly severity: "HIGH";
|
|
65
|
+
readonly ccBehavior: "Exports the current Claude Code conversation as plain text to a file";
|
|
66
|
+
readonly swarmBehavior: "Exports the swarm plan and context as JSON to stdout";
|
|
67
|
+
readonly disambiguationNote: "Use /swarm export to export swarm plan+context JSON. Do not confuse with Claude Code /export (which exports conversation text).";
|
|
68
|
+
}, {
|
|
69
|
+
readonly swarmCommand: "doctor";
|
|
70
|
+
readonly ccCommand: "/doctor";
|
|
71
|
+
readonly severity: "HIGH";
|
|
72
|
+
readonly ccBehavior: "Diagnoses the Claude Code installation (version, auth, permissions)";
|
|
73
|
+
readonly swarmBehavior: "Runs health checks on swarm configuration and state files";
|
|
74
|
+
readonly disambiguationNote: "Use /swarm config doctor to diagnose swarm config health. NEVER invoke the bare /doctor command — it runs Claude Code installation diagnostics.";
|
|
75
|
+
}, {
|
|
76
|
+
readonly swarmCommand: "history";
|
|
77
|
+
readonly ccCommand: "/history";
|
|
78
|
+
readonly severity: "MEDIUM";
|
|
79
|
+
readonly ccBehavior: "Shows Claude Code session history";
|
|
80
|
+
readonly swarmBehavior: "Shows completed swarm phases with status icons";
|
|
81
|
+
readonly disambiguationNote: "Use /swarm history to see completed phases. This is unrelated to Claude Code session history.";
|
|
82
|
+
}];
|
|
83
|
+
export declare const CRITICAL_CONFLICTS: Set<string>;
|
|
84
|
+
export declare const HIGH_CONFLICTS: Set<string>;
|
|
85
|
+
export declare const CONFLICT_MAP: Map<string, CommandConflict>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -31,6 +31,8 @@ export type CommandEntry = {
|
|
|
31
31
|
aliasOf?: string;
|
|
32
32
|
/** Whether this entry is deprecated — prefer aliasOf target instead */
|
|
33
33
|
deprecated?: boolean;
|
|
34
|
+
/** If set, this command shares a name with a Claude Code built-in slash command */
|
|
35
|
+
clashesWithNativeCcCommand?: string;
|
|
34
36
|
};
|
|
35
37
|
export declare const COMMAND_REGISTRY: {
|
|
36
38
|
readonly 'acknowledge-spec-drift': {
|
|
@@ -43,16 +45,19 @@ export declare const COMMAND_REGISTRY: {
|
|
|
43
45
|
readonly handler: (ctx: CommandContext) => Promise<string>;
|
|
44
46
|
readonly description: "Show current swarm state";
|
|
45
47
|
readonly category: "core";
|
|
48
|
+
readonly clashesWithNativeCcCommand: "/status";
|
|
46
49
|
};
|
|
47
50
|
readonly plan: {
|
|
48
51
|
readonly handler: (ctx: CommandContext) => Promise<string>;
|
|
49
52
|
readonly description: "Show plan (optionally filter by phase number)";
|
|
50
53
|
readonly category: "core";
|
|
54
|
+
readonly clashesWithNativeCcCommand: "/plan";
|
|
51
55
|
};
|
|
52
56
|
readonly agents: {
|
|
53
57
|
readonly handler: (ctx: CommandContext) => Promise<string>;
|
|
54
58
|
readonly description: "List registered agents";
|
|
55
59
|
readonly category: "core";
|
|
60
|
+
readonly clashesWithNativeCcCommand: "/agents";
|
|
56
61
|
};
|
|
57
62
|
readonly help: {
|
|
58
63
|
readonly handler: (ctx: CommandContext) => Promise<string>;
|
|
@@ -65,11 +70,13 @@ export declare const COMMAND_REGISTRY: {
|
|
|
65
70
|
readonly handler: (ctx: CommandContext) => Promise<string>;
|
|
66
71
|
readonly description: "Show completed phases summary";
|
|
67
72
|
readonly category: "utility";
|
|
73
|
+
readonly clashesWithNativeCcCommand: "/history";
|
|
68
74
|
};
|
|
69
75
|
readonly config: {
|
|
70
76
|
readonly handler: (ctx: CommandContext) => Promise<string>;
|
|
71
77
|
readonly description: "Show current resolved configuration";
|
|
72
78
|
readonly category: "config";
|
|
79
|
+
readonly clashesWithNativeCcCommand: "/config";
|
|
73
80
|
};
|
|
74
81
|
readonly 'config doctor': {
|
|
75
82
|
readonly handler: (ctx: CommandContext) => Promise<string>;
|
|
@@ -125,6 +132,7 @@ export declare const COMMAND_REGISTRY: {
|
|
|
125
132
|
readonly args: "";
|
|
126
133
|
readonly details: "Exports the current plan and context as JSON to stdout. Useful for piping to external tools or debugging swarm state.";
|
|
127
134
|
readonly category: "utility";
|
|
135
|
+
readonly clashesWithNativeCcCommand: "/export";
|
|
128
136
|
};
|
|
129
137
|
readonly evidence: {
|
|
130
138
|
readonly handler: (ctx: CommandContext) => Promise<string>;
|
|
@@ -157,6 +165,7 @@ export declare const COMMAND_REGISTRY: {
|
|
|
157
165
|
readonly category: "diagnostics";
|
|
158
166
|
readonly aliasOf: "config doctor";
|
|
159
167
|
readonly deprecated: true;
|
|
168
|
+
readonly clashesWithNativeCcCommand: "/doctor";
|
|
160
169
|
};
|
|
161
170
|
readonly info: {
|
|
162
171
|
readonly handler: (ctx: CommandContext) => Promise<string>;
|
|
@@ -291,6 +300,7 @@ export declare const COMMAND_REGISTRY: {
|
|
|
291
300
|
readonly details: "DELETES plan.md, context.md, and summaries/ directory from .swarm/. Stops background automation and clears in-memory queues. SAFETY: requires --confirm flag — without it, displays a warning and tips to export first.";
|
|
292
301
|
readonly args: "--confirm (required)";
|
|
293
302
|
readonly category: "utility";
|
|
303
|
+
readonly clashesWithNativeCcCommand: "/reset";
|
|
294
304
|
};
|
|
295
305
|
readonly 'reset-session': {
|
|
296
306
|
readonly handler: (ctx: CommandContext) => Promise<string>;
|
|
@@ -376,6 +386,7 @@ export declare const COMMAND_REGISTRY: {
|
|
|
376
386
|
readonly details: "save: creates named snapshot of current .swarm/ state. restore: soft-resets to checkpoint by overwriting current .swarm/ files. delete: removes named checkpoint. list: shows all checkpoints with timestamps. All subcommands require a label except list.";
|
|
377
387
|
readonly args: "<save|restore|delete|list> <label>";
|
|
378
388
|
readonly category: "utility";
|
|
389
|
+
readonly clashesWithNativeCcCommand: "/checkpoint";
|
|
379
390
|
};
|
|
380
391
|
};
|
|
381
392
|
export type RegisteredCommand = keyof typeof COMMAND_REGISTRY;
|
|
@@ -5,6 +5,7 @@ export declare const ORCHESTRATOR_NAME: "architect";
|
|
|
5
5
|
export declare const ALL_SUBAGENT_NAMES: readonly ["sme", "docs", "designer", "critic_sounding_board", "critic_drift_verifier", "critic_hallucination_verifier", "curator_init", "curator_phase", "council_generalist", "council_skeptic", "council_domain_expert", "reviewer", "critic", "critic_oversight", "explorer", "coder", "test_engineer"];
|
|
6
6
|
export declare const ALL_AGENT_NAMES: readonly ["architect", "sme", "docs", "designer", "critic_sounding_board", "critic_drift_verifier", "critic_hallucination_verifier", "curator_init", "curator_phase", "council_generalist", "council_skeptic", "council_domain_expert", "reviewer", "critic", "critic_oversight", "explorer", "coder", "test_engineer"];
|
|
7
7
|
export declare const OPENCODE_NATIVE_AGENTS: Set<"compaction" | "title" | "build" | "general" | "plan" | "explore" | "summary">;
|
|
8
|
+
export declare const CLAUDE_CODE_NATIVE_COMMANDS: ReadonlySet<string>;
|
|
8
9
|
export type QAAgentName = (typeof QA_AGENTS)[number];
|
|
9
10
|
export type PipelineAgentName = (typeof PIPELINE_AGENTS)[number];
|
|
10
11
|
export type AgentName = (typeof ALL_AGENT_NAMES)[number];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CC Command Intercept Hook
|
|
3
|
+
*
|
|
4
|
+
* Runtime message pipeline hook that detects bare Claude Code commands in agent
|
|
5
|
+
* messages and performs safe interventions:
|
|
6
|
+
* - CRITICAL destructive (/reset, /clear): hard-blocks via output mutation
|
|
7
|
+
* - CRITICAL non-destructive (/plan): soft-corrects to /swarm plan
|
|
8
|
+
* - HIGH severity: advisory log only, no text modification
|
|
9
|
+
*
|
|
10
|
+
* Designed for <5ms execution on 10k-token messages via simple regex/string ops.
|
|
11
|
+
* Idempotent: skips text already annotated with [CC_COMMAND_INTERCEPT].
|
|
12
|
+
*/
|
|
13
|
+
import { type ConflictSeverity } from '../commands/conflict-registry';
|
|
14
|
+
export interface CcInterceptConfig {
|
|
15
|
+
/** Severities to process (default: ['CRITICAL', 'HIGH']) */
|
|
16
|
+
intercept: ConflictSeverity[];
|
|
17
|
+
/** Whether to hard-block CRITICAL destructive commands (default: true) */
|
|
18
|
+
blockDestructive: boolean;
|
|
19
|
+
/** Whether to log intercept events (default: true) */
|
|
20
|
+
logIntercepts: boolean;
|
|
21
|
+
}
|
|
22
|
+
interface MessageWithParts {
|
|
23
|
+
info: {
|
|
24
|
+
role: string;
|
|
25
|
+
agent?: string;
|
|
26
|
+
sessionID?: string;
|
|
27
|
+
[key: string]: unknown;
|
|
28
|
+
};
|
|
29
|
+
parts: Array<{
|
|
30
|
+
type: string;
|
|
31
|
+
text?: string;
|
|
32
|
+
[key: string]: unknown;
|
|
33
|
+
}>;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Creates a messagesTransform hook that intercepts bare CC commands.
|
|
37
|
+
*
|
|
38
|
+
* @param config - Optional configuration overrides
|
|
39
|
+
* @returns Hook object with messagesTransform function
|
|
40
|
+
*/
|
|
41
|
+
export declare function createCcCommandInterceptHook(config?: Partial<CcInterceptConfig>): {
|
|
42
|
+
messagesTransform: (input: Record<string, never>, output: {
|
|
43
|
+
messages?: MessageWithParts[];
|
|
44
|
+
}) => Promise<void>;
|
|
45
|
+
};
|
|
46
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -7,31 +7,7 @@
|
|
|
7
7
|
* This hook runs as a chat.message transform — it inspects the architect's output
|
|
8
8
|
* and injects the critic's autonomous oversight response when escalation is detected.
|
|
9
9
|
*/
|
|
10
|
-
import type { OpencodeClient } from '@opencode-ai/sdk';
|
|
11
|
-
import type { AgentDefinition } from '../agents/architect.js';
|
|
12
10
|
import type { PluginConfig } from '../config';
|
|
13
|
-
import type { AgentSessionState } from '../state.js';
|
|
14
|
-
/**
|
|
15
|
-
* Test-only dependency-injection seam. Production code accesses state through
|
|
16
|
-
* `_internals.*` so tests can swap individual functions on this object without
|
|
17
|
-
* resorting to `mock.module('../../../src/state.js', ...)`, which leaks across
|
|
18
|
-
* test files in Bun's shared test-runner process and contaminates unrelated
|
|
19
|
-
* suites (see `gitignore-warning.ts:_internals` and `diff-scope.ts:_internals`
|
|
20
|
-
* for the pattern rationale). Tests should restore overridden properties in
|
|
21
|
-
* `afterEach`.
|
|
22
|
-
*
|
|
23
|
-
* All fields default to `null`. In production the lazy loaders (`_loadState`,
|
|
24
|
-
* `_loadCritic`) are used as fallbacks. In tests, set a non-null override
|
|
25
|
-
* before calling the hook to bypass the real module entirely.
|
|
26
|
-
*/
|
|
27
|
-
export declare const _internals: {
|
|
28
|
-
hasActiveFullAuto: ((sessionId?: string) => boolean) | null;
|
|
29
|
-
ensureAgentSession: ((sessionId: string) => AgentSessionState) | null;
|
|
30
|
-
swarmState: {
|
|
31
|
-
opencodeClient: OpencodeClient | null;
|
|
32
|
-
} | null;
|
|
33
|
-
createCriticAutonomousOversightAgent: ((model: string, customAppendPrompt?: string) => AgentDefinition) | null;
|
|
34
|
-
};
|
|
35
11
|
interface MessageWithParts {
|
|
36
12
|
info: {
|
|
37
13
|
role: string;
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { createAgentActivityHooks } from './agent-activity';
|
|
2
|
+
export { createCcCommandInterceptHook } from './cc-command-intercept';
|
|
2
3
|
export { createCompactionCustomizerHook } from './compaction-customizer';
|
|
3
4
|
export { createContextBudgetHandler } from './context-budget';
|
|
4
5
|
export { createCuratorLLMDelegate } from './curator-llm-factory';
|