@sunasteriskrnd/takumi 1.0.0-dev.6 → 1.0.0-dev.8

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 (2) hide show
  1. package/dist/index.js +114 -3
  2. package/package.json +2 -1
package/dist/index.js CHANGED
@@ -64049,6 +64049,94 @@ async function maybeShowConfigUpdateNotification(claudeDir, global3) {
64049
64049
  init_package_installer();
64050
64050
  init_logger();
64051
64051
 
64052
+ // src/domains/ui/prompts/agent-selection-prompts.ts
64053
+ init_provider_registry();
64054
+
64055
+ // src/services/package-installer/agent-cli-detector.ts
64056
+ init_process_executor();
64057
+ var DETECT_TIMEOUT_MS = 5000;
64058
+ var BINARY_CANDIDATES = {
64059
+ "claude-code": process.platform === "win32" ? ["claude.exe", "claude.cmd", "claude"] : ["claude"],
64060
+ codex: process.platform === "win32" ? ["codex.exe", "codex.cmd", "codex"] : ["codex"]
64061
+ };
64062
+ async function probeBinary(candidates) {
64063
+ for (const bin of candidates) {
64064
+ const needsShell = process.platform === "win32" && /\.(cmd|bat)$/i.test(bin);
64065
+ try {
64066
+ const { stdout: stdout2 } = await execFileAsync5(bin, ["--version"], {
64067
+ timeout: DETECT_TIMEOUT_MS,
64068
+ encoding: "utf8",
64069
+ shell: needsShell
64070
+ });
64071
+ return typeof stdout2 === "string" ? stdout2 : String(stdout2);
64072
+ } catch {}
64073
+ }
64074
+ return null;
64075
+ }
64076
+ function extractVersion(stdout2) {
64077
+ const match2 = stdout2.match(/(\d+\.\d+\.\d+(?:[-+][\w.]+)?)/);
64078
+ return match2 ? match2[1] : undefined;
64079
+ }
64080
+ async function detectAgentInstallations(providers2) {
64081
+ const probes = providers2.filter((p) => (p in BINARY_CANDIDATES)).map(async (provider) => {
64082
+ const candidates = BINARY_CANDIDATES[provider];
64083
+ if (!candidates) {
64084
+ return [provider, { installed: false }];
64085
+ }
64086
+ const stdout2 = await probeBinary(candidates);
64087
+ const detection = stdout2 ? { installed: true, version: extractVersion(stdout2) } : { installed: false };
64088
+ return [provider, detection];
64089
+ });
64090
+ const entries = await Promise.all(probes);
64091
+ const result = {};
64092
+ for (const [provider, detection] of entries) {
64093
+ result[provider] = detection;
64094
+ }
64095
+ return result;
64096
+ }
64097
+
64098
+ // src/domains/ui/prompts/agent-selection-prompts.ts
64099
+ function buildDetectionNote(supported, detections) {
64100
+ const lines = supported.map((provider) => {
64101
+ const detection = detections[provider];
64102
+ const label = providers[provider]?.displayName ?? provider;
64103
+ if (detection?.installed) {
64104
+ const version3 = detection.version ? ` v${detection.version}` : "";
64105
+ return ` ✓ ${label}${version3} detected on PATH`;
64106
+ }
64107
+ return ` ✗ ${label} not detected on PATH`;
64108
+ });
64109
+ lines.push("");
64110
+ lines.push("Init writes config files regardless — detection only informs defaults.");
64111
+ return lines.join(`
64112
+ `);
64113
+ }
64114
+ function computeInitialSelection(supported, detections) {
64115
+ if (detections["claude-code"]?.installed)
64116
+ return ["claude-code"];
64117
+ const firstInstalled = supported.find((p) => detections[p]?.installed);
64118
+ return firstInstalled ? [firstInstalled] : [];
64119
+ }
64120
+ async function promptAgentSelection(supported) {
64121
+ const detections = await detectAgentInstallations(supported);
64122
+ note(buildDetectionNote(supported, detections), "Detected agent CLIs");
64123
+ const options2 = supported.map((provider) => {
64124
+ const detection = detections[provider];
64125
+ const label = providers[provider]?.displayName ?? provider;
64126
+ const hint = detection?.installed ? detection.version ? `installed v${detection.version}` : "installed" : "not detected — config will still be written";
64127
+ return { value: provider, label, hint };
64128
+ });
64129
+ const initialValues = computeInitialSelection(supported, detections);
64130
+ const selected = await ae({
64131
+ message: "Select agent(s) to initialize",
64132
+ options: options2,
64133
+ required: true,
64134
+ initialValues
64135
+ });
64136
+ if (lD(selected))
64137
+ return null;
64138
+ return selected;
64139
+ }
64052
64140
  // src/domains/ui/prompts/kit-prompts.ts
64053
64141
  init_types2();
64054
64142
  async function selectKit(defaultKit, accessibleKits) {
@@ -64805,6 +64893,9 @@ class PromptsManager {
64805
64893
  async promptSkillsInstallation() {
64806
64894
  return promptSkillsInstallation();
64807
64895
  }
64896
+ async promptAgentSelection(supported) {
64897
+ return promptAgentSelection(supported);
64898
+ }
64808
64899
  showPackageInstallationResults(results) {
64809
64900
  const successfulInstalls = [];
64810
64901
  const failedInstalls = [];
@@ -69547,6 +69638,7 @@ init_logger();
69547
69638
  init_types2();
69548
69639
  async function resolveOptions(ctx) {
69549
69640
  const explicitDir = ctx.rawOptions.dir !== undefined;
69641
+ const explicitAgents = Array.isArray(ctx.rawOptions.agents) && ctx.rawOptions.agents.length > 0;
69550
69642
  const parsed = UpdateCommandOptionsSchema.parse(ctx.rawOptions);
69551
69643
  const validOptions = {
69552
69644
  kit: parsed.kit,
@@ -69589,8 +69681,6 @@ async function resolveOptions(ctx) {
69589
69681
  ` + "For other agents, run init without --sync to perform a fresh install.");
69590
69682
  }
69591
69683
  validOptions.agents = Array.from(new Set(validOptions.agents));
69592
- } else {
69593
- validOptions.agents = ["claude-code"];
69594
69684
  }
69595
69685
  ConfigManager.setGlobalFlag(validOptions.global);
69596
69686
  if (validOptions.global) {
@@ -69639,6 +69729,26 @@ Choose one approach.`);
69639
69729
  logger.info("Running in non-interactive mode (--yes flag)");
69640
69730
  }
69641
69731
  const initialInstallSkills = validOptions.installSkills ? true : undefined;
69732
+ if (!explicitAgents) {
69733
+ if (isNonInteractive2) {
69734
+ validOptions.agents = ["claude-code"];
69735
+ } else {
69736
+ const supported = listSupportedProviders();
69737
+ const selected = await ctx.prompts.promptAgentSelection(supported);
69738
+ if (selected === null) {
69739
+ logger.warning("Agent selection cancelled");
69740
+ return {
69741
+ ...ctx,
69742
+ options: validOptions,
69743
+ explicitDir,
69744
+ isNonInteractive: isNonInteractive2,
69745
+ installSkills: initialInstallSkills,
69746
+ cancelled: true
69747
+ };
69748
+ }
69749
+ validOptions.agents = selected;
69750
+ }
69751
+ }
69642
69752
  return {
69643
69753
  ...ctx,
69644
69754
  options: validOptions,
@@ -76199,7 +76309,7 @@ var import_fs_extra39 = __toESM(require_lib(), 1);
76199
76309
  // package.json
76200
76310
  var package_default = {
76201
76311
  name: "@sunasteriskrnd/takumi",
76202
- version: "1.0.0-dev.6",
76312
+ version: "1.0.0-dev.8",
76203
76313
  description: "CLI tool for bootstrapping and managing Takumi projects",
76204
76314
  type: "module",
76205
76315
  repository: {
@@ -76222,6 +76332,7 @@ var package_default = {
76222
76332
  build: `bun build src/index.ts --outdir dist --target node --external @octokit/rest --external better-sqlite3 --external yauzl-promise --external @node-rs/crc32 && node -e "const fs=require('fs'),f='dist/index.js',c=fs.readFileSync(f,'utf-8');fs.writeFileSync(f,c.replace(/^#!.*\\n\\/\\/ @bun\\n/,''))"`,
76223
76333
  "verify:package": "node scripts/prepublish-check.js",
76224
76334
  test: "bun test",
76335
+ "test:ci": "NON_INTERACTIVE=true CI_SAFE_MODE=true bun test",
76225
76336
  "test:integration": "CK_RUN_CLI_INTEGRATION=1 bun test tests/integration/cli.test.ts",
76226
76337
  "test:watch": "bun test --watch",
76227
76338
  "test:quick": "./scripts/dev-quick-start.sh test",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sunasteriskrnd/takumi",
3
- "version": "1.0.0-dev.6",
3
+ "version": "1.0.0-dev.8",
4
4
  "description": "CLI tool for bootstrapping and managing Takumi projects",
5
5
  "type": "module",
6
6
  "repository": {
@@ -23,6 +23,7 @@
23
23
  "build": "bun build src/index.ts --outdir dist --target node --external @octokit/rest --external better-sqlite3 --external yauzl-promise --external @node-rs/crc32 && node -e \"const fs=require('fs'),f='dist/index.js',c=fs.readFileSync(f,'utf-8');fs.writeFileSync(f,c.replace(/^#!.*\\n\\/\\/ @bun\\n/,''))\"",
24
24
  "verify:package": "node scripts/prepublish-check.js",
25
25
  "test": "bun test",
26
+ "test:ci": "NON_INTERACTIVE=true CI_SAFE_MODE=true bun test",
26
27
  "test:integration": "CK_RUN_CLI_INTEGRATION=1 bun test tests/integration/cli.test.ts",
27
28
  "test:watch": "bun test --watch",
28
29
  "test:quick": "./scripts/dev-quick-start.sh test",