@arrislink/axon 1.0.7 → 1.0.8
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/README.md +1 -0
- package/dist/index.js +59 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -129,6 +129,7 @@ graph LR
|
|
|
129
129
|
|---------|-------------|
|
|
130
130
|
| `ax init [name]` | Initialize a new Axon project |
|
|
131
131
|
| `ax spec init` | Create project specification interactively |
|
|
132
|
+
| `ax spec edit` | Edit the existing specification |
|
|
132
133
|
| `ax spec show` | Display current specification |
|
|
133
134
|
| `ax plan` | Generate task graph from specification |
|
|
134
135
|
| `ax work` | Execute the next task |
|
package/dist/index.js
CHANGED
|
@@ -16228,6 +16228,15 @@ var init_i18n = __esm(() => {
|
|
|
16228
16228
|
});
|
|
16229
16229
|
|
|
16230
16230
|
// src/utils/prompt.ts
|
|
16231
|
+
var exports_prompt = {};
|
|
16232
|
+
__export(exports_prompt, {
|
|
16233
|
+
select: () => select,
|
|
16234
|
+
password: () => password,
|
|
16235
|
+
multiSelect: () => multiSelect,
|
|
16236
|
+
input: () => input,
|
|
16237
|
+
editor: () => editor,
|
|
16238
|
+
confirm: () => confirm
|
|
16239
|
+
});
|
|
16231
16240
|
async function confirm(options) {
|
|
16232
16241
|
const response = await import_prompts2.default({
|
|
16233
16242
|
type: "confirm",
|
|
@@ -16273,6 +16282,23 @@ async function input(options) {
|
|
|
16273
16282
|
});
|
|
16274
16283
|
return response.value || "";
|
|
16275
16284
|
}
|
|
16285
|
+
async function password(message) {
|
|
16286
|
+
const response = await import_prompts2.default({
|
|
16287
|
+
type: "password",
|
|
16288
|
+
name: "value",
|
|
16289
|
+
message
|
|
16290
|
+
});
|
|
16291
|
+
return response.value || "";
|
|
16292
|
+
}
|
|
16293
|
+
async function editor(message, defaultValue) {
|
|
16294
|
+
const response = await import_prompts2.default({
|
|
16295
|
+
type: "text",
|
|
16296
|
+
name: "value",
|
|
16297
|
+
message: `${message} (Editor not supported, please enter text)`,
|
|
16298
|
+
initial: defaultValue
|
|
16299
|
+
});
|
|
16300
|
+
return response.value || "";
|
|
16301
|
+
}
|
|
16276
16302
|
var import_prompts2;
|
|
16277
16303
|
var init_prompt = __esm(() => {
|
|
16278
16304
|
import_prompts2 = __toESM(require_prompts3(), 1);
|
|
@@ -25105,6 +25131,38 @@ specCommand.command("init").description("\u4EA4\u4E92\u5F0F\u521B\u5EFA\u9879\u7
|
|
|
25105
25131
|
console.log(` 1. \u5BA1\u9605\u5E76\u7F16\u8F91 ${source_default.cyan(".openspec/spec.md")}`);
|
|
25106
25132
|
console.log(` 2. ${source_default.cyan("ax plan")} - \u751F\u6210\u4EFB\u52A1\u56FE`);
|
|
25107
25133
|
});
|
|
25134
|
+
specCommand.command("edit").description("\u7F16\u8F91\u9879\u76EE\u89C4\u683C\u6587\u6863").action(async () => {
|
|
25135
|
+
const projectRoot = process.cwd();
|
|
25136
|
+
if (!ConfigManager.isAxonProject(projectRoot)) {
|
|
25137
|
+
throw new AxonError("\u5F53\u524D\u76EE\u5F55\u4E0D\u662F Axon \u9879\u76EE", "SPEC_ERROR", [
|
|
25138
|
+
"\u8BF7\u5148\u8FD0\u884C `ax init` \u521D\u59CB\u5316\u9879\u76EE"
|
|
25139
|
+
]);
|
|
25140
|
+
}
|
|
25141
|
+
const configManager = new ConfigManager(projectRoot);
|
|
25142
|
+
const config = configManager.get();
|
|
25143
|
+
const specPath = join5(projectRoot, config.tools.openspec.path, "spec.md");
|
|
25144
|
+
if (!existsSync6(specPath)) {
|
|
25145
|
+
throw new AxonError("\u89C4\u683C\u6587\u6863\u4E0D\u5B58\u5728", "SPEC_ERROR", ["\u4F7F\u7528 `ax spec init` \u521B\u5EFA\u89C4\u683C\u6587\u6863"]);
|
|
25146
|
+
}
|
|
25147
|
+
const content = readFileSync3(specPath, "utf-8");
|
|
25148
|
+
spinner.start("\u6253\u5F00\u7F16\u8F91\u5668");
|
|
25149
|
+
try {
|
|
25150
|
+
const { editor: editor2 } = await Promise.resolve().then(() => (init_prompt(), exports_prompt));
|
|
25151
|
+
const edited = await editor2("\u7F16\u8F91\u89C4\u683C\u6587\u6863:", content);
|
|
25152
|
+
if (edited !== content) {
|
|
25153
|
+
await Bun.write(specPath, edited);
|
|
25154
|
+
spinner.succeed("\u89C4\u683C\u6587\u6863\u5DF2\u4FDD\u5B58");
|
|
25155
|
+
} else {
|
|
25156
|
+
spinner.stop();
|
|
25157
|
+
logger.info("\u672A\u505A\u4EFB\u4F55\u66F4\u6539");
|
|
25158
|
+
}
|
|
25159
|
+
} catch (error) {
|
|
25160
|
+
spinner.fail();
|
|
25161
|
+
throw new AxonError("\u7F16\u8F91\u89C4\u683C\u6587\u6863\u5931\u8D25", "SPEC_ERROR", [
|
|
25162
|
+
error instanceof Error ? error.message : "\u672A\u77E5\u9519\u8BEF"
|
|
25163
|
+
]);
|
|
25164
|
+
}
|
|
25165
|
+
});
|
|
25108
25166
|
specCommand.command("show").description("\u663E\u793A\u5F53\u524D\u89C4\u683C\u6587\u6863").action(() => {
|
|
25109
25167
|
const projectRoot = process.cwd();
|
|
25110
25168
|
if (!ConfigManager.isAxonProject(projectRoot)) {
|
|
@@ -25130,9 +25188,7 @@ specCommand.command("validate").description("\u9A8C\u8BC1\u89C4\u683C\u6587\u686
|
|
|
25130
25188
|
const config = configManager.get();
|
|
25131
25189
|
const specPath = join5(projectRoot, config.tools.openspec.path, "spec.md");
|
|
25132
25190
|
if (!existsSync6(specPath)) {
|
|
25133
|
-
throw new AxonError("\u89C4\u683C\u6587\u6863\u4E0D\u5B58\u5728", "SPEC_ERROR", [
|
|
25134
|
-
"\u4F7F\u7528 `ax spec init` \u521B\u5EFA\u89C4\u683C\u6587\u6863"
|
|
25135
|
-
]);
|
|
25191
|
+
throw new AxonError("\u89C4\u683C\u6587\u6863\u4E0D\u5B58\u5728", "SPEC_ERROR", ["\u4F7F\u7528 `ax spec init` \u521B\u5EFA\u89C4\u683C\u6587\u6863"]);
|
|
25136
25192
|
}
|
|
25137
25193
|
const content = readFileSync3(specPath, "utf-8");
|
|
25138
25194
|
const issues = [];
|