@arrislink/axon 1.0.6 → 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 +190 -92
- 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,36 +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: "Axon Skill", value: "skill", description: "\u53EF\u590D\u7528\u7684 AI \u6280\u80FD/\u63D2\u4EF6" },
|
|
16278
|
-
{ name: "CLI
|
|
16279
|
-
{ name: "
|
|
16280
|
-
{ 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") }
|
|
16281
16300
|
]);
|
|
16282
16301
|
const featureOptions = this.getFeatureOptions(projectType);
|
|
16283
|
-
const features = await multiSelect("\u2728 \u9700\u8981\u54EA\u4E9B\u529F\u80FD\uFF1F", featureOptions);
|
|
16284
|
-
const techStack = await select("\uD83D\uDEE0\uFE0F \u6280\u672F\u6808\u504F\u597D\uFF1F", [
|
|
16285
|
-
{ name: "TypeScript + Bun", value: "typescript-bun", description: "\u5FEB\u901F\u3001\u73B0\u4EE3\u7684 JS \u8FD0\u884C\u65F6" },
|
|
16286
|
-
{ name: "TypeScript + Node.js", value: "typescript-node", description: "\u6210\u719F\u7A33\u5B9A\u7684 JS \u8FD0\u884C\u65F6" },
|
|
16287
|
-
{ name: "Go", value: "go", description: "\u9AD8\u6027\u80FD\u3001\u7B80\u6D01\u7684\u8BED\u8A00" },
|
|
16288
|
-
{ name: "Python + FastAPI", value: "python-fastapi", description: "\u5FEB\u901F API \u5F00\u53D1" },
|
|
16289
|
-
{ name: "Rust", value: "rust", description: "\u5185\u5B58\u5B89\u5168\u3001\u9AD8\u6027\u80FD" },
|
|
16290
|
-
{ 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") }
|
|
16291
16310
|
]);
|
|
16292
16311
|
let additionalRequirements = "";
|
|
16293
|
-
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 });
|
|
16294
16313
|
if (hasMore) {
|
|
16295
16314
|
additionalRequirements = await input({
|
|
16296
|
-
message: "\u8BF7\u63CF\u8FF0\u5176\u4ED6\u9700\u6C42:"
|
|
16315
|
+
message: t("Please describe other requirements:", "\u8BF7\u63CF\u8FF0\u5176\u4ED6\u9700\u6C42:")
|
|
16297
16316
|
});
|
|
16298
16317
|
}
|
|
16299
16318
|
return {
|
|
@@ -16306,46 +16325,46 @@ class SpecCollector {
|
|
|
16306
16325
|
}
|
|
16307
16326
|
getFeatureOptions(projectType) {
|
|
16308
16327
|
const common = [
|
|
16309
|
-
{ name: "\u65E5\u5FD7\u8BB0\u5F55", value: "logging" },
|
|
16310
|
-
{ name: "\u9519\u8BEF\u5904\u7406", value: "error-handling" },
|
|
16311
|
-
{ name: "\u914D\u7F6E\u7BA1\u7406", value: "config" },
|
|
16312
|
-
{ 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" }
|
|
16313
16332
|
];
|
|
16314
16333
|
switch (projectType) {
|
|
16315
16334
|
case "api":
|
|
16316
16335
|
return [
|
|
16317
|
-
{ name: "\u7528\u6237\u8BA4\u8BC1 (JWT)", value: "auth-jwt" },
|
|
16336
|
+
{ name: t("Authentication (JWT)", "\u7528\u6237\u8BA4\u8BC1 (JWT)"), value: "auth-jwt" },
|
|
16318
16337
|
{ name: "OAuth 2.0", value: "oauth" },
|
|
16319
|
-
{ name: "CRUD \u57FA\u7840\u63A5\u53E3", value: "crud" },
|
|
16320
|
-
{ name: "\u6570\u636E\u9A8C\u8BC1", value: "validation" },
|
|
16321
|
-
{ name: "API \u6587\u6863 (OpenAPI)", value: "openapi" },
|
|
16322
|
-
{ 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" },
|
|
16323
16342
|
...common
|
|
16324
16343
|
];
|
|
16325
16344
|
case "webapp":
|
|
16326
16345
|
return [
|
|
16327
|
-
{ name: "\u7528\u6237\u8BA4\u8BC1", value: "auth" },
|
|
16328
|
-
{ name: "\u54CD\u5E94\u5F0F UI", value: "responsive" },
|
|
16329
|
-
{ name: "\u72B6\u6001\u7BA1\u7406", value: "state" },
|
|
16330
|
-
{ name: "\u8DEF\u7531", value: "routing" },
|
|
16331
|
-
{ 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" },
|
|
16332
16351
|
...common
|
|
16333
16352
|
];
|
|
16334
16353
|
case "cli":
|
|
16335
16354
|
return [
|
|
16336
|
-
{ name: "\u4EA4\u4E92\u5F0F\u63D0\u793A", value: "interactive" },
|
|
16337
|
-
{ name: "\u914D\u7F6E\u6587\u4EF6\u652F\u6301", value: "config-file" },
|
|
16338
|
-
{ name: "\u5E2E\u52A9\u6587\u6863", value: "help" },
|
|
16339
|
-
{ name: "\u8FDB\u5EA6\u663E\u793A", value: "progress" },
|
|
16340
|
-
{ 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" },
|
|
16341
16360
|
...common
|
|
16342
16361
|
];
|
|
16343
16362
|
case "skill":
|
|
16344
16363
|
return [
|
|
16345
|
-
{ name: "\u529F\u80FD\u63CF\u8FF0 (Skill Spec)", value: "skill-spec" },
|
|
16346
|
-
{ name: "\u4F7F\u7528\u793A\u4F8B (Examples)", value: "skill-examples" },
|
|
16347
|
-
{ name: "\u6838\u5FC3\u903B\u8F91 (Beads)", value: "skill-logic" },
|
|
16348
|
-
{ name: "\u4F9D\u8D56\u7BA1\u7406", value: "skill-deps" },
|
|
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" },
|
|
16349
16368
|
...common
|
|
16350
16369
|
];
|
|
16351
16370
|
default:
|
|
@@ -16356,6 +16375,7 @@ class SpecCollector {
|
|
|
16356
16375
|
var init_collector = __esm(() => {
|
|
16357
16376
|
init_prompt();
|
|
16358
16377
|
init_logger();
|
|
16378
|
+
init_i18n();
|
|
16359
16379
|
});
|
|
16360
16380
|
|
|
16361
16381
|
// src/core/integrations/anthropic.ts
|
|
@@ -17628,7 +17648,7 @@ class SkillsLibrary {
|
|
|
17628
17648
|
}
|
|
17629
17649
|
let result = [...this.skills];
|
|
17630
17650
|
if (filter?.tags?.length) {
|
|
17631
|
-
result = result.filter((s) => s.metadata.tags.some((
|
|
17651
|
+
result = result.filter((s) => s.metadata.tags.some((t2) => filter.tags?.includes(t2)));
|
|
17632
17652
|
}
|
|
17633
17653
|
if (filter?.difficulty) {
|
|
17634
17654
|
result = result.filter((s) => s.metadata.difficulty === filter.difficulty);
|
|
@@ -19723,6 +19743,9 @@ var {
|
|
|
19723
19743
|
|
|
19724
19744
|
// src/index.ts
|
|
19725
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";
|
|
19726
19749
|
|
|
19727
19750
|
// src/commands/init.ts
|
|
19728
19751
|
init_source();
|
|
@@ -24767,11 +24790,12 @@ function progressBar(current, total, width = 20) {
|
|
|
24767
24790
|
|
|
24768
24791
|
// src/commands/init.ts
|
|
24769
24792
|
init_errors();
|
|
24793
|
+
init_i18n();
|
|
24770
24794
|
var import_prompts = __toESM(require_prompts3(), 1);
|
|
24771
|
-
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) => {
|
|
24772
24796
|
const projectPath = projectName === "." ? process.cwd() : join4(process.cwd(), projectName);
|
|
24773
24797
|
const name = projectName === "." ? basename(process.cwd()) : projectName;
|
|
24774
|
-
logger.title("Axon \u9879\u76EE\u521D\u59CB\u5316");
|
|
24798
|
+
logger.title(t("Axon Project Initialization", "Axon \u9879\u76EE\u521D\u59CB\u5316"));
|
|
24775
24799
|
if (ConfigManager.isAxonProject(projectPath)) {
|
|
24776
24800
|
throw new AxonError("\u9879\u76EE\u5DF2\u521D\u59CB\u5316", "INIT_ERROR", [
|
|
24777
24801
|
`\u76EE\u5F55 ${projectPath} \u5DF2\u5B58\u5728 .axon \u914D\u7F6E`,
|
|
@@ -24780,7 +24804,7 @@ var initCommand = new Command("init").description("\u521D\u59CB\u5316\u65B0\u768
|
|
|
24780
24804
|
}
|
|
24781
24805
|
const existingConfigs = detectExistingConfig(projectPath);
|
|
24782
24806
|
if (existingConfigs.hasOpenCode || existingConfigs.hasBeads) {
|
|
24783
|
-
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"));
|
|
24784
24808
|
if (existingConfigs.hasOpenCode)
|
|
24785
24809
|
console.log(source_default.dim(" - .opencode/ (OpenCode)"));
|
|
24786
24810
|
if (existingConfigs.hasBeads)
|
|
@@ -24789,16 +24813,16 @@ var initCommand = new Command("init").description("\u521D\u59CB\u5316\u65B0\u768
|
|
|
24789
24813
|
const response = await import_prompts.default({
|
|
24790
24814
|
type: "select",
|
|
24791
24815
|
name: "action",
|
|
24792
|
-
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"),
|
|
24793
24817
|
choices: [
|
|
24794
|
-
{ title: "\u4FDD\u7559\u73B0\u6709\u914D\u7F6E (Merge)", value: "merge", description: "\u4FDD\u7559\u73B0\u6709\u6587\u4EF6\uFF0C\u4EC5\u6DFB\u52A0 Axon \u914D\u7F6E" },
|
|
24795
|
-
{ title: "\u5907\u4EFD\u5E76\u521B\u5EFA\u65B0\u914D\u7F6E (Backup)", value: "backup", description: "\u5907\u4EFD\u73B0\u6709\u76EE\u5F55\u4E3A .backup \u540E\u91CD\u5EFA" },
|
|
24796
|
-
{ 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" }
|
|
24797
24821
|
],
|
|
24798
24822
|
initial: 0
|
|
24799
24823
|
});
|
|
24800
24824
|
if (!response.action || response.action === "cancel") {
|
|
24801
|
-
logger.info("\u5DF2\u53D6\u6D88\u521D\u59CB\u5316");
|
|
24825
|
+
logger.info(t("Initialization cancelled", "\u5DF2\u53D6\u6D88\u521D\u59CB\u5316"));
|
|
24802
24826
|
return;
|
|
24803
24827
|
}
|
|
24804
24828
|
if (response.action === "backup") {
|
|
@@ -24809,15 +24833,15 @@ var initCommand = new Command("init").description("\u521D\u59CB\u5316\u65B0\u768
|
|
|
24809
24833
|
if (existingConfigs.hasBeads) {
|
|
24810
24834
|
await Bun.$`mv ${join4(projectPath, ".beads")} ${join4(projectPath, `.beads.backup.${timestamp}`)}`;
|
|
24811
24835
|
}
|
|
24812
|
-
logger.success(
|
|
24836
|
+
logger.success(t("\u2705 Existing configuration backed up", "\u2705 \u5DF2\u5907\u4EFD\u73B0\u6709\u914D\u7F6E"));
|
|
24813
24837
|
}
|
|
24814
24838
|
}
|
|
24815
24839
|
if (!existsSync3(projectPath)) {
|
|
24816
|
-
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)}`));
|
|
24817
24841
|
mkdirSync2(projectPath, { recursive: true });
|
|
24818
24842
|
spinner.succeed();
|
|
24819
24843
|
}
|
|
24820
|
-
spinner.start("\u521B\u5EFA Axon \u76EE\u5F55\u7ED3\u6784");
|
|
24844
|
+
spinner.start(t("Creating Axon directory structure", "\u521B\u5EFA Axon \u76EE\u5F55\u7ED3\u6784"));
|
|
24821
24845
|
for (const dir of DEFAULT_DIRECTORIES) {
|
|
24822
24846
|
const fullPath = join4(projectPath, dir);
|
|
24823
24847
|
if (!existsSync3(fullPath)) {
|
|
@@ -24825,30 +24849,33 @@ var initCommand = new Command("init").description("\u521D\u59CB\u5316\u65B0\u768
|
|
|
24825
24849
|
}
|
|
24826
24850
|
}
|
|
24827
24851
|
spinner.succeed();
|
|
24828
|
-
spinner.start("\u751F\u6210\u914D\u7F6E\u6587\u4EF6");
|
|
24852
|
+
spinner.start(t("Generating configuration file", "\u751F\u6210\u914D\u7F6E\u6587\u4EF6"));
|
|
24829
24853
|
ConfigManager.initialize(projectPath, name);
|
|
24830
24854
|
spinner.succeed();
|
|
24831
24855
|
if (!options.skipReadme && !existsSync3(join4(projectPath, "README.md"))) {
|
|
24832
|
-
spinner.start("\u751F\u6210 README.md");
|
|
24856
|
+
spinner.start(t("Generating README.md", "\u751F\u6210 README.md"));
|
|
24833
24857
|
const readme = generateReadme(name);
|
|
24834
24858
|
await Bun.write(join4(projectPath, "README.md"), readme);
|
|
24835
24859
|
spinner.succeed();
|
|
24836
24860
|
}
|
|
24837
|
-
spinner.start("\u751F\u6210\u5165\u95E8\u6307\u5357");
|
|
24861
|
+
spinner.start(t("Generating Quick Start guide", "\u751F\u6210\u5165\u95E8\u6307\u5357"));
|
|
24838
24862
|
const gettingStarted = generateGettingStarted(name);
|
|
24839
24863
|
await Bun.write(join4(projectPath, "GETTING_STARTED.md"), gettingStarted);
|
|
24840
24864
|
spinner.succeed();
|
|
24841
24865
|
if (!existsSync3(join4(projectPath, ".openspec", "spec.md"))) {
|
|
24842
|
-
spinner.start("\u521B\u5EFA\u89C4\u683C\u6A21\u677F");
|
|
24843
|
-
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
|
|
24844
24871
|
|
|
24845
24872
|
(\u5F85\u586B\u5199)
|
|
24846
|
-
|
|
24873
|
+
`);
|
|
24847
24874
|
await Bun.write(join4(projectPath, ".openspec", "spec.md"), specContent);
|
|
24848
24875
|
spinner.succeed();
|
|
24849
24876
|
}
|
|
24850
24877
|
if (!options.skipGit) {
|
|
24851
|
-
spinner.start("\u521D\u59CB\u5316 Git \u4ED3\u5E93");
|
|
24878
|
+
spinner.start(t("Initializing Git repository", "\u521D\u59CB\u5316 Git \u4ED3\u5E93"));
|
|
24852
24879
|
const git = new GitOperations(projectPath);
|
|
24853
24880
|
if (!git.isGitRepo()) {
|
|
24854
24881
|
await git.init();
|
|
@@ -24859,31 +24886,57 @@ var initCommand = new Command("init").description("\u521D\u59CB\u5316\u65B0\u768
|
|
|
24859
24886
|
}
|
|
24860
24887
|
logger.blank();
|
|
24861
24888
|
logger.divider();
|
|
24862
|
-
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`));
|
|
24863
24890
|
logger.blank();
|
|
24864
|
-
console.log(source_default.dim("\u5DF2\u521B\u5EFA\u4EE5\u4E0B\u7ED3\u6784:"));
|
|
24865
|
-
console.log(` ${source_default.cyan(".axon/")} - \u914D\u7F6E\u548C\u5143\u6570\u636E`);
|
|
24866
|
-
console.log(` ${source_default.cyan(".openspec/")} - \u89C4\u683C\u6587\u6863`);
|
|
24867
|
-
console.log(` ${source_default.cyan(".beads/")} - \u4EFB\u52A1\u56FE`);
|
|
24868
|
-
console.log(` ${source_default.cyan(".skills/")} - \u672C\u5730\u6280\u80FD\u5E93`);
|
|
24869
|
-
console.log(` ${source_default.cyan("GETTING_STARTED.md")} - \u5165\u95E8\u6307\u5357`);
|
|
24870
|
-
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")}`);
|
|
24871
24898
|
logger.blank();
|
|
24872
|
-
console.log(source_default.bold("\u4E0B\u4E00\u6B65:"));
|
|
24899
|
+
console.log(source_default.bold(t("Next steps:", "\u4E0B\u4E00\u6B65:")));
|
|
24873
24900
|
console.log(` 1. ${source_default.cyan("cd " + (projectName === "." ? "" : projectName))}`);
|
|
24874
|
-
console.log(` 2. ${source_default.cyan("cat GETTING_STARTED.md")} - \u9605\u8BFB\u5165\u95E8\u6307\u5357`);
|
|
24875
|
-
console.log(` 3. ${source_default.cyan("ax spec init")} - \u5B9A\u4E49\u9879\u76EE\u89C4\u683C`);
|
|
24876
|
-
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")}`);
|
|
24877
24904
|
logger.blank();
|
|
24878
24905
|
});
|
|
24879
|
-
function detectExistingConfig(projectPath) {
|
|
24880
|
-
return {
|
|
24881
|
-
hasOpenCode: existsSync3(join4(projectPath, ".opencode")),
|
|
24882
|
-
hasBeads: existsSync3(join4(projectPath, ".beads"))
|
|
24883
|
-
};
|
|
24884
|
-
}
|
|
24885
24906
|
function generateGettingStarted(name) {
|
|
24886
|
-
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
|
|
24887
24940
|
|
|
24888
24941
|
## 1. \u914D\u7F6E Provider
|
|
24889
24942
|
Axon \u4F7F\u7528 OhMyOpenCode (OMO) \u7BA1\u7406 LLM Provider\u3002
|
|
@@ -24915,12 +24968,48 @@ ax work
|
|
|
24915
24968
|
\`\`\`
|
|
24916
24969
|
|
|
24917
24970
|
\u66F4\u591A\u6587\u6863\u8BF7\u67E5\u770B [README.md](./README.md)\u3002
|
|
24918
|
-
|
|
24971
|
+
`);
|
|
24919
24972
|
}
|
|
24920
24973
|
function generateReadme(name) {
|
|
24921
|
-
return `# ${name}
|
|
24974
|
+
return t(`# ${name}
|
|
24975
|
+
|
|
24976
|
+
> AI-assisted development project created by [Axon](https://github.com/arrislink/axon)
|
|
24977
|
+
|
|
24978
|
+
## Getting Started
|
|
24979
|
+
|
|
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}
|
|
24922
25011
|
|
|
24923
|
-
> \u7531 [Axon](https://github.com/axon) \u521B\u5EFA\u7684 AI \u8F85\u52A9\u5F00\u53D1\u9879\u76EE
|
|
25012
|
+
> \u7531 [Axon](https://github.com/arrislink/axon) \u521B\u5EFA\u7684 AI \u8F85\u52A9\u5F00\u53D1\u9879\u76EE
|
|
24924
25013
|
|
|
24925
25014
|
## \u5F00\u59CB
|
|
24926
25015
|
|
|
@@ -24954,7 +25043,13 @@ ax work
|
|
|
24954
25043
|
---
|
|
24955
25044
|
|
|
24956
25045
|
\u7531 \uD83E\uDDE0 Axon \u63D0\u4F9B\u652F\u6301
|
|
24957
|
-
|
|
25046
|
+
`);
|
|
25047
|
+
}
|
|
25048
|
+
function detectExistingConfig(projectPath) {
|
|
25049
|
+
return {
|
|
25050
|
+
hasOpenCode: existsSync3(join4(projectPath, ".opencode")),
|
|
25051
|
+
hasBeads: existsSync3(join4(projectPath, ".beads"))
|
|
25052
|
+
};
|
|
24958
25053
|
}
|
|
24959
25054
|
// src/commands/spec.ts
|
|
24960
25055
|
init_source();
|
|
@@ -25317,7 +25412,7 @@ skillsCommand.command("list").description("\u5217\u51FA\u6240\u6709\u6280\u80FD"
|
|
|
25317
25412
|
const library2 = new SkillsLibrary(localPath, globalPath);
|
|
25318
25413
|
const filter = {};
|
|
25319
25414
|
if (options.tags) {
|
|
25320
|
-
filter.tags = options.tags.split(",").map((
|
|
25415
|
+
filter.tags = options.tags.split(",").map((t2) => t2.trim());
|
|
25321
25416
|
}
|
|
25322
25417
|
if (options.difficulty) {
|
|
25323
25418
|
filter.difficulty = options.difficulty;
|
|
@@ -25362,7 +25457,7 @@ skillsCommand.command("save <path>").description("\u5C06\u6587\u4EF6\u4FDD\u5B58
|
|
|
25362
25457
|
const library2 = new SkillsLibrary(join9(projectRoot, config.tools.skills.local_path), config.tools.skills.global_path);
|
|
25363
25458
|
const content = await Bun.file(filePath).text();
|
|
25364
25459
|
const name = options.name || basename3(filePath).replace(/\.[^.]+$/, "");
|
|
25365
|
-
const tags = options.tags ? options.tags.split(",").map((
|
|
25460
|
+
const tags = options.tags ? options.tags.split(",").map((t2) => t2.trim()) : ["custom"];
|
|
25366
25461
|
const skill = {
|
|
25367
25462
|
metadata: {
|
|
25368
25463
|
name,
|
|
@@ -25893,9 +25988,12 @@ configCommand.command("keys").description("\u5FEB\u901F\u8BBE\u7F6E API \u5BC6\u
|
|
|
25893
25988
|
});
|
|
25894
25989
|
// src/index.ts
|
|
25895
25990
|
init_errors();
|
|
25896
|
-
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;
|
|
25897
25995
|
var program2 = new Command;
|
|
25898
|
-
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})
|
|
25899
25997
|
|
|
25900
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");
|
|
25901
25999
|
program2.addCommand(initCommand);
|
|
@@ -25922,7 +26020,7 @@ ${source_default.bold("\u5FEB\u901F\u5F00\u59CB:")}
|
|
|
25922
26020
|
4. ${source_default.cyan("ax plan")} \u62C6\u89E3\u4EFB\u52A1
|
|
25923
26021
|
5. ${source_default.cyan("ax work")} \u5F00\u59CB\u6267\u884C
|
|
25924
26022
|
|
|
25925
|
-
${source_default.dim("\u6587\u6863: https://
|
|
26023
|
+
${source_default.dim("\u6587\u6863: https://github.com/arrislink/axon")}
|
|
25926
26024
|
${source_default.dim("\u95EE\u9898\u53CD\u9988: https://github.com/arrislink/axon/issues")}
|
|
25927
26025
|
`);
|
|
25928
26026
|
process.on("uncaughtException", handleError);
|