@wooojin/forgen 0.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.
- package/.claude-plugin/plugin.json +20 -0
- package/CHANGELOG.md +353 -0
- package/CONTRIBUTING.md +98 -0
- package/LICENSE +21 -0
- package/README.ja.md +469 -0
- package/README.ko.md +469 -0
- package/README.md +483 -0
- package/README.zh.md +469 -0
- package/agents/analyst.md +98 -0
- package/agents/architect.md +62 -0
- package/agents/code-reviewer.md +120 -0
- package/agents/code-simplifier.md +197 -0
- package/agents/critic.md +70 -0
- package/agents/debugger.md +117 -0
- package/agents/designer.md +131 -0
- package/agents/executor.md +54 -0
- package/agents/explore.md +145 -0
- package/agents/git-master.md +212 -0
- package/agents/performance-reviewer.md +172 -0
- package/agents/planner.md +29 -0
- package/agents/qa-tester.md +158 -0
- package/agents/refactoring-expert.md +168 -0
- package/agents/scientist.md +144 -0
- package/agents/security-reviewer.md +137 -0
- package/agents/test-engineer.md +153 -0
- package/agents/verifier.md +133 -0
- package/agents/writer.md +184 -0
- package/commands/api-design.md +268 -0
- package/commands/architecture-decision.md +314 -0
- package/commands/ci-cd.md +270 -0
- package/commands/code-review.md +233 -0
- package/commands/compound.md +117 -0
- package/commands/database.md +263 -0
- package/commands/debug-detective.md +99 -0
- package/commands/docker.md +274 -0
- package/commands/documentation.md +276 -0
- package/commands/ecomode.md +51 -0
- package/commands/frontend.md +271 -0
- package/commands/git-master.md +90 -0
- package/commands/incident-response.md +292 -0
- package/commands/migrate.md +101 -0
- package/commands/performance.md +288 -0
- package/commands/refactor.md +105 -0
- package/commands/security-review.md +288 -0
- package/commands/tdd.md +183 -0
- package/commands/testing-strategy.md +265 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +295 -0
- package/dist/core/auto-compound-runner.d.ts +12 -0
- package/dist/core/auto-compound-runner.js +460 -0
- package/dist/core/config-hooks.d.ts +10 -0
- package/dist/core/config-hooks.js +112 -0
- package/dist/core/config-injector.d.ts +50 -0
- package/dist/core/config-injector.js +455 -0
- package/dist/core/doctor.d.ts +1 -0
- package/dist/core/doctor.js +163 -0
- package/dist/core/errors.d.ts +81 -0
- package/dist/core/errors.js +133 -0
- package/dist/core/global-config.d.ts +43 -0
- package/dist/core/global-config.js +25 -0
- package/dist/core/harness.d.ts +24 -0
- package/dist/core/harness.js +621 -0
- package/dist/core/init.d.ts +7 -0
- package/dist/core/init.js +37 -0
- package/dist/core/inspect-cli.d.ts +7 -0
- package/dist/core/inspect-cli.js +47 -0
- package/dist/core/legacy-detector.d.ts +33 -0
- package/dist/core/legacy-detector.js +66 -0
- package/dist/core/logger.d.ts +34 -0
- package/dist/core/logger.js +121 -0
- package/dist/core/mcp-config.d.ts +44 -0
- package/dist/core/mcp-config.js +177 -0
- package/dist/core/notepad.d.ts +31 -0
- package/dist/core/notepad.js +88 -0
- package/dist/core/paths.d.ts +85 -0
- package/dist/core/paths.js +101 -0
- package/dist/core/plugin-detector.d.ts +44 -0
- package/dist/core/plugin-detector.js +226 -0
- package/dist/core/runtime-detector.d.ts +8 -0
- package/dist/core/runtime-detector.js +49 -0
- package/dist/core/scope-resolver.d.ts +8 -0
- package/dist/core/scope-resolver.js +45 -0
- package/dist/core/session-logger.d.ts +6 -0
- package/dist/core/session-logger.js +111 -0
- package/dist/core/session-store.d.ts +28 -0
- package/dist/core/session-store.js +218 -0
- package/dist/core/settings-lock.d.ts +18 -0
- package/dist/core/settings-lock.js +125 -0
- package/dist/core/spawn.d.ts +3 -0
- package/dist/core/spawn.js +135 -0
- package/dist/core/types.d.ts +108 -0
- package/dist/core/types.js +1 -0
- package/dist/core/uninstall.d.ts +4 -0
- package/dist/core/uninstall.js +307 -0
- package/dist/core/v1-bootstrap.d.ts +26 -0
- package/dist/core/v1-bootstrap.js +155 -0
- package/dist/engine/compound-cli.d.ts +24 -0
- package/dist/engine/compound-cli.js +250 -0
- package/dist/engine/compound-extractor.d.ts +68 -0
- package/dist/engine/compound-extractor.js +860 -0
- package/dist/engine/compound-lifecycle.d.ts +32 -0
- package/dist/engine/compound-lifecycle.js +305 -0
- package/dist/engine/compound-loop.d.ts +32 -0
- package/dist/engine/compound-loop.js +511 -0
- package/dist/engine/match-eval-log.d.ts +139 -0
- package/dist/engine/match-eval-log.js +270 -0
- package/dist/engine/phrase-blocklist.d.ts +119 -0
- package/dist/engine/phrase-blocklist.js +208 -0
- package/dist/engine/skill-promoter.d.ts +20 -0
- package/dist/engine/skill-promoter.js +115 -0
- package/dist/engine/solution-format.d.ts +160 -0
- package/dist/engine/solution-format.js +432 -0
- package/dist/engine/solution-index.d.ts +13 -0
- package/dist/engine/solution-index.js +252 -0
- package/dist/engine/solution-matcher.d.ts +364 -0
- package/dist/engine/solution-matcher.js +656 -0
- package/dist/engine/solution-writer.d.ts +76 -0
- package/dist/engine/solution-writer.js +157 -0
- package/dist/engine/term-matcher.d.ts +81 -0
- package/dist/engine/term-matcher.js +268 -0
- package/dist/engine/term-normalizer.d.ts +116 -0
- package/dist/engine/term-normalizer.js +171 -0
- package/dist/fgx.d.ts +6 -0
- package/dist/fgx.js +42 -0
- package/dist/forge/cli.d.ts +11 -0
- package/dist/forge/cli.js +100 -0
- package/dist/forge/evidence-processor.d.ts +21 -0
- package/dist/forge/evidence-processor.js +87 -0
- package/dist/forge/mismatch-detector.d.ts +44 -0
- package/dist/forge/mismatch-detector.js +83 -0
- package/dist/forge/onboarding-cli.d.ts +6 -0
- package/dist/forge/onboarding-cli.js +89 -0
- package/dist/forge/onboarding.d.ts +25 -0
- package/dist/forge/onboarding.js +122 -0
- package/dist/hooks/compound-reflection.d.ts +45 -0
- package/dist/hooks/compound-reflection.js +82 -0
- package/dist/hooks/context-guard.d.ts +24 -0
- package/dist/hooks/context-guard.js +156 -0
- package/dist/hooks/dangerous-patterns.json +18 -0
- package/dist/hooks/db-guard.d.ts +17 -0
- package/dist/hooks/db-guard.js +105 -0
- package/dist/hooks/hook-config.d.ts +29 -0
- package/dist/hooks/hook-config.js +92 -0
- package/dist/hooks/hook-registry.d.ts +43 -0
- package/dist/hooks/hook-registry.js +31 -0
- package/dist/hooks/hooks-generator.d.ts +49 -0
- package/dist/hooks/hooks-generator.js +99 -0
- package/dist/hooks/intent-classifier.d.ts +12 -0
- package/dist/hooks/intent-classifier.js +62 -0
- package/dist/hooks/keyword-detector.d.ts +25 -0
- package/dist/hooks/keyword-detector.js +389 -0
- package/dist/hooks/notepad-injector.d.ts +18 -0
- package/dist/hooks/notepad-injector.js +51 -0
- package/dist/hooks/permission-handler.d.ts +14 -0
- package/dist/hooks/permission-handler.js +114 -0
- package/dist/hooks/post-tool-failure.d.ts +11 -0
- package/dist/hooks/post-tool-failure.js +118 -0
- package/dist/hooks/post-tool-handlers.d.ts +17 -0
- package/dist/hooks/post-tool-handlers.js +115 -0
- package/dist/hooks/post-tool-use.d.ts +29 -0
- package/dist/hooks/post-tool-use.js +151 -0
- package/dist/hooks/pre-compact.d.ts +10 -0
- package/dist/hooks/pre-compact.js +165 -0
- package/dist/hooks/pre-tool-use.d.ts +31 -0
- package/dist/hooks/pre-tool-use.js +325 -0
- package/dist/hooks/prompt-injection-filter.d.ts +56 -0
- package/dist/hooks/prompt-injection-filter.js +287 -0
- package/dist/hooks/rate-limiter.d.ts +21 -0
- package/dist/hooks/rate-limiter.js +86 -0
- package/dist/hooks/secret-filter.d.ts +14 -0
- package/dist/hooks/secret-filter.js +65 -0
- package/dist/hooks/session-recovery.d.ts +27 -0
- package/dist/hooks/session-recovery.js +406 -0
- package/dist/hooks/shared/atomic-write.d.ts +41 -0
- package/dist/hooks/shared/atomic-write.js +148 -0
- package/dist/hooks/shared/context-budget.d.ts +37 -0
- package/dist/hooks/shared/context-budget.js +45 -0
- package/dist/hooks/shared/file-lock.d.ts +56 -0
- package/dist/hooks/shared/file-lock.js +253 -0
- package/dist/hooks/shared/hook-response.d.ts +33 -0
- package/dist/hooks/shared/hook-response.js +62 -0
- package/dist/hooks/shared/injection-caps.d.ts +39 -0
- package/dist/hooks/shared/injection-caps.js +52 -0
- package/dist/hooks/shared/plugin-signal.d.ts +23 -0
- package/dist/hooks/shared/plugin-signal.js +104 -0
- package/dist/hooks/shared/read-stdin.d.ts +8 -0
- package/dist/hooks/shared/read-stdin.js +63 -0
- package/dist/hooks/shared/sanitize-id.d.ts +7 -0
- package/dist/hooks/shared/sanitize-id.js +9 -0
- package/dist/hooks/shared/sanitize.d.ts +7 -0
- package/dist/hooks/shared/sanitize.js +22 -0
- package/dist/hooks/skill-injector.d.ts +38 -0
- package/dist/hooks/skill-injector.js +285 -0
- package/dist/hooks/slop-detector.d.ts +18 -0
- package/dist/hooks/slop-detector.js +93 -0
- package/dist/hooks/solution-injector.d.ts +58 -0
- package/dist/hooks/solution-injector.js +436 -0
- package/dist/hooks/subagent-tracker.d.ts +10 -0
- package/dist/hooks/subagent-tracker.js +90 -0
- package/dist/i18n/index.d.ts +43 -0
- package/dist/i18n/index.js +224 -0
- package/dist/lib.d.ts +14 -0
- package/dist/lib.js +14 -0
- package/dist/mcp/server.d.ts +8 -0
- package/dist/mcp/server.js +40 -0
- package/dist/mcp/solution-reader.d.ts +90 -0
- package/dist/mcp/solution-reader.js +273 -0
- package/dist/mcp/tools.d.ts +16 -0
- package/dist/mcp/tools.js +302 -0
- package/dist/preset/facet-catalog.d.ts +17 -0
- package/dist/preset/facet-catalog.js +46 -0
- package/dist/preset/preset-manager.d.ts +31 -0
- package/dist/preset/preset-manager.js +111 -0
- package/dist/renderer/inspect-renderer.d.ts +11 -0
- package/dist/renderer/inspect-renderer.js +123 -0
- package/dist/renderer/rule-renderer.d.ts +18 -0
- package/dist/renderer/rule-renderer.js +159 -0
- package/dist/store/evidence-store.d.ts +23 -0
- package/dist/store/evidence-store.js +58 -0
- package/dist/store/profile-store.d.ts +12 -0
- package/dist/store/profile-store.js +53 -0
- package/dist/store/recommendation-store.d.ts +22 -0
- package/dist/store/recommendation-store.js +64 -0
- package/dist/store/rule-store.d.ts +22 -0
- package/dist/store/rule-store.js +62 -0
- package/dist/store/session-state-store.d.ts +11 -0
- package/dist/store/session-state-store.js +44 -0
- package/dist/store/types.d.ts +159 -0
- package/dist/store/types.js +7 -0
- package/hooks/hook-registry.json +21 -0
- package/hooks/hooks.json +185 -0
- package/package.json +89 -0
- package/plugin.json +20 -0
- package/scripts/postinstall.js +826 -0
- package/skills/api-design/SKILL.md +262 -0
- package/skills/architecture-decision/SKILL.md +309 -0
- package/skills/ci-cd/SKILL.md +264 -0
- package/skills/code-review/SKILL.md +228 -0
- package/skills/compound/SKILL.md +101 -0
- package/skills/database/SKILL.md +257 -0
- package/skills/debug-detective/SKILL.md +95 -0
- package/skills/docker/SKILL.md +268 -0
- package/skills/documentation/SKILL.md +270 -0
- package/skills/ecomode/SKILL.md +46 -0
- package/skills/frontend/SKILL.md +265 -0
- package/skills/git-master/SKILL.md +86 -0
- package/skills/incident-response/SKILL.md +286 -0
- package/skills/migrate/SKILL.md +96 -0
- package/skills/performance/SKILL.md +282 -0
- package/skills/refactor/SKILL.md +100 -0
- package/skills/security-review/SKILL.md +282 -0
- package/skills/tdd/SKILL.md +178 -0
- package/skills/testing-strategy/SKILL.md +260 -0
- package/starter-pack/solutions/starter-api-error-responses.md +37 -0
- package/starter-pack/solutions/starter-async-patterns.md +40 -0
- package/starter-pack/solutions/starter-caching-strategy.md +40 -0
- package/starter-pack/solutions/starter-code-review-checklist.md +39 -0
- package/starter-pack/solutions/starter-debugging-systematic.md +40 -0
- package/starter-pack/solutions/starter-dependency-injection.md +40 -0
- package/starter-pack/solutions/starter-error-handling-patterns.md +38 -0
- package/starter-pack/solutions/starter-git-atomic-commits.md +36 -0
- package/starter-pack/solutions/starter-input-validation.md +40 -0
- package/starter-pack/solutions/starter-n-plus-one-queries.md +37 -0
- package/starter-pack/solutions/starter-refactor-safely.md +38 -0
- package/starter-pack/solutions/starter-secret-management.md +37 -0
- package/starter-pack/solutions/starter-separation-of-concerns.md +36 -0
- package/starter-pack/solutions/starter-tdd-red-green-refactor.md +40 -0
- package/starter-pack/solutions/starter-typescript-strict-types.md +39 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Forgen — Domain Error Classes
|
|
3
|
+
*
|
|
4
|
+
* 도메인별 에러 계층:
|
|
5
|
+
* ForgenError (base)
|
|
6
|
+
* ├── ProviderError — AI provider 호출 실패
|
|
7
|
+
* ├── HookError — hook 실행 실패
|
|
8
|
+
* ├── ConfigError — 설정 파일 파싱/검증 실패
|
|
9
|
+
* ├── PackError — pack 설치/로드 실패
|
|
10
|
+
* ├── ForgeError — forge dimension/profile 관련 실패
|
|
11
|
+
* └── NonRetryableError — 재시도 불가 에러 (provider 내부 사용)
|
|
12
|
+
*/
|
|
13
|
+
export interface ForgenErrorOptions {
|
|
14
|
+
code?: string;
|
|
15
|
+
context?: Record<string, unknown>;
|
|
16
|
+
cause?: unknown;
|
|
17
|
+
}
|
|
18
|
+
/** 모든 forgen 에러의 기반 클래스 */
|
|
19
|
+
export declare class ForgenError extends Error {
|
|
20
|
+
readonly code: string;
|
|
21
|
+
readonly context: Record<string, unknown>;
|
|
22
|
+
constructor(message: string, options?: ForgenErrorOptions);
|
|
23
|
+
toJSON(): Record<string, unknown>;
|
|
24
|
+
}
|
|
25
|
+
export interface ProviderErrorOptions extends ForgenErrorOptions {
|
|
26
|
+
providerName?: string;
|
|
27
|
+
statusCode?: number;
|
|
28
|
+
}
|
|
29
|
+
/** AI provider 호출 실패 */
|
|
30
|
+
export declare class ProviderError extends ForgenError {
|
|
31
|
+
readonly providerName: string;
|
|
32
|
+
readonly statusCode: number | undefined;
|
|
33
|
+
constructor(message: string, options?: ProviderErrorOptions);
|
|
34
|
+
toJSON(): Record<string, unknown>;
|
|
35
|
+
}
|
|
36
|
+
export interface HookErrorOptions extends ForgenErrorOptions {
|
|
37
|
+
hookName?: string;
|
|
38
|
+
eventType?: string;
|
|
39
|
+
}
|
|
40
|
+
/** hook 실행 실패 */
|
|
41
|
+
export declare class HookError extends ForgenError {
|
|
42
|
+
readonly hookName: string;
|
|
43
|
+
readonly eventType: string;
|
|
44
|
+
constructor(message: string, options?: HookErrorOptions);
|
|
45
|
+
toJSON(): Record<string, unknown>;
|
|
46
|
+
}
|
|
47
|
+
export interface ConfigErrorOptions extends ForgenErrorOptions {
|
|
48
|
+
configPath?: string;
|
|
49
|
+
field?: string;
|
|
50
|
+
}
|
|
51
|
+
/** 설정 파일 파싱/검증 실패 */
|
|
52
|
+
export declare class ConfigError extends ForgenError {
|
|
53
|
+
readonly configPath: string;
|
|
54
|
+
readonly field: string | undefined;
|
|
55
|
+
constructor(message: string, options?: ConfigErrorOptions);
|
|
56
|
+
toJSON(): Record<string, unknown>;
|
|
57
|
+
}
|
|
58
|
+
export interface PackErrorOptions extends ForgenErrorOptions {
|
|
59
|
+
packName?: string;
|
|
60
|
+
}
|
|
61
|
+
/** pack 설치/로드 실패 */
|
|
62
|
+
export declare class PackError extends ForgenError {
|
|
63
|
+
readonly packName: string;
|
|
64
|
+
constructor(message: string, options?: PackErrorOptions);
|
|
65
|
+
toJSON(): Record<string, unknown>;
|
|
66
|
+
}
|
|
67
|
+
export interface ForgeErrorOptions extends ForgenErrorOptions {
|
|
68
|
+
dimension?: string;
|
|
69
|
+
profile?: string;
|
|
70
|
+
}
|
|
71
|
+
/** forge dimension/profile 관련 실패 */
|
|
72
|
+
export declare class ForgeError extends ForgenError {
|
|
73
|
+
readonly dimension: string | undefined;
|
|
74
|
+
readonly profile: string | undefined;
|
|
75
|
+
constructor(message: string, options?: ForgeErrorOptions);
|
|
76
|
+
toJSON(): Record<string, unknown>;
|
|
77
|
+
}
|
|
78
|
+
/** 재시도 불가 에러 (401/403 등) — provider 내부에서 사용 */
|
|
79
|
+
export declare class NonRetryableError extends ForgenError {
|
|
80
|
+
constructor(message: string);
|
|
81
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Forgen — Domain Error Classes
|
|
3
|
+
*
|
|
4
|
+
* 도메인별 에러 계층:
|
|
5
|
+
* ForgenError (base)
|
|
6
|
+
* ├── ProviderError — AI provider 호출 실패
|
|
7
|
+
* ├── HookError — hook 실행 실패
|
|
8
|
+
* ├── ConfigError — 설정 파일 파싱/검증 실패
|
|
9
|
+
* ├── PackError — pack 설치/로드 실패
|
|
10
|
+
* ├── ForgeError — forge dimension/profile 관련 실패
|
|
11
|
+
* └── NonRetryableError — 재시도 불가 에러 (provider 내부 사용)
|
|
12
|
+
*/
|
|
13
|
+
/** 모든 forgen 에러의 기반 클래스 */
|
|
14
|
+
export class ForgenError extends Error {
|
|
15
|
+
code;
|
|
16
|
+
context;
|
|
17
|
+
constructor(message, options = {}) {
|
|
18
|
+
super(message, { cause: options.cause });
|
|
19
|
+
this.name = 'ForgenError';
|
|
20
|
+
this.code = options.code ?? 'FORGEN_ERROR';
|
|
21
|
+
this.context = options.context ?? {};
|
|
22
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
23
|
+
}
|
|
24
|
+
toJSON() {
|
|
25
|
+
return {
|
|
26
|
+
name: this.name,
|
|
27
|
+
message: this.message,
|
|
28
|
+
code: this.code,
|
|
29
|
+
context: this.context,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/** AI provider 호출 실패 */
|
|
34
|
+
export class ProviderError extends ForgenError {
|
|
35
|
+
providerName;
|
|
36
|
+
statusCode;
|
|
37
|
+
constructor(message, options = {}) {
|
|
38
|
+
super(message, { ...options, code: options.code ?? 'PROVIDER_ERROR' });
|
|
39
|
+
this.name = 'ProviderError';
|
|
40
|
+
this.providerName = options.providerName ?? 'unknown';
|
|
41
|
+
this.statusCode = options.statusCode;
|
|
42
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
43
|
+
}
|
|
44
|
+
toJSON() {
|
|
45
|
+
return {
|
|
46
|
+
...super.toJSON(),
|
|
47
|
+
providerName: this.providerName,
|
|
48
|
+
statusCode: this.statusCode,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/** hook 실행 실패 */
|
|
53
|
+
export class HookError extends ForgenError {
|
|
54
|
+
hookName;
|
|
55
|
+
eventType;
|
|
56
|
+
constructor(message, options = {}) {
|
|
57
|
+
super(message, { ...options, code: options.code ?? 'HOOK_ERROR' });
|
|
58
|
+
this.name = 'HookError';
|
|
59
|
+
this.hookName = options.hookName ?? 'unknown';
|
|
60
|
+
this.eventType = options.eventType ?? 'unknown';
|
|
61
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
62
|
+
}
|
|
63
|
+
toJSON() {
|
|
64
|
+
return {
|
|
65
|
+
...super.toJSON(),
|
|
66
|
+
hookName: this.hookName,
|
|
67
|
+
eventType: this.eventType,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/** 설정 파일 파싱/검증 실패 */
|
|
72
|
+
export class ConfigError extends ForgenError {
|
|
73
|
+
configPath;
|
|
74
|
+
field;
|
|
75
|
+
constructor(message, options = {}) {
|
|
76
|
+
super(message, { ...options, code: options.code ?? 'CONFIG_ERROR' });
|
|
77
|
+
this.name = 'ConfigError';
|
|
78
|
+
this.configPath = options.configPath ?? 'unknown';
|
|
79
|
+
this.field = options.field;
|
|
80
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
81
|
+
}
|
|
82
|
+
toJSON() {
|
|
83
|
+
return {
|
|
84
|
+
...super.toJSON(),
|
|
85
|
+
configPath: this.configPath,
|
|
86
|
+
field: this.field,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/** pack 설치/로드 실패 */
|
|
91
|
+
export class PackError extends ForgenError {
|
|
92
|
+
packName;
|
|
93
|
+
constructor(message, options = {}) {
|
|
94
|
+
super(message, { ...options, code: options.code ?? 'PACK_ERROR' });
|
|
95
|
+
this.name = 'PackError';
|
|
96
|
+
this.packName = options.packName ?? 'unknown';
|
|
97
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
98
|
+
}
|
|
99
|
+
toJSON() {
|
|
100
|
+
return {
|
|
101
|
+
...super.toJSON(),
|
|
102
|
+
packName: this.packName,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/** forge dimension/profile 관련 실패 */
|
|
107
|
+
export class ForgeError extends ForgenError {
|
|
108
|
+
dimension;
|
|
109
|
+
profile;
|
|
110
|
+
constructor(message, options = {}) {
|
|
111
|
+
super(message, { ...options, code: options.code ?? 'FORGE_ERROR' });
|
|
112
|
+
this.name = 'ForgeError';
|
|
113
|
+
this.dimension = options.dimension;
|
|
114
|
+
this.profile = options.profile;
|
|
115
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
116
|
+
}
|
|
117
|
+
toJSON() {
|
|
118
|
+
return {
|
|
119
|
+
...super.toJSON(),
|
|
120
|
+
dimension: this.dimension,
|
|
121
|
+
profile: this.profile,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
// ── NonRetryable ──
|
|
126
|
+
/** 재시도 불가 에러 (401/403 등) — provider 내부에서 사용 */
|
|
127
|
+
export class NonRetryableError extends ForgenError {
|
|
128
|
+
constructor(message) {
|
|
129
|
+
super(message, { code: 'NON_RETRYABLE_ERROR' });
|
|
130
|
+
this.name = 'NonRetryableError';
|
|
131
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { QualityPack, AutonomyPack, TrustPolicy } from '../store/types.js';
|
|
2
|
+
export type NotifyVerbosity = 'minimal' | 'session' | 'agent' | 'verbose';
|
|
3
|
+
export interface GatewayConfig {
|
|
4
|
+
url: string;
|
|
5
|
+
headers?: Record<string, string>;
|
|
6
|
+
events?: string[];
|
|
7
|
+
enabled: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface GlobalConfig {
|
|
10
|
+
/** 사용자 프로필 이름 */
|
|
11
|
+
name?: string;
|
|
12
|
+
/** UI 언어 (ko | en) */
|
|
13
|
+
locale?: 'ko' | 'en';
|
|
14
|
+
/** 기본으로 --dangerously-skip-permissions 활성화 */
|
|
15
|
+
dangerouslySkipPermissions?: boolean;
|
|
16
|
+
/** 모델 라우팅 프리셋 */
|
|
17
|
+
modelRouting?: 'default' | 'cost-saving' | 'max-quality';
|
|
18
|
+
/** 알림 상세도 */
|
|
19
|
+
notifyVerbosity?: NotifyVerbosity;
|
|
20
|
+
/** 이벤트 게이트웨이 설정 */
|
|
21
|
+
gateway?: GatewayConfig;
|
|
22
|
+
/** 현재 적용된 base packs */
|
|
23
|
+
base_packs?: {
|
|
24
|
+
quality_pack: QualityPack;
|
|
25
|
+
autonomy_pack: AutonomyPack;
|
|
26
|
+
};
|
|
27
|
+
/** 사용자 trust 선호 */
|
|
28
|
+
trust_preferences?: {
|
|
29
|
+
desired_policy: TrustPolicy;
|
|
30
|
+
};
|
|
31
|
+
/** forgen inspect 표시 설정 */
|
|
32
|
+
inspect?: {
|
|
33
|
+
show_facets: boolean;
|
|
34
|
+
show_evidence: boolean;
|
|
35
|
+
max_evidence: number;
|
|
36
|
+
};
|
|
37
|
+
/** 레거시 마이그레이션 백업 경로 */
|
|
38
|
+
legacy_backup?: string;
|
|
39
|
+
}
|
|
40
|
+
/** v1 config 로드 (~/.forgen/config.json 우선, 레거시 폴백) */
|
|
41
|
+
export declare function loadGlobalConfig(): GlobalConfig;
|
|
42
|
+
/** v1 config 저장 (~/.forgen/config.json) */
|
|
43
|
+
export declare function saveGlobalConfig(config: GlobalConfig): void;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as fs from 'node:fs';
|
|
2
|
+
import { GLOBAL_CONFIG, V1_GLOBAL_CONFIG } from './paths.js';
|
|
3
|
+
/** v1 config 로드 (~/.forgen/config.json 우선, 레거시 폴백) */
|
|
4
|
+
export function loadGlobalConfig() {
|
|
5
|
+
// v1 경로 우선
|
|
6
|
+
if (fs.existsSync(V1_GLOBAL_CONFIG)) {
|
|
7
|
+
try {
|
|
8
|
+
return JSON.parse(fs.readFileSync(V1_GLOBAL_CONFIG, 'utf-8'));
|
|
9
|
+
}
|
|
10
|
+
catch { /* fall through */ }
|
|
11
|
+
}
|
|
12
|
+
// 레거시 폴백
|
|
13
|
+
if (fs.existsSync(GLOBAL_CONFIG)) {
|
|
14
|
+
try {
|
|
15
|
+
return JSON.parse(fs.readFileSync(GLOBAL_CONFIG, 'utf-8'));
|
|
16
|
+
}
|
|
17
|
+
catch { /* fall through */ }
|
|
18
|
+
}
|
|
19
|
+
return {};
|
|
20
|
+
}
|
|
21
|
+
/** v1 config 저장 (~/.forgen/config.json) */
|
|
22
|
+
export function saveGlobalConfig(config) {
|
|
23
|
+
fs.mkdirSync(require('node:path').dirname(V1_GLOBAL_CONFIG), { recursive: true });
|
|
24
|
+
fs.writeFileSync(V1_GLOBAL_CONFIG, JSON.stringify(config, null, 2));
|
|
25
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Forgen v1 — Core Harness (prepareHarness entry point)
|
|
3
|
+
*
|
|
4
|
+
* v1 설계: v1-bootstrap 기반 세션 오케스트레이션.
|
|
5
|
+
* philosophy/scope/pack 의존 제거. Profile + Preset Manager + Rule Renderer.
|
|
6
|
+
*
|
|
7
|
+
* Module Structure:
|
|
8
|
+
* - Lines 1-70: Imports, utility helpers
|
|
9
|
+
* - Lines 70-220: injectSettings — Claude Code settings.json injection
|
|
10
|
+
* - Lines 220-400: Agent/skill installation helpers
|
|
11
|
+
* - Lines 400-550: Rule file injection, gitignore, compound memory
|
|
12
|
+
* - Lines 550+: prepareHarness — main orchestration
|
|
13
|
+
*/
|
|
14
|
+
import { rollbackSettings } from './settings-lock.js';
|
|
15
|
+
import { type V1BootstrapResult } from './v1-bootstrap.js';
|
|
16
|
+
export interface V1HarnessContext {
|
|
17
|
+
cwd: string;
|
|
18
|
+
inTmux: boolean;
|
|
19
|
+
v1: V1BootstrapResult;
|
|
20
|
+
}
|
|
21
|
+
/** 최초 실행 여부: ~/.forgen/ 디렉토리가 없으면 true */
|
|
22
|
+
export declare function isFirstRun(): boolean;
|
|
23
|
+
export { rollbackSettings };
|
|
24
|
+
export declare function prepareHarness(cwd: string): Promise<V1HarnessContext>;
|