ccjk 16.0.6 → 16.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/README.md +72 -316
  2. package/dist/chunks/claude-code-config-manager.mjs +28 -7
  3. package/dist/chunks/claude-code-incremental-manager.mjs +2 -2
  4. package/dist/chunks/codex-config-switch.mjs +3 -3
  5. package/dist/chunks/codex-presets.mjs +98 -0
  6. package/dist/chunks/codex-provider-manager.mjs +4 -4
  7. package/dist/chunks/codex-runtime.mjs +246 -0
  8. package/dist/chunks/codex-uninstaller.mjs +2 -2
  9. package/dist/chunks/commands.mjs +1 -1
  10. package/dist/chunks/features.mjs +35 -15
  11. package/dist/chunks/simple-config.mjs +659 -148
  12. package/dist/cli.mjs +1700 -908
  13. package/dist/i18n/locales/en/clean.json +24 -0
  14. package/dist/i18n/locales/en/codex.json +24 -1
  15. package/dist/i18n/locales/en/configuration.json +27 -12
  16. package/dist/i18n/locales/en/hub.json +30 -0
  17. package/dist/i18n/locales/en/menu.json +32 -8
  18. package/dist/i18n/locales/en/workflow.json +13 -1
  19. package/dist/i18n/locales/zh-CN/clean.json +24 -0
  20. package/dist/i18n/locales/zh-CN/codex.json +24 -1
  21. package/dist/i18n/locales/zh-CN/configuration.json +27 -12
  22. package/dist/i18n/locales/zh-CN/hub.json +30 -0
  23. package/dist/i18n/locales/zh-CN/menu.json +32 -8
  24. package/dist/i18n/locales/zh-CN/workflow.json +13 -1
  25. package/dist/index.d.mts +3 -1
  26. package/dist/index.d.ts +3 -1
  27. package/dist/index.mjs +1 -1
  28. package/dist/shared/{ccjk.BSLlI-JL.mjs → ccjk.TC1_-qhV.mjs} +1 -1
  29. package/package.json +1 -1
  30. package/templates/common/output-styles/en/agents-md-baseline.md +28 -0
  31. package/templates/common/output-styles/en/plan-first.md +30 -0
  32. package/templates/common/output-styles/en/surgical-diff.md +27 -0
  33. package/templates/common/output-styles/en/verify-and-ship.md +31 -0
  34. package/templates/common/output-styles/zh-CN/agents-md-baseline.md +28 -0
  35. package/templates/common/output-styles/zh-CN/plan-first.md +30 -0
  36. package/templates/common/output-styles/zh-CN/surgical-diff.md +27 -0
  37. package/templates/common/output-styles/zh-CN/verify-and-ship.md +31 -0
  38. package/templates/common/workflow/bmad/en/bmad-init.md +275 -0
  39. package/templates/common/workflow/bmad/zh-CN/bmad-init.md +275 -0
  40. package/templates/common/workflow/codeReview/en/code-review.md +34 -0
  41. package/templates/common/workflow/codeReview/zh-CN/code-review.md +34 -0
  42. package/templates/common/workflow/continuousDelivery/en/continuous-delivery.md +628 -0
  43. package/templates/common/workflow/continuousDelivery/zh-CN/continuous-delivery.md +628 -0
  44. package/templates/common/workflow/essential/en/agents/ccjk-config-agent.md +187 -0
  45. package/templates/common/workflow/essential/en/agents/ccjk-mcp-agent.md +191 -0
  46. package/templates/common/workflow/essential/en/agents/ccjk-skill-agent.md +249 -0
  47. package/templates/common/workflow/essential/en/agents/ccjk-workflow-agent.md +277 -0
  48. package/templates/common/workflow/essential/en/agents/get-current-datetime.md +29 -0
  49. package/templates/common/workflow/essential/en/agents/init-architect.md +115 -0
  50. package/templates/common/workflow/essential/en/agents/planner.md +116 -0
  51. package/templates/common/workflow/essential/en/agents/teamagent.md +102 -0
  52. package/templates/common/workflow/essential/en/agents/ui-ux-designer.md +91 -0
  53. package/templates/common/workflow/essential/en/feat.md +92 -0
  54. package/templates/common/workflow/essential/en/init-project.md +53 -0
  55. package/templates/common/workflow/essential/zh-CN/agents/get-current-datetime.md +29 -0
  56. package/templates/common/workflow/essential/zh-CN/agents/init-architect.md +115 -0
  57. package/templates/common/workflow/essential/zh-CN/agents/planner.md +116 -0
  58. package/templates/common/workflow/essential/zh-CN/agents/teamagent.md +102 -0
  59. package/templates/common/workflow/essential/zh-CN/agents/ui-ux-designer.md +91 -0
  60. package/templates/common/workflow/essential/zh-CN/feat.md +315 -0
  61. package/templates/common/workflow/essential/zh-CN/init-project.md +53 -0
  62. package/templates/common/workflow/interview/en/interview.md +67 -0
  63. package/templates/common/workflow/interview/zh-CN/interview.md +67 -0
  64. package/templates/common/workflow/linearMethod/en/linear-method.md +651 -0
  65. package/templates/common/workflow/linearMethod/zh-CN/linear-method.md +750 -0
  66. package/templates/common/workflow/refactoringMaster/en/refactoring-master.md +516 -0
  67. package/templates/common/workflow/refactoringMaster/zh-CN/refactoring-master.md +810 -0
  68. package/templates/common/workflow/specFirstTDD/en/spec-first-tdd.md +364 -0
  69. package/templates/common/workflow/specFirstTDD/zh-CN/spec-first-tdd.md +364 -0
@@ -18,7 +18,7 @@ import i18next from 'i18next';
18
18
  import Backend from 'i18next-fs-backend';
19
19
  import { edit, stringify, parse, initSync } from '@rainbowatcher/toml-edit-js';
20
20
 
21
- const version = "16.0.6";
21
+ const version = "16.3.0";
22
22
  const homepage = "https://github.com/miounet11/ccjk#readme";
23
23
 
24
24
  const i18n = i18next.createInstance();
@@ -39,7 +39,9 @@ const NAMESPACES = [
39
39
  "uninstall",
40
40
  "updater",
41
41
  "workflow",
42
- "codex"
42
+ "codex",
43
+ "clean",
44
+ "hub"
43
45
  ];
44
46
  function ensureI18nInitialized() {
45
47
  if (!i18n.isInitialized) {
@@ -382,14 +384,21 @@ function getOrderedWorkflows() {
382
384
 
383
385
  const CLAUDE_DIR = join(homedir(), ".claude");
384
386
  const SETTINGS_FILE = join(CLAUDE_DIR, "settings.json");
385
- const CLAVUE_DIR = join(homedir(), ".clavue");
386
- const CLAVUE_SETTINGS_FILE = join(CLAVUE_DIR, "settings.json");
387
- const CLAVUE_CONFIG_FILE = join(CLAVUE_DIR, ".clavue.json");
388
- const CLAVUE_MD_FILE = join(CLAVUE_DIR, "clavue.md");
387
+ const CLAVUE_DIR$1 = join(homedir(), ".clavue");
388
+ const CLAVUE_SETTINGS_FILE = join(CLAVUE_DIR$1, "settings.json");
389
+ const CLAVUE_CONFIG_FILE = join(CLAVUE_DIR$1, ".clavue.json");
390
+ const CLAVUE_CREDENTIALS_FILE = join(CLAVUE_DIR$1, ".credentials.json");
391
+ const CLAVUE_MD_FILE = join(CLAVUE_DIR$1, "clavue.md");
389
392
  const CLAUDE_MD_FILE = join(CLAUDE_DIR, "CLAUDE.md");
390
393
  const ClAUDE_CONFIG_FILE = join(homedir(), ".claude.json");
391
394
  const CLAUDE_VSC_CONFIG_FILE = join(CLAUDE_DIR, "config.json");
392
- const CODEX_DIR = join(homedir(), ".codex");
395
+ function resolveCodexHome() {
396
+ const fromEnv = process.env?.CODEX_HOME?.trim();
397
+ if (fromEnv)
398
+ return fromEnv;
399
+ return join(homedir(), ".codex");
400
+ }
401
+ const CODEX_DIR = resolveCodexHome();
393
402
  const CODEX_CONFIG_FILE = join(CODEX_DIR, "config.toml");
394
403
  const CODEX_AUTH_FILE = join(CODEX_DIR, "auth.json");
395
404
  const CODEX_AGENTS_FILE = join(CODEX_DIR, "AGENTS.md");
@@ -406,7 +415,7 @@ const DEFAULT_CODE_TOOL_TYPE = "clavue";
406
415
  const CODE_TOOL_BANNERS = {
407
416
  "clavue": "for Clavue",
408
417
  "claude-code": "for Claude Code",
409
- "codex": "for Codex",
418
+ "codex": "for Codex (CLI / App / IDE)",
410
419
  "grok": "for Grok CLI"
411
420
  };
412
421
  function settingsFileForTool(tool) {
@@ -468,7 +477,8 @@ const constants = {
468
477
  CLAUDE_MD_FILE: CLAUDE_MD_FILE,
469
478
  CLAUDE_VSC_CONFIG_FILE: CLAUDE_VSC_CONFIG_FILE,
470
479
  CLAVUE_CONFIG_FILE: CLAVUE_CONFIG_FILE,
471
- CLAVUE_DIR: CLAVUE_DIR,
480
+ CLAVUE_CREDENTIALS_FILE: CLAVUE_CREDENTIALS_FILE,
481
+ CLAVUE_DIR: CLAVUE_DIR$1,
472
482
  CLAVUE_MD_FILE: CLAVUE_MD_FILE,
473
483
  CLAVUE_SETTINGS_FILE: CLAVUE_SETTINGS_FILE,
474
484
  CODEX_AGENTS_FILE: CODEX_AGENTS_FILE,
@@ -488,6 +498,7 @@ const constants = {
488
498
  getAiOutputLanguageLabel: getAiOutputLanguageLabel,
489
499
  isCodeToolType: isCodeToolType,
490
500
  resolveCodeToolType: resolveCodeToolType,
501
+ resolveCodexHome: resolveCodexHome,
491
502
  settingsFileForTool: settingsFileForTool
492
503
  };
493
504
 
@@ -1599,9 +1610,9 @@ function resolveClaudeFamilySettingsTarget(codeTool) {
1599
1610
  if (resolvedTool === "clavue") {
1600
1611
  return {
1601
1612
  codeTool: "clavue",
1602
- configDir: CLAVUE_DIR,
1613
+ configDir: CLAVUE_DIR$1,
1603
1614
  settingsFile: CLAVUE_SETTINGS_FILE,
1604
- instructionsFile: join(CLAVUE_DIR, "clavue.md"),
1615
+ instructionsFile: join(CLAVUE_DIR$1, "clavue.md"),
1605
1616
  runtimeConfigFile: CLAVUE_CONFIG_FILE,
1606
1617
  runtimeBackupDirName: "backups",
1607
1618
  displayName: "Clavue",
@@ -1853,21 +1864,143 @@ const claudeConfig = {
1853
1864
  writeMcpConfig: writeMcpConfig
1854
1865
  };
1855
1866
 
1856
- const TRUSTED_OPERATOR_ASK_RULES = [
1857
- "Bash(git push:*)",
1858
- "Bash(rm:*)",
1859
- "Bash(rm -rf:*)",
1860
- "Bash(git push --force:*)",
1861
- "Bash(git reset --hard:*)",
1862
- "Bash(npm publish:*)",
1863
- "Bash(npm login:*)",
1864
- "Bash(docker:*)",
1865
- "Bash(kubectl:*)",
1866
- "Bash(terraform apply:*)",
1867
- "Bash(gh release:*)",
1868
- "Bash(git tag:*)",
1869
- "Bash(gh pr merge:*)"
1867
+ const COMMON_DENY_RULES = [
1868
+ "Bash(rm -rf /)",
1869
+ "Bash(rm -rf /*)",
1870
+ "Bash(rm -rf ~)",
1871
+ "Bash(rm -rf ~/*)",
1872
+ "Bash(rm -rf $HOME)",
1873
+ "Bash(rm -rf $HOME/*)",
1874
+ "Bash(rm -rf --no-preserve-root *)",
1875
+ "Bash(git push --force *)",
1876
+ "Bash(git push -f *)",
1877
+ "Bash(git push --force-with-lease *)",
1878
+ "Bash(git push --mirror *)",
1879
+ "Bash(npm publish *)",
1880
+ "Bash(npm publish)",
1881
+ "Bash(pnpm publish *)",
1882
+ "Bash(pnpm publish)",
1883
+ "Bash(yarn publish *)",
1884
+ "Bash(yarn publish)",
1885
+ "Bash(sudo *)",
1886
+ "Bash(su *)",
1887
+ "Bash(su)",
1888
+ "Bash(curl * | sh)",
1889
+ "Bash(curl * | bash)",
1890
+ "Bash(wget * | sh)",
1891
+ "Bash(wget * | bash)"
1870
1892
  ];
1893
+ const CLAUDE_FAMILY_PERMISSION_TIERS = {
1894
+ safe: {
1895
+ id: "safe",
1896
+ name: "Safe",
1897
+ allow: ["Read", "Grep", "Glob", "LS", "WebFetch", "WebSearch"],
1898
+ deny: [...COMMON_DENY_RULES],
1899
+ defaultMode: "default",
1900
+ allowUnsandboxedCommands: false,
1901
+ trustedOperatorMode: false
1902
+ },
1903
+ standard: {
1904
+ id: "standard",
1905
+ name: "Standard",
1906
+ allow: [
1907
+ "Read",
1908
+ "Grep",
1909
+ "Glob",
1910
+ "LS",
1911
+ "WebFetch",
1912
+ "WebSearch",
1913
+ "Edit",
1914
+ "Write",
1915
+ "MultiEdit",
1916
+ "NotebookEdit",
1917
+ "NotebookRead",
1918
+ "TodoWrite",
1919
+ "Task",
1920
+ "TaskCreate",
1921
+ "TaskGet",
1922
+ "TaskList",
1923
+ "TaskOutput",
1924
+ "TaskStop",
1925
+ "TaskUpdate",
1926
+ "Skill",
1927
+ "Bash(git status *)",
1928
+ "Bash(git status)",
1929
+ "Bash(git diff *)",
1930
+ "Bash(git log *)",
1931
+ "Bash(git show *)",
1932
+ "Bash(git add *)",
1933
+ "Bash(git commit *)",
1934
+ "Bash(git fetch *)",
1935
+ "Bash(git pull *)",
1936
+ "Bash(git push *)",
1937
+ "Bash(npm *)",
1938
+ "Bash(pnpm *)",
1939
+ "Bash(yarn *)",
1940
+ "Bash(bun *)",
1941
+ "Bash(npx *)",
1942
+ "Bash(pnpx *)",
1943
+ "Bash(node *)",
1944
+ "Bash(tsx *)",
1945
+ "Bash(python *)",
1946
+ "Bash(python3 *)",
1947
+ "Bash(cargo *)",
1948
+ "Bash(go *)",
1949
+ "Bash(ls *)",
1950
+ "Bash(ls)",
1951
+ "Bash(pwd)",
1952
+ "Bash(rg *)",
1953
+ "Bash(grep *)",
1954
+ "Bash(find *)",
1955
+ "Bash(cat *)",
1956
+ "Bash(head *)",
1957
+ "Bash(tail *)",
1958
+ "Bash(jq *)",
1959
+ "Bash(curl *)",
1960
+ "Bash(open *)",
1961
+ "Bash(code *)",
1962
+ "Bash(clavue *)",
1963
+ "Bash(claude *)",
1964
+ "Bash(codex *)",
1965
+ "Bash(ccjk *)"
1966
+ ],
1967
+ deny: [...COMMON_DENY_RULES],
1968
+ defaultMode: "acceptEdits",
1969
+ allowUnsandboxedCommands: false,
1970
+ trustedOperatorMode: false
1971
+ },
1972
+ yolo: {
1973
+ id: "yolo",
1974
+ name: "YOLO",
1975
+ allow: [
1976
+ "Read",
1977
+ "Grep",
1978
+ "Glob",
1979
+ "LS",
1980
+ "WebFetch",
1981
+ "WebSearch",
1982
+ "Edit",
1983
+ "Write",
1984
+ "MultiEdit",
1985
+ "NotebookEdit",
1986
+ "NotebookRead",
1987
+ "TodoWrite",
1988
+ "Task",
1989
+ "TaskCreate",
1990
+ "TaskGet",
1991
+ "TaskList",
1992
+ "TaskOutput",
1993
+ "TaskStop",
1994
+ "TaskUpdate",
1995
+ "Skill",
1996
+ "Bash"
1997
+ ],
1998
+ deny: [...COMMON_DENY_RULES],
1999
+ defaultMode: "bypassPermissions",
2000
+ allowUnsandboxedCommands: true,
2001
+ trustedOperatorMode: true
2002
+ }
2003
+ };
1871
2004
  function hasOwn(object, key) {
1872
2005
  return Object.prototype.hasOwnProperty.call(object, key);
1873
2006
  }
@@ -1904,17 +2037,38 @@ function normalizeClaudeFamilySettings(settings, options = {}) {
1904
2037
  }
1905
2038
  return settings;
1906
2039
  }
1907
- function applyTrustedOperatorPermissions(settings) {
2040
+ function allTierAllowRules() {
2041
+ const rules = /* @__PURE__ */ new Set();
2042
+ for (const tier of Object.values(CLAUDE_FAMILY_PERMISSION_TIERS)) {
2043
+ for (const rule of tier.allow) {
2044
+ rules.add(rule);
2045
+ }
2046
+ }
2047
+ return rules;
2048
+ }
2049
+ function isLegacyPermissionRule(rule) {
2050
+ return /^Bash\(.+:\*\)$/.test(rule) || /^(Read|Grep|Glob|LS|WebFetch|WebSearch|Edit|Write|NotebookEdit|MultiEdit|NotebookRead|TodoWrite|Task|Skill)\(\*\)$/.test(rule);
2051
+ }
2052
+ function applyClaudeFamilyPermissionTier(settings, tierId, options = {}) {
1908
2053
  if (!settings || typeof settings !== "object" || Array.isArray(settings)) {
1909
2054
  return settings;
1910
2055
  }
2056
+ const tier = CLAUDE_FAMILY_PERMISSION_TIERS[tierId];
1911
2057
  const mutableSettings = settings;
1912
2058
  mutableSettings.permissions = mutableSettings.permissions && typeof mutableSettings.permissions === "object" && !Array.isArray(mutableSettings.permissions) ? mutableSettings.permissions : {};
1913
- mutableSettings.permissions.defaultMode = "bypassPermissions";
1914
- mutableSettings.permissions.trustedOperatorMode = true;
1915
- mutableSettings.permissions.ask = mergeStringArray(mutableSettings.permissions.ask, TRUSTED_OPERATOR_ASK_RULES);
2059
+ const currentAllow = stringArray(mutableSettings.permissions.allow);
2060
+ const templateRules = allTierAllowRules();
2061
+ const customAllow = options.reset ? [] : currentAllow.filter((rule) => !templateRules.has(rule) && !isLegacyPermissionRule(rule));
2062
+ mutableSettings.permissions.allow = mergeStringArray(tier.allow, customAllow);
2063
+ mutableSettings.permissions.deny = [...tier.deny];
2064
+ mutableSettings.permissions.defaultMode = tier.defaultMode;
2065
+ mutableSettings.permissions.trustedOperatorMode = tier.trustedOperatorMode;
2066
+ mutableSettings.allowUnsandboxedCommands = tier.allowUnsandboxedCommands;
1916
2067
  return settings;
1917
2068
  }
2069
+ function applyTrustedOperatorPermissions(settings) {
2070
+ return applyClaudeFamilyPermissionTier(settings, "yolo");
2071
+ }
1918
2072
 
1919
2073
  const MODEL_ENV_KEYS = [
1920
2074
  "ANTHROPIC_MODEL",
@@ -1922,7 +2076,11 @@ const MODEL_ENV_KEYS = [
1922
2076
  "ANTHROPIC_DEFAULT_SONNET_MODEL",
1923
2077
  "ANTHROPIC_DEFAULT_OPUS_MODEL",
1924
2078
  // Deprecated but still cleaned to avoid stale values
1925
- "ANTHROPIC_SMALL_FAST_MODEL"
2079
+ "ANTHROPIC_SMALL_FAST_MODEL",
2080
+ // Clavue 9.x composite model routing env keys
2081
+ "ANTHROPIC_CUSTOM_MODEL_OPTION",
2082
+ "CLAUDE_CODE_SUBAGENT_MODEL",
2083
+ "CLAVUE_API_DIALECT"
1926
2084
  ];
1927
2085
  function clearModelEnv(env) {
1928
2086
  for (const key of MODEL_ENV_KEYS) {
@@ -1930,6 +2088,150 @@ function clearModelEnv(env) {
1930
2088
  }
1931
2089
  }
1932
2090
 
2091
+ const CLAVUE_DIR = join(homedir(), ".clavue");
2092
+ const CLAVUE_JSON = join(CLAVUE_DIR, ".clavue.json");
2093
+ const CREDENTIALS_JSON = join(CLAVUE_DIR, ".credentials.json");
2094
+ function createModelRouting(models) {
2095
+ const primary = models.primaryModel || "";
2096
+ const haiku = models.haikuModel || primary;
2097
+ const sonnet = models.sonnetModel || primary;
2098
+ const opus = models.opusModel || primary;
2099
+ return {
2100
+ primaryModel: primary,
2101
+ subagentModel: sonnet,
2102
+ smallFastModel: haiku,
2103
+ planModel: opus,
2104
+ exploreModel: sonnet,
2105
+ generalModel: sonnet,
2106
+ teamModel: sonnet,
2107
+ guideModel: opus,
2108
+ reviewModel: ""
2109
+ };
2110
+ }
2111
+ function readJsonFile(path, fallback) {
2112
+ if (!existsSync(path)) return fallback;
2113
+ try {
2114
+ return JSON.parse(readFileSync(path, "utf-8"));
2115
+ } catch {
2116
+ return fallback;
2117
+ }
2118
+ }
2119
+ function writeJsonFile(path, data) {
2120
+ ensureDir(CLAVUE_DIR);
2121
+ writeFileSync(path, JSON.stringify(data, null, 2));
2122
+ }
2123
+ function readClavueJson() {
2124
+ return readJsonFile(CLAVUE_JSON, {});
2125
+ }
2126
+ function writeClavueJson(data) {
2127
+ writeJsonFile(CLAVUE_JSON, data);
2128
+ }
2129
+ function readCredentials() {
2130
+ return readJsonFile(CREDENTIALS_JSON, { providerProfiles: {} });
2131
+ }
2132
+ function writeCredentials(data) {
2133
+ writeJsonFile(CREDENTIALS_JSON, data);
2134
+ }
2135
+ function listProviderProfiles() {
2136
+ return readClavueJson().clavueProviderProfiles || [];
2137
+ }
2138
+ function getActiveProviderProfileId() {
2139
+ return readClavueJson().activeProviderProfileId;
2140
+ }
2141
+ function getProviderProfile(id) {
2142
+ return listProviderProfiles().find((p) => p.id === id);
2143
+ }
2144
+ function saveProviderProfile(profile) {
2145
+ const clavueJson = readClavueJson();
2146
+ const profiles = clavueJson.clavueProviderProfiles || [];
2147
+ const now = Date.now();
2148
+ const existingIdx = profiles.findIndex((p) => p.id === profile.id);
2149
+ const existing = existingIdx >= 0 ? profiles[existingIdx] : void 0;
2150
+ const fullProfile = {
2151
+ id: profile.id,
2152
+ name: profile.name || profile.id,
2153
+ providerId: profile.providerId || "custom",
2154
+ baseUrl: profile.baseUrl,
2155
+ authType: profile.authType,
2156
+ modelRouting: profile.modelRouting || createModelRouting({}),
2157
+ provenance: existing?.provenance || { kind: "manual" },
2158
+ createdAt: existing?.createdAt || now,
2159
+ updatedAt: now
2160
+ };
2161
+ if (profile.modelMode !== void 0) {
2162
+ fullProfile.modelMode = profile.modelMode;
2163
+ } else if (existing?.modelMode) {
2164
+ fullProfile.modelMode = existing.modelMode;
2165
+ }
2166
+ if (profile.apiDialectMode !== void 0) {
2167
+ fullProfile.apiDialectMode = profile.apiDialectMode;
2168
+ } else if (existing?.apiDialectMode) {
2169
+ fullProfile.apiDialectMode = existing.apiDialectMode;
2170
+ }
2171
+ if (existingIdx >= 0) {
2172
+ profiles[existingIdx] = fullProfile;
2173
+ } else {
2174
+ profiles.push(fullProfile);
2175
+ }
2176
+ clavueJson.clavueProviderProfiles = profiles;
2177
+ if (profile.setAsActive !== false) {
2178
+ clavueJson.activeProviderProfileId = profile.id;
2179
+ }
2180
+ writeClavueJson(clavueJson);
2181
+ if (profile.apiKey) {
2182
+ const credentials = readCredentials();
2183
+ credentials.providerProfiles[profile.id] = {
2184
+ credential: profile.apiKey,
2185
+ authType: profile.authType
2186
+ };
2187
+ writeCredentials(credentials);
2188
+ }
2189
+ return fullProfile;
2190
+ }
2191
+ function deleteProviderProfile(id) {
2192
+ const clavueJson = readClavueJson();
2193
+ const profiles = clavueJson.clavueProviderProfiles || [];
2194
+ const idx = profiles.findIndex((p) => p.id === id);
2195
+ if (idx < 0) return false;
2196
+ profiles.splice(idx, 1);
2197
+ clavueJson.clavueProviderProfiles = profiles;
2198
+ if (clavueJson.activeProviderProfileId === id) {
2199
+ clavueJson.activeProviderProfileId = profiles.length > 0 ? profiles[0].id : void 0;
2200
+ }
2201
+ writeClavueJson(clavueJson);
2202
+ const credentials = readCredentials();
2203
+ delete credentials.providerProfiles[id];
2204
+ writeCredentials(credentials);
2205
+ return true;
2206
+ }
2207
+ function setActiveProviderProfile(id) {
2208
+ const profiles = listProviderProfiles();
2209
+ if (!profiles.find((p) => p.id === id)) return false;
2210
+ const clavueJson = readClavueJson();
2211
+ clavueJson.activeProviderProfileId = id;
2212
+ writeClavueJson(clavueJson);
2213
+ return true;
2214
+ }
2215
+ function generateProfileId(name) {
2216
+ return name.toLowerCase().replace(/[^a-z0-9-]/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
2217
+ }
2218
+
2219
+ const clavueProviderProfile = {
2220
+ __proto__: null,
2221
+ createModelRouting: createModelRouting,
2222
+ deleteProviderProfile: deleteProviderProfile,
2223
+ generateProfileId: generateProfileId,
2224
+ getActiveProviderProfileId: getActiveProviderProfileId,
2225
+ getProviderProfile: getProviderProfile,
2226
+ listProviderProfiles: listProviderProfiles,
2227
+ readClavueJson: readClavueJson,
2228
+ readCredentials: readCredentials,
2229
+ saveProviderProfile: saveProviderProfile,
2230
+ setActiveProviderProfile: setActiveProviderProfile,
2231
+ writeClavueJson: writeClavueJson,
2232
+ writeCredentials: writeCredentials
2233
+ };
2234
+
1933
2235
  function cleanupPermissions(templatePermissions, userPermissions) {
1934
2236
  const templateSet = new Set(templatePermissions);
1935
2237
  const cleanedPermissions = userPermissions.filter((permission) => {
@@ -2040,6 +2342,20 @@ function configureApi(apiConfig, codeTool) {
2040
2342
  } catch (error) {
2041
2343
  console.error("Failed to set onboarding flag", error);
2042
2344
  }
2345
+ if (target.codeTool === "clavue" && apiConfig.url && apiConfig.key) {
2346
+ try {
2347
+ const profileId = generateProfileId("ccjk-default");
2348
+ saveProviderProfile({
2349
+ id: profileId,
2350
+ name: "ccjk-default",
2351
+ baseUrl: apiConfig.url,
2352
+ authType: apiConfig.authType || "api_key",
2353
+ apiKey: apiConfig.key,
2354
+ setAsActive: true
2355
+ });
2356
+ } catch {
2357
+ }
2358
+ }
2043
2359
  return apiConfig;
2044
2360
  }
2045
2361
  function mergeConfigs(sourceFile, targetFile) {
@@ -2074,6 +2390,37 @@ function updateCustomModel(primaryModel, haikuModel, sonnetModel, opusModel, cod
2074
2390
  settings.env.ANTHROPIC_DEFAULT_OPUS_MODEL = opusModel.trim();
2075
2391
  normalizeClaudeFamilySettings(settings, { codeTool: target.codeTool });
2076
2392
  writeJsonConfig(target.settingsFile, settings);
2393
+ if (target.codeTool === "clavue") {
2394
+ updateClavueProviderModelRouting(primaryModel, haikuModel, sonnetModel, opusModel);
2395
+ }
2396
+ }
2397
+ function updateClavueProviderModelRouting(primaryModel, haikuModel, sonnetModel, opusModel) {
2398
+ try {
2399
+ const activeId = getActiveProviderProfileId();
2400
+ const profiles = listProviderProfiles();
2401
+ const existingProfile = activeId ? profiles.find((p) => p.id === activeId) : profiles[0];
2402
+ const modelRouting = createModelRouting({
2403
+ primaryModel: primaryModel?.trim() || existingProfile?.modelRouting?.primaryModel || "",
2404
+ haikuModel: haikuModel?.trim() || existingProfile?.modelRouting?.smallFastModel || "",
2405
+ sonnetModel: sonnetModel?.trim() || existingProfile?.modelRouting?.subagentModel || "",
2406
+ opusModel: opusModel?.trim() || existingProfile?.modelRouting?.planModel || ""
2407
+ });
2408
+ if (existingProfile) {
2409
+ saveProviderProfile({
2410
+ id: existingProfile.id,
2411
+ name: existingProfile.name,
2412
+ baseUrl: existingProfile.baseUrl,
2413
+ authType: existingProfile.authType,
2414
+ apiKey: "",
2415
+ // credential already stored, don't overwrite
2416
+ modelRouting,
2417
+ modelMode: existingProfile.modelMode,
2418
+ apiDialectMode: existingProfile.apiDialectMode,
2419
+ setAsActive: true
2420
+ });
2421
+ }
2422
+ } catch {
2423
+ }
2077
2424
  }
2078
2425
  function updateDefaultModel(model, codeTool) {
2079
2426
  const target = resolveClaudeFamilySettingsTarget(codeTool);
@@ -2211,6 +2558,15 @@ function switchToOfficialLogin$1(codeTool) {
2211
2558
  writeJsonConfig(CLAUDE_VSC_CONFIG_FILE, vscConfig);
2212
2559
  }
2213
2560
  }
2561
+ if (target.codeTool === "clavue") {
2562
+ try {
2563
+ const clavueJson = readClavueJson();
2564
+ clavueJson.clavueProviderProfiles = [];
2565
+ clavueJson.activeProviderProfileId = void 0;
2566
+ writeClavueJson(clavueJson);
2567
+ } catch {
2568
+ }
2569
+ }
2214
2570
  console.log(i18n.t("api:officialLoginConfigured"));
2215
2571
  return true;
2216
2572
  } catch (error) {
@@ -3472,6 +3828,11 @@ function addNumbersToChoices(choices, startFrom = 1, format = (n) => `${n}. `) {
3472
3828
  });
3473
3829
  }
3474
3830
 
3831
+ const promptHelpers = {
3832
+ __proto__: null,
3833
+ addNumbersToChoices: addNumbersToChoices
3834
+ };
3835
+
3475
3836
  async function selectAiOutputLanguage(defaultLang) {
3476
3837
  ensureI18nInitialized();
3477
3838
  console.log(ansis.dim(`
@@ -3931,16 +4292,38 @@ function upsertCodexMcpService(serviceId, service) {
3931
4292
  }
3932
4293
  writeFile(CODEX_CONFIG_FILE, content);
3933
4294
  }
4295
+ function buildMcpServiceSectionRegex(serviceId) {
4296
+ return new RegExp(
4297
+ `\\n?\\[mcp_servers\\.${escapeRegex(serviceId)}(?:\\.[^\\]]+)?\\][\\s\\S]*?(?=\\n\\[|$)`,
4298
+ "g"
4299
+ );
4300
+ }
3934
4301
  function deleteCodexMcpService(serviceId) {
3935
4302
  if (!exists(CODEX_CONFIG_FILE)) {
3936
4303
  return;
3937
4304
  }
3938
4305
  const content = readFile(CODEX_CONFIG_FILE) || "";
3939
- const sectionRegex = new RegExp(
3940
- `\\n?\\[mcp_servers\\.${escapeRegex(serviceId)}\\][\\s\\S]*?(?=\\n\\[|$)`,
3941
- "g"
3942
- );
3943
- const updatedContent = content.replace(sectionRegex, "");
4306
+ const updatedContent = content.replace(buildMcpServiceSectionRegex(serviceId), "");
4307
+ writeFile(CODEX_CONFIG_FILE, updatedContent);
4308
+ }
4309
+ function listCodexMcpServiceIds() {
4310
+ if (!exists(CODEX_CONFIG_FILE))
4311
+ return [];
4312
+ const content = readFile(CODEX_CONFIG_FILE) || "";
4313
+ const ids = /* @__PURE__ */ new Set();
4314
+ const sectionRegex = /^\[mcp_servers\.([^\]]+)\]/gm;
4315
+ for (const match of content.matchAll(sectionRegex)) {
4316
+ const rootId = match[1].split(".")[0];
4317
+ if (rootId)
4318
+ ids.add(rootId);
4319
+ }
4320
+ return Array.from(ids);
4321
+ }
4322
+ function deleteAllCodexMcpServices() {
4323
+ if (!exists(CODEX_CONFIG_FILE))
4324
+ return;
4325
+ const content = readFile(CODEX_CONFIG_FILE) || "";
4326
+ const updatedContent = content.replace(/\n?\[mcp_servers\.[^\]]+\][\s\S]*?(?=\n\[|$)/g, "").replace(/\n?#\s*---\s*MCP servers added by CCJK\s*---\s*/gi, "");
3944
4327
  writeFile(CODEX_CONFIG_FILE, updatedContent);
3945
4328
  }
3946
4329
  function batchUpdateCodexMcpServices(services, options = {}) {
@@ -3998,8 +4381,10 @@ function formatTomlString(value) {
3998
4381
  const codexTomlUpdater = {
3999
4382
  __proto__: null,
4000
4383
  batchUpdateCodexMcpServices: batchUpdateCodexMcpServices,
4384
+ deleteAllCodexMcpServices: deleteAllCodexMcpServices,
4001
4385
  deleteCodexMcpService: deleteCodexMcpService,
4002
4386
  deleteCodexProvider: deleteCodexProvider,
4387
+ listCodexMcpServiceIds: listCodexMcpServiceIds,
4003
4388
  updateCodexApiFields: updateCodexApiFields,
4004
4389
  updateTopLevelTomlField: updateTopLevelTomlField,
4005
4390
  upsertCodexMcpService: upsertCodexMcpService,
@@ -4254,6 +4639,102 @@ async function configureCodexMcp(options) {
4254
4639
  console.log(ansis.green(i18n.t("codex:mcpConfigured")));
4255
4640
  }
4256
4641
 
4642
+ const CODEX_WORKFLOW_GROUP_PREFIX = "::codexWorkflowGroup:";
4643
+ const CODEX_WORKFLOW_CONFIG_BASE = [
4644
+ {
4645
+ id: "commonTools",
4646
+ order: 1,
4647
+ defaultSelected: true,
4648
+ category: "essential",
4649
+ type: "group",
4650
+ files: ["init-project.md", "agents/init-architect.md", "agents/get-current-datetime.md"]
4651
+ },
4652
+ {
4653
+ id: "featPlanUx",
4654
+ order: 2,
4655
+ defaultSelected: true,
4656
+ category: "essential",
4657
+ type: "group",
4658
+ files: ["feat.md", "agents/planner.md", "agents/ui-ux-designer.md"]
4659
+ },
4660
+ {
4661
+ id: "sixStepsWorkflow",
4662
+ order: 3,
4663
+ defaultSelected: true,
4664
+ category: "sixStep",
4665
+ type: "single",
4666
+ files: ["workflow.md"]
4667
+ },
4668
+ {
4669
+ id: "specFirstTDD",
4670
+ order: 4,
4671
+ defaultSelected: true,
4672
+ category: "specFirstTDD",
4673
+ type: "single",
4674
+ files: ["spec-first-tdd.md"]
4675
+ },
4676
+ {
4677
+ id: "codeReview",
4678
+ order: 5,
4679
+ defaultSelected: true,
4680
+ category: "codeReview",
4681
+ type: "single",
4682
+ files: ["code-review.md"]
4683
+ },
4684
+ {
4685
+ id: "refactoringMaster",
4686
+ order: 6,
4687
+ defaultSelected: false,
4688
+ category: "refactoringMaster",
4689
+ type: "single",
4690
+ files: ["refactoring-master.md"]
4691
+ },
4692
+ {
4693
+ id: "gitWorkflow",
4694
+ order: 7,
4695
+ defaultSelected: true,
4696
+ category: "git",
4697
+ type: "group",
4698
+ files: ["git-commit.md", "git-rollback.md", "git-cleanBranches.md", "git-worktree.md"]
4699
+ },
4700
+ {
4701
+ id: "continuousDelivery",
4702
+ order: 8,
4703
+ defaultSelected: false,
4704
+ category: "continuousDelivery",
4705
+ type: "single",
4706
+ files: ["continuous-delivery.md"]
4707
+ },
4708
+ {
4709
+ id: "bmadWorkflow",
4710
+ order: 9,
4711
+ defaultSelected: false,
4712
+ category: "bmad",
4713
+ type: "single",
4714
+ files: ["bmad-init.md"]
4715
+ }
4716
+ ];
4717
+ function getCodexWorkflowGroupSentinel(workflowId) {
4718
+ return `${CODEX_WORKFLOW_GROUP_PREFIX}${workflowId}`;
4719
+ }
4720
+ function isCodexWorkflowGroupSentinel(path) {
4721
+ return path.startsWith(CODEX_WORKFLOW_GROUP_PREFIX);
4722
+ }
4723
+ function getCodexWorkflowIdFromSentinel(path) {
4724
+ if (!isCodexWorkflowGroupSentinel(path))
4725
+ return void 0;
4726
+ return path.slice(CODEX_WORKFLOW_GROUP_PREFIX.length);
4727
+ }
4728
+ function getCodexWorkflowOptions() {
4729
+ ensureI18nInitialized();
4730
+ return CODEX_WORKFLOW_CONFIG_BASE.map((config) => ({
4731
+ id: config.id,
4732
+ order: config.order,
4733
+ defaultSelected: config.defaultSelected,
4734
+ name: i18n.t(`workflow:workflowOption.${config.id}`)
4735
+ })).sort((a, b) => a.order - b.order);
4736
+ }
4737
+
4257
4738
  let cachedSkipPromptBackup = null;
4258
4739
  function getRootDir$1() {
4259
4740
  const currentFilePath = fileURLToPath(import.meta.url);
@@ -4942,13 +5423,30 @@ async function runCodexWorkflowImportWithLanguageSelection(options) {
4942
5423
  skipPrompt
4943
5424
  );
4944
5425
  updateCcjkConfig({ aiOutputLang });
4945
- await runCodexSystemPromptSelection(skipPrompt);
4946
- ensureCodexAgentsLanguageDirective(aiOutputLang);
4947
- await runCodexWorkflowSelection(options);
4948
- console.log(ansis.green(i18n.t("codex:workflowInstall")));
5426
+ const presetAutoApply = options?.setupPreset === "clean" || options?.setupPreset === "optimized";
5427
+ await runCodexSystemPromptSelection({
5428
+ skipPrompt: skipPrompt || presetAutoApply,
5429
+ forcedStyle: options?.systemPromptStyle,
5430
+ skipEntirely: options?.skipAgentsLanguageDirective && options?.systemPromptStyle === "none"
5431
+ });
5432
+ if (!options?.skipAgentsLanguageDirective)
5433
+ ensureCodexAgentsLanguageDirective(aiOutputLang);
5434
+ if (!options?.skipWorkflowInstall) {
5435
+ await runCodexWorkflowSelection({
5436
+ ...options,
5437
+ skipPrompt: skipPrompt || presetAutoApply
5438
+ });
5439
+ console.log(ansis.green(i18n.t("codex:workflowInstall")));
5440
+ } else {
5441
+ console.log(ansis.gray(i18n.t("codex:preset.clean.skippedWorkflows")));
5442
+ }
4949
5443
  return aiOutputLang;
4950
5444
  }
4951
- async function runCodexSystemPromptSelection(skipPrompt = false) {
5445
+ async function runCodexSystemPromptSelection(options = {}) {
5446
+ const resolved = typeof options === "boolean" ? { skipPrompt: options } : options;
5447
+ const { skipPrompt = false, forcedStyle, skipEntirely = false } = resolved;
5448
+ if (skipEntirely)
5449
+ return;
4952
5450
  ensureI18nInitialized();
4953
5451
  const rootDir = getRootDir$1();
4954
5452
  const ccjkConfig$1 = readCcjkConfig();
@@ -4968,48 +5466,14 @@ async function runCodexSystemPromptSelection(skipPrompt = false) {
4968
5466
  systemPromptSrc = join(rootDir, "templates", "common", "output-styles", "zh-CN");
4969
5467
  if (!exists(systemPromptSrc))
4970
5468
  return;
4971
- const availablePrompts = [
4972
- {
4973
- id: "linus-mode",
4974
- name: i18n.t("configuration:outputStyles.linus-mode.name"),
4975
- description: i18n.t("configuration:outputStyles.linus-mode.description")
4976
- },
4977
- {
4978
- id: "uncle-bob-mode",
4979
- name: i18n.t("configuration:outputStyles.uncle-bob-mode.name"),
4980
- description: i18n.t("configuration:outputStyles.uncle-bob-mode.description")
4981
- },
4982
- {
4983
- id: "dhh-mode",
4984
- name: i18n.t("configuration:outputStyles.dhh-mode.name"),
4985
- description: i18n.t("configuration:outputStyles.dhh-mode.description")
4986
- },
4987
- {
4988
- id: "carmack-mode",
4989
- name: i18n.t("configuration:outputStyles.carmack-mode.name"),
4990
- description: i18n.t("configuration:outputStyles.carmack-mode.description")
4991
- },
4992
- {
4993
- id: "jobs-mode",
4994
- name: i18n.t("configuration:outputStyles.jobs-mode.name"),
4995
- description: i18n.t("configuration:outputStyles.jobs-mode.description")
4996
- },
4997
- {
4998
- id: "evan-you-mode",
4999
- name: i18n.t("configuration:outputStyles.evan-you-mode.name"),
5000
- description: i18n.t("configuration:outputStyles.evan-you-mode.description")
5001
- }
5002
- ].filter((style) => exists(join(systemPromptSrc, `${style.id}.md`)));
5003
- if (availablePrompts.length === 0)
5004
- return;
5469
+ const { getCodexAgentsStylePrompts } = await Promise.resolve().then(function () { return outputStyles; });
5470
+ const availablePrompts = getCodexAgentsStylePrompts(systemPromptSrc);
5005
5471
  const { resolveSystemPromptStyle } = await Promise.resolve().then(function () { return prompts; });
5006
- const systemPrompt = await resolveSystemPromptStyle(
5472
+ const systemPrompt = forcedStyle !== void 0 ? forcedStyle : await resolveSystemPromptStyle(
5007
5473
  availablePrompts,
5008
5474
  void 0,
5009
- // No command line option for this function
5010
5475
  tomlConfig,
5011
5476
  skipPrompt
5012
- // Pass skipPrompt flag
5013
5477
  );
5014
5478
  if (!systemPrompt || systemPrompt === "none") {
5015
5479
  try {
@@ -5046,6 +5510,8 @@ async function runCodexSystemPromptSelection(skipPrompt = false) {
5046
5510
  }
5047
5511
  async function runCodexWorkflowSelection(options) {
5048
5512
  ensureI18nInitialized();
5513
+ if (options?.skipWorkflowInstall)
5514
+ return;
5049
5515
  const { skipPrompt = false, workflows: presetWorkflows = [] } = options ?? {};
5050
5516
  const rootDir = getRootDir$1();
5051
5517
  const ccjkConfig = readCcjkConfig();
@@ -5091,8 +5557,7 @@ async function runCodexWorkflowSelection(options) {
5091
5557
  choices: addNumbersToChoices(allWorkflows.map((workflow) => ({
5092
5558
  name: workflow.name,
5093
5559
  value: workflow.path,
5094
- checked: true
5095
- // Default all selected
5560
+ checked: workflow.defaultSelected
5096
5561
  })))
5097
5562
  }]);
5098
5563
  if (!workflows || workflows.length === 0)
@@ -5110,53 +5575,46 @@ async function runCodexWorkflowSelection(options) {
5110
5575
  writeFile(targetPath, content);
5111
5576
  }
5112
5577
  }
5113
- const GIT_GROUP_SENTINEL = "::gitGroup";
5114
5578
  function getAllWorkflowFiles(workflowSrc, preferredLang) {
5579
+ const optionNames = new Map(getCodexWorkflowOptions().map((option) => [option.id, option.name]));
5115
5580
  const workflows = [];
5116
- const sixStepFile = join(workflowSrc, "sixStep", preferredLang, "workflow.md");
5117
- if (exists(sixStepFile)) {
5118
- workflows.push({
5119
- name: i18n.t("workflow:workflowOption.sixStepsWorkflow"),
5120
- path: sixStepFile
5121
- });
5122
- }
5123
- const gitPromptsDir = join(workflowSrc, "git", preferredLang);
5124
- if (exists(gitPromptsDir)) {
5581
+ for (const config of CODEX_WORKFLOW_CONFIG_BASE.sort((a, b) => a.order - b.order)) {
5582
+ const resolvedFiles = resolveCodexWorkflowFiles(workflowSrc, preferredLang, config);
5583
+ if (resolvedFiles.length === 0)
5584
+ continue;
5585
+ const name = optionNames.get(config.id) || config.id;
5586
+ const path = config.type === "group" ? getCodexWorkflowGroupSentinel(config.id) : resolvedFiles[0];
5125
5587
  workflows.push({
5126
- name: i18n.t("workflow:workflowOption.gitWorkflow"),
5127
- // Use sentinel path for grouped selection; expanded later
5128
- path: GIT_GROUP_SENTINEL
5588
+ name,
5589
+ path,
5590
+ defaultSelected: config.defaultSelected
5129
5591
  });
5130
5592
  }
5131
5593
  return workflows;
5132
5594
  }
5595
+ function resolveCodexWorkflowFiles(workflowSrc, preferredLang, config) {
5596
+ const resolved = [];
5597
+ for (const file of config.files) {
5598
+ const full = join(workflowSrc, config.category, preferredLang, file);
5599
+ if (exists(full))
5600
+ resolved.push(full);
5601
+ }
5602
+ return resolved;
5603
+ }
5133
5604
  function expandSelectedWorkflowPaths(paths, workflowSrc, preferredLang) {
5134
5605
  const expanded = [];
5135
5606
  for (const p of paths) {
5136
- if (p === GIT_GROUP_SENTINEL) {
5137
- expanded.push(...getGitPromptFiles(workflowSrc, preferredLang));
5607
+ if (isCodexWorkflowGroupSentinel(p)) {
5608
+ const workflowId = getCodexWorkflowIdFromSentinel(p);
5609
+ const config = CODEX_WORKFLOW_CONFIG_BASE.find((item) => item.id === workflowId);
5610
+ if (config)
5611
+ expanded.push(...resolveCodexWorkflowFiles(workflowSrc, preferredLang, config));
5138
5612
  } else {
5139
5613
  expanded.push(p);
5140
5614
  }
5141
5615
  }
5142
5616
  return expanded;
5143
5617
  }
5144
- function getGitPromptFiles(workflowSrc, preferredLang) {
5145
- const gitPromptsDir = join(workflowSrc, "git", preferredLang);
5146
- const files = [
5147
- "git-commit.md",
5148
- "git-rollback.md",
5149
- "git-cleanBranches.md",
5150
- "git-worktree.md"
5151
- ];
5152
- const resolved = [];
5153
- for (const f of files) {
5154
- const full = join(gitPromptsDir, f);
5155
- if (exists(full))
5156
- resolved.push(full);
5157
- }
5158
- return resolved;
5159
- }
5160
5618
  function toProvidersList(providers) {
5161
5619
  return providers.map((provider) => ({ name: provider.name || provider.id, value: provider.id }));
5162
5620
  }
@@ -5451,10 +5909,33 @@ async function configureCodexApi(options) {
5451
5909
  }
5452
5910
  async function runCodexFullInit(options) {
5453
5911
  ensureI18nInitialized();
5454
- await installCodexCli(options?.skipPrompt || false);
5455
- const aiOutputLang = await runCodexWorkflowImportWithLanguageSelection(options);
5456
- await configureCodexApi(options);
5457
- await configureCodexMcp(options);
5912
+ let resolvedOptions = { ...options };
5913
+ if (!resolvedOptions.skipPrompt && !resolvedOptions.setupPreset) {
5914
+ const { applyCodexSetupPreset, promptCodexSetupPreset } = await import('./codex-presets.mjs');
5915
+ const preset = await promptCodexSetupPreset();
5916
+ if (!preset) {
5917
+ console.log(ansis.yellow(i18n.t("common:cancelled")));
5918
+ return resolvedOptions.aiOutputLang || "en";
5919
+ }
5920
+ resolvedOptions = {
5921
+ ...resolvedOptions,
5922
+ ...applyCodexSetupPreset(preset, resolvedOptions)
5923
+ };
5924
+ if (preset !== "custom") {
5925
+ const presetName = i18n.t(`codex:preset.${preset}.name`);
5926
+ console.log(ansis.gray(`\u2714 ${i18n.t("codex:preset.applied", { preset: presetName })}`));
5927
+ }
5928
+ } else if (resolvedOptions.setupPreset && resolvedOptions.setupPreset !== "custom") {
5929
+ const { applyCodexSetupPreset } = await import('./codex-presets.mjs');
5930
+ resolvedOptions = {
5931
+ ...resolvedOptions,
5932
+ ...applyCodexSetupPreset(resolvedOptions.setupPreset, resolvedOptions)
5933
+ };
5934
+ }
5935
+ await installCodexCli(resolvedOptions.skipPrompt || false);
5936
+ const aiOutputLang = await runCodexWorkflowImportWithLanguageSelection(resolvedOptions);
5937
+ await configureCodexApi(resolvedOptions);
5938
+ await configureCodexMcp(resolvedOptions);
5458
5939
  return aiOutputLang;
5459
5940
  }
5460
5941
  function ensureCodexAgentsLanguageDirective(aiOutputLang) {
@@ -5923,38 +6404,50 @@ async function installCometixLine() {
5923
6404
  }
5924
6405
  }
5925
6406
 
6407
+ const CODEX_AGENTS_STYLE_CONFIGS = [
6408
+ { id: "agents-md-baseline", filename: "agents-md-baseline.md", order: 1 },
6409
+ { id: "plan-first", filename: "plan-first.md", order: 2 },
6410
+ { id: "verify-and-ship", filename: "verify-and-ship.md", order: 3 },
6411
+ { id: "surgical-diff", filename: "surgical-diff.md", order: 4 },
6412
+ { id: "engineer-professional", filename: "engineer-professional.md", order: 5 }
6413
+ ];
6414
+ const CUSTOM_OUTPUT_STYLE_CONFIGS = [
6415
+ ...CODEX_AGENTS_STYLE_CONFIGS
6416
+ ];
6417
+ function buildStylePrompts(configs, templateDir, i18nPrefix) {
6418
+ ensureI18nInitialized();
6419
+ return configs.filter((style) => exists(join(templateDir, style.filename))).sort((a, b) => a.order - b.order).map((style) => ({
6420
+ id: style.id,
6421
+ name: i18n.t(`${i18nPrefix}.${style.id}.name`),
6422
+ description: i18n.t(`${i18nPrefix}.${style.id}.description`)
6423
+ }));
6424
+ }
6425
+ function getCodexAgentsStylePrompts(templateDir) {
6426
+ return buildStylePrompts(CODEX_AGENTS_STYLE_CONFIGS, templateDir, "configuration:codexAgentsStyles");
6427
+ }
6428
+ function getCustomOutputStyleIds() {
6429
+ return CUSTOM_OUTPUT_STYLE_CONFIGS.map((style) => style.id);
6430
+ }
6431
+ const BUILTIN_OUTPUT_STYLE_IDS = ["default", "explanatory", "learning", "none"];
6432
+ function getAllValidOutputStyleIds() {
6433
+ return [...getCustomOutputStyleIds(), ...BUILTIN_OUTPUT_STYLE_IDS];
6434
+ }
6435
+
6436
+ const outputStyles = {
6437
+ __proto__: null,
6438
+ CODEX_AGENTS_STYLE_CONFIGS: CODEX_AGENTS_STYLE_CONFIGS,
6439
+ CUSTOM_OUTPUT_STYLE_CONFIGS: CUSTOM_OUTPUT_STYLE_CONFIGS,
6440
+ getAllValidOutputStyleIds: getAllValidOutputStyleIds,
6441
+ getCodexAgentsStylePrompts: getCodexAgentsStylePrompts,
6442
+ getCustomOutputStyleIds: getCustomOutputStyleIds
6443
+ };
6444
+
5926
6445
  const OUTPUT_STYLES = [
5927
- // Custom styles (have template files) - zcf legacy curated modes
5928
- {
5929
- id: "linus-mode",
5930
- isCustom: true,
5931
- filePath: "linus-mode.md"
5932
- },
5933
- {
5934
- id: "uncle-bob-mode",
5935
- isCustom: true,
5936
- filePath: "uncle-bob-mode.md"
5937
- },
5938
- {
5939
- id: "dhh-mode",
5940
- isCustom: true,
5941
- filePath: "dhh-mode.md"
5942
- },
5943
- {
5944
- id: "carmack-mode",
5945
- isCustom: true,
5946
- filePath: "carmack-mode.md"
5947
- },
5948
- {
5949
- id: "jobs-mode",
5950
- isCustom: true,
5951
- filePath: "jobs-mode.md"
5952
- },
5953
- {
5954
- id: "evan-you-mode",
6446
+ ...CUSTOM_OUTPUT_STYLE_CONFIGS.map((style) => ({
6447
+ id: style.id,
5955
6448
  isCustom: true,
5956
- filePath: "evan-you-mode.md"
5957
- },
6449
+ filePath: style.filename
6450
+ })),
5958
6451
  // Built-in styles (no template files)
5959
6452
  {
5960
6453
  id: "default",
@@ -7433,7 +7926,8 @@ async function validateSkipPromptOptions(options) {
7433
7926
  if (options.outputStyles === "skip") {
7434
7927
  options.outputStyles = false;
7435
7928
  } else if (options.outputStyles === "all") {
7436
- options.outputStyles = ["linus-mode", "uncle-bob-mode", "dhh-mode", "carmack-mode", "jobs-mode", "evan-you-mode"];
7929
+ const { getCustomOutputStyleIds } = await Promise.resolve().then(function () { return outputStyles; });
7930
+ options.outputStyles = getCustomOutputStyleIds();
7437
7931
  } else {
7438
7932
  options.outputStyles = options.outputStyles.split(",").map((s) => s.trim());
7439
7933
  }
@@ -7500,7 +7994,8 @@ async function validateSkipPromptOptions(options) {
7500
7994
  }
7501
7995
  }
7502
7996
  if (Array.isArray(options.outputStyles)) {
7503
- const validStyles = ["linus-mode", "uncle-bob-mode", "dhh-mode", "carmack-mode", "jobs-mode", "evan-you-mode", "default", "explanatory", "learning", "none"];
7997
+ const { getAllValidOutputStyleIds } = await Promise.resolve().then(function () { return outputStyles; });
7998
+ const validStyles = getAllValidOutputStyleIds();
7504
7999
  for (const style of options.outputStyles) {
7505
8000
  if (!validStyles.includes(style)) {
7506
8001
  throw new Error(i18n.t("errors:invalidOutputStyle", { style, validStyles: validStyles.join(", ") }));
@@ -7508,7 +8003,8 @@ async function validateSkipPromptOptions(options) {
7508
8003
  }
7509
8004
  }
7510
8005
  if (options.defaultOutputStyle) {
7511
- const validStyles = ["linus-mode", "uncle-bob-mode", "dhh-mode", "carmack-mode", "jobs-mode", "evan-you-mode", "default", "explanatory", "learning", "none"];
8006
+ const { getAllValidOutputStyleIds } = await Promise.resolve().then(function () { return outputStyles; });
8007
+ const validStyles = getAllValidOutputStyleIds();
7512
8008
  if (!validStyles.includes(options.defaultOutputStyle)) {
7513
8009
  throw new Error(i18n.t("errors:invalidDefaultOutputStyle", { style: options.defaultOutputStyle, validStyles: validStyles.join(", ") }));
7514
8010
  }
@@ -7644,6 +8140,11 @@ async function init(options = {}) {
7644
8140
  if (codeToolType === "grok") {
7645
8141
  const { configureIncrementalManagement } = await import('./claude-code-incremental-manager.mjs');
7646
8142
  await configureIncrementalManagement();
8143
+ updateCcjkConfig({
8144
+ version,
8145
+ preferredLang: i18n.language,
8146
+ codeToolType: "grok"
8147
+ });
7647
8148
  console.log(ansis.dim(`
7648
8149
  ${i18n.t("menu:menuDescriptions.grokInitHint")}
7649
8150
  `));
@@ -7716,6 +8217,8 @@ async function init(options = {}) {
7716
8217
  codeToolType
7717
8218
  });
7718
8219
  console.log(ansis.green(i18n.t("codex:setupComplete")));
8220
+ const { printCodexReloadHint } = await import('./codex-runtime.mjs');
8221
+ printCodexReloadHint();
7719
8222
  return;
7720
8223
  }
7721
8224
  const aiOutputLang = await resolveAiOutputLanguage(i18n.language, options.aiOutputLang, ccjkConfig, options.skipPrompt);
@@ -8420,6 +8923,14 @@ async function importRecommendedPermissions(codeTool) {
8420
8923
  applyTrustedOperatorPermissions(currentSettings);
8421
8924
  saveSettings(currentSettings, codeTool);
8422
8925
  }
8926
+ async function applyRecommendedPermissionTier(tier, codeTool, options = {}) {
8927
+ const currentSettings = loadCurrentSettings(codeTool);
8928
+ applyClaudeFamilyPermissionTier(currentSettings, tier, options);
8929
+ saveSettings(currentSettings, codeTool);
8930
+ }
8931
+ function getPermissionTierLabel(tier) {
8932
+ return CLAUDE_FAMILY_PERMISSION_TIERS[tier].name;
8933
+ }
8423
8934
  async function openSettingsJson(codeTool) {
8424
8935
  const target = resolveClaudeFamilySettingsTarget(codeTool);
8425
8936
  ensureDir(target.configDir);
@@ -8453,4 +8964,4 @@ async function openSettingsJson(codeTool) {
8453
8964
  }
8454
8965
  }
8455
8966
 
8456
- export { installClaudeCode as $, AI_OUTPUT_LANGUAGES as A, buildMcpServerConfig as B, CCJK_CONFIG_DIR as C, DEFAULT_CODE_TOOL_TYPE as D, cleanupPermissions as E, commandExists as F, configureApi as G, copyConfigFiles as H, createHomebrewSymlink as I, detectInstalledVersion as J, displayVerificationResult as K, LANG_LABELS as L, ensureApiKeyApproved as M, ensureClaudeDir as N, executeInstallMethod as O, fixWindowsMcpConfig as P, getAiOutputLanguageLabel as Q, getExistingApiConfig as R, SETTINGS_FILE as S, getExistingModelConfig as T, getInstallationStatus as U, getMcpConfigPath as V, getPlatform as W, handleInstallFailure as X, importRecommendedEnv as Y, importRecommendedPermissions as Z, init as _, API_DEFAULT_URL as a, COMETIX_COMMAND_NAME as a$, installCodex as a0, isClaudeCodeInstalled as a1, isCodeToolType as a2, isCodexInstalled as a3, isLocalClaudeCodeInstalled as a4, manageApiKeyApproval as a5, mergeAndCleanPermissions as a6, mergeConfigs as a7, mergeMcpServers as a8, mergeSettingsFile as a9, exists as aA, readJsonConfig as aB, writeTomlConfig as aC, clearModelEnv as aD, normalizeClaudeFamilySettings as aE, copyFile as aF, detectConfigManagementMode as aG, readCodexConfig as aH, backupCodexComplete as aI, writeAuthFile as aJ, updateCcjkConfig as aK, changeLanguage as aL, readCcjkConfig as aM, configureOutputStyle as aN, isClaudeFamilyCodeTool as aO, isWindows as aP, selectMcpServices as aQ, getMcpServices as aR, isCcrInstalled as aS, installCcr as aT, setupCcrConfiguration as aU, modifyApiConfigPartially as aV, formatApiKeyDisplay as aW, readCcrConfig as aX, configureCcrFeature as aY, handleExitPromptError as aZ, handleGeneralError as a_, openSettingsJson as aa, promptApiConfigurationAction as ab, readMcpConfig as ac, removeApiKeyFromRejected as ad, removeLocalClaudeCode as ae, resolveCodeToolType as af, selectInstallMethod as ag, setInstallMethod as ah, setPrimaryApiKey as ai, settingsFileForTool as aj, switchToOfficialLogin$1 as ak, uninstallCodeTool as al, updateCustomModel as am, updateDefaultModel as an, verifyInstallation as ao, writeMcpConfig as ap, ensureI18nInitialized as aq, getActiveCodeTool as ar, i18n as as, addNumbersToChoices as at, validateApiKey as au, promptBoolean as av, resolveClaudeFamilySettingsTarget as aw, ensureDir as ax, readDefaultTomlConfig as ay, createDefaultTomlConfig as az, API_ENV_KEY as b, COMETIX_COMMANDS as b0, installCometixLine as b1, checkAndUpdateTools as b2, runCodexUpdate as b3, resolveCodeType as b4, writeJsonConfig as b5, displayBanner as b6, version as b7, resolveAiOutputLanguage as b8, updatePromptOnly as b9, installer as bA, selectAndInstallWorkflows as ba, checkClaudeCodeVersionAndPrompt as bb, STARTUP_CODE_TOOL_CHOICES as bc, displayBannerWithInfo as bd, runCodexUninstall as be, manageCodexMcp as bf, configureCodexApi as bg, runCodexWorkflowImportWithLanguageSelection as bh, runCodexFullInit as bi, switchCodexProvider as bj, listCodexProviders as bk, switchToOfficialLogin as bl, switchToProvider as bm, readCcjkConfigAsync as bn, initI18n as bo, selectScriptLanguage as bp, index as bq, fsOperations as br, jsonConfig as bs, claudeConfig as bt, config$1 as bu, config as bv, prompts as bw, codexProfileV2 as bx, codexTomlUpdater as by, codex as bz, CCJK_CONFIG_FILE as c, CLAUDE_DIR as d, CLAUDE_MD_FILE as e, CLAUDE_VSC_CONFIG_FILE as f, CLAVUE_CONFIG_FILE as g, CLAVUE_DIR as h, CLAVUE_MD_FILE as i, CLAVUE_SETTINGS_FILE as j, CODEX_AGENTS_FILE as k, CODEX_AUTH_FILE as l, CODEX_CONFIG_FILE as m, CODEX_DIR as n, CODEX_PROMPTS_DIR as o, CODE_TOOL_ALIASES as p, CODE_TOOL_BANNERS as q, CODE_TOOL_TYPES as r, ClAUDE_CONFIG_FILE as s, LEGACY_CCJK_CONFIG_FILES as t, SUPPORTED_LANGS as u, activeSettingsFile as v, addCompletedOnboarding as w, applyAiLanguageDirective as x, backupExistingConfig as y, backupMcpConfig as z };
8967
+ export { init as $, AI_OUTPUT_LANGUAGES as A, backupMcpConfig as B, CCJK_CONFIG_DIR as C, DEFAULT_CODE_TOOL_TYPE as D, buildMcpServerConfig as E, cleanupPermissions as F, commandExists as G, configureApi as H, copyConfigFiles as I, createHomebrewSymlink as J, detectInstalledVersion as K, LANG_LABELS as L, displayVerificationResult as M, ensureApiKeyApproved as N, ensureClaudeDir as O, executeInstallMethod as P, fixWindowsMcpConfig as Q, getAiOutputLanguageLabel as R, SETTINGS_FILE as S, getExistingApiConfig as T, getExistingModelConfig as U, getInstallationStatus as V, getMcpConfigPath as W, getPlatform as X, handleInstallFailure as Y, importRecommendedEnv as Z, importRecommendedPermissions as _, API_DEFAULT_URL as a, setupCcrConfiguration as a$, installClaudeCode as a0, installCodex as a1, isClaudeCodeInstalled as a2, isCodeToolType as a3, isCodexInstalled as a4, isLocalClaudeCodeInstalled as a5, manageApiKeyApproval as a6, mergeAndCleanPermissions as a7, mergeConfigs as a8, mergeMcpServers as a9, parseToml as aA, readFile as aB, ensureDir as aC, readDefaultTomlConfig as aD, createDefaultTomlConfig as aE, readJsonConfig as aF, writeTomlConfig as aG, clearModelEnv as aH, normalizeClaudeFamilySettings as aI, copyFile as aJ, detectConfigManagementMode as aK, readCodexConfig as aL, backupCodexComplete as aM, writeAuthFile as aN, CODEX_WORKFLOW_CONFIG_BASE as aO, updateCcjkConfig as aP, changeLanguage as aQ, applyRecommendedPermissionTier as aR, getPermissionTierLabel as aS, readCcjkConfig as aT, configureOutputStyle as aU, isClaudeFamilyCodeTool as aV, isWindows as aW, selectMcpServices as aX, getMcpServices as aY, isCcrInstalled as aZ, installCcr as a_, mergeSettingsFile as aa, openSettingsJson as ab, promptApiConfigurationAction as ac, readMcpConfig as ad, removeApiKeyFromRejected as ae, removeLocalClaudeCode as af, resolveCodeToolType as ag, resolveCodexHome as ah, selectInstallMethod as ai, setInstallMethod as aj, setPrimaryApiKey as ak, settingsFileForTool as al, switchToOfficialLogin$1 as am, uninstallCodeTool as an, updateCustomModel as ao, updateDefaultModel as ap, verifyInstallation as aq, writeMcpConfig as ar, ensureI18nInitialized as as, getActiveCodeTool as at, i18n as au, addNumbersToChoices as av, validateApiKey as aw, promptBoolean as ax, resolveClaudeFamilySettingsTarget as ay, exists as az, API_ENV_KEY as b, modifyApiConfigPartially as b0, formatApiKeyDisplay as b1, readCcrConfig as b2, configureCcrFeature as b3, handleExitPromptError as b4, handleGeneralError as b5, MCP_SERVICE_CONFIGS as b6, getBackupMessage as b7, deleteAllCodexMcpServices as b8, readDir as b9, getProviderProfile as bA, readCredentials as bB, readCcjkConfigAsync as bC, initI18n as bD, selectScriptLanguage as bE, index as bF, fsOperations as bG, jsonConfig as bH, claudeConfig as bI, clavueProviderProfile as bJ, config$1 as bK, config as bL, promptHelpers as bM, prompts as bN, codexProfileV2 as bO, codexTomlUpdater as bP, codex as bQ, installer as bR, isDirectory as ba, deleteCodexMcpService as bb, listCodexMcpServiceIds as bc, displayBanner as bd, runCodexUpdate as be, version as bf, resolveAiOutputLanguage as bg, updatePromptOnly as bh, selectAndInstallWorkflows as bi, checkClaudeCodeVersionAndPrompt as bj, runCodexWorkflowImportWithLanguageSelection as bk, runCodexFullInit as bl, manageCodexMcp as bm, configureCodexApi as bn, checkAndUpdateTools as bo, resolveCodeType as bp, writeJsonConfig as bq, STARTUP_CODE_TOOL_CHOICES as br, displayBannerWithInfo as bs, runCodexUninstall as bt, switchCodexProvider as bu, listCodexProviders as bv, switchToOfficialLogin as bw, switchToProvider as bx, listProviderProfiles as by, getActiveProviderProfileId as bz, CCJK_CONFIG_FILE as c, CLAUDE_DIR as d, CLAUDE_MD_FILE as e, CLAUDE_VSC_CONFIG_FILE as f, CLAVUE_CONFIG_FILE as g, CLAVUE_CREDENTIALS_FILE as h, CLAVUE_DIR$1 as i, CLAVUE_MD_FILE as j, CLAVUE_SETTINGS_FILE as k, CODEX_AGENTS_FILE as l, CODEX_AUTH_FILE as m, CODEX_CONFIG_FILE as n, CODEX_DIR as o, CODEX_PROMPTS_DIR as p, CODE_TOOL_ALIASES as q, CODE_TOOL_BANNERS as r, CODE_TOOL_TYPES as s, ClAUDE_CONFIG_FILE as t, LEGACY_CCJK_CONFIG_FILES as u, SUPPORTED_LANGS as v, activeSettingsFile as w, addCompletedOnboarding as x, applyAiLanguageDirective as y, backupExistingConfig as z };