@vmz/vmz 0.1.17 → 0.1.18

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 (131) hide show
  1. package/dist/application-cmd.d.ts +6 -16
  2. package/dist/application-cmd.js +34 -180
  3. package/dist/author-input.d.ts +40 -19
  4. package/dist/author-input.js +2 -16
  5. package/dist/build-assemble.d.ts +63 -41
  6. package/dist/build-assemble.js +42 -43
  7. package/dist/bundler-adapter.d.ts +46 -48
  8. package/dist/bundler-adapter.js +4 -43
  9. package/dist/cdn-policy.d.ts +77 -93
  10. package/dist/cdn-policy.js +10 -16
  11. package/dist/cli-localize.d.ts +34 -0
  12. package/dist/cli-localize.js +58 -0
  13. package/dist/cli.d.ts +8 -19
  14. package/dist/cli.js +69 -252
  15. package/dist/content-addressed-assets.d.ts +24 -10
  16. package/dist/content-addressed-assets.js +2 -7
  17. package/dist/delivery-profile.d.ts +54 -27
  18. package/dist/delivery-profile.js +15 -13
  19. package/dist/dev-session.d.ts +29 -23
  20. package/dist/dev-session.js +0 -21
  21. package/dist/dev-watch-roots.d.ts +34 -25
  22. package/dist/dev-watch-roots.js +0 -31
  23. package/dist/document-build.d.ts +22 -97
  24. package/dist/document-build.js +4 -19
  25. package/dist/document-check.d.ts +30 -53
  26. package/dist/document-check.js +14 -29
  27. package/dist/document-cmd.d.ts +3 -6
  28. package/dist/document-cmd.js +19 -79
  29. package/dist/document-designs.d.ts +5 -8
  30. package/dist/document-designs.js +2 -15
  31. package/dist/document-enrich.d.ts +52 -24
  32. package/dist/document-enrich.js +4 -32
  33. package/dist/document-evidence.d.ts +46 -43
  34. package/dist/document-evidence.js +6 -47
  35. package/dist/document-integrate.d.ts +13 -29
  36. package/dist/document-integrate.js +2 -13
  37. package/dist/document-interactive.d.ts +45 -67
  38. package/dist/document-interactive.js +9 -50
  39. package/dist/document-layout-render.d.ts +7 -16
  40. package/dist/document-layout-render.js +0 -17
  41. package/dist/document-locale.d.ts +12 -25
  42. package/dist/document-locale.js +3 -14
  43. package/dist/document-markdown.d.ts +9 -5
  44. package/dist/document-markdown.js +0 -4
  45. package/dist/document-routing-config.d.ts +7 -14
  46. package/dist/document-routing-config.js +0 -9
  47. package/dist/document-scan.d.ts +14 -18
  48. package/dist/document-scan.js +2 -23
  49. package/dist/document-schema.d.ts +154 -41
  50. package/dist/document-schema.js +0 -35
  51. package/dist/embedded-packaging.d.ts +20 -8
  52. package/dist/embedded-packaging.js +0 -1
  53. package/dist/explain-cmd.d.ts +4 -3
  54. package/dist/explain-cmd.js +16 -65
  55. package/dist/index.d.ts +70 -143
  56. package/dist/index.js +16 -136
  57. package/dist/invocation.d.ts +29 -50
  58. package/dist/invocation.js +11 -57
  59. package/dist/locale-check.d.ts +69 -70
  60. package/dist/locale-check.js +5 -66
  61. package/dist/locale-cmd.d.ts +2 -5
  62. package/dist/locale-cmd.js +62 -142
  63. package/dist/locale-delivery.d.ts +294 -191
  64. package/dist/locale-delivery.js +8 -94
  65. package/dist/locale-route-emit.d.ts +23 -9
  66. package/dist/locale-route-emit.js +0 -7
  67. package/dist/locale-router.d.ts +189 -162
  68. package/dist/locale-router.js +13 -122
  69. package/dist/locale-runtime.d.ts +292 -262
  70. package/dist/locale-runtime.js +8 -102
  71. package/dist/locale-schema.js +0 -1
  72. package/dist/locale-tooling.d.ts +100 -63
  73. package/dist/locale-tooling.js +7 -45
  74. package/dist/log.d.ts +22 -15
  75. package/dist/log.js +24 -21
  76. package/dist/native-addon.d.ts +10 -9
  77. package/dist/native-addon.js +1 -10
  78. package/dist/pack-client-packages.d.ts +5 -1
  79. package/dist/pack-client-packages.js +0 -6
  80. package/dist/pack.d.ts +17 -15
  81. package/dist/pack.js +0 -12
  82. package/dist/packages.d.ts +10 -23
  83. package/dist/packages.js +1 -37
  84. package/dist/plan-cmd.d.ts +6 -0
  85. package/dist/plan-cmd.js +35 -0
  86. package/dist/plugin-host.js +0 -1
  87. package/dist/port.d.ts +2 -10
  88. package/dist/port.js +2 -11
  89. package/dist/pretty-json.d.ts +9 -19
  90. package/dist/pretty-json.js +3 -17
  91. package/dist/production-observability.d.ts +37 -181
  92. package/dist/production-observability.js +1 -9
  93. package/dist/production-test-pack.d.ts +17 -3
  94. package/dist/production-test-pack.js +0 -2
  95. package/dist/public-static-assets.d.ts +6 -1
  96. package/dist/public-static-assets.js +0 -5
  97. package/dist/refactor-cmd.d.ts +3 -6
  98. package/dist/refactor-cmd.js +16 -69
  99. package/dist/release-cmd.d.ts +7 -6
  100. package/dist/release-cmd.js +17 -59
  101. package/dist/release-pack.d.ts +7 -3
  102. package/dist/release-pack.js +0 -6
  103. package/dist/resolve.d.ts +15 -19
  104. package/dist/resolve.js +1 -15
  105. package/dist/server-artifact.d.ts +30 -75
  106. package/dist/server-artifact.js +0 -10
  107. package/dist/server-language-backend.d.ts +22 -79
  108. package/dist/server-language-backend.js +0 -26
  109. package/dist/site-delivery.d.ts +46 -59
  110. package/dist/site-delivery.js +3 -8
  111. package/dist/site-favicon.d.ts +6 -1
  112. package/dist/site-favicon.js +0 -5
  113. package/dist/static-emit.d.ts +73 -103
  114. package/dist/static-emit.js +1 -26
  115. package/dist/test-cmd.d.ts +3 -5
  116. package/dist/test-cmd.js +15 -25
  117. package/dist/test-compile.js +0 -1
  118. package/dist/test-discover.js +0 -1
  119. package/dist/test-logic.js +0 -1
  120. package/dist/test-protocol.js +0 -1
  121. package/dist/toolchain-dx.d.ts +11 -0
  122. package/dist/toolchain-dx.js +10 -0
  123. package/dist/watch-diff.d.ts +4 -13
  124. package/dist/watch-diff.js +0 -17
  125. package/dist/wechat-packaging.d.ts +8 -7
  126. package/dist/wechat-packaging.js +0 -6
  127. package/locales/en-US/cli.json +105 -0
  128. package/locales/locales.json +4 -0
  129. package/package.json +15 -12
  130. package/dist/resolve-native-cli.d.ts +0 -14
  131. package/dist/resolve-native-cli.js +0 -84
@@ -6,132 +6,35 @@ export declare const PRODUCTION_OBSERVABILITY_SCHEMA = "vmz.production.observabi
6
6
  export declare const PRODUCTION_TRACE_SCHEMA = "vmz.production.trace.v0";
7
7
  /** Facets that production traces must be able to carry (08 A5). */
8
8
  export declare const REQUIRED_TRACE_FACETS: readonly string[];
9
- /**
10
- * Default Browser Production Profile observability contract.
11
- * @param {Record<string, unknown>} [overrides]
12
- */
13
- export declare function browserProductionObservability(overrides?: {}): {
9
+ interface RedactionPolicy {
10
+ replaceWith?: string;
11
+ allowPublicProvenance?: boolean;
12
+ allowOperatorRaw?: boolean;
13
+ }
14
+ interface RedactSensitiveOpts {
15
+ privilege?: 'public' | 'operator';
16
+ }
17
+ interface ObservabilityContract {
14
18
  schema: string;
15
- id: any;
16
- trace: {
17
- schema: string;
18
- requiredFacets: any;
19
- retainOnFailure: any;
20
- };
21
- redaction: {
22
- mode: string;
23
- replaceWith: any;
24
- allowPublicProvenance: boolean;
25
- sensitiveKeyPattern: string;
26
- };
27
- security: {
28
- csp: any;
29
- requireIntegrityForRemote: boolean;
30
- originIsolation: boolean;
31
- requireNonceForInline: boolean;
32
- cookieNamespace: any;
33
- sessionNamespace: any;
34
- };
35
- capability: {
36
- allowlistRequired: boolean;
37
- inputOutputSchemaRequired: boolean;
38
- timeoutMsDefault: number;
39
- cancelSupported: boolean;
40
- serverSecretClosure: boolean;
41
- };
42
- budgets: {
43
- irrelevantBindingWork: number;
44
- irrelevantRouteRegionRebuild: number;
45
- wholeTreeRerender: number;
46
- maxArtifactBytes: number;
47
- maxHtmlBytes: number;
48
- maxClientJsBytes: number;
49
- maxPatchCountPerTransition: number;
50
- };
51
- health: {
52
- livePath: any;
53
- readyPath: any;
54
- gracefulShutdown: {
55
- stopAccepting: boolean;
56
- drainInFlight: boolean;
57
- timeoutMs: number;
58
- };
59
- };
60
- sampling: {
61
- diagnosticSampleRate: number;
62
- rollbackOnErrorRate: number;
63
- latencyBudgetMs: {
64
- p95: number;
65
- p99: number;
66
- };
67
- };
68
- };
69
- /**
70
- * @param {unknown} raw
71
- */
72
- export declare function normalizeObservability(raw: any): {
73
- schema: string;
74
- id: any;
75
- trace: {
76
- schema: string;
77
- requiredFacets: any;
78
- retainOnFailure: any;
79
- };
80
- redaction: {
81
- mode: string;
82
- replaceWith: any;
83
- allowPublicProvenance: boolean;
84
- sensitiveKeyPattern: string;
85
- };
86
- security: {
87
- csp: any;
88
- requireIntegrityForRemote: boolean;
89
- originIsolation: boolean;
90
- requireNonceForInline: boolean;
91
- cookieNamespace: any;
92
- sessionNamespace: any;
93
- };
94
- capability: {
95
- allowlistRequired: boolean;
96
- inputOutputSchemaRequired: boolean;
97
- timeoutMsDefault: number;
98
- cancelSupported: boolean;
99
- serverSecretClosure: boolean;
100
- };
101
- budgets: {
102
- irrelevantBindingWork: number;
103
- irrelevantRouteRegionRebuild: number;
104
- wholeTreeRerender: number;
105
- maxArtifactBytes: number;
106
- maxHtmlBytes: number;
107
- maxClientJsBytes: number;
108
- maxPatchCountPerTransition: number;
109
- };
110
- health: {
111
- livePath: any;
112
- readyPath: any;
113
- gracefulShutdown: {
114
- stopAccepting: boolean;
115
- drainInFlight: boolean;
116
- timeoutMs: number;
117
- };
118
- };
119
- sampling: {
120
- diagnosticSampleRate: number;
121
- rollbackOnErrorRate: number;
122
- latencyBudgetMs: {
123
- p95: number;
124
- p99: number;
125
- };
126
- };
127
- };
19
+ id: string;
20
+ trace: Record<string, unknown>;
21
+ redaction: Record<string, unknown>;
22
+ security: Record<string, unknown>;
23
+ capability: Record<string, unknown>;
24
+ budgets: Record<string, unknown>;
25
+ health: Record<string, unknown>;
26
+ sampling: Record<string, unknown>;
27
+ digest?: string;
28
+ }
29
+ export declare function browserProductionObservability(overrides?: Record<string, unknown>): ObservabilityContract;
30
+ export declare function normalizeObservability(raw: unknown): ObservabilityContract;
128
31
  /**
129
32
  * Redact sensitive keys recursively. Never returns secrets for public provenance.
130
33
  * @param {unknown} value
131
34
  * @param {Record<string, any>} [policy]
132
35
  * @param {{ privilege?: 'public' | 'operator' }} [opts]
133
36
  */
134
- export declare function redactSensitive(value: any, policy?: {}, opts?: {}): any;
37
+ export declare function redactSensitive(value: unknown, policy?: RedactionPolicy, opts?: RedactSensitiveOpts): any;
135
38
  /**
136
39
  * Validate a production trace carries required facets (as event.facet or mapped kind).
137
40
  * @param {unknown} raw
@@ -146,11 +49,15 @@ export declare function validateProductionTrace(raw: any, requiredFacets?: reado
146
49
  * Build a minimal valid production trace covering all required facets (for CI assembly).
147
50
  * @param {Record<string, unknown>} [meta]
148
51
  */
149
- export declare function buildCoveringProductionTrace(meta?: {}): {
52
+ export declare function buildCoveringProductionTrace(meta?: {
53
+ generation?: number;
54
+ applicationId?: string;
55
+ artifactDigest?: string | null;
56
+ }): {
150
57
  schema: string;
151
58
  status: string;
152
- applicationId: any;
153
- artifactDigest: any;
59
+ applicationId: string;
60
+ artifactDigest: string;
154
61
  events: {
155
62
  facet: string;
156
63
  kind: string;
@@ -205,68 +112,16 @@ export declare function measureDistBudgets(distDir: any): {
205
112
  * @param {Record<string, unknown>} [overrides]
206
113
  * @param {{ applicationId?: string, artifactDigest?: string }} [meta]
207
114
  */
208
- export declare function emitProductionObservability(distDir: any, overrides?: {}, meta?: {}): {
209
- contract: {
210
- schema: string;
211
- id: any;
212
- trace: {
213
- schema: string;
214
- requiredFacets: any;
215
- retainOnFailure: any;
216
- };
217
- redaction: {
218
- mode: string;
219
- replaceWith: any;
220
- allowPublicProvenance: boolean;
221
- sensitiveKeyPattern: string;
222
- };
223
- security: {
224
- csp: any;
225
- requireIntegrityForRemote: boolean;
226
- originIsolation: boolean;
227
- requireNonceForInline: boolean;
228
- cookieNamespace: any;
229
- sessionNamespace: any;
230
- };
231
- capability: {
232
- allowlistRequired: boolean;
233
- inputOutputSchemaRequired: boolean;
234
- timeoutMsDefault: number;
235
- cancelSupported: boolean;
236
- serverSecretClosure: boolean;
237
- };
238
- budgets: {
239
- irrelevantBindingWork: number;
240
- irrelevantRouteRegionRebuild: number;
241
- wholeTreeRerender: number;
242
- maxArtifactBytes: number;
243
- maxHtmlBytes: number;
244
- maxClientJsBytes: number;
245
- maxPatchCountPerTransition: number;
246
- };
247
- health: {
248
- livePath: any;
249
- readyPath: any;
250
- gracefulShutdown: {
251
- stopAccepting: boolean;
252
- drainInFlight: boolean;
253
- timeoutMs: number;
254
- };
255
- };
256
- sampling: {
257
- diagnosticSampleRate: number;
258
- rollbackOnErrorRate: number;
259
- latencyBudgetMs: {
260
- p95: number;
261
- p99: number;
262
- };
263
- };
264
- };
115
+ export declare function emitProductionObservability(distDir: string, overrides?: Record<string, unknown>, meta?: {
116
+ applicationId?: string;
117
+ artifactDigest?: string | null;
118
+ }): {
119
+ contract: ObservabilityContract;
265
120
  trace: {
266
121
  schema: string;
267
122
  status: string;
268
- applicationId: any;
269
- artifactDigest: any;
123
+ applicationId: string;
124
+ artifactDigest: string;
270
125
  events: {
271
126
  facet: string;
272
127
  kind: string;
@@ -284,3 +139,4 @@ export declare function emitProductionObservability(distDir: any, overrides?: {}
284
139
  };
285
140
  export declare function observabilityDigest(contract: any): any;
286
141
  export declare function sha256Text(text: any): string;
142
+ export {};
@@ -2,7 +2,6 @@
2
2
  * A5: Production observability — trace facets, redaction, CSP/security,
3
3
  * performance budgets, health/readiness, capability closure.
4
4
  */
5
- // @ts-nocheck
6
5
  import crypto from 'node:crypto';
7
6
  import fs from 'node:fs';
8
7
  import path from 'node:path';
@@ -25,10 +24,6 @@ export const REQUIRED_TRACE_FACETS = Object.freeze([
25
24
  'artifact',
26
25
  ]);
27
26
  const SENSITIVE_KEY_RE = /^(password|passwd|secret|token|authorization|cookie|set-cookie|api[_-]?key|private[_-]?key|session|refresh[_-]?token|access[_-]?token|client[_-]?secret)$/i;
28
- /**
29
- * Default Browser Production Profile observability contract.
30
- * @param {Record<string, unknown>} [overrides]
31
- */
32
27
  export function browserProductionObservability(overrides = {}) {
33
28
  return normalizeObservability({
34
29
  schema: PRODUCTION_OBSERVABILITY_SCHEMA,
@@ -85,11 +80,8 @@ export function browserProductionObservability(overrides = {}) {
85
80
  ...overrides,
86
81
  });
87
82
  }
88
- /**
89
- * @param {unknown} raw
90
- */
91
83
  export function normalizeObservability(raw) {
92
- const d = raw && typeof raw === 'object' && !Array.isArray(raw) ? /** @type {Record<string, any>} */ (raw) : {};
84
+ const d = raw && typeof raw === 'object' && !Array.isArray(raw) ? raw : {};
93
85
  const trace = d.trace && typeof d.trace === 'object' ? d.trace : {};
94
86
  const redaction = d.redaction && typeof d.redaction === 'object' ? d.redaction : {};
95
87
  const security = d.security && typeof d.security === 'object' ? d.security : {};
@@ -107,12 +107,25 @@ export declare function normalizeCiProfile(raw: any): {
107
107
  };
108
108
  export declare function scenarioPackDigest(pack: any): string;
109
109
  export declare function ciProfileDigest(profile: any): string;
110
+ type ProductionScenarioResult = {
111
+ scenarioId: string;
112
+ status?: string;
113
+ reason?: string | null;
114
+ detail?: string | null;
115
+ artifacts?: unknown;
116
+ attempts?: number;
117
+ flaky?: boolean;
118
+ };
110
119
  /**
111
120
  * Build a production test report from scenario results.
112
121
  * Quarantine entries must be status=`quarantined` (never `passed`).
113
- * @param {{ pack: Record<string, any>, profile: Record<string, any>, results: Array<Record<string, any>>, artifactsDir?: string }} input
114
122
  */
115
- export declare function buildProductionTestReport(input: any): {
123
+ export declare function buildProductionTestReport(input: {
124
+ pack: Record<string, any>;
125
+ profile: Record<string, any>;
126
+ results: ProductionScenarioResult[];
127
+ artifactsDir?: string;
128
+ }): {
116
129
  schema: string;
117
130
  status: string;
118
131
  packId: any;
@@ -125,7 +138,7 @@ export declare function buildProductionTestReport(input: any): {
125
138
  artifactsDir: any;
126
139
  generatedAt: any;
127
140
  tests: any[];
128
- errors: any[];
141
+ errors: string[];
129
142
  };
130
143
  /** Stable digest of report (excludes generatedAt). */
131
144
  export declare function productionTestReportDigest(report: any): string;
@@ -142,3 +155,4 @@ export declare function emitProductionTestArtifacts(root: any, report: any, pack
142
155
  /** Assert CI profile forbids JS test-runner disguise. */
143
156
  export declare function assertNoForbiddenRunners(profile: any, importedNames?: any[]): any[];
144
157
  export declare function sha256Text(text: any): string;
158
+ export {};
@@ -3,7 +3,6 @@
3
3
  * Assembles real user-path scenarios for `pnpm verify -- production-test`.
4
4
  * Does not invent Vitest/Jest/Playwright semantics.
5
5
  */
6
- // @ts-nocheck
7
6
  import crypto from 'node:crypto';
8
7
  import fs from 'node:fs';
9
8
  import path from 'node:path';
@@ -325,7 +324,6 @@ export function ciProfileDigest(profile) {
325
324
  /**
326
325
  * Build a production test report from scenario results.
327
326
  * Quarantine entries must be status=`quarantined` (never `passed`).
328
- * @param {{ pack: Record<string, any>, profile: Record<string, any>, results: Array<Record<string, any>>, artifactsDir?: string }} input
329
327
  */
330
328
  export function buildProductionTestReport(input) {
331
329
  const pack = input.pack;
@@ -7,7 +7,11 @@ export declare const PUBLIC_STATIC_ASSETS_SCHEMA = "vmz.public_static_assets.v0"
7
7
  * @param {string} distDir
8
8
  * @param {{ projectRoot?: string, publicDir?: string }} [opts]
9
9
  */
10
- export declare function emitPublicStaticAssets(distDir: any, opts?: {}): {
10
+ interface PublicStaticAssetsOpts {
11
+ projectRoot?: string;
12
+ publicDir?: string;
13
+ }
14
+ export declare function emitPublicStaticAssets(distDir: string, opts?: PublicStaticAssetsOpts): {
11
15
  schema: string;
12
16
  status: string;
13
17
  reason: string;
@@ -22,3 +26,4 @@ export declare function emitPublicStaticAssets(distDir: any, opts?: {}): {
22
26
  files: any[];
23
27
  skippedConflicts: any[];
24
28
  };
29
+ export {};
@@ -2,7 +2,6 @@
2
2
  * Opaque site-root static files: project `public/**` → deploy root (static / web-static).
3
3
  * Not dependency packaging (no node_modules / @dxo/* scanning).
4
4
  */
5
- // @ts-nocheck
6
5
  import fs from 'node:fs';
7
6
  import path from 'node:path';
8
7
  import { writePrettyJsonFile } from './pretty-json.js';
@@ -25,10 +24,6 @@ const RESERVED_EXACT = new Set([
25
24
  'robots.txt',
26
25
  '404.html',
27
26
  ]);
28
- /**
29
- * @param {string} distDir
30
- * @param {{ projectRoot?: string, publicDir?: string }} [opts]
31
- */
32
27
  export function emitPublicStaticAssets(distDir, opts = {}) {
33
28
  const absDist = path.resolve(distDir);
34
29
  const projectRoot = opts.projectRoot ? path.resolve(opts.projectRoot) : null;
@@ -1,8 +1,5 @@
1
1
  /**
2
- * `vmz refactor` — RouteId/field safe rename (plan + atomic apply).
2
+ * `vmz refactor` — registered on `@vmz/commander`.
3
3
  */
4
- /**
5
- * @param {string[]} argv args after `refactor`
6
- * @returns {Promise<number>}
7
- */
8
- export declare function cmdRefactor(argv: any): Promise<0 | 1>;
4
+ import type { Command } from '@vmz/commander';
5
+ export declare function registerRefactorCommands(parent: Command): void;
@@ -1,73 +1,23 @@
1
- // @ts-nocheck
2
1
  /**
3
- * `vmz refactor` — RouteId/field safe rename (plan + atomic apply).
2
+ * `vmz refactor` — registered on `@vmz/commander`.
4
3
  */
5
4
  import { createWorkspace } from './index.js';
6
5
  import { log } from './log.js';
7
6
  import { resolveWorkspaceDirs } from './resolve.js';
8
- /**
9
- * @param {string[]} argv args after `refactor`
10
- * @returns {Promise<number>}
11
- */
12
- export async function cmdRefactor(argv) {
13
- const [sub, ...rest] = argv;
14
- if (!sub || sub === 'help' || sub === '-h' || sub === '--help') {
15
- printRefactorHelp();
16
- return 0;
17
- }
18
- if (sub === 'rename') {
19
- return cmdRename(rest);
20
- }
21
- log.error(`unknown refactor subcommand \`${sub}\``);
22
- printRefactorHelp();
23
- return 1;
24
- }
25
- function printRefactorHelp() {
26
- console.log(`vmz refactor — workspace edit plans
27
-
28
- Usage:
29
- vmz refactor rename --kind <route_id|field|method|component|capability> --from <id> --to <id> [path]
30
- [--scope <chunk>] [--json] [--apply] [--explain]
31
-
32
- Notes:
33
- Returns WorkspaceEditPlan (\`vmz.dx.workspace_edit.v0\`).
34
- route_id / field emit proven TextEdits; --apply writes atomically when status=ready.
35
- `);
36
- }
37
- /**
38
- * @param {string[]} argv
39
- */
40
- function parseRefactorArgs(argv) {
41
- /** @type {Record<string, string | boolean> & { _: string[] }} */
42
- const out = { _: [] };
43
- for (let i = 0; i < argv.length; i++) {
44
- const a = argv[i];
45
- if (a.startsWith('--')) {
46
- const eq = a.indexOf('=');
47
- if (eq !== -1) {
48
- out[a.slice(2, eq)] = a.slice(eq + 1);
49
- continue;
50
- }
51
- const key = a.slice(2);
52
- const next = argv[i + 1];
53
- if (next && !next.startsWith('-')) {
54
- out[key] = next;
55
- i += 1;
56
- }
57
- else {
58
- out[key] = true;
59
- }
60
- continue;
61
- }
62
- out._.push(a);
63
- }
64
- return out;
7
+ export function registerRefactorCommands(parent) {
8
+ parent
9
+ .command('rename', 'cli.cmd.refactor.rename')
10
+ .option('--kind <kind>', 'cli.opt.refactor.kind')
11
+ .option('--from <id>', 'cli.opt.refactor.from')
12
+ .option('--to <id>', 'cli.opt.refactor.to')
13
+ .option('--scope <chunk>', 'cli.opt.refactor.scope')
14
+ .option('--out-dir, -o <dir>', 'cli.opt.out-dir')
15
+ .option('--json [file]', 'cli.opt.json')
16
+ .option('--apply', 'cli.opt.apply')
17
+ .option('--explain', 'cli.opt.explain')
18
+ .action((options) => cmdRename(options));
65
19
  }
66
- /**
67
- * @param {string[]} argv
68
- */
69
- function cmdRename(argv) {
70
- const args = parseRefactorArgs(argv);
20
+ function cmdRename(args) {
71
21
  const kind = typeof args.kind === 'string' ? args.kind : '';
72
22
  const from = typeof args.from === 'string' ? args.from : '';
73
23
  const to = typeof args.to === 'string' ? args.to : '';
@@ -76,8 +26,7 @@ function cmdRename(argv) {
76
26
  const wantApply = args.apply === true;
77
27
  const wantExplain = args.explain === true;
78
28
  if (!kind || !from || !to) {
79
- log.error('rename requires --kind, --from, and --to');
80
- printRefactorHelp();
29
+ log.errorId('cli.err.refactor_rename_usage');
81
30
  return 1;
82
31
  }
83
32
  const pathArg = args._[0] ?? '.';
@@ -141,9 +90,7 @@ function cmdRename(argv) {
141
90
  for (const e of plan.edits || []) {
142
91
  console.log(` edit ${e.path} @${e.start}..${e.end} → ${JSON.stringify(e.newText)}`);
143
92
  }
144
- for (const d of plan.diagnostics || []) {
145
- console.log(` ${d.severity || 'info'}: ${d.message}`);
146
- }
93
+ log.diagnostics(plan.diagnostics || []);
147
94
  if ((plan.edits || []).length === 0) {
148
95
  console.log(' edits: (none)');
149
96
  }
@@ -1,8 +1,9 @@
1
1
  /**
2
- * `vmz artifact` — pack / publish / rollback / diff (A3 filesystem Delivery Profile).
2
+ * `vmz artifact` — pack / publish / rollback / diff; registered on `@vmz/commander`.
3
3
  */
4
- /**
5
- * @param {string[]} argv
6
- * @param {{ root?: string }} [ctx]
7
- */
8
- export declare function cmdArtifact(argv: any, ctx?: {}): 0 | 1;
4
+ import type { Command, ParsedOptions } from '@vmz/commander';
5
+ export type ArtifactSub = 'pack' | 'publish' | 'rollback' | 'current' | 'diff';
6
+ export declare function registerArtifactCommands(parent: Command): void;
7
+ export declare function runArtifact(sub: ArtifactSub, options: ParsedOptions, ctx?: {
8
+ root?: string;
9
+ }): number;
@@ -1,66 +1,24 @@
1
- // @ts-nocheck
2
1
  /**
3
- * `vmz artifact` — pack / publish / rollback / diff (A3 filesystem Delivery Profile).
2
+ * `vmz artifact` — pack / publish / rollback / diff; registered on `@vmz/commander`.
4
3
  */
5
4
  import path from 'node:path';
6
5
  import { log } from './log.js';
7
6
  import { diffArtifacts, loadReleaseEnvelope, packRelease, publishRelease, readPointer, rollbackRelease } from './release-pack.js';
8
- function usage() {
9
- console.log(`vmz artifact — filesystem release packaging (A3)
10
-
11
- Usage:
12
- vmz artifact pack [dist] Write dist/_vmz manifests + envelope
13
- vmz artifact publish [dist] Pack + publish under dist/releases (atomic CURRENT)
14
- vmz artifact rollback [releases] Restore PREVIOUS pointer (no rebuild)
15
- vmz artifact diff <aDigest> <bDigest> Structured file digest diff
16
- vmz artifact current [releases] Print CURRENT digest
17
-
18
- Options:
19
- --releases <dir> Releases root (default: <app>/dist/releases)
20
- --app-id <id> applicationId for envelope
21
- --json Machine-readable stdout
22
- `);
7
+ export function registerArtifactCommands(parent) {
8
+ const withOpts = (cmd) => cmd.option('--releases <dir>', 'cli.opt.releases').option('--app-id <id>', 'cli.opt.app-id').option('--json', 'cli.opt.json');
9
+ withOpts(parent.command('pack', 'cli.cmd.artifact.pack')).action((o) => runArtifact('pack', o));
10
+ withOpts(parent.command('publish', 'cli.cmd.artifact.publish')).action((o) => runArtifact('publish', o));
11
+ withOpts(parent.command('rollback', 'cli.cmd.artifact.rollback')).action((o) => runArtifact('rollback', o));
12
+ withOpts(parent.command('current', 'cli.cmd.artifact.current')).action((o) => runArtifact('current', o));
13
+ withOpts(parent.command('diff', 'cli.cmd.artifact.diff')).action((o) => runArtifact('diff', o));
23
14
  }
24
- /**
25
- * @param {string[]} argv
26
- * @param {{ root?: string }} [ctx]
27
- */
28
- export function cmdArtifact(argv, ctx = {}) {
29
- const args = [...argv];
30
- if (!args.length || args[0] === 'help' || args[0] === '--help') {
31
- usage();
32
- return 0;
33
- }
34
- const sub = args.shift();
35
- /** @type {Record<string, string | boolean>} */
36
- const flags = {};
37
- /** @type {string[]} */
38
- const pos = [];
39
- for (let i = 0; i < args.length; i++) {
40
- const a = args[i];
41
- if (a === '--json') {
42
- flags.json = true;
43
- continue;
44
- }
45
- if (a === '--releases' || a === '--app-id') {
46
- flags[a.slice(2)] = args[++i];
47
- continue;
48
- }
49
- if (a.startsWith('--')) {
50
- const eq = a.indexOf('=');
51
- if (eq !== -1)
52
- flags[a.slice(2, eq)] = a.slice(eq + 1);
53
- else
54
- flags[a.slice(2)] = true;
55
- continue;
56
- }
57
- pos.push(a);
58
- }
15
+ export function runArtifact(sub, options, ctx = {}) {
59
16
  const cwd = path.resolve(ctx.root || process.cwd());
17
+ const pos = options._ || [];
60
18
  const dist = path.resolve(cwd, pos[0] || 'dist');
61
- const releases = path.resolve(typeof flags.releases === 'string' ? flags.releases : path.join(cwd, 'dist', 'releases'));
62
- const appId = typeof flags['app-id'] === 'string' ? flags['app-id'] : undefined;
63
- const asJson = Boolean(flags.json);
19
+ const releases = path.resolve(typeof options.releases === 'string' ? options.releases : path.join(cwd, 'dist', 'releases'));
20
+ const appId = typeof options['app-id'] === 'string' ? options['app-id'] : undefined;
21
+ const asJson = Boolean(options.json);
64
22
  try {
65
23
  if (sub === 'pack') {
66
24
  const envelope = packRelease(dist, { applicationId: appId });
@@ -102,7 +60,7 @@ export function cmdArtifact(argv, ctx = {}) {
102
60
  const aDig = pos[0];
103
61
  const bDig = pos[1];
104
62
  if (!aDig || !bDig) {
105
- log.error('artifact diff requires <aDigest> <bDigest>');
63
+ log.errorId('cli.err.artifact_diff_usage');
106
64
  return 1;
107
65
  }
108
66
  const a = loadReleaseEnvelope(releases, aDig);
@@ -115,12 +73,12 @@ export function cmdArtifact(argv, ctx = {}) {
115
73
  }
116
74
  return 0;
117
75
  }
118
- log.error(`unknown artifact subcommand: ${sub}`);
119
- usage();
76
+ log.errorId('commander.err.unknown_command', { cmd: `artifact ${sub}` });
120
77
  return 1;
121
78
  }
122
79
  catch (e) {
123
- log.error(String(e && e.message ? e.message : e));
80
+ const err = e;
81
+ log.error(String(err && err.message ? err.message : e));
124
82
  return 1;
125
83
  }
126
84
  }
@@ -27,12 +27,15 @@ export declare function canonicalJson(value: any): string;
27
27
  * @param {string} distDir
28
28
  * @param {{ applicationId?: string }} [opts]
29
29
  */
30
- export declare function packRelease(distDir: any, opts?: {}): {
30
+ interface PackReleaseOpts {
31
+ applicationId?: string;
32
+ }
33
+ export declare function packRelease(distDir: string, opts?: PackReleaseOpts): {
31
34
  artifactDigest: string;
32
35
  schema: string;
33
- applicationId: any;
36
+ applicationId: string;
34
37
  deliveryProfile: string;
35
- applicationIntegrity: any;
38
+ applicationIntegrity: string;
36
39
  deploymentDigest: any;
37
40
  programDigest: string;
38
41
  styleDigest: any;
@@ -94,3 +97,4 @@ export declare function diffArtifacts(a: any, b: any): {
94
97
  * @param {string} digest
95
98
  */
96
99
  export declare function loadReleaseEnvelope(releasesRoot: any, digest: any): any;
100
+ export {};
@@ -5,7 +5,6 @@
5
5
  * `_vmz/*` manifests + content digests; publish retains previous release for rollback
6
6
  * without rebuild.
7
7
  */
8
- // @ts-nocheck
9
8
  import crypto from 'node:crypto';
10
9
  import fs from 'node:fs';
11
10
  import path from 'node:path';
@@ -90,11 +89,6 @@ function listContentFiles(distDir) {
90
89
  out.sort();
91
90
  return out;
92
91
  }
93
- /**
94
- * Pack `dist/` into `_vmz` manifests + release envelope (filesystem Delivery Profile).
95
- * @param {string} distDir
96
- * @param {{ applicationId?: string }} [opts]
97
- */
98
92
  export function packRelease(distDir, opts = {}) {
99
93
  const abs = path.resolve(distDir);
100
94
  if (!fs.existsSync(abs)) {