|
1 | 1 | // Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license. |
2 | 2 |
|
3 | 3 | import { Args, Command, Flags } from '@oclif/core'; |
| 4 | +import { existsSync, readFileSync } from 'node:fs'; |
| 5 | +import { join } from 'node:path'; |
4 | 6 | import chalk from 'chalk'; |
5 | 7 | import { ZodError } from 'zod'; |
6 | 8 | import { ObjectStackDefinitionSchema, normalizeStackInput } from '@objectstack/spec'; |
@@ -170,7 +172,18 @@ export default class Validate extends Command { |
170 | 172 | // time. Parse it now so malformed source fails loudly (ADR-0078) |
171 | 173 | // instead of being stored and breaking only at render. |
172 | 174 | if (!flags.json) printStep('Checking JSX-source pages (ADR-0080)...'); |
173 | | - const jsxFindings = validateJsxPages(result.data as Record<string, unknown>); |
| 175 | + // Optional component manifest (ADR-0080): if the project ships a |
| 176 | + // `sdui.manifest.json` (generated from the registry's public tier), the |
| 177 | + // gate does full component/prop validation; otherwise parse-level. |
| 178 | + let sduiManifest: unknown; |
| 179 | + try { |
| 180 | + const mp = join(process.cwd(), 'sdui.manifest.json'); |
| 181 | + if (existsSync(mp)) sduiManifest = JSON.parse(readFileSync(mp, 'utf8')); |
| 182 | + } catch { /* fall back to parse-level */ } |
| 183 | + const jsxFindings = validateJsxPages( |
| 184 | + result.data as Record<string, unknown>, |
| 185 | + sduiManifest ? { manifest: sduiManifest as never } : {}, |
| 186 | + ); |
174 | 187 | const jsxErrors = jsxFindings.filter((f) => f.severity === 'error'); |
175 | 188 | const jsxWarnings = jsxFindings.filter((f) => f.severity === 'warning'); |
176 | 189 |
|
|
0 commit comments