polydeukes 0.6.0 → 0.7.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 +30 -70
- package/README.md +31 -84
- package/dist/baseline.d.ts +37 -1
- package/dist/baseline.js +68 -1
- package/dist/bin.d.ts +3 -4
- package/dist/bin.js +79 -93
- package/dist/covenant/bash-line.d.ts +130 -0
- package/dist/covenant/bash-line.js +566 -0
- package/dist/covenant/declaration-engine.d.ts +108 -0
- package/dist/covenant/declaration-engine.js +415 -0
- package/dist/covenant/discipline.d.ts +103 -0
- package/dist/covenant/discipline.js +667 -0
- package/dist/covenant/dispatch.d.ts +153 -0
- package/dist/covenant/dispatch.js +237 -0
- package/dist/covenant/extract-steps.d.ts +122 -0
- package/dist/covenant/extract-steps.js +0 -0
- package/dist/covenant/mention.d.ts +117 -0
- package/dist/covenant/mention.js +209 -0
- package/dist/covenant/module.d.ts +25 -0
- package/dist/covenant/module.js +23 -0
- package/dist/covenant/mutation-rules.d.ts +40 -0
- package/dist/covenant/mutation-rules.js +146 -0
- package/dist/covenant/relations.d.ts +46 -0
- package/dist/covenant/relations.js +68 -0
- package/dist/covenant/run-covenant.d.ts +95 -0
- package/dist/covenant/run-covenant.js +164 -0
- package/dist/covenant/self-mod.d.ts +55 -0
- package/dist/covenant/self-mod.js +84 -0
- package/dist/covenant/shell-evidence.d.ts +38 -0
- package/dist/covenant/shell-evidence.js +247 -0
- package/dist/covenant/shell-mod.d.ts +84 -0
- package/dist/covenant/shell-mod.js +213 -0
- package/dist/covenant/supply.d.ts +54 -0
- package/dist/covenant/supply.js +50 -0
- package/dist/covenant/transcript-mod.d.ts +60 -0
- package/dist/covenant/transcript-mod.js +254 -0
- package/dist/covenant/ttl-witness.d.ts +47 -0
- package/dist/covenant/ttl-witness.js +80 -0
- package/dist/covenant-check.d.ts +72 -39
- package/dist/covenant-check.js +260 -121
- package/dist/diff-ir.d.ts +28 -0
- package/dist/diff-ir.js +310 -0
- package/dist/docs/README.ko.md +60 -0
- package/dist/docs/README.md +64 -0
- package/dist/docs/catalog.json +480 -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 +98 -0
- package/dist/docs/how-to/connect-surfaces.ko.md +120 -0
- package/dist/docs/how-to/connect-surfaces.md +121 -0
- package/dist/docs/how-to/write-disciplines.ko.md +179 -0
- package/dist/docs/how-to/write-disciplines.md +181 -0
- package/dist/docs/index.json +2280 -0
- package/dist/docs/reference/cli/covenant-check.ko.md +148 -0
- package/dist/docs/reference/cli/covenant-check.md +153 -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 +84 -0
- package/dist/docs/reference/cli/explain.md +89 -0
- package/dist/docs/reference/cli/init.ko.md +119 -0
- package/dist/docs/reference/cli/init.md +119 -0
- package/dist/docs/reference/configuration/index.ko.md +553 -0
- package/dist/docs/reference/{configuration.md → configuration/index.md} +215 -90
- package/dist/docs/reference/packages/adapter-claude-code.ko.md +110 -0
- package/dist/docs/reference/{adapter-claude-code.md → packages/adapter-claude-code.md} +47 -19
- package/dist/docs/reference/packages/adapter-grok.ko.md +77 -0
- package/dist/docs/reference/packages/adapter-grok.md +79 -0
- package/dist/docs/reference/packages/core.ko.md +174 -0
- package/dist/docs/reference/{core.md → packages/core.md} +74 -12
- package/dist/docs/reference/packages/polydeukes.ko.md +195 -0
- package/dist/docs/reference/packages/polydeukes.md +204 -0
- package/dist/docs/reference/packages/sdk-ts.ko.md +161 -0
- package/dist/docs/reference/packages/sdk-ts.md +164 -0
- package/dist/docs/troubleshooting.ko.md +144 -0
- package/dist/docs/troubleshooting.md +103 -151
- 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 +1 -1
- package/dist/explain.js +37 -22
- package/dist/load-config.d.ts +1 -1
- package/dist/load-config.js +1 -1
- package/dist/pre-state-reader.d.ts +1 -1
- package/dist/pre-state-reader.js +1 -1
- package/dist/scaffold-project.d.ts +2 -2
- package/dist/scaffold-project.js +9 -3
- package/dist/schema/polydeukes.schema.json +12 -0
- package/dist/worktree-reader.d.ts +19 -0
- package/dist/worktree-reader.js +30 -0
- package/package.json +3 -17
- package/dist/claude-code-hook.d.ts +0 -79
- package/dist/claude-code-hook.js +0 -372
- package/dist/claude-code.d.ts +0 -6
- package/dist/claude-code.js +0 -6
- package/dist/covenant-module.d.ts +0 -25
- package/dist/covenant-module.js +0 -42
- package/dist/docs/configuration.md +0 -103
- package/dist/docs/installation.md +0 -241
- package/dist/docs/reference/adapter-git.md +0 -100
- package/dist/docs/reference/covenant.md +0 -116
- package/dist/docs/reference/polydeukes.md +0 -315
- package/dist/index.d.ts +0 -22
- package/dist/index.js +0 -21
- package/dist/init-claude-code.d.ts +0 -52
- package/dist/init-claude-code.js +0 -469
- package/dist/init-grok.d.ts +0 -51
- package/dist/init-grok.js +0 -242
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bash command-line tokenizer + mutation-target extraction core.
|
|
3
|
+
*
|
|
4
|
+
* Pure functions only — zero I/O, spawn, or logging. A hand-rolled single-pass character
|
|
5
|
+
* scanner recognizes quote state (`'`, `"`, `$'…'`, `\`), control operators
|
|
6
|
+
* (`;` `&&` `||` `|` `&`), redirect operators (`>` `>>` `>|` `<` `2>` `&>`, attached `>f`),
|
|
7
|
+
* and marks tokens opaque when their static value is unknowable (command substitution,
|
|
8
|
+
* parameter expansion, globs).
|
|
9
|
+
*
|
|
10
|
+
* Fail-closed: no input ever throws. A construct the scanner cannot finish reading yields a
|
|
11
|
+
* partial result — the commands it did read, plus one `unread` span per failure; in
|
|
12
|
+
* {@link extractMutations} each span becomes one indeterminate entry. Block/allow
|
|
13
|
+
* decisions, read-only allowlists, and detection rules live in the judges that consume this.
|
|
14
|
+
*/
|
|
15
|
+
/** A single word token with a static-opacity flag (`opaque` = value not knowable). */
|
|
16
|
+
export type WordToken = {
|
|
17
|
+
text: string;
|
|
18
|
+
opaque: boolean;
|
|
19
|
+
};
|
|
20
|
+
/** A redirect operator paired with its target word (`>` `>>` `<` `2>` `&>`). */
|
|
21
|
+
export type RedirectToken = {
|
|
22
|
+
operator: string;
|
|
23
|
+
target: WordToken;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* One heredoc body a command declared, with its delimiter's quoting. `literal` means the
|
|
27
|
+
* delimiter was quoted, so the body is written verbatim; an unquoted delimiter expands its
|
|
28
|
+
* body, which only a consumer can decide what to do about.
|
|
29
|
+
*/
|
|
30
|
+
export type HeredocBody = {
|
|
31
|
+
body: string;
|
|
32
|
+
literal: boolean;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* One simple command: its word tokens, any redirect operators, and the heredoc bodies it
|
|
36
|
+
* declared (in declaration order — absent when it declared none).
|
|
37
|
+
*/
|
|
38
|
+
export type SimpleCommand = {
|
|
39
|
+
words: WordToken[];
|
|
40
|
+
redirects: RedirectToken[];
|
|
41
|
+
heredocs?: HeredocBody[];
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* A span of the line the scanner could not read, with the reason it stopped. `reason` is a
|
|
45
|
+
* telemetry pass-through value: no consumer branches on it.
|
|
46
|
+
*/
|
|
47
|
+
export type UnreadSpan = {
|
|
48
|
+
text: string;
|
|
49
|
+
reason: string;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* A half-open span `[start, end)` of the line bash hands to a command as stdin data instead
|
|
53
|
+
* of executing: a heredoc body, or a herestring's target word.
|
|
54
|
+
*/
|
|
55
|
+
export type DataSpan = {
|
|
56
|
+
start: number;
|
|
57
|
+
end: number;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* The tokenizer's result: the commands it read, plus one span per failure it hit. A failure
|
|
61
|
+
* does not discard the line — the read commands reach precise judgment and only the spans
|
|
62
|
+
* fall to a consumer's conservative treatment. An empty `unread` is the "fully read" signal.
|
|
63
|
+
*
|
|
64
|
+
* `data` lists the stdin-data spans in source order, non-overlapping: heredoc bodies and
|
|
65
|
+
* herestring words bash hands over without expanding them. A body under an unquoted
|
|
66
|
+
* delimiter that carries `$` or a backtick, and an opaque herestring word, are text bash
|
|
67
|
+
* runs first and are not data. A span the scanner could not finish reading is never among
|
|
68
|
+
* them either, so unread bytes stay on the command line.
|
|
69
|
+
*/
|
|
70
|
+
export type TokenizeResult = {
|
|
71
|
+
commands: SimpleCommand[];
|
|
72
|
+
unread: UnreadSpan[];
|
|
73
|
+
data: DataSpan[];
|
|
74
|
+
};
|
|
75
|
+
/** A detected mutation target (path) with the name of the rule that found it. */
|
|
76
|
+
export type MutationTarget = {
|
|
77
|
+
path: string;
|
|
78
|
+
rule: string;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* A detection rule seam: a pure function over a single simple command that returns the
|
|
82
|
+
* mutation targets it detects.
|
|
83
|
+
*/
|
|
84
|
+
export type MutationRule = {
|
|
85
|
+
name: string;
|
|
86
|
+
detect(command: SimpleCommand): MutationTarget[];
|
|
87
|
+
};
|
|
88
|
+
/** A structure that cannot be decided deterministically, with the reason why. */
|
|
89
|
+
export type Indeterminate = {
|
|
90
|
+
reason: string;
|
|
91
|
+
};
|
|
92
|
+
/** The extraction result — detected mutations and undecidable structures, kept separate. */
|
|
93
|
+
export type MutationAnalysis = {
|
|
94
|
+
mutations: MutationTarget[];
|
|
95
|
+
indeterminate: Indeterminate[];
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* True when `commandName` (a command word's basename) re-parses its string arguments in a
|
|
99
|
+
* nested shell — the reinterpretation boundary the tokenizer refuses to parse into. A judge
|
|
100
|
+
* can consult this to refuse to treat such a command as provably read-only.
|
|
101
|
+
*/
|
|
102
|
+
export declare function isNestedShellCommand(commandName: string): boolean;
|
|
103
|
+
/**
|
|
104
|
+
* The word that names the command, skipping any leading assignments — undefined when the
|
|
105
|
+
* command is nothing but assignments.
|
|
106
|
+
*
|
|
107
|
+
* Read at the nested-shell boundary only. There an unskipped assignment hides `bash` behind
|
|
108
|
+
* `FOO=1` and the line passes with confidence; for the read-only allowlist and precedent
|
|
109
|
+
* evidence the same miss is the conservative direction, so those keep reading `words[0]`.
|
|
110
|
+
*/
|
|
111
|
+
export declare function commandNameWord(command: SimpleCommand): WordToken | undefined;
|
|
112
|
+
/**
|
|
113
|
+
* Tokenize one shell line into simple commands. Never throws, and never discards what it
|
|
114
|
+
* read: a construct it cannot finish reading is recorded as an `unread` span and the scan
|
|
115
|
+
* carries on.
|
|
116
|
+
*/
|
|
117
|
+
export declare function tokenizeCommandLine(line: string): TokenizeResult;
|
|
118
|
+
/**
|
|
119
|
+
* The executed text of a command line: the line with every `data` span deleted and nothing
|
|
120
|
+
* put in its place, so the words bash runs keep their spelling and line structure. Bytes
|
|
121
|
+
* the scanner could not finish reading are not data spans and stay as written.
|
|
122
|
+
*/
|
|
123
|
+
export declare function executedText(line: string): string;
|
|
124
|
+
/**
|
|
125
|
+
* Extract mutation targets from a shell line via injected rules. A simple command
|
|
126
|
+
* contributes an indeterminate entry when it is a nested-shell call OR contains any opaque
|
|
127
|
+
* word (in which case its rules are still applied, but an undecidable structure is present);
|
|
128
|
+
* each unread span yields one more. Never throws.
|
|
129
|
+
*/
|
|
130
|
+
export declare function extractMutations(line: string, rules: MutationRule[]): MutationAnalysis;
|