codedeck 0.5.0 → 0.5.2

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.
Files changed (48) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +15 -0
  3. package/dist/cli/commands/doctor.js +10 -2
  4. package/dist/cli/commands/doctor.js.map +1 -1
  5. package/dist/cli/commands/open.js +49 -12
  6. package/dist/cli/commands/open.js.map +1 -1
  7. package/dist/cli/commands/profile.js +191 -0
  8. package/dist/cli/commands/profile.js.map +1 -0
  9. package/dist/cli/commands/run.js +36 -5
  10. package/dist/cli/commands/run.js.map +1 -1
  11. package/dist/cli/commands/setup.js +175 -23
  12. package/dist/cli/commands/setup.js.map +1 -1
  13. package/dist/cli/index.js +2 -0
  14. package/dist/cli/index.js.map +1 -1
  15. package/dist/config/config.js +82 -2
  16. package/dist/config/config.js.map +1 -1
  17. package/dist/daemon/daemon.js +1 -0
  18. package/dist/daemon/daemon.js.map +1 -1
  19. package/dist/drivers/codex/parser.js +14 -10
  20. package/dist/drivers/codex/parser.js.map +1 -1
  21. package/dist/drivers/helpers.js +17 -1
  22. package/dist/drivers/helpers.js.map +1 -1
  23. package/dist/drivers/session-runtime.js +3 -0
  24. package/dist/drivers/session-runtime.js.map +1 -1
  25. package/dist/open/contract.js.map +1 -1
  26. package/dist/open/launchers/claude.js +8 -2
  27. package/dist/open/launchers/claude.js.map +1 -1
  28. package/dist/plugin/agents/auditor.md +2 -0
  29. package/dist/plugin/agents/general.md +10 -2
  30. package/dist/plugin/agents/orchestrator-edit.md +10 -2
  31. package/dist/plugin/agents/orchestrator-read.md +10 -2
  32. package/dist/plugin/agents/orchestrator.md +18 -3
  33. package/dist/plugin/prompts/_partials/dispatch.md +2 -0
  34. package/dist/plugin/prompts/_partials/reports-dispatch.md +5 -0
  35. package/dist/plugin/prompts/_partials/reports-general.md +5 -0
  36. package/dist/plugin/prompts/_partials/spec-gates.md +6 -0
  37. package/dist/plugin/prompts/_partials/worktree.md +1 -1
  38. package/dist/plugin/prompts/roles/general.md +1 -0
  39. package/dist/plugin/prompts/roles/orchestrator-edit.md +1 -0
  40. package/dist/plugin/prompts/roles/orchestrator-read.md +1 -0
  41. package/dist/plugin/prompts/roles/orchestrator.md +3 -1
  42. package/dist/utils/process.js +88 -0
  43. package/dist/utils/process.js.map +1 -1
  44. package/dist/web/canvas-page.js +79 -33
  45. package/dist/web/canvas-page.js.map +1 -1
  46. package/dist/web/review-page.js +121 -22
  47. package/dist/web/review-page.js.map +1 -1
  48. package/package.json +1 -1
@@ -58,6 +58,16 @@ export const REVIEW_PAGE = `<!doctype html>
58
58
  tr.add td.code { background: rgba(48,209,88,.10); }
59
59
  tr.del td.code { background: rgba(255,69,58,.10); }
60
60
  tr.add td.no.new { color: #30d158; } tr.del td.no.old { color: #ff453a; }
61
+ .tok-k { color: #ff7b72; }
62
+ .tok-s { color: #a5d6ff; }
63
+ .tok-c { color: #8b949e; font-style: italic; }
64
+ .tok-n { color: #79c0ff; }
65
+ .tok-f { color: #d2a8ff; }
66
+ .sign { color: #636366; user-select: none; }
67
+ tr.chg td.code { background: rgba(255,159,10,.06); }
68
+ .wd, .wd-del { border-radius: 3px; }
69
+ .wd { background: rgba(48,209,88,.38); }
70
+ .wd-del { background: rgba(255,69,58,.38); text-decoration: line-through; }
61
71
  tr.cbox td { padding: 8px 12px 10px 54px; background: rgba(10,132,255,.07); }
62
72
  .cbox textarea { width: 100%; min-height: 64px; background: rgba(255,255,255,.06);
63
73
  border: 1px solid rgba(255,255,255,.14); border-radius: 8px; color: #f5f5f7;
@@ -67,7 +77,7 @@ export const REVIEW_PAGE = `<!doctype html>
67
77
  border-radius: 8px; padding: 6px 12px; cursor: pointer; font-family: inherit; font-size: 12px; }
68
78
  .cbox button.ghost { background: transparent; }
69
79
  .cbox .ok { font-size: 11.5px; color: #30d158; }
70
- .hasNote td.no.new, .hasNote td.no.old { text-decoration: underline dotted; text-underline-offset: 3px; }
80
+ .hasNote td.no { text-decoration: underline dotted; text-underline-offset: 3px; }
71
81
  tr.sel td.code { background: rgba(10,132,255,.20); }
72
82
  tr.sel td.no { background: rgba(10,132,255,.35); color: #fff; }
73
83
  tr.thread td { padding: 6px 12px 10px 54px; }
@@ -128,6 +138,75 @@ function langOf(p) {
128
138
  xml: "xml", json: "json", yaml: "yaml", yml: "yaml", toml: "toml", md: "md", sh: "bash", sql: "sql" };
129
139
  return map[ext] || "";
130
140
  }
141
+ /* Minimal inline syntax highlight (kept dependency-free so the page stays
142
+ * self-contained/offline): single-pass tokenizer, strings before comments so
143
+ * "//" inside a string is not a comment. md/plain stays uncolored. */
144
+ var HI_C = /(\\/\\*[\\s\\S]*?\\*\\/|<!--[\\s\\S]*?-->)|("(?:[^"\\\\\\n]|\\\\.)*"|'(?:[^'\\\\\\n]|\\\\.)*'|\`(?:[^\`\\\\]|\\\\.)*\`)|(\\/\\/[^\\n]*)|\\b(\\d+(?:\\.\\d+)?)\\b|\\b(break|case|catch|class|const|continue|def|delete|do|else|elif|enum|export|extends|false|finally|for|from|function|if|import|in|instanceof|interface|let|new|null|return|struct|switch|this|throw|true|try|type|typeof|var|void|while|with|as|async|await|fn|impl|match|mut|pub|self|package|func|go|defer|nil|lambda|pass|raise|yield|private|public|protected|static|final|int|float|double|char|boolean|string|number|select|chan)\\b|([A-Za-z_$][\\w$]*)(?=\\()/g;
145
+ var HI_H = /("""[\\s\\S]*?"""|"(?:[^"\\\\\\n]|\\\\.)*"|'(?:[^'\\\\\\n]|\\\\.)*'|\`(?:[^\`\\\\]|\\\\.)*\`)|(#[^\\n]*)|\\b(\\d+(?:\\.\\d+)?)\\b|\\b(break|case|catch|class|const|continue|def|delete|do|else|elif|enum|export|extends|false|finally|for|from|function|if|import|in|instanceof|interface|let|new|null|return|struct|switch|this|throw|true|try|type|typeof|var|void|while|with|as|async|await|fn|impl|match|mut|pub|self|package|func|go|defer|nil|lambda|pass|raise|yield|private|public|protected|static|final|int|float|double|char|boolean|string|number|select|chan)\\b|([A-Za-z_$][\\w$]*)(?=\\()/g;
146
+ function hi(code, lang) {
147
+ if (!code) return "";
148
+ if (!lang || lang === "md") return esc(code);
149
+ var hash = lang === "py" || lang === "bash" || lang === "yaml" || lang === "toml" || lang === "ruby" || lang === "dockerfile";
150
+ var re = hash ? HI_H : HI_C;
151
+ re.lastIndex = 0;
152
+ var out = "", last = 0, m, cls;
153
+ while ((m = re.exec(code))) {
154
+ out += esc(code.slice(last, m.index));
155
+ if (hash) cls = m[1] ? "tok-s" : m[2] ? "tok-c" : m[3] ? "tok-n" : m[4] ? "tok-k" : "tok-f";
156
+ else cls = m[1] ? "tok-c" : m[2] ? "tok-s" : m[3] ? "tok-c" : m[4] ? "tok-n" : m[5] ? "tok-k" : "tok-f";
157
+ out += '<span class="' + cls + '">' + esc(m[0]) + "</span>";
158
+ last = m.index + m[0].length;
159
+ }
160
+ return out + esc(code.slice(last));
161
+ }
162
+ /* Merged word-diff for paired del/add lines (same count in one change block):
163
+ * one row per line number: removed tokens struck (.wd-del), added (.wd).
164
+ * Token-count cap falls back to plain highlight on minified-line pairs. */
165
+ function toks(s) {
166
+ var parts = String(s).match(/\\w+|\\s+|[^\\w\\s]/g) || [];
167
+ var out = [], pos = 0, k;
168
+ for (k = 0; k < parts.length; k++) { out.push({ t: parts[k], s: pos, e: pos + parts[k].length }); pos += parts[k].length; }
169
+ return out;
170
+ }
171
+ function mergeWords(oldCode, newCode, lang) {
172
+ var A = toks(oldCode), B = toks(newCode);
173
+ if (!A.length || !B.length) return hi(newCode, lang);
174
+ if (A.length * B.length > 10000) return hi(newCode, lang);
175
+ var n = A.length, m = B.length, i, j;
176
+ var len = [];
177
+ for (i = 0; i <= n; i++) { len.push([]); for (j = 0; j <= m; j++) len[i].push(0); }
178
+ for (i = n - 1; i >= 0; i--) {
179
+ for (j = m - 1; j >= 0; j--) {
180
+ len[i][j] = A[i].t === B[j].t ? len[i + 1][j + 1] + 1 : Math.max(len[i + 1][j], len[i][j + 1]);
181
+ }
182
+ }
183
+ var fa = [], fb = [];
184
+ for (i = 0; i < n; i++) fa.push(true);
185
+ for (j = 0; j < m; j++) fb.push(true);
186
+ i = 0; j = 0;
187
+ while (i < n && j < m) {
188
+ if (A[i].t === B[j].t) { fa[i] = false; fb[j] = false; i++; j++; }
189
+ else if (len[i + 1][j] >= len[i][j + 1]) i++;
190
+ else j++;
191
+ }
192
+ var out = "";
193
+ i = 0; j = 0;
194
+ while (i < n || j < m) {
195
+ if (i < n && j < m && !fa[i] && !fb[j]) {
196
+ var ei = i, ej = j;
197
+ while (ei < n && ej < m && !fa[ei] && !fb[ej]) { ei++; ej++; }
198
+ out += hi(newCode.slice(B[j].s, B[ej - 1].e), lang);
199
+ i = ei; j = ej;
200
+ } else {
201
+ var oi = i, oj = j;
202
+ while (i < n && fa[i]) i++;
203
+ while (j < m && fb[j]) j++;
204
+ if (oi < i) out += '<span class="wd-del">' + hi(oldCode.slice(A[oi].s, A[i - 1].e), lang) + "</span>";
205
+ if (oj < j) out += '<span class="wd">' + hi(newCode.slice(B[oj].s, B[j - 1].e), lang) + "</span>";
206
+ }
207
+ }
208
+ return out;
209
+ }
131
210
  /* Drafts: key codedeck-review:<file>:<line>[-<endLine>] -> { code, body, deleted } */
132
211
  function draftKey(file, line, endLine) { return "codedeck-review:" + file + ":" + line + (endLine && endLine !== line ? "-" + endLine : ""); }
133
212
  function loadDraft(file, line, endLine) {
@@ -294,7 +373,7 @@ function commentRow(file, line, code, deleted, endLine, onClose) {
294
373
  var tr = document.createElement("tr");
295
374
  tr.className = "cbox";
296
375
  var td = document.createElement("td");
297
- td.colSpan = 3;
376
+ td.colSpan = 2;
298
377
  var spec = endLine && endLine !== line ? line + "-" + endLine : String(line);
299
378
  var ta = document.createElement("textarea");
300
379
  ta.placeholder = "comentar " + file + ":" + spec + "… (shift+enter envia)";
@@ -376,7 +455,7 @@ function renderThread(d) {
376
455
  tr.setAttribute("data-start", String(lo));
377
456
  tr.setAttribute("data-end", String(hi));
378
457
  var td = document.createElement("td");
379
- td.colSpan = 3;
458
+ td.colSpan = 2;
380
459
  var box = document.createElement("div");
381
460
  box.className = "threadbox";
382
461
  var head = document.createElement("div");
@@ -452,6 +531,7 @@ function render(data) {
452
531
  var sec = document.createElement("section");
453
532
  sec.className = "file";
454
533
  sec.id = "f" + idx;
534
+ var lang = langOf(f.path);
455
535
  var h = document.createElement("h3");
456
536
  var title = f.status === "renamed" ? f.oldPath + " → " + f.path : f.path;
457
537
  h.innerHTML = '<span class="st ' + f.status[0].toUpperCase() + '">' + f.status[0].toUpperCase() + "</span><span>" + esc(title) + "</span>" +
@@ -475,25 +555,47 @@ function render(data) {
475
555
  sec.appendChild(hh);
476
556
  var table = document.createElement("table");
477
557
  table.className = "diff";
478
- (hu.lines || []).forEach(function (ln) {
558
+ var wls = hu.lines || [], pmap = {}, pskip = {}, pb = 0;
559
+ while (pb < wls.length) {
560
+ if (wls[pb].type !== "add" && wls[pb].type !== "del") { pb++; continue; }
561
+ var pe = pb, pd = [], pa = [];
562
+ while (pe < wls.length && (wls[pe].type === "add" || wls[pe].type === "del")) {
563
+ if (wls[pe].type === "del") pd.push(pe); else pa.push(pe);
564
+ pe++;
565
+ }
566
+ if (pd.length && pd.length === pa.length) {
567
+ for (var pk = 0; pk < pd.length; pk++) {
568
+ pmap[pd[pk]] = pa[pk];
569
+ pskip[pa[pk]] = true;
570
+ }
571
+ }
572
+ pb = pe;
573
+ }
574
+ (hu.lines || []).forEach(function (ln, li) {
575
+ if (pskip[li]) return;
576
+ var pm = pmap[li] !== undefined ? wls[pmap[li]] : null;
479
577
  var tr = document.createElement("tr");
480
- if (ln.type === "add") tr.className = "add";
578
+ if (pm) tr.className = "chg";
579
+ else if (ln.type === "add") tr.className = "add";
481
580
  else if (ln.type === "del") tr.className = "del";
482
- var anchorLine = ln.newNo != null ? ln.newNo : ln.oldNo;
581
+ var anchorLine = pm ? pm.newNo : (ln.newNo != null ? ln.newNo : ln.oldNo);
582
+ var showNew = pm ? pm.newNo : ln.newNo;
583
+ var showCode = pm ? pm.text : ln.text;
483
584
  tr.setAttribute("data-file", f.path);
484
585
  tr.setAttribute("data-line", String(anchorLine));
485
- tr.setAttribute("data-code", ln.text);
486
- var tdO = document.createElement("td");
487
- tdO.className = "no old";
488
- tdO.textContent = ln.oldNo != null ? String(ln.oldNo) : "";
489
- tdO.title = "arraste para selecionar · clique comenta a linha";
490
- var tdN = document.createElement("td");
491
- tdN.className = "no new";
492
- tdN.textContent = ln.newNo != null ? String(ln.newNo) : "";
493
- tdN.title = "arraste para selecionar · clique comenta a linha";
586
+ tr.setAttribute("data-code", showCode);
587
+ var tdG = document.createElement("td");
588
+ tdG.className = "no" + (pm ? "" : ln.type === "add" ? " new" : ln.type === "del" ? " old" : "");
589
+ var showNo = showNew != null ? showNew : ln.oldNo;
590
+ tdG.textContent = showNo != null ? String(showNo) : "";
591
+ tdG.title = "arraste para selecionar · clique comenta a linha" + (pm && ln.oldNo !== showNo ? " · era " + ln.oldNo + " no ref" : "");
494
592
  var tdC = document.createElement("td");
495
593
  tdC.className = "code";
496
- tdC.textContent = (ln.type === "add" ? "+" : ln.type === "del" ? "-" : " ") + ln.text;
594
+ if (pm) tdC.innerHTML = mergeWords(ln.text, showCode, lang);
595
+ else {
596
+ var sign = ln.type === "add" ? "+" : ln.type === "del" ? "-" : " ";
597
+ tdC.innerHTML = '<span class="sign">' + esc(sign) + "</span>" + hi(ln.text, lang);
598
+ }
497
599
  function dragStart(ev) {
498
600
  if (ev.button !== undefined && ev.button !== 0) return;
499
601
  ev.preventDefault();
@@ -509,12 +611,9 @@ function render(data) {
509
611
  var slice = rowsBetween(sec, f.path, selAnchor.tr, tr);
510
612
  slice.forEach(function (r) { r.classList.add("sel"); });
511
613
  }
512
- tdO.addEventListener("mousedown", dragStart);
513
- tdN.addEventListener("mousedown", dragStart);
514
- tdO.addEventListener("mouseover", dragOver);
515
- tdN.addEventListener("mouseover", dragOver);
516
- tr.appendChild(tdO);
517
- tr.appendChild(tdN);
614
+ tdG.addEventListener("mousedown", dragStart);
615
+ tdG.addEventListener("mouseover", dragOver);
616
+ tr.appendChild(tdG);
518
617
  tr.appendChild(tdC);
519
618
  table.appendChild(tr);
520
619
  });
@@ -1 +1 @@
1
- {"version":3,"file":"review-page.js","sourceRoot":"","sources":["../../src/web/review-page.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,WAAW,GAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA4iB3B,CAAC"}
1
+ {"version":3,"file":"review-page.js","sourceRoot":"","sources":["../../src/web/review-page.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,WAAW,GAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA+oB3B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codedeck",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "description": "CodeDeck, a local runtime for coding agents with session management, process supervision, event normalization, and git isolation",
5
5
  "type": "module",
6
6
  "bin": {