s9n-devops-agent 1.0.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/LICENSE +21 -0
- package/README.md +318 -0
- package/bin/cs-devops-agent +151 -0
- package/cleanup-sessions.sh +70 -0
- package/docs/PROJECT_INFO.md +115 -0
- package/docs/RELEASE_NOTES.md +189 -0
- package/docs/SESSION_MANAGEMENT.md +120 -0
- package/docs/TESTING.md +331 -0
- package/docs/houserules.md +267 -0
- package/docs/infrastructure.md +68 -0
- package/docs/testing-guide.md +224 -0
- package/package.json +68 -0
- package/src/agent-commands.js +211 -0
- package/src/claude-session-manager.js +488 -0
- package/src/close-session.js +316 -0
- package/src/cs-devops-agent-worker.js +1660 -0
- package/src/run-with-agent.js +372 -0
- package/src/session-coordinator.js +1207 -0
- package/src/setup-cs-devops-agent.js +985 -0
- package/src/worktree-manager.js +768 -0
- package/start-devops-session.sh +299 -0
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
# Claude House Rules for CS_DevOpsAgent
|
|
2
|
+
|
|
3
|
+
## Testing Policy (Required)
|
|
4
|
+
|
|
5
|
+
Goal: Every bug fix and feature ships with an executable test.
|
|
6
|
+
|
|
7
|
+
Location: test_cases/<area>/<component>/.
|
|
8
|
+
|
|
9
|
+
DoD: (1) failing test reproduces bug (red), (2) fix makes it pass (green), (3) tests wired into CI and local runner.
|
|
10
|
+
|
|
11
|
+
Naming: YYYYMMDD_<short-slug>_spec.(py|ts|js|go|rb|java)
|
|
12
|
+
|
|
13
|
+
Non-duplication: Extend existing tests for the same bug.
|
|
14
|
+
|
|
15
|
+
Determinism: No flaky/random tests; use seeds and fake timers.
|
|
16
|
+
|
|
17
|
+
## Test Generation Rules (for Claude / code assistants)
|
|
18
|
+
|
|
19
|
+
Always write the failing test first.
|
|
20
|
+
|
|
21
|
+
Infer <area>/<component> from changed paths.
|
|
22
|
+
|
|
23
|
+
Stub external services; avoid real I/O unless explicitly needed.
|
|
24
|
+
|
|
25
|
+
Use native runners per language (pytest, vitest/jest, go test, rspec, JUnit).
|
|
26
|
+
|
|
27
|
+
Add short "why it failed before the fix" note in the test.
|
|
28
|
+
|
|
29
|
+
## Test Case Template
|
|
30
|
+
```
|
|
31
|
+
# Test Case: <human title>
|
|
32
|
+
- Area: <e.g., worktree>
|
|
33
|
+
- Component: <e.g., manager>
|
|
34
|
+
- Related Issue/PR: <#id or link>
|
|
35
|
+
- Repro Summary: <steps/inputs>
|
|
36
|
+
- Expected Behavior: <should happen>
|
|
37
|
+
- Regression Guard: <what breaks if it fails again>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
<code block with the actual test file content>
|
|
41
|
+
|
|
42
|
+
## Partial Test Execution (Targeted Runs)
|
|
43
|
+
|
|
44
|
+
By default, local runs and CI only execute tests for changed areas (files in the PR/branch).
|
|
45
|
+
|
|
46
|
+
Areas are inferred from changed file paths and mapped to test_cases/<area>/<component> directories.
|
|
47
|
+
|
|
48
|
+
If we can't infer a mapping, we fallback to full suite.
|
|
49
|
+
|
|
50
|
+
You can override the scope:
|
|
51
|
+
|
|
52
|
+
scripts/run-tests --all → full suite
|
|
53
|
+
|
|
54
|
+
scripts/run-tests --changed → only changed areas (default)
|
|
55
|
+
|
|
56
|
+
scripts/run-tests test_cases/<area>/<component> → specific folder
|
|
57
|
+
|
|
58
|
+
## Logging Policy
|
|
59
|
+
|
|
60
|
+
All test scripts log with UTC timestamps, levels (INFO/WARN/ERROR/DEBUG), and grouping for CI.
|
|
61
|
+
|
|
62
|
+
Set LOG_LEVEL to debug|info|warn|error (default info).
|
|
63
|
+
|
|
64
|
+
Enable deep tracing with TRACE=1 (verbose commands, environment, and selection decisions).
|
|
65
|
+
|
|
66
|
+
## Auto-Run on Bugfix Workflow
|
|
67
|
+
|
|
68
|
+
If the current branch name or latest commit message contains fix: or bug:, targeted tests for the affected areas run first; if they pass, we run the rest of that language's suite.
|
|
69
|
+
|
|
70
|
+
CI blocks merge if: tests fail or a bugfix PR lacks an associated test.
|
|
71
|
+
|
|
72
|
+
## Code Style Guidelines for CS_DevOpsAgent
|
|
73
|
+
|
|
74
|
+
### Comment Style
|
|
75
|
+
- Use descriptive header comments for major sections
|
|
76
|
+
- Include purpose and key features at the top of files
|
|
77
|
+
- Document complex logic inline
|
|
78
|
+
- Keep comments concise but informative
|
|
79
|
+
|
|
80
|
+
### Module Structure
|
|
81
|
+
- Group related functionality together
|
|
82
|
+
- Use clear section separators
|
|
83
|
+
- Export modules properly for reuse
|
|
84
|
+
- Maintain consistent naming conventions
|
|
85
|
+
|
|
86
|
+
### Error Handling
|
|
87
|
+
- Always handle errors gracefully
|
|
88
|
+
- Log errors with appropriate levels
|
|
89
|
+
- Provide useful error messages
|
|
90
|
+
- Clean up resources on failure
|
|
91
|
+
|
|
92
|
+
### Worktree Management Specifics
|
|
93
|
+
- Always check if running in CS_DevOpsAgent repo itself
|
|
94
|
+
- Detect agent from environment variables
|
|
95
|
+
- Create isolated worktrees per agent
|
|
96
|
+
- Maintain agent configuration files
|
|
97
|
+
- Handle branch naming consistently
|
|
98
|
+
|
|
99
|
+
## Usage Examples
|
|
100
|
+
|
|
101
|
+
Run only changed areas (default):
|
|
102
|
+
```bash
|
|
103
|
+
scripts/run-tests --changed
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Force full suite:
|
|
107
|
+
```bash
|
|
108
|
+
scripts/run-tests --all
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Force a folder (e.g., during triage):
|
|
112
|
+
```bash
|
|
113
|
+
scripts/run-tests test_cases/worktree/manager
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Increase logs:
|
|
117
|
+
```bash
|
|
118
|
+
LOG_LEVEL=debug scripts/run-tests --changed
|
|
119
|
+
TRACE=1 scripts/run-tests --changed
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Infrastructure Documentation Policy (NEW)
|
|
123
|
+
|
|
124
|
+
### Purpose
|
|
125
|
+
Track all infrastructure changes in a centralized location for team visibility and compliance.
|
|
126
|
+
|
|
127
|
+
### Location
|
|
128
|
+
`/Documentation/infrastructure.md` - Created automatically if it doesn't exist.
|
|
129
|
+
|
|
130
|
+
### What to Document
|
|
131
|
+
- **Configuration Changes**: Environment variables, settings files, config updates
|
|
132
|
+
- **Dependency Updates**: New packages, version changes, removals
|
|
133
|
+
- **Build System Changes**: Scripts, build configs, CI/CD updates
|
|
134
|
+
- **Architecture Changes**: New services, components, integrations
|
|
135
|
+
- **Database Changes**: Schema updates, migrations, indexes
|
|
136
|
+
- **API Changes**: Endpoints, authentication, rate limits
|
|
137
|
+
- **Security Changes**: Auth updates, certificates, permissions
|
|
138
|
+
|
|
139
|
+
### Format
|
|
140
|
+
```markdown
|
|
141
|
+
## [Date] - [Agent/Developer Name]
|
|
142
|
+
### Category: [Config|Dependencies|Build|Architecture|Database|API|Security]
|
|
143
|
+
**Change Type**: [Added|Modified|Removed|Fixed]
|
|
144
|
+
**Component**: [Affected component/service]
|
|
145
|
+
**Description**: Brief description of the change
|
|
146
|
+
**Reason**: Why this change was necessary
|
|
147
|
+
**Impact**: Potential impacts or considerations
|
|
148
|
+
**Files Changed**:
|
|
149
|
+
- file1.js
|
|
150
|
+
- config/settings.json
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Auto-Detection Rules
|
|
154
|
+
1. Monitor for changes in:
|
|
155
|
+
- `package.json`, `package-lock.json`
|
|
156
|
+
- `.env`, `.env.*` files
|
|
157
|
+
- `*config*.js`, `*config*.json`
|
|
158
|
+
- `Dockerfile`, `docker-compose.yml`
|
|
159
|
+
- `.github/workflows/*`
|
|
160
|
+
- Database migration files
|
|
161
|
+
- API route definitions
|
|
162
|
+
|
|
163
|
+
2. Auto-generate entry when detected
|
|
164
|
+
3. Include in commit message: `infra:` prefix when infrastructure changes detected
|
|
165
|
+
|
|
166
|
+
### Commit Message Enhancement
|
|
167
|
+
When infrastructure changes are detected:
|
|
168
|
+
```
|
|
169
|
+
infra(category): description
|
|
170
|
+
|
|
171
|
+
- Updated /Documentation/infrastructure.md
|
|
172
|
+
- [List of infrastructure changes]
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Example:
|
|
176
|
+
```
|
|
177
|
+
infra(deps): add worktree management dependencies
|
|
178
|
+
|
|
179
|
+
- Updated /Documentation/infrastructure.md
|
|
180
|
+
- Added chokidar@3.5.3 for file watching
|
|
181
|
+
- Added execa@6.1.0 for process management
|
|
182
|
+
- Modified package.json scripts
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## Environment Variables for Worktree Management
|
|
186
|
+
|
|
187
|
+
- `AGENT_NAME` or `AI_AGENT`: Identifies the AI agent
|
|
188
|
+
- `AGENT_TASK` or `AI_TASK`: Task or feature being worked on
|
|
189
|
+
- `AC_USE_WORKTREE`: Enable/disable worktree creation (true/false/auto)
|
|
190
|
+
- `AC_MSG_FILE`: Path to agent-specific commit message file
|
|
191
|
+
- `AC_BRANCH_PREFIX`: Prefix for agent branches
|
|
192
|
+
- `AC_TRACK_INFRA`: Enable infrastructure tracking (default: true)
|
|
193
|
+
- `AC_INFRA_DOC_PATH`: Path to infrastructure doc (default: /Documentation/infrastructure.md)
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## Prep TODO & Coordination (Multi-Agent Handshake)
|
|
198
|
+
|
|
199
|
+
**Purpose:** Prevent agents from stepping on each other by publishing an _edit plan_ before changing files. The commit agent reads these plans, reserves shards (coarse path buckets), and either **acknowledges** or **blocks** the work.
|
|
200
|
+
|
|
201
|
+
### Agent Workflow
|
|
202
|
+
|
|
203
|
+
**Agents MUST write** a single JSON at `.ac-prep/<agent>.json` **before** edits and wait for `.ac/ack/<agent>.json`.
|
|
204
|
+
|
|
205
|
+
### Prep JSON Format
|
|
206
|
+
```json
|
|
207
|
+
{
|
|
208
|
+
"agent": "<agent-id>",
|
|
209
|
+
"task": "<short-slug>",
|
|
210
|
+
"branch": "<target-branch>",
|
|
211
|
+
"paths": ["<glob1>", "<glob2>"],
|
|
212
|
+
"shards": ["<shard1>", "<shard2>"],
|
|
213
|
+
"reason": "<why>",
|
|
214
|
+
"priority": 1-10,
|
|
215
|
+
"createdAt": "<ISO-8601>",
|
|
216
|
+
"ttlMs": 600000
|
|
217
|
+
}
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### Flow
|
|
221
|
+
|
|
222
|
+
1. **Write prep file** → `.ac-prep/<agent>.json`
|
|
223
|
+
2. **Wait for acknowledgment** → `.ac/ack/<agent>.json`
|
|
224
|
+
3. **Check status**:
|
|
225
|
+
- `status:"ok"` → proceed only within acknowledged paths/shards
|
|
226
|
+
- `status:"blocked"` → do not edit; narrow scope or wait; re-publish
|
|
227
|
+
- `status:"queued"` → wait for turn based on priority
|
|
228
|
+
4. **After edits** → write `.claude-commit-msg` (Conventional Commit + 1–3 bullets)
|
|
229
|
+
5. **If alert appears** → `.git/.ac/alerts/<agent>.md` → re-run with narrower scope
|
|
230
|
+
|
|
231
|
+
### Shard System
|
|
232
|
+
|
|
233
|
+
Shards live in `.ac-shards.json`. The commit agent:
|
|
234
|
+
- **Reserves shards** on prep, acks or blocks
|
|
235
|
+
- **At commit**, claims shards and stages only owned files
|
|
236
|
+
- **Overlapping work** is blocked/queued/branched per config
|
|
237
|
+
- **Writes human alerts** to `.git/.ac/alerts/<agent>.md` when overlap occurs
|
|
238
|
+
|
|
239
|
+
### Priority Levels
|
|
240
|
+
- `10`: Critical hotfix
|
|
241
|
+
- `7-9`: High priority features
|
|
242
|
+
- `4-6`: Normal development
|
|
243
|
+
- `1-3`: Low priority/cleanup
|
|
244
|
+
|
|
245
|
+
### Conflict Resolution Strategy
|
|
246
|
+
```
|
|
247
|
+
AC_SHARD_STRATEGY options:
|
|
248
|
+
- "block": Prevent overlapping edits (default)
|
|
249
|
+
- "branch": Create agent-specific branches
|
|
250
|
+
- "queue": Queue based on priority and timestamp
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
### Agent Identification
|
|
254
|
+
Agents are identified by:
|
|
255
|
+
- Environment variable: `AGENT_NAME` or `AI_AGENT`
|
|
256
|
+
- Auto-detection from API keys (Claude, Copilot, Cursor, etc.)
|
|
257
|
+
- Session-based: `session-${USER}@${HOSTNAME}`
|
|
258
|
+
|
|
259
|
+
### Monitoring
|
|
260
|
+
Check coordination status:
|
|
261
|
+
```bash
|
|
262
|
+
ls -la .ac-prep/ # Pending prep requests
|
|
263
|
+
ls -la .ac/ack/ # Acknowledgments
|
|
264
|
+
ls -la .git/.ac/alerts/ # Conflict alerts
|
|
265
|
+
cat .git/.ac/claims/*.json # Active claims
|
|
266
|
+
```
|
|
267
|
+
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Infrastructure Change Log
|
|
2
|
+
|
|
3
|
+
This document tracks all infrastructure changes made to the project. It is automatically updated when infrastructure-related files are modified.
|
|
4
|
+
|
|
5
|
+
## Format Guidelines
|
|
6
|
+
|
|
7
|
+
Each entry should follow this format:
|
|
8
|
+
```
|
|
9
|
+
## [Date] - [Agent/Developer Name]
|
|
10
|
+
### Category: [Config|Dependencies|Build|Architecture|Database|API|Security]
|
|
11
|
+
**Change Type**: [Added|Modified|Removed|Fixed]
|
|
12
|
+
**Component**: [Affected component/service]
|
|
13
|
+
**Description**: Brief description of the change
|
|
14
|
+
**Reason**: Why this change was necessary
|
|
15
|
+
**Impact**: Potential impacts or considerations
|
|
16
|
+
**Files Changed**:
|
|
17
|
+
- file1.js
|
|
18
|
+
- config/settings.json
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## 2025-01-28 - System
|
|
24
|
+
|
|
25
|
+
### Category: Architecture
|
|
26
|
+
**Change Type**: Added
|
|
27
|
+
**Component**: CS_DevOpsAgent
|
|
28
|
+
**Description**: Initial infrastructure documentation setup
|
|
29
|
+
**Reason**: Establish centralized tracking of infrastructure changes
|
|
30
|
+
**Impact**: All future infrastructure changes will be logged here
|
|
31
|
+
**Files Changed**:
|
|
32
|
+
- Documentation/infrastructure.md (created)
|
|
33
|
+
- claude.md (updated with infrastructure policy)
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## 2025-01-28 - System
|
|
38
|
+
|
|
39
|
+
### Category: Dependencies
|
|
40
|
+
**Change Type**: Added
|
|
41
|
+
**Component**: CS_DevOpsAgent Testing
|
|
42
|
+
**Description**: Added test infrastructure and logging libraries
|
|
43
|
+
**Reason**: Enable comprehensive testing with targeted execution
|
|
44
|
+
**Impact**: Improved test coverage and CI/CD integration
|
|
45
|
+
**Files Changed**:
|
|
46
|
+
- scripts/lib/log.sh
|
|
47
|
+
- scripts/changed-areas.sh
|
|
48
|
+
- scripts/run-tests
|
|
49
|
+
- test_cases/* (structure created)
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## 2025-01-28 - System
|
|
54
|
+
|
|
55
|
+
### Category: Architecture
|
|
56
|
+
**Change Type**: Added
|
|
57
|
+
**Component**: Worktree Management
|
|
58
|
+
**Description**: Implemented multi-agent worktree management system
|
|
59
|
+
**Reason**: Enable parallel development by multiple AI agents
|
|
60
|
+
**Impact**: Agents can now work simultaneously without conflicts
|
|
61
|
+
**Files Changed**:
|
|
62
|
+
- worktree-manager.js
|
|
63
|
+
- run-with-agent.js
|
|
64
|
+
- cs-devops-agent-worker.js (enhanced with worktree detection)
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
<!-- New entries will be added above this line -->
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
# Multi-Agent Coordination Testing Guide
|
|
2
|
+
|
|
3
|
+
**Date:** September 28, 2025
|
|
4
|
+
**Version:** 1.0
|
|
5
|
+
**Author:** SecondBrain AI
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 🎯 Overview
|
|
10
|
+
|
|
11
|
+
This guide documents how to test and validate the multi-agent coordination system in CS_DevOpsAgent. The system prevents conflicts when multiple AI agents (Claude, Copilot, Cursor, Warp, etc.) work on the same codebase simultaneously.
|
|
12
|
+
|
|
13
|
+
## 🧪 Test Scripts Available
|
|
14
|
+
|
|
15
|
+
### 1. Simple Coordination Test
|
|
16
|
+
**File:** `test-coordination-simple.sh`
|
|
17
|
+
**Purpose:** Quick validation of coordination system setup and basic functionality
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
./test-coordination-simple.sh
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
**What it tests:**
|
|
24
|
+
- ✅ Coordination directories exist
|
|
25
|
+
- ✅ Configuration files present
|
|
26
|
+
- ✅ Agent prep requests can be created
|
|
27
|
+
- ✅ Multiple agents can request concurrently
|
|
28
|
+
- ✅ Monitoring capabilities
|
|
29
|
+
|
|
30
|
+
### 2. Comprehensive Test Suite
|
|
31
|
+
**File:** `test-coordination.sh`
|
|
32
|
+
**Purpose:** Full test suite with isolated environment
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
./test-coordination.sh
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**What it tests:**
|
|
39
|
+
- Setup script idempotency
|
|
40
|
+
- Directory structure creation
|
|
41
|
+
- JSON template generation
|
|
42
|
+
- Priority ordering
|
|
43
|
+
- Shard reservation system
|
|
44
|
+
- Expiration handling
|
|
45
|
+
|
|
46
|
+
### 3. Multi-Agent Simulation
|
|
47
|
+
**File:** `simulate-multi-agents.sh`
|
|
48
|
+
**Purpose:** Simulates multiple agents working concurrently in separate processes
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
./simulate-multi-agents.sh
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**Features:**
|
|
55
|
+
- Simulates 4 different agents (Claude, Copilot, Cursor, Warp)
|
|
56
|
+
- Each agent runs in a separate background process
|
|
57
|
+
- Real-time monitoring dashboard
|
|
58
|
+
- Conflict detection simulation
|
|
59
|
+
- Generates comprehensive report
|
|
60
|
+
|
|
61
|
+
## 📊 Test Results Interpretation
|
|
62
|
+
|
|
63
|
+
### Success Indicators
|
|
64
|
+
- ✅ All prep requests created successfully
|
|
65
|
+
- ✅ No file conflicts between agents
|
|
66
|
+
- ✅ Proper priority ordering maintained
|
|
67
|
+
- ✅ Monitoring shows accurate status
|
|
68
|
+
|
|
69
|
+
### Warning Signs
|
|
70
|
+
- ⚠️ Alerts generated in `.git/.ac/alerts/`
|
|
71
|
+
- ⚠️ Blocked acknowledgments
|
|
72
|
+
- ⚠️ Expired requests not cleaned up
|
|
73
|
+
- ⚠️ Missing configuration files
|
|
74
|
+
|
|
75
|
+
## 🔧 Manual Testing Scenarios
|
|
76
|
+
|
|
77
|
+
### Scenario 1: Two Agents, Same Shard
|
|
78
|
+
Simulate Claude and Copilot trying to edit the same service files:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# Terminal 1 - Claude
|
|
82
|
+
export AGENT_NAME="claude"
|
|
83
|
+
./agent-prep.sh "auth-service" "src/services/**" 6
|
|
84
|
+
|
|
85
|
+
# Terminal 2 - Copilot (run immediately after)
|
|
86
|
+
export AGENT_NAME="copilot"
|
|
87
|
+
./agent-prep.sh "api-update" "src/services/**" 7
|
|
88
|
+
|
|
89
|
+
# Check for conflicts
|
|
90
|
+
ls -la .git/.ac/alerts/
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Scenario 2: Priority Queue Test
|
|
94
|
+
Test that high-priority requests are processed first:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
# Low priority request
|
|
98
|
+
export AGENT_NAME="agent1"
|
|
99
|
+
./agent-prep.sh "cleanup" "docs/**" 2
|
|
100
|
+
|
|
101
|
+
# High priority request
|
|
102
|
+
export AGENT_NAME="agent2"
|
|
103
|
+
./agent-prep.sh "hotfix" "src/core/**" 10
|
|
104
|
+
|
|
105
|
+
# Monitor processing order
|
|
106
|
+
./monitor-agents.sh
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Scenario 3: Concurrent Non-Conflicting Work
|
|
110
|
+
Test multiple agents working on different shards:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
# Each in a separate terminal
|
|
114
|
+
export AGENT_NAME="claude" && ./agent-prep.sh "docs-update" "docs/**" 5
|
|
115
|
+
export AGENT_NAME="copilot" && ./agent-prep.sh "test-suite" "tests/**" 5
|
|
116
|
+
export AGENT_NAME="cursor" && ./agent-prep.sh "config-update" "config/**" 5
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## 🔍 Monitoring During Tests
|
|
120
|
+
|
|
121
|
+
### Real-Time Status
|
|
122
|
+
```bash
|
|
123
|
+
# Watch active requests
|
|
124
|
+
watch -n 2 'ls -la .ac-prep/*.json | grep -v template'
|
|
125
|
+
|
|
126
|
+
# Monitor acknowledgments
|
|
127
|
+
watch -n 2 'ls -la .ac/ack/*.json | grep -v template'
|
|
128
|
+
|
|
129
|
+
# Check for alerts
|
|
130
|
+
watch -n 2 'ls -la .git/.ac/alerts/'
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Using the Monitor Script
|
|
134
|
+
```bash
|
|
135
|
+
./monitor-agents.sh
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Shows:
|
|
139
|
+
- Active prep requests with priorities
|
|
140
|
+
- Current acknowledgments
|
|
141
|
+
- Any conflict alerts
|
|
142
|
+
- Processing queue status
|
|
143
|
+
|
|
144
|
+
## 🐛 Troubleshooting Test Issues
|
|
145
|
+
|
|
146
|
+
### Issue: Tests fail with "command not found"
|
|
147
|
+
**Solution:** Ensure setup script has been run:
|
|
148
|
+
```bash
|
|
149
|
+
./setup-prep-handshake.sh
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Issue: "Permission denied" errors
|
|
153
|
+
**Solution:** Make scripts executable:
|
|
154
|
+
```bash
|
|
155
|
+
chmod +x *.sh
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Issue: JSON parsing errors
|
|
159
|
+
**Solution:** Install jq for better JSON handling:
|
|
160
|
+
```bash
|
|
161
|
+
brew install jq # macOS
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Issue: Simulation hangs
|
|
165
|
+
**Solution:** Kill background processes:
|
|
166
|
+
```bash
|
|
167
|
+
pkill -f agent-prep
|
|
168
|
+
rm -rf /tmp/multi-agent-sim-*
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## 📈 Performance Benchmarks
|
|
172
|
+
|
|
173
|
+
Expected timings for a healthy system:
|
|
174
|
+
- Prep request creation: < 100ms
|
|
175
|
+
- Acknowledgment generation: < 200ms
|
|
176
|
+
- Conflict detection: < 500ms
|
|
177
|
+
- Full simulation (4 agents): ~30 seconds
|
|
178
|
+
|
|
179
|
+
## 🔄 Continuous Testing
|
|
180
|
+
|
|
181
|
+
### Pre-Commit Hook
|
|
182
|
+
Add to `.git/hooks/pre-commit`:
|
|
183
|
+
```bash
|
|
184
|
+
#!/bin/bash
|
|
185
|
+
./test-coordination-simple.sh
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### CI/CD Integration
|
|
189
|
+
For GitHub Actions:
|
|
190
|
+
```yaml
|
|
191
|
+
- name: Test Multi-Agent Coordination
|
|
192
|
+
run: |
|
|
193
|
+
./setup-prep-handshake.sh
|
|
194
|
+
./test-coordination-simple.sh
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## 📝 Test Coverage
|
|
198
|
+
|
|
199
|
+
Current test coverage:
|
|
200
|
+
- ✅ Basic setup validation: 100%
|
|
201
|
+
- ✅ Request creation: 100%
|
|
202
|
+
- ✅ Concurrent requests: 90%
|
|
203
|
+
- ⚠️ Conflict resolution: 70%
|
|
204
|
+
- ⚠️ Expiration handling: 60%
|
|
205
|
+
- 🔄 Real-time coordination: In progress
|
|
206
|
+
|
|
207
|
+
## 🚀 Next Steps
|
|
208
|
+
|
|
209
|
+
To improve testing:
|
|
210
|
+
1. Add automated conflict resolution tests
|
|
211
|
+
2. Implement deadline expiration tests
|
|
212
|
+
3. Add stress testing (10+ concurrent agents)
|
|
213
|
+
4. Create integration tests with actual Git operations
|
|
214
|
+
5. Add performance regression tests
|
|
215
|
+
|
|
216
|
+
## 📚 Related Documentation
|
|
217
|
+
|
|
218
|
+
- [Multi-Agent Coordination Update Notes](../Update%20Notes/2025-09-28-multi-agent-coordination.md)
|
|
219
|
+
- [House Rules](../houserules.md)
|
|
220
|
+
- [README](../README.md#-multi-agent-coordination)
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
**Note:** Always run tests in a clean environment to ensure accurate results. The coordination system is designed to be idempotent, so running setup multiple times should not cause issues.
|
package/package.json
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "s9n-devops-agent",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "CS_DevOpsAgent - Intelligent Git Automation System with multi-agent support and session management",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "src/cs-devops-agent-worker.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"s9n-devops-agent": "./bin/cs-devops-agent"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"bin/",
|
|
12
|
+
"src/",
|
|
13
|
+
"docs/",
|
|
14
|
+
"start-devops-session.sh",
|
|
15
|
+
"cleanup-sessions.sh",
|
|
16
|
+
"LICENSE",
|
|
17
|
+
"README.md"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"start": "./start-devops-session.sh",
|
|
21
|
+
"dev": "./start-devops-session.sh",
|
|
22
|
+
"devops": "./start-devops-session.sh",
|
|
23
|
+
"devops:list": "node src/session-coordinator.js list",
|
|
24
|
+
"devops:start": "node src/session-coordinator.js start",
|
|
25
|
+
"devops:close": "node src/close-session.js",
|
|
26
|
+
"devops:cleanup": "./cleanup-sessions.sh",
|
|
27
|
+
"setup": "node src/setup-cs-devops-agent.js",
|
|
28
|
+
"test": "jest test_cases/",
|
|
29
|
+
"test:watch": "jest --watch",
|
|
30
|
+
"test:coverage": "jest --coverage",
|
|
31
|
+
"test:worktree": "jest test_cases/worktree/",
|
|
32
|
+
"test:e2e": "./test_scripts/test-multi-agent-e2e.sh",
|
|
33
|
+
"test:push-behind": "jest test_scripts/push_behind_spec.js",
|
|
34
|
+
"test:debug": "./debug-failing-tests.sh"
|
|
35
|
+
},
|
|
36
|
+
"keywords": [
|
|
37
|
+
"git",
|
|
38
|
+
"automation",
|
|
39
|
+
"commit",
|
|
40
|
+
"workflow",
|
|
41
|
+
"vscode",
|
|
42
|
+
"branching",
|
|
43
|
+
"development-tools"
|
|
44
|
+
],
|
|
45
|
+
"author": "Sachin Dev Duggal",
|
|
46
|
+
"license": "MIT",
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"chokidar": "^3.5.3",
|
|
49
|
+
"execa": "^7.1.1"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"jest": "^29.7.0"
|
|
53
|
+
},
|
|
54
|
+
"engines": {
|
|
55
|
+
"node": ">=16.0.0"
|
|
56
|
+
},
|
|
57
|
+
"publishConfig": {
|
|
58
|
+
"access": "public"
|
|
59
|
+
},
|
|
60
|
+
"repository": {
|
|
61
|
+
"type": "git",
|
|
62
|
+
"url": "git+https://github.com/SecondBrainAICo/CS_DevOpsAgent.git"
|
|
63
|
+
},
|
|
64
|
+
"bugs": {
|
|
65
|
+
"url": "https://github.com/SecondBrainAICo/CS_DevOpsAgent/issues"
|
|
66
|
+
},
|
|
67
|
+
"homepage": "https://github.com/SecondBrainAICo/CS_DevOpsAgent#readme"
|
|
68
|
+
}
|