tmux-agent 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/.codex/skills/speckit/SKILL.md +173 -0
- package/.codex/skills/speckit/assets/templates/checklist-template.md +49 -0
- package/.codex/skills/speckit/assets/templates/notes-entrypoints-template.md +11 -0
- package/.codex/skills/speckit/assets/templates/notes-questions-template.md +7 -0
- package/.codex/skills/speckit/assets/templates/notes-readme-template.md +36 -0
- package/.codex/skills/speckit/assets/templates/notes-session-template.md +21 -0
- package/.codex/skills/speckit/assets/templates/plan-template.md +126 -0
- package/.codex/skills/speckit/assets/templates/spec-template.md +135 -0
- package/.codex/skills/speckit/assets/templates/tasks-template.md +269 -0
- package/.codex/skills/speckit/references/acceptance.md +183 -0
- package/.codex/skills/speckit/references/analyze.md +186 -0
- package/.codex/skills/speckit/references/checklist.md +302 -0
- package/.codex/skills/speckit/references/clarify-auto.md +69 -0
- package/.codex/skills/speckit/references/clarify-detailed.md +78 -0
- package/.codex/skills/speckit/references/clarify.md +189 -0
- package/.codex/skills/speckit/references/constitution.md +90 -0
- package/.codex/skills/speckit/references/group.md +89 -0
- package/.codex/skills/speckit/references/implement-task.md +115 -0
- package/.codex/skills/speckit/references/implement.md +129 -0
- package/.codex/skills/speckit/references/notes.md +82 -0
- package/.codex/skills/speckit/references/plan-deep.md +87 -0
- package/.codex/skills/speckit/references/plan-from-questions.md +115 -0
- package/.codex/skills/speckit/references/plan-from-review.md +89 -0
- package/.codex/skills/speckit/references/plan.md +97 -0
- package/.codex/skills/speckit/references/review-plan.md +156 -0
- package/.codex/skills/speckit/references/specify.md +246 -0
- package/.codex/skills/speckit/references/tasks.md +155 -0
- package/.codex/skills/speckit/references/taskstoissues.md +33 -0
- package/.codex/skills/speckit/scripts/bash/check-prerequisites.sh +206 -0
- package/.codex/skills/speckit/scripts/bash/common.sh +191 -0
- package/.codex/skills/speckit/scripts/bash/create-new-feature.sh +259 -0
- package/.codex/skills/speckit/scripts/bash/extract-coded-points.sh +322 -0
- package/.codex/skills/speckit/scripts/bash/extract-spec-ids.sh +238 -0
- package/.codex/skills/speckit/scripts/bash/extract-tasks.sh +295 -0
- package/.codex/skills/speckit/scripts/bash/extract-user-stories.sh +312 -0
- package/.codex/skills/speckit/scripts/bash/setup-notes.sh +182 -0
- package/.codex/skills/speckit/scripts/bash/setup-plan.sh +110 -0
- package/.codex/skills/speckit/scripts/bash/show-todo-tasks.sh +257 -0
- package/.codex/skills/speckit/scripts/bash/spec-group-checklist.sh +402 -0
- package/.codex/skills/speckit/scripts/bash/spec-group-members.sh +215 -0
- package/.codex/skills/speckit/scripts/bash/spec-registry-graph.sh +399 -0
- package/.specify/memory/constitution.md +67 -0
- package/.specify/templates/agent-file-template.md +28 -0
- package/.specify/templates/checklist-template.md +49 -0
- package/.specify/templates/plan-template.md +126 -0
- package/.specify/templates/spec-template.md +135 -0
- package/.specify/templates/tasks-template.md +269 -0
- package/README.md +128 -0
- package/README.zh-CN.md +127 -0
- package/bun.lock +269 -0
- package/dist/cli/commands/codex/forkHome.js +88 -0
- package/dist/cli/commands/codex/send.js +55 -0
- package/dist/cli/commands/codex/sessionInfo.js +42 -0
- package/dist/cli/commands/codex/spawn.js +68 -0
- package/dist/cli/commands/find.js +26 -0
- package/dist/cli/commands/paneKill.js +33 -0
- package/dist/cli/commands/paneSpawn.js +40 -0
- package/dist/cli/commands/paneTitle.js +33 -0
- package/dist/cli/commands/read.js +34 -0
- package/dist/cli/commands/send.js +51 -0
- package/dist/cli/commands/snapshot.js +19 -0
- package/dist/cli/commands/ui/select.js +41 -0
- package/dist/cli/commands/windowKill.js +25 -0
- package/dist/cli/commands/windowLs.js +15 -0
- package/dist/cli/commands/windowNew.js +28 -0
- package/dist/cli/commands/windowRename.js +25 -0
- package/dist/cli/index.js +365 -0
- package/dist/cli/parse.js +39 -0
- package/dist/lib/codex/forkHome.js +101 -0
- package/dist/lib/codex/isCodexPane.js +55 -0
- package/dist/lib/codex/send.js +58 -0
- package/dist/lib/codex/sessionInfo.js +449 -0
- package/dist/lib/codex/spawn.js +246 -0
- package/dist/lib/contracts/types.js +2 -0
- package/dist/lib/fs/safeRm.js +32 -0
- package/dist/lib/io/readStdin.js +14 -0
- package/dist/lib/os/process.js +55 -0
- package/dist/lib/output/format.js +95 -0
- package/dist/lib/proc/lsof.js +42 -0
- package/dist/lib/proc/ps.js +60 -0
- package/dist/lib/targeting/errors.js +13 -0
- package/dist/lib/targeting/resolvePaneTarget.js +91 -0
- package/dist/lib/targeting/resolveWindowTarget.js +40 -0
- package/dist/lib/targeting/scope.js +58 -0
- package/dist/lib/tmux/capturePane.js +20 -0
- package/dist/lib/tmux/exec.js +66 -0
- package/dist/lib/tmux/paneOps.js +29 -0
- package/dist/lib/tmux/paste.js +23 -0
- package/dist/lib/tmux/sendKeys.js +47 -0
- package/dist/lib/tmux/session.js +29 -0
- package/dist/lib/tmux/snapshotPanes.js +46 -0
- package/dist/lib/tmux/snapshotWindows.js +24 -0
- package/dist/lib/tmux/windowOps.js +32 -0
- package/dist/lib/ui/popupSelect.js +432 -0
- package/dist/lib/ui/popupSupport.js +76 -0
- package/package.json +23 -0
- package/src/cli/commands/codex/forkHome.ts +141 -0
- package/src/cli/commands/codex/send.ts +83 -0
- package/src/cli/commands/codex/sessionInfo.ts +59 -0
- package/src/cli/commands/codex/spawn.ts +90 -0
- package/src/cli/commands/find.ts +40 -0
- package/src/cli/commands/paneKill.ts +49 -0
- package/src/cli/commands/paneSpawn.ts +53 -0
- package/src/cli/commands/paneTitle.ts +50 -0
- package/src/cli/commands/read.ts +48 -0
- package/src/cli/commands/send.ts +71 -0
- package/src/cli/commands/snapshot.ts +28 -0
- package/src/cli/commands/ui/select.ts +49 -0
- package/src/cli/commands/windowKill.ts +35 -0
- package/src/cli/commands/windowLs.ts +20 -0
- package/src/cli/commands/windowNew.ts +40 -0
- package/src/cli/commands/windowRename.ts +36 -0
- package/src/cli/index.ts +430 -0
- package/src/lib/codex/forkHome.ts +148 -0
- package/src/lib/codex/isCodexPane.ts +56 -0
- package/src/lib/codex/send.ts +84 -0
- package/src/lib/codex/sessionInfo.ts +521 -0
- package/src/lib/codex/spawn.ts +305 -0
- package/src/lib/contracts/types.ts +30 -0
- package/src/lib/fs/safeRm.ts +32 -0
- package/src/lib/io/readStdin.ts +11 -0
- package/src/lib/output/format.ts +105 -0
- package/src/lib/proc/lsof.ts +44 -0
- package/src/lib/proc/ps.ts +70 -0
- package/src/lib/targeting/errors.ts +25 -0
- package/src/lib/targeting/resolvePaneTarget.ts +106 -0
- package/src/lib/targeting/resolveWindowTarget.ts +45 -0
- package/src/lib/targeting/scope.ts +76 -0
- package/src/lib/tmux/capturePane.ts +21 -0
- package/src/lib/tmux/exec.ts +90 -0
- package/src/lib/tmux/paneOps.ts +35 -0
- package/src/lib/tmux/paste.ts +20 -0
- package/src/lib/tmux/sendKeys.ts +72 -0
- package/src/lib/tmux/session.ts +27 -0
- package/src/lib/tmux/snapshotPanes.ts +52 -0
- package/src/lib/tmux/snapshotWindows.ts +23 -0
- package/src/lib/tmux/windowOps.ts +43 -0
- package/src/lib/ui/popupSelect.ts +561 -0
- package/src/lib/ui/popupSupport.ts +84 -0
- package/tests/e2e/codexForkHome.test.ts +146 -0
- package/tests/e2e/codexSessionInfo.test.ts +112 -0
- package/tests/e2e/codexTuiSend.test.ts +68 -0
- package/tests/integration/codexSpawn.test.ts +113 -0
- package/tests/integration/paneOps.test.ts +60 -0
- package/tests/integration/sendRead.test.ts +52 -0
- package/tests/integration/snapshot.test.ts +39 -0
- package/tests/integration/tmuxHarness.ts +39 -0
- package/tests/integration/windowOps.test.ts +60 -0
- package/tests/unit/codexSend.test.ts +105 -0
- package/tests/unit/codexSessionInfo.test.ts +88 -0
- package/tests/unit/codexSpawn.test.ts +34 -0
- package/tests/unit/keys.test.ts +30 -0
- package/tests/unit/outputFormat.test.ts +52 -0
- package/tests/unit/popupSelect.test.ts +77 -0
- package/tests/unit/popupSupport.test.ts +109 -0
- package/tests/unit/resolvePaneTarget.test.ts +43 -0
- package/tests/unit/resolveWindowTarget.test.ts +36 -0
- package/tests/unit/safeRm.test.ts +41 -0
- package/tests/unit/scope.test.ts +57 -0
- package/tsconfig.json +14 -0
- package/vitest.config.ts +16 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# Feature Specification: [FEATURE NAME]
|
|
2
|
+
|
|
3
|
+
**Feature Branch**: `[###-feature-name]`
|
|
4
|
+
**Created**: [DATE]
|
|
5
|
+
**Status**: Draft
|
|
6
|
+
**Input**: User description: "$ARGUMENTS"
|
|
7
|
+
|
|
8
|
+
## User Scenarios & Testing _(mandatory)_
|
|
9
|
+
|
|
10
|
+
<!--
|
|
11
|
+
IMPORTANT: User stories should be PRIORITIZED as user journeys ordered by importance.
|
|
12
|
+
Each user story/journey must be INDEPENDENTLY TESTABLE - meaning if you implement just ONE of them,
|
|
13
|
+
you should still have a viable MVP (Minimum Viable Product) that delivers value.
|
|
14
|
+
|
|
15
|
+
Assign priorities (P1, P2, P3, etc.) to each story, where P1 is the most critical.
|
|
16
|
+
Think of each story as a standalone slice of functionality that can be:
|
|
17
|
+
- Developed independently
|
|
18
|
+
- Tested independently
|
|
19
|
+
- Deployed independently
|
|
20
|
+
- Demonstrated to users independently
|
|
21
|
+
-->
|
|
22
|
+
|
|
23
|
+
### User Story 1 - [Brief Title] (Priority: P1)
|
|
24
|
+
|
|
25
|
+
[Describe this user journey in plain language]
|
|
26
|
+
|
|
27
|
+
**Why this priority**: [Explain the value and why it has this priority level]
|
|
28
|
+
|
|
29
|
+
**Independent Test**: [Describe how this can be tested independently - e.g., "Can be fully tested by [specific action] and delivers [specific value]"]
|
|
30
|
+
|
|
31
|
+
**Acceptance Scenarios**:
|
|
32
|
+
|
|
33
|
+
1. **Given** [initial state], **When** [action], **Then** [expected outcome]
|
|
34
|
+
2. **Given** [initial state], **When** [action], **Then** [expected outcome]
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
### User Story 2 - [Brief Title] (Priority: P2)
|
|
39
|
+
|
|
40
|
+
[Describe this user journey in plain language]
|
|
41
|
+
|
|
42
|
+
**Why this priority**: [Explain the value and why it has this priority level]
|
|
43
|
+
|
|
44
|
+
**Independent Test**: [Describe how this can be tested independently]
|
|
45
|
+
|
|
46
|
+
**Acceptance Scenarios**:
|
|
47
|
+
|
|
48
|
+
1. **Given** [initial state], **When** [action], **Then** [expected outcome]
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
### User Story 3 - [Brief Title] (Priority: P3)
|
|
53
|
+
|
|
54
|
+
[Describe this user journey in plain language]
|
|
55
|
+
|
|
56
|
+
**Why this priority**: [Explain the value and why it has this priority level]
|
|
57
|
+
|
|
58
|
+
**Independent Test**: [Describe how this can be tested independently]
|
|
59
|
+
|
|
60
|
+
**Acceptance Scenarios**:
|
|
61
|
+
|
|
62
|
+
1. **Given** [initial state], **When** [action], **Then** [expected outcome]
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
[Add more user stories as needed, each with an assigned priority]
|
|
67
|
+
|
|
68
|
+
### Edge Cases
|
|
69
|
+
|
|
70
|
+
<!--
|
|
71
|
+
ACTION REQUIRED: The content in this section represents placeholders.
|
|
72
|
+
Fill them out with the right edge cases.
|
|
73
|
+
-->
|
|
74
|
+
|
|
75
|
+
- What happens when [boundary condition]?
|
|
76
|
+
- How does system handle [error scenario]?
|
|
77
|
+
|
|
78
|
+
## Requirements _(mandatory)_
|
|
79
|
+
|
|
80
|
+
<!--
|
|
81
|
+
ACTION REQUIRED: The content in this section represents placeholders.
|
|
82
|
+
Fill them out with the right functional requirements.
|
|
83
|
+
-->
|
|
84
|
+
|
|
85
|
+
### Functional Requirements
|
|
86
|
+
|
|
87
|
+
- **FR-001**: System MUST [specific capability, e.g., "allow users to create accounts"]
|
|
88
|
+
- **FR-002**: System MUST [specific capability, e.g., "validate email addresses"]
|
|
89
|
+
- **FR-003**: Users MUST be able to [key interaction, e.g., "reset their password"]
|
|
90
|
+
- **FR-004**: System MUST [data requirement, e.g., "persist user preferences"]
|
|
91
|
+
- **FR-005**: System MUST [behavior, e.g., "log all security events"]
|
|
92
|
+
|
|
93
|
+
_Example of marking unclear requirements:_
|
|
94
|
+
|
|
95
|
+
- **FR-006**: System MUST authenticate users via [NEEDS CLARIFICATION: auth method not specified - email/password, SSO, OAuth?]
|
|
96
|
+
- **FR-007**: System MUST retain user data for [NEEDS CLARIFICATION: retention period not specified]
|
|
97
|
+
|
|
98
|
+
### Non-Functional Requirements (Quality)
|
|
99
|
+
|
|
100
|
+
<!--
|
|
101
|
+
If this feature is performance/scale sensitive:
|
|
102
|
+
- Define budgets (latency/throughput/memory/alloc) and how they are measured
|
|
103
|
+
- Define observability: logs/metrics/traces + failure triage signals
|
|
104
|
+
-->
|
|
105
|
+
|
|
106
|
+
- **NFR-001**: If performance-sensitive, system MUST define budgets for critical paths
|
|
107
|
+
and record a measurable baseline before implementation.
|
|
108
|
+
- **NFR-002**: System MUST provide structured diagnostic signals (logs/metrics/traces)
|
|
109
|
+
for key flows, with a documented enable/disable cost model.
|
|
110
|
+
- **NFR-003**: Identifiers used in diagnostics SHOULD be stable and searchable.
|
|
111
|
+
- **NFR-004**: Error handling MUST be explicit for user-facing failures, and MUST include
|
|
112
|
+
a clear triage path (where to look, what to collect).
|
|
113
|
+
- **NFR-005**: If this feature introduces breaking changes, the project MUST document
|
|
114
|
+
the change and migration steps (where applicable).
|
|
115
|
+
|
|
116
|
+
### Key Entities _(include if feature involves data)_
|
|
117
|
+
|
|
118
|
+
- **[Entity 1]**: [What it represents, key attributes without implementation]
|
|
119
|
+
- **[Entity 2]**: [What it represents, relationships to other entities]
|
|
120
|
+
|
|
121
|
+
## Success Criteria _(mandatory)_
|
|
122
|
+
|
|
123
|
+
<!--
|
|
124
|
+
ACTION REQUIRED: Define measurable success criteria.
|
|
125
|
+
These must be technology-agnostic and measurable.
|
|
126
|
+
-->
|
|
127
|
+
|
|
128
|
+
### Measurable Outcomes
|
|
129
|
+
|
|
130
|
+
- **SC-001**: [Measurable metric, e.g., "Users can complete account creation in under 2 minutes"]
|
|
131
|
+
- **SC-002**: [Measurable metric, e.g., "System handles 1000 concurrent users without degradation"]
|
|
132
|
+
- **SC-003**: [User satisfaction metric, e.g., "90% of users successfully complete primary task on first attempt"]
|
|
133
|
+
- **SC-004**: [Business metric, e.g., "Reduce support tickets related to [X] by 50%"]
|
|
134
|
+
- **SC-005**: [Performance metric, e.g., "No regression in p95 latency / allocations for [hot path]"]
|
|
135
|
+
- **SC-006**: [Diagnosability metric, e.g., "Devtools can explain 'why' for [event] with causal chain"]
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
---
|
|
2
|
+
|
|
3
|
+
description: "Task list template for feature implementation"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Tasks: [FEATURE NAME]
|
|
7
|
+
|
|
8
|
+
**Input**: Design documents from `/specs/[###-feature-name]/`
|
|
9
|
+
**Prerequisites**: plan.md (required), spec.md (required for user stories), research.md, data-model.md, contracts/, notes/ (optional)
|
|
10
|
+
|
|
11
|
+
**Tests**: The examples below include test tasks. Tests are OPTIONAL by default - only include
|
|
12
|
+
them if explicitly requested in the feature specification, or if your project’s quality gates require
|
|
13
|
+
tests for this change. If a change touches performance-sensitive paths, include performance regression
|
|
14
|
+
defenses (baseline + guard) unless explicitly justified. If a change introduces breaking changes, include
|
|
15
|
+
a migration note task (plan.md / PR) and follow the project’s compatibility policy (do not add “silent”
|
|
16
|
+
compat layers unless they are explicitly planned).
|
|
17
|
+
|
|
18
|
+
**Organization**: Tasks are grouped by user story to enable independent implementation and testing of each story.
|
|
19
|
+
|
|
20
|
+
## Format: `[ID] [P?] [Story] Description`
|
|
21
|
+
|
|
22
|
+
- **[P]**: Can run in parallel (different files, no dependencies)
|
|
23
|
+
- **[Story]**: Which user story this task belongs to (e.g., US1, US2, US3)
|
|
24
|
+
- Include exact file paths in descriptions
|
|
25
|
+
|
|
26
|
+
## Path Conventions
|
|
27
|
+
|
|
28
|
+
- **Single project**: `src/`, `tests/` at repository root
|
|
29
|
+
- **Web app**: `backend/src/`, `frontend/src/`
|
|
30
|
+
- **Mobile**: `api/src/`, `ios/src/` or `android/src/`
|
|
31
|
+
- Paths shown below assume single project - adjust based on plan.md structure
|
|
32
|
+
|
|
33
|
+
<!--
|
|
34
|
+
============================================================================
|
|
35
|
+
IMPORTANT: The tasks below are SAMPLE TASKS for illustration purposes only.
|
|
36
|
+
|
|
37
|
+
The $speckit tasks stage MUST replace these with actual tasks based on:
|
|
38
|
+
- User stories from spec.md (with their priorities P1, P2, P3...)
|
|
39
|
+
- Feature requirements from plan.md
|
|
40
|
+
- Entities from data-model.md
|
|
41
|
+
- Endpoints from contracts/
|
|
42
|
+
|
|
43
|
+
Tasks MUST be organized by user story so each story can be:
|
|
44
|
+
- Implemented independently
|
|
45
|
+
- Tested independently
|
|
46
|
+
- Delivered as an MVP increment
|
|
47
|
+
|
|
48
|
+
DO NOT keep these sample tasks in the generated tasks.md file.
|
|
49
|
+
============================================================================
|
|
50
|
+
-->
|
|
51
|
+
|
|
52
|
+
## Phase 1: Setup (Shared Infrastructure)
|
|
53
|
+
|
|
54
|
+
**Purpose**: Project initialization and basic structure
|
|
55
|
+
|
|
56
|
+
- [ ] T001 Create project structure per implementation plan
|
|
57
|
+
- [ ] T002 Initialize [language] project with [framework] dependencies
|
|
58
|
+
- [ ] T003 [P] Configure linting and formatting tools
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Phase 2: Foundational (Blocking Prerequisites)
|
|
63
|
+
|
|
64
|
+
**Purpose**: Core infrastructure that MUST be complete before ANY user story can be implemented
|
|
65
|
+
|
|
66
|
+
**⚠️ CRITICAL**: No user story work can begin until this phase is complete
|
|
67
|
+
|
|
68
|
+
Examples of foundational tasks (adjust based on your project):
|
|
69
|
+
|
|
70
|
+
- [ ] T004 Setup database schema and migrations framework
|
|
71
|
+
- [ ] T005 [P] Implement authentication/authorization framework
|
|
72
|
+
- [ ] T006 [P] Setup API routing and middleware structure
|
|
73
|
+
- [ ] T007 Create base models/entities that all stories depend on
|
|
74
|
+
- [ ] T008 Configure error handling and logging infrastructure
|
|
75
|
+
- [ ] T00X [P] Define unified minimal IR + drift prevention (docs/specs + parser/codegen)
|
|
76
|
+
- [ ] T00X [P] Define deterministic identity model (instanceId/txnSeq/opId) and remove random/time defaults
|
|
77
|
+
- [ ] T00X [P] Enforce transaction boundary (no IO in txn window, no writable ref escape hatches)
|
|
78
|
+
- [ ] T00X [P] Define external reactive source integration: signal-dirty (pull-based), no render-level tearing (single snapshot anchor), and sharded notify to avoid O(N) selector work
|
|
79
|
+
- [ ] T00X [P] Encapsulate internal hooks as explicit injectable contracts (Runtime Services); avoid magic fields / parameter explosion; document migration in specs/[###-feature]/plan.md
|
|
80
|
+
- [ ] T00X [P] Normalize package public submodules: PascalCase `src/*.ts` (except `index.ts`/`global.d.ts`), move non-submodule code into `src/internal/**`, and keep `exports` from exposing internals
|
|
81
|
+
- [ ] T00X [P] Decompose oversized modules/files (≥1000 LOC or expected to exceed): define a decomposition brief (mutually exclusive submodules), pick structure (flat `*.*.ts` vs directory), keep refactor semantics-preserving, and add incremental verification checkpoints
|
|
82
|
+
- [ ] T00X [P] Add controlled trial-run harness (RunSession + Evidence/IR export) with schema validation; ensure parallel sessions are isolated
|
|
83
|
+
- [ ] T00X [P] Define performance budget + baseline measurement approach (benchmark/profile)
|
|
84
|
+
- [ ] T00X [P] Define diagnostic events/Devtools surfaces + expected overhead (enabled vs disabled)
|
|
85
|
+
- [ ] T00X [P] Provide user-facing performance mental model (≤5 keywords, cost model, optimization ladder) and align terminology across docs/benchmarks/diagnostics
|
|
86
|
+
- [ ] T009 Setup environment configuration management
|
|
87
|
+
|
|
88
|
+
**Checkpoint**: Foundation ready - user story implementation can now begin in parallel
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## Phase 3: User Story 1 - [Title] (Priority: P1) 🎯 MVP
|
|
93
|
+
|
|
94
|
+
**Goal**: [Brief description of what this story delivers]
|
|
95
|
+
|
|
96
|
+
**Independent Test**: [How to verify this story works on its own]
|
|
97
|
+
|
|
98
|
+
### Tests for User Story 1 (OPTIONAL - only if tests requested) ⚠️
|
|
99
|
+
|
|
100
|
+
> **NOTE: Write these tests FIRST, ensure they FAIL before implementation**
|
|
101
|
+
|
|
102
|
+
- [ ] T010 [P] [US1] Contract test for [endpoint] in tests/contract/test\_[name].py
|
|
103
|
+
- [ ] T011 [P] [US1] Integration test for [user journey] in tests/integration/test\_[name].py
|
|
104
|
+
|
|
105
|
+
### Implementation for User Story 1
|
|
106
|
+
|
|
107
|
+
- [ ] T012 [P] [US1] Create [Entity1] model in src/models/[entity1].py
|
|
108
|
+
- [ ] T013 [P] [US1] Create [Entity2] model in src/models/[entity2].py
|
|
109
|
+
- [ ] T014 [US1] Implement [Service] in src/services/[service].py (depends on T012, T013)
|
|
110
|
+
- [ ] T015 [US1] Implement [endpoint/feature] in src/[location]/[file].py
|
|
111
|
+
- [ ] T016 [US1] Add validation and error handling
|
|
112
|
+
- [ ] T017 [US1] Add logging for user story 1 operations
|
|
113
|
+
|
|
114
|
+
**Checkpoint**: At this point, User Story 1 should be fully functional and testable independently
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Phase 4: User Story 2 - [Title] (Priority: P2)
|
|
119
|
+
|
|
120
|
+
**Goal**: [Brief description of what this story delivers]
|
|
121
|
+
|
|
122
|
+
**Independent Test**: [How to verify this story works on its own]
|
|
123
|
+
|
|
124
|
+
### Tests for User Story 2 (OPTIONAL - only if tests requested) ⚠️
|
|
125
|
+
|
|
126
|
+
- [ ] T018 [P] [US2] Contract test for [endpoint] in tests/contract/test\_[name].py
|
|
127
|
+
- [ ] T019 [P] [US2] Integration test for [user journey] in tests/integration/test\_[name].py
|
|
128
|
+
|
|
129
|
+
### Implementation for User Story 2
|
|
130
|
+
|
|
131
|
+
- [ ] T020 [P] [US2] Create [Entity] model in src/models/[entity].py
|
|
132
|
+
- [ ] T021 [US2] Implement [Service] in src/services/[service].py
|
|
133
|
+
- [ ] T022 [US2] Implement [endpoint/feature] in src/[location]/[file].py
|
|
134
|
+
- [ ] T023 [US2] Integrate with User Story 1 components (if needed)
|
|
135
|
+
|
|
136
|
+
**Checkpoint**: At this point, User Stories 1 AND 2 should both work independently
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Phase 5: User Story 3 - [Title] (Priority: P3)
|
|
141
|
+
|
|
142
|
+
**Goal**: [Brief description of what this story delivers]
|
|
143
|
+
|
|
144
|
+
**Independent Test**: [How to verify this story works on its own]
|
|
145
|
+
|
|
146
|
+
### Tests for User Story 3 (OPTIONAL - only if tests requested) ⚠️
|
|
147
|
+
|
|
148
|
+
- [ ] T024 [P] [US3] Contract test for [endpoint] in tests/contract/test\_[name].py
|
|
149
|
+
- [ ] T025 [P] [US3] Integration test for [user journey] in tests/integration/test\_[name].py
|
|
150
|
+
|
|
151
|
+
### Implementation for User Story 3
|
|
152
|
+
|
|
153
|
+
- [ ] T026 [P] [US3] Create [Entity] model in src/models/[entity].py
|
|
154
|
+
- [ ] T027 [US3] Implement [Service] in src/services/[service].py
|
|
155
|
+
- [ ] T028 [US3] Implement [endpoint/feature] in src/[location]/[file].py
|
|
156
|
+
|
|
157
|
+
**Checkpoint**: All user stories should now be independently functional
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
[Add more user story phases as needed, following the same pattern]
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## Phase N: Polish & Cross-Cutting Concerns
|
|
166
|
+
|
|
167
|
+
**Purpose**: Improvements that affect multiple user stories
|
|
168
|
+
|
|
169
|
+
- [ ] TXXX [P] Documentation updates in docs/
|
|
170
|
+
- [ ] TXXX Code cleanup and refactoring
|
|
171
|
+
- [ ] TXXX Performance optimization across all stories
|
|
172
|
+
- [ ] TXXX Performance regression guard (bench/profile baseline + CI-friendly check if applicable)
|
|
173
|
+
- [ ] TXXX Diagnosability & explainability polish (events/trace/devtools UX + overhead validation)
|
|
174
|
+
- [ ] TXXX [P] Additional unit tests (if requested) in tests/unit/
|
|
175
|
+
- [ ] TXXX Security hardening
|
|
176
|
+
- [ ] TXXX Run quickstart.md validation
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## Dependencies & Execution Order
|
|
181
|
+
|
|
182
|
+
### Phase Dependencies
|
|
183
|
+
|
|
184
|
+
- **Setup (Phase 1)**: No dependencies - can start immediately
|
|
185
|
+
- **Foundational (Phase 2)**: Depends on Setup completion - BLOCKS all user stories
|
|
186
|
+
- **User Stories (Phase 3+)**: All depend on Foundational phase completion
|
|
187
|
+
- User stories can then proceed in parallel (if staffed)
|
|
188
|
+
- Or sequentially in priority order (P1 → P2 → P3)
|
|
189
|
+
- **Polish (Final Phase)**: Depends on all desired user stories being complete
|
|
190
|
+
|
|
191
|
+
### User Story Dependencies
|
|
192
|
+
|
|
193
|
+
- **User Story 1 (P1)**: Can start after Foundational (Phase 2) - No dependencies on other stories
|
|
194
|
+
- **User Story 2 (P2)**: Can start after Foundational (Phase 2) - May integrate with US1 but should be independently testable
|
|
195
|
+
- **User Story 3 (P3)**: Can start after Foundational (Phase 2) - May integrate with US1/US2 but should be independently testable
|
|
196
|
+
|
|
197
|
+
### Within Each User Story
|
|
198
|
+
|
|
199
|
+
- Tests (if included) MUST be written and FAIL before implementation
|
|
200
|
+
- Models before services
|
|
201
|
+
- Services before endpoints
|
|
202
|
+
- Core implementation before integration
|
|
203
|
+
- Story complete before moving to next priority
|
|
204
|
+
|
|
205
|
+
### Parallel Opportunities
|
|
206
|
+
|
|
207
|
+
- All Setup tasks marked [P] can run in parallel
|
|
208
|
+
- All Foundational tasks marked [P] can run in parallel (within Phase 2)
|
|
209
|
+
- Once Foundational phase completes, all user stories can start in parallel (if team capacity allows)
|
|
210
|
+
- All tests for a user story marked [P] can run in parallel
|
|
211
|
+
- Models within a story marked [P] can run in parallel
|
|
212
|
+
- Different user stories can be worked on in parallel by different team members
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## Parallel Example: User Story 1
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
# Launch all tests for User Story 1 together (if tests requested):
|
|
220
|
+
Task: "Contract test for [endpoint] in tests/contract/test_[name].py"
|
|
221
|
+
Task: "Integration test for [user journey] in tests/integration/test_[name].py"
|
|
222
|
+
|
|
223
|
+
# Launch all models for User Story 1 together:
|
|
224
|
+
Task: "Create [Entity1] model in src/models/[entity1].py"
|
|
225
|
+
Task: "Create [Entity2] model in src/models/[entity2].py"
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
## Implementation Strategy
|
|
231
|
+
|
|
232
|
+
### MVP First (User Story 1 Only)
|
|
233
|
+
|
|
234
|
+
1. Complete Phase 1: Setup
|
|
235
|
+
2. Complete Phase 2: Foundational (CRITICAL - blocks all stories)
|
|
236
|
+
3. Complete Phase 3: User Story 1
|
|
237
|
+
4. **STOP and VALIDATE**: Test User Story 1 independently
|
|
238
|
+
5. Deploy/demo if ready
|
|
239
|
+
|
|
240
|
+
### Incremental Delivery
|
|
241
|
+
|
|
242
|
+
1. Complete Setup + Foundational → Foundation ready
|
|
243
|
+
2. Add User Story 1 → Test independently → Deploy/Demo (MVP!)
|
|
244
|
+
3. Add User Story 2 → Test independently → Deploy/Demo
|
|
245
|
+
4. Add User Story 3 → Test independently → Deploy/Demo
|
|
246
|
+
5. Each story adds value without breaking previous stories
|
|
247
|
+
|
|
248
|
+
### Parallel Team Strategy
|
|
249
|
+
|
|
250
|
+
With multiple developers:
|
|
251
|
+
|
|
252
|
+
1. Team completes Setup + Foundational together
|
|
253
|
+
2. Once Foundational is done:
|
|
254
|
+
- Developer A: User Story 1
|
|
255
|
+
- Developer B: User Story 2
|
|
256
|
+
- Developer C: User Story 3
|
|
257
|
+
3. Stories complete and integrate independently
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
## Notes
|
|
262
|
+
|
|
263
|
+
- [P] tasks = different files, no dependencies
|
|
264
|
+
- [Story] label maps task to specific user story for traceability
|
|
265
|
+
- Each user story should be independently completable and testable
|
|
266
|
+
- Verify tests fail before implementing
|
|
267
|
+
- Commit after each task or logical group
|
|
268
|
+
- Stop at any checkpoint to validate story independently
|
|
269
|
+
- Avoid: vague tasks, same file conflicts, cross-story dependencies that break independence
|
package/README.md
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# agent-tmux
|
|
2
|
+
|
|
3
|
+
LLM-friendly tmux control plane CLI for windows/panes — with Codex TUI helpers.
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<a href="./README.md">English</a> · <a href="./README.zh-CN.md">中文</a>
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
`agent-tmux` is a small CLI that lets an AI agent (or you) control [tmux][tmux] safely:
|
|
10
|
+
list/snapshot windows and panes, resolve targets, send text/keys, read output, and (optionally)
|
|
11
|
+
drive a [Codex CLI][codex-cli] TUI pane with reliability guardrails.
|
|
12
|
+
|
|
13
|
+
### Why
|
|
14
|
+
|
|
15
|
+
- Designed for agent loops: minimal stdout by default; single-line JSON with `--json`.
|
|
16
|
+
- Safe targeting: resolves to stable `%pane_id` / `@<window_id>%<pane_id>`; ambiguity fails with candidates.
|
|
17
|
+
- Codex helpers: `codex send/session-info/fork-home/spawn` for multi-pane workflows.
|
|
18
|
+
|
|
19
|
+
### Requirements
|
|
20
|
+
|
|
21
|
+
- [Bun][bun] 1.2+ (for installing dependencies)
|
|
22
|
+
- [Node.js][nodejs] 20+
|
|
23
|
+
- [tmux][tmux] 3.x
|
|
24
|
+
- For `ui select`: tmux with `display-popup` and [fzf][fzf]
|
|
25
|
+
|
|
26
|
+
### Install (local dev)
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
bun install
|
|
30
|
+
bun run build
|
|
31
|
+
bun dist/cli/index.js --help
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Optional global binary:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
bun link
|
|
38
|
+
agent-tmux --help
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Quick start
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
agent-tmux window ls
|
|
45
|
+
agent-tmux snapshot
|
|
46
|
+
agent-tmux find codex
|
|
47
|
+
agent-tmux send %717 "echo hello"
|
|
48
|
+
agent-tmux read %717 --lines 20
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Codex (TUI) quick start
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
agent-tmux codex spawn
|
|
55
|
+
agent-tmux codex send %717 "continue" --capture-tail 60
|
|
56
|
+
agent-tmux codex session-info %717 --json
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Notes:
|
|
60
|
+
- `codex spawn` / `ui select` are meant to run inside tmux (so `TMUX_PANE` is available). Outside tmux, pass an explicit `--origin <paneTarget>` for `codex spawn`.
|
|
61
|
+
|
|
62
|
+
### Command overview
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
agent-tmux window ls|new|rename|kill
|
|
66
|
+
agent-tmux pane spawn|title|kill
|
|
67
|
+
agent-tmux snapshot
|
|
68
|
+
agent-tmux find <query>
|
|
69
|
+
agent-tmux send <paneTarget> <text>
|
|
70
|
+
agent-tmux read <paneTarget> [--lines N]
|
|
71
|
+
agent-tmux codex send|session-info|fork-home|spawn
|
|
72
|
+
agent-tmux ui select --spec -
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Targeting (paneTarget)
|
|
76
|
+
|
|
77
|
+
- `%<pane_id>` (stable)
|
|
78
|
+
- `@<window_id>%<pane_id>` (stable + asserts window)
|
|
79
|
+
- `IDX` (number; within current window scope)
|
|
80
|
+
- Keyword substring match against `COMMAND/TITLE` (within current window scope)
|
|
81
|
+
|
|
82
|
+
### Output contract
|
|
83
|
+
|
|
84
|
+
- Success: exit code `0`; stdout is the result only.
|
|
85
|
+
- Failure: non-zero exit code; stderr starts with `Error:`.
|
|
86
|
+
- `--json`: stdout is a single-line JSON object (no extra text).
|
|
87
|
+
- stdin is read only when an argument is explicitly `-` or `--spec -`.
|
|
88
|
+
|
|
89
|
+
### Environment variables
|
|
90
|
+
|
|
91
|
+
- `AGENT_TMUX_SERVER` / `AGENT_TMUX_SOCKET`: pass `tmux -L <name>` to target a specific tmux server.
|
|
92
|
+
|
|
93
|
+
### Usage with AI agents
|
|
94
|
+
|
|
95
|
+
Add to your project instructions (e.g. `AGENTS.md`):
|
|
96
|
+
|
|
97
|
+
```markdown
|
|
98
|
+
## tmux control
|
|
99
|
+
|
|
100
|
+
Use `agent-tmux` for tmux automation. Prefer `--json` for machine-readable output.
|
|
101
|
+
|
|
102
|
+
Typical flow:
|
|
103
|
+
1) `agent-tmux snapshot` / `agent-tmux find <query>`
|
|
104
|
+
2) `agent-tmux send <paneTarget> <text>`
|
|
105
|
+
3) `agent-tmux read <paneTarget> --lines 60`
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Tests
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
bun run test
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Codex e2e tests (requires local codex + credentials):
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
AGENT_TMUX_E2E_CODEX=1 bun run test
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## Links
|
|
123
|
+
|
|
124
|
+
[codex-cli]: https://github.com/openai/codex
|
|
125
|
+
[bun]: https://bun.sh
|
|
126
|
+
[fzf]: https://github.com/junegunn/fzf
|
|
127
|
+
[nodejs]: https://nodejs.org/
|
|
128
|
+
[tmux]: https://github.com/tmux/tmux
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# agent-tmux
|
|
2
|
+
|
|
3
|
+
面向 AI agent 的 tmux 控制面 CLI(支持 Codex TUI 辅助命令)。
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<a href="./README.md">English</a> · <a href="./README.zh-CN.md">中文</a>
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
`agent-tmux` 让 AI agent(或你)安全操控 [tmux][tmux]:列出/快照 window 与 pane、解析目标、发送文本/按键、读取输出;并提供一组面向 [Codex CLI][codex-cli] TUI 的增强命令,用于多 pane 并行与更可靠的输入提交。
|
|
10
|
+
|
|
11
|
+
## 为什么要用它
|
|
12
|
+
|
|
13
|
+
- 面向 agent 调用:默认 stdout 极简;`--json` 输出单行 JSON。
|
|
14
|
+
- 安全定位:目标会先解析为稳定 `%pane_id` / `@<window_id>%<pane_id>`;歧义直接失败并给候选。
|
|
15
|
+
- Codex 增强:`codex send/session-info/fork-home/spawn` 支持多会话、多 pane 工作流。
|
|
16
|
+
|
|
17
|
+
## 运行环境
|
|
18
|
+
|
|
19
|
+
- [Bun][bun] 1.2+(用于安装依赖)
|
|
20
|
+
- [Node.js][nodejs] 20+
|
|
21
|
+
- [tmux][tmux] 3.x
|
|
22
|
+
- `ui select` 需要 tmux 支持 `display-popup` 且系统存在 [fzf][fzf]
|
|
23
|
+
|
|
24
|
+
## 安装(本地开发)
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
bun install
|
|
28
|
+
bun run build
|
|
29
|
+
bun dist/cli/index.js --help
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
可选:全局安装到 `agent-tmux` 命令:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
bun link
|
|
36
|
+
agent-tmux --help
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## 快速开始
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
agent-tmux window ls
|
|
43
|
+
agent-tmux snapshot
|
|
44
|
+
agent-tmux find codex
|
|
45
|
+
agent-tmux send %717 "echo hello"
|
|
46
|
+
agent-tmux read %717 --lines 20
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Codex(TUI)快速开始
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
agent-tmux codex spawn
|
|
53
|
+
agent-tmux codex send %717 "继续" --capture-tail 60
|
|
54
|
+
agent-tmux codex session-info %717 --json
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
注意:
|
|
58
|
+
- `codex spawn` / `ui select` 预期在 tmux 内运行(需要 `TMUX_PANE`)。在 tmux 外运行 `codex spawn` 时,请显式提供 `--origin <paneTarget>`。
|
|
59
|
+
|
|
60
|
+
## 命令概览
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
agent-tmux window ls|new|rename|kill
|
|
64
|
+
agent-tmux pane spawn|title|kill
|
|
65
|
+
agent-tmux snapshot
|
|
66
|
+
agent-tmux find <query>
|
|
67
|
+
agent-tmux send <paneTarget> <text>
|
|
68
|
+
agent-tmux read <paneTarget> [--lines N]
|
|
69
|
+
agent-tmux codex send|session-info|fork-home|spawn
|
|
70
|
+
agent-tmux ui select --spec -
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## 目标定位(paneTarget)
|
|
74
|
+
|
|
75
|
+
- `%<pane_id>`(稳定定位)
|
|
76
|
+
- `@<window_id>%<pane_id>`(稳定定位 + 断言所属 window)
|
|
77
|
+
- `IDX`(纯数字;仅在当前 window scope 内)
|
|
78
|
+
- 关键词(对 `COMMAND/TITLE` 的大小写不敏感子串匹配;仅在当前 window scope 内)
|
|
79
|
+
|
|
80
|
+
## 输出契约(给 agent 用)
|
|
81
|
+
|
|
82
|
+
- 成功:exit code `0`;stdout 只输出结果。
|
|
83
|
+
- 失败:非零 exit code;stderr 以 `Error:` 开头。
|
|
84
|
+
- `--json`:stdout 为单行 JSON(不夹杂其他文本)。
|
|
85
|
+
- 默认不读 stdin;只有参数显式为 `-` 或 `--spec -` 才读到 EOF。
|
|
86
|
+
|
|
87
|
+
## 环境变量
|
|
88
|
+
|
|
89
|
+
- `AGENT_TMUX_SERVER` / `AGENT_TMUX_SOCKET`:传入 `tmux -L <name>`,用于指定 tmux server。
|
|
90
|
+
|
|
91
|
+
## 给 AI agent 的用法建议
|
|
92
|
+
|
|
93
|
+
建议把下面片段加入项目说明(例如 `AGENTS.md`):
|
|
94
|
+
|
|
95
|
+
```markdown
|
|
96
|
+
## tmux 控制
|
|
97
|
+
|
|
98
|
+
使用 `agent-tmux` 做 tmux 自动化。机器可读场景优先 `--json`。
|
|
99
|
+
|
|
100
|
+
常见流程:
|
|
101
|
+
1) `agent-tmux snapshot` / `agent-tmux find <query>`
|
|
102
|
+
2) `agent-tmux send <paneTarget> <text>`
|
|
103
|
+
3) `agent-tmux read <paneTarget> --lines 60`
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## 测试
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
bun run test
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Codex e2e(需要本机 codex + 凭据):
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
AGENT_TMUX_E2E_CODEX=1 bun run test
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## Links
|
|
121
|
+
|
|
122
|
+
[codex-cli]: https://github.com/openai/codex
|
|
123
|
+
[bun]: https://bun.sh
|
|
124
|
+
[fzf]: https://github.com/junegunn/fzf
|
|
125
|
+
[nodejs]: https://nodejs.org/
|
|
126
|
+
[tmux]: https://github.com/tmux/tmux
|
|
127
|
+
|