@bradygaster/squad-cli 0.8.25 → 0.9.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 (199) hide show
  1. package/README.md +329 -77
  2. package/dist/cli/commands/aspire.d.ts.map +1 -1
  3. package/dist/cli/commands/aspire.js +3 -0
  4. package/dist/cli/commands/aspire.js.map +1 -1
  5. package/dist/cli/commands/build.js +3 -3
  6. package/dist/cli/commands/build.js.map +1 -1
  7. package/dist/cli/commands/cast.d.ts +13 -0
  8. package/dist/cli/commands/cast.d.ts.map +1 -0
  9. package/dist/cli/commands/cast.js +77 -0
  10. package/dist/cli/commands/cast.js.map +1 -0
  11. package/dist/cli/commands/cost.d.ts +2 -0
  12. package/dist/cli/commands/cost.d.ts.map +1 -0
  13. package/dist/cli/commands/cost.js +170 -0
  14. package/dist/cli/commands/cost.js.map +1 -0
  15. package/dist/cli/commands/cross-squad.d.ts +12 -0
  16. package/dist/cli/commands/cross-squad.d.ts.map +1 -0
  17. package/dist/cli/commands/cross-squad.js +80 -0
  18. package/dist/cli/commands/cross-squad.js.map +1 -0
  19. package/dist/cli/commands/doctor.d.ts +5 -0
  20. package/dist/cli/commands/doctor.d.ts.map +1 -1
  21. package/dist/cli/commands/doctor.js +156 -0
  22. package/dist/cli/commands/doctor.js.map +1 -1
  23. package/dist/cli/commands/economy.d.ts +10 -0
  24. package/dist/cli/commands/economy.d.ts.map +1 -0
  25. package/dist/cli/commands/economy.js +64 -0
  26. package/dist/cli/commands/economy.js.map +1 -0
  27. package/dist/cli/commands/export.d.ts.map +1 -1
  28. package/dist/cli/commands/export.js +11 -4
  29. package/dist/cli/commands/export.js.map +1 -1
  30. package/dist/cli/commands/import.js +2 -2
  31. package/dist/cli/commands/import.js.map +1 -1
  32. package/dist/cli/commands/personal.d.ts +16 -0
  33. package/dist/cli/commands/personal.d.ts.map +1 -0
  34. package/dist/cli/commands/personal.js +213 -0
  35. package/dist/cli/commands/personal.js.map +1 -0
  36. package/dist/cli/commands/roles.d.ts +2 -0
  37. package/dist/cli/commands/roles.d.ts.map +1 -0
  38. package/dist/cli/commands/roles.js +54 -0
  39. package/dist/cli/commands/roles.js.map +1 -0
  40. package/dist/cli/commands/schedule.d.ts +14 -0
  41. package/dist/cli/commands/schedule.d.ts.map +1 -0
  42. package/dist/cli/commands/schedule.js +208 -0
  43. package/dist/cli/commands/schedule.js.map +1 -0
  44. package/dist/cli/commands/watch.d.ts.map +1 -1
  45. package/dist/cli/commands/watch.js +17 -5
  46. package/dist/cli/commands/watch.js.map +1 -1
  47. package/dist/cli/core/cast.d.ts +9 -0
  48. package/dist/cli/core/cast.d.ts.map +1 -1
  49. package/dist/cli/core/cast.js +170 -60
  50. package/dist/cli/core/cast.js.map +1 -1
  51. package/dist/cli/core/detect-squad-dir.d.ts +10 -0
  52. package/dist/cli/core/detect-squad-dir.d.ts.map +1 -1
  53. package/dist/cli/core/detect-squad-dir.js +47 -0
  54. package/dist/cli/core/detect-squad-dir.js.map +1 -1
  55. package/dist/cli/core/init.d.ts +8 -0
  56. package/dist/cli/core/init.d.ts.map +1 -1
  57. package/dist/cli/core/init.js +115 -2
  58. package/dist/cli/core/init.js.map +1 -1
  59. package/dist/cli/core/migrations.d.ts.map +1 -1
  60. package/dist/cli/core/migrations.js +21 -0
  61. package/dist/cli/core/migrations.js.map +1 -1
  62. package/dist/cli/core/team-md.js +34 -34
  63. package/dist/cli/core/templates.d.ts.map +1 -1
  64. package/dist/cli/core/templates.js +8 -1
  65. package/dist/cli/core/templates.js.map +1 -1
  66. package/dist/cli/core/upgrade.d.ts +14 -0
  67. package/dist/cli/core/upgrade.d.ts.map +1 -1
  68. package/dist/cli/core/upgrade.js +182 -48
  69. package/dist/cli/core/upgrade.js.map +1 -1
  70. package/dist/cli/core/version.js +2 -2
  71. package/dist/cli/core/version.js.map +1 -1
  72. package/dist/cli/index.d.ts +2 -0
  73. package/dist/cli/index.d.ts.map +1 -1
  74. package/dist/cli/index.js +2 -0
  75. package/dist/cli/index.js.map +1 -1
  76. package/dist/cli/self-update.d.ts +21 -0
  77. package/dist/cli/self-update.d.ts.map +1 -0
  78. package/dist/cli/self-update.js +113 -0
  79. package/dist/cli/self-update.js.map +1 -0
  80. package/dist/cli/shell/autocomplete.d.ts.map +1 -1
  81. package/dist/cli/shell/autocomplete.js +5 -0
  82. package/dist/cli/shell/autocomplete.js.map +1 -1
  83. package/dist/cli/shell/commands.d.ts.map +1 -1
  84. package/dist/cli/shell/commands.js +55 -24
  85. package/dist/cli/shell/commands.js.map +1 -1
  86. package/dist/cli/shell/components/AgentPanel.d.ts.map +1 -1
  87. package/dist/cli/shell/components/AgentPanel.js +21 -6
  88. package/dist/cli/shell/components/AgentPanel.js.map +1 -1
  89. package/dist/cli/shell/components/App.d.ts.map +1 -1
  90. package/dist/cli/shell/components/App.js +33 -15
  91. package/dist/cli/shell/components/App.js.map +1 -1
  92. package/dist/cli/shell/components/InputPrompt.js +1 -1
  93. package/dist/cli/shell/components/InputPrompt.js.map +1 -1
  94. package/dist/cli/shell/components/MessageStream.d.ts +2 -0
  95. package/dist/cli/shell/components/MessageStream.d.ts.map +1 -1
  96. package/dist/cli/shell/components/MessageStream.js +20 -20
  97. package/dist/cli/shell/components/MessageStream.js.map +1 -1
  98. package/dist/cli/shell/components/ThinkingIndicator.d.ts +4 -0
  99. package/dist/cli/shell/components/ThinkingIndicator.d.ts.map +1 -1
  100. package/dist/cli/shell/components/ThinkingIndicator.js +23 -4
  101. package/dist/cli/shell/components/ThinkingIndicator.js.map +1 -1
  102. package/dist/cli/shell/coordinator.d.ts +7 -0
  103. package/dist/cli/shell/coordinator.d.ts.map +1 -1
  104. package/dist/cli/shell/coordinator.js +206 -88
  105. package/dist/cli/shell/coordinator.js.map +1 -1
  106. package/dist/cli/shell/error-messages.d.ts +14 -0
  107. package/dist/cli/shell/error-messages.d.ts.map +1 -1
  108. package/dist/cli/shell/error-messages.js +65 -1
  109. package/dist/cli/shell/error-messages.js.map +1 -1
  110. package/dist/cli/shell/index.d.ts +1 -1
  111. package/dist/cli/shell/index.d.ts.map +1 -1
  112. package/dist/cli/shell/index.js +83 -12
  113. package/dist/cli/shell/index.js.map +1 -1
  114. package/dist/cli/shell/router.d.ts.map +1 -1
  115. package/dist/cli/shell/router.js +21 -2
  116. package/dist/cli/shell/router.js.map +1 -1
  117. package/dist/cli/shell/stream-bridge.d.ts +2 -0
  118. package/dist/cli/shell/stream-bridge.d.ts.map +1 -1
  119. package/dist/cli/shell/stream-bridge.js +11 -2
  120. package/dist/cli/shell/stream-bridge.js.map +1 -1
  121. package/dist/cli/shell/terminal.d.ts +5 -5
  122. package/dist/cli/shell/terminal.d.ts.map +1 -1
  123. package/dist/cli/shell/terminal.js +35 -26
  124. package/dist/cli/shell/terminal.js.map +1 -1
  125. package/dist/cli-entry.js +124 -42
  126. package/dist/cli-entry.js.map +1 -1
  127. package/package.json +20 -4
  128. package/scripts/patch-esm-imports.mjs +106 -77
  129. package/scripts/patch-ink-rendering.mjs +115 -0
  130. package/templates/casting/Futurama.json +10 -0
  131. package/templates/casting-history.json +4 -4
  132. package/templates/casting-policy.json +37 -35
  133. package/templates/casting-reference.md +104 -0
  134. package/templates/casting-registry.json +3 -3
  135. package/templates/ceremonies.md +41 -41
  136. package/templates/charter.md +53 -53
  137. package/templates/constraint-tracking.md +38 -38
  138. package/templates/cooperative-rate-limiting.md +229 -0
  139. package/templates/copilot-instructions.md +46 -46
  140. package/templates/history.md +10 -10
  141. package/templates/identity/now.md +9 -9
  142. package/templates/identity/wisdom.md +15 -15
  143. package/templates/issue-lifecycle.md +412 -0
  144. package/templates/keda-scaler.md +164 -0
  145. package/templates/machine-capabilities.md +75 -0
  146. package/templates/mcp-config.md +90 -90
  147. package/templates/multi-agent-format.md +28 -28
  148. package/templates/orchestration-log.md +27 -27
  149. package/templates/plugin-marketplace.md +49 -49
  150. package/templates/ralph-circuit-breaker.md +313 -0
  151. package/templates/raw-agent-output.md +37 -37
  152. package/templates/roster.md +60 -60
  153. package/templates/routing.md +39 -54
  154. package/templates/run-output.md +50 -50
  155. package/templates/scribe-charter.md +119 -119
  156. package/templates/skill.md +24 -24
  157. package/templates/skills/agent-collaboration/SKILL.md +42 -0
  158. package/templates/skills/agent-conduct/SKILL.md +24 -0
  159. package/templates/skills/architectural-proposals/SKILL.md +151 -0
  160. package/templates/skills/ci-validation-gates/SKILL.md +84 -0
  161. package/templates/skills/cli-wiring/SKILL.md +47 -0
  162. package/templates/skills/client-compatibility/SKILL.md +89 -0
  163. package/templates/skills/cross-squad/SKILL.md +114 -0
  164. package/templates/skills/distributed-mesh/SKILL.md +287 -0
  165. package/templates/skills/distributed-mesh/mesh.json.example +30 -0
  166. package/templates/skills/distributed-mesh/sync-mesh.ps1 +111 -0
  167. package/templates/skills/distributed-mesh/sync-mesh.sh +104 -0
  168. package/templates/skills/docs-standards/SKILL.md +71 -0
  169. package/templates/skills/economy-mode/SKILL.md +114 -0
  170. package/templates/skills/external-comms/SKILL.md +329 -0
  171. package/templates/skills/gh-auth-isolation/SKILL.md +183 -0
  172. package/templates/skills/git-workflow/SKILL.md +204 -0
  173. package/templates/skills/github-multi-account/SKILL.md +95 -0
  174. package/templates/skills/history-hygiene/SKILL.md +36 -0
  175. package/templates/skills/humanizer/SKILL.md +105 -0
  176. package/templates/skills/init-mode/SKILL.md +102 -0
  177. package/templates/skills/model-selection/SKILL.md +117 -0
  178. package/templates/skills/nap/SKILL.md +24 -0
  179. package/templates/skills/personal-squad/SKILL.md +57 -0
  180. package/templates/skills/release-process/SKILL.md +423 -0
  181. package/templates/skills/reskill/SKILL.md +92 -0
  182. package/templates/skills/reviewer-protocol/SKILL.md +79 -0
  183. package/templates/skills/secret-handling/SKILL.md +200 -0
  184. package/templates/skills/session-recovery/SKILL.md +155 -0
  185. package/templates/skills/squad-conventions/SKILL.md +69 -69
  186. package/templates/skills/test-discipline/SKILL.md +37 -0
  187. package/templates/skills/windows-compatibility/SKILL.md +74 -0
  188. package/templates/squad.agent.md +1287 -1146
  189. package/templates/workflows/squad-ci.yml +24 -24
  190. package/templates/workflows/squad-docs.yml +54 -50
  191. package/templates/workflows/squad-heartbeat.yml +3 -4
  192. package/templates/workflows/squad-insider-release.yml +61 -61
  193. package/templates/workflows/squad-issue-assign.yml +161 -161
  194. package/templates/workflows/squad-label-enforce.yml +181 -181
  195. package/templates/workflows/squad-preview.yml +55 -55
  196. package/templates/workflows/squad-promote.yml +120 -120
  197. package/templates/workflows/squad-release.yml +77 -77
  198. package/templates/workflows/squad-triage.yml +260 -260
  199. package/templates/workflows/sync-squad-labels.yml +169 -169
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bradygaster/squad-cli",
3
- "version": "0.8.25",
3
+ "version": "0.9.1",
4
4
  "description": "Squad CLI — Command-line interface for the Squad multi-agent runtime",
5
5
  "type": "module",
6
6
  "bin": {
@@ -72,6 +72,10 @@
72
72
  "types": "./dist/cli/shell/shell-metrics.d.ts",
73
73
  "import": "./dist/cli/shell/shell-metrics.js"
74
74
  },
75
+ "./core/detect-squad-dir": {
76
+ "types": "./dist/cli/core/detect-squad-dir.d.ts",
77
+ "import": "./dist/cli/core/detect-squad-dir.js"
78
+ },
75
79
  "./core/init": {
76
80
  "types": "./dist/cli/core/init.d.ts",
77
81
  "import": "./dist/cli/core/init.js"
@@ -136,9 +140,21 @@
136
140
  "types": "./dist/cli/commands/copilot.d.ts",
137
141
  "import": "./dist/cli/commands/copilot.js"
138
142
  },
143
+ "./commands/cost": {
144
+ "types": "./dist/cli/commands/cost.d.ts",
145
+ "import": "./dist/cli/commands/cost.js"
146
+ },
139
147
  "./commands/copilot-bridge": {
140
148
  "types": "./dist/cli/commands/copilot-bridge.d.ts",
141
149
  "import": "./dist/cli/commands/copilot-bridge.js"
150
+ },
151
+ "./commands/personal": {
152
+ "types": "./dist/cli/commands/personal.d.ts",
153
+ "import": "./dist/cli/commands/personal.js"
154
+ },
155
+ "./commands/cast": {
156
+ "types": "./dist/cli/commands/cast.d.ts",
157
+ "import": "./dist/cli/commands/cast.js"
142
158
  }
143
159
  },
144
160
  "files": [
@@ -148,16 +164,16 @@
148
164
  "README.md"
149
165
  ],
150
166
  "scripts": {
151
- "postinstall": "node scripts/patch-esm-imports.mjs",
167
+ "postinstall": "node scripts/patch-esm-imports.mjs && node scripts/patch-ink-rendering.mjs",
152
168
  "prepublishOnly": "npm run build",
153
169
  "build": "tsc -p tsconfig.json && npm run postbuild",
154
170
  "postbuild": "node -e \"require('fs').cpSync('src/remote-ui', 'dist/remote-ui', {recursive: true})\""
155
171
  },
156
172
  "engines": {
157
- "node": ">=20"
173
+ "node": ">=22.5.0"
158
174
  },
159
175
  "dependencies": {
160
- "@bradygaster/squad-sdk": "0.8.25",
176
+ "@bradygaster/squad-sdk": ">=0.9.0",
161
177
  "ink": "^6.8.0",
162
178
  "react": "^19.2.4",
163
179
  "vscode-jsonrpc": "^8.2.1"
@@ -1,77 +1,106 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * ESM Import Patcher for @github/copilot-sdk
5
- *
6
- * Patches broken ESM imports in @github/copilot-sdk for Node 24+ compatibility.
7
- *
8
- * Root cause: @github/copilot-sdk@0.1.32 has inconsistent ESM imports:
9
- * - session.js imports "vscode-jsonrpc/node" (BROKEN - missing .js extension)
10
- * - client.js imports "vscode-jsonrpc/node.js" (correct)
11
- *
12
- * Node 24+ enforces strict ESM resolution requiring .js extensions.
13
- * This is a temporary workaround until copilot-sdk fixes upstream.
14
- *
15
- * Issue: bradygaster/squad#XXX
16
- */
17
-
18
- import { readFileSync, writeFileSync, existsSync } from 'fs';
19
- import { join, dirname } from 'path';
20
- import { fileURLToPath } from 'url';
21
-
22
- const __dirname = dirname(fileURLToPath(import.meta.url));
23
-
24
- /**
25
- * Patch session.js in @github/copilot-sdk
26
- */
27
- function patchCopilotSdk() {
28
- // Try multiple possible locations (npm workspaces can hoist dependencies)
29
- const possiblePaths = [
30
- // squad-cli package node_modules
31
- join(__dirname, '..', 'node_modules', '@github', 'copilot-sdk', 'dist', 'session.js'),
32
- // Workspace root node_modules (common with npm workspaces)
33
- join(__dirname, '..', '..', '..', 'node_modules', '@github', 'copilot-sdk', 'dist', 'session.js'),
34
- // Global install location (node_modules at parent of package)
35
- join(__dirname, '..', '..', '@github', 'copilot-sdk', 'dist', 'session.js'),
36
- ];
37
-
38
- let sessionJsPath = null;
39
- for (const path of possiblePaths) {
40
- if (existsSync(path)) {
41
- sessionJsPath = path;
42
- break;
43
- }
44
- }
45
-
46
- if (!sessionJsPath) {
47
- // copilot-sdk not installed (maybe optionalDependency or CI without install)
48
- // This is fine - exit silently
49
- return false;
50
- }
51
-
52
- try {
53
- let content = readFileSync(sessionJsPath, 'utf8');
54
-
55
- // Replace extensionless import with .js extension
56
- const patched = content.replace(
57
- /from\s+["']vscode-jsonrpc\/node["']/g,
58
- 'from "vscode-jsonrpc/node.js"'
59
- );
60
-
61
- if (patched !== content) {
62
- writeFileSync(sessionJsPath, patched, 'utf8');
63
- console.log('✅ Patched @github/copilot-sdk ESM imports for Node 24+ compatibility');
64
- return true;
65
- } else {
66
- // Already patched or upstream fixed
67
- return false;
68
- }
69
- } catch (err) {
70
- console.warn('⚠️ Failed to patch @github/copilot-sdk ESM imports:', err.message);
71
- console.warn(' This may cause issues on Node 24+ if copilot-sdk loads.');
72
- return false;
73
- }
74
- }
75
-
76
- // Run patch
77
- patchCopilotSdk();
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * ESM Import Patcher — dual-layer fix for Node 22/24+ compatibility
5
+ *
6
+ * Layer 1: Patch vscode-jsonrpc/package.json with `exports` field
7
+ * vscode-jsonrpc@8.2.1 has no `exports` field. Node 22+ strict ESM
8
+ * rejects subpath imports like 'vscode-jsonrpc/node' without it.
9
+ * Injecting the exports map from v9.x fixes ALL subpath imports at once.
10
+ *
11
+ * Layer 2: Patch @github/copilot-sdk session.js (defense-in-depth)
12
+ * copilot-sdk@0.1.32 imports 'vscode-jsonrpc/node' without .js extension.
13
+ * This layer ensures the import works even if Layer 1 somehow fails.
14
+ *
15
+ * Issue: bradygaster/squad#449
16
+ * Upstream: https://github.com/github/copilot-sdk/issues/707
17
+ */
18
+
19
+ import { readFileSync, writeFileSync, existsSync } from 'fs';
20
+ import { join, dirname } from 'path';
21
+ import { fileURLToPath } from 'url';
22
+
23
+ const __dirname = dirname(fileURLToPath(import.meta.url));
24
+
25
+ // Locations where npm workspaces / global install may place dependencies
26
+ const SEARCH_ROOTS = [
27
+ join(__dirname, '..', 'node_modules'), // squad-cli local
28
+ join(__dirname, '..', '..', '..', 'node_modules'), // workspace root
29
+ join(__dirname, '..', '..'), // global install (sibling)
30
+ ];
31
+
32
+ /**
33
+ * Layer 1 Inject `exports` field into vscode-jsonrpc/package.json.
34
+ * This is the canonical fix: once the package has proper exports, Node's
35
+ * ESM resolver handles every subpath ('vscode-jsonrpc/node', '/browser', etc.)
36
+ * without needing per-file patches.
37
+ */
38
+ function patchVscodeJsonrpcExports() {
39
+ const exportsField = {
40
+ '.': { types: './lib/common/api.d.ts', default: './lib/node/main.js' },
41
+ './node': { node: './lib/node/main.js', types: './lib/node/main.d.ts' },
42
+ './node.js': { node: './lib/node/main.js', types: './lib/node/main.d.ts' },
43
+ './browser': { types: './lib/browser/main.d.ts', browser: './lib/browser/main.js' },
44
+ };
45
+
46
+ for (const root of SEARCH_ROOTS) {
47
+ const pkgPath = join(root, 'vscode-jsonrpc', 'package.json');
48
+ if (!existsSync(pkgPath)) continue;
49
+
50
+ try {
51
+ const raw = readFileSync(pkgPath, 'utf8');
52
+ const pkg = JSON.parse(raw);
53
+
54
+ if (pkg.exports && pkg.exports['./node.js']) {
55
+ console.log('⏭️ vscode-jsonrpc already has complete exports field — skipping');
56
+ return false;
57
+ }
58
+
59
+ pkg.exports = exportsField;
60
+ writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n', 'utf8');
61
+ console.log('✅ Patched vscode-jsonrpc/package.json with exports field (Node 22/24+ ESM fix)');
62
+ return true;
63
+ } catch (err) {
64
+ console.warn('⚠️ Failed to patch vscode-jsonrpc exports:', err.message);
65
+ return false;
66
+ }
67
+ }
68
+
69
+ return false;
70
+ }
71
+
72
+ /**
73
+ * Layer 2 — Patch copilot-sdk session.js import (defense-in-depth).
74
+ * Rewrites extensionless 'vscode-jsonrpc/node' to 'vscode-jsonrpc/node.js'.
75
+ */
76
+ function patchCopilotSdkSessionJs() {
77
+ for (const root of SEARCH_ROOTS) {
78
+ const sessionJsPath = join(root, '@github', 'copilot-sdk', 'dist', 'session.js');
79
+ if (!existsSync(sessionJsPath)) continue;
80
+
81
+ try {
82
+ const content = readFileSync(sessionJsPath, 'utf8');
83
+
84
+ const patched = content.replace(
85
+ /from\s+["']vscode-jsonrpc\/node["']/g,
86
+ 'from "vscode-jsonrpc/node.js"'
87
+ );
88
+
89
+ if (patched !== content) {
90
+ writeFileSync(sessionJsPath, patched, 'utf8');
91
+ console.log('✅ Patched @github/copilot-sdk session.js ESM imports');
92
+ return true;
93
+ }
94
+ return false;
95
+ } catch (err) {
96
+ console.warn('⚠️ Failed to patch copilot-sdk session.js:', err.message);
97
+ return false;
98
+ }
99
+ }
100
+
101
+ return false;
102
+ }
103
+
104
+ // Run both layers
105
+ patchVscodeJsonrpcExports();
106
+ patchCopilotSdkSessionJs();
@@ -0,0 +1,115 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Ink Rendering Patcher for Squad CLI
5
+ *
6
+ * Patches ink/build/ink.js to fix scroll flicker on Windows Terminal.
7
+ * Three patches are applied:
8
+ *
9
+ * 1. Remove trailing newline — the extra '\n' appended to output causes
10
+ * logUpdate's previousLineCount to be off by one, pushing the bottom of
11
+ * the UI below the viewport.
12
+ *
13
+ * 2. Disable clearTerminal fullscreen path — when output fills the terminal,
14
+ * Ink clears the entire screen, causing violent scroll-to-top flicker.
15
+ * We force the condition to `false` so logUpdate's incremental
16
+ * erase-and-rewrite is always used instead.
17
+ *
18
+ * 3. Verify incrementalRendering passthrough — confirms that Ink forwards
19
+ * the incrementalRendering option to logUpdate.create(). No code change
20
+ * needed if already wired up.
21
+ *
22
+ * All patches are idempotent (safe to run multiple times).
23
+ */
24
+
25
+ import { readFileSync, writeFileSync, existsSync } from 'fs';
26
+ import { join, dirname } from 'path';
27
+ import { fileURLToPath } from 'url';
28
+
29
+ const __dirname = dirname(fileURLToPath(import.meta.url));
30
+
31
+ function patchInkRendering() {
32
+ // Try multiple possible locations (npm workspaces can hoist dependencies)
33
+ const possiblePaths = [
34
+ // squad-cli package node_modules
35
+ join(__dirname, '..', 'node_modules', 'ink', 'build', 'ink.js'),
36
+ // Workspace root node_modules (common with npm workspaces)
37
+ join(__dirname, '..', '..', '..', 'node_modules', 'ink', 'build', 'ink.js'),
38
+ // Global install location (node_modules at parent of package)
39
+ join(__dirname, '..', '..', 'ink', 'build', 'ink.js'),
40
+ ];
41
+
42
+ const inkJsPath = possiblePaths.find(p => existsSync(p)) ?? null;
43
+
44
+ if (!inkJsPath) {
45
+ // ink not installed yet — exit silently
46
+ return false;
47
+ }
48
+
49
+ try {
50
+ let content = readFileSync(inkJsPath, 'utf8');
51
+ let patchCount = 0;
52
+
53
+ // --- Patch 1: Remove trailing newline ---
54
+ // Original: const outputToRender = output + '\n';
55
+ // Patched: const outputToRender = output;
56
+ const trailingNewlineSearch = "const outputToRender = output + '\\n';";
57
+ const trailingNewlineReplace = 'const outputToRender = output;';
58
+ if (content.includes(trailingNewlineSearch)) {
59
+ content = content.replace(trailingNewlineSearch, trailingNewlineReplace);
60
+ console.log(' ✅ Patch 1/3: Removed trailing newline from outputToRender');
61
+ patchCount++;
62
+ } else if (content.includes(trailingNewlineReplace)) {
63
+ console.log(' ⏭️ Patch 1/3: Trailing newline already removed');
64
+ } else {
65
+ console.warn(' ⚠️ Patch 1/3: Could not find outputToRender pattern — Ink version may have changed');
66
+ }
67
+
68
+ // --- Patch 2: Disable clearTerminal fullscreen path ---
69
+ // Original: if (isFullscreen) {
70
+ // const sync = shouldSynchronize(this.options.stdout);
71
+ // ...
72
+ // this.options.stdout.write(ansiEscapes.clearTerminal + ...
73
+ // Patched: if (false) {
74
+ //
75
+ // We match `if (isFullscreen) {` only when followed by the clearTerminal
76
+ // usage to avoid replacing unrelated isFullscreen references.
77
+ const fullscreenSearch = /if \(isFullscreen\) \{\s*\n\s*const sync = shouldSynchronize/;
78
+ const fullscreenAlreadyPatched = /if \(false\) \{\s*\n\s*const sync = shouldSynchronize/;
79
+ if (fullscreenSearch.test(content)) {
80
+ content = content.replace(
81
+ /if \(isFullscreen\) (\{\s*\n\s*const sync = shouldSynchronize)/,
82
+ 'if (false) $1'
83
+ );
84
+ console.log(' ✅ Patch 2/3: Disabled clearTerminal fullscreen path');
85
+ patchCount++;
86
+ } else if (fullscreenAlreadyPatched.test(content)) {
87
+ console.log(' ⏭️ Patch 2/3: clearTerminal path already disabled');
88
+ } else {
89
+ console.warn(' ⚠️ Patch 2/3: Could not find isFullscreen pattern — Ink version may have changed');
90
+ }
91
+
92
+ // --- Patch 3: Verify incrementalRendering passthrough ---
93
+ const incrementalPattern = 'incremental: options.incrementalRendering';
94
+ if (content.includes(incrementalPattern)) {
95
+ console.log(' ✅ Patch 3/3: incrementalRendering passthrough verified (no change needed)');
96
+ } else {
97
+ console.warn(' ⚠️ Patch 3/3: incrementalRendering passthrough not found — Ink version may have changed');
98
+ }
99
+
100
+ if (patchCount > 0) {
101
+ writeFileSync(inkJsPath, content, 'utf8');
102
+ console.log(`✅ Patched ink.js with ${patchCount} rendering fix(es) for scroll flicker`);
103
+ return true;
104
+ }
105
+
106
+ return false;
107
+ } catch (err) {
108
+ console.warn('⚠️ Failed to patch ink.js rendering:', err.message);
109
+ console.warn(' Scroll flicker may occur on Windows Terminal.');
110
+ return false;
111
+ }
112
+ }
113
+
114
+ // Run patch
115
+ patchInkRendering();
@@ -0,0 +1,10 @@
1
+ [
2
+ "Fry",
3
+ "Leela",
4
+ "Bender",
5
+ "Farnsworth",
6
+ "Zoidberg",
7
+ "Amy",
8
+ "Zapp",
9
+ "Kif"
10
+ ]
@@ -1,4 +1,4 @@
1
- {
2
- "universe_usage_history": [],
3
- "assignment_cast_snapshots": {}
4
- }
1
+ {
2
+ "universe_usage_history": [],
3
+ "assignment_cast_snapshots": {}
4
+ }
@@ -1,35 +1,37 @@
1
- {
2
- "casting_policy_version": "1.1",
3
- "allowlist_universes": [
4
- "The Usual Suspects",
5
- "Reservoir Dogs",
6
- "Alien",
7
- "Ocean's Eleven",
8
- "Arrested Development",
9
- "Star Wars",
10
- "The Matrix",
11
- "Firefly",
12
- "The Goonies",
13
- "The Simpsons",
14
- "Breaking Bad",
15
- "Lost",
16
- "Marvel Cinematic Universe",
17
- "DC Universe"
18
- ],
19
- "universe_capacity": {
20
- "The Usual Suspects": 6,
21
- "Reservoir Dogs": 8,
22
- "Alien": 8,
23
- "Ocean's Eleven": 14,
24
- "Arrested Development": 15,
25
- "Star Wars": 12,
26
- "The Matrix": 10,
27
- "Firefly": 10,
28
- "The Goonies": 8,
29
- "The Simpsons": 20,
30
- "Breaking Bad": 12,
31
- "Lost": 18,
32
- "Marvel Cinematic Universe": 25,
33
- "DC Universe": 18
34
- }
35
- }
1
+ {
2
+ "casting_policy_version": "1.1",
3
+ "allowlist_universes": [
4
+ "The Usual Suspects",
5
+ "Reservoir Dogs",
6
+ "Alien",
7
+ "Ocean's Eleven",
8
+ "Arrested Development",
9
+ "Star Wars",
10
+ "The Matrix",
11
+ "Firefly",
12
+ "The Goonies",
13
+ "The Simpsons",
14
+ "Breaking Bad",
15
+ "Lost",
16
+ "Marvel Cinematic Universe",
17
+ "DC Universe",
18
+ "Futurama"
19
+ ],
20
+ "universe_capacity": {
21
+ "The Usual Suspects": 6,
22
+ "Reservoir Dogs": 8,
23
+ "Alien": 8,
24
+ "Ocean's Eleven": 14,
25
+ "Arrested Development": 15,
26
+ "Star Wars": 12,
27
+ "The Matrix": 10,
28
+ "Firefly": 10,
29
+ "The Goonies": 8,
30
+ "The Simpsons": 20,
31
+ "Breaking Bad": 12,
32
+ "Lost": 18,
33
+ "Marvel Cinematic Universe": 25,
34
+ "DC Universe": 18,
35
+ "Futurama": 12
36
+ }
37
+ }
@@ -0,0 +1,104 @@
1
+ # Casting Reference
2
+
3
+ On-demand reference for Squad's casting system. Loaded during Init Mode or when adding team members.
4
+
5
+ ## Universe Table
6
+
7
+ | Universe | Capacity | Shape Tags | Resonance Signals |
8
+ |---|---|---|---|
9
+ | The Usual Suspects | 6 | small, noir, ensemble | crime, heist, mystery, deception |
10
+ | Reservoir Dogs | 8 | small, noir, ensemble | crime, heist, tension, loyalty |
11
+ | Alien | 8 | small, sci-fi, survival | space, isolation, threat, engineering |
12
+ | Ocean's Eleven | 14 | medium, heist, ensemble | planning, coordination, roles, charm |
13
+ | Arrested Development | 15 | medium, comedy, ensemble | dysfunction, business, family, satire |
14
+ | Star Wars | 12 | medium, sci-fi, epic | conflict, mentorship, legacy, rebellion |
15
+ | The Matrix | 10 | medium, sci-fi, cyberpunk | systems, reality, hacking, philosophy |
16
+ | Firefly | 10 | medium, sci-fi, western | frontier, crew, independence, smuggling |
17
+ | The Goonies | 8 | small, adventure, ensemble | exploration, treasure, kids, teamwork |
18
+ | The Simpsons | 20 | large, comedy, ensemble | satire, community, family, absurdity |
19
+ | Breaking Bad | 12 | medium, drama, tension | chemistry, transformation, consequence, power |
20
+ | Lost | 18 | large, mystery, ensemble | survival, mystery, groups, leadership |
21
+ | Marvel Cinematic Universe | 25 | large, action, ensemble | heroism, teamwork, powers, scale |
22
+ | DC Universe | 18 | large, action, ensemble | justice, duality, powers, mythology |
23
+ | Futurama | 12 | medium, sci-fi, comedy | future, robots, space, absurdity |
24
+
25
+ **Total: 15 universes** — capacity range 6–25.
26
+
27
+ ## Selection Algorithm
28
+
29
+ Universe selection is deterministic. Score each universe and pick the highest:
30
+
31
+ ```
32
+ score = size_fit + shape_fit + resonance_fit + LRU
33
+ ```
34
+
35
+ | Factor | Description |
36
+ |---|---|
37
+ | `size_fit` | How well the universe capacity matches the team size. Prefer universes where capacity ≥ agent_count with minimal waste. |
38
+ | `shape_fit` | Match universe shape tags against the assignment shape derived from the project description. |
39
+ | `resonance_fit` | Match universe resonance signals against session and repo context signals. |
40
+ | `LRU` | Least-recently-used bonus — prefer universes not used in recent assignments (from `history.json`). |
41
+
42
+ Same inputs → same choice (unless LRU changes between assignments).
43
+
44
+ ## Casting State File Schemas
45
+
46
+ ### policy.json
47
+
48
+ Source template: `.squad/templates/casting-policy.json`
49
+ Runtime location: `.squad/casting/policy.json`
50
+
51
+ ```json
52
+ {
53
+ "casting_policy_version": "1.1",
54
+ "allowlist_universes": ["Universe Name", "..."],
55
+ "universe_capacity": {
56
+ "Universe Name": 10
57
+ }
58
+ }
59
+ ```
60
+
61
+ ### registry.json
62
+
63
+ Source template: `.squad/templates/casting-registry.json`
64
+ Runtime location: `.squad/casting/registry.json`
65
+
66
+ ```json
67
+ {
68
+ "agents": {
69
+ "agent-role-id": {
70
+ "persistent_name": "CharacterName",
71
+ "universe": "Universe Name",
72
+ "created_at": "ISO-8601",
73
+ "legacy_named": false,
74
+ "status": "active"
75
+ }
76
+ }
77
+ }
78
+ ```
79
+
80
+ ### history.json
81
+
82
+ Source template: `.squad/templates/casting-history.json`
83
+ Runtime location: `.squad/casting/history.json`
84
+
85
+ ```json
86
+ {
87
+ "universe_usage_history": [
88
+ {
89
+ "universe": "Universe Name",
90
+ "assignment_id": "unique-id",
91
+ "used_at": "ISO-8601"
92
+ }
93
+ ],
94
+ "assignment_cast_snapshots": {
95
+ "assignment-id": {
96
+ "universe": "Universe Name",
97
+ "agents": {
98
+ "role-id": "CharacterName"
99
+ },
100
+ "created_at": "ISO-8601"
101
+ }
102
+ }
103
+ }
104
+ ```
@@ -1,3 +1,3 @@
1
- {
2
- "agents": {}
3
- }
1
+ {
2
+ "agents": {}
3
+ }
@@ -1,41 +1,41 @@
1
- # Ceremonies
2
-
3
- > Team meetings that happen before or after work. Each squad configures their own.
4
-
5
- ## Design Review
6
-
7
- | Field | Value |
8
- |-------|-------|
9
- | **Trigger** | auto |
10
- | **When** | before |
11
- | **Condition** | multi-agent task involving 2+ agents modifying shared systems |
12
- | **Facilitator** | lead |
13
- | **Participants** | all-relevant |
14
- | **Time budget** | focused |
15
- | **Enabled** | ✅ yes |
16
-
17
- **Agenda:**
18
- 1. Review the task and requirements
19
- 2. Agree on interfaces and contracts between components
20
- 3. Identify risks and edge cases
21
- 4. Assign action items
22
-
23
- ---
24
-
25
- ## Retrospective
26
-
27
- | Field | Value |
28
- |-------|-------|
29
- | **Trigger** | auto |
30
- | **When** | after |
31
- | **Condition** | build failure, test failure, or reviewer rejection |
32
- | **Facilitator** | lead |
33
- | **Participants** | all-involved |
34
- | **Time budget** | focused |
35
- | **Enabled** | ✅ yes |
36
-
37
- **Agenda:**
38
- 1. What happened? (facts only)
39
- 2. Root cause analysis
40
- 3. What should change?
41
- 4. Action items for next iteration
1
+ # Ceremonies
2
+
3
+ > Team meetings that happen before or after work. Each squad configures their own.
4
+
5
+ ## Design Review
6
+
7
+ | Field | Value |
8
+ |-------|-------|
9
+ | **Trigger** | auto |
10
+ | **When** | before |
11
+ | **Condition** | multi-agent task involving 2+ agents modifying shared systems |
12
+ | **Facilitator** | lead |
13
+ | **Participants** | all-relevant |
14
+ | **Time budget** | focused |
15
+ | **Enabled** | ✅ yes |
16
+
17
+ **Agenda:**
18
+ 1. Review the task and requirements
19
+ 2. Agree on interfaces and contracts between components
20
+ 3. Identify risks and edge cases
21
+ 4. Assign action items
22
+
23
+ ---
24
+
25
+ ## Retrospective
26
+
27
+ | Field | Value |
28
+ |-------|-------|
29
+ | **Trigger** | auto |
30
+ | **When** | after |
31
+ | **Condition** | build failure, test failure, or reviewer rejection |
32
+ | **Facilitator** | lead |
33
+ | **Participants** | all-involved |
34
+ | **Time budget** | focused |
35
+ | **Enabled** | ✅ yes |
36
+
37
+ **Agenda:**
38
+ 1. What happened? (facts only)
39
+ 2. Root cause analysis
40
+ 3. What should change?
41
+ 4. Action items for next iteration