@kurot/cli 1.0.2 → 1.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.
Files changed (76) hide show
  1. package/CHANGELOG.md +53 -1
  2. package/README.md +41 -11
  3. package/dist/commands/build.d.ts.map +1 -1
  4. package/dist/commands/build.js +49 -10
  5. package/dist/commands/build.js.map +1 -1
  6. package/dist/commands/dev.d.ts.map +1 -1
  7. package/dist/commands/dev.js +19 -5
  8. package/dist/commands/dev.js.map +1 -1
  9. package/dist/core/dev-server.d.ts +9 -0
  10. package/dist/core/dev-server.d.ts.map +1 -1
  11. package/dist/core/dev-server.js +40 -16
  12. package/dist/core/dev-server.js.map +1 -1
  13. package/dist/core/diagnostics/codes.d.ts +21 -0
  14. package/dist/core/diagnostics/codes.d.ts.map +1 -0
  15. package/dist/core/diagnostics/codes.js +25 -0
  16. package/dist/core/diagnostics/codes.js.map +1 -0
  17. package/dist/core/diagnostics/collector.d.ts +28 -0
  18. package/dist/core/diagnostics/collector.d.ts.map +1 -0
  19. package/dist/core/diagnostics/collector.js +78 -0
  20. package/dist/core/diagnostics/collector.js.map +1 -0
  21. package/dist/core/diagnostics/index.d.ts +7 -0
  22. package/dist/core/diagnostics/index.d.ts.map +1 -0
  23. package/dist/core/diagnostics/index.js +4 -0
  24. package/dist/core/diagnostics/index.js.map +1 -0
  25. package/dist/core/diagnostics/output.d.ts +30 -0
  26. package/dist/core/diagnostics/output.d.ts.map +1 -0
  27. package/dist/core/diagnostics/output.js +15 -0
  28. package/dist/core/diagnostics/output.js.map +1 -0
  29. package/dist/core/diagnostics/types.d.ts +30 -0
  30. package/dist/core/diagnostics/types.d.ts.map +1 -0
  31. package/dist/core/diagnostics/types.js +2 -0
  32. package/dist/core/diagnostics/types.js.map +1 -0
  33. package/dist/core/exml/ast.d.ts +9 -1
  34. package/dist/core/exml/ast.d.ts.map +1 -1
  35. package/dist/core/exml/exml-diagnostics.d.ts +7 -0
  36. package/dist/core/exml/exml-diagnostics.d.ts.map +1 -0
  37. package/dist/core/exml/exml-diagnostics.js +26 -0
  38. package/dist/core/exml/exml-diagnostics.js.map +1 -0
  39. package/dist/core/exml/exml-parser.d.ts.map +1 -1
  40. package/dist/core/exml/exml-parser.js +1 -1
  41. package/dist/core/exml/exml-parser.js.map +1 -1
  42. package/dist/core/exml/index.d.ts +5 -3
  43. package/dist/core/exml/index.d.ts.map +1 -1
  44. package/dist/core/exml/index.js +2 -1
  45. package/dist/core/exml/index.js.map +1 -1
  46. package/dist/core/exml/registry.d.ts +7 -0
  47. package/dist/core/exml/registry.d.ts.map +1 -1
  48. package/dist/core/exml/registry.js +41 -0
  49. package/dist/core/exml/registry.js.map +1 -1
  50. package/dist/core/exml/skin-module-builder.d.ts +21 -0
  51. package/dist/core/exml/skin-module-builder.d.ts.map +1 -0
  52. package/dist/core/exml/skin-module-builder.js +103 -0
  53. package/dist/core/exml/skin-module-builder.js.map +1 -0
  54. package/dist/core/exml/source-location.d.ts +25 -0
  55. package/dist/core/exml/source-location.d.ts.map +1 -0
  56. package/dist/core/exml/source-location.js +52 -0
  57. package/dist/core/exml/source-location.js.map +1 -0
  58. package/dist/core/exml/xml-parser.d.ts +15 -0
  59. package/dist/core/exml/xml-parser.d.ts.map +1 -1
  60. package/dist/core/exml/xml-parser.js +13 -7
  61. package/dist/core/exml/xml-parser.js.map +1 -1
  62. package/dist/core/pipeline.d.ts +11 -1
  63. package/dist/core/pipeline.d.ts.map +1 -1
  64. package/dist/core/pipeline.js +9 -0
  65. package/dist/core/pipeline.js.map +1 -1
  66. package/dist/core/plugins/compile-exml.d.ts.map +1 -1
  67. package/dist/core/plugins/compile-exml.js +101 -88
  68. package/dist/core/plugins/compile-exml.js.map +1 -1
  69. package/dist/index.js +8 -1
  70. package/dist/index.js.map +1 -1
  71. package/dist/utils/logger.d.ts +1 -0
  72. package/dist/utils/logger.d.ts.map +1 -1
  73. package/dist/utils/logger.js +14 -5
  74. package/dist/utils/logger.js.map +1 -1
  75. package/package.json +1 -1
  76. package/templates/game/template/web/logo.png +0 -0
package/CHANGELOG.md CHANGED
@@ -5,17 +5,69 @@ All notable changes to `@kurot/cli` are documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
- ## Unreleased
8
+ ## 1.1.0 — 2026-08-13
9
9
 
10
10
  ### Added
11
11
 
12
12
  - Project-owned HTML templates through `html.template`, with explicit placeholders for the import map, entry script, and stage settings.
13
13
  - Editable `template/web/index.html` files in both the `game` and `empty` project templates.
14
+ - A serializable diagnostic model shared by build plugins, with stable codes,
15
+ severity, optional source locations and repair suggestions. Diagnostics are
16
+ deduplicated and sorted deterministically for reliable Agent consumption.
17
+ - Source ranges for EXML elements and attributes, including accurate 1-based
18
+ line and column reporting for unknown component tags across LF and CRLF files.
19
+ - Similar-name suggestions for unknown built-in EXML tags, such as
20
+ `eui:Buton` → `eui:Button`.
21
+ - `--strict` support for `kurot build` and `kurot dev`. Strict policy promotes
22
+ supported recoverable warnings to errors; release builds enable it by default.
23
+ - `kurot build --diagnostics json`, which reserves stdout for one structured
24
+ build result containing success state, mode, duration, output directory and
25
+ diagnostics.
26
+ - `kurot dev --diagnostics jsonl`, which reserves stdout for independent
27
+ `build-start`, `diagnostic`, `build-complete` and `server-ready` events.
28
+ - Stable diagnostics for the following cases:
29
+ - `KUROT_EXML_UNKNOWN_TAG`
30
+ - `KUROT_EXML_COMPILE_FAILED`
31
+ - `KUROT_EXML_DECLARED_FILE_NOT_FOUND`
32
+ - `KUROT_THEME_FILE_NOT_FOUND`
33
+ - `KUROT_THEME_INVALID_JSON`
34
+ - `KUROT_THEME_SKIN_NOT_FOUND`
35
+ - `KUROT_WATCH_RELEASE_IGNORED`
14
36
 
15
37
  ### Changed
16
38
 
17
39
  - The default page centers the game canvas horizontally and vertically.
18
40
  - Development builds clear the previous output before compiling and place shared application chunks under `js/chunks/`.
41
+ - Unknown EXML tags remain warnings in normal development builds, but strict
42
+ and release builds now stop after reporting them with their source location.
43
+ - A missing theme, invalid theme JSON, an absent explicitly declared EXML file,
44
+ and a theme Skin path that was not compiled are now reported as distinct
45
+ conditions instead of being silently collapsed into an empty theme.
46
+ - Invalid theme JSON and genuine Skin compilation failures stop every build.
47
+ Missing inputs that remain recoverable in normal mode emit explicit warnings.
48
+ - Machine-readable modes suppress colored human logs, keeping stdout free of
49
+ ANSI escapes and unstructured text. Failed commands set a non-zero exit code.
50
+
51
+ ### Fixed
52
+
53
+ - Development EXML failures no longer generate empty Skin factories returning
54
+ `{}` and therefore can no longer masquerade as successful compilation.
55
+ - EXML watch rebuilds stage the complete Skin bundle before installation. A
56
+ failed rebuild keeps the last successful bundle and dev server alive; fixing
57
+ the EXML source allows the next rebuild to recover normally.
58
+ - Theme `skins` mappings are checked against the actual compiled EXML set, while
59
+ avoiding duplicate diagnostics when the same path was already reported as a
60
+ missing explicit declaration.
61
+
62
+ ### Tests
63
+
64
+ - Added parser and collector coverage for source locations, strict promotion,
65
+ sorting, deduplication and JSON serialization.
66
+ - Added real CLI process coverage for human output, JSON build success/failure,
67
+ strict unknown-tag failures, malformed EXML, theme errors, JSONL dev startup,
68
+ and failed-watch recovery.
69
+ - Verified that a structured unknown-tag suggestion can be applied and followed
70
+ by a successful strict build with zero diagnostics.
19
71
 
20
72
  ## 1.0.0 — 2026-08-06
21
73
 
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  CLI tool for the Kurot game engine — a modern replacement for the legacy Egret CLI. Powered by esbuild for fast compilation, with a built-in EXML skin parser and code generator.
4
4
 
5
- > Migrating from Egret? See [migration.md](docs/migration.md)
5
+ > Migrating from Egret? See [egret-migration.md](../../docs/egret-migration.md)
6
6
  >
7
7
  > Release history: [CHANGELOG.md](CHANGELOG.md)
8
8
 
@@ -73,12 +73,22 @@ Compile the project into ESM application, engine, namespace, and theme bundles.
73
73
  kurot build [options]
74
74
  ```
75
75
 
76
- | Option | Description | Default |
77
- | --------------- | ------------------------------------------------------ | ------- |
78
- | `-r, --release` | Minified, content-hashed release build (→ bin-release) | `false` |
79
- | `--sourcemap` | Generate sourcemaps | `false` |
80
- | `--watch` | Rebuild source on file changes | `false` |
81
- | `--analyze` | Print bundle size analysis (esbuild metafile) | `false` |
76
+ | Option | Description | Default |
77
+ | ------------------------ | ------------------------------------------------------ | ------- |
78
+ | `-r, --release` | Minified, content-hashed release build (→ bin-release) | `false` |
79
+ | `--sourcemap` | Generate sourcemaps | `false` |
80
+ | `--watch` | Rebuild source on file changes | `false` |
81
+ | `--analyze` | Print bundle size analysis (esbuild metafile) | `false` |
82
+ | `--strict` | Promote supported warnings to build errors | `false` |
83
+ | `--diagnostics <format>` | Diagnostic output: `human` or `json` | `human` |
84
+
85
+ `--diagnostics json` writes exactly one JSON result to stdout. It includes
86
+ `success`, `mode`, `durationMs`, the output directory on success, and all
87
+ structured diagnostics. Release builds use strict diagnostic policy by default.
88
+
89
+ ```bash
90
+ kurot build --strict --diagnostics json
91
+ ```
82
92
 
83
93
  **Output (Egret-aligned shape, ESM under the hood):**
84
94
 
@@ -102,10 +112,23 @@ Start a development server with auto-recompilation on file changes (manual brows
102
112
  kurot dev [options]
103
113
  ```
104
114
 
105
- | Option | Description | Default |
106
- | ------------------- | ------------------- | ------- |
107
- | `-p, --port <port>` | Port to listen | `3000` |
108
- | `--sourcemap` | Generate sourcemaps | `false` |
115
+ | Option | Description | Default |
116
+ | ------------------------ | ------------------------------------------ | ------- |
117
+ | `-p, --port <port>` | Port to listen | `3000` |
118
+ | `--sourcemap` | Generate sourcemaps | `false` |
119
+ | `--strict` | Promote supported warnings to build errors | `false` |
120
+ | `--diagnostics <format>` | Diagnostic output: `human` or `jsonl` | `human` |
121
+
122
+ Unlike build's single JSON result, `kurot dev --diagnostics jsonl` writes one
123
+ JSON event per line so an agent can follow initial builds, diagnostics,
124
+ rebuilds, and server readiness incrementally.
125
+
126
+ ```bash
127
+ kurot dev --strict --diagnostics jsonl
128
+ ```
129
+
130
+ Machine-readable modes reserve stdout for their JSON protocol and never include
131
+ ANSI color sequences. Failures set a non-zero process exit code.
109
132
 
110
133
  ### `kurot clean`
111
134
 
@@ -197,6 +220,13 @@ The CLI includes a complete EXML skin parsing and code generation pipeline (XML
197
220
  - **Skin Properties** — preserves root properties such as `minWidth`, `minHeight`, and state-specific values
198
221
  - **Percent Layout** — auto-detects `width="100%"` and converts to `percentWidth`
199
222
  - **Data Binding** — parses `{expression}` binding syntax and generates `Binding.bindProperty` calls
223
+ - **Structured Diagnostics** — stable codes, source locations, suggestions, and strict warning promotion
224
+
225
+ Unknown tags remain warnings in normal development builds and are omitted from
226
+ the generated visual tree. Under `--strict` (and in release builds), those
227
+ warnings become errors. Syntax errors, invalid theme JSON, and other genuine
228
+ Skin compilation failures always stop the build; the compiler never substitutes
229
+ an empty Skin factory.
200
230
 
201
231
  The standard declarations `xmlns:eui="http://ns.egret.com/eui"` and
202
232
  `xmlns:egret="http://ns.egret.com/egret"` are namespace identifiers. The CLI
@@ -1 +1 @@
1
- {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA0BpC,eAAO,MAAM,YAAY,SAoCtB,CAAC"}
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAoCpC,eAAO,MAAM,YAAY,SAyEtB,CAAC"}
@@ -3,39 +3,78 @@ import { loadProject } from '../core/project.js';
3
3
  import { createContext, runPipeline, disposeContext } from '../core/pipeline.js';
4
4
  import { defaultPlugins } from '../core/plugins/index.js';
5
5
  import { BuildError } from '../core/errors.js';
6
- import { logger } from '../utils/logger.js';
6
+ import { DIAGNOSTIC_CODES, parseBuildDiagnosticsFormat, writeMachineOutput, } from '../core/diagnostics/index.js';
7
+ import { logger, setLoggerEnabled } from '../utils/logger.js';
7
8
  export const buildCommand = new Command('build')
8
9
  .description('Build the project')
9
10
  .option('-r, --release', 'Minified, content-hashed release build (→ bin-release)', false)
10
11
  .option('--sourcemap', 'Generate sourcemaps', false)
11
12
  .option('--watch', 'Rebuild source on file changes', false)
12
13
  .option('--analyze', 'Print esbuild bundle size analysis', false)
14
+ .option('--strict', 'Treat supported warnings as build errors', false)
15
+ .option('--diagnostics <format>', 'Diagnostic output: human or json', 'human')
13
16
  .action(async (options) => {
14
17
  const start = Date.now();
18
+ const format = parseBuildDiagnosticsFormat(options.diagnostics);
19
+ const machine = format === 'json';
20
+ setLoggerEnabled(!machine);
21
+ let ctx;
22
+ let mode = options.release ? 'release' : 'development';
15
23
  try {
16
- const mode = options.release ? 'release' : 'development';
17
24
  if (options.watch && options.release) {
18
25
  logger.warn('--watch is a development workflow; ignoring --release.');
26
+ mode = 'development';
19
27
  }
20
- const project = await loadProject(options.watch ? 'development' : mode);
28
+ const project = await loadProject(mode);
21
29
  logger.info(`Building (${project.mode})...`);
22
- const ctx = createContext(project, {
30
+ const buildCtx = createContext(project, {
23
31
  sourcemap: options.sourcemap,
24
32
  analyze: options.analyze,
25
33
  watch: options.watch,
34
+ strict: options.strict || project.mode === 'release',
26
35
  });
27
- await runPipeline(ctx, defaultPlugins());
36
+ ctx = buildCtx;
37
+ if (options.watch && options.release) {
38
+ buildCtx.diagnostics.report({
39
+ code: DIAGNOSTIC_CODES.WATCH_RELEASE_IGNORED,
40
+ severity: 'warning',
41
+ message: 'Release mode was ignored because --watch uses development mode.',
42
+ });
43
+ }
44
+ await runPipeline(buildCtx, defaultPlugins());
28
45
  if (options.watch) {
29
46
  logger.success('Watching for changes. Press Ctrl+C to stop.');
30
- await waitForShutdown(() => disposeContext(ctx));
31
- return;
47
+ await waitForShutdown(() => disposeContext(buildCtx));
48
+ }
49
+ const durationMs = Date.now() - start;
50
+ logger.success(`Build completed in ${(durationMs / 1000).toFixed(2)}s → ${relativeOut(project.outputDir)}/`);
51
+ if (machine) {
52
+ writeMachineOutput({
53
+ success: true,
54
+ command: 'build',
55
+ mode: project.mode,
56
+ durationMs,
57
+ outputDir: project.outputDir,
58
+ diagnostics: buildCtx.diagnostics.all(),
59
+ });
32
60
  }
33
- const elapsed = ((Date.now() - start) / 1000).toFixed(2);
34
- logger.success(`Build completed in ${elapsed}s → ${relativeOut(project.outputDir)}/`);
35
61
  }
36
62
  catch (err) {
37
63
  const message = err instanceof Error ? err.message : String(err);
38
- throw new BuildError(`Build failed: ${message}`, err instanceof Error ? err : undefined);
64
+ if (!machine) {
65
+ throw new BuildError(`Build failed: ${message}`, err instanceof Error ? err : undefined);
66
+ }
67
+ writeMachineOutput({
68
+ success: false,
69
+ command: 'build',
70
+ mode,
71
+ durationMs: Date.now() - start,
72
+ diagnostics: ctx?.diagnostics.all() ?? [],
73
+ });
74
+ process.exitCode = 1;
75
+ }
76
+ finally {
77
+ setLoggerEnabled(true);
39
78
  }
40
79
  });
41
80
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAqB5C,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC;KAC9C,WAAW,CAAC,mBAAmB,CAAC;KAChC,MAAM,CAAC,eAAe,EAAE,wDAAwD,EAAE,KAAK,CAAC;KACxF,MAAM,CAAC,aAAa,EAAE,qB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ev.d.ts","sourceRoot":"","sources":["../../src/commands/dev.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,eAAO,MAAM,UAAU,SAmBpB,CAAC"}
1
+ {"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/commands/dev.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAcpC,eAAO,MAAM,UAAU,SA8BpB,CAAC"}
@@ -1,25 +1,39 @@
1
1
  import { Command } from 'commander';
2
2
  import { loadProject } from '../core/project.js';
3
3
  import { startDevServer } from '../core/dev-server.js';
4
- import { logger } from '../utils/logger.js';
4
+ import { ConfigError } from '../core/errors.js';
5
+ import { parseDevDiagnosticsFormat, writeMachineOutput } from '../core/diagnostics/index.js';
6
+ import { logger, setLoggerEnabled } from '../utils/logger.js';
5
7
  export const devCommand = new Command('dev')
6
8
  .description('Start a development server with rebuild on change')
7
9
  .option('-p, --port <port>', 'Port to listen on', '3000')
8
10
  .option('--sourcemap', 'Generate sourcemaps', false)
11
+ .option('--strict', 'Treat supported warnings as build errors', false)
12
+ .option('--diagnostics <format>', 'Diagnostic output: human or jsonl', 'human')
9
13
  .action(async (options) => {
14
+ const format = parseDevDiagnosticsFormat(options.diagnostics);
15
+ const machine = format === 'jsonl';
16
+ setLoggerEnabled(!machine);
10
17
  const port = Number.parseInt(options.port, 10);
11
18
  if (!Number.isInteger(port) || port < 1 || port > 65535) {
12
- logger.error(`Invalid port: ${options.port}`);
13
- process.exit(1);
19
+ setLoggerEnabled(true);
20
+ throw new ConfigError(`Invalid port: ${options.port}`);
14
21
  }
15
22
  try {
16
23
  const project = await loadProject('development');
17
24
  logger.info(`Starting dev server on port ${port}...`);
18
- await startDevServer(project, { port, sourcemap: options.sourcemap });
25
+ await startDevServer(project, {
26
+ port,
27
+ sourcemap: options.sourcemap,
28
+ strict: options.strict,
29
+ onEvent: machine ? writeMachineOutput : undefined,
30
+ });
19
31
  }
20
32
  catch (err) {
21
33
  logger.error(`Dev server failed: ${err instanceof Error ? err.message : String(err)}`);
22
- process.exit(1);
34
+ process.exitCode = 1;
35
+ if (machine)
36
+ setLoggerEnabled(true);
23
37
  }
24
38
  });
25
39
  //# sourceMappingURL=dev.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dev.js","sourceRoot":"","sources":["../../src/commands/dev.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,OAAO,CAAC,KAAK,CAAC;KAC1C,WAAW,CAAC,mDAAmD,CAAC;KAChE,MAAM,CAAC,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,CAAC;KACxD,MAAM,CAAC,aAAa,EAAE,qBAAqB,EAAE,KAAK,CAAC;KACnD,MAAM,CAAC,KAAK,EAAE,OAA6C,EAAE,EAAE;IAC/D,MAAM,IAAI,GAAG,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAC/C,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,CAAC,IAAI,IAAI,GAAG,KAAK,EAAE,CAAC;QACzD,MAAM,CAAC,KAAK,CAAC,iBAAiB,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;QAC9C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC;IAED,IAAI,CAAC;QACJ,MAAM,OAAO,GAAG,MAAM,WAAW,CAAC,aAAa,CAAC,CAAC;QACjD,MAAM,CAAC,IAAI,CAAC,+BAA+B,IAAI,KAAK,CAAC,CAAC;QACtD,MAAM,cAAc,CA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,GAAG,MAAM,KAAK,OAAO,CAAC;IACnC,gBAAgB,CAAC,CAAC,OAAO,CAAC,CAAC;IAC3B,MAAM,IAAI,GAAG,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAC/C,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,CAAC,IAAI,IAAI,GAAG,KAAK,EAAE,CAAC;QACzD,gBAAgB,CAAC,IAAI,CAAC,CAAC;QACvB,MAAM,IAAI,WAAW,CAAC,iBAAiB,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IACxD,CAAC;IAED,IAAI,CAAC;QACJ,MAAM,OAAO,GAAG,MAAM,WAAW,CAAC,aAAa,CAAC,CAAC;QACjD,MAAM,CAAC,IAAI,CAAC,+BAA+B,IAAI,KAAK,CAAC,CAAC;QACtD,MAAM,cAAc,CAAC,OAAO,EAAE;YAC7B,IAAI;YACJ,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,SAAS;SACjD,CAAC,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACd,MAAM,CAAC,KAAK,CAAC,sBAAsB,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACvF,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACrB,IAAI,OAAO;YAAE,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;AACF,CAAC,CAAC,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import type { Project } from './project.js';
2
+ import type { DevEvent } from './diagnostics/index.js';
2
3
  export interface DevServerOptions {
3
4
  /**
4
5
  * Port for the dev server to listen on.
@@ -8,6 +9,14 @@ export interface DevServerOptions {
8
9
  * Whether to generate sourcemaps for the app bundle.
9
10
  */
10
11
  sourcemap: boolean;
12
+ /**
13
+ * Whether supported warnings stop builds.
14
+ */
15
+ strict: boolean;
16
+ /**
17
+ * Receives machine-readable lifecycle events.
18
+ */
19
+ onEvent?: (event: DevEvent) => void;
11
20
  }
12
21
  /**
13
22
  * Starts a development server.
@@ -1 +1 @@
1
- {"version":3,"file":"dev-server.d.ts","sourceRoot":"","sources":["../../src/core/dev-server.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAY5C,MAAM,WAAW,gBAAgB;IAChC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,SAAS,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAoB/F"}
1
+ {"version":3,"file":"dev-server.d.ts","sourceRoot":"","sources":["../../src/core/dev-server.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAW5C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEvD,MAAM,WAAW,gBAAgB;IAChC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,SAAS,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAC;CACpC;AAED;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CA8B/F"}
@@ -14,17 +14,28 @@ import { logger } from '../utils/logger.js';
14
14
  * The browser is not auto-reloaded — refresh manually to pick up changes.
15
15
  */
16
16
  export async function startDevServer(project, options) {
17
- const ctx = createContext(project, { sourcemap: options.sourcemap, watch: true });
18
- await runPipeline(ctx, [
19
- compileExml(),
20
- compileEngine(),
21
- compileCustomNamespaces(),
22
- compileSource(),
23
- generateHtml(),
24
- copyAssets(),
25
- ]);
26
- watchResources(project, ctx);
27
- const server = startHttpServer(project, options.port);
17
+ const ctx = createContext(project, { sourcemap: options.sourcemap, watch: true, strict: options.strict });
18
+ const startedAt = Date.now();
19
+ options.onEvent?.({ type: 'build-start', reason: 'initial' });
20
+ try {
21
+ await runPipeline(ctx, [
22
+ compileExml(),
23
+ compileEngine(),
24
+ compileCustomNamespaces(),
25
+ compileSource(),
26
+ generateHtml(),
27
+ copyAssets(),
28
+ ]);
29
+ emitDiagnostics(ctx, options);
30
+ options.onEvent?.({ type: 'build-complete', success: true, durationMs: Date.now() - startedAt });
31
+ }
32
+ catch (error) {
33
+ emitDiagnostics(ctx, options);
34
+ options.onEvent?.({ type: 'build-complete', success: false, durationMs: Date.now() - startedAt });
35
+ throw error;
36
+ }
37
+ watchResources(project, ctx, options);
38
+ const server = startHttpServer(project, options);
28
39
  process.on('SIGINT', async () => {
29
40
  logger.info('Stopping dev server...');
30
41
  await disposeContext(ctx);
@@ -35,7 +46,7 @@ export async function startDevServer(project, options) {
35
46
  /**
36
47
  * Recompiles EXML and re-copies assets when a `.exml` file changes.
37
48
  */
38
- function watchResources(project, ctx) {
49
+ function watchResources(project, ctx, options) {
39
50
  if (!project.config.exml)
40
51
  return;
41
52
  let debounce;
@@ -46,13 +57,19 @@ function watchResources(project, ctx) {
46
57
  return;
47
58
  clearTimeout(debounce);
48
59
  debounce = setTimeout(async () => {
60
+ const startedAt = Date.now();
61
+ options.onEvent?.({ type: 'build-start', reason: 'exml-change' });
49
62
  logger.info(`EXML changed: ${path.basename(filename)}, recompiling...`);
50
63
  try {
51
64
  await compileExml().apply(ctx);
52
65
  await copyAssets().apply(ctx);
66
+ emitDiagnostics(ctx, options);
67
+ options.onEvent?.({ type: 'build-complete', success: true, durationMs: Date.now() - startedAt });
53
68
  }
54
69
  catch (err) {
55
- logger.warn(`EXML recompile failed: ${err instanceof Error ? err.message : err}`);
70
+ emitDiagnostics(ctx, options);
71
+ options.onEvent?.({ type: 'build-complete', success: false, durationMs: Date.now() - startedAt });
72
+ logger.error(`EXML recompile failed: ${err instanceof Error ? err.message : err}`);
56
73
  }
57
74
  }, 100);
58
75
  });
@@ -66,7 +83,7 @@ function watchResources(project, ctx) {
66
83
  /**
67
84
  * Serves static files from the project output directory.
68
85
  */
69
- function startHttpServer(project, port) {
86
+ function startHttpServer(project, options) {
70
87
  const server = http.createServer(async (req, res) => {
71
88
  const url = (req.url ?? '/').split('?')[0];
72
89
  const filePath = path.join(project.outputDir, url === '/' ? 'index.html' : url);
@@ -80,12 +97,19 @@ function startHttpServer(project, port) {
80
97
  res.end('Not found');
81
98
  }
82
99
  });
83
- server.listen(port, () => {
84
- logger.success(`Dev server running at http://localhost:${port}`);
100
+ server.listen(options.port, () => {
101
+ const url = `http://localhost:${options.port}`;
102
+ logger.success(`Dev server running at ${url}`);
85
103
  logger.info('Watching for changes (refresh the browser to reload)...');
104
+ options.onEvent?.({ type: 'server-ready', url });
86
105
  });
87
106
  return server;
88
107
  }
108
+ function emitDiagnostics(ctx, options) {
109
+ for (const diagnostic of ctx.diagnostics.all()) {
110
+ options.onEvent?.({ type: 'diagnostic', diagnostic });
111
+ }
112
+ }
89
113
  const MIME_TYPES = {
90
114
  '.html': 'text/html; charset=utf-8',
91
115
  '.js': 'application/javascript',
@@ -1 +1 @@
1
- {"version":3,"file":"dev-server.js","sourceRoot":"","sources":["../../src/core/dev-server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,MAAM,MAAM,SAAS,CAAC;AAClC,OAAO,KAAK,IA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able diagnostic codes emitted by the CLI.
3
+ */
4
+ export declare const DIAGNOSTIC_CODES: {
5
+ readonly EXML_UNKNOWN_TAG: "KUROT_EXML_UNKNOWN_TAG";
6
+ readonly EXML_COMPILE_FAILED: "KUROT_EXML_COMPILE_FAILED";
7
+ readonly EXML_DECLARED_FILE_NOT_FOUND: "KUROT_EXML_DECLARED_FILE_NOT_FOUND";
8
+ readonly THEME_FILE_NOT_FOUND: "KUROT_THEME_FILE_NOT_FOUND";
9
+ readonly THEME_INVALID_JSON: "KUROT_THEME_INVALID_JSON";
10
+ readonly THEME_SKIN_NOT_FOUND: "KUROT_THEME_SKIN_NOT_FOUND";
11
+ readonly WATCH_RELEASE_IGNORED: "KUROT_WATCH_RELEASE_IGNORED";
12
+ };
13
+ /**
14
+ * Union of diagnostic codes currently defined by the CLI.
15
+ */
16
+ export type DiagnosticCode = (typeof DIAGNOSTIC_CODES)[keyof typeof DIAGNOSTIC_CODES];
17
+ /**
18
+ * Returns whether strict mode promotes a diagnostic code to an error.
19
+ */
20
+ export declare function isStrictDiagnosticCode(code: string): boolean;
21
+ //# sourceMappingURL=codes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codes.d.ts","sourceRoot":"","sources":["../../../src/core/diagnostics/codes.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;CAQnB,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,OAAO,gBAAgB,CAAC,CAAC;AAStF;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE5D"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Stable diagnostic codes emitted by the CLI.
3
+ */
4
+ export const DIAGNOSTIC_CODES = {
5
+ EXML_UNKNOWN_TAG: 'KUROT_EXML_UNKNOWN_TAG',
6
+ EXML_COMPILE_FAILED: 'KUROT_EXML_COMPILE_FAILED',
7
+ EXML_DECLARED_FILE_NOT_FOUND: 'KUROT_EXML_DECLARED_FILE_NOT_FOUND',
8
+ THEME_FILE_NOT_FOUND: 'KUROT_THEME_FILE_NOT_FOUND',
9
+ THEME_INVALID_JSON: 'KUROT_THEME_INVALID_JSON',
10
+ THEME_SKIN_NOT_FOUND: 'KUROT_THEME_SKIN_NOT_FOUND',
11
+ WATCH_RELEASE_IGNORED: 'KUROT_WATCH_RELEASE_IGNORED',
12
+ };
13
+ const STRICT_DIAGNOSTIC_CODES = new Set([
14
+ DIAGNOSTIC_CODES.EXML_UNKNOWN_TAG,
15
+ DIAGNOSTIC_CODES.EXML_DECLARED_FILE_NOT_FOUND,
16
+ DIAGNOSTIC_CODES.THEME_FILE_NOT_FOUND,
17
+ DIAGNOSTIC_CODES.THEME_SKIN_NOT_FOUND,
18
+ ]);
19
+ /**
20
+ * Returns whether strict mode promotes a diagnostic code to an error.
21
+ */
22
+ export function isStrictDiagnosticCode(code) {
23
+ return STRICT_DIAGNOSTIC_CODES.has(code);
24
+ }
25
+ //# sourceMappingURL=codes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codes.js","sourceRoot":"","sources":["../../../src/core/diagnostics/codes.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC/B,gBAAgB,EAAE,wBAAwB;IAC1C,mBAAmB,EAAE,2BAA2B;IAChD,4BAA4B,EAAE,oCAAoC;IAClE,oBAAoB,EAAE,4BAA4B;IAClD,kBAAkB,EAAE,0BAA0B;IAC9C,oBAAoB,EAAE,4BAA4B;IAClD,qBAAqB,EAAE,6BAA6B;CAC3C,CAAC;AAOX,MAAM,uBAAuB,GAAgC,IAAI,GAAG,CAAC;IACpE,gBAAgB,CAAC,gBAAgB;IACjC,gBAAgB,CAAC,4BAA4B;IAC7C,gBAAgB,CAAC,oBAAoB;IACrC,gBAAgB,CAAC,oBAAoB;CACrC,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,UAAU,sBAAsB,CAAC,IAAY;IAClD,OAAO,uBAAuB,CAAC,GAAG,CAAC,IAAsB,CAAC,CAAC;AAC5D,CAAC"}
@@ -0,0 +1,28 @@
1
+ import type { Diagnostic, DiagnosticPolicy } from './types.js';
2
+ /**
3
+ * Collects, normalizes, deduplicates, and orders build diagnostics.
4
+ */
5
+ export declare class DiagnosticCollector {
6
+ private readonly _policy;
7
+ private readonly _diagnostics;
8
+ constructor(_policy: DiagnosticPolicy);
9
+ /**
10
+ * Adds a diagnostic after applying the active policy.
11
+ */
12
+ report(diagnostic: Diagnostic): void;
13
+ /**
14
+ * Returns all diagnostics in stable source order.
15
+ */
16
+ all(): readonly Diagnostic[];
17
+ /**
18
+ * Returns whether any collected diagnostic is an error.
19
+ */
20
+ hasErrors(): boolean;
21
+ /**
22
+ * Removes diagnostics whose codes belong to a refreshed build scope.
23
+ */
24
+ removeByCodes(codes: readonly string[]): void;
25
+ private _normalize;
26
+ private _key;
27
+ }
28
+ //# sourceMappingURL=collector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collector.d.ts","sourceRoot":"","sources":["../../../src/core/diagnostics/collector.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE/D;;GAEG;AACH,qBAAa,mBAAmB;IAOZ,OAAO,CAAC,QAAQ,CAAC,OAAO;IAJ3C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAiC;gBAI1B,OAAO,EAAE,gBAAgB;IAI7D;;OAEG;IACI,MAAM,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI;IAO3C;;OAEG;IACI,GAAG,IAAI,SAAS,UAAU,EAAE;IAInC;;OAEG;IACI,SAAS,IAAI,OAAO;IAI3B;;OAEG;IACI,aAAa,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI;IAWpD,OAAO,CAAC,UAAU;IAOlB,OAAO,CAAC,IAAI;CAWZ"}
@@ -0,0 +1,78 @@
1
+ import { isStrictDiagnosticCode } from './codes.js';
2
+ /**
3
+ * Collects, normalizes, deduplicates, and orders build diagnostics.
4
+ */
5
+ export class DiagnosticCollector {
6
+ _policy;
7
+ // ── Instance fields ───────────────────────────────────────────────
8
+ _diagnostics = new Map();
9
+ // ── Constructor ───────────────────────────────────────────────────
10
+ constructor(_policy) {
11
+ this._policy = _policy;
12
+ }
13
+ // ── Public methods ────────────────────────────────────────────────
14
+ /**
15
+ * Adds a diagnostic after applying the active policy.
16
+ */
17
+ report(diagnostic) {
18
+ const normalized = this._normalize(diagnostic);
19
+ const key = this._key(normalized);
20
+ if (this._diagnostics.has(key))
21
+ return;
22
+ this._diagnostics.set(key, normalized);
23
+ }
24
+ /**
25
+ * Returns all diagnostics in stable source order.
26
+ */
27
+ all() {
28
+ return [...this._diagnostics.values()].sort(compareDiagnostics);
29
+ }
30
+ /**
31
+ * Returns whether any collected diagnostic is an error.
32
+ */
33
+ hasErrors() {
34
+ return [...this._diagnostics.values()].some(diagnostic => diagnostic.severity === 'error');
35
+ }
36
+ /**
37
+ * Removes diagnostics whose codes belong to a refreshed build scope.
38
+ */
39
+ removeByCodes(codes) {
40
+ const codeSet = new Set(codes);
41
+ for (const [key, diagnostic] of this._diagnostics) {
42
+ if (codeSet.has(diagnostic.code)) {
43
+ this._diagnostics.delete(key);
44
+ }
45
+ }
46
+ }
47
+ // ── Private methods ───────────────────────────────────────────────
48
+ _normalize(diagnostic) {
49
+ if (!this._policy.strict || diagnostic.severity === 'error' || !isStrictDiagnosticCode(diagnostic.code)) {
50
+ return diagnostic;
51
+ }
52
+ return { ...diagnostic, severity: 'error' };
53
+ }
54
+ _key(diagnostic) {
55
+ const location = diagnostic.location;
56
+ return [
57
+ diagnostic.code,
58
+ location?.file ?? '',
59
+ location?.line ?? '',
60
+ location?.column ?? '',
61
+ location?.offset ?? '',
62
+ diagnostic.message,
63
+ ].join('\u0000');
64
+ }
65
+ }
66
+ function compareDiagnostics(a, b) {
67
+ const fileOrder = (a.location?.file ?? '').localeCompare(b.location?.file ?? '');
68
+ if (fileOrder !== 0)
69
+ return fileOrder;
70
+ const lineOrder = (a.location?.line ?? 0) - (b.location?.line ?? 0);
71
+ if (lineOrder !== 0)
72
+ return lineOrder;
73
+ const columnOrder = (a.location?.column ?? 0) - (b.location?.column ?? 0);
74
+ if (columnOrder !== 0)
75
+ return columnOrder;
76
+ return a.code.localeCompare(b.code);
77
+ }
78
+ //# sourceMappingURL=collector.js.map