oh-my-codex-cli 0.1.0
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/.agent/skills/agent-kb/HOW_TO_USE.md +428 -0
- package/.agent/skills/agent-kb/README.md +46 -0
- package/.agent/skills/agent-kb/SKILL.md +128 -0
- package/.agent/skills/agent-kb/references/intelligent-analysis-explained.md +333 -0
- package/.agent/skills/agent-kb/references/query-optimization.md +225 -0
- package/.agent/skills/aireview/SKILL.md +704 -0
- package/.agent/skills/analyze/SKILL.md +81 -0
- package/.agent/skills/architect-planner/HOW_TO_USE.md +238 -0
- package/.agent/skills/architect-planner/README.md +41 -0
- package/.agent/skills/architect-planner/SKILL.md +539 -0
- package/.agent/skills/auto-mbti/SKILL.md +291 -0
- package/.agent/skills/autopilot/SKILL.md +222 -0
- package/.agent/skills/backend-patterns/SKILL.md +602 -0
- package/.agent/skills/bdd-generator/README.md +78 -0
- package/.agent/skills/bdd-generator/SKILL.md +436 -0
- package/.agent/skills/brainstorming/HOW_TO_USE.md +289 -0
- package/.agent/skills/brainstorming/README.md +41 -0
- package/.agent/skills/brainstorming/SKILL.md +165 -0
- package/.agent/skills/build-fix/SKILL.md +190 -0
- package/.agent/skills/cancel/SKILL.md +658 -0
- package/.agent/skills/checkpoint/SKILL.md +94 -0
- package/.agent/skills/code-review/SKILL.md +273 -0
- package/.agent/skills/coding-standards/SKILL.md +535 -0
- package/.agent/skills/conductor/SKILL.md +128 -0
- package/.agent/skills/conductor/commands/conductor/implement.toml +358 -0
- package/.agent/skills/conductor/commands/conductor/newTrack.toml +142 -0
- package/.agent/skills/conductor/commands/conductor/revert.toml +123 -0
- package/.agent/skills/conductor/commands/conductor/setup.toml +429 -0
- package/.agent/skills/conductor/commands/conductor/status.toml +57 -0
- package/.agent/skills/conductor/scripts/install.sh +89 -0
- package/.agent/skills/conductor/templates/code_styleguides/csharp.md +115 -0
- package/.agent/skills/conductor/templates/code_styleguides/dart.md +238 -0
- package/.agent/skills/conductor/templates/code_styleguides/general.md +23 -0
- package/.agent/skills/conductor/templates/code_styleguides/go.md +48 -0
- package/.agent/skills/conductor/templates/code_styleguides/html-css.md +49 -0
- package/.agent/skills/conductor/templates/code_styleguides/javascript.md +51 -0
- package/.agent/skills/conductor/templates/code_styleguides/python.md +37 -0
- package/.agent/skills/conductor/templates/code_styleguides/typescript.md +43 -0
- package/.agent/skills/conductor/templates/rules/README.md +23 -0
- package/.agent/skills/conductor/templates/rules/agents.md +49 -0
- package/.agent/skills/conductor/templates/rules/coding-style.md +70 -0
- package/.agent/skills/conductor/templates/rules/dev.md +20 -0
- package/.agent/skills/conductor/templates/rules/git-workflow.md +45 -0
- package/.agent/skills/conductor/templates/rules/hooks.md +6 -0
- package/.agent/skills/conductor/templates/rules/patterns.md +55 -0
- package/.agent/skills/conductor/templates/rules/performance.md +47 -0
- package/.agent/skills/conductor/templates/rules/research.md +26 -0
- package/.agent/skills/conductor/templates/rules/review.md +22 -0
- package/.agent/skills/conductor/templates/rules/security.md +36 -0
- package/.agent/skills/conductor/templates/rules/testing.md +30 -0
- package/.agent/skills/conductor/templates/workflow.md +333 -0
- package/.agent/skills/consensus/HOW_TO_USE.md +191 -0
- package/.agent/skills/consensus/README.md +41 -0
- package/.agent/skills/consensus/SKILL.md +317 -0
- package/.agent/skills/content-research-writer/SKILL.md +537 -0
- package/.agent/skills/debug-analysis/SKILL.md +331 -0
- package/.agent/skills/deepinit/SKILL.md +347 -0
- package/.agent/skills/deepsearch/SKILL.md +56 -0
- package/.agent/skills/doctor/SKILL.md +158 -0
- package/.agent/skills/drawio/EXAMPLES.md +382 -0
- package/.agent/skills/drawio/QUICK_START.md +237 -0
- package/.agent/skills/drawio/README.md +315 -0
- package/.agent/skills/drawio/SETUP_GUIDE.md +254 -0
- package/.agent/skills/drawio/SKILL.md +1176 -0
- package/.agent/skills/e2e/SKILL.md +396 -0
- package/.agent/skills/ecomode/SKILL.md +160 -0
- package/.agent/skills/electron-driver/SKILL.md +144 -0
- package/.agent/skills/electron-driver/scripts/driver-template.js +71 -0
- package/.agent/skills/eval/SKILL.md +140 -0
- package/.agent/skills/eval-harness/SKILL.md +242 -0
- package/.agent/skills/evolve/SKILL.md +213 -0
- package/.agent/skills/frontend-design/SKILL.md +42 -0
- package/.agent/skills/frontend-patterns/SKILL.md +646 -0
- package/.agent/skills/frontend-ui-ux/SKILL.md +70 -0
- package/.agent/skills/git-master/SKILL.md +75 -0
- package/.agent/skills/help/SKILL.md +89 -0
- package/.agent/skills/iterative-retrieval/SKILL.md +217 -0
- package/.agent/skills/local-skills-setup/SKILL.md +483 -0
- package/.agent/skills/log-analyzer/SKILL.md +187 -0
- package/.agent/skills/mcp-setup/SKILL.md +226 -0
- package/.agent/skills/multi-model-research/HOW_TO_USE.md +614 -0
- package/.agent/skills/multi-model-research/README.md +233 -0
- package/.agent/skills/multi-model-research/SKILL.md +541 -0
- package/.agent/skills/multi-model-research/references/troubleshooting.md +415 -0
- package/.agent/skills/note/SKILL.md +80 -0
- package/.agent/skills/omc-setup/SKILL.md +219 -0
- package/.agent/skills/orchestrate/SKILL.md +620 -0
- package/.agent/skills/patent-workflow/IMPLEMENTATION_SUMMARY.md +500 -0
- package/.agent/skills/patent-workflow/README.md +455 -0
- package/.agent/skills/patent-workflow/SKILL.md +1036 -0
- package/.agent/skills/patent-workflow/tools/irr_checker.py +260 -0
- package/.agent/skills/patent-workflow/tools/sample_terminology.json +49 -0
- package/.agent/skills/patent-workflow/tools/term_checker.py +355 -0
- package/.agent/skills/pattern-recognition/SKILL.md +792 -0
- package/.agent/skills/pipeline/SKILL.md +448 -0
- package/.agent/skills/plan/SKILL.md +309 -0
- package/.agent/skills/planning-methodology/SKILL.md +370 -0
- package/.agent/skills/planning-with-files/SKILL.md +210 -0
- package/.agent/skills/planning-with-files/examples.md +202 -0
- package/.agent/skills/planning-with-files/reference.md +218 -0
- package/.agent/skills/planning-with-files/scripts/check-complete.ps1 +42 -0
- package/.agent/skills/planning-with-files/scripts/check-complete.sh +44 -0
- package/.agent/skills/planning-with-files/scripts/init-session.ps1 +120 -0
- package/.agent/skills/planning-with-files/scripts/init-session.sh +120 -0
- package/.agent/skills/planning-with-files/scripts/session-catchup.py +208 -0
- package/.agent/skills/planning-with-files/templates/findings.md +95 -0
- package/.agent/skills/planning-with-files/templates/progress.md +114 -0
- package/.agent/skills/planning-with-files/templates/task_plan.md +132 -0
- package/.agent/skills/project-analyze/CLAUDE.md +18 -0
- package/.agent/skills/project-analyze/HOW_TO_USE.md +145 -0
- package/.agent/skills/project-analyze/README.md +42 -0
- package/.agent/skills/project-analyze/SKILL.md +289 -0
- package/.agent/skills/project-analyze/SKILL.md.backup +287 -0
- package/.agent/skills/project-analyze/SKILL.md.backup_20260105_093646 +287 -0
- package/.agent/skills/project-analyze/assets/analysis-report-template.md +433 -0
- package/.agent/skills/project-analyze/references/analysis-patterns.md +422 -0
- package/.agent/skills/project-analyze/references/projectmind-explained.md +535 -0
- package/.agent/skills/project-session-manager/SKILL.md +428 -0
- package/.agent/skills/project-session-manager/lib/config.sh +86 -0
- package/.agent/skills/project-session-manager/lib/parse.sh +121 -0
- package/.agent/skills/project-session-manager/lib/session.sh +132 -0
- package/.agent/skills/project-session-manager/lib/tmux.sh +103 -0
- package/.agent/skills/project-session-manager/lib/worktree.sh +171 -0
- package/.agent/skills/project-session-manager/psm.sh +629 -0
- package/.agent/skills/project-session-manager/templates/feature.md +56 -0
- package/.agent/skills/project-session-manager/templates/issue-fix.md +57 -0
- package/.agent/skills/project-session-manager/templates/pr-review.md +65 -0
- package/.agent/skills/project-session-manager/templates/projects.json +19 -0
- package/.agent/skills/quality-check/HOW_TO_USE.md +171 -0
- package/.agent/skills/quality-check/README.md +50 -0
- package/.agent/skills/quality-check/SKILL.md +240 -0
- package/.agent/skills/quality-check/SKILL.md.backup +238 -0
- package/.agent/skills/quality-check/SKILL.md.backup_20260105_093646 +238 -0
- package/.agent/skills/quality-check/assets/quality-report-template.md +437 -0
- package/.agent/skills/quality-check/references/refactoring-patterns.md +550 -0
- package/.agent/skills/quality-check/references/scoring-criteria.md +454 -0
- package/.agent/skills/quality-validation/SKILL.md +519 -0
- package/.agent/skills/quality-validation/SKILL.md.backup +573 -0
- package/.agent/skills/quality-validation/SKILL.md.backup_20260105_093646 +573 -0
- package/.agent/skills/ralph/SKILL.md +236 -0
- package/.agent/skills/ralph-init/SKILL.md +78 -0
- package/.agent/skills/ralplan/SKILL.md +58 -0
- package/.agent/skills/refactor-clean/SKILL.md +49 -0
- package/.agent/skills/release/SKILL.md +84 -0
- package/.agent/skills/research/SKILL.md +526 -0
- package/.agent/skills/research-methodology/SKILL.md +268 -0
- package/.agent/skills/review/SKILL.md +53 -0
- package/.agent/skills/security-review/SKILL.md +509 -0
- package/.agent/skills/security-review/cloud-infrastructure-security.md +361 -0
- package/.agent/skills/setup-pm/SKILL.md +102 -0
- package/.agent/skills/skill/SKILL.md +424 -0
- package/.agent/skills/skill-create/SKILL.md +209 -0
- package/.agent/skills/skill-debugger/HOW_TO_USE.md +244 -0
- package/.agent/skills/skill-debugger/README.md +44 -0
- package/.agent/skills/skill-debugger/SKILL.md +326 -0
- package/.agent/skills/skill-debugger/diagnostic_checklist.md +115 -0
- package/.agent/skills/skill-development/SKILL.md +661 -0
- package/.agent/skills/skill-development/references/skill-creator-original.md +209 -0
- package/.agent/skills/skill-doc-generator/README.md +37 -0
- package/.agent/skills/skill-doc-generator/SKILL.md +331 -0
- package/.agent/skills/skill-quality-analyzer/HOW_TO_USE.md +243 -0
- package/.agent/skills/skill-quality-analyzer/README.md +61 -0
- package/.agent/skills/skill-quality-analyzer/SKILL.md +247 -0
- package/.agent/skills/skill-quality-analyzer/analyzer.py +209 -0
- package/.agent/skills/skill-quality-analyzer/expected_output.json +81 -0
- package/.agent/skills/skill-quality-analyzer/sample_input.json +9 -0
- package/.agent/skills/skill-tester/README.md +46 -0
- package/.agent/skills/skill-tester/SKILL.md +345 -0
- package/.agent/skills/start-dev/SKILL.md +701 -0
- package/.agent/skills/swarm/SKILL.md +691 -0
- package/.agent/skills/task-kb-lookup/SKILL.md +211 -0
- package/.agent/skills/task-kb-record/SKILL.md +417 -0
- package/.agent/skills/tdd/SKILL.md +446 -0
- package/.agent/skills/tdd-generator/DEMO.md +516 -0
- package/.agent/skills/tdd-generator/README.md +89 -0
- package/.agent/skills/tdd-generator/SKILL.md +278 -0
- package/.agent/skills/tdd-workflow/SKILL.md +424 -0
- package/.agent/skills/test-coverage/SKILL.md +48 -0
- package/.agent/skills/thinkdeep/HOW_TO_USE.md +183 -0
- package/.agent/skills/thinkdeep/README.md +41 -0
- package/.agent/skills/thinkdeep/SKILL.md +343 -0
- package/.agent/skills/ui-ux-pro-max/SKILL.md +228 -0
- package/.agent/skills/ui-ux-pro-max/data/charts.csv +26 -0
- package/.agent/skills/ui-ux-pro-max/data/colors.csv +97 -0
- package/.agent/skills/ui-ux-pro-max/data/landing.csv +31 -0
- package/.agent/skills/ui-ux-pro-max/data/products.csv +97 -0
- package/.agent/skills/ui-ux-pro-max/data/prompts.csv +24 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
- package/.agent/skills/ui-ux-pro-max/data/styles.csv +59 -0
- package/.agent/skills/ui-ux-pro-max/data/typography.csv +58 -0
- package/.agent/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
- package/.agent/skills/ui-ux-pro-max/scripts/core.py +236 -0
- package/.agent/skills/ui-ux-pro-max/scripts/search.py +61 -0
- package/.agent/skills/ultrapilot/SKILL.md +647 -0
- package/.agent/skills/ultraqa/SKILL.md +152 -0
- package/.agent/skills/ultrawork/SKILL.md +123 -0
- package/.agent/skills/update-codemaps/SKILL.md +38 -0
- package/.agent/skills/update-docs/SKILL.md +52 -0
- package/.agent/skills/verification-loop/SKILL.md +140 -0
- package/.agent/skills/verify/SKILL.md +80 -0
- package/.agent/skills/writer-memory/SKILL.md +459 -0
- package/.agent/skills/writer-memory/lib/character-tracker.ts +338 -0
- package/.agent/skills/writer-memory/lib/memory-manager.ts +804 -0
- package/.agent/skills/writer-memory/lib/relationship-graph.ts +400 -0
- package/.agent/skills/writer-memory/lib/scene-organizer.ts +544 -0
- package/.agent/skills/writer-memory/lib/synopsis-builder.ts +339 -0
- package/.agent/skills/writer-memory/templates/synopsis-template.md +46 -0
- package/.governance/skill-lint.allowlist +4 -0
- package/.governance/skill-llm.allowlist +4 -0
- package/AGENTS.md +59 -0
- package/LICENSE +21 -0
- package/README.md +169 -0
- package/README.zh.md +145 -0
- package/bin/omcodex.js +8 -0
- package/commands/conductor/implement.toml +358 -0
- package/commands/conductor/newTrack.toml +142 -0
- package/commands/conductor/revert.toml +123 -0
- package/commands/conductor/setup.toml +429 -0
- package/commands/conductor/status.toml +57 -0
- package/docs/ALIGNMENT.md +40 -0
- package/docs/CODEX.md +133 -0
- package/docs/NOTIFY.md +81 -0
- package/docs/SKILL_GOVERNANCE.md +72 -0
- package/docs/SKILL_GOVERNANCE_FRAMEWORK.md +182 -0
- package/docs/SKILL_GOVERNANCE_FRAMEWORK.zh.md +170 -0
- package/package.json +50 -0
- package/prompts/architect.md +105 -0
- package/prompts/executor.md +134 -0
- package/prompts/planner.md +113 -0
- package/scripts/check-skill-governance.sh +84 -0
- package/scripts/check-skill-llm-governance.js +302 -0
- package/scripts/eval-skills.js +217 -0
- package/scripts/generate-catalog-docs.js +95 -0
- package/scripts/generate-codex-mcp-config.sh +22 -0
- package/scripts/install-codex-force.sh +5 -0
- package/scripts/install-codex-incremental.sh +5 -0
- package/scripts/install-codex.sh +79 -0
- package/scripts/notify-dispatch.js +15 -0
- package/scripts/setup-package-manager.js +137 -0
- package/src/catalog/generated/public-catalog.json +547 -0
- package/src/catalog/manifest.json +542 -0
- package/src/catalog/reader.js +43 -0
- package/src/catalog/schema.js +79 -0
- package/src/cli/doctor.js +62 -0
- package/src/cli/index.js +85 -0
- package/src/cli/notify.js +127 -0
- package/src/cli/route.js +43 -0
- package/src/cli/setup.js +155 -0
- package/src/cli/team.js +125 -0
- package/src/config/generator.js +119 -0
- package/src/mcp/memory-server.js +241 -0
- package/src/mcp/state-server.js +112 -0
- package/src/mcp/trace-server.js +168 -0
- package/src/notify/dispatch.js +74 -0
- package/src/notify/extensibility/dispatcher.js +113 -0
- package/src/notify/extensibility/events.js +15 -0
- package/src/notify/extensibility/loader.js +54 -0
- package/src/router/skill-router.js +90 -0
- package/src/team/auto-advance.js +72 -0
- package/src/team/orchestrator.js +82 -0
- package/src/team/state-store.js +33 -0
- package/src/utils/paths.js +33 -0
- package/templates/AGENTS.md +15 -0
- package/templates/catalog-manifest.json +542 -0
- package/templates/code_styleguides/csharp.md +115 -0
- package/templates/code_styleguides/dart.md +238 -0
- package/templates/code_styleguides/general.md +23 -0
- package/templates/code_styleguides/go.md +48 -0
- package/templates/code_styleguides/html-css.md +49 -0
- package/templates/code_styleguides/javascript.md +51 -0
- package/templates/code_styleguides/python.md +37 -0
- package/templates/code_styleguides/typescript.md +43 -0
- package/templates/rules/README.md +23 -0
- package/templates/rules/agents.md +49 -0
- package/templates/rules/coding-style.md +70 -0
- package/templates/rules/dev.md +20 -0
- package/templates/rules/git-workflow.md +45 -0
- package/templates/rules/notify.md +6 -0
- package/templates/rules/patterns.md +55 -0
- package/templates/rules/performance.md +47 -0
- package/templates/rules/research.md +26 -0
- package/templates/rules/review.md +22 -0
- package/templates/rules/security.md +36 -0
- package/templates/rules/testing.md +30 -0
- package/templates/workflow.md +333 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# PSM Session Registry Management
|
|
3
|
+
|
|
4
|
+
# Add session to registry
|
|
5
|
+
# Usage: psm_add_session <id> <type> <project> <ref> <branch> <base> <tmux> <worktree> <source_repo> <metadata_json>
|
|
6
|
+
psm_add_session() {
|
|
7
|
+
local id="$1"
|
|
8
|
+
local type="$2"
|
|
9
|
+
local project="$3"
|
|
10
|
+
local ref="$4"
|
|
11
|
+
local branch="$5"
|
|
12
|
+
local base="$6"
|
|
13
|
+
local tmux_session="$7"
|
|
14
|
+
local worktree="$8"
|
|
15
|
+
local source_repo="$9"
|
|
16
|
+
local metadata="${10:-{}}"
|
|
17
|
+
|
|
18
|
+
local now=$(date -Iseconds)
|
|
19
|
+
|
|
20
|
+
local tmp=$(mktemp)
|
|
21
|
+
jq --arg id "$id" \
|
|
22
|
+
--arg type "$type" \
|
|
23
|
+
--arg project "$project" \
|
|
24
|
+
--arg ref "$ref" \
|
|
25
|
+
--arg branch "$branch" \
|
|
26
|
+
--arg base "$base" \
|
|
27
|
+
--arg tmux "$tmux_session" \
|
|
28
|
+
--arg worktree "$worktree" \
|
|
29
|
+
--arg source "$source_repo" \
|
|
30
|
+
--arg now "$now" \
|
|
31
|
+
--argjson meta "$metadata" \
|
|
32
|
+
'.sessions[$id] = {
|
|
33
|
+
"id": $id,
|
|
34
|
+
"type": $type,
|
|
35
|
+
"project": $project,
|
|
36
|
+
"ref": $ref,
|
|
37
|
+
"branch": $branch,
|
|
38
|
+
"base": $base,
|
|
39
|
+
"tmux": $tmux,
|
|
40
|
+
"worktree": $worktree,
|
|
41
|
+
"source_repo": $source,
|
|
42
|
+
"created_at": $now,
|
|
43
|
+
"last_accessed": $now,
|
|
44
|
+
"state": "active",
|
|
45
|
+
"metadata": $meta
|
|
46
|
+
} | .stats.total_created += 1' \
|
|
47
|
+
"$PSM_SESSIONS" > "$tmp" && mv "$tmp" "$PSM_SESSIONS"
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
# Get session by ID
|
|
51
|
+
# Usage: psm_get_session <id>
|
|
52
|
+
psm_get_session() {
|
|
53
|
+
local id="$1"
|
|
54
|
+
jq -r ".sessions[\"$id\"] // empty" "$PSM_SESSIONS"
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
# Update session state
|
|
58
|
+
# Usage: psm_update_session_state <id> <state>
|
|
59
|
+
psm_update_session_state() {
|
|
60
|
+
local id="$1"
|
|
61
|
+
local state="$2"
|
|
62
|
+
local now=$(date -Iseconds)
|
|
63
|
+
|
|
64
|
+
local tmp=$(mktemp)
|
|
65
|
+
jq --arg id "$id" \
|
|
66
|
+
--arg state "$state" \
|
|
67
|
+
--arg now "$now" \
|
|
68
|
+
'.sessions[$id].state = $state | .sessions[$id].last_accessed = $now' \
|
|
69
|
+
"$PSM_SESSIONS" > "$tmp" && mv "$tmp" "$PSM_SESSIONS"
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
# Remove session from registry
|
|
73
|
+
# Usage: psm_remove_session <id>
|
|
74
|
+
psm_remove_session() {
|
|
75
|
+
local id="$1"
|
|
76
|
+
|
|
77
|
+
local tmp=$(mktemp)
|
|
78
|
+
jq --arg id "$id" \
|
|
79
|
+
'del(.sessions[$id]) | .stats.total_cleaned += 1' \
|
|
80
|
+
"$PSM_SESSIONS" > "$tmp" && mv "$tmp" "$PSM_SESSIONS"
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
# List all sessions
|
|
84
|
+
# Usage: psm_list_sessions [project]
|
|
85
|
+
psm_list_sessions() {
|
|
86
|
+
local project="$1"
|
|
87
|
+
|
|
88
|
+
if [[ -n "$project" ]]; then
|
|
89
|
+
jq -r ".sessions | to_entries[] | select(.value.project == \"$project\") | .value | \"\(.id)|\(.type)|\(.state)|\(.worktree)\"" "$PSM_SESSIONS"
|
|
90
|
+
else
|
|
91
|
+
jq -r '.sessions | to_entries[] | .value | "\(.id)|\(.type)|\(.state)|\(.worktree)"' "$PSM_SESSIONS"
|
|
92
|
+
fi
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
# Get sessions by state
|
|
96
|
+
psm_get_sessions_by_state() {
|
|
97
|
+
local state="$1"
|
|
98
|
+
jq -r ".sessions | to_entries[] | select(.value.state == \"$state\") | .value.id" "$PSM_SESSIONS"
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
# Get session count
|
|
102
|
+
psm_session_count() {
|
|
103
|
+
jq -r '.sessions | length' "$PSM_SESSIONS"
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
# Write session metadata file in worktree
|
|
107
|
+
# Usage: psm_write_session_metadata <worktree_path> <session_json>
|
|
108
|
+
psm_write_session_metadata() {
|
|
109
|
+
local worktree_path="$1"
|
|
110
|
+
local session_json="$2"
|
|
111
|
+
|
|
112
|
+
echo "$session_json" > "${worktree_path}/.psm-session.json"
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
# Read session metadata from worktree
|
|
116
|
+
psm_read_session_metadata() {
|
|
117
|
+
local worktree_path="$1"
|
|
118
|
+
local meta_file="${worktree_path}/.psm-session.json"
|
|
119
|
+
|
|
120
|
+
if [[ -f "$meta_file" ]]; then
|
|
121
|
+
cat "$meta_file"
|
|
122
|
+
fi
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
# Get all session IDs for cleanup check
|
|
126
|
+
psm_get_review_sessions() {
|
|
127
|
+
jq -r '.sessions | to_entries[] | select(.value.type == "review") | "\(.value.id)|\(.value.metadata.pr_number // empty)|\(.value.project)"' "$PSM_SESSIONS"
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
psm_get_fix_sessions() {
|
|
131
|
+
jq -r '.sessions | to_entries[] | select(.value.type == "fix") | "\(.value.id)|\(.value.metadata.issue_number // empty)|\(.value.project)"' "$PSM_SESSIONS"
|
|
132
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# PSM Tmux Session Management
|
|
3
|
+
|
|
4
|
+
# Check if tmux is available
|
|
5
|
+
psm_has_tmux() {
|
|
6
|
+
command -v tmux &> /dev/null
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
# Create a tmux session
|
|
10
|
+
# Usage: psm_create_tmux_session <session_name> <working_dir>
|
|
11
|
+
psm_create_tmux_session() {
|
|
12
|
+
local session_name="$1"
|
|
13
|
+
local working_dir="$2"
|
|
14
|
+
|
|
15
|
+
if ! psm_has_tmux; then
|
|
16
|
+
echo "error|tmux not found"
|
|
17
|
+
return 1
|
|
18
|
+
fi
|
|
19
|
+
|
|
20
|
+
# Check if session already exists
|
|
21
|
+
if tmux has-session -t "$session_name" 2>/dev/null; then
|
|
22
|
+
echo "exists|$session_name"
|
|
23
|
+
return 1
|
|
24
|
+
fi
|
|
25
|
+
|
|
26
|
+
# Create detached session
|
|
27
|
+
tmux new-session -d -s "$session_name" -c "$working_dir" 2>/dev/null || {
|
|
28
|
+
echo "error|Failed to create tmux session"
|
|
29
|
+
return 1
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
echo "created|$session_name"
|
|
33
|
+
return 0
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
# Launch Codex in tmux session
|
|
37
|
+
# Usage: psm_launch_codex <session_name>
|
|
38
|
+
psm_launch_codex() {
|
|
39
|
+
local session_name="$1"
|
|
40
|
+
|
|
41
|
+
if ! tmux has-session -t "$session_name" 2>/dev/null; then
|
|
42
|
+
echo "error|Session not found: $session_name"
|
|
43
|
+
return 1
|
|
44
|
+
fi
|
|
45
|
+
|
|
46
|
+
# Send codex command to the session
|
|
47
|
+
tmux send-keys -t "$session_name" "codex" Enter
|
|
48
|
+
|
|
49
|
+
echo "launched|$session_name"
|
|
50
|
+
return 0
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
# Kill a tmux session
|
|
54
|
+
# Usage: psm_kill_tmux_session <session_name>
|
|
55
|
+
psm_kill_tmux_session() {
|
|
56
|
+
local session_name="$1"
|
|
57
|
+
|
|
58
|
+
if ! tmux has-session -t "$session_name" 2>/dev/null; then
|
|
59
|
+
echo "not_found|$session_name"
|
|
60
|
+
return 0
|
|
61
|
+
fi
|
|
62
|
+
|
|
63
|
+
tmux kill-session -t "$session_name" 2>/dev/null || {
|
|
64
|
+
echo "error|Failed to kill session"
|
|
65
|
+
return 1
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
echo "killed|$session_name"
|
|
69
|
+
return 0
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
# List all PSM tmux sessions
|
|
73
|
+
psm_list_tmux_sessions() {
|
|
74
|
+
if ! psm_has_tmux; then
|
|
75
|
+
return 0
|
|
76
|
+
fi
|
|
77
|
+
|
|
78
|
+
tmux list-sessions -F "#{session_name}|#{session_created}|#{session_attached}" 2>/dev/null | grep "^psm:" || true
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
# Check if a tmux session exists
|
|
82
|
+
# Usage: psm_tmux_session_exists <session_name>
|
|
83
|
+
psm_tmux_session_exists() {
|
|
84
|
+
local session_name="$1"
|
|
85
|
+
tmux has-session -t "$session_name" 2>/dev/null
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
# Get current tmux session name
|
|
89
|
+
psm_current_tmux_session() {
|
|
90
|
+
if [[ -n "$TMUX" ]]; then
|
|
91
|
+
tmux display-message -p "#{session_name}" 2>/dev/null
|
|
92
|
+
fi
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
# Generate tmux session name
|
|
96
|
+
# Usage: psm_tmux_session_name <alias> <type> <id>
|
|
97
|
+
psm_tmux_session_name() {
|
|
98
|
+
local alias="$1"
|
|
99
|
+
local type="$2"
|
|
100
|
+
local id="$3"
|
|
101
|
+
|
|
102
|
+
echo "psm:${alias}:${type}-${id}"
|
|
103
|
+
}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# PSM Worktree Management
|
|
3
|
+
|
|
4
|
+
# Create a worktree for PR review
|
|
5
|
+
# Usage: psm_create_pr_worktree <local_repo> <alias> <pr_number> <pr_branch>
|
|
6
|
+
psm_create_pr_worktree() {
|
|
7
|
+
local local_repo="$1"
|
|
8
|
+
local alias="$2"
|
|
9
|
+
local pr_number="$3"
|
|
10
|
+
local pr_branch="$4"
|
|
11
|
+
|
|
12
|
+
local worktree_root=$(psm_get_worktree_root)
|
|
13
|
+
local worktree_path="${worktree_root}/${alias}/pr-${pr_number}"
|
|
14
|
+
|
|
15
|
+
# Check if worktree already exists
|
|
16
|
+
if [[ -d "$worktree_path" ]]; then
|
|
17
|
+
echo "exists|$worktree_path"
|
|
18
|
+
return 1
|
|
19
|
+
fi
|
|
20
|
+
|
|
21
|
+
# Ensure parent directory exists
|
|
22
|
+
mkdir -p "${worktree_root}/${alias}"
|
|
23
|
+
|
|
24
|
+
# Fetch the PR branch
|
|
25
|
+
cd "$local_repo" || return 1
|
|
26
|
+
git fetch origin "pull/${pr_number}/head:psm-pr-${pr_number}-review" 2>/dev/null || {
|
|
27
|
+
echo "error|Failed to fetch PR #${pr_number}"
|
|
28
|
+
return 1
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
# Create worktree
|
|
32
|
+
git worktree add "$worktree_path" "psm-pr-${pr_number}-review" 2>/dev/null || {
|
|
33
|
+
echo "error|Failed to create worktree"
|
|
34
|
+
return 1
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
echo "created|$worktree_path"
|
|
38
|
+
return 0
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
# Create a worktree for issue fix
|
|
42
|
+
# Usage: psm_create_issue_worktree <local_repo> <alias> <issue_number> <slug> <base_branch>
|
|
43
|
+
psm_create_issue_worktree() {
|
|
44
|
+
local local_repo="$1"
|
|
45
|
+
local alias="$2"
|
|
46
|
+
local issue_number="$3"
|
|
47
|
+
local slug="$4"
|
|
48
|
+
local base_branch="${5:-main}"
|
|
49
|
+
|
|
50
|
+
local worktree_root=$(psm_get_worktree_root)
|
|
51
|
+
local worktree_path="${worktree_root}/${alias}/issue-${issue_number}"
|
|
52
|
+
local branch_name="fix/${issue_number}-${slug}"
|
|
53
|
+
|
|
54
|
+
# Check if worktree already exists
|
|
55
|
+
if [[ -d "$worktree_path" ]]; then
|
|
56
|
+
echo "exists|$worktree_path|$branch_name"
|
|
57
|
+
return 1
|
|
58
|
+
fi
|
|
59
|
+
|
|
60
|
+
mkdir -p "${worktree_root}/${alias}"
|
|
61
|
+
|
|
62
|
+
cd "$local_repo" || return 1
|
|
63
|
+
|
|
64
|
+
# Fetch latest from origin
|
|
65
|
+
git fetch origin "$base_branch" 2>/dev/null || {
|
|
66
|
+
echo "error|Failed to fetch $base_branch"
|
|
67
|
+
return 1
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
# Create and checkout new branch
|
|
71
|
+
git branch "$branch_name" "origin/$base_branch" 2>/dev/null || {
|
|
72
|
+
# Branch might already exist
|
|
73
|
+
true
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
# Create worktree
|
|
77
|
+
git worktree add "$worktree_path" "$branch_name" 2>/dev/null || {
|
|
78
|
+
echo "error|Failed to create worktree"
|
|
79
|
+
return 1
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
echo "created|$worktree_path|$branch_name"
|
|
83
|
+
return 0
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
# Create a worktree for feature development
|
|
87
|
+
# Usage: psm_create_feature_worktree <local_repo> <alias> <feature_name> <base_branch>
|
|
88
|
+
psm_create_feature_worktree() {
|
|
89
|
+
local local_repo="$1"
|
|
90
|
+
local alias="$2"
|
|
91
|
+
local feature_name="$3"
|
|
92
|
+
local base_branch="${4:-main}"
|
|
93
|
+
|
|
94
|
+
local worktree_root=$(psm_get_worktree_root)
|
|
95
|
+
local safe_name=$(psm_sanitize "$feature_name")
|
|
96
|
+
local worktree_path="${worktree_root}/${alias}/feat-${safe_name}"
|
|
97
|
+
local branch_name="feature/${safe_name}"
|
|
98
|
+
|
|
99
|
+
# Check if worktree already exists
|
|
100
|
+
if [[ -d "$worktree_path" ]]; then
|
|
101
|
+
echo "exists|$worktree_path|$branch_name"
|
|
102
|
+
return 1
|
|
103
|
+
fi
|
|
104
|
+
|
|
105
|
+
mkdir -p "${worktree_root}/${alias}"
|
|
106
|
+
|
|
107
|
+
cd "$local_repo" || return 1
|
|
108
|
+
|
|
109
|
+
# Fetch latest
|
|
110
|
+
git fetch origin "$base_branch" 2>/dev/null || {
|
|
111
|
+
echo "error|Failed to fetch $base_branch"
|
|
112
|
+
return 1
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
# Create branch
|
|
116
|
+
git branch "$branch_name" "origin/$base_branch" 2>/dev/null || true
|
|
117
|
+
|
|
118
|
+
# Create worktree
|
|
119
|
+
git worktree add "$worktree_path" "$branch_name" 2>/dev/null || {
|
|
120
|
+
echo "error|Failed to create worktree"
|
|
121
|
+
return 1
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
echo "created|$worktree_path|$branch_name"
|
|
125
|
+
return 0
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
# Remove a worktree
|
|
129
|
+
# Usage: psm_remove_worktree <local_repo> <worktree_path>
|
|
130
|
+
psm_remove_worktree() {
|
|
131
|
+
local local_repo="$1"
|
|
132
|
+
local worktree_path="$2"
|
|
133
|
+
|
|
134
|
+
if [[ ! -d "$worktree_path" ]]; then
|
|
135
|
+
echo "not_found|$worktree_path"
|
|
136
|
+
return 1
|
|
137
|
+
fi
|
|
138
|
+
|
|
139
|
+
# Check for uncommitted changes
|
|
140
|
+
if [[ -d "$worktree_path/.git" ]] || [[ -f "$worktree_path/.git" ]]; then
|
|
141
|
+
cd "$worktree_path" || return 1
|
|
142
|
+
if [[ -n $(git status --porcelain 2>/dev/null) ]]; then
|
|
143
|
+
echo "dirty|$worktree_path"
|
|
144
|
+
return 1
|
|
145
|
+
fi
|
|
146
|
+
fi
|
|
147
|
+
|
|
148
|
+
cd "$local_repo" || return 1
|
|
149
|
+
git worktree remove "$worktree_path" --force 2>/dev/null || {
|
|
150
|
+
# Force remove the directory if git worktree remove fails
|
|
151
|
+
rm -rf "$worktree_path"
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
echo "removed|$worktree_path"
|
|
155
|
+
return 0
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
# List all PSM worktrees
|
|
159
|
+
psm_list_worktrees() {
|
|
160
|
+
local worktree_root=$(psm_get_worktree_root)
|
|
161
|
+
|
|
162
|
+
if [[ ! -d "$worktree_root" ]]; then
|
|
163
|
+
return 0
|
|
164
|
+
fi
|
|
165
|
+
|
|
166
|
+
find "$worktree_root" -mindepth 2 -maxdepth 2 -type d 2>/dev/null | while read -r dir; do
|
|
167
|
+
local alias=$(basename "$(dirname "$dir")")
|
|
168
|
+
local name=$(basename "$dir")
|
|
169
|
+
echo "${alias}:${name}|${dir}"
|
|
170
|
+
done
|
|
171
|
+
}
|