Skip to content

Commit 667aafc

Browse files
authored
Merge pull request #2 from NeverMore93/fork-publishing-changes
refactor: fork publishing setup (package.json rename, .gitignore, CLAUDE.md)
2 parents ac1b7ab + 482bbc4 commit 667aafc

11 files changed

Lines changed: 372 additions & 17 deletions

File tree

.claude/scheduled_tasks.lock

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Claude Code Review
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, ready_for_review, reopened]
6+
7+
jobs:
8+
claude-review:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
pull-requests: read
13+
issues: read
14+
id-token: write
15+
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 1
21+
22+
- name: Run Claude Code Review
23+
id: claude-review
24+
uses: anthropics/claude-code-action@v1
25+
with:
26+
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
27+
plugin_marketplaces: 'https://github.com/anthropics/claude-code.git'
28+
plugins: 'code-review@claude-code-plugins'
29+
prompt: '/code-review:code-review ${{ github.repository }}/pull/${{ github.event.pull_request.number }}'

.github/workflows/claude.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Claude Code
2+
3+
on:
4+
issue_comment:
5+
types: [created]
6+
pull_request_review_comment:
7+
types: [created]
8+
issues:
9+
types: [opened, assigned]
10+
pull_request_review:
11+
types: [submitted]
12+
13+
jobs:
14+
claude:
15+
if: |
16+
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
17+
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
18+
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
19+
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
20+
runs-on: ubuntu-latest
21+
permissions:
22+
contents: read
23+
pull-requests: read
24+
issues: read
25+
id-token: write
26+
actions: read
27+
steps:
28+
- name: Checkout repository
29+
uses: actions/checkout@v4
30+
with:
31+
fetch-depth: 1
32+
33+
- name: Run Claude Code
34+
id: claude
35+
uses: anthropics/claude-code-action@v1
36+
with:
37+
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
38+
additional_permissions: |
39+
actions: read

.github/workflows/publish.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Publish to npm
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
id-token: write
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
18+
- name: Set up Bun
19+
uses: oven-sh/setup-bun@v2
20+
with:
21+
bun-version: latest
22+
23+
- name: Install dependencies
24+
run: bun install
25+
26+
- name: Type check
27+
run: bun run typecheck
28+
29+
- name: Build
30+
run: bun run build
31+
32+
- name: Set up Node.js
33+
uses: actions/setup-node@v4
34+
with:
35+
node-version: '20'
36+
registry-url: 'https://registry.npmjs.org'
37+
38+
- name: Publish to npm
39+
run: npm publish
40+
env:
41+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,35 @@
1-
/.idea/
1+
# Dependencies
2+
node_modules/
3+
4+
# Build output
5+
dist/
6+
7+
# Environment
8+
.env*
9+
10+
# IDE
11+
.idea/
12+
.vscode/
13+
.cursor/
14+
15+
# OS
16+
.DS_Store
17+
Thumbs.db
18+
19+
# Bun
20+
bun.lockb
21+
22+
# Package archives
23+
*.tgz
24+
25+
# Coverage
26+
coverage/
27+
28+
# Logs
29+
logs/
30+
31+
# SpecKit / Agent state (tracked separately)
32+
.specify/
33+
.agents/
34+
.claude/
35+
specs/

.npmignore

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Source
2+
src/
3+
4+
# Tests
5+
tests/
6+
7+
# Specs and design docs
8+
specs/
9+
.specify/
10+
11+
# Agent/skill directories
12+
.agents/
13+
.claude/
14+
15+
# GitHub workflows
16+
.github/
17+
18+
# Project config
19+
AGENTS.md
20+
CLAUDE.md
21+
tsconfig.json
22+
tsup.config.ts
23+
bun.lock
24+
bun.lockb
25+
26+
# IDE
27+
.idea/
28+
.vscode/
29+
.cursor/

CLAUDE.md

Lines changed: 65 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,67 @@
11
# CLAUDE.md
22

3-
## Responsibility Boundary
4-
- This repository owns the facade implementation, stable project memory, SpecKit assets, feature specifications, and repo-local agent guidance for the OpenCode worktree plugin.
5-
- Child directories may narrow these rules with their own `CLAUDE.md`; the nearest file wins for its subtree.
6-
7-
## Allowed Content
8-
- Plugin source code under `src/`
9-
- Specification workflow assets under `.specify/`, including stable memory under `.specify/memory/`
10-
- Agent workflow assets under `.claude/` and `.agents/`, including lightweight repo-local skills
11-
- Feature specs, plans, tasks, checklists, context, and case breakdowns under `specs/`
12-
- Minimal top-level documentation such as `README.md`, `AGENTS.md`, and this file
13-
14-
## Forbidden Content
15-
- Generated build outputs, vendored dependencies, secrets, or local machine state
16-
- Unrelated applications, experiments, or copied OCX monorepo code that is not maintained here
17-
- Files placed in a directory whose ownership belongs to a more specific child contract
3+
Behavioral guidelines to reduce common LLM coding mistakes. Merge with project-specific instructions as needed.
4+
5+
**Tradeoff:** These guidelines bias toward caution over speed. For trivial tasks, use judgment.
6+
7+
## Project-Specific Guidelines
8+
9+
### 1. Think Before Coding
10+
11+
**Don't assume. Don't hide confusion. Surface tradeoffs.**
12+
13+
Before implementing:
14+
- State your assumptions explicitly. If uncertain, ask.
15+
- If multiple interpretations exist, present them - don't pick silently.
16+
- If a simpler approach exists, say so. Push back when warranted.
17+
- If something is unclear, stop. Name what's confusing. Ask.
18+
19+
### 2. Simplicity First
20+
21+
**Minimum code that solves the problem. Nothing speculative.**
22+
23+
- No features beyond what was asked.
24+
- No abstractions for single-use code.
25+
- No "flexibility" or "configurability" that wasn't requested.
26+
- No error handling for impossible scenarios.
27+
- If you write 200 lines and it could be 50, rewrite it.
28+
29+
Ask yourself: "Would a senior engineer say this is overcomplicated?" If yes, simplify.
30+
31+
### 3. Surgical Changes
32+
33+
**Touch only what you must. Clean up only your own mess.**
34+
35+
When editing existing code:
36+
- Don't "improve" adjacent code, comments, or formatting.
37+
- Don't refactor things that aren't broken.
38+
- Match existing style, even if you'd do it differently.
39+
- If you notice unrelated dead code, mention it - don't delete it.
40+
41+
When your changes create orphans:
42+
- Remove imports/variables/functions that YOUR changes made unused.
43+
- Don't remove pre-existing dead code unless asked.
44+
45+
The test: Every changed line should trace directly to the user's request.
46+
47+
### 4. Goal-Driven Execution
48+
49+
**Define success criteria. Loop until verified.**
50+
51+
Transform tasks into verifiable goals:
52+
- "Add validation" → "Write tests for invalid inputs, then make them pass"
53+
- "Fix the bug" → "Write a test that reproduces it, then make it pass"
54+
- "Refactor X" → "Ensure tests pass before and after"
55+
56+
For multi-step tasks, state a brief plan:
57+
```
58+
1. [Step] → verify: [check]
59+
2. [Step] → verify: [check]
60+
3. [Step] → verify: [check]
61+
```
62+
63+
Strong success criteria let you loop independently. Weak criteria ("make it work") require constant clarification.
64+
65+
---
66+
67+
**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.

package.json

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{
2+
"name": "opencode-worktree",
3+
"version": "0.1.0",
4+
"description": "OpenCode plugin for multi-repo workspace worktree orchestration",
5+
"type": "module",
6+
"main": "dist/plugin/worktree.js",
7+
"types": "dist/plugin/worktree.d.ts",
8+
"exports": {
9+
".": {
10+
"types": "./dist/plugin/worktree.d.ts",
11+
"default": "./dist/plugin/worktree.js"
12+
}
13+
},
14+
"files": [
15+
"dist",
16+
"README.md",
17+
"LICENSE"
18+
],
19+
"scripts": {
20+
"build": "tsup",
21+
"dev": "tsup --watch",
22+
"typecheck": "tsc --noEmit",
23+
"test": "bun test",
24+
"prepublishOnly": "bun run build && bun run typecheck",
25+
"release": "bumpp"
26+
},
27+
"author": "NeverMore93",
28+
"repository": {
29+
"type": "git",
30+
"url": "https://github.com/NeverMore93/opencode-worktree"
31+
},
32+
"homepage": "https://github.com/NeverMore93/opencode-worktree#readme",
33+
"dependencies": {
34+
"jsonc-parser": "^3.3.1",
35+
"zod": "^3.24.0"
36+
},
37+
"peerDependencies": {
38+
"@opencode-ai/plugin": ">=1.1.0",
39+
"@opencode-ai/sdk": ">=1.0.0"
40+
},
41+
"devDependencies": {
42+
"@opencode-ai/plugin": "^1.14.18",
43+
"@opencode-ai/sdk": "^1.0.0",
44+
"@types/bun": "^1.2.0",
45+
"bumpp": "^10.4.1",
46+
"tsup": "^8.5.1",
47+
"typescript": "^5.5.0"
48+
},
49+
"engines": {
50+
"node": ">=20.3.0",
51+
"bun": ">=1.0.0"
52+
},
53+
"keywords": [
54+
"opencode",
55+
"opencode-plugin",
56+
"worktree",
57+
"workspace",
58+
"git",
59+
"multi-repo"
60+
],
61+
"license": "MIT"
62+
}

pr-body.txt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
## Summary
2+
3+
Prepare the fork for independent npm publishing by updating package metadata and project configuration.
4+
5+
## Changes
6+
7+
- **package.json**: Rename from `@opencode-ai/plugin-worktree` to `opencode-worktree` to avoid npm scope conflict
8+
- Added `exports` field for ESM best practice
9+
- Added `author`, `homepage`, `repository` pointing to fork
10+
- Moved runtime deps (`jsonc-parser`, `zod`) to top-level `dependencies`
11+
- Added `opencode-plugin` and `multi-repo` keywords
12+
- **.gitignore**: Expanded to production standard (node_modules, dist, env, IDE, OS, spec/agent state)
13+
- **CLAUDE.md**: Replaced repository-ownership guidelines with project-specific coding guidelines (Think Before Coding, Simplicity First, Surgical Changes, Goal-Driven Execution)
14+
15+
## Test Plan
16+
17+
- `npm run build` — verify tsup builds successfully
18+
- `npm run typecheck` — verify TypeScript compiles without errors
19+
- `npm publish --dry-run` — verify package can be published (no scope conflict)
20+
21+
## Root Cause
22+
23+
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.

tsconfig.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"compilerOptions": {
3+
"target": "ES2022",
4+
"module": "ESNext",
5+
"moduleResolution": "Bundler",
6+
"lib": ["ES2022"],
7+
"rootDir": "src",
8+
"outDir": "dist",
9+
"strict": true,
10+
"esModuleInterop": true,
11+
"skipLibCheck": true,
12+
"types": ["bun-types"],
13+
"declaration": true,
14+
"declarationMap": true,
15+
"sourceMap": true,
16+
"resolveJsonModule": true,
17+
"isolatedModules": true,
18+
"noEmit": true,
19+
"noFallthroughCasesInSwitch": true,
20+
"noUncheckedIndexedAccess": true,
21+
"noImplicitOverride": true,
22+
"verbatimModuleSyntax": true
23+
},
24+
"include": ["src/**/*.ts"],
25+
"exclude": ["node_modules", "dist"]
26+
}

0 commit comments

Comments
 (0)