@nalvietnam/avatar-cli 1.6.0 → 1.6.1
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
|
@@ -1852,17 +1852,41 @@ import { join as join14 } from "path";
|
|
|
1852
1852
|
import { confirm as confirm2 } from "@inquirer/prompts";
|
|
1853
1853
|
var WIKI_TIMEOUT_MS = 15 * 60 * 1e3;
|
|
1854
1854
|
var DEFAULT_LLMLITE_MODEL = "nal-claude";
|
|
1855
|
+
var DEFAULT_ANTHROPIC_MODEL = "claude-sonnet-4-5";
|
|
1856
|
+
function normalizeAnthropicBaseUrl(rawBaseUrl) {
|
|
1857
|
+
const cleaned = rawBaseUrl.replace(/\/+$/, "");
|
|
1858
|
+
if (cleaned.endsWith("/v1")) return `${cleaned}/`;
|
|
1859
|
+
if (cleaned.endsWith("/v1/")) return cleaned;
|
|
1860
|
+
return `${cleaned}/v1/`;
|
|
1861
|
+
}
|
|
1855
1862
|
async function readSettingsForWikiCredentials(workspacePath) {
|
|
1856
1863
|
const settingsPath = join14(workspacePath, ".claude", "settings.json");
|
|
1857
1864
|
if (!await pathExists(settingsPath)) return null;
|
|
1858
1865
|
try {
|
|
1859
1866
|
const settings = await readJson(settingsPath);
|
|
1860
1867
|
const env = settings.env || {};
|
|
1861
|
-
const apiKey = typeof env.ANTHROPIC_AUTH_TOKEN === "string" ? env.ANTHROPIC_AUTH_TOKEN : null;
|
|
1862
1868
|
const baseUrl = typeof env.ANTHROPIC_BASE_URL === "string" ? env.ANTHROPIC_BASE_URL : null;
|
|
1863
|
-
if (!
|
|
1864
|
-
const
|
|
1865
|
-
|
|
1869
|
+
if (!baseUrl) return null;
|
|
1870
|
+
const userModel = typeof env.ANTHROPIC_MODEL === "string" ? env.ANTHROPIC_MODEL : "";
|
|
1871
|
+
const anthropicKey = typeof env.ANTHROPIC_API_KEY === "string" ? env.ANTHROPIC_API_KEY : null;
|
|
1872
|
+
if (anthropicKey) {
|
|
1873
|
+
return {
|
|
1874
|
+
provider: "anthropic",
|
|
1875
|
+
apiKey: anthropicKey,
|
|
1876
|
+
baseUrl: normalizeAnthropicBaseUrl(baseUrl),
|
|
1877
|
+
model: userModel.length > 0 ? userModel : DEFAULT_ANTHROPIC_MODEL
|
|
1878
|
+
};
|
|
1879
|
+
}
|
|
1880
|
+
const llmliteToken = typeof env.ANTHROPIC_AUTH_TOKEN === "string" ? env.ANTHROPIC_AUTH_TOKEN : null;
|
|
1881
|
+
if (llmliteToken) {
|
|
1882
|
+
return {
|
|
1883
|
+
provider: "llmlite",
|
|
1884
|
+
apiKey: llmliteToken,
|
|
1885
|
+
baseUrl,
|
|
1886
|
+
model: userModel.length > 0 ? userModel : DEFAULT_LLMLITE_MODEL
|
|
1887
|
+
};
|
|
1888
|
+
}
|
|
1889
|
+
return null;
|
|
1866
1890
|
} catch {
|
|
1867
1891
|
return null;
|
|
1868
1892
|
}
|
|
@@ -1880,8 +1904,10 @@ function tailLines2(text, n) {
|
|
|
1880
1904
|
async function runGitnexusWikiConditional(workspacePath) {
|
|
1881
1905
|
const creds = await readSettingsForWikiCredentials(workspacePath);
|
|
1882
1906
|
if (!creds) {
|
|
1883
|
-
log.warn("Subscription mode (
|
|
1884
|
-
log.dim(
|
|
1907
|
+
log.warn("Subscription mode (OAuth, kh\xF4ng c\xF3 API key trong settings.json) \u2192 skip wiki gen.");
|
|
1908
|
+
log.dim(
|
|
1909
|
+
"\u0110\u1EC3 gen wiki sau, ch\u1EA1y manual:\n gitnexus wiki . --api-key <key> --base-url <url> --model <model>"
|
|
1910
|
+
);
|
|
1885
1911
|
return { ran: false, skipped: true, reason: "subscription-mode" };
|
|
1886
1912
|
}
|
|
1887
1913
|
const proceed = await confirmWikiGeneration(creds.baseUrl, creds.model);
|
|
@@ -1891,7 +1917,9 @@ async function runGitnexusWikiConditional(workspacePath) {
|
|
|
1891
1917
|
);
|
|
1892
1918
|
return { ran: false, skipped: true, reason: "user-declined" };
|
|
1893
1919
|
}
|
|
1894
|
-
const sp = spinnerWithElapsed(
|
|
1920
|
+
const sp = spinnerWithElapsed(
|
|
1921
|
+
`Generating wiki via ${creds.baseUrl} (${creds.provider}) model=${creds.model}`
|
|
1922
|
+
);
|
|
1895
1923
|
const result = spawnSync10(
|
|
1896
1924
|
"gitnexus",
|
|
1897
1925
|
["wiki", ".", "--api-key", creds.apiKey, "--base-url", creds.baseUrl, "--model", creds.model],
|
|
@@ -4746,7 +4774,7 @@ async function removeSubmoduleEntry(gitmodulesPath, submodulePath) {
|
|
|
4746
4774
|
}
|
|
4747
4775
|
|
|
4748
4776
|
// src/commands/uninstall.ts
|
|
4749
|
-
var CLI_VERSION = "1.6.
|
|
4777
|
+
var CLI_VERSION = "1.6.1";
|
|
4750
4778
|
function registerUninstallCommand(program2) {
|
|
4751
4779
|
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) => {
|
|
4752
4780
|
try {
|
|
@@ -4828,7 +4856,7 @@ function printUninstallSuccessBox(backupPath) {
|
|
|
4828
4856
|
}
|
|
4829
4857
|
|
|
4830
4858
|
// src/index.ts
|
|
4831
|
-
var CLI_VERSION2 = "1.6.
|
|
4859
|
+
var CLI_VERSION2 = "1.6.1";
|
|
4832
4860
|
var program = new Command();
|
|
4833
4861
|
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(
|
|
4834
4862
|
"beforeAll",
|