forked from kdcokenny/opencode-worktree
-
Notifications
You must be signed in to change notification settings - Fork 0
refactor: fork publishing setup (package.json rename, .gitignore, CLAUDE.md) #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| name: Claude Code Review | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, synchronize, ready_for_review, reopened] | ||
|
|
||
| jobs: | ||
| claude-review: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| pull-requests: read | ||
| issues: read | ||
| id-token: write | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 1 | ||
|
|
||
| - name: Run Claude Code Review | ||
| id: claude-review | ||
| uses: anthropics/claude-code-action@v1 | ||
| with: | ||
| claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} | ||
| plugin_marketplaces: 'https://github.com/anthropics/claude-code.git' | ||
| plugins: 'code-review@claude-code-plugins' | ||
| prompt: '/code-review:code-review ${{ github.repository }}/pull/${{ github.event.pull_request.number }}' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| name: Claude Code | ||
|
|
||
| on: | ||
| issue_comment: | ||
| types: [created] | ||
| pull_request_review_comment: | ||
| types: [created] | ||
| issues: | ||
| types: [opened, assigned] | ||
| pull_request_review: | ||
| types: [submitted] | ||
|
|
||
| jobs: | ||
| claude: | ||
| if: | | ||
| (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) || | ||
| (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) || | ||
| (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) || | ||
| (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude'))) | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| pull-requests: read | ||
| issues: read | ||
| id-token: write | ||
| actions: read | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 1 | ||
|
|
||
| - name: Run Claude Code | ||
| id: claude | ||
| uses: anthropics/claude-code-action@v1 | ||
| with: | ||
| claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} | ||
| additional_permissions: | | ||
| actions: read |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| name: Publish to npm | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - 'v*' | ||
|
|
||
| jobs: | ||
| publish: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| id-token: write | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Bun | ||
| uses: oven-sh/setup-bun@v2 | ||
| with: | ||
| bun-version: latest | ||
|
|
||
| - name: Install dependencies | ||
| run: bun install | ||
|
|
||
| - name: Type check | ||
| run: bun run typecheck | ||
|
|
||
| - name: Build | ||
| run: bun run build | ||
|
|
||
| - name: Set up Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20' | ||
| registry-url: 'https://registry.npmjs.org' | ||
|
|
||
| - name: Publish to npm | ||
| run: npm publish | ||
| env: | ||
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,35 @@ | ||
| /.idea/ | ||
| # Dependencies | ||
| node_modules/ | ||
|
|
||
| # Build output | ||
| dist/ | ||
|
|
||
| # Environment | ||
| .env* | ||
|
|
||
| # IDE | ||
| .idea/ | ||
| .vscode/ | ||
| .cursor/ | ||
|
|
||
| # OS | ||
| .DS_Store | ||
| Thumbs.db | ||
|
|
||
| # Bun | ||
| bun.lockb | ||
|
|
||
| # Package archives | ||
| *.tgz | ||
|
|
||
| # Coverage | ||
| coverage/ | ||
|
|
||
| # Logs | ||
| logs/ | ||
|
|
||
| # SpecKit / Agent state (tracked separately) | ||
| .specify/ | ||
| .agents/ | ||
| .claude/ | ||
| specs/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| # Source | ||
| src/ | ||
|
|
||
| # Tests | ||
| tests/ | ||
|
|
||
| # Specs and design docs | ||
| specs/ | ||
| .specify/ | ||
|
|
||
| # Agent/skill directories | ||
| .agents/ | ||
| .claude/ | ||
|
|
||
| # GitHub workflows | ||
| .github/ | ||
|
|
||
| # Project config | ||
| AGENTS.md | ||
| CLAUDE.md | ||
| tsconfig.json | ||
| tsup.config.ts | ||
| bun.lock | ||
| bun.lockb | ||
|
|
||
| # IDE | ||
| .idea/ | ||
| .vscode/ | ||
| .cursor/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,67 @@ | ||
| # CLAUDE.md | ||
|
|
||
| ## Responsibility Boundary | ||
| - This repository owns the facade implementation, stable project memory, SpecKit assets, feature specifications, and repo-local agent guidance for the OpenCode worktree plugin. | ||
| - Child directories may narrow these rules with their own `CLAUDE.md`; the nearest file wins for its subtree. | ||
|
|
||
| ## Allowed Content | ||
| - Plugin source code under `src/` | ||
| - Specification workflow assets under `.specify/`, including stable memory under `.specify/memory/` | ||
| - Agent workflow assets under `.claude/` and `.agents/`, including lightweight repo-local skills | ||
| - Feature specs, plans, tasks, checklists, context, and case breakdowns under `specs/` | ||
| - Minimal top-level documentation such as `README.md`, `AGENTS.md`, and this file | ||
|
|
||
| ## Forbidden Content | ||
| - Generated build outputs, vendored dependencies, secrets, or local machine state | ||
| - Unrelated applications, experiments, or copied OCX monorepo code that is not maintained here | ||
| - Files placed in a directory whose ownership belongs to a more specific child contract | ||
| Behavioral guidelines to reduce common LLM coding mistakes. Merge with project-specific instructions as needed. | ||
|
|
||
| **Tradeoff:** These guidelines bias toward caution over speed. For trivial tasks, use judgment. | ||
|
|
||
| ## Project-Specific Guidelines | ||
|
|
||
| ### 1. Think Before Coding | ||
|
|
||
| **Don't assume. Don't hide confusion. Surface tradeoffs.** | ||
|
|
||
| Before implementing: | ||
| - State your assumptions explicitly. If uncertain, ask. | ||
| - If multiple interpretations exist, present them - don't pick silently. | ||
| - If a simpler approach exists, say so. Push back when warranted. | ||
| - If something is unclear, stop. Name what's confusing. Ask. | ||
|
|
||
| ### 2. Simplicity First | ||
|
|
||
| **Minimum code that solves the problem. Nothing speculative.** | ||
|
|
||
| - No features beyond what was asked. | ||
| - No abstractions for single-use code. | ||
| - No "flexibility" or "configurability" that wasn't requested. | ||
| - No error handling for impossible scenarios. | ||
| - If you write 200 lines and it could be 50, rewrite it. | ||
|
|
||
| Ask yourself: "Would a senior engineer say this is overcomplicated?" If yes, simplify. | ||
|
|
||
| ### 3. Surgical Changes | ||
|
|
||
| **Touch only what you must. Clean up only your own mess.** | ||
|
|
||
| When editing existing code: | ||
| - Don't "improve" adjacent code, comments, or formatting. | ||
| - Don't refactor things that aren't broken. | ||
| - Match existing style, even if you'd do it differently. | ||
| - If you notice unrelated dead code, mention it - don't delete it. | ||
|
|
||
| When your changes create orphans: | ||
| - Remove imports/variables/functions that YOUR changes made unused. | ||
| - Don't remove pre-existing dead code unless asked. | ||
|
|
||
| The test: Every changed line should trace directly to the user's request. | ||
|
|
||
| ### 4. Goal-Driven Execution | ||
|
|
||
| **Define success criteria. Loop until verified.** | ||
|
|
||
| Transform tasks into verifiable goals: | ||
| - "Add validation" → "Write tests for invalid inputs, then make them pass" | ||
| - "Fix the bug" → "Write a test that reproduces it, then make it pass" | ||
| - "Refactor X" → "Ensure tests pass before and after" | ||
|
|
||
| For multi-step tasks, state a brief plan: | ||
| ``` | ||
| 1. [Step] → verify: [check] | ||
| 2. [Step] → verify: [check] | ||
| 3. [Step] → verify: [check] | ||
| ``` | ||
|
|
||
| Strong success criteria let you loop independently. Weak criteria ("make it work") require constant clarification. | ||
|
|
||
| --- | ||
|
|
||
| **These guidelines are working if:** fewer unnecessary changes in diffs, fewer rewrites due to overcomplication, and clarifying questions come before implementation rather than after mistakes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| { | ||
| "name": "opencode-worktree", | ||
| "version": "0.1.0", | ||
| "description": "OpenCode plugin for multi-repo workspace worktree orchestration", | ||
| "type": "module", | ||
| "main": "dist/plugin/worktree.js", | ||
| "types": "dist/plugin/worktree.d.ts", | ||
| "exports": { | ||
| ".": { | ||
| "types": "./dist/plugin/worktree.d.ts", | ||
| "default": "./dist/plugin/worktree.js" | ||
| } | ||
| }, | ||
| "files": [ | ||
| "dist", | ||
| "README.md", | ||
| "LICENSE" | ||
| ], | ||
| "scripts": { | ||
| "build": "tsup", | ||
| "dev": "tsup --watch", | ||
| "typecheck": "tsc --noEmit", | ||
| "test": "bun test", | ||
| "prepublishOnly": "bun run build && bun run typecheck", | ||
| "release": "bumpp" | ||
| }, | ||
| "author": "NeverMore93", | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/NeverMore93/opencode-worktree" | ||
| }, | ||
| "homepage": "https://github.com/NeverMore93/opencode-worktree#readme", | ||
| "dependencies": { | ||
| "jsonc-parser": "^3.3.1", | ||
| "zod": "^3.24.0" | ||
| }, | ||
| "peerDependencies": { | ||
| "@opencode-ai/plugin": ">=1.1.0", | ||
| "@opencode-ai/sdk": ">=1.0.0" | ||
| }, | ||
| "devDependencies": { | ||
| "@opencode-ai/plugin": "^1.14.18", | ||
| "@opencode-ai/sdk": "^1.0.0", | ||
| "@types/bun": "^1.2.0", | ||
| "bumpp": "^10.4.1", | ||
| "tsup": "^8.5.1", | ||
| "typescript": "^5.5.0" | ||
| }, | ||
|
Comment on lines
+41
to
+48
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add "devDependencies": {
"@opencode-ai/plugin": "^1.14.18",
"@opencode-ai/sdk": "^1.0.0",
"@types/bun": "^1.2.0",
"bumpp": "^10.4.1",
"jsonc-parser": "^3.3.1",
"tsup": "^8.5.1",
"typescript": "^5.5.0",
"zod": "^3.24.0"
}, |
||
| "engines": { | ||
| "node": ">=20.3.0", | ||
| "bun": ">=1.0.0" | ||
| }, | ||
| "keywords": [ | ||
| "opencode", | ||
| "opencode-plugin", | ||
| "worktree", | ||
| "workspace", | ||
| "git", | ||
| "multi-repo" | ||
| ], | ||
| "license": "MIT" | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| ## Summary | ||
|
|
||
| Prepare the fork for independent npm publishing by updating package metadata and project configuration. | ||
|
|
||
| ## Changes | ||
|
|
||
| - **package.json**: Rename from `@opencode-ai/plugin-worktree` to `opencode-worktree` to avoid npm scope conflict | ||
| - Added `exports` field for ESM best practice | ||
| - Added `author`, `homepage`, `repository` pointing to fork | ||
| - Moved runtime deps (`jsonc-parser`, `zod`) to top-level `dependencies` | ||
| - Added `opencode-plugin` and `multi-repo` keywords | ||
| - **.gitignore**: Expanded to production standard (node_modules, dist, env, IDE, OS, spec/agent state) | ||
| - **CLAUDE.md**: Replaced repository-ownership guidelines with project-specific coding guidelines (Think Before Coding, Simplicity First, Surgical Changes, Goal-Driven Execution) | ||
|
|
||
| ## Test Plan | ||
|
|
||
| - `npm run build` — verify tsup builds successfully | ||
| - `npm run typecheck` — verify TypeScript compiles without errors | ||
| - `npm publish --dry-run` — verify package can be published (no scope conflict) | ||
|
|
||
| ## Root Cause | ||
|
|
||
| The original `@opencode-ai/plugin-worktree` name requires npm org membership to publish. Since this is a fork for independent publishing, we need a non-scoped or own-scope package name. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| { | ||
| "compilerOptions": { | ||
| "target": "ES2022", | ||
| "module": "ESNext", | ||
| "moduleResolution": "Bundler", | ||
| "lib": ["ES2022"], | ||
| "rootDir": "src", | ||
| "outDir": "dist", | ||
| "strict": true, | ||
| "esModuleInterop": true, | ||
| "skipLibCheck": true, | ||
| "types": ["bun-types"], | ||
| "declaration": true, | ||
| "declarationMap": true, | ||
| "sourceMap": true, | ||
| "resolveJsonModule": true, | ||
| "isolatedModules": true, | ||
| "noEmit": true, | ||
| "noFallthroughCasesInSwitch": true, | ||
| "noUncheckedIndexedAccess": true, | ||
| "noImplicitOverride": true, | ||
| "verbatimModuleSyntax": true | ||
| }, | ||
| "include": ["src/**/*.ts"], | ||
| "exclude": ["node_modules", "dist"] | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since
jsonc-parserandzodare bundled into the final output (vianoExternalintsup.config.ts), they do not need to be listed as runtimedependencies. Moving them todevDependencieswill prevent unnecessary installations for users of the package."dependencies": {},