@hcmai/cli 0.4.5 → 0.4.7
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 +32 -6
- package/dist/index.js.map +1 -1
- package/dist/skills/manifest.json +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -6429,6 +6429,9 @@ async function workspaceValidateCommand(args) {
|
|
|
6429
6429
|
exitWorkspaceError(e);
|
|
6430
6430
|
}
|
|
6431
6431
|
}
|
|
6432
|
+
function isScriptPath(relativePath) {
|
|
6433
|
+
return relativePath.startsWith("scripts/");
|
|
6434
|
+
}
|
|
6432
6435
|
async function workspacePushCommand(args) {
|
|
6433
6436
|
try {
|
|
6434
6437
|
const rootDir = resolveRootDir(args.dir);
|
|
@@ -6437,6 +6440,24 @@ async function workspacePushCommand(args) {
|
|
|
6437
6440
|
const client3 = HcmClient17.fromAuthContext(
|
|
6438
6441
|
await getActiveAuthContextFromCli(args, { fallbackEnv: context.profile })
|
|
6439
6442
|
);
|
|
6443
|
+
const activeWorkspaceKey = args.dryRun ? null : await probeActiveWorkspaceKey(client3);
|
|
6444
|
+
if (!args.dryRun && context.workspaceKey && activeWorkspaceKey !== context.workspaceKey) {
|
|
6445
|
+
const plan = await pushWorkspaceRawFiles({
|
|
6446
|
+
http: client3.raw(),
|
|
6447
|
+
rootDir,
|
|
6448
|
+
context,
|
|
6449
|
+
dryRun: true
|
|
6450
|
+
});
|
|
6451
|
+
const scriptOps = plan.operations.filter((op) => isScriptPath(op.remotePath ?? op.localPath));
|
|
6452
|
+
if (scriptOps.length > 0) {
|
|
6453
|
+
throw new Error(
|
|
6454
|
+
`\u672C\u6B21\u4F1A\u5199 ${scriptOps.length} \u4E2A\u811A\u672C\uFF0C\u4F46\u5F53\u524D\u6FC0\u6D3B\u7684\u5F00\u53D1\u7A7A\u95F4\u662F ${activeWorkspaceKey ? `"${activeWorkspaceKey}"` : "\uFF08\u672A\u6FC0\u6D3B\uFF09"}\uFF0C\u4E0D\u662F\u672C\u7A7A\u95F4 "${context.workspaceKey}"\u3002
|
|
6455
|
+
\u670D\u52A1\u7AEF\u4F1A\u62D2\u7EDD\u5199\u811A\u672C\uFF0C\u800C\u975E\u811A\u672C\u6587\u4EF6\u5DF2\u7ECF\u5199\u8FDB\u53BB\u4E86 \u2014\u2014 \u90A3\u4F1A\u7559\u4E0B\u534A\u63A8\u9001\u72B6\u6001\u3002
|
|
6456
|
+
\u4E0B\u4E00\u6B65\uFF1Ahcm workspace activate ${context.workspaceKey}
|
|
6457
|
+
\u6D89\u53CA\u811A\u672C\uFF1A${scriptOps.map((op) => op.remotePath ?? op.localPath).join(", ")}`
|
|
6458
|
+
);
|
|
6459
|
+
}
|
|
6460
|
+
}
|
|
6440
6461
|
const rawResult = await pushWorkspaceRawFiles({
|
|
6441
6462
|
http: client3.raw(),
|
|
6442
6463
|
rootDir,
|
|
@@ -6454,11 +6475,7 @@ async function workspacePushCommand(args) {
|
|
|
6454
6475
|
}
|
|
6455
6476
|
writeWorkspacePushResult(rawResult, results, args.output ?? "table");
|
|
6456
6477
|
const hint = activationHint(
|
|
6457
|
-
await probeActiveWorkspaceKey(
|
|
6458
|
-
HcmClient17.fromAuthContext(
|
|
6459
|
-
await getActiveAuthContextFromCli(args, { fallbackEnv: context.profile })
|
|
6460
|
-
)
|
|
6461
|
-
),
|
|
6478
|
+
activeWorkspaceKey ?? await probeActiveWorkspaceKey(client3),
|
|
6462
6479
|
context.workspaceKey ?? null
|
|
6463
6480
|
);
|
|
6464
6481
|
if (hint) process.stderr.write(`
|
|
@@ -7650,7 +7667,16 @@ function classify(argv, actionResolution) {
|
|
|
7650
7667
|
return guarded("managed-local-write", "workspace-local-change");
|
|
7651
7668
|
}
|
|
7652
7669
|
if (subcommand === "create") return guarded("tenant-write", "workspace-create");
|
|
7653
|
-
if (subcommand === "
|
|
7670
|
+
if (subcommand === "activate") return guarded("tenant-write", "workspace-activate");
|
|
7671
|
+
if (subcommand === "push") return guarded("tenant-write", "workspace-push");
|
|
7672
|
+
if (["deploy", "release", "promote", "publish"].includes(subcommand)) {
|
|
7673
|
+
return forbidden("publish", "\u90E8\u7F72\u5230 active \u5C5E\u4E8E R3\uFF0C\u987B\u8D70\u53D1\u5E03\u4E0E\u5BA1\u6279\u94FE\u8DEF\u3002");
|
|
7674
|
+
}
|
|
7675
|
+
}
|
|
7676
|
+
if (name === "script") {
|
|
7677
|
+
if (["dry-run", "manifest-validate", "logs", "task"].includes(subcommand)) {
|
|
7678
|
+
return direct("R1", "remote-read", "script-" + subcommand);
|
|
7679
|
+
}
|
|
7654
7680
|
}
|
|
7655
7681
|
if (name === "import") {
|
|
7656
7682
|
if (hasFlag(argv, "--dry-run")) {
|