crewforth 0.0.1 → 3.0.0-rc.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.
Files changed (168) hide show
  1. package/CHANGELOG.md +3784 -0
  2. package/LICENSE +21 -0
  3. package/README.md +37 -7
  4. package/VERSION +1 -0
  5. package/adopt.sh +1670 -0
  6. package/bin/cli.js +497 -0
  7. package/kit/AGENT_TEMPLATE.md +92 -0
  8. package/kit/CLAUDE.md +228 -0
  9. package/kit/README.md +107 -0
  10. package/kit/agents/crew-backend-expert.md +95 -0
  11. package/kit/agents/crew-commit-agent.md +96 -0
  12. package/kit/agents/crew-database-expert.md +84 -0
  13. package/kit/agents/crew-devops-expert.md +82 -0
  14. package/kit/agents/crew-frontend-expert.md +85 -0
  15. package/kit/agents/crew-performance-expert.md +78 -0
  16. package/kit/agents/crew-planner.md +60 -0
  17. package/kit/agents/crew-privacy-agent.md +71 -0
  18. package/kit/agents/crew-review-agent.md +95 -0
  19. package/kit/agents/crew-security-expert.md +73 -0
  20. package/kit/agents/crew-session-manager.md +77 -0
  21. package/kit/agents/crew-test-expert.md +64 -0
  22. package/kit/eval/doctor.sh +465 -0
  23. package/kit/eval/gate-report.sh +137 -0
  24. package/kit/eval/golden-holdout.txt +53 -0
  25. package/kit/eval/golden-routing.txt +199 -0
  26. package/kit/eval/lib/crew-env.sh +14 -0
  27. package/kit/eval/lib/settings-json.awk +154 -0
  28. package/kit/eval/lib/star.sh +70 -0
  29. package/kit/eval/parser-conformance.sh +612 -0
  30. package/kit/eval/preflight.sh +186 -0
  31. package/kit/eval/routing-eval.sh +209 -0
  32. package/kit/eval/scan-skill.sh +162 -0
  33. package/kit/eval/smoke-test.sh +6693 -0
  34. package/kit/eval/update-guard.sh +81 -0
  35. package/kit/eval/utilization.sh +130 -0
  36. package/kit/hooks/board-sync.sh +106 -0
  37. package/kit/hooks/board.sh +962 -0
  38. package/kit/hooks/commit-msg +49 -0
  39. package/kit/hooks/context-usage.sh +353 -0
  40. package/kit/hooks/floor-blocklist.txt +124 -0
  41. package/kit/hooks/guard-bash.sh +1431 -0
  42. package/kit/hooks/guard-commit-scan.sh +511 -0
  43. package/kit/hooks/guard-write.sh +513 -0
  44. package/kit/hooks/pre-commit +577 -0
  45. package/kit/hooks/route-hint.sh +185 -0
  46. package/kit/hooks/secret-blocklist.txt +82 -0
  47. package/kit/hooks/session-guard.sh +149 -0
  48. package/kit/hooks/session-rehydrate.sh +41 -0
  49. package/kit/hooks/session-stats.sh +252 -0
  50. package/kit/hooks/session-update-check.sh +236 -0
  51. package/kit/hooks/skill-trust.sh +150 -0
  52. package/kit/hooks/trace-blocklist.txt +53 -0
  53. package/kit/settings.json +132 -0
  54. package/kit/skills/a11y/SKILL.md +44 -0
  55. package/kit/skills/adr/SKILL.md +74 -0
  56. package/kit/skills/api-design/SKILL.md +50 -0
  57. package/kit/skills/automode-policy/SKILL.md +91 -0
  58. package/kit/skills/automode-policy/references/policy.json +13 -0
  59. package/kit/skills/automode-policy/scripts/apply.sh +84 -0
  60. package/kit/skills/automode-policy/scripts/check.sh +102 -0
  61. package/kit/skills/backend-architecture/SKILL.md +103 -0
  62. package/kit/skills/brainstorm/SKILL.md +47 -0
  63. package/kit/skills/ci-pipeline/SKILL.md +38 -0
  64. package/kit/skills/commit-message/SKILL.md +82 -0
  65. package/kit/skills/commit-message/references/examples.md +8 -0
  66. package/kit/skills/confidence-check/SKILL.md +86 -0
  67. package/kit/skills/crew-board/SKILL.md +55 -0
  68. package/kit/skills/crew-brainstorm/SKILL.md +19 -0
  69. package/kit/skills/crew-code-review/SKILL.md +151 -0
  70. package/kit/skills/crew-code-review/references/history-search.md +19 -0
  71. package/kit/skills/crew-code-review/references/panel-mode.md +32 -0
  72. package/kit/skills/crew-code-review/references/receiving.md +23 -0
  73. package/kit/skills/crew-doctor/SKILL.md +36 -0
  74. package/kit/skills/crew-gates/SKILL.md +25 -0
  75. package/kit/skills/crew-handoff/SKILL.md +14 -0
  76. package/kit/skills/crew-plan/SKILL.md +18 -0
  77. package/kit/skills/crew-review/SKILL.md +23 -0
  78. package/kit/skills/crew-ship/SKILL.md +19 -0
  79. package/kit/skills/crew-skill/SKILL.md +61 -0
  80. package/kit/skills/crew-studio/SKILL.md +129 -0
  81. package/kit/skills/crew-update/SKILL.md +43 -0
  82. package/kit/skills/db-migration/SKILL.md +120 -0
  83. package/kit/skills/db-migration/references/backup-restore.md +33 -0
  84. package/kit/skills/db-migration/references/raw-sql.md +30 -0
  85. package/kit/skills/db-migration/references/tool-matrix.md +35 -0
  86. package/kit/skills/dependency-audit/SKILL.md +61 -0
  87. package/kit/skills/dependency-upgrade/SKILL.md +82 -0
  88. package/kit/skills/deploy/SKILL.md +100 -0
  89. package/kit/skills/deploy/references/proxy-ssl.md +56 -0
  90. package/kit/skills/deploy/references/rollback.md +18 -0
  91. package/kit/skills/deploy/references/scripts.md +9 -0
  92. package/kit/skills/deploy/references/topology-a.md +128 -0
  93. package/kit/skills/deploy/references/topology-b.md +44 -0
  94. package/kit/skills/docs-writer/SKILL.md +53 -0
  95. package/kit/skills/docs-writer/references/coauthoring.md +34 -0
  96. package/kit/skills/eval-grader/SKILL.md +75 -0
  97. package/kit/skills/eval-grader/references/method.md +51 -0
  98. package/kit/skills/frontend/SKILL.md +56 -0
  99. package/kit/skills/frontend/references/verify-contract.md +41 -0
  100. package/kit/skills/frontend-design/SKILL.md +71 -0
  101. package/kit/skills/frontend-design/references/design-review.md +34 -0
  102. package/kit/skills/frontend-rn-expo/SKILL.md +25 -0
  103. package/kit/skills/handoff/SKILL.md +71 -0
  104. package/kit/skills/handoff/references/cold-reader.md +51 -0
  105. package/kit/skills/i18n-integrity/SKILL.md +31 -0
  106. package/kit/skills/incident-runbook/SKILL.md +40 -0
  107. package/kit/skills/incident-runbook/references/postmortem.md +16 -0
  108. package/kit/skills/iterate/SKILL.md +40 -0
  109. package/kit/skills/mcp-builder/SKILL.md +54 -0
  110. package/kit/skills/mcp-builder/references/building.md +71 -0
  111. package/kit/skills/observability/SKILL.md +50 -0
  112. package/kit/skills/performance/SKILL.md +38 -0
  113. package/kit/skills/performance/references/bottlenecks.md +10 -0
  114. package/kit/skills/privacy-compliance/SKILL.md +75 -0
  115. package/kit/skills/red-team/SKILL.md +48 -0
  116. package/kit/skills/reflect/SKILL.md +57 -0
  117. package/kit/skills/release/SKILL.md +44 -0
  118. package/kit/skills/security-scan/SKILL.md +99 -0
  119. package/kit/skills/security-scan/references/ai-agents.md +107 -0
  120. package/kit/skills/security-scan/references/fronts.md +99 -0
  121. package/kit/skills/security-scan/references/prompting.md +23 -0
  122. package/kit/skills/security-scan/references/reporting.md +75 -0
  123. package/kit/skills/security-scan/references/verify.md +131 -0
  124. package/kit/skills/sonarqube-check/SKILL.md +108 -0
  125. package/kit/skills/sonarqube-check/references/local-engines.md +32 -0
  126. package/kit/skills/sonarqube-check/references/stand-up-server.md +25 -0
  127. package/kit/skills/spec-planning/SKILL.md +92 -0
  128. package/kit/skills/systematic-debugging/SKILL.md +57 -0
  129. package/kit/skills/systematic-debugging/references/techniques.md +44 -0
  130. package/kit/skills/teamboard/SKILL.md +88 -0
  131. package/kit/skills/teamboard/references/setup.md +37 -0
  132. package/kit/skills/testing/SKILL.md +49 -0
  133. package/kit/skills/testing/references/flaky-triage.md +51 -0
  134. package/kit/skills/threat-model/SKILL.md +57 -0
  135. package/kit/skills/threat-model/references/interview.md +51 -0
  136. package/kit/skills/threat-model/references/schema.md +42 -0
  137. package/kit/skills/token-budget/SKILL.md +51 -0
  138. package/kit/skills/trace-scan/SKILL.md +43 -0
  139. package/kit/skills/worktree/SKILL.md +40 -0
  140. package/kit/studio/README.md +266 -0
  141. package/kit/studio/ensure-node.sh +471 -0
  142. package/kit/studio/package.json +14 -0
  143. package/kit/studio/server/hooks/studio-gate.sh +169 -0
  144. package/kit/studio/server/index.js +902 -0
  145. package/kit/studio/server/lib/crew-env.js +11 -0
  146. package/kit/studio/server/lib/fleet.js +146 -0
  147. package/kit/studio/server/lib/graph.js +533 -0
  148. package/kit/studio/server/lib/instance.js +135 -0
  149. package/kit/studio/server/lib/kit-telemetry.js +182 -0
  150. package/kit/studio/server/lib/kit.js +158 -0
  151. package/kit/studio/server/lib/palette.js +118 -0
  152. package/kit/studio/server/lib/peers.js +72 -0
  153. package/kit/studio/server/lib/permissions.js +150 -0
  154. package/kit/studio/server/lib/projects.js +294 -0
  155. package/kit/studio/server/lib/roster.js +191 -0
  156. package/kit/studio/server/lib/session.js +309 -0
  157. package/kit/studio/server/lib/terminal.js +91 -0
  158. package/kit/studio/server/lib/transcript.js +100 -0
  159. package/kit/studio/web/app.js +1098 -0
  160. package/kit/studio/web/canvas.js +1179 -0
  161. package/kit/studio/web/chat.js +543 -0
  162. package/kit/studio/web/index.html +86 -0
  163. package/kit/studio/web/md.js +110 -0
  164. package/kit/studio/web/storage-migrate.js +23 -0
  165. package/kit/studio/web/style.css +1453 -0
  166. package/package.json +46 -8
  167. package/start.sh +748 -0
  168. package/bin/crewforth.js +0 -10
@@ -0,0 +1,110 @@
1
+ // A small Markdown renderer for agent reports.
2
+ //
3
+ // Agents write Markdown — headings, tables, fenced code — and reading it raw
4
+ // wastes the structure they took the trouble to produce. This covers what they
5
+ // actually use rather than the whole spec.
6
+ //
7
+ // Everything is HTML-escaped first and only known constructs are re-introduced,
8
+ // so report text can never inject markup into the panel.
9
+
10
+ const ESC = { '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' };
11
+ const esc = (s) => String(s).replace(/[&<>"']/g, (c) => ESC[c]);
12
+
13
+ function inline(s) {
14
+ return esc(s)
15
+ .replace(/`([^`]+)`/g, '<code>$1</code>')
16
+ .replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>')
17
+ .replace(/(^|[\s(])\*([^*\s][^*]*)\*/g, '$1<em>$2</em>')
18
+ .replace(/\[([^\]]+)\]\(([^)]+)\)/g, '<span class="md-link">$1</span>');
19
+ }
20
+
21
+ function tableRow(line) {
22
+ return line.replace(/^\||\|$/g, '').split('|').map((c) => c.trim());
23
+ }
24
+
25
+ export function renderMarkdown(src) {
26
+ if (!src) return '';
27
+ const lines = String(src).split('\n');
28
+ const out = [];
29
+ let i = 0;
30
+ let list = null; // 'ul' | 'ol'
31
+
32
+ const closeList = () => { if (list) { out.push(`</${list}>`); list = null; } };
33
+
34
+ while (i < lines.length) {
35
+ const line = lines[i];
36
+
37
+ // fenced code — taken verbatim, never re-parsed
38
+ const fence = line.match(/^\s*```(\w*)\s*$/);
39
+ if (fence) {
40
+ closeList();
41
+ const body = [];
42
+ i += 1;
43
+ while (i < lines.length && !/^\s*```\s*$/.test(lines[i])) { body.push(lines[i]); i += 1; }
44
+ i += 1;
45
+ out.push(`<pre class="md-code"><code>${esc(body.join('\n'))}</code></pre>`);
46
+ continue;
47
+ }
48
+
49
+ // table: a header row followed by a separator of dashes
50
+ if (/^\s*\|/.test(line) && i + 1 < lines.length && /^\s*\|[\s:|-]+\|?\s*$/.test(lines[i + 1])) {
51
+ closeList();
52
+ const head = tableRow(line);
53
+ i += 2;
54
+ const rows = [];
55
+ while (i < lines.length && /^\s*\|/.test(lines[i])) { rows.push(tableRow(lines[i])); i += 1; }
56
+ out.push(
57
+ '<div class="md-tablewrap"><table class="md-table"><thead><tr>' +
58
+ head.map((h) => `<th>${inline(h)}</th>`).join('') +
59
+ '</tr></thead><tbody>' +
60
+ rows.map((r) => `<tr>${r.map((c) => `<td>${inline(c)}</td>`).join('')}</tr>`).join('') +
61
+ '</tbody></table></div>',
62
+ );
63
+ continue;
64
+ }
65
+
66
+ const h = line.match(/^(#{1,6})\s+(.*)$/);
67
+ if (h) {
68
+ closeList();
69
+ const lvl = Math.min(6, h[1].length + 2); // report h1 is a section, not a page title
70
+ out.push(`<h${lvl} class="md-h">${inline(h[2])}</h${lvl}>`);
71
+ i += 1;
72
+ continue;
73
+ }
74
+
75
+ if (/^\s*([-*_])\1{2,}\s*$/.test(line)) { closeList(); out.push('<hr class="md-hr">'); i += 1; continue; }
76
+
77
+ const quote = line.match(/^\s*>\s?(.*)$/);
78
+ if (quote) {
79
+ closeList();
80
+ const body = [quote[1]];
81
+ i += 1;
82
+ while (i < lines.length && /^\s*>\s?/.test(lines[i])) { body.push(lines[i].replace(/^\s*>\s?/, '')); i += 1; }
83
+ out.push(`<blockquote class="md-quote">${inline(body.join(' '))}</blockquote>`);
84
+ continue;
85
+ }
86
+
87
+ const ul = line.match(/^\s*[-*+]\s+(.*)$/);
88
+ const ol = line.match(/^\s*\d+[.)]\s+(.*)$/);
89
+ if (ul || ol) {
90
+ const want = ul ? 'ul' : 'ol';
91
+ if (list !== want) { closeList(); out.push(`<${want} class="md-list">`); list = want; }
92
+ out.push(`<li>${inline((ul ?? ol)[1])}</li>`);
93
+ i += 1;
94
+ continue;
95
+ }
96
+
97
+ if (!line.trim()) { closeList(); i += 1; continue; }
98
+
99
+ closeList();
100
+ const para = [line];
101
+ i += 1;
102
+ while (i < lines.length && lines[i].trim() && !/^\s*(#{1,6}\s|[-*+]\s|\d+[.)]\s|>|\||```)/.test(lines[i])) {
103
+ para.push(lines[i]); i += 1;
104
+ }
105
+ out.push(`<p class="md-p">${inline(para.join(' '))}</p>`);
106
+ }
107
+
108
+ closeList();
109
+ return out.join('');
110
+ }
@@ -0,0 +1,23 @@
1
+ // 3.0 renamed the panel's saved-layout keys: csk-studio-* → crewforth-studio-*. They are moved once, on the first
2
+ // open after the update: the old value is copied unless the new key already holds one, then the old key is removed.
3
+ // So the user's theme, widths, folds and canvas layout survive the rename. Remove in 4.0.
4
+ const OLD = 'csk-studio-';
5
+ export const PREFIX = 'crewforth-studio-';
6
+
7
+ export function migrateStorage(ls) {
8
+ let moved = 0;
9
+ try {
10
+ const keys = [];
11
+ for (let i = 0; i < ls.length; i++) {
12
+ const k = ls.key(i);
13
+ if (k && k.startsWith(OLD)) keys.push(k);
14
+ }
15
+ for (const k of keys) {
16
+ const nk = PREFIX + k.slice(OLD.length);
17
+ if (ls.getItem(nk) === null) ls.setItem(nk, ls.getItem(k));
18
+ ls.removeItem(k);
19
+ moved += 1;
20
+ }
21
+ } catch { /* blocked storage: nothing to move, nothing lost */ }
22
+ return moved;
23
+ }