huaweicloud-devkit 2.0.0-next.0 → 2.0.0-next.1

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.
Files changed (42) hide show
  1. package/package.json +1 -1
  2. package/plugins/huaweicloud-core/.claude-plugin/plugin.json +1 -1
  3. package/plugins/huaweicloud-core/.codex-plugin/plugin.json +1 -1
  4. package/plugins/huaweicloud-core/.cursor-plugin/plugin.json +1 -1
  5. package/plugins/huaweicloud-core/.hermes-plugin/plugin.json +1 -1
  6. package/plugins/huaweicloud-core/.workbuddy-plugin/plugin.json +1 -1
  7. package/plugins/huaweicloud-core/dist/agents/officeace-sqlite.js +14 -4
  8. package/plugins/huaweicloud-core/dist/agents/opencode-config.js +5 -1
  9. package/plugins/huaweicloud-core/dist/approvals-cli.js +159 -0
  10. package/plugins/huaweicloud-core/dist/hcloud-plan.js +26 -4
  11. package/plugins/huaweicloud-core/dist/hcloud-run.js +4 -1
  12. package/plugins/huaweicloud-core/dist/lib/approval-tokens.js +132 -13
  13. package/plugins/huaweicloud-core/dist/lib/approvals-pin.js +128 -0
  14. package/plugins/huaweicloud-core/dist/mcp-server.js +114 -28
  15. package/plugins/huaweicloud-core/dist/mcp-server.js.map +3 -3
  16. package/plugins/huaweicloud-core/dist/packs/huaweicloud-cli/tools.js +27 -9
  17. package/plugins/huaweicloud-core/dist/payload-runtime-deps.js +11 -3
  18. package/plugins/huaweicloud-core/dist/safety/classify-text.js +13 -0
  19. package/plugins/huaweicloud-core/dist/safety/policy.js +1 -0
  20. package/plugins/huaweicloud-core/dist/setup-cli.js +7 -0
  21. package/plugins/huaweicloud-core/dist/update-registry.js +8 -2
  22. package/plugins/huaweicloud-core/dist/update-upgrade.js +8 -1
  23. package/plugins/huaweicloud-core/hooks/huaweicloud-safety.py +20 -1
  24. package/plugins/huaweicloud-core/openclaw.plugin.json +1 -1
  25. package/plugins/huaweicloud-core/safety/policy.json +8 -0
  26. package/plugins/huaweicloud-core/skills/huaweicloud-cli-and-auth/SKILL.md +4 -1
  27. package/plugins/huaweicloud-core/skills/huaweicloud-safety/SKILL.md +13 -6
  28. package/plugins/huaweicloud-core/skills/huaweicloud-safety/references/approvals.md +47 -0
  29. package/plugins/huaweicloud-core/src/agents/officeace-sqlite.ts +14 -4
  30. package/plugins/huaweicloud-core/src/agents/opencode-config.ts +5 -1
  31. package/plugins/huaweicloud-core/src/approvals-cli.ts +187 -0
  32. package/plugins/huaweicloud-core/src/hcloud-plan.ts +44 -5
  33. package/plugins/huaweicloud-core/src/hcloud-run.ts +4 -1
  34. package/plugins/huaweicloud-core/src/lib/approval-tokens.ts +194 -13
  35. package/plugins/huaweicloud-core/src/lib/approvals-pin.ts +153 -0
  36. package/plugins/huaweicloud-core/src/packs/huaweicloud-cli/tools.ts +29 -9
  37. package/plugins/huaweicloud-core/src/payload-runtime-deps.ts +11 -3
  38. package/plugins/huaweicloud-core/src/safety/classify-text.ts +15 -0
  39. package/plugins/huaweicloud-core/src/safety/policy.ts +2 -0
  40. package/plugins/huaweicloud-core/src/setup-cli.ts +7 -0
  41. package/plugins/huaweicloud-core/src/update-registry.ts +8 -2
  42. package/plugins/huaweicloud-core/src/update-upgrade.ts +8 -1
@@ -35,6 +35,7 @@ import { cmdProxy } from './proxy/cli.ts';
35
35
  import { removeKooCli, removeObsConfig } from './sandbox/uninstall-cleanup.ts';
36
36
  import { readReceipt, removeReceipt } from './dep/receipts.ts';
37
37
  import { runSecretCommand } from './lib/secret-vault/cli.ts';
38
+ import { createProcessApproveIo, runApproveCommand, runPinCommand } from './approvals-cli.ts';
38
39
  import { custodyReport } from './lib/secret-vault/custody.ts';
39
40
  import { vaultList } from './lib/secret-vault/store.ts';
40
41
  import { detectCodeartsSandbox } from './codearts-sandbox.ts';
@@ -1482,6 +1483,12 @@ async function main(): Promise<void> {
1482
1483
  case 'secret':
1483
1484
  process.exitCode = runSecretCommand(process.argv.slice(3));
1484
1485
  break;
1486
+ case 'approve':
1487
+ process.exitCode = await runApproveCommand(process.argv.slice(3), createProcessApproveIo());
1488
+ break;
1489
+ case 'pin':
1490
+ process.exitCode = await runPinCommand(process.argv.slice(3), createProcessApproveIo());
1491
+ break;
1485
1492
  case 'proxy':
1486
1493
  await cmdProxy();
1487
1494
  break;
@@ -70,7 +70,11 @@ export function queryDistTagsSync({
70
70
  cwd,
71
71
  }: { timeoutMs?: number; cwd?: string } = {}): DistTags | null {
72
72
  try {
73
- const result = spawnSync(NPM_BIN, ['view', 'huaweicloud-devkit', 'dist-tags', '--json'], {
73
+ // String command, never an args array: args + shell:true is DEP0190 on
74
+ // Node 24, and the words are static so the shell concatenation is
75
+ // injection-safe. shell:true stays load-bearing: it routes npm.cmd on
76
+ // Windows (the #643 EINVAL doctrine below).
77
+ const result = spawnSync(`${NPM_BIN} view huaweicloud-devkit dist-tags --json`, {
74
78
  encoding: 'utf8',
75
79
  timeout: timeoutMs,
76
80
  windowsHide: true,
@@ -105,7 +109,9 @@ export function queryDistTags({
105
109
  return new Promise<DistTags | null>((resolve) => {
106
110
  let child: ChildProcessWithoutNullStreams;
107
111
  try {
108
- child = spawn(NPM_BIN, ['view', 'huaweicloud-devkit', 'dist-tags', '--json'], {
112
+ // Same string-command doctrine as queryDistTagsSync: no args array
113
+ // under shell (DEP0190 on Node 24), static words only.
114
+ child = spawn(`${NPM_BIN} view huaweicloud-devkit dist-tags --json`, {
109
115
  windowsHide: true,
110
116
  cwd,
111
117
  shell: true,
@@ -30,7 +30,14 @@ function defaultSpawn(
30
30
  args: readonly string[],
31
31
  options: SpawnSyncOptionsWithStringEncoding,
32
32
  ): SpawnResultLike {
33
- return spawnSync(command, args, options);
33
+ // The args join into the command string before the spawn: options carries
34
+ // shell:true (the #643 npm.cmd routing; the target interpolation stays
35
+ // guarded by the SUPPORTED_AGENT_TARGETS allowlist, review #717), and an
36
+ // args array under shell is DEP0190 on Node 24. shell:true already
37
+ // concatenates args unescaped, so the join is behavior-identical minus
38
+ // the warning; the seam's (command, args) contract is unchanged for the
39
+ // injected test doubles.
40
+ return spawnSync([command, ...args].join(' '), options);
34
41
  }
35
42
 
36
43
  function restartMessage(target: string): string {