@supacloud/compiler 0.25.0 → 0.26.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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # @supacloud/compiler
2
2
 
3
+ Generated HTTP clients export `ApiClientError` with `code`, `method`, route
4
+ `path`, `status` and a bounded `requestId`. Undeclared HTTP errors no longer
5
+ embed raw response bodies in their message; explicit inspection remains
6
+ available through the non-enumerable `response` property. Declared non-2xx
7
+ response unions, caller decoders, binary/stream routes and GraphQL stay intact.
8
+ These errors do not prove write rollback and do not add automatic retries.
9
+ See [typed clients and recovery](../../docs/framework-composition.md).
10
+
3
11
  ## Unified Database Contracts
4
12
 
5
13
  `supacloud-compiler database-contracts database-contracts.json` generates a shared
@@ -613,6 +621,12 @@ AI Agent 可以只读取目标模块的上下文包,而不需要扫描整个
613
621
  supacloud-compiler context case --root ./app --json
614
622
  ```
615
623
 
624
+ Context targets also accept a module class, provider token/class, controller,
625
+ command, job, or query name/class. They resolve to the owning module and return
626
+ the same version-1 neighborhood pack (`subject` remains the module name).
627
+ Exact module names keep precedence; an ambiguous symbol is rejected with the
628
+ candidate module names instead of selecting an arbitrary owner.
629
+
616
630
  上下文包包含目标模块、直接和间接上下游模块、相关源码文件、路由/Command/provider
617
631
  图谱以及实际引用的平台 token。`compile --json` 和 `check --json` 会返回稳定的
618
632
  `ok`、`diagnostics`、`written`/`mismatches` 字段;可修复的诊断还会包含机器可消费的
@@ -625,6 +639,13 @@ supacloud-compiler context case --root ./app --json
625
639
  CLI 修复的 `targetFile` 相对于配置的源码根目录解析,也可以用 `--root` 显式指定;
626
640
  JSON 修复文件本身仍相对于当前工作目录读取。
627
641
 
642
+ `createDiagnosticRepairPlan(diagnostics)` classifies existing semantic fixes as
643
+ `preview`, `input-required`, or `manual`, and retains each complete `fix` payload.
644
+ It never infers a permission or a transaction/idempotency policy. `preview`
645
+ means the executor supports the suggestion and its policy inputs are present,
646
+ not that its AST preconditions have passed or that a write has been authorized.
647
+ Unsupported fix types remain manual suggestions. Planning does not write files.
648
+
628
649
  上下游分别沿单一方向遍历,不会经过共享基础模块再扩散到无关兄弟业务。
629
650
  上下文包还包含准确的切面源文件、校验诊断和 `executionPlans`;`explain <module>`
630
651
  也展示静态执行计划。计划描述标准命令治理;自定义 executor 的内部实现和短路行为
@@ -640,10 +661,14 @@ JSON 修复文件本身仍相对于当前工作目录读取。
640
661
  ## 编译基准
641
662
 
642
663
  使用 `bun run benchmark` 运行固定 fixture 基准,输出 cold compile、增量
643
- compile、依赖失效耗时、重用/重析模块和生成产物字节数。基准是本地证据,
644
- 不是跨机器性能承诺;2026-09-06 当前 fixture 的一次结果约为:
645
- `175.76ms` 冷编译、`18.88ms` 相同输入增量、`16.77ms` 单依赖失效、
646
- `9329` bytes。
664
+ compile、依赖失效耗时、重用/重析模块和生成产物字节数。`generation` 额外报告
665
+ 同进程中旧双渲染路径与复用已校验渲染结果的对照:每组 25 次、7 组取中位数,
666
+ 交替测试顺序并共用预热产物缓存。编译入口复用一次渲染结果,公共
667
+ `generateApplication(graph, options)` 调用方式不变。
668
+
669
+ 基准是本地证据,不是跨机器性能承诺,也不证明整次编译按相同比例加速。
670
+ 测试不以机器耗时比例作为通过条件。具体数据及限制见
671
+ [本地验收记录](../../docs/vibecoding-acceptance.md#performance-evidence)。
647
672
 
648
673
  ## 开发
649
674
 
@@ -683,6 +708,43 @@ rechecks types instead of returning an unchecked cached result.
683
708
  Generated route calls require all path parameters and a decoder for typed
684
709
  responses. See [type safety and migration](../../docs/type-safety.md).
685
710
 
711
+ ### Raw Requests and Legacy DELETE Bodies
712
+
713
+ `parse: "none"` leaves the original `Request` body unread. The route must declare
714
+ `contract: { body: "domain", evidence: "path/to/acceptance.test.ts" }` and must not
715
+ declare a parsed `body` schema or bind `@Body()`. Its domain handler is responsible
716
+ for authentication ordering, content-type checks, bounded reading, cancellation
717
+ and validation. The declaration does not prove those checks ran.
718
+
719
+ Body policies accept explicit literals and statically resolvable object spreads.
720
+ Dynamic spreads, computed keys and shorthand policies fail compilation rather
721
+ than silently restoring default parsing. Generated clients accept `BodyInit`
722
+ for raw routes, preserve bytes/streams, and do not assume JSON content type.
723
+ The caller must set the domain's content type explicitly when required.
724
+ The API and contract manifests retain the policy; OpenAPI describes the raw
725
+ body without claiming a JSON schema.
726
+
727
+ Existing DELETE endpoints with a JSON body can opt in with
728
+ `allowDeleteBody: true` and an explicit body schema. This does not relax GET,
729
+ HEAD or OPTIONS, and it does not bypass adapter request validation.
730
+
731
+ Terminal `/*` routes support `@Param("*")` with a declared `"*"` params field.
732
+ Generated clients require the wildcard value, encode each path segment, and
733
+ preserve `/` separators. OpenAPI uses a collision-free named path parameter for
734
+ the tail; this does not turn the endpoint into a fixed-depth JSON resource.
735
+ Literal `.` and `..` tail segments are rejected because Fetch would normalize
736
+ them and change the request target. Equivalent parameterized paths on the same
737
+ HTTP method fail compilation when OpenAPI generation is enabled, instead of
738
+ silently overwriting OpenAPI operations.
739
+
740
+ ### Hidden Route Documentation
741
+
742
+ Use `data: { openapi: { hide: true } }` to retain an endpoint at runtime while
743
+ excluding it from generated OpenAPI and the Elysia Swagger view. Its compiled
744
+ descriptor, contract manifest and client remain available. This is documentation
745
+ metadata, not an authorization boundary.
746
+
747
+
686
748
  ## License
687
749
 
688
750
  MIT
@@ -6,5 +6,11 @@ export interface CompilerBenchmarkResult {
6
6
  generatedBytes: number;
7
7
  reusedModules: string[];
8
8
  reanalyzedModules: string[];
9
+ generation: {
10
+ iterationsPerSample: number;
11
+ samples: number;
12
+ legacyMedianMs: number;
13
+ reusedRenderMedianMs: number;
14
+ };
9
15
  }
10
16
  export declare function runCompilerBenchmark(): Promise<CompilerBenchmarkResult>;