cc-mirror 1.1.2 → 1.1.5

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.
Files changed (25) hide show
  1. package/dist/cc-mirror.mjs +294 -233
  2. package/dist/skills/orchestration/SKILL.md +619 -0
  3. package/dist/skills/{multi-agent-orchestrator → orchestration}/references/tools.md +143 -58
  4. package/dist/tui.mjs +533 -401
  5. package/package.json +1 -1
  6. package/dist/skills/multi-agent-orchestrator/SKILL.md +0 -391
  7. package/dist/skills/multi-agent-orchestrator/references/code-review.md +0 -266
  8. package/dist/skills/multi-agent-orchestrator/references/data-analysis.md +0 -315
  9. package/dist/skills/multi-agent-orchestrator/references/devops.md +0 -309
  10. package/dist/skills/multi-agent-orchestrator/references/documentation.md +0 -310
  11. package/dist/skills/multi-agent-orchestrator/references/project-management.md +0 -345
  12. package/dist/skills/multi-agent-orchestrator/references/research.md +0 -285
  13. package/dist/skills/multi-agent-orchestrator/references/software-development.md +0 -242
  14. package/dist/skills/multi-agent-orchestrator/references/testing.md +0 -282
  15. /package/dist/skills/{multi-agent-orchestrator → orchestration}/references/domains/code-review.md +0 -0
  16. /package/dist/skills/{multi-agent-orchestrator → orchestration}/references/domains/data-analysis.md +0 -0
  17. /package/dist/skills/{multi-agent-orchestrator → orchestration}/references/domains/devops.md +0 -0
  18. /package/dist/skills/{multi-agent-orchestrator → orchestration}/references/domains/documentation.md +0 -0
  19. /package/dist/skills/{multi-agent-orchestrator → orchestration}/references/domains/project-management.md +0 -0
  20. /package/dist/skills/{multi-agent-orchestrator → orchestration}/references/domains/research.md +0 -0
  21. /package/dist/skills/{multi-agent-orchestrator → orchestration}/references/domains/software-development.md +0 -0
  22. /package/dist/skills/{multi-agent-orchestrator → orchestration}/references/domains/testing.md +0 -0
  23. /package/dist/skills/{multi-agent-orchestrator → orchestration}/references/examples.md +0 -0
  24. /package/dist/skills/{multi-agent-orchestrator → orchestration}/references/guide.md +0 -0
  25. /package/dist/skills/{multi-agent-orchestrator → orchestration}/references/patterns.md +0 -0
@@ -179,8 +179,8 @@ var runTui = async () => {
179
179
  };
180
180
 
181
181
  // src/core/index.ts
182
- import fs13 from "node:fs";
183
- import path22 from "node:path";
182
+ import fs14 from "node:fs";
183
+ import path23 from "node:path";
184
184
 
185
185
  // src/core/constants.ts
186
186
  import os from "node:os";
@@ -731,6 +731,15 @@ var getUserLabel = () => {
731
731
  var formatUserMessage = (label) => ` [${label}] {} `;
732
732
 
733
733
  // src/brands/zai.ts
734
+ var ZAI_BLOCKED_TOOLS = [
735
+ // Server-injected MCP tools (Z.ai injects these, we block them)
736
+ "mcp__4_5v_mcp__analyze_image",
737
+ "mcp__milk_tea_server__claim_milk_tea_coupon",
738
+ "mcp__web_reader__webReader",
739
+ // Builtin tools that should use zai-cli instead
740
+ "WebSearch",
741
+ "WebFetch"
742
+ ];
734
743
  var clamp = (value) => Math.max(0, Math.min(255, Math.round(value)));
735
744
  var hexToRgb = (hex) => {
736
745
  const normalized = hex.replace("#", "").trim();
@@ -912,7 +921,8 @@ var buildZaiTweakccConfig = () => ({
912
921
  toolsets: [
913
922
  {
914
923
  name: "zai",
915
- allowedTools: "*"
924
+ allowedTools: "*",
925
+ blockedTools: ZAI_BLOCKED_TOOLS
916
926
  }
917
927
  ],
918
928
  defaultToolset: "zai",
@@ -921,6 +931,10 @@ var buildZaiTweakccConfig = () => ({
921
931
  });
922
932
 
923
933
  // src/brands/minimax.ts
934
+ var MINIMAX_BLOCKED_TOOLS = [
935
+ // WebSearch should use mcp__MiniMax__web_search instead
936
+ "WebSearch"
937
+ ];
924
938
  var clamp2 = (value) => Math.max(0, Math.min(255, Math.round(value)));
925
939
  var hexToRgb2 = (hex) => {
926
940
  const normalized = hex.replace("#", "").trim();
@@ -1101,7 +1115,8 @@ var buildMinimaxTweakccConfig = () => ({
1101
1115
  toolsets: [
1102
1116
  {
1103
1117
  name: "minimax",
1104
- allowedTools: "*"
1118
+ allowedTools: "*",
1119
+ blockedTools: MINIMAX_BLOCKED_TOOLS
1105
1120
  }
1106
1121
  ],
1107
1122
  defaultToolset: "minimax",
@@ -1960,7 +1975,7 @@ var listVariants = (rootDir) => {
1960
1975
  };
1961
1976
 
1962
1977
  // src/core/variant-builder/VariantBuilder.ts
1963
- import path16 from "node:path";
1978
+ import path17 from "node:path";
1964
1979
 
1965
1980
  // src/providers/index.ts
1966
1981
  var DEFAULT_TIMEOUT_MS = "3000000";
@@ -2290,8 +2305,8 @@ var InstallNpmStep = class {
2290
2305
  };
2291
2306
 
2292
2307
  // src/core/variant-builder/steps/TeamModeStep.ts
2293
- import fs7 from "node:fs";
2294
- import path8 from "node:path";
2308
+ import fs8 from "node:fs";
2309
+ import path9 from "node:path";
2295
2310
 
2296
2311
  // src/core/skills.ts
2297
2312
  import fs6 from "node:fs";
@@ -2384,7 +2399,7 @@ var ensureDevBrowserSkill = (opts) => {
2384
2399
  fs6.rmSync(tmpDir, { recursive: true, force: true });
2385
2400
  }
2386
2401
  };
2387
- var ORCHESTRATOR_SKILL_NAME = "multi-agent-orchestrator";
2402
+ var ORCHESTRATOR_SKILL_NAME = "orchestration";
2388
2403
  var findBundledSkillDir = () => {
2389
2404
  const thisFile = fileURLToPath2(import.meta.url);
2390
2405
  const thisDir = path7.dirname(thisFile);
@@ -2515,6 +2530,69 @@ var ensureDevBrowserSkillAsync = async (opts) => {
2515
2530
  }
2516
2531
  };
2517
2532
 
2533
+ // src/team-pack/index.ts
2534
+ import fs7 from "node:fs";
2535
+ import path8 from "node:path";
2536
+ import { fileURLToPath as fileURLToPath3 } from "node:url";
2537
+ var __dirname = path8.dirname(fileURLToPath3(import.meta.url));
2538
+ var TEAM_PACK_FILES = [
2539
+ { source: "tasklist.md", target: "tool-description-tasklist.md" },
2540
+ { source: "taskupdate.md", target: "tool-description-taskupdate.md" },
2541
+ { source: "task-extra-notes.md", target: "agent-prompt-task-tool-extra-notes.md" },
2542
+ { source: "task-management-note.md", target: "system-prompt-task-management-note.md" },
2543
+ { source: "orchestration-skill.md", target: "system-prompt-orchestration-skill.md" },
2544
+ { source: "skill-tool-override.md", target: "tool-description-skill.md" }
2545
+ ];
2546
+ var copyTeamPackPrompts = (systemPromptsDir) => {
2547
+ const copied = [];
2548
+ if (!fs7.existsSync(systemPromptsDir)) {
2549
+ fs7.mkdirSync(systemPromptsDir, { recursive: true });
2550
+ }
2551
+ for (const file of TEAM_PACK_FILES) {
2552
+ const sourcePath = path8.join(__dirname, file.source);
2553
+ const targetPath = path8.join(systemPromptsDir, file.target);
2554
+ if (fs7.existsSync(sourcePath)) {
2555
+ fs7.copyFileSync(sourcePath, targetPath);
2556
+ copied.push(file.target);
2557
+ }
2558
+ }
2559
+ return copied;
2560
+ };
2561
+ var configureTeamToolset = (configPath) => {
2562
+ if (!fs7.existsSync(configPath)) {
2563
+ return false;
2564
+ }
2565
+ try {
2566
+ const config = JSON.parse(fs7.readFileSync(configPath, "utf8"));
2567
+ config.settings = config.settings || {};
2568
+ const toolsets = Array.isArray(config.settings.toolsets) ? config.settings.toolsets : [];
2569
+ const defaultToolsetName = config.settings.defaultToolset;
2570
+ const existingDefaultToolset = toolsets.find(
2571
+ (t) => t.name === defaultToolsetName
2572
+ );
2573
+ const existingBlockedTools = existingDefaultToolset?.blockedTools || [];
2574
+ const mergedBlockedTools = [.../* @__PURE__ */ new Set([...existingBlockedTools, "TodoWrite"])];
2575
+ const teamToolset = {
2576
+ name: "team",
2577
+ allowedTools: "*",
2578
+ blockedTools: mergedBlockedTools
2579
+ };
2580
+ const existingTeamIndex = toolsets.findIndex((t) => t.name === "team");
2581
+ if (existingTeamIndex >= 0) {
2582
+ toolsets[existingTeamIndex] = teamToolset;
2583
+ } else {
2584
+ toolsets.push(teamToolset);
2585
+ }
2586
+ config.settings.toolsets = toolsets;
2587
+ config.settings.defaultToolset = "team";
2588
+ config.settings.planModeToolset = "team";
2589
+ fs7.writeFileSync(configPath, JSON.stringify(config, null, 2));
2590
+ return true;
2591
+ } catch {
2592
+ return false;
2593
+ }
2594
+ };
2595
+
2518
2596
  // src/core/variant-builder/steps/TeamModeStep.ts
2519
2597
  var TEAM_MODE_DISABLED = "function sU(){return!1}";
2520
2598
  var TEAM_MODE_ENABLED = "function sU(){return!0}";
@@ -2535,16 +2613,16 @@ var TeamModeStep = class {
2535
2613
  }
2536
2614
  patchCli(ctx) {
2537
2615
  const { state, params, paths } = ctx;
2538
- const cliPath = path8.join(paths.npmDir, "node_modules", "@anthropic-ai", "claude-code", "cli.js");
2616
+ const cliPath = path9.join(paths.npmDir, "node_modules", "@anthropic-ai", "claude-code", "cli.js");
2539
2617
  const backupPath = `${cliPath}.backup`;
2540
- if (!fs7.existsSync(cliPath)) {
2618
+ if (!fs8.existsSync(cliPath)) {
2541
2619
  state.notes.push("Warning: cli.js not found, skipping team mode patch");
2542
2620
  return;
2543
2621
  }
2544
- if (!fs7.existsSync(backupPath)) {
2545
- fs7.copyFileSync(cliPath, backupPath);
2622
+ if (!fs8.existsSync(backupPath)) {
2623
+ fs8.copyFileSync(cliPath, backupPath);
2546
2624
  }
2547
- let content = fs7.readFileSync(cliPath, "utf8");
2625
+ let content = fs8.readFileSync(cliPath, "utf8");
2548
2626
  if (content.includes(TEAM_MODE_ENABLED)) {
2549
2627
  state.notes.push("Team mode already enabled");
2550
2628
  return;
@@ -2554,16 +2632,16 @@ var TeamModeStep = class {
2554
2632
  return;
2555
2633
  }
2556
2634
  content = content.replace(TEAM_MODE_DISABLED, TEAM_MODE_ENABLED);
2557
- fs7.writeFileSync(cliPath, content);
2558
- const verifyContent = fs7.readFileSync(cliPath, "utf8");
2635
+ fs8.writeFileSync(cliPath, content);
2636
+ const verifyContent = fs8.readFileSync(cliPath, "utf8");
2559
2637
  if (!verifyContent.includes(TEAM_MODE_ENABLED)) {
2560
2638
  state.notes.push("Warning: Team mode patch verification failed");
2561
2639
  return;
2562
2640
  }
2563
- const settingsPath = path8.join(paths.configDir, "settings.json");
2564
- if (fs7.existsSync(settingsPath)) {
2641
+ const settingsPath = path9.join(paths.configDir, "settings.json");
2642
+ if (fs8.existsSync(settingsPath)) {
2565
2643
  try {
2566
- const settings = JSON.parse(fs7.readFileSync(settingsPath, "utf8"));
2644
+ const settings = JSON.parse(fs8.readFileSync(settingsPath, "utf8"));
2567
2645
  settings.env = settings.env || {};
2568
2646
  if (!settings.env.CLAUDE_CODE_TEAM_NAME) {
2569
2647
  settings.env.CLAUDE_CODE_TEAM_NAME = params.name;
@@ -2571,7 +2649,12 @@ var TeamModeStep = class {
2571
2649
  if (!settings.env.CLAUDE_CODE_AGENT_TYPE) {
2572
2650
  settings.env.CLAUDE_CODE_AGENT_TYPE = "team-lead";
2573
2651
  }
2574
- fs7.writeFileSync(settingsPath, JSON.stringify(settings, null, 2));
2652
+ settings.permissions = settings.permissions || {};
2653
+ settings.permissions.allow = settings.permissions.allow || [];
2654
+ if (!settings.permissions.allow.includes("Skill(orchestration)")) {
2655
+ settings.permissions.allow.push("Skill(orchestration)");
2656
+ }
2657
+ fs8.writeFileSync(settingsPath, JSON.stringify(settings, null, 2));
2575
2658
  } catch {
2576
2659
  state.notes.push("Warning: Could not update settings.json with team env vars");
2577
2660
  }
@@ -2583,15 +2666,24 @@ var TeamModeStep = class {
2583
2666
  } else if (skillResult.status === "failed") {
2584
2667
  state.notes.push(`Warning: orchestrator skill install failed: ${skillResult.message}`);
2585
2668
  }
2669
+ const systemPromptsDir = path9.join(paths.tweakDir, "system-prompts");
2670
+ const copiedFiles = copyTeamPackPrompts(systemPromptsDir);
2671
+ if (copiedFiles.length > 0) {
2672
+ state.notes.push(`Team pack prompts installed (${copiedFiles.join(", ")})`);
2673
+ }
2674
+ const tweakccConfigPath = path9.join(paths.tweakDir, "config.json");
2675
+ if (configureTeamToolset(tweakccConfigPath)) {
2676
+ state.notes.push("Team toolset configured (TodoWrite blocked)");
2677
+ }
2586
2678
  }
2587
2679
  };
2588
2680
 
2589
2681
  // src/core/variant-builder/steps/WriteConfigStep.ts
2590
- import path10 from "node:path";
2682
+ import path11 from "node:path";
2591
2683
 
2592
2684
  // src/core/claude-config.ts
2593
- import fs8 from "node:fs";
2594
- import path9 from "node:path";
2685
+ import fs9 from "node:fs";
2686
+ import path10 from "node:path";
2595
2687
  var SETTINGS_FILE = "settings.json";
2596
2688
  var CLAUDE_CONFIG_FILE = ".claude.json";
2597
2689
  var PLACEHOLDER_KEY = "<API_KEY>";
@@ -2602,7 +2694,7 @@ var toStringOrNull = (value) => {
2602
2694
  return trimmed;
2603
2695
  };
2604
2696
  var readSettingsApiKey = (configDir) => {
2605
- const settingsPath = path9.join(configDir, SETTINGS_FILE);
2697
+ const settingsPath = path10.join(configDir, SETTINGS_FILE);
2606
2698
  const settings = readJson(settingsPath);
2607
2699
  if (!settings?.env) return null;
2608
2700
  const env = settings.env;
@@ -2614,7 +2706,7 @@ var ZAI_DENY_TOOLS = [
2614
2706
  "mcp__web_reader__webReader"
2615
2707
  ];
2616
2708
  var ensureZaiMcpDeny = (configDir) => {
2617
- const settingsPath = path9.join(configDir, SETTINGS_FILE);
2709
+ const settingsPath = path10.join(configDir, SETTINGS_FILE);
2618
2710
  const existing = readJson(settingsPath) || {};
2619
2711
  const permissions = existing.permissions || {};
2620
2712
  const deny = Array.isArray(permissions.deny) ? [...permissions.deny] : [];
@@ -2637,7 +2729,7 @@ var ensureZaiMcpDeny = (configDir) => {
2637
2729
  return true;
2638
2730
  };
2639
2731
  var ensureSettingsEnvDefaults = (configDir, defaults) => {
2640
- const settingsPath = path9.join(configDir, SETTINGS_FILE);
2732
+ const settingsPath = path10.join(configDir, SETTINGS_FILE);
2641
2733
  const existing = readJson(settingsPath) || {};
2642
2734
  const env = { ...existing.env ?? {} };
2643
2735
  let changed = false;
@@ -2652,7 +2744,7 @@ var ensureSettingsEnvDefaults = (configDir, defaults) => {
2652
2744
  return true;
2653
2745
  };
2654
2746
  var ensureSettingsEnvOverrides = (configDir, overrides) => {
2655
- const settingsPath = path9.join(configDir, SETTINGS_FILE);
2747
+ const settingsPath = path10.join(configDir, SETTINGS_FILE);
2656
2748
  const existing = readJson(settingsPath) || {};
2657
2749
  const env = { ...existing.env ?? {} };
2658
2750
  let changed = false;
@@ -2671,8 +2763,8 @@ var ensureApiKeyApproval = (configDir, apiKey) => {
2671
2763
  const resolvedKey = toStringOrNull(apiKey) || readSettingsApiKey(configDir);
2672
2764
  if (!resolvedKey) return false;
2673
2765
  const approvedToken = resolvedKey.slice(-20);
2674
- const configPath = path9.join(configDir, CLAUDE_CONFIG_FILE);
2675
- const exists = fs8.existsSync(configPath);
2766
+ const configPath = path10.join(configDir, CLAUDE_CONFIG_FILE);
2767
+ const exists = fs9.existsSync(configPath);
2676
2768
  let config = null;
2677
2769
  if (exists) {
2678
2770
  config = readJson(configPath);
@@ -2696,8 +2788,8 @@ var ensureApiKeyApproval = (configDir, apiKey) => {
2696
2788
  return true;
2697
2789
  };
2698
2790
  var ensureOnboardingState = (configDir, opts = {}) => {
2699
- const configPath = path9.join(configDir, CLAUDE_CONFIG_FILE);
2700
- const exists = fs8.existsSync(configPath);
2791
+ const configPath = path10.join(configDir, CLAUDE_CONFIG_FILE);
2792
+ const exists = fs9.existsSync(configPath);
2701
2793
  let config = null;
2702
2794
  if (exists) {
2703
2795
  config = readJson(configPath);
@@ -2731,8 +2823,8 @@ var ensureOnboardingState = (configDir, opts = {}) => {
2731
2823
  };
2732
2824
  var ensureMinimaxMcpServer = (configDir, apiKey) => {
2733
2825
  const resolvedKey = toStringOrNull(apiKey) || readSettingsApiKey(configDir);
2734
- const configPath = path9.join(configDir, CLAUDE_CONFIG_FILE);
2735
- const exists = fs8.existsSync(configPath);
2826
+ const configPath = path10.join(configDir, CLAUDE_CONFIG_FILE);
2827
+ const exists = fs9.existsSync(configPath);
2736
2828
  let config = null;
2737
2829
  if (exists) {
2738
2830
  config = readJson(configPath);
@@ -2789,7 +2881,7 @@ var WriteConfigStep = class {
2789
2881
  env.ANTHROPIC_API_KEY = "<API_KEY>";
2790
2882
  }
2791
2883
  const config = { env };
2792
- writeJson(path10.join(paths.configDir, "settings.json"), config);
2884
+ writeJson(path11.join(paths.configDir, "settings.json"), config);
2793
2885
  state.env = env;
2794
2886
  state.resolvedApiKey = typeof env.ANTHROPIC_API_KEY === "string" ? env.ANTHROPIC_API_KEY : void 0;
2795
2887
  ensureApiKeyApproval(paths.configDir, state.resolvedApiKey);
@@ -2855,14 +2947,14 @@ var BrandThemeStep = class {
2855
2947
  }
2856
2948
  }
2857
2949
  if (params.noTweak && prefs.promptPackPreference) {
2858
- state.notes.push(`Prompt pack skipped (tweakcc disabled, ${prefs.promptPackModePreference}).`);
2950
+ state.notes.push("Prompt pack skipped (tweakcc disabled).");
2859
2951
  }
2860
2952
  }
2861
2953
  };
2862
2954
 
2863
2955
  // src/core/prompt-pack.ts
2864
- import fs9 from "node:fs";
2865
- import path11 from "node:path";
2956
+ import fs10 from "node:fs";
2957
+ import path12 from "node:path";
2866
2958
 
2867
2959
  // src/core/prompt-pack/sanitize.ts
2868
2960
  var BACKTICK_REGEX = /`/g;
@@ -2884,12 +2976,11 @@ var verbositySpec = `
2884
2976
  What changed, Where, How to verify, Risks, Next steps, Open questions.
2885
2977
  </output_verbosity_spec>
2886
2978
  `.trim();
2887
- var operatingSpec = (mode) => `
2979
+ var operatingSpec = () => `
2888
2980
  <system_reminder>
2889
2981
  - Operate like an ambitious, senior engineer: proactive, high-ownership, and precise.
2890
2982
  - Prefer concrete outputs: commands, file paths, diffs, and validation steps.
2891
2983
  - Respect permissions and confirm before destructive actions.
2892
- ${mode === "maximal" ? "- Parallelize independent work with Task/subagents when useful." : ""}
2893
2984
  </system_reminder>
2894
2985
  `.trim();
2895
2986
  var subjectiveWorkSpec = `
@@ -2900,6 +2991,13 @@ var subjectiveWorkSpec = `
2900
2991
  - When you catch yourself making assumptions about subjective quality, pause and ask instead.
2901
2992
  </subjective_work_guardrails>
2902
2993
  `.trim();
2994
+ var skillClarificationSpec = `
2995
+ <skill_clarification>
2996
+ The examples in the Skill tool description (commit, review-pr, pdf) are illustrative only.
2997
+ IMPORTANT: Only skills listed in <available_skills> are actually installed in this variant.
2998
+ If a user asks for a skill not in <available_skills>, inform them it's not installed.
2999
+ </skill_clarification>
3000
+ `.trim();
2903
3001
 
2904
3002
  // src/core/prompt-pack/providers/zai.ts
2905
3003
  var ZAI_BLOCKED_MCP_TOOLS = [
@@ -2923,7 +3021,7 @@ Quick start examples:
2923
3021
  - npx zai-cli repo search facebook/react "server components"
2924
3022
  - npx zai-cli repo --help
2925
3023
  `.trim();
2926
- var buildZaiContract = (mode) => `
3024
+ var buildZaiContract = () => `
2927
3025
  <explicit_guidance>
2928
3026
  Provider: z.ai (GLM)
2929
3027
 
@@ -2968,7 +3066,7 @@ Blocked tools:
2968
3066
  ${ZAI_BLOCKED_MCP_TOOLS.map((tool) => `- ${tool}`).join("\n")}
2969
3067
  </warning>
2970
3068
 
2971
- ${operatingSpec(mode)}
3069
+ ${operatingSpec()}
2972
3070
 
2973
3071
  ${subjectiveWorkSpec}
2974
3072
 
@@ -2986,8 +3084,8 @@ ${ZAI_BLOCKED_MCP_TOOLS.map((tool) => `- ${tool}`).join("\n")}
2986
3084
 
2987
3085
  ${subjectiveWorkSpec}
2988
3086
  `.trim();
2989
- var buildZaiOverlays = (mode) => ({
2990
- main: buildZaiContract(mode),
3087
+ var buildZaiOverlays = () => ({
3088
+ main: buildZaiContract(),
2991
3089
  mcpCli: `
2992
3090
  ${buildZaiExcerpt()}
2993
3091
 
@@ -3048,13 +3146,14 @@ ${ZAI_BLOCKED_MCP_TOOLS.map((tool) => `- ${tool}`).join("\n")}
3048
3146
  <explicit_guidance>
3049
3147
  Prefer zai-cli via Bash for web/search/vision. Only use other MCP tools if the user explicitly configured them and they are clearly relevant.
3050
3148
  </explicit_guidance>
3051
- `.trim()
3149
+ `.trim(),
3150
+ skill: skillClarificationSpec
3052
3151
  });
3053
3152
 
3054
3153
  // src/core/prompt-pack/providers/minimax.ts
3055
3154
  var MINIMAX_WEB_SEARCH = "mcp__MiniMax__web_search";
3056
3155
  var MINIMAX_UNDERSTAND_IMAGE = "mcp__MiniMax__understand_image";
3057
- var buildMinimaxContract = (mode) => `
3156
+ var buildMinimaxContract = () => `
3058
3157
  <explicit_guidance>
3059
3158
  <tool_routing priority="critical">
3060
3159
  MiniMax MCP tools available (and ONLY these for web + vision):
@@ -3086,7 +3185,7 @@ Single-page URL retrieval:
3086
3185
  - Do NOT misuse web_search to fetch full page content.
3087
3186
  </tool_routing>
3088
3187
 
3089
- ${operatingSpec(mode)}
3188
+ ${operatingSpec()}
3090
3189
 
3091
3190
  ${subjectiveWorkSpec}
3092
3191
 
@@ -3104,8 +3203,8 @@ MiniMax tool routing:
3104
3203
 
3105
3204
  ${subjectiveWorkSpec}
3106
3205
  `.trim();
3107
- var buildMinimaxOverlays = (mode) => ({
3108
- main: buildMinimaxContract(mode),
3206
+ var buildMinimaxOverlays = () => ({
3207
+ main: buildMinimaxContract(),
3109
3208
  mcpCli: `
3110
3209
  ${buildMinimaxExcerpt()}
3111
3210
 
@@ -3143,83 +3242,18 @@ MiniMax MCP tools:
3143
3242
  You MUST load the tool first:
3144
3243
  - MCPSearch query: select:${MINIMAX_WEB_SEARCH} or select:${MINIMAX_UNDERSTAND_IMAGE}
3145
3244
  </explicit_guidance>
3146
- `.trim()
3245
+ `.trim(),
3246
+ skill: skillClarificationSpec
3147
3247
  });
3148
3248
 
3149
3249
  // src/core/prompt-pack/overlays.ts
3150
- var mergeOverlays = (base, extra) => ({
3151
- ...base,
3152
- ...Object.fromEntries(Object.entries(extra).filter(([, value]) => value && value.trim().length > 0))
3153
- });
3154
- var buildProviderExcerpt = (provider) => provider === "zai" ? buildZaiExcerpt() : buildMinimaxExcerpt();
3155
- var buildMaximalOverlays = (provider) => ({
3156
- explore: `
3157
- <system_reminder>
3158
- - You are in Explore mode: go wide before deep.
3159
- - Use tools early to validate assumptions and reduce guesswork.
3160
- - Output: Findings (bullets), Risks/unknowns, Next steps.
3161
- </system_reminder>
3162
-
3163
- ${buildProviderExcerpt(provider)}
3164
- `.trim(),
3165
- planEnhanced: `
3166
- <system_reminder>
3167
- - Provide 2-3 viable options with tradeoffs.
3168
- - Include risks, unknowns, and a validation checklist.
3169
- - Output structure: Overview, Options, Recommendation, Steps, Verification, Risks.
3170
- </system_reminder>
3171
-
3172
- ${buildProviderExcerpt(provider)}
3173
- `.trim(),
3174
- planReminder: `
3175
- <system_reminder>
3176
- - In Plan Mode: surface options, tradeoffs, risks, and validation steps explicitly.
3177
- </system_reminder>
3178
- `.trim(),
3179
- planReminderSub: `
3180
- <system_reminder>
3181
- - In Plan Mode (subagents): surface options, tradeoffs, risks, and validation steps explicitly.
3182
- </system_reminder>
3183
- `.trim(),
3184
- taskTool: `
3185
- Maximal mode: use Task to parallelize independent research/debugging and to keep the main thread focused.
3186
- `.trim(),
3187
- enterPlan: `
3188
- Maximal mode: enter Plan Mode early for ambiguous, multi-step, or high-risk tasks.
3189
- `.trim(),
3190
- exitPlan: `
3191
- Maximal mode: return a crisp plan with options, checkpoints, verification, and rollback considerations.
3192
- `.trim(),
3193
- skill: `
3194
- Maximal mode: use Skills when they provide sharper domain knowledge or integrations; otherwise proceed normally.
3195
- `.trim(),
3196
- conversationSummary: `
3197
- <system_reminder>
3198
- - Capture decisions, constraints, open questions, and next steps.
3199
- - Preserve critical commands, configs, and file paths.
3200
- </system_reminder>
3201
- `.trim(),
3202
- conversationSummaryExtended: `
3203
- <system_reminder>
3204
- - Capture decisions, constraints, open questions, and next steps.
3205
- - Preserve critical commands, configs, and file paths.
3206
- </system_reminder>
3207
- `.trim(),
3208
- webfetchSummary: `
3209
- <system_reminder>
3210
- - Extract key facts, titles, and constraints.
3211
- - Preserve URLs and important context verbatim.
3212
- </system_reminder>
3213
- `.trim()
3214
- });
3215
- var buildProviderOverlays = (provider, mode) => {
3216
- if (provider === "zai") return buildZaiOverlays(mode);
3217
- return buildMinimaxOverlays(mode);
3250
+ var buildProviderOverlays = (provider) => {
3251
+ if (provider === "zai") return buildZaiOverlays();
3252
+ return buildMinimaxOverlays();
3218
3253
  };
3219
- var resolveOverlays = (provider, mode) => {
3220
- const base = buildProviderOverlays(provider, mode);
3221
- const overlays = mode === "maximal" ? mergeOverlays(base, buildMaximalOverlays(provider)) : base;
3222
- return sanitizeOverlayMap(overlays);
3254
+ var resolveOverlays = (provider) => {
3255
+ const base = buildProviderOverlays(provider);
3256
+ return sanitizeOverlayMap(base);
3223
3257
  };
3224
3258
 
3225
3259
  // src/core/prompt-pack/targets.ts
@@ -3277,17 +3311,17 @@ ${block}
3277
3311
  };
3278
3312
  var updatePromptFile = (filePath, overlay) => {
3279
3313
  if (!overlay) return false;
3280
- if (!fs9.existsSync(filePath)) return false;
3281
- const content = fs9.readFileSync(filePath, "utf8");
3314
+ if (!fs10.existsSync(filePath)) return false;
3315
+ const content = fs10.readFileSync(filePath, "utf8");
3282
3316
  const updated = insertOverlay(content, overlay);
3283
3317
  if (updated === content) return false;
3284
- fs9.writeFileSync(filePath, updated);
3318
+ fs10.writeFileSync(filePath, updated);
3285
3319
  return true;
3286
3320
  };
3287
3321
  var applyOverlays = (systemPromptsDir, overlays) => {
3288
3322
  const updated = [];
3289
3323
  for (const target of PROMPT_PACK_TARGETS) {
3290
- const filePath = path11.join(systemPromptsDir, target.filename);
3324
+ const filePath = path12.join(systemPromptsDir, target.filename);
3291
3325
  const overlay = overlays[target.key];
3292
3326
  if (updatePromptFile(filePath, overlay)) {
3293
3327
  updated.push(target.filename);
@@ -3295,14 +3329,14 @@ var applyOverlays = (systemPromptsDir, overlays) => {
3295
3329
  }
3296
3330
  return updated;
3297
3331
  };
3298
- var applyPromptPack = (tweakDir, providerKey, mode = "minimal") => {
3332
+ var applyPromptPack = (tweakDir, providerKey) => {
3299
3333
  if (!isPromptPackKey(providerKey)) {
3300
- return { changed: false, updated: [], mode };
3334
+ return { changed: false, updated: [] };
3301
3335
  }
3302
- const overlays = resolveOverlays(providerKey, mode);
3303
- const systemPromptsDir = path11.join(tweakDir, "system-prompts");
3336
+ const overlays = resolveOverlays(providerKey);
3337
+ const systemPromptsDir = path12.join(tweakDir, "system-prompts");
3304
3338
  const updated = applyOverlays(systemPromptsDir, overlays);
3305
- return { changed: updated.length > 0, updated, mode };
3339
+ return { changed: updated.length > 0, updated };
3306
3340
  };
3307
3341
 
3308
3342
  // src/core/variant-builder/steps/TweakccStep.ts
@@ -3321,10 +3355,10 @@ ${state.tweakResult.stdout ?? ""}`.trim();
3321
3355
  throw new Error(formatTweakccFailure(output));
3322
3356
  }
3323
3357
  if (prefs.promptPackEnabled) {
3324
- ctx.report(`Applying prompt pack (${prefs.promptPackModePreference})...`);
3325
- const packResult = applyPromptPack(paths.tweakDir, params.providerKey, prefs.promptPackModePreference);
3358
+ ctx.report("Applying prompt pack...");
3359
+ const packResult = applyPromptPack(paths.tweakDir, params.providerKey);
3326
3360
  if (packResult.changed) {
3327
- state.notes.push(`Prompt pack applied (${packResult.mode}, ${packResult.updated.join(", ")})`);
3361
+ state.notes.push(`Prompt pack applied (${packResult.updated.join(", ")})`);
3328
3362
  ctx.report("Re-applying tweakcc...");
3329
3363
  const reapply = runTweakcc(paths.tweakDir, state.binaryPath, prefs.commandStdio);
3330
3364
  state.tweakResult = reapply;
@@ -3349,10 +3383,10 @@ ${state.tweakResult.stdout ?? ""}`.trim();
3349
3383
  throw new Error(formatTweakccFailure(output));
3350
3384
  }
3351
3385
  if (prefs.promptPackEnabled) {
3352
- await ctx.report(`Applying prompt pack (${prefs.promptPackModePreference})...`);
3353
- const packResult = applyPromptPack(paths.tweakDir, params.providerKey, prefs.promptPackModePreference);
3386
+ await ctx.report("Applying prompt pack...");
3387
+ const packResult = applyPromptPack(paths.tweakDir, params.providerKey);
3354
3388
  if (packResult.changed) {
3355
- state.notes.push(`Prompt pack applied (${packResult.mode}, ${packResult.updated.join(", ")})`);
3389
+ state.notes.push(`Prompt pack applied (${packResult.updated.join(", ")})`);
3356
3390
  await ctx.report("Re-applying tweakcc...");
3357
3391
  const reapply = await runTweakccAsync(paths.tweakDir, state.binaryPath, prefs.commandStdio);
3358
3392
  state.tweakResult = reapply;
@@ -3367,10 +3401,10 @@ ${reapply.stdout ?? ""}`.trim();
3367
3401
  };
3368
3402
 
3369
3403
  // src/core/wrapper.ts
3370
- import fs10 from "node:fs";
3371
- import path12 from "node:path";
3404
+ import fs11 from "node:fs";
3405
+ import path13 from "node:path";
3372
3406
  var writeWrapper = (wrapperPath, configDir, binaryPath, runtime = "node") => {
3373
- const tweakDir = path12.join(path12.dirname(configDir), "tweakcc");
3407
+ const tweakDir = path13.join(path13.dirname(configDir), "tweakcc");
3374
3408
  const execLine = runtime === "node" ? `exec node "${binaryPath}" "$@"` : `exec "${binaryPath}" "$@"`;
3375
3409
  const envLoader = [
3376
3410
  "if command -v node >/dev/null 2>&1; then",
@@ -3585,7 +3619,7 @@ var writeWrapper = (wrapperPath, configDir, binaryPath, runtime = "node") => {
3585
3619
  execLine,
3586
3620
  ""
3587
3621
  ].join("\n");
3588
- fs10.writeFileSync(wrapperPath, content, { mode: 493 });
3622
+ fs11.writeFileSync(wrapperPath, content, { mode: 493 });
3589
3623
  };
3590
3624
 
3591
3625
  // src/core/variant-builder/steps/WrapperStep.ts
@@ -3602,9 +3636,9 @@ var WrapperStep = class {
3602
3636
  };
3603
3637
 
3604
3638
  // src/core/shell-env.ts
3605
- import fs11 from "node:fs";
3639
+ import fs12 from "node:fs";
3606
3640
  import os5 from "node:os";
3607
- import path13 from "node:path";
3641
+ import path14 from "node:path";
3608
3642
  var SETTINGS_FILE2 = "settings.json";
3609
3643
  var BLOCK_START = "# cc-mirror: Z.ai env start";
3610
3644
  var BLOCK_END = "# cc-mirror: Z.ai env end";
@@ -3618,20 +3652,20 @@ var normalizeApiKey = (value) => {
3618
3652
  var resolveShellProfile = () => {
3619
3653
  const home = os5.homedir();
3620
3654
  const shell = process.env.SHELL || "";
3621
- const name = path13.basename(shell);
3655
+ const name = path14.basename(shell);
3622
3656
  if (name === "zsh") {
3623
- return path13.join(home, ".zshrc");
3657
+ return path14.join(home, ".zshrc");
3624
3658
  }
3625
3659
  if (name === "bash") {
3626
- const bashrc = path13.join(home, ".bashrc");
3627
- if (fs11.existsSync(bashrc)) return bashrc;
3628
- return path13.join(home, ".bash_profile");
3660
+ const bashrc = path14.join(home, ".bashrc");
3661
+ if (fs12.existsSync(bashrc)) return bashrc;
3662
+ return path14.join(home, ".bash_profile");
3629
3663
  }
3630
3664
  return null;
3631
3665
  };
3632
3666
  var readSettingsApiKey2 = (configDir) => {
3633
- const settingsPath = path13.join(configDir, SETTINGS_FILE2);
3634
- if (!fs11.existsSync(settingsPath)) return null;
3667
+ const settingsPath = path14.join(configDir, SETTINGS_FILE2);
3668
+ if (!fs12.existsSync(settingsPath)) return null;
3635
3669
  const settings = readJson(settingsPath);
3636
3670
  const key = settings?.env?.ANTHROPIC_API_KEY;
3637
3671
  if (typeof key !== "string") return null;
@@ -3686,7 +3720,7 @@ var ensureZaiShellEnv = (opts) => {
3686
3720
  if (!profile) {
3687
3721
  return { status: "failed", message: "Unsupported shell; set Z_AI_API_KEY manually" };
3688
3722
  }
3689
- const existing = fs11.existsSync(profile) ? fs11.readFileSync(profile, "utf8") : "";
3723
+ const existing = fs12.existsSync(profile) ? fs12.readFileSync(profile, "utf8") : "";
3690
3724
  if (hasZaiKeyInProfile(existing)) {
3691
3725
  return { status: "skipped", message: "Z_AI_API_KEY already set in shell profile", path: profile };
3692
3726
  }
@@ -3694,7 +3728,7 @@ var ensureZaiShellEnv = (opts) => {
3694
3728
  if (next === existing) {
3695
3729
  return { status: "skipped", message: "Shell profile already up to date", path: profile };
3696
3730
  }
3697
- fs11.writeFileSync(profile, next);
3731
+ fs12.writeFileSync(profile, next);
3698
3732
  return { status: "updated", path: profile, message: `Run: source ${profile}` };
3699
3733
  };
3700
3734
 
@@ -3733,7 +3767,7 @@ var ShellEnvStep = class {
3733
3767
  };
3734
3768
 
3735
3769
  // src/core/variant-builder/steps/SkillInstallStep.ts
3736
- import path14 from "node:path";
3770
+ import path15 from "node:path";
3737
3771
  var SkillInstallStep = class {
3738
3772
  name = "SkillInstall";
3739
3773
  execute(ctx) {
@@ -3745,7 +3779,7 @@ var SkillInstallStep = class {
3745
3779
  const skillResult = ensureDevBrowserSkill({
3746
3780
  install: true,
3747
3781
  update: prefs.skillUpdateEnabled,
3748
- targetDir: path14.join(paths.configDir, "skills")
3782
+ targetDir: path15.join(paths.configDir, "skills")
3749
3783
  });
3750
3784
  if (skillResult.status === "failed") {
3751
3785
  state.notes.push(`dev-browser skill install failed: ${skillResult.message || "unknown error"}`);
@@ -3762,7 +3796,7 @@ var SkillInstallStep = class {
3762
3796
  const skillResult = await ensureDevBrowserSkillAsync({
3763
3797
  install: true,
3764
3798
  update: prefs.skillUpdateEnabled,
3765
- targetDir: path14.join(paths.configDir, "skills")
3799
+ targetDir: path15.join(paths.configDir, "skills")
3766
3800
  });
3767
3801
  if (skillResult.status === "failed") {
3768
3802
  state.notes.push(`dev-browser skill install failed: ${skillResult.message || "unknown error"}`);
@@ -3773,7 +3807,7 @@ var SkillInstallStep = class {
3773
3807
  };
3774
3808
 
3775
3809
  // src/core/variant-builder/steps/FinalizeStep.ts
3776
- import path15 from "node:path";
3810
+ import path16 from "node:path";
3777
3811
  var FinalizeStep = class {
3778
3812
  name = "Finalize";
3779
3813
  execute(ctx) {
@@ -3798,7 +3832,6 @@ var FinalizeStep = class {
3798
3832
  tweakDir: paths.tweakDir,
3799
3833
  brand: prefs.brandKey ?? void 0,
3800
3834
  promptPack: prefs.promptPackPreference,
3801
- promptPackMode: prefs.promptPackModePreference,
3802
3835
  skillInstall: prefs.skillInstallEnabled,
3803
3836
  shellEnv: prefs.shellEnvEnabled,
3804
3837
  binDir: paths.resolvedBin,
@@ -3808,7 +3841,7 @@ var FinalizeStep = class {
3808
3841
  npmVersion: prefs.resolvedNpmVersion,
3809
3842
  teamModeEnabled
3810
3843
  };
3811
- writeJson(path15.join(paths.variantDir, "variant.json"), meta);
3844
+ writeJson(path16.join(paths.variantDir, "variant.json"), meta);
3812
3845
  state.meta = meta;
3813
3846
  }
3814
3847
  };
@@ -3820,7 +3853,6 @@ var shouldEnablePromptPack = (providerKey, provider) => {
3820
3853
  if (provider?.noPromptPack) return false;
3821
3854
  return providerKey === "zai" || providerKey === "minimax";
3822
3855
  };
3823
- var defaultPromptPackMode = (providerKey) => providerKey === "zai" || providerKey === "minimax" ? "maximal" : "minimal";
3824
3856
  var shouldInstallSkills = (providerKey) => providerKey === "zai" || providerKey === "minimax";
3825
3857
  var shouldEnableShellEnv = (providerKey) => providerKey === "zai";
3826
3858
  var yieldToEventLoop = () => new Promise((resolve) => setImmediate(resolve));
@@ -3830,10 +3862,11 @@ var VariantBuilder = class {
3830
3862
  this.steps = [
3831
3863
  new PrepareDirectoriesStep(),
3832
3864
  new InstallNpmStep(),
3833
- new TeamModeStep(),
3834
- // Patches cli.js for team mode (if enabled)
3835
3865
  new WriteConfigStep(),
3836
3866
  new BrandThemeStep(),
3867
+ // Creates tweakcc/config.json
3868
+ new TeamModeStep(),
3869
+ // Patches cli.js and configures team toolset (needs config.json)
3837
3870
  new TweakccStep(),
3838
3871
  new WrapperStep(),
3839
3872
  new ShellEnvStep(),
@@ -3853,11 +3886,11 @@ var VariantBuilder = class {
3853
3886
  const binDir = params.binDir ?? DEFAULT_BIN_DIR;
3854
3887
  const resolvedRoot = expandTilde(rootDir) ?? rootDir;
3855
3888
  const resolvedBin = expandTilde(binDir) ?? binDir;
3856
- const variantDir = path16.join(resolvedRoot, params.name);
3857
- const configDir = path16.join(variantDir, "config");
3858
- const tweakDir = path16.join(variantDir, "tweakcc");
3859
- const wrapperPath = path16.join(resolvedBin, params.name);
3860
- const npmDir = path16.join(variantDir, "npm");
3889
+ const variantDir = path17.join(resolvedRoot, params.name);
3890
+ const configDir = path17.join(variantDir, "config");
3891
+ const tweakDir = path17.join(variantDir, "tweakcc");
3892
+ const wrapperPath = path17.join(resolvedBin, params.name);
3893
+ const npmDir = path17.join(variantDir, "npm");
3861
3894
  const paths = {
3862
3895
  resolvedRoot,
3863
3896
  resolvedBin,
@@ -3870,7 +3903,6 @@ var VariantBuilder = class {
3870
3903
  const resolvedNpmPackage = normalizeNpmPackage(params.npmPackage);
3871
3904
  const resolvedNpmVersion = normalizeNpmVersion();
3872
3905
  const promptPackPreference = params.promptPack ?? shouldEnablePromptPack(params.providerKey, provider);
3873
- const promptPackModePreference = params.promptPackMode ?? defaultPromptPackMode(params.providerKey);
3874
3906
  const promptPackEnabled = !params.noTweak && promptPackPreference;
3875
3907
  const skillInstallEnabled = params.skillInstall ?? shouldInstallSkills(params.providerKey);
3876
3908
  const shellEnvEnabled = params.shellEnv ?? shouldEnableShellEnv(params.providerKey);
@@ -3880,7 +3912,6 @@ var VariantBuilder = class {
3880
3912
  resolvedNpmPackage,
3881
3913
  resolvedNpmVersion,
3882
3914
  promptPackPreference,
3883
- promptPackModePreference,
3884
3915
  promptPackEnabled,
3885
3916
  skillInstallEnabled,
3886
3917
  shellEnvEnabled,
@@ -3954,7 +3985,7 @@ var VariantBuilder = class {
3954
3985
  };
3955
3986
 
3956
3987
  // src/core/variant-builder/VariantUpdater.ts
3957
- import path21 from "node:path";
3988
+ import path22 from "node:path";
3958
3989
 
3959
3990
  // src/core/variant-builder/update-steps/InstallNpmUpdateStep.ts
3960
3991
  var InstallNpmUpdateStep = class {
@@ -3989,8 +4020,8 @@ var InstallNpmUpdateStep = class {
3989
4020
  };
3990
4021
 
3991
4022
  // src/core/variant-builder/update-steps/TeamModeUpdateStep.ts
3992
- import fs12 from "node:fs";
3993
- import path17 from "node:path";
4023
+ import fs13 from "node:fs";
4024
+ import path18 from "node:path";
3994
4025
  var TEAM_MODE_DISABLED2 = "function sU(){return!1}";
3995
4026
  var TEAM_MODE_ENABLED2 = "function sU(){return!0}";
3996
4027
  var TeamModeUpdateStep = class {
@@ -4023,31 +4054,39 @@ var TeamModeUpdateStep = class {
4023
4054
  this.patchCli(ctx);
4024
4055
  }
4025
4056
  unpatchCli(ctx) {
4026
- const { state, meta } = ctx;
4027
- const cliPath = path17.join(meta.npmDir || "", "node_modules", "@anthropic-ai", "claude-code", "cli.js");
4028
- if (!fs12.existsSync(cliPath)) {
4057
+ const { state, meta, paths } = ctx;
4058
+ const cliPath = path18.join(paths.npmDir, "node_modules", "@anthropic-ai", "claude-code", "cli.js");
4059
+ if (!fs13.existsSync(cliPath)) {
4029
4060
  state.notes.push("Warning: cli.js not found, skipping team mode unpatch");
4061
+ this.removeSkill(ctx);
4030
4062
  return;
4031
4063
  }
4032
- let content = fs12.readFileSync(cliPath, "utf8");
4064
+ let content = fs13.readFileSync(cliPath, "utf8");
4033
4065
  if (content.includes(TEAM_MODE_DISABLED2)) {
4034
4066
  state.notes.push("Team mode already disabled");
4035
4067
  meta.teamModeEnabled = false;
4068
+ this.removeSkill(ctx);
4036
4069
  return;
4037
4070
  }
4038
4071
  if (!content.includes(TEAM_MODE_ENABLED2)) {
4039
4072
  state.notes.push("Warning: Team mode function not found in cli.js");
4073
+ this.removeSkill(ctx);
4040
4074
  return;
4041
4075
  }
4042
4076
  content = content.replace(TEAM_MODE_ENABLED2, TEAM_MODE_DISABLED2);
4043
- fs12.writeFileSync(cliPath, content);
4044
- const verifyContent = fs12.readFileSync(cliPath, "utf8");
4077
+ fs13.writeFileSync(cliPath, content);
4078
+ const verifyContent = fs13.readFileSync(cliPath, "utf8");
4045
4079
  if (!verifyContent.includes(TEAM_MODE_DISABLED2)) {
4046
4080
  state.notes.push("Warning: Team mode unpatch verification failed");
4081
+ this.removeSkill(ctx);
4047
4082
  return;
4048
4083
  }
4049
4084
  meta.teamModeEnabled = false;
4050
4085
  state.notes.push("Team mode disabled successfully");
4086
+ this.removeSkill(ctx);
4087
+ }
4088
+ removeSkill(ctx) {
4089
+ const { state, meta } = ctx;
4051
4090
  const skillResult = removeOrchestratorSkill(meta.configDir);
4052
4091
  if (skillResult.status === "removed") {
4053
4092
  state.notes.push("Multi-agent orchestrator skill removed");
@@ -4056,17 +4095,17 @@ var TeamModeUpdateStep = class {
4056
4095
  }
4057
4096
  }
4058
4097
  patchCli(ctx) {
4059
- const { state, meta, name } = ctx;
4060
- const cliPath = path17.join(meta.npmDir || "", "node_modules", "@anthropic-ai", "claude-code", "cli.js");
4098
+ const { state, meta, name, paths } = ctx;
4099
+ const cliPath = path18.join(paths.npmDir, "node_modules", "@anthropic-ai", "claude-code", "cli.js");
4061
4100
  const backupPath = `${cliPath}.backup`;
4062
- if (!fs12.existsSync(cliPath)) {
4101
+ if (!fs13.existsSync(cliPath)) {
4063
4102
  state.notes.push("Warning: cli.js not found, skipping team mode patch");
4064
4103
  return;
4065
4104
  }
4066
- if (!fs12.existsSync(backupPath)) {
4067
- fs12.copyFileSync(cliPath, backupPath);
4105
+ if (!fs13.existsSync(backupPath)) {
4106
+ fs13.copyFileSync(cliPath, backupPath);
4068
4107
  }
4069
- let content = fs12.readFileSync(cliPath, "utf8");
4108
+ let content = fs13.readFileSync(cliPath, "utf8");
4070
4109
  if (content.includes(TEAM_MODE_ENABLED2)) {
4071
4110
  state.notes.push("Team mode already enabled");
4072
4111
  meta.teamModeEnabled = true;
@@ -4077,16 +4116,16 @@ var TeamModeUpdateStep = class {
4077
4116
  return;
4078
4117
  }
4079
4118
  content = content.replace(TEAM_MODE_DISABLED2, TEAM_MODE_ENABLED2);
4080
- fs12.writeFileSync(cliPath, content);
4081
- const verifyContent = fs12.readFileSync(cliPath, "utf8");
4119
+ fs13.writeFileSync(cliPath, content);
4120
+ const verifyContent = fs13.readFileSync(cliPath, "utf8");
4082
4121
  if (!verifyContent.includes(TEAM_MODE_ENABLED2)) {
4083
4122
  state.notes.push("Warning: Team mode patch verification failed");
4084
4123
  return;
4085
4124
  }
4086
- const settingsPath = path17.join(meta.configDir, "settings.json");
4087
- if (fs12.existsSync(settingsPath)) {
4125
+ const settingsPath = path18.join(meta.configDir, "settings.json");
4126
+ if (fs13.existsSync(settingsPath)) {
4088
4127
  try {
4089
- const settings = JSON.parse(fs12.readFileSync(settingsPath, "utf8"));
4128
+ const settings = JSON.parse(fs13.readFileSync(settingsPath, "utf8"));
4090
4129
  settings.env = settings.env || {};
4091
4130
  if (!settings.env.CLAUDE_CODE_TEAM_NAME) {
4092
4131
  settings.env.CLAUDE_CODE_TEAM_NAME = name;
@@ -4094,7 +4133,12 @@ var TeamModeUpdateStep = class {
4094
4133
  if (!settings.env.CLAUDE_CODE_AGENT_TYPE) {
4095
4134
  settings.env.CLAUDE_CODE_AGENT_TYPE = "team-lead";
4096
4135
  }
4097
- fs12.writeFileSync(settingsPath, JSON.stringify(settings, null, 2));
4136
+ settings.permissions = settings.permissions || {};
4137
+ settings.permissions.allow = settings.permissions.allow || [];
4138
+ if (!settings.permissions.allow.includes("Skill(orchestration)")) {
4139
+ settings.permissions.allow.push("Skill(orchestration)");
4140
+ }
4141
+ fs13.writeFileSync(settingsPath, JSON.stringify(settings, null, 2));
4098
4142
  } catch {
4099
4143
  state.notes.push("Warning: Could not update settings.json with team env vars");
4100
4144
  }
@@ -4107,6 +4151,15 @@ var TeamModeUpdateStep = class {
4107
4151
  } else if (skillResult.status === "failed") {
4108
4152
  state.notes.push(`Warning: orchestrator skill install failed: ${skillResult.message}`);
4109
4153
  }
4154
+ const systemPromptsDir = path18.join(meta.tweakDir, "system-prompts");
4155
+ const copiedFiles = copyTeamPackPrompts(systemPromptsDir);
4156
+ if (copiedFiles.length > 0) {
4157
+ state.notes.push(`Team pack prompts installed (${copiedFiles.join(", ")})`);
4158
+ }
4159
+ const tweakccConfigPath = path18.join(meta.tweakDir, "config.json");
4160
+ if (configureTeamToolset(tweakccConfigPath)) {
4161
+ state.notes.push("Team toolset configured (TodoWrite blocked)");
4162
+ }
4110
4163
  }
4111
4164
  };
4112
4165
 
@@ -4168,13 +4221,13 @@ ${tweakResult.stdout ?? ""}`.trim();
4168
4221
  }
4169
4222
  if (prefs.promptPackEnabled) {
4170
4223
  if (isAsync) {
4171
- await ctx.report(`Applying prompt pack (${prefs.promptPackModePreference})...`);
4224
+ await ctx.report("Applying prompt pack...");
4172
4225
  } else {
4173
- ctx.report(`Applying prompt pack (${prefs.promptPackModePreference})...`);
4226
+ ctx.report("Applying prompt pack...");
4174
4227
  }
4175
- const packResult = applyPromptPack(meta.tweakDir, meta.provider, prefs.promptPackModePreference);
4228
+ const packResult = applyPromptPack(meta.tweakDir, meta.provider);
4176
4229
  if (packResult.changed) {
4177
- state.notes.push(`Prompt pack applied (${packResult.mode}, ${packResult.updated.join(", ")})`);
4230
+ state.notes.push(`Prompt pack applied (${packResult.updated.join(", ")})`);
4178
4231
  if (isAsync) {
4179
4232
  await ctx.report("Re-applying tweakcc...");
4180
4233
  } else {
@@ -4193,7 +4246,7 @@ ${reapply.stdout ?? ""}`.trim();
4193
4246
  };
4194
4247
 
4195
4248
  // src/core/variant-builder/update-steps/WrapperUpdateStep.ts
4196
- import path18 from "node:path";
4249
+ import path19 from "node:path";
4197
4250
  var WrapperUpdateStep = class {
4198
4251
  name = "Wrapper";
4199
4252
  execute(ctx) {
@@ -4211,7 +4264,7 @@ var WrapperUpdateStep = class {
4211
4264
  const resolvedBin = opts.binDir ? expandTilde(opts.binDir) ?? opts.binDir : meta.binDir;
4212
4265
  if (resolvedBin) {
4213
4266
  ensureDir(resolvedBin);
4214
- const wrapperPath = path18.join(resolvedBin, name);
4267
+ const wrapperPath = path19.join(resolvedBin, name);
4215
4268
  writeWrapper(wrapperPath, meta.configDir, meta.binaryPath, "node");
4216
4269
  meta.binDir = resolvedBin;
4217
4270
  }
@@ -4303,7 +4356,7 @@ var ShellEnvUpdateStep = class {
4303
4356
  };
4304
4357
 
4305
4358
  // src/core/variant-builder/update-steps/SkillInstallUpdateStep.ts
4306
- import path19 from "node:path";
4359
+ import path20 from "node:path";
4307
4360
  var SkillInstallUpdateStep = class {
4308
4361
  name = "SkillInstall";
4309
4362
  execute(ctx) {
@@ -4323,7 +4376,7 @@ var SkillInstallUpdateStep = class {
4323
4376
  const skillOpts = {
4324
4377
  install: true,
4325
4378
  update: prefs.skillUpdateEnabled,
4326
- targetDir: path19.join(meta.configDir, "skills")
4379
+ targetDir: path20.join(meta.configDir, "skills")
4327
4380
  };
4328
4381
  const skillResult = isAsync ? await ensureDevBrowserSkillAsync(skillOpts) : ensureDevBrowserSkill(skillOpts);
4329
4382
  if (skillResult.status === "failed") {
@@ -4335,7 +4388,7 @@ var SkillInstallUpdateStep = class {
4335
4388
  };
4336
4389
 
4337
4390
  // src/core/variant-builder/update-steps/FinalizeUpdateStep.ts
4338
- import path20 from "node:path";
4391
+ import path21 from "node:path";
4339
4392
  var FinalizeUpdateStep = class {
4340
4393
  name = "Finalize";
4341
4394
  execute(ctx) {
@@ -4350,10 +4403,10 @@ var FinalizeUpdateStep = class {
4350
4403
  const { meta, paths, prefs } = ctx;
4351
4404
  meta.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
4352
4405
  meta.promptPack = prefs.promptPackPreference;
4353
- meta.promptPackMode = prefs.promptPackModePreference;
4354
4406
  meta.skillInstall = prefs.skillInstallEnabled;
4355
4407
  meta.shellEnv = prefs.shellEnvEnabled;
4356
- writeJson(path20.join(paths.variantDir, "variant.json"), meta);
4408
+ delete meta.promptPackMode;
4409
+ writeJson(path21.join(paths.variantDir, "variant.json"), meta);
4357
4410
  }
4358
4411
  };
4359
4412
 
@@ -4365,7 +4418,6 @@ var shouldEnablePromptPack2 = (providerKey) => {
4365
4418
  if (provider?.noPromptPack) return false;
4366
4419
  return providerKey === "zai" || providerKey === "minimax";
4367
4420
  };
4368
- var defaultPromptPackMode2 = (providerKey) => providerKey === "zai" || providerKey === "minimax" ? "maximal" : "minimal";
4369
4421
  var shouldInstallSkills2 = (providerKey) => providerKey === "zai" || providerKey === "minimax";
4370
4422
  var shouldEnableShellEnv2 = (providerKey) => providerKey === "zai";
4371
4423
  var yieldToEventLoop2 = () => new Promise((resolve) => setImmediate(resolve));
@@ -4391,13 +4443,12 @@ var VariantUpdater = class {
4391
4443
  */
4392
4444
  initContext(rootDir, name, opts) {
4393
4445
  const resolvedRoot = expandTilde(rootDir || DEFAULT_ROOT) ?? rootDir;
4394
- const variantDir = path21.join(resolvedRoot, name);
4446
+ const variantDir = path22.join(resolvedRoot, name);
4395
4447
  const meta = loadVariantMeta(variantDir);
4396
4448
  if (!meta) throw new Error(`Variant not found: ${name}`);
4397
4449
  const resolvedNpmPackage = normalizeNpmPackage2(opts.npmPackage ?? meta.npmPackage);
4398
4450
  const resolvedNpmVersion = normalizeNpmVersion2();
4399
4451
  const promptPackPreference = opts.promptPack ?? meta.promptPack ?? shouldEnablePromptPack2(meta.provider);
4400
- const promptPackModePreference = opts.promptPackMode ?? meta.promptPackMode ?? defaultPromptPackMode2(meta.provider);
4401
4452
  const promptPackEnabled = !opts.noTweak && promptPackPreference;
4402
4453
  const skillInstallEnabled = opts.skillInstall ?? meta.skillInstall ?? shouldInstallSkills2(meta.provider);
4403
4454
  const shellEnvEnabled = opts.shellEnv ?? meta.shellEnv ?? shouldEnableShellEnv2(meta.provider);
@@ -4407,13 +4458,12 @@ var VariantUpdater = class {
4407
4458
  resolvedRoot,
4408
4459
  resolvedBin: opts.binDir ? expandTilde(opts.binDir) ?? opts.binDir : meta.binDir,
4409
4460
  variantDir,
4410
- npmDir: meta.npmDir || path21.join(variantDir, "npm")
4461
+ npmDir: meta.npmDir || path22.join(variantDir, "npm")
4411
4462
  };
4412
4463
  const prefs = {
4413
4464
  resolvedNpmPackage,
4414
4465
  resolvedNpmVersion,
4415
4466
  promptPackPreference,
4416
- promptPackModePreference,
4417
4467
  promptPackEnabled,
4418
4468
  skillInstallEnabled,
4419
4469
  shellEnvEnabled,
@@ -4489,17 +4539,17 @@ var updateVariant = (rootDir, name, opts = {}) => {
4489
4539
  };
4490
4540
  var removeVariant = (rootDir, name) => {
4491
4541
  const resolvedRoot = expandTilde(rootDir || DEFAULT_ROOT) ?? rootDir;
4492
- const variantDir = path22.join(resolvedRoot, name);
4493
- if (!fs13.existsSync(variantDir)) throw new Error(`Variant not found: ${name}`);
4494
- fs13.rmSync(variantDir, { recursive: true, force: true });
4542
+ const variantDir = path23.join(resolvedRoot, name);
4543
+ if (!fs14.existsSync(variantDir)) throw new Error(`Variant not found: ${name}`);
4544
+ fs14.rmSync(variantDir, { recursive: true, force: true });
4495
4545
  };
4496
4546
  var doctor = (rootDir, binDir) => {
4497
4547
  const resolvedRoot = expandTilde(rootDir || DEFAULT_ROOT) ?? rootDir;
4498
4548
  const resolvedBin = expandTilde(binDir || DEFAULT_BIN_DIR) ?? binDir;
4499
4549
  const variants = listVariants(resolvedRoot);
4500
4550
  return variants.map(({ name, meta }) => {
4501
- const wrapperPath = path22.join(resolvedBin, name);
4502
- const ok = Boolean(meta && fs13.existsSync(meta.binaryPath) && fs13.existsSync(wrapperPath));
4551
+ const wrapperPath = path23.join(resolvedBin, name);
4552
+ const ok = Boolean(meta && fs14.existsSync(meta.binaryPath) && fs14.existsSync(wrapperPath));
4503
4553
  return {
4504
4554
  name,
4505
4555
  ok,
@@ -4511,7 +4561,7 @@ var doctor = (rootDir, binDir) => {
4511
4561
  var listVariants2 = (rootDir) => listVariants(rootDir);
4512
4562
  var tweakVariant = (rootDir, name) => {
4513
4563
  const resolvedRoot = expandTilde(rootDir || DEFAULT_ROOT) ?? rootDir;
4514
- const variantDir = path22.join(resolvedRoot, name);
4564
+ const variantDir = path23.join(resolvedRoot, name);
4515
4565
  const meta = loadVariantMeta(variantDir);
4516
4566
  if (!meta) throw new Error(`Variant not found: ${name}`);
4517
4567
  ensureDir(meta.tweakDir);
@@ -4585,21 +4635,33 @@ function runTweakCommand({ opts }) {
4585
4635
  }
4586
4636
 
4587
4637
  // src/cli/commands/update.ts
4588
- import path23 from "node:path";
4638
+ import path24 from "node:path";
4589
4639
 
4590
4640
  // src/cli/utils/printSummary.ts
4591
4641
  function printSummary(opts) {
4592
4642
  const { action, meta, wrapperPath, notes } = opts;
4643
+ const getPromptPackDescription = () => {
4644
+ if (!meta.promptPack) return "off";
4645
+ if (meta.provider === "zai") return "on (zai-cli routing)";
4646
+ if (meta.provider === "minimax") return "on (MCP routing)";
4647
+ return "on";
4648
+ };
4649
+ const getTeamModeDescription = () => {
4650
+ if (!meta.teamModeEnabled) return "off";
4651
+ return "on (orchestrator skill, TodoWrite blocked)";
4652
+ };
4593
4653
  console.log("");
4594
4654
  console.log(`\u2713 ${action}: ${meta.name}`);
4595
4655
  console.log(` Provider: ${meta.provider}`);
4596
4656
  if (meta.promptPack !== void 0) {
4597
- const mode = meta.promptPackMode || "maximal";
4598
- console.log(` Prompt pack: ${meta.promptPack ? `on (${mode})` : "off"}`);
4657
+ console.log(` Prompt pack: ${getPromptPackDescription()}`);
4599
4658
  }
4600
4659
  if (meta.skillInstall !== void 0) {
4601
4660
  console.log(` dev-browser skill: ${meta.skillInstall ? "on" : "off"}`);
4602
4661
  }
4662
+ if (meta.teamModeEnabled !== void 0) {
4663
+ console.log(` Team mode: ${getTeamModeDescription()}`);
4664
+ }
4603
4665
  if (meta.shellEnv !== void 0 && meta.provider === "zai") {
4604
4666
  console.log(` Shell env: ${meta.shellEnv ? "write Z_AI_API_KEY" : "manual"}`);
4605
4667
  }
@@ -4680,14 +4742,6 @@ function formatModelNote(overrides) {
4680
4742
  return `Model mapping: ${text}`;
4681
4743
  }
4682
4744
 
4683
- // src/cli/utils/promptPack.ts
4684
- function parsePromptPackMode(value) {
4685
- if (!value) return void 0;
4686
- const normalized = value.toLowerCase();
4687
- if (normalized === "minimal" || normalized === "maximal") return normalized;
4688
- return void 0;
4689
- }
4690
-
4691
4745
  // src/cli/utils/extraEnv.ts
4692
4746
  function buildExtraEnv(opts) {
4693
4747
  const env = Array.isArray(opts.env) ? [...opts.env] : [];
@@ -4709,10 +4763,11 @@ function runUpdateCommand({ opts }) {
4709
4763
  return;
4710
4764
  }
4711
4765
  const promptPack = opts["no-prompt-pack"] ? false : void 0;
4712
- const promptPackMode = parsePromptPackMode(opts["prompt-pack-mode"]);
4713
4766
  const skillInstall = opts["no-skill-install"] ? false : void 0;
4714
4767
  const skillUpdate = Boolean(opts["skill-update"]);
4715
4768
  const shellEnv = opts["no-shell-env"] ? false : opts["shell-env"] ? true : void 0;
4769
+ const enableTeamMode = opts["enable-team-mode"] ? true : void 0;
4770
+ const disableTeamMode = opts["disable-team-mode"] ? true : void 0;
4716
4771
  for (const name of names) {
4717
4772
  const result = updateVariant(rootDir, name, {
4718
4773
  binDir,
@@ -4720,13 +4775,13 @@ function runUpdateCommand({ opts }) {
4720
4775
  brand: opts.brand,
4721
4776
  noTweak: Boolean(opts.noTweak),
4722
4777
  promptPack,
4723
- promptPackMode,
4724
4778
  skillInstall,
4725
4779
  shellEnv,
4726
4780
  skillUpdate,
4727
- enableTeamMode: Boolean(opts["enable-team-mode"])
4781
+ enableTeamMode,
4782
+ disableTeamMode
4728
4783
  });
4729
- const wrapperPath = path23.join(binDir, name);
4784
+ const wrapperPath = path24.join(binDir, name);
4730
4785
  printSummary({
4731
4786
  action: "Updated",
4732
4787
  meta: result.meta,
@@ -4785,7 +4840,6 @@ async function prepareCreateParams(opts) {
4785
4840
  async function handleQuickMode(opts, params) {
4786
4841
  const { provider } = params;
4787
4842
  const promptPack = opts["no-prompt-pack"] ? false : void 0;
4788
- const promptPackMode = parsePromptPackMode(opts["prompt-pack-mode"]);
4789
4843
  const skillInstall = opts["no-skill-install"] ? false : void 0;
4790
4844
  const skillUpdate = Boolean(opts["skill-update"]);
4791
4845
  let shellEnv = opts["no-shell-env"] ? false : opts["shell-env"] ? true : void 0;
@@ -4809,6 +4863,10 @@ async function handleQuickMode(opts, params) {
4809
4863
  shellEnv = answer.trim().toLowerCase().startsWith("y");
4810
4864
  }
4811
4865
  }
4866
+ const enableTeamMode = opts["disable-team-mode"] ? false : true;
4867
+ if (enableTeamMode) {
4868
+ console.log("Team mode will be enabled (orchestrator skill installed)");
4869
+ }
4812
4870
  const result = createVariant({
4813
4871
  name: params.name,
4814
4872
  providerKey: params.providerKey,
@@ -4821,12 +4879,11 @@ async function handleQuickMode(opts, params) {
4821
4879
  npmPackage: params.npmPackage,
4822
4880
  noTweak: Boolean(opts.noTweak),
4823
4881
  promptPack,
4824
- promptPackMode,
4825
4882
  skillInstall,
4826
4883
  shellEnv,
4827
4884
  skillUpdate,
4828
4885
  modelOverrides: resolvedModelOverrides,
4829
- enableTeamMode: Boolean(opts["enable-team-mode"]),
4886
+ enableTeamMode,
4830
4887
  tweakccStdio: "pipe"
4831
4888
  });
4832
4889
  const modelNote = formatModelNote(resolvedModelOverrides);
@@ -4841,7 +4898,6 @@ async function handleQuickMode(opts, params) {
4841
4898
  async function handleInteractiveMode(opts, params) {
4842
4899
  const { provider } = params;
4843
4900
  const promptPack = opts["no-prompt-pack"] ? false : void 0;
4844
- const promptPackMode = parsePromptPackMode(opts["prompt-pack-mode"]);
4845
4901
  const skillInstall = opts["no-skill-install"] ? false : void 0;
4846
4902
  const skillUpdate = Boolean(opts["skill-update"]);
4847
4903
  let shellEnv = opts["no-shell-env"] ? false : opts["shell-env"] ? true : void 0;
@@ -4869,6 +4925,13 @@ async function handleInteractiveMode(opts, params) {
4869
4925
  shellEnv = answer.trim().toLowerCase().startsWith("y");
4870
4926
  }
4871
4927
  }
4928
+ let enableTeamMode = true;
4929
+ if (opts["disable-team-mode"]) {
4930
+ enableTeamMode = false;
4931
+ } else if (!opts["enable-team-mode"]) {
4932
+ const answer = await prompt("Enable team mode (multi-agent collaboration)? (yes/no)", "yes");
4933
+ enableTeamMode = answer.trim().toLowerCase().startsWith("y");
4934
+ }
4872
4935
  const result = createVariant({
4873
4936
  name: nextName,
4874
4937
  providerKey: params.providerKey,
@@ -4881,12 +4944,11 @@ async function handleInteractiveMode(opts, params) {
4881
4944
  npmPackage: nextNpmPackage,
4882
4945
  noTweak: Boolean(opts.noTweak),
4883
4946
  promptPack,
4884
- promptPackMode,
4885
4947
  skillInstall,
4886
4948
  shellEnv,
4887
4949
  skillUpdate,
4888
4950
  modelOverrides: resolvedModelOverrides,
4889
- enableTeamMode: Boolean(opts["enable-team-mode"]),
4951
+ enableTeamMode,
4890
4952
  tweakccStdio: "pipe"
4891
4953
  });
4892
4954
  const modelNote = formatModelNote(resolvedModelOverrides);
@@ -4900,7 +4962,6 @@ async function handleInteractiveMode(opts, params) {
4900
4962
  }
4901
4963
  async function handleNonInteractiveMode(opts, params) {
4902
4964
  const promptPack = opts["no-prompt-pack"] ? false : void 0;
4903
- const promptPackMode = parsePromptPackMode(opts["prompt-pack-mode"]);
4904
4965
  const skillInstall = opts["no-skill-install"] ? false : void 0;
4905
4966
  const skillUpdate = Boolean(opts["skill-update"]);
4906
4967
  const shellEnv = opts["no-shell-env"] ? false : opts["shell-env"] ? true : void 0;
@@ -4909,6 +4970,7 @@ async function handleNonInteractiveMode(opts, params) {
4909
4970
  throw new Error("Provider API key required (use --api-key)");
4910
4971
  }
4911
4972
  const resolvedModelOverrides = await ensureModelMapping(params.providerKey, opts, { ...modelOverrides });
4973
+ const enableTeamMode = opts["disable-team-mode"] ? false : true;
4912
4974
  const result = createVariant({
4913
4975
  name: params.name,
4914
4976
  providerKey: params.providerKey,
@@ -4921,12 +4983,11 @@ async function handleNonInteractiveMode(opts, params) {
4921
4983
  npmPackage: params.npmPackage,
4922
4984
  noTweak: Boolean(opts.noTweak),
4923
4985
  promptPack,
4924
- promptPackMode,
4925
4986
  skillInstall,
4926
4987
  shellEnv,
4927
4988
  skillUpdate,
4928
4989
  modelOverrides: resolvedModelOverrides,
4929
- enableTeamMode: Boolean(opts["enable-team-mode"]),
4990
+ enableTeamMode,
4930
4991
  tweakccStdio: "pipe"
4931
4992
  });
4932
4993
  const modelNote = formatModelNote(resolvedModelOverrides);