feat: add ast-grep SessionStart hook and setup command#58
Conversation
Implement comprehensive ast-grep integration with: - SessionStart hook (ast-grep-context.ts) that detects projects and recommends ast-grep over grep/ripgrep for code search - New `npx @pleaseai/code setup` command to install and verify required tools - @pleaseai/binaries package: shared utilities for binary download, caching, and platform detection - Updated packages (code, lsp, dora) to use @pleaseai/binaries for consistent tool management - Updated ast-grep SKILL.md with Linux compatibility note This enables developers to: 1. Get smart recommendations for code search tools via SessionStart hook 2. Install required tools (ast-grep) with a single command 3. Have centralized binary management across all packages 4. Benefit from cross-package code reuse in binary handling Closes #58
Summary of ChangesHello @amondnet, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the developer experience by integrating ast-grep for advanced code search capabilities and streamlining tool management. It introduces a new SessionStart hook to intelligently recommend ast-grep and a unified setup command to easily install and verify development tools. A new @pleaseai/binaries package centralizes binary handling, improving consistency and maintainability across various project components. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a new @pleaseai/binaries package to centralize binary download, caching, and platform detection utilities, which is then integrated into @pleaseai/code, @pleaseai/dora, and @pleaseai/lsp packages. It adds a new setup command to @pleaseai/code for checking and installing required tools like ast-grep, and includes a SessionStart hook to provide dynamic ast-grep context to Claude Code sessions. Additionally, the PR updates bun.lock to reflect new dependencies and chalk version, modifies Claude plugin settings to reduce command timeouts and enable hookify and plugin-dev, and disables LSP in .please/config.json. Review comments highlight an inconsistency in packages/binaries/package.json and tsconfig.json regarding build output, point out that the confirm function in setup.ts needs a SIGINT handler to prevent terminal issues, and recommend using a specific stable version for ast-grep downloads instead of the unstable /latest/ URL.
- Add cross-platform support for extractZip (PowerShell on Windows, unzip on Unix) - Add SIGINT handler to confirm() to restore terminal state on Ctrl+C - Pin ast-grep version to 0.40.3 for stability and reproducibility
- Update packages/dora and packages/lsp to use zod ^3.25.0 || ^4.0.0 - Update apps/docs to use zod ^4.0.0 - Update docs-please dependency to ^0.2.6 - Resolves excessive type depth error in TypeScript compilation
…ities - Add comprehensive tests for cache utilities (ensure cache dir, get cached binary path, clear cache) - Add tests for platform detection and binary validation - Add tests for download utilities and binary extraction - Total 37 new tests covering core functionality
Update ast-grep hook to use the correct environment variable for plugin root path resolution.
Refactor ast-grep-context.ts to export testable functions and add comprehensive tests covering context strings, installation detection, output generation, and end-to-end script execution. - Register hooks/scripts as workspace package - Add package.json and tsconfig.json for hooks/scripts - Export checkAstGrepInstalled, getAdditionalContext, createHookOutput - Add 17 tests with full coverage
Summary
Implement comprehensive ast-grep integration with SessionStart hook and setup command:
npx @pleaseai/code setup) to install and verify required tools like ast-grepBenefits
Developers can now:
Test plan
code setupcommand manuallyRelated Issues
Closes #58