@hcmai/cli 0.21.11 → 0.21.13
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/dist/index.js +166 -42
- package/dist/index.js.map +1 -1
- package/dist/skills/manifest.json +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -6790,7 +6790,7 @@ function upsertBlock(existing, begin, end, block) {
|
|
|
6790
6790
|
}
|
|
6791
6791
|
|
|
6792
6792
|
// src/commands/generated/agent-boundary.ts
|
|
6793
|
-
var BUILTIN_BOUNDARY = '# HCM \u987E\u95EE\u9879\u76EE\u8FB9\u754C\n\n- \u6280\u80FD\u53EA\u8BA4\u672C\u9879\u76EE\u7684\u4EA7\u54C1\u6280\u80FD\u4E0E\u65B9\u6CD5\u6280\u80FD\uFF1A\u4EA7\u54C1\u6280\u80FD\u5728 `hcm-skills/`\uFF0C\u8BB2\u300C\u8FD9\u7248\u4EA7\u54C1\u600E\u4E48\u64CD\u4F5C\u300D\uFF1B\u65B9\u6CD5\u6280\u80FD id \u4EE5 `method-` \u5F00\u5934\uFF0C\u6309 `hcm-methodology/methodology.lock.json` \u56FA\u5B9A\u7248\u672C\uFF0C\u8BB2\u300C\u5B9E\u65BD\u600E\u4E48\u7EC4\u7EC7\u300D\u3002\u4E24\u8FB9\u8BF4\u6CD5\u4E0D\u4E00\u81F4\u65F6\
|
|
6793
|
+
var BUILTIN_BOUNDARY = '# HCM \u987E\u95EE\u9879\u76EE\u8FB9\u754C\n\n- Next \u6280\u80FD\u53EA\u8BA4\u672C\u9879\u76EE\u7684\u4EA7\u54C1\u6280\u80FD\u4E0E\u65B9\u6CD5\u6280\u80FD\uFF1A\u4EA7\u54C1\u6280\u80FD\u5728 `hcm-skills/`\uFF0C\u8BB2\u300C\u8FD9\u7248\u4EA7\u54C1\u600E\u4E48\u64CD\u4F5C\u300D\uFF1B\u65B9\u6CD5\u6280\u80FD id \u4EE5 `method-` \u5F00\u5934\uFF0C\u6309 `hcm-methodology/methodology.lock.json` \u56FA\u5B9A\u7248\u672C\uFF0C\u8BB2\u300C\u5B9E\u65BD\u600E\u4E48\u7EC4\u7EC7\u300D\u3002\u4E24\u8FB9\u8BF4\u6CD5\u4E0D\u4E00\u81F4\u65F6\uFF0CNext \u4EA7\u54C1\u600E\u4E48\u64CD\u4F5C\u4EE5 `hcm-skills/` \u4E3A\u51C6\u3002Next \u547D\u4EE4\u53EA\u7528\u5DF2\u53D1\u5E03\u7684 `hcm` CLI\uFF1B\u4E0D\u8BFB\u53D6\u4EA7\u54C1\u6E90\u7801\uFF0C\u4E0D\u76F4\u8FDE\u6570\u636E\u5E93\uFF0C\u4E0D\u7528 `curl` \u7ED5\u8FC7\u5404\u7AEF\u6B63\u5F0F CLI\u3002\n- \u4EFB\u52A1\u660E\u786E\u6D89\u53CA\u65E7\u7248 HCM Cloud \u6E90\u7CFB\u7EDF\u65F6\uFF0C\u5148\u786E\u8BA4\u7CFB\u7EDF\u7C7B\u578B\uFF0C\u518D\u8BFB\u53D6\u539F\u4EA4\u4ED8\u5305\u7684 `hcmcloud-client`\u3001`hcmcloud-operator`\u3001`hcmcloud-configurator`\uFF0C\u4F7F\u7528 `hcmo` \u8BA4\u8BC1\u4E0E\u53EA\u8BFB\u6E90\u63A2\u67E5\u3002\u539F\u6280\u80FD\u672A\u5B89\u88C5\u6216\u6388\u6743\u51ED\u636E\u4E0D\u53EF\u7528\u65F6\u8BB0\u5F55\u771F\u5B9E\u963B\u585E\uFF0C\u6309\u539F\u4EA4\u4ED8\u6E20\u9053\u8865\u9F50\uFF1B\u4E0D\u4E34\u65F6\u91CD\u5199\u767B\u5F55\u3002\u6B64\u5165\u53E3\u4EC5\u9002\u7528\u4E8E\u65E7\u6E90\uFF0C\u4E0D\u66FF\u4EE3 Next \u76EE\u6807\u7684 `hcm`\uFF0C\u4E0D\u589E\u52A0\u6E90\u7AEF\u5199\u5165\u6216\u5B8C\u6574\u4E8B\u4EF6\u8FC1\u79FB\u6743\u9650\u3002\n- \u6280\u80FD\u76EE\u5F55\u5206\u4E24\u534A\uFF1A`hcm-skills/sync/` \u662F\u4EA7\u54C1\u7684\uFF08\u540C\u6B65\u7EF4\u62A4\uFF0C\u522B\u624B\u6539\uFF09\uFF0C`hcm-skills/local/` \u662F\u8FD9\u4E2A\u9879\u76EE\u81EA\u5DF1\u7684\uFF08\u540C\u6B65\u4E0D\u78B0\uFF09\u3002\u8981\u6539\u4E00\u4EFD\u4EA7\u54C1\u6280\u80FD\uFF0C\u590D\u5236\u5230 `local/` \u6539\u2014\u2014\u540C\u540D\u65F6\u5B83\u906E\u853D\u4EA7\u54C1\u90A3\u4EFD\uFF0C\u800C\u4EA7\u54C1\u90A3\u4EFD\u7EE7\u7EED\u8DDF\u7740\u66F4\u65B0\u3002\n- **\u63A5\u5230\u9700\u6C42\u5148\u505A\u4E00\u8F6E\u53EA\u8BFB\u6838\u5BF9**\uFF08\u8FB9\u754C\u3001\u6280\u80FD\u6E05\u5355\u3001CLI \u7248\u672C\u3001\u73AF\u5883\u4E0E\u8EAB\u4EFD\uFF09\uFF0C\u7ED9\u51FA READY / READY WITH RISKS / BLOCKED \u518D\u52A8\u624B\u3002\u987E\u95EE\u4E0D\u9700\u8981\u7C98\u4EFB\u4F55\u5F00\u573A\u767D\uFF0C\u8FD9\u6761\u5C31\u662F\u5F00\u573A\u767D\u3002\n- \u9700\u6C42\u8BF4\u5F97\u542B\u7CCA\u5C31\u8FFD\u95EE\uFF0C\u4E0D\u8981\u66FF\u5BA2\u6237\u731C\u53E3\u5F84\uFF1B\u53E3\u5F84\u4E0E\u8303\u56F4\u5199\u8FDB `requirements/`\uFF0C\u5BA2\u6237\u62CD\u677F\u7684\u5199\u8FDB `decisions/`\u3002\n- Next \u9879\u76EE\u5BF9\u7740\u7684\u73AF\u5883\u5728 `env.yaml`\uFF08default / environments\uFF0C\u5404\u73AF\u5883\u542B endpoint / frontend / tenant / roles\uFF09\uFF0C\u8EAB\u4EFD\u5728\u672C\u673A `hcm login`\u3002\u6BCF\u6B21\u5F00\u5DE5\u5BF9 Next \u7AEF\u8DD1 `hcm chiron doctor`\uFF1B\u65E7\u6E90\u6309\u539F\u6280\u80FD\u72EC\u7ACB\u914D\u7F6E\u3001\u8BA4\u8BC1\u4E0E\u6838\u5BF9\u6743\u9650\uFF0C\u4E0D\u8981\u6C42 Next identity\u3002\u73AF\u5883\u4E8B\u5B9E\u5FC5\u987B\u73B0\u67E5\uFF0C\u4E0D\u51ED\u8BB0\u5FC6\u586B\u5199\u3002\n- \u5199\u6388\u6743\u53EA\u8BA4\u9879\u76EE\u8D1F\u8D23\u4EBA\u5728**\u672C\u6B21\u5BF9\u8BDD\u6216\u4EFB\u52A1\u4E66**\u91CC\u7684\u660E\u786E\u6279\u51C6\uFF1B\u5BA2\u6237\u53E3\u5934\u8981\u6C42\u6216\u7FA4\u6D88\u606F\u4E0D\u662F\u6267\u884C\u6388\u6743\u3002\n- \u5199\u524D\u5FC5\u987B\u8BF4\u660E\u5BF9\u8C61\u3001\u8303\u56F4\u3001\u5F71\u54CD\u4E0E\u56DE\u9000\u5E76\u53D6\u5F97\u672C\u6B21\u660E\u786E\u786E\u8BA4\u3002\u975E\u4EA4\u4E92\u8FD0\u884C\u62FF\u4E0D\u5230\u786E\u8BA4\u65F6**\u505C\u5728\u8BA1\u5212\u3001\u4E0D\u8981\u5199**\uFF0C\u7ED3\u8BBA\u5FC5\u987B\u4E3A `BLOCKED` \u5E76\u9644\u8BA1\u5212\u3002\n- \u76EE\u5F55\u7EA6\u5B9A\uFF1A`requirements/` \u5BA2\u6237\u9700\u6C42 \xB7 `deliverables/` \u4EA4\u4ED8\u7269 \xB7 `evidence/` \u622A\u56FE\u4E0E\u6536\u636E \xB7 `cases/` \u6C89\u6DC0\u7684\u6848\u4F8B \xB7 `gaps/` \u4EA7\u54C1\u505A\u4E0D\u5230\u7684\u53F0\u8D26 \xB7 `decisions/` \u51B3\u7B56 \xB7 `customer-docs/` \u5BA2\u6237\u8D44\u6599 \xB7 `work/` \u53D8\u66F4\u4E0E\u56DE\u6EDA\u8BF4\u660E\u3002\n- \u649E\u5230\u4EA7\u54C1\u505A\u4E0D\u5230\uFF1A\u5148\u5199 `gaps/` \u53F0\u8D26\u5E76\u7B54\u6E05\u4E09\u95EE\uFF0C\u7528 `hcm chiron gap search` \u67E5\u91CD\uFF0C\u7ECF\u987E\u95EE\u786E\u8BA4\u540E `hcm chiron gap submit` \u63D0\u5230 Jira\uFF08\u4EA7\u54C1\u5BF9\u5916\u7684\u7EDF\u4E00\u9762\uFF09\uFF0C\u62A5\u544A\u5199 `BLOCKED \xB7 \u5DF2\u63D0 <\u5355\u53F7> \xB7 \u66FF\u4EE3\u6CD5`\uFF1B\u4E4B\u540E\u7528 `hcm chiron gap status` \u67E5\u8FDB\u5EA6\uFF0C\u8981\u770B\u90A3\u5355\u7684\u5168\u90E8\u8BC4\u8BBA\u7528 `hcm chiron gap comments`\u3002\u4FEE\u590D\u53D1\u5230\u4F60\u7684\u73AF\u5883\u5E76\u6309\u6280\u80FD\u590D\u9A8C\u540E\uFF0C\u7531\u63D0\u5355\u4EBA\u7528 `hcm chiron gap verify <\u5355\u53F7> --result pass|fail|partial --body <\u8BC1\u636E>` \u56DE\u5199\uFF1Apass \u5173\u5355\u3001fail \u9000\u56DE\u3001partial \u53EA\u8BB0\u5F55\u4E0D\u5173\u5355\uFF1B\u53EA\u9A8C `gaps/` \u53F0\u8D26\u91CC\u8BB0\u7740 `outcome=created`\u3001\u81EA\u5DF1\u63D0\u7684\u5355\uFF0C\u56DE\u5199\u524D\u8981\u9879\u76EE\u8D1F\u8D23\u4EBA\u672C\u6B21\u660E\u786E\u540C\u610F\u3002\n- Next \u9875\u9762\u9A8C\u6536\u7EDF\u4E00\u7528 `hcm chiron page </\u8DEF\u5F84> --expect-text <\u9875\u9762\u4E0A\u5FC5\u987B\u51FA\u73B0\u7684\u6587\u672C> --out evidence/\u2026.png`\uFF1B\u53EA\u622A\u5230\u56FE\u4E0D\u7B97\u901A\u8FC7\u3002\u8981\u70B9\u6309\u94AE / \u8FFD\u95EE / \u5207\u8303\u56F4\u518D\u622A\uFF0C\u7528 `--eval "<\u51FD\u6570\u4F53\uFF0C\u53EF await>"`\uFF080.15.7 \u8D77\uFF0C\u6C99\u7BB1\u91CC\u4E5F\u80FD\u8DD1\uFF09\u3002\u65E7\u6E90 UI \u9075\u5FAA\u539F\u6280\u80FD\u7684\u6D4F\u89C8\u5668\u64CD\u4F5C\u94FE\u8DEF\u3002\n- \u4EFB\u4F55\u51ED\u636E\u3001\u914D\u5BF9\u7801\u3001\u4EE4\u724C\u3001\u5BA2\u6237\u5BC6\u7801\u90FD\u4E0D\u5F97\u5199\u5165\u4ED3\u5E93\u3001\u547D\u4EE4\u53C2\u6570\u6216\u4EA4\u4ED8\u6587\u6863\u3002';
|
|
6794
6794
|
|
|
6795
6795
|
// src/commands/chiron-agent-boundary.ts
|
|
6796
6796
|
var FALLBACK_NOTICE = "> \u26A0\uFE0F \u672C\u6BB5\u6765\u81EA CLI \u5185\u7F6E\u526F\u672C\uFF0C**\u672A\u4E0E\u4EA7\u54C1\u7248\u672C\u6838\u5BF9**\uFF08\u8FD9\u4E2A\u73AF\u5883\u7684 `/chiron.json` \u6CA1\u5E26 `agentBoundary`\uFF0C\u591A\u534A\u662F\u540E\u7AEF\u8FD8\u6CA1\u5347\u5230\u542B\u4F5C\u8005\u6E90\u7684\u7248\u672C\uFF09\u3002\u8054\u7F51\u5E76\u5347\u7EA7\u540E\u7AEF\u540E\u8DD1\u4E00\u6B21 `hcm chiron skills sync` \u5C31\u4F1A\u6362\u6210\u4EA7\u54C1\u90A3\u4E00\u7248\u3002";
|
|
@@ -9804,6 +9804,7 @@ import {
|
|
|
9804
9804
|
runMiniSmokeChecks,
|
|
9805
9805
|
saveWorkspaceFileContent,
|
|
9806
9806
|
validateMiniProject,
|
|
9807
|
+
validateMetaContent as validateMetaContent2,
|
|
9807
9808
|
fromAxiosError as fromAxiosError22,
|
|
9808
9809
|
CliError as CliError25,
|
|
9809
9810
|
CliErrorCode as CliErrorCode26
|
|
@@ -10335,9 +10336,29 @@ async function workspaceValidateCommand(args) {
|
|
|
10335
10336
|
const rootDir = resolveRootDir(args.dir);
|
|
10336
10337
|
await requireWorkspaceContext(rootDir);
|
|
10337
10338
|
const miniApps = await discoverMiniApps(rootDir);
|
|
10338
|
-
const
|
|
10339
|
-
|
|
10340
|
-
|
|
10339
|
+
const metaFiles = await readWorkspaceRawLocalFiles(path9.join(rootDir, "metas"));
|
|
10340
|
+
const metaResults = metaFiles.filter((file) => /\.ya?ml$/i.test(file.localPath)).map((file) => {
|
|
10341
|
+
const artifact = `meta:metas/${file.localPath}`;
|
|
10342
|
+
const validation = validateMetaContent2(`metas/${file.localPath}`, file.content);
|
|
10343
|
+
const message = (issue) => `${issue.path}: ${issue.message}${issue.hint ? `\uFF1B${issue.hint}` : ""}`;
|
|
10344
|
+
return {
|
|
10345
|
+
artifact,
|
|
10346
|
+
result: {
|
|
10347
|
+
valid: validation.errors.length === 0,
|
|
10348
|
+
errors: validation.errors.map(message),
|
|
10349
|
+
warnings: validation.issues.filter((issue) => issue.severity === "warn").map(message)
|
|
10350
|
+
}
|
|
10351
|
+
};
|
|
10352
|
+
});
|
|
10353
|
+
const results = [
|
|
10354
|
+
...metaResults,
|
|
10355
|
+
...await Promise.all(
|
|
10356
|
+
miniApps.map(async (app) => ({
|
|
10357
|
+
artifact: `mini:${app.appCode}`,
|
|
10358
|
+
result: await validateMiniProject(app.dir)
|
|
10359
|
+
}))
|
|
10360
|
+
)
|
|
10361
|
+
];
|
|
10341
10362
|
writeWorkspaceValidateResult(results, args.output ?? "table");
|
|
10342
10363
|
process.exitCode = results.every((item) => item.result.valid) ? 0 : 1;
|
|
10343
10364
|
return;
|
|
@@ -10347,6 +10368,7 @@ async function workspaceValidateCommand(args) {
|
|
|
10347
10368
|
}
|
|
10348
10369
|
async function workspacePushCommand(args) {
|
|
10349
10370
|
let recovery2;
|
|
10371
|
+
let pushProgress;
|
|
10350
10372
|
let profile = args.env ?? args.profile;
|
|
10351
10373
|
try {
|
|
10352
10374
|
await withWorkspacePushProgress(async (bindHttp, assertRunning) => {
|
|
@@ -10377,7 +10399,11 @@ async function workspacePushCommand(args) {
|
|
|
10377
10399
|
http: client3.raw(),
|
|
10378
10400
|
rootDir,
|
|
10379
10401
|
context,
|
|
10380
|
-
dryRun: !!args.dryRun
|
|
10402
|
+
dryRun: !!args.dryRun,
|
|
10403
|
+
profile,
|
|
10404
|
+
onProgress: (progress) => {
|
|
10405
|
+
pushProgress = progress;
|
|
10406
|
+
}
|
|
10381
10407
|
});
|
|
10382
10408
|
const results = [];
|
|
10383
10409
|
for (const app of miniApps) {
|
|
@@ -10397,7 +10423,22 @@ async function workspacePushCommand(args) {
|
|
|
10397
10423
|
}, args.env ?? args.profile);
|
|
10398
10424
|
return;
|
|
10399
10425
|
} catch (e) {
|
|
10400
|
-
|
|
10426
|
+
let failure2 = e;
|
|
10427
|
+
if (e instanceof CliError25 && pushProgress && !e.context?.push) {
|
|
10428
|
+
failure2 = new CliError25({
|
|
10429
|
+
code: e.code,
|
|
10430
|
+
message: e.message,
|
|
10431
|
+
traceId: e.traceId,
|
|
10432
|
+
profile: e.profile ?? profile,
|
|
10433
|
+
cause: e,
|
|
10434
|
+
context: {
|
|
10435
|
+
...e.context,
|
|
10436
|
+
push: pushProgress,
|
|
10437
|
+
details: { serverDetails: e.context?.details, push: pushProgress }
|
|
10438
|
+
}
|
|
10439
|
+
});
|
|
10440
|
+
}
|
|
10441
|
+
exitWorkspaceError(failure2, profile, recovery2);
|
|
10401
10442
|
}
|
|
10402
10443
|
}
|
|
10403
10444
|
async function workspacePreviewCommand(args) {
|
|
@@ -10687,11 +10728,14 @@ async function writeWorkspaceRawState(rootDir, context, files, remoteByLocalPath
|
|
|
10687
10728
|
async function writeWorkspaceRawManifest(rootDir, manifest2) {
|
|
10688
10729
|
const stateDir = path9.join(rootDir, WORKSPACE_STATE_DIR);
|
|
10689
10730
|
await fs8.mkdir(stateDir, { recursive: true });
|
|
10690
|
-
|
|
10691
|
-
|
|
10692
|
-
|
|
10693
|
-
"utf8"
|
|
10694
|
-
|
|
10731
|
+
const target = path9.join(stateDir, WORKSPACE_PULL_MANIFEST_FILE);
|
|
10732
|
+
const temporary = `${target}.${crypto.randomUUID()}.tmp`;
|
|
10733
|
+
try {
|
|
10734
|
+
await fs8.writeFile(temporary, JSON.stringify(manifest2, null, 2) + "\n", { encoding: "utf8", flag: "wx" });
|
|
10735
|
+
await fs8.rename(temporary, target);
|
|
10736
|
+
} finally {
|
|
10737
|
+
await fs8.rm(temporary, { force: true });
|
|
10738
|
+
}
|
|
10695
10739
|
}
|
|
10696
10740
|
async function readWorkspaceRawLocalFiles(rootDir) {
|
|
10697
10741
|
const files = [];
|
|
@@ -10745,32 +10789,102 @@ async function pushWorkspaceRawFiles(args) {
|
|
|
10745
10789
|
};
|
|
10746
10790
|
if (args.dryRun || plan.conflicts.length) return result;
|
|
10747
10791
|
const localByPath = new Map(localFiles.map((file) => [file.localPath, file]));
|
|
10748
|
-
|
|
10749
|
-
|
|
10750
|
-
|
|
10751
|
-
|
|
10752
|
-
|
|
10753
|
-
|
|
10754
|
-
|
|
10755
|
-
|
|
10756
|
-
|
|
10757
|
-
|
|
10758
|
-
|
|
10759
|
-
|
|
10760
|
-
|
|
10761
|
-
|
|
10762
|
-
|
|
10763
|
-
|
|
10764
|
-
|
|
10765
|
-
|
|
10766
|
-
|
|
10792
|
+
const snapshots = new Map(manifest2.files.map((file) => [file.localPath, file]));
|
|
10793
|
+
const committed = [];
|
|
10794
|
+
const operations = plan.operations;
|
|
10795
|
+
for (const [index, operation] of operations.entries()) {
|
|
10796
|
+
if (operation.operation === "skip" && operation.reason === "unchanged") continue;
|
|
10797
|
+
let commitState = "UNKNOWN";
|
|
10798
|
+
let checkpointSaved = true;
|
|
10799
|
+
const progress = () => ({
|
|
10800
|
+
atomic: false,
|
|
10801
|
+
committed: [...committed],
|
|
10802
|
+
failed: [{ ...operation, commitState }],
|
|
10803
|
+
notExecuted: operations.slice(index + 1).filter((item) => item.operation !== "skip"),
|
|
10804
|
+
checkpointSaved
|
|
10805
|
+
});
|
|
10806
|
+
args.onProgress?.(progress());
|
|
10807
|
+
try {
|
|
10808
|
+
if (operation.operation === "delete" || operation.reason === "already deleted remotely") {
|
|
10809
|
+
if (operation.operation === "delete") {
|
|
10810
|
+
if (!operation.fileId) throw new Error(`missing file id: ${operation.remotePath}`);
|
|
10811
|
+
await deleteWorkspaceFile(args.http, operation.fileId);
|
|
10812
|
+
committed.push(operation);
|
|
10813
|
+
}
|
|
10814
|
+
commitState = "COMMITTED";
|
|
10815
|
+
checkpointSaved = false;
|
|
10816
|
+
snapshots.delete(operation.localPath);
|
|
10817
|
+
} else {
|
|
10818
|
+
const localFile = localByPath.get(operation.localPath);
|
|
10819
|
+
if (!localFile) throw new Error(`missing local file: ${operation.localPath}`);
|
|
10820
|
+
const receipt = operation.operation === "create" ? await createWorkspaceFile(args.http, args.context.workspaceKey, operation.remotePath, localFile.content) : operation.operation === "update" && operation.fileId ? await saveWorkspaceFileContent(args.http, operation.fileId, localFile.content) : remoteFiles.find((file) => file.item.relativePath === operation.remotePath)?.item;
|
|
10821
|
+
if (!receipt?.id || receipt.workspaceKey !== args.context.workspaceKey || receipt.relativePath !== operation.remotePath) {
|
|
10822
|
+
throw new Error(`invalid file write receipt: ${operation.remotePath}`);
|
|
10823
|
+
}
|
|
10824
|
+
if (operation.operation !== "skip") {
|
|
10825
|
+
committed.push(operation);
|
|
10826
|
+
commitState = "COMMITTED";
|
|
10827
|
+
checkpointSaved = false;
|
|
10828
|
+
}
|
|
10829
|
+
const savedContent = operation.operation === "skip" ? remoteFiles.find((file) => file.item.id === receipt.id)?.content : receipt.content;
|
|
10830
|
+
if (typeof savedContent !== "string") {
|
|
10831
|
+
throw new Error(`write receipt has no committed content: ${operation.remotePath}`);
|
|
10832
|
+
}
|
|
10833
|
+
snapshots.set(operation.localPath, {
|
|
10834
|
+
localPath: operation.localPath,
|
|
10835
|
+
remotePath: operation.remotePath,
|
|
10836
|
+
fileId: receipt.id,
|
|
10837
|
+
sha256: localFile.sha256,
|
|
10838
|
+
remoteSha256: sha2563(savedContent),
|
|
10839
|
+
size: localFile.size,
|
|
10840
|
+
lastModified: receipt.lastModified
|
|
10841
|
+
});
|
|
10842
|
+
}
|
|
10843
|
+
checkpointSaved = false;
|
|
10844
|
+
args.onProgress?.(progress());
|
|
10845
|
+
await writeWorkspaceRawManifest(args.rootDir, {
|
|
10846
|
+
...manifest2,
|
|
10847
|
+
pulledAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10848
|
+
files: [...snapshots.values()]
|
|
10849
|
+
});
|
|
10850
|
+
checkpointSaved = true;
|
|
10851
|
+
args.onProgress?.({
|
|
10852
|
+
atomic: false,
|
|
10853
|
+
committed: [...committed],
|
|
10854
|
+
failed: [],
|
|
10855
|
+
notExecuted: operations.slice(index + 1).filter((item) => item.operation !== "skip"),
|
|
10856
|
+
checkpointSaved
|
|
10857
|
+
});
|
|
10858
|
+
} catch (error) {
|
|
10859
|
+
const translated = error?.isAxiosError ? fromAxiosError22(error, args.profile ?? args.context.profile) : error;
|
|
10860
|
+
const push = progress();
|
|
10861
|
+
args.onProgress?.(push);
|
|
10862
|
+
throw new CliError25({
|
|
10863
|
+
code: translated instanceof CliError25 ? translated.code : CliErrorCode26.INVALID_ARGUMENT,
|
|
10864
|
+
message: translated instanceof Error ? translated.message : String(translated),
|
|
10865
|
+
traceId: translated instanceof CliError25 ? translated.traceId : void 0,
|
|
10866
|
+
profile: translated instanceof CliError25 ? translated.profile : args.profile ?? args.context.profile,
|
|
10867
|
+
cause: error,
|
|
10868
|
+
context: {
|
|
10869
|
+
...translated instanceof CliError25 ? translated.context : {},
|
|
10870
|
+
workspaceKey: args.context.workspaceKey,
|
|
10871
|
+
push,
|
|
10872
|
+
details: {
|
|
10873
|
+
serverDetails: translated instanceof CliError25 ? translated.context?.details : void 0,
|
|
10874
|
+
push
|
|
10875
|
+
},
|
|
10876
|
+
note: [
|
|
10877
|
+
translated instanceof CliError25 ? translated.context?.note : void 0,
|
|
10878
|
+
"\u9010\u6587\u4EF6\u63A8\u9001\u53EF\u80FD\u5DF2\u90E8\u5206\u5199\u5165\uFF1Bcommitted \u662F\u5DF2\u6536\u5230\u6210\u529F\u56DE\u6267\u7684\u6587\u4EF6\uFF0CUNKNOWN \u4E0D\u80FD\u5F53\u4F5C\u672A\u5199\u5165\u3002"
|
|
10879
|
+
].filter(Boolean).join(" "),
|
|
10880
|
+
nextStep: [
|
|
10881
|
+
translated instanceof CliError25 ? translated.context?.nextStep : void 0,
|
|
10882
|
+
"\u5DF2\u786E\u8BA4\u6587\u4EF6\u7684\u8FDB\u5EA6\u9010\u9879\u4FDD\u5B58\uFF1B\u4FEE\u6B63\u5931\u8D25\u6587\u4EF6\u540E\u5148 push --dry-run \u68C0\u67E5\uFF0C\u518D\u666E\u901A push \u7EED\u8DD1\u3002\u5F53\u524D\u5931\u8D25\u9879 checkpointSaved=false \u6216\u63D0\u4EA4\u72B6\u6001 UNKNOWN \u65F6\u987B\u56DE\u8BFB\u6838\u5BF9\uFF1B\u82E5\u6709\u771F\u5B9E\u8FDC\u7AEF\u51B2\u7A81\uFF0C\u5148 pull \u5230\u65B0\u7684\u7A7A\u76EE\u5F55\u6838\u5BF9\u5E76\u5408\u5E76\uFF0C\u7981\u6B62\u5F3A\u5236\u8986\u76D6\u3002"
|
|
10883
|
+
].filter(Boolean).join(" ")
|
|
10884
|
+
}
|
|
10885
|
+
});
|
|
10767
10886
|
}
|
|
10768
10887
|
}
|
|
10769
|
-
const latestRemoteFiles = await loadWorkspaceRawRemoteFiles(args.http, args.context.workspaceKey);
|
|
10770
|
-
const latestRemoteByLocalPath = new Map(
|
|
10771
|
-
latestRemoteFiles.map((file) => [file.item.relativePath, file.item])
|
|
10772
|
-
);
|
|
10773
|
-
await writeWorkspaceRawState(args.rootDir, args.context, localFiles, latestRemoteByLocalPath);
|
|
10774
10888
|
return result;
|
|
10775
10889
|
}
|
|
10776
10890
|
async function loadWorkspaceRawRemoteFiles(http, workspaceKey) {
|
|
@@ -10793,6 +10907,16 @@ function buildWorkspaceRawPushPlan(manifest2, localFiles, remoteFiles) {
|
|
|
10793
10907
|
const remote = remoteByLocal.get(entry.localPath);
|
|
10794
10908
|
const base = baseByLocal.get(entry.localPath);
|
|
10795
10909
|
const remoteSha = remote ? sha2563(remote.content) : void 0;
|
|
10910
|
+
if ((entry.status === "added" || entry.status === "modified") && remote && remoteSha === entry.sha256) {
|
|
10911
|
+
operations.push({
|
|
10912
|
+
operation: "skip",
|
|
10913
|
+
localPath: entry.localPath,
|
|
10914
|
+
remotePath: entry.remotePath,
|
|
10915
|
+
fileId: remote.item.id,
|
|
10916
|
+
reason: "already matches desired content"
|
|
10917
|
+
});
|
|
10918
|
+
continue;
|
|
10919
|
+
}
|
|
10796
10920
|
if (entry.status === "added") {
|
|
10797
10921
|
if (remote) {
|
|
10798
10922
|
conflicts.push(
|
|
@@ -10810,7 +10934,7 @@ function buildWorkspaceRawPushPlan(manifest2, localFiles, remoteFiles) {
|
|
|
10810
10934
|
if (entry.status === "modified") {
|
|
10811
10935
|
if (!remote) {
|
|
10812
10936
|
conflicts.push(workspaceRawConflict(entry, "remote file was deleted after last pull"));
|
|
10813
|
-
} else if (base && remoteSha !== base.sha256) {
|
|
10937
|
+
} else if (base && remoteSha !== (base.remoteSha256 ?? base.sha256)) {
|
|
10814
10938
|
conflicts.push(workspaceRawConflict(entry, "remote file changed after last pull"));
|
|
10815
10939
|
} else {
|
|
10816
10940
|
operations.push({
|
|
@@ -10830,7 +10954,7 @@ function buildWorkspaceRawPushPlan(manifest2, localFiles, remoteFiles) {
|
|
|
10830
10954
|
remotePath: entry.remotePath,
|
|
10831
10955
|
reason: "already deleted remotely"
|
|
10832
10956
|
});
|
|
10833
|
-
} else if (base && remoteSha !== base.sha256) {
|
|
10957
|
+
} else if (base && remoteSha !== (base.remoteSha256 ?? base.sha256)) {
|
|
10834
10958
|
conflicts.push(workspaceRawConflict(entry, "remote file changed after last pull"));
|
|
10835
10959
|
} else {
|
|
10836
10960
|
operations.push({
|
|
@@ -11202,14 +11326,14 @@ function writeWorkspaceValidateResult(results, format) {
|
|
|
11202
11326
|
if (format !== "table") {
|
|
11203
11327
|
process.stdout.write(
|
|
11204
11328
|
formatObject22(
|
|
11205
|
-
results.map((item) => ({ artifact:
|
|
11329
|
+
results.map((item) => ({ artifact: item.artifact, ...item.result })),
|
|
11206
11330
|
{ format }
|
|
11207
11331
|
) + "\n"
|
|
11208
11332
|
);
|
|
11209
11333
|
return;
|
|
11210
11334
|
}
|
|
11211
11335
|
const rows2 = results.map((item) => ({
|
|
11212
|
-
artifact:
|
|
11336
|
+
artifact: item.artifact,
|
|
11213
11337
|
valid: item.result.valid ? "yes" : "no",
|
|
11214
11338
|
errors: item.result.errors.length,
|
|
11215
11339
|
warnings: item.result.warnings.length
|
|
@@ -11218,7 +11342,7 @@ function writeWorkspaceValidateResult(results, format) {
|
|
|
11218
11342
|
for (const item of results) {
|
|
11219
11343
|
if (!item.result.errors.length && !item.result.warnings.length) continue;
|
|
11220
11344
|
process.stdout.write(`
|
|
11221
|
-
|
|
11345
|
+
${item.artifact}
|
|
11222
11346
|
`);
|
|
11223
11347
|
for (const error of item.result.errors) process.stdout.write(` error: ${error}
|
|
11224
11348
|
`);
|
|
@@ -17131,7 +17255,7 @@ async function chironPageCommand(target, args, deps = defaultChironPageDeps) {
|
|
|
17131
17255
|
// src/commands/chiron-test.ts
|
|
17132
17256
|
init_exit();
|
|
17133
17257
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
17134
|
-
import { randomUUID } from "crypto";
|
|
17258
|
+
import { randomUUID as randomUUID2 } from "crypto";
|
|
17135
17259
|
import { promises as fs14 } from "fs";
|
|
17136
17260
|
import path17 from "path";
|
|
17137
17261
|
import yaml3 from "js-yaml";
|
|
@@ -18162,7 +18286,7 @@ async function chironTestCommand(target, args, deps) {
|
|
|
18162
18286
|
const results = await runCase(
|
|
18163
18287
|
spec,
|
|
18164
18288
|
root,
|
|
18165
|
-
{ env: args.env, as: args.as, evidenceRunId:
|
|
18289
|
+
{ env: args.env, as: args.as, evidenceRunId: randomUUID2() },
|
|
18166
18290
|
deps
|
|
18167
18291
|
);
|
|
18168
18292
|
failed2 += results.filter((r) => r.verdict === "fail").length;
|