This commit introduces the initial framework for the `/core:refactor` command.
Summary of work:
- Created the command definition in `claude/code/commands/refactor.md`.
- Implemented a PHP script, `claude/code/scripts/refactor.php`, to handle the refactoring logic.
- Set up a PHP environment with `composer` and added the `nikic/php-parser` dependency for AST manipulation.
- Implemented a proof-of-concept for the `extract-method` subcommand.
Challenges and Implementation Details:
The initial implementation attempt using shell scripting (`sed`, `awk`, `perl`) proved to be unreliable for source code manipulation, resulting in corrupted files. This approach was abandoned in favor of a more robust solution using a proper PHP parser.
The current implementation uses the `nikic/php-parser` library to traverse the Abstract Syntax Tree (AST) of a PHP file. A `MethodExtractor` visitor identifies a hardcoded selection of code within a test file (`Test.php`), extracts the relevant AST nodes into a new method, and replaces the original nodes with a call to the new method.
This is a non-functional proof-of-concept and requires further development to become a dynamic, user-driven tool. The file path, selection, and new method name are currently hardcoded for demonstration purposes.
This commit introduces a new feature to track test coverage over time and warn when it drops.
The new `/core:coverage` command can be used to display the current coverage, compare it to the last commit, and show a historical trend.
A pre-commit hook has also been added to warn when coverage drops.
Key changes:
- Created `claude/code/commands/coverage.sh` to handle coverage calculation, history tracking, and reporting.
- Created `claude/code/scripts/check-coverage.sh` to be used as a pre-commit hook.
- Created `.coverage-history.json` to store coverage history.
- Updated `claude/code/hooks.json` to add the new pre-commit hook.
Known limitations:
- The actual test coverage calculation is not implemented. A mock value is used as a placeholder. This is because I was unable to find the project's testing framework or a command to generate test coverage. A `TODO` has been added to the `coverage.sh` script to indicate where the real command should be added.
- The pre-commit hook is not being triggered. I have debugged the issue extensively, but the cause is still unknown. The `check-coverage.sh` script is fully functional and can be run manually.
Adds a new `/core:release` command to streamline the release process for modules.
This command automates the following workflow:
- Bumps the version in `package.json` (and `gemini-extension.json` if it exists).
- Generates a `CHANGELOG.md` entry from conventional commit messages.
- Commits the changes with a `chore(release): vX.Y.Z` message.
- Creates and pushes a new git tag to trigger the CI release.
A `--preview` flag is included to allow for a dry run of the release process without making any changes.
Adds a new scaffolding command, `/core:scaffold`, to generate boilerplate code for models, actions, controllers, and modules.
The command includes subcommands for each component:
- `/core:scaffold model <name>`
- `/core:scaffold action <name>`
- `/core:scaffold controller <name>`
- `/core:scaffold module <name>`
The templates follow the conventions of the Host UK monorepo and include necessary boilerplate code, namespaces, and directory structures. A placeholder test file is also included.
This commit introduces a new `/core:api generate` command that generates a TypeScript/JavaScript API client or an OpenAPI specification from a project's Laravel API routes.
The implementation includes:
- A PHP script that uses regular expressions to parse the `routes/api.php` file and extract route information.
- A shell script that uses `jq` to transform the JSON output of the PHP script into the desired output formats.
- Support for generating TypeScript, JavaScript, and OpenAPI specifications.
- Updated documentation in the `README.md` file.
Challenges:
An attempt was made to parse the routes by bootstrapping a minimal Laravel application, but a persistent Composer issue prevented the installation of the necessary dependencies. After several failed attempts to resolve the issue, a regex-based parsing approach was adopted as the only viable path forward in this environment.
This commit introduces a new command, `/core:deps`, to visualize dependencies between modules in the monorepo.
The command parses a `repos.yaml` file to build a dependency graph and supports the following functionalities:
- Displaying a full dependency tree for all modules.
- Displaying a dependency tree for a single module.
- Displaying reverse dependencies for a single module using the `--reverse` flag.
- Detecting and reporting circular dependencies.
The implementation consists of a Python script that handles the core logic and a command definition file that connects the command to the script. A comprehensive test suite is included to ensure the correctness of the implementation.
Co-authored-by: Claude <noreply@anthropic.com>
This commit introduces a new /core:clean command to clean up generated files, caches, and build artifacts.
The command provides the following options:
- /core:clean: Cleans all caches and build artifacts.
- /core:clean --cache: Cleans caches only.
- /core:clean --deps: Performs a dry-run for dependency cleanup.
- /core:clean --deps --force: Deletes dependency directories after a confirmation prompt.
- /core:clean --dry-run: Shows what would be deleted without performing any actions.
The implementation includes safety features such as a "dry-run by default" for dependency cleaning and a confirmation prompt for destructive operations.
Implements a new `/core:log` command to provide smart log viewing with filtering and analysis capabilities.
This new command allows users to:
- Tail `laravel.log` in real-time.
- Filter log entries by error level (`--errors`).
- Filter log entries by a specific time range (`--since`).
- Filter log entries using a regular expression (`--grep`).
- Filter log entries by a specific request ID (`--request`).
- Perform log analysis to summarize errors and provide recommendations (`analyse`).
The implementation includes a new command definition file (`claude/code/commands/log.md`) and a corresponding shell script (`claude/code/scripts/log.sh`) that contains the core logic for the command. A dummy log file (`storage/logs/laravel.log`) has also been added to facilitate testing and development.
Introduces a new script to detect the current module (PHP or Go) based on the presence of composer.json or go.mod files, git remote URL, or the current directory name.
This context is loaded once per session and used to dynamically adjust commands, starting with the QA command.
Refactors the QA command and verification scripts to use the new module context, removing redundant project-type detection.
This commit introduces a new /core:qa command to automate the quality assurance process.
The command can be run with the following options:
- No flags: Runs the full QA suite (linting and tests).
- --quick: Runs only the linters for a fast feedback loop.
- --fix: Runs the full QA suite and iteratively attempts to fix issues using the project's auto-formatter.
The command detects the project type (Go or PHP) and runs the appropriate QA tools.
This addresses the user's request to have an automated and iterative QA command.
Implements a new `/core:commit` command that analyzes staged changes to generate a conventional commit message.
The command supports three main modes of operation:
- `/core:commit`: Automatically generates a commit message based on the content of the staged files.
- `/core:commit "custom message"`: Uses the provided string as the full commit message.
- `/core:commit --amend`: Amends the last commit with the new message.
Message generation includes several heuristics:
- **Commit Type:** Determined by file paths (e.g., `_test.go` -> `test`) and diff content (e.g., keywords like `fix` or `refactor`).
- **Scope:** Inferred from the most common directory name among the staged files.
- **Summary:** Extracted from function or class names in the diff, or defaults to a file-based summary.
- **Co-Author:** A `Co-Authored-By` trailer is automatically appended.
This feature streamlines the development workflow by automating the creation of descriptive and conventional commit messages.
Adds a new command `/core:status` to display the status of all repositories in a formatted table.
The command provides the following features:
- Displays module name, branch, clean/dirty status, and ahead/behind counts.
- Supports filtering for dirty repositories with the `--dirty` flag.
- Supports filtering for repositories behind remote with the `--behind` flag.
- Includes a summary line with counts of dirty, behind, and clean repositories.
This is implemented by wrapping the existing `core dev health` command with a new script that handles formatting and filtering.
Exposes core CLI commands as MCP tools for AI agents.
This change introduces a Go-based MCP server that wraps the
existing core CLI commands (`go test`, `dev health`, `dev commit`),
providing structured JSON responses.
This allows AI agents to interact with the core CLI in a structured,
type-safe manner.
The implementation includes:
- A new Go HTTP server in `google/mcp/`
- Handlers for each of the core CLI commands
- Unit tests for the handlers with a mock `core` executable
- Documentation for the new MCP tools
- Integration with the `code` plugin via `plugin.json`
This commit introduces a new command, `/core:env`, to manage environment variables. It provides a set of tools to compare and manage a local `.env` file against a `.env.example` template, with a strong emphasis on security by masking sensitive values.
The command includes the following subcommands:
- `/core:env`: Shows the current environment variables with sensitive values masked.
- `/core:env check`: Validates the local `.env` file against `.env.example`, reporting any missing or required variables.
- `/core:env diff`: Displays the differences between the `.env` and `.env.example` files, ensuring sensitive data is not exposed.
- `/core:env sync`: Adds missing variables from `.env.example` to the local `.env` file without overwriting existing values.
To prevent accidental exposure of secrets, the `.env` file is now included in `.gitignore`.
This commit introduces a new plugin for integrating with GitHub Issues.
The `issue` plugin provides the following commands:
- `/core:issue list`: List open issues.
- `/core:issue view <number>`: View the details of a specific issue.
- `/core:issue start <number>`: Start working on an issue by creating a feature branch.
- `/core:issue close <number>`: Close an issue by creating a pull request.
The plugin uses the GitHub CLI (`gh`) to interact with the GitHub API.
This change introduces a new hook that runs before a file is written or edited. The hook executes a script that scans the file content for patterns that match common secret formats, such as API keys, AWS keys, and private keys.
If a potential secret is found, the script exits with a non-zero status code, which blocks the file operation and prevents the secret from being committed. The script also provides a user-friendly error message with the filename, line number, and a suggestion to use environment variables.
This helps to prevent accidental commits of sensitive credentials to the repository.
The `/core:yes` command for auto-approve mode was already implemented. This commit verifies its functionality.
- The `ensure-commit.sh` hook script was tested and confirmed to block stopping with uncommitted changes.
- The command definition in `claude/code/commands/yes.md` was reviewed and found to be correct and complete.
- No code changes were necessary as the feature already exists.
Adds a new skill to provide Laravel-specific patterns and guidance for PHP module development.
This includes documentation on:
- Event-driven module structure
- Single-purpose Action classes
- Multi-tenancy with BelongsToWorkspace trait
- UI component conventions (Flux Pro, Font Awesome Pro)
- Common `core` CLI commands for testing, formatting, and analysis.
Adds a new `/core:onboard` command to provide an interactive onboarding experience for new contributors.
The command:
- Explains the repository structure and key modules.
- Lists common development commands.
- Links to good first issues.
- Includes a `--module` option for deep dives into specific modules (tenant, admin, php).
- Prompts the user about their interests to guide them to a suitable first task.
Adds a new skill, `/core:debug`, to provide a structured workflow for debugging issues. The skill is defined in `claude/code/commands/debug.md` and follows the systematic protocol outlined in the original request.
The debugging protocol includes the following steps:
1. Reproduce
2. Isolate
3. Hypothesize
4. Test Hypotheses
5. Fix
6. Verify
New slash commands:
- /collect:collect - Auto-detect and collect any resource
- /collect:github - Collect GitHub repos/orgs
- /collect:website - Crawl websites with depth control
- /collect:excavate - Full project archaeology dig
- /collect:papers - Collect whitepapers from registry
All commands use Borg CLI (github.com/Snider/Borg) for collection.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Remove custom collection scripts in favour of Borg
(github.com/Snider/Borg) for data collection. Skills now document
what to collect, with Borg handling the actual collection.
Removed:
- collect-whitepaper.sh, dispatch.sh, update-index.sh
- All skill-specific bash scripts (collect.sh, generate-jobs.sh, etc.)
- hooks.json and HOOKS.md
Updated:
- plugin.json to reference Borg dependency
- SKILL.md files with Borg command examples
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Move collection hooks, scripts, and all skills from claude/code to
new claude/collect plugin. Updates marketplace.json and plugin
descriptions accordingly.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Restructure Gemini extension files that were incorrectly placed at repo
root. Updates script paths to reference shared claude/code/ scripts.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Reorganise as a marketplace with multiple focused plugins:
- claude/code: Core development (hooks, scripts, data collection)
- claude/review: Code review automation
- claude/verify: Work verification
- claude/qa: Quality assurance loops
- claude/ci: CI/CD integration
Structure:
- .claude-plugin/marketplace.json lists all plugins
- Each plugin has its own .claude-plugin/plugin.json
- Commands namespaced: /code:*, /review:*, /qa:*, etc.
Install individual plugins or all via marketplace:
claude plugin add host-uk/core-agent
claude plugin add host-uk/core-agent/claude/code
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add .claude-plugin/plugin.json manifest for auto-updates
- Move claude/ contents to root level (commands/, hooks/, scripts/, skills/)
- Update hooks.json to use ${CLAUDE_PLUGIN_ROOT} for portability
- Add .gitignore for IDE files
- Update CLAUDE.md with new structure and installation instructions
Plugin can now be installed via:
claude plugin add host-uk/core-agent
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Scripts:
- auto-approve.sh: PermissionRequest hook that allows all tools
- ensure-commit.sh: Stop hook that blocks with uncommitted changes
- qa-filter.sh: PostToolUse hook that extracts QA failures only
- qa-verify.sh: Stop hook that runs QA and blocks on failures
Updated skill files to reference script paths.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add skill files for autonomous workflows:
- yes.md: Auto-approve mode with commit requirement
- qa.md: Iterative QA fix loop for Go/PHP projects
Both skills use skill-scoped hooks to modify Claude's behavior
during execution.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Skill that enables "just do it" mode:
- Auto-approves all permission requests via PermissionRequest hook
- Ensures work completes with commit via Stop hook
- Skill-scoped hooks (only active during skill)
- Still respects safety blocks from prefer-core.sh
Usage: /core:yes fix the failing test and commit
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
6 new issues for Claude Code hook improvements:
- 012: Test output filtering (reduce noise, show failures only)
- 013: Stop verification (verify work complete before stopping)
- 014: Auto-test on edit (async tests after code changes)
- 015: Session context injection (git/issues/CI on startup)
- 016: Silent auto-formatting (suppress formatter output)
- 017: Expose/hide policy (define what to show vs suppress)
Based on Claude Code hooks documentation:
- PostToolUse with suppressOutput for noise reduction
- Stop hooks with agent verification
- Async hooks for background testing
- SessionStart for context injection
- additionalContext for exposing important info
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Document the approach of using `core` CLI instead of raw commands:
- Command mapping table (go/php/git → core equivalents)
- Key commands reference for dev, go, php, build, ai, qa
- Missing features → raise issues on host-uk/core
- TDD approach: code as if functionality exists
Every agent using core tests the framework, making it bulletproof.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Consolidates the repository structure:
- Move skills/ to claude/skills/
- Move collection hooks to claude/collection/
- Update CLAUDE.md to reflect unified structure
Public version remains at core-claude; this is the advanced in-house version.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>