@arrislink/axon 1.0.5 → 1.0.7
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 +211 -90
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -16209,6 +16209,24 @@ var require_prompts3 = __commonJS((exports, module) => {
|
|
|
16209
16209
|
module.exports = isNodeLT("8.6.0") ? require_dist() : require_lib();
|
|
16210
16210
|
});
|
|
16211
16211
|
|
|
16212
|
+
// src/utils/i18n.ts
|
|
16213
|
+
function detectLocale() {
|
|
16214
|
+
const lang = process.env["LANG"] || process.env["LANGUAGE"] || process.env["LC_ALL"] || "en";
|
|
16215
|
+
if (lang.toLowerCase().includes("zh")) {
|
|
16216
|
+
currentLocale = "zh";
|
|
16217
|
+
} else {
|
|
16218
|
+
currentLocale = "en";
|
|
16219
|
+
}
|
|
16220
|
+
return currentLocale;
|
|
16221
|
+
}
|
|
16222
|
+
function t(en, zh) {
|
|
16223
|
+
return currentLocale === "zh" ? zh : en;
|
|
16224
|
+
}
|
|
16225
|
+
var currentLocale = "en";
|
|
16226
|
+
var init_i18n = __esm(() => {
|
|
16227
|
+
detectLocale();
|
|
16228
|
+
});
|
|
16229
|
+
|
|
16212
16230
|
// src/utils/prompt.ts
|
|
16213
16231
|
async function confirm(options) {
|
|
16214
16232
|
const response = await import_prompts2.default({
|
|
@@ -16264,35 +16282,37 @@ var init_prompt = __esm(() => {
|
|
|
16264
16282
|
class SpecCollector {
|
|
16265
16283
|
constructor() {}
|
|
16266
16284
|
async collect() {
|
|
16267
|
-
logger.title("Axon \u9700\u6C42\u6536\u96C6");
|
|
16268
|
-
console.log(
|
|
16269
|
-
|
|
16285
|
+
logger.title(t("Axon Requirements Collection", "Axon \u9700\u6C42\u6536\u96C6"));
|
|
16286
|
+
console.log(t(`Let's start defining your project!
|
|
16287
|
+
`, `\u8BA9\u6211\u4EEC\u5F00\u59CB\u5B9A\u4E49\u4F60\u7684\u9879\u76EE\uFF01
|
|
16288
|
+
`));
|
|
16270
16289
|
const description = await input({
|
|
16271
|
-
message: "\uD83C\uDF40 \u4F60\u60F3\u6784\u5EFA\u4EC0\u4E48\u9879\u76EE\uFF1F",
|
|
16272
|
-
validate: (val) => val.length > 5 || "\u8BF7\u63D0\u4F9B\u66F4\u8BE6\u7EC6\u7684\u63CF\u8FF0"
|
|
16290
|
+
message: t("\uD83C\uDF40 What project do you want to build?", "\uD83C\uDF40 \u4F60\u60F3\u6784\u5EFA\u4EC0\u4E48\u9879\u76EE\uFF1F"),
|
|
16291
|
+
validate: (val) => val.length > 5 || t("Please provide a more detailed description", "\u8BF7\u63D0\u4F9B\u66F4\u8BE6\u7EC6\u7684\u63CF\u8FF0")
|
|
16273
16292
|
});
|
|
16274
|
-
const projectType = await select("\uD83D\uDCE6 \u9879\u76EE\u7C7B\u578B\uFF1F", [
|
|
16275
|
-
{ name: "Web API", value: "api", description: "RESTful \u6216 GraphQL \u540E\u7AEF\u670D\u52A1" },
|
|
16276
|
-
{ name: "Web
|
|
16277
|
-
{ name: "
|
|
16278
|
-
{ name: "
|
|
16279
|
-
{ name: "
|
|
16293
|
+
const projectType = await select(t("\uD83D\uDCE6 Project type?", "\uD83D\uDCE6 \u9879\u76EE\u7C7B\u578B\uFF1F"), [
|
|
16294
|
+
{ name: "Web API", value: "api", description: t("RESTful or GraphQL backend service", "RESTful \u6216 GraphQL \u540E\u7AEF\u670D\u52A1") },
|
|
16295
|
+
{ name: "Web App", value: "webapp", description: t("Frontend + Backend full application", "\u524D\u7AEF + \u540E\u7AEF\u5B8C\u6574\u5E94\u7528") },
|
|
16296
|
+
{ name: "Axon Skill", value: "skill", description: t("Reusable AI skill/plugin", "\u53EF\u590D\u7528\u7684 AI \u6280\u80FD/\u63D2\u4EF6") },
|
|
16297
|
+
{ name: "CLI Tool", value: "cli", description: t("Command line tool", "\u547D\u4EE4\u884C\u5DE5\u5177") },
|
|
16298
|
+
{ name: "Library/SDK", value: "library", description: t("Reusable code library", "\u53EF\u590D\u7528\u7684\u4EE3\u7801\u5E93") },
|
|
16299
|
+
{ name: "Other", value: "other", description: t("Other types of projects", "\u5176\u4ED6\u7C7B\u578B\u9879\u76EE") }
|
|
16280
16300
|
]);
|
|
16281
16301
|
const featureOptions = this.getFeatureOptions(projectType);
|
|
16282
|
-
const features = await multiSelect("\u2728 \u9700\u8981\u54EA\u4E9B\u529F\u80FD\uFF1F", featureOptions);
|
|
16283
|
-
const techStack = await select("\uD83D\uDEE0\uFE0F \u6280\u672F\u6808\u504F\u597D\uFF1F", [
|
|
16284
|
-
{ name: "TypeScript + Bun", value: "typescript-bun", description: "\u5FEB\u901F\u3001\u73B0\u4EE3\u7684 JS \u8FD0\u884C\u65F6" },
|
|
16285
|
-
{ name: "TypeScript + Node.js", value: "typescript-node", description: "\u6210\u719F\u7A33\u5B9A\u7684 JS \u8FD0\u884C\u65F6" },
|
|
16286
|
-
{ name: "Go", value: "go", description: "\u9AD8\u6027\u80FD\u3001\u7B80\u6D01\u7684\u8BED\u8A00" },
|
|
16287
|
-
{ name: "Python + FastAPI", value: "python-fastapi", description: "\u5FEB\u901F API \u5F00\u53D1" },
|
|
16288
|
-
{ name: "Rust", value: "rust", description: "\u5185\u5B58\u5B89\u5168\u3001\u9AD8\u6027\u80FD" },
|
|
16289
|
-
{ name: "
|
|
16302
|
+
const features = await multiSelect(t("\u2728 Which features do you need?", "\u2728 \u9700\u8981\u54EA\u4E9B\u529F\u80FD\uFF1F"), featureOptions);
|
|
16303
|
+
const techStack = await select(t("\uD83D\uDEE0\uFE0F Tech stack preference?", "\uD83D\uDEE0\uFE0F \u6280\u672F\u6808\u504F\u597D\uFF1F"), [
|
|
16304
|
+
{ name: "TypeScript + Bun", value: "typescript-bun", description: t("Fast, modern JS runtime", "\u5FEB\u901F\u3001\u73B0\u4EE3\u7684 JS \u8FD0\u884C\u65F6") },
|
|
16305
|
+
{ name: "TypeScript + Node.js", value: "typescript-node", description: t("Mature and stable JS runtime", "\u6210\u719F\u7A33\u5B9A\u7684 JS \u8FD0\u884C\u65F6") },
|
|
16306
|
+
{ name: "Go", value: "go", description: t("High performance, concise language", "\u9AD8\u6027\u80FD\u3001\u7B80\u6D01\u7684\u8BED\u8A00") },
|
|
16307
|
+
{ name: "Python + FastAPI", value: "python-fastapi", description: t("Fast API development", "\u5FEB\u901F API \u5F00\u53D1") },
|
|
16308
|
+
{ name: "Rust", value: "rust", description: t("Memory safe, high performance", "\u5185\u5B58\u5B89\u5168\u3001\u9AD8\u6027\u80FD") },
|
|
16309
|
+
{ name: "Let AI Recommend", value: "auto", description: t("Automatically choose based on requirements", "\u6839\u636E\u9879\u76EE\u9700\u6C42\u81EA\u52A8\u9009\u62E9") }
|
|
16290
16310
|
]);
|
|
16291
16311
|
let additionalRequirements = "";
|
|
16292
|
-
const hasMore = await confirm({ message: "\uD83D\uDCDD \u8FD8\u6709\u5176\u4ED6\u9700\u6C42\u8981\u8865\u5145\u5417\uFF1F", default: false });
|
|
16312
|
+
const hasMore = await confirm({ message: t("\uD83D\uDCDD Any other requirements to add?", "\uD83D\uDCDD \u8FD8\u6709\u5176\u4ED6\u9700\u6C42\u8981\u8865\u5145\u5417\uFF1F"), default: false });
|
|
16293
16313
|
if (hasMore) {
|
|
16294
16314
|
additionalRequirements = await input({
|
|
16295
|
-
message: "\u8BF7\u63CF\u8FF0\u5176\u4ED6\u9700\u6C42:"
|
|
16315
|
+
message: t("Please describe other requirements:", "\u8BF7\u63CF\u8FF0\u5176\u4ED6\u9700\u6C42:")
|
|
16296
16316
|
});
|
|
16297
16317
|
}
|
|
16298
16318
|
return {
|
|
@@ -16305,38 +16325,46 @@ class SpecCollector {
|
|
|
16305
16325
|
}
|
|
16306
16326
|
getFeatureOptions(projectType) {
|
|
16307
16327
|
const common = [
|
|
16308
|
-
{ name: "\u65E5\u5FD7\u8BB0\u5F55", value: "logging" },
|
|
16309
|
-
{ name: "\u9519\u8BEF\u5904\u7406", value: "error-handling" },
|
|
16310
|
-
{ name: "\u914D\u7F6E\u7BA1\u7406", value: "config" },
|
|
16311
|
-
{ name: "\u5355\u5143\u6D4B\u8BD5", value: "testing" }
|
|
16328
|
+
{ name: t("Logging", "\u65E5\u5FD7\u8BB0\u5F55"), value: "logging" },
|
|
16329
|
+
{ name: t("Error Handling", "\u9519\u8BEF\u5904\u7406"), value: "error-handling" },
|
|
16330
|
+
{ name: t("Config Management", "\u914D\u7F6E\u7BA1\u7406"), value: "config" },
|
|
16331
|
+
{ name: t("Unit Testing", "\u5355\u5143\u6D4B\u8BD5"), value: "testing" }
|
|
16312
16332
|
];
|
|
16313
16333
|
switch (projectType) {
|
|
16314
16334
|
case "api":
|
|
16315
16335
|
return [
|
|
16316
|
-
{ name: "\u7528\u6237\u8BA4\u8BC1 (JWT)", value: "auth-jwt" },
|
|
16336
|
+
{ name: t("Authentication (JWT)", "\u7528\u6237\u8BA4\u8BC1 (JWT)"), value: "auth-jwt" },
|
|
16317
16337
|
{ name: "OAuth 2.0", value: "oauth" },
|
|
16318
|
-
{ name: "CRUD \u57FA\u7840\u63A5\u53E3", value: "crud" },
|
|
16319
|
-
{ name: "\u6570\u636E\u9A8C\u8BC1", value: "validation" },
|
|
16320
|
-
{ name: "API \u6587\u6863 (OpenAPI)", value: "openapi" },
|
|
16321
|
-
{ name: "\u901F\u7387\u9650\u5236", value: "rate-limit" },
|
|
16338
|
+
{ name: t("CRUD Basic API", "CRUD \u57FA\u7840\u63A5\u53E3"), value: "crud" },
|
|
16339
|
+
{ name: t("Data Validation", "\u6570\u636E\u9A8C\u8BC1"), value: "validation" },
|
|
16340
|
+
{ name: t("API Docs (OpenAPI)", "API \u6587\u6863 (OpenAPI)"), value: "openapi" },
|
|
16341
|
+
{ name: t("Rate Limit", "\u901F\u7387\u9650\u5236"), value: "rate-limit" },
|
|
16322
16342
|
...common
|
|
16323
16343
|
];
|
|
16324
16344
|
case "webapp":
|
|
16325
16345
|
return [
|
|
16326
|
-
{ name: "\u7528\u6237\u8BA4\u8BC1", value: "auth" },
|
|
16327
|
-
{ name: "\u54CD\u5E94\u5F0F UI", value: "responsive" },
|
|
16328
|
-
{ name: "\u72B6\u6001\u7BA1\u7406", value: "state" },
|
|
16329
|
-
{ name: "\u8DEF\u7531", value: "routing" },
|
|
16330
|
-
{ name: "API \u96C6\u6210", value: "api-integration" },
|
|
16346
|
+
{ name: t("Authentication", "\u7528\u6237\u8BA4\u8BC1"), value: "auth" },
|
|
16347
|
+
{ name: t("Responsive UI", "\u54CD\u5E94\u5F0F UI"), value: "responsive" },
|
|
16348
|
+
{ name: t("State Management", "\u72B6\u6001\u7BA1\u7406"), value: "state" },
|
|
16349
|
+
{ name: t("Routing", "\u8DEF\u7531"), value: "routing" },
|
|
16350
|
+
{ name: t("API Integration", "API \u96C6\u6210"), value: "api-integration" },
|
|
16331
16351
|
...common
|
|
16332
16352
|
];
|
|
16333
16353
|
case "cli":
|
|
16334
16354
|
return [
|
|
16335
|
-
{ name: "\u4EA4\u4E92\u5F0F\u63D0\u793A", value: "interactive" },
|
|
16336
|
-
{ name: "\u914D\u7F6E\u6587\u4EF6\u652F\u6301", value: "config-file" },
|
|
16337
|
-
{ name: "\u5E2E\u52A9\u6587\u6863", value: "help" },
|
|
16338
|
-
{ name: "\u8FDB\u5EA6\u663E\u793A", value: "progress" },
|
|
16339
|
-
{ name: "\u989C\u8272\u8F93\u51FA", value: "colors" },
|
|
16355
|
+
{ name: t("Interactive Prompts", "\u4EA4\u4E92\u5F0F\u63D0\u793A"), value: "interactive" },
|
|
16356
|
+
{ name: t("Config File Support", "\u914D\u7F6E\u6587\u4EF6\u652F\u6301"), value: "config-file" },
|
|
16357
|
+
{ name: t("Help Docs", "\u5E2E\u52A9\u6587\u6863"), value: "help" },
|
|
16358
|
+
{ name: t("Progress Indicators", "\u8FDB\u5EA6\u663E\u793A"), value: "progress" },
|
|
16359
|
+
{ name: t("Colorized Output", "\u989C\u8272\u8F93\u51FA"), value: "colors" },
|
|
16360
|
+
...common
|
|
16361
|
+
];
|
|
16362
|
+
case "skill":
|
|
16363
|
+
return [
|
|
16364
|
+
{ name: t("Skill Spec", "\u529F\u80FD\u63CF\u8FF0 (Skill Spec)"), value: "skill-spec" },
|
|
16365
|
+
{ name: t("Skill Examples", "\u4F7F\u7528\u793A\u4F8B (Examples)"), value: "skill-examples" },
|
|
16366
|
+
{ name: t("Core Logic (Beads)", "\u6838\u5FC3\u903B\u8F91 (Beads)"), value: "skill-logic" },
|
|
16367
|
+
{ name: t("Dependency Management", "\u4F9D\u8D56\u7BA1\u7406"), value: "skill-deps" },
|
|
16340
16368
|
...common
|
|
16341
16369
|
];
|
|
16342
16370
|
default:
|
|
@@ -16347,6 +16375,7 @@ class SpecCollector {
|
|
|
16347
16375
|
var init_collector = __esm(() => {
|
|
16348
16376
|
init_prompt();
|
|
16349
16377
|
init_logger();
|
|
16378
|
+
init_i18n();
|
|
16350
16379
|
});
|
|
16351
16380
|
|
|
16352
16381
|
// src/core/integrations/anthropic.ts
|
|
@@ -16502,10 +16531,19 @@ class OpenCodeLLMClient {
|
|
|
16502
16531
|
proc.kill();
|
|
16503
16532
|
}
|
|
16504
16533
|
const exitCode = await proc.exited;
|
|
16534
|
+
const stderr = await new Response(proc.stderr).text();
|
|
16505
16535
|
if (exitCode !== 0) {
|
|
16506
|
-
const stderr = await new Response(proc.stderr).text();
|
|
16507
16536
|
throw new Error(`OpenCode CLI Error: ${stderr || "Unknown error"}`);
|
|
16508
16537
|
}
|
|
16538
|
+
if (fullResponse.trim() === "" && stderr.trim().length > 0) {
|
|
16539
|
+
if (stderr.includes("Error") || stderr.includes("NotFound") || stderr.includes("|")) {
|
|
16540
|
+
throw new Error(`OpenCode CLI Silent Crash: ${stderr.split(`
|
|
16541
|
+
`)[0]}`);
|
|
16542
|
+
}
|
|
16543
|
+
}
|
|
16544
|
+
if (fullResponse.trim() === "") {
|
|
16545
|
+
throw new Error("OpenCode CLI returned an empty response");
|
|
16546
|
+
}
|
|
16509
16547
|
return {
|
|
16510
16548
|
content: fullResponse,
|
|
16511
16549
|
model: metadata.model,
|
|
@@ -16797,7 +16835,7 @@ class AxonLLMClient {
|
|
|
16797
16835
|
throw new Error(`\u672A\u652F\u6301\u7684 LLM \u6A21\u5F0F: ${this.mode}`);
|
|
16798
16836
|
} catch (error) {
|
|
16799
16837
|
if (this.mode !== "fallback") {
|
|
16800
|
-
console.warn(`\uD83E\uDDE0 Axon: ${this.mode} \u6A21\u5F0F\u8C03\u7528\u5931\u8D25\uFF0C\u5C1D\u8BD5\u56DE\u9000...`);
|
|
16838
|
+
console.warn(`\uD83E\uDDE0 Axon: ${this.mode} \u6A21\u5F0F\u8C03\u7528\u5931\u8D25\u6216\u54CD\u5E94\u4E3A\u7A7A\uFF0C\u5C1D\u8BD5\u56DE\u9000...`);
|
|
16801
16839
|
if (process.env["DEBUG"])
|
|
16802
16840
|
console.error(error);
|
|
16803
16841
|
this.mode = "fallback";
|
|
@@ -16924,6 +16962,7 @@ class SpecGenerator {
|
|
|
16924
16962
|
const projectTypeNames = {
|
|
16925
16963
|
api: "Web API",
|
|
16926
16964
|
webapp: "Web \u5E94\u7528",
|
|
16965
|
+
skill: "Axon Skill",
|
|
16927
16966
|
cli: "CLI \u5DE5\u5177",
|
|
16928
16967
|
library: "\u5E93/SDK",
|
|
16929
16968
|
other: "\u5176\u4ED6"
|
|
@@ -17014,7 +17053,11 @@ ${collected.additionalRequirements}` : ""}
|
|
|
17014
17053
|
"config-file": "\u914D\u7F6E\u6587\u4EF6\u652F\u6301",
|
|
17015
17054
|
help: "\u5E2E\u52A9\u6587\u6863",
|
|
17016
17055
|
progress: "\u8FDB\u5EA6\u663E\u793A",
|
|
17017
|
-
colors: "\u989C\u8272\u8F93\u51FA"
|
|
17056
|
+
colors: "\u989C\u8272\u8F93\u51FA",
|
|
17057
|
+
"skill-spec": "Skill \u529F\u80FD\u5B9A\u4E49",
|
|
17058
|
+
"skill-examples": "Skill \u4F7F\u7528\u793A\u4F8B",
|
|
17059
|
+
"skill-logic": "Skill \u6838\u5FC3\u903B\u8F91 (Beads)",
|
|
17060
|
+
"skill-deps": "Skill \u4F9D\u8D56\u7BA1\u7406"
|
|
17018
17061
|
};
|
|
17019
17062
|
return names[feature] || feature;
|
|
17020
17063
|
}
|
|
@@ -17605,7 +17648,7 @@ class SkillsLibrary {
|
|
|
17605
17648
|
}
|
|
17606
17649
|
let result = [...this.skills];
|
|
17607
17650
|
if (filter?.tags?.length) {
|
|
17608
|
-
result = result.filter((s) => s.metadata.tags.some((
|
|
17651
|
+
result = result.filter((s) => s.metadata.tags.some((t2) => filter.tags?.includes(t2)));
|
|
17609
17652
|
}
|
|
17610
17653
|
if (filter?.difficulty) {
|
|
17611
17654
|
result = result.filter((s) => s.metadata.difficulty === filter.difficulty);
|
|
@@ -19700,6 +19743,9 @@ var {
|
|
|
19700
19743
|
|
|
19701
19744
|
// src/index.ts
|
|
19702
19745
|
init_source();
|
|
19746
|
+
import { readFileSync as readFileSync7 } from "fs";
|
|
19747
|
+
import { join as join12, dirname as dirname5 } from "path";
|
|
19748
|
+
import { fileURLToPath } from "url";
|
|
19703
19749
|
|
|
19704
19750
|
// src/commands/init.ts
|
|
19705
19751
|
init_source();
|
|
@@ -24744,11 +24790,12 @@ function progressBar(current, total, width = 20) {
|
|
|
24744
24790
|
|
|
24745
24791
|
// src/commands/init.ts
|
|
24746
24792
|
init_errors();
|
|
24793
|
+
init_i18n();
|
|
24747
24794
|
var import_prompts = __toESM(require_prompts3(), 1);
|
|
24748
|
-
var initCommand = new Command("init").description("\u521D\u59CB\u5316\u65B0\u7684 Axon \u9879\u76EE").argument("[project-name]", "\u9879\u76EE\u540D\u79F0", ".").option("-t, --template <name>", "\u4F7F\u7528\u6A21\u677F (web, api, cli)", "default").option("--skip-install", "\u8DF3\u8FC7\u4F9D\u8D56\u5B89\u88C5").option("--skip-git", "\u8DF3\u8FC7 Git \u521D\u59CB\u5316").action(async (projectName, options) => {
|
|
24795
|
+
var initCommand = new Command("init").description(t("Initialize a new Axon project", "\u521D\u59CB\u5316\u65B0\u7684 Axon \u9879\u76EE")).argument("[project-name]", t("Project name", "\u9879\u76EE\u540D\u79F0"), ".").option("-t, --template <name>", t("Use template (web, api, cli)", "\u4F7F\u7528\u6A21\u677F (web, api, cli)"), "default").option("--skip-install", t("Skip dependency installation", "\u8DF3\u8FC7\u4F9D\u8D56\u5B89\u88C5")).option("--skip-git", t("Skip Git initialization", "\u8DF3\u8FC7 Git \u521D\u59CB\u5316")).action(async (projectName, options) => {
|
|
24749
24796
|
const projectPath = projectName === "." ? process.cwd() : join4(process.cwd(), projectName);
|
|
24750
24797
|
const name = projectName === "." ? basename(process.cwd()) : projectName;
|
|
24751
|
-
logger.title("Axon \u9879\u76EE\u521D\u59CB\u5316");
|
|
24798
|
+
logger.title(t("Axon Project Initialization", "Axon \u9879\u76EE\u521D\u59CB\u5316"));
|
|
24752
24799
|
if (ConfigManager.isAxonProject(projectPath)) {
|
|
24753
24800
|
throw new AxonError("\u9879\u76EE\u5DF2\u521D\u59CB\u5316", "INIT_ERROR", [
|
|
24754
24801
|
`\u76EE\u5F55 ${projectPath} \u5DF2\u5B58\u5728 .axon \u914D\u7F6E`,
|
|
@@ -24757,7 +24804,7 @@ var initCommand = new Command("init").description("\u521D\u59CB\u5316\u65B0\u768
|
|
|
24757
24804
|
}
|
|
24758
24805
|
const existingConfigs = detectExistingConfig(projectPath);
|
|
24759
24806
|
if (existingConfigs.hasOpenCode || existingConfigs.hasBeads) {
|
|
24760
|
-
logger.warn("\u26A0\uFE0F \u68C0\u6D4B\u5230\u73B0\u6709\u914D\u7F6E");
|
|
24807
|
+
logger.warn(t("\u26A0\uFE0F Existing configuration detected", "\u26A0\uFE0F \u68C0\u6D4B\u5230\u73B0\u6709\u914D\u7F6E"));
|
|
24761
24808
|
if (existingConfigs.hasOpenCode)
|
|
24762
24809
|
console.log(source_default.dim(" - .opencode/ (OpenCode)"));
|
|
24763
24810
|
if (existingConfigs.hasBeads)
|
|
@@ -24766,16 +24813,16 @@ var initCommand = new Command("init").description("\u521D\u59CB\u5316\u65B0\u768
|
|
|
24766
24813
|
const response = await import_prompts.default({
|
|
24767
24814
|
type: "select",
|
|
24768
24815
|
name: "action",
|
|
24769
|
-
message: "\u5982\u4F55\u5904\u7406\u73B0\u6709\u914D\u7F6E\uFF1F",
|
|
24816
|
+
message: t("How to handle existing configuration?", "\u5982\u4F55\u5904\u7406\u73B0\u6709\u914D\u7F6E\uFF1F"),
|
|
24770
24817
|
choices: [
|
|
24771
|
-
{ title: "\u4FDD\u7559\u73B0\u6709\u914D\u7F6E (Merge)", value: "merge", description: "\u4FDD\u7559\u73B0\u6709\u6587\u4EF6\uFF0C\u4EC5\u6DFB\u52A0 Axon \u914D\u7F6E" },
|
|
24772
|
-
{ title: "\u5907\u4EFD\u5E76\u521B\u5EFA\u65B0\u914D\u7F6E (Backup)", value: "backup", description: "\u5907\u4EFD\u73B0\u6709\u76EE\u5F55\u4E3A .backup \u540E\u91CD\u5EFA" },
|
|
24773
|
-
{ title: "\u53D6\u6D88\u521D\u59CB\u5316 (Cancel)", value: "cancel" }
|
|
24818
|
+
{ title: t("Keep it (Merge)", "\u4FDD\u7559\u73B0\u6709\u914D\u7F6E (Merge)"), value: "merge", description: t("Keep existing files, only add Axon config", "\u4FDD\u7559\u73B0\u6709\u6587\u4EF6\uFF0C\u4EC5\u6DFB\u52A0 Axon \u914D\u7F6E") },
|
|
24819
|
+
{ title: t("Backup and recreate (Backup)", "\u5907\u4EFD\u5E76\u521B\u5EFA\u65B0\u914D\u7F6E (Backup)"), value: "backup", description: t("Backup existing directories to .backup then recreate", "\u5907\u4EFD\u73B0\u6709\u76EE\u5F55\u4E3A .backup \u540E\u91CD\u5EFA") },
|
|
24820
|
+
{ title: t("Cancel", "\u53D6\u6D88\u521D\u59CB\u5316 (Cancel)"), value: "cancel" }
|
|
24774
24821
|
],
|
|
24775
24822
|
initial: 0
|
|
24776
24823
|
});
|
|
24777
24824
|
if (!response.action || response.action === "cancel") {
|
|
24778
|
-
logger.info("\u5DF2\u53D6\u6D88\u521D\u59CB\u5316");
|
|
24825
|
+
logger.info(t("Initialization cancelled", "\u5DF2\u53D6\u6D88\u521D\u59CB\u5316"));
|
|
24779
24826
|
return;
|
|
24780
24827
|
}
|
|
24781
24828
|
if (response.action === "backup") {
|
|
@@ -24786,15 +24833,15 @@ var initCommand = new Command("init").description("\u521D\u59CB\u5316\u65B0\u768
|
|
|
24786
24833
|
if (existingConfigs.hasBeads) {
|
|
24787
24834
|
await Bun.$`mv ${join4(projectPath, ".beads")} ${join4(projectPath, `.beads.backup.${timestamp}`)}`;
|
|
24788
24835
|
}
|
|
24789
|
-
logger.success(
|
|
24836
|
+
logger.success(t("\u2705 Existing configuration backed up", "\u2705 \u5DF2\u5907\u4EFD\u73B0\u6709\u914D\u7F6E"));
|
|
24790
24837
|
}
|
|
24791
24838
|
}
|
|
24792
24839
|
if (!existsSync3(projectPath)) {
|
|
24793
|
-
spinner.start(`\u521B\u5EFA\u9879\u76EE\u76EE\u5F55 ${source_default.cyan(name)}`);
|
|
24840
|
+
spinner.start(t(`Creating project directory ${source_default.cyan(name)}`, `\u521B\u5EFA\u9879\u76EE\u76EE\u5F55 ${source_default.cyan(name)}`));
|
|
24794
24841
|
mkdirSync2(projectPath, { recursive: true });
|
|
24795
24842
|
spinner.succeed();
|
|
24796
24843
|
}
|
|
24797
|
-
spinner.start("\u521B\u5EFA Axon \u76EE\u5F55\u7ED3\u6784");
|
|
24844
|
+
spinner.start(t("Creating Axon directory structure", "\u521B\u5EFA Axon \u76EE\u5F55\u7ED3\u6784"));
|
|
24798
24845
|
for (const dir of DEFAULT_DIRECTORIES) {
|
|
24799
24846
|
const fullPath = join4(projectPath, dir);
|
|
24800
24847
|
if (!existsSync3(fullPath)) {
|
|
@@ -24802,30 +24849,33 @@ var initCommand = new Command("init").description("\u521D\u59CB\u5316\u65B0\u768
|
|
|
24802
24849
|
}
|
|
24803
24850
|
}
|
|
24804
24851
|
spinner.succeed();
|
|
24805
|
-
spinner.start("\u751F\u6210\u914D\u7F6E\u6587\u4EF6");
|
|
24852
|
+
spinner.start(t("Generating configuration file", "\u751F\u6210\u914D\u7F6E\u6587\u4EF6"));
|
|
24806
24853
|
ConfigManager.initialize(projectPath, name);
|
|
24807
24854
|
spinner.succeed();
|
|
24808
24855
|
if (!options.skipReadme && !existsSync3(join4(projectPath, "README.md"))) {
|
|
24809
|
-
spinner.start("\u751F\u6210 README.md");
|
|
24856
|
+
spinner.start(t("Generating README.md", "\u751F\u6210 README.md"));
|
|
24810
24857
|
const readme = generateReadme(name);
|
|
24811
24858
|
await Bun.write(join4(projectPath, "README.md"), readme);
|
|
24812
24859
|
spinner.succeed();
|
|
24813
24860
|
}
|
|
24814
|
-
spinner.start("\u751F\u6210\u5165\u95E8\u6307\u5357");
|
|
24861
|
+
spinner.start(t("Generating Quick Start guide", "\u751F\u6210\u5165\u95E8\u6307\u5357"));
|
|
24815
24862
|
const gettingStarted = generateGettingStarted(name);
|
|
24816
24863
|
await Bun.write(join4(projectPath, "GETTING_STARTED.md"), gettingStarted);
|
|
24817
24864
|
spinner.succeed();
|
|
24818
24865
|
if (!existsSync3(join4(projectPath, ".openspec", "spec.md"))) {
|
|
24819
|
-
spinner.start("\u521B\u5EFA\u89C4\u683C\u6A21\u677F");
|
|
24820
|
-
const specContent = `# ${name}
|
|
24866
|
+
spinner.start(t("Creating specification template", "\u521B\u5EFA\u89C4\u683C\u6A21\u677F"));
|
|
24867
|
+
const specContent = t(`# ${name} Specification
|
|
24868
|
+
|
|
24869
|
+
(To be filled)
|
|
24870
|
+
`, `# ${name} \u89C4\u683C\u6587\u6863
|
|
24821
24871
|
|
|
24822
24872
|
(\u5F85\u586B\u5199)
|
|
24823
|
-
|
|
24873
|
+
`);
|
|
24824
24874
|
await Bun.write(join4(projectPath, ".openspec", "spec.md"), specContent);
|
|
24825
24875
|
spinner.succeed();
|
|
24826
24876
|
}
|
|
24827
24877
|
if (!options.skipGit) {
|
|
24828
|
-
spinner.start("\u521D\u59CB\u5316 Git \u4ED3\u5E93");
|
|
24878
|
+
spinner.start(t("Initializing Git repository", "\u521D\u59CB\u5316 Git \u4ED3\u5E93"));
|
|
24829
24879
|
const git = new GitOperations(projectPath);
|
|
24830
24880
|
if (!git.isGitRepo()) {
|
|
24831
24881
|
await git.init();
|
|
@@ -24836,31 +24886,57 @@ var initCommand = new Command("init").description("\u521D\u59CB\u5316\u65B0\u768
|
|
|
24836
24886
|
}
|
|
24837
24887
|
logger.blank();
|
|
24838
24888
|
logger.divider();
|
|
24839
|
-
logger.success(`\u9879\u76EE ${source_default.bold(name)} \u521D\u59CB\u5316\u5B8C\u6210\uFF01`);
|
|
24889
|
+
logger.success(t(`Project ${source_default.bold(name)} initialization complete!`, `\u9879\u76EE ${source_default.bold(name)} \u521D\u59CB\u5316\u5B8C\u6210\uFF01`));
|
|
24840
24890
|
logger.blank();
|
|
24841
|
-
console.log(source_default.dim("\u5DF2\u521B\u5EFA\u4EE5\u4E0B\u7ED3\u6784:"));
|
|
24842
|
-
console.log(` ${source_default.cyan(".axon/")} - \u914D\u7F6E\u548C\u5143\u6570\u636E`);
|
|
24843
|
-
console.log(` ${source_default.cyan(".openspec/")} - \u89C4\u683C\u6587\u6863`);
|
|
24844
|
-
console.log(` ${source_default.cyan(".beads/")} - \u4EFB\u52A1\u56FE`);
|
|
24845
|
-
console.log(` ${source_default.cyan(".skills/")} - \u672C\u5730\u6280\u80FD\u5E93`);
|
|
24846
|
-
console.log(` ${source_default.cyan("GETTING_STARTED.md")} - \u5165\u95E8\u6307\u5357`);
|
|
24847
|
-
console.log(` ${source_default.cyan("README.md")} - \u9879\u76EE\u8BF4\u660E`);
|
|
24891
|
+
console.log(source_default.dim(t("Created structure:", "\u5DF2\u521B\u5EFA\u4EE5\u4E0B\u7ED3\u6784:")));
|
|
24892
|
+
console.log(` ${source_default.cyan(".axon/")} - ${t("Config and metadata", "\u914D\u7F6E\u548C\u5143\u6570\u636E")}`);
|
|
24893
|
+
console.log(` ${source_default.cyan(".openspec/")} - ${t("Specification document", "\u89C4\u683C\u6587\u6863")}`);
|
|
24894
|
+
console.log(` ${source_default.cyan(".beads/")} - ${t("Task graph", "\u4EFB\u52A1\u56FE")}`);
|
|
24895
|
+
console.log(` ${source_default.cyan(".skills/")} - ${t("Local skill library", "\u672C\u5730\u6280\u80FD\u5E93")}`);
|
|
24896
|
+
console.log(` ${source_default.cyan("GETTING_STARTED.md")} - ${t("Quick Start guide", "\u5165\u95E8\u6307\u5357")}`);
|
|
24897
|
+
console.log(` ${source_default.cyan("README.md")} - ${t("Project description", "\u9879\u76EE\u8BF4\u660E")}`);
|
|
24848
24898
|
logger.blank();
|
|
24849
|
-
console.log(source_default.bold("\u4E0B\u4E00\u6B65:"));
|
|
24899
|
+
console.log(source_default.bold(t("Next steps:", "\u4E0B\u4E00\u6B65:")));
|
|
24850
24900
|
console.log(` 1. ${source_default.cyan("cd " + (projectName === "." ? "" : projectName))}`);
|
|
24851
|
-
console.log(` 2. ${source_default.cyan("cat GETTING_STARTED.md")} - \u9605\u8BFB\u5165\u95E8\u6307\u5357`);
|
|
24852
|
-
console.log(` 3. ${source_default.cyan("ax spec init")} - \u5B9A\u4E49\u9879\u76EE\u89C4\u683C`);
|
|
24853
|
-
console.log(` 4. ${source_default.cyan("ax plan")} - \u751F\u6210\u4EFB\u52A1\u56FE`);
|
|
24901
|
+
console.log(` 2. ${source_default.cyan("cat GETTING_STARTED.md")} - ${t("Read Quick Start guide", "\u9605\u8BFB\u5165\u95E8\u6307\u5357")}`);
|
|
24902
|
+
console.log(` 3. ${source_default.cyan("ax spec init")} - ${t("Define project specification", "\u5B9A\u4E49\u9879\u76EE\u89C4\u683C")}`);
|
|
24903
|
+
console.log(` 4. ${source_default.cyan("ax plan")} - ${t("Generate task graph", "\u751F\u6210\u4EFB\u52A1\u56FE")}`);
|
|
24854
24904
|
logger.blank();
|
|
24855
24905
|
});
|
|
24856
|
-
function detectExistingConfig(projectPath) {
|
|
24857
|
-
return {
|
|
24858
|
-
hasOpenCode: existsSync3(join4(projectPath, ".opencode")),
|
|
24859
|
-
hasBeads: existsSync3(join4(projectPath, ".beads"))
|
|
24860
|
-
};
|
|
24861
|
-
}
|
|
24862
24906
|
function generateGettingStarted(name) {
|
|
24863
|
-
return `# ${name} - Axon
|
|
24907
|
+
return t(`# ${name} - Axon Quick Start
|
|
24908
|
+
|
|
24909
|
+
## 1. Configure Provider
|
|
24910
|
+
Axon uses OhMyOpenCode (OMO) to manage LLM Providers.
|
|
24911
|
+
|
|
24912
|
+
\`\`\`bash
|
|
24913
|
+
# Install OMO (if not already installed)
|
|
24914
|
+
bunx oh-my-opencode install
|
|
24915
|
+
|
|
24916
|
+
# Configure Provider (Antigravity recommended)
|
|
24917
|
+
bunx oh-my-opencode config set-provider antigravity
|
|
24918
|
+
|
|
24919
|
+
# Test connection
|
|
24920
|
+
ax config test
|
|
24921
|
+
\`\`\`
|
|
24922
|
+
|
|
24923
|
+
## 2. Define Requirements
|
|
24924
|
+
\`\`\`bash
|
|
24925
|
+
ax spec init
|
|
24926
|
+
\`\`\`
|
|
24927
|
+
|
|
24928
|
+
## 3. Generate Plan
|
|
24929
|
+
\`\`\`bash
|
|
24930
|
+
ax plan
|
|
24931
|
+
\`\`\`
|
|
24932
|
+
|
|
24933
|
+
## 4. Start Working
|
|
24934
|
+
\`\`\`bash
|
|
24935
|
+
ax work
|
|
24936
|
+
\`\`\`
|
|
24937
|
+
|
|
24938
|
+
For more documentation, see [README.md](./README.md).
|
|
24939
|
+
`, `# ${name} - Axon \u5FEB\u901F\u5165\u95E8
|
|
24864
24940
|
|
|
24865
24941
|
## 1. \u914D\u7F6E Provider
|
|
24866
24942
|
Axon \u4F7F\u7528 OhMyOpenCode (OMO) \u7BA1\u7406 LLM Provider\u3002
|
|
@@ -24892,12 +24968,48 @@ ax work
|
|
|
24892
24968
|
\`\`\`
|
|
24893
24969
|
|
|
24894
24970
|
\u66F4\u591A\u6587\u6863\u8BF7\u67E5\u770B [README.md](./README.md)\u3002
|
|
24895
|
-
|
|
24971
|
+
`);
|
|
24896
24972
|
}
|
|
24897
24973
|
function generateReadme(name) {
|
|
24898
|
-
return `# ${name}
|
|
24974
|
+
return t(`# ${name}
|
|
24975
|
+
|
|
24976
|
+
> AI-assisted development project created by [Axon](https://github.com/arrislink/axon)
|
|
24977
|
+
|
|
24978
|
+
## Getting Started
|
|
24899
24979
|
|
|
24900
|
-
|
|
24980
|
+
\`\`\`bash
|
|
24981
|
+
# Define project specification
|
|
24982
|
+
ax spec init
|
|
24983
|
+
|
|
24984
|
+
# Generate task graph
|
|
24985
|
+
ax plan
|
|
24986
|
+
|
|
24987
|
+
# Start executing tasks
|
|
24988
|
+
ax work
|
|
24989
|
+
\`\`\`
|
|
24990
|
+
|
|
24991
|
+
## Project Structure
|
|
24992
|
+
|
|
24993
|
+
- \`.axon/\` - Axon configuration
|
|
24994
|
+
- \`.openspec/\` - Project specification document
|
|
24995
|
+
- \`.beads/\` - Task dependency graph
|
|
24996
|
+
- \`.skills/\` - Local skill templates
|
|
24997
|
+
|
|
24998
|
+
## Common Commands
|
|
24999
|
+
|
|
25000
|
+
| Command | Description |
|
|
25001
|
+
|------|------|
|
|
25002
|
+
| \`ax status\` | View project status |
|
|
25003
|
+
| \`ax work\` | Execute next task |
|
|
25004
|
+
| \`ax skills search <query>\` | Search skill templates |
|
|
25005
|
+
| \`ax doctor\` | Diagnose environment issues |
|
|
25006
|
+
|
|
25007
|
+
---
|
|
25008
|
+
|
|
25009
|
+
Powered by \uD83E\uDDE0 Axon
|
|
25010
|
+
`, `# ${name}
|
|
25011
|
+
|
|
25012
|
+
> \u7531 [Axon](https://github.com/arrislink/axon) \u521B\u5EFA\u7684 AI \u8F85\u52A9\u5F00\u53D1\u9879\u76EE
|
|
24901
25013
|
|
|
24902
25014
|
## \u5F00\u59CB
|
|
24903
25015
|
|
|
@@ -24931,7 +25043,13 @@ ax work
|
|
|
24931
25043
|
---
|
|
24932
25044
|
|
|
24933
25045
|
\u7531 \uD83E\uDDE0 Axon \u63D0\u4F9B\u652F\u6301
|
|
24934
|
-
|
|
25046
|
+
`);
|
|
25047
|
+
}
|
|
25048
|
+
function detectExistingConfig(projectPath) {
|
|
25049
|
+
return {
|
|
25050
|
+
hasOpenCode: existsSync3(join4(projectPath, ".opencode")),
|
|
25051
|
+
hasBeads: existsSync3(join4(projectPath, ".beads"))
|
|
25052
|
+
};
|
|
24935
25053
|
}
|
|
24936
25054
|
// src/commands/spec.ts
|
|
24937
25055
|
init_source();
|
|
@@ -25294,7 +25412,7 @@ skillsCommand.command("list").description("\u5217\u51FA\u6240\u6709\u6280\u80FD"
|
|
|
25294
25412
|
const library2 = new SkillsLibrary(localPath, globalPath);
|
|
25295
25413
|
const filter = {};
|
|
25296
25414
|
if (options.tags) {
|
|
25297
|
-
filter.tags = options.tags.split(",").map((
|
|
25415
|
+
filter.tags = options.tags.split(",").map((t2) => t2.trim());
|
|
25298
25416
|
}
|
|
25299
25417
|
if (options.difficulty) {
|
|
25300
25418
|
filter.difficulty = options.difficulty;
|
|
@@ -25339,7 +25457,7 @@ skillsCommand.command("save <path>").description("\u5C06\u6587\u4EF6\u4FDD\u5B58
|
|
|
25339
25457
|
const library2 = new SkillsLibrary(join9(projectRoot, config.tools.skills.local_path), config.tools.skills.global_path);
|
|
25340
25458
|
const content = await Bun.file(filePath).text();
|
|
25341
25459
|
const name = options.name || basename3(filePath).replace(/\.[^.]+$/, "");
|
|
25342
|
-
const tags = options.tags ? options.tags.split(",").map((
|
|
25460
|
+
const tags = options.tags ? options.tags.split(",").map((t2) => t2.trim()) : ["custom"];
|
|
25343
25461
|
const skill = {
|
|
25344
25462
|
metadata: {
|
|
25345
25463
|
name,
|
|
@@ -25870,9 +25988,12 @@ configCommand.command("keys").description("\u5FEB\u901F\u8BBE\u7F6E API \u5BC6\u
|
|
|
25870
25988
|
});
|
|
25871
25989
|
// src/index.ts
|
|
25872
25990
|
init_errors();
|
|
25873
|
-
var
|
|
25991
|
+
var __dirname2 = dirname5(fileURLToPath(import.meta.url));
|
|
25992
|
+
var pkgPath = join12(__dirname2, "../package.json");
|
|
25993
|
+
var pkg = JSON.parse(readFileSync7(pkgPath, "utf-8"));
|
|
25994
|
+
var VERSION = pkg.version;
|
|
25874
25995
|
var program2 = new Command;
|
|
25875
|
-
program2.name("ax").description(`${source_default.green("\uD83E\uDDE0")} ${source_default.bold("Axon")} - AI-Powered Development Operating System
|
|
25996
|
+
program2.name("ax").description(`${source_default.green("\uD83E\uDDE0")} ${source_default.bold("Axon")} - AI-Powered Development Operating System (v${VERSION})
|
|
25876
25997
|
|
|
25877
25998
|
${source_default.dim("\u4ECE\u9700\u6C42\u5230\u4EE3\u7801\uFF0C\u8BA9 AI \u6210\u4E3A\u4F60\u7684\u5F00\u53D1\u4F19\u4F34\uFF0C\u800C\u975E\u5DE5\u5177\u3002")}`).version(VERSION, "-v, --version", "\u663E\u793A\u7248\u672C\u53F7").helpOption("-h, --help", "\u663E\u793A\u5E2E\u52A9\u4FE1\u606F");
|
|
25878
25999
|
program2.addCommand(initCommand);
|
|
@@ -25899,7 +26020,7 @@ ${source_default.bold("\u5FEB\u901F\u5F00\u59CB:")}
|
|
|
25899
26020
|
4. ${source_default.cyan("ax plan")} \u62C6\u89E3\u4EFB\u52A1
|
|
25900
26021
|
5. ${source_default.cyan("ax work")} \u5F00\u59CB\u6267\u884C
|
|
25901
26022
|
|
|
25902
|
-
${source_default.dim("\u6587\u6863: https://
|
|
26023
|
+
${source_default.dim("\u6587\u6863: https://github.com/arrislink/axon")}
|
|
25903
26024
|
${source_default.dim("\u95EE\u9898\u53CD\u9988: https://github.com/arrislink/axon/issues")}
|
|
25904
26025
|
`);
|
|
25905
26026
|
process.on("uncaughtException", handleError);
|