@mandujs/core 0.53.0 → 0.53.2

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 (112) hide show
  1. package/package.json +38 -2
  2. package/src/a11y/run-audit.ts +6 -6
  3. package/src/brain/adapters/oauth-flow.ts +1 -1
  4. package/src/brain/architecture/analyzer.ts +0 -2
  5. package/src/brain/credentials.ts +2 -2
  6. package/src/bundler/__tests__/build-runner.ts +13 -1
  7. package/src/bundler/__tests__/extended-watch.test.ts +3 -2
  8. package/src/bundler/__tests__/fast-refresh.test.ts +10 -12
  9. package/src/bundler/build.test.ts +30 -33
  10. package/src/bundler/build.ts +56 -27
  11. package/src/bundler/dev.ts +44 -39
  12. package/src/bundler/prerender.ts +63 -0
  13. package/src/bundler/safe-build.test.ts +2 -1
  14. package/src/bundler/types.ts +13 -6
  15. package/src/change/history.ts +1 -1
  16. package/src/change/snapshot.ts +18 -9
  17. package/src/client/Link.tsx +9 -9
  18. package/src/client/globals.ts +3 -2
  19. package/src/client/hooks.ts +0 -4
  20. package/src/client/hydrate.ts +1 -1
  21. package/src/client/router.ts +12 -12
  22. package/src/client/rpc.ts +1 -1
  23. package/src/client/use-fetch.ts +6 -6
  24. package/src/client/use-sse.ts +5 -5
  25. package/src/config/mcp-status.ts +0 -1
  26. package/src/config/validate.ts +4 -4
  27. package/src/config/watcher.ts +1 -1
  28. package/src/content/collection.ts +8 -12
  29. package/src/content/content-layer.ts +5 -5
  30. package/src/content/data-store.ts +2 -2
  31. package/src/content/loader-context.ts +0 -1
  32. package/src/content/loaders/file.ts +1 -1
  33. package/src/content/loaders/glob.ts +4 -4
  34. package/src/content/loaders/types.ts +1 -1
  35. package/src/content/meta-store.ts +1 -1
  36. package/src/content/types.ts +1 -1
  37. package/src/contract/define.ts +11 -12
  38. package/src/contract/index.ts +3 -3
  39. package/src/contract/protection.ts +2 -2
  40. package/src/contract/types.ts +1 -1
  41. package/src/contract/validator.ts +0 -1
  42. package/src/db/__tests__/db.test.ts +4 -7
  43. package/src/db/index.ts +138 -51
  44. package/src/db/migrations/index.ts +3 -0
  45. package/src/db/migrations/lock.ts +78 -23
  46. package/src/db/migrations/runner.ts +118 -101
  47. package/src/deploy/cache.ts +1 -0
  48. package/src/design/extract.ts +2 -1
  49. package/src/design/patch.ts +0 -1
  50. package/src/devtools/ai/mcp-connector.ts +24 -24
  51. package/src/devtools/client/components/kitchen-root.tsx +1 -1
  52. package/src/devtools/client/components/panel/errors-panel.tsx +1 -1
  53. package/src/devtools/client/state-manager.ts +1 -1
  54. package/src/devtools/init.ts +2 -3
  55. package/src/devtools/server/source-context.ts +1 -1
  56. package/src/devtools/worker/redaction-worker.ts +8 -4
  57. package/src/devtools/worker/worker-manager.ts +4 -3
  58. package/src/error/classifier.ts +1 -1
  59. package/src/error/domains.ts +1 -1
  60. package/src/filling/sse.ts +5 -5
  61. package/src/generator/generate.ts +2 -2
  62. package/src/guard/analyzer.ts +1 -1
  63. package/src/guard/ast-analyzer.ts +7 -7
  64. package/src/guard/auto-correct.ts +2 -2
  65. package/src/guard/config-guard.ts +0 -2
  66. package/src/guard/contract-guard.ts +1 -1
  67. package/src/guard/decision-memory.ts +2 -2
  68. package/src/guard/design-inline-class.ts +2 -1
  69. package/src/guard/graph.ts +1 -1
  70. package/src/guard/healing.ts +36 -41
  71. package/src/guard/negotiation.ts +3 -3
  72. package/src/guard/reporter.ts +1 -4
  73. package/src/guard/semantic-slots.ts +2 -2
  74. package/src/guard/suggestions.ts +2 -2
  75. package/src/guard/watcher.ts +5 -4
  76. package/src/index.ts +5 -5
  77. package/src/intent/index.ts +1 -1
  78. package/src/kitchen/api/agent-devtools-api.ts +544 -0
  79. package/src/kitchen/api/contract-api.ts +1 -1
  80. package/src/kitchen/api/file-api.ts +3 -3
  81. package/src/kitchen/kitchen-handler.ts +63 -38
  82. package/src/kitchen/kitchen-ui.ts +346 -62
  83. package/src/lockfile/validate.ts +0 -1
  84. package/src/openapi/generator.ts +2 -1
  85. package/src/openapi/openapi.test.ts +43 -14
  86. package/src/perf/user-marks.ts +1 -1
  87. package/src/plugins/registry.ts +1 -2
  88. package/src/plugins/types.ts +1 -1
  89. package/src/resource/__tests__/generator.test.ts +32 -15
  90. package/src/resource/ddl/__tests__/emit.test.ts +24 -0
  91. package/src/resource/ddl/diff.ts +0 -1
  92. package/src/resource/ddl/emit.ts +12 -1
  93. package/src/resource/generator-repo.ts +40 -20
  94. package/src/resource/generator.ts +1 -1
  95. package/src/resource/generators/contract.ts +1 -1
  96. package/src/resource/schema.ts +2 -1
  97. package/src/router/fs-routes.ts +6 -6
  98. package/src/router/fs-scanner.ts +1 -1
  99. package/src/runtime/env.ts +1 -1
  100. package/src/runtime/image-handler.ts +2 -1
  101. package/src/runtime/middleware.ts +2 -1
  102. package/src/runtime/server.ts +67 -60
  103. package/src/runtime/ssr.ts +3 -3
  104. package/src/runtime/streaming-ssr.ts +25 -27
  105. package/src/scheduler/validate.ts +1 -1
  106. package/src/seo/integration/ssr.ts +2 -3
  107. package/src/seo/render/opengraph.ts +1 -1
  108. package/src/seo/resolve/index.ts +0 -4
  109. package/src/slot/corrector.ts +1 -1
  110. package/src/slot/validator.ts +4 -4
  111. package/src/watcher/reporter.ts +1 -1
  112. package/src/watcher/watcher.ts +19 -19
@@ -34,7 +34,7 @@
34
34
 
35
35
  import { existsSync } from "fs";
36
36
  import { relative, resolve, sep, isAbsolute, dirname, extname } from "path";
37
- import { minimatch } from "minimatch";
37
+
38
38
  import type {
39
39
  GuardConfig,
40
40
  LayerDefinition,
@@ -22,18 +22,16 @@
22
22
  * ```
23
23
  */
24
24
 
25
- import { readFile, writeFile, mkdir, rename, unlink } from "fs/promises";
26
- import { existsSync } from "fs";
27
- import { dirname, join, relative, basename, extname, resolve, normalize } from "path";
28
- import type {
29
- Violation,
30
- ViolationType,
31
- GuardConfig,
32
- GuardPreset,
33
- LayerDefinition,
34
- ViolationReport,
35
- } from "./types";
36
- import { generateSmartSuggestions, getDocumentationLink } from "./suggestions";
25
+ import { readFile, writeFile, mkdir, unlink } from "fs/promises";
26
+ import { existsSync } from "fs";
27
+ import { dirname, join, extname, resolve, normalize } from "path";
28
+ import type {
29
+ Violation,
30
+ ViolationType,
31
+ GuardConfig,
32
+ GuardPreset,
33
+ } from "./types";
34
+ import { getDocumentationLink } from "./suggestions";
37
35
  import { checkDirectory } from "./watcher";
38
36
 
39
37
  // ═══════════════════════════════════════════════════════════════════════════
@@ -326,14 +324,13 @@ function generateHealingOptions(
326
324
  /**
327
325
  * 레이어 위반 옵션 생성
328
326
  */
329
- function generateLayerViolationOptions(
330
- violation: Violation,
331
- config: GuardConfig,
332
- rootDir: string
333
- ): HealingOption[] {
334
- const options: HealingOption[] = [];
335
- const { filePath, importPath, importStatement, fromLayer, toLayer, allowedLayers } =
336
- violation;
327
+ function generateLayerViolationOptions(
328
+ violation: Violation,
329
+ _config: GuardConfig,
330
+ rootDir: string
331
+ ): HealingOption[] {
332
+ const options: HealingOption[] = [];
333
+ const { filePath, importPath, importStatement, toLayer, allowedLayers } = violation;
337
334
 
338
335
  const targetModule = extractModuleName(importPath);
339
336
 
@@ -409,17 +406,15 @@ function generateLayerViolationOptions(
409
406
  /**
410
407
  * 순환 의존 옵션 생성
411
408
  */
412
- function generateCircularDependencyOptions(
413
- violation: Violation,
414
- config: GuardConfig,
415
- rootDir: string
416
- ): HealingOption[] {
417
- const options: HealingOption[] = [];
418
- const { fromLayer, toLayer, importPath } = violation;
419
-
420
- const targetModule = extractModuleName(importPath);
421
-
422
- // 옵션 1: 공통 코드를 shared로 추출
409
+ function generateCircularDependencyOptions(
410
+ violation: Violation,
411
+ _config: GuardConfig,
412
+ _rootDir: string
413
+ ): HealingOption[] {
414
+ const options: HealingOption[] = [];
415
+ const { fromLayer, toLayer } = violation;
416
+
417
+ // 옵션 1: 공통 코드를 shared로 추출
423
418
  options.push({
424
419
  label: "공통 코드를 shared로 추출",
425
420
  explanation: `${fromLayer}와 ${toLayer}가 공유하는 코드를 shared 레이어로 이동하세요.`,
@@ -446,11 +441,11 @@ function generateCircularDependencyOptions(
446
441
  /**
447
442
  * Cross-slice 옵션 생성
448
443
  */
449
- function generateCrossSliceOptions(
450
- violation: Violation,
451
- config: GuardConfig,
452
- rootDir: string
453
- ): HealingOption[] {
444
+ function generateCrossSliceOptions(
445
+ violation: Violation,
446
+ _config: GuardConfig,
447
+ _rootDir: string
448
+ ): HealingOption[] {
454
449
  const options: HealingOption[] = [];
455
450
  const { fromLayer, importPath } = violation;
456
451
 
@@ -483,11 +478,11 @@ function generateCrossSliceOptions(
483
478
  /**
484
479
  * 깊은 중첩 옵션 생성
485
480
  */
486
- function generateDeepNestingOptions(
487
- violation: Violation,
488
- config: GuardConfig,
489
- rootDir: string
490
- ): HealingOption[] {
481
+ function generateDeepNestingOptions(
482
+ violation: Violation,
483
+ _config: GuardConfig,
484
+ _rootDir: string
485
+ ): HealingOption[] {
491
486
  const options: HealingOption[] = [];
492
487
  const { filePath, importPath, importStatement } = violation;
493
488
 
@@ -23,7 +23,7 @@
23
23
 
24
24
  import { join, dirname } from "path";
25
25
  import { mkdir, writeFile, readdir, stat } from "fs/promises";
26
- import { searchDecisions, type ArchitectureDecision } from "./decision-memory";
26
+ import { searchDecisions } from "./decision-memory";
27
27
  import { getPreset, type GuardPreset, type PresetDefinition } from "./presets";
28
28
 
29
29
  // ═══════════════════════════════════════════════════════════════════════════
@@ -1176,10 +1176,10 @@ export async function negotiate(
1176
1176
  ): Promise<NegotiationResponse> {
1177
1177
  const {
1178
1178
  intent,
1179
- requirements = [],
1179
+ requirements: _requirements = [],
1180
1180
  constraints = [],
1181
1181
  preset = "mandu",
1182
- context,
1182
+ context: _context,
1183
1183
  } = request;
1184
1184
 
1185
1185
  // 1. 카테고리 감지
@@ -8,13 +8,10 @@ import type {
8
8
  Violation,
9
9
  ViolationReport,
10
10
  Severity,
11
- LayerDefinition,
12
11
  GuardPreset,
13
12
  } from "./types";
14
13
  import {
15
- getDocumentationLink,
16
14
  toAgentFormat,
17
- type AgentViolationFormat,
18
15
  } from "./suggestions";
19
16
 
20
17
  // ═══════════════════════════════════════════════════════════════════════════
@@ -89,7 +86,7 @@ export function formatViolation(
89
86
  ): string {
90
87
  const icon = getSeverityIcon(violation.severity);
91
88
  const color = getSeverityColor(violation.severity);
92
- const label = getSeverityLabel(violation.severity);
89
+ const _label = getSeverityLabel(violation.severity);
93
90
 
94
91
  const lines: string[] = [
95
92
  "",
@@ -22,7 +22,7 @@
22
22
  */
23
23
 
24
24
  import { readFile } from "fs/promises";
25
- import { join, relative, normalize } from "path";
25
+
26
26
 
27
27
  // ═══════════════════════════════════════════════════════════════════════════
28
28
  // Types
@@ -460,7 +460,7 @@ function safeRegexTest(
460
460
  export async function validateSlotConstraints(
461
461
  filePath: string,
462
462
  constraints: SlotConstraints,
463
- rootDir?: string
463
+ _rootDir?: string
464
464
  ): Promise<SemanticSlotValidationResult> {
465
465
  const violations: ConstraintViolation[] = [];
466
466
  const suggestions: string[] = [];
@@ -80,7 +80,7 @@ interface SuggestionContext {
80
80
  * 스마트 제안 생성
81
81
  */
82
82
  export function generateSmartSuggestions(context: SuggestionContext): string[] {
83
- const { type, fromLayer, toLayer, importPath, allowedLayers, layers, preset, slice } = context;
83
+ const { type } = context;
84
84
  const suggestions: string[] = [];
85
85
 
86
86
  switch (type) {
@@ -153,7 +153,7 @@ function generateLayerViolationSuggestions(context: SuggestionContext): string[]
153
153
  * 순환 의존 제안 생성
154
154
  */
155
155
  function generateCircularDependencySuggestions(context: SuggestionContext): string[] {
156
- const { fromLayer, toLayer, importPath } = context;
156
+ const { fromLayer, toLayer } = context;
157
157
  const suggestions: string[] = [];
158
158
 
159
159
  suggestions.push(
@@ -1,3 +1,4 @@
1
+ import type * as __ManduGlobTypes0 from "glob";
1
2
  /**
2
3
  * Mandu Guard Watcher
3
4
  *
@@ -45,9 +46,9 @@ interface WatcherOptions {
45
46
 
46
47
  const analysisCache = new Map<string, FileAnalysis>();
47
48
 
48
- let globModulePromise: Promise<typeof import("glob")> | null = null;
49
+ let globModulePromise: Promise<typeof __ManduGlobTypes0> | null = null;
49
50
 
50
- async function getGlobModule(): Promise<typeof import("glob")> {
51
+ async function getGlobModule(): Promise<typeof __ManduGlobTypes0> {
51
52
  if (!globModulePromise) {
52
53
  globModulePromise = import("glob");
53
54
  }
@@ -93,7 +94,7 @@ export function createGuardWatcher(options: WatcherOptions): GuardWatcher {
93
94
 
94
95
  // 레이어 정의 가져오기
95
96
  const layers = resolveLayerDefinitions(config);
96
- const hierarchy = resolveHierarchy(config);
97
+ const _hierarchy = resolveHierarchy(config);
97
98
 
98
99
  // 설정 기본값 적용
99
100
  const srcDir = config.srcDir ?? DEFAULT_GUARD_CONFIG.srcDir;
@@ -272,7 +273,7 @@ export function createGuardWatcher(options: WatcherOptions): GuardWatcher {
272
273
 
273
274
  close(): void {
274
275
  if (watcher) {
275
- watcher.close();
276
+ void watcher.close();
276
277
  watcher = null;
277
278
  }
278
279
  clearAnalysisCache();
package/src/index.ts CHANGED
@@ -94,14 +94,14 @@ export {
94
94
  } from "./observability/tracing";
95
95
 
96
96
  // Consolidated Mandu namespace
97
- import { ManduFilling, ManduContext, ManduFillingFactory, createSSEConnection } from "./filling";
97
+ import { ManduFillingFactory, createSSEConnection } from "./filling";
98
98
  import { createContract, defineHandler, defineRoute, createClient, contractFetch, createClientContract, querySchema, bodySchema, apiError } from "./contract";
99
99
  import { defineContract, generateAllFromContract, generateOpenAPISpec } from "./contract/define";
100
- import { island, isIsland, type IslandComponent, type IslandHydrationStrategy, type ClientIslandDefinition, type CompiledClientIsland } from "./island";
101
- import { intent, isIntent, getIntentDocs, generateOpenAPIFromIntent } from "./intent";
100
+ import { island, isIsland } from "./island";
101
+ import { intent, isIntent } from "./intent";
102
102
  import { initializeHook, reportError, ManduDevTools, getStateManager } from "./devtools";
103
- import type { ContractDefinition, ContractInstance, ContractSchema } from "./contract";
104
- import type { ContractHandlers, ClientOptions } from "./contract";
103
+
104
+
105
105
 
106
106
  /**
107
107
  * Mandu - Unified Namespace
@@ -22,7 +22,7 @@
22
22
  * ```
23
23
  */
24
24
 
25
- import { z, type ZodType } from 'zod';
25
+ import { type ZodType } from 'zod';
26
26
  import { ManduFillingFactory, type ManduFilling } from '../filling/filling';
27
27
  import type { ManduContext } from '../filling/context';
28
28
  import { getZodTypeName, getZodObjectShape, getZodArrayElementType } from '../contract/zod-utils';