Skip to content

Commit f41602e

Browse files
committed
ai(rules[check:*,implement]) Add tmuxinator parity commands
1 parent 67fb94a commit f41602e

File tree

3 files changed

+289
-0
lines changed

3 files changed

+289
-0
lines changed

.claude/commands/check/parity.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# /check:parity — Feature Parity Analysis
2+
3+
Deep-dive analysis of tmuxp vs tmuxinator and teamocil. Updates comparison docs and parity notes.
4+
5+
## Workflow
6+
7+
1. **Read source code** of all three projects:
8+
- tmuxp: `src/tmuxp/workspace/` (builder.py, loader.py, importers.py), `src/tmuxp/cli/load.py`
9+
- tmuxinator: `~/study/ruby/tmuxinator/lib/tmuxinator/` (project.rb, window.rb, pane.rb, hooks/, assets/template.erb)
10+
- teamocil: `~/study/ruby/teamocil/lib/teamocil/tmux/` (session.rb, window.rb, pane.rb)
11+
12+
2. **Read existing docs** for baseline:
13+
- `docs/about.md` — tmuxp's own feature description
14+
- `docs/comparison.md` — feature comparison table (create if missing)
15+
- `notes/parity-tmuxinator.md` — tmuxinator parity analysis (create if missing)
16+
- `notes/parity-teamocil.md` — teamocil parity analysis (create if missing)
17+
18+
3. **Update `docs/comparison.md`** with tabular feature comparison:
19+
- Overview table (language, min tmux, config format, architecture)
20+
- Configuration keys table (every key across all three, with ✓/✗)
21+
- CLI commands table (side-by-side)
22+
- Architecture comparison (ORM vs script generation vs command objects)
23+
- Include version numbers for each project
24+
25+
4. **Update `notes/parity-tmuxinator.md`** with:
26+
- Features tmuxinator has that tmuxp lacks (with source locations)
27+
- Import behavior analysis (what the current importer handles vs misses)
28+
- WorkspaceBuilder requirements for 100% feature support
29+
- Code quality issues in current importer
30+
31+
5. **Update `notes/parity-teamocil.md`** with:
32+
- Features teamocil has that tmuxp lacks (with source locations)
33+
- v0.x vs v1.4.2 format differences (current importer targets v0.x only)
34+
- Import behavior analysis
35+
- WorkspaceBuilder requirements for full parity
36+
37+
6. **Commit each file separately**
38+
39+
## Key areas to verify
40+
41+
- Check `importers.py` line-by-line against actual tmuxinator/teamocil config keys
42+
- Verify `load_workspace()` actually reads config keys it claims to support
43+
- Cross-reference CHANGELOGs for version-specific features
44+
- Check test fixtures match real-world configs
45+
46+
---
47+
48+
# Import Behavior
49+
50+
Study tmuxp, teamocil, and tmuxinator source code. Find any syntax they support that tmuxp's native syntax doesn't.
51+
52+
Create/update:
53+
- `notes/import-teamocil.md`
54+
- `notes/import-tmuxinator.md`
55+
56+
## Syntax Level Differences / Limitations
57+
58+
For each config key and syntax pattern discovered, classify as:
59+
60+
### Differences (Translatable)
61+
62+
Syntax that differs but can be automatically converted during import. Document the mapping.
63+
64+
### Limitations (tmuxp needs to add support)
65+
66+
Syntax/features that cannot be imported because tmuxp lacks the underlying capability. For each, note:
67+
1. What the feature does in the source tool
68+
2. Why it can't be imported
69+
3. What tmuxp would need to add
70+
71+
---
72+
73+
# WorkspaceBuilder
74+
75+
Analyze what WorkspaceBuilder needs to:
76+
77+
1. **Auto-detect config format** — Determine heuristics to identify tmuxinator vs teamocil vs tmuxp configs transparently
78+
2. **100% feature support** — List every feature/behavior needed for complete compatibility, including behavioral idiosyncrasies
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# /check:shortcomings — API Limitations Analysis
2+
3+
Second-step command that reads parity analysis and outputs API blockers to `notes/plan.md`.
4+
5+
## Input Files (from /check:parity)
6+
7+
- `notes/parity-tmuxinator.md`
8+
- `notes/parity-teamocil.md`
9+
- `notes/import-tmuxinator.md`
10+
- `notes/import-teamocil.md`
11+
12+
## Workflow
13+
14+
1. **Read parity analysis files** to understand feature gaps
15+
16+
2. **Explore libtmux** at `~/work/python/libtmux/`:
17+
- What APIs are missing? (e.g., no `pane.set_title()`)
18+
- What's hardcoded? (e.g., `shutil.which("tmux")`)
19+
20+
3. **Explore tmuxp** at `~/work/python/tmuxp/`:
21+
- What config keys are dead data?
22+
- What keys are missing from loader/builder?
23+
- What CLI flags are missing?
24+
25+
4. **Update `notes/plan.md`** with:
26+
- libtmux limitations (what Server/Pane/Window/Session can't do)
27+
- tmuxp limitations (what WorkspaceBuilder/loader/cli can't do)
28+
- Dead config keys (imported but ignored)
29+
- Required API additions for each gap
30+
- Non-breaking implementation notes
31+
32+
5. **Commit** `notes/plan.md`
33+
34+
## Output Structure
35+
36+
notes/plan.md should follow this format:
37+
38+
### libtmux Limitations
39+
Per-limitation:
40+
- **Blocker**: What API is missing/hardcoded
41+
- **Blocks**: What parity feature this prevents
42+
- **Required**: What API addition is needed
43+
44+
### tmuxp Limitations
45+
Per-limitation:
46+
- **Blocker**: What's missing/broken
47+
- **Blocks**: What parity feature this prevents
48+
- **Required**: What change is needed
49+
50+
### Implementation Notes
51+
Non-breaking approach for each limitation.

.claude/commands/implement.md

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
# /implement — Plan and Implement from notes/plan.md
2+
3+
Orchestrates the full implementation workflow: plan → implement → test → verify → commit → document.
4+
5+
## Reference Codebases
6+
7+
- **tmuxinator**: `~/study/ruby/tmuxinator/`
8+
- **teamocil**: `~/study/ruby/teamocil/`
9+
- **tmux**: `~/study/c/tmux/`
10+
- **libtmux**: `~/work/python/libtmux/`
11+
- **tmuxp**: `~/work/python/tmuxp/`
12+
13+
## Workflow
14+
15+
### Phase 1: Planning Mode
16+
17+
1. **Read the plan**: Load `notes/plan.md` to understand what needs to be implemented
18+
2. **Select a task**: Pick the highest priority incomplete item from the plan
19+
3. **Research**:
20+
- Read relevant tmuxinator/teamocil Ruby source for behavior reference
21+
- Read libtmux Python source for available APIs
22+
- Read tmuxp source for integration points
23+
- **Study existing tests** for similar functionality (see Testing Pattern below)
24+
4. **Create implementation plan**: Design the specific changes needed
25+
5. **Exit planning mode** with the finalized approach
26+
27+
### Phase 2: Implementation
28+
29+
1. **Make changes**: Edit the necessary files
30+
2. **Follow conventions**: Match existing code style, use type hints, add docstrings
31+
32+
### Phase 3: Write Tests
33+
34+
**CRITICAL**: Before running verification, write tests for new functionality.
35+
36+
1. **Find similar tests**: Search `tests/` for existing tests of similar features
37+
2. **Follow the project test pattern** (see Testing Pattern below)
38+
3. **Add test cases**: Cover normal cases, edge cases, and error conditions
39+
40+
### Phase 4: Verification
41+
42+
Run the full QA suite:
43+
44+
```bash
45+
uv run ruff check . --fix --show-fixes
46+
uv run ruff format .
47+
uv run mypy
48+
uv run py.test --reruns 0 -vvv
49+
```
50+
51+
All checks must pass before proceeding.
52+
53+
### Phase 5: Commit Implementation
54+
55+
**Source and tests must be in separate commits.**
56+
57+
1. **Commit source code first**: Implementation changes only (e.g., `fix(cli): Read socket_name/path and config from workspace config`)
58+
2. **Commit tests second**: Test files only (e.g., `tests(cli): Add config key precedence tests for load_workspace`)
59+
60+
Follow the project's commit conventions (e.g., `feat:`, `fix:`, `refactor:` for source; `tests:` or `tests(<scope>):` for tests).
61+
62+
### Phase 6: Update Documentation
63+
64+
1. **Update `notes/completed.md`**: Add entry for what was implemented
65+
- Date
66+
- What was done
67+
- Files changed
68+
- Any notes or follow-ups
69+
70+
2. **Update `notes/plan.md`**: Mark the item as complete or remove it
71+
72+
3. **Commit notes separately**: Use message like `notes: Mark <feature> as complete`
73+
74+
---
75+
76+
## Testing Pattern
77+
78+
This project uses a consistent test pattern. **Always follow this pattern for new tests.**
79+
80+
### 1. NamedTuple Fixture Class
81+
82+
```python
83+
import typing as t
84+
85+
class MyFeatureTestFixture(t.NamedTuple):
86+
"""Test fixture for my feature tests."""
87+
88+
# pytest (internal): Test fixture name
89+
test_id: str
90+
91+
# test params
92+
input_value: str
93+
expected_output: str
94+
expected_error: str | None = None
95+
```
96+
97+
### 2. Fixture List
98+
99+
```python
100+
TEST_MY_FEATURE_FIXTURES: list[MyFeatureTestFixture] = [
101+
MyFeatureTestFixture(
102+
test_id="normal-case",
103+
input_value="foo",
104+
expected_output="bar",
105+
),
106+
MyFeatureTestFixture(
107+
test_id="edge-case-empty",
108+
input_value="",
109+
expected_output="",
110+
),
111+
MyFeatureTestFixture(
112+
test_id="error-case",
113+
input_value="bad",
114+
expected_output="",
115+
expected_error="Invalid input",
116+
),
117+
]
118+
```
119+
120+
### 3. Parametrized Test Function
121+
122+
```python
123+
@pytest.mark.parametrize(
124+
"test",
125+
TEST_MY_FEATURE_FIXTURES,
126+
ids=[test.test_id for test in TEST_MY_FEATURE_FIXTURES],
127+
)
128+
def test_my_feature(test: MyFeatureTestFixture) -> None:
129+
"""Test my feature with various inputs."""
130+
result = my_function(test.input_value)
131+
assert result == test.expected_output
132+
133+
if test.expected_error:
134+
# check error handling
135+
pass
136+
```
137+
138+
### Key Rules
139+
140+
- **Function tests only** — No `class TestFoo:` groupings (per CLAUDE.md)
141+
- **Use fixtures from `tests/fixtures/`** — Prefer real tmux fixtures over mocks
142+
- **Use `tmp_path`** — Not Python's `tempfile`
143+
- **Use `monkeypatch`** — Not `unittest.mock`
144+
145+
---
146+
147+
## Output
148+
149+
After completion, report:
150+
- What was implemented
151+
- Files changed (including test files)
152+
- Test results summary
153+
- What remains in the plan
154+
155+
## Notes
156+
157+
- If tests fail, fix the issues before committing
158+
- If libtmux changes are needed, note them but don't modify libtmux in this workflow
159+
- One logical change per run — don't implement multiple unrelated items
160+
- **Always write tests** — No implementation is complete without tests

0 commit comments

Comments
 (0)