@lumi-ai-lab/harness-data 0.0.21 → 0.0.22
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 +2 -2
- package/package.json +1 -1
- package/src/commands/doctor.js +6 -4
- package/src/commands/install.js +9 -4
- package/src/commands/update.js +2 -1
- package/src/lib/config.js +4 -2
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ or:
|
|
|
24
24
|
GITHUB_TOKEN=... npx @lumi-ai-lab/harness-data install
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
Without a GitHub token, the installer interactively asks for local absolute paths to `cas-cli`, `qdm-indicators-cli`, `qdm-cmr-cli`, and `harness-data-wikis`. CAS username and password are always collected interactively.
|
|
27
|
+
Without a GitHub token, the installer interactively asks for local absolute paths to `cas-cli`, `qdm-indicators-cli`, `qdm-cmr-cli`, `qdm-sql-cli`, and `harness-data-wikis`. CAS username and password are always collected interactively.
|
|
28
28
|
|
|
29
29
|
Update an existing runtime interactively:
|
|
30
30
|
|
|
@@ -38,6 +38,6 @@ Diagnose a runtime:
|
|
|
38
38
|
npx @lumi-ai-lab/harness-data doctor
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
-
The runtime is assembled from the `harness-data` runtime bundle, platform-specific CLI Release assets, `harness-data-wikis`, generated local config, CAS credentials, and selected Agent symlinks.
|
|
41
|
+
The runtime is assembled from the `harness-data` runtime bundle, platform-specific CLI Release assets, `harness-data-wikis`, generated local config, CAS credentials, and selected Agent symlinks. SQL CLI tokens are fetched through `cas-cli token --app rtp`.
|
|
42
42
|
|
|
43
43
|
`--agent` supports `claude`, `codex`, `pi`, `openclaw`, `hermes`, `both`, and `all`; the default is `all`. `both` installs Claude + Codex, while `all` installs Claude + Codex + Pi + OpenClaw + Hermes.
|
package/package.json
CHANGED
package/src/commands/doctor.js
CHANGED
|
@@ -3,7 +3,7 @@ import path from "node:path";
|
|
|
3
3
|
import { run } from "../lib/exec.js";
|
|
4
4
|
import { findWorkspaceDir } from "../lib/paths.js";
|
|
5
5
|
import { binaryName } from "../lib/platform.js";
|
|
6
|
-
import { concreteAgentNames } from "../lib/config.js";
|
|
6
|
+
import { concreteAgentNames, qdmCliBinaries } from "../lib/config.js";
|
|
7
7
|
|
|
8
8
|
function existsExecutable(file) {
|
|
9
9
|
try {
|
|
@@ -36,8 +36,9 @@ function configPathsValid(workspace) {
|
|
|
36
36
|
const file = path.join(workspace, "config", "qdm-cli-paths.env");
|
|
37
37
|
if (!fs.existsSync(file)) return false;
|
|
38
38
|
const content = fs.readFileSync(file, "utf8");
|
|
39
|
-
const
|
|
40
|
-
|
|
39
|
+
const required = ["QDM_CMR_CLI", "QDM_INDICATORS_CLI", "QDM_SQL_CLI", "QDM_CAS_CLI"];
|
|
40
|
+
const values = new Map([...content.matchAll(/^export\s+([A-Z0-9_]+)="([^"]+)"/gm)].map((match) => [match[1], match[2]]));
|
|
41
|
+
return required.every((name) => values.has(name) && fs.existsSync(values.get(name)));
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
function casCredentialsValid(dir) {
|
|
@@ -66,7 +67,7 @@ export async function collectDoctor(workspace, options = {}) {
|
|
|
66
67
|
add("wikis/reports", fs.existsSync(path.join(workspace, "wikis", "reports")));
|
|
67
68
|
add("wikis/dims", fs.existsSync(path.join(workspace, "wikis", "dims")));
|
|
68
69
|
add("wikis/rules", fs.existsSync(path.join(workspace, "wikis", "rules")));
|
|
69
|
-
for (const binary of
|
|
70
|
+
for (const binary of qdmCliBinaries) {
|
|
70
71
|
add(`bin/${binary}`, existsExecutable(path.join(workspace, "bin", binaryName(binary))));
|
|
71
72
|
}
|
|
72
73
|
add("config/harness-config.yaml", fs.existsSync(path.join(workspace, "config", "harness-config.yaml")));
|
|
@@ -75,6 +76,7 @@ export async function collectDoctor(workspace, options = {}) {
|
|
|
75
76
|
add("CAS credentials file", casCredentialsValid(casConfigDir), casConfigDir);
|
|
76
77
|
add("CMR token", await tokenCheck(workspace, "qdm-cmr-cli", env));
|
|
77
78
|
add("Indicators token", await tokenCheck(workspace, "qdm-indicators-cli", env));
|
|
79
|
+
add("SQL token", await tokenCheck(workspace, "qdm-sql-cli", env));
|
|
78
80
|
add("Agent hook", concreteAgentNames.some((name) => agentOk(workspace, name)));
|
|
79
81
|
for (const name of ["openclaw", "hermes"]) {
|
|
80
82
|
if (fs.existsSync(path.join(workspace, `.${name}`))) {
|
package/src/commands/install.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { commandExists, run } from "../lib/exec.js";
|
|
4
|
-
import { writeLocalConfig, linkAgents } from "../lib/config.js";
|
|
4
|
+
import { localPathToolNames, writeLocalConfig, linkAgents } from "../lib/config.js";
|
|
5
5
|
import { ask, askSecret, chooseAgent } from "../lib/prompt.js";
|
|
6
6
|
import { readUserState, resolveWorkspaceDir, writeState } from "../lib/paths.js";
|
|
7
7
|
import { installToolsFromManifest, manifestDigest, readManifest } from "../lib/manifest.js";
|
|
@@ -156,7 +156,7 @@ async function installLocalTools(runtimeDir, options = {}) {
|
|
|
156
156
|
const binDir = path.join(runtimeDir, "bin");
|
|
157
157
|
fs.mkdirSync(binDir, { recursive: true });
|
|
158
158
|
const installed = {};
|
|
159
|
-
for (const name of
|
|
159
|
+
for (const name of localPathToolNames) {
|
|
160
160
|
const source = await promptExecutable(runtimeDir, name, options);
|
|
161
161
|
const target = path.join(binDir, binaryName(name));
|
|
162
162
|
if (path.resolve(source) !== path.resolve(target)) {
|
|
@@ -225,7 +225,7 @@ async function writeCasCredentials(runtimeDir, options = {}) {
|
|
|
225
225
|
return dir;
|
|
226
226
|
}
|
|
227
227
|
|
|
228
|
-
async function configureTokens(runtimeDir, casDir) {
|
|
228
|
+
export async function configureTokens(runtimeDir, casDir) {
|
|
229
229
|
const env = { QDM_CAS_CONFIG_DIR: casDir };
|
|
230
230
|
const bin = (name) => path.join(runtimeDir, "bin", binaryName(name));
|
|
231
231
|
const cmrToken = (await run(bin("cas-cli"), ["token", "--app", "cmr"], { cwd: runtimeDir, env })).stdout.trim();
|
|
@@ -234,8 +234,12 @@ async function configureTokens(runtimeDir, casDir) {
|
|
|
234
234
|
const indicatorsToken = (await run(bin("cas-cli"), ["token", "--app", "indicators"], { cwd: runtimeDir, env })).stdout.trim();
|
|
235
235
|
await run(bin("qdm-indicators-cli"), ["config", "set-token", indicatorsToken], { cwd: runtimeDir, env });
|
|
236
236
|
ok("Indicators Token 已配置");
|
|
237
|
+
const sqlToken = (await run(bin("cas-cli"), ["token", "--app", "rtp"], { cwd: runtimeDir, env })).stdout.trim();
|
|
238
|
+
await run(bin("qdm-sql-cli"), ["config", "set-token", sqlToken], { cwd: runtimeDir, env });
|
|
239
|
+
ok("SQL Token 已配置");
|
|
237
240
|
await run(bin("qdm-cmr-cli"), ["config", "check-token"], { cwd: runtimeDir, env });
|
|
238
241
|
await run(bin("qdm-indicators-cli"), ["config", "check-token"], { cwd: runtimeDir, env });
|
|
242
|
+
await run(bin("qdm-sql-cli"), ["config", "check-token"], { cwd: runtimeDir, env });
|
|
239
243
|
}
|
|
240
244
|
|
|
241
245
|
export async function buildAndCheck(runtimeDir, options = {}) {
|
|
@@ -264,11 +268,12 @@ export function printDoctorSummary(doctor, options = {}) {
|
|
|
264
268
|
ok("wikis/reports");
|
|
265
269
|
ok("wikis/dims");
|
|
266
270
|
ok("wikis/rules");
|
|
267
|
-
ok("
|
|
271
|
+
ok("5 个 CLI");
|
|
268
272
|
ok("本地配置");
|
|
269
273
|
ok("CAS 凭证");
|
|
270
274
|
ok("CMR Token");
|
|
271
275
|
ok("Indicators Token");
|
|
276
|
+
ok("SQL Token");
|
|
272
277
|
if (!warnings.some((check) => check.name.startsWith("Agent hook"))) ok("Agent Hook");
|
|
273
278
|
for (const check of warnings) warn(`${check.name}${check.detail ? ` (${check.detail})` : ""}`);
|
|
274
279
|
return;
|
package/src/commands/update.js
CHANGED
|
@@ -19,7 +19,8 @@ export function isNonBlockingUpdateDoctorCheck(check) {
|
|
|
19
19
|
check.name.startsWith("Agent hook .") ||
|
|
20
20
|
check.name === "CAS credentials file" ||
|
|
21
21
|
check.name === "CMR token" ||
|
|
22
|
-
check.name === "Indicators token"
|
|
22
|
+
check.name === "Indicators token" ||
|
|
23
|
+
check.name === "SQL token";
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
async function npmLatest() {
|
package/src/lib/config.js
CHANGED
|
@@ -20,6 +20,8 @@ export const agentLinks = {
|
|
|
20
20
|
],
|
|
21
21
|
};
|
|
22
22
|
export const agentChoiceText = agentChoices.join(", ");
|
|
23
|
+
export const qdmCliBinaries = ["data-harness-cli", "qdm-cmr-cli", "qdm-indicators-cli", "qdm-sql-cli", "cas-cli"];
|
|
24
|
+
export const localPathToolNames = ["cas-cli", "qdm-indicators-cli", "qdm-cmr-cli", "qdm-sql-cli"];
|
|
23
25
|
|
|
24
26
|
export function hasAnyAgentHook(workspace) {
|
|
25
27
|
return concreteAgentNames.some((name) => fs.existsSync(path.join(workspace, `.${name}`)));
|
|
@@ -35,8 +37,8 @@ export function writeLocalConfig(workspace, options = {}) {
|
|
|
35
37
|
}
|
|
36
38
|
const bin = (name) => path.join(workspace, "bin", binaryName(name)).replaceAll("\\", "/");
|
|
37
39
|
const casConfigDir = path.join(workspace, ".qdm-auth", "cas").replaceAll("\\", "/");
|
|
38
|
-
fs.writeFileSync(harness, `paths:\n knowledge: wikis\n\ncli:\n qdm_cmr_cli: ${bin("qdm-cmr-cli")}\n qdm_indicators_cli: ${bin("qdm-indicators-cli")}\n qdm_cas_cli: ${bin("cas-cli")}\n`);
|
|
39
|
-
fs.writeFileSync(env, `export QDM_CMR_CLI="${bin("qdm-cmr-cli")}"\nexport QDM_INDICATORS_CLI="${bin("qdm-indicators-cli")}"\nexport QDM_CAS_CLI="${bin("cas-cli")}"\nexport QDM_CAS_CONFIG_DIR="${casConfigDir}"\n`);
|
|
40
|
+
fs.writeFileSync(harness, `paths:\n knowledge: wikis\n\ncli:\n qdm_cmr_cli: ${bin("qdm-cmr-cli")}\n qdm_indicators_cli: ${bin("qdm-indicators-cli")}\n qdm_sql_cli: ${bin("qdm-sql-cli")}\n qdm_cas_cli: ${bin("cas-cli")}\n`);
|
|
41
|
+
fs.writeFileSync(env, `export QDM_CMR_CLI="${bin("qdm-cmr-cli")}"\nexport QDM_INDICATORS_CLI="${bin("qdm-indicators-cli")}"\nexport QDM_SQL_CLI="${bin("qdm-sql-cli")}"\nexport QDM_CAS_CLI="${bin("cas-cli")}"\nexport QDM_CAS_CONFIG_DIR="${casConfigDir}"\n`);
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
export function validateCasConfigDir(dir) {
|