Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions hooks/hooks.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
"hooks": [
{
"type": "command",
"command": "bunx @pleaseai/code format --stdin",
"command": "bun $CLAUDE_PLUGIN_ROOT/hooks/scripts/code-runner.ts format --stdin",
"timeout": 10
},
{
"type": "command",
"command": "bunx @pleaseai/code lsp --stdin",
"command": "bun $CLAUDE_PLUGIN_ROOT/hooks/scripts/code-runner.ts lsp --stdin",
"timeout": 10
}
]
Expand Down
23 changes: 23 additions & 0 deletions hooks/scripts/code-runner.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { spawnSync } from 'node:child_process'
import process from 'node:process'
import manifest from '../../.release-please-manifest.json' with { type: 'json' }

const version = manifest['packages/code']
if (!version) {
console.error(
'Error: Could not find version for \'packages/code\' in .release-please-manifest.json',
)
process.exit(1)
}

const args = process.argv.slice(2)
const result = spawnSync('bunx', [`@pleaseai/code@${version}`, ...args], {
stdio: 'inherit',
})

if (result.error) {
console.error('Error: Failed to spawn bunx command.', result.error)
process.exit(1)
}

process.exit(result.status ?? 1)
Comment thread
amondnet marked this conversation as resolved.