@uicontract/core 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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 UIC Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,48 @@
1
+ # @uicontract/core
2
+
3
+ Core types, schema, validation, logger, and error classes for UIC.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @uicontract/core
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```typescript
14
+ import { type ManifestElement, validateManifest, createLogger, UicError } from '@uicontract/core';
15
+
16
+ // Validate a manifest against the JSON Schema
17
+ const result = validateManifest(manifest);
18
+ if (!result.valid) {
19
+ console.error(result.errors);
20
+ }
21
+
22
+ // Create a structured logger
23
+ const logger = createLogger({ level: 'info' });
24
+ logger.info('Scan complete', { filesScanned: 42 });
25
+
26
+ // Typed errors with code and context
27
+ throw new UicError('MANIFEST_NOT_FOUND', {
28
+ message: 'No manifest.json found. Run "npx uic scan <dir>" first.',
29
+ path: '/my-app',
30
+ });
31
+ ```
32
+
33
+ ## API
34
+
35
+ - **Types**: `ManifestElement`, `RawElement`, `NamedElement`, `ParserPlugin`, `DiscoveryResult`, and more
36
+ - **`validateManifest(manifest)`**: Validates a manifest object against the v1 JSON Schema; returns `{ valid, errors }`
37
+ - **`createLogger(options)`**: Returns a structured logger with `debug`, `info`, `warn`, and `error` methods
38
+ - **`UicError`**: Base error class with `code` and `context` properties for all UIC packages
39
+
40
+ All shared types and interfaces live here. Framework-specific packages (`@uicontract/parser-react`, `@uicontract/parser-vue`) and the naming/annotation layers all depend on this package.
41
+
42
+ ## Part of UIC
43
+
44
+ This package is part of [UIC (UI Contracts)](https://github.com/sherifkozman/uicontract) — making web app UIs machine-readable.
45
+
46
+ ## License
47
+
48
+ [MIT](../../LICENSE)
@@ -0,0 +1,26 @@
1
+ /**
2
+ * UIC configuration loader and validator.
3
+ *
4
+ * Looks for `.uicrc.json` in the given directory and its parents,
5
+ * returning a typed UicConfig. Returns defaults when no file is found.
6
+ */
7
+ export interface UicConfig {
8
+ /** ID prefixes that require explicit approval to change */
9
+ protectedScopes: string[];
10
+ /** How to handle breaking changes: "block" exits non-zero, "warn" prints warning but exits 0 */
11
+ breakingChangePolicy: 'block' | 'warn';
12
+ /** npm package names implementing the Parser interface to load at startup */
13
+ plugins: string[];
14
+ }
15
+ export declare const DEFAULT_CONFIG: UicConfig;
16
+ /**
17
+ * Validate an unknown value as a UicConfig. Throws on invalid shape.
18
+ */
19
+ export declare function validateConfig(raw: unknown): UicConfig;
20
+ /**
21
+ * Load UIC configuration from `.uicrc.json` in `dir` or its parents.
22
+ * Returns `DEFAULT_CONFIG` when no config file is found.
23
+ * Throws `UicError` on invalid JSON or invalid shape.
24
+ */
25
+ export declare function loadConfig(dir: string): Promise<UicConfig>;
26
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAUH,MAAM,WAAW,SAAS;IACxB,2DAA2D;IAC3D,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,gGAAgG;IAChG,oBAAoB,EAAE,OAAO,GAAG,MAAM,CAAC;IACvC,6EAA6E;IAC7E,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,eAAO,MAAM,cAAc,EAAE,SAI5B,CAAC;AAYF;;GAEG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,GAAG,SAAS,CAkEtD;AA+BD;;;;GAIG;AACH,wBAAsB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CA4BhE"}
package/dist/config.js ADDED
@@ -0,0 +1,142 @@
1
+ /**
2
+ * UIC configuration loader and validator.
3
+ *
4
+ * Looks for `.uicrc.json` in the given directory and its parents,
5
+ * returning a typed UicConfig. Returns defaults when no file is found.
6
+ */
7
+ import * as fs from 'node:fs/promises';
8
+ import * as path from 'node:path';
9
+ import { UicError } from './errors.js';
10
+ export const DEFAULT_CONFIG = {
11
+ protectedScopes: [],
12
+ breakingChangePolicy: 'block',
13
+ plugins: [],
14
+ };
15
+ const CONFIG_FILENAME = '.uicrc.json';
16
+ // ---------------------------------------------------------------------------
17
+ // Validation helpers
18
+ // ---------------------------------------------------------------------------
19
+ function isRecord(value) {
20
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
21
+ }
22
+ /**
23
+ * Validate an unknown value as a UicConfig. Throws on invalid shape.
24
+ */
25
+ export function validateConfig(raw) {
26
+ if (!isRecord(raw)) {
27
+ throw new UicError('MANIFEST_INVALID', {
28
+ message: 'Invalid .uicrc.json: config must be a JSON object. See docs/CLI.md for the config schema.',
29
+ context: { received: typeof raw },
30
+ });
31
+ }
32
+ const config = { ...DEFAULT_CONFIG };
33
+ // protectedScopes
34
+ if ('protectedScopes' in raw) {
35
+ if (!Array.isArray(raw['protectedScopes'])) {
36
+ throw new UicError('MANIFEST_INVALID', {
37
+ message: 'Invalid .uicrc.json: "protectedScopes" must be an array of strings. Example: ["settings.billing"]',
38
+ context: { received: typeof raw['protectedScopes'] },
39
+ });
40
+ }
41
+ for (let i = 0; i < raw['protectedScopes'].length; i++) {
42
+ const item = raw['protectedScopes'][i];
43
+ if (typeof item !== 'string') {
44
+ throw new UicError('MANIFEST_INVALID', {
45
+ message: `Invalid .uicrc.json: "protectedScopes[${String(i)}]" must be a string, got ${typeof item}.`,
46
+ context: { index: i, received: typeof item },
47
+ });
48
+ }
49
+ }
50
+ config.protectedScopes = raw['protectedScopes'];
51
+ }
52
+ // plugins
53
+ if ('plugins' in raw) {
54
+ if (!Array.isArray(raw['plugins'])) {
55
+ throw new UicError('MANIFEST_INVALID', {
56
+ message: 'Invalid .uicrc.json: "plugins" must be an array of strings. Example: ["uic-parser-svelte"]',
57
+ context: { received: typeof raw['plugins'] },
58
+ });
59
+ }
60
+ for (let i = 0; i < raw['plugins'].length; i++) {
61
+ const item = raw['plugins'][i];
62
+ if (typeof item !== 'string') {
63
+ throw new UicError('MANIFEST_INVALID', {
64
+ message: `Invalid .uicrc.json: "plugins[${String(i)}]" must be a string, got ${typeof item}.`,
65
+ context: { index: i, received: typeof item },
66
+ });
67
+ }
68
+ }
69
+ config.plugins = raw['plugins'];
70
+ }
71
+ // breakingChangePolicy
72
+ if ('breakingChangePolicy' in raw) {
73
+ if (raw['breakingChangePolicy'] !== 'block' && raw['breakingChangePolicy'] !== 'warn') {
74
+ throw new UicError('MANIFEST_INVALID', {
75
+ message: 'Invalid .uicrc.json: "breakingChangePolicy" must be "block" or "warn".',
76
+ context: { received: raw['breakingChangePolicy'] },
77
+ });
78
+ }
79
+ config.breakingChangePolicy = raw['breakingChangePolicy'];
80
+ }
81
+ return config;
82
+ }
83
+ // ---------------------------------------------------------------------------
84
+ // Loader
85
+ // ---------------------------------------------------------------------------
86
+ /**
87
+ * Walk up from `dir` looking for `.uicrc.json`.
88
+ * Returns `null` if none found.
89
+ */
90
+ async function findConfigFile(dir) {
91
+ let current = path.resolve(dir);
92
+ for (;;) {
93
+ const candidate = path.join(current, CONFIG_FILENAME);
94
+ try {
95
+ await fs.access(candidate);
96
+ return candidate;
97
+ }
98
+ catch {
99
+ // not found — go up
100
+ }
101
+ const parent = path.dirname(current);
102
+ if (parent === current) {
103
+ // reached filesystem root
104
+ return null;
105
+ }
106
+ current = parent;
107
+ }
108
+ }
109
+ /**
110
+ * Load UIC configuration from `.uicrc.json` in `dir` or its parents.
111
+ * Returns `DEFAULT_CONFIG` when no config file is found.
112
+ * Throws `UicError` on invalid JSON or invalid shape.
113
+ */
114
+ export async function loadConfig(dir) {
115
+ const configPath = await findConfigFile(dir);
116
+ if (configPath === null) {
117
+ return { ...DEFAULT_CONFIG };
118
+ }
119
+ let raw;
120
+ try {
121
+ raw = await fs.readFile(configPath, 'utf-8');
122
+ }
123
+ catch (err) {
124
+ throw new UicError('FILE_READ_ERROR', {
125
+ message: `Failed to read config file "${configPath}". Check permissions and try again.`,
126
+ context: { configPath },
127
+ cause: err instanceof Error ? err : undefined,
128
+ });
129
+ }
130
+ let parsed;
131
+ try {
132
+ parsed = JSON.parse(raw);
133
+ }
134
+ catch {
135
+ throw new UicError('MANIFEST_INVALID', {
136
+ message: `Failed to parse "${configPath}" as JSON. Ensure it contains valid JSON.`,
137
+ context: { configPath },
138
+ });
139
+ }
140
+ return validateConfig(parsed);
141
+ }
142
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AA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AE,GAAG,cAAc,EAAE,CAAC;IAC/B,CAAC;IAED,IAAI,GAAW,CAAC;IAChB,IAAI,CAAC;QACH,GAAG,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,QAAQ,CAAC,iBAAiB,EAAE;YACpC,OAAO,EAAE,+BAA+B,UAAU,qCAAqC;YACvF,OAAO,EAAE,EAAE,UAAU,EAAE;YACvB,KAAK,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS;SAC9C,CAAC,CAAC;IACL,CAAC;IAED,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAY,CAAC;IACtC,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,QAAQ,CAAC,kBAAkB,EAAE;YACrC,OAAO,EAAE,oBAAoB,UAAU,2CAA2C;YAClF,OAAO,EAAE,EAAE,UAAU,EAAE;SACxB,CAAC,CAAC;IACL,CAAC;IAED,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC;AAChC,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Error types for the UIC system.
3
+ */
4
+ /** All known error codes */
5
+ export type UicErrorCode = 'MANIFEST_NOT_FOUND' | 'MANIFEST_INVALID' | 'MANIFEST_VERSION_UNSUPPORTED' | 'DUPLICATE_AGENT_ID' | 'PARSER_NOT_FOUND' | 'PARSER_DUPLICATE' | 'SCAN_FAILED' | 'FILE_READ_ERROR' | 'FILE_WRITE_ERROR' | 'ANNOTATION_FAILED' | 'NAMING_FAILED' | 'UNKNOWN';
6
+ /** Options for constructing a UicError */
7
+ interface UicErrorOptions {
8
+ message: string;
9
+ context?: Record<string, unknown>;
10
+ cause?: Error;
11
+ }
12
+ /** Base error class with structured code and context */
13
+ export declare class UicError extends Error {
14
+ readonly code: UicErrorCode;
15
+ readonly context: Record<string, unknown>;
16
+ constructor(code: UicErrorCode, options: UicErrorOptions);
17
+ }
18
+ export {};
19
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,4BAA4B;AAC5B,MAAM,MAAM,YAAY,GACpB,oBAAoB,GACpB,kBAAkB,GAClB,8BAA8B,GAC9B,oBAAoB,GACpB,kBAAkB,GAClB,kBAAkB,GAClB,aAAa,GACb,iBAAiB,GACjB,kBAAkB,GAClB,mBAAmB,GACnB,eAAe,GACf,SAAS,CAAC;AAEd,0CAA0C;AAC1C,UAAU,eAAe;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED,wDAAwD;AACxD,qBAAa,QAAS,SAAQ,KAAK;IACjC,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBAE9B,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,eAAe;CASzD"}
package/dist/errors.js ADDED
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Error types for the UIC system.
3
+ */
4
+ /** Base error class with structured code and context */
5
+ export class UicError extends Error {
6
+ code;
7
+ context;
8
+ constructor(code, options) {
9
+ super(options.message);
10
+ this.name = 'UicError';
11
+ this.code = code;
12
+ this.context = options.context ?? {};
13
+ if (options.cause) {
14
+ this.cause = options.cause;
15
+ }
16
+ }
17
+ }
18
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAwBH,wDAAwD;AACxD,MAAM,OAAO,QAAS,SAAQ,KAAK;IACxB,IAAI,CAAe;IACnB,OAAO,CAA0B;IAE1C,YAAY,IAAkB,EAAE,OAAwB;QACtD,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC;QACrC,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;YAClB,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAC7B,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @uicontract/core — foundation types and utilities for UIC.
3
+ */
4
+ export declare const VERSION = "0.0.0";
5
+ export type { InteractiveElementType, RawElement, NamedElement, ManifestElement, Manifest, ParserOptions, ParserWarning, DiscoveryResult, Parser, } from './types.js';
6
+ export { UicError } from './errors.js';
7
+ export type { UicErrorCode } from './errors.js';
8
+ export { createLogger, LOG_LEVELS } from './logger.js';
9
+ export type { LogLevel, Logger } from './logger.js';
10
+ export { validateManifest, buildManifest, serializeManifest, deserializeManifest, } from './schema/manifest.js';
11
+ export type { ValidationError, ValidationResult } from './schema/manifest.js';
12
+ export { ParserRegistry, parserRegistry } from './parser-registry.js';
13
+ export { loadConfig, validateConfig, DEFAULT_CONFIG } from './config.js';
14
+ export type { UicConfig } from './config.js';
15
+ export { loadPlugins } from './plugin-loader.js';
16
+ export type { PluginLoadResult } from './plugin-loader.js';
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,OAAO,UAAU,CAAC;AAG/B,YAAY,EACV,sBAAsB,EACtB,UAAU,EACV,YAAY,EACZ,eAAe,EACf,QAAQ,EACR,aAAa,EACb,aAAa,EACb,eAAe,EACf,MAAM,GACP,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGhD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACvD,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGpD,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAG9E,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGtE,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACzE,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAG7C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,YAAY,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @uicontract/core — foundation types and utilities for UIC.
3
+ */
4
+ export const VERSION = '0.0.0';
5
+ // Errors
6
+ export { UicError } from './errors.js';
7
+ // Logger
8
+ export { createLogger, LOG_LEVELS } from './logger.js';
9
+ // Schema / Manifest
10
+ export { validateManifest, buildManifest, serializeManifest, deserializeManifest, } from './schema/manifest.js';
11
+ // Parser Registry
12
+ export { ParserRegistry, parserRegistry } from './parser-registry.js';
13
+ // Config
14
+ export { loadConfig, validateConfig, DEFAULT_CONFIG } from './config.js';
15
+ // Plugin Loader
16
+ export { loadPlugins } from './plugin-loader.js';
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC;AAe/B,SAAS;AACT,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGvC,SAAS;AACT,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGvD,oBAAoB;AACpB,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,sBAAsB,CAAC;AAG9B,kBAAkB;AAClB,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtE,SAAS;AACT,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGzE,gBAAgB;AAChB,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Structured logger for the UIC system.
3
+ * All output goes to stderr (never stdout).
4
+ */
5
+ export type LogLevel = 'debug' | 'info' | 'warn' | 'error';
6
+ export interface Logger {
7
+ debug(message: string, context?: Record<string, unknown>): void;
8
+ info(message: string, context?: Record<string, unknown>): void;
9
+ warn(message: string, context?: Record<string, unknown>): void;
10
+ error(message: string, context?: Record<string, unknown>): void;
11
+ }
12
+ /** Numeric ordering of log levels for filtering */
13
+ export declare const LOG_LEVELS: Record<LogLevel, number>;
14
+ interface CreateLoggerOptions {
15
+ level?: LogLevel;
16
+ prefix?: string;
17
+ }
18
+ /**
19
+ * Creates a structured logger that writes to stderr.
20
+ *
21
+ * Default level: 'warn'. Use --verbose for 'debug', --quiet for 'error'.
22
+ */
23
+ export declare function createLogger(options?: CreateLoggerOptions): Logger;
24
+ export {};
25
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAE3D,MAAM,WAAW,MAAM;IACrB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAChE,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC/D,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC/D,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;CACjE;AAED,mDAAmD;AACnD,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAK/C,CAAC;AAEF,UAAU,mBAAmB;IAC3B,KAAK,CAAC,EAAE,QAAQ,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,OAAO,CAAC,EAAE,mBAAmB,GAAG,MAAM,CA8ClE"}
package/dist/logger.js ADDED
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Structured logger for the UIC system.
3
+ * All output goes to stderr (never stdout).
4
+ */
5
+ /** Numeric ordering of log levels for filtering */
6
+ export const LOG_LEVELS = {
7
+ debug: 0,
8
+ info: 1,
9
+ warn: 2,
10
+ error: 3,
11
+ };
12
+ /**
13
+ * Creates a structured logger that writes to stderr.
14
+ *
15
+ * Default level: 'warn'. Use --verbose for 'debug', --quiet for 'error'.
16
+ */
17
+ export function createLogger(options) {
18
+ const level = options?.level ?? 'warn';
19
+ const prefix = options?.prefix ?? 'UIC';
20
+ const threshold = LOG_LEVELS[level];
21
+ function shouldLog(msgLevel) {
22
+ return LOG_LEVELS[msgLevel] >= threshold;
23
+ }
24
+ function formatContext(context) {
25
+ if (!context || Object.keys(context).length === 0) {
26
+ return '';
27
+ }
28
+ return ' ' + JSON.stringify(context);
29
+ }
30
+ function write(msgLevel, message, context) {
31
+ if (!shouldLog(msgLevel)) {
32
+ return;
33
+ }
34
+ const tag = msgLevel.toUpperCase();
35
+ const contextStr = formatContext(context);
36
+ if (level === 'debug') {
37
+ const timestamp = new Date().toISOString();
38
+ process.stderr.write(`[${prefix}] [${tag}] ${timestamp} ${message}${contextStr}\n`);
39
+ }
40
+ else {
41
+ process.stderr.write(`[${prefix}] [${tag}] ${message}${contextStr}\n`);
42
+ }
43
+ }
44
+ return {
45
+ debug(message, context) {
46
+ write('debug', message, context);
47
+ },
48
+ info(message, context) {
49
+ write('info', message, context);
50
+ },
51
+ warn(message, context) {
52
+ write('warn', message, context);
53
+ },
54
+ error(message, context) {
55
+ write('error', message, context);
56
+ },
57
+ };
58
+ }
59
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH,mDAAmD;AACnD,MAAM,CAAC,MAAM,UAAU,GAA6B;IAClD,KAAK,EAAE,CAAC;IACR,IAAI,EAAE,CAAC;IACP,IAAI,EAAE,CAAC;IACP,KAAK,EAAE,CAAC;CACT,CAAC;AAOF;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,OAA6B;IACxD,MAAM,KAAK,GAAG,OAAO,EAAE,KAAK,IAAI,MAAM,CAAC;IACvC,MAAM,MAAM,GAAG,OAAO,EAAE,MAAM,IAAI,KAAK,CAAC;IACxC,MAAM,SAAS,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;IAEpC,SAAS,SAAS,CAAC,QAAkB;QACnC,OAAO,UAAU,CAAC,QAAQ,CAAC,IAAI,SAAS,CAAC;IAC3C,CAAC;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AAE,OAAiC;YACtD,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QACnC,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Registry for framework parsers.
3
+ * Parsers register themselves; the CLI uses the registry to detect and discover.
4
+ */
5
+ import type { Parser } from './types.js';
6
+ /** Registry that holds framework parsers and supports detection. */
7
+ export declare class ParserRegistry {
8
+ private readonly parsers;
9
+ /** Register a parser. Throws if a parser for the same framework is already registered. */
10
+ register(parser: Parser): void;
11
+ /** Get a parser by framework name. */
12
+ get(framework: string): Parser | undefined;
13
+ /** Try each registered parser's detect() and return the first match. */
14
+ detect(dir: string): Promise<Parser | undefined>;
15
+ /** Get all registered parsers. */
16
+ getAll(): readonly Parser[];
17
+ }
18
+ /** Singleton parser registry instance. */
19
+ export declare const parserRegistry: ParserRegistry;
20
+ //# sourceMappingURL=parser-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser-registry.d.ts","sourceRoot":"","sources":["../src/parser-registry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAGzC,oEAAoE;AACpE,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA6B;IAErD,0FAA0F;IAC1F,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAU9B,sCAAsC;IACtC,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAI1C,wEAAwE;IAClE,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAUtD,kCAAkC;IAClC,MAAM,IAAI,SAAS,MAAM,EAAE;CAG5B;AAED,0CAA0C;AAC1C,eAAO,MAAM,cAAc,gBAAuB,CAAC"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Registry for framework parsers.
3
+ * Parsers register themselves; the CLI uses the registry to detect and discover.
4
+ */
5
+ import { UicError } from './errors.js';
6
+ /** Registry that holds framework parsers and supports detection. */
7
+ export class ParserRegistry {
8
+ parsers = new Map();
9
+ /** Register a parser. Throws if a parser for the same framework is already registered. */
10
+ register(parser) {
11
+ if (this.parsers.has(parser.framework)) {
12
+ throw new UicError('PARSER_DUPLICATE', {
13
+ message: `A parser for framework "${parser.framework}" is already registered. Each framework can only have one parser.`,
14
+ context: { framework: parser.framework },
15
+ });
16
+ }
17
+ this.parsers.set(parser.framework, parser);
18
+ }
19
+ /** Get a parser by framework name. */
20
+ get(framework) {
21
+ return this.parsers.get(framework);
22
+ }
23
+ /** Try each registered parser's detect() and return the first match. */
24
+ async detect(dir) {
25
+ for (const parser of this.parsers.values()) {
26
+ const detected = await parser.detect(dir);
27
+ if (detected) {
28
+ return parser;
29
+ }
30
+ }
31
+ return undefined;
32
+ }
33
+ /** Get all registered parsers. */
34
+ getAll() {
35
+ return Array.from(this.parsers.values());
36
+ }
37
+ }
38
+ /** Singleton parser registry instance. */
39
+ export const parserRegistry = new ParserRegistry();
40
+ //# sourceMappingURL=parser-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser-registry.js","sourceRoot":"","sources":["../src/parser-registry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,oEAAoE;AACpE,MAAM,OAAO,cAAc;IACR,OAAO,GAAG,IAAI,GAAG,EAAkB,CAAC;IAErD,0FAA0F;IAC1F,QAAQ,CAAC,MAAc;QACrB,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC;YACvC,MAAM,IAAI,QAAQ,CAAC,kBAAkB,EAAE;gBACrC,OAAO,EAAE,2BAA2B,MAAM,CAAC,SAAS,mEAAmE;gBACvH,OAAO,EAAE,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE;aACzC,CAAC,CAAC;QACL,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IAC7C,CAAC;IAED,sCAAsC;IACtC,GAAG,CAAC,SAAiB;QACnB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IACrC,CAAC;IAED,wEAAwE;IACxE,KAAK,CAAC,MAAM,CAAC,GAAW;QACtB,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;YAC3C,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC1C,IAAI,QAAQ,EAAE,CAAC;gBACb,OAAO,MAAM,CAAC;YAChB,CAAC;QACH,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,kCAAkC;IAClC,MAAM;QACJ,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC3C,CAAC;CACF;AAED,0CAA0C;AAC1C,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,cAAc,EAAE,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Plugin loader for third-party UIC parsers.
3
+ *
4
+ * Dynamically imports npm packages listed in `.uicrc.json` `plugins` and
5
+ * registers them into the ParserRegistry. Invalid or missing plugins are
6
+ * warned about but do not throw.
7
+ */
8
+ import type { Logger } from './logger.js';
9
+ import { ParserRegistry } from './parser-registry.js';
10
+ /** Result of loading plugins — which succeeded and which failed. */
11
+ export interface PluginLoadResult {
12
+ loaded: string[];
13
+ failed: string[];
14
+ }
15
+ /**
16
+ * Dynamically import each plugin and register its Parser into the registry.
17
+ *
18
+ * Plugins are npm package names that export a Parser object. The loader tries
19
+ * several export patterns:
20
+ *
21
+ * 1. Default export is a Parser
22
+ * 2. Named `parser` export is a Parser
23
+ * 3. Module object itself is a Parser (CommonJS default)
24
+ *
25
+ * Invalid or missing plugins are logged as warnings and added to `failed`.
26
+ */
27
+ export declare function loadPlugins(pluginNames: string[], registry: ParserRegistry, logger: Logger): Promise<PluginLoadResult>;
28
+ //# sourceMappingURL=plugin-loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-loader.d.ts","sourceRoot":"","sources":["../src/plugin-loader.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAqBtD,oEAAoE;AACpE,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,WAAW,CAC/B,WAAW,EAAE,MAAM,EAAE,EACrB,QAAQ,EAAE,cAAc,EACxB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,gBAAgB,CAAC,CA4E3B"}
@@ -0,0 +1,100 @@
1
+ /**
2
+ * Plugin loader for third-party UIC parsers.
3
+ *
4
+ * Dynamically imports npm packages listed in `.uicrc.json` `plugins` and
5
+ * registers them into the ParserRegistry. Invalid or missing plugins are
6
+ * warned about but do not throw.
7
+ */
8
+ import { UicError } from './errors.js';
9
+ // ---------------------------------------------------------------------------
10
+ // Validation
11
+ // ---------------------------------------------------------------------------
12
+ function isParser(value) {
13
+ if (typeof value !== 'object' || value === null)
14
+ return false;
15
+ const obj = value;
16
+ return (typeof obj['framework'] === 'string' &&
17
+ typeof obj['detect'] === 'function' &&
18
+ typeof obj['discover'] === 'function');
19
+ }
20
+ /**
21
+ * Dynamically import each plugin and register its Parser into the registry.
22
+ *
23
+ * Plugins are npm package names that export a Parser object. The loader tries
24
+ * several export patterns:
25
+ *
26
+ * 1. Default export is a Parser
27
+ * 2. Named `parser` export is a Parser
28
+ * 3. Module object itself is a Parser (CommonJS default)
29
+ *
30
+ * Invalid or missing plugins are logged as warnings and added to `failed`.
31
+ */
32
+ export async function loadPlugins(pluginNames, registry, logger) {
33
+ const loaded = [];
34
+ const failed = [];
35
+ for (const name of pluginNames) {
36
+ try {
37
+ const mod = await import(name);
38
+ // Resolve the Parser from common export patterns
39
+ let parser;
40
+ // Try default export first
41
+ if (typeof mod === 'object' && mod !== null && 'default' in mod) {
42
+ const defaultExport = mod['default'];
43
+ if (isParser(defaultExport)) {
44
+ parser = defaultExport;
45
+ }
46
+ }
47
+ // Try named `parser` export
48
+ if (!parser && typeof mod === 'object' && mod !== null && 'parser' in mod) {
49
+ const namedExport = mod['parser'];
50
+ if (isParser(namedExport)) {
51
+ parser = namedExport;
52
+ }
53
+ }
54
+ // Try module itself (CommonJS pattern).
55
+ // Wrapped in try/catch because some module systems (including test mocks)
56
+ // throw on property access for exports not defined in the module.
57
+ if (!parser) {
58
+ try {
59
+ if (isParser(mod)) {
60
+ parser = mod;
61
+ }
62
+ }
63
+ catch {
64
+ // Property access threw — module is not a valid Parser
65
+ }
66
+ }
67
+ if (!isParser(parser)) {
68
+ logger.warn(`Plugin "${name}" does not export a valid Parser. ` +
69
+ `Expected an object with { framework: string, detect: Function, discover: Function }.`);
70
+ failed.push(name);
71
+ continue;
72
+ }
73
+ try {
74
+ registry.register(parser);
75
+ loaded.push(name);
76
+ logger.debug(`Loaded plugin "${name}" (framework: ${parser.framework})`);
77
+ }
78
+ catch (err) {
79
+ if (err instanceof UicError && err.code === 'PARSER_DUPLICATE') {
80
+ logger.warn(`Plugin "${name}" skipped: parser for framework "${parser.framework}" already registered.`);
81
+ failed.push(name);
82
+ }
83
+ else {
84
+ throw err;
85
+ }
86
+ }
87
+ }
88
+ catch (err) {
89
+ // Re-throw UicError (from registry internals), catch everything else
90
+ if (err instanceof UicError)
91
+ throw err;
92
+ const message = err instanceof Error ? err.message : String(err);
93
+ logger.warn(`Failed to load plugin "${name}": ${message}. ` +
94
+ `Ensure it is installed: pnpm add ${name}`);
95
+ failed.push(name);
96
+ }
97
+ }
98
+ return { loaded, failed };
99
+ }
100
+ //# sourceMappingURL=plugin-loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-loader.js","sourceRoot":"","sources":["../src/plugin-loader.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,8EAA8E;AAC9E,aAAa;AACb,8EAA8E;AAE9E,SAAS,QAAQ,CAAC,KAAc;IAC9B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAC9D,MAAM,GAAG,GAAG,KAAgC,CAAC;IAC7C,OAAO,CACL,OAAO,GAAG,CAAC,WAAW,CAAC,KAAK,QAAQ;QACpC,OAAO,GAAG,CAAC,QAAQ,CAAC,KAAK,UAAU;QACnC,OAAO,GAAG,CAAC,UAAU,CAAC,KAAK,UAAU,CACtC,CAAC;AACJ,CAAC;AAYD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,WAAqB,EACrB,QAAwB,EACxB,MAAc;IAEd,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,MAAM,MAAM,GAAa,EAAE,CAAC;IAE5B,KAAK,MAAM,IAAI,IAAI,WAAW,EAAE,CAAC;QAC/B,IAAI,CAAC;YACH,MAAM,GAAG,GAAY,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC;YAExC,iDAAiD;YACjD,IAAI,MAAe,CAAC;YAEpB,2BAA2B;YAC3B,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,IAAI,SAAS,IAAI,GAAG,EAAE,CAAC;gBAChE,MAAM,aAAa,GAAI,GAA+B,CAAC,SAAS,CAAC,CAAC;gBAClE,IAAI,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC;oBAC5B,MAAM,GA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F,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBACpB,CAAC;qBAAM,CAAC;oBACN,MAAM,GAAG,CAAC;gBACZ,CAAC;YACH,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,qEAAqE;YACrE,IAAI,GAAG,YAAY,QAAQ;gBAAE,MAAM,GAAG,CAAC;YACvC,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACjE,MAAM,CAAC,IAAI,CACT,0BAA0B,IAAI,MAAM,OAAO,IAAI;gBAC7C,oCAAoC,IAAI,EAAE,CAC7C,CAAC;YACF,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACpB,CAAC;IACH,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAC5B,CAAC"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Manifest validation, building, and serialization.
3
+ *
4
+ * Validation is implemented manually (no ajv/JSON Schema library)
5
+ * to keep runtime dependencies at zero.
6
+ */
7
+ import type { Manifest, NamedElement } from '../types.js';
8
+ /** A single validation error */
9
+ export interface ValidationError {
10
+ path: string;
11
+ code: string;
12
+ message: string;
13
+ }
14
+ /** Result of validating a manifest */
15
+ export interface ValidationResult {
16
+ valid: boolean;
17
+ errors: ValidationError[];
18
+ }
19
+ /** Validate a manifest object against the v1 schema. */
20
+ export declare function validateManifest(manifest: unknown): ValidationResult;
21
+ /** Build a manifest from named elements and metadata. */
22
+ export declare function buildManifest(options: {
23
+ elements: NamedElement[];
24
+ framework: string;
25
+ projectRoot: string;
26
+ filesScanned: number;
27
+ warnings: number;
28
+ generatorVersion: string;
29
+ }): Manifest;
30
+ /** Serialize a manifest to a pretty-printed JSON string. */
31
+ export declare function serializeManifest(manifest: Manifest): string;
32
+ /** Deserialize a JSON string to a manifest, validating it in the process. */
33
+ export declare function deserializeManifest(json: string): Manifest;
34
+ //# sourceMappingURL=manifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/schema/manifest.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAmB,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3E,gCAAgC;AAChC,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,sCAAsC;AACtC,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,eAAe,EAAE,CAAC;CAC3B;AAwID,wDAAwD;AACxD,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,OAAO,GAAG,gBAAgB,CAiJpE;AAED,yDAAyD;AACzD,wBAAgB,aAAa,CAAC,OAAO,EAAE;IACrC,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;CAC1B,GAAG,QAAQ,CAsBX;AAED,4DAA4D;AAC5D,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAE5D;AAED,6EAA6E;AAC7E,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAmB1D"}
@@ -0,0 +1,317 @@
1
+ /**
2
+ * Manifest validation, building, and serialization.
3
+ *
4
+ * Validation is implemented manually (no ajv/JSON Schema library)
5
+ * to keep runtime dependencies at zero.
6
+ */
7
+ const SCHEMA_VERSION_PATTERN = /^\d+\.\d+$/;
8
+ const AGENT_ID_PATTERN = /^[a-z][a-z0-9.-]*$/;
9
+ function isRecord(value) {
10
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
11
+ }
12
+ function isStringOrNull(value) {
13
+ return value === null || typeof value === 'string';
14
+ }
15
+ function validateElement(element, index, errors) {
16
+ const prefix = `elements[${String(index)}]`;
17
+ if (!isRecord(element)) {
18
+ errors.push({
19
+ path: prefix,
20
+ code: 'INVALID_TYPE',
21
+ message: `Element at index ${String(index)} must be an object.`,
22
+ });
23
+ return;
24
+ }
25
+ // agentId
26
+ if (typeof element['agentId'] !== 'string') {
27
+ errors.push({
28
+ path: `${prefix}.agentId`,
29
+ code: 'REQUIRED_FIELD',
30
+ message: 'agentId is required and must be a string.',
31
+ });
32
+ }
33
+ else if (element['agentId'].length === 0) {
34
+ errors.push({
35
+ path: `${prefix}.agentId`,
36
+ code: 'EMPTY_AGENT_ID',
37
+ message: 'agentId must not be empty.',
38
+ });
39
+ }
40
+ else if (!AGENT_ID_PATTERN.test(element['agentId'])) {
41
+ errors.push({
42
+ path: `${prefix}.agentId`,
43
+ code: 'INVALID_AGENT_ID',
44
+ message: `agentId "${element['agentId']}" must match pattern ^[a-z][a-z0-9.-]*$ (lowercase, starts with letter, contains only letters, digits, dots, hyphens).`,
45
+ });
46
+ }
47
+ // type
48
+ if (typeof element['type'] !== 'string' || element['type'].length === 0) {
49
+ errors.push({
50
+ path: `${prefix}.type`,
51
+ code: 'REQUIRED_FIELD',
52
+ message: 'type is required and must be a non-empty string.',
53
+ });
54
+ }
55
+ // filePath
56
+ if (typeof element['filePath'] !== 'string' || element['filePath'].length === 0) {
57
+ errors.push({
58
+ path: `${prefix}.filePath`,
59
+ code: 'REQUIRED_FIELD',
60
+ message: 'filePath is required and must be a non-empty string.',
61
+ });
62
+ }
63
+ // line
64
+ if (typeof element['line'] !== 'number' || !Number.isInteger(element['line']) || element['line'] < 1) {
65
+ errors.push({
66
+ path: `${prefix}.line`,
67
+ code: 'INVALID_TYPE',
68
+ message: 'line must be a positive integer.',
69
+ });
70
+ }
71
+ // column
72
+ if (typeof element['column'] !== 'number' ||
73
+ !Number.isInteger(element['column']) ||
74
+ element['column'] < 1) {
75
+ errors.push({
76
+ path: `${prefix}.column`,
77
+ code: 'INVALID_TYPE',
78
+ message: 'column must be a positive integer.',
79
+ });
80
+ }
81
+ // nullable string fields
82
+ const nullableFields = ['componentName', 'route', 'label', 'handler'];
83
+ for (const field of nullableFields) {
84
+ if (!(field in element)) {
85
+ errors.push({
86
+ path: `${prefix}.${field}`,
87
+ code: 'REQUIRED_FIELD',
88
+ message: `${field} is required (can be null).`,
89
+ });
90
+ }
91
+ else if (!isStringOrNull(element[field])) {
92
+ errors.push({
93
+ path: `${prefix}.${field}`,
94
+ code: 'INVALID_TYPE',
95
+ message: `${field} must be a string or null.`,
96
+ });
97
+ }
98
+ }
99
+ // attributes
100
+ if (!isRecord(element['attributes'])) {
101
+ errors.push({
102
+ path: `${prefix}.attributes`,
103
+ code: 'REQUIRED_FIELD',
104
+ message: 'attributes is required and must be an object.',
105
+ });
106
+ }
107
+ else {
108
+ for (const [key, value] of Object.entries(element['attributes'])) {
109
+ if (typeof value !== 'string') {
110
+ errors.push({
111
+ path: `${prefix}.attributes.${key}`,
112
+ code: 'INVALID_TYPE',
113
+ message: `attributes["${key}"] must be a string.`,
114
+ });
115
+ }
116
+ }
117
+ }
118
+ // boolean fields
119
+ const booleanFields = ['conditional', 'dynamic'];
120
+ for (const field of booleanFields) {
121
+ if (typeof element[field] !== 'boolean') {
122
+ errors.push({
123
+ path: `${prefix}.${field}`,
124
+ code: 'REQUIRED_FIELD',
125
+ message: `${field} is required and must be a boolean.`,
126
+ });
127
+ }
128
+ }
129
+ }
130
+ /** Validate a manifest object against the v1 schema. */
131
+ export function validateManifest(manifest) {
132
+ const errors = [];
133
+ if (!isRecord(manifest)) {
134
+ errors.push({
135
+ path: '',
136
+ code: 'INVALID_TYPE',
137
+ message: 'Manifest must be an object.',
138
+ });
139
+ return { valid: false, errors };
140
+ }
141
+ // schemaVersion
142
+ if (typeof manifest['schemaVersion'] !== 'string') {
143
+ errors.push({
144
+ path: 'schemaVersion',
145
+ code: 'REQUIRED_FIELD',
146
+ message: 'schemaVersion is required and must be a string.',
147
+ });
148
+ }
149
+ else if (!SCHEMA_VERSION_PATTERN.test(manifest['schemaVersion'])) {
150
+ errors.push({
151
+ path: 'schemaVersion',
152
+ code: 'INVALID_FORMAT',
153
+ message: 'schemaVersion must match format "major.minor" (e.g., "1.0").',
154
+ });
155
+ }
156
+ else {
157
+ const major = parseInt(manifest['schemaVersion'].split('.')[0] ?? '0', 10);
158
+ if (major !== 1) {
159
+ errors.push({
160
+ path: 'schemaVersion',
161
+ code: 'VERSION_UNSUPPORTED',
162
+ message: `schemaVersion major version ${String(major)} is not supported. Only version 1.x is supported. Please update @uicontract/core to handle this manifest version.`,
163
+ });
164
+ }
165
+ }
166
+ // generatedAt
167
+ if (typeof manifest['generatedAt'] !== 'string') {
168
+ errors.push({
169
+ path: 'generatedAt',
170
+ code: 'REQUIRED_FIELD',
171
+ message: 'generatedAt is required and must be an ISO 8601 datetime string.',
172
+ });
173
+ }
174
+ // generator
175
+ if (!isRecord(manifest['generator'])) {
176
+ errors.push({
177
+ path: 'generator',
178
+ code: 'REQUIRED_FIELD',
179
+ message: 'generator is required and must be an object with name and version.',
180
+ });
181
+ }
182
+ else {
183
+ if (typeof manifest['generator']['name'] !== 'string' || manifest['generator']['name'].length === 0) {
184
+ errors.push({
185
+ path: 'generator.name',
186
+ code: 'REQUIRED_FIELD',
187
+ message: 'generator.name is required and must be a non-empty string.',
188
+ });
189
+ }
190
+ if (typeof manifest['generator']['version'] !== 'string' || manifest['generator']['version'].length === 0) {
191
+ errors.push({
192
+ path: 'generator.version',
193
+ code: 'REQUIRED_FIELD',
194
+ message: 'generator.version is required and must be a non-empty string.',
195
+ });
196
+ }
197
+ }
198
+ // metadata
199
+ if (!isRecord(manifest['metadata'])) {
200
+ errors.push({
201
+ path: 'metadata',
202
+ code: 'REQUIRED_FIELD',
203
+ message: 'metadata is required and must be an object.',
204
+ });
205
+ }
206
+ else {
207
+ const meta = manifest['metadata'];
208
+ if (typeof meta['framework'] !== 'string' || meta['framework'].length === 0) {
209
+ errors.push({
210
+ path: 'metadata.framework',
211
+ code: 'REQUIRED_FIELD',
212
+ message: 'metadata.framework is required and must be a non-empty string.',
213
+ });
214
+ }
215
+ if (typeof meta['projectRoot'] !== 'string' || meta['projectRoot'].length === 0) {
216
+ errors.push({
217
+ path: 'metadata.projectRoot',
218
+ code: 'REQUIRED_FIELD',
219
+ message: 'metadata.projectRoot is required and must be a non-empty string.',
220
+ });
221
+ }
222
+ if (typeof meta['filesScanned'] !== 'number' || !Number.isInteger(meta['filesScanned'])) {
223
+ errors.push({
224
+ path: 'metadata.filesScanned',
225
+ code: 'INVALID_TYPE',
226
+ message: 'metadata.filesScanned must be an integer.',
227
+ });
228
+ }
229
+ if (typeof meta['elementsDiscovered'] !== 'number' || !Number.isInteger(meta['elementsDiscovered'])) {
230
+ errors.push({
231
+ path: 'metadata.elementsDiscovered',
232
+ code: 'INVALID_TYPE',
233
+ message: 'metadata.elementsDiscovered must be an integer.',
234
+ });
235
+ }
236
+ if (typeof meta['warnings'] !== 'number' || !Number.isInteger(meta['warnings'])) {
237
+ errors.push({
238
+ path: 'metadata.warnings',
239
+ code: 'INVALID_TYPE',
240
+ message: 'metadata.warnings must be an integer.',
241
+ });
242
+ }
243
+ }
244
+ // elements
245
+ if (!Array.isArray(manifest['elements'])) {
246
+ errors.push({
247
+ path: 'elements',
248
+ code: 'REQUIRED_FIELD',
249
+ message: 'elements is required and must be an array.',
250
+ });
251
+ }
252
+ else {
253
+ for (let i = 0; i < manifest['elements'].length; i++) {
254
+ validateElement(manifest['elements'][i], i, errors);
255
+ }
256
+ // Check for duplicate agentIds
257
+ const seenIds = new Set();
258
+ for (let i = 0; i < manifest['elements'].length; i++) {
259
+ const el = manifest['elements'][i];
260
+ if (isRecord(el) && typeof el['agentId'] === 'string' && el['agentId'].length > 0) {
261
+ if (seenIds.has(el['agentId'])) {
262
+ errors.push({
263
+ path: `elements[${String(i)}].agentId`,
264
+ code: 'DUPLICATE_AGENT_ID',
265
+ message: `Duplicate agentId "${el['agentId']}". Each element must have a unique agentId.`,
266
+ });
267
+ }
268
+ seenIds.add(el['agentId']);
269
+ }
270
+ }
271
+ }
272
+ return { valid: errors.length === 0, errors };
273
+ }
274
+ /** Build a manifest from named elements and metadata. */
275
+ export function buildManifest(options) {
276
+ const manifestElements = options.elements.map((el) => ({
277
+ ...el,
278
+ attributes: { ...el.attributes },
279
+ }));
280
+ return {
281
+ schemaVersion: '1.0',
282
+ generatedAt: new Date().toISOString(),
283
+ generator: {
284
+ name: '@uicontract/cli',
285
+ version: options.generatorVersion,
286
+ },
287
+ metadata: {
288
+ framework: options.framework,
289
+ projectRoot: options.projectRoot,
290
+ filesScanned: options.filesScanned,
291
+ elementsDiscovered: manifestElements.length,
292
+ warnings: options.warnings,
293
+ },
294
+ elements: manifestElements,
295
+ };
296
+ }
297
+ /** Serialize a manifest to a pretty-printed JSON string. */
298
+ export function serializeManifest(manifest) {
299
+ return JSON.stringify(manifest, null, 2);
300
+ }
301
+ /** Deserialize a JSON string to a manifest, validating it in the process. */
302
+ export function deserializeManifest(json) {
303
+ let parsed;
304
+ try {
305
+ parsed = JSON.parse(json);
306
+ }
307
+ catch {
308
+ throw new Error('Failed to parse manifest JSON. Ensure the file contains valid JSON.');
309
+ }
310
+ const result = validateManifest(parsed);
311
+ if (!result.valid) {
312
+ const details = result.errors.map((e) => ` - ${e.path}: ${e.message}`).join('\n');
313
+ throw new Error(`Invalid manifest:\n${details}\n\nEnsure your manifest matches the v1 schema.`);
314
+ }
315
+ return parsed;
316
+ }
317
+ //# sourceMappingURL=manifest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../src/schema/manifest.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAiBH,MAAM,sBAAsB,GAAG,YAAY,CAAC;AAC5C,MAAM,gBAAgB,GA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B;SAClC;QACD,QAAQ,EAAE;YACR,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,YAAY,EAAE,OAAO,CAAC,YAAY;YAClC,kBAAkB,EAAE,gBAAgB,CAAC,MAAM;YAC3C,QAAQ,EAAE,OAAO,CAAC,QAAQ;SAC3B;QACD,QAAQ,EAAE,gBAAgB;KAC3B,CAAC;AACJ,CAAC;AAED,4DAA4D;AAC5D,MAAM,UAAU,iBAAiB,CAAC,QAAkB;IAClD,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AAC3C,CAAC;AAED,6EAA6E;AAC7E,MAAM,UAAU,mBAAmB,CAAC,IAAY;IAC9C,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAY,CAAC;IACvC,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CACb,qEAAqE,CACtE,CAAC;IACJ,CAAC;IAED,MAAM,MAAM,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACxC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QAClB,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnF,MAAM,IAAI,KAAK,CACb,sBAAsB,OAAO,iDAAiD,CAC/E,CAAC;IACJ,CAAC;IAED,OAAO,MAAkB,CAAC;AAC5B,CAAC"}
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Shared types for the UIC (UI Contracts) system.
3
+ */
4
+ /** Element types discovered by parsers */
5
+ export type InteractiveElementType = 'button' | 'input' | 'select' | 'textarea' | 'a' | 'form' | 'div' | 'span' | 'img' | 'label';
6
+ /** Raw element discovered by parser (before naming) */
7
+ export interface RawElement {
8
+ type: InteractiveElementType;
9
+ filePath: string;
10
+ line: number;
11
+ column: number;
12
+ componentName: string | null;
13
+ route: string | null;
14
+ label: string | null;
15
+ handler: string | null;
16
+ attributes: Record<string, string>;
17
+ conditional: boolean;
18
+ dynamic: boolean;
19
+ }
20
+ /** Named element (after naming engine assigns an agentId) */
21
+ export interface NamedElement extends RawElement {
22
+ agentId: string;
23
+ }
24
+ /** Manifest element (serialized to JSON) — identical to NamedElement by design. */
25
+ export type ManifestElement = NamedElement;
26
+ /** Full manifest structure */
27
+ export interface Manifest {
28
+ schemaVersion: string;
29
+ generatedAt: string;
30
+ generator: {
31
+ name: string;
32
+ version: string;
33
+ };
34
+ metadata: {
35
+ framework: string;
36
+ projectRoot: string;
37
+ filesScanned: number;
38
+ elementsDiscovered: number;
39
+ warnings: number;
40
+ };
41
+ elements: ManifestElement[];
42
+ }
43
+ /** Options for parser discovery */
44
+ export interface ParserOptions {
45
+ include?: string[];
46
+ exclude?: string[];
47
+ maxDepth?: number;
48
+ }
49
+ /** Warning emitted during parsing */
50
+ export interface ParserWarning {
51
+ code: string;
52
+ message: string;
53
+ filePath: string;
54
+ line?: number;
55
+ }
56
+ /** Result of a parser's discover() call */
57
+ export interface DiscoveryResult {
58
+ elements: RawElement[];
59
+ warnings: ParserWarning[];
60
+ metadata: {
61
+ filesScanned: number;
62
+ filesSkipped: number;
63
+ scanDurationMs: number;
64
+ };
65
+ }
66
+ /** Interface that framework parsers must implement */
67
+ export interface Parser {
68
+ readonly framework: string;
69
+ detect(dir: string): Promise<boolean>;
70
+ discover(dir: string, options: ParserOptions): Promise<DiscoveryResult>;
71
+ }
72
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,0CAA0C;AAC1C,MAAM,MAAM,sBAAsB,GAC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C,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,qCAAqC;AACrC,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,2CAA2C;AAC3C,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,UAAU,EAAE,CAAC;IACvB,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,QAAQ,EAAE;QACR,YAAY,EAAE,MAAM,CAAC;QACrB,YAAY,EAAE,MAAM,CAAC;QACrB,cAAc,EAAE,MAAM,CAAC;KACxB,CAAC;CACH;AAED,sDAAsD;AACtD,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACtC,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;CACzE"}
package/dist/types.js ADDED
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Shared types for the UIC (UI Contracts) system.
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG"}
package/package.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "@uicontract/core",
3
+ "version": "0.1.0",
4
+ "description": "Core types, schema, validation, logger, and error classes for UIC",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "author": "UIC Contributors",
8
+ "homepage": "https://github.com/sherifkozman/uicontract/tree/main/packages/core",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/sherifkozman/uicontract.git",
12
+ "directory": "packages/core"
13
+ },
14
+ "bugs": {
15
+ "url": "https://github.com/sherifkozman/uicontract/issues"
16
+ },
17
+ "keywords": [
18
+ "uic",
19
+ "ui-contracts",
20
+ "schema",
21
+ "manifest",
22
+ "agent-id"
23
+ ],
24
+ "engines": {
25
+ "node": ">=20"
26
+ },
27
+ "publishConfig": {
28
+ "access": "public"
29
+ },
30
+ "main": "./dist/index.js",
31
+ "types": "./dist/index.d.ts",
32
+ "exports": {
33
+ ".": {
34
+ "types": "./dist/index.d.ts",
35
+ "import": "./dist/index.js"
36
+ }
37
+ },
38
+ "files": [
39
+ "dist",
40
+ "LICENSE",
41
+ "README.md"
42
+ ],
43
+ "scripts": {
44
+ "build": "tsc -b",
45
+ "test": "vitest run",
46
+ "typecheck": "tsc --noEmit",
47
+ "lint": "eslint src"
48
+ }
49
+ }