@wooojin/forgen 0.6.9 → 0.6.10

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://claude.ai/schemas/claude-plugin.json",
3
3
  "name": "forgen",
4
- "version": "0.6.9",
4
+ "version": "0.6.10",
5
5
  "description": "Claude Code harness — the more you use Claude, the better it gets",
6
6
  "author": {
7
7
  "name": "jang-ujin",
package/CHANGELOG.md CHANGED
@@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.6.10] — 2026-11-17 — 가드가 세션을 멈추지 않음
11
+
12
+ ### Fixed
13
+ - **가드 적중 시 세션 정지.** PreToolUse 가드가 `continue:false` 를 보내 Claude Code 턴 전체가 이유 없이 멈추던 것을 고쳤다. 이제 해당 도구 호출만 거부하고 사유를 보이며 세션은 계속된다. 치명 명령(`rm -rf /`, `mkfs`, `DROP TABLE`)은 계속 거부하며 `FORGEN_USER_CONFIRMED` 로도 우회할 수 없다.
14
+ - **비밀 커밋 가드는 확인 요청(ask).** 이름·패턴 판단이라 오탐이 있을 수 있어, 차단 대신 사유를 보이고 사용자 확인을 받는다.
15
+ - **추적 중 `.env` 템플릿 오탐.** `.env` 이름 규칙은 새로 추가되는 파일에만 적용한다. 이미 추적 중인 `.env.development` 같은 예시값 템플릿의 수정은 내용 검사로 판단한다(진짜 키는 계속 잡힌다).
16
+
17
+ ### Changed
18
+ - dev: `@biomejs/biome` 2.6.6. dependabot 이 claude-mem 메이저 업데이트를 올리지 않는다(forgen-eval 비교 대상으로만 사용).
19
+
10
20
  ## [0.6.9] — 2026-11-05 — 실사용 신뢰성 재정비
11
21
 
12
22
  ### Added
@@ -560,7 +560,9 @@ async function main() {
560
560
  recordViolation({ rule_id: 'builtin:commit-secret', session_id: sessionId, source: 'pre-tool-guard', kind: 'deny', message_preview: `git secret files: ${secretHits.map((h) => h.file).slice(0, 5).join(', ')}`, target_kind: 'command' });
561
561
  }
562
562
  catch { /* fail-open */ }
563
- console.log(denyOrObserve('pre-tool-use', `[Forgen] 비밀 파일/키가 커밋 대상에 포함되어 차단했습니다:\n${lines}\n.gitignore 에 추가하거나 git reset 으로 빼고, 키가 이미 노출됐다면 폐기·재발급하세요.`));
563
+ // 이름·패턴 기반 판단이라 오탐이 있을 수 있다 → 조용히 막지 않고 사유를 보여주며 사용자에게 묻는다
564
+ // (사용자 교정 2026-11-06: "멈추면 안되는 거지. 차라리 물어봐야지 사용자한테").
565
+ console.log(ask(`[Forgen] 사용자 확인 필요 — 비밀 파일/키로 보이는 항목이 커밋 대상에 있습니다:\n${lines}\n예시값만 담긴 템플릿이면 승인하고, 진짜 비밀이면 거부한 뒤 .gitignore 추가 또는 git reset 으로 빼세요. 키가 이미 노출됐다면 폐기·재발급하세요.\n${ASK_NONINTERACTIVE_HINT}`));
564
566
  return;
565
567
  }
566
568
  }
@@ -119,6 +119,7 @@ function collectHits(ops, hookCwd, hits) {
119
119
  const candidates = new Set();
120
120
  const lsOthers = git(dir, ['ls-files', '-z', '--others', '--exclude-standard', ...pathArgs]).split('\0');
121
121
  const lsMod = git(dir, ['ls-files', '-z', '--modified', ...pathArgs]).split('\0');
122
+ const tracked = new Set(lsMod.filter(Boolean));
122
123
  for (const f of [...lsOthers, ...lsMod])
123
124
  if (f)
124
125
  candidates.add(f);
@@ -132,7 +133,9 @@ function collectHits(ops, hookCwd, hits) {
132
133
  if (n++ >= 200)
133
134
  break;
134
135
  checkBudget();
135
- const reason = secretFileReason(f);
136
+ // 이름 규칙(.env 등)은 저장소에 **새로 들어가는** 파일에만 적용한다. 이미 추적 중인 파일
137
+ // (예: 예시값만 담긴 .env.development 템플릿)의 수정은 내용 검사로 판단한다.
138
+ const reason = tracked.has(f) ? null : secretFileReason(f);
136
139
  if (reason)
137
140
  add(f, reason);
138
141
  try {
@@ -152,10 +155,8 @@ function collectHits(ops, hookCwd, hits) {
152
155
  else {
153
156
  const withAll = op.args.some((a) => a === '-a' || a === '--all' || /^-[a-zA-Z]*a[a-zA-Z]*$/.test(a) && !a.startsWith('--'));
154
157
  const diffArgs = (cached) => ['diff', ...(cached ? ['--cached'] : []), '-U0', '--no-color', '--no-ext-diff'];
155
- const files = [
156
- ...git(dir, ['diff', '--cached', '--name-only', '-z']).split('\0'),
157
- ...(withAll ? git(dir, ['diff', '--name-only', '-z']).split('\0') : []),
158
- ].filter(Boolean);
158
+ // 이름 규칙은 새로 추가되는 파일(--diff-filter=A)에만. 추적 중 파일의 수정은 아래 내용 검사로 본다.
159
+ const files = git(dir, ['diff', '--cached', '--name-only', '--diff-filter=A', '-z']).split('\0').filter(Boolean);
159
160
  for (const f of files) {
160
161
  const r = secretFileReason(f);
161
162
  if (r)
@@ -36,14 +36,18 @@ export declare function approveWithPostToolContext(context: string, userNotice?:
36
36
  * PostToolUse, PreToolUse 경고 등 모델 도달이 불필요한 경우 사용.
37
37
  */
38
38
  export declare function approveWithWarning(warning: string): string;
39
- /** 차단 응답 (PreToolUse 전용) */
39
+ /**
40
+ * 차단 응답 (PreToolUse 전용) — 해당 도구 호출만 거부하고 세션은 계속한다.
41
+ * `continue: false` 는 Claude Code 턴 전체를 멈춰("hook stopped continuation") 사용자가
42
+ * 왜 멈췄는지 알 수 없게 만든다. 거부는 permissionDecision='deny' 로 충분하다.
43
+ */
40
44
  export declare function deny(reason: string): string;
41
45
  /** 사용자 확인 요청 (PreToolUse 전용) */
42
46
  export declare function ask(reason: string): string;
43
47
  /**
44
48
  * P3' enforcement helper (2026-04-27)
45
49
  *
46
- * ALLOW-LIST 에 있는 hook 만 진짜 deny — 아닌 경우 approve + 관찰 신호로 강등.
50
+ * ALLOW-LIST 에 있는 hook 만 진짜 deny(도구 호출 거부, 세션은 계속) — 아닌 경우 approve + 관찰 신호로 강등.
47
51
  *
48
52
  * 사용:
49
53
  * ```ts
@@ -56,10 +56,14 @@ export function approveWithPostToolContext(context, userNotice) {
56
56
  export function approveWithWarning(warning) {
57
57
  return JSON.stringify({ continue: true, suppressOutput: false, systemMessage: warning });
58
58
  }
59
- /** 차단 응답 (PreToolUse 전용) */
59
+ /**
60
+ * 차단 응답 (PreToolUse 전용) — 해당 도구 호출만 거부하고 세션은 계속한다.
61
+ * `continue: false` 는 Claude Code 턴 전체를 멈춰("hook stopped continuation") 사용자가
62
+ * 왜 멈췄는지 알 수 없게 만든다. 거부는 permissionDecision='deny' 로 충분하다.
63
+ */
60
64
  export function deny(reason) {
61
65
  return JSON.stringify({
62
- continue: false,
66
+ continue: true,
63
67
  hookSpecificOutput: {
64
68
  hookEventName: 'PreToolUse',
65
69
  permissionDecision: 'deny',
@@ -81,7 +85,7 @@ export function ask(reason) {
81
85
  /**
82
86
  * P3' enforcement helper (2026-04-27)
83
87
  *
84
- * ALLOW-LIST 에 있는 hook 만 진짜 deny — 아닌 경우 approve + 관찰 신호로 강등.
88
+ * ALLOW-LIST 에 있는 hook 만 진짜 deny(도구 호출 거부, 세션은 계속) — 아닌 경우 approve + 관찰 신호로 강등.
85
89
  *
86
90
  * 사용:
87
91
  * ```ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wooojin/forgen",
3
- "version": "0.6.9",
3
+ "version": "0.6.10",
4
4
  "preferGlobal": true,
5
5
  "main": "dist/lib.js",
6
6
  "types": "./dist/lib.d.ts",
package/plugin.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://claude.ai/schemas/claude-plugin.json",
3
3
  "name": "forgen",
4
- "version": "0.6.9",
4
+ "version": "0.6.10",
5
5
  "description": "Claude Code harness — the more you use Claude, the better it gets",
6
6
  "author": {
7
7
  "name": "jang-ujin",