@luhtech/site-template 0.17.0 → 0.18.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/README.md +4 -13
- package/bin/luhtech-tokens.mjs +5 -38
- package/package.json +2 -13
- package/src/content/loadBrand.ts +3 -46
- package/src/content/loadPage.ts +3 -53
- package/src/content/loadSite.ts +3 -41
- package/src/content/loadTool.ts +3 -53
- package/src/content/_vendored-schema-fallback/capability-claim.schema.json +0 -91
- package/src/content/schemaFetch.ts +0 -70
package/README.md
CHANGED
|
@@ -20,9 +20,10 @@ site with no way to supply one (GTM-L3 G1.4-R, 2026-09-08).
|
|
|
20
20
|
## The contract
|
|
21
21
|
|
|
22
22
|
- **`loadSite(path)`** / **`loadPage(path)`** (`@luhtech/site-template/content`)
|
|
23
|
-
read a JSON
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
read a JSON content instance. They do not validate: since 0.18.0 each site
|
|
24
|
+
repo validates its content in CI against schema-registry with the reusable
|
|
25
|
+
`content-validate.yml` workflow, so this public package fetches and carries
|
|
26
|
+
no schema. `loadTool`, `loadBrand` and `luhtech-tokens` work the same way.
|
|
26
27
|
- **`<SiteLayout site={site} page={page}>`** (`@luhtech/site-template/layouts/SiteLayout.astro`)
|
|
27
28
|
renders nav from `site.nav`, footer from `site.footer.legalLine` +
|
|
28
29
|
`parentHref`, and `<head>` from `page.seo` (title, description, og:\*,
|
|
@@ -106,16 +107,6 @@ site with no way to supply one (GTM-L3 G1.4-R, 2026-09-08).
|
|
|
106
107
|
no MCP access. `kind=method` claims describe design intent regardless of
|
|
107
108
|
status and are reported, never failed.
|
|
108
109
|
|
|
109
|
-
## A known, out-of-scope gap
|
|
110
|
-
|
|
111
|
-
`content/capability-claim.schema.json` 404s at both its bare and
|
|
112
|
-
version-pinned live URLs (a schema-registry publish-pipeline issue, not
|
|
113
|
-
something this package can fix). `loadPage`'s validator falls back to a
|
|
114
|
-
vendored local copy (`src/content/_vendored-schema-fallback/`, fetched from
|
|
115
|
-
the real schema-registry source, not fabricated) only for this one schema,
|
|
116
|
-
and logs a warning when it does. Every other schema fetch failure is a hard
|
|
117
|
-
error.
|
|
118
|
-
|
|
119
110
|
## Article sections, table of contents, linkable blocks
|
|
120
111
|
|
|
121
112
|
Added in 0.4.0 (d-2026-09-08-sr-article-venture-site-bridge), the schema-first
|
package/bin/luhtech-tokens.mjs
CHANGED
|
@@ -6,23 +6,15 @@
|
|
|
6
6
|
* same real logic, generalized to take instance/output paths as CLI args
|
|
7
7
|
* instead of assuming one repo's directory layout.
|
|
8
8
|
*
|
|
9
|
+
* The instance is validated in the site repo's CI (schema-registry
|
|
10
|
+
* content-validate.yml), not here.
|
|
11
|
+
*
|
|
9
12
|
* Usage:
|
|
10
13
|
* luhtech-tokens <path-to-brand-identity.json> <output-css-path>
|
|
11
14
|
* luhtech-tokens content/brand/ectropy.json src/styles/tokens.generated.css
|
|
12
15
|
*/
|
|
13
16
|
import { readFileSync, writeFileSync, mkdirSync } from 'node:fs';
|
|
14
17
|
import { dirname, resolve } from 'node:path';
|
|
15
|
-
import Ajv from 'ajv';
|
|
16
|
-
import addFormats from 'ajv-formats';
|
|
17
|
-
|
|
18
|
-
const SCHEMA_BASE = 'https://schemas.luh.tech';
|
|
19
|
-
const SCHEMA_REFS = [
|
|
20
|
-
'portfolio/brand-identity.schema.json',
|
|
21
|
-
'_enums/luhtech-enums.schema.v2.json',
|
|
22
|
-
'_enums/venture.enum.json',
|
|
23
|
-
'_definitions/definitions.schema.json',
|
|
24
|
-
'_definitions/graph.schema.json',
|
|
25
|
-
];
|
|
26
18
|
|
|
27
19
|
const [, , instanceArg, outputArg] = process.argv;
|
|
28
20
|
if (!instanceArg || !outputArg) {
|
|
@@ -32,15 +24,6 @@ if (!instanceArg || !outputArg) {
|
|
|
32
24
|
const instancePath = resolve(process.cwd(), instanceArg);
|
|
33
25
|
const outputPath = resolve(process.cwd(), outputArg);
|
|
34
26
|
|
|
35
|
-
async function fetchSchema(rel) {
|
|
36
|
-
const url = `${SCHEMA_BASE}/${rel}`;
|
|
37
|
-
const res = await fetch(url);
|
|
38
|
-
if (!res.ok) {
|
|
39
|
-
throw new Error(`Failed to fetch canonical schema ${url}: HTTP ${res.status}.`);
|
|
40
|
-
}
|
|
41
|
-
return res.json();
|
|
42
|
-
}
|
|
43
|
-
|
|
44
27
|
function readInstance(path) {
|
|
45
28
|
let raw;
|
|
46
29
|
try {
|
|
@@ -78,26 +61,10 @@ ${color.accent.secondary ? ` --color-accent-secondary: ${cssColor(color.accent.
|
|
|
78
61
|
}
|
|
79
62
|
|
|
80
63
|
async function main() {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
const [brandIdentitySchema, ...refs] = await Promise.all(SCHEMA_REFS.map(fetchSchema));
|
|
85
|
-
for (const ref of refs) {
|
|
86
|
-
ajv.addSchema(ref);
|
|
87
|
-
}
|
|
88
|
-
const validate = ajv.compile(brandIdentitySchema);
|
|
89
|
-
|
|
64
|
+
// The brand instance is validated in the site repo's CI against
|
|
65
|
+
// schema-registry (content-validate.yml); this public package fetches no schema.
|
|
90
66
|
const brand = readInstance(instancePath);
|
|
91
67
|
|
|
92
|
-
if (!validate(brand)) {
|
|
93
|
-
const detail = (validate.errors ?? [])
|
|
94
|
-
.map((e) => `${e.instancePath || '(root)'}: ${e.message}`)
|
|
95
|
-
.join('; ');
|
|
96
|
-
throw new Error(
|
|
97
|
-
`${instancePath} failed validation against portfolio/brand-identity.schema.json: ${detail}`
|
|
98
|
-
);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
68
|
const css = generateCss(brand);
|
|
102
69
|
mkdirSync(dirname(outputPath), { recursive: true });
|
|
103
70
|
writeFileSync(outputPath, css, 'utf-8');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luhtech/site-template",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"description": "Shared Astro component library + content-instance contract for LuhTech venture marketing sites -- one template renders every site from content/page.schema.json + content/site.schema.json instances.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -46,17 +46,6 @@
|
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@lucide/astro": "^1.42.0",
|
|
49
|
-
"@resvg/resvg-js": "^2.6.2"
|
|
50
|
-
"ajv": "^8.17.1",
|
|
51
|
-
"ajv-formats": "^3.0.1"
|
|
52
|
-
},
|
|
53
|
-
"luhtech": {
|
|
54
|
-
"schemaPins": {
|
|
55
|
-
"content/page.schema.json": "2.5.0",
|
|
56
|
-
"content/site.schema.json": "1.4.0",
|
|
57
|
-
"content/capability-claim.schema.json": "0.2.0",
|
|
58
|
-
"content/tool.schema.json": "1.2.0",
|
|
59
|
-
"portfolio/brand-identity.schema.json": "1.5.0"
|
|
60
|
-
}
|
|
49
|
+
"@resvg/resvg-js": "^2.6.2"
|
|
61
50
|
}
|
|
62
51
|
}
|
package/src/content/loadBrand.ts
CHANGED
|
@@ -1,34 +1,4 @@
|
|
|
1
1
|
import { readFileSync } from 'node:fs';
|
|
2
|
-
import Ajv from 'ajv';
|
|
3
|
-
import addFormats from 'ajv-formats';
|
|
4
|
-
import { fetchSchema, fetchSupportSchema } from './schemaFetch.js';
|
|
5
|
-
|
|
6
|
-
// 1.5.0: voice.lexicon spellings/glosses/prohibitedPatterns and surface-scoped
|
|
7
|
-
// prohibited items (additive -- every 1.3.0 instance validates unchanged).
|
|
8
|
-
const BRAND_PIN = '1.5.0';
|
|
9
|
-
|
|
10
|
-
let validatorPromise: ReturnType<typeof buildValidator> | null = null;
|
|
11
|
-
|
|
12
|
-
async function buildValidator() {
|
|
13
|
-
const ajv = new Ajv({ strict: false, allErrors: true });
|
|
14
|
-
addFormats(ajv);
|
|
15
|
-
|
|
16
|
-
const [brandSchema, definitionsSchema, graphSchema, ventureEnum, luhtechEnums] =
|
|
17
|
-
await Promise.all([
|
|
18
|
-
fetchSchema('portfolio/brand-identity.schema.json', BRAND_PIN),
|
|
19
|
-
fetchSupportSchema('_definitions/definitions.schema.json'),
|
|
20
|
-
fetchSupportSchema('_definitions/graph.schema.json'),
|
|
21
|
-
fetchSupportSchema('_enums/venture.enum.json'),
|
|
22
|
-
fetchSupportSchema('_enums/luhtech-enums.schema.v2.json'),
|
|
23
|
-
]);
|
|
24
|
-
|
|
25
|
-
ajv.addSchema(definitionsSchema as object);
|
|
26
|
-
ajv.addSchema(graphSchema as object);
|
|
27
|
-
ajv.addSchema(ventureEnum as object);
|
|
28
|
-
ajv.addSchema(luhtechEnums as object);
|
|
29
|
-
|
|
30
|
-
return ajv.compile(brandSchema as object);
|
|
31
|
-
}
|
|
32
2
|
|
|
33
3
|
export interface LoadedBrand {
|
|
34
4
|
brandId: string;
|
|
@@ -37,26 +7,13 @@ export interface LoadedBrand {
|
|
|
37
7
|
}
|
|
38
8
|
|
|
39
9
|
/**
|
|
40
|
-
* Reads a portfolio/brand-identity.schema.json instance from disk
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* returning an unvalidated instance.
|
|
10
|
+
* Reads a portfolio/brand-identity.schema.json instance from disk. The instance is validated in the
|
|
11
|
+
* site repo's CI against schema-registry (schema-registry content-validate.yml),
|
|
12
|
+
* not here: this public package fetches and carries no schema.
|
|
44
13
|
*/
|
|
45
14
|
export async function loadBrand(path: string): Promise<LoadedBrand> {
|
|
46
15
|
const raw = readFileSync(path, 'utf-8');
|
|
47
16
|
const instance = JSON.parse(raw);
|
|
48
17
|
|
|
49
|
-
if (!validatorPromise) validatorPromise = buildValidator();
|
|
50
|
-
const validate = await validatorPromise;
|
|
51
|
-
|
|
52
|
-
if (!validate(instance)) {
|
|
53
|
-
const errors = (validate.errors ?? [])
|
|
54
|
-
.map((e) => ` ${e.instancePath || '/'} ${e.message}`)
|
|
55
|
-
.join('\n');
|
|
56
|
-
throw new Error(
|
|
57
|
-
`${path} failed portfolio/brand-identity.schema.json@${BRAND_PIN} validation:\n${errors}`
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
18
|
return instance as LoadedBrand;
|
|
62
19
|
}
|
package/src/content/loadPage.ts
CHANGED
|
@@ -1,41 +1,4 @@
|
|
|
1
1
|
import { readFileSync } from 'node:fs';
|
|
2
|
-
import Ajv from 'ajv';
|
|
3
|
-
import addFormats from 'ajv-formats';
|
|
4
|
-
import { fetchSchema, fetchSupportSchema } from './schemaFetch.js';
|
|
5
|
-
|
|
6
|
-
const PAGE_PIN = '2.5.0';
|
|
7
|
-
const CAPABILITY_CLAIM_PIN = '0.2.0';
|
|
8
|
-
|
|
9
|
-
let validatorPromise: ReturnType<typeof buildValidator> | null = null;
|
|
10
|
-
|
|
11
|
-
async function buildValidator() {
|
|
12
|
-
const ajv = new Ajv({ strict: false, allErrors: true });
|
|
13
|
-
addFormats(ajv);
|
|
14
|
-
|
|
15
|
-
const [pageSchema, capabilityClaimSchema, cellSchema, definitionsSchema, graphSchema, ventureEnum, contentSpineSchema] =
|
|
16
|
-
await Promise.all([
|
|
17
|
-
fetchSchema('content/page.schema.json', PAGE_PIN),
|
|
18
|
-
fetchSchema('content/capability-claim.schema.json', CAPABILITY_CLAIM_PIN),
|
|
19
|
-
fetchSupportSchema('_definitions/cell.schema.json'),
|
|
20
|
-
fetchSupportSchema('_definitions/definitions.schema.json'),
|
|
21
|
-
fetchSupportSchema('_definitions/graph.schema.json'),
|
|
22
|
-
fetchSupportSchema('_enums/venture.enum.json'),
|
|
23
|
-
// page.schema.json v2.0.0 (content-spine adoption) $refs this for
|
|
24
|
-
// publishRecordRefs/themeRefs/strategyRef/producedBy -- missing here
|
|
25
|
-
// until now because PAGE_PIN itself couldn't move past v1.4.0 (see
|
|
26
|
-
// this same PR's own PAGE_PIN fix) to ever need it.
|
|
27
|
-
fetchSupportSchema('_definitions/content-spine.schema.json'),
|
|
28
|
-
]);
|
|
29
|
-
|
|
30
|
-
ajv.addSchema(capabilityClaimSchema as object);
|
|
31
|
-
ajv.addSchema(cellSchema as object);
|
|
32
|
-
ajv.addSchema(definitionsSchema as object);
|
|
33
|
-
ajv.addSchema(graphSchema as object);
|
|
34
|
-
ajv.addSchema(ventureEnum as object);
|
|
35
|
-
ajv.addSchema(contentSpineSchema as object);
|
|
36
|
-
|
|
37
|
-
return ajv.compile(pageSchema as object);
|
|
38
|
-
}
|
|
39
2
|
|
|
40
3
|
export interface PageBlock {
|
|
41
4
|
blockType: string;
|
|
@@ -111,26 +74,13 @@ export interface LoadedPage {
|
|
|
111
74
|
}
|
|
112
75
|
|
|
113
76
|
/**
|
|
114
|
-
* Reads a content/page.schema.json instance from disk
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
* and continue with an unvalidated instance.
|
|
77
|
+
* Reads a content/page.schema.json instance from disk. The instance is validated in the
|
|
78
|
+
* site repo's CI against schema-registry (schema-registry content-validate.yml),
|
|
79
|
+
* not here: this public package fetches and carries no schema.
|
|
118
80
|
*/
|
|
119
81
|
export async function loadPage(path: string): Promise<LoadedPage> {
|
|
120
82
|
const raw = readFileSync(path, 'utf-8');
|
|
121
83
|
const instance = JSON.parse(raw);
|
|
122
84
|
|
|
123
|
-
if (!validatorPromise) validatorPromise = buildValidator();
|
|
124
|
-
const validate = await validatorPromise;
|
|
125
|
-
|
|
126
|
-
if (!validate(instance)) {
|
|
127
|
-
const errors = (validate.errors ?? [])
|
|
128
|
-
.map((e) => ` ${e.instancePath || '/'} ${e.message}`)
|
|
129
|
-
.join('\n');
|
|
130
|
-
throw new Error(
|
|
131
|
-
`${path} failed content/page.schema.json@${PAGE_PIN} validation:\n${errors}`
|
|
132
|
-
);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
85
|
return instance as LoadedPage;
|
|
136
86
|
}
|
package/src/content/loadSite.ts
CHANGED
|
@@ -1,55 +1,17 @@
|
|
|
1
1
|
import { readFileSync } from 'node:fs';
|
|
2
|
-
import Ajv from 'ajv';
|
|
3
|
-
import addFormats from 'ajv-formats';
|
|
4
|
-
import { fetchSchema, fetchSupportSchema } from './schemaFetch.js';
|
|
5
|
-
|
|
6
|
-
const SITE_PIN = '1.4.0';
|
|
7
|
-
|
|
8
|
-
let validatorPromise: ReturnType<typeof buildValidator> | null = null;
|
|
9
|
-
|
|
10
|
-
async function buildValidator() {
|
|
11
|
-
const ajv = new Ajv({ strict: false, allErrors: true });
|
|
12
|
-
addFormats(ajv);
|
|
13
|
-
|
|
14
|
-
const [siteSchema, definitionsSchema, graphSchema, ventureEnum] = await Promise.all([
|
|
15
|
-
fetchSchema('content/site.schema.json', SITE_PIN),
|
|
16
|
-
fetchSupportSchema('_definitions/definitions.schema.json'),
|
|
17
|
-
fetchSupportSchema('_definitions/graph.schema.json'),
|
|
18
|
-
fetchSupportSchema('_enums/venture.enum.json'),
|
|
19
|
-
]);
|
|
20
|
-
|
|
21
|
-
ajv.addSchema(definitionsSchema as object);
|
|
22
|
-
ajv.addSchema(graphSchema as object);
|
|
23
|
-
ajv.addSchema(ventureEnum as object);
|
|
24
|
-
|
|
25
|
-
return ajv.compile(siteSchema as object);
|
|
26
|
-
}
|
|
27
2
|
|
|
28
3
|
export interface LoadedSite {
|
|
29
4
|
[key: string]: unknown;
|
|
30
5
|
}
|
|
31
6
|
|
|
32
7
|
/**
|
|
33
|
-
* Reads a content/site.schema.json instance from disk
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* and continue with an unvalidated instance.
|
|
8
|
+
* Reads a content/site.schema.json instance from disk. The instance is validated in the
|
|
9
|
+
* site repo's CI against schema-registry (schema-registry content-validate.yml),
|
|
10
|
+
* not here: this public package fetches and carries no schema.
|
|
37
11
|
*/
|
|
38
12
|
export async function loadSite(path: string): Promise<LoadedSite> {
|
|
39
13
|
const raw = readFileSync(path, 'utf-8');
|
|
40
14
|
const instance = JSON.parse(raw);
|
|
41
15
|
|
|
42
|
-
if (!validatorPromise) validatorPromise = buildValidator();
|
|
43
|
-
const validate = await validatorPromise;
|
|
44
|
-
|
|
45
|
-
if (!validate(instance)) {
|
|
46
|
-
const errors = (validate.errors ?? [])
|
|
47
|
-
.map((e) => ` ${e.instancePath || '/'} ${e.message}`)
|
|
48
|
-
.join('\n');
|
|
49
|
-
throw new Error(
|
|
50
|
-
`${path} failed content/site.schema.json@${SITE_PIN} validation:\n${errors}`
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
16
|
return instance as LoadedSite;
|
|
55
17
|
}
|
package/src/content/loadTool.ts
CHANGED
|
@@ -1,42 +1,4 @@
|
|
|
1
1
|
import { readFileSync } from 'node:fs';
|
|
2
|
-
import Ajv from 'ajv';
|
|
3
|
-
import addFormats from 'ajv-formats';
|
|
4
|
-
import { fetchSchema, fetchSupportSchema } from './schemaFetch.js';
|
|
5
|
-
|
|
6
|
-
const TOOL_PIN = '1.2.0';
|
|
7
|
-
const CAPABILITY_CLAIM_PIN = '0.2.0';
|
|
8
|
-
|
|
9
|
-
let validatorPromise: ReturnType<typeof buildValidator> | null = null;
|
|
10
|
-
|
|
11
|
-
async function buildValidator() {
|
|
12
|
-
const ajv = new Ajv({ strict: false, allErrors: true });
|
|
13
|
-
addFormats(ajv);
|
|
14
|
-
|
|
15
|
-
// tool.schema.json 1.2.0 adopts the content spine (cell refs, themes,
|
|
16
|
-
// strategy) and forbids audit-paint field names, so its $ref chain now
|
|
17
|
-
// reaches cell, content-spine (which itself $refs capability-claim) and
|
|
18
|
-
// forbidden-audit-paint-names -- found building LuhTech-Business's /tools/
|
|
19
|
-
// route against the 1.2.0 pin, which failed "can't resolve reference".
|
|
20
|
-
const [toolSchema, capabilityClaimSchema, definitionsSchema, graphSchema, cellSchema, contentSpineSchema, forbiddenNamesSchema] =
|
|
21
|
-
await Promise.all([
|
|
22
|
-
fetchSchema('content/tool.schema.json', TOOL_PIN),
|
|
23
|
-
fetchSchema('content/capability-claim.schema.json', CAPABILITY_CLAIM_PIN),
|
|
24
|
-
fetchSupportSchema('_definitions/definitions.schema.json'),
|
|
25
|
-
fetchSupportSchema('_definitions/graph.schema.json'),
|
|
26
|
-
fetchSupportSchema('_definitions/cell.schema.json'),
|
|
27
|
-
fetchSupportSchema('_definitions/content-spine.schema.json'),
|
|
28
|
-
fetchSupportSchema('_definitions/forbidden-audit-paint-names.schema.json'),
|
|
29
|
-
]);
|
|
30
|
-
|
|
31
|
-
ajv.addSchema(capabilityClaimSchema as object);
|
|
32
|
-
ajv.addSchema(definitionsSchema as object);
|
|
33
|
-
ajv.addSchema(graphSchema as object);
|
|
34
|
-
ajv.addSchema(cellSchema as object);
|
|
35
|
-
ajv.addSchema(contentSpineSchema as object);
|
|
36
|
-
ajv.addSchema(forbiddenNamesSchema as object);
|
|
37
|
-
|
|
38
|
-
return ajv.compile(toolSchema as object);
|
|
39
|
-
}
|
|
40
2
|
|
|
41
3
|
export interface ToolFieldSpec {
|
|
42
4
|
id: string;
|
|
@@ -80,25 +42,13 @@ export interface LoadedTool {
|
|
|
80
42
|
}
|
|
81
43
|
|
|
82
44
|
/**
|
|
83
|
-
* Reads a content/tool.schema.json instance from disk
|
|
84
|
-
*
|
|
85
|
-
*
|
|
45
|
+
* Reads a content/tool.schema.json instance from disk. The instance is validated in the
|
|
46
|
+
* site repo's CI against schema-registry (schema-registry content-validate.yml),
|
|
47
|
+
* not here: this public package fetches and carries no schema.
|
|
86
48
|
*/
|
|
87
49
|
export async function loadTool(path: string): Promise<LoadedTool> {
|
|
88
50
|
const raw = readFileSync(path, 'utf-8');
|
|
89
51
|
const instance = JSON.parse(raw);
|
|
90
52
|
|
|
91
|
-
if (!validatorPromise) validatorPromise = buildValidator();
|
|
92
|
-
const validate = await validatorPromise;
|
|
93
|
-
|
|
94
|
-
if (!validate(instance)) {
|
|
95
|
-
const errors = (validate.errors ?? [])
|
|
96
|
-
.map((e) => ` ${e.instancePath || '/'} ${e.message}`)
|
|
97
|
-
.join('\n');
|
|
98
|
-
throw new Error(
|
|
99
|
-
`${path} failed content/tool.schema.json@${TOOL_PIN} validation:\n${errors}`
|
|
100
|
-
);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
53
|
return instance as LoadedTool;
|
|
104
54
|
}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
-
"$id": "https://schemas.luh.tech/content/capability-claim.schema.json",
|
|
4
|
-
"title": "Capability Claim",
|
|
5
|
-
"version": "0.2.0",
|
|
6
|
-
"description": "A statement about what the platform does, carried by any rendered surface. Marked method or built. A claim marked built must resolve to a register entry; one that does not fails CI. Reconciled with content/article.schema.json's older, distinct claim shape (v2.0.0): article's own claims now $ref this schema rather than an embedded, incompatible definition. kind and sourcedStatus are different axes, not restated forms of each other -- kind names WHAT TYPE of statement this is (method: how the system works; built: this exists and runs), sourcedStatus names WHAT MATURITY the referenced feature has reached, per its real register entry. Widening kind's two values down into sourcedStatus's four (or vice versa) would lose a real distinction either schema already depends on, so both fields coexist.",
|
|
7
|
-
"type": "object",
|
|
8
|
-
"additionalProperties": false,
|
|
9
|
-
"required": [
|
|
10
|
-
"claimId",
|
|
11
|
-
"kind",
|
|
12
|
-
"text"
|
|
13
|
-
],
|
|
14
|
-
"properties": {
|
|
15
|
-
"claimId": {
|
|
16
|
-
"type": "string",
|
|
17
|
-
"pattern": "^[a-z][a-z0-9-]*$"
|
|
18
|
-
},
|
|
19
|
-
"kind": {
|
|
20
|
-
"type": "string",
|
|
21
|
-
"enum": [
|
|
22
|
-
"method",
|
|
23
|
-
"built"
|
|
24
|
-
],
|
|
25
|
-
"description": "method: this is how the model works. built: this exists and runs today."
|
|
26
|
-
},
|
|
27
|
-
"text": {
|
|
28
|
-
"type": "string",
|
|
29
|
-
"minLength": 1
|
|
30
|
-
},
|
|
31
|
-
"featureRef": {
|
|
32
|
-
"type": [
|
|
33
|
-
"string",
|
|
34
|
-
"null"
|
|
35
|
-
],
|
|
36
|
-
"pattern": "^urn:luhtech:[a-z][a-z0-9-]*:feature:[a-z0-9-]+$",
|
|
37
|
-
"description": "Required when kind is built. The register entry the claim resolves to."
|
|
38
|
-
},
|
|
39
|
-
"sourcedStatus": {
|
|
40
|
-
"type": [
|
|
41
|
-
"string",
|
|
42
|
-
"null"
|
|
43
|
-
],
|
|
44
|
-
"enum": [
|
|
45
|
-
"operational",
|
|
46
|
-
"partial",
|
|
47
|
-
"planned",
|
|
48
|
-
"concept",
|
|
49
|
-
null
|
|
50
|
-
],
|
|
51
|
-
"description": "Optional graduated maturity, matching content/article.schema.json's original claim vocabulary. Independent of kind -- a method claim can be sourcedStatus:concept (describes an approach not yet built at all) just as easily as a built claim can be sourcedStatus:partial (exists, not complete). Absent when the claim doesn't need finer graduation than kind alone provides (e.g. a claim mechanically derived from a single roadmap feature's status field, per the pipeline that emits content/deck-record.schema.json instances)."
|
|
52
|
-
},
|
|
53
|
-
"observedAt": {
|
|
54
|
-
"type": [
|
|
55
|
-
"string",
|
|
56
|
-
"null"
|
|
57
|
-
],
|
|
58
|
-
"format": "date"
|
|
59
|
-
},
|
|
60
|
-
"note": {
|
|
61
|
-
"type": [
|
|
62
|
-
"string",
|
|
63
|
-
"null"
|
|
64
|
-
]
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
"allOf": [
|
|
68
|
-
{
|
|
69
|
-
"if": {
|
|
70
|
-
"properties": {
|
|
71
|
-
"kind": {
|
|
72
|
-
"const": "built"
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
"required": [
|
|
76
|
-
"kind"
|
|
77
|
-
]
|
|
78
|
-
},
|
|
79
|
-
"then": {
|
|
80
|
-
"required": [
|
|
81
|
-
"featureRef"
|
|
82
|
-
],
|
|
83
|
-
"properties": {
|
|
84
|
-
"featureRef": {
|
|
85
|
-
"type": "string"
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
]
|
|
91
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
// Fetches the live, version-pinned schemas this package validates against.
|
|
2
|
-
// Pins live in package.json's luhtech.schemaPins -- the immutable
|
|
3
|
-
// https://schemas.luh.tech/v/{version}/{path} convention (d-2026-08-28-eb-
|
|
4
|
-
// versioned-schema-serving), not the floating "latest" alias, so a schema
|
|
5
|
-
// change upstream never silently changes what an already-shipped site
|
|
6
|
-
// build validates against.
|
|
7
|
-
//
|
|
8
|
-
// content/capability-claim.schema.json is a known, flagged gap: it 404s at
|
|
9
|
-
// both its bare and versioned live URLs (a schema-registry publish-pipeline
|
|
10
|
-
// issue, out of scope for this package -- see the site-template README).
|
|
11
|
-
// This loader falls back to a vendored local copy for that one schema only,
|
|
12
|
-
// fetched from the real schema-registry source (not fabricated), and never
|
|
13
|
-
// silently swallows a 404 for any other schema.
|
|
14
|
-
//
|
|
15
|
-
// The fallback is a static JSON import, not a runtime readFileSync -- a
|
|
16
|
-
// bundled build (Vite/Rollup, which Astro uses) relocates compiled chunks
|
|
17
|
-
// without knowing to also copy an fs-read sidecar file, producing an ENOENT
|
|
18
|
-
// at build time (found live during the first real consumer build, GTM-L2
|
|
19
|
-
// C3). A static import lets the bundler inline the JSON content itself,
|
|
20
|
-
// sidestepping the asset-copy problem entirely.
|
|
21
|
-
|
|
22
|
-
import capabilityClaimFallback from './_vendored-schema-fallback/capability-claim.schema.json';
|
|
23
|
-
|
|
24
|
-
const VENDORED_FALLBACK: Record<string, unknown> = {
|
|
25
|
-
'content/capability-claim.schema.json': capabilityClaimFallback,
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const cache = new Map<string, unknown>();
|
|
29
|
-
|
|
30
|
-
export async function fetchSchema(pinnedPath: string, version: string): Promise<unknown> {
|
|
31
|
-
const cacheKey = `${pinnedPath}@${version}`;
|
|
32
|
-
if (cache.has(cacheKey)) return cache.get(cacheKey);
|
|
33
|
-
|
|
34
|
-
const url = `https://schemas.luh.tech/v/${version}/${pinnedPath}`;
|
|
35
|
-
let schema: unknown;
|
|
36
|
-
try {
|
|
37
|
-
const res = await fetch(url);
|
|
38
|
-
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
|
39
|
-
schema = await res.json();
|
|
40
|
-
} catch (err) {
|
|
41
|
-
const fallback = VENDORED_FALLBACK[pinnedPath];
|
|
42
|
-
if (!fallback) {
|
|
43
|
-
throw new Error(
|
|
44
|
-
`Failed to fetch pinned schema ${pinnedPath}@${version} from ${url}: ${(err as Error).message}. ` +
|
|
45
|
-
`No vendored fallback exists for this schema -- this is a real failure, not a known gap.`
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
console.warn(
|
|
49
|
-
`[site-template] ${pinnedPath}@${version} unreachable at ${url} (known publish-pipeline gap) -- using vendored fallback.`
|
|
50
|
-
);
|
|
51
|
-
schema = fallback;
|
|
52
|
-
}
|
|
53
|
-
cache.set(cacheKey, schema);
|
|
54
|
-
return schema;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/** Unversioned support schemas (definitions, enums) the pinned schemas $ref -- these
|
|
58
|
-
* are stable, shared vocabulary, not independently versioned/pinned. */
|
|
59
|
-
export async function fetchSupportSchema(path: string): Promise<unknown> {
|
|
60
|
-
const cacheKey = `support:${path}`;
|
|
61
|
-
if (cache.has(cacheKey)) return cache.get(cacheKey);
|
|
62
|
-
const url = `https://schemas.luh.tech/${path}`;
|
|
63
|
-
const res = await fetch(url);
|
|
64
|
-
if (!res.ok) {
|
|
65
|
-
throw new Error(`Failed to fetch support schema ${path} from ${url}: HTTP ${res.status}`);
|
|
66
|
-
}
|
|
67
|
-
const schema = await res.json();
|
|
68
|
-
cache.set(cacheKey, schema);
|
|
69
|
-
return schema;
|
|
70
|
-
}
|