@plugmatica/plugin-build 0.0.0-stage → 0.1.0

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 (128) hide show
  1. package/LICENSE +21 -0
  2. package/LICENSE-APACHE +202 -0
  3. package/README.md +221 -2
  4. package/dev-target/README.md +20 -0
  5. package/dev-target/compose.yaml +119 -0
  6. package/dist/chunk-EOLUQEKQ.js +587 -0
  7. package/dist/chunk-QHTGR4ZB.js +9378 -0
  8. package/dist/chunk-TQNG5OZ3.js +3135 -0
  9. package/dist/cli.d.ts +1 -0
  10. package/dist/cli.js +2606 -0
  11. package/dist/index.d.ts +2144 -0
  12. package/dist/index.js +230 -0
  13. package/dist/vite-WRwB4IG8.d.ts +929 -0
  14. package/dist/vite.d.ts +3 -0
  15. package/dist/vite.js +20 -0
  16. package/package.json +94 -4
  17. package/templates/README.md +29 -0
  18. package/templates/backend-capabilities/LICENSE.txt +231 -0
  19. package/templates/backend-capabilities/backend/Cargo.toml +21 -0
  20. package/templates/backend-capabilities/backend/src/lib.rs +179 -0
  21. package/templates/backend-capabilities/backend/tests/basic.rs +174 -0
  22. package/templates/backend-capabilities/manifest.source.json +64 -0
  23. package/templates/backend-capabilities/package.json +22 -0
  24. package/templates/backend-composition/LICENSE.txt +231 -0
  25. package/templates/backend-composition/backend/Cargo.toml +21 -0
  26. package/templates/backend-composition/backend/src/lib.rs +96 -0
  27. package/templates/backend-composition/backend/tests/basic.rs +75 -0
  28. package/templates/backend-composition/manifest.source.json +26 -0
  29. package/templates/backend-composition/package.json +22 -0
  30. package/templates/backend-entities/LICENSE.txt +231 -0
  31. package/templates/backend-entities/backend/Cargo.toml +20 -0
  32. package/templates/backend-entities/backend/src/lib.rs +77 -0
  33. package/templates/backend-entities/backend/tests/basic.rs +26 -0
  34. package/templates/backend-entities/manifest.source.json +15 -0
  35. package/templates/backend-entities/package.json +22 -0
  36. package/templates/backend-minimal/LICENSE.txt +231 -0
  37. package/templates/backend-minimal/backend/Cargo.toml +21 -0
  38. package/templates/backend-minimal/backend/src/lib.rs +69 -0
  39. package/templates/backend-minimal/backend/tests/basic.rs +67 -0
  40. package/templates/backend-minimal/manifest.source.json +15 -0
  41. package/templates/backend-minimal/package.json +22 -0
  42. package/templates/backend-operations/LICENSE.txt +231 -0
  43. package/templates/backend-operations/backend/Cargo.toml +21 -0
  44. package/templates/backend-operations/backend/src/lib.rs +117 -0
  45. package/templates/backend-operations/backend/tests/basic.rs +169 -0
  46. package/templates/backend-operations/manifest.source.json +15 -0
  47. package/templates/backend-operations/package.json +22 -0
  48. package/templates/frontend-entity/LICENSE.txt +27 -0
  49. package/templates/frontend-entity/README.md +46 -0
  50. package/templates/frontend-entity/frontend/i18n/en-GB.json +5 -0
  51. package/templates/frontend-entity/frontend/package.json +32 -0
  52. package/templates/frontend-entity/frontend/src/CustomerListPage.tsx +98 -0
  53. package/templates/frontend-entity/frontend/src/model.ts +5 -0
  54. package/templates/frontend-entity/frontend/tests/entityLifecycle.test.tsx +79 -0
  55. package/templates/frontend-entity/frontend/tsconfig.json +4 -0
  56. package/templates/frontend-entity/frontend/vite.config.ts +3 -0
  57. package/templates/frontend-entity/frontend/vitest.config.ts +9 -0
  58. package/templates/frontend-entity/manifest.source.json +53 -0
  59. package/templates/frontend-entity/package.json +22 -0
  60. package/templates/frontend-entity/pnpm-workspace.yaml +2 -0
  61. package/templates/frontend-extension/LICENSE.txt +27 -0
  62. package/templates/frontend-extension/README.md +7 -0
  63. package/templates/frontend-extension/frontend/i18n/en-GB.json +4 -0
  64. package/templates/frontend-extension/frontend/package.json +25 -0
  65. package/templates/frontend-extension/frontend/src/CustomerNotes.tsx +24 -0
  66. package/templates/frontend-extension/frontend/tsconfig.json +4 -0
  67. package/templates/frontend-extension/frontend/vite.config.ts +3 -0
  68. package/templates/frontend-extension/manifest.source.json +16 -0
  69. package/templates/frontend-extension/package.json +22 -0
  70. package/templates/frontend-extension/pnpm-workspace.yaml +2 -0
  71. package/templates/frontend-minimal/LICENSE.txt +27 -0
  72. package/templates/frontend-minimal/README.md +5 -0
  73. package/templates/frontend-minimal/frontend/i18n/en-GB.json +4 -0
  74. package/templates/frontend-minimal/frontend/package.json +25 -0
  75. package/templates/frontend-minimal/frontend/src/Page.tsx +16 -0
  76. package/templates/frontend-minimal/frontend/src/entry.ts +1 -0
  77. package/templates/frontend-minimal/frontend/tsconfig.json +4 -0
  78. package/templates/frontend-minimal/frontend/vite.config.ts +3 -0
  79. package/templates/frontend-minimal/manifest.source.json +51 -0
  80. package/templates/frontend-minimal/package.json +22 -0
  81. package/templates/frontend-minimal/pnpm-workspace.yaml +2 -0
  82. package/templates/frontend-provider-event/LICENSE.txt +27 -0
  83. package/templates/frontend-provider-event/README.md +7 -0
  84. package/templates/frontend-provider-event/frontend/i18n/en-GB.json +3 -0
  85. package/templates/frontend-provider-event/frontend/package.json +25 -0
  86. package/templates/frontend-provider-event/frontend/src/CustomerBadgeProvider.ts +24 -0
  87. package/templates/frontend-provider-event/frontend/src/CustomerSavedHandler.ts +22 -0
  88. package/templates/frontend-provider-event/frontend/tsconfig.json +4 -0
  89. package/templates/frontend-provider-event/frontend/vite.config.ts +3 -0
  90. package/templates/frontend-provider-event/manifest.source.json +16 -0
  91. package/templates/frontend-provider-event/package.json +22 -0
  92. package/templates/frontend-provider-event/pnpm-workspace.yaml +2 -0
  93. package/templates/full-stack-minimal/LICENSE.txt +231 -0
  94. package/templates/full-stack-minimal/README.md +49 -0
  95. package/templates/full-stack-minimal/backend/Cargo.toml +18 -0
  96. package/templates/full-stack-minimal/backend/src/lib.rs +49 -0
  97. package/templates/full-stack-minimal/backend/tests/basic.rs +49 -0
  98. package/templates/full-stack-minimal/frontend/i18n/en-GB.json +6 -0
  99. package/templates/full-stack-minimal/frontend/package.json +25 -0
  100. package/templates/full-stack-minimal/frontend/src/Page.tsx +29 -0
  101. package/templates/full-stack-minimal/frontend/src/entry.ts +1 -0
  102. package/templates/full-stack-minimal/frontend/tsconfig.json +4 -0
  103. package/templates/full-stack-minimal/frontend/vite.config.ts +3 -0
  104. package/templates/full-stack-minimal/manifest.source.json +55 -0
  105. package/templates/full-stack-minimal/package.json +24 -0
  106. package/templates/full-stack-minimal/pnpm-workspace.yaml +2 -0
  107. package/templates/full-stack-workflow-node/LICENSE.txt +231 -0
  108. package/templates/full-stack-workflow-node/README.md +111 -0
  109. package/templates/full-stack-workflow-node/backend/Cargo.toml +12 -0
  110. package/templates/full-stack-workflow-node/backend/src/lib.rs +70 -0
  111. package/templates/full-stack-workflow-node/frontend/i18n/en-GB.json +10 -0
  112. package/templates/full-stack-workflow-node/frontend/package.json +29 -0
  113. package/templates/full-stack-workflow-node/frontend/src/editors/FormatLabelEditor.tsx +25 -0
  114. package/templates/full-stack-workflow-node/frontend/src/entry.ts +2 -0
  115. package/templates/full-stack-workflow-node/frontend/src/nodes/FormatLabel.tsx +18 -0
  116. package/templates/full-stack-workflow-node/frontend/src/presentations/FormatLabelPresentation.tsx +7 -0
  117. package/templates/full-stack-workflow-node/frontend/tsconfig.json +4 -0
  118. package/templates/full-stack-workflow-node/frontend/vite.config.ts +5 -0
  119. package/templates/full-stack-workflow-node/manifest.source.json +18 -0
  120. package/templates/full-stack-workflow-node/package.json +25 -0
  121. package/templates/full-stack-workflow-node/pnpm-workspace.yaml +2 -0
  122. package/templates/localization-fr-fr/LICENSE.txt +27 -0
  123. package/templates/localization-fr-fr/README.md +5 -0
  124. package/templates/localization-fr-fr/localization/plugmatica.customer.fr-FR.json +4 -0
  125. package/templates/localization-fr-fr/manifest.source.json +36 -0
  126. package/templates/localization-fr-fr/package.json +18 -0
  127. package/templates/starter-projection.json +448 -0
  128. package/tsconfig.plugin.json +14 -0
@@ -0,0 +1,2144 @@
1
+ import { CurrentExtensionContract, PluginExtensionContribution, PluginExtensionSurface, ExtensionDevtoolsArtifact } from '@plugmatica/core-sdk';
2
+ export { PLUGIN_MANIFEST_VERSION, PLUGIN_PROTOCOL_VERSION } from '@plugmatica/core-sdk';
3
+ import { P as PluginCompilerResult, C as CompilerFileResult, a as PluginManifestLike, b as PluginContractGraph, E as EcosystemPluginManifest, c as ExtensionGraphValidation } from './vite-WRwB4IG8.js';
4
+ export { d as CompiledContributionMetadata, e as CompiledExtensionNode, f as CompiledSdkDefinition, g as CompiledWorkflowNode, h as CompilerRuntimeMetadata, i as CompilerSdkHelper, j as CompilerSemanticKind, k as CompilerSourceMetadata, l as ExtensionGraphIssue, G as GenerateExtensionTargetsOptions, m as GeneratePluginDocumentationOptions, n as GeneratePluginManifestOptions, o as GeneratePluginManifestResult, p as GeneratedExtensionTargetArtifacts, q as GeneratedPluginContractGraphArtifacts, r as GeneratedPluginDocumentationArtifacts, s as PLUGMATICA_FEDERATION_DEDUPE, t as PLUGMATICA_FEDERATION_SHARED_VERSIONS, u as PLUGMATICA_FRONTEND_POLICY, v as PluginContractGraphEdge, w as PluginContractGraphEdgeKind, x as PluginContractGraphNode, y as PluginContractGraphNodeKind, z as PluginManifestGenerationError, A as PlugmaticaFederationPolicyOptions, B as PlugmaticaFederationSharedConfig, D as PlugmaticaFederationSharedEntry, F as PlugmaticaFederationSharedPackage, H as PlugmaticaFrontendPolicy, I as PlugmaticaManifestPluginOptions, J as PlugmaticaPluginConfigOptions, S as ScanIssue, K as compilerPageRoutesFromManifest, L as createExtensionTargetReference, M as definePlugmaticaPluginConfig, N as extensionNamespaceName, O as formatScanIssues, Q as generateExtensionTargets, R as generatePluginContractGraphArtifacts, T as generatePluginDocumentation, U as generatePluginManifest, V as plugmaticaFederationDedupe, W as plugmaticaFederationShared, X as plugmaticaManifestPlugin, Y as renderStandardSurfaceReference, Z as targetAccessPath } from './vite-WRwB4IG8.js';
5
+ import { MessageDictionary } from '@plugmatica/i18n/core';
6
+ import 'vite';
7
+
8
+ /**
9
+ * Current durable repository contract-baseline file format version.
10
+ */
11
+ declare const CONTRACT_BASELINE_FORMAT_VERSION: 1;
12
+ /**
13
+ * Supported source kinds from which a compatibility baseline can be resolved.
14
+ */
15
+ type ContractBaselineKind = "explicit" | "repository" | "git" | "registry" | "installed";
16
+ /**
17
+ * Compatibility-resolution mode controlling development fallback versus authoritative publish behavior.
18
+ */
19
+ type ContractBaselineMode = "development" | "publish";
20
+ /**
21
+ * Source-oriented reference to an extension contract item used in compatibility diagnostics.
22
+ */
23
+ type ContractDiagnosticReference = {
24
+ /**
25
+ * Stable discriminator describing the record/provider kind.
26
+ */
27
+ kind: "surface" | "event" | "provider";
28
+ /**
29
+ * Extension-contract key associated with the diagnostic or change.
30
+ */
31
+ key: string;
32
+ /**
33
+ * Extension surface associated with the record when applicable.
34
+ */
35
+ surface?: string;
36
+ /**
37
+ * Source metadata for diagnostics or compiler output.
38
+ */
39
+ source?: {
40
+ file?: string;
41
+ component?: string;
42
+ semanticSourceName?: string;
43
+ };
44
+ };
45
+ /**
46
+ * Durable, source-control friendly baseline payload. Provider provenance is
47
+ * deliberately not stored here because it is environmental comparison input,
48
+ * not part of the accepted public contract itself.
49
+ */
50
+ type ContractBaselineFile = {
51
+ /**
52
+ * Durable format version for the serialized artifact.
53
+ */
54
+ formatVersion: typeof CONTRACT_BASELINE_FORMAT_VERSION;
55
+ /**
56
+ * Plugin identifier.
57
+ */
58
+ pluginId: string;
59
+ /**
60
+ * Plugin version when available.
61
+ */
62
+ pluginVersion?: string;
63
+ /**
64
+ * Normalized current extension contract.
65
+ */
66
+ contract: CurrentExtensionContract;
67
+ /**
68
+ * Source-oriented contract diagnostics.
69
+ */
70
+ diagnostics?: readonly ContractDiagnosticReference[];
71
+ };
72
+ /**
73
+ * Describes where a resolved compatibility baseline came from.
74
+ */
75
+ type ContractBaselineProvenance = {
76
+ /**
77
+ * Stable discriminator describing the record/provider kind.
78
+ */
79
+ kind: ContractBaselineKind;
80
+ /**
81
+ * Human-readable description.
82
+ */
83
+ description: string;
84
+ /**
85
+ * Provider-specific source reference, such as a file path, Git object, installed manifest, or registry URL.
86
+ */
87
+ reference?: string;
88
+ /**
89
+ * Plugin version when available.
90
+ */
91
+ pluginVersion?: string;
92
+ /**
93
+ * Publication timestamp when supplied by the baseline source.
94
+ */
95
+ publishedAt?: string;
96
+ /**
97
+ * Installation timestamp when supplied by an installed manifest.
98
+ */
99
+ installedAt?: string;
100
+ /**
101
+ * Registry name when a registry provider supplied the baseline.
102
+ */
103
+ registry?: string;
104
+ /**
105
+ * Registry cache state used for the resolved baseline.
106
+ */
107
+ cache?: "fresh" | "stale-fallback" | "offline";
108
+ };
109
+ /**
110
+ * Resolved extension contract baseline plus its source provenance.
111
+ */
112
+ type ContractBaseline = {
113
+ /**
114
+ * Plugin identifier.
115
+ */
116
+ pluginId: string;
117
+ /**
118
+ * Plugin version when available.
119
+ */
120
+ pluginVersion?: string;
121
+ /**
122
+ * Publication timestamp when supplied by the baseline source.
123
+ */
124
+ publishedAt?: string;
125
+ /**
126
+ * Installation timestamp when supplied by an installed manifest.
127
+ */
128
+ installedAt?: string;
129
+ /**
130
+ * Normalized current extension contract.
131
+ */
132
+ contract: CurrentExtensionContract;
133
+ /**
134
+ * Source-oriented contract diagnostics.
135
+ */
136
+ diagnostics?: readonly ContractDiagnosticReference[];
137
+ /**
138
+ * Metadata describing the baseline source.
139
+ */
140
+ provenance: ContractBaselineProvenance;
141
+ };
142
+ /**
143
+ * Plugin/project context supplied to compatibility baseline providers.
144
+ */
145
+ type ContractBaselineContext = {
146
+ /**
147
+ * Plugin identifier.
148
+ */
149
+ pluginId: string;
150
+ /**
151
+ * Plugin version when available.
152
+ */
153
+ pluginVersion?: string;
154
+ /**
155
+ * Plugin project root directory.
156
+ */
157
+ projectRoot: string;
158
+ /**
159
+ * Plugin source manifest path when available.
160
+ */
161
+ manifestPath?: string;
162
+ /**
163
+ * Compatibility resolution mode.
164
+ */
165
+ mode: ContractBaselineMode;
166
+ /**
167
+ * Whether network-backed baseline resolution is disabled.
168
+ */
169
+ offline?: boolean;
170
+ };
171
+ /**
172
+ * Contract implemented by compatibility baseline sources.
173
+ */
174
+ interface ContractBaselineProvider {
175
+ /**
176
+ * Stable discriminator describing the record/provider kind.
177
+ */
178
+ readonly kind: ContractBaselineKind;
179
+ /**
180
+ * Resolve a compatibility baseline for the supplied plugin context.
181
+ *
182
+ * @param context - Plugin/project compatibility context.
183
+ * @returns Resolved baseline, or null when this provider has no applicable baseline.
184
+ */
185
+ resolve(context: ContractBaselineContext): Promise<ContractBaseline | null>;
186
+ }
187
+ /**
188
+ * Records one provider attempt made while resolving a compatibility baseline.
189
+ */
190
+ type BaselineResolutionAttempt = {
191
+ /**
192
+ * Stable discriminator describing the record/provider kind.
193
+ */
194
+ kind: ContractBaselineKind;
195
+ /**
196
+ * High-level status.
197
+ */
198
+ status: "selected" | "not-found" | "unavailable" | "skipped";
199
+ /**
200
+ * Author-facing diagnostic message.
201
+ */
202
+ message: string;
203
+ };
204
+ /**
205
+ * Result of resolving a compatibility baseline, including the attempted providers.
206
+ */
207
+ type ContractBaselineResolution = {
208
+ /**
209
+ * Selected compatibility baseline, or null when no prior baseline exists.
210
+ */
211
+ baseline: ContractBaseline | null;
212
+ /**
213
+ * Ordered provider attempts made during baseline resolution.
214
+ */
215
+ attempts: readonly BaselineResolutionAttempt[];
216
+ /**
217
+ * Compatibility resolution mode.
218
+ */
219
+ mode: ContractBaselineMode;
220
+ };
221
+ /**
222
+ * Kinds of extension-contract elements compared for compatibility.
223
+ */
224
+ type ContractElementKind = "surface" | "event" | "provider";
225
+ /**
226
+ * Compatibility change to one extension point exposed by a surface contract.
227
+ */
228
+ type ContractPointChange = {
229
+ /**
230
+ * Extension-contract key associated with the diagnostic or change.
231
+ */
232
+ key: string;
233
+ /**
234
+ * Kind of compatibility change.
235
+ */
236
+ change: "added" | "removed" | "changed";
237
+ /**
238
+ * Whether the change is compatibility-breaking.
239
+ */
240
+ breaking: boolean;
241
+ /**
242
+ * Previous multiplicity when relevant.
243
+ */
244
+ beforeMultiple?: boolean;
245
+ /**
246
+ * Current multiplicity when relevant.
247
+ */
248
+ afterMultiple?: boolean;
249
+ };
250
+ /**
251
+ * Compatibility change to one operation exposed by an extension contract.
252
+ */
253
+ type ContractOperationChange = {
254
+ /**
255
+ * Extension-contract key associated with the diagnostic or change.
256
+ */
257
+ key: string;
258
+ /**
259
+ * Kind of compatibility change.
260
+ */
261
+ change: "added" | "removed";
262
+ /**
263
+ * Whether the change is compatibility-breaking.
264
+ */
265
+ breaking: boolean;
266
+ };
267
+ /**
268
+ * Normalized compatibility change for one surface, event, or provider contract element.
269
+ */
270
+ type ContractChange = {
271
+ /**
272
+ * Stable discriminator describing the record/provider kind.
273
+ */
274
+ kind: ContractElementKind;
275
+ /**
276
+ * Stable contract identity used for comparison.
277
+ */
278
+ identity: string;
279
+ /**
280
+ * Extension-contract key associated with the diagnostic or change.
281
+ */
282
+ key: string;
283
+ /**
284
+ * Extension surface associated with the record when applicable.
285
+ */
286
+ surface?: string;
287
+ /**
288
+ * Kind of compatibility change.
289
+ */
290
+ change: "added" | "removed" | "changed" | "preserved";
291
+ /**
292
+ * Whether the change is compatibility-breaking.
293
+ */
294
+ breaking: boolean;
295
+ /**
296
+ * Reasons the comparison classified this change.
297
+ */
298
+ reasons: readonly string[];
299
+ /**
300
+ * Nested extension-point changes.
301
+ */
302
+ pointChanges?: readonly ContractPointChange[];
303
+ /**
304
+ * Nested operation changes.
305
+ */
306
+ operationChanges?: readonly ContractOperationChange[];
307
+ /** Source hints from the accepted baseline and current compiler snapshot. */
308
+ source?: {
309
+ baseline?: ContractDiagnosticReference["source"];
310
+ current?: ContractDiagnosticReference["source"];
311
+ };
312
+ };
313
+ /**
314
+ * Heuristic pairing of removed/added contract elements that likely represent a rename.
315
+ */
316
+ type LikelyContractRename = {
317
+ /**
318
+ * Stable discriminator describing the record/provider kind.
319
+ */
320
+ kind: ContractElementKind;
321
+ /**
322
+ * Extension surface associated with the record when applicable.
323
+ */
324
+ surface?: string;
325
+ /**
326
+ * Removed/previous contract identity in the likely rename pair.
327
+ */
328
+ from: string;
329
+ /**
330
+ * Added/current contract identity in the likely rename pair.
331
+ */
332
+ to: string;
333
+ /**
334
+ * Heuristic confidence assigned to the likely rename.
335
+ */
336
+ confidence: "high" | "medium";
337
+ /**
338
+ * Reason for a skip, rename inference, or compatibility classification.
339
+ */
340
+ reason: string;
341
+ /** Source hint for the removed baseline identity when available. */
342
+ fromSource?: ContractDiagnosticReference["source"];
343
+ /** Source hint for the added current identity when available. */
344
+ toSource?: ContractDiagnosticReference["source"];
345
+ };
346
+ /**
347
+ * High-level compatibility outcome for a current contract versus its baseline.
348
+ */
349
+ type CompatibilityStatus = "no-baseline" | "compatible" | "breaking";
350
+ /**
351
+ * Complete compatibility comparison report for one plugin version.
352
+ */
353
+ type CompatibilityReport = {
354
+ /**
355
+ * Plugin identifier.
356
+ */
357
+ pluginId: string;
358
+ /**
359
+ * Current plugin version being compared.
360
+ */
361
+ currentPluginVersion?: string;
362
+ /**
363
+ * High-level status.
364
+ */
365
+ status: CompatibilityStatus;
366
+ /**
367
+ * Whether the change is compatibility-breaking.
368
+ */
369
+ breaking: boolean;
370
+ /**
371
+ * Selected compatibility baseline, or null when no prior baseline exists.
372
+ */
373
+ baseline: ContractBaselineProvenance | null;
374
+ /**
375
+ * Detailed baseline resolution result.
376
+ */
377
+ baselineResolution?: ContractBaselineResolution;
378
+ /**
379
+ * Added contract elements or count, depending on the containing record.
380
+ */
381
+ added: readonly ContractChange[];
382
+ /**
383
+ * Removed contract elements or count, depending on the containing record.
384
+ */
385
+ removed: readonly ContractChange[];
386
+ /**
387
+ * Changed contract elements or count, depending on the containing record.
388
+ */
389
+ changed: readonly ContractChange[];
390
+ /**
391
+ * Preserved contract elements or count, depending on the containing record.
392
+ */
393
+ preserved: readonly ContractChange[];
394
+ /**
395
+ * Likely rename pairs inferred from removed/added elements.
396
+ */
397
+ likelyRenames: readonly LikelyContractRename[];
398
+ /**
399
+ * Aggregated counts or inspection summary.
400
+ */
401
+ summary: {
402
+ added: number;
403
+ removed: number;
404
+ changed: number;
405
+ preserved: number;
406
+ breaking: number;
407
+ };
408
+ };
409
+
410
+ /** Manifest page identity supplied to the compiler for one frontend expose/module. */
411
+ type PluginCompilerPageRoute = {
412
+ /** Stable page key from the source manifest. */
413
+ key: string;
414
+ /** Frontend expose/module name associated with the page. */
415
+ module: string;
416
+ };
417
+ /** Optional manifest context used while compiling semantic plugin source. */
418
+ type CompilePluginSourceOptions = {
419
+ /** Page routes used as deterministic identity input for page modules. */
420
+ pageRoutes?: readonly PluginCompilerPageRoute[];
421
+ };
422
+ /**
423
+ * Compiles all semantic Plugmatica TSX/JSX in a source tree into one deterministic intermediate representation.
424
+ * This function has no baseline/registry/installed-plugin inputs by design, so historical state cannot influence the Current Extension Contract.
425
+ *
426
+ * @param sourceDir - Root directory containing plugin frontend source files.
427
+ * @param options - Optional manifest page-route context used for deterministic page identity.
428
+ * @returns The complete semantic compiler result for the current source snapshot.
429
+ */
430
+ declare function compilePluginSource(sourceDir: string, options?: CompilePluginSourceOptions): PluginCompilerResult;
431
+
432
+ /**
433
+ * Applies runtime identities already resolved in compiler IR to one source file.
434
+ * The transform never derives a key: it only serialises compile results.
435
+ *
436
+ * `extension` is the public author escape hatch. Generated bundles instead
437
+ * carry the complete resolved compiler metadata through `__pmExtension`, so
438
+ * runtime and manifest identities are sourced from the same compile result.
439
+ *
440
+ * @param sourceText - Exact source text corresponding to the compiler file result.
441
+ * @param file - Compiler result containing resolved runtime metadata for that source file.
442
+ * @returns Transformed source with compiler-owned runtime metadata injected into semantic JSX nodes.
443
+ */
444
+ declare function transformCompiledSource(sourceText: string, file: CompilerFileResult): string;
445
+
446
+ type ExtensionFixChange = {
447
+ file: string;
448
+ removed: number;
449
+ };
450
+ type ExtensionFixResult = {
451
+ sourceDir: string;
452
+ dryRun: boolean;
453
+ candidates: number;
454
+ changedFiles: readonly ExtensionFixChange[];
455
+ };
456
+ /**
457
+ * Remove compiler-proven redundant `extension` props.
458
+ *
459
+ * Only diagnostics carrying a deterministic `remove-range` edit are applied.
460
+ * Intentional ABI overrides are never rewritten automatically.
461
+ */
462
+ declare function fixRedundantExtensionOverrides(options: {
463
+ sourceDir: string;
464
+ pageRoutes?: readonly PluginCompilerPageRoute[];
465
+ dryRun?: boolean;
466
+ }): ExtensionFixResult;
467
+ /** Format one deterministic author-facing summary for the redundant-extension fixer. */
468
+ declare function formatExtensionFixResult(result: ExtensionFixResult): string;
469
+
470
+ /**
471
+ * Normalized current plugin extension contract plus compiler diagnostics used for compatibility workflows.
472
+ */
473
+ type CurrentContractSnapshot = {
474
+ /**
475
+ * Plugin identifier.
476
+ */
477
+ pluginId: string;
478
+ /**
479
+ * Plugin version when available.
480
+ */
481
+ pluginVersion?: string;
482
+ /**
483
+ * Normalized current extension contract.
484
+ */
485
+ contract: CurrentExtensionContract;
486
+ /**
487
+ * Source-oriented contract diagnostics.
488
+ */
489
+ diagnostics: readonly ContractDiagnosticReference[];
490
+ /**
491
+ * Semantic compiler result used to derive the contract.
492
+ */
493
+ compilerResult: PluginCompilerResult;
494
+ };
495
+ /**
496
+ * Compile a plugin source tree and build its normalized current extension-contract snapshot.
497
+ *
498
+ * @param options - Options controlling the operation.
499
+ * @returns Current normalized contract snapshot and compiler result.
500
+ */
501
+ declare function buildCurrentContractSnapshot(options: {
502
+ sourceDir: string;
503
+ manifestPath: string;
504
+ compilerResult?: PluginCompilerResult;
505
+ }): CurrentContractSnapshot;
506
+ /**
507
+ * Create the durable repository baseline payload accepted by compatibility tooling.
508
+ *
509
+ * @param snapshot - Current contract snapshot to serialize as a baseline.
510
+ * @returns Durable repository baseline payload.
511
+ */
512
+ declare function createRepositoryBaselineFile(snapshot: Pick<CurrentContractSnapshot, "pluginId" | "pluginVersion" | "contract" | "diagnostics">): ContractBaselineFile;
513
+ /**
514
+ * Validate and normalize an unknown value into the current extension-contract shape.
515
+ *
516
+ * @param value - Unknown or string value to normalize or parse.
517
+ * @returns Normalized extension contract.
518
+ */
519
+ declare function normalizeCurrentExtensionContract(value: unknown): CurrentExtensionContract;
520
+ /**
521
+ * Validate and parse an unknown value as a repository contract baseline file.
522
+ *
523
+ * @param value - Unknown or string value to normalize or parse.
524
+ * @returns Validated baseline file payload.
525
+ */
526
+ declare function parseContractBaselineFile(value: unknown): ContractBaselineFile;
527
+ /**
528
+ * Read and parse a repository contract baseline JSON file.
529
+ *
530
+ * @param file - Path to the JSON file.
531
+ * @returns Parsed baseline file payload.
532
+ */
533
+ declare function readContractBaselineFile(file: string): ContractBaselineFile;
534
+ /**
535
+ * Write a repository contract baseline file using deterministic formatted JSON.
536
+ *
537
+ * @param file - Path to the JSON file.
538
+ * @param baseline - Baseline payload to write.
539
+ */
540
+ declare function writeContractBaselineFile(file: string, baseline: ContractBaselineFile): void;
541
+ /**
542
+ * Extract extension-contract and provenance metadata from a generated or installed manifest payload.
543
+ *
544
+ * @param value - Unknown or string value to normalize or parse.
545
+ * @returns Extracted plugin identity/version timestamps, contract, and optional diagnostics.
546
+ */
547
+ declare function contractFromManifestPayload(value: unknown): {
548
+ pluginId?: string;
549
+ pluginVersion?: string;
550
+ publishedAt?: string;
551
+ installedAt?: string;
552
+ contract: CurrentExtensionContract;
553
+ diagnostics?: readonly ContractDiagnosticReference[];
554
+ };
555
+
556
+ /**
557
+ * Signals that an authoritative registry compatibility baseline could not be resolved.
558
+ */
559
+ declare class RegistryBaselineUnavailableError extends Error {
560
+ constructor(message: string, options?: ErrorOptions);
561
+ }
562
+ /**
563
+ * Resolves a compatibility baseline from one explicitly configured JSON file.
564
+ */
565
+ declare class ExplicitContractBaselineProvider implements ContractBaselineProvider {
566
+ /**
567
+ * Stable discriminator describing the record/provider kind.
568
+ */
569
+ readonly kind: "explicit";
570
+ /**
571
+ * Source file path.
572
+ */
573
+ readonly file: string;
574
+ constructor(file: string);
575
+ /**
576
+ * Resolve a compatibility baseline for the supplied plugin context.
577
+ *
578
+ * @param context - Plugin/project compatibility context.
579
+ * @returns Resolved baseline, or null when this provider has no applicable baseline.
580
+ */
581
+ resolve(context: ContractBaselineContext): Promise<ContractBaseline | null>;
582
+ }
583
+ /**
584
+ * Resolves a compatibility baseline from the plugin repository working tree.
585
+ */
586
+ declare class RepositoryContractBaselineProvider implements ContractBaselineProvider {
587
+ /**
588
+ * Stable discriminator describing the record/provider kind.
589
+ */
590
+ readonly kind: "repository";
591
+ /**
592
+ * Repository baseline filename or path.
593
+ */
594
+ readonly fileName: string;
595
+ constructor(fileName?: string);
596
+ /**
597
+ * Resolve a compatibility baseline for the supplied plugin context.
598
+ *
599
+ * @param context - Plugin/project compatibility context.
600
+ * @returns Resolved baseline, or null when this provider has no applicable baseline.
601
+ */
602
+ resolve(context: ContractBaselineContext): Promise<ContractBaseline | null>;
603
+ }
604
+ /**
605
+ * Options for resolving a compatibility baseline from a Git tag.
606
+ */
607
+ type GitTagContractBaselineProviderOptions = {
608
+ /**
609
+ * Git tag containing the baseline.
610
+ */
611
+ tag: string;
612
+ /** Repository-relative baseline path, or a project-root-relative path when projectRoot is nested. */
613
+ baselinePath?: string;
614
+ /**
615
+ * Git executable to invoke; defaults to git.
616
+ */
617
+ git?: string;
618
+ };
619
+ /**
620
+ * Optional historical convenience provider. It reads a durable Contract
621
+ * Baseline from a Git object without checking out the tag and never
622
+ * participates in Current Extension Contract generation. Missing Git, shallow
623
+ * clones and absent tags resolve to null so normal development remains usable.
624
+ */
625
+ declare class GitTagContractBaselineProvider implements ContractBaselineProvider {
626
+ /**
627
+ * Stable discriminator describing the record/provider kind.
628
+ */
629
+ readonly kind: "git";
630
+ /**
631
+ * Git-tag baseline resolution options.
632
+ */
633
+ readonly options: GitTagContractBaselineProviderOptions;
634
+ constructor(options: GitTagContractBaselineProviderOptions);
635
+ /**
636
+ * Resolve a compatibility baseline for the supplied plugin context.
637
+ *
638
+ * @param context - Plugin/project compatibility context.
639
+ * @returns Resolved baseline, or null when this provider has no applicable baseline.
640
+ */
641
+ resolve(context: ContractBaselineContext): Promise<ContractBaseline | null>;
642
+ }
643
+ /**
644
+ * Resolves a compatibility baseline from one of the installed plugin manifest candidates.
645
+ */
646
+ declare class InstalledPluginContractBaselineProvider implements ContractBaselineProvider {
647
+ /**
648
+ * Stable discriminator describing the record/provider kind.
649
+ */
650
+ readonly kind: "installed";
651
+ /**
652
+ * Installed plugin manifest/package candidates searched in order.
653
+ */
654
+ readonly candidates: readonly string[];
655
+ constructor(candidates: string | readonly string[]);
656
+ /**
657
+ * Resolve a compatibility baseline for the supplied plugin context.
658
+ *
659
+ * @param context - Plugin/project compatibility context.
660
+ * @returns Resolved baseline, or null when this provider has no applicable baseline.
661
+ */
662
+ resolve(context: ContractBaselineContext): Promise<ContractBaseline | null>;
663
+ }
664
+ /**
665
+ * Options for registry-backed compatibility baseline resolution.
666
+ */
667
+ type RegistryContractBaselineProviderOptions = {
668
+ /** URL or URL template. `{pluginId}` and `{version}` are URL-encoded. */
669
+ endpoint: string | ((context: ContractBaselineContext) => string);
670
+ /**
671
+ * Directory used for registry response caching.
672
+ */
673
+ cacheDir?: string;
674
+ /**
675
+ * Fresh-cache lifetime in milliseconds.
676
+ */
677
+ cacheTtlMs?: number;
678
+ /**
679
+ * Fetch implementation used for registry HTTP requests.
680
+ *
681
+ * @param input - Input used to create an extension target reference.
682
+ * @param init - Optional fetch request initialization.
683
+ * @returns Fetch response promise.
684
+ */
685
+ fetch?: typeof globalThis.fetch;
686
+ /**
687
+ * Additional HTTP headers sent to the registry.
688
+ */
689
+ headers?: Record<string, string>;
690
+ /**
691
+ * Human-readable destination registry name.
692
+ */
693
+ registryName?: string;
694
+ /** Bound registry latency so development can continue with installed/no baseline. */
695
+ timeoutMs?: number;
696
+ };
697
+ /**
698
+ * Resolves the authoritative published compatibility baseline from a destination registry with bounded caching.
699
+ */
700
+ declare class RegistryContractBaselineProvider implements ContractBaselineProvider {
701
+ /**
702
+ * Stable discriminator describing the record/provider kind.
703
+ */
704
+ readonly kind: "registry";
705
+ /**
706
+ * Registry baseline resolution, cache, and timeout options.
707
+ */
708
+ readonly options: RegistryContractBaselineProviderOptions;
709
+ constructor(options: RegistryContractBaselineProviderOptions);
710
+ /**
711
+ * Resolve a compatibility baseline for the supplied plugin context.
712
+ *
713
+ * @param context - Plugin/project compatibility context.
714
+ * @returns Resolved baseline, or null when this provider has no applicable baseline.
715
+ */
716
+ resolve(context: ContractBaselineContext): Promise<ContractBaseline | null>;
717
+ }
718
+ /**
719
+ * Resolve the effective compatibility baseline using the configured providers and development/publish policy.
720
+ *
721
+ * @param options - Options controlling the operation.
722
+ * @returns Selected baseline and provider-attempt history.
723
+ */
724
+ declare function resolveContractBaseline(options: {
725
+ context: ContractBaselineContext;
726
+ providers: readonly ContractBaselineProvider[];
727
+ }): Promise<ContractBaselineResolution>;
728
+
729
+ /**
730
+ * Compare a current extension contract with a resolved baseline and classify compatibility changes.
731
+ *
732
+ * @param options - Options controlling the operation.
733
+ * @returns Compatibility report describing added, removed, changed, preserved, and breaking contract elements.
734
+ */
735
+ declare function compareExtensionContracts(options: {
736
+ pluginId: string;
737
+ currentPluginVersion?: string;
738
+ current: CurrentExtensionContract;
739
+ baseline: ContractBaseline | null;
740
+ baselineResolution?: ContractBaselineResolution;
741
+ currentDiagnostics?: readonly ContractDiagnosticReference[];
742
+ }): CompatibilityReport;
743
+
744
+ /**
745
+ * Format a compatibility report into deterministic author-facing text.
746
+ *
747
+ * @param report - Compatibility report to format or enforce.
748
+ * @returns Formatted compatibility report text.
749
+ */
750
+ declare function formatCompatibilityReport(report: CompatibilityReport): string;
751
+ /**
752
+ * Error raised when strict compatibility enforcement encounters a breaking extension-contract report.
753
+ */
754
+ declare class BreakingExtensionContractError extends Error {
755
+ /**
756
+ * Compatibility report for this release step.
757
+ */
758
+ readonly report: CompatibilityReport;
759
+ constructor(report: CompatibilityReport);
760
+ }
761
+ /**
762
+ * Throw when a compatibility report contains breaking changes.
763
+ *
764
+ * @param report - Compatibility report to format or enforce.
765
+ */
766
+ declare function enforceStrictCompatibility(report: CompatibilityReport): void;
767
+
768
+ /**
769
+ * Resolve the repository contract-baseline path for a plugin project.
770
+ *
771
+ * @param projectRoot - Plugin project root directory.
772
+ * @param configuredPath - Optional configured baseline path; relative paths are resolved from the project root.
773
+ * @returns Absolute baseline file path.
774
+ */
775
+ declare function repositoryBaselinePath(projectRoot: string, configuredPath?: string): string;
776
+ /**
777
+ * Create an initial repository compatibility baseline from the current plugin contract.
778
+ *
779
+ * @param options - Options controlling the operation.
780
+ * @returns Absolute path of the initialized baseline file.
781
+ */
782
+ declare function initRepositoryContractBaseline(options: {
783
+ sourceDir: string;
784
+ manifestPath: string;
785
+ projectRoot?: string;
786
+ baselinePath?: string;
787
+ }): {
788
+ path: string;
789
+ snapshot: ReturnType<typeof buildCurrentContractSnapshot>;
790
+ };
791
+ /**
792
+ * Replace the repository compatibility baseline with the current plugin contract.
793
+ *
794
+ * @param options - Options controlling the operation.
795
+ * @returns Absolute path of the updated baseline file.
796
+ */
797
+ declare function updateRepositoryContractBaseline(options: {
798
+ sourceDir: string;
799
+ manifestPath: string;
800
+ projectRoot?: string;
801
+ baselinePath?: string;
802
+ }): {
803
+ path: string;
804
+ snapshot: ReturnType<typeof buildCurrentContractSnapshot>;
805
+ };
806
+ /**
807
+ * Build the current contract, resolve a baseline, and produce the compatibility report.
808
+ *
809
+ * @param options - Options controlling the operation.
810
+ * @returns Compatibility report for the current plugin contract.
811
+ */
812
+ declare function checkContractCompatibility(options: {
813
+ sourceDir: string;
814
+ manifestPath: string;
815
+ projectRoot?: string;
816
+ providers?: readonly ContractBaselineProvider[];
817
+ mode?: ContractBaselineMode;
818
+ offline?: boolean;
819
+ }): Promise<{
820
+ report: CompatibilityReport;
821
+ resolution: ContractBaselineResolution;
822
+ snapshot: ReturnType<typeof buildCurrentContractSnapshot>;
823
+ }>;
824
+
825
+ /**
826
+ * Physical metadata columns owned by Plugmatica's relational managed-entity
827
+ * store. Plugin entity and augmentation fields must never normalize onto one
828
+ * of these names.
829
+ */
830
+ declare const RESERVED_MANAGED_ENTITY_COLUMNS: readonly ["scope_kind", "scope_key", "pid", "revision", "schema_version", "created_by", "updated_by"];
831
+ /**
832
+ * Describes one build-time backend descriptor validation issue.
833
+ */
834
+ type BackendDescriptorIssue = {
835
+ /**
836
+ * Stable diagnostic code.
837
+ */
838
+ code: "reserved_managed_entity_field";
839
+ /**
840
+ * Entity/descriptor location associated with the issue.
841
+ */
842
+ location: string;
843
+ /**
844
+ * Plugin field associated with the issue.
845
+ */
846
+ field: string;
847
+ /**
848
+ * One-based source column when available.
849
+ */
850
+ column: string;
851
+ /**
852
+ * Author-facing diagnostic message.
853
+ */
854
+ message: string;
855
+ };
856
+ /**
857
+ * Error thrown when a backend descriptor fails Plugmatica build-time validation.
858
+ */
859
+ declare class BackendDescriptorValidationError extends Error {
860
+ /**
861
+ * Validation or audit issues.
862
+ */
863
+ readonly issues: readonly BackendDescriptorIssue[];
864
+ constructor(issues: readonly BackendDescriptorIssue[]);
865
+ }
866
+ /**
867
+ * Validate the managed-storage-sensitive portion of a compiled backend
868
+ * descriptor. The Rust `plugin-describe` tool remains the authoritative
869
+ * backend descriptor gate; this validator lets JS build/publish pipelines fail
870
+ * before packaging when they already have descriptor.json available.
871
+ *
872
+ * @param descriptor - Backend descriptor value to validate.
873
+ * @returns Validation issues; empty when the descriptor is valid.
874
+ */
875
+ declare function validateBackendDescriptor(descriptor: unknown): BackendDescriptorIssue[];
876
+ /**
877
+ * Assert that a backend descriptor satisfies Plugmatica build-time validation rules.
878
+ *
879
+ * @param descriptor - Backend descriptor value to validate.
880
+ */
881
+ declare function assertValidBackendDescriptor(descriptor: unknown): void;
882
+ /**
883
+ * Read and validate a backend descriptor JSON file.
884
+ *
885
+ * @param descriptorPath - Path to the backend descriptor JSON file.
886
+ * @returns Validation issues read from the descriptor file; empty when valid.
887
+ */
888
+ declare function validateBackendDescriptorFile(descriptorPath: string): BackendDescriptorIssue[];
889
+ /**
890
+ * Assert that a backend descriptor JSON file satisfies Plugmatica build-time validation rules.
891
+ *
892
+ * @param descriptorPath - Path to the backend descriptor JSON file.
893
+ */
894
+ declare function assertValidBackendDescriptorFile(descriptorPath: string): void;
895
+ /**
896
+ * Normalize a field or entity name to the managed-storage identifier form used by the host.
897
+ *
898
+ * @param value - Unknown or string value to normalize or parse.
899
+ * @returns Normalized managed-storage identifier.
900
+ */
901
+ declare function managedStorageIdentifier(value: string): string;
902
+ /**
903
+ * Resolve whether a plugin field maps to a host-reserved managed-storage column.
904
+ *
905
+ * @param fieldName - Plugin field name to check.
906
+ * @returns Reserved host column name, or undefined when the field is allowed.
907
+ */
908
+ declare function reservedManagedColumnForField(fieldName: string): string | undefined;
909
+
910
+ /**
911
+ * Build the normalized graph of plugin extension contracts and ecosystem dependencies.
912
+ *
913
+ * @param options - Options controlling the operation.
914
+ * @returns Normalized plugin contract graph.
915
+ */
916
+ declare function buildPluginContractGraph(options: {
917
+ manifest: PluginManifestLike;
918
+ compilerResult?: PluginCompilerResult;
919
+ }): PluginContractGraph;
920
+ /**
921
+ * Render a plugin contract graph as Mermaid flowchart source.
922
+ *
923
+ * @param graph - Plugin contract graph to render.
924
+ * @returns Mermaid flowchart source.
925
+ */
926
+ declare function renderPluginContractGraphMermaid(graph: PluginContractGraph): string;
927
+
928
+ /**
929
+ * Validate cross-plugin extension dependencies, required targets, and version requirements.
930
+ *
931
+ * @param manifests - Plugin manifests participating in ecosystem dependency validation.
932
+ * @param options - Options controlling the operation.
933
+ * @returns Graph validation result containing all discovered issues.
934
+ */
935
+ declare function validateExtensionDependencyGraph(manifests: readonly EcosystemPluginManifest[], options?: {
936
+ partial?: boolean;
937
+ }): ExtensionGraphValidation;
938
+ /**
939
+ * Deliberately conservative semver check. `null` means the requirement uses a
940
+ * form this lightweight frontend graph inspector does not evaluate; runtime is
941
+ * still authoritative. False is returned only when incompatibility is clear.
942
+ *
943
+ * @param requirement - Supported plugin-version requirement expression.
944
+ * @param version - Plugin version to test against the requirement.
945
+ * @returns True when the version satisfies the requirement.
946
+ */
947
+ declare function versionRequirementAccepts(requirement: string, version?: string): boolean | null;
948
+
949
+ declare function synthesizeWorkflowEventTriggers(
950
+ pluginKey: string,
951
+ backendDescriptor: Record<string, unknown>,
952
+ ): Record<string, unknown>[];
953
+ declare function workflowActionContractFingerprint(
954
+ node: Record<string, unknown>,
955
+ ): string;
956
+ declare function workflowEventContractFingerprint(
957
+ event: Record<string, unknown>,
958
+ ): string;
959
+
960
+ /**
961
+ * Source location of an extracted or diagnosed frontend i18n message.
962
+ */
963
+ type I18nSourceLocation = {
964
+ /**
965
+ * Source file path.
966
+ */
967
+ file: string;
968
+ /**
969
+ * One-based source line when available.
970
+ */
971
+ line: number;
972
+ /**
973
+ * One-based source column when available.
974
+ */
975
+ column: number;
976
+ };
977
+ /**
978
+ * Message reference extracted from plugin frontend source.
979
+ */
980
+ type ExtractedMessage = {
981
+ /**
982
+ * Fully qualified i18n reference as it appeared in source.
983
+ */
984
+ reference: string;
985
+ /**
986
+ * Generated localization or extension namespace.
987
+ */
988
+ namespace: string;
989
+ /**
990
+ * Locale dictionary key after namespace resolution.
991
+ */
992
+ key: string;
993
+ /**
994
+ * Whether the message belongs to the plugin-local namespace.
995
+ */
996
+ local: boolean;
997
+ /**
998
+ * Source locations contributing this message/catalogue entry.
999
+ */
1000
+ sources: I18nSourceLocation[];
1001
+ };
1002
+ /**
1003
+ * Author-facing issue produced by plugin i18n scanning or validation.
1004
+ */
1005
+ type I18nScanIssue = {
1006
+ /**
1007
+ * Diagnostic severity.
1008
+ */
1009
+ severity: "error" | "warning";
1010
+ /**
1011
+ * Stable diagnostic code.
1012
+ */
1013
+ code: string;
1014
+ /**
1015
+ * Author-facing diagnostic message.
1016
+ */
1017
+ message: string;
1018
+ /**
1019
+ * Source file path.
1020
+ */
1021
+ file?: string;
1022
+ /**
1023
+ * One-based source line when available.
1024
+ */
1025
+ line?: number;
1026
+ /**
1027
+ * One-based source column when available.
1028
+ */
1029
+ column?: number;
1030
+ /** One-line source excerpt for actionable build diagnostics. */
1031
+ snippet?: string;
1032
+ /** Concrete remediation shown by the plugin-build CLI. */
1033
+ suggestion?: string;
1034
+ };
1035
+ /**
1036
+ * Messages and diagnostics produced by scanning plugin frontend source.
1037
+ */
1038
+ type I18nScanResult = {
1039
+ /**
1040
+ * Extracted or generated messages.
1041
+ */
1042
+ messages: ExtractedMessage[];
1043
+ /**
1044
+ * Validation or audit issues.
1045
+ */
1046
+ issues: I18nScanIssue[];
1047
+ };
1048
+ /**
1049
+ * Inputs controlling plugin i18n scanning, validation, and catalogue generation.
1050
+ */
1051
+ type PluginI18nBuildOptions = {
1052
+ /**
1053
+ * Plugin key.
1054
+ */
1055
+ pluginKey: string;
1056
+ /**
1057
+ * Plugin frontend source directory.
1058
+ */
1059
+ sourceDir: string;
1060
+ /**
1061
+ * Frontend workspace root.
1062
+ */
1063
+ frontendRoot: string;
1064
+ /**
1065
+ * Default locale for generated localization resources.
1066
+ */
1067
+ defaultLocale: string;
1068
+ /**
1069
+ * Directory containing plugin locale dictionaries.
1070
+ */
1071
+ localesDir?: string;
1072
+ /**
1073
+ * Output path for the generated default catalogue.
1074
+ */
1075
+ catalogOutput?: string;
1076
+ /**
1077
+ * Root containing shared localization catalogues.
1078
+ */
1079
+ sharedCatalogRoot: string;
1080
+ /**
1081
+ * Default locale used for shared catalogue validation.
1082
+ */
1083
+ sharedDefaultLocale?: string;
1084
+ /**
1085
+ * Shared namespaces/versions required by the plugin.
1086
+ */
1087
+ requiredNamespaces?: Array<{
1088
+ namespace: string;
1089
+ version: string;
1090
+ }>;
1091
+ /**
1092
+ * Whether raw user-facing strings fail generation.
1093
+ */
1094
+ failOnRawStrings?: boolean;
1095
+ /** Reuse the manifest-generation scan so raw-string issues are not duplicated. */
1096
+ scanResult?: I18nScanResult;
1097
+ };
1098
+ /**
1099
+ * Generated default-catalogue entry for one plugin-local message.
1100
+ */
1101
+ type GeneratedI18nCatalogEntry = {
1102
+ /**
1103
+ * Default message text.
1104
+ */
1105
+ defaultMessage: string;
1106
+ /**
1107
+ * ICU placeholder names required by the message.
1108
+ */
1109
+ placeholders: string[];
1110
+ /**
1111
+ * Source locations contributing this message/catalogue entry.
1112
+ */
1113
+ sources: I18nSourceLocation[];
1114
+ };
1115
+ /**
1116
+ * Generated plugin-local message catalogue and shared namespace references.
1117
+ */
1118
+ type GeneratedI18nCatalog = {
1119
+ /**
1120
+ * Generated localization or extension namespace.
1121
+ */
1122
+ namespace: string;
1123
+ /**
1124
+ * Default locale for generated localization resources.
1125
+ */
1126
+ defaultLocale: string;
1127
+ /**
1128
+ * Extracted or generated messages.
1129
+ */
1130
+ messages: Record<string, GeneratedI18nCatalogEntry>;
1131
+ /**
1132
+ * Shared namespace/key references used by the plugin.
1133
+ */
1134
+ sharedReferences: Record<string, string[]>;
1135
+ };
1136
+ /**
1137
+ * Generated manifest metadata describing plugin localization resources and requirements.
1138
+ */
1139
+ type GeneratedI18nManifest = {
1140
+ /**
1141
+ * Generated localization or extension namespace.
1142
+ */
1143
+ namespace: string;
1144
+ /**
1145
+ * Default locale for generated localization resources.
1146
+ */
1147
+ defaultLocale: string;
1148
+ /**
1149
+ * Generated catalogue path/reference.
1150
+ */
1151
+ catalog: string;
1152
+ /**
1153
+ * Checksum of generated catalogue content.
1154
+ */
1155
+ catalogChecksum: string;
1156
+ /**
1157
+ * Generated localization resource declarations.
1158
+ */
1159
+ resources: Array<{
1160
+ locale: string;
1161
+ path: string;
1162
+ checksum: string;
1163
+ }>;
1164
+ /**
1165
+ * Required shared localization namespace declarations.
1166
+ */
1167
+ requires: Array<{
1168
+ namespace: string;
1169
+ version: string;
1170
+ }>;
1171
+ };
1172
+
1173
+ type I18nAuditDuplicateGroup = {
1174
+ message: string;
1175
+ keys: string[];
1176
+ };
1177
+ type I18nAuditVariantGroup = {
1178
+ normalized: string;
1179
+ entries: Array<{
1180
+ key: string;
1181
+ message: string;
1182
+ }>;
1183
+ };
1184
+ type I18nAuditSharedCandidate = {
1185
+ localKey: string;
1186
+ sharedKey: string;
1187
+ message: string;
1188
+ };
1189
+ type PluginI18nAuditResult = {
1190
+ pluginKey: string;
1191
+ defaultLocale: string;
1192
+ catalogPath: string;
1193
+ stats: {
1194
+ catalogKeys: number;
1195
+ usedLocalKeys: number;
1196
+ usedSharedKeys: number;
1197
+ unusedKeys: number;
1198
+ exactDuplicateGroups: number;
1199
+ exactDuplicateExtraKeys: number;
1200
+ variantGroups: number;
1201
+ sharedCandidates: number;
1202
+ };
1203
+ unusedKeys: string[];
1204
+ duplicateGroups: I18nAuditDuplicateGroup[];
1205
+ variantGroups: I18nAuditVariantGroup[];
1206
+ sharedCandidates: I18nAuditSharedCandidate[];
1207
+ scanIssues: I18nScanIssue[];
1208
+ };
1209
+ /**
1210
+ * Audit one plugin's default locale without changing semantic runtime behavior.
1211
+ * This is intentionally advisory: it finds housekeeping opportunities that are
1212
+ * too noisy/subjective to make normal plugin builds fail.
1213
+ */
1214
+ declare function auditPluginI18n({ pluginKey, sourceDir, frontendRoot, defaultLocale, localesDir: localesDirOption, }: {
1215
+ pluginKey: string;
1216
+ sourceDir: string;
1217
+ frontendRoot: string;
1218
+ defaultLocale?: string;
1219
+ localesDir?: string;
1220
+ }): PluginI18nAuditResult;
1221
+ /** Format an advisory i18n audit for terminal use. */
1222
+ declare function formatPluginI18nAudit(result: PluginI18nAuditResult): string;
1223
+
1224
+ /**
1225
+ * Options controlling automatic extraction/fixing of plugin-local i18n messages.
1226
+ */
1227
+ type I18nFixOptions = {
1228
+ /**
1229
+ * Plugin key.
1230
+ */
1231
+ pluginKey: string;
1232
+ /**
1233
+ * Plugin frontend source directory.
1234
+ */
1235
+ sourceDir: string;
1236
+ /**
1237
+ * Frontend workspace root.
1238
+ */
1239
+ frontendRoot: string;
1240
+ /**
1241
+ * Default locale for generated localization resources.
1242
+ */
1243
+ defaultLocale?: string;
1244
+ /**
1245
+ * Directory containing plugin locale dictionaries.
1246
+ */
1247
+ localesDir?: string;
1248
+ /** Analyze and report without modifying source/catalog files. */
1249
+ dryRun?: boolean;
1250
+ };
1251
+ /**
1252
+ * One source rewrite applied by the plugin i18n fixer.
1253
+ */
1254
+ type I18nFixApplied = {
1255
+ /**
1256
+ * Source file path.
1257
+ */
1258
+ file: string;
1259
+ /**
1260
+ * One-based source line when available.
1261
+ */
1262
+ line: number;
1263
+ /**
1264
+ * One-based source column when available.
1265
+ */
1266
+ column: number;
1267
+ /**
1268
+ * Plugin-local i18n key assigned to the rewritten message.
1269
+ */
1270
+ key: string;
1271
+ /**
1272
+ * Default message text.
1273
+ */
1274
+ defaultMessage: string;
1275
+ };
1276
+ /**
1277
+ * One raw message that the i18n fixer intentionally left unchanged.
1278
+ */
1279
+ type I18nFixSkipped = {
1280
+ /**
1281
+ * Source file path.
1282
+ */
1283
+ file: string;
1284
+ /**
1285
+ * One-based source line when available.
1286
+ */
1287
+ line: number;
1288
+ /**
1289
+ * One-based source column when available.
1290
+ */
1291
+ column: number;
1292
+ /**
1293
+ * Default message text.
1294
+ */
1295
+ defaultMessage: string;
1296
+ /**
1297
+ * Reason this raw message could not be rewritten safely.
1298
+ */
1299
+ reason: string;
1300
+ };
1301
+ /**
1302
+ * Conflicting default messages that prevent a safe automatic i18n rewrite.
1303
+ */
1304
+ type I18nFixConflict = {
1305
+ /**
1306
+ * Plugin-local i18n key assigned to the rewritten message.
1307
+ */
1308
+ key: string;
1309
+ /**
1310
+ * Existing catalogue value involved in a conflict.
1311
+ */
1312
+ existing: string;
1313
+ /**
1314
+ * Incoming default message involved in a conflict.
1315
+ */
1316
+ incoming: string;
1317
+ /**
1318
+ * Source file path.
1319
+ */
1320
+ file: string;
1321
+ /**
1322
+ * One-based source line when available.
1323
+ */
1324
+ line: number;
1325
+ /**
1326
+ * One-based source column when available.
1327
+ */
1328
+ column: number;
1329
+ };
1330
+ /**
1331
+ * Result of applying plugin i18n source and catalogue fixes.
1332
+ */
1333
+ type I18nFixResult = {
1334
+ /**
1335
+ * Plugin key.
1336
+ */
1337
+ pluginKey: string;
1338
+ /**
1339
+ * Path to the plugin default-locale catalogue.
1340
+ */
1341
+ catalogPath: string;
1342
+ /**
1343
+ * Source files changed by the fixer.
1344
+ */
1345
+ changedFiles: string[];
1346
+ /**
1347
+ * Safe rewrites applied.
1348
+ */
1349
+ applied: I18nFixApplied[];
1350
+ /**
1351
+ * Raw messages that were intentionally not rewritten.
1352
+ */
1353
+ skipped: I18nFixSkipped[];
1354
+ /**
1355
+ * Catalogue conflicts that require author resolution.
1356
+ */
1357
+ conflicts: I18nFixConflict[];
1358
+ /**
1359
+ * Whether the default catalogue was created.
1360
+ */
1361
+ catalogCreated: boolean;
1362
+ /**
1363
+ * Whether an existing catalogue changed.
1364
+ */
1365
+ catalogUpdated: boolean;
1366
+ };
1367
+ /**
1368
+ * Rewrites mechanically safe raw user-facing strings to Plugmatica i18n and
1369
+ * creates/merges the default locale catalog. Normal component copy uses
1370
+ * usePluginI18n().t(...); statically declared table headers use PluginMessage
1371
+ * so descriptor arrays can stay outside React hook scope.
1372
+ *
1373
+ * The fixer is deliberately conservative. It only rewrites copy when both a
1374
+ * stable semantic translation key and a safe render strategy can be determined.
1375
+ * Anything else remains untouched so the normal strict build can explain what
1376
+ * still needs a developer-provided key.
1377
+ *
1378
+ * @param options - Options controlling the operation.
1379
+ * @returns Applied/skipped/conflicting rewrites and catalogue update result.
1380
+ */
1381
+ declare function fixPluginI18n(options: I18nFixOptions): I18nFixResult;
1382
+ /**
1383
+ * Format an i18n fix result for CLI output.
1384
+ *
1385
+ * @param result - i18n fix result to format.
1386
+ * @param dryRun - Whether output should describe changes without treating them as written.
1387
+ * @returns Formatted i18n fix summary.
1388
+ */
1389
+ declare function formatI18nFixResult(result: I18nFixResult, dryRun?: boolean): string;
1390
+
1391
+ type LocaleFragmentSource = {
1392
+ locale: string;
1393
+ files: string[];
1394
+ dictionary: MessageDictionary;
1395
+ };
1396
+ /**
1397
+ * Canonical authoring root for split plugin locale dictionaries.
1398
+ *
1399
+ * Runtime packages still expose frontend/i18n/<locale>.json. The i18n-src tree
1400
+ * exists only to keep large authoring catalogues manageable.
1401
+ */
1402
+ declare function localeFragmentsRoot(frontendRoot: string): string;
1403
+ /** Return true when a plugin uses split locale authoring. */
1404
+ declare function hasLocaleFragments(frontendRoot: string): boolean;
1405
+ /**
1406
+ * Read and merge all flat JSON fragments for one locale.
1407
+ * Duplicate keys are rejected so there is still exactly one authoring owner
1408
+ * for every translation key.
1409
+ */
1410
+ declare function readLocaleFragments(frontendRoot: string, locale: string): LocaleFragmentSource | null;
1411
+ /**
1412
+ * Materialise split locale fragments into the existing flat runtime resource
1413
+ * directory. This deliberately keeps the runtime/package contract unchanged.
1414
+ */
1415
+ declare function materializeLocaleFragments({ frontendRoot, localesDir, }: {
1416
+ frontendRoot: string;
1417
+ localesDir: string;
1418
+ }): string[];
1419
+ /**
1420
+ * Update split authoring fragments after the safe i18n fixer adds messages.
1421
+ * Existing keys stay in their current fragment; new keys go into _generated.json.
1422
+ */
1423
+ declare function writeLocaleFragments(frontendRoot: string, locale: string, nextDictionary: MessageDictionary): void;
1424
+
1425
+ /**
1426
+ * Scan plugin frontend sources and generate the canonical plugin i18n catalogue/manifest metadata.
1427
+ *
1428
+ * @param options - Options controlling the operation.
1429
+ * @returns Generated i18n catalogue, manifest metadata, and scan diagnostics.
1430
+ */
1431
+ declare function generatePluginI18n(options: PluginI18nBuildOptions): {
1432
+ manifest: GeneratedI18nManifest;
1433
+ catalog: GeneratedI18nCatalog;
1434
+ issues: I18nScanIssue[];
1435
+ };
1436
+ /**
1437
+ * Merge compiler-generated i18n metadata into a plugin source manifest projection.
1438
+ *
1439
+ * @param sourceManifest - Authored plugin source manifest.
1440
+ * @param i18n - Compiler-generated i18n manifest metadata.
1441
+ * @returns Manifest projection containing compiler-generated i18n metadata.
1442
+ */
1443
+ declare function mergeGeneratedI18nIntoManifest<T extends Record<string, unknown>>(sourceManifest: T, i18n: GeneratedI18nManifest): T & {
1444
+ i18n: GeneratedI18nManifest;
1445
+ };
1446
+
1447
+ /**
1448
+ * Scan plugin frontend source for declared messages, shared references, and raw-string diagnostics.
1449
+ *
1450
+ * @param sourceDir - Plugin frontend source directory to scan.
1451
+ * @param pluginKey - Plugin key used for local i18n namespacing.
1452
+ * @param failOnRawStrings - Whether raw user-facing strings are reported as errors rather than warnings.
1453
+ * @returns Extracted messages and scan issues.
1454
+ */
1455
+ declare function scanPluginI18nSource(sourceDir: string, pluginKey: string, failOnRawStrings?: boolean): I18nScanResult;
1456
+
1457
+ /**
1458
+ * Read and validate a locale message dictionary JSON file.
1459
+ *
1460
+ * @param file - Path to the JSON file.
1461
+ * @returns Validated locale message dictionary.
1462
+ */
1463
+ declare function readMessageDictionary(file: string): MessageDictionary;
1464
+ /**
1465
+ * Validate a locale dictionary against the default dictionary and ICU placeholder contract.
1466
+ *
1467
+ * @param {
1468
+ locale,
1469
+ dictionary,
1470
+ defaultDictionary,
1471
+ file,
1472
+ } - Options supplied to validateLocaleDictionary.
1473
+ * @returns Locale validation issues; empty when the dictionary is compatible.
1474
+ */
1475
+ declare function validateLocaleDictionary({ locale, dictionary, defaultDictionary, file, }: {
1476
+ locale: string;
1477
+ dictionary: MessageDictionary;
1478
+ defaultDictionary: MessageDictionary;
1479
+ file: string;
1480
+ }): I18nScanIssue[];
1481
+ /**
1482
+ * Check whether a shared localization namespace contains a referenced key.
1483
+ *
1484
+ * @param namespace - Shared localization namespace.
1485
+ * @param key - Localization message key.
1486
+ * @param sharedCatalogRoot - Root directory containing shared localization catalogues.
1487
+ * @param defaultLocale - Default locale used when resolving shared catalogues.
1488
+ * @returns True when the shared default catalogue contains the key.
1489
+ */
1490
+ declare function validateSharedReference(namespace: string, key: string, sharedCatalogRoot: string, defaultLocale: string): boolean;
1491
+ /**
1492
+ * Extract ICU placeholder names from a message string.
1493
+ *
1494
+ * @param message - ICU message text to inspect.
1495
+ * @returns Sorted unique ICU placeholder names.
1496
+ */
1497
+ declare function messagePlaceholders(message: string): string[];
1498
+
1499
+ /**
1500
+ * Materialises the complete frontend manifest from the intentionally concise
1501
+ * source manifest plus compiler IR. This is the single ownership boundary used
1502
+ * by packaging and compatibility snapshots.
1503
+ *
1504
+ * @param sourceManifest - Authored plugin source manifest.
1505
+ * @param compilerResult - Compiler result.
1506
+ * @returns Generated manifest projection with compiler-owned frontend metadata.
1507
+ */
1508
+ declare function materializeGeneratedFrontendManifest<T extends PluginManifestLike>(sourceManifest: T, compilerResult: Pick<PluginCompilerResult, "surfaces" | "contributions">): T;
1509
+ /**
1510
+ * Source manifests may describe custom/advanced protocol surfaces, but standard
1511
+ * semantic UI-kit surfaces are compiler-owned. Keeping one authority prevents
1512
+ * manifest.source.json from becoming a second handwritten React model.
1513
+ *
1514
+ * @param manifest - Plugin manifest projection to inspect or validate.
1515
+ */
1516
+ declare function validateSourceManifestOwnership(manifest: PluginManifestLike): void;
1517
+ /**
1518
+ * Merge compiler-generated extension surfaces into a manifest projection without duplicating identities.
1519
+ *
1520
+ * @param manifest - Plugin manifest projection to inspect or validate.
1521
+ * @param generated - Compiler-generated contract records to merge.
1522
+ * @returns Manifest projection with generated surfaces merged.
1523
+ */
1524
+ declare function mergeGeneratedSurfaces<T extends PluginManifestLike>(manifest: T, generated: PluginExtensionSurface[]): T;
1525
+ /**
1526
+ * Merge compiler-generated extension contributions into a manifest projection without duplicating identities.
1527
+ *
1528
+ * @param manifest - Plugin manifest projection to inspect or validate.
1529
+ * @param generated - Compiler-generated contract records to merge.
1530
+ * @returns Manifest projection with generated contributions merged.
1531
+ */
1532
+ declare function mergeGeneratedContributions<T extends PluginManifestLike>(manifest: T, generated: readonly PluginExtensionContribution[]): T;
1533
+ /**
1534
+ * Enforce the standard surface vocabulary while preserving `custom` as the
1535
+ * explicit escape hatch. This operates only on manifest protocol metadata; it
1536
+ * never participates in public instance-key derivation.
1537
+ *
1538
+ * Standard UI/operation contributions may omit `contract` in source. The build
1539
+ * output receives the canonical requirement automatically so authors targeting
1540
+ * Tabs/Form/Table/etc. do not have to copy Plugmatica protocol ids by hand.
1541
+ *
1542
+ * @param manifest - Plugin manifest projection to inspect or validate.
1543
+ * @returns Manifest projection using current standard surface contracts.
1544
+ */
1545
+ declare function normalizeStandardSurfaceContracts<T extends PluginManifestLike>(manifest: T): T;
1546
+ /**
1547
+ * Builds the ABI-only Current Extension Contract from the current manifest.
1548
+ * Historical baselines are deliberately not accepted here; they belong to the
1549
+ * compatibility layer and cannot influence current identity generation.
1550
+ *
1551
+ * @param manifest - Plugin manifest projection to inspect or validate.
1552
+ * @returns Current normalized extension contract represented by the manifest.
1553
+ */
1554
+ declare function currentExtensionContractFromManifest(manifest: PluginManifestLike): CurrentExtensionContract;
1555
+
1556
+ /**
1557
+ * Build the extension-devtools inspection artifact for a compiled plugin.
1558
+ *
1559
+ * @param options - Options controlling the operation.
1560
+ * @returns Serializable devtools artifact.
1561
+ */
1562
+ declare function createExtensionDevtoolsArtifact(options: {
1563
+ pluginKey: string;
1564
+ pluginVersion: string;
1565
+ currentExtensionContract: CurrentExtensionContract;
1566
+ compilerResult: PluginCompilerResult;
1567
+ }): ExtensionDevtoolsArtifact;
1568
+ /**
1569
+ * Write an extension-devtools artifact as deterministic JSON.
1570
+ *
1571
+ * @param artifact - Artifact payload to write.
1572
+ * @param outputPath - Destination file path.
1573
+ * @returns Written output path.
1574
+ */
1575
+ declare function writeExtensionDevtoolsArtifact(artifact: ExtensionDevtoolsArtifact, outputPath: string): string;
1576
+
1577
+ /**
1578
+ * Describes one frontend package-boundary violation.
1579
+ */
1580
+ type PackageBoundaryIssue = {
1581
+ /**
1582
+ * Stable diagnostic code.
1583
+ */
1584
+ code: "forbidden_internal_dependency" | "runtime_shell_leak" | "plugin_host_internal_import" | "host_networking_leak" | "identity_history_leak";
1585
+ /**
1586
+ * Source file path.
1587
+ */
1588
+ file: string;
1589
+ /**
1590
+ * Author-facing diagnostic message.
1591
+ */
1592
+ message: string;
1593
+ };
1594
+ /**
1595
+ * Result of auditing frontend packages for forbidden dependency-boundary crossings.
1596
+ */
1597
+ type PackageBoundaryAudit = {
1598
+ /**
1599
+ * Root directory audited or represented by the result.
1600
+ */
1601
+ root: string;
1602
+ /**
1603
+ * Validation or audit issues.
1604
+ */
1605
+ issues: PackageBoundaryIssue[];
1606
+ };
1607
+ /**
1608
+ * Enforces the frontend dependency direction without coupling packages to the
1609
+ * runtime shell. This is architecture linting only; it does not participate in
1610
+ * extension identity or Contract Baseline resolution.
1611
+ *
1612
+ * @param frontendRoot - Frontend workspace root to audit.
1613
+ * @returns Structured package-boundary audit.
1614
+ */
1615
+ declare function auditFrontendPackageBoundaries(frontendRoot: string): PackageBoundaryAudit;
1616
+ /**
1617
+ * Assert that frontend packages respect the supported Plugmatica package boundaries.
1618
+ *
1619
+ * @param frontendRoot - Frontend workspace root to audit.
1620
+ */
1621
+ declare function assertFrontendPackageBoundaries(frontendRoot: string): void;
1622
+ /**
1623
+ * Format a frontend package-boundary audit for CLI output.
1624
+ *
1625
+ * @param audit - Audit result to format.
1626
+ * @returns Formatted audit text suitable for CLI/CI output.
1627
+ */
1628
+ declare function formatPackageBoundaryAudit(audit: PackageBoundaryAudit): string;
1629
+ /** Result of auditing first-party plugin frontend packages for authoring boundaries. */
1630
+ type PluginAuthoringBoundaryAudit = {
1631
+ root: string;
1632
+ issues: Array<{
1633
+ code: "sibling_plugin_frontend_dependency" | "handwritten_extension_target_token";
1634
+ file: string;
1635
+ message: string;
1636
+ }>;
1637
+ };
1638
+ /**
1639
+ * Enforce the self-contained first-party plugin rule across first-party plugin frontend packages under `plugins/<plugin>/frontend`.
1640
+ *
1641
+ * A plugin may depend on shared Plugmatica SDK/UI packages, but it must not
1642
+ * import or declare another sibling plugin's frontend package merely to reach
1643
+ * extension targets. Public capability selectors belong in the consuming
1644
+ * plugin and generated direct target packages remain an external compatibility
1645
+ * mechanism, not a first-party coupling convention.
1646
+ *
1647
+ * Hand-authored `__pmTarget` token objects are also rejected in plugin source;
1648
+ * authors should use `extensionTarget.*(...)` for capability selectors or a
1649
+ * compiler-generated target artifact when concrete coupling is intentional.
1650
+ */
1651
+ declare function auditRepositoryPluginAuthoringBoundaries(repositoryRoot: string): PluginAuthoringBoundaryAudit;
1652
+
1653
+ /**
1654
+ * Structured inspection result combining compiler summary, extension contract, graph, and graph validation.
1655
+ */
1656
+ type PluginInspection = {
1657
+ /**
1658
+ * Plugin identifier.
1659
+ */
1660
+ pluginId: string;
1661
+ /**
1662
+ * Plugin version when available.
1663
+ */
1664
+ pluginVersion?: string;
1665
+ /**
1666
+ * Aggregated counts or inspection summary.
1667
+ */
1668
+ summary: {
1669
+ sourceFiles: number;
1670
+ semanticNodes: number;
1671
+ surfaces: number;
1672
+ events: number;
1673
+ providers: number;
1674
+ contributions: number;
1675
+ dependencies: number;
1676
+ exposedModules: number;
1677
+ };
1678
+ /**
1679
+ * Current extension contract extracted during inspection.
1680
+ */
1681
+ currentExtensionContract: ReturnType<typeof buildCurrentContractSnapshot>["contract"];
1682
+ /**
1683
+ * Generated plugin contract graph.
1684
+ */
1685
+ graph: ReturnType<typeof buildPluginContractGraph>;
1686
+ /**
1687
+ * Cross-plugin graph validation result.
1688
+ */
1689
+ graphValidation: ReturnType<typeof validateExtensionDependencyGraph>;
1690
+ };
1691
+ /**
1692
+ * Inspect plugin source and manifest contracts without building a runtime package.
1693
+ *
1694
+ * @param options - Options controlling the operation.
1695
+ * @returns Structured plugin inspection result.
1696
+ */
1697
+ declare function inspectPlugin(options: {
1698
+ sourceDir: string;
1699
+ manifestPath: string;
1700
+ }): PluginInspection;
1701
+ /**
1702
+ * Format a complete plugin inspection report for CLI output.
1703
+ *
1704
+ * @param inspection - Plugin inspection result to format.
1705
+ * @returns Formatted complete inspection text.
1706
+ */
1707
+ declare function formatPluginInspection(inspection: PluginInspection): string;
1708
+ /**
1709
+ * Format the extension-contract inventory portion of a plugin inspection.
1710
+ *
1711
+ * @param inspection - Plugin inspection result to format.
1712
+ * @returns Formatted extension inventory text.
1713
+ */
1714
+ declare function formatExtensionInventory(inspection: PluginInspection): string;
1715
+
1716
+ type WorkflowInspectionIssue = {
1717
+ severity: "error" | "warning";
1718
+ /** Which evidence failed: the package can be valid even when the live registry differs. */
1719
+ scope: "package" | "registry";
1720
+ code: string;
1721
+ message: string;
1722
+ };
1723
+ type WorkflowNodePackageInspection = {
1724
+ packageRoot: string;
1725
+ pluginKey: string;
1726
+ version: string;
1727
+ packageStatus: "valid" | "invalid";
1728
+ registryStatus: "not_checked" | "matched" | "mismatch";
1729
+ browserStatus: "not_checked";
1730
+ nodes: {
1731
+ nodeType: string;
1732
+ executor: string;
1733
+ contractVersion: number | null;
1734
+ contractFingerprint: string | null;
1735
+ frontendModule: string | null;
1736
+ frontendAssociation: "compiler_metadata" | "convention_only" | "unresolved";
1737
+ registryStatus: "not_checked" | "matched" | "missing" | "mismatch";
1738
+ }[];
1739
+ /** Descriptor-owned event triggers are executable Workflow types, not frontend actions. */
1740
+ triggers: {
1741
+ nodeType: string;
1742
+ event: string;
1743
+ contractVersion: number | null;
1744
+ contractFingerprint: string | null;
1745
+ registryStatus: "not_checked" | "matched" | "missing" | "mismatch";
1746
+ }[];
1747
+ modules: {
1748
+ module: string;
1749
+ points: string[];
1750
+ compiledExposePresent: boolean;
1751
+ }[];
1752
+ issues: WorkflowInspectionIssue[];
1753
+ };
1754
+ declare function inspectWorkflowNodePackage(options: {
1755
+ packageRoot: string;
1756
+ /** JSON response saved from /api/workflow-node-types?scopeKind=oss&scopeKey=default&locale=en-GB. */
1757
+ registryJson?: string;
1758
+ /** Require a complete catalog/editor/presentation facet set for each backend action. */
1759
+ requireUi?: boolean;
1760
+ }): WorkflowNodePackageInspection;
1761
+ declare function formatWorkflowNodePackageInspection(result: WorkflowNodePackageInspection): string;
1762
+
1763
+ /**
1764
+ * One labelled plugin contract snapshot used to build compatibility history.
1765
+ */
1766
+ type ReleaseContractSnapshot = {
1767
+ /**
1768
+ * Display label.
1769
+ */
1770
+ label: string;
1771
+ /**
1772
+ * Plugin identifier.
1773
+ */
1774
+ pluginId: string;
1775
+ /**
1776
+ * Plugin version when available.
1777
+ */
1778
+ pluginVersion?: string;
1779
+ /**
1780
+ * Normalized current extension contract.
1781
+ */
1782
+ contract: CurrentExtensionContract;
1783
+ /**
1784
+ * Source metadata for diagnostics or compiler output.
1785
+ */
1786
+ source?: string;
1787
+ };
1788
+ /**
1789
+ * Compatibility comparison between two adjacent release snapshots.
1790
+ */
1791
+ type ReleaseCompatibilityStep = {
1792
+ /**
1793
+ * Source node identifier.
1794
+ */
1795
+ from: ReleaseContractSnapshot;
1796
+ /**
1797
+ * Destination node identifier.
1798
+ */
1799
+ to: ReleaseContractSnapshot;
1800
+ /**
1801
+ * Compatibility report for this release step.
1802
+ */
1803
+ report: CompatibilityReport;
1804
+ };
1805
+ /**
1806
+ * Ordered compatibility history across a plugin release sequence.
1807
+ */
1808
+ type ReleaseCompatibilityHistory = {
1809
+ /**
1810
+ * Plugin identifier.
1811
+ */
1812
+ pluginId: string;
1813
+ /**
1814
+ * Ordered release snapshots.
1815
+ */
1816
+ releases: readonly ReleaseContractSnapshot[];
1817
+ /**
1818
+ * Compatibility comparisons between adjacent releases.
1819
+ */
1820
+ steps: readonly ReleaseCompatibilityStep[];
1821
+ };
1822
+ /**
1823
+ * Load normalized contract snapshots from baseline/manifest files.
1824
+ *
1825
+ * @param files - Contract baseline or manifest files to load.
1826
+ * @returns Normalized release snapshots in input order.
1827
+ */
1828
+ declare function loadReleaseContractSnapshots(files: readonly string[]): ReleaseContractSnapshot[];
1829
+ /**
1830
+ * Build pairwise compatibility history across ordered plugin release snapshots.
1831
+ *
1832
+ * @param releases - Ordered release snapshots to compare.
1833
+ * @returns Compatibility history across the release sequence.
1834
+ */
1835
+ declare function buildReleaseCompatibilityHistory(releases: readonly ReleaseContractSnapshot[]): ReleaseCompatibilityHistory;
1836
+ /**
1837
+ * Render release compatibility history as Mermaid source.
1838
+ *
1839
+ * @param history - Release compatibility history to render.
1840
+ * @returns Mermaid compatibility history diagram.
1841
+ */
1842
+ declare function renderReleaseCompatibilityHistoryMermaid(history: ReleaseCompatibilityHistory): string;
1843
+ /**
1844
+ * Render release compatibility history as Markdown.
1845
+ *
1846
+ * @param history - Release compatibility history to render.
1847
+ * @returns Markdown compatibility history.
1848
+ */
1849
+ declare function renderReleaseCompatibilityHistoryMarkdown(history: ReleaseCompatibilityHistory): string;
1850
+ /**
1851
+ * Generate and write release compatibility history artifacts.
1852
+ *
1853
+ * @param options - Options controlling the operation.
1854
+ * @returns Written history artifact paths.
1855
+ */
1856
+ declare function writeReleaseCompatibilityHistory(options: {
1857
+ history: ReleaseCompatibilityHistory;
1858
+ outputDir: string;
1859
+ }): {
1860
+ json: string;
1861
+ markdown: string;
1862
+ mermaid: string;
1863
+ };
1864
+
1865
+ /**
1866
+ * Comparable frontend projection of protocol constants and enum sets owned by the Rust contract.
1867
+ */
1868
+ type ProtocolParitySnapshot = {
1869
+ /**
1870
+ * Plugin manifest format version.
1871
+ */
1872
+ manifestVersion: number;
1873
+ /**
1874
+ * Plugin protocol version.
1875
+ */
1876
+ protocolVersion: string;
1877
+ /**
1878
+ * Supported extension surface identifiers.
1879
+ */
1880
+ extensionSurfaces: readonly string[];
1881
+ /**
1882
+ * Supported operation-hook phases.
1883
+ */
1884
+ operationExtensionPhases: readonly string[];
1885
+ /**
1886
+ * Supported extension contribution kinds.
1887
+ */
1888
+ extensionKinds: readonly string[];
1889
+ };
1890
+ /**
1891
+ * Result of comparing frontend protocol metadata with the canonical Rust protocol metadata.
1892
+ */
1893
+ type ProtocolParityReport = {
1894
+ /**
1895
+ * Canonical backend root used for protocol comparison.
1896
+ */
1897
+ backendRoot: string;
1898
+ /**
1899
+ * Protocol snapshot expected from canonical Rust metadata.
1900
+ */
1901
+ expected: ProtocolParitySnapshot;
1902
+ /**
1903
+ * Protocol snapshot observed in frontend constants.
1904
+ */
1905
+ actual: ProtocolParitySnapshot;
1906
+ /**
1907
+ * Validation or audit issues.
1908
+ */
1909
+ issues: readonly string[];
1910
+ };
1911
+ /**
1912
+ * Compare frontend protocol constants and generated enum sets against canonical Rust metadata.
1913
+ *
1914
+ * @param backendRoot - Canonical Rust backend workspace root containing protocol metadata.
1915
+ * @returns Protocol parity report.
1916
+ */
1917
+ declare function verifyFrontendProtocolAgainstRust(backendRoot: string): ProtocolParityReport;
1918
+ /**
1919
+ * Format a protocol parity report for CLI or release diagnostics.
1920
+ *
1921
+ * @param report - Compatibility report to format or enforce.
1922
+ * @returns Formatted protocol parity text.
1923
+ */
1924
+ declare function formatProtocolParityReport(report: ProtocolParityReport): string;
1925
+
1926
+ /**
1927
+ * Release-policy classification applied to frontend packages and export paths.
1928
+ */
1929
+ type PackageClassification = "public-plugin" | "public-protocol" | "host-internal";
1930
+ /**
1931
+ * Release-policy declaration for one frontend package and its public/internal export paths.
1932
+ */
1933
+ type PackageReleasePolicyEntry = {
1934
+ /**
1935
+ * Package path relative to the frontend root.
1936
+ */
1937
+ path: string;
1938
+ /**
1939
+ * Public/internal release classification.
1940
+ */
1941
+ classification: PackageClassification;
1942
+ /**
1943
+ * Export-path classification map.
1944
+ */
1945
+ exports: Record<string, PackageClassification>;
1946
+ };
1947
+ /**
1948
+ * Parsed frontend package release-policy document.
1949
+ */
1950
+ type PackageReleasePolicy = {
1951
+ /**
1952
+ * Schema version.
1953
+ */
1954
+ schemaVersion: 1;
1955
+ /**
1956
+ * Package release-policy entries.
1957
+ */
1958
+ packages: Record<string, PackageReleasePolicyEntry>;
1959
+ };
1960
+ /**
1961
+ * One package publication, dependency, declaration, or classification policy violation.
1962
+ */
1963
+ type PackageReleaseIssue = {
1964
+ /**
1965
+ * Stable diagnostic code.
1966
+ */
1967
+ code: "invalid_policy" | "unclassified_package" | "missing_package" | "package_name_mismatch" | "public_package_private" | "public_package_version" | "public_dependency_version" | "internal_package_public" | "missing_publish_config" | "missing_license" | "missing_readme" | "missing_dist_files_entry" | "workspace_protocol_leak" | "private_dependency_leak" | "export_surface_mismatch" | "unpublishable_declaration_dependency";
1968
+ /**
1969
+ * Package involved in the release issue.
1970
+ */
1971
+ packageName: string;
1972
+ /**
1973
+ * Source file path.
1974
+ */
1975
+ file: string;
1976
+ /**
1977
+ * Author-facing diagnostic message.
1978
+ */
1979
+ message: string;
1980
+ };
1981
+ /**
1982
+ * Result of auditing frontend packages against the release policy.
1983
+ */
1984
+ type PackageReleaseAudit = {
1985
+ /**
1986
+ * Root directory audited or represented by the result.
1987
+ */
1988
+ root: string;
1989
+ /**
1990
+ * Release policy source path.
1991
+ */
1992
+ policyPath: string;
1993
+ /**
1994
+ * Validation or audit issues.
1995
+ */
1996
+ issues: PackageReleaseIssue[];
1997
+ };
1998
+ /**
1999
+ * Load and validate the frontend package release policy.
2000
+ *
2001
+ * @param frontendRoot - Frontend workspace root to audit.
2002
+ * @returns Validated package release policy.
2003
+ */
2004
+ declare function loadPackageReleasePolicy(frontendRoot: string): PackageReleasePolicy;
2005
+ /**
2006
+ * Audit frontend package metadata, exports, dependencies, and declarations against release policy.
2007
+ *
2008
+ * @param frontendRoot - Frontend workspace root to audit.
2009
+ * @returns Complete package release audit.
2010
+ */
2011
+ declare function auditPackageReleaseContract(frontendRoot: string): PackageReleaseAudit;
2012
+ /**
2013
+ * Assert that all frontend packages satisfy the configured release contract.
2014
+ *
2015
+ * @param frontendRoot - Frontend workspace root to audit.
2016
+ */
2017
+ declare function assertPackageReleaseContract(frontendRoot: string): void;
2018
+ /**
2019
+ * Format package release audit issues for release/CI output.
2020
+ *
2021
+ * @param audit - Audit result to format.
2022
+ * @returns Formatted release audit text.
2023
+ */
2024
+ declare function formatPackageReleaseAudit(audit: PackageReleaseAudit): string;
2025
+ /**
2026
+ * After package builds, checks emitted declarations for imports of private
2027
+ * Plugmatica packages. This catches accidental .d.ts dependency leaks that
2028
+ * source/package.json auditing alone cannot prove away.
2029
+ *
2030
+ * @param frontendRoot - Frontend workspace root to audit.
2031
+ * @returns Declaration dependency issues.
2032
+ */
2033
+ declare function auditBuiltDeclarationDependencies(frontendRoot: string): PackageReleaseIssue[];
2034
+
2035
+ /** Stable public starter metadata packaged with `@plugmatica/plugin-build`. */
2036
+ type PluginTemplate = {
2037
+ id: string;
2038
+ name: string;
2039
+ description: string;
2040
+ category: string;
2041
+ facets: string[];
2042
+ tags: string[];
2043
+ files: string[];
2044
+ templateParameters: PluginTemplateParameter[];
2045
+ };
2046
+ /** Parameter required to materialize a portable starter. */
2047
+ type PluginTemplateParameter = {
2048
+ name: string;
2049
+ token: string;
2050
+ required?: boolean;
2051
+ default?: string;
2052
+ description: string;
2053
+ };
2054
+ /** Options used to materialise a new plugin package from a canonical starter. */
2055
+ type PluginScaffoldOptions = {
2056
+ /** Destination directory for the new plugin package. */
2057
+ directory: string;
2058
+ /** Canonical starter ID, for example `frontend-minimal` or `backend-capabilities`. */
2059
+ template?: string;
2060
+ /** Stable Plugmatica plugin key. Defaults to an `example.*` key derived from the directory name. */
2061
+ pluginKey?: string;
2062
+ /** Human-readable plugin name written to the source manifest. */
2063
+ name?: string;
2064
+ /** Plugin description written to the source manifest. */
2065
+ description?: string;
2066
+ /** Plugin author written to the source manifest. */
2067
+ author?: string;
2068
+ /** Module Federation module name for frontend-bearing starters. */
2069
+ moduleName?: string;
2070
+ /** Public UI surface type consumed by the capability-resolved extension starter. */
2071
+ targetSurface?: string;
2072
+ /** Public semantic surface key consumed by the capability-resolved extension starter. */
2073
+ targetKey?: string;
2074
+ /** Public extension point consumed by the capability-resolved extension starter. */
2075
+ targetPoint?: string;
2076
+ /** Versioned public UI contract identifier consumed by the extension starter. */
2077
+ targetContractId?: string;
2078
+ /** Compatible public UI contract version range. */
2079
+ targetContractVersion?: string;
2080
+ /** Public provider capability key consumed by the provider/event starter. */
2081
+ providerKey?: string;
2082
+ /** Versioned public provider contract identifier. */
2083
+ providerContractId?: string;
2084
+ /** Compatible public provider contract version range. */
2085
+ providerContractVersion?: string;
2086
+ /** Public event capability key consumed by the provider/event starter. */
2087
+ eventKey?: string;
2088
+ /** Versioned public event contract identifier. */
2089
+ eventContractId?: string;
2090
+ /** Compatible public event contract version range. */
2091
+ eventContractVersion?: string;
2092
+ /** Additional template parameters for programmatic consumers. */
2093
+ templateValues?: Record<string, string>;
2094
+ /** Replace an existing destination directory instead of refusing to overwrite it. */
2095
+ force?: boolean;
2096
+ };
2097
+ /**
2098
+ * Return the canonical starter catalogue packaged with `@plugmatica/plugin-build`.
2099
+ *
2100
+ * The catalogue is generated from the verified repository examples and is safe
2101
+ * to expose to CLI/IDE/AI consumers.
2102
+ */
2103
+ declare function listPluginTemplates(): Promise<PluginTemplate[]>;
2104
+ /**
2105
+ * Creates a new Plugmatica plugin package from a canonical verified starter.
2106
+ *
2107
+ * Repository examples are projected into portable public templates at release
2108
+ * time. This function only resolves the selected template, substitutes required
2109
+ * parameters, personalizes package identity and materializes the files.
2110
+ *
2111
+ * @example
2112
+ * ```ts
2113
+ * await createPluginScaffold({
2114
+ * directory: "./orders",
2115
+ * template: "full-stack-minimal",
2116
+ * pluginKey: "acme.orders",
2117
+ * });
2118
+ * ```
2119
+ */
2120
+ declare function createPluginScaffold(options: PluginScaffoldOptions): Promise<{
2121
+ root: string;
2122
+ template: string;
2123
+ pluginKey: string;
2124
+ facets: {
2125
+ frontend: boolean;
2126
+ backend: boolean;
2127
+ localization: boolean;
2128
+ };
2129
+ }>;
2130
+ /**
2131
+ * Assert that the current Node.js major version satisfies the plugin-build toolchain contract.
2132
+ *
2133
+ * @param major - Node.js major version to validate.
2134
+ */
2135
+ declare function assertSupportedNode(major?: number): void;
2136
+ /**
2137
+ * Assert that plugin-build is running under the supported pnpm package manager.
2138
+ *
2139
+ * @param userAgent - Package-manager user-agent string, normally npm_config_user_agent.
2140
+ */
2141
+ declare function assertSupportedPackageManager(userAgent?: string | undefined): void;
2142
+
2143
+ export { BackendDescriptorValidationError, BreakingExtensionContractError, CONTRACT_BASELINE_FORMAT_VERSION, CompilerFileResult, EcosystemPluginManifest, ExplicitContractBaselineProvider, ExtensionGraphValidation, GitTagContractBaselineProvider, InstalledPluginContractBaselineProvider, PluginCompilerResult, PluginContractGraph, PluginManifestLike, RESERVED_MANAGED_ENTITY_COLUMNS, RegistryBaselineUnavailableError, RegistryContractBaselineProvider, RepositoryContractBaselineProvider, assertFrontendPackageBoundaries, assertPackageReleaseContract, assertSupportedNode, assertSupportedPackageManager, assertValidBackendDescriptor, assertValidBackendDescriptorFile, auditBuiltDeclarationDependencies, auditFrontendPackageBoundaries, auditPackageReleaseContract, auditPluginI18n, auditRepositoryPluginAuthoringBoundaries, buildCurrentContractSnapshot, buildPluginContractGraph, buildReleaseCompatibilityHistory, checkContractCompatibility, compareExtensionContracts, compilePluginSource, contractFromManifestPayload, createExtensionDevtoolsArtifact, createPluginScaffold, createRepositoryBaselineFile, currentExtensionContractFromManifest, enforceStrictCompatibility, fixPluginI18n, fixRedundantExtensionOverrides, formatCompatibilityReport, formatExtensionFixResult, formatExtensionInventory, formatI18nFixResult, formatPackageBoundaryAudit, formatPackageReleaseAudit, formatPluginI18nAudit, formatPluginInspection, formatProtocolParityReport, formatWorkflowNodePackageInspection, generatePluginI18n, hasLocaleFragments, initRepositoryContractBaseline, inspectPlugin, inspectWorkflowNodePackage, listPluginTemplates, loadPackageReleasePolicy, loadReleaseContractSnapshots, localeFragmentsRoot, managedStorageIdentifier, materializeGeneratedFrontendManifest, materializeLocaleFragments, mergeGeneratedContributions, mergeGeneratedI18nIntoManifest, mergeGeneratedSurfaces, messagePlaceholders, normalizeCurrentExtensionContract, normalizeStandardSurfaceContracts, parseContractBaselineFile, readContractBaselineFile, readLocaleFragments, readMessageDictionary, renderPluginContractGraphMermaid, renderReleaseCompatibilityHistoryMarkdown, renderReleaseCompatibilityHistoryMermaid, repositoryBaselinePath, reservedManagedColumnForField, resolveContractBaseline, scanPluginI18nSource, synthesizeWorkflowEventTriggers, transformCompiledSource, updateRepositoryContractBaseline, validateBackendDescriptor, validateBackendDescriptorFile, validateExtensionDependencyGraph, validateLocaleDictionary, validateSharedReference, validateSourceManifestOwnership, verifyFrontendProtocolAgainstRust, versionRequirementAccepts, workflowActionContractFingerprint, workflowEventContractFingerprint, writeContractBaselineFile, writeExtensionDevtoolsArtifact, writeLocaleFragments, writeReleaseCompatibilityHistory };
2144
+ export type { BackendDescriptorIssue, BaselineResolutionAttempt, CompatibilityReport, CompatibilityStatus, CompilePluginSourceOptions, ContractBaseline, ContractBaselineContext, ContractBaselineFile, ContractBaselineKind, ContractBaselineMode, ContractBaselineProvenance, ContractBaselineProvider, ContractBaselineResolution, ContractChange, ContractDiagnosticReference, ContractElementKind, ContractOperationChange, ContractPointChange, CurrentContractSnapshot, ExtensionFixChange, ExtensionFixResult, ExtractedMessage, GeneratedI18nCatalog, GeneratedI18nCatalogEntry, GeneratedI18nManifest, GitTagContractBaselineProviderOptions, I18nAuditDuplicateGroup, I18nAuditSharedCandidate, I18nAuditVariantGroup, I18nFixApplied, I18nFixConflict, I18nFixOptions, I18nFixResult, I18nFixSkipped, I18nScanIssue, I18nScanResult, I18nSourceLocation, LikelyContractRename, LocaleFragmentSource, PackageBoundaryAudit, PackageBoundaryIssue, PackageClassification, PackageReleaseAudit, PackageReleaseIssue, PackageReleasePolicy, PackageReleasePolicyEntry, PluginAuthoringBoundaryAudit, PluginCompilerPageRoute, PluginI18nAuditResult, PluginI18nBuildOptions, PluginInspection, PluginScaffoldOptions, PluginTemplate, PluginTemplateParameter, ProtocolParityReport, ProtocolParitySnapshot, RegistryContractBaselineProviderOptions, ReleaseCompatibilityHistory, ReleaseCompatibilityStep, ReleaseContractSnapshot, WorkflowInspectionIssue, WorkflowNodePackageInspection };