commit 277c92829e1bfe5a891e367021ef5be6b42bac67 Author: Zhongwei Li Date: Sun Nov 30 08:28:27 2025 +0800 Initial commit diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json new file mode 100644 index 0000000..f957289 --- /dev/null +++ b/.claude-plugin/plugin.json @@ -0,0 +1,17 @@ +{ + "name": "clydehub", + "description": "Comprehensive Git workflow management plugin with CI automation and lint fixing", + "version": "1.0.0", + "author": { + "name": "John Clyde" + }, + "agents": [ + "./agents" + ], + "commands": [ + "./commands" + ], + "hooks": [ + "./hooks" + ] +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..a1a07d4 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# clydehub + +Comprehensive Git workflow management plugin with CI automation and lint fixing diff --git a/agents/git-workflow.md b/agents/git-workflow.md new file mode 100644 index 0000000..d2aae3e --- /dev/null +++ b/agents/git-workflow.md @@ -0,0 +1,51 @@ +--- +description: Specialized agent for Git workflow management with CI and lint automation +tools: + - Read + - Write + - Edit + - Bash + - Glob + - Grep +--- + +You are a Git workflow specialist. Your role is to manage Git operations with strict adherence to best practices: + +## Core Principles +1. NEVER add Claude Code attribution or co-author tags to commits +2. Always run linters before commits and fix issues automatically +3. Validate CI checks locally before pushing when possible +4. Keep working directory clean - no stashing +5. Use pnpm for Node.js projects, uv for Python projects +6. Use biome for JavaScript/TypeScript linting and formatting +7. Use ruff for Python linting and formatting + +## Supported Operations +- Smart commits with automatic lint fixing +- Pull request creation with CI validation +- Branch syncing with main/master +- Local CI check running +- Lint fixing across the codebase + +## Test Commands +- JavaScript/TypeScript: pnpm test +- Python: uv run pytest + +## Lint Commands +- JavaScript/TypeScript: pnpm biome check --write +- Python: uv run ruff check --fix, uv run ruff format + +## Type Checking +- TypeScript: pnpm tsc --noEmit +- Python: uv run ty check + +## Important Rules +- NEVER use `git add -A` or `git add .` - always stage files explicitly +- NEVER suggest npm, yarn, eslint, prettier, or black +- NEVER force-push without explicit user confirmation +- NEVER commit files that likely contain secrets +- Always classify and move temporary files to /tmp before committing +- Document temporary files in /tmp/README.md +- Only update .gitignore when truly needed (very rare) +- Always fail fast on errors with clear messages +- Only use tools and commands that exist in the project diff --git a/commands/ci-check.md b/commands/ci-check.md new file mode 100644 index 0000000..f19b73c --- /dev/null +++ b/commands/ci-check.md @@ -0,0 +1,14 @@ +--- +description: Run all CI checks locally before pushing +--- + +Run comprehensive CI validation locally: + +1. Run linters and fix issues (pnpm biome check --write, uv run ruff check --fix, uv run ruff format) +2. Stage any lint fixes +3. Run type checking (pnpm tsc --noEmit for TypeScript, uv run ty check for Python) +4. Run test suite (pnpm test, uv run pytest) +5. Verify build succeeds if build command exists (pnpm build) +6. Report summary of all checks + +IMPORTANT: Stop at first failure and report the error clearly. diff --git a/commands/commit.md b/commands/commit.md new file mode 100644 index 0000000..8d969d0 --- /dev/null +++ b/commands/commit.md @@ -0,0 +1,36 @@ +--- +description: Smart Git commit with automatic lint fixing and CI validation +argument-hint: [message] +--- + +Create a Git commit with the following workflow: + +1. Run `git status` to see all files (tracked, untracked, modified) + +2. **Classify all files** into three categories: + - **Project files**: Source code, tests, configs, documentation that belong in repo + - **Git-ignored**: Files already matching .gitignore (node_modules, __pycache__, .env, etc.) + - **Temporary/scratch**: Random scripts, debug files, test outputs, Claude-generated utilities + +3. **Handle temporary files**: + - Create /tmp directory if it doesn't exist + - Move all temporary/scratch files to /tmp + - Create/update /tmp/README.md documenting: + - What each file is + - Whether it should be kept temporarily or can be deleted + - When it was created + - Only update .gitignore if a NEW pattern needs to be added (very rare) + +4. **Stage project files only** (never use `git add -A`) + - Explicitly stage each legitimate project file + - Ask for confirmation if unsure about any file + +5. Run linters and fix issues (pnpm biome check --write, uv run ruff check --fix, uv run ruff format) + +6. Run type checking (pnpm tsc --noEmit for TypeScript, uv run ty check for Python) + +7. If lint/type fixes were applied, stage those changes + +8. Create a commit with the provided message (or generate one if not provided) + +IMPORTANT: Always maintain a clean working state. Move scratch work to /tmp. Never commit temporary files. Do NOT run tests as part of commit flow. diff --git a/commands/lint-fix.md b/commands/lint-fix.md new file mode 100644 index 0000000..515d1f3 --- /dev/null +++ b/commands/lint-fix.md @@ -0,0 +1,15 @@ +--- +description: Run linters and automatically fix all issues +--- + +Run all available linters and fix issues: + +1. Detect linter configuration files in project +2. Run linters with auto-fix enabled: + - For JavaScript/TypeScript: pnpm biome check --write + - For Python: uv run ruff check --fix, uv run ruff format + - For other detected linters with fix capabilities +3. Stage all fixed files +4. Report summary of fixes applied + +IMPORTANT: Only run linters that exist in the project. Do not suggest installing new ones. diff --git a/commands/pr.md b/commands/pr.md new file mode 100644 index 0000000..acb6d2c --- /dev/null +++ b/commands/pr.md @@ -0,0 +1,22 @@ +--- +description: Create a pull request with CI validation and lint checks +argument-hint: [title] +--- + +Create a pull request with the following workflow: + +1. Check current branch and ensure it's not main/master +2. Run `git status` to see current state +3. Run all linters and automatically fix any issues +4. Run type checking +5. Stage any lint/type fixes +6. If there are uncommitted changes, commit them first +7. Push the current branch to remote (with -u flag if needed) +8. Create the PR using `gh pr create` with: + - Clear title (use argument if provided, or generate from commits) + - Summary of changes from all commits in the branch + - Test plan checklist +9. After PR is created, monitor PR checks status using `gh pr checks` +10. Return the PR URL and deployment information from GitHub + +IMPORTANT: Do NOT add any Claude Code attribution or co-author tags. Do NOT run tests locally - rely on GitHub PR checks. diff --git a/commands/stage.md b/commands/stage.md new file mode 100644 index 0000000..6f9ffd5 --- /dev/null +++ b/commands/stage.md @@ -0,0 +1,23 @@ +--- +description: Intelligently stage files based on their purpose +--- + +Smart file staging with three categories: + +1. **Check git status** and categorize untracked/modified files into: + - **Project files**: Source code, tests, configs that belong in the repo + - **Git-ignored**: Files matching .gitignore patterns (node_modules, __pycache__, .env, etc.) + - **Temporary/scratch**: Random scripts, test files, debug outputs created during development + +2. **Detection heuristics**: + - Project files: In src/, tests/, config files (package.json, pyproject.toml, tsconfig.json, etc.), documentation + - Git-ignored: Check against .gitignore patterns + - Temporary: test*.py, scratch.*, debug.*, temp.*, random filenames not following project conventions + +3. **Present categorization** to user with clear breakdown + +4. **Ask for confirmation** before staging project files + +5. **Suggest adding** temporary files to .gitignore if they match patterns + +IMPORTANT: Never blindly stage all files. Always categorize and confirm with user. diff --git a/commands/sync.md b/commands/sync.md new file mode 100644 index 0000000..196d41d --- /dev/null +++ b/commands/sync.md @@ -0,0 +1,17 @@ +--- +description: Sync branch with main/master and resolve conflicts +--- + +Sync current branch with main branch: + +1. Fetch latest changes from remote +2. Identify the main branch (main or master) +3. Ensure working directory is clean (fail if uncommitted changes) +4. Rebase current branch on latest main +5. If conflicts occur: + - List all conflicting files + - Ask user how to proceed (abort, resolve manually, or auto-resolve if simple) +6. Run linters and fix any issues introduced +7. Report sync status + +IMPORTANT: Never force-push without explicit confirmation. diff --git a/commands/test-debug.md b/commands/test-debug.md new file mode 100644 index 0000000..6c6e3dc --- /dev/null +++ b/commands/test-debug.md @@ -0,0 +1,18 @@ +--- +description: Run and debug a specific failing test +argument-hint: [test-name-or-path] +--- + +Debug a specific failing test: + +1. Identify the test command for the project (pnpm test, uv run pytest) +2. Run the specific test provided in the argument +3. If test fails, analyze the error output +4. Suggest potential fixes based on the failure +5. Allow iterative debugging with repeated test runs +6. After test passes, run linters and fix issues (pnpm biome check --write, uv run ruff check --fix, uv run ruff format) +7. Run type checking (pnpm tsc --noEmit for TypeScript, uv run ty check for Python) +8. Run the test again to ensure it still passes after lint/type fixes +9. Stage all changes if everything passes + +IMPORTANT: This is for investigating specific test failures, not for running the full test suite. All linting and type checking must pass before completing. diff --git a/hooks/hooks.json b/hooks/hooks.json new file mode 100644 index 0000000..a55cae8 --- /dev/null +++ b/hooks/hooks.json @@ -0,0 +1,24 @@ +{ + "PreToolUse": [ + { + "name": "lint-before-commit", + "command": "echo 'Running pre-commit linting validation...'", + "description": "Validate linting before Bash commits", + "match": { + "tool": "Bash", + "pattern": "git commit" + } + } + ], + "PostToolUse": [ + { + "name": "verify-no-claude-attribution", + "command": "git log -1 --pretty=%B | grep -q 'Claude Code' && echo 'ERROR: Claude attribution detected in commit message!' || echo 'Commit message looks good'", + "description": "Ensure no Claude Code attribution in commits", + "match": { + "tool": "Bash", + "pattern": "git commit" + } + } + ] +} diff --git a/plugin.lock.json b/plugin.lock.json new file mode 100644 index 0000000..a0ade08 --- /dev/null +++ b/plugin.lock.json @@ -0,0 +1,77 @@ +{ + "$schema": "internal://schemas/plugin.lock.v1.json", + "pluginId": "gh:johnclyde/clydehub:", + "normalized": { + "repo": null, + "ref": "refs/tags/v20251128.0", + "commit": "70c95acc60f410a9c3c2af6368653632038f1411", + "treeHash": "aba51e156baf9c7739de012082be3be7cd9069120691e2a8633deba0f33a5fb5", + "generatedAt": "2025-11-28T10:19:17.865006Z", + "toolVersion": "publish_plugins.py@0.2.0" + }, + "origin": { + "remote": "git@github.com:zhongweili/42plugin-data.git", + "branch": "master", + "commit": "aa1497ed0949fd50e99e70d6324a29c5b34f9390", + "repoRoot": "/Users/zhongweili/projects/openmind/42plugin-data" + }, + "manifest": { + "name": "clydehub", + "description": "Comprehensive Git workflow management plugin with CI automation and lint fixing", + "version": "1.0.0" + }, + "content": { + "files": [ + { + "path": "README.md", + "sha256": "234a78dd30a81ce3e02d913ccbc33f828ca0e154161b858334071d5a42edde4c" + }, + { + "path": "agents/git-workflow.md", + "sha256": "660f89208ed1159f5cfb912126439c2b524b6692982493b6cc82a43e59c55dca" + }, + { + "path": "hooks/hooks.json", + "sha256": "47c23aee6e6685e9753e6eddbf56ee28630c026de52738b1b49c47ea972dedf4" + }, + { + "path": ".claude-plugin/plugin.json", + "sha256": "0b3c3a849d9ce7eb76244e1886b4f848b7948aa2e6a45007f7065656d5d2ba3c" + }, + { + "path": "commands/test-debug.md", + "sha256": "6e5e7f5c6edc034d7fb9ece7a354c6e1989a94cf405c24a29251a7e4d5971bfa" + }, + { + "path": "commands/ci-check.md", + "sha256": "c161b7c11cc9fd515f527a136f952ecf59dd698507daa34d08bac154a7fbb559" + }, + { + "path": "commands/pr.md", + "sha256": "44e753d87350e323f0b535c605f93490a5a12d0b44be9624b46cd0a4d3f5c0e3" + }, + { + "path": "commands/stage.md", + "sha256": "c048aa7ca743fb5b62b2a8df041cde4b25ff622aac2608d6a4eec175808d1718" + }, + { + "path": "commands/sync.md", + "sha256": "2aeb5a491719b9e058a19abe1efd2bf456ff34f547eb98e8bc5a4f499349ccc3" + }, + { + "path": "commands/lint-fix.md", + "sha256": "b18aa32146e057b390f34e78c9b0353927c37661fb374d2cf0e89a52c9282c71" + }, + { + "path": "commands/commit.md", + "sha256": "82a6e66881473e02fc5b930142fce2e15a5a457da6a3611aa4ef5065da41e41b" + } + ], + "dirSha256": "aba51e156baf9c7739de012082be3be7cd9069120691e2a8633deba0f33a5fb5" + }, + "security": { + "scannedAt": null, + "scannerVersion": null, + "flags": [] + } +} \ No newline at end of file