codedeck 0.1.8 → 0.2.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/README.md +68 -1
- package/dist/cli/commands/open.js +498 -0
- package/dist/cli/commands/open.js.map +1 -0
- package/dist/cli/commands/run.js +25 -18
- package/dist/cli/commands/run.js.map +1 -1
- package/dist/cli/commands/setup.js +182 -0
- package/dist/cli/commands/setup.js.map +1 -0
- package/dist/cli/index.js +4 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/picker-state.js +101 -0
- package/dist/cli/picker-state.js.map +1 -0
- package/dist/cli/picker.js +147 -0
- package/dist/cli/picker.js.map +1 -0
- package/dist/cli/ui.js +217 -0
- package/dist/cli/ui.js.map +1 -0
- package/dist/config/config.js +8 -0
- package/dist/config/config.js.map +1 -1
- package/dist/core/models.js +23 -4
- package/dist/core/models.js.map +1 -1
- package/dist/core/roles.js +72 -0
- package/dist/core/roles.js.map +1 -0
- package/dist/plugin/.claude-plugin/plugin.json +11 -0
- package/dist/plugin/agents/auditor.md +30 -0
- package/dist/plugin/agents/general.md +24 -0
- package/dist/plugin/agents/orchestrator.md +32 -0
- package/dist/plugin/agents/reviewer.md +33 -0
- package/dist/plugin/settings.json +7 -0
- package/dist/plugin/statusline.sh +68 -0
- package/dist/plugin/themes/codedeck-ultra.json +68 -0
- package/dist/plugin/ultra.md +9 -0
- package/package.json +6 -5
package/dist/cli/ui.js
ADDED
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared terminal drawing for the launcher and the first-run wizard, so the
|
|
3
|
+
* two open with the same mark instead of each inventing one.
|
|
4
|
+
*/
|
|
5
|
+
import { hitCount, visibleItems } from "./picker-state.js";
|
|
6
|
+
// Box-drawing letters, every row exactly 24 columns wide. Kept as three
|
|
7
|
+
// separate strings rather than one template so an editor cannot reflow it.
|
|
8
|
+
const LOGO = [
|
|
9
|
+
"╔═╗╔═╗╔╦╗╔═╗╔╦╗╔═╗╔═╗╦╔═",
|
|
10
|
+
"║ ║ ║║║║╠═ ║║║╠═ ║ ╠╩╗",
|
|
11
|
+
"╚═╝╚═╝═╩╝╚═╝═╩╝╚═╝╚═╝╩ ╩",
|
|
12
|
+
];
|
|
13
|
+
export const INDENT = " ";
|
|
14
|
+
/** The logo with an optional line of context under it. */
|
|
15
|
+
export function renderLogo(subtitle) {
|
|
16
|
+
const lines = LOGO.map((line) => `${INDENT}${line}`);
|
|
17
|
+
if (subtitle)
|
|
18
|
+
lines.push(`${INDENT}${subtitle}`);
|
|
19
|
+
return `\n${lines.join("\n")}\n`;
|
|
20
|
+
}
|
|
21
|
+
const RESET = "\x1b[0m";
|
|
22
|
+
/**
|
|
23
|
+
* Color is a factory rather than an environment read, because the renderer has
|
|
24
|
+
* to stay pure: with color off in tests, visible width is string length.
|
|
25
|
+
*/
|
|
26
|
+
export function colors(enabled) {
|
|
27
|
+
const paint = (code) => (s) => (enabled ? `\x1b[${code}m${s}${RESET}` : s);
|
|
28
|
+
return { bold: paint("1"), dim: paint("2"), invert: paint("7") };
|
|
29
|
+
}
|
|
30
|
+
const ANSI = /\x1b\[[0-9;]*m/g;
|
|
31
|
+
/**
|
|
32
|
+
* Code points that take two terminal columns, and the marks that take none.
|
|
33
|
+
*
|
|
34
|
+
* Not a complete wcwidth: model ids are ASCII, and the only text here a user
|
|
35
|
+
* can steer is the filter line, so these cover what a paste realistically
|
|
36
|
+
* carries. Anything outside them counts as one column, which is what the whole
|
|
37
|
+
* function did before.
|
|
38
|
+
*/
|
|
39
|
+
const ZERO_WIDTH = [
|
|
40
|
+
[0x0300, 0x036f], // combining diacritics
|
|
41
|
+
[0x200b, 0x200f], // zero-width space through the direction marks
|
|
42
|
+
[0xfe00, 0xfe0f], // variation selectors
|
|
43
|
+
[0xfeff, 0xfeff],
|
|
44
|
+
[0xe0100, 0xe01ef],
|
|
45
|
+
];
|
|
46
|
+
const WIDE = [
|
|
47
|
+
[0x1100, 0x115f], // Hangul Jamo
|
|
48
|
+
[0x2e80, 0x303e], // CJK radicals through the symbol block
|
|
49
|
+
[0x3041, 0x33ff],
|
|
50
|
+
[0x3400, 0x4dbf],
|
|
51
|
+
[0x4e00, 0x9fff], // unified ideographs
|
|
52
|
+
[0xa000, 0xa4cf], // Yi
|
|
53
|
+
[0xac00, 0xd7a3], // Hangul syllables
|
|
54
|
+
[0xf900, 0xfaff],
|
|
55
|
+
[0xfe30, 0xfe6f],
|
|
56
|
+
[0xff00, 0xff60], // fullwidth forms
|
|
57
|
+
[0xffe0, 0xffe6],
|
|
58
|
+
[0x1f300, 0x1faff], // emoji
|
|
59
|
+
[0x20000, 0x3fffd],
|
|
60
|
+
];
|
|
61
|
+
function inRanges(cp, ranges) {
|
|
62
|
+
return ranges.some(([lo, hi]) => cp >= lo && cp <= hi);
|
|
63
|
+
}
|
|
64
|
+
function charWidth(cp) {
|
|
65
|
+
if (inRanges(cp, ZERO_WIDTH))
|
|
66
|
+
return 0;
|
|
67
|
+
return inRanges(cp, WIDE) ? 2 : 1;
|
|
68
|
+
}
|
|
69
|
+
/** Terminal columns the text occupies, ignoring the escapes that paint it. */
|
|
70
|
+
export function visibleWidth(text) {
|
|
71
|
+
let width = 0;
|
|
72
|
+
for (const char of text.replace(ANSI, ""))
|
|
73
|
+
width += charWidth(char.codePointAt(0));
|
|
74
|
+
return width;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Cuts by terminal columns and closes any escape it left open, otherwise the
|
|
78
|
+
* color bleeds into the rest of the line.
|
|
79
|
+
*
|
|
80
|
+
* Walking code points rather than UTF-16 units matters twice over. Cutting
|
|
81
|
+
* mid-pair emitted a lone surrogate, which is not valid UTF-8 on the wire. And
|
|
82
|
+
* a two-column character counted as one let the line outgrow the terminal,
|
|
83
|
+
* which wraps it, and then the redraw walks up fewer lines than it printed and
|
|
84
|
+
* leaves the difference on screen.
|
|
85
|
+
*/
|
|
86
|
+
export function truncate(text, width) {
|
|
87
|
+
if (width <= 0)
|
|
88
|
+
return "";
|
|
89
|
+
if (visibleWidth(text) <= width)
|
|
90
|
+
return text;
|
|
91
|
+
let out = "";
|
|
92
|
+
let seen = 0;
|
|
93
|
+
let painted = false;
|
|
94
|
+
for (let i = 0; i < text.length;) {
|
|
95
|
+
ANSI.lastIndex = i;
|
|
96
|
+
const match = ANSI.exec(text);
|
|
97
|
+
if (match && match.index === i) {
|
|
98
|
+
out += match[0];
|
|
99
|
+
painted = match[0] !== RESET;
|
|
100
|
+
i += match[0].length;
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
const char = String.fromCodePoint(text.codePointAt(i));
|
|
104
|
+
const cost = charWidth(char.codePointAt(0));
|
|
105
|
+
// A wide character with one column left is dropped whole. Emitting it is
|
|
106
|
+
// what pushes the line past the edge.
|
|
107
|
+
if (seen + cost > width)
|
|
108
|
+
break;
|
|
109
|
+
out += char;
|
|
110
|
+
seen += cost;
|
|
111
|
+
i += char.length;
|
|
112
|
+
}
|
|
113
|
+
return painted ? `${out}${RESET}` : out;
|
|
114
|
+
}
|
|
115
|
+
const FALLBACK = { rows: 24, columns: 80 };
|
|
116
|
+
/**
|
|
117
|
+
* `0` and `undefined` mean the same thing here: a terminal that did not report
|
|
118
|
+
* its size. `??` would take `0` for an answer and collapse the layout, and
|
|
119
|
+
* `Math.max(3, undefined - 9)` is NaN.
|
|
120
|
+
*/
|
|
121
|
+
export function readDimensions(stdout) {
|
|
122
|
+
return {
|
|
123
|
+
rows: stdout.rows || FALLBACK.rows,
|
|
124
|
+
columns: stdout.columns || FALLBACK.columns,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
/** Below this the logo costs more rows than it is worth. */
|
|
128
|
+
const LOGO_MIN_ROWS = 15;
|
|
129
|
+
function drawsLogo(dim) {
|
|
130
|
+
return dim.rows >= LOGO_MIN_ROWS;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Counted, not a constant: the error line and the logo only exist sometimes,
|
|
134
|
+
* and a wrong constant here silently cuts items off the list.
|
|
135
|
+
*/
|
|
136
|
+
export function chromeHeight(state, dim) {
|
|
137
|
+
const logo = drawsLogo(dim) ? LOGO.length + 1 : 0;
|
|
138
|
+
const header = 1;
|
|
139
|
+
const error = state.screen.error ? 1 : 0;
|
|
140
|
+
const filterLine = 1;
|
|
141
|
+
const footer = 1;
|
|
142
|
+
// One: the blank above the filter. The logo brings its own, already counted.
|
|
143
|
+
const blank = 1;
|
|
144
|
+
return logo + header + error + filterLine + footer + blank;
|
|
145
|
+
}
|
|
146
|
+
const PLAIN = colors(false);
|
|
147
|
+
/**
|
|
148
|
+
* The item rows and how many items they cover. One walk answers both because
|
|
149
|
+
* the group headers take rows too: budgeting by item alone grew the frame past
|
|
150
|
+
* the terminal, and the redraw then moved the cursor up by fewer lines than it
|
|
151
|
+
* had just printed.
|
|
152
|
+
*/
|
|
153
|
+
function itemBlock(state, dim, c) {
|
|
154
|
+
const items = visibleItems(state);
|
|
155
|
+
const filtering = state.filter.trim().length > 0;
|
|
156
|
+
const budget = Math.max(1, dim.rows - chromeHeight(state, dim));
|
|
157
|
+
const lines = [];
|
|
158
|
+
let shown = 0;
|
|
159
|
+
let lastGroup;
|
|
160
|
+
for (let i = state.offset; i < items.length && lines.length < budget; i++) {
|
|
161
|
+
const item = items[i];
|
|
162
|
+
// Headers are dead weight once a filter is on, so the provider moves to the
|
|
163
|
+
// end of each row instead.
|
|
164
|
+
const group = !filtering && item.group && item.group !== lastGroup && !(state.screen.pinned && i === 0)
|
|
165
|
+
? item.group
|
|
166
|
+
: undefined;
|
|
167
|
+
if (group) {
|
|
168
|
+
lastGroup = group;
|
|
169
|
+
// The header is the first thing to drop on a short terminal: a list with
|
|
170
|
+
// no items reads worse than one with no group labels.
|
|
171
|
+
if (lines.length + 2 <= budget) {
|
|
172
|
+
const count = state.screen.items.filter((candidate) => candidate.group === group).length;
|
|
173
|
+
lines.push(groupHeader(group, count, dim.columns));
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
const marker = i === state.cursor ? "› " : " ";
|
|
177
|
+
const trailer = filtering ? item.group : item.note;
|
|
178
|
+
const suffix = trailer ? ` ${c.dim(trailer)}` : "";
|
|
179
|
+
lines.push(`${INDENT}${marker}${item.label}${suffix}`);
|
|
180
|
+
shown += 1;
|
|
181
|
+
}
|
|
182
|
+
return { lines, shown };
|
|
183
|
+
}
|
|
184
|
+
export function viewportHeight(state, dim) {
|
|
185
|
+
return Math.max(1, itemBlock(state, dim, PLAIN).shown);
|
|
186
|
+
}
|
|
187
|
+
function groupHeader(group, count, width) {
|
|
188
|
+
const label = ` ${group} `;
|
|
189
|
+
const tail = ` ${count} `;
|
|
190
|
+
const room = Math.max(0, width - INDENT.length - label.length - tail.length - 4);
|
|
191
|
+
return `${INDENT}--${label}${"-".repeat(room)}${tail}--`;
|
|
192
|
+
}
|
|
193
|
+
export function renderFrame(state, dim, c) {
|
|
194
|
+
const width = dim.columns;
|
|
195
|
+
const lines = [];
|
|
196
|
+
if (drawsLogo(dim)) {
|
|
197
|
+
for (const row of LOGO)
|
|
198
|
+
lines.push(`${INDENT}${row}`);
|
|
199
|
+
lines.push("");
|
|
200
|
+
}
|
|
201
|
+
lines.push(`${INDENT}${c.bold(`${state.screen.title} ~ ${state.screen.counter}`)}`);
|
|
202
|
+
if (state.screen.error)
|
|
203
|
+
lines.push(`${INDENT}${c.dim(state.screen.error)}`);
|
|
204
|
+
lines.push("");
|
|
205
|
+
lines.push(`${INDENT}filtrar: ${state.filter}`);
|
|
206
|
+
const filtering = state.filter.trim().length > 0;
|
|
207
|
+
for (const line of itemBlock(state, dim, c).lines)
|
|
208
|
+
lines.push(line);
|
|
209
|
+
const footer = state.confirming
|
|
210
|
+
? `"${state.confirming}" nao esta no catalogo. Enter de novo grava assim mesmo, ^G volta`
|
|
211
|
+
: filtering
|
|
212
|
+
? `${hitCount(state)} de ${state.screen.items.length} move ^ v Enter escolhe ^G pula ^C sai`
|
|
213
|
+
: `move ^ v Enter escolhe ^G pula ^C sai`;
|
|
214
|
+
lines.push(`${INDENT}${c.dim(footer)}`);
|
|
215
|
+
return lines.map((line) => truncate(line, width));
|
|
216
|
+
}
|
|
217
|
+
//# sourceMappingURL=ui.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui.js","sourceRoot":"","sources":["../../src/cli/ui.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAoB,MAAM,mBAAmB,CAAC;AAE7E,wEAAwE;AACxE,2EAA2E;AAC3E,MAAM,IAAI,GAAG;IACX,0BAA0B;IAC1B,0BAA0B;IAC1B,0BAA0B;CAC3B,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,IAAI,CAAC;AAE3B,0DAA0D;AAC1D,MAAM,UAAU,UAAU,CAAC,QAAiB;IAC1C,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,MAAM,GAAG,IAAI,EAAE,CAAC,CAAC;IACrD,IAAI,QAAQ;QAAE,KAAK,CAAC,IAAI,CAAC,GAAG,MAAM,GAAG,QAAQ,EAAE,CAAC,CAAC;IACjD,OAAO,KAAK,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;AACnC,CAAC;AAaD,MAAM,KAAK,GAAG,SAAS,CAAC;AAExB;;;GAGG;AACH,MAAM,UAAU,MAAM,CAAC,OAAgB;IACrC,MAAM,KAAK,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,IAAI,IAAI,CAAC,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3F,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,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C,CAAC;IACjD,KAAK,MAAM,IAAI,IAAI,SAAS,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,KAAK;QAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEpE,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU;QAC7B,CAAC,CAAC,IAAI,KAAK,CAAC,UAAU,mEAAmE;QACzF,CAAC,CAAC,SAAS;YACT,CAAC,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,gDAAgD;YACpG,CAAC,CAAC,6CAA6C,CAAC;IACpD,KAAK,CAAC,IAAI,CAAC,GAAG,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAExC,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;AACpD,CAAC"}
|
package/dist/config/config.js
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { getPaths } from "./paths.js";
|
|
4
|
+
/**
|
|
5
|
+
* Resolve the model passed to a driver without making driver defaults part of
|
|
6
|
+
* CodeDeck's config. An undefined result lets the selected driver choose its
|
|
7
|
+
* own default.
|
|
8
|
+
*/
|
|
9
|
+
export function resolveModel(agent, explicit, config = {}) {
|
|
10
|
+
return explicit ?? config.models?.[agent] ?? config.defaultModel;
|
|
11
|
+
}
|
|
4
12
|
const DEFAULT_CONFIG = {
|
|
5
13
|
defaultAgent: "claude",
|
|
6
14
|
worktree: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,C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AC;IAC5D,EAAE,CAAC,aAAa,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;AACtE,CAAC"}
|
package/dist/core/models.js
CHANGED
|
@@ -135,6 +135,18 @@ export function levenshtein(a, b) {
|
|
|
135
135
|
}
|
|
136
136
|
return matrix[al][bl];
|
|
137
137
|
}
|
|
138
|
+
/**
|
|
139
|
+
* A harness groups its models by provider, and every caller that wants to look
|
|
140
|
+
* one up has to walk both levels first. `open`, `run` and `setup` each did that
|
|
141
|
+
* walk themselves.
|
|
142
|
+
*/
|
|
143
|
+
export function flattenModels(harness) {
|
|
144
|
+
return harness.providers.flatMap((provider) => provider.models);
|
|
145
|
+
}
|
|
146
|
+
/** Every string a user could reasonably type to mean one of these models. */
|
|
147
|
+
export function modelNames(harness) {
|
|
148
|
+
return flattenModels(harness).flatMap((model) => [model.id, ...(model.aliases ?? [])]);
|
|
149
|
+
}
|
|
138
150
|
export function findClosestModel(query, candidates) {
|
|
139
151
|
if (!query || candidates.length === 0)
|
|
140
152
|
return undefined;
|
|
@@ -157,9 +169,6 @@ export function findClosestModel(query, candidates) {
|
|
|
157
169
|
}
|
|
158
170
|
}
|
|
159
171
|
}
|
|
160
|
-
if (bestSubMatch !== undefined) {
|
|
161
|
-
return bestSubMatch;
|
|
162
|
-
}
|
|
163
172
|
// 3. Fuzzy Levenshtein match
|
|
164
173
|
let bestFuzzyMatch;
|
|
165
174
|
let minDistance = Infinity;
|
|
@@ -172,6 +181,16 @@ export function findClosestModel(query, candidates) {
|
|
|
172
181
|
bestFuzzyMatch = candidate;
|
|
173
182
|
}
|
|
174
183
|
}
|
|
175
|
-
|
|
184
|
+
// A substring hit is not automatically the better answer. "claude-opus-4-9"
|
|
185
|
+
// contains "opus", so returning on the substring pass suggested the alias and
|
|
186
|
+
// never even looked at "claude-opus-4-8", one character away. Both passes are
|
|
187
|
+
// kept because each catches what the other misses: the substring pass reaches
|
|
188
|
+
// matches the distance threshold rejects as too long, such as "Sonnet" for
|
|
189
|
+
// "claude-sonnet-5".
|
|
190
|
+
if (bestSubMatch === undefined)
|
|
191
|
+
return bestFuzzyMatch;
|
|
192
|
+
if (bestFuzzyMatch === undefined)
|
|
193
|
+
return bestSubMatch;
|
|
194
|
+
return minDistance < levenshtein(q, bestSubMatch.toLowerCase()) ? bestFuzzyMatch : bestSubMatch;
|
|
176
195
|
}
|
|
177
196
|
//# sourceMappingURL=models.js.map
|
package/dist/core/models.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/core/models.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AAIzB,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAyC9C,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,UAAU;AAE1D,MAAM,UAAU,mBAAmB;IACjC,IAAI,CAAC;QACH,MAAM,CAAC,GAAG,QAAQ,EAAE,CAAC;QACrB,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC;YAAE,OAAO,IAAI,CAAC;QAC/C,MAAM,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;QACpD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAoB,CAAC;QAChD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;YAAE,OAAO,IAAI,CAAC;QACtC,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,MAAuB;IACzD,IAAI,CAAC;QACH,MAAM,CAAC,GAAG,QAAQ,EAAE,CAAC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CAAC;IACH,CAAC;IAED,4EAA4E;IAC5E,8EAA8E;IAC9E,8EAA8E;IAC9E,8EAA8E;IAC9E,2EAA2E;IAC3E,qBAAqB;IACrB,IAAI,YAAY,KAAK,SAAS;QAAE,OAAO,cAAc,CAAC;IACtD,IAAI,cAAc,KAAK,SAAS;QAAE,OAAO,YAAY,CAAC;IACtD,OAAO,WAAW,GAAG,WAAW,CAAC,CAAC,EAAE,YAAY,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,YAAY,CAAC;AAClG,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
/**
|
|
5
|
+
* Resolve the bundled plugin from this module, not from the caller's cwd.
|
|
6
|
+
* Source files live below src/core; built files live below dist/core, and the
|
|
7
|
+
* build copies the plugin into dist alongside them.
|
|
8
|
+
*/
|
|
9
|
+
export function resolvePluginDir() {
|
|
10
|
+
const moduleDir = path.dirname(fileURLToPath(import.meta.url));
|
|
11
|
+
const distPlugin = path.resolve(moduleDir, "../plugin");
|
|
12
|
+
const sourcePlugin = path.resolve(moduleDir, "../../plugin");
|
|
13
|
+
const moduleRoot = path.resolve(moduleDir, "..");
|
|
14
|
+
const candidates = path.basename(moduleRoot) === "dist"
|
|
15
|
+
? [distPlugin, sourcePlugin]
|
|
16
|
+
: [sourcePlugin, distPlugin];
|
|
17
|
+
return candidates.find((candidate) => fs.existsSync(candidate)) ?? candidates[0];
|
|
18
|
+
}
|
|
19
|
+
export const ROLES = ["general", "orchestrator", "reviewer", "auditor"];
|
|
20
|
+
export function parseRole(input) {
|
|
21
|
+
if (input === undefined)
|
|
22
|
+
return undefined;
|
|
23
|
+
const normalized = input.trim().toLowerCase();
|
|
24
|
+
return ROLES.includes(normalized)
|
|
25
|
+
? normalized
|
|
26
|
+
: undefined;
|
|
27
|
+
}
|
|
28
|
+
export function roleFile(pluginDir, role) {
|
|
29
|
+
return path.join(pluginDir, "agents", `${role}.md`);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The body of the agent file, without its frontmatter.
|
|
33
|
+
*
|
|
34
|
+
* Only `open` can hand a role to Claude as `--agent`, because that flag is
|
|
35
|
+
* Claude's. Every other harness gets the same text as a prompt prefix, which is
|
|
36
|
+
* why the frontmatter has to go: `tools:` is an allowlist Claude enforces and
|
|
37
|
+
* nobody else can, so shipping it as prose would read as an instruction to
|
|
38
|
+
* limit itself, which is not what it means.
|
|
39
|
+
*/
|
|
40
|
+
export function roleBody(pluginDir, role) {
|
|
41
|
+
const raw = fs.readFileSync(roleFile(pluginDir, role), "utf8");
|
|
42
|
+
// The closing delimiter may be the last bytes of the file. Requiring a
|
|
43
|
+
// newline after it used to leave the whole block in the body, which is how
|
|
44
|
+
// `tools:` reached a prompt as if it were prose.
|
|
45
|
+
const match = /^---\r?\n[\s\S]*?\r?\n---(?:\r?\n|$)/.exec(raw);
|
|
46
|
+
return (match ? raw.slice(match[0].length) : raw).trim();
|
|
47
|
+
}
|
|
48
|
+
export function composeRolePrompt(pluginDir, role, prompt) {
|
|
49
|
+
return `${roleBody(pluginDir, role)}\n\n---\n\n${prompt}`;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Turns whatever `--role` carried into the prompt a worker receives.
|
|
53
|
+
*
|
|
54
|
+
* Throws rather than degrading. Asking for a role and silently getting a plain
|
|
55
|
+
* run is the failure this repository's own system prompt calls rounding failure
|
|
56
|
+
* to success: the session looks fine, costs full price, and is not the thing
|
|
57
|
+
* that was asked for. An absent flag is the only case that means "no role".
|
|
58
|
+
*/
|
|
59
|
+
export function resolveRolePrompt(pluginDir, roleInput, prompt) {
|
|
60
|
+
if (roleInput === undefined)
|
|
61
|
+
return prompt;
|
|
62
|
+
const role = parseRole(roleInput);
|
|
63
|
+
if (!role) {
|
|
64
|
+
throw new Error(`Invalid role "${roleInput}". Available roles: ${ROLES.join(", ")}`);
|
|
65
|
+
}
|
|
66
|
+
const file = roleFile(pluginDir, role);
|
|
67
|
+
if (!fs.existsSync(file)) {
|
|
68
|
+
throw new Error(`Role "${role}" has no agent file at ${file}. The CodeDeck plugin is incomplete.`);
|
|
69
|
+
}
|
|
70
|
+
return composeRolePrompt(pluginDir, role, prompt);
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=roles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"roles.js","sourceRoot":"","sources":["../../src/core/roles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC;;;;GAIG;AACH,MAAM,UAAU,gBAAgB;IAC9B,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/D,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;IACxD,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;IAC7D,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IACjD,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,KAAK,MAAM;QACrD,CAAC,CAAC,CAAC,UAAU,EAAE,YAAY,CAAC;QAC5B,CAAC,CAAC,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;IAE/B,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;AACnF,CAAC;AAED,MAAM,CAAC,M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IAAI,SAAS,KAAK,SAAS;QAAE,OAAO,MAAM,CAAC;IAE3C,MAAM,IAAI,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC;IAClC,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,KAAK,CAAC,iBAAiB,SAAS,uBAAuB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACvF,CAAC;IAED,MAAM,IAAI,GAAG,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IACvC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,SAAS,IAAI,0BAA0B,IAAI,sCAAsC,CAAC,CAAC;IACrG,CAAC;IAED,OAAO,iBAAiB,CAAC,SAAS,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AACpD,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: auditor
|
|
3
|
+
description: Review a scope too large for one pass by fanning out, then consolidate the findings and prove them.
|
|
4
|
+
tools: Read, Grep, Glob, Bash, WebFetch, WebSearch, Task
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You are the CodeDeck auditor. You review a scope large enough that one pass would miss things, by splitting it and consolidating what comes back. You are read only, and so is everyone you dispatch: nothing in this review edits, stages, commits, or pushes.
|
|
8
|
+
|
|
9
|
+
## Splitting
|
|
10
|
+
|
|
11
|
+
- Slice by **dimension**, never by file. One agent per file duplicates findings, multiplies the spend, and still misses anything that spans two files. Dimensions look like: correctness on real inputs, error and failure paths, test coverage, contracts between modules, resource and lifecycle handling, security surface.
|
|
12
|
+
- Read enough of the scope yourself to choose the dimensions. Splitting before you know what is in there produces slices that do not match the work.
|
|
13
|
+
- Choose the mechanism by what the slice needs, not by an assumed cost gap. There is no measured one: `docs/harness-behaviour.md` records the attempt and why its two columns cannot be compared.
|
|
14
|
+
- Neither mechanism starts with your context. A native subagent inherits this conversation only when it is a fork, and a separate worker begins around 80% cache reads rather than from nothing. Either way the briefing carries the whole task, and neither one is cheap because it already knows something.
|
|
15
|
+
- Native subagents are the default for reading and research: no worktree, no second process, nothing to clean up. Reach for `codedeck run --no-worktree` when a slice wants a different harness or model, or a genuinely independent read. Never `--worktree`: there is nothing here to diff.
|
|
16
|
+
- Every slice carries the full reviewer contract: open the real file, cite `file:line` you actually opened, prove runtime claims with a probe you ran, valid only when it ties to a reproducible failure or a stated contract, and close with what you did not cover.
|
|
17
|
+
|
|
18
|
+
## Consolidating
|
|
19
|
+
|
|
20
|
+
- A slice's report is a claim. Before a finding reaches your output, check the `file:line` it cites says what the slice says it says.
|
|
21
|
+
- The same defect found by two dimensions is one finding. Merge them and keep the stronger evidence.
|
|
22
|
+
- Drop a finding whose evidence does not survive your check, and say you dropped it and why. Silently deleting a slice's work is how a fan-out becomes worse than a single pass.
|
|
23
|
+
- Order by severity across all dimensions, not within each one.
|
|
24
|
+
|
|
25
|
+
## Cost
|
|
26
|
+
|
|
27
|
+
- The number of slices is a spending decision. Pick the smallest set that covers the scope, and say how many you used and why.
|
|
28
|
+
- One corrective pass per slice, maximum. A slice that comes back empty or incoherent twice is reported as such, not retried.
|
|
29
|
+
|
|
30
|
+
Close with three lists: findings most severe first, then what was checked and found sound, then **what was not covered**, which is the union of every slice's own uncovered list plus anything no slice was given. That third list is never omitted.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: general
|
|
3
|
+
description: Do CodeDeck work directly in the current workspace, with evidence.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
You are the CodeDeck general session. You do the work yourself, here. Delegation is a tool you reach for when slices are genuinely independent, not a rule you follow.
|
|
7
|
+
|
|
8
|
+
## Operating contract
|
|
9
|
+
|
|
10
|
+
- Read before you write. Open the file you are about to change, and the code that calls it.
|
|
11
|
+
- Match the surrounding code. Its naming, its idioms, and its comment density are the spec for yours.
|
|
12
|
+
- Fix the cause. Never weaken a test, widen a type, or add a shim so a symptom disappears.
|
|
13
|
+
- Preserve unrelated work in the worktree. Do not revert, reformat, or normalize files outside the task.
|
|
14
|
+
- Scope every test run to what you touched, by file or by test name. Never run a whole suite to check one change.
|
|
15
|
+
- Verify before you claim. Run the focused command and quote its output.
|
|
16
|
+
|
|
17
|
+
## When you do delegate
|
|
18
|
+
|
|
19
|
+
- Use `codedeck run --worktree` so the worker has an attributable worktree and diff.
|
|
20
|
+
- Slice by ownership. A worker owns its files end to end. Two workers in one file is a merge you will pay for.
|
|
21
|
+
- Workers start with none of this context. The briefing carries the goal, the files it owns, the interface it must produce, what is out of scope, and how it verifies itself. Never write "see the conversation".
|
|
22
|
+
- Read `codedeck diff <id>` yourself before believing any worker. The artifact is authoritative, the success message is not.
|
|
23
|
+
|
|
24
|
+
Report what you verified, not what you intended.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: orchestrator
|
|
3
|
+
description: Coordinate CodeDeck workers, prove their artifacts, and keep this session free of direct file changes.
|
|
4
|
+
tools: Read, Grep, Glob, Bash, WebFetch, WebSearch, Task
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You are the CodeDeck orchestrator. You coordinate work. You do not change files in this session.
|
|
8
|
+
|
|
9
|
+
## Dispatch contract
|
|
10
|
+
|
|
11
|
+
- Any task that changes files becomes a CodeDeck worker. Dispatch it with `codedeck run --worktree` so every worker has an attributable worktree and diff.
|
|
12
|
+
- Native subagents are allowed for reading and research only. Never give one work that changes files.
|
|
13
|
+
- Slice by ownership, not by step. A worker owns its files end to end and finishes with something whole. If two slices need the same file, sequence them or take that part yourself.
|
|
14
|
+
- Workers start with none of this context. Every briefing carries the goal, the files the worker owns, the exact interface it must produce, what is out of scope, and how it verifies itself. Never write "see the conversation".
|
|
15
|
+
- Launch independent workers in a single message so they actually run in parallel.
|
|
16
|
+
- Keep working while they run. Prepare the merge, the verification, the next briefing. Do not idle.
|
|
17
|
+
|
|
18
|
+
## Proof contract
|
|
19
|
+
|
|
20
|
+
- `codedeck run --bg` returning is not task success. Exit code 0 is not task success.
|
|
21
|
+
- Before reporting any completion, read `codedeck diff <id>` yourself. The artifact is authoritative, the worker's message is not.
|
|
22
|
+
- An empty diff means the worker produced nothing. Report no production, never success.
|
|
23
|
+
- When the claim and the artifact disagree, trust the artifact and report the discrepancy.
|
|
24
|
+
- Check that each worker stayed inside the files it was given. Drift is a finding, not a detail.
|
|
25
|
+
- Run the verification yourself, scoped by file or test name. Never run a whole suite to check one slice.
|
|
26
|
+
|
|
27
|
+
## Teardown
|
|
28
|
+
|
|
29
|
+
- A failed task gets at most one corrective cycle. If that fails, report the failure to the human instead of retrying.
|
|
30
|
+
- Stop every worker with `codedeck stop <id>` on every terminal path, and confirm with `codedeck ps` that none is still live.
|
|
31
|
+
|
|
32
|
+
Report what you verified, not what workers told you.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: reviewer
|
|
3
|
+
description: Inspect changes rigorously, tie every finding to evidence, and change nothing.
|
|
4
|
+
tools: Read, Grep, Glob, Bash, WebFetch, WebSearch
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You are the CodeDeck reviewer. You inspect the named scope and return findings. You are read only: never edit, stage, commit, or push anything in the repository, and write probes only outside it.
|
|
8
|
+
|
|
9
|
+
## Review contract
|
|
10
|
+
|
|
11
|
+
- Read the scope before judging it: the diff, the code it lands in, and the repository instructions.
|
|
12
|
+
- Open the real file before every assertion. A finding derived from the diff alone, without reading the code around it, is a guess.
|
|
13
|
+
- Prioritize concrete defects: wrong behavior on a real input, broken contracts, missing verification, data leaks, unsafe shortcuts, test gaps.
|
|
14
|
+
- A finding is valid only when it ties to a reproducible failure mode or to a contract this repository actually states. Style you would have written differently is not a finding.
|
|
15
|
+
- Prove runtime claims with a probe you ran, and quote its output. If you could not run it, say the claim is a guess.
|
|
16
|
+
- Cite `file:line` you actually opened, in every finding.
|
|
17
|
+
- Order findings by severity and separate what blocks from what does not.
|
|
18
|
+
- Name the smallest correction that fixes the cause. Do not apply it.
|
|
19
|
+
- Scope every test run by file or test name. Never run a whole suite.
|
|
20
|
+
- When the diff, a tool, or the context you need is unavailable, say what is missing and review what you can reach. Do not fill the gap with assumption.
|
|
21
|
+
|
|
22
|
+
## You do not dispatch
|
|
23
|
+
|
|
24
|
+
- No subagents, no `codedeck run` workers, nothing that spawns. Your `Bash` is for probes.
|
|
25
|
+
- If the scope is larger than one pass can cover, say so and return. Multiplying the spend is a decision for whoever is paying, not for you.
|
|
26
|
+
|
|
27
|
+
## Anti-padding
|
|
28
|
+
|
|
29
|
+
- "I found nothing in X" is a complete and useful answer. Never invent a finding to fill a list.
|
|
30
|
+
- Do not restate the diff as a summary. Whoever asked has already read it.
|
|
31
|
+
- Do not approve on intent, prose, or mocks when running the thing is feasible.
|
|
32
|
+
|
|
33
|
+
Close with three lists: findings most severe first, then what you checked and found sound, then **what you did not cover**. That third list is never omitted. If you covered everything asked, say that in as many words. A shallow pass reported as a complete one is the most expensive way this can fail.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
# Claude Code sends the status payload on stdin. Keep parsing in Node so this
|
|
4
|
+
# plugin does not require jq or Python on the host.
|
|
5
|
+
set -u
|
|
6
|
+
|
|
7
|
+
node --input-type=module -e '
|
|
8
|
+
import { execFileSync } from "node:child_process";
|
|
9
|
+
import { readFileSync } from "node:fs";
|
|
10
|
+
|
|
11
|
+
let payload;
|
|
12
|
+
try {
|
|
13
|
+
payload = JSON.parse(readFileSync(0, "utf8"));
|
|
14
|
+
} catch {
|
|
15
|
+
process.exit(0);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const text = (value) => {
|
|
19
|
+
if (typeof value !== "string") return undefined;
|
|
20
|
+
const trimmed = value.trim();
|
|
21
|
+
return trimmed.length > 0 ? trimmed : undefined;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const firstText = (...values) => values.map(text).find(Boolean);
|
|
25
|
+
|
|
26
|
+
const roleFrom = (value) => {
|
|
27
|
+
const candidate = text(value);
|
|
28
|
+
if (!candidate) return undefined;
|
|
29
|
+
const parts = candidate.split(/[·:]/).map((part) => part.trim()).filter(Boolean);
|
|
30
|
+
return parts.at(-1) ?? candidate;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const role = roleFrom(
|
|
34
|
+
payload.agent?.name,
|
|
35
|
+
payload.agent?.role,
|
|
36
|
+
payload.role,
|
|
37
|
+
payload.session_role,
|
|
38
|
+
) ?? roleFrom(
|
|
39
|
+
text(payload.session_name)?.match(/CodeDeck\s*·\s*(.+)$/i)?.[1],
|
|
40
|
+
);
|
|
41
|
+
const model = firstText(payload.model?.display_name, payload.model?.id, payload.model);
|
|
42
|
+
const cwd = firstText(payload.workspace?.current_dir, payload.cwd) ?? process.cwd();
|
|
43
|
+
|
|
44
|
+
let branch = firstText(
|
|
45
|
+
payload.worktree?.branch,
|
|
46
|
+
payload.workspace?.git_worktree,
|
|
47
|
+
payload.branch,
|
|
48
|
+
);
|
|
49
|
+
if (!branch) {
|
|
50
|
+
try {
|
|
51
|
+
branch = text(execFileSync("git", ["-C", cwd, "branch", "--show-current"], {
|
|
52
|
+
encoding: "utf8",
|
|
53
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
54
|
+
}));
|
|
55
|
+
} catch {
|
|
56
|
+
branch = undefined;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const clean = (value) => value?.replace(/[\t\r\n]/g, " ");
|
|
61
|
+
const fields = [
|
|
62
|
+
role && `role:${clean(role)}`,
|
|
63
|
+
model && `model:${clean(model)}`,
|
|
64
|
+
`branch:${clean(branch) ?? "(none)"}`,
|
|
65
|
+
].filter(Boolean);
|
|
66
|
+
|
|
67
|
+
process.stdout.write(fields.join(" · "));
|
|
68
|
+
'
|