oh-my-claude-sisyphus 3.6.1 → 3.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/commands/psm.md +180 -0
- package/dist/__tests__/analytics/analytics-summary.test.d.ts +2 -0
- package/dist/__tests__/analytics/analytics-summary.test.d.ts.map +1 -0
- package/dist/__tests__/analytics/analytics-summary.test.js +267 -0
- package/dist/__tests__/analytics/analytics-summary.test.js.map +1 -0
- package/dist/__tests__/analytics/cost-estimator.test.d.ts +2 -0
- package/dist/__tests__/analytics/cost-estimator.test.d.ts.map +1 -0
- package/dist/__tests__/analytics/cost-estimator.test.js +212 -0
- package/dist/__tests__/analytics/cost-estimator.test.js.map +1 -0
- package/dist/__tests__/hooks/auto-slash-command/executor.test.d.ts +7 -0
- package/dist/__tests__/hooks/auto-slash-command/executor.test.d.ts.map +1 -0
- package/dist/__tests__/hooks/auto-slash-command/executor.test.js +374 -0
- package/dist/__tests__/hooks/auto-slash-command/executor.test.js.map +1 -0
- package/dist/__tests__/hud/auto-tracking.integration.test.d.ts +2 -0
- package/dist/__tests__/hud/auto-tracking.integration.test.d.ts.map +1 -0
- package/dist/__tests__/hud/auto-tracking.integration.test.js +12 -0
- package/dist/__tests__/hud/auto-tracking.integration.test.js.map +1 -0
- package/dist/__tests__/learned-skills/config.test.d.ts +2 -0
- package/dist/__tests__/learned-skills/config.test.d.ts.map +1 -0
- package/dist/__tests__/learned-skills/config.test.js +37 -0
- package/dist/__tests__/learned-skills/config.test.js.map +1 -0
- package/dist/__tests__/learned-skills/detector.test.d.ts +2 -0
- package/dist/__tests__/learned-skills/detector.test.d.ts.map +1 -0
- package/dist/__tests__/learned-skills/detector.test.js +99 -0
- package/dist/__tests__/learned-skills/detector.test.js.map +1 -0
- package/dist/__tests__/learned-skills/finder.test.d.ts +2 -0
- package/dist/__tests__/learned-skills/finder.test.d.ts.map +1 -0
- package/dist/__tests__/learned-skills/finder.test.js +59 -0
- package/dist/__tests__/learned-skills/finder.test.js.map +1 -0
- package/dist/__tests__/learned-skills/loader.test.d.ts +2 -0
- package/dist/__tests__/learned-skills/loader.test.d.ts.map +1 -0
- package/dist/__tests__/learned-skills/loader.test.js +69 -0
- package/dist/__tests__/learned-skills/loader.test.js.map +1 -0
- package/dist/__tests__/learned-skills/parser.test.d.ts +2 -0
- package/dist/__tests__/learned-skills/parser.test.d.ts.map +1 -0
- package/dist/__tests__/learned-skills/parser.test.js +81 -0
- package/dist/__tests__/learned-skills/parser.test.js.map +1 -0
- package/dist/__tests__/learned-skills/validator.test.d.ts +2 -0
- package/dist/__tests__/learned-skills/validator.test.d.ts.map +1 -0
- package/dist/__tests__/learned-skills/validator.test.js +85 -0
- package/dist/__tests__/learned-skills/validator.test.js.map +1 -0
- package/dist/agents/codex-agents.d.ts +20 -0
- package/dist/agents/codex-agents.d.ts.map +1 -0
- package/dist/agents/codex-agents.js +36 -0
- package/dist/agents/codex-agents.js.map +1 -0
- package/dist/agents/document-writer.d.ts +11 -0
- package/dist/agents/document-writer.d.ts.map +1 -0
- package/dist/agents/document-writer.js +209 -0
- package/dist/agents/document-writer.js.map +1 -0
- package/dist/agents/frontend-engineer.d.ts +11 -0
- package/dist/agents/frontend-engineer.d.ts.map +1 -0
- package/dist/agents/frontend-engineer.js +115 -0
- package/dist/agents/frontend-engineer.js.map +1 -0
- package/dist/agents/librarian.d.ts +12 -0
- package/dist/agents/librarian.d.ts.map +1 -0
- package/dist/agents/librarian.js +103 -0
- package/dist/agents/librarian.js.map +1 -0
- package/dist/agents/metis.d.ts +12 -0
- package/dist/agents/metis.d.ts.map +1 -0
- package/dist/agents/metis.js +117 -0
- package/dist/agents/metis.js.map +1 -0
- package/dist/agents/momus.d.ts +12 -0
- package/dist/agents/momus.d.ts.map +1 -0
- package/dist/agents/momus.js +128 -0
- package/dist/agents/momus.js.map +1 -0
- package/dist/agents/multimodal-looker.d.ts +11 -0
- package/dist/agents/multimodal-looker.d.ts.map +1 -0
- package/dist/agents/multimodal-looker.js +70 -0
- package/dist/agents/multimodal-looker.js.map +1 -0
- package/dist/agents/oracle.d.ts +13 -0
- package/dist/agents/oracle.d.ts.map +1 -0
- package/dist/agents/oracle.js +191 -0
- package/dist/agents/oracle.js.map +1 -0
- package/dist/agents/orchestrator-sisyphus.d.ts +11 -0
- package/dist/agents/orchestrator-sisyphus.d.ts.map +1 -0
- package/dist/agents/orchestrator-sisyphus.js +115 -0
- package/dist/agents/orchestrator-sisyphus.js.map +1 -0
- package/dist/agents/prometheus.d.ts +12 -0
- package/dist/agents/prometheus.d.ts.map +1 -0
- package/dist/agents/prometheus.js +195 -0
- package/dist/agents/prometheus.js.map +1 -0
- package/dist/agents/sisyphus-junior.d.ts +12 -0
- package/dist/agents/sisyphus-junior.d.ts.map +1 -0
- package/dist/agents/sisyphus-junior.js +93 -0
- package/dist/agents/sisyphus-junior.js.map +1 -0
- package/dist/cli/analytics.js +0 -0
- package/dist/cli/components/CostDashboard.d.ts +15 -0
- package/dist/cli/components/CostDashboard.d.ts.map +1 -0
- package/dist/cli/components/CostDashboard.js +15 -0
- package/dist/cli/components/CostDashboard.js.map +1 -0
- package/dist/cli/components/LiveStats.d.ts +16 -0
- package/dist/cli/components/LiveStats.d.ts.map +1 -0
- package/dist/cli/components/LiveStats.js +16 -0
- package/dist/cli/components/LiveStats.js.map +1 -0
- package/dist/cli/components/SessionBrowser.d.ts +14 -0
- package/dist/cli/components/SessionBrowser.d.ts.map +1 -0
- package/dist/cli/components/SessionBrowser.js +14 -0
- package/dist/cli/components/SessionBrowser.js.map +1 -0
- package/dist/cli/index.js +0 -0
- package/dist/cli/tui.d.ts +21 -0
- package/dist/cli/tui.d.ts.map +1 -0
- package/dist/cli/tui.js +21 -0
- package/dist/cli/tui.js.map +1 -0
- package/dist/hooks/autopilot/signals.d.ts +20 -0
- package/dist/hooks/autopilot/signals.d.ts.map +1 -0
- package/dist/hooks/autopilot/signals.js +75 -0
- package/dist/hooks/autopilot/signals.js.map +1 -0
- package/dist/hooks/autopilot/summary.d.ts +27 -0
- package/dist/hooks/autopilot/summary.d.ts.map +1 -0
- package/dist/hooks/autopilot/summary.js +160 -0
- package/dist/hooks/autopilot/summary.js.map +1 -0
- package/dist/hooks/autopilot/transition.d.ts +39 -0
- package/dist/hooks/autopilot/transition.d.ts.map +1 -0
- package/dist/hooks/autopilot/transition.js +216 -0
- package/dist/hooks/autopilot/transition.js.map +1 -0
- package/dist/hooks/context-window-limit-recovery/constants.d.ts +28 -0
- package/dist/hooks/context-window-limit-recovery/constants.d.ts.map +1 -0
- package/dist/hooks/context-window-limit-recovery/constants.js +85 -0
- package/dist/hooks/context-window-limit-recovery/constants.js.map +1 -0
- package/dist/hooks/context-window-limit-recovery/index.d.ts +62 -0
- package/dist/hooks/context-window-limit-recovery/index.d.ts.map +1 -0
- package/dist/hooks/context-window-limit-recovery/index.js +201 -0
- package/dist/hooks/context-window-limit-recovery/index.js.map +1 -0
- package/dist/hooks/context-window-limit-recovery/parser.d.ts +31 -0
- package/dist/hooks/context-window-limit-recovery/parser.d.ts.map +1 -0
- package/dist/hooks/context-window-limit-recovery/parser.js +241 -0
- package/dist/hooks/context-window-limit-recovery/parser.js.map +1 -0
- package/dist/hooks/context-window-limit-recovery/types.d.ts +84 -0
- package/dist/hooks/context-window-limit-recovery/types.d.ts.map +1 -0
- package/dist/hooks/context-window-limit-recovery/types.js +34 -0
- package/dist/hooks/context-window-limit-recovery/types.js.map +1 -0
- package/dist/hooks/edit-error-recovery/index.d.ts +62 -0
- package/dist/hooks/edit-error-recovery/index.d.ts.map +1 -0
- package/dist/hooks/edit-error-recovery/index.js +89 -0
- package/dist/hooks/edit-error-recovery/index.js.map +1 -0
- package/dist/hooks/learned-skills/config.d.ts +53 -0
- package/dist/hooks/learned-skills/config.d.ts.map +1 -0
- package/dist/hooks/learned-skills/config.js +103 -0
- package/dist/hooks/learned-skills/config.js.map +1 -0
- package/dist/hooks/learned-skills/constants.d.ts +24 -0
- package/dist/hooks/learned-skills/constants.d.ts.map +1 -0
- package/dist/hooks/learned-skills/constants.js +26 -0
- package/dist/hooks/learned-skills/constants.js.map +1 -0
- package/dist/hooks/learned-skills/detection-hook.d.ts +39 -0
- package/dist/hooks/learned-skills/detection-hook.d.ts.map +1 -0
- package/dist/hooks/learned-skills/detection-hook.js +83 -0
- package/dist/hooks/learned-skills/detection-hook.js.map +1 -0
- package/dist/hooks/learned-skills/detector.d.ts +30 -0
- package/dist/hooks/learned-skills/detector.d.ts.map +1 -0
- package/dist/hooks/learned-skills/detector.js +150 -0
- package/dist/hooks/learned-skills/detector.js.map +1 -0
- package/dist/hooks/learned-skills/finder.d.ts +21 -0
- package/dist/hooks/learned-skills/finder.d.ts.map +1 -0
- package/dist/hooks/learned-skills/finder.js +117 -0
- package/dist/hooks/learned-skills/finder.js.map +1 -0
- package/dist/hooks/learned-skills/index.d.ts +62 -0
- package/dist/hooks/learned-skills/index.d.ts.map +1 -0
- package/dist/hooks/learned-skills/index.js +137 -0
- package/dist/hooks/learned-skills/index.js.map +1 -0
- package/dist/hooks/learned-skills/loader.d.ts +20 -0
- package/dist/hooks/learned-skills/loader.d.ts.map +1 -0
- package/dist/hooks/learned-skills/loader.js +107 -0
- package/dist/hooks/learned-skills/loader.js.map +1 -0
- package/dist/hooks/learned-skills/parser.d.ts +21 -0
- package/dist/hooks/learned-skills/parser.d.ts.map +1 -0
- package/dist/hooks/learned-skills/parser.js +190 -0
- package/dist/hooks/learned-skills/parser.js.map +1 -0
- package/dist/hooks/learned-skills/promotion.d.ts +29 -0
- package/dist/hooks/learned-skills/promotion.d.ts.map +1 -0
- package/dist/hooks/learned-skills/promotion.js +87 -0
- package/dist/hooks/learned-skills/promotion.js.map +1 -0
- package/dist/hooks/learned-skills/types.d.ts +109 -0
- package/dist/hooks/learned-skills/types.d.ts.map +1 -0
- package/dist/hooks/learned-skills/types.js +8 -0
- package/dist/hooks/learned-skills/types.js.map +1 -0
- package/dist/hooks/learned-skills/validator.d.ts +15 -0
- package/dist/hooks/learned-skills/validator.d.ts.map +1 -0
- package/dist/hooks/learned-skills/validator.js +87 -0
- package/dist/hooks/learned-skills/validator.js.map +1 -0
- package/dist/hooks/learned-skills/writer.d.ts +27 -0
- package/dist/hooks/learned-skills/writer.d.ts.map +1 -0
- package/dist/hooks/learned-skills/writer.js +126 -0
- package/dist/hooks/learned-skills/writer.js.map +1 -0
- package/dist/hooks/mnemosyne/config.d.ts +53 -0
- package/dist/hooks/mnemosyne/config.d.ts.map +1 -0
- package/dist/hooks/mnemosyne/config.js +103 -0
- package/dist/hooks/mnemosyne/config.js.map +1 -0
- package/dist/hooks/mnemosyne/constants.d.ts +24 -0
- package/dist/hooks/mnemosyne/constants.d.ts.map +1 -0
- package/dist/hooks/mnemosyne/constants.js +26 -0
- package/dist/hooks/mnemosyne/constants.js.map +1 -0
- package/dist/hooks/mnemosyne/detection-hook.d.ts +39 -0
- package/dist/hooks/mnemosyne/detection-hook.d.ts.map +1 -0
- package/dist/hooks/mnemosyne/detection-hook.js +83 -0
- package/dist/hooks/mnemosyne/detection-hook.js.map +1 -0
- package/dist/hooks/mnemosyne/detector.d.ts +30 -0
- package/dist/hooks/mnemosyne/detector.d.ts.map +1 -0
- package/dist/hooks/mnemosyne/detector.js +150 -0
- package/dist/hooks/mnemosyne/detector.js.map +1 -0
- package/dist/hooks/mnemosyne/finder.d.ts +21 -0
- package/dist/hooks/mnemosyne/finder.d.ts.map +1 -0
- package/dist/hooks/mnemosyne/finder.js +117 -0
- package/dist/hooks/mnemosyne/finder.js.map +1 -0
- package/dist/hooks/mnemosyne/index.d.ts +62 -0
- package/dist/hooks/mnemosyne/index.d.ts.map +1 -0
- package/dist/hooks/mnemosyne/index.js +137 -0
- package/dist/hooks/mnemosyne/index.js.map +1 -0
- package/dist/hooks/mnemosyne/loader.d.ts +20 -0
- package/dist/hooks/mnemosyne/loader.d.ts.map +1 -0
- package/dist/hooks/mnemosyne/loader.js +113 -0
- package/dist/hooks/mnemosyne/loader.js.map +1 -0
- package/dist/hooks/mnemosyne/parser.d.ts +21 -0
- package/dist/hooks/mnemosyne/parser.d.ts.map +1 -0
- package/dist/hooks/mnemosyne/parser.js +190 -0
- package/dist/hooks/mnemosyne/parser.js.map +1 -0
- package/dist/hooks/mnemosyne/promotion.d.ts +29 -0
- package/dist/hooks/mnemosyne/promotion.d.ts.map +1 -0
- package/dist/hooks/mnemosyne/promotion.js +87 -0
- package/dist/hooks/mnemosyne/promotion.js.map +1 -0
- package/dist/hooks/mnemosyne/types.d.ts +109 -0
- package/dist/hooks/mnemosyne/types.d.ts.map +1 -0
- package/dist/hooks/mnemosyne/types.js +8 -0
- package/dist/hooks/mnemosyne/types.js.map +1 -0
- package/dist/hooks/mnemosyne/validator.d.ts +15 -0
- package/dist/hooks/mnemosyne/validator.d.ts.map +1 -0
- package/dist/hooks/mnemosyne/validator.js +87 -0
- package/dist/hooks/mnemosyne/validator.js.map +1 -0
- package/dist/hooks/mnemosyne/writer.d.ts +27 -0
- package/dist/hooks/mnemosyne/writer.d.ts.map +1 -0
- package/dist/hooks/mnemosyne/writer.js +126 -0
- package/dist/hooks/mnemosyne/writer.js.map +1 -0
- package/dist/hooks/ralph-loop/index.d.ts +116 -0
- package/dist/hooks/ralph-loop/index.d.ts.map +1 -0
- package/dist/hooks/ralph-loop/index.js +322 -0
- package/dist/hooks/ralph-loop/index.js.map +1 -0
- package/dist/hooks/ralph-prd/index.d.ts +130 -0
- package/dist/hooks/ralph-prd/index.d.ts.map +1 -0
- package/dist/hooks/ralph-prd/index.js +310 -0
- package/dist/hooks/ralph-prd/index.js.map +1 -0
- package/dist/hooks/ralph-progress/index.d.ts +102 -0
- package/dist/hooks/ralph-progress/index.d.ts.map +1 -0
- package/dist/hooks/ralph-progress/index.js +408 -0
- package/dist/hooks/ralph-progress/index.js.map +1 -0
- package/dist/hooks/ralph-verifier/index.d.ts +72 -0
- package/dist/hooks/ralph-verifier/index.d.ts.map +1 -0
- package/dist/hooks/ralph-verifier/index.js +223 -0
- package/dist/hooks/ralph-verifier/index.js.map +1 -0
- package/dist/hooks/session-recovery/constants.d.ts +56 -0
- package/dist/hooks/session-recovery/constants.d.ts.map +1 -0
- package/dist/hooks/session-recovery/constants.js +78 -0
- package/dist/hooks/session-recovery/constants.js.map +1 -0
- package/dist/hooks/session-recovery/index.d.ts +53 -0
- package/dist/hooks/session-recovery/index.d.ts.map +1 -0
- package/dist/hooks/session-recovery/index.js +321 -0
- package/dist/hooks/session-recovery/index.js.map +1 -0
- package/dist/hooks/session-recovery/storage.d.ts +76 -0
- package/dist/hooks/session-recovery/storage.d.ts.map +1 -0
- package/dist/hooks/session-recovery/storage.js +383 -0
- package/dist/hooks/session-recovery/storage.js.map +1 -0
- package/dist/hooks/session-recovery/types.d.ts +145 -0
- package/dist/hooks/session-recovery/types.d.ts.map +1 -0
- package/dist/hooks/session-recovery/types.js +8 -0
- package/dist/hooks/session-recovery/types.js.map +1 -0
- package/dist/hooks/sisyphus-orchestrator/constants.d.ts +23 -0
- package/dist/hooks/sisyphus-orchestrator/constants.d.ts.map +1 -0
- package/dist/hooks/sisyphus-orchestrator/constants.js +142 -0
- package/dist/hooks/sisyphus-orchestrator/constants.js.map +1 -0
- package/dist/hooks/sisyphus-orchestrator/index.d.ts +113 -0
- package/dist/hooks/sisyphus-orchestrator/index.d.ts.map +1 -0
- package/dist/hooks/sisyphus-orchestrator/index.js +309 -0
- package/dist/hooks/sisyphus-orchestrator/index.js.map +1 -0
- package/dist/hooks/subagent-tracker/index.d.ts +83 -0
- package/dist/hooks/subagent-tracker/index.d.ts.map +1 -0
- package/dist/hooks/subagent-tracker/index.js +207 -0
- package/dist/hooks/subagent-tracker/index.js.map +1 -0
- package/dist/hooks/ultraqa-loop/index.d.ts +94 -0
- package/dist/hooks/ultraqa-loop/index.d.ts.map +1 -0
- package/dist/hooks/ultraqa-loop/index.js +216 -0
- package/dist/hooks/ultraqa-loop/index.js.map +1 -0
- package/dist/hooks/ultrawork-state/index.d.ts +62 -0
- package/dist/hooks/ultrawork-state/index.d.ts.map +1 -0
- package/dist/hooks/ultrawork-state/index.js +208 -0
- package/dist/hooks/ultrawork-state/index.js.map +1 -0
- package/dist/hud/sisyphus-state.d.ts +31 -0
- package/dist/hud/sisyphus-state.d.ts.map +1 -0
- package/dist/hud/sisyphus-state.js +163 -0
- package/dist/hud/sisyphus-state.js.map +1 -0
- package/docs/design/project-session-manager.md +1033 -0
- package/package.json +1 -1
- package/skills/project-session-manager/SKILL.md +410 -0
- package/skills/project-session-manager/lib/config.sh +86 -0
- package/skills/project-session-manager/lib/parse.sh +121 -0
- package/skills/project-session-manager/lib/session.sh +132 -0
- package/skills/project-session-manager/lib/tmux.sh +103 -0
- package/skills/project-session-manager/lib/worktree.sh +171 -0
- package/skills/project-session-manager/psm.sh +629 -0
- package/skills/project-session-manager/templates/feature.md +56 -0
- package/skills/project-session-manager/templates/issue-fix.md +57 -0
- package/skills/project-session-manager/templates/pr-review.md +65 -0
- package/skills/project-session-manager/templates/projects.json +19 -0
|
@@ -0,0 +1,1033 @@
|
|
|
1
|
+
# Project Session Manager (PSM) - Design Document
|
|
2
|
+
|
|
3
|
+
> **Skill Name:** `project-session-manager` (alias: `psm`)
|
|
4
|
+
> **Version:** 1.0.0
|
|
5
|
+
> **Author:** oh-my-claudecode
|
|
6
|
+
> **Status:** Design Draft
|
|
7
|
+
|
|
8
|
+
## Executive Summary
|
|
9
|
+
|
|
10
|
+
Project Session Manager (PSM) automates the creation and management of isolated development environments using git worktrees and tmux sessions with Claude Code. It enables parallel work across multiple tasks, projects, and repositories while maintaining clean separation and easy context switching.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Table of Contents
|
|
15
|
+
|
|
16
|
+
1. [Problem Statement](#1-problem-statement)
|
|
17
|
+
2. [Use Cases](#2-use-cases)
|
|
18
|
+
3. [Command Interface](#3-command-interface)
|
|
19
|
+
4. [Architecture](#4-architecture)
|
|
20
|
+
5. [Directory Structure](#5-directory-structure)
|
|
21
|
+
6. [Session Naming Conventions](#6-session-naming-conventions)
|
|
22
|
+
7. [Workflow Presets](#7-workflow-presets)
|
|
23
|
+
8. [State Management](#8-state-management)
|
|
24
|
+
9. [Cleanup Strategies](#9-cleanup-strategies)
|
|
25
|
+
10. [Integration Points](#10-integration-points)
|
|
26
|
+
11. [Edge Cases & Error Handling](#11-edge-cases--error-handling)
|
|
27
|
+
12. [Security Considerations](#12-security-considerations)
|
|
28
|
+
13. [Future Enhancements](#13-future-enhancements)
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## 1. Problem Statement
|
|
33
|
+
|
|
34
|
+
### Current Pain Points
|
|
35
|
+
|
|
36
|
+
1. **Context Switching Overhead**: Switching between tasks requires stashing changes, switching branches, and losing Claude Code context
|
|
37
|
+
2. **PR Review Isolation**: Reviewing PRs often contaminates the working directory
|
|
38
|
+
3. **Parallel Work Limitation**: Can only work on one task at a time per repository
|
|
39
|
+
4. **Session Management**: Manual tmux session creation is tedious and inconsistent
|
|
40
|
+
5. **Cleanup Burden**: Orphaned worktrees and sessions accumulate over time
|
|
41
|
+
|
|
42
|
+
### Solution
|
|
43
|
+
|
|
44
|
+
PSM provides a unified interface to:
|
|
45
|
+
- Create isolated worktrees with a single command
|
|
46
|
+
- Spawn pre-configured tmux sessions with Claude Code
|
|
47
|
+
- Track and manage all active sessions
|
|
48
|
+
- Automate cleanup of completed work
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## 2. Use Cases
|
|
53
|
+
|
|
54
|
+
### 2.1 PR Review
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
# Review PR #123 from oh-my-claudecode repo
|
|
58
|
+
/psm review omc#123
|
|
59
|
+
|
|
60
|
+
# Review PR from any GitHub URL
|
|
61
|
+
/psm review https://github.com/anthropics/claude-code/pull/456
|
|
62
|
+
|
|
63
|
+
# Review with specific focus
|
|
64
|
+
/psm review omc#123 --focus "security implications"
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
**What happens:**
|
|
68
|
+
1. Fetches PR branch
|
|
69
|
+
2. Creates worktree at `~/.psm/worktrees/omc/pr-123`
|
|
70
|
+
3. Spawns tmux session `psm:omc:pr-123`
|
|
71
|
+
4. Launches Claude Code with PR context pre-loaded
|
|
72
|
+
5. Opens diff in editor (optional)
|
|
73
|
+
|
|
74
|
+
### 2.2 Issue Fixing
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
# Fix issue #42
|
|
78
|
+
/psm fix omc#42
|
|
79
|
+
|
|
80
|
+
# Fix with branch name override
|
|
81
|
+
/psm fix omc#42 --branch fix/auth-timeout
|
|
82
|
+
|
|
83
|
+
# Fix from issue URL
|
|
84
|
+
/psm fix https://github.com/anthropics/claude-code/issues/789
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**What happens:**
|
|
88
|
+
1. Fetches issue details via `gh`
|
|
89
|
+
2. Creates feature branch from main
|
|
90
|
+
3. Creates worktree at `~/.psm/worktrees/omc/issue-42`
|
|
91
|
+
4. Spawns tmux session with issue context
|
|
92
|
+
5. Pre-populates Claude Code with issue description
|
|
93
|
+
|
|
94
|
+
### 2.3 Feature Development
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
# Start new feature
|
|
98
|
+
/psm feature omc "add-webhook-support"
|
|
99
|
+
|
|
100
|
+
# Feature from existing branch
|
|
101
|
+
/psm feature omc --branch feature/webhooks
|
|
102
|
+
|
|
103
|
+
# Feature with specific base
|
|
104
|
+
/psm feature omc "dark-mode" --base develop
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**What happens:**
|
|
108
|
+
1. Creates feature branch from specified base
|
|
109
|
+
2. Creates worktree
|
|
110
|
+
3. Spawns session with feature context
|
|
111
|
+
4. Optionally creates draft PR
|
|
112
|
+
|
|
113
|
+
### 2.4 Release Preparation
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
# Prepare release
|
|
117
|
+
/psm release omc v3.5.0
|
|
118
|
+
|
|
119
|
+
# Release candidate
|
|
120
|
+
/psm release omc v3.5.0-rc1 --draft
|
|
121
|
+
|
|
122
|
+
# Hotfix release
|
|
123
|
+
/psm release omc v3.4.1 --hotfix --base v3.4.0
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
**What happens:**
|
|
127
|
+
1. Creates release branch
|
|
128
|
+
2. Creates worktree
|
|
129
|
+
3. Spawns session with release checklist
|
|
130
|
+
4. Pre-loads CHANGELOG context
|
|
131
|
+
|
|
132
|
+
### 2.5 Session Management
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
# List all sessions
|
|
136
|
+
/psm list
|
|
137
|
+
|
|
138
|
+
# List sessions for specific project
|
|
139
|
+
/psm list omc
|
|
140
|
+
|
|
141
|
+
# Attach to existing session
|
|
142
|
+
/psm attach omc:pr-123
|
|
143
|
+
|
|
144
|
+
# Detach current session (return to main)
|
|
145
|
+
/psm detach
|
|
146
|
+
|
|
147
|
+
# Kill specific session
|
|
148
|
+
/psm kill omc:pr-123
|
|
149
|
+
|
|
150
|
+
# Kill all sessions for project
|
|
151
|
+
/psm kill omc --all
|
|
152
|
+
|
|
153
|
+
# Cleanup completed sessions
|
|
154
|
+
/psm cleanup
|
|
155
|
+
|
|
156
|
+
# Cleanup aggressively (force)
|
|
157
|
+
/psm cleanup --force --older-than 7d
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### 2.6 Quick Context Switch
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
# Switch to another session (detach current, attach target)
|
|
164
|
+
/psm switch omc:feature-auth
|
|
165
|
+
|
|
166
|
+
# Switch with session picker (fzf)
|
|
167
|
+
/psm switch
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## 3. Command Interface
|
|
173
|
+
|
|
174
|
+
### 3.1 Primary Commands
|
|
175
|
+
|
|
176
|
+
| Command | Description | Aliases |
|
|
177
|
+
|---------|-------------|---------|
|
|
178
|
+
| `review <ref>` | Start PR review session | `pr`, `r` |
|
|
179
|
+
| `fix <ref>` | Start issue fix session | `issue`, `i` |
|
|
180
|
+
| `feature <name>` | Start feature development | `feat`, `f` |
|
|
181
|
+
| `release <version>` | Start release preparation | `rel` |
|
|
182
|
+
| `list [project]` | List active sessions | `ls`, `l` |
|
|
183
|
+
| `attach <session>` | Attach to session | `a` |
|
|
184
|
+
| `detach` | Detach from current | `d` |
|
|
185
|
+
| `switch [session]` | Switch sessions | `sw`, `s` |
|
|
186
|
+
| `kill <session>` | Kill session | `k`, `rm` |
|
|
187
|
+
| `cleanup` | Clean up completed | `gc`, `clean` |
|
|
188
|
+
| `status` | Show current session info | `st` |
|
|
189
|
+
|
|
190
|
+
### 3.2 Global Flags
|
|
191
|
+
|
|
192
|
+
| Flag | Description | Default |
|
|
193
|
+
|------|-------------|---------|
|
|
194
|
+
| `--project`, `-p` | Project identifier or path | Current directory |
|
|
195
|
+
| `--no-claude` | Skip Claude Code launch | false |
|
|
196
|
+
| `--no-tmux` | Use current terminal | false |
|
|
197
|
+
| `--editor`, `-e` | Open in editor after | false |
|
|
198
|
+
| `--verbose`, `-v` | Verbose output | false |
|
|
199
|
+
| `--dry-run` | Show what would happen | false |
|
|
200
|
+
|
|
201
|
+
### 3.3 Project References
|
|
202
|
+
|
|
203
|
+
PSM supports multiple reference formats:
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
# Short alias (requires ~/.psm/projects.json config)
|
|
207
|
+
omc#123
|
|
208
|
+
|
|
209
|
+
# Full GitHub reference
|
|
210
|
+
anthropics/claude-code#123
|
|
211
|
+
|
|
212
|
+
# GitHub URL
|
|
213
|
+
https://github.com/anthropics/claude-code/pull/123
|
|
214
|
+
|
|
215
|
+
# Local path
|
|
216
|
+
/path/to/repo#123
|
|
217
|
+
|
|
218
|
+
# Current directory (implicit)
|
|
219
|
+
#123
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### 3.4 Project Aliases Configuration
|
|
223
|
+
|
|
224
|
+
```json
|
|
225
|
+
// ~/.psm/projects.json
|
|
226
|
+
{
|
|
227
|
+
"aliases": {
|
|
228
|
+
"omc": {
|
|
229
|
+
"repo": "anthropics/oh-my-claudecode",
|
|
230
|
+
"local": "~/Workspace/oh-my-claudecode",
|
|
231
|
+
"default_base": "main"
|
|
232
|
+
},
|
|
233
|
+
"cc": {
|
|
234
|
+
"repo": "anthropics/claude-code",
|
|
235
|
+
"local": "~/Workspace/claude-code",
|
|
236
|
+
"default_base": "main"
|
|
237
|
+
},
|
|
238
|
+
"myapp": {
|
|
239
|
+
"repo": "myorg/myapp",
|
|
240
|
+
"local": "~/Projects/myapp",
|
|
241
|
+
"default_base": "develop"
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
"defaults": {
|
|
245
|
+
"worktree_root": "~/.psm/worktrees",
|
|
246
|
+
"cleanup_after_days": 14,
|
|
247
|
+
"auto_cleanup_merged": true
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
## 4. Architecture
|
|
255
|
+
|
|
256
|
+
### 4.1 Component Overview
|
|
257
|
+
|
|
258
|
+
```
|
|
259
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
260
|
+
│ PSM Skill Entry Point │
|
|
261
|
+
│ /oh-my-claudecode:psm │
|
|
262
|
+
└─────────────────────────────────────────────────────────────┘
|
|
263
|
+
│
|
|
264
|
+
┌───────────────┼───────────────┐
|
|
265
|
+
▼ ▼ ▼
|
|
266
|
+
┌─────────────────┐ ┌─────────────┐ ┌─────────────────┐
|
|
267
|
+
│ Command Parser │ │ State Store │ │ Project Resolver│
|
|
268
|
+
│ (argparse) │ │ (JSON DB) │ │ (git/gh API) │
|
|
269
|
+
└─────────────────┘ └─────────────┘ └─────────────────┘
|
|
270
|
+
│ │ │
|
|
271
|
+
└───────────────┼───────────────┘
|
|
272
|
+
▼
|
|
273
|
+
┌─────────────────────────────────────────────────────────┐
|
|
274
|
+
│ Session Orchestrator │
|
|
275
|
+
└─────────────────────────────────────────────────────────┘
|
|
276
|
+
│ │ │
|
|
277
|
+
▼ ▼ ▼
|
|
278
|
+
┌─────────────────┐ ┌─────────────┐ ┌─────────────────┐
|
|
279
|
+
│ Worktree Manager│ │Tmux Manager │ │ Claude Launcher │
|
|
280
|
+
│ (git cmd) │ │ (tmux cmd) │ │ (claude cmd) │
|
|
281
|
+
└─────────────────┘ └─────────────┘ └─────────────────┘
|
|
282
|
+
│ │ │
|
|
283
|
+
└───────────────┼───────────────┘
|
|
284
|
+
▼
|
|
285
|
+
┌─────────────────────────────────────────────────────────┐
|
|
286
|
+
│ Integration Layer │
|
|
287
|
+
│ (gh CLI, git, tmux, claude, omc skills, Clawdbot) │
|
|
288
|
+
└─────────────────────────────────────────────────────────┘
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
### 4.2 Session Lifecycle
|
|
292
|
+
|
|
293
|
+
```
|
|
294
|
+
┌────────────┐ ┌────────────┐ ┌────────────┐ ┌────────────┐
|
|
295
|
+
│ CREATING │ ──▶ │ ACTIVE │ ──▶ │ DETACHED │ ──▶ │ ARCHIVED │
|
|
296
|
+
└────────────┘ └────────────┘ └────────────┘ └────────────┘
|
|
297
|
+
│ │ │ │
|
|
298
|
+
│ │ │ │
|
|
299
|
+
▼ ▼ ▼ ▼
|
|
300
|
+
- Fetch refs - Claude active - Session saved - Worktree kept
|
|
301
|
+
- Create worktree - Tmux attached - Tmux running - PR merged
|
|
302
|
+
- Create branch - Work in progress - Can resume - Ready for GC
|
|
303
|
+
- Start tmux
|
|
304
|
+
- Launch claude
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
### 4.3 Data Flow
|
|
308
|
+
|
|
309
|
+
```
|
|
310
|
+
User Command
|
|
311
|
+
│
|
|
312
|
+
▼
|
|
313
|
+
┌─────────────────┐
|
|
314
|
+
│ Parse Arguments │
|
|
315
|
+
└─────────────────┘
|
|
316
|
+
│
|
|
317
|
+
▼
|
|
318
|
+
┌─────────────────┐ ┌─────────────────┐
|
|
319
|
+
│ Resolve Project │◀───▶│ projects.json │
|
|
320
|
+
└─────────────────┘ └─────────────────┘
|
|
321
|
+
│
|
|
322
|
+
▼
|
|
323
|
+
┌─────────────────┐ ┌─────────────────┐
|
|
324
|
+
│ Fetch Context │◀───▶│ GitHub API (gh) │
|
|
325
|
+
│ (PR/Issue/etc) │ └─────────────────┘
|
|
326
|
+
└─────────────────┘
|
|
327
|
+
│
|
|
328
|
+
▼
|
|
329
|
+
┌─────────────────┐ ┌─────────────────┐
|
|
330
|
+
│ Create Worktree │◀───▶│ Git Repository │
|
|
331
|
+
└─────────────────┘ └─────────────────┘
|
|
332
|
+
│
|
|
333
|
+
▼
|
|
334
|
+
┌─────────────────┐ ┌─────────────────┐
|
|
335
|
+
│ Create Session │◀───▶│ sessions.json │
|
|
336
|
+
└─────────────────┘ └─────────────────┘
|
|
337
|
+
│
|
|
338
|
+
▼
|
|
339
|
+
┌─────────────────┐
|
|
340
|
+
│ Launch Tmux + │
|
|
341
|
+
│ Claude Code │
|
|
342
|
+
└─────────────────┘
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
---
|
|
346
|
+
|
|
347
|
+
## 5. Directory Structure
|
|
348
|
+
|
|
349
|
+
### 5.1 Global PSM Directory
|
|
350
|
+
|
|
351
|
+
```
|
|
352
|
+
~/.psm/
|
|
353
|
+
├── config.json # Global configuration
|
|
354
|
+
├── projects.json # Project aliases
|
|
355
|
+
├── sessions.json # Active session registry
|
|
356
|
+
├── templates/ # Session templates
|
|
357
|
+
│ ├── pr-review.md # PR review prompt template
|
|
358
|
+
│ ├── issue-fix.md # Issue fix prompt template
|
|
359
|
+
│ ├── feature.md # Feature dev template
|
|
360
|
+
│ └── release.md # Release prep template
|
|
361
|
+
├── logs/ # Session logs
|
|
362
|
+
│ └── psm.log
|
|
363
|
+
└── worktrees/ # Default worktree location
|
|
364
|
+
├── omc/ # Per-project worktrees
|
|
365
|
+
│ ├── pr-123/
|
|
366
|
+
│ ├── issue-42/
|
|
367
|
+
│ └── feature-auth/
|
|
368
|
+
└── claude-code/
|
|
369
|
+
└── pr-456/
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
### 5.2 Per-Session Directory
|
|
373
|
+
|
|
374
|
+
```
|
|
375
|
+
~/.psm/worktrees/omc/pr-123/
|
|
376
|
+
├── .git # Git worktree link
|
|
377
|
+
├── .psm-session.json # Session metadata
|
|
378
|
+
├── .psm-context.md # Pre-loaded Claude context
|
|
379
|
+
├── <project files> # Actual code
|
|
380
|
+
└── .omc/ # OMC state (if applicable)
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
### 5.3 Session Metadata File
|
|
384
|
+
|
|
385
|
+
```json
|
|
386
|
+
// .psm-session.json
|
|
387
|
+
{
|
|
388
|
+
"id": "omc:pr-123",
|
|
389
|
+
"type": "review",
|
|
390
|
+
"project": "omc",
|
|
391
|
+
"ref": "pr-123",
|
|
392
|
+
"branch": "feature/add-hooks",
|
|
393
|
+
"base": "main",
|
|
394
|
+
"created_at": "2024-01-26T10:30:00Z",
|
|
395
|
+
"last_accessed": "2024-01-26T14:45:00Z",
|
|
396
|
+
"tmux_session": "psm:omc:pr-123",
|
|
397
|
+
"worktree_path": "~/.psm/worktrees/omc/pr-123",
|
|
398
|
+
"source_repo": "~/Workspace/oh-my-claudecode",
|
|
399
|
+
"github": {
|
|
400
|
+
"pr_number": 123,
|
|
401
|
+
"pr_title": "Add webhook support",
|
|
402
|
+
"pr_author": "contributor",
|
|
403
|
+
"pr_url": "https://github.com/anthropics/oh-my-claudecode/pull/123"
|
|
404
|
+
},
|
|
405
|
+
"state": "active",
|
|
406
|
+
"notes": []
|
|
407
|
+
}
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
---
|
|
411
|
+
|
|
412
|
+
## 6. Session Naming Conventions
|
|
413
|
+
|
|
414
|
+
### 6.1 Tmux Session Names
|
|
415
|
+
|
|
416
|
+
Format: `psm:<project>:<type>-<identifier>`
|
|
417
|
+
|
|
418
|
+
| Type | Pattern | Example |
|
|
419
|
+
|------|---------|---------|
|
|
420
|
+
| PR Review | `psm:<proj>:pr-<num>` | `psm:omc:pr-123` |
|
|
421
|
+
| Issue Fix | `psm:<proj>:issue-<num>` | `psm:omc:issue-42` |
|
|
422
|
+
| Feature | `psm:<proj>:feat-<name>` | `psm:omc:feat-auth` |
|
|
423
|
+
| Release | `psm:<proj>:rel-<ver>` | `psm:omc:rel-v3.5.0` |
|
|
424
|
+
| Generic | `psm:<proj>:<name>` | `psm:omc:experiment` |
|
|
425
|
+
|
|
426
|
+
### 6.2 Worktree Directory Names
|
|
427
|
+
|
|
428
|
+
Format: `<type>-<identifier>`
|
|
429
|
+
|
|
430
|
+
| Type | Pattern | Example |
|
|
431
|
+
|------|---------|---------|
|
|
432
|
+
| PR Review | `pr-<num>` | `pr-123` |
|
|
433
|
+
| Issue Fix | `issue-<num>` | `issue-42` |
|
|
434
|
+
| Feature | `feat-<name>` | `feat-auth` |
|
|
435
|
+
| Release | `rel-<ver>` | `rel-v3.5.0` |
|
|
436
|
+
|
|
437
|
+
### 6.3 Branch Names
|
|
438
|
+
|
|
439
|
+
| Type | Pattern | Example |
|
|
440
|
+
|------|---------|---------|
|
|
441
|
+
| PR Review | (uses PR branch) | `feature/add-hooks` |
|
|
442
|
+
| Issue Fix | `fix/<issue>-<slug>` | `fix/42-auth-timeout` |
|
|
443
|
+
| Feature | `feature/<name>` | `feature/auth` |
|
|
444
|
+
| Release | `release/<ver>` | `release/v3.5.0` |
|
|
445
|
+
| Hotfix | `hotfix/<ver>` | `hotfix/v3.4.1` |
|
|
446
|
+
|
|
447
|
+
---
|
|
448
|
+
|
|
449
|
+
## 7. Workflow Presets
|
|
450
|
+
|
|
451
|
+
### 7.1 PR Review Preset
|
|
452
|
+
|
|
453
|
+
```yaml
|
|
454
|
+
name: pr-review
|
|
455
|
+
steps:
|
|
456
|
+
- fetch_pr_info
|
|
457
|
+
- create_worktree_from_pr_branch
|
|
458
|
+
- generate_review_context:
|
|
459
|
+
template: pr-review.md
|
|
460
|
+
includes:
|
|
461
|
+
- pr_description
|
|
462
|
+
- changed_files_summary
|
|
463
|
+
- commit_history
|
|
464
|
+
- related_issues
|
|
465
|
+
- spawn_tmux_session
|
|
466
|
+
- launch_claude_with_context:
|
|
467
|
+
initial_prompt: |
|
|
468
|
+
You are reviewing PR #{{pr_number}}: {{pr_title}}
|
|
469
|
+
|
|
470
|
+
Focus areas:
|
|
471
|
+
- Code quality and patterns
|
|
472
|
+
- Security implications
|
|
473
|
+
- Test coverage
|
|
474
|
+
- Documentation updates
|
|
475
|
+
|
|
476
|
+
Changed files:
|
|
477
|
+
{{changed_files}}
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
### 7.2 Issue Fix Preset
|
|
481
|
+
|
|
482
|
+
```yaml
|
|
483
|
+
name: issue-fix
|
|
484
|
+
steps:
|
|
485
|
+
- fetch_issue_info
|
|
486
|
+
- create_branch_from_base
|
|
487
|
+
- create_worktree
|
|
488
|
+
- generate_fix_context:
|
|
489
|
+
template: issue-fix.md
|
|
490
|
+
includes:
|
|
491
|
+
- issue_description
|
|
492
|
+
- issue_labels
|
|
493
|
+
- related_code_search
|
|
494
|
+
- similar_issues
|
|
495
|
+
- spawn_tmux_session
|
|
496
|
+
- launch_claude_with_context:
|
|
497
|
+
initial_prompt: |
|
|
498
|
+
You are fixing issue #{{issue_number}}: {{issue_title}}
|
|
499
|
+
|
|
500
|
+
Issue description:
|
|
501
|
+
{{issue_body}}
|
|
502
|
+
|
|
503
|
+
Labels: {{labels}}
|
|
504
|
+
|
|
505
|
+
Potentially related files:
|
|
506
|
+
{{related_files}}
|
|
507
|
+
```
|
|
508
|
+
|
|
509
|
+
### 7.3 Feature Development Preset
|
|
510
|
+
|
|
511
|
+
```yaml
|
|
512
|
+
name: feature-dev
|
|
513
|
+
steps:
|
|
514
|
+
- create_feature_branch
|
|
515
|
+
- create_worktree
|
|
516
|
+
- generate_feature_context:
|
|
517
|
+
template: feature.md
|
|
518
|
+
includes:
|
|
519
|
+
- project_structure
|
|
520
|
+
- related_components
|
|
521
|
+
- coding_standards
|
|
522
|
+
- spawn_tmux_session
|
|
523
|
+
- launch_claude_with_context:
|
|
524
|
+
initial_prompt: |
|
|
525
|
+
You are developing feature: {{feature_name}}
|
|
526
|
+
|
|
527
|
+
Project context loaded. Ready to implement.
|
|
528
|
+
|
|
529
|
+
Suggested starting point:
|
|
530
|
+
{{suggested_files}}
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
### 7.4 Release Preparation Preset
|
|
534
|
+
|
|
535
|
+
```yaml
|
|
536
|
+
name: release-prep
|
|
537
|
+
steps:
|
|
538
|
+
- validate_version_format
|
|
539
|
+
- create_release_branch
|
|
540
|
+
- create_worktree
|
|
541
|
+
- generate_release_context:
|
|
542
|
+
template: release.md
|
|
543
|
+
includes:
|
|
544
|
+
- changelog_since_last_release
|
|
545
|
+
- pending_prs
|
|
546
|
+
- version_files
|
|
547
|
+
- release_checklist
|
|
548
|
+
- spawn_tmux_session
|
|
549
|
+
- launch_claude_with_context:
|
|
550
|
+
initial_prompt: |
|
|
551
|
+
You are preparing release {{version}}
|
|
552
|
+
|
|
553
|
+
Changes since last release:
|
|
554
|
+
{{changelog}}
|
|
555
|
+
|
|
556
|
+
Release checklist:
|
|
557
|
+
- [ ] Update version in package.json
|
|
558
|
+
- [ ] Update CHANGELOG.md
|
|
559
|
+
- [ ] Run full test suite
|
|
560
|
+
- [ ] Update documentation
|
|
561
|
+
- [ ] Create release notes
|
|
562
|
+
```
|
|
563
|
+
|
|
564
|
+
---
|
|
565
|
+
|
|
566
|
+
## 8. State Management
|
|
567
|
+
|
|
568
|
+
### 8.1 Sessions Registry
|
|
569
|
+
|
|
570
|
+
```json
|
|
571
|
+
// ~/.psm/sessions.json
|
|
572
|
+
{
|
|
573
|
+
"version": 1,
|
|
574
|
+
"sessions": {
|
|
575
|
+
"omc:pr-123": {
|
|
576
|
+
"id": "omc:pr-123",
|
|
577
|
+
"state": "active",
|
|
578
|
+
"created_at": "2024-01-26T10:30:00Z",
|
|
579
|
+
"last_accessed": "2024-01-26T14:45:00Z",
|
|
580
|
+
"worktree": "~/.psm/worktrees/omc/pr-123",
|
|
581
|
+
"tmux": "psm:omc:pr-123",
|
|
582
|
+
"type": "review",
|
|
583
|
+
"metadata": {
|
|
584
|
+
"pr_number": 123,
|
|
585
|
+
"pr_merged": false
|
|
586
|
+
}
|
|
587
|
+
},
|
|
588
|
+
"omc:issue-42": {
|
|
589
|
+
"id": "omc:issue-42",
|
|
590
|
+
"state": "detached",
|
|
591
|
+
"created_at": "2024-01-25T09:00:00Z",
|
|
592
|
+
"last_accessed": "2024-01-25T18:00:00Z",
|
|
593
|
+
"worktree": "~/.psm/worktrees/omc/issue-42",
|
|
594
|
+
"tmux": "psm:omc:issue-42",
|
|
595
|
+
"type": "fix",
|
|
596
|
+
"metadata": {
|
|
597
|
+
"issue_number": 42,
|
|
598
|
+
"issue_closed": false
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
},
|
|
602
|
+
"stats": {
|
|
603
|
+
"total_created": 45,
|
|
604
|
+
"total_cleaned": 32,
|
|
605
|
+
"active_count": 3
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
```
|
|
609
|
+
|
|
610
|
+
### 8.2 State Transitions
|
|
611
|
+
|
|
612
|
+
```
|
|
613
|
+
┌───────────┐
|
|
614
|
+
│ CREATING │ ─── on success ───▶ ACTIVE
|
|
615
|
+
└───────────┘
|
|
616
|
+
│
|
|
617
|
+
│ on failure
|
|
618
|
+
▼
|
|
619
|
+
┌───────────┐
|
|
620
|
+
│ FAILED │ ─── cleanup ───▶ (removed)
|
|
621
|
+
└───────────┘
|
|
622
|
+
|
|
623
|
+
┌───────────┐
|
|
624
|
+
│ ACTIVE │ ─── detach ───▶ DETACHED
|
|
625
|
+
└───────────┘
|
|
626
|
+
│
|
|
627
|
+
│ kill
|
|
628
|
+
▼
|
|
629
|
+
┌───────────┐
|
|
630
|
+
│ ARCHIVED │ ─── cleanup ───▶ (removed)
|
|
631
|
+
└───────────┘
|
|
632
|
+
|
|
633
|
+
┌───────────┐
|
|
634
|
+
│ DETACHED │ ─── attach ───▶ ACTIVE
|
|
635
|
+
└───────────┘
|
|
636
|
+
│
|
|
637
|
+
│ pr_merged / issue_closed / timeout
|
|
638
|
+
▼
|
|
639
|
+
┌───────────┐
|
|
640
|
+
│ ARCHIVED │
|
|
641
|
+
└───────────┘
|
|
642
|
+
```
|
|
643
|
+
|
|
644
|
+
### 8.3 Auto-Archive Triggers
|
|
645
|
+
|
|
646
|
+
Sessions automatically transition to ARCHIVED when:
|
|
647
|
+
|
|
648
|
+
1. **PR Merged**: GitHub webhook or polling detects merge
|
|
649
|
+
2. **Issue Closed**: GitHub webhook or polling detects closure
|
|
650
|
+
3. **Inactivity Timeout**: No access for configured days (default: 14)
|
|
651
|
+
4. **Manual Archive**: User marks as complete
|
|
652
|
+
|
|
653
|
+
---
|
|
654
|
+
|
|
655
|
+
## 9. Cleanup Strategies
|
|
656
|
+
|
|
657
|
+
### 9.1 Cleanup Levels
|
|
658
|
+
|
|
659
|
+
| Level | Command | What it Cleans |
|
|
660
|
+
|-------|---------|----------------|
|
|
661
|
+
| Safe | `/psm cleanup` | Merged PRs, closed issues, archived |
|
|
662
|
+
| Moderate | `/psm cleanup --stale` | + Inactive > 14 days |
|
|
663
|
+
| Aggressive | `/psm cleanup --force` | + All detached sessions |
|
|
664
|
+
| Nuclear | `/psm cleanup --all` | Everything (with confirmation) |
|
|
665
|
+
|
|
666
|
+
### 9.2 Cleanup Algorithm
|
|
667
|
+
|
|
668
|
+
```python
|
|
669
|
+
def cleanup(options):
|
|
670
|
+
sessions = load_sessions()
|
|
671
|
+
to_remove = []
|
|
672
|
+
|
|
673
|
+
for session in sessions:
|
|
674
|
+
should_remove = False
|
|
675
|
+
|
|
676
|
+
# Level 1: Safe (always)
|
|
677
|
+
if session.type == "review" and session.pr_merged:
|
|
678
|
+
should_remove = True
|
|
679
|
+
elif session.type == "fix" and session.issue_closed:
|
|
680
|
+
should_remove = True
|
|
681
|
+
elif session.state == "archived":
|
|
682
|
+
should_remove = True
|
|
683
|
+
|
|
684
|
+
# Level 2: Stale
|
|
685
|
+
if options.stale:
|
|
686
|
+
days_inactive = now() - session.last_accessed
|
|
687
|
+
if days_inactive > options.older_than:
|
|
688
|
+
should_remove = True
|
|
689
|
+
|
|
690
|
+
# Level 3: Force
|
|
691
|
+
if options.force:
|
|
692
|
+
if session.state == "detached":
|
|
693
|
+
should_remove = True
|
|
694
|
+
|
|
695
|
+
if should_remove:
|
|
696
|
+
to_remove.append(session)
|
|
697
|
+
|
|
698
|
+
# Execute cleanup
|
|
699
|
+
for session in to_remove:
|
|
700
|
+
if not options.dry_run:
|
|
701
|
+
kill_tmux_session(session.tmux)
|
|
702
|
+
remove_worktree(session.worktree)
|
|
703
|
+
remove_session_record(session.id)
|
|
704
|
+
|
|
705
|
+
log(f"Cleaned: {session.id}")
|
|
706
|
+
```
|
|
707
|
+
|
|
708
|
+
### 9.3 Cleanup Safeguards
|
|
709
|
+
|
|
710
|
+
1. **Uncommitted Changes Check**: Warn if worktree has uncommitted changes
|
|
711
|
+
2. **Unpushed Commits Check**: Warn if local commits not pushed
|
|
712
|
+
3. **Active Session Check**: Never cleanup currently attached session
|
|
713
|
+
4. **Confirmation Prompt**: For aggressive/nuclear cleanup
|
|
714
|
+
5. **Dry Run**: Always preview what will be cleaned
|
|
715
|
+
|
|
716
|
+
### 9.4 Scheduled Cleanup
|
|
717
|
+
|
|
718
|
+
```json
|
|
719
|
+
// ~/.psm/config.json
|
|
720
|
+
{
|
|
721
|
+
"cleanup": {
|
|
722
|
+
"auto_enabled": true,
|
|
723
|
+
"schedule": "daily",
|
|
724
|
+
"level": "safe",
|
|
725
|
+
"older_than_days": 14,
|
|
726
|
+
"notify_before_cleanup": true
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
```
|
|
730
|
+
|
|
731
|
+
---
|
|
732
|
+
|
|
733
|
+
## 10. Integration Points
|
|
734
|
+
|
|
735
|
+
### 10.1 OMC Skill Integration
|
|
736
|
+
|
|
737
|
+
| OMC Skill | PSM Integration |
|
|
738
|
+
|-----------|-----------------|
|
|
739
|
+
| `autopilot` | Can spawn PSM session for isolated work |
|
|
740
|
+
| `ultrawork` | Parallel agents across PSM sessions |
|
|
741
|
+
| `ralph` | Persistence tracking per PSM session |
|
|
742
|
+
| `git-master` | Aware of worktree context |
|
|
743
|
+
| `deepsearch` | Scoped to session worktree |
|
|
744
|
+
|
|
745
|
+
### 10.2 Clawdbot Integration
|
|
746
|
+
|
|
747
|
+
```typescript
|
|
748
|
+
// Clawdbot can manage PSM sessions
|
|
749
|
+
interface ClawdbotPSMIntegration {
|
|
750
|
+
// List sessions via Clawdbot UI
|
|
751
|
+
listSessions(): Promise<Session[]>;
|
|
752
|
+
|
|
753
|
+
// Create session from Clawdbot
|
|
754
|
+
createSession(options: SessionOptions): Promise<Session>;
|
|
755
|
+
|
|
756
|
+
// Attach to session in new terminal
|
|
757
|
+
attachSession(sessionId: string): Promise<void>;
|
|
758
|
+
|
|
759
|
+
// Session status in Clawdbot dashboard
|
|
760
|
+
getSessionStatus(sessionId: string): Promise<SessionStatus>;
|
|
761
|
+
}
|
|
762
|
+
```
|
|
763
|
+
|
|
764
|
+
### 10.3 GitHub Integration
|
|
765
|
+
|
|
766
|
+
| Feature | Integration |
|
|
767
|
+
|---------|-------------|
|
|
768
|
+
| PR Creation | Auto-create draft PR from feature session |
|
|
769
|
+
| PR Status | Track merge status for cleanup |
|
|
770
|
+
| Issue Linking | Auto-link commits to issue |
|
|
771
|
+
| Review Comments | Load review comments as context |
|
|
772
|
+
| CI Status | Show CI status in session info |
|
|
773
|
+
|
|
774
|
+
### 10.4 Editor Integration
|
|
775
|
+
|
|
776
|
+
```bash
|
|
777
|
+
# VSCode
|
|
778
|
+
/psm review omc#123 --editor vscode
|
|
779
|
+
|
|
780
|
+
# Cursor
|
|
781
|
+
/psm review omc#123 --editor cursor
|
|
782
|
+
|
|
783
|
+
# Neovim
|
|
784
|
+
/psm review omc#123 --editor nvim
|
|
785
|
+
```
|
|
786
|
+
|
|
787
|
+
Opens editor in worktree directory alongside tmux session.
|
|
788
|
+
|
|
789
|
+
### 10.5 HUD Integration
|
|
790
|
+
|
|
791
|
+
PSM status in OMC HUD statusline:
|
|
792
|
+
|
|
793
|
+
```
|
|
794
|
+
[psm:omc:pr-123] 📋 Review | 🕐 2h active | 📁 ~/.psm/worktrees/omc/pr-123
|
|
795
|
+
```
|
|
796
|
+
|
|
797
|
+
---
|
|
798
|
+
|
|
799
|
+
## 11. Edge Cases & Error Handling
|
|
800
|
+
|
|
801
|
+
### 11.1 Common Edge Cases
|
|
802
|
+
|
|
803
|
+
| Scenario | Handling |
|
|
804
|
+
|----------|----------|
|
|
805
|
+
| Worktree already exists | Offer: attach, recreate, or abort |
|
|
806
|
+
| Tmux session name conflict | Append timestamp suffix |
|
|
807
|
+
| PR branch force-pushed | Warn and offer to refetch |
|
|
808
|
+
| Network offline | Cache what's possible, queue GitHub ops |
|
|
809
|
+
| Git dirty state in main repo | Warn but allow (worktree is isolated) |
|
|
810
|
+
| Worktree on different filesystem | Use git clone instead |
|
|
811
|
+
| Very large repository | Shallow clone option |
|
|
812
|
+
| Session metadata corrupted | Rebuild from git/tmux state |
|
|
813
|
+
|
|
814
|
+
### 11.2 Error Recovery
|
|
815
|
+
|
|
816
|
+
```bash
|
|
817
|
+
# Rebuild sessions.json from existing worktrees and tmux
|
|
818
|
+
/psm repair
|
|
819
|
+
|
|
820
|
+
# Fix orphaned tmux sessions (no worktree)
|
|
821
|
+
/psm repair --orphaned-tmux
|
|
822
|
+
|
|
823
|
+
# Fix orphaned worktrees (no session record)
|
|
824
|
+
/psm repair --orphaned-worktrees
|
|
825
|
+
|
|
826
|
+
# Full reconstruction
|
|
827
|
+
/psm repair --full
|
|
828
|
+
```
|
|
829
|
+
|
|
830
|
+
### 11.3 Conflict Resolution
|
|
831
|
+
|
|
832
|
+
```
|
|
833
|
+
User runs: /psm review omc#123
|
|
834
|
+
|
|
835
|
+
Existing session found!
|
|
836
|
+
|
|
837
|
+
Options:
|
|
838
|
+
[A] Attach to existing session (recommended)
|
|
839
|
+
[R] Recreate (destroys existing worktree)
|
|
840
|
+
[C] Create parallel (omc:pr-123-2)
|
|
841
|
+
[Q] Quit
|
|
842
|
+
```
|
|
843
|
+
|
|
844
|
+
---
|
|
845
|
+
|
|
846
|
+
## 12. Security Considerations
|
|
847
|
+
|
|
848
|
+
### 12.1 Credential Handling
|
|
849
|
+
|
|
850
|
+
- **GitHub Token**: Uses existing `gh` CLI auth, never stored by PSM
|
|
851
|
+
- **SSH Keys**: Relies on system SSH agent
|
|
852
|
+
- **Secrets in Worktrees**: Worktrees inherit .gitignore, secrets not duplicated
|
|
853
|
+
|
|
854
|
+
### 12.2 Path Sanitization
|
|
855
|
+
|
|
856
|
+
```python
|
|
857
|
+
def sanitize_session_name(name: str) -> str:
|
|
858
|
+
# Prevent path traversal
|
|
859
|
+
name = name.replace("..", "")
|
|
860
|
+
name = name.replace("/", "-")
|
|
861
|
+
name = name.replace("\\", "-")
|
|
862
|
+
# Limit length
|
|
863
|
+
name = name[:64]
|
|
864
|
+
# Alphanumeric + dash only
|
|
865
|
+
name = re.sub(r'[^a-zA-Z0-9-]', '', name)
|
|
866
|
+
return name
|
|
867
|
+
```
|
|
868
|
+
|
|
869
|
+
### 12.3 Permissions
|
|
870
|
+
|
|
871
|
+
- Worktree directories: `0755` (user rwx, others rx)
|
|
872
|
+
- Session metadata: `0600` (user only)
|
|
873
|
+
- Config files: `0600` (user only)
|
|
874
|
+
|
|
875
|
+
---
|
|
876
|
+
|
|
877
|
+
## 13. Future Enhancements
|
|
878
|
+
|
|
879
|
+
### 13.1 Planned Features
|
|
880
|
+
|
|
881
|
+
| Feature | Priority | Description |
|
|
882
|
+
|---------|----------|-------------|
|
|
883
|
+
| Session Templates | High | Custom workflow templates |
|
|
884
|
+
| Team Sharing | Medium | Share session configs |
|
|
885
|
+
| Session Recording | Medium | Record session for replay |
|
|
886
|
+
| Cloud Sync | Low | Sync sessions across machines |
|
|
887
|
+
| Auto-PR Creation | Medium | Create PR when session completes |
|
|
888
|
+
| Session Metrics | Low | Time tracking per session |
|
|
889
|
+
|
|
890
|
+
### 13.2 Extension Points
|
|
891
|
+
|
|
892
|
+
```typescript
|
|
893
|
+
// Plugin interface for custom workflows
|
|
894
|
+
interface PSMPlugin {
|
|
895
|
+
name: string;
|
|
896
|
+
|
|
897
|
+
// Called before session creation
|
|
898
|
+
beforeCreate?(context: SessionContext): Promise<void>;
|
|
899
|
+
|
|
900
|
+
// Called after session creation
|
|
901
|
+
afterCreate?(session: Session): Promise<void>;
|
|
902
|
+
|
|
903
|
+
// Custom cleanup logic
|
|
904
|
+
shouldCleanup?(session: Session): Promise<boolean>;
|
|
905
|
+
|
|
906
|
+
// Custom context generation
|
|
907
|
+
generateContext?(session: Session): Promise<string>;
|
|
908
|
+
}
|
|
909
|
+
```
|
|
910
|
+
|
|
911
|
+
### 13.3 Potential Integrations
|
|
912
|
+
|
|
913
|
+
- **Linear**: Create sessions from Linear issues
|
|
914
|
+
- **Jira**: Create sessions from Jira tickets
|
|
915
|
+
- **Slack**: Notifications on session events
|
|
916
|
+
- **Discord**: Team session coordination
|
|
917
|
+
|
|
918
|
+
---
|
|
919
|
+
|
|
920
|
+
## Appendix A: Quick Reference Card
|
|
921
|
+
|
|
922
|
+
```
|
|
923
|
+
┌────────────────────────────────────────────────────────────┐
|
|
924
|
+
│ Project Session Manager (PSM) │
|
|
925
|
+
├────────────────────────────────────────────────────────────┤
|
|
926
|
+
│ CREATE SESSIONS │
|
|
927
|
+
│ /psm review <pr> Review a PR │
|
|
928
|
+
│ /psm fix <issue> Fix an issue │
|
|
929
|
+
│ /psm feature <name> Start feature │
|
|
930
|
+
│ /psm release <ver> Prepare release │
|
|
931
|
+
├────────────────────────────────────────────────────────────┤
|
|
932
|
+
│ MANAGE SESSIONS │
|
|
933
|
+
│ /psm list List all sessions │
|
|
934
|
+
│ /psm attach <id> Attach to session │
|
|
935
|
+
│ /psm switch [id] Switch sessions │
|
|
936
|
+
│ /psm detach Detach current │
|
|
937
|
+
│ /psm status Current session info │
|
|
938
|
+
├────────────────────────────────────────────────────────────┤
|
|
939
|
+
│ CLEANUP │
|
|
940
|
+
│ /psm cleanup Clean merged/closed │
|
|
941
|
+
│ /psm kill <id> Kill specific session │
|
|
942
|
+
│ /psm repair Fix corrupted state │
|
|
943
|
+
├────────────────────────────────────────────────────────────┤
|
|
944
|
+
│ REFERENCES │
|
|
945
|
+
│ omc#123 Project alias + number │
|
|
946
|
+
│ org/repo#123 Full GitHub reference │
|
|
947
|
+
│ https://... GitHub URL │
|
|
948
|
+
└────────────────────────────────────────────────────────────┘
|
|
949
|
+
```
|
|
950
|
+
|
|
951
|
+
---
|
|
952
|
+
|
|
953
|
+
## Appendix B: Configuration Reference
|
|
954
|
+
|
|
955
|
+
```json
|
|
956
|
+
// ~/.psm/config.json (complete)
|
|
957
|
+
{
|
|
958
|
+
"version": 1,
|
|
959
|
+
"worktree_root": "~/.psm/worktrees",
|
|
960
|
+
"defaults": {
|
|
961
|
+
"editor": "cursor",
|
|
962
|
+
"launch_claude": true,
|
|
963
|
+
"launch_tmux": true,
|
|
964
|
+
"shallow_clone_depth": 100
|
|
965
|
+
},
|
|
966
|
+
"cleanup": {
|
|
967
|
+
"auto_enabled": true,
|
|
968
|
+
"schedule": "daily",
|
|
969
|
+
"level": "safe",
|
|
970
|
+
"older_than_days": 14,
|
|
971
|
+
"notify_before_cleanup": true,
|
|
972
|
+
"keep_archived_days": 7
|
|
973
|
+
},
|
|
974
|
+
"tmux": {
|
|
975
|
+
"session_prefix": "psm",
|
|
976
|
+
"default_layout": "main-vertical",
|
|
977
|
+
"status_bar": true
|
|
978
|
+
},
|
|
979
|
+
"claude": {
|
|
980
|
+
"auto_context": true,
|
|
981
|
+
"context_template": "default",
|
|
982
|
+
"model": "opus"
|
|
983
|
+
},
|
|
984
|
+
"github": {
|
|
985
|
+
"poll_interval_minutes": 5,
|
|
986
|
+
"auto_fetch_pr_reviews": true
|
|
987
|
+
},
|
|
988
|
+
"notifications": {
|
|
989
|
+
"on_pr_merged": true,
|
|
990
|
+
"on_issue_closed": true,
|
|
991
|
+
"on_cleanup": true
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
```
|
|
995
|
+
|
|
996
|
+
---
|
|
997
|
+
|
|
998
|
+
## Appendix C: Example Session Transcript
|
|
999
|
+
|
|
1000
|
+
```bash
|
|
1001
|
+
$ /psm review omc#123
|
|
1002
|
+
|
|
1003
|
+
🔍 Fetching PR #123 from oh-my-claudecode...
|
|
1004
|
+
Title: "Add webhook support for external integrations"
|
|
1005
|
+
Author: @contributor
|
|
1006
|
+
Changed: 12 files (+450, -23)
|
|
1007
|
+
|
|
1008
|
+
📁 Creating worktree at ~/.psm/worktrees/omc/pr-123...
|
|
1009
|
+
Branch: feature/webhook-support
|
|
1010
|
+
Base: main
|
|
1011
|
+
|
|
1012
|
+
🖥️ Creating tmux session: psm:omc:pr-123...
|
|
1013
|
+
|
|
1014
|
+
🤖 Launching Claude Code with PR context...
|
|
1015
|
+
|
|
1016
|
+
✅ Session ready!
|
|
1017
|
+
|
|
1018
|
+
Session ID: omc:pr-123
|
|
1019
|
+
Worktree: ~/.psm/worktrees/omc/pr-123
|
|
1020
|
+
Tmux: psm:omc:pr-123
|
|
1021
|
+
|
|
1022
|
+
Commands:
|
|
1023
|
+
/psm attach omc:pr-123 - Reattach later
|
|
1024
|
+
/psm kill omc:pr-123 - End session
|
|
1025
|
+
/psm cleanup - Clean when PR merged
|
|
1026
|
+
|
|
1027
|
+
Attaching to session...
|
|
1028
|
+
```
|
|
1029
|
+
|
|
1030
|
+
---
|
|
1031
|
+
|
|
1032
|
+
*Document Version: 1.0.0*
|
|
1033
|
+
*Last Updated: 2024-01-26*
|