@arrislink/axon 1.0.8 → 1.0.9

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.
Files changed (2) hide show
  1. package/dist/index.js +29 -7
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -16291,13 +16291,35 @@ async function password(message) {
16291
16291
  return response.value || "";
16292
16292
  }
16293
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 || "";
16294
+ const editorCmd = process.env["EDITOR"] || process.env["VISUAL"] || "nano";
16295
+ const tmpFile = `${process.cwd()}/.axon-editor-${Date.now()}.md`;
16296
+ try {
16297
+ if (defaultValue) {
16298
+ await Bun.write(tmpFile, defaultValue);
16299
+ }
16300
+ const proc = Bun.spawnSync([editorCmd, tmpFile]);
16301
+ if (proc.success) {
16302
+ const edited = await Bun.file(tmpFile).text();
16303
+ return edited;
16304
+ }
16305
+ throw new Error("Editor exited with error");
16306
+ } catch (err) {
16307
+ console.warn("\u26A0\uFE0F \u5916\u90E8\u7F16\u8F91\u5668\u4E0D\u53EF\u7528\uFF0C\u8BF7\u76F4\u63A5\u8F93\u5165\u5185\u5BB9");
16308
+ const response = await import_prompts2.default({
16309
+ type: "text",
16310
+ name: "value",
16311
+ message,
16312
+ initial: defaultValue
16313
+ });
16314
+ return response.value || "";
16315
+ } finally {
16316
+ try {
16317
+ const file = Bun.file(tmpFile);
16318
+ if (await file.exists()) {
16319
+ await Bun.spawn(["rm", tmpFile]).exited;
16320
+ }
16321
+ } catch {}
16322
+ }
16301
16323
  }
16302
16324
  var import_prompts2;
16303
16325
  var init_prompt = __esm(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arrislink/axon",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "AI-Powered Development Operating System with unified LLM provider support",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -50,7 +50,7 @@
50
50
  "license": "MIT",
51
51
  "repository": {
52
52
  "type": "git",
53
- "url": "https://github.com/arrislink/axon.git"
53
+ "url": "git+https://github.com/arrislink/axon.git"
54
54
  },
55
55
  "bugs": {
56
56
  "url": "https://github.com/arrislink/axon/issues"
@@ -75,4 +75,4 @@
75
75
  "bun": ">=1.1.0",
76
76
  "node": ">=18.0.0"
77
77
  }
78
- }
78
+ }