@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.
- package/package.json +38 -2
- package/src/a11y/run-audit.ts +6 -6
- package/src/brain/adapters/oauth-flow.ts +1 -1
- package/src/brain/architecture/analyzer.ts +0 -2
- package/src/brain/credentials.ts +2 -2
- package/src/bundler/__tests__/build-runner.ts +13 -1
- package/src/bundler/__tests__/extended-watch.test.ts +3 -2
- package/src/bundler/__tests__/fast-refresh.test.ts +10 -12
- package/src/bundler/build.test.ts +30 -33
- package/src/bundler/build.ts +56 -27
- package/src/bundler/dev.ts +44 -39
- package/src/bundler/prerender.ts +63 -0
- package/src/bundler/safe-build.test.ts +2 -1
- package/src/bundler/types.ts +13 -6
- package/src/change/history.ts +1 -1
- package/src/change/snapshot.ts +18 -9
- package/src/client/Link.tsx +9 -9
- package/src/client/globals.ts +3 -2
- package/src/client/hooks.ts +0 -4
- package/src/client/hydrate.ts +1 -1
- package/src/client/router.ts +12 -12
- package/src/client/rpc.ts +1 -1
- package/src/client/use-fetch.ts +6 -6
- package/src/client/use-sse.ts +5 -5
- package/src/config/mcp-status.ts +0 -1
- package/src/config/validate.ts +4 -4
- package/src/config/watcher.ts +1 -1
- package/src/content/collection.ts +8 -12
- package/src/content/content-layer.ts +5 -5
- package/src/content/data-store.ts +2 -2
- package/src/content/loader-context.ts +0 -1
- package/src/content/loaders/file.ts +1 -1
- package/src/content/loaders/glob.ts +4 -4
- package/src/content/loaders/types.ts +1 -1
- package/src/content/meta-store.ts +1 -1
- package/src/content/types.ts +1 -1
- package/src/contract/define.ts +11 -12
- package/src/contract/index.ts +3 -3
- package/src/contract/protection.ts +2 -2
- package/src/contract/types.ts +1 -1
- package/src/contract/validator.ts +0 -1
- package/src/db/__tests__/db.test.ts +4 -7
- package/src/db/index.ts +138 -51
- package/src/db/migrations/index.ts +3 -0
- package/src/db/migrations/lock.ts +78 -23
- package/src/db/migrations/runner.ts +118 -101
- package/src/deploy/cache.ts +1 -0
- package/src/design/extract.ts +2 -1
- package/src/design/patch.ts +0 -1
- package/src/devtools/ai/mcp-connector.ts +24 -24
- package/src/devtools/client/components/kitchen-root.tsx +1 -1
- package/src/devtools/client/components/panel/errors-panel.tsx +1 -1
- package/src/devtools/client/state-manager.ts +1 -1
- package/src/devtools/init.ts +2 -3
- package/src/devtools/server/source-context.ts +1 -1
- package/src/devtools/worker/redaction-worker.ts +8 -4
- package/src/devtools/worker/worker-manager.ts +4 -3
- package/src/error/classifier.ts +1 -1
- package/src/error/domains.ts +1 -1
- package/src/filling/sse.ts +5 -5
- package/src/generator/generate.ts +2 -2
- package/src/guard/analyzer.ts +1 -1
- package/src/guard/ast-analyzer.ts +7 -7
- package/src/guard/auto-correct.ts +2 -2
- package/src/guard/config-guard.ts +0 -2
- package/src/guard/contract-guard.ts +1 -1
- package/src/guard/decision-memory.ts +2 -2
- package/src/guard/design-inline-class.ts +2 -1
- package/src/guard/graph.ts +1 -1
- package/src/guard/healing.ts +36 -41
- package/src/guard/negotiation.ts +3 -3
- package/src/guard/reporter.ts +1 -4
- package/src/guard/semantic-slots.ts +2 -2
- package/src/guard/suggestions.ts +2 -2
- package/src/guard/watcher.ts +5 -4
- package/src/index.ts +5 -5
- package/src/intent/index.ts +1 -1
- package/src/kitchen/api/agent-devtools-api.ts +544 -0
- package/src/kitchen/api/contract-api.ts +1 -1
- package/src/kitchen/api/file-api.ts +3 -3
- package/src/kitchen/kitchen-handler.ts +63 -38
- package/src/kitchen/kitchen-ui.ts +346 -62
- package/src/lockfile/validate.ts +0 -1
- package/src/openapi/generator.ts +2 -1
- package/src/openapi/openapi.test.ts +43 -14
- package/src/perf/user-marks.ts +1 -1
- package/src/plugins/registry.ts +1 -2
- package/src/plugins/types.ts +1 -1
- package/src/resource/__tests__/generator.test.ts +32 -15
- package/src/resource/ddl/__tests__/emit.test.ts +24 -0
- package/src/resource/ddl/diff.ts +0 -1
- package/src/resource/ddl/emit.ts +12 -1
- package/src/resource/generator-repo.ts +40 -20
- package/src/resource/generator.ts +1 -1
- package/src/resource/generators/contract.ts +1 -1
- package/src/resource/schema.ts +2 -1
- package/src/router/fs-routes.ts +6 -6
- package/src/router/fs-scanner.ts +1 -1
- package/src/runtime/env.ts +1 -1
- package/src/runtime/image-handler.ts +2 -1
- package/src/runtime/middleware.ts +2 -1
- package/src/runtime/server.ts +67 -60
- package/src/runtime/ssr.ts +3 -3
- package/src/runtime/streaming-ssr.ts +25 -27
- package/src/scheduler/validate.ts +1 -1
- package/src/seo/integration/ssr.ts +2 -3
- package/src/seo/render/opengraph.ts +1 -1
- package/src/seo/resolve/index.ts +0 -4
- package/src/slot/corrector.ts +1 -1
- package/src/slot/validator.ts +4 -4
- package/src/watcher/reporter.ts +1 -1
- package/src/watcher/watcher.ts +19 -19
package/src/guard/graph.ts
CHANGED
package/src/guard/healing.ts
CHANGED
|
@@ -22,18 +22,16 @@
|
|
|
22
22
|
* ```
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
import { readFile, writeFile, mkdir,
|
|
26
|
-
import { existsSync } from "fs";
|
|
27
|
-
import { dirname, join,
|
|
28
|
-
import type {
|
|
29
|
-
Violation,
|
|
30
|
-
ViolationType,
|
|
31
|
-
GuardConfig,
|
|
32
|
-
GuardPreset,
|
|
33
|
-
|
|
34
|
-
|
|
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
|
-
|
|
332
|
-
rootDir: string
|
|
333
|
-
): HealingOption[] {
|
|
334
|
-
const options: HealingOption[] = [];
|
|
335
|
-
const { filePath, importPath, importStatement,
|
|
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
|
-
|
|
415
|
-
|
|
416
|
-
): HealingOption[] {
|
|
417
|
-
const options: HealingOption[] = [];
|
|
418
|
-
const { fromLayer, toLayer
|
|
419
|
-
|
|
420
|
-
|
|
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
|
-
|
|
452
|
-
|
|
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
|
-
|
|
489
|
-
|
|
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
|
|
package/src/guard/negotiation.ts
CHANGED
|
@@ -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
|
|
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. 카테고리 감지
|
package/src/guard/reporter.ts
CHANGED
|
@@ -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
|
|
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
|
-
|
|
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
|
-
|
|
463
|
+
_rootDir?: string
|
|
464
464
|
): Promise<SemanticSlotValidationResult> {
|
|
465
465
|
const violations: ConstraintViolation[] = [];
|
|
466
466
|
const suggestions: string[] = [];
|
package/src/guard/suggestions.ts
CHANGED
|
@@ -80,7 +80,7 @@ interface SuggestionContext {
|
|
|
80
80
|
* 스마트 제안 생성
|
|
81
81
|
*/
|
|
82
82
|
export function generateSmartSuggestions(context: SuggestionContext): string[] {
|
|
83
|
-
const { type
|
|
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
|
|
156
|
+
const { fromLayer, toLayer } = context;
|
|
157
157
|
const suggestions: string[] = [];
|
|
158
158
|
|
|
159
159
|
suggestions.push(
|
package/src/guard/watcher.ts
CHANGED
|
@@ -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
|
|
49
|
+
let globModulePromise: Promise<typeof __ManduGlobTypes0> | null = null;
|
|
49
50
|
|
|
50
|
-
async function getGlobModule(): Promise<typeof
|
|
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
|
|
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 {
|
|
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
|
|
101
|
-
import { intent, isIntent
|
|
100
|
+
import { island, isIsland } from "./island";
|
|
101
|
+
import { intent, isIntent } from "./intent";
|
|
102
102
|
import { initializeHook, reportError, ManduDevTools, getStateManager } from "./devtools";
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
|
|
104
|
+
|
|
105
105
|
|
|
106
106
|
/**
|
|
107
107
|
* Mandu - Unified Namespace
|
package/src/intent/index.ts
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* ```
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
import {
|
|
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';
|