polydeukes 0.5.0 → 0.6.1
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/README.ko.md +54 -74
- package/README.md +55 -86
- package/dist/baseline.d.ts +82 -0
- package/dist/baseline.js +166 -0
- package/dist/bin.d.ts +1 -1
- package/dist/bin.js +26 -6
- package/dist/claude-code-hook.d.ts +7 -5
- package/dist/claude-code-hook.js +69 -17
- package/dist/claude-code.d.ts +6 -0
- package/dist/claude-code.js +6 -0
- package/dist/covenant-check.d.ts +10 -17
- package/dist/covenant-check.js +44 -12
- package/dist/covenant-module.d.ts +2 -2
- package/dist/covenant-module.js +9 -1
- package/dist/docs/README.ko.md +60 -0
- package/dist/docs/README.md +64 -0
- package/dist/docs/catalog.json +464 -0
- package/dist/docs/concepts/judgment.ko.md +113 -0
- package/dist/docs/concepts/judgment.md +113 -0
- package/dist/docs/how-to/configure-project.ko.md +99 -0
- package/dist/docs/how-to/configure-project.md +95 -0
- package/dist/docs/how-to/connect-surfaces.ko.md +115 -0
- package/dist/docs/how-to/connect-surfaces.md +118 -0
- package/dist/docs/how-to/write-disciplines.ko.md +124 -0
- package/dist/docs/how-to/write-disciplines.md +125 -0
- package/dist/docs/index.json +2046 -0
- package/dist/docs/reference/cli/covenant-check.ko.md +101 -0
- package/dist/docs/reference/cli/covenant-check.md +98 -0
- package/dist/docs/reference/cli/docs.ko.md +97 -0
- package/dist/docs/reference/cli/docs.md +95 -0
- package/dist/docs/reference/cli/explain.ko.md +79 -0
- package/dist/docs/reference/cli/explain.md +84 -0
- package/dist/docs/reference/cli/init.ko.md +119 -0
- package/dist/docs/reference/cli/init.md +131 -0
- package/dist/docs/reference/configuration/index.ko.md +448 -0
- package/dist/docs/reference/configuration/index.md +474 -0
- package/dist/docs/reference/packages/adapter-claude-code.ko.md +83 -0
- package/dist/docs/reference/{adapter-claude-code.md → packages/adapter-claude-code.md} +16 -10
- package/dist/docs/reference/packages/adapter-git.ko.md +101 -0
- package/dist/docs/reference/{adapter-git.md → packages/adapter-git.md} +25 -15
- package/dist/docs/reference/packages/core.ko.md +128 -0
- package/dist/docs/reference/{core.md → packages/core.md} +32 -13
- package/dist/docs/reference/packages/covenant.ko.md +115 -0
- package/dist/docs/reference/{covenant.md → packages/covenant.md} +41 -26
- package/dist/docs/reference/packages/polydeukes.ko.md +134 -0
- package/dist/docs/reference/packages/polydeukes.md +139 -0
- package/dist/docs/troubleshooting.ko.md +142 -0
- package/dist/docs/troubleshooting.md +97 -122
- package/dist/docs/tutorials/first-judgment.ko.md +82 -0
- package/dist/docs/tutorials/first-judgment.md +81 -0
- package/dist/docs-catalog.d.ts +25 -0
- package/dist/docs-catalog.js +450 -0
- package/dist/docs-library.d.ts +23 -0
- package/dist/docs-library.js +347 -0
- package/dist/docs-markdown.d.ts +32 -0
- package/dist/docs-markdown.js +150 -0
- package/dist/docs-query.d.ts +11 -40
- package/dist/docs-query.js +28 -122
- package/dist/docs-types.d.ts +105 -0
- package/dist/docs-types.js +2 -0
- package/dist/explain.d.ts +3 -5
- package/dist/explain.js +48 -47
- package/dist/index.d.ts +2 -3
- package/dist/index.js +1 -2
- package/dist/init-claude-code.d.ts +5 -3
- package/dist/init-claude-code.js +226 -63
- package/dist/init-grok.d.ts +51 -0
- package/dist/init-grok.js +242 -0
- package/dist/load-config.d.ts +5 -1
- package/dist/load-config.js +2 -1
- package/dist/pre-state-reader.d.ts +22 -0
- package/dist/pre-state-reader.js +32 -0
- package/dist/scaffold-project.js +48 -8
- package/dist/schema/polydeukes.schema.json +38 -91
- package/package.json +7 -7
- package/dist/docs/configuration.md +0 -103
- package/dist/docs/installation.md +0 -212
- package/dist/docs/reference/configuration.md +0 -338
- package/dist/docs/reference/polydeukes.md +0 -287
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# `@polydeukes/covenant`
|
|
2
2
|
|
|
3
|
-
**English** · [한국어](
|
|
3
|
+
**English** · [한국어](covenant.ko.md)
|
|
4
4
|
|
|
5
5
|
> **The judge** — the dispatcher, the discipline library, the meta-covenants, and the TTL
|
|
6
6
|
> witness valve.
|
|
@@ -9,10 +9,16 @@
|
|
|
9
9
|
> import it. What you reach is its behaviour, through the `disciplines:` block in your config
|
|
10
10
|
> and the rows it writes to `.polydeukes/roi.log`.
|
|
11
11
|
|
|
12
|
+
<a id="ownership"></a>
|
|
12
13
|
## What this package owns
|
|
13
14
|
|
|
14
15
|
The judge. Everything that turns a declared promise into a verdict lives here.
|
|
15
16
|
|
|
17
|
+
**This is the install unit for judgment.** An embedder that wants verdicts without the
|
|
18
|
+
umbrella's surfaces installs this package and provides `@polydeukes/core` alongside it — core
|
|
19
|
+
is a `peerDependency` here, so the vocabulary is shared rather than duplicated. The umbrella
|
|
20
|
+
is what satisfies that peer for an ordinary consumer.
|
|
21
|
+
|
|
16
22
|
| Unit | What it does |
|
|
17
23
|
|---|---|
|
|
18
24
|
| `runCovenant` wrapper | Runs a judge body, translates its non-blocking `1` into the blocking `2`, and logs every call. No covenant runs unmeasured |
|
|
@@ -22,22 +28,23 @@ The judge. Everything that turns a declared promise into a verdict lives here.
|
|
|
22
28
|
| Delta layer | New-violation-only judgment over a file's before/after pair |
|
|
23
29
|
| Discipline library | Config `disciplines:` entries become enforcement without a line of code |
|
|
24
30
|
|
|
31
|
+
<a id="disciplines-and-meta-covenants"></a>
|
|
25
32
|
## Discipline families and meta-covenants
|
|
26
33
|
|
|
27
|
-
**A `disciplines:` entry
|
|
28
|
-
|
|
29
|
-
|
|
34
|
+
**A `disciplines:` entry is one declaration** — `judge = relate ∘ extract` over the
|
|
35
|
+
observation as a world. What the declaration's sources bind decides what evidence the
|
|
36
|
+
judgment needs, which is also what decides whether it can be judged on a given surface.
|
|
30
37
|
|
|
31
|
-
|
|
|
32
|
-
|
|
33
|
-
|
|
|
34
|
-
|
|
|
35
|
-
|
|
|
36
|
-
|
|
|
38
|
+
| Sources | Judges | Evidence needed |
|
|
39
|
+
|---|---|---|
|
|
40
|
+
| the fixed names `target.path` · `pre` · `post` · `state` · `changes` | The change itself | A file change |
|
|
41
|
+
| the fixed name `command` | The shell call's command line | A shell call — an Edit carries none |
|
|
42
|
+
| `{ transcript: true }` | Session history — was a qualifying call actually executed *before* this one | A session |
|
|
43
|
+
| `{ file: … }` · `{ sidecar: true }` | Another file, or the spawn-record channel | The surface's reader for it |
|
|
37
44
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
45
|
+
The writing guide for these entries is [the configuration reference's `disciplines`
|
|
46
|
+
section](../configuration/index.md#disciplines); the declaration grammar is the core's
|
|
47
|
+
`algebra-declaration.schema.json`.
|
|
41
48
|
|
|
42
49
|
**Three meta-covenants** protect the judging chain. They are covenants like any other; the
|
|
43
50
|
vocabulary below applies to them unchanged.
|
|
@@ -51,7 +58,7 @@ vocabulary below applies to them unchanged.
|
|
|
51
58
|
**Six words** are the telemetry contract — five verdicts and one observation. A row in
|
|
52
59
|
`.polydeukes/roi.log` carries exactly one of them, and the CLI, the docs, and the tests use
|
|
53
60
|
the same word for the same event. How to read a row is in
|
|
54
|
-
[troubleshooting](
|
|
61
|
+
[troubleshooting](../../troubleshooting.md#reading-a-verdict).
|
|
55
62
|
|
|
56
63
|
| Verdict | Means |
|
|
57
64
|
|---|---|
|
|
@@ -69,6 +76,7 @@ arguments — leaves no row at all. The comparison observes the result rather th
|
|
|
69
76
|
spelling, so it records that write after the fact. It never blocks: the write already
|
|
70
77
|
happened, and the comparison fails open on both sides of the verdict.
|
|
71
78
|
|
|
79
|
+
<a id="consumer-contract"></a>
|
|
72
80
|
## Where the consumer touches it
|
|
73
81
|
|
|
74
82
|
- **The `disciplines:` block** in your config. One entry compiles into one registration,
|
|
@@ -79,6 +87,7 @@ happened, and the comparison fails open on both sides of the verdict.
|
|
|
79
87
|
|
|
80
88
|
No import. The umbrella assembles this package for both surfaces.
|
|
81
89
|
|
|
90
|
+
<a id="limits"></a>
|
|
82
91
|
## Declared limits
|
|
83
92
|
|
|
84
93
|
- **The shell axis leaves `skipped` rows, and that row is the contract.** Predicting a
|
|
@@ -86,18 +95,24 @@ No import. The umbrella assembles this package for both surfaces.
|
|
|
86
95
|
not "nothing gets through" — it is that **no call passes unrecorded**. A new spelling
|
|
87
96
|
landing in `skipped` is the declared limit showing itself. A pass with no row at all, or
|
|
88
97
|
one recorded `passed` without a judgment, is the defect class.
|
|
89
|
-
- **
|
|
90
|
-
none
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
98
|
+
- **A declaration that reads the session cannot be judged without one.** On the commit
|
|
99
|
+
surface there is none. A matching `precedent` (or any other transcript-reading)
|
|
100
|
+
declaration records `skipped` with the reason `supply-pass` only when that declaration's
|
|
101
|
+
own `supply` is `pass`. With no policy the missing session is unjudgeable (exit 2), not
|
|
102
|
+
an automatic skip. That skip-with-pass is a permanent condition of that surface.
|
|
103
|
+
- **A declaration scoped on `command` is absent from the commit surface, and absent without
|
|
104
|
+
a row.** A staged diff carries no command line, so no world such a declaration observes is
|
|
105
|
+
admitted there. This leaves nothing in `.polydeukes/roi.log`, so the log cannot separate a
|
|
106
|
+
command discipline that never triggered from one whose surface never observed a command.
|
|
107
|
+
- **A declaration the compiler cannot resolve compiles to a skip registration** — routing
|
|
108
|
+
intact, no body: a step outside the registry, an argument outside a step's keys, a pattern
|
|
109
|
+
that does not compile, a paired/single mismatch. Assembly therefore never throws: one
|
|
110
|
+
unresolvable entry cannot take down its siblings, the meta-covenants, and the valve, which
|
|
111
|
+
would leave no way to fix the config that caused it. A reserved mechanism, or one whose
|
|
112
|
+
axes and relations the catalogue refuses, is a different stage: `loadConfig` rejects the
|
|
113
|
+
file (exit 2), and no skip row is written. A source the world lacks at judgment time is a
|
|
114
|
+
third case — the declaration's own `supply` policy disposes of it, and with no policy the
|
|
115
|
+
body answers unjudgeable (exit 2), never upheld.
|
|
101
116
|
- **Complete containment is a non-goal.** There are no blocklists here — enumerating bypass
|
|
102
117
|
spellings is always one step behind, so the logic is inverted: a mention of a protected
|
|
103
118
|
path blocks unless proven safe. Residual vectors such as indirect path computation are
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# `polydeukes`
|
|
2
|
+
|
|
3
|
+
[English](./polydeukes.md) · **한국어**
|
|
4
|
+
|
|
5
|
+
일반 사용자는 통합 패키지인 `polydeukes` 하나만 설치하면 됩니다. CLI 실행 파일, 설정 로더, 커밋 표면 실행기, 세션 표면 실행기 서브패스, 동봉된 스키마 자산을
|
|
6
|
+
모두 이 패키지가 맡습니다.
|
|
7
|
+
|
|
8
|
+
<a id="polydeukes-entry-points"></a>
|
|
9
|
+
## 진입점
|
|
10
|
+
|
|
11
|
+
| 지정자 | 내보내는 것 |
|
|
12
|
+
|---|---|
|
|
13
|
+
| `polydeukes` | `loadConfig`, `runCovenantCheck`, `ResolvedConfig` |
|
|
14
|
+
| `polydeukes/claude-code` | `runClaudeCodeHook`과 입력·결과 타입 |
|
|
15
|
+
| `polydeukes/schema.json` | 동봉된 설정 JSON Schema |
|
|
16
|
+
|
|
17
|
+
같은 CLI를 `pdks`와 별칭 `polydeukes`로 실행할 수 있습니다.
|
|
18
|
+
|
|
19
|
+
<a id="polydeukes-bin"></a>
|
|
20
|
+
## CLI 명령
|
|
21
|
+
|
|
22
|
+
| 명령 | 목적 |
|
|
23
|
+
|---|---|
|
|
24
|
+
| `pdks covenant check` | 스테이징한 변경, 작업 트리, 리비전 범위를 판정 |
|
|
25
|
+
| `pdks init claude-code` | Claude Code 세션 표면 설치 |
|
|
26
|
+
| `pdks init grok` | Grok 세션 표면 설치 |
|
|
27
|
+
| `pdks explain` | 조립된 등록표를 판정 없이 표시 |
|
|
28
|
+
| `pdks docs [topic]` | 동봉된 주제를 읽음 |
|
|
29
|
+
| `pdks docs search <query>` | 동봉된 문서를 검색 |
|
|
30
|
+
| `pdks docs show <document-id>` | 동봉된 문서 또는 절을 표시 |
|
|
31
|
+
|
|
32
|
+
`pdks docs`는 오프라인입니다. 네트워크가 아니라 설치된 패키지를 읽습니다. 플래그, JSON,
|
|
33
|
+
종료 코드는 [`pdks docs`](../cli/docs.ko.md)에 있습니다.
|
|
34
|
+
|
|
35
|
+
<a id="polydeukes-export-map"></a>
|
|
36
|
+
## 공개 심볼
|
|
37
|
+
|
|
38
|
+
<a id="root-export"></a>
|
|
39
|
+
### `.` 루트 진입점
|
|
40
|
+
|
|
41
|
+
| 심볼 | 종류 | 메모 |
|
|
42
|
+
|---|---|---|
|
|
43
|
+
| `loadConfig` | 함수 | `rootDir` 아래의 `polydeukes.config.*` 파일 하나를 찾아 읽습니다. 없거나, 둘 이상이거나, 파싱이나 검증에서 실패하면 예외를 던집니다. |
|
|
44
|
+
| `runCovenantCheck` | 함수 | 커밋 표면을 실행하고 `{ exitCode: 0 \| 2 }`를 반환합니다. |
|
|
45
|
+
| `ResolvedConfig` | 타입 | `@polydeukes/core`에서 다시 내보냅니다. |
|
|
46
|
+
| `LoadConfigSpec`, `LoadedConfig` | 타입 | 설정 로더의 입력과 결과입니다. |
|
|
47
|
+
| `CovenantCheckSpec`, `CovenantCheckOutcome`, `CheckDomain` | 타입 | 커밋 실행기의 입력, 결과, 관측 범위입니다. |
|
|
48
|
+
|
|
49
|
+
<a id="session-export"></a>
|
|
50
|
+
### `./claude-code`
|
|
51
|
+
|
|
52
|
+
| 심볼 | 종류 | 메모 |
|
|
53
|
+
|---|---|---|
|
|
54
|
+
| `runClaudeCodeHook` | 함수 | 세션 표면을 실행하고 `{ exitCode: 0 \| 2 }`를 반환합니다. |
|
|
55
|
+
| `ClaudeCodeHookSpec` | 타입 | 세션 실행기 입력입니다. |
|
|
56
|
+
| `ClaudeCodeHookOutcome` | 타입 | 세션 실행기 결과입니다. |
|
|
57
|
+
|
|
58
|
+
생성된 훅은 배럴 대신 이 서브패스를 가져옵니다. ESM의 정적 가져오기는 모듈을 즉시 평가하므로,
|
|
59
|
+
배럴을 사용하면 세션 도구 호출에 필요 없는 커밋 표면 실행기와 Git 어댑터까지 매번 불러옵니다.
|
|
60
|
+
|
|
61
|
+
<a id="schema-export"></a>
|
|
62
|
+
### `./schema.json`
|
|
63
|
+
|
|
64
|
+
| 자산 | 메모 |
|
|
65
|
+
|---|---|
|
|
66
|
+
| `polydeukes.schema.json` | 통합 패키지에 동봉한 설정 스키마 사본입니다. |
|
|
67
|
+
|
|
68
|
+
<a id="polydeukes-signatures"></a>
|
|
69
|
+
## 시그니처와 예제
|
|
70
|
+
|
|
71
|
+
```ts
|
|
72
|
+
function loadConfig(spec: LoadConfigSpec): LoadedConfig;
|
|
73
|
+
|
|
74
|
+
type LoadConfigSpec = { rootDir: string };
|
|
75
|
+
|
|
76
|
+
type LoadedConfig = {
|
|
77
|
+
config: ResolvedConfig;
|
|
78
|
+
configPath: string;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
function runCovenantCheck(spec: CovenantCheckSpec): Promise<CovenantCheckOutcome>;
|
|
82
|
+
|
|
83
|
+
type CovenantCheckSpec = {
|
|
84
|
+
repoRoot: string;
|
|
85
|
+
telemetryPath?: string;
|
|
86
|
+
covenantDist?: string;
|
|
87
|
+
ttyPrompt?: (prompt: string) => string | null;
|
|
88
|
+
domain?: CheckDomain;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
type CheckDomain =
|
|
92
|
+
| { kind: 'staged' }
|
|
93
|
+
| { kind: 'worktree' }
|
|
94
|
+
| { kind: 'range'; base: string; head: string; ancestry?: 'merge-base' };
|
|
95
|
+
|
|
96
|
+
function runClaudeCodeHook(spec: ClaudeCodeHookSpec): Promise<ClaudeCodeHookOutcome>;
|
|
97
|
+
|
|
98
|
+
type ClaudeCodeHookSpec = {
|
|
99
|
+
repoRoot: string;
|
|
100
|
+
rawPayload?: string;
|
|
101
|
+
telemetryPath?: string;
|
|
102
|
+
covenantDist?: string;
|
|
103
|
+
};
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
`ancestry: 'merge-base'`는 `<base>...<head>`와 같이 공통 조상을 기준으로 비교한다는 뜻입니다.
|
|
107
|
+
`rawPayload`가 없으면 훅은 표준 입력인 파일 디스크립터 0을 읽습니다. 훅 타입은 루트 배럴이 아니라 `polydeukes/claude-code`에 있습니다.
|
|
108
|
+
|
|
109
|
+
```ts
|
|
110
|
+
import { loadConfig, runCovenantCheck } from 'polydeukes';
|
|
111
|
+
import { runClaudeCodeHook } from 'polydeukes/claude-code';
|
|
112
|
+
|
|
113
|
+
const { configPath } = loadConfig({ rootDir: process.cwd() });
|
|
114
|
+
const check = await runCovenantCheck({ repoRoot: process.cwd() });
|
|
115
|
+
const hook = await runClaudeCodeHook({ repoRoot: process.cwd(), rawPayload: '{}' });
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
<a id="polydeukes-failure-boundaries"></a>
|
|
119
|
+
## 실패 경계
|
|
120
|
+
|
|
121
|
+
- `loadConfig()`는 설정이 없거나, 둘 이상이거나, 파싱이나 검증에서 실패하면 예외를 던집니다.
|
|
122
|
+
- `runCovenantCheck()`와 `runClaudeCodeHook()`는 예외를 던지지 않고 `{ exitCode: 0 \| 2 }`를 반환합니다.
|
|
123
|
+
- 숫자 코드는 `@polydeukes/core`의 `EXIT_UPHOLD`(`0`), `EXIT_BREAK_NON_BLOCKING`(`1`),
|
|
124
|
+
`EXIT_BREAK_BLOCKING`(`2`)입니다. 우산 실행기는 `0` 또는 `2`만 노출하며 `1`을 반환하지 않습니다.
|
|
125
|
+
- `pdks covenant check`가 증인 토큰을 요청하는 것은 스테이징한 변경을 검사할 때뿐입니다. `--worktree`와 `--range`에서는 묻지 않습니다.
|
|
126
|
+
- `pdks docs`와 `pdks explain`은 실패 시 중간 출력 없이 끝납니다.
|
|
127
|
+
|
|
128
|
+
<a id="polydeukes-see-also"></a>
|
|
129
|
+
## 함께 보기
|
|
130
|
+
|
|
131
|
+
- [`pdks covenant check`](../cli/covenant-check.ko.md)
|
|
132
|
+
- [`pdks init`](../cli/init.ko.md)
|
|
133
|
+
- [`pdks explain`](../cli/explain.ko.md)
|
|
134
|
+
- [설정 참조](../configuration/index.ko.md)
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# `polydeukes`
|
|
2
|
+
|
|
3
|
+
**English** · [한국어](./polydeukes.ko.md)
|
|
4
|
+
|
|
5
|
+
The umbrella package is the only package a consumer installs. It owns the CLI bin, the config
|
|
6
|
+
loader, the commit-surface runner, the session-surface runner subpath, and the bundled schema
|
|
7
|
+
artifact.
|
|
8
|
+
|
|
9
|
+
<a id="polydeukes-entry-points"></a>
|
|
10
|
+
## Entry points
|
|
11
|
+
|
|
12
|
+
| Specifier | What it exports |
|
|
13
|
+
|---|---|
|
|
14
|
+
| `polydeukes` | `loadConfig`, `runCovenantCheck`, and `ResolvedConfig` |
|
|
15
|
+
| `polydeukes/claude-code` | `runClaudeCodeHook` and its spec/outcome types |
|
|
16
|
+
| `polydeukes/schema.json` | The bundled config JSON Schema |
|
|
17
|
+
|
|
18
|
+
The package has one executable name in `bin`: `pdks`, with `polydeukes` as an alias.
|
|
19
|
+
|
|
20
|
+
<a id="polydeukes-bin"></a>
|
|
21
|
+
## CLI surface
|
|
22
|
+
|
|
23
|
+
| Command | Purpose |
|
|
24
|
+
|---|---|
|
|
25
|
+
| `pdks covenant check` | Judge the staged diff, the working tree, or a ref range |
|
|
26
|
+
| `pdks init claude-code` | Install the Claude Code session surface |
|
|
27
|
+
| `pdks init grok` | Install the Grok session surface |
|
|
28
|
+
| `pdks explain` | Render the assembled registration table without judging |
|
|
29
|
+
| `pdks docs [topic]` | Read a bundled topic |
|
|
30
|
+
| `pdks docs search <query>` | Search the bundled docs |
|
|
31
|
+
| `pdks docs show <document-id>` | Show one bundled document or section |
|
|
32
|
+
|
|
33
|
+
`pdks docs` is offline. It reads the installed package, not the network. Flags, JSON, and
|
|
34
|
+
exit codes are in [`pdks docs`](../cli/docs.md).
|
|
35
|
+
|
|
36
|
+
<a id="polydeukes-export-map"></a>
|
|
37
|
+
## Export map
|
|
38
|
+
|
|
39
|
+
<a id="root-export"></a>
|
|
40
|
+
### `.` root export
|
|
41
|
+
|
|
42
|
+
| Symbol | Kind | Notes |
|
|
43
|
+
|---|---|---|
|
|
44
|
+
| `loadConfig` | function | Discovers exactly one `polydeukes.config.*` file under `rootDir`; throws on missing, ambiguous, parse, or validation failure. |
|
|
45
|
+
| `runCovenantCheck` | function | Runs the commit-surface runner and resolves to `{ exitCode: 0 \| 2 }`. |
|
|
46
|
+
| `ResolvedConfig` | type | Re-export from `@polydeukes/core`. |
|
|
47
|
+
| `LoadConfigSpec`, `LoadedConfig` | types | Configuration loader input and result. |
|
|
48
|
+
| `CovenantCheckSpec`, `CovenantCheckOutcome`, `CheckDomain` | types | Commit runner input, result, and observation selection. |
|
|
49
|
+
|
|
50
|
+
<a id="session-export"></a>
|
|
51
|
+
### `./claude-code`
|
|
52
|
+
|
|
53
|
+
| Symbol | Kind | Notes |
|
|
54
|
+
|---|---|---|
|
|
55
|
+
| `runClaudeCodeHook` | function | Runs the session-surface runner and resolves to `{ exitCode: 0 \| 2 }`. |
|
|
56
|
+
| `ClaudeCodeHookSpec` | type | Input for the session runner. |
|
|
57
|
+
| `ClaudeCodeHookOutcome` | type | Session runner result. |
|
|
58
|
+
|
|
59
|
+
The generated hook imports this subpath, not the barrel. ESM imports are eager, so importing the
|
|
60
|
+
barrel would load the commit-surface runner — and the git adapter behind it — on every session tool
|
|
61
|
+
call that will never use them.
|
|
62
|
+
|
|
63
|
+
<a id="schema-export"></a>
|
|
64
|
+
### `./schema.json`
|
|
65
|
+
|
|
66
|
+
| Artifact | Notes |
|
|
67
|
+
|---|---|
|
|
68
|
+
| `polydeukes.schema.json` | The config schema copy that ships with the umbrella package. |
|
|
69
|
+
|
|
70
|
+
<a id="polydeukes-signatures"></a>
|
|
71
|
+
## Signatures and examples
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
function loadConfig(spec: LoadConfigSpec): LoadedConfig;
|
|
75
|
+
|
|
76
|
+
type LoadConfigSpec = { rootDir: string };
|
|
77
|
+
|
|
78
|
+
type LoadedConfig = {
|
|
79
|
+
config: ResolvedConfig;
|
|
80
|
+
configPath: string;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
function runCovenantCheck(spec: CovenantCheckSpec): Promise<CovenantCheckOutcome>;
|
|
84
|
+
|
|
85
|
+
type CovenantCheckSpec = {
|
|
86
|
+
repoRoot: string;
|
|
87
|
+
telemetryPath?: string;
|
|
88
|
+
covenantDist?: string;
|
|
89
|
+
ttyPrompt?: (prompt: string) => string | null;
|
|
90
|
+
domain?: CheckDomain;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
type CheckDomain =
|
|
94
|
+
| { kind: 'staged' }
|
|
95
|
+
| { kind: 'worktree' }
|
|
96
|
+
| { kind: 'range'; base: string; head: string; ancestry?: 'merge-base' };
|
|
97
|
+
|
|
98
|
+
function runClaudeCodeHook(spec: ClaudeCodeHookSpec): Promise<ClaudeCodeHookOutcome>;
|
|
99
|
+
|
|
100
|
+
type ClaudeCodeHookSpec = {
|
|
101
|
+
repoRoot: string;
|
|
102
|
+
rawPayload?: string;
|
|
103
|
+
telemetryPath?: string;
|
|
104
|
+
covenantDist?: string;
|
|
105
|
+
};
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
`ancestry: 'merge-base'` is the `<base>...<head>` reading. `rawPayload` absent means the hook reads
|
|
109
|
+
fd 0. The hook types live on `polydeukes/claude-code`, not on the root barrel.
|
|
110
|
+
|
|
111
|
+
```ts
|
|
112
|
+
import { loadConfig, runCovenantCheck } from 'polydeukes';
|
|
113
|
+
import { runClaudeCodeHook } from 'polydeukes/claude-code';
|
|
114
|
+
|
|
115
|
+
const { configPath } = loadConfig({ rootDir: process.cwd() });
|
|
116
|
+
const check = await runCovenantCheck({ repoRoot: process.cwd() });
|
|
117
|
+
const hook = await runClaudeCodeHook({ repoRoot: process.cwd(), rawPayload: '{}' });
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
<a id="polydeukes-failure-boundaries"></a>
|
|
121
|
+
## Failure boundaries
|
|
122
|
+
|
|
123
|
+
- `loadConfig()` throws on missing, ambiguous, parse, or validation failure.
|
|
124
|
+
- `runCovenantCheck()` and `runClaudeCodeHook()` never throw; they resolve to `{ exitCode: 0 \| 2
|
|
125
|
+
}`.
|
|
126
|
+
- The numeric codes are `EXIT_UPHOLD` (`0`), `EXIT_BREAK_NON_BLOCKING` (`1`), and
|
|
127
|
+
`EXIT_BREAK_BLOCKING` (`2`) from `@polydeukes/core`. The umbrella runners expose only `0` or
|
|
128
|
+
`2`; they never return `1`.
|
|
129
|
+
- `pdks covenant check` prompts for a witness token only for the staged domain, never for
|
|
130
|
+
`--worktree` or `--range`.
|
|
131
|
+
- `pdks docs` and `pdks explain` print nothing partial on failure.
|
|
132
|
+
|
|
133
|
+
<a id="polydeukes-see-also"></a>
|
|
134
|
+
## See also
|
|
135
|
+
|
|
136
|
+
- [`pdks covenant check`](../cli/covenant-check.md)
|
|
137
|
+
- [`pdks init`](../cli/init.md)
|
|
138
|
+
- [`pdks explain`](../cli/explain.md)
|
|
139
|
+
- [`Configuration reference`](../configuration/index.md)
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# Polydeukes 문제 해결
|
|
2
|
+
|
|
3
|
+
[English](./troubleshooting.md) · **한국어**
|
|
4
|
+
|
|
5
|
+
정책을 바꾸기 전에 어느 단계에서 실패했는지 확인하세요. 세션이 복구 명령까지 차단한다면
|
|
6
|
+
본인의 터미널에서 실행합니다. `pdks docs`는 동봉 문서가 온전하면 프로젝트 설정이나
|
|
7
|
+
판정 관련 패키지가 없어도 사용할 수 있습니다.
|
|
8
|
+
|
|
9
|
+
<a id="no-config"></a>
|
|
10
|
+
## 설정 파일이 없을 때
|
|
11
|
+
|
|
12
|
+
프로젝트 루트 바로 아래에 `polydeukes.config.yaml`, `polydeukes.config.yml`,
|
|
13
|
+
`polydeukes.config.json` 중 하나도 없으면 설정이 필요한 명령은 종료 코드 2를 반환합니다.
|
|
14
|
+
Git에서 원래 파일을 복원하세요. 새 프로젝트라면 `pdks init claude-code` 또는
|
|
15
|
+
`pdks init grok`로 만들 수 있습니다. 이후 `pdks explain`을 실행합니다. 설정이 없다고
|
|
16
|
+
기본 정책으로 대신 실행하지는 않습니다.
|
|
17
|
+
|
|
18
|
+
<a id="multiple-config"></a>
|
|
19
|
+
## 설정 파일이 여러 개일 때
|
|
20
|
+
|
|
21
|
+
오류 메시지에 중복된 파일명이 나옵니다. 필요한 내용을 합친 뒤 허용되는 파일명 하나만
|
|
22
|
+
남기세요. 로더는 어느 파일을 사용할지 임의로 선택하지 않습니다. 정리한 뒤
|
|
23
|
+
`pdks explain`을 다시 실행합니다.
|
|
24
|
+
|
|
25
|
+
<a id="invalid-config"></a>
|
|
26
|
+
## 설정 오류
|
|
27
|
+
|
|
28
|
+
구문이나 스키마 오류가 있으면 종료 코드 2와 함께 파일명을 알립니다. 스키마 오류는 문제가
|
|
29
|
+
있는 필드도 알려 줍니다. 잘못된 YAML, 사용자 정의 태그, 알 수 없는 필드, 비어 있는
|
|
30
|
+
`languages` 객체를 고치세요. YAML 태그는 파서가 실행할 수 없더라도 거부합니다.
|
|
31
|
+
설정은 실행할 코드가 아니라 데이터이기 때문입니다.
|
|
32
|
+
|
|
33
|
+
`protectedPath:`나 `adaptors:` 같은 오타는 거부합니다. 다만 어댑터 이름에는 확장 가능성을
|
|
34
|
+
남겨 두었습니다. `adapters.gti:`도 설정으로 읽히지만 Git 어댑터는 사용하지 않습니다.
|
|
35
|
+
올바른 키는 `adapters.git`입니다. 수정한 뒤 `pdks explain`에서 실제 등록 내용을 확인하세요.
|
|
36
|
+
|
|
37
|
+
<a id="grok-witness"></a>
|
|
38
|
+
## Grok 증인
|
|
39
|
+
|
|
40
|
+
훅을 아직 읽지 않은 문제와 증인(witness) 밸브를 사용할 수 없는 문제는 구별해야 합니다.
|
|
41
|
+
|
|
42
|
+
- `pdks init grok` 실행 뒤 Hooks 탭을 다시 불러오거나 새 세션을 시작하세요. 실제 도구를
|
|
43
|
+
호출하고 텔레메트리를 확인합니다. 설치기가 성공했다고 해서 열린 세션에 훅이 적용됐다는
|
|
44
|
+
뜻은 아닙니다.
|
|
45
|
+
- Grok의 ACP 대화 기록에는 현재 세션 증인 밸브가 요구하는 Claude 형식의 인간 메시지가
|
|
46
|
+
없습니다. 다시 불러와도 이 기능이 생기지는 않습니다. 복구가 필요하면 Grok에 Claude용
|
|
47
|
+
증인 토큰을 보내려 하지 말고 본인의 터미널에서 작업하세요.
|
|
48
|
+
|
|
49
|
+
커밋 증인은 해당 스테이징 검사만 허용합니다. 차단된 Grok 도구 호출까지 허용하지 않습니다.
|
|
50
|
+
|
|
51
|
+
<a id="config-fault"></a>
|
|
52
|
+
## 선언을 판정으로 구성하지 못할 때
|
|
53
|
+
|
|
54
|
+
설정은 읽었지만 어떤 항목을 판정할 수 있는 형태로 컴파일하지 못한 경우입니다. 적용 범위가
|
|
55
|
+
일치하면 `skipped`와 사유 `config-fault`를 기록합니다. `pdks explain`에서도 원인을 볼 수
|
|
56
|
+
있습니다. 추출 단계 이름, 인수, 정규식 문법, 쌍과 단일 추출 결과의 사용을 확인하세요.
|
|
57
|
+
지목된 선언을 고친 뒤 같은 관측으로 다시 검사합니다. 미판정은 정상 판정이 아닙니다.
|
|
58
|
+
|
|
59
|
+
<a id="judge-cannot-be-loaded"></a>
|
|
60
|
+
## 판정기를 불러올 수 없을 때
|
|
61
|
+
|
|
62
|
+
패키지나 판정 모듈이 빠져 있으면 작업을 차단합니다. 본인의 터미널에서 패키지를 다시
|
|
63
|
+
설치하거나 워크스페이스 전체를 빌드하세요. 생성된 훅은 설치된 패키지에 판정을 맡기며,
|
|
64
|
+
판정기를 별도로 복사해 가지고 있지 않습니다. 복구 뒤 실제 호출로 다시 확인합니다.
|
|
65
|
+
텔레메트리를 불러오기 전에 실패했다면 기록이 전혀 남지 않을 수도 있습니다.
|
|
66
|
+
|
|
67
|
+
세션 훅은 메시지 앞에 `covenant hook failed closed:`를, 커밋 검사는
|
|
68
|
+
`covenant check failed closed:`를 붙입니다. 실제로 보게 되는 두 형태는 다음과 같습니다.
|
|
69
|
+
|
|
70
|
+
```text
|
|
71
|
+
covenant hook failed closed: Cannot find package 'polydeukes' imported from …
|
|
72
|
+
covenant check failed closed: the covenant judges could not be loaded from … — run 'pnpm build' to rebuild them: Cannot find module './self-mod.js' …
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
첫째는 설치된 패키지가 없는 경우이고, 둘째는 소스 체크아웃에서 판정기 빌드 산출물이 없거나
|
|
76
|
+
일부만 있는 경우입니다.
|
|
77
|
+
|
|
78
|
+
<a id="reading-verdict"></a>
|
|
79
|
+
## 판정 결과 읽기
|
|
80
|
+
|
|
81
|
+
| 기록 | 의미 |
|
|
82
|
+
|---|---|
|
|
83
|
+
| `passed` | 관측한 입력을 판정했으며 약속(covenant)을 지켰습니다. |
|
|
84
|
+
| `blocked` | 위반 때문에 작업을 멈췄습니다. |
|
|
85
|
+
| `witnessed` | 차단 결과가 나왔지만 증인 밸브를 통해 작업을 허용했습니다. |
|
|
86
|
+
| `advised` | 위반을 기록하되 작업을 멈추지 않았습니다. 두 표면 모두에서 나올 수 있습니다. |
|
|
87
|
+
| `skipped` | 적용 범위가 일치한 등록을 판정할 수 없었습니다. 정상 판정이 아닙니다. |
|
|
88
|
+
| `unattributed` | 기준 상태와 비교해 판정으로 설명되지 않는 보호 대상의 변경을 발견했거나, 유효한 기준 상태를 읽지 못했습니다. 판정 결과가 아니라 관측 기록입니다. |
|
|
89
|
+
|
|
90
|
+
판정은 기본적으로 `.polydeukes/roi.log`에 추가됩니다. `telemetry.logPath`로 위치를 바꿀 수
|
|
91
|
+
있습니다. 로그 쓰기에 실패하더라도 판정 결과는 바뀌지 않습니다. 종료 코드 0은 작업을
|
|
92
|
+
계속해도 된다는 뜻이지 모든 규율을 지켰다는 뜻은 아닙니다.
|
|
93
|
+
|
|
94
|
+
<a id="opening-a-blocked-call"></a>
|
|
95
|
+
## 차단된 호출을 증언으로 허용하기
|
|
96
|
+
|
|
97
|
+
지원되는 Claude Code 세션에서 설정된 증인 토큰을 인간 메시지의 첫 줄에 단독으로 입력한 뒤,
|
|
98
|
+
유효 시간 안에 다시 시도합니다. 보호 대상을 의도적으로 편집하기 전에 입력해도 됩니다.
|
|
99
|
+
먼저 한 번 차단돼야 하는 것은 아닙니다. 토큰은 비밀이 아니며, 밸브는 사람이 직접 입력했는지
|
|
100
|
+
확인하고 차단 판정에만 적용됩니다. 증언으로 허용한 호출은 `witnessed` 행을 새로 남깁니다.
|
|
101
|
+
앞서 기록한 `blocked` 행을 고치는 것이 아닙니다.
|
|
102
|
+
|
|
103
|
+
모듈 누락처럼 판정기를 조립하지 못하게 하는 오류는 증인으로 해결할 수 없습니다.
|
|
104
|
+
|
|
105
|
+
<a id="blocked-commit"></a>
|
|
106
|
+
## 커밋이 차단됐을 때
|
|
107
|
+
|
|
108
|
+
본인의 터미널에서 커밋을 실행하고 TTY 프롬프트에 설정된 토큰 전체를 입력하세요.
|
|
109
|
+
비대화형 스테이징 검사는 이 응답을 받을 수 없습니다. 검사가 작업을 거부하면 종료 코드 2를
|
|
110
|
+
반환합니다. Git은 커밋 실패를 다른 0이 아닌 코드로 알릴 수도 있습니다.
|
|
111
|
+
|
|
112
|
+
일반 규율 항목은 자체 수준과 어댑터 수준이 모두 차단을 허용해야 작업을 멈춥니다.
|
|
113
|
+
`adapters.git.enforce: block`만 설정해도 기본값 `advise`인 항목이 자동 승격되지는 않습니다.
|
|
114
|
+
수준 변경은 정책을 바꾸는 결정이지 필수 복구 절차가 아닙니다. 커밋 프롬프트와 세션 메시지는
|
|
115
|
+
서로 별개의 증인 입력 경로입니다.
|
|
116
|
+
|
|
117
|
+
<a id="skipped-rows-on-the-commit-surface"></a>
|
|
118
|
+
## 커밋 표면의 미판정 기록
|
|
119
|
+
|
|
120
|
+
대화 기록을 읽는 선언에 `supply: { session: 'pass' }`가 있으면 세션이 없는 커밋 표면에서는
|
|
121
|
+
`supply-pass`를 기록합니다. 이 약속은 세션 표면에서 확인하세요. 미판정은 과거 작업을
|
|
122
|
+
검증했다는 뜻이 아닙니다. 다른 채널을 공급할 수 없으면 `no-observation`이 나올 수도
|
|
123
|
+
있습니다. 모든 자료 부재를 같은 실패로 취급하지 말고 등록 내용과 사유를 확인하세요.
|
|
124
|
+
|
|
125
|
+
스테이징한 변경에는 명령줄이 없으므로 명령 범위 선언은 적용되지 않으며 판정도 기록하지
|
|
126
|
+
않습니다. 설정, 범위 일치, 자료 공급, 최종 비교는 각각 다른 단계입니다.
|
|
127
|
+
|
|
128
|
+
<a id="local-state"></a>
|
|
129
|
+
## 다른 컴퓨터로 프로젝트를 옮길 때
|
|
130
|
+
|
|
131
|
+
텔레메트리와 `.polydeukes/baseline.json`은 로컬 상태이며 Git이 옮겨 주는 판정 이력이
|
|
132
|
+
아닙니다. 이 파일 없이 저장소를 복제해도 과거 판정이 복원되지는 않습니다. 세션 훅은 기준
|
|
133
|
+
상태가 없거나 유효하지 않으면 이를 기록하고 다음 비교에 쓸 기준을 만듭니다. 과거 변경을
|
|
134
|
+
판정했다는 증거가 생기는 것은 아닙니다. 필요한 로그는 따로 보관해 옮기세요.
|
|
135
|
+
`telemetry.logPath`를 바꿨다면 모든 기록이 `.polydeukes/`에 있다고 가정해서는 안 됩니다.
|
|
136
|
+
|
|
137
|
+
<a id="next-steps"></a>
|
|
138
|
+
## 다음 단계
|
|
139
|
+
|
|
140
|
+
- [표면 연결하기](./how-to/connect-surfaces.ko.md)
|
|
141
|
+
- [프로젝트 설정하기](./how-to/configure-project.ko.md)
|
|
142
|
+
- [규율 작성하기](./how-to/write-disciplines.ko.md)
|