commitgate 0.4.0 → 0.7.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/AGENTS.template.md +8 -0
- package/CHANGELOG.md +115 -0
- package/README.en.md +112 -17
- package/README.md +117 -17
- package/bin/commitgate.mjs +15 -6
- package/bin/dispatch.d.mts +6 -0
- package/bin/dispatch.mjs +38 -0
- package/bin/init.ts +788 -78
- package/bin/migrate.ts +244 -0
- package/bin/uninstall.ts +43 -1
- package/package.json +6 -3
- package/req.config.json.sample +2 -0
- package/scripts/req/lib/adapters.ts +56 -8
- package/scripts/req/lib/config.ts +25 -0
- package/scripts/req/lib/porcelain.ts +104 -0
- package/scripts/req/lib/scratch.ts +104 -0
- package/scripts/req/req-commit.ts +16 -3
- package/scripts/req/req-doctor.ts +135 -31
- package/scripts/req/req-new.ts +60 -10
- package/scripts/req/req-next.ts +33 -17
- package/scripts/req/review-codex.ts +198 -68
- package/scripts/verify-review-overrides.mjs +96 -0
- package/templates/CLAUDE.template.md +2 -1
- package/templates/claude-command.md +5 -2
- package/templates/claude-skill.md +4 -1
- package/templates/cursor-rule.mdc +5 -2
- package/templates/workflow.gitignore +8 -0
- package/workflow/machine.schema.json +5 -1
- package/workflow/req.config.schema.json +5 -0
- package/workflow/review-persona.md +22 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** 타입 선언 — `bin/dispatch.mjs`(런타임은 tsx 없이 로드돼야 하므로 순수 .mjs로 유지)의 타입. */
|
|
2
|
+
export declare const VERB_MODULES: Record<string, string>
|
|
3
|
+
|
|
4
|
+
export type DispatchDecision = { entry: string; rest: string[] } | { unknown: string }
|
|
5
|
+
|
|
6
|
+
export declare function resolveDispatch(argv: string[]): DispatchDecision
|
package/bin/dispatch.mjs
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* commitgate bin verb dispatch — 순수 결정 로직(부작용 없음, 테스트 가능).
|
|
3
|
+
*
|
|
4
|
+
* `bin/commitgate.mjs`(register tsx·동적 import 부작용 포함)와 `tests/unit/dispatch.test.ts`가 공유한다.
|
|
5
|
+
* 설계 D3(REQ-2026-014 Stage B):
|
|
6
|
+
* - 알려진 verb → 해당 모듈(verb 토큰 소비).
|
|
7
|
+
* - argv 없음 **또는 첫 인자가 `-` 옵션** → init에 argv 전체 전달(하위호환: `npx commitgate --dry-run` 등).
|
|
8
|
+
* - 그 외 비-옵션 미지 토큰 → `unknown`(호출부가 fail-closed).
|
|
9
|
+
*
|
|
10
|
+
* `migrate`는 **파일 생성과 동시에**(Phase 3) 등록했다. Phase 1이 미리 등록하지 않은 이유는, 등록만 하고 모듈이 없으면
|
|
11
|
+
* 깨진 동적 import가 raw unhandled rejection으로 터지기 때문이다(`unknown` 분기의 친절한 1줄 오류가 낫다).
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/** verb → 대상 모듈(binDir 기준 상대). req:* 는 패키지의 scripts/req/*.ts 에서 실행(Stage B: 대상 프로젝트에 복사하지 않음). */
|
|
15
|
+
export const VERB_MODULES = {
|
|
16
|
+
'req:new': '../scripts/req/req-new.ts',
|
|
17
|
+
'req:next': '../scripts/req/req-next.ts',
|
|
18
|
+
'req:review-codex': '../scripts/req/review-codex.ts',
|
|
19
|
+
'req:doctor': '../scripts/req/req-doctor.ts',
|
|
20
|
+
'req:commit': '../scripts/req/req-commit.ts',
|
|
21
|
+
uninstall: 'uninstall.ts',
|
|
22
|
+
migrate: 'migrate.ts',
|
|
23
|
+
init: 'init.ts',
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* argv → { entry, rest } 또는 { unknown }.
|
|
28
|
+
* @param {string[]} argv process.argv.slice(2)
|
|
29
|
+
* @returns {{ entry: string, rest: string[] } | { unknown: string }}
|
|
30
|
+
*/
|
|
31
|
+
export function resolveDispatch(argv) {
|
|
32
|
+
const verb = argv[0]
|
|
33
|
+
// verb 없음 / init 옵션(`-`로 시작) → init에 argv 전체 전달(D3).
|
|
34
|
+
if (verb === undefined || verb.startsWith('-')) return { entry: 'init.ts', rest: argv }
|
|
35
|
+
if (Object.prototype.hasOwnProperty.call(VERB_MODULES, verb)) return { entry: VERB_MODULES[verb], rest: argv.slice(1) }
|
|
36
|
+
// 비-옵션 미지 토큰: 호출부가 fail-closed 처리(오타를 조용히 init으로 보내지 않는다).
|
|
37
|
+
return { unknown: verb }
|
|
38
|
+
}
|