claws-code 0.8.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.
Files changed (180) hide show
  1. package/.claude/commands/claws-auto.md +90 -0
  2. package/.claude/commands/claws-bin.md +28 -0
  3. package/.claude/commands/claws-cleanup.md +28 -0
  4. package/.claude/commands/claws-do.md +82 -0
  5. package/.claude/commands/claws-fix.md +40 -0
  6. package/.claude/commands/claws-goal.md +111 -0
  7. package/.claude/commands/claws-help.md +54 -0
  8. package/.claude/commands/claws-plan.md +103 -0
  9. package/.claude/commands/claws-report.md +29 -0
  10. package/.claude/commands/claws-status.md +37 -0
  11. package/.claude/commands/claws-update.md +32 -0
  12. package/.claude/commands/claws.md +64 -0
  13. package/.claude/rules/claws-default-behavior.md +76 -0
  14. package/.claude/settings.json +112 -0
  15. package/.claude/settings.local.json +19 -0
  16. package/.claude/skills/claws-auto-engine/SKILL.md +97 -0
  17. package/.claude/skills/claws-goal-tracker/SKILL.md +106 -0
  18. package/.claude/skills/claws-prompt-templates/SKILL.md +203 -0
  19. package/.claude/skills/claws-wave-lead/SKILL.md +126 -0
  20. package/.claude/skills/claws-wave-subworker/SKILL.md +60 -0
  21. package/CHANGELOG.md +1949 -0
  22. package/LICENSE +21 -0
  23. package/README.md +420 -0
  24. package/bin/cli.js +84 -0
  25. package/cli.js +223 -0
  26. package/docs/ARCHITECTURE.md +511 -0
  27. package/docs/event-protocol.md +588 -0
  28. package/docs/features.md +562 -0
  29. package/docs/guide.md +891 -0
  30. package/docs/index.html +716 -0
  31. package/docs/protocol.md +323 -0
  32. package/extension/.vscodeignore +15 -0
  33. package/extension/CHANGELOG.md +1906 -0
  34. package/extension/LICENSE +21 -0
  35. package/extension/README.md +137 -0
  36. package/extension/docs/features.md +424 -0
  37. package/extension/docs/protocol.md +197 -0
  38. package/extension/esbuild.mjs +25 -0
  39. package/extension/icon.png +0 -0
  40. package/extension/native/.metadata.json +10 -0
  41. package/extension/native/node-pty/LICENSE +69 -0
  42. package/extension/native/node-pty/README.md +165 -0
  43. package/extension/native/node-pty/lib/conpty_console_list_agent.js +16 -0
  44. package/extension/native/node-pty/lib/conpty_console_list_agent.js.map +1 -0
  45. package/extension/native/node-pty/lib/eventEmitter2.js +47 -0
  46. package/extension/native/node-pty/lib/eventEmitter2.js.map +1 -0
  47. package/extension/native/node-pty/lib/index.js +52 -0
  48. package/extension/native/node-pty/lib/index.js.map +1 -0
  49. package/extension/native/node-pty/lib/interfaces.js +7 -0
  50. package/extension/native/node-pty/lib/interfaces.js.map +1 -0
  51. package/extension/native/node-pty/lib/shared/conout.js +11 -0
  52. package/extension/native/node-pty/lib/shared/conout.js.map +1 -0
  53. package/extension/native/node-pty/lib/terminal.js +190 -0
  54. package/extension/native/node-pty/lib/terminal.js.map +1 -0
  55. package/extension/native/node-pty/lib/types.js +7 -0
  56. package/extension/native/node-pty/lib/types.js.map +1 -0
  57. package/extension/native/node-pty/lib/unixTerminal.js +346 -0
  58. package/extension/native/node-pty/lib/unixTerminal.js.map +1 -0
  59. package/extension/native/node-pty/lib/utils.js +39 -0
  60. package/extension/native/node-pty/lib/utils.js.map +1 -0
  61. package/extension/native/node-pty/lib/windowsConoutConnection.js +125 -0
  62. package/extension/native/node-pty/lib/windowsConoutConnection.js.map +1 -0
  63. package/extension/native/node-pty/lib/windowsPtyAgent.js +320 -0
  64. package/extension/native/node-pty/lib/windowsPtyAgent.js.map +1 -0
  65. package/extension/native/node-pty/lib/windowsTerminal.js +199 -0
  66. package/extension/native/node-pty/lib/windowsTerminal.js.map +1 -0
  67. package/extension/native/node-pty/lib/worker/conoutSocketWorker.js +22 -0
  68. package/extension/native/node-pty/lib/worker/conoutSocketWorker.js.map +1 -0
  69. package/extension/native/node-pty/package.json +64 -0
  70. package/extension/native/node-pty/prebuilds/darwin-arm64/pty.node +0 -0
  71. package/extension/native/node-pty/prebuilds/darwin-arm64/spawn-helper +0 -0
  72. package/extension/native/node-pty/prebuilds/darwin-x64/pty.node +0 -0
  73. package/extension/native/node-pty/prebuilds/darwin-x64/spawn-helper +0 -0
  74. package/extension/native/node-pty/prebuilds/win32-arm64/conpty/OpenConsole.exe +0 -0
  75. package/extension/native/node-pty/prebuilds/win32-arm64/conpty/conpty.dll +0 -0
  76. package/extension/native/node-pty/prebuilds/win32-arm64/conpty.node +0 -0
  77. package/extension/native/node-pty/prebuilds/win32-arm64/conpty_console_list.node +0 -0
  78. package/extension/native/node-pty/prebuilds/win32-arm64/pty.node +0 -0
  79. package/extension/native/node-pty/prebuilds/win32-arm64/winpty-agent.exe +0 -0
  80. package/extension/native/node-pty/prebuilds/win32-arm64/winpty.dll +0 -0
  81. package/extension/native/node-pty/prebuilds/win32-x64/conpty/OpenConsole.exe +0 -0
  82. package/extension/native/node-pty/prebuilds/win32-x64/conpty/conpty.dll +0 -0
  83. package/extension/native/node-pty/prebuilds/win32-x64/conpty.node +0 -0
  84. package/extension/native/node-pty/prebuilds/win32-x64/conpty_console_list.node +0 -0
  85. package/extension/native/node-pty/prebuilds/win32-x64/pty.node +0 -0
  86. package/extension/native/node-pty/prebuilds/win32-x64/winpty-agent.exe +0 -0
  87. package/extension/native/node-pty/prebuilds/win32-x64/winpty.dll +0 -0
  88. package/extension/package-lock.json +605 -0
  89. package/extension/package.json +343 -0
  90. package/extension/scripts/bundle-native.mjs +104 -0
  91. package/extension/scripts/deploy-dev.mjs +60 -0
  92. package/extension/src/ansi-strip.ts +52 -0
  93. package/extension/src/backends/vscode/claws-pty.ts +483 -0
  94. package/extension/src/backends/vscode/status-bar.ts +99 -0
  95. package/extension/src/backends/vscode/vscode-backend.ts +282 -0
  96. package/extension/src/capture-store.ts +125 -0
  97. package/extension/src/event-log.ts +629 -0
  98. package/extension/src/event-schemas.ts +478 -0
  99. package/extension/src/extension.js +492 -0
  100. package/extension/src/extension.ts +873 -0
  101. package/extension/src/lifecycle-engine.ts +60 -0
  102. package/extension/src/lifecycle-rules.ts +171 -0
  103. package/extension/src/lifecycle-store.ts +506 -0
  104. package/extension/src/peer-registry.ts +176 -0
  105. package/extension/src/pipeline-registry.ts +82 -0
  106. package/extension/src/platform.ts +64 -0
  107. package/extension/src/protocol.ts +532 -0
  108. package/extension/src/server-config.ts +98 -0
  109. package/extension/src/server.ts +2210 -0
  110. package/extension/src/task-registry.ts +51 -0
  111. package/extension/src/terminal-backend.ts +211 -0
  112. package/extension/src/terminal-manager.ts +395 -0
  113. package/extension/src/topic-registry.ts +70 -0
  114. package/extension/src/topic-utils.ts +46 -0
  115. package/extension/src/transport.ts +45 -0
  116. package/extension/src/uninstall-cleanup.ts +232 -0
  117. package/extension/src/wave-registry.ts +314 -0
  118. package/extension/src/websocket-transport.ts +153 -0
  119. package/extension/tsconfig.json +23 -0
  120. package/lib/capabilities.js +145 -0
  121. package/lib/dry-run.js +43 -0
  122. package/lib/install.js +1018 -0
  123. package/lib/mcp-setup.js +92 -0
  124. package/lib/platform.js +240 -0
  125. package/lib/preflight.js +152 -0
  126. package/lib/shell-hook.js +343 -0
  127. package/lib/uninstall.js +162 -0
  128. package/lib/verify.js +166 -0
  129. package/mcp_server.js +3529 -0
  130. package/package.json +48 -0
  131. package/rules/claws-default-behavior.md +72 -0
  132. package/scripts/_helpers/atomic-file.mjs +137 -0
  133. package/scripts/_helpers/fix-repair.js +64 -0
  134. package/scripts/_helpers/json-safe.mjs +218 -0
  135. package/scripts/bump-version.sh +84 -0
  136. package/scripts/codegen/gen-docs.mjs +61 -0
  137. package/scripts/codegen/gen-json-schema.mjs +62 -0
  138. package/scripts/codegen/gen-mcp-tools.mjs +358 -0
  139. package/scripts/codegen/gen-types.mjs +172 -0
  140. package/scripts/codegen/index.mjs +42 -0
  141. package/scripts/dev-hooks/check-extension-dirs.js +77 -0
  142. package/scripts/dev-hooks/check-open-claws-terminals.js +70 -0
  143. package/scripts/dev-hooks/check-stale-main.js +55 -0
  144. package/scripts/dev-hooks/check-tag-pushed.js +51 -0
  145. package/scripts/dev-hooks/check-tag-vs-main.js +56 -0
  146. package/scripts/dev-vsix-install.sh +60 -0
  147. package/scripts/fix.sh +702 -0
  148. package/scripts/gen-client-types.mjs +81 -0
  149. package/scripts/git-hooks/pre-commit +31 -0
  150. package/scripts/hooks/lifecycle-state.js +61 -0
  151. package/scripts/hooks/package.json +4 -0
  152. package/scripts/hooks/post-tool-use-claws.js +292 -0
  153. package/scripts/hooks/pre-bash-no-verify-block.js +72 -0
  154. package/scripts/hooks/pre-tool-use-claws.js +206 -0
  155. package/scripts/hooks/session-start-claws.js +97 -0
  156. package/scripts/hooks/stop-claws.js +88 -0
  157. package/scripts/inject-claude-md.js +205 -0
  158. package/scripts/inject-dev-hooks.js +96 -0
  159. package/scripts/inject-global-claude-md.js +140 -0
  160. package/scripts/inject-settings-hooks.js +370 -0
  161. package/scripts/install.ps1 +146 -0
  162. package/scripts/install.sh +1729 -0
  163. package/scripts/monitor-arm-watch.js +155 -0
  164. package/scripts/rebuild-node-pty.sh +245 -0
  165. package/scripts/report.sh +232 -0
  166. package/scripts/shell-hook.fish +164 -0
  167. package/scripts/shell-hook.ps1 +33 -0
  168. package/scripts/shell-hook.sh +232 -0
  169. package/scripts/stream-events.js +399 -0
  170. package/scripts/terminal-wrapper.sh +36 -0
  171. package/scripts/test-enforcement.sh +132 -0
  172. package/scripts/test-install.sh +174 -0
  173. package/scripts/test-installer-parity.sh +135 -0
  174. package/scripts/test-template-enforcement.sh +76 -0
  175. package/scripts/uninstall.sh +143 -0
  176. package/scripts/update.sh +337 -0
  177. package/scripts/verify-release.sh +323 -0
  178. package/scripts/verify-wrapped.sh +194 -0
  179. package/templates/CLAUDE.global.md +135 -0
  180. package/templates/CLAUDE.project.md +37 -0
@@ -0,0 +1,146 @@
1
+ #Requires -Version 5.1
2
+ # Claws — Windows PowerShell installer
3
+ # Usage: iwr https://raw.githubusercontent.com/neunaha/claws/v0.8-alpha/scripts/install.ps1 | iex
4
+ #
5
+ # Env overrides:
6
+ # $env:CLAWS_BRANCH — branch/tag to install (default: v0.8-alpha)
7
+ # $env:CLAWS_VSCODE_CLI — full path to Code.cmd (overrides auto-detection)
8
+
9
+ $ErrorActionPreference = 'Stop'
10
+
11
+ # Without SilentlyContinue, PS 5.1 redraws the progress bar every chunk (20-50x slower)
12
+ $ProgressPreference = 'SilentlyContinue'
13
+
14
+ # Branch override (PS 5.1: no ?? operator)
15
+ if ($env:CLAWS_BRANCH) { $BRANCH = $env:CLAWS_BRANCH } else { $BRANCH = 'v0.8-alpha' }
16
+
17
+ # Banner (ASCII-only — Unicode box chars render as ? in PS 5.1 / legacy consoles)
18
+ Write-Host ""
19
+ Write-Host " +-------------------------------------------+" -ForegroundColor Cyan
20
+ Write-Host " | |" -ForegroundColor Cyan
21
+ Write-Host " | CLAWS -- Terminal Control Bridge |" -ForegroundColor Cyan
22
+ Write-Host " | Project-local orchestration setup |" -ForegroundColor Cyan
23
+ Write-Host " | |" -ForegroundColor Cyan
24
+ Write-Host " +-------------------------------------------+" -ForegroundColor Cyan
25
+ Write-Host ""
26
+
27
+ # Preflight
28
+ Write-Host "Checking dependencies..." -ForegroundColor White
29
+
30
+ if (-not (Get-Command node -ErrorAction SilentlyContinue)) {
31
+ Write-Host " ERROR: 'node' not found in PATH." -ForegroundColor Red
32
+ Write-Host " Install Node.js 18+ from: https://nodejs.org/" -ForegroundColor Yellow
33
+ exit 1
34
+ }
35
+ $NodeVersionStr = (& node --version 2>&1).ToString().TrimStart('v')
36
+ $NodeMajor = [int]($NodeVersionStr.Split('.')[0])
37
+ if ($NodeMajor -lt 18) {
38
+ Write-Host (" ERROR: Node.js v" + $NodeVersionStr + " is too old -- Claws requires Node 18+.") -ForegroundColor Red
39
+ Write-Host " Upgrade from: https://nodejs.org/" -ForegroundColor Yellow
40
+ exit 1
41
+ }
42
+ Write-Host (" OK node v" + $NodeVersionStr) -ForegroundColor Green
43
+
44
+ if (-not (Get-Command git -ErrorAction SilentlyContinue)) {
45
+ Write-Host " ERROR: 'git' not found in PATH." -ForegroundColor Red
46
+ Write-Host " Install Git from: https://git-scm.com/download/win" -ForegroundColor Yellow
47
+ exit 1
48
+ }
49
+ $GitVersionStr = (& git --version 2>&1).ToString() -replace 'git version ', ''
50
+ Write-Host (" OK git " + $GitVersionStr) -ForegroundColor Green
51
+
52
+ # MSVC preflight — node-pty requires C++ build tools; warn-not-block if absent
53
+ $HasMSVC = (Get-Command 'cl.exe' -ErrorAction SilentlyContinue) -or
54
+ (Get-Command 'msbuild.exe' -ErrorAction SilentlyContinue)
55
+ if (-not $HasMSVC) {
56
+ Write-Host " WARN: C++ build tools not found -- node-pty may not compile." -ForegroundColor Yellow
57
+ Write-Host " Install: winget install Microsoft.VisualStudio.BuildTools" -ForegroundColor DarkGray
58
+ }
59
+
60
+ Write-Host (" Project: " + (Get-Location).Path) -ForegroundColor DarkGray
61
+ Write-Host ""
62
+
63
+ # Download + extract + delegate
64
+ $TempDir = $null
65
+ try {
66
+ $TempDir = Join-Path $env:TEMP ("claws-install-" + [System.Guid]::NewGuid().ToString('N').Substring(0, 8))
67
+ New-Item -ItemType Directory -Path $TempDir -Force | Out-Null
68
+
69
+ $TarballUrl = "https://codeload.github.com/neunaha/claws/tar.gz/refs/heads/" + $BRANCH
70
+ $TarballPath = Join-Path $TempDir "claws.tar.gz"
71
+ $ExtractDir = Join-Path $TempDir "extract"
72
+
73
+ Write-Host ("Downloading branch '" + $BRANCH + "'...") -ForegroundColor White
74
+ Invoke-WebRequest -Uri $TarballUrl -OutFile $TarballPath -UseBasicParsing
75
+
76
+ Write-Host "Extracting..." -ForegroundColor White
77
+ New-Item -ItemType Directory -Path $ExtractDir -Force | Out-Null
78
+ & tar -xzf $TarballPath -C $ExtractDir
79
+ if ($LASTEXITCODE -ne 0) { throw ("tar extraction failed (exit " + $LASTEXITCODE + ")") }
80
+
81
+ # GitHub tarballs unpack to one top-level directory (e.g. neunaha-claws-<sha>)
82
+ $RepoRoot = Get-ChildItem -Path $ExtractDir -Directory | Select-Object -First 1 -ExpandProperty FullName
83
+ if (-not $RepoRoot) { throw ("No directory found in extracted archive at " + $ExtractDir) }
84
+
85
+ $NodeCli = Join-Path $RepoRoot "bin\cli.js"
86
+ if (-not (Test-Path $NodeCli)) { throw ("bin\cli.js not found at " + $NodeCli) }
87
+
88
+ # Detect VS Code CLI: env override → LOCALAPPDATA → ProgramFiles → PATH
89
+ $CodePath = ''
90
+ if ($env:CLAWS_VSCODE_CLI) {
91
+ $CodePath = $env:CLAWS_VSCODE_CLI
92
+ } elseif (Test-Path "$env:LOCALAPPDATA\Programs\Microsoft VS Code\bin\Code.cmd") {
93
+ $CodePath = "$env:LOCALAPPDATA\Programs\Microsoft VS Code\bin\Code.cmd"
94
+ } elseif (Test-Path "$env:ProgramFiles\Microsoft VS Code\bin\Code.cmd") {
95
+ $CodePath = "$env:ProgramFiles\Microsoft VS Code\bin\Code.cmd"
96
+ } elseif (Get-Command 'Code.cmd' -ErrorAction SilentlyContinue) {
97
+ $CodePath = (Get-Command 'Code.cmd').Source
98
+ }
99
+
100
+ if (-not $CodePath) {
101
+ Write-Host " WARN: VS Code CLI not found -- extension install will be skipped." -ForegroundColor Yellow
102
+ Write-Host " After install: VS Code > 'Shell Command: Install code command in PATH'" -ForegroundColor DarkGray
103
+ }
104
+
105
+ # Pre-install: kill stale worker mcp_server.js processes from prior sessions.
106
+ # Only kills node.exe processes whose CommandLine contains the project's
107
+ # .claws-bin\mcp_server.js path — prevents collateral kills of other projects.
108
+ # (lib/install.js repeats this check with CLAWS_TERMINAL_CORR_ID env filtering
109
+ # on platforms where PowerShell env introspection is not needed.)
110
+ $ClawsCleanKilled = 0
111
+ $ClawsProjectRoot = (Get-Location).Path
112
+ $ClawsMcpPath = Join-Path $ClawsProjectRoot ".claws-bin\mcp_server.js"
113
+ try {
114
+ $ClawsMyPid = $PID
115
+ Get-CimInstance Win32_Process -Filter "Name='node.exe'" | ForEach-Object {
116
+ $proc = $_
117
+ if ($proc.CommandLine -and $proc.CommandLine.Contains($ClawsMcpPath) -and
118
+ $proc.ProcessId -ne $ClawsMyPid) {
119
+ $shortCmd = $proc.CommandLine.Substring(0, [Math]::Min(80, $proc.CommandLine.Length))
120
+ Write-Host (" [claws-clean] kill PID " + $proc.ProcessId + ": " + $shortCmd) -ForegroundColor DarkGray
121
+ Stop-Process -Id $proc.ProcessId -Force -ErrorAction SilentlyContinue
122
+ $ClawsCleanKilled++
123
+ }
124
+ }
125
+ } catch {
126
+ # Non-fatal — cleanup is best-effort; node installer will run regardless
127
+ }
128
+ Write-Host (" [claws-clean] killed " + $ClawsCleanKilled + " stale processes") -ForegroundColor DarkGray
129
+
130
+ # Delegate to Node installer; lib/install.js owns VSIX build, phases, and final output
131
+ Write-Host "Running installer..." -ForegroundColor White
132
+ $NodeArgs = @($NodeCli, 'install', '--vscode-cli', $CodePath) + $args
133
+ & node @NodeArgs
134
+ if ($LASTEXITCODE -ne 0) { throw ("node installer exited with code " + $LASTEXITCODE) }
135
+
136
+ Remove-Item -Recurse -Force -Path $TempDir -ErrorAction SilentlyContinue
137
+ $TempDir = $null
138
+ } catch {
139
+ Write-Host ""
140
+ Write-Host (" INSTALL FAILED: " + $_) -ForegroundColor Red
141
+ if ($TempDir -and (Test-Path $TempDir)) {
142
+ Write-Host (" Extract dir left for debugging: " + $TempDir) -ForegroundColor Yellow
143
+ }
144
+ Write-Host ""
145
+ exit 1
146
+ }