Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .claude/scheduled_tasks.lock

This file was deleted.

29 changes: 29 additions & 0 deletions .github/workflows/claude-code-review.yml
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 }}'
39 changes: 39 additions & 0 deletions .github/workflows/claude.yml
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
41 changes: 41 additions & 0 deletions .github/workflows/publish.yml
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 }}
36 changes: 35 additions & 1 deletion .gitignore
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/
29 changes: 29 additions & 0 deletions .npmignore
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/
80 changes: 65 additions & 15 deletions CLAUDE.md
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.
62 changes: 62 additions & 0 deletions package.json
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"
},
Comment on lines +33 to +36
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Since jsonc-parser and zod are bundled into the final output (via noExternal in tsup.config.ts), they do not need to be listed as runtime dependencies. Moving them to devDependencies will prevent unnecessary installations for users of the package.

  "dependencies": {},

"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
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Add jsonc-parser and zod to devDependencies since they are bundled at build time and not required as runtime dependencies by the consumer.

  "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"
}
23 changes: 23 additions & 0 deletions pr-body.txt
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.
26 changes: 26 additions & 0 deletions tsconfig.json
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"]
}
Loading
Loading