maskweaver 0.9.4 → 0.9.5
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/dist/cli/doctor.js +5 -21
- package/dist/cli/install.d.ts +0 -8
- package/dist/cli/install.js +0 -39
- package/dist/context/config.d.ts +0 -22
- package/dist/context/config.js +0 -28
- package/dist/context/feature.d.ts +0 -39
- package/dist/context/feature.js +0 -77
- package/dist/context/files.d.ts +0 -13
- package/dist/context/files.js +1 -24
- package/dist/context/index.d.ts +0 -7
- package/dist/context/index.js +0 -12
- package/dist/context/project.d.ts +0 -21
- package/dist/context/project.js +0 -30
- package/dist/context/types.d.ts +0 -48
- package/dist/context/types.js +0 -12
- package/dist/context/utils.d.ts +0 -18
- package/dist/context/utils.js +0 -27
- package/dist/core/engine/promptBuilder.d.ts +0 -17
- package/dist/core/engine/promptBuilder.js +0 -28
- package/dist/core/index.d.ts +0 -6
- package/dist/core/index.js +0 -9
- package/dist/core/loader/MaskLoader.d.ts +0 -23
- package/dist/core/loader/MaskLoader.js +0 -29
- package/dist/core/schema/types.d.ts +0 -47
- package/dist/core/schema/types.js +0 -6
- package/dist/core/schema/validator.d.ts +0 -14
- package/dist/core/schema/validator.js +0 -18
- package/dist/i18n/index.d.ts +0 -18
- package/dist/i18n/index.js +4 -23
- package/dist/index.d.ts +0 -8
- package/dist/index.js +0 -8
- package/dist/lib.d.ts +0 -5
- package/dist/lib.js +0 -12
- package/dist/memory/chunking.d.ts +0 -22
- package/dist/memory/chunking.js +2 -37
- package/dist/memory/core.d.ts +0 -29
- package/dist/memory/core.js +1 -52
- package/dist/memory/index.d.ts +0 -5
- package/dist/memory/index.js +0 -10
- package/dist/memory/indexer.d.ts +0 -21
- package/dist/memory/indexer.js +0 -44
- package/dist/memory/providers/examples.d.ts +0 -5
- package/dist/memory/providers/examples.js +4 -64
- package/dist/memory/providers/factory.d.ts +0 -44
- package/dist/memory/providers/factory.js +0 -46
- package/dist/memory/providers/index.d.ts +0 -26
- package/dist/memory/providers/index.js +0 -28
- package/dist/memory/providers/ollama.d.ts +0 -6
- package/dist/memory/providers/ollama.js +1 -8
- package/dist/memory/providers/openai.d.ts +0 -6
- package/dist/memory/providers/openai.js +1 -8
- package/dist/memory/providers/openrouter.d.ts +0 -6
- package/dist/memory/providers/openrouter.js +0 -8
- package/dist/memory/providers/text-only.d.ts +0 -13
- package/dist/memory/providers/text-only.js +0 -17
- package/dist/memory/providers/types.d.ts +0 -39
- package/dist/memory/providers/types.js +0 -7
- package/dist/memory/providers/voyage.d.ts +0 -22
- package/dist/memory/providers/voyage.js +1 -24
- package/dist/memory/search/hybrid.d.ts +0 -12
- package/dist/memory/search/hybrid.js +1 -22
- package/dist/memory/store/sqlite.d.ts +0 -72
- package/dist/memory/store/sqlite.js +4 -127
- package/dist/plugin/config/index.d.ts +0 -112
- package/dist/plugin/config/index.js +0 -115
- package/dist/plugin/index.d.ts +0 -13
- package/dist/plugin/index.js +1 -123
- package/dist/plugin/tools/command-registry.d.ts +0 -6
- package/dist/plugin/tools/command-registry.js +0 -14
- package/dist/plugin/tools/context.d.ts +0 -12
- package/dist/plugin/tools/context.js +0 -58
- package/dist/plugin/tools/maskSave.d.ts +0 -3
- package/dist/plugin/tools/maskSave.js +0 -3
- package/dist/plugin/tools/memoryGet.d.ts +0 -3
- package/dist/plugin/tools/memoryGet.js +0 -3
- package/dist/plugin/tools/memoryIndexer.d.ts +0 -3
- package/dist/plugin/tools/memoryIndexer.js +0 -10
- package/dist/plugin/tools/memorySearch.d.ts +0 -31
- package/dist/plugin/tools/memorySearch.js +0 -79
- package/dist/plugin/tools/memoryWrite.d.ts +0 -8
- package/dist/plugin/tools/memoryWrite.js +0 -32
- package/dist/plugin/tools/retrospect.d.ts +0 -3
- package/dist/plugin/tools/retrospect.js +0 -3
- package/dist/plugin/tools/slashcommand.d.ts +0 -11
- package/dist/plugin/tools/slashcommand.js +0 -38
- package/dist/plugin/tools/squad.d.ts +0 -12
- package/dist/plugin/tools/squad.js +11 -83
- package/dist/plugin/tools/weave.d.ts +0 -6
- package/dist/plugin/tools/weave.js +0 -78
- package/dist/plugin/types.d.ts +0 -20
- package/dist/plugin/types.js +0 -7
- package/dist/retrospect/index.d.ts +0 -7
- package/dist/retrospect/index.js +0 -9
- package/dist/retrospect/mask-save.d.ts +0 -12
- package/dist/retrospect/mask-save.js +1 -80
- package/dist/retrospect/retrospect.d.ts +0 -18
- package/dist/retrospect/retrospect.js +0 -63
- package/dist/retrospect/strategies/base.d.ts +0 -15
- package/dist/retrospect/strategies/base.js +0 -7
- package/dist/retrospect/strategies/deep.d.ts +0 -12
- package/dist/retrospect/strategies/deep.js +0 -24
- package/dist/retrospect/strategies/index.d.ts +0 -12
- package/dist/retrospect/strategies/index.js +0 -12
- package/dist/retrospect/strategies/quick.d.ts +0 -12
- package/dist/retrospect/strategies/quick.js +0 -19
- package/dist/retrospect/strategies/standard.d.ts +0 -12
- package/dist/retrospect/strategies/standard.js +0 -15
- package/dist/retrospect/types.d.ts +0 -7
- package/dist/retrospect/types.js +0 -7
- package/dist/shared/config.d.ts +0 -105
- package/dist/shared/config.js +0 -33
- package/dist/shared/errors.d.ts +0 -18
- package/dist/shared/errors.js +0 -19
- package/dist/shared/generate-agents.d.ts +0 -69
- package/dist/shared/generate-agents.js +2 -86
- package/dist/shared/image.d.ts +0 -67
- package/dist/shared/image.js +6 -104
- package/dist/shared/index.d.ts +0 -5
- package/dist/shared/index.js +0 -7
- package/dist/shared/model-registry.d.ts +0 -72
- package/dist/shared/model-registry.js +5 -95
- package/dist/shared/types.d.ts +0 -15
- package/dist/shared/types.js +0 -3
- package/dist/shared-context/dag.d.ts +0 -105
- package/dist/shared-context/dag.js +3 -114
- package/dist/shared-context/index.d.ts +0 -5
- package/dist/shared-context/index.js +0 -15
- package/dist/shared-context/logger.d.ts +0 -37
- package/dist/shared-context/logger.js +0 -41
- package/dist/shared-context/parallel-executor.d.ts +0 -54
- package/dist/shared-context/parallel-executor.js +4 -56
- package/dist/shared-context/session.d.ts +0 -56
- package/dist/shared-context/session.js +0 -47
- package/dist/shared-context/squad.d.ts +0 -68
- package/dist/shared-context/squad.js +0 -63
- package/dist/shared-context/storage.d.ts +0 -132
- package/dist/shared-context/storage.js +0 -116
- package/dist/shared-context/task.d.ts +0 -120
- package/dist/shared-context/task.js +0 -152
- package/dist/shared-context/test/dag.test.js +9 -14
- package/dist/shared-context/test/logger.test.d.ts +0 -8
- package/dist/shared-context/test/logger.test.js +0 -52
- package/dist/shared-context/test/session.test.d.ts +0 -7
- package/dist/shared-context/test/session.test.js +0 -63
- package/dist/shared-context/test/squad.test.d.ts +0 -10
- package/dist/shared-context/test/squad.test.js +2 -68
- package/dist/shared-context/test/storage.test.d.ts +0 -8
- package/dist/shared-context/test/storage.test.js +0 -68
- package/dist/shared-context/test/task.test.d.ts +0 -7
- package/dist/shared-context/test/task.test.js +0 -54
- package/dist/shared-context/test/watchdog.test.d.ts +0 -7
- package/dist/shared-context/test/watchdog.test.js +3 -58
- package/dist/shared-context/types.d.ts +0 -215
- package/dist/shared-context/types.js +0 -125
- package/dist/shared-context/watchdog.d.ts +0 -127
- package/dist/shared-context/watchdog.js +0 -148
- package/dist/shared-context/worktree.d.ts +0 -68
- package/dist/shared-context/worktree.js +2 -34
- package/dist/verify/budget.d.ts +0 -29
- package/dist/verify/budget.js +0 -34
- package/dist/verify/critical-files.d.ts +0 -17
- package/dist/verify/critical-files.js +0 -37
- package/dist/verify/escalation.d.ts +0 -20
- package/dist/verify/escalation.js +0 -22
- package/dist/verify/index.d.ts +0 -5
- package/dist/verify/index.js +0 -11
- package/dist/verify/prompts.d.ts +0 -20
- package/dist/verify/prompts.js +0 -20
- package/dist/verify/types.d.ts +0 -26
- package/dist/verify/types.js +1 -12
- package/dist/verify/verifier.d.ts +0 -29
- package/dist/verify/verifier.js +0 -54
- package/dist/version.d.ts +1 -16
- package/dist/version.js +1 -16
- package/dist/weave/bridge.d.ts +0 -35
- package/dist/weave/bridge.js +0 -51
- package/dist/weave/environment/detector.d.ts +0 -6
- package/dist/weave/environment/detector.js +4 -45
- package/dist/weave/environment/index.d.ts +0 -19
- package/dist/weave/environment/index.js +1 -39
- package/dist/weave/environment/issues.d.ts +0 -35
- package/dist/weave/environment/issues.js +0 -59
- package/dist/weave/git.d.ts +0 -8
- package/dist/weave/git.js +0 -8
- package/dist/weave/index.d.ts +0 -13
- package/dist/weave/index.js +2 -28
- package/dist/weave/knowledge/global.d.ts +0 -39
- package/dist/weave/knowledge/global.js +2 -78
- package/dist/weave/loop.js +0 -3
- package/dist/weave/orchestrator.d.ts +0 -69
- package/dist/weave/orchestrator.js +1 -101
- package/dist/weave/phase-manager.d.ts +0 -64
- package/dist/weave/phase-manager.js +0 -89
- package/dist/weave/security/secret-scan.d.ts +0 -14
- package/dist/weave/security/secret-scan.js +0 -19
- package/dist/weave/stages/build.js +0 -15
- package/dist/weave/stages/execute.d.ts +0 -42
- package/dist/weave/stages/execute.js +4 -86
- package/dist/weave/stages/handoff.d.ts +0 -7
- package/dist/weave/stages/handoff.js +0 -43
- package/dist/weave/stages/index.d.ts +0 -3
- package/dist/weave/stages/index.js +0 -3
- package/dist/weave/stages/intake.d.ts +0 -8
- package/dist/weave/stages/intake.js +5 -65
- package/dist/weave/stages/map.d.ts +0 -1
- package/dist/weave/stages/openspec.d.ts +0 -1
- package/dist/weave/stages/plan.d.ts +0 -11
- package/dist/weave/stages/plan.js +1 -53
- package/dist/weave/stages/refine.d.ts +0 -7
- package/dist/weave/stages/refine.js +0 -7
- package/dist/weave/stages/research.d.ts +0 -6
- package/dist/weave/stages/research.js +0 -6
- package/dist/weave/stages/spec.d.ts +0 -12
- package/dist/weave/stages/spec.js +0 -17
- package/dist/weave/types.d.ts +0 -20
- package/dist/weave/types.js +0 -5
- package/dist/weave/verification/commands.d.ts +0 -12
- package/dist/weave/verification/commands.js +0 -19
- package/dist/weave/verification/index.d.ts +0 -6
- package/dist/weave/verification/index.js +1 -19
- package/dist/weave/verification/playwright.d.ts +0 -47
- package/dist/weave/verification/playwright.js +1 -90
- package/dist/weave/worktree.d.ts +0 -16
- package/dist/weave/worktree.js +0 -23
- package/dist/weave/yaml-repair.d.ts +0 -39
- package/dist/weave/yaml-repair.js +13 -116
- package/package.json +1 -1
package/dist/context/index.js
CHANGED
|
@@ -1,17 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Context Package
|
|
3
|
-
*
|
|
4
|
-
* 피처 기반 컨텍스트 관리 시스템
|
|
5
|
-
*
|
|
6
|
-
* "Export only what's needed" - Kent Beck
|
|
7
|
-
*/
|
|
8
|
-
// Configuration
|
|
9
1
|
export { CONTEXT_CONFIG, getContextDir, getProjectPath, getFeaturesDir, getFeaturePath, getContextConfig, } from './config.js';
|
|
10
|
-
// Project Context
|
|
11
2
|
export { getProjectContext, saveProjectContext, initContextDir, } from './project.js';
|
|
12
|
-
// Feature Management
|
|
13
3
|
export { createFeature, getFeature, updateFeature, listFeatures, switchFeature, completeFeature, deleteFeature, getActiveFeature, } from './feature.js';
|
|
14
|
-
// File Management
|
|
15
4
|
export { addFileToFeature, removeFileFromFeature, } from './files.js';
|
|
16
|
-
// Utilities
|
|
17
5
|
export { now, errorMessage, normalizePath, } from './utils.js';
|
|
@@ -1,25 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Project Context Management
|
|
3
|
-
*
|
|
4
|
-
* 프로젝트 전체 메타데이터 관리
|
|
5
|
-
*
|
|
6
|
-
* "Each function should do one thing and do it well" - Kent Beck
|
|
7
|
-
*/
|
|
8
1
|
import type { ProjectContext, Result } from './types.js';
|
|
9
|
-
/**
|
|
10
|
-
* 프로젝트 컨텍스트를 읽어옵니다.
|
|
11
|
-
*/
|
|
12
2
|
export declare function getProjectContext(basePath: string): Promise<Result<ProjectContext>>;
|
|
13
|
-
/**
|
|
14
|
-
* 프로젝트 컨텍스트를 저장합니다.
|
|
15
|
-
*/
|
|
16
3
|
export declare function saveProjectContext(basePath: string, context: ProjectContext): Promise<Result<void>>;
|
|
17
|
-
/**
|
|
18
|
-
* 컨텍스트 디렉토리 구조를 초기화합니다.
|
|
19
|
-
*
|
|
20
|
-
* 생성 구조:
|
|
21
|
-
* .opencode/context/
|
|
22
|
-
* ├── project.json
|
|
23
|
-
* └── features/
|
|
24
|
-
*/
|
|
25
4
|
export declare function initContextDir(basePath: string): Promise<Result<void>>;
|
package/dist/context/project.js
CHANGED
|
@@ -1,20 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Project Context Management
|
|
3
|
-
*
|
|
4
|
-
* 프로젝트 전체 메타데이터 관리
|
|
5
|
-
*
|
|
6
|
-
* "Each function should do one thing and do it well" - Kent Beck
|
|
7
|
-
*/
|
|
8
1
|
import { mkdir, readFile, writeFile } from 'fs/promises';
|
|
9
2
|
import { existsSync } from 'fs';
|
|
10
3
|
import { getContextDir, getProjectPath } from './config.js';
|
|
11
4
|
import { errorMessage } from './utils.js';
|
|
12
|
-
// ============================================================================
|
|
13
|
-
// Project Context Operations
|
|
14
|
-
// ============================================================================
|
|
15
|
-
/**
|
|
16
|
-
* 프로젝트 컨텍스트를 읽어옵니다.
|
|
17
|
-
*/
|
|
18
5
|
export async function getProjectContext(basePath) {
|
|
19
6
|
try {
|
|
20
7
|
const projectPath = getProjectPath(basePath);
|
|
@@ -35,13 +22,9 @@ export async function getProjectContext(basePath) {
|
|
|
35
22
|
};
|
|
36
23
|
}
|
|
37
24
|
}
|
|
38
|
-
/**
|
|
39
|
-
* 프로젝트 컨텍스트를 저장합니다.
|
|
40
|
-
*/
|
|
41
25
|
export async function saveProjectContext(basePath, context) {
|
|
42
26
|
try {
|
|
43
27
|
const projectPath = getProjectPath(basePath);
|
|
44
|
-
// 디렉토리가 없으면 초기화
|
|
45
28
|
if (!existsSync(getContextDir(basePath))) {
|
|
46
29
|
const initResult = await initContextDir(basePath);
|
|
47
30
|
if (!initResult.success) {
|
|
@@ -58,25 +41,12 @@ export async function saveProjectContext(basePath, context) {
|
|
|
58
41
|
};
|
|
59
42
|
}
|
|
60
43
|
}
|
|
61
|
-
// ============================================================================
|
|
62
|
-
// Directory Initialization
|
|
63
|
-
// ============================================================================
|
|
64
|
-
/**
|
|
65
|
-
* 컨텍스트 디렉토리 구조를 초기화합니다.
|
|
66
|
-
*
|
|
67
|
-
* 생성 구조:
|
|
68
|
-
* .opencode/context/
|
|
69
|
-
* ├── project.json
|
|
70
|
-
* └── features/
|
|
71
|
-
*/
|
|
72
44
|
export async function initContextDir(basePath) {
|
|
73
45
|
try {
|
|
74
46
|
const { getFeaturesDir } = await import('./config.js');
|
|
75
47
|
const featuresDir = getFeaturesDir(basePath);
|
|
76
48
|
const projectPath = getProjectPath(basePath);
|
|
77
|
-
// 디렉토리 생성 (recursive)
|
|
78
49
|
await mkdir(featuresDir, { recursive: true });
|
|
79
|
-
// project.json이 없으면 기본값으로 생성
|
|
80
50
|
if (!existsSync(projectPath)) {
|
|
81
51
|
const defaultProject = {
|
|
82
52
|
name: basePath.split(/[/\\]/).pop() || 'unnamed-project',
|
package/dist/context/types.d.ts
CHANGED
|
@@ -1,69 +1,21 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Context Type Definitions
|
|
3
|
-
*
|
|
4
|
-
* 피처 기반 컨텍스트 관리 시스템의 타입 정의
|
|
5
|
-
*
|
|
6
|
-
* 설계 원칙:
|
|
7
|
-
* - 명확한 이름으로 의도 표현 (Intention-Revealing Names)
|
|
8
|
-
* - 타입 안전성 (Type Safety)
|
|
9
|
-
* - 불변성 강조 (Immutability)
|
|
10
|
-
*
|
|
11
|
-
* @author Kent Beck's Dummy Human
|
|
12
|
-
*/
|
|
13
|
-
/**
|
|
14
|
-
* 피처 컨텍스트
|
|
15
|
-
*
|
|
16
|
-
* 하나의 작업 단위를 나타냅니다. 로그인 기능 구현, 버그 수정 등
|
|
17
|
-
* 각 피처는 관련 파일들과 현재 진행 상태를 추적합니다.
|
|
18
|
-
*/
|
|
19
1
|
export interface FeatureContext {
|
|
20
|
-
/** 고유 식별자 (UUID) */
|
|
21
2
|
id: string;
|
|
22
|
-
/** 피처 이름 (예: "login-oauth") */
|
|
23
3
|
name: string;
|
|
24
|
-
/** 한 줄 목표 설명 */
|
|
25
4
|
goal: string;
|
|
26
|
-
/** 현재 상태 */
|
|
27
5
|
status: 'active' | 'paused' | 'completed';
|
|
28
|
-
/** 관련 파일 목록 */
|
|
29
6
|
files: string[];
|
|
30
|
-
/** 마지막 작업 상태 스냅샷 */
|
|
31
7
|
lastContext: string;
|
|
32
|
-
/** 막힌 부분 (선택) */
|
|
33
8
|
blockers?: string;
|
|
34
|
-
/** 생성 시각 (ISO 8601) */
|
|
35
9
|
createdAt: string;
|
|
36
|
-
/** 마지막 수정 시각 (ISO 8601) */
|
|
37
10
|
updatedAt: string;
|
|
38
11
|
}
|
|
39
|
-
/**
|
|
40
|
-
* 프로젝트 컨텍스트
|
|
41
|
-
*
|
|
42
|
-
* 프로젝트 전체에 대한 메타 정보를 관리합니다.
|
|
43
|
-
*/
|
|
44
12
|
export interface ProjectContext {
|
|
45
|
-
/** 프로젝트 이름 */
|
|
46
13
|
name: string;
|
|
47
|
-
/** 기술 스택 */
|
|
48
14
|
techStack?: string[];
|
|
49
|
-
/** 코딩 컨벤션 */
|
|
50
15
|
conventions?: string;
|
|
51
|
-
/** 현재 활성 피처 ID */
|
|
52
16
|
activeFeatureId?: string;
|
|
53
17
|
}
|
|
54
|
-
/**
|
|
55
|
-
* 피처 업데이트 입력
|
|
56
|
-
*
|
|
57
|
-
* Partial을 사용하되 id와 createdAt은 변경 불가
|
|
58
|
-
*/
|
|
59
18
|
export type FeatureUpdate = Partial<Omit<FeatureContext, 'id' | 'createdAt'>>;
|
|
60
|
-
/**
|
|
61
|
-
* 작업 결과 타입
|
|
62
|
-
*
|
|
63
|
-
* 모든 작업은 성공/실패를 명시적으로 반환
|
|
64
|
-
*
|
|
65
|
-
* "Make the return value obvious" - Kent Beck
|
|
66
|
-
*/
|
|
67
19
|
export interface Result<T> {
|
|
68
20
|
success: boolean;
|
|
69
21
|
data?: T;
|
package/dist/context/types.js
CHANGED
package/dist/context/utils.d.ts
CHANGED
|
@@ -1,21 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Context Utilities
|
|
3
|
-
*
|
|
4
|
-
* 작은, 재사용 가능한 유틸리티 함수들
|
|
5
|
-
*
|
|
6
|
-
* "Small functions, well named, doing one thing" - Kent Beck
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* 현재 시각을 ISO 8601 형식으로 반환
|
|
10
|
-
*/
|
|
11
1
|
export declare function now(): string;
|
|
12
|
-
/**
|
|
13
|
-
* 에러에서 메시지 추출
|
|
14
|
-
*
|
|
15
|
-
* "Handle errors gracefully" - Kent Beck
|
|
16
|
-
*/
|
|
17
2
|
export declare function errorMessage(error: unknown): string;
|
|
18
|
-
/**
|
|
19
|
-
* 파일 경로 정규화 (Windows 백슬래시 → 슬래시)
|
|
20
|
-
*/
|
|
21
3
|
export declare function normalizePath(filePath: string): string;
|
package/dist/context/utils.js
CHANGED
|
@@ -1,39 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Context Utilities
|
|
3
|
-
*
|
|
4
|
-
* 작은, 재사용 가능한 유틸리티 함수들
|
|
5
|
-
*
|
|
6
|
-
* "Small functions, well named, doing one thing" - Kent Beck
|
|
7
|
-
*/
|
|
8
|
-
// ============================================================================
|
|
9
|
-
// Time Utilities
|
|
10
|
-
// ============================================================================
|
|
11
|
-
/**
|
|
12
|
-
* 현재 시각을 ISO 8601 형식으로 반환
|
|
13
|
-
*/
|
|
14
1
|
export function now() {
|
|
15
2
|
return new Date().toISOString();
|
|
16
3
|
}
|
|
17
|
-
// ============================================================================
|
|
18
|
-
// Error Handling
|
|
19
|
-
// ============================================================================
|
|
20
|
-
/**
|
|
21
|
-
* 에러에서 메시지 추출
|
|
22
|
-
*
|
|
23
|
-
* "Handle errors gracefully" - Kent Beck
|
|
24
|
-
*/
|
|
25
4
|
export function errorMessage(error) {
|
|
26
5
|
if (error instanceof Error) {
|
|
27
6
|
return error.message;
|
|
28
7
|
}
|
|
29
8
|
return String(error);
|
|
30
9
|
}
|
|
31
|
-
// ============================================================================
|
|
32
|
-
// Path Normalization
|
|
33
|
-
// ============================================================================
|
|
34
|
-
/**
|
|
35
|
-
* 파일 경로 정규화 (Windows 백슬래시 → 슬래시)
|
|
36
|
-
*/
|
|
37
10
|
export function normalizePath(filePath) {
|
|
38
11
|
return filePath.replace(/\\/g, '/');
|
|
39
12
|
}
|
|
@@ -1,28 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Prompt Builder
|
|
3
|
-
*
|
|
4
|
-
* Builds system prompts from mask definitions.
|
|
5
|
-
*/
|
|
6
1
|
import type { MaskSchema, LoadedMask } from '../schema/types';
|
|
7
2
|
export interface PromptBuilderOptions {
|
|
8
|
-
/** Include metadata in prompt header */
|
|
9
3
|
includeMetadata?: boolean;
|
|
10
|
-
/** Include usage examples */
|
|
11
4
|
includeExamples?: boolean;
|
|
12
|
-
/** Additional context to append */
|
|
13
5
|
additionalContext?: string;
|
|
14
6
|
}
|
|
15
|
-
/**
|
|
16
|
-
* Build a system prompt from a mask
|
|
17
|
-
*/
|
|
18
7
|
export declare function buildPrompt(mask: MaskSchema | LoadedMask, options?: PromptBuilderOptions): string;
|
|
19
|
-
/**
|
|
20
|
-
* Build a minimal prompt (just the core system prompt)
|
|
21
|
-
*/
|
|
22
8
|
export declare function buildMinimalPrompt(mask: MaskSchema | LoadedMask): string;
|
|
23
|
-
/**
|
|
24
|
-
* Build a rich prompt with all available information
|
|
25
|
-
*/
|
|
26
9
|
export declare function buildRichPrompt(mask: MaskSchema | LoadedMask): string;
|
|
27
10
|
export declare const promptBuilder: {
|
|
28
11
|
build: typeof buildPrompt;
|
|
@@ -1,27 +1,16 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Prompt Builder
|
|
3
|
-
*
|
|
4
|
-
* Builds system prompts from mask definitions.
|
|
5
|
-
*/
|
|
6
1
|
const DEFAULT_OPTIONS = {
|
|
7
2
|
includeMetadata: false,
|
|
8
3
|
includeExamples: false,
|
|
9
4
|
};
|
|
10
|
-
/**
|
|
11
|
-
* Build a system prompt from a mask
|
|
12
|
-
*/
|
|
13
5
|
export function buildPrompt(mask, options = {}) {
|
|
14
6
|
const opts = { ...DEFAULT_OPTIONS, ...options };
|
|
15
7
|
const parts = [];
|
|
16
|
-
// Header (optional)
|
|
17
8
|
if (opts.includeMetadata) {
|
|
18
9
|
parts.push(`# ${mask.profile.name}`);
|
|
19
10
|
parts.push(`> ${mask.profile.tagline}`);
|
|
20
11
|
parts.push('');
|
|
21
12
|
}
|
|
22
|
-
// Main system prompt (always included)
|
|
23
13
|
parts.push(mask.behavior.systemPrompt.trim());
|
|
24
|
-
// Signature phrases (if available)
|
|
25
14
|
if (mask.behavior.signaturePhrases && mask.behavior.signaturePhrases.length > 0) {
|
|
26
15
|
parts.push('');
|
|
27
16
|
parts.push('SIGNATURE PHRASES YOU MAY USE:');
|
|
@@ -29,7 +18,6 @@ export function buildPrompt(mask, options = {}) {
|
|
|
29
18
|
parts.push(`- "${phrase}"`);
|
|
30
19
|
}
|
|
31
20
|
}
|
|
32
|
-
// Usage examples (optional)
|
|
33
21
|
if (opts.includeExamples && mask.usage.examples.length > 0) {
|
|
34
22
|
parts.push('');
|
|
35
23
|
parts.push('EXAMPLE SCENARIOS:');
|
|
@@ -38,7 +26,6 @@ export function buildPrompt(mask, options = {}) {
|
|
|
38
26
|
parts.push(` → ${example.expectedOutcome}`);
|
|
39
27
|
}
|
|
40
28
|
}
|
|
41
|
-
// Additional context (optional)
|
|
42
29
|
if (opts.additionalContext) {
|
|
43
30
|
parts.push('');
|
|
44
31
|
parts.push('ADDITIONAL CONTEXT:');
|
|
@@ -46,52 +33,38 @@ export function buildPrompt(mask, options = {}) {
|
|
|
46
33
|
}
|
|
47
34
|
return parts.join('\n');
|
|
48
35
|
}
|
|
49
|
-
/**
|
|
50
|
-
* Build a minimal prompt (just the core system prompt)
|
|
51
|
-
*/
|
|
52
36
|
export function buildMinimalPrompt(mask) {
|
|
53
37
|
return mask.behavior.systemPrompt.trim();
|
|
54
38
|
}
|
|
55
|
-
/**
|
|
56
|
-
* Build a rich prompt with all available information
|
|
57
|
-
*/
|
|
58
39
|
export function buildRichPrompt(mask) {
|
|
59
40
|
const parts = [];
|
|
60
|
-
// Identity header
|
|
61
41
|
parts.push(`You are ${mask.profile.name}.`);
|
|
62
42
|
parts.push(`${mask.profile.tagline}`);
|
|
63
43
|
parts.push('');
|
|
64
|
-
// Background
|
|
65
44
|
parts.push('BACKGROUND:');
|
|
66
45
|
parts.push(mask.profile.background.trim());
|
|
67
46
|
parts.push('');
|
|
68
|
-
// Expertise
|
|
69
47
|
parts.push('YOUR EXPERTISE:');
|
|
70
48
|
for (const exp of mask.profile.expertise) {
|
|
71
49
|
parts.push(`- ${exp}`);
|
|
72
50
|
}
|
|
73
51
|
parts.push('');
|
|
74
|
-
// Thinking style
|
|
75
52
|
parts.push('YOUR THINKING STYLE:');
|
|
76
53
|
parts.push(mask.profile.thinkingStyle.trim());
|
|
77
54
|
parts.push('');
|
|
78
|
-
// Main behavior instructions
|
|
79
55
|
parts.push('INSTRUCTIONS:');
|
|
80
56
|
parts.push(mask.behavior.systemPrompt.trim());
|
|
81
57
|
parts.push('');
|
|
82
|
-
// Communication style
|
|
83
58
|
const style = mask.behavior.communicationStyle;
|
|
84
59
|
parts.push('COMMUNICATION STYLE:');
|
|
85
60
|
parts.push(`- Tone: ${style.tone}`);
|
|
86
61
|
parts.push(`- Verbosity: ${style.verbosity}`);
|
|
87
62
|
parts.push(`- Technical depth: ${style.technicalDepth}`);
|
|
88
63
|
parts.push('');
|
|
89
|
-
// Strengths
|
|
90
64
|
parts.push('YOUR STRENGTHS:');
|
|
91
65
|
for (const strength of mask.profile.strengths) {
|
|
92
66
|
parts.push(`- ${strength}`);
|
|
93
67
|
}
|
|
94
|
-
// Limitations (if any)
|
|
95
68
|
if (mask.profile.limitations && mask.profile.limitations.length > 0) {
|
|
96
69
|
parts.push('');
|
|
97
70
|
parts.push('ACKNOWLEDGE YOUR LIMITATIONS:');
|
|
@@ -99,7 +72,6 @@ export function buildRichPrompt(mask) {
|
|
|
99
72
|
parts.push(`- ${limitation}`);
|
|
100
73
|
}
|
|
101
74
|
}
|
|
102
|
-
// Signature phrases
|
|
103
75
|
if (mask.behavior.signaturePhrases && mask.behavior.signaturePhrases.length > 0) {
|
|
104
76
|
parts.push('');
|
|
105
77
|
parts.push('PHRASES YOU MIGHT USE:');
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @maskweaver/core
|
|
3
|
-
*
|
|
4
|
-
* Core library for Maskweaver - AI expert persona system.
|
|
5
|
-
* 가면술사 핵심 라이브러리
|
|
6
|
-
*/
|
|
7
1
|
export type { Result } from '../shared/types.js';
|
|
8
2
|
export type { MaskSchema, MaskMetadata, MaskProfile, MaskBehavior, MaskUsage, MaskUsageExample, MaskConfig, MaskCatalog, MaskCatalogEntry, MaskCategory, LoadedMask, CommunicationTone, Verbosity, TechnicalDepth, } from './schema/types';
|
|
9
3
|
export { validateMask, validateMaskOrThrow, MaskSchemaValidator, type ValidationResult, } from './schema/validator';
|
package/dist/core/index.js
CHANGED
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @maskweaver/core
|
|
3
|
-
*
|
|
4
|
-
* Core library for Maskweaver - AI expert persona system.
|
|
5
|
-
* 가면술사 핵심 라이브러리
|
|
6
|
-
*/
|
|
7
|
-
// Validator
|
|
8
1
|
export { validateMask, validateMaskOrThrow, MaskSchemaValidator, } from './schema/validator';
|
|
9
|
-
// Loader
|
|
10
2
|
export { MaskLoader, } from './loader/MaskLoader';
|
|
11
|
-
// Prompt builder
|
|
12
3
|
export { promptBuilder, buildPrompt, buildMinimalPrompt, buildRichPrompt, } from './engine/promptBuilder';
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Mask Loader
|
|
3
|
-
*
|
|
4
|
-
* Loads mask definitions from the file system.
|
|
5
|
-
*/
|
|
6
1
|
import type { MaskCatalog, LoadedMask, MaskCatalogEntry } from '../schema/types';
|
|
7
2
|
export interface MaskLoaderOptions {
|
|
8
3
|
masksDir: string;
|
|
@@ -12,35 +7,17 @@ export declare class MaskLoader {
|
|
|
12
7
|
private catalog;
|
|
13
8
|
private cache;
|
|
14
9
|
constructor(options: MaskLoaderOptions);
|
|
15
|
-
/**
|
|
16
|
-
* Load the mask catalog (index.json)
|
|
17
|
-
*/
|
|
18
10
|
loadCatalog(): Promise<MaskCatalog>;
|
|
19
|
-
/**
|
|
20
|
-
* Load all masks from the catalog
|
|
21
|
-
*/
|
|
22
11
|
loadAll(): Promise<LoadedMask[]>;
|
|
23
|
-
/**
|
|
24
|
-
* Load a single mask by ID
|
|
25
|
-
*/
|
|
26
12
|
load(maskId: string): Promise<LoadedMask | null>;
|
|
27
|
-
/**
|
|
28
|
-
* List all masks (metadata only)
|
|
29
|
-
*/
|
|
30
13
|
listAll(): Promise<Array<MaskCatalogEntry & {
|
|
31
14
|
category: string;
|
|
32
15
|
}>>;
|
|
33
|
-
/**
|
|
34
|
-
* List categories
|
|
35
|
-
*/
|
|
36
16
|
listCategories(): Promise<Array<{
|
|
37
17
|
id: string;
|
|
38
18
|
name: string;
|
|
39
19
|
description: string;
|
|
40
20
|
count: number;
|
|
41
21
|
}>>;
|
|
42
|
-
/**
|
|
43
|
-
* Clear the cache
|
|
44
|
-
*/
|
|
45
22
|
clearCache(): void;
|
|
46
23
|
}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Mask Loader
|
|
3
|
-
*
|
|
4
|
-
* Loads mask definitions from the file system.
|
|
5
|
-
*/
|
|
6
1
|
import { readFile } from 'fs/promises';
|
|
7
2
|
import { existsSync } from 'fs';
|
|
8
3
|
import { parse as parseYaml } from 'yaml';
|
|
@@ -14,9 +9,6 @@ export class MaskLoader {
|
|
|
14
9
|
constructor(options) {
|
|
15
10
|
this.masksDir = options.masksDir;
|
|
16
11
|
}
|
|
17
|
-
/**
|
|
18
|
-
* Load the mask catalog (index.json)
|
|
19
|
-
*/
|
|
20
12
|
async loadCatalog() {
|
|
21
13
|
if (this.catalog) {
|
|
22
14
|
return this.catalog;
|
|
@@ -29,9 +21,6 @@ export class MaskLoader {
|
|
|
29
21
|
this.catalog = JSON.parse(content);
|
|
30
22
|
return this.catalog;
|
|
31
23
|
}
|
|
32
|
-
/**
|
|
33
|
-
* Load all masks from the catalog
|
|
34
|
-
*/
|
|
35
24
|
async loadAll() {
|
|
36
25
|
const catalog = await this.loadCatalog();
|
|
37
26
|
const masks = [];
|
|
@@ -50,16 +39,11 @@ export class MaskLoader {
|
|
|
50
39
|
}
|
|
51
40
|
return masks;
|
|
52
41
|
}
|
|
53
|
-
/**
|
|
54
|
-
* Load a single mask by ID
|
|
55
|
-
*/
|
|
56
42
|
async load(maskId) {
|
|
57
|
-
// Check cache
|
|
58
43
|
if (this.cache.has(maskId)) {
|
|
59
44
|
return this.cache.get(maskId);
|
|
60
45
|
}
|
|
61
46
|
const catalog = await this.loadCatalog();
|
|
62
|
-
// Find mask in catalog
|
|
63
47
|
let entry = null;
|
|
64
48
|
let categoryId = null;
|
|
65
49
|
for (const [catId, category] of Object.entries(catalog.categories)) {
|
|
@@ -73,7 +57,6 @@ export class MaskLoader {
|
|
|
73
57
|
if (!entry || !categoryId) {
|
|
74
58
|
return null;
|
|
75
59
|
}
|
|
76
|
-
// Load mask file
|
|
77
60
|
const filePath = `${this.masksDir}/${entry.file}`;
|
|
78
61
|
if (!existsSync(filePath)) {
|
|
79
62
|
throw new Error(`Mask file not found: ${filePath}`);
|
|
@@ -82,21 +65,15 @@ export class MaskLoader {
|
|
|
82
65
|
const parsed = filePath.endsWith('.yaml') || filePath.endsWith('.yml')
|
|
83
66
|
? parseYaml(content)
|
|
84
67
|
: JSON.parse(content);
|
|
85
|
-
// Validate
|
|
86
68
|
const validated = validateMaskOrThrow(parsed);
|
|
87
|
-
// Create loaded mask
|
|
88
69
|
const loadedMask = {
|
|
89
70
|
...validated,
|
|
90
71
|
category: categoryId,
|
|
91
72
|
filePath,
|
|
92
73
|
};
|
|
93
|
-
// Cache it
|
|
94
74
|
this.cache.set(maskId, loadedMask);
|
|
95
75
|
return loadedMask;
|
|
96
76
|
}
|
|
97
|
-
/**
|
|
98
|
-
* List all masks (metadata only)
|
|
99
|
-
*/
|
|
100
77
|
async listAll() {
|
|
101
78
|
const catalog = await this.loadCatalog();
|
|
102
79
|
const result = [];
|
|
@@ -110,9 +87,6 @@ export class MaskLoader {
|
|
|
110
87
|
}
|
|
111
88
|
return result;
|
|
112
89
|
}
|
|
113
|
-
/**
|
|
114
|
-
* List categories
|
|
115
|
-
*/
|
|
116
90
|
async listCategories() {
|
|
117
91
|
const catalog = await this.loadCatalog();
|
|
118
92
|
return Object.entries(catalog.categories).map(([id, cat]) => ({
|
|
@@ -122,9 +96,6 @@ export class MaskLoader {
|
|
|
122
96
|
count: cat.masks.length,
|
|
123
97
|
}));
|
|
124
98
|
}
|
|
125
|
-
/**
|
|
126
|
-
* Clear the cache
|
|
127
|
-
*/
|
|
128
99
|
clearCache() {
|
|
129
100
|
this.cache.clear();
|
|
130
101
|
this.catalog = null;
|
|
@@ -1,62 +1,38 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Mask Schema v1.0
|
|
3
|
-
*
|
|
4
|
-
* Defines the structure for AI expert personas.
|
|
5
|
-
* 가면술사 (Maskweaver) - Core Type Definitions
|
|
6
|
-
*/
|
|
7
1
|
export interface MaskMetadata {
|
|
8
|
-
/** Unique identifier (kebab-case) */
|
|
9
2
|
id: string;
|
|
10
|
-
/** Schema version for future compatibility */
|
|
11
3
|
version: '1.0';
|
|
12
|
-
/** Primary language of this mask definition */
|
|
13
4
|
language: 'en' | 'ko' | 'zh' | 'ja';
|
|
14
|
-
/** Creation/update timestamps (ISO 8601) */
|
|
15
5
|
created: string;
|
|
16
6
|
updated: string;
|
|
17
|
-
/** Contributors/authors */
|
|
18
7
|
authors?: string[];
|
|
19
|
-
/** Related mask IDs for cross-referencing */
|
|
20
8
|
relatedMasks?: string[];
|
|
21
|
-
/** Tags for categorization and search */
|
|
22
9
|
tags?: string[];
|
|
23
10
|
}
|
|
24
11
|
export interface MaskProfile {
|
|
25
|
-
/** Display name of the persona */
|
|
26
12
|
name: string;
|
|
27
|
-
/** One-line tagline */
|
|
28
13
|
tagline: string;
|
|
29
|
-
/** Detailed background (2-3 paragraphs) */
|
|
30
14
|
background: string;
|
|
31
|
-
/** Core expertise areas (3-5 items) */
|
|
32
15
|
expertise: string[];
|
|
33
|
-
/** Thinking style description */
|
|
34
16
|
thinkingStyle: string;
|
|
35
|
-
/** Key strengths (3-5 bullet points) */
|
|
36
17
|
strengths: string[];
|
|
37
|
-
/** Limitations/weaknesses (honesty is key) */
|
|
38
18
|
limitations?: string[];
|
|
39
19
|
}
|
|
40
20
|
export type CommunicationTone = 'direct' | 'friendly' | 'formal' | 'socratic' | 'enthusiastic';
|
|
41
21
|
export type Verbosity = 'concise' | 'moderate' | 'detailed';
|
|
42
22
|
export type TechnicalDepth = 'beginner' | 'intermediate' | 'expert';
|
|
43
23
|
export interface MaskBehavior {
|
|
44
|
-
/** System prompt injected when mask is applied */
|
|
45
24
|
systemPrompt: string;
|
|
46
|
-
/** Communication style guidelines */
|
|
47
25
|
communicationStyle: {
|
|
48
26
|
tone: CommunicationTone;
|
|
49
27
|
verbosity: Verbosity;
|
|
50
28
|
technicalDepth: TechnicalDepth;
|
|
51
29
|
};
|
|
52
|
-
/** Task approach patterns */
|
|
53
30
|
approachPatterns: {
|
|
54
31
|
problemSolving: string;
|
|
55
32
|
codeReview: string;
|
|
56
33
|
architecture?: string;
|
|
57
34
|
debugging?: string;
|
|
58
35
|
};
|
|
59
|
-
/** Example phrases this persona might use */
|
|
60
36
|
signaturePhrases?: string[];
|
|
61
37
|
}
|
|
62
38
|
export interface MaskUsageExample {
|
|
@@ -64,28 +40,17 @@ export interface MaskUsageExample {
|
|
|
64
40
|
expectedOutcome: string;
|
|
65
41
|
}
|
|
66
42
|
export interface MaskUsage {
|
|
67
|
-
/** When to use this mask */
|
|
68
43
|
suitableFor: string[];
|
|
69
|
-
/** When NOT to use this mask */
|
|
70
44
|
notSuitableFor?: string[];
|
|
71
|
-
/** Example use cases */
|
|
72
45
|
examples: MaskUsageExample[];
|
|
73
46
|
}
|
|
74
47
|
export interface MaskConfig {
|
|
75
|
-
/** Runtime configuration */
|
|
76
48
|
priority?: number;
|
|
77
|
-
/** Tool restrictions */
|
|
78
49
|
allowedTools?: string[];
|
|
79
50
|
disallowedTools?: string[];
|
|
80
|
-
/** Session settings */
|
|
81
51
|
maxTokens?: number;
|
|
82
52
|
temperature?: number;
|
|
83
53
|
}
|
|
84
|
-
/**
|
|
85
|
-
* Complete Mask Definition
|
|
86
|
-
*
|
|
87
|
-
* This is the main schema for defining expert personas (masks).
|
|
88
|
-
*/
|
|
89
54
|
export interface MaskSchema {
|
|
90
55
|
metadata: MaskMetadata;
|
|
91
56
|
profile: MaskProfile;
|
|
@@ -93,9 +58,6 @@ export interface MaskSchema {
|
|
|
93
58
|
usage: MaskUsage;
|
|
94
59
|
config?: MaskConfig;
|
|
95
60
|
}
|
|
96
|
-
/**
|
|
97
|
-
* Mask Catalog Entry (for index.json)
|
|
98
|
-
*/
|
|
99
61
|
export interface MaskCatalogEntry {
|
|
100
62
|
id: string;
|
|
101
63
|
name: string;
|
|
@@ -103,24 +65,15 @@ export interface MaskCatalogEntry {
|
|
|
103
65
|
tags: string[];
|
|
104
66
|
category?: string;
|
|
105
67
|
}
|
|
106
|
-
/**
|
|
107
|
-
* Mask Category (for index.json)
|
|
108
|
-
*/
|
|
109
68
|
export interface MaskCategory {
|
|
110
69
|
name: string;
|
|
111
70
|
description: string;
|
|
112
71
|
masks: MaskCatalogEntry[];
|
|
113
72
|
}
|
|
114
|
-
/**
|
|
115
|
-
* Mask Catalog (masks/index.json)
|
|
116
|
-
*/
|
|
117
73
|
export interface MaskCatalog {
|
|
118
74
|
version: string;
|
|
119
75
|
categories: Record<string, MaskCategory>;
|
|
120
76
|
}
|
|
121
|
-
/**
|
|
122
|
-
* Loaded Mask (with resolved category info)
|
|
123
|
-
*/
|
|
124
77
|
export interface LoadedMask extends MaskSchema {
|
|
125
78
|
category: string;
|
|
126
79
|
filePath: string;
|