@lumi-ai-lab/harness-data 0.0.4 → 0.0.6

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/src/lib/paths.js CHANGED
@@ -2,7 +2,6 @@ import fs from "node:fs";
2
2
  import os from "node:os";
3
3
  import path from "node:path";
4
4
 
5
- const appDir = path.join("lumi-ai-lab", "harness-data");
6
5
  const stateDir = path.join("lumi-ai-lab", "harness-data-installer");
7
6
 
8
7
  export function expandHome(value) {
@@ -13,9 +12,7 @@ export function expandHome(value) {
13
12
  }
14
13
 
15
14
  export function defaultWorkspaceDir() {
16
- if (process.platform === "darwin") return path.join(os.homedir(), "Library", "Application Support", appDir);
17
- if (process.platform === "win32") return path.join(process.env.LOCALAPPDATA || path.join(os.homedir(), "AppData", "Local"), appDir);
18
- return path.join(process.env.XDG_DATA_HOME || path.join(os.homedir(), ".local", "share"), appDir);
15
+ return process.cwd();
19
16
  }
20
17
 
21
18
  export function userStatePath() {
@@ -62,6 +59,6 @@ export function findWorkspaceDir(explicitDir) {
62
59
 
63
60
  export function looksLikeWorkspace(dir) {
64
61
  return fs.existsSync(path.join(dir, "bootstrap", "cli-manifest.json")) &&
65
- fs.existsSync(path.join(dir, ".agents")) &&
62
+ fs.existsSync(path.join(dir, "agents")) &&
66
63
  fs.existsSync(path.join(dir, "wikis"));
67
64
  }
@@ -2,8 +2,12 @@ export function platformKey() {
2
2
  const os = process.platform === "darwin" ? "darwin" : process.platform === "linux" ? "linux" : process.platform === "win32" ? "windows" : process.platform;
3
3
  const arch = process.arch === "x64" ? "amd64" : process.arch;
4
4
  const key = `${os}-${arch}`;
5
- if (!["darwin-arm64", "darwin-amd64", "linux-arm64", "linux-amd64"].includes(key)) {
5
+ if (!["darwin-arm64", "darwin-amd64", "linux-amd64", "windows-amd64"].includes(key)) {
6
6
  throw new Error(`unsupported platform: ${key}`);
7
7
  }
8
8
  return key;
9
9
  }
10
+
11
+ export function binaryName(name) {
12
+ return process.platform === "win32" ? `${name}.exe` : name;
13
+ }
package/src/lib/prompt.js CHANGED
@@ -1,7 +1,8 @@
1
1
  import readline from "node:readline/promises";
2
2
  import { stdin as input, stdout as output } from "node:process";
3
+ import { Writable } from "node:stream";
3
4
 
4
- const agentChoices = ["claude", "codex", "pi", "both", "all"];
5
+ const agentChoices = ["claude", "codex", "pi", "all"];
5
6
 
6
7
  export async function confirm(message, options = {}) {
7
8
  if (options.yes) return true;
@@ -19,17 +20,47 @@ export async function confirm(message, options = {}) {
19
20
  export async function chooseAgent(options = {}) {
20
21
  if (options.agent) {
21
22
  const value = String(options.agent).trim().toLowerCase();
22
- if (!agentChoices.includes(value)) throw new Error("agent must be claude, codex, pi, both, or all");
23
+ if (!agentChoices.includes(value)) throw new Error("agent must be claude, codex, pi, or all");
23
24
  return value;
24
25
  }
25
- if (options.yes) throw new Error("non-interactive install requires --agent claude|codex|pi|both|all");
26
+ if (options.yes) return "all";
26
27
  const rl = readline.createInterface({ input, output });
27
28
  try {
28
- const answer = (await rl.question("Choose Agent: claude, codex, pi, both, all [codex] ")).trim().toLowerCase();
29
- const value = answer || "codex";
30
- if (!agentChoices.includes(value)) throw new Error("agent must be claude, codex, pi, both, or all");
29
+ const answer = (await rl.question("选择 Agentclaude, codex, pi, all [all] ")).trim().toLowerCase();
30
+ const value = answer || "all";
31
+ if (!agentChoices.includes(value)) throw new Error("agent must be claude, codex, pi, or all");
31
32
  return value;
32
33
  } finally {
33
34
  rl.close();
34
35
  }
35
36
  }
37
+
38
+ export async function ask(message, options = {}) {
39
+ if (options.value) return String(options.value);
40
+ if (options.yes) throw new Error(`${message} is required`);
41
+ const rl = readline.createInterface({ input, output });
42
+ try {
43
+ return (await rl.question(`${message} `)).trim();
44
+ } finally {
45
+ rl.close();
46
+ }
47
+ }
48
+
49
+ export async function askSecret(message, options = {}) {
50
+ if (options.value) return String(options.value);
51
+ if (options.yes) throw new Error(`${message} is required`);
52
+ const muted = new Writable({
53
+ write(_chunk, _encoding, callback) {
54
+ callback();
55
+ }
56
+ });
57
+ output.write(`${message} `);
58
+ const rl = readline.createInterface({ input, output: muted, terminal: true });
59
+ try {
60
+ const answer = (await rl.question("")).trim();
61
+ output.write("\n");
62
+ return answer;
63
+ } finally {
64
+ rl.close();
65
+ }
66
+ }