@platforma-sdk/block-tools 2.10.19 → 2.11.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.
- package/dist/cli.js +11 -11
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +362 -352
- package/dist/cli.mjs.map +1 -1
- package/dist/structure/engine/builders.d.ts +7 -6
- package/dist/structure/engine/content-rules.d.ts +4 -4
- package/dist/structure/engine/ir.d.ts +11 -6
- package/dist/structure/rules/block-package-json.d.ts +1 -1
- package/dist/structure/rules/root-ci.d.ts +1 -0
- package/dist/v2/registry/schema_public.d.ts +150 -150
- package/package.json +4 -4
- package/src/structure/CLAUDE.md +2 -0
- package/src/structure/__tests__/discovery-shortname.test.ts +50 -0
- package/src/structure/__tests__/root-ci-workflows.test.ts +68 -0
- package/src/structure/engine/builders.ts +7 -6
- package/src/structure/engine/content-rules.ts +7 -7
- package/src/structure/engine/discovery-fs.ts +9 -1
- package/src/structure/engine/ir.ts +11 -6
- package/src/structure/engine/runner.ts +14 -14
- package/src/structure/rules/block-package-json.ts +2 -3
- package/src/structure/rules/block.ts +3 -4
- package/src/structure/rules/migrations.ts +1 -2
- package/src/structure/rules/model.ts +1 -2
- package/src/structure/rules/root-catalog-bump.ts +3 -4
- package/src/structure/rules/root-ci.ts +55 -0
- package/src/structure/rules/root.ts +2 -3
- package/src/structure/rules/software.ts +1 -2
- package/src/structure/rules/test.ts +1 -2
- package/src/structure/rules/ui.ts +3 -5
- package/src/structure/rules/workflow.ts +3 -5
- package/src/structure/structure-definition.ts +2 -0
- package/src/structure/templates/text/workflows/build.tpl.yaml +67 -0
- package/src/structure/templates/text/workflows/mark-stable.tpl.yaml +34 -0
|
@@ -82,12 +82,13 @@ export declare function binaryFile(path: string): ContentForm;
|
|
|
82
82
|
/** Content form: an inline literal string. */
|
|
83
83
|
export declare function text(value: string): ContentForm;
|
|
84
84
|
/** Content form: a text template (the structurer's `text/` templates) with
|
|
85
|
-
* `${var}` placeholders substituted from `vars`.
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
*
|
|
90
|
-
|
|
85
|
+
* `${var}` placeholders substituted from `vars`. When `vars` is a function it
|
|
86
|
+
* receives the active {@link RunContext} at resolve time. */
|
|
87
|
+
export declare function tpl(path: string, vars: Record<string, string> | ((ctx: RunContext) => Record<string, string>)): ContentForm;
|
|
88
|
+
/** Content form: content computed at run time from the active
|
|
89
|
+
* {@link RunContext}. The return value is serialised as JSON / YAML by the
|
|
90
|
+
* target file's extension, or used verbatim if it is already a string. */
|
|
91
|
+
export declare function generate(fn: (ctx: RunContext) => unknown): ContentForm;
|
|
91
92
|
/** The active run's {@link BlockVars} (block name parts + software platform).
|
|
92
93
|
* Valid only during a run (inside a generator or managed body); throws
|
|
93
94
|
* otherwise. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RunContext, Scope } from './api';
|
|
2
|
-
import { TriggerContext } from './ir';
|
|
2
|
+
import { ManagedBody, TriggerContext } from './ir';
|
|
3
3
|
import { JsonObject } from './parsers/json';
|
|
4
4
|
import { YamlDocument } from './parsers/yaml';
|
|
5
5
|
export type { JsonObject };
|
|
@@ -30,7 +30,7 @@ export type WithManagedOpts = {
|
|
|
30
30
|
/** Engine-internal: run `body` with `obj` as the active JSON state so the
|
|
31
31
|
* JSON builders mutate it; returns the mutated object. Exported for tests —
|
|
32
32
|
* the runner calls this for managed `.json` files. */
|
|
33
|
-
export declare function withManagedBody(obj: JsonObject, body:
|
|
33
|
+
export declare function withManagedBody(obj: JsonObject, body: ManagedBody, opts?: WithManagedOpts): JsonObject;
|
|
34
34
|
export type WithManagedYamlOpts = WithManagedOpts & {
|
|
35
35
|
/** Sync accessor for prefetched latest versions. Required for
|
|
36
36
|
* `ensureCatalogLatest` to take effect. */
|
|
@@ -41,10 +41,10 @@ export type WithManagedYamlOpts = WithManagedOpts & {
|
|
|
41
41
|
};
|
|
42
42
|
/** Engine-internal: run `body` with `doc` as the active YAML state (for
|
|
43
43
|
* `pnpm-workspace.yaml`); returns the mutated document. Exported for tests. */
|
|
44
|
-
export declare function withManagedYaml(doc: YamlDocument, body:
|
|
44
|
+
export declare function withManagedYaml(doc: YamlDocument, body: ManagedBody, opts?: WithManagedYamlOpts): YamlDocument;
|
|
45
45
|
/** Engine-internal: run `body` with `lines` as the active line-based state
|
|
46
46
|
* (for `.gitignore`); returns the mutated lines. Exported for tests. */
|
|
47
|
-
export declare function withManagedLines(lines: string[], body:
|
|
47
|
+
export declare function withManagedLines(lines: string[], body: ManagedBody, opts?: WithManagedOpts): string[];
|
|
48
48
|
/** Set the value at `jsonPath` in the active managed JSON object. */
|
|
49
49
|
export declare function ensureField(jsonPath: string, value: unknown): void;
|
|
50
50
|
/** Remove the field at `jsonPath`. With `predicate`, only removes when
|
|
@@ -24,9 +24,11 @@ export type TriggerContext = {
|
|
|
24
24
|
};
|
|
25
25
|
export type TriggerFn = (tctx: TriggerContext) => boolean;
|
|
26
26
|
/** Content forms — what to write into a file when creating it.
|
|
27
|
-
* `tpl.vars` may be
|
|
28
|
-
*
|
|
29
|
-
|
|
27
|
+
* `tpl.vars` and `generate.fn` may be functions; when they are, the
|
|
28
|
+
* resolver calls them with the active `RunContext` (the same object
|
|
29
|
+
* triggers see as `tctx.ctx`), so lambdas read block identity via their
|
|
30
|
+
* argument rather than the module-global `getActiveRunContext()`. */
|
|
31
|
+
export type TplVarsLike = Record<string, string> | ((ctx: RunContext) => Record<string, string>);
|
|
30
32
|
export type ContentForm = {
|
|
31
33
|
kind: "file";
|
|
32
34
|
path: string;
|
|
@@ -39,13 +41,16 @@ export type ContentForm = {
|
|
|
39
41
|
vars: TplVarsLike;
|
|
40
42
|
} | {
|
|
41
43
|
kind: "generate";
|
|
42
|
-
fn: () => unknown;
|
|
44
|
+
fn: (ctx: RunContext) => unknown;
|
|
43
45
|
} | {
|
|
44
46
|
kind: "binary";
|
|
45
47
|
path: string;
|
|
46
48
|
};
|
|
47
|
-
/** Builder-body for a `managed` file (the content-rules lambda).
|
|
48
|
-
|
|
49
|
+
/** Builder-body for a `managed` file (the content-rules lambda). Receives the
|
|
50
|
+
* active `RunContext` — the same object triggers see as `tctx.ctx` and that
|
|
51
|
+
* `generate`/`tpl` lambdas receive — so the body reads block identity via its
|
|
52
|
+
* argument rather than the module-global `getActiveRunContext()`. */
|
|
53
|
+
export type ManagedBody = (ctx: RunContext) => void;
|
|
49
54
|
export type FixedItem = {
|
|
50
55
|
kind: "fixed";
|
|
51
56
|
path: string;
|
|
@@ -6,4 +6,4 @@ import { RunContext } from '../engine/api';
|
|
|
6
6
|
* workflow → pl-tengo, model → build-model, ui → ts-builder. */
|
|
7
7
|
export declare function blockComponents(ctx: RunContext): Record<string, string>;
|
|
8
8
|
export declare function blockPackageJsonInitial(ctx: RunContext): Record<string, unknown>;
|
|
9
|
-
export declare function blockPackageJsonRules(): void;
|
|
9
|
+
export declare function blockPackageJsonRules(ctx: RunContext): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function rootCiRules(): void;
|