@nalvietnam/avatar-cli 1.6.3 → 1.6.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/index.js CHANGED
@@ -1850,6 +1850,28 @@ import { spawnSync as spawnSync10 } from "child_process";
1850
1850
  import { existsSync as existsSync5 } from "fs";
1851
1851
  import { join as join14 } from "path";
1852
1852
  import { confirm as confirm2 } from "@inquirer/prompts";
1853
+
1854
+ // src/lib/detect-reasoning-model-from-name.ts
1855
+ var REASONING_PATTERNS = [
1856
+ // Anthropic Claude 4+ với extended thinking.
1857
+ // Match: claude-opus-4-7, claude-opus-4-8, claude-sonnet-4-5, claude-opus-4-1, ...
1858
+ /^claude-(opus|sonnet)-4/i,
1859
+ // Anthropic Claude 5+ (future-proof — assume reasoning theo trend).
1860
+ /^claude-(opus|sonnet|haiku)-[5-9]/i,
1861
+ // OpenAI o-series (o1, o3, o4).
1862
+ /^o1(-|$)/i,
1863
+ /^o3(-|$)/i,
1864
+ /^o4(-|$)/i,
1865
+ // LLMLite NAL alias mapping — phổ biến nal-claude-opus-* trỏ tới opus-4+.
1866
+ // (Conservative: chỉ match nếu name có chứa opus/sonnet + version số.)
1867
+ /nal-claude-(opus|sonnet)-?4/i
1868
+ ];
1869
+ function isReasoningModel(modelName) {
1870
+ if (!modelName) return false;
1871
+ return REASONING_PATTERNS.some((pattern) => pattern.test(modelName));
1872
+ }
1873
+
1874
+ // src/lib/run-gitnexus-wiki-conditional.ts
1853
1875
  var WIKI_TIMEOUT_MS = 15 * 60 * 1e3;
1854
1876
  var FALLBACK_LLMLITE_MODEL = "nal-claude";
1855
1877
  var FALLBACK_ANTHROPIC_MODEL = "claude-sonnet-4-5";
@@ -1919,19 +1941,29 @@ async function runGitnexusWikiConditional(workspacePath) {
1919
1941
  );
1920
1942
  return { ran: false, skipped: true, reason: "user-declined" };
1921
1943
  }
1944
+ const reasoningMode = isReasoningModel(creds.model);
1945
+ const args = [
1946
+ "wiki",
1947
+ ".",
1948
+ "--api-key",
1949
+ creds.apiKey,
1950
+ "--base-url",
1951
+ creds.baseUrl,
1952
+ "--model",
1953
+ creds.model
1954
+ ];
1955
+ if (reasoningMode) {
1956
+ args.push("--reasoning-model");
1957
+ }
1922
1958
  const sp = spinnerWithElapsed(
1923
- `Generating wiki via ${creds.baseUrl} (${creds.provider}) model=${creds.model}`
1924
- );
1925
- const result = spawnSync10(
1926
- "gitnexus",
1927
- ["wiki", ".", "--api-key", creds.apiKey, "--base-url", creds.baseUrl, "--model", creds.model],
1928
- {
1929
- cwd: workspacePath,
1930
- stdio: ["ignore", "pipe", "pipe"],
1931
- timeout: WIKI_TIMEOUT_MS,
1932
- encoding: "utf8"
1933
- }
1959
+ `Generating wiki via ${creds.baseUrl} (${creds.provider}) model=${creds.model}${reasoningMode ? " [reasoning]" : ""}`
1934
1960
  );
1961
+ const result = spawnSync10("gitnexus", args, {
1962
+ cwd: workspacePath,
1963
+ stdio: ["ignore", "pipe", "pipe"],
1964
+ timeout: WIKI_TIMEOUT_MS,
1965
+ encoding: "utf8"
1966
+ });
1935
1967
  if (result.status !== 0 || result.signal === "SIGTERM") {
1936
1968
  const reason = result.signal === "SIGTERM" ? "timeout" : "non-zero-exit";
1937
1969
  sp.fail(`Wiki gen ${reason} (exit ${result.status ?? "null"})`);
@@ -4808,7 +4840,7 @@ async function removeSubmoduleEntry(gitmodulesPath, submodulePath) {
4808
4840
  }
4809
4841
 
4810
4842
  // src/commands/uninstall.ts
4811
- var CLI_VERSION = "1.6.3";
4843
+ var CLI_VERSION = "1.6.4";
4812
4844
  function registerUninstallCommand(program2) {
4813
4845
  program2.command("uninstall").description("G\u1EE1 Avatar kh\u1ECFi project \u2014 backup t\u1EF1 \u0111\u1ED9ng (M11)").option("--yes", "Skip confirm prompt").option("--no-backup", "Kh\xF4ng t\u1EA1o backup tr\u01B0\u1EDBc khi x\xF3a (nguy hi\u1EC3m)").option("--keep-submodule", "Gi\u1EEF submodule .claude/pack/").option("--keep-hooks", "Gi\u1EEF git hooks post-merge, pre-push").option("--dry-run", "Hi\u1EC3n th\u1ECB danh s\xE1ch s\u1EBD x\xF3a, kh\xF4ng th\u1EF1c thi").action(async (opts) => {
4814
4846
  try {
@@ -4890,7 +4922,7 @@ function printUninstallSuccessBox(backupPath) {
4890
4922
  }
4891
4923
 
4892
4924
  // src/index.ts
4893
- var CLI_VERSION2 = "1.6.3";
4925
+ var CLI_VERSION2 = "1.6.4";
4894
4926
  var program = new Command();
4895
4927
  program.name("avatar").description("AI harness CLI for NAL Vietnam engineering").version(CLI_VERSION2, "-v, --version", "Hi\u1EC3n th\u1ECB phi\xEAn b\u1EA3n Avatar CLI").addHelpText(
4896
4928
  "beforeAll",