@wooojin/forgen 0.5.0 → 0.5.6
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 +1 -1
- package/CHANGELOG.md +236 -0
- package/README.ja.md +16 -8
- package/README.ko.md +17 -9
- package/README.md +6 -1
- package/README.zh.md +16 -8
- package/assets/claude/skills/verify/SKILL.md +66 -0
- package/assets/shared/hook-registry.json +217 -22
- package/dist/cli.js +7 -3
- package/dist/core/auto-compound-runner.js +73 -14
- package/dist/core/changelog-cli.d.ts +4 -1
- package/dist/core/changelog-cli.js +8 -7
- package/dist/core/compound-sweep-cli.d.ts +4 -1
- package/dist/core/compound-sweep-cli.js +25 -5
- package/dist/core/doctor.js +37 -0
- package/dist/core/spawn.d.ts +26 -0
- package/dist/core/spawn.js +38 -3
- package/dist/core/uninstall.d.ts +7 -0
- package/dist/core/uninstall.js +46 -1
- package/dist/engine/compound-loop.js +20 -1
- package/dist/hooks/context-guard.d.ts +3 -0
- package/dist/hooks/context-guard.js +16 -8
- package/dist/hooks/hook-config.js +5 -0
- package/dist/hooks/hook-registry.d.ts +17 -1
- package/dist/hooks/hooks-generator.d.ts +2 -0
- package/dist/hooks/hooks-generator.js +8 -1
- package/dist/hooks/session-end.d.ts +41 -0
- package/dist/hooks/session-end.js +113 -0
- package/dist/hooks/session-recovery.js +18 -1
- package/dist/hooks/shared/hook-timing.js +6 -1
- package/dist/host/codex-adapter.js +5 -0
- package/dist/host/codex-hook-alive.d.ts +23 -0
- package/dist/host/codex-hook-alive.js +51 -0
- package/dist/host/codex-notify.d.ts +55 -0
- package/dist/host/codex-notify.js +153 -0
- package/dist/host/codex-rollout.d.ts +21 -0
- package/dist/host/codex-rollout.js +82 -0
- package/dist/host/codex-rules-context.d.ts +25 -0
- package/dist/host/codex-rules-context.js +62 -0
- package/dist/host/exec-host.d.ts +10 -0
- package/dist/host/exec-host.js +18 -3
- package/dist/host/install-claude.d.ts +14 -0
- package/dist/host/install-claude.js +53 -0
- package/dist/host/install-codex.d.ts +120 -0
- package/dist/host/install-codex.js +560 -52
- package/dist/host/install-orchestrator.d.ts +4 -0
- package/dist/host/install-orchestrator.js +32 -2
- package/dist/host/invoke-agent.js +1 -0
- package/dist/host/parity-harness.js +7 -3
- package/dist/host/projection.d.ts +37 -3
- package/dist/host/projection.js +93 -42
- package/dist/store/evidence-store.js +121 -57
- package/dist/store/rule-store.d.ts +41 -0
- package/dist/store/rule-store.js +77 -2
- package/hooks/hooks.json +13 -1
- package/package.json +1 -1
- package/plugin.json +1 -1
- package/skills/architecture-decision/SKILL.md +18 -0
- package/skills/calibrate/SKILL.md +18 -0
- package/skills/code-review/SKILL.md +17 -0
- package/skills/compound/SKILL.md +17 -0
- package/skills/deep-interview/SKILL.md +7 -0
- package/skills/docker/SKILL.md +18 -0
- package/skills/forge-loop/SKILL.md +23 -0
- package/skills/learn/SKILL.md +15 -0
- package/skills/retro/SKILL.md +16 -0
- package/skills/ship/SKILL.md +18 -0
|
@@ -24,7 +24,23 @@ export interface CodexInstallOptions {
|
|
|
24
24
|
releaseMode?: boolean;
|
|
25
25
|
/** AGENTS.md 위치 override (default: pkgRoot 기준 자동 resolve). 격리 테스트용. */
|
|
26
26
|
agentsMdPath?: string;
|
|
27
|
+
/** ADR-016 D1: config.toml 에 forgen notify 폴백 등록 여부 (default true). */
|
|
28
|
+
registerNotify?: boolean;
|
|
27
29
|
}
|
|
30
|
+
/** ADR-016 D1 — config.toml `notify` 등록 결과. */
|
|
31
|
+
export type CodexNotifyStatus =
|
|
32
|
+
/** forgen 블록을 새로 썼거나 갱신함 */
|
|
33
|
+
'installed'
|
|
34
|
+
/** 이미 동일한 forgen 블록이 있음 */
|
|
35
|
+
| 'already-present'
|
|
36
|
+
/** 사용자가 직접 정의한 `notify` 가 있어 건드리지 않음 (단일 argv 라 병합 불가) */
|
|
37
|
+
| 'user-defined'
|
|
38
|
+
/** forgen 블록의 notify 줄이 손으로 고쳐져(여러 줄 배열 등) 안전하게 다시 쓸 수 없어 그대로 둠 */
|
|
39
|
+
| 'custom-block'
|
|
40
|
+
/** --no-notify: 블록이 없었음 */
|
|
41
|
+
| 'skipped'
|
|
42
|
+
/** --no-notify: 기존 forgen 블록을 제거함 */
|
|
43
|
+
| 'removed';
|
|
28
44
|
export interface CodexInstallResult {
|
|
29
45
|
codexHome: string;
|
|
30
46
|
hooksPath: string;
|
|
@@ -44,8 +60,111 @@ export interface CodexInstallResult {
|
|
|
44
60
|
devGuideSkillsPath: string;
|
|
45
61
|
devGuideSkillsInstalled: number;
|
|
46
62
|
devGuideSkillsRemoved: number;
|
|
63
|
+
/** ADR-014 D2: ~/.codex/agents/ch-*.toml 커스텀 에이전트 설치 결과 */
|
|
64
|
+
agentsPath: string;
|
|
65
|
+
agentsInstalled: number;
|
|
66
|
+
agentsRemoved: number;
|
|
67
|
+
/** ADR-014 D4: hooks.json forgen 엔트리 중 config.toml hooks.state 에 신뢰 기록이 있는 수 */
|
|
68
|
+
hookTrust: CodexHookTrustAudit;
|
|
69
|
+
/** ADR-014 D2: config.toml `[features] multi_agent = true` 여부 (false 면 ch-* 에이전트 spawn 불가 → 안내) */
|
|
70
|
+
multiAgentEnabled: boolean;
|
|
71
|
+
/** ADR-016 D1: config.toml `notify` 폴백 등록 결과 */
|
|
72
|
+
notify: CodexNotifyStatus;
|
|
73
|
+
}
|
|
74
|
+
export interface CodexHookTrustAudit {
|
|
75
|
+
/** hooks.json 의 forgen hook 명령 수 (Codex 가 지원하는 이벤트만) */
|
|
76
|
+
total: number;
|
|
77
|
+
/** Codex 가 모르는 이벤트라 조용히 무시되는 forgen 엔트리 (`<event>:<i>:<j>`) — trust 대상이 아님 */
|
|
78
|
+
ignoredByCodex: string[];
|
|
79
|
+
/** trusted_hash 가 현재 핸들러의 해시와 일치하고 꺼져 있지 않은 수 (Codex 가 실제로 실행하는 훅) */
|
|
80
|
+
trusted: number;
|
|
81
|
+
/** 신뢰 기록이 없는 hook 키 (`<event>:<i>:<j>`) */
|
|
82
|
+
untrusted: string[];
|
|
83
|
+
/**
|
|
84
|
+
* ADR-016 D2: 신뢰 기록은 있으나 핸들러가 바뀌어 해시가 어긋난 hook 키. Codex 는 `/hooks` 재승인
|
|
85
|
+
* 전까지 이 훅도 skip 한다 (이전엔 키 존재만 봐서 "trusted" 로 오표시).
|
|
86
|
+
*/
|
|
87
|
+
modified: string[];
|
|
88
|
+
/** 승인돼 있고 해시도 맞지만 사용자가 `/hooks` 에서 끈 훅 (`enabled = false`) — Codex 가 실행하지 않는다 */
|
|
89
|
+
disabled: string[];
|
|
90
|
+
/** config.toml 자체가 없거나 hooks.state 가 전혀 없으면 true (Codex 가 아직 한 번도 훅을 review 안 함) */
|
|
91
|
+
noStateRecorded: boolean;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* config.toml 에 forgen notify 블록을 upsert.
|
|
95
|
+
*
|
|
96
|
+
* - Codex 의 `notify` 는 top-level 단일 argv 다. 사용자가 이미 정의했으면 **건드리지 않는다** — 그리고
|
|
97
|
+
* forgen 블록이 남아 있으면 제거한다 (중복 키 = config.toml 파싱 실패 → Codex 기동 불가).
|
|
98
|
+
* - top-level 키는 첫 테이블 헤더 앞에 와야 하므로 블록은 항상 파일 최상단(BOM 뒤)에 둔다.
|
|
99
|
+
* - 사용자가 forgen 블록의 argv 뒤에 `"--", "<prog>", …` 로 자기 notifier 를 체인해 뒀으면 그 꼬리를 보존.
|
|
100
|
+
* 블록의 notify 줄을 한 줄 JSON 으로 읽을 수 없으면(여러 줄 배열 등 손편집) 아무것도 바꾸지 않는다.
|
|
101
|
+
* - 블록 사이에 Codex 가 끼워 넣은 줄(root 키)은 블록 바로 뒤로 옮겨 보존한다.
|
|
102
|
+
*/
|
|
103
|
+
export declare function upsertNotifyBlock(currentToml: string, pkgRoot: string): {
|
|
104
|
+
content: string;
|
|
105
|
+
status: CodexNotifyStatus;
|
|
106
|
+
};
|
|
107
|
+
/** forgen notify 블록 제거 (`--no-notify`, uninstall). 블록 사이에 끼어든 다른 줄은 보존. */
|
|
108
|
+
export declare function removeNotifyBlock(currentToml: string): {
|
|
109
|
+
content: string;
|
|
110
|
+
removed: boolean;
|
|
111
|
+
};
|
|
112
|
+
interface HooksFile {
|
|
113
|
+
description?: string;
|
|
114
|
+
hooks: Record<string, Array<unknown>>;
|
|
47
115
|
}
|
|
48
116
|
export declare function planCodexInstall(opts: CodexInstallOptions): CodexInstallResult;
|
|
117
|
+
/** `[features]` 섹션 안에 `multi_agent = true` 가 있는지 (TOML 라이브러리 없이 섹션 범위만 본다). */
|
|
118
|
+
export declare function isCodexMultiAgentEnabled(configToml: string): boolean;
|
|
119
|
+
/**
|
|
120
|
+
* Codex 0.153 hooks 공식 이벤트 12종 (learn.chatgpt.com/docs/hooks + binary 문자열). 이 밖의 이벤트
|
|
121
|
+
* (예: Claude 전용 PostToolUseFailure) 는 Codex 가 조용히 무시하므로 trust 대상이 아니다.
|
|
122
|
+
*/
|
|
123
|
+
export declare const CODEX_SUPPORTED_HOOK_EVENTS: ReadonlySet<string>;
|
|
124
|
+
/** Codex 는 hooks.state 키에 이벤트명을 snake_case 로 쓴다 (PreToolUse → pre_tool_use). */
|
|
125
|
+
export declare function codexHookEventKey(event: string): string;
|
|
126
|
+
/**
|
|
127
|
+
* ADR-016 D2 — Codex 0.153.4 의 hook trust 해시 재현 (`hook_hash`, discovery.rs).
|
|
128
|
+
*
|
|
129
|
+
* 해시는 *핸들러 단위*: `{event_name, matcher?, hooks:[정규화된 핸들러 1개]}` 의 canonical JSON sha256.
|
|
130
|
+
* 정규화: timeout 은 기본값/clamp 적용 후 항상 포함, async 항상 포함, statusMessage 는 있을 때만,
|
|
131
|
+
* additionalContextLimit 은 허용 이벤트에서 기본값(2500)이 아닐 때만. 파일 경로·인덱스·미지 필드는 불포함.
|
|
132
|
+
* `type:"command"` 가 아니면 null (forgen 은 command 훅만 쓴다).
|
|
133
|
+
*/
|
|
134
|
+
export declare function codexHookTrustHash(event: string, matcher: unknown, handler: {
|
|
135
|
+
type?: unknown;
|
|
136
|
+
command?: unknown;
|
|
137
|
+
timeout?: unknown;
|
|
138
|
+
async?: unknown;
|
|
139
|
+
statusMessage?: unknown;
|
|
140
|
+
additionalContextLimit?: unknown;
|
|
141
|
+
}): string | null;
|
|
142
|
+
/**
|
|
143
|
+
* hooks.json 의 forgen 엔트리 각각을 config.toml 의
|
|
144
|
+
* `[hooks.state."<hooksPath>:<event>:<groupIdx>:<hookIdx>"] trusted_hash` 와 대조한다 (ADR-014 D4).
|
|
145
|
+
*
|
|
146
|
+
* ADR-016 D2: 이전엔 *기록 유무* 만 봤다 — 그래서 핸들러가 바뀌어 Codex 가 `modified` 로 skip 하는 훅을
|
|
147
|
+
* "trusted" 로 오표시했다. 이제 Codex 와 같은 해시를 계산해 trusted / modified / untrusted 를 구분한다.
|
|
148
|
+
* 읽기 전용 대조이며 trusted_hash 를 쓰지 않는다 — Codex 의 review 정책을 우회하지 않는다.
|
|
149
|
+
*/
|
|
150
|
+
export declare function auditCodexHookTrust(opts: {
|
|
151
|
+
hooksPath: string;
|
|
152
|
+
configTomlPath: string;
|
|
153
|
+
pkgRoot: string;
|
|
154
|
+
hooksFile?: HooksFile | null;
|
|
155
|
+
configToml?: string;
|
|
156
|
+
}): CodexHookTrustAudit;
|
|
157
|
+
/**
|
|
158
|
+
* Claude agent .md → Codex agent role TOML.
|
|
159
|
+
* 공식 스키마(필수 name/description/developer_instructions, 선택 model_reasoning_effort/sandbox_mode)
|
|
160
|
+
* 외 필드는 쓰지 않는다 — Codex 가 unknown field 를 거부 (ADR-014 D2).
|
|
161
|
+
*/
|
|
162
|
+
export declare function renderCodexAgentToml(file: string, raw: string): {
|
|
163
|
+
name: string;
|
|
164
|
+
toml: string;
|
|
165
|
+
} | null;
|
|
166
|
+
/** ADR-014 D3 — Codex 스킬에는 `$ARGUMENTS` 치환 변수가 없다. */
|
|
167
|
+
export declare function adaptSkillBodyForCodex(body: string): string;
|
|
49
168
|
export declare function resolveAgentsMdPath(_pkgRoot: string): string;
|
|
50
169
|
export declare function upsertForgenRulesInAgentsMd(opts: {
|
|
51
170
|
agentsMdPath: string;
|
|
@@ -54,3 +173,4 @@ export declare function upsertForgenRulesInAgentsMd(opts: {
|
|
|
54
173
|
}): {
|
|
55
174
|
injected: boolean;
|
|
56
175
|
};
|
|
176
|
+
export {};
|