@intentius/chant 0.97.0 → 0.99.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 (62) hide show
  1. package/dist/cli/commands/import.d.ts +67 -4
  2. package/dist/cli/commands/import.d.ts.map +1 -1
  3. package/dist/cli/commands/lint.d.ts.map +1 -1
  4. package/dist/cli/handlers/misc.d.ts.map +1 -1
  5. package/dist/cli/handlers/operator.d.ts.map +1 -1
  6. package/dist/cli/main.d.ts.map +1 -1
  7. package/dist/cli/mcp/tools/import.d.ts +4 -0
  8. package/dist/cli/mcp/tools/import.d.ts.map +1 -1
  9. package/dist/cli/plugins.d.ts +10 -0
  10. package/dist/cli/plugins.d.ts.map +1 -1
  11. package/dist/deep-observation.d.ts.map +1 -1
  12. package/dist/import/embedded.d.ts +184 -0
  13. package/dist/import/embedded.d.ts.map +1 -0
  14. package/dist/import/generator.d.ts +13 -0
  15. package/dist/import/generator.d.ts.map +1 -1
  16. package/dist/import/parser.d.ts +15 -1
  17. package/dist/import/parser.d.ts.map +1 -1
  18. package/dist/lexicon.d.ts +19 -0
  19. package/dist/lexicon.d.ts.map +1 -1
  20. package/dist/lint/engine.d.ts +6 -1
  21. package/dist/lint/engine.d.ts.map +1 -1
  22. package/dist/lint/rule.d.ts +10 -0
  23. package/dist/lint/rule.d.ts.map +1 -1
  24. package/dist/lint/rules/file-declarable-limit.d.ts.map +1 -1
  25. package/dist/lint/rules/flat-declarations.d.ts.map +1 -1
  26. package/dist/lint/rules/no-unused-declarable.d.ts.map +1 -1
  27. package/dist/lint/rules/property-kind.d.ts +7 -0
  28. package/dist/lint/rules/property-kind.d.ts.map +1 -0
  29. package/dist/workspace/conformance/index.d.ts +9 -0
  30. package/dist/workspace/conformance/index.d.ts.map +1 -1
  31. package/dist/yaml.d.ts +44 -6
  32. package/dist/yaml.d.ts.map +1 -1
  33. package/package.json +1 -1
  34. package/src/cli/commands/import-layout.test.ts +142 -0
  35. package/src/cli/commands/import-no-parser.test.ts +70 -0
  36. package/src/cli/commands/import.test.ts +284 -2
  37. package/src/cli/commands/import.ts +325 -86
  38. package/src/cli/commands/lint.ts +21 -8
  39. package/src/cli/handlers/misc.ts +3 -0
  40. package/src/cli/handlers/operator-steward-signal.e2e.test.ts +19 -11
  41. package/src/cli/handlers/operator.ts +17 -3
  42. package/src/cli/main.ts +3 -1
  43. package/src/cli/mcp/tools/import.ts +6 -0
  44. package/src/cli/plugins.ts +41 -2
  45. package/src/deep-observation.test.ts +21 -0
  46. package/src/deep-observation.ts +9 -0
  47. package/src/import/embedded.test.ts +153 -0
  48. package/src/import/embedded.ts +376 -0
  49. package/src/import/generator.ts +14 -0
  50. package/src/import/parser.ts +17 -1
  51. package/src/lexicon.ts +21 -0
  52. package/src/lint/engine.ts +7 -0
  53. package/src/lint/rule.ts +10 -0
  54. package/src/lint/rules/file-declarable-limit.ts +11 -4
  55. package/src/lint/rules/flat-declarations.ts +6 -1
  56. package/src/lint/rules/no-unused-declarable.ts +59 -2
  57. package/src/lint/rules/property-kind.test.ts +99 -0
  58. package/src/lint/rules/property-kind.ts +56 -0
  59. package/src/workspace/conformance/index.mjs +1 -0
  60. package/src/workspace/conformance/index.ts +23 -1
  61. package/src/yaml.test.ts +244 -1
  62. package/src/yaml.ts +443 -241
@@ -1,3 +1,5 @@
1
+ import type { TemplateIR } from "../../import/parser.js";
2
+ import type { GeneratedFile, TypeScriptGenerator } from "../../import/generator.js";
1
3
  import type { LexiconPlugin, ResourceSelector } from "../../lexicon.js";
2
4
  /**
3
5
  * Import command options
@@ -9,6 +11,11 @@ export interface ImportOptions {
9
11
  output?: string;
10
12
  /** Force overwrite existing files */
11
13
  force?: boolean;
14
+ /**
15
+ * Lexicon whose parser handles the file (#2935). Skips detection and the
16
+ * JSON/YAML check: the raw content goes straight to that plugin's parser.
17
+ */
18
+ lexicon?: string;
12
19
  }
13
20
  /**
14
21
  * Import command result
@@ -22,9 +29,64 @@ export interface ImportResult {
22
29
  warnings: string[];
23
30
  /** Error message if failed */
24
31
  error?: string;
25
- /** Detected lexicon */
32
+ /** The lexicon that handled the template */
26
33
  lexicon?: string;
34
+ /**
35
+ * True when `lexicon` was found by template detection, false or absent when
36
+ * it was named (`--lexicon`, `--kustomize`) (#2965).
37
+ */
38
+ detected?: boolean;
39
+ }
40
+ /**
41
+ * Parse template content for detection (#2935): JSON first, then YAML. A YAML
42
+ * file is split into documents with core's `splitYAMLDocuments` (the k8s
43
+ * parser splits the same way), and each document is parsed on its own, so
44
+ * detection sees the same per-document objects the plugin's parser will. A
45
+ * document whose top level is a list parses as that list (#2965). JSON yields
46
+ * one document, the parsed value, exactly as before. Returns undefined when
47
+ * the content is neither. A document core's YAML reader cannot parse is
48
+ * skipped here, since detection only needs one it can read; the plugin's
49
+ * parser meets the same document and reports it (#2991). A file with no
50
+ * non-empty document is rejected.
51
+ */
52
+ export declare function parseTemplateDocuments(content: string): unknown[] | undefined;
53
+ /** The outcome of template detection (#2965). */
54
+ export interface TemplateDetection {
55
+ /** The plugin that handles the template. */
56
+ plugin: LexiconPlugin;
57
+ /**
58
+ * Where it came from: one of the project's lexicons, or an installed
59
+ * lexicon package tried because none of the project's matched.
60
+ */
61
+ source: "project" | "installed";
62
+ /** Other installed lexicons that also recognized the deciding document. */
63
+ alsoMatched: string[];
64
+ }
65
+ /**
66
+ * Detect which lexicon handles a template (#2965). The project's lexicons
67
+ * (from chant.config, or the lexicons its source imports) are asked first, so
68
+ * inside a project nothing changes when one of them matches. When none does,
69
+ * or there is no project, every installed `@intentius/chant-lexicon-*`
70
+ * package that is not already a project lexicon is asked, in name order,
71
+ * and one with a `templateParser` is preferred over one without.
72
+ * Installed lexicons are loaded one at a time and without `init()`; one that
73
+ * fails to load is skipped. The chosen plugin is initialized before it is
74
+ * returned.
75
+ */
76
+ export declare function detectTemplateLexicon(documents: unknown[], projectDir: string): Promise<TemplateDetection | undefined>;
77
+ /** The files an import writes, and anything core could not keep. */
78
+ export interface OrganizedFiles {
79
+ files: GeneratedFile[];
80
+ warnings: string[];
27
81
  }
82
+ /**
83
+ * Decide the files an import writes. A generator with `ownsLayout` is called
84
+ * once with the whole IR and its files are written exactly as returned
85
+ * (#2964). Otherwise an IR of up to three resources is generated in one call,
86
+ * and a larger one is split into one file per resource category plus an
87
+ * `index.ts` barrel.
88
+ */
89
+ export declare function generateOrganizedFiles(ir: TemplateIR, generator: TypeScriptGenerator): OrganizedFiles;
28
90
  /**
29
91
  * Execute the import command
30
92
  */
@@ -33,8 +95,9 @@ export declare function importCommand(options: ImportOptions): Promise<ImportRes
33
95
  * Import from an in-memory template string through a KNOWN plugin — no
34
96
  * detection, no JSON assumption (#1548). This is the seam
35
97
  * `chant import --kustomize <dir>` drives with `kustomize build` output
36
- * through the k8s plugin's YAML parser; `importCommand` above is the same
37
- * pipeline behind file reading + JSON detection.
98
+ * through the k8s plugin's YAML parser, and `chant import <file> --lexicon
99
+ * <name>` drives with the file's content (#2935); `importCommand` above is
100
+ * the same pipeline behind file reading + JSON/YAML detection.
38
101
  */
39
102
  export interface ContentImportOptions {
40
103
  /** The raw template content (YAML or JSON — the plugin's parser decides). */
@@ -73,7 +136,7 @@ export interface LiveImportOptions {
73
136
  * for full-fidelity IR, then generate chant TypeScript from it.
74
137
  *
75
138
  * Unlike file import, the live config may contain secrets — the caller prints a
76
- * warning. Reuses the same by-category output organization as file import.
139
+ * warning. Uses the same file layout as file import (`generateOrganizedFiles`).
77
140
  */
78
141
  export declare function importFromLive(options: LiveImportOptions): Promise<ImportResult>;
79
142
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"import.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/import.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAErE;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,4BAA4B;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,8CAA8C;IAC9C,MAAM,CAAC,EAAE,M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OAAO,CAAC;IACjB,uBAAuB;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,yBAAyB;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,sBAAsB;IACtB,WAAW,EAAE,cAAc,EAAE,CAAC;IAC9B,uBAAuB;IACvB,MAAM,EAAE,MAAM,CAAC;CAChB;AAiVD;;GAEG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,CAqN3E;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CAIxD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,WAAW,EACpB,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,GACtC,MAAM,IAAI,CAiCZ"}
@@ -1 +1 @@
1
- {"version":3,"file":"misc.d.ts","sourceRoot":"","sources":["../../../src/cli/handlers/misc.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AA8ClD,wBAAsB,QAAQ,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAqGnE;AAED,wBAAsB,OAAO,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAuClE;AAED,wBAAsB,WAAW,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CA8CtE;AAED,wBAAsB,SAAS,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAsIpE;AAED,wBAAsB,SAAS,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAKpE;AAED,wBAAsB,SAAS,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAgBpE"}
1
+ {"version":3,"file":"misc.d.ts","sourceRoot":"","sources":["../../../src/cli/handlers/misc.ts"],"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,EAC7B,QAAQ,EAAE,iBAAiB,GAAG,SAAS,GACtC,MAAM,EAAE,CAiCV"}
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":";AAMA,OAAO,EAAkB,KAAK,UAAU,EAAE,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAuG9E;;GAEG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,UAAU,CAyhBpD;AA6rBD;;;;;;;;;;GAUG;AACH,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAuBzE;AAID;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,EAAE,UAAU,EAoIvC,CAAC;AA4KF;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,CAAC,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAuB5E"}
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":";AAMA,OAAO,EAAkB,KAAK,UAAU,EAAE,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAuG9E;;GAEG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,UAAU,CAyhBpD;AA+rBD;;;;;;;;;;GAUG;AACH,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAuBzE;AAID;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,EAAE,UAAU,EAoIvC,CAAC;AA4KF;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,CAAC,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAuB5E"}
@@ -15,6 +15,10 @@ export declare const importTool: {
15
15
  type: string;
16
16
  description: string;
17
17
  };
18
+ lexicon: {
19
+ type: string;
20
+ description: string;
21
+ };
18
22
  };
19
23
  required: string[];
20
24
  };
@@ -1 +1 @@
1
- {"version":3,"file":"import.d.ts","sourceRoot":"","sources":["../../../../src/cli/mcp/tools/import.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;CAiBtB,CAAC;AAEF;;GAEG;AACH,wBAAsB,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAoBpF"}
1
+ {"version":3,"file":"import.d.ts","sourceRoot":"","sources":["../../../../src/cli/mcp/tools/import.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;CAqBtB,CAAC;AAEF;;GAEG;AACH,wBAAsB,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAsBpF"}
@@ -20,6 +20,16 @@ export declare function recordProjectLexicons(dir: string): StaticLexiconRead;
20
20
  * LexiconPlugin export. Falls back to wrapping a raw Serializer export.
21
21
  */
22
22
  export declare function loadPlugin(lexiconName: string): Promise<LexiconPlugin>;
23
+ /**
24
+ * The names of the lexicon packages installed where {@link loadPlugin} can
25
+ * load them (#2965), sorted. `loadPlugin` imports
26
+ * `@intentius/chant-lexicon-<name>` from chant's own install and then from the
27
+ * project (`importLexiconPackage`), so this lists the `@intentius` scope of
28
+ * every `node_modules` directory Node would search from either place: each
29
+ * ancestor of chant's own module and each ancestor of `projectDir`. A name
30
+ * being listed does not promise it loads; the caller still handles a failure.
31
+ */
32
+ export declare function listInstalledLexicons(projectDir?: string): string[];
23
33
  /**
24
34
  * The installed version of each named lexicon package (chant #1442).
25
35
  *
@@ -1 +1 @@
1
- {"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../src/cli/plugins.ts"],"names":[],"mappings":"AACA,OAAO,E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+BtE;AA0CD,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,EAAE,oBAAoB,GAC5B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAyIzB;AAKD,qFAAqF;AACrF,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,CAAC,EAAE,sBAAsB,CAAC;CAChC;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,CAAC,EAAE,kBAAkB,GAC3B,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAoDtB;AAED,4FAA4F;AAC5F,wBAAgB,cAAc,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,OAAO,CAK9D"}
@@ -0,0 +1,184 @@
1
+ /**
2
+ * Content embedded in another lexicon's resources, imported by the lexicon
3
+ * that owns it (#2962).
4
+ *
5
+ * A Kubernetes ConfigMap holding a collector's `config.yaml`, a
6
+ * `PrometheusRule` whose `spec.groups` are Prometheus rule groups, and a
7
+ * ConfigMap holding Grafana dashboard JSON all carry another lexicon's
8
+ * source inside a k8s resource. The host lexicon's parser (k8s) finds such
9
+ * content and offers it here; the lexicon that can import it (otel,
10
+ * prometheus, grafana) declares so with `LexiconPlugin.embeddedImporters()`.
11
+ * Core matches the two at run time, so the host needs no dependency on the
12
+ * owner: when the owner is not installed the content stays as written, with
13
+ * a warning.
14
+ *
15
+ * The flow, driven by `chant import`:
16
+ *
17
+ * 1. The host's `TemplateParser.parse(content, context)` calls
18
+ * `context.embedded.resolve(site)` for each place content can be
19
+ * embedded, and puts the `EmbeddedReference` it gets back into its IR in
20
+ * place of the raw value. `undefined` means keep the raw value.
21
+ * 2. The owner's `EmbeddedContentImporter.import(site)` returns the modules
22
+ * declaring the content and how the host's value is built from them
23
+ * (`collectorYaml([...])`, a list of rule groups, `dashboardJson(...)`).
24
+ * 3. Core writes those modules in a directory of their own beside the
25
+ * host's files, and the host's generator renders the reference with
26
+ * `renderEmbeddedReference`, which also writes the imports it needs.
27
+ */
28
+ import type { GeneratedFile } from "./generator.js";
29
+ /** One place in a host resource that may hold another lexicon's content. */
30
+ export interface EmbeddedContent {
31
+ /** The host lexicon, e.g. `"k8s"`. */
32
+ readonly host: string;
33
+ /** The host resource's type, e.g. `"K8s::Core::ConfigMap"`. */
34
+ readonly hostType: string;
35
+ /** Where it is, for messages: `ConfigMap otel-agent data["config.yaml"]`. */
36
+ readonly location: string;
37
+ /** A name for the directory its modules are written to; core makes it unique. */
38
+ readonly directory: string;
39
+ /** The content as text, when the host holds it as text (a ConfigMap value). */
40
+ readonly text?: string;
41
+ /**
42
+ * The content as the document it would be in a file of its own. Core
43
+ * parses `text` into it (JSON, then YAML) when the host leaves it out.
44
+ * `PrometheusRule` `spec.groups` is offered as `{ groups: [...] }`, the rule
45
+ * file those groups would make.
46
+ */
47
+ readonly document?: unknown;
48
+ /**
49
+ * When the host's value is one member of `document` rather than the whole
50
+ * of it: `"groups"` for `spec.groups`. The reference must then evaluate to
51
+ * `document[select]`. Absent, it evaluates to `text`.
52
+ */
53
+ readonly select?: string;
54
+ /** The host resource's labels, where the host has them. */
55
+ readonly labels?: Readonly<Record<string, string>>;
56
+ /**
57
+ * The lexicon the host expects to own this content, from conventions it
58
+ * knows (a PrometheusRule's groups are Prometheus rules). Only used for the
59
+ * warning when no installed lexicon imports the content.
60
+ */
61
+ readonly expectedOwner?: {
62
+ readonly lexicon: string;
63
+ readonly what: string;
64
+ };
65
+ }
66
+ /** A declaration the host's value is built from. */
67
+ export interface EmbeddedBinding {
68
+ /** A package (`@intentius/chant-lexicon-otel`) or the path of one of the import's `files`. */
69
+ readonly from: string;
70
+ /** The exported name. */
71
+ readonly name: string;
72
+ /** A member of it the value uses instead, e.g. an `Slo`'s `rules`. */
73
+ readonly member?: string;
74
+ }
75
+ /** How the host's value is built from the imported declarations. */
76
+ export interface EmbeddedValue {
77
+ /** The declarations, in order. */
78
+ readonly bindings: readonly EmbeddedBinding[];
79
+ /** `"list"`: an array of them. `"single"`: the one binding. */
80
+ readonly shape: "list" | "single";
81
+ /** A function the value is passed through, e.g. otel's `collectorYaml`. */
82
+ readonly through?: {
83
+ readonly from: string;
84
+ readonly name: string;
85
+ };
86
+ }
87
+ /** What an owner's importer returns for one piece of content. */
88
+ export interface EmbeddedImport {
89
+ /** The modules declaring the content, at paths relative to their own directory. */
90
+ readonly files: readonly GeneratedFile[];
91
+ readonly value: EmbeddedValue;
92
+ /** What the import read but could not carry. */
93
+ readonly warnings?: readonly string[];
94
+ }
95
+ /** An owner lexicon's declaration that it can import content embedded in another's resources. */
96
+ export interface EmbeddedContentImporter {
97
+ /** What it imports, for messages: `"an OpenTelemetry Collector config"`. */
98
+ readonly what: string;
99
+ /** Whether this content is one it imports. Must not throw on content that is not. */
100
+ matches(content: EmbeddedContent): boolean;
101
+ /** Import it. A throw keeps the content as written, with a warning. */
102
+ import(content: EmbeddedContent): EmbeddedImport;
103
+ }
104
+ /** An importer with the lexicon that registered it. */
105
+ export interface RegisteredEmbeddedImporter {
106
+ readonly lexicon: string;
107
+ readonly importer: EmbeddedContentImporter;
108
+ }
109
+ /**
110
+ * What the host puts in its IR in place of the raw value. Plain data: the
111
+ * bindings' local paths are relative to the import's output directory.
112
+ */
113
+ export interface EmbeddedReference {
114
+ readonly $embedded: {
115
+ readonly lexicon: string;
116
+ readonly what: string;
117
+ readonly location: string;
118
+ readonly value: EmbeddedValue;
119
+ };
120
+ }
121
+ export declare function isEmbeddedReference(value: unknown): value is EmbeddedReference;
122
+ /** What a host's parser is handed to resolve embedded content. */
123
+ export interface EmbeddedContentResolver {
124
+ /** The reference to put in place of the content, or undefined to keep it as written. */
125
+ resolve(content: EmbeddedContent): EmbeddedReference | undefined;
126
+ }
127
+ /** The document a text holds: JSON, or a single YAML document. Undefined for anything else. */
128
+ export declare function embeddedDocument(text: string): unknown;
129
+ /**
130
+ * Resolves embedded content against the importers registered for one
131
+ * import, and collects what the imports produce: the files to write beside
132
+ * the host's and the warnings to print. `offered` lists every piece of
133
+ * content the host offered, claimed or not.
134
+ */
135
+ export declare class EmbeddedImports implements EmbeddedContentResolver {
136
+ private readonly importers;
137
+ private readonly options;
138
+ readonly offered: EmbeddedContent[];
139
+ readonly files: GeneratedFile[];
140
+ readonly warnings: string[];
141
+ private readonly directories;
142
+ /**
143
+ * @param importers what the installed lexicons registered, in the order they are asked
144
+ * @param options.quiet collect `offered` only, with no warnings (a probe before the importers are known)
145
+ */
146
+ constructor(importers?: readonly RegisteredEmbeddedImporter[], options?: {
147
+ quiet?: boolean;
148
+ });
149
+ resolve(offered: EmbeddedContent): EmbeddedReference | undefined;
150
+ private claimDirectory;
151
+ }
152
+ /**
153
+ * The imports one generated module needs for the references it renders.
154
+ * Names are made unique against the module's own declarations: a second
155
+ * `otlp` from another collector's directory is imported as `otlp2`.
156
+ */
157
+ export declare class EmbeddedImportScope {
158
+ private readonly fromDir;
159
+ private readonly taken;
160
+ /** specifier -> exported name -> local name */
161
+ private readonly bySpecifier;
162
+ /**
163
+ * @param fromDir the directory of the module being generated, relative to the output directory (`""` for its top)
164
+ * @param taken names the module already declares or imports
165
+ */
166
+ constructor(fromDir: string, taken?: Iterable<string>);
167
+ /** The local name `name`, exported by `from` (a package or an output-relative path), is used under. */
168
+ bind(from: string, name: string): string;
169
+ /** The import statements, packages first, then local modules, each sorted. */
170
+ lines(): string[];
171
+ private specifier;
172
+ }
173
+ /**
174
+ * The TypeScript expression for a reference, binding its names in `scope`.
175
+ * A list longer than one line is broken one binding per line, indented from
176
+ * `indent` spaces.
177
+ */
178
+ export declare function renderEmbeddedReference(ref: EmbeddedReference, scope: EmbeddedImportScope, indent?: number): string;
179
+ /**
180
+ * The names a generated module exports in its `export { … }` list, for an
181
+ * importer whose generator writes one per module (COR004).
182
+ */
183
+ export declare function exportedNames(content: string): string[];
184
+ //# sourceMappingURL=embedded.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"embedded.d.ts","sourceRoot":"","sources":["../../src/import/embedded.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAIjD,4EAA4E;AAC5E,MAAM,WAAW,eAAe;IAC9B,sCAAsC;IACtC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,+DAA+D;IAC/D,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,6EAA6E;IAC7E,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,iFAAiF;IACjF,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,+EAA+E;IAC/E,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,2DAA2D;IAC3D,QAAQ,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACnD;;;;OAIG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE;QAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CAC9E;AAED,oDAAoD;AACpD,MAAM,WAAW,eAAe;IAC9B,8FAA8F;IAC9F,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,yBAAyB;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,sEAAsE;IACtE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;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AC,SAAS;CAMlB;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,iBAAiB,EAAE,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAI,GAAG,MAAM,CAa9G;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CASvD"}
@@ -16,5 +16,18 @@ export interface TypeScriptGenerator {
16
16
  * @returns Array of generated TypeScript files
17
17
  */
18
18
  generate(ir: TemplateIR): GeneratedFile[];
19
+ /**
20
+ * True when the generator places its own files (#2964). Core then calls
21
+ * `generate()` once with the whole IR and writes exactly the files it
22
+ * returns, at the paths it gives, however many resources the IR holds.
23
+ *
24
+ * Leave it unset for core's default layout: up to three resources are
25
+ * generated in one call, and above three core splits the IR into
26
+ * per-category files (`storage.ts`, `compute.ts`, `network.ts`,
27
+ * `other.ts`) plus an `index.ts` barrel, keeping only the first file of
28
+ * each call. Set it when your resources refer to each other across that
29
+ * split, or when one `generate()` call returns several modules.
30
+ */
31
+ readonly ownsLayout?: boolean;
19
32
  }
20
33
  //# sourceMappingURL=generator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../src/import/generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,EAAE,UAAU,GAAG,aAAa,EAAE,CAAC;CAC3C"}
1
+ {"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../src/import/generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,EAAE,UAAU,GAAG,aAAa,EAAE,CAAC;IAE1C;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;CAC/B"}
@@ -1,3 +1,4 @@
1
+ import type { EmbeddedContentResolver } from "./embedded.js";
1
2
  /**
2
3
  * Intermediate representation of a template parameter
3
4
  */
@@ -58,6 +59,18 @@ export interface TemplateIR {
58
59
  * import surfaces them instead of dropping them silently (#2069). */
59
60
  readonly warnings?: string[];
60
61
  }
62
+ /**
63
+ * What `chant import` hands a parser besides the content (#2962).
64
+ */
65
+ export interface ParseContext {
66
+ /**
67
+ * Resolves content embedded in the template's resources (a collector
68
+ * config in a ConfigMap) to a reference to declarations the owning
69
+ * lexicon imports. Absent outside `chant import`; a parser then keeps
70
+ * embedded content as written.
71
+ */
72
+ readonly embedded?: EmbeddedContentResolver;
73
+ }
61
74
  /**
62
75
  * Interface for template parsers that convert external formats to IR
63
76
  */
@@ -65,8 +78,9 @@ export interface TemplateParser {
65
78
  /**
66
79
  * Parse template content into intermediate representation
67
80
  * @param content - Raw template content (JSON, YAML, etc.)
81
+ * @param context - What `chant import` provides beyond the content; parsers may ignore it
68
82
  * @returns Intermediate representation of the template
69
83
  */
70
- parse(content: string): TemplateIR;
84
+ parse(content: string, context?: ParseContext): TemplateIR;
71
85
  }
72
86
  //# sourceMappingURL=parser.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/import/parser.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ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AW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,oEAAoE;IACpE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,6DAA6D;IAC7D,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAC9B,+DAA+D;IAC/D,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,SAAS,EAAE,UAAU,EAAE,CAAC;IACjC,QAAQ,CAAC,UAAU,EAAE,WAAW,EAAE,CAAC;IACnC,sDAAsD;IACtD,QAAQ,CAAC,UAAU,CAAC,EAAE,WAAW,EAAE,CAAC;IACpC,mDAAmD;IACnD,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,CAAC;IAC9B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC5C;yEACqE;IACrE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CAC9B;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,uBAAuB,CAAC;CAC7C;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;OAKG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;CAC5D"}
package/dist/lexicon.d.ts CHANGED
@@ -5,6 +5,7 @@ import type { RuleSpec } from "./lint/declarative.js";
5
5
  import type { PostSynthCheck } from "./lint/post-synth.js";
6
6
  import type { TemplateParser, TemplateIR } from "./import/parser.js";
7
7
  import type { TypeScriptGenerator } from "./import/generator.js";
8
+ import type { EmbeddedContentImporter } from "./import/embedded.js";
8
9
  import type { AgentConfigImporter } from "./agents/importer.js";
9
10
  import type { ArtifactIntegrity } from "./lexicon-integrity.js";
10
11
  import type { OkfFile } from "./okf.js";
@@ -923,6 +924,14 @@ export interface LexiconPlugin {
923
924
  lintRules?(): LintRule[];
924
925
  /** Return declarative rule specs for compilation via rule() */
925
926
  declarativeRules?(): RuleSpec[];
927
+ /**
928
+ * Class names this lexicon exports whose instances are property-kind
929
+ * declarables (`createProperty`), such as Grafana's panels and queries.
930
+ * The core COR001, COR004 and COR009 heuristics leave them out, since a
931
+ * property-kind declarable lives inside the resource that holds it
932
+ * (chant #2957). A lexicon that leaves this out gets the rules unchanged.
933
+ */
934
+ propertyClassNames?(): string[];
926
935
  /** Return post-synthesis checks for build validation */
927
936
  postSynthChecks?(): PostSynthCheck[];
928
937
  /**
@@ -1018,6 +1027,16 @@ export interface LexiconPlugin {
1018
1027
  templateParser?(): TemplateParser;
1019
1028
  /** Return a generator for converting IR to TypeScript */
1020
1029
  templateGenerator?(): TypeScriptGenerator;
1030
+ /**
1031
+ * Importers for this lexicon's content when it is embedded in another
1032
+ * lexicon's resources (#2962): a collector config in a k8s ConfigMap, rule
1033
+ * groups in a `PrometheusRule`, dashboard JSON in a ConfigMap. The host's
1034
+ * parser offers the content through `ParseContext.embedded`, and core finds
1035
+ * the owner at run time among the project's lexicons and the installed
1036
+ * ones whose `detectTemplate` recognizes the content, so the host does not
1037
+ * depend on the owner. See `packages/core/src/import/embedded.ts`.
1038
+ */
1039
+ embeddedImporters?(): EmbeddedContentImporter[];
1021
1040
  /**
1022
1041
  * Re-express local agent configuration (skills, MCP servers, instruction
1023
1042
  * files) discovered by `chant audit --agents` as this lexicon's resources.