zcf 3.1.2 → 3.1.4

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/dist/cli.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import cac from 'cac';
3
3
  import ansis from 'ansis';
4
- import { a5 as ensureI18nInitialized, a0 as i18n, a8 as readCcrConfig, a9 as isCcrInstalled, aa as installCcr, ab as configureCcrFeature, ac as handleExitPromptError, ad as handleGeneralError, p as SUPPORTED_LANGS, a7 as addNumbersToChoices, q as LANG_LABELS, ae as updateZcfConfig, af as changeLanguage, ag as readZcfConfig, o as openSettingsJson, d as importRecommendedPermissions, b as importRecommendedEnv, T as applyAiLanguageDirective, ah as configureOutputStyle, Q as getExistingModelConfig, N as updateCustomModel, O as updateDefaultModel, ai as isWindows, t as readMcpConfig, y as fixWindowsMcpConfig, w as writeMcpConfig, aj as selectMcpServices, u as backupMcpConfig, ak as getMcpServices, x as buildMcpServerConfig, v as mergeMcpServers, al as setupCcrConfiguration, R as getExistingApiConfig, V as promptApiConfigurationAction, am as modifyApiConfigPartially, an as validateApiKey, K as configureApi, ao as formatApiKeyDisplay, U as switchToOfficialLogin, ap as COMETIX_COMMAND_NAME, aq as COMETIX_COMMANDS, ar as installCometixLine, as as checkAndUpdateTools, at as readJsonConfig, au as writeJsonConfig, j as ZCF_CONFIG_FILE, av as displayBanner, aw as runCodexUpdate, ax as version, ay as resolveAiOutputLanguage, az as updatePromptOnly, aA as selectAndInstallWorkflows, aB as checkClaudeCodeVersionAndPrompt, n as isCodeToolType, D as DEFAULT_CODE_TOOL_TYPE, aC as displayBannerWithInfo, l as CODE_TOOL_BANNERS, aD as runCodexUninstall, aE as configureCodexMcp, aF as configureCodexApi, aG as runCodexWorkflowImport, aH as runCodexFullInit, i as init, aI as listCodexProviders, aJ as getCurrentCodexProvider, aK as switchCodexProvider, a1 as readCodexConfig, aL as switchToOfficialLogin$1, aM as switchToProvider, aN as readZcfConfigAsync, aO as initI18n, aP as selectScriptLanguage } from './chunks/simple-config.mjs';
4
+ import { a5 as ensureI18nInitialized, a0 as i18n, a8 as readCcrConfig, a9 as isCcrInstalled, aa as installCcr, ab as configureCcrFeature, ac as handleExitPromptError, ad as handleGeneralError, p as SUPPORTED_LANGS, a7 as addNumbersToChoices, q as LANG_LABELS, ae as updateZcfConfig, af as changeLanguage, ag as readZcfConfig, o as openSettingsJson, d as importRecommendedPermissions, b as importRecommendedEnv, T as applyAiLanguageDirective, ah as configureOutputStyle, Q as getExistingModelConfig, N as updateCustomModel, O as updateDefaultModel, ai as isWindows, t as readMcpConfig, y as fixWindowsMcpConfig, w as writeMcpConfig, aj as selectMcpServices, u as backupMcpConfig, ak as getMcpServices, x as buildMcpServerConfig, v as mergeMcpServers, al as setupCcrConfiguration, R as getExistingApiConfig, V as promptApiConfigurationAction, am as modifyApiConfigPartially, an as validateApiKey, K as configureApi, ao as formatApiKeyDisplay, U as switchToOfficialLogin, ap as COMETIX_COMMAND_NAME, aq as COMETIX_COMMANDS, ar as installCometixLine, as as checkAndUpdateTools, at as runCodexUpdate, au as resolveCodeType, av as readJsonConfig, aw as writeJsonConfig, j as ZCF_CONFIG_FILE, ax as displayBanner, ay as version, az as resolveAiOutputLanguage, aA as updatePromptOnly, aB as selectAndInstallWorkflows, aC as checkClaudeCodeVersionAndPrompt, n as isCodeToolType, D as DEFAULT_CODE_TOOL_TYPE, aD as displayBannerWithInfo, l as CODE_TOOL_BANNERS, aE as runCodexUninstall, aF as configureCodexMcp, aG as configureCodexApi, aH as runCodexWorkflowImport, aI as runCodexFullInit, i as init, aJ as listCodexProviders, aK as getCurrentCodexProvider, aL as switchCodexProvider, a1 as readCodexConfig, aM as switchToOfficialLogin$1, aN as switchToProvider, aO as readZcfConfigAsync, aP as initI18n, aQ as selectScriptLanguage } from './chunks/simple-config.mjs';
5
5
  import { existsSync } from 'node:fs';
6
6
  import { homedir } from 'node:os';
7
7
  import inquirer from 'inquirer';
@@ -553,7 +553,7 @@ ${ansis.blue(`\u2139 ${i18n.t("configuration:existingLanguageConfig") || "Existi
553
553
  return;
554
554
  }
555
555
  }
556
- const { selectAiOutputLanguage } = await import('./chunks/simple-config.mjs').then(function (n) { return n.aR; });
556
+ const { selectAiOutputLanguage } = await import('./chunks/simple-config.mjs').then(function (n) { return n.aS; });
557
557
  const aiOutputLang = await selectAiOutputLanguage();
558
558
  applyAiLanguageDirective(aiOutputLang);
559
559
  updateZcfConfig({ aiOutputLang });
@@ -586,7 +586,7 @@ async function changeScriptLanguageFeature(currentLang) {
586
586
  }
587
587
  async function configureCodexDefaultModelFeature() {
588
588
  ensureI18nInitialized();
589
- const { readCodexConfig } = await import('./chunks/simple-config.mjs').then(function (n) { return n.aS; });
589
+ const { readCodexConfig } = await import('./chunks/simple-config.mjs').then(function (n) { return n.aT; });
590
590
  const existingConfig = readCodexConfig();
591
591
  const currentModel = existingConfig?.model;
592
592
  if (currentModel) {
@@ -691,7 +691,7 @@ ${ansis.blue(`\u2139 ${i18n.t("configuration:existingLanguageConfig") || "Existi
691
691
  return;
692
692
  }
693
693
  }
694
- const { selectAiOutputLanguage } = await import('./chunks/simple-config.mjs').then(function (n) { return n.aR; });
694
+ const { selectAiOutputLanguage } = await import('./chunks/simple-config.mjs').then(function (n) { return n.aS; });
695
695
  const aiOutputLang = await selectAiOutputLanguage();
696
696
  await updateCodexLanguageDirective(aiOutputLang);
697
697
  updateZcfConfig({ aiOutputLang });
@@ -699,14 +699,14 @@ ${ansis.blue(`\u2139 ${i18n.t("configuration:existingLanguageConfig") || "Existi
699
699
  } else if (option === "systemPrompt") {
700
700
  const zcfConfig = readZcfConfig();
701
701
  const currentLang = zcfConfig?.aiOutputLang || "English";
702
- const { runCodexSystemPromptSelection } = await import('./chunks/simple-config.mjs').then(function (n) { return n.aS; });
702
+ const { runCodexSystemPromptSelection } = await import('./chunks/simple-config.mjs').then(function (n) { return n.aT; });
703
703
  await runCodexSystemPromptSelection();
704
704
  await ensureLanguageDirectiveInAgents(currentLang);
705
705
  console.log(ansis.green(`\u2714 ${i18n.t("configuration:systemPromptConfigured")}`));
706
706
  }
707
707
  }
708
708
  async function updateCodexModelProvider(modelProvider) {
709
- const { readCodexConfig, writeCodexConfig, backupCodexConfig, getBackupMessage } = await import('./chunks/simple-config.mjs').then(function (n) { return n.aS; });
709
+ const { readCodexConfig, writeCodexConfig, backupCodexConfig, getBackupMessage } = await import('./chunks/simple-config.mjs').then(function (n) { return n.aT; });
710
710
  const backupPath = backupCodexConfig();
711
711
  if (backupPath) {
712
712
  console.log(ansis.gray(getBackupMessage(backupPath)));
@@ -727,7 +727,7 @@ async function updateCodexModelProvider(modelProvider) {
727
727
  writeCodexConfig(updatedConfig);
728
728
  }
729
729
  async function ensureLanguageDirectiveInAgents(aiOutputLang) {
730
- const { readFile, writeFile, exists } = await import('./chunks/simple-config.mjs').then(function (n) { return n.aQ; });
730
+ const { readFile, writeFile, exists } = await import('./chunks/simple-config.mjs').then(function (n) { return n.aR; });
731
731
  const { homedir } = await import('node:os');
732
732
  const { join } = await import('pathe');
733
733
  const CODEX_AGENTS_FILE = join(homedir(), ".codex", "AGENTS.md");
@@ -745,7 +745,7 @@ async function ensureLanguageDirectiveInAgents(aiOutputLang) {
745
745
  const langLabel = languageLabels[aiOutputLang] || aiOutputLang;
746
746
  const hasLanguageDirective = /\*\*Most Important:\s*Always respond in [^*]+\*\*/i.test(content);
747
747
  if (!hasLanguageDirective) {
748
- const { backupCodexAgents, getBackupMessage } = await import('./chunks/simple-config.mjs').then(function (n) { return n.aS; });
748
+ const { backupCodexAgents, getBackupMessage } = await import('./chunks/simple-config.mjs').then(function (n) { return n.aT; });
749
749
  const backupPath = backupCodexAgents();
750
750
  if (backupPath) {
751
751
  console.log(ansis.gray(getBackupMessage(backupPath)));
@@ -762,8 +762,8 @@ async function ensureLanguageDirectiveInAgents(aiOutputLang) {
762
762
  }
763
763
  }
764
764
  async function updateCodexLanguageDirective(aiOutputLang) {
765
- const { readFile, writeFile, exists } = await import('./chunks/simple-config.mjs').then(function (n) { return n.aQ; });
766
- const { backupCodexAgents, getBackupMessage } = await import('./chunks/simple-config.mjs').then(function (n) { return n.aS; });
765
+ const { readFile, writeFile, exists } = await import('./chunks/simple-config.mjs').then(function (n) { return n.aR; });
766
+ const { backupCodexAgents, getBackupMessage } = await import('./chunks/simple-config.mjs').then(function (n) { return n.aT; });
767
767
  const { homedir } = await import('node:os');
768
768
  const { join } = await import('pathe');
769
769
  const CODEX_AGENTS_FILE = join(homedir(), ".codex", "AGENTS.md");
@@ -1042,10 +1042,55 @@ async function runCometixMenuFeature() {
1042
1042
  await showCometixMenu();
1043
1043
  }
1044
1044
 
1045
+ class ToolUpdateScheduler {
1046
+ /**
1047
+ * Update tools based on code type
1048
+ * @param codeType - The code tool type to update
1049
+ * @param skipPrompt - Whether to skip interactive prompts
1050
+ */
1051
+ async updateByCodeType(codeType, skipPrompt = false) {
1052
+ await ensureI18nInitialized();
1053
+ switch (codeType) {
1054
+ case "claude-code":
1055
+ await this.updateClaudeCodeTools(skipPrompt);
1056
+ break;
1057
+ case "codex":
1058
+ await this.updateCodexTools(skipPrompt);
1059
+ break;
1060
+ default:
1061
+ throw new Error(`Unsupported code type: ${codeType}`);
1062
+ }
1063
+ }
1064
+ /**
1065
+ * Update Claude Code related tools
1066
+ * @param skipPrompt - Whether to skip interactive prompts
1067
+ */
1068
+ async updateClaudeCodeTools(skipPrompt) {
1069
+ await checkAndUpdateTools(skipPrompt);
1070
+ }
1071
+ /**
1072
+ * Update Codex tools
1073
+ * @param skipPrompt - Whether to skip interactive prompts
1074
+ */
1075
+ async updateCodexTools(skipPrompt) {
1076
+ await runCodexUpdate(false, skipPrompt);
1077
+ }
1078
+ }
1079
+
1045
1080
  async function checkUpdates(options = {}) {
1046
1081
  try {
1047
1082
  const skipPrompt = options.skipPrompt || false;
1048
- await checkAndUpdateTools(skipPrompt);
1083
+ let codeType;
1084
+ try {
1085
+ codeType = await resolveCodeType(options.codeType);
1086
+ } catch (err) {
1087
+ const errorMessage = err instanceof Error ? err.message : String(err);
1088
+ console.error(ansis.red(`${errorMessage}
1089
+ Defaulting to "claude-code".`));
1090
+ codeType = "claude-code";
1091
+ }
1092
+ const scheduler = new ToolUpdateScheduler();
1093
+ await scheduler.updateByCodeType(codeType, skipPrompt);
1049
1094
  } catch (error) {
1050
1095
  const errorMessage = error instanceof Error ? error.message : String(error);
1051
1096
  console.error(ansis.red(`${i18n.t("updater:errorCheckingUpdates")} ${errorMessage}`));
@@ -1824,13 +1869,15 @@ async function update(options = {}) {
1824
1869
  }
1825
1870
  return;
1826
1871
  }
1827
- const { resolveTemplateLanguage } = await import('./chunks/simple-config.mjs').then(function (n) { return n.aR; });
1872
+ const { resolveTemplateLanguage } = await import('./chunks/simple-config.mjs').then(function (n) { return n.aS; });
1828
1873
  const configLang = await resolveTemplateLanguage(
1829
1874
  options.configLang,
1830
1875
  // Command line option
1831
- zcfConfig
1876
+ zcfConfig,
1877
+ options.skipPrompt
1878
+ // Non-interactive mode flag
1832
1879
  );
1833
- const aiOutputLang = await resolveAiOutputLanguage(i18n.language, options.aiOutputLang, zcfConfig);
1880
+ const aiOutputLang = await resolveAiOutputLanguage(i18n.language, options.aiOutputLang, zcfConfig, options.skipPrompt);
1834
1881
  console.log(ansis.cyan(`
1835
1882
  ${i18n.t("configuration:updatingPrompts")}
1836
1883
  `));
@@ -2356,7 +2403,7 @@ function customizeHelp(sections) {
2356
2403
  ` ${ansis.green("--workflows, -w")} <list> ${i18n.t("cli:help.optionDescriptions.workflows")} (${i18n.t("cli:help.defaults.prefix")} all workflows)`,
2357
2404
  ` ${ansis.green("--output-styles, -o")} <styles> ${i18n.t("cli:help.optionDescriptions.outputStyles")} (${i18n.t("cli:help.defaults.prefix")} all custom styles)`,
2358
2405
  ` ${ansis.green("--default-output-style, -d")} <style> ${i18n.t("cli:help.optionDescriptions.defaultOutputStyle")} (${i18n.t("cli:help.defaults.prefix")} engineer-professional)`,
2359
- ` ${ansis.green("--code-type, -T")} <type> ${i18n.t("cli:help.optionDescriptions.codeToolType")} (claude-code, codex)`,
2406
+ ` ${ansis.green("--code-type, -T")} <type> ${i18n.t("cli:help.optionDescriptions.codeToolType")} (claude-code, codex, cc=claude-code, cx=codex)`,
2360
2407
  ` ${ansis.green("--install-cometix-line, -x")} <value> ${i18n.t("cli:help.optionDescriptions.installStatuslineTool")} (${i18n.t("cli:help.defaults.prefix")} true)`
2361
2408
  ].join("\n")
2362
2409
  });
@@ -2387,6 +2434,14 @@ function customizeHelp(sections) {
2387
2434
  ` ${ansis.cyan("npx zcf check-updates")} ${ansis.gray(`# ${i18n.t("cli:help.defaults.updateTools")}`)}`,
2388
2435
  ` ${ansis.cyan("npx zcf check")}`,
2389
2436
  "",
2437
+ ansis.gray(` # ${i18n.t("cli:help.exampleDescriptions.checkClaudeCode")}`),
2438
+ ` ${ansis.cyan("npx zcf check --code-type claude-code")}`,
2439
+ ` ${ansis.cyan("npx zcf check -T cc")}`,
2440
+ "",
2441
+ ansis.gray(` # ${i18n.t("cli:help.exampleDescriptions.checkCodex")}`),
2442
+ ` ${ansis.cyan("npx zcf check --code-type codex")}`,
2443
+ ` ${ansis.cyan("npx zcf check -T cx")}`,
2444
+ "",
2390
2445
  ansis.gray(` # ${i18n.t("cli:help.exampleDescriptions.nonInteractiveModeCicd")}`),
2391
2446
  ` ${ansis.cyan('npx zcf i --skip-prompt --api-type api_key --api-key "sk-ant-..."')}`,
2392
2447
  ` ${ansis.cyan('npx zcf i --skip-prompt --all-lang zh-CN --api-type api_key --api-key "key"')}`,
@@ -2403,10 +2458,10 @@ async function setupCommands(cli) {
2403
2458
  await initI18n(defaultLang);
2404
2459
  } catch {
2405
2460
  }
2406
- cli.command("", "Show interactive menu (default)").option("--lang, -l <lang>", "ZCF display language (zh-CN, en)").option("--all-lang, -g <lang>", "Set all language parameters to this value").option("--config-lang, -c <lang>", "Configuration language (zh-CN, en)").option("--force, -f", "Force overwrite existing configuration").option("--code-type, -T <codeType>", "Select code tool type (claude-code, codex)").action(await withLanguageResolution(async () => {
2461
+ cli.command("", "Show interactive menu (default)").option("--lang, -l <lang>", "ZCF display language (zh-CN, en)").option("--all-lang, -g <lang>", "Set all language parameters to this value").option("--config-lang, -c <lang>", "Configuration language (zh-CN, en)").option("--force, -f", "Force overwrite existing configuration").option("--code-type, -T <codeType>", "Select code tool type (claude-code, codex, cc, cx)").action(await withLanguageResolution(async () => {
2407
2462
  await showMainMenu();
2408
2463
  }));
2409
- cli.command("init", "Initialize Claude Code configuration").alias("i").option("--lang, -l <lang>", "ZCF display language (zh-CN, en)").option("--config-lang, -c <lang>", "Configuration language (zh-CN, en)").option("--ai-output-lang, -a <lang>", "AI output language").option("--force, -f", "Force overwrite existing configuration").option("--skip-prompt, -s", "Skip all interactive prompts (non-interactive mode)").option("--config-action, -r <action>", `Config handling (new/backup/merge/docs-only/skip), ${i18n.t("cli:help.defaults.prefix")} backup`).option("--api-type, -t <type>", "API type (auth_token/api_key/ccr_proxy/skip)").option("--api-key, -k <key>", "API key (used for both API key and auth token types)").option("--api-url, -u <url>", "Custom API URL").option("--mcp-services, -m <services>", `Comma-separated MCP services to install (context7,mcp-deepwiki,Playwright,exa), "skip" to skip all, "all" for all non-key services, ${i18n.t("cli:help.defaults.prefix")} all`).option("--workflows, -w <workflows>", `Comma-separated workflows to install (sixStepsWorkflow,featPlanUx,gitWorkflow,bmadWorkflow), "skip" to skip all, "all" for all workflows, ${i18n.t("cli:help.defaults.prefix")} all`).option("--output-styles, -o <styles>", `Comma-separated output styles (engineer-professional,nekomata-engineer,laowang-engineer,default,explanatory,learning), "skip" to skip all, "all" for all custom styles, ${i18n.t("cli:help.defaults.prefix")} all`).option("--default-output-style, -d <style>", `Default output style, ${i18n.t("cli:help.defaults.prefix")} engineer-professional`).option("--all-lang, -g <lang>", "Set all language parameters to this value").option("--code-type, -T <codeType>", "Select code tool type (claude-code, codex)").option("--install-cometix-line, -x <value>", `Install CCometixLine statusline tool (true/false), ${i18n.t("cli:help.defaults.prefix")} true`).action(await withLanguageResolution(async (options) => {
2464
+ cli.command("init", "Initialize Claude Code configuration").alias("i").option("--lang, -l <lang>", "ZCF display language (zh-CN, en)").option("--config-lang, -c <lang>", "Configuration language (zh-CN, en)").option("--ai-output-lang, -a <lang>", "AI output language").option("--force, -f", "Force overwrite existing configuration").option("--skip-prompt, -s", "Skip all interactive prompts (non-interactive mode)").option("--config-action, -r <action>", `Config handling (new/backup/merge/docs-only/skip), ${i18n.t("cli:help.defaults.prefix")} backup`).option("--api-type, -t <type>", "API type (auth_token/api_key/ccr_proxy/skip)").option("--api-key, -k <key>", "API key (used for both API key and auth token types)").option("--api-url, -u <url>", "Custom API URL").option("--mcp-services, -m <services>", `Comma-separated MCP services to install (context7,mcp-deepwiki,Playwright,exa), "skip" to skip all, "all" for all non-key services, ${i18n.t("cli:help.defaults.prefix")} all`).option("--workflows, -w <workflows>", `Comma-separated workflows to install (sixStepsWorkflow,featPlanUx,gitWorkflow,bmadWorkflow), "skip" to skip all, "all" for all workflows, ${i18n.t("cli:help.defaults.prefix")} all`).option("--output-styles, -o <styles>", `Comma-separated output styles (engineer-professional,nekomata-engineer,laowang-engineer,default,explanatory,learning), "skip" to skip all, "all" for all custom styles, ${i18n.t("cli:help.defaults.prefix")} all`).option("--default-output-style, -d <style>", `Default output style, ${i18n.t("cli:help.defaults.prefix")} engineer-professional`).option("--all-lang, -g <lang>", "Set all language parameters to this value").option("--code-type, -T <codeType>", "Select code tool type (claude-code, codex, cc, cx)").option("--install-cometix-line, -x <value>", `Install CCometixLine statusline tool (true/false), ${i18n.t("cli:help.defaults.prefix")} true`).action(await withLanguageResolution(async (options) => {
2410
2465
  await init(options);
2411
2466
  }));
2412
2467
  cli.command("update", "Update Claude Code prompts only").alias("u").option("--lang, -l <lang>", "ZCF display language (zh-CN, en)").option("--all-lang, -g <lang>", "Set all language parameters to this value").option("--config-lang, -c <lang>", "Configuration language (zh-CN, en)").action(await withLanguageResolution(async (options) => {
@@ -2427,8 +2482,8 @@ async function setupCommands(cli) {
2427
2482
  cli.command("uninstall", "Remove ZCF configurations and tools").option("--lang, -l <lang>", "ZCF display language (zh-CN, en)").option("--all-lang, -g <lang>", "Set all language parameters to this value").option("--mode, -m <mode>", "Uninstall mode (complete/custom/interactive), default: interactive").option("--items, -i <items>", "Comma-separated items for custom uninstall mode").action(await withLanguageResolution(async (options) => {
2428
2483
  await uninstall(options);
2429
2484
  }));
2430
- cli.command("check-updates", "Check and update Claude Code and CCR to latest versions").alias("check").option("--lang, -l <lang>", "ZCF display language (zh-CN, en)").option("--all-lang, -g <lang>", "Set all language parameters to this value").action(await withLanguageResolution(async () => {
2431
- await checkUpdates();
2485
+ cli.command("check-updates", "Check and update Claude Code and CCR to latest versions").alias("check").option("--lang, -l <lang>", "ZCF display language (zh-CN, en)").option("--all-lang, -g <lang>", "Set all language parameters to this value").option("--code-type, -T <codeType>", "Select code tool type (claude-code, codex, cc, cx)").action(await withLanguageResolution(async (options) => {
2486
+ await checkUpdates(options);
2432
2487
  }));
2433
2488
  cli.help((sections) => customizeHelp(sections));
2434
2489
  cli.version(version);
@@ -39,6 +39,8 @@
39
39
  "help.exampleDescriptions.runClaudeCodeUsageAnalysis": "Run Claude Code usage analysis",
40
40
  "help.exampleDescriptions.uninstallConfigurations": "Uninstall configurations and tools",
41
41
  "help.exampleDescriptions.checkAndUpdateTools": "Check and update tools",
42
+ "help.exampleDescriptions.checkClaudeCode": "Check and update Claude Code tools",
43
+ "help.exampleDescriptions.checkCodex": "Check and update Codex tools",
42
44
  "help.exampleDescriptions.nonInteractiveModeCicd": "Non-interactive mode (CI/CD)",
43
45
  "banner.subtitle": "One-click configuration tool for Claude Code",
44
46
  "banner.updateSubtitle": "Update configuration for Claude Code",
@@ -17,6 +17,7 @@
17
17
  "invalidAuthTokenConfig": "Invalid ANTHROPIC_AUTH_TOKEN: expected string",
18
18
  "invalidPermissionsConfig": "Invalid permissions configuration: expected object",
19
19
  "invalidPermissionsAllow": "Invalid permissions.allow: expected array",
20
+ "invalidCodeType": "Invalid code type: \"{value}\". Valid options are: {validOptions}",
20
21
  "generalError": "Error",
21
22
  "stackTrace": "Stack"
22
23
  }
@@ -39,6 +39,8 @@
39
39
  "help.exampleDescriptions.runClaudeCodeUsageAnalysis": "运行 Claude Code 用量分析",
40
40
  "help.exampleDescriptions.uninstallConfigurations": "卸载配置和工具",
41
41
  "help.exampleDescriptions.checkAndUpdateTools": "检查并更新工具",
42
+ "help.exampleDescriptions.checkClaudeCode": "检查并更新Claude Code工具",
43
+ "help.exampleDescriptions.checkCodex": "检查并更新Codex工具",
42
44
  "help.exampleDescriptions.nonInteractiveModeCicd": "非交互模式(CI/CD)",
43
45
  "banner.subtitle": "Claude Code 一键配置工具",
44
46
  "banner.updateSubtitle": "更新 Claude Code 配置",
@@ -17,6 +17,7 @@
17
17
  "invalidAuthTokenConfig": "无效的 ANTHROPIC_AUTH_TOKEN:期望字符串类型",
18
18
  "invalidPermissionsConfig": "无效的权限配置:期望对象类型",
19
19
  "invalidPermissionsAllow": "无效的 permissions.allow:期望数组类型",
20
+ "invalidCodeType": "无效的代码类型:\"{value}\"。可用的类型:{validOptions}",
20
21
  "generalError": "错误",
21
22
  "stackTrace": "堆栈跟踪"
22
23
  }
package/dist/index.d.mts CHANGED
@@ -37,7 +37,7 @@ interface InitOptions {
37
37
  force?: boolean;
38
38
  skipBanner?: boolean;
39
39
  skipPrompt?: boolean;
40
- codeType?: CodeToolType;
40
+ codeType?: CodeToolType | string;
41
41
  configAction?: 'new' | 'backup' | 'merge' | 'docs-only' | 'skip';
42
42
  apiType?: 'auth_token' | 'api_key' | 'ccr_proxy' | 'skip';
43
43
  apiKey?: string;
package/dist/index.d.ts CHANGED
@@ -37,7 +37,7 @@ interface InitOptions {
37
37
  force?: boolean;
38
38
  skipBanner?: boolean;
39
39
  skipPrompt?: boolean;
40
- codeType?: CodeToolType;
40
+ codeType?: CodeToolType | string;
41
41
  configAction?: 'new' | 'backup' | 'merge' | 'docs-only' | 'skip';
42
42
  apiType?: 'auth_token' | 'api_key' | 'ccr_proxy' | 'skip';
43
43
  apiKey?: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "zcf",
3
3
  "type": "module",
4
- "version": "3.1.2",
4
+ "version": "3.1.4",
5
5
  "description": "Zero-Config Code Flow - One-click configuration tool for Claude Code",
6
6
  "author": {
7
7
  "name": "Miao Da",
@@ -10,17 +10,19 @@
10
10
  "permissions": {
11
11
  "allow": [
12
12
  "Bash",
13
- "Read",
14
- "Write",
13
+ "BashOutput",
15
14
  "Edit",
16
- "MultiEdit",
17
15
  "Glob",
18
16
  "Grep",
17
+ "KillShell",
18
+ "NotebookEdit",
19
+ "Read",
20
+ "SlashCommand",
21
+ "Task",
22
+ "TodoWrite",
19
23
  "WebFetch",
20
24
  "WebSearch",
21
- "TodoWrite",
22
- "NotebookRead",
23
- "NotebookEdit",
25
+ "Write",
24
26
  "mcp__ide",
25
27
  "mcp__exa",
26
28
  "mcp__context7",
@@ -0,0 +1,102 @@
1
+ ---
2
+ description: Safely find and clean up merged or stale Git branches with dry-run mode and custom base/protected branches support
3
+ allowed-tools: Read(**), Exec(git fetch, git config, git branch, git remote, git push, git for-each-ref, git log), Write()
4
+ argument-hint: [--base <branch>] [--stale <days>] [--remote] [--force] [--dry-run] [--yes]
5
+ # examples:
6
+ # - /git-cleanBranches --dry-run
7
+ # - /git-cleanBranches --base release/v2.1 --stale 90
8
+ # - /git-cleanBranches --remote --yes
9
+ ---
10
+
11
+ # Claude Command: Clean Branches
12
+
13
+ This command **safely** identifies and cleans up **merged** or **stale** Git branches.
14
+ Runs in **read-only preview (`--dry-run`)** mode by default, requiring explicit instructions to perform deletions.
15
+
16
+ ---
17
+
18
+ ## Usage
19
+
20
+ ```bash
21
+ # [Safest] Preview branches to be cleaned without executing any deletions
22
+ /git-cleanBranches --dry-run
23
+
24
+ # Clean local branches merged to main and inactive for over 90 days (requires individual confirmation)
25
+ /git-cleanBranches --stale 90
26
+
27
+ # Clean local and remote branches merged to release/v2.1 (auto-confirm)
28
+ /git-cleanBranches --base release/v2.1 --remote --yes
29
+
30
+ # [Dangerous] Force delete an unmerged local branch
31
+ /git-cleanBranches --force outdated-feature
32
+ ```
33
+
34
+ ### Options
35
+
36
+ - `--base <branch>`: Specify the base branch for cleanup (defaults to repository's `main`/`master`).
37
+ - `--stale <days>`: Clean branches with no commits for specified days (disabled by default).
38
+ - `--remote`: Also clean remote merged/stale branches.
39
+ - `--dry-run`: **Default behavior**. Only list branches to be deleted without executing any operations.
40
+ - `--yes`: Skip individual confirmations and delete all identified branches directly (suitable for CI/CD).
41
+ - `--force`: Use `-D` to force delete local branches (even if unmerged).
42
+
43
+ ---
44
+
45
+ ## What This Command Does
46
+
47
+ 1. **Configuration and Safety Checks**
48
+ - **Update Information**: Automatically executes `git fetch --all --prune` to ensure branch status is current.
49
+ - **Read Protected Branches**: Reads the list of branches that should not be cleaned from Git config (see "Configuration" below).
50
+ - **Determine Base**: Uses `--base` parameter or auto-detected `main`/`master` as comparison baseline.
51
+
52
+ 2. **Analysis and Identification (Find)**
53
+ - **Merged Branches**: Find local (and remote if `--remote` is added) branches fully merged to `--base`.
54
+ - **Stale Branches**: If `--stale <days>` is specified, find branches with last commit N days ago.
55
+ - **Exclude Protected Branches**: Remove all configured protected branches from cleanup list.
56
+
57
+ 3. **Report and Preview (Report)**
58
+ - Clearly list "merged branches to be deleted" and "stale branches to be deleted".
59
+ - Without `--yes` parameter, **command ends here**, waiting for user confirmation to re-execute (without `--dry-run`).
60
+
61
+ 4. **Execute Cleanup (Execute)**
62
+ - **Only executed without `--dry-run` and after user confirmation** (or with `--yes`).
63
+ - Delete identified branches one by one, unless user chooses to skip in interactive confirmation.
64
+ - Local: `git branch -d <branch>`; Remote: `git push origin --delete <branch>`.
65
+ - If `--force` is specified, local deletion uses `git branch -D <branch>`.
66
+
67
+ ---
68
+
69
+ ## Configuration (Configure Once, Use Forever)
70
+
71
+ To prevent accidental deletion of important branches (e.g., `develop`, `release/*`), add protection rules to the repository's Git config. The command reads them automatically.
72
+
73
+ ```bash
74
+ # Protect develop branch
75
+ git config --add branch.cleanup.protected develop
76
+
77
+ # Protect all branches starting with release/ (wildcard)
78
+ git config --add branch.cleanup.protected 'release/*'
79
+
80
+ # View all configured protected branches
81
+ git config --get-all branch.cleanup.protected
82
+ ```
83
+
84
+ ---
85
+
86
+ ## Best Practices for Embedded Devs
87
+
88
+ - **Prioritize `--dry-run`**: Develop the habit of previewing before executing.
89
+ - **Leverage `--base`**: When maintaining long-term `release` branches, use it to clean `feature` or `hotfix` branches merged to that release.
90
+ - **Careful with `--force`**: Don't force delete unless you're 100% certain an unmerged branch is useless.
91
+ - **Team Collaboration**: Notify the team channel before cleaning shared remote branches.
92
+ - **Regular Runs**: Run monthly or quarterly to keep the repository clean.
93
+
94
+ ---
95
+
96
+ ## Why This Version Is Better
97
+
98
+ - ✅ **Safer**: Default read-only preview with configurable protected branch list.
99
+ - ✅ **More Flexible**: Supports custom base branches, perfectly fits `release` / `develop` workflows.
100
+ - ✅ **More Compatible**: Avoids commands with inconsistent behavior across systems like `date -d`.
101
+ - ✅ **More Intuitive**: Condenses complex 16-step checklist into a single command with safety options.
102
+ - ✅ **Consistent Style**: Shares similar parameter design and documentation structure with `/commit` command.
@@ -0,0 +1,157 @@
1
+ ---
2
+ description: Analyze changes with Git only and auto-generate conventional commit messages with optional emoji; suggests splitting commits when needed, runs local Git hooks by default (use --no-verify to skip)
3
+ allowed-tools: Read(**), Exec(git status, git diff, git add, git restore --staged, git commit, git rev-parse, git config), Write(.git/COMMIT_EDITMSG)
4
+ argument-hint: [--no-verify] [--all] [--amend] [--signoff] [--emoji] [--scope <scope>] [--type <type>]
5
+ # examples:
6
+ # - /git-commit # Analyze current changes, generate commit message
7
+ # - /git-commit --all # Stage all changes and commit
8
+ # - /git-commit --no-verify # Skip Git hooks
9
+ # - /git-commit --emoji # Include emoji in commit message
10
+ # - /git-commit --scope ui --type feat # Specify scope and type
11
+ # - /git-commit --amend --signoff # Amend last commit with signature
12
+ ---
13
+
14
+ # Claude Command: Commit (Git-only)
15
+
16
+ This command works **without any package manager/build tools**, using only **Git** to:
17
+
18
+ - Read changes (staged/unstaged)
19
+ - Determine if changes should be **split into multiple commits**
20
+ - Generate **Conventional Commits** style messages with optional emoji for each commit
21
+ - Execute `git add` and `git commit` as needed (runs local Git hooks by default; use `--no-verify` to skip)
22
+
23
+ ---
24
+
25
+ ## Usage
26
+
27
+ ```bash
28
+ /git-commit
29
+ /git-commit --no-verify
30
+ /git-commit --emoji
31
+ /git-commit --all --signoff
32
+ /git-commit --amend
33
+ /git-commit --scope ui --type feat --emoji
34
+ ```
35
+
36
+ ### Options
37
+
38
+ - `--no-verify`: Skip local Git hooks (`pre-commit`/`commit-msg` etc.).
39
+ - `--all`: When staging area is empty, automatically `git add -A` to include all changes in the commit.
40
+ - `--amend`: **Amend** the last commit without creating a new one (preserves author and timestamp unless local Git config specifies otherwise).
41
+ - `--signoff`: Add `Signed-off-by` line (use when following DCO process).
42
+ - `--emoji`: Include emoji prefix in commit message (omit for plain text).
43
+ - `--scope <scope>`: Specify commit scope (e.g., `ui`, `docs`, `api`), written to message header.
44
+ - `--type <type>`: Force commit type (e.g., `feat`, `fix`, `docs`), overrides automatic detection.
45
+
46
+ > Note: If the framework doesn't support interactive confirmation, enable `confirm: true` in front-matter to avoid mistakes.
47
+
48
+ ---
49
+
50
+ ## What This Command Does
51
+
52
+ 1. **Repository/Branch Validation**
53
+ - Check if in a Git repository using `git rev-parse --is-inside-work-tree`.
54
+ - Read current branch/HEAD status; if in rebase/merge conflict state, prompt to resolve conflicts first.
55
+
56
+ 2. **Change Detection**
57
+ - Get staged and unstaged changes using `git status --porcelain` and `git diff`.
58
+ - If staged files = 0:
59
+ - If `--all` is passed → Execute `git add -A`.
60
+ - Otherwise prompt choice: continue analyzing unstaged changes for **suggestions**, or cancel to manually group staging.
61
+
62
+ 3. **Split Suggestions (Split Heuristics)**
63
+ - Cluster by **concerns**, **file modes**, **change types** (e.g., source code vs docs/tests; different directories/packages; additions vs deletions).
64
+ - If **multiple independent changesets** or large diff detected (e.g., > 300 lines / across multiple top-level directories), suggest splitting commits with pathspecs for each group (for subsequent `git add <paths>`).
65
+
66
+ 4. **Commit Message Generation (Conventional with Optional Emoji)**
67
+ - Auto-infer `type` (`feat`/`fix`/`docs`/`refactor`/`test`/`chore`/`perf`/`style`/`ci`/`revert`...) and optional `scope`.
68
+ - Generate message header: `[<emoji>] <type>(<scope>)?: <subject>` (first line ≤ 72 chars, imperative mood, emoji included only with `--emoji` flag).
69
+ - Generate message body: bullet points (motivation, implementation details, impact scope, BREAKING CHANGE if any).
70
+ - Write draft to `.git/COMMIT_EDITMSG` for use with `git commit`.
71
+
72
+ 5. **Execute Commit**
73
+ - Single commit scenario: `git commit [-S] [--no-verify] [-s] -F .git/COMMIT_EDITMSG`
74
+ - Multiple commit scenario (if split accepted): Provide clear instructions for `git add <paths> && git commit ...` per group; execute sequentially if allowed.
75
+
76
+ 6. **Safe Rollback**
77
+ - If mistakenly staged, use `git restore --staged <paths>` to unstage (command provides instructions, doesn't modify file contents).
78
+
79
+ ---
80
+
81
+ ## Best Practices for Commits
82
+
83
+ - **Atomic commits**: One commit does one thing, easier to trace and review.
84
+ - **Group before committing**: Split by directory/module/feature.
85
+ - **Clear subject**: First line ≤ 72 chars, imperative mood (e.g., "add... / fix...").
86
+ - **Body with context**: Explain motivation, solution, impact scope, risks, and next steps.
87
+ - **Follow Conventional Commits**: `<type>(<scope>): <subject>`.
88
+
89
+ ---
90
+
91
+ ## Type to Emoji Mapping (When --emoji is Used)
92
+
93
+ - ✨ `feat`: New feature
94
+ - 🐛 `fix`: Bug fix (includes 🔥 remove code/files, 🚑️ hotfix, 👽️ adapt to external API changes, 🔒️ security fix, 🚨 fix warnings, 💚 fix CI)
95
+ - 📝 `docs`: Documentation and comments
96
+ - 🎨 `style`: Code style/formatting (no semantic changes)
97
+ - ♻️ `refactor`: Refactoring (no new features, no bug fixes)
98
+ - ⚡️ `perf`: Performance improvements
99
+ - ✅ `test`: Add/fix tests, snapshots
100
+ - 🔧 `chore`: Build/tools/misc tasks (merge branches, update configs, release tags, pin dependencies, .gitignore, etc.)
101
+ - 👷 `ci`: CI/CD configuration and scripts
102
+ - ⏪️ `revert`: Revert commits
103
+ - 💥 `feat`: Breaking changes (explained in `BREAKING CHANGE:` section)
104
+
105
+ > If `--type`/`--scope` is passed, it will **override** auto-detection.
106
+ > Emoji is only included when `--emoji` flag is specified.
107
+
108
+ ---
109
+
110
+ ## Guidelines for Splitting Commits
111
+
112
+ 1. **Different concerns**: Unrelated feature/module changes should be split.
113
+ 2. **Different types**: Don't mix `feat`, `fix`, `refactor` in the same commit.
114
+ 3. **File modes**: Source code vs docs/tests/configs should be grouped separately.
115
+ 4. **Size threshold**: Large diffs (e.g., >300 lines or across multiple top-level directories) should be split.
116
+ 5. **Revertability**: Ensure each commit can be independently reverted.
117
+
118
+ ---
119
+
120
+ ## Examples
121
+
122
+ **Good (with --emoji)**
123
+
124
+ - ✨ feat(ui): add user authentication flow
125
+ - 🐛 fix(api): handle token refresh race condition
126
+ - 📝 docs: update API usage examples
127
+ - ♻️ refactor(core): extract retry logic into helper
128
+ - ✅ test: add unit tests for rate limiter
129
+ - 🔧 chore: update git hooks and repository settings
130
+ - ⏪️ revert: revert "feat(core): introduce streaming API"
131
+
132
+ **Good (without --emoji)**
133
+
134
+ - feat(ui): add user authentication flow
135
+ - fix(api): handle token refresh race condition
136
+ - docs: update API usage examples
137
+ - refactor(core): extract retry logic into helper
138
+ - test: add unit tests for rate limiter
139
+ - chore: update git hooks and repository settings
140
+ - revert: revert "feat(core): introduce streaming API"
141
+
142
+ **Split Example**
143
+
144
+ - `feat(types): add new type defs for payment method`
145
+ - `docs: update API docs for new types`
146
+ - `test: add unit tests for payment types`
147
+ - `fix: address linter warnings in new files` ← (if your repo has hook errors)
148
+
149
+ ---
150
+
151
+ ## Important Notes
152
+
153
+ - **Git only**: No package manager/build commands (`pnpm`/`npm`/`yarn` etc.).
154
+ - **Respects hooks**: Executes local Git hooks by default; use `--no-verify` to skip.
155
+ - **No source code changes**: Command only reads/writes `.git/COMMIT_EDITMSG` and staging area; doesn't directly edit working directory files.
156
+ - **Safety prompts**: In rebase/merge conflicts, detached HEAD states, prompts to handle/confirm before continuing.
157
+ - **Auditable and controllable**: If `confirm: true` is enabled, each actual `git add`/`git commit` step requires confirmation.