@iruidong/code 0.1.2 → 0.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/QUICKSTART.md CHANGED
@@ -10,7 +10,7 @@ ruidong --version
10
10
  Expected output:
11
11
 
12
12
  ```bash
13
- Ruidong Code v0.1.2
13
+ Ruidong Code v0.1.4
14
14
  ```
15
15
 
16
16
  ## 2. Initialize provider config
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- // ruidong v0.1.2 (built from source)
2
+ // ruidong v0.1.4 (built from source)
3
3
  // Copyright (c) Anthropic PBC. All rights reserved.
4
4
  import { createRequire as __createRequire } from "module";const require=__createRequire(import.meta.url);
5
5
  var __defProp = Object.defineProperty;
@@ -81,7 +81,7 @@ var __callDispose = (stack, error, hasError) => {
81
81
  var PUBLIC_CLI_VERSION, BUILD_TIME, API_COMPAT_VERSION, API_COMPAT_VERSION_BASE;
82
82
  var init_version = __esm({
83
83
  "build-src/src/constants/version.ts"() {
84
- PUBLIC_CLI_VERSION = "0.1.2";
84
+ PUBLIC_CLI_VERSION = "0.1.4";
85
85
  BUILD_TIME = "2026-04-01T06:00:31.912Z";
86
86
  API_COMPAT_VERSION = "2.1.88";
87
87
  API_COMPAT_VERSION_BASE = API_COMPAT_VERSION.match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/)?.[0];
@@ -13083,15 +13083,15 @@ function setEnvIfUnset(key, value) {
13083
13083
  }
13084
13084
  process.env[key] = value;
13085
13085
  }
13086
- function applyProviderFlags(providerId) {
13087
- const providerFlagKeys = [
13088
- "CLAUDE_CODE_USE_BEDROCK",
13089
- "CLAUDE_CODE_USE_VERTEX",
13090
- "CLAUDE_CODE_USE_FOUNDRY"
13091
- ];
13092
- if (providerFlagKeys.some((key) => process.env[key] !== void 0)) {
13086
+ function setManagedEnv(key, value) {
13087
+ const normalizedValue = value?.trim();
13088
+ if (!normalizedValue) {
13089
+ delete process.env[key];
13093
13090
  return;
13094
13091
  }
13092
+ process.env[key] = normalizedValue;
13093
+ }
13094
+ function applyProviderFlags(providerId) {
13095
13095
  switch (providerId) {
13096
13096
  case "bedrock":
13097
13097
  process.env.CLAUDE_CODE_USE_BEDROCK = "1";
@@ -13115,6 +13115,39 @@ function applyProviderFlags(providerId) {
13115
13115
  break;
13116
13116
  }
13117
13117
  }
13118
+ function selectConfiguredCredential(provider) {
13119
+ const hasConfiguredApiKey = provider.apiKey !== void 0;
13120
+ const hasConfiguredAuthToken = provider.authToken !== void 0;
13121
+ if (!hasConfiguredApiKey && !hasConfiguredAuthToken) {
13122
+ return null;
13123
+ }
13124
+ const authMode = provider.authMode ?? "auto";
13125
+ if (authMode === "api-key") {
13126
+ return "api-key";
13127
+ }
13128
+ if (authMode === "bearer") {
13129
+ return "bearer";
13130
+ }
13131
+ if (hasConfiguredAuthToken) {
13132
+ return "bearer";
13133
+ }
13134
+ return "api-key";
13135
+ }
13136
+ function applyProviderCredentialEnv(provider) {
13137
+ const selectedCredential = selectConfiguredCredential(provider);
13138
+ if (!selectedCredential) {
13139
+ return;
13140
+ }
13141
+ const resolvedApiKey = resolveSecretValue(provider.apiKey);
13142
+ const resolvedAuthToken = resolveSecretValue(provider.authToken);
13143
+ if (selectedCredential === "api-key") {
13144
+ setManagedEnv("ANTHROPIC_API_KEY", resolvedApiKey ?? resolvedAuthToken);
13145
+ delete process.env.ANTHROPIC_AUTH_TOKEN;
13146
+ return;
13147
+ }
13148
+ setManagedEnv("ANTHROPIC_AUTH_TOKEN", resolvedAuthToken ?? resolvedApiKey);
13149
+ delete process.env.ANTHROPIC_API_KEY;
13150
+ }
13118
13151
  function applyOfficialMarketplaceConfig(official) {
13119
13152
  if (!official) {
13120
13153
  return;
@@ -13156,11 +13189,16 @@ function applyRuidongRuntimeConfig() {
13156
13189
  const provider = config2.provider;
13157
13190
  if (provider) {
13158
13191
  applyProviderFlags(provider.id);
13159
- setEnvIfUnset("ANTHROPIC_BASE_URL", provider.baseUrl);
13160
- setEnvIfUnset("ANTHROPIC_API_KEY", resolveSecretValue(provider.apiKey));
13161
- setEnvIfUnset("ANTHROPIC_AUTH_TOKEN", resolveSecretValue(provider.authToken));
13162
- setEnvIfUnset("ANTHROPIC_AUTH_MODE", provider.authMode ?? "auto");
13163
- setEnvIfUnset("ANTHROPIC_MODEL", provider.defaultModel);
13192
+ if (provider.baseUrl !== void 0) {
13193
+ setManagedEnv("ANTHROPIC_BASE_URL", provider.baseUrl);
13194
+ }
13195
+ applyProviderCredentialEnv(provider);
13196
+ if (provider.authMode !== void 0) {
13197
+ setManagedEnv("ANTHROPIC_AUTH_MODE", provider.authMode);
13198
+ }
13199
+ if (provider.defaultModel !== void 0) {
13200
+ setManagedEnv("ANTHROPIC_MODEL", provider.defaultModel);
13201
+ }
13164
13202
  }
13165
13203
  applyOfficialMarketplaceConfig(config2.marketplace?.official);
13166
13204
  setEnvIfUnset(
@@ -75104,7 +75142,7 @@ async function setupSdkMcpClients(sdkMcpConfigs, sendMcpMessage) {
75104
75142
  {
75105
75143
  name: "ruidong-code",
75106
75144
  title: "ruidong",
75107
- version: "0.1.2",
75145
+ version: "0.1.4",
75108
75146
  description: "Ruidong Code agentic coding tool",
75109
75147
  websiteUrl: PRODUCT_URL
75110
75148
  },
@@ -75527,7 +75565,7 @@ var init_client3 = __esm({
75527
75565
  {
75528
75566
  name: "ruidong-code",
75529
75567
  title: "ruidong",
75530
- version: "0.1.2",
75568
+ version: "0.1.4",
75531
75569
  description: "Ruidong Code agentic coding tool",
75532
75570
  websiteUrl: PRODUCT_URL
75533
75571
  },
@@ -86958,6 +86996,7 @@ var init_shellConfig = __esm({
86958
86996
 
86959
86997
  // build-src/src/utils/autoUpdater.ts
86960
86998
  import axios20 from "axios";
86999
+ import { spawnSync as spawnSync2 } from "node:child_process";
86961
87000
  import { constants as fsConstants2 } from "fs";
86962
87001
  import { access as access2, writeFile as writeFile11 } from "fs/promises";
86963
87002
  import { homedir as homedir18 } from "os";
@@ -87141,13 +87180,27 @@ async function checkGlobalInstallPermissions() {
87141
87180
  return { hasPermissions: false, npmPrefix: null };
87142
87181
  }
87143
87182
  }
87183
+ async function execNpmView(args) {
87184
+ const result = spawnSync2("npm", args, {
87185
+ cwd: homedir18(),
87186
+ timeout: 5e3,
87187
+ maxBuffer: 1e6,
87188
+ encoding: "utf8"
87189
+ });
87190
+ return {
87191
+ stdout: result.stdout ?? "",
87192
+ stderr: result.stderr ?? "",
87193
+ code: result.status ?? (result.error ? 1 : 0)
87194
+ };
87195
+ }
87144
87196
  async function getLatestVersion(channel) {
87145
87197
  const npmTag = channel === "stable" ? "stable" : "latest";
87146
- const result = await execFileNoThrowWithCwd(
87147
- "npm",
87148
- ["view", `${PACKAGE_NAME}@${npmTag}`, "version", "--prefer-online"],
87149
- { abortSignal: AbortSignal.timeout(5e3), cwd: homedir18() }
87150
- );
87198
+ const result = await execNpmView([
87199
+ "view",
87200
+ `${PACKAGE_NAME}@${npmTag}`,
87201
+ "version",
87202
+ "--prefer-online"
87203
+ ]);
87151
87204
  if (result.code !== 0) {
87152
87205
  logForDebugging(`npm view failed with code ${result.code}`);
87153
87206
  if (result.stderr) {
@@ -87163,11 +87216,13 @@ async function getLatestVersion(channel) {
87163
87216
  return result.stdout.trim();
87164
87217
  }
87165
87218
  async function getNpmDistTags() {
87166
- const result = await execFileNoThrowWithCwd(
87167
- "npm",
87168
- ["view", PACKAGE_NAME, "dist-tags", "--json", "--prefer-online"],
87169
- { abortSignal: AbortSignal.timeout(5e3), cwd: homedir18() }
87170
- );
87219
+ const result = await execNpmView([
87220
+ "view",
87221
+ PACKAGE_NAME,
87222
+ "dist-tags",
87223
+ "--json",
87224
+ "--prefer-online"
87225
+ ]);
87171
87226
  if (result.code !== 0) {
87172
87227
  logForDebugging(`npm view dist-tags failed with code ${result.code}`);
87173
87228
  return { latest: null, stable: null };
@@ -87209,7 +87264,7 @@ async function installGlobalPackage(specificVersion) {
87209
87264
  );
87210
87265
  logEvent("tengu_auto_updater_lock_contention", {
87211
87266
  pid: process.pid,
87212
- currentVersion: "0.1.2"
87267
+ currentVersion: "0.1.4"
87213
87268
  });
87214
87269
  return "in_progress";
87215
87270
  }
@@ -87218,7 +87273,7 @@ async function installGlobalPackage(specificVersion) {
87218
87273
  if (!env.isRunningWithBun() && env.isNpmFromWindowsPath()) {
87219
87274
  logError(new Error("Windows NPM detected in WSL environment"));
87220
87275
  logEvent("tengu_auto_updater_windows_npm_in_wsl", {
87221
- currentVersion: "0.1.2"
87276
+ currentVersion: "0.1.4"
87222
87277
  });
87223
87278
  console.error(`
87224
87279
  Error: Windows NPM detected in WSL
@@ -87885,7 +87940,7 @@ function detectLinuxGlobPatternWarnings() {
87885
87940
  }
87886
87941
  async function getDoctorDiagnostic() {
87887
87942
  const installationType = await getCurrentInstallationType();
87888
- const version2 = typeof MACRO !== "undefined" && "0.1.2" ? "0.1.2" : "unknown";
87943
+ const version2 = typeof MACRO !== "undefined" && "0.1.4" ? "0.1.4" : "unknown";
87889
87944
  const installationPath = await getInstallationPath();
87890
87945
  const invokedBinary = getInvokedBinary();
87891
87946
  const multipleInstallations = await detectMultipleInstallations();
@@ -88965,7 +89020,7 @@ async function updateLatest(channelOrVersion, forceReinstall = false) {
88965
89020
  version2 = maxVersion;
88966
89021
  }
88967
89022
  }
88968
- if (!forceReinstall && version2 === "0.1.2" && await versionIsAvailable(version2) && await isPossibleClaudeBinary(executablePath)) {
89023
+ if (!forceReinstall && version2 === "0.1.4" && await versionIsAvailable(version2) && await isPossibleClaudeBinary(executablePath)) {
88969
89024
  logForDebugging(`Found ${version2} at ${executablePath}, skipping install`);
88970
89025
  logEvent("tengu_native_update_complete", {
88971
89026
  latency_ms: Date.now() - startTime,
@@ -144008,7 +144063,7 @@ __export(voice_exports2, {
144008
144063
  startRecording: () => startRecording,
144009
144064
  stopRecording: () => stopRecording
144010
144065
  });
144011
- import { spawn as spawn4, spawnSync as spawnSync2 } from "child_process";
144066
+ import { spawn as spawn4, spawnSync as spawnSync3 } from "child_process";
144012
144067
  import { readFile as readFile25 } from "fs/promises";
144013
144068
  function loadAudioNapi() {
144014
144069
  audioNapiPromise ??= (async () => {
@@ -144022,7 +144077,7 @@ function loadAudioNapi() {
144022
144077
  return audioNapiPromise;
144023
144078
  }
144024
144079
  function hasCommand2(cmd) {
144025
- const result = spawnSync2(cmd, ["--version"], {
144080
+ const result = spawnSync3(cmd, ["--version"], {
144026
144081
  stdio: "ignore",
144027
144082
  timeout: 3e3
144028
144083
  });
@@ -187817,7 +187872,7 @@ ${sanitizedDescription}
187817
187872
  **Environment Info**
187818
187873
  - Platform: ${env.platform}
187819
187874
  - Terminal: ${env.terminal}
187820
- - Version: ${"0.1.2"}
187875
+ - Version: ${"0.1.4"}
187821
187876
  - Feedback ID: ${feedbackId}
187822
187877
 
187823
187878
  **Errors**
@@ -200449,7 +200504,7 @@ var init_MemoryUpdateNotification = __esm({
200449
200504
  // build-src/src/utils/editor.ts
200450
200505
  import {
200451
200506
  spawn as spawn5,
200452
- spawnSync as spawnSync3
200507
+ spawnSync as spawnSync4
200453
200508
  } from "child_process";
200454
200509
  import memoize61 from "lodash-es/memoize.js";
200455
200510
  import { basename as basename37 } from "path";
@@ -200499,7 +200554,7 @@ function openFileInExternalEditor(filePath, line) {
200499
200554
  let result;
200500
200555
  if (process.platform === "win32") {
200501
200556
  const lineArg = useGotoLine ? `+${line} ` : "";
200502
- result = spawnSync3(`${editor} ${lineArg}"${filePath}"`, {
200557
+ result = spawnSync4(`${editor} ${lineArg}"${filePath}"`, {
200503
200558
  ...syncOpts,
200504
200559
  shell: true
200505
200560
  });
@@ -200508,7 +200563,7 @@ function openFileInExternalEditor(filePath, line) {
200508
200563
  ...editorArgs,
200509
200564
  ...useGotoLine ? [`+${line}`, filePath] : [filePath]
200510
200565
  ];
200511
- result = spawnSync3(base, args, syncOpts);
200566
+ result = spawnSync4(base, args, syncOpts);
200512
200567
  }
200513
200568
  if (result.error) {
200514
200569
  logForDebugging(`editor spawn failed: ${result.error}`, {
@@ -254125,7 +254180,7 @@ function generateHtmlReport(data, insights) {
254125
254180
  </html>`;
254126
254181
  }
254127
254182
  function buildExportData(data, insights, facets, remoteStats) {
254128
- const version2 = typeof MACRO !== "undefined" ? "0.1.2" : "unknown";
254183
+ const version2 = typeof MACRO !== "undefined" ? "0.1.4" : "unknown";
254129
254184
  const remote_hosts_collected = remoteStats?.hosts.filter((h) => h.sessionCount > 0).map((h) => h.name);
254130
254185
  const facets_summary = {
254131
254186
  total: facets.size,
@@ -257889,7 +257944,7 @@ var init_sessionStorage = __esm({
257889
257944
  init_settings2();
257890
257945
  init_slowOperations();
257891
257946
  init_uuid();
257892
- VERSION2 = typeof MACRO !== "undefined" ? "0.1.2" : "unknown";
257947
+ VERSION2 = typeof MACRO !== "undefined" ? "0.1.4" : "unknown";
257893
257948
  MAX_TOMBSTONE_REWRITE_BYTES = 50 * 1024 * 1024;
257894
257949
  SKIP_FIRST_PROMPT_PATTERN = /^(?:\s*<[a-z][\w-]*[\s>]|\[Request interrupted by user[^\]]*\])/;
257895
257950
  EPHEMERAL_PROGRESS_TYPES = /* @__PURE__ */ new Set([
@@ -264653,7 +264708,7 @@ __export(worktree_exports, {
264653
264708
  worktreeBranchName: () => worktreeBranchName
264654
264709
  });
264655
264710
  import chalk38 from "chalk";
264656
- import { spawnSync as spawnSync4 } from "child_process";
264711
+ import { spawnSync as spawnSync5 } from "child_process";
264657
264712
  import {
264658
264713
  copyFile as copyFile10,
264659
264714
  mkdir as mkdir41,
@@ -265352,7 +265407,7 @@ async function execIntoTmuxWorktree(args) {
265352
265407
  error: "Error: --tmux is not supported on Windows"
265353
265408
  };
265354
265409
  }
265355
- const tmuxCheck = spawnSync4("tmux", ["-V"], { encoding: "utf-8" });
265410
+ const tmuxCheck = spawnSync5("tmux", ["-V"], { encoding: "utf-8" });
265356
265411
  if (tmuxCheck.status !== 0) {
265357
265412
  const installHint = process.platform === "darwin" ? "Install tmux with: brew install tmux" : "Install tmux with: sudo apt install tmux";
265358
265413
  return {
@@ -265459,7 +265514,7 @@ async function execIntoTmuxWorktree(args) {
265459
265514
  newArgs.push(arg);
265460
265515
  }
265461
265516
  let tmuxPrefix = "C-b";
265462
- const prefixResult = spawnSync4("tmux", ["show-options", "-g", "prefix"], {
265517
+ const prefixResult = spawnSync5("tmux", ["show-options", "-g", "prefix"], {
265463
265518
  encoding: "utf-8"
265464
265519
  });
265465
265520
  if (prefixResult.status === 0 && prefixResult.stdout) {
@@ -265486,7 +265541,7 @@ async function execIntoTmuxWorktree(args) {
265486
265541
  CLAUDE_CODE_TMUX_PREFIX: tmuxPrefix,
265487
265542
  CLAUDE_CODE_TMUX_PREFIX_CONFLICTS: prefixConflicts ? "1" : ""
265488
265543
  };
265489
- const hasSessionResult = spawnSync4(
265544
+ const hasSessionResult = spawnSync5(
265490
265545
  "tmux",
265491
265546
  ["has-session", "-t", tmuxSessionName],
265492
265547
  { encoding: "utf-8" }
@@ -265510,7 +265565,7 @@ ${y("\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2
265510
265565
  const isClaudeCliInternal = repoName === "claude-cli-internal";
265511
265566
  const shouldSetupDevPanes = isAnt && isClaudeCliInternal && !sessionExists;
265512
265567
  if (shouldSetupDevPanes) {
265513
- spawnSync4(
265568
+ spawnSync5(
265514
265569
  "tmux",
265515
265570
  [
265516
265571
  "new-session",
@@ -265526,33 +265581,33 @@ ${y("\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2
265526
265581
  ],
265527
265582
  { cwd: worktreeDir, env: tmuxEnv }
265528
265583
  );
265529
- spawnSync4(
265584
+ spawnSync5(
265530
265585
  "tmux",
265531
265586
  ["split-window", "-h", "-t", tmuxSessionName, "-c", worktreeDir],
265532
265587
  { cwd: worktreeDir }
265533
265588
  );
265534
- spawnSync4(
265589
+ spawnSync5(
265535
265590
  "tmux",
265536
265591
  ["send-keys", "-t", tmuxSessionName, "bun run watch", "Enter"],
265537
265592
  { cwd: worktreeDir }
265538
265593
  );
265539
- spawnSync4(
265594
+ spawnSync5(
265540
265595
  "tmux",
265541
265596
  ["split-window", "-v", "-t", tmuxSessionName, "-c", worktreeDir],
265542
265597
  { cwd: worktreeDir }
265543
265598
  );
265544
- spawnSync4("tmux", ["send-keys", "-t", tmuxSessionName, "bun run start"], {
265599
+ spawnSync5("tmux", ["send-keys", "-t", tmuxSessionName, "bun run start"], {
265545
265600
  cwd: worktreeDir
265546
265601
  });
265547
- spawnSync4("tmux", ["select-pane", "-t", `${tmuxSessionName}:0.0`], {
265602
+ spawnSync5("tmux", ["select-pane", "-t", `${tmuxSessionName}:0.0`], {
265548
265603
  cwd: worktreeDir
265549
265604
  });
265550
265605
  if (isAlreadyInTmux) {
265551
- spawnSync4("tmux", ["switch-client", "-t", tmuxSessionName], {
265606
+ spawnSync5("tmux", ["switch-client", "-t", tmuxSessionName], {
265552
265607
  stdio: "inherit"
265553
265608
  });
265554
265609
  } else {
265555
- spawnSync4(
265610
+ spawnSync5(
265556
265611
  "tmux",
265557
265612
  [...tmuxGlobalArgs, "attach-session", "-t", tmuxSessionName],
265558
265613
  {
@@ -265564,11 +265619,11 @@ ${y("\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2
265564
265619
  } else {
265565
265620
  if (isAlreadyInTmux) {
265566
265621
  if (sessionExists) {
265567
- spawnSync4("tmux", ["switch-client", "-t", tmuxSessionName], {
265622
+ spawnSync5("tmux", ["switch-client", "-t", tmuxSessionName], {
265568
265623
  stdio: "inherit"
265569
265624
  });
265570
265625
  } else {
265571
- spawnSync4(
265626
+ spawnSync5(
265572
265627
  "tmux",
265573
265628
  [
265574
265629
  "new-session",
@@ -265584,7 +265639,7 @@ ${y("\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2
265584
265639
  ],
265585
265640
  { cwd: worktreeDir, env: tmuxEnv }
265586
265641
  );
265587
- spawnSync4("tmux", ["switch-client", "-t", tmuxSessionName], {
265642
+ spawnSync5("tmux", ["switch-client", "-t", tmuxSessionName], {
265588
265643
  stdio: "inherit"
265589
265644
  });
265590
265645
  }
@@ -265603,7 +265658,7 @@ ${y("\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2
265603
265658
  process.execPath,
265604
265659
  ...newArgs
265605
265660
  ];
265606
- spawnSync4("tmux", tmuxArgs, {
265661
+ spawnSync5("tmux", tmuxArgs, {
265607
265662
  stdio: "inherit",
265608
265663
  cwd: worktreeDir,
265609
265664
  env: tmuxEnv
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iruidong/code",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Ruidong Code CLI for anthropic-compatible coding workflows",
5
5
  "type": "module",
6
6
  "private": false,