@lumi-ai-lab/harness-data 0.0.19 → 0.0.20

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lumi-ai-lab/harness-data",
3
- "version": "0.0.19",
3
+ "version": "0.0.20",
4
4
  "description": "Installer and updater for Harness Data",
5
5
  "type": "module",
6
6
  "bin": {
@@ -57,6 +57,21 @@ function cleanupRuntimeBackups(backups) {
57
57
  for (const item of backups) fs.rmSync(item.backup, { recursive: true, force: true });
58
58
  }
59
59
 
60
+ function mergeRuntimeConfig(runtimeDir, sourceDir) {
61
+ const targetDir = path.join(runtimeDir, "config");
62
+ fs.mkdirSync(targetDir, { recursive: true });
63
+ for (const file of fs.readdirSync(sourceDir)) {
64
+ const source = path.join(sourceDir, file);
65
+ const target = path.join(targetDir, file);
66
+ const stat = fs.statSync(source);
67
+ if (stat.isDirectory()) {
68
+ if (!fs.existsSync(target)) fs.cpSync(source, target, { recursive: true });
69
+ continue;
70
+ }
71
+ if (file.endsWith(".example") || !fs.existsSync(target)) fs.copyFileSync(source, target);
72
+ }
73
+ }
74
+
60
75
  export async function installRuntimeBundle(runtimeDir, options = {}) {
61
76
  if (!options.force && fs.existsSync(path.join(runtimeDir, "agents")) &&
62
77
  fs.existsSync(path.join(runtimeDir, "config")) &&
@@ -102,7 +117,8 @@ export async function installRuntimeBundle(runtimeDir, options = {}) {
102
117
  fs.mkdirSync(path.join(stagedRoot, "config"), { recursive: true });
103
118
  for (const file of fs.readdirSync(configSource)) fs.copyFileSync(path.join(configSource, file), path.join(stagedRoot, "config", file));
104
119
 
105
- for (const name of ["agents", "bootstrap", "config"]) replaceRuntimePath(runtimeDir, name, stagedRoot, backups);
120
+ for (const name of ["agents", "bootstrap"]) replaceRuntimePath(runtimeDir, name, stagedRoot, backups);
121
+ mergeRuntimeConfig(runtimeDir, path.join(stagedRoot, "config"));
106
122
  cleanupRuntimeBackups(backups);
107
123
  } catch (error) {
108
124
  restoreRuntimeBackups(backups);
@@ -11,10 +11,15 @@ import { resolveLatestTool } from "../lib/tool-release.js";
11
11
  import { protocolFromUrl, runGitWithProtocol } from "../lib/git-auth.js";
12
12
  import { buildAndCheck, installRuntimeBundle, printDoctorSummary } from "./install.js";
13
13
  import { collectDoctor } from "./doctor.js";
14
+ import { writeLocalConfig } from "../lib/config.js";
14
15
  import { action, blank, header, ok, shortSha, skip, step, warn } from "../lib/log.js";
15
16
 
16
17
  export function isNonBlockingUpdateDoctorCheck(check) {
17
- return check.name === "Agent hook" || check.name.startsWith("Agent hook .");
18
+ return check.name === "Agent hook" ||
19
+ check.name.startsWith("Agent hook .") ||
20
+ check.name === "CAS credentials file" ||
21
+ check.name === "CMR token" ||
22
+ check.name === "Indicators token";
18
23
  }
19
24
 
20
25
  async function npmLatest() {
@@ -187,6 +192,8 @@ export async function updateCommand(options = {}) {
187
192
 
188
193
  step(6, 6, "安装校验");
189
194
  if (changed) {
195
+ writeLocalConfig(runtimeDir, { overwrite: true });
196
+ ok("本地配置已刷新");
190
197
  const doctor = await collectDoctor(runtimeDir, trackingOptions);
191
198
  printDoctorSummary(doctor, { nonBlocking: isNonBlockingUpdateDoctorCheck });
192
199
  if (doctor.checks.some((check) => !check.ok && !isNonBlockingUpdateDoctorCheck(check))) throw new Error("doctor failed; update is incomplete");