s9n-devops-agent 1.2.1 → 1.3.3
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/README.md +210 -56
- package/docs/INSTALLATION_GUIDE.md +366 -0
- package/docs/houserules.md +51 -0
- package/package.json +5 -1
- package/src/display-utils.cjs +350 -0
- package/src/file-coordinator.cjs +356 -0
- package/src/file-monitor-enhanced.cjs +338 -0
- package/src/house-rules-manager.js +610 -0
- package/src/session-coordinator.js +122 -17
- package/src/setup-cs-devops-agent.js +5 -3
- package/start-devops-session.sh +188 -18
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
# Installation & Setup Guide
|
|
2
|
+
|
|
3
|
+
## Table of Contents
|
|
4
|
+
1. [Prerequisites](#prerequisites)
|
|
5
|
+
2. [Installation Methods](#installation-methods)
|
|
6
|
+
3. [Quick Start (One Command!)](#quick-start-one-command)
|
|
7
|
+
4. [House Rules System](#house-rules-system)
|
|
8
|
+
5. [Configuration Options](#configuration-options)
|
|
9
|
+
6. [CI/CD Setup](#cicd-setup)
|
|
10
|
+
7. [Troubleshooting](#troubleshooting)
|
|
11
|
+
|
|
12
|
+
## Prerequisites
|
|
13
|
+
|
|
14
|
+
- **Node.js**: Version 16.0.0 or higher
|
|
15
|
+
- **Git**: Version 2.20.0 or higher (for worktree support)
|
|
16
|
+
- **Operating System**: macOS, Linux, or Windows with WSL
|
|
17
|
+
- **Terminal**: Any modern terminal (zsh, bash, fish)
|
|
18
|
+
|
|
19
|
+
## Installation Methods
|
|
20
|
+
|
|
21
|
+
### Method 1: NPM Package (Recommended)
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# Global installation (recommended)
|
|
25
|
+
npm install -g s9n-devops-agent
|
|
26
|
+
|
|
27
|
+
# Or local installation
|
|
28
|
+
npm install --save-dev s9n-devops-agent
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Method 2: From Source
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# Clone the repository
|
|
35
|
+
git clone https://github.com/SecondBrainAICo/CS_DevOpsAgent.git
|
|
36
|
+
cd CS_DevOpsAgent
|
|
37
|
+
|
|
38
|
+
# Install dependencies
|
|
39
|
+
npm install
|
|
40
|
+
|
|
41
|
+
# Link globally for CLI access
|
|
42
|
+
npm link
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Quick Start (One Command!)
|
|
46
|
+
|
|
47
|
+
### 🚀 The Simplest Setup Ever
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# Just run this - it handles EVERYTHING!
|
|
51
|
+
npm start
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**That's it!** On first run, `npm start` will:
|
|
55
|
+
|
|
56
|
+
1. ✅ **Check for house rules** - Create if missing, update if needed
|
|
57
|
+
2. ✅ **Set up file coordination** - Prevent AI agents from conflicting
|
|
58
|
+
3. ✅ **Configure your identity** - Set developer initials
|
|
59
|
+
4. ✅ **Set version strategy** - Configure how versions increment
|
|
60
|
+
5. ✅ **Start session manager** - Ready to create AI coding sessions
|
|
61
|
+
|
|
62
|
+
### What Happens on First Run?
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
$ npm start
|
|
66
|
+
|
|
67
|
+
═══════════════════════════════════════════════════════════
|
|
68
|
+
First-time Setup: House Rules & File Coordination
|
|
69
|
+
═══════════════════════════════════════════════════════════
|
|
70
|
+
|
|
71
|
+
House rules help AI agents understand your project conventions and
|
|
72
|
+
prevent conflicts when multiple agents work on the same codebase.
|
|
73
|
+
|
|
74
|
+
Would you like to:
|
|
75
|
+
1) Create comprehensive house rules (recommended)
|
|
76
|
+
2) Specify path to existing house rules
|
|
77
|
+
3) Skip for now
|
|
78
|
+
|
|
79
|
+
Your choice [1]: 1
|
|
80
|
+
✓ Will create comprehensive house rules at: houserules.md
|
|
81
|
+
|
|
82
|
+
Setting up file coordination system...
|
|
83
|
+
✓ File coordination directories created
|
|
84
|
+
✓ Setup complete! AI agents will now follow house rules and coordinate file edits.
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## House Rules System
|
|
88
|
+
|
|
89
|
+
### What Are House Rules?
|
|
90
|
+
|
|
91
|
+
House rules are project conventions that teach AI agents:
|
|
92
|
+
- How to write code in your style
|
|
93
|
+
- How to coordinate with other agents
|
|
94
|
+
- How to format commits
|
|
95
|
+
- How to handle documentation
|
|
96
|
+
|
|
97
|
+
### Automatic Management
|
|
98
|
+
|
|
99
|
+
The DevOps Agent uses an intelligent versioning system:
|
|
100
|
+
|
|
101
|
+
```markdown
|
|
102
|
+
<!-- DEVOPS_AGENT_SECTION:file-coordination:1.3.0:a5f2c891 -->
|
|
103
|
+
## 🚨 CRITICAL: File Coordination Protocol
|
|
104
|
+
[content managed by DevOps Agent]
|
|
105
|
+
<!-- END_DEVOPS_AGENT_SECTION:file-coordination -->
|
|
106
|
+
|
|
107
|
+
## Your Custom Rules
|
|
108
|
+
[your content is never touched]
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### House Rules Commands
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
# Check if updates are available
|
|
115
|
+
npm run house-rules:status
|
|
116
|
+
|
|
117
|
+
# Update or create house rules
|
|
118
|
+
npm run house-rules:update
|
|
119
|
+
|
|
120
|
+
# Health check and repair if deleted
|
|
121
|
+
npm run house-rules:repair
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Updates Preserve Your Content
|
|
125
|
+
|
|
126
|
+
When you update the DevOps Agent:
|
|
127
|
+
1. Post-install checks for house rules updates
|
|
128
|
+
2. Only updates DevOps-managed sections
|
|
129
|
+
3. Your custom rules are NEVER modified
|
|
130
|
+
4. Backups are created before any changes
|
|
131
|
+
|
|
132
|
+
## Configuration Options
|
|
133
|
+
|
|
134
|
+
### Environment Variables
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
# Auto-setup without prompts (useful for CI)
|
|
138
|
+
export DEVOPS_AUTO_SETUP=true
|
|
139
|
+
|
|
140
|
+
# Developer initials (used in branch names)
|
|
141
|
+
export AC_BRANCH_PREFIX="dev_abc_"
|
|
142
|
+
|
|
143
|
+
# Daily branch rollover is now automatic (no prompting)
|
|
144
|
+
# Version increments daily: v0.20 → v0.21 → v0.22
|
|
145
|
+
|
|
146
|
+
# Timezone for daily rollover
|
|
147
|
+
export AC_TZ="America/New_York"
|
|
148
|
+
|
|
149
|
+
# Debug mode
|
|
150
|
+
export AC_DEBUG=true
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Configuration Files
|
|
154
|
+
|
|
155
|
+
**Global Settings** (`~/.devops-agent/settings.json`):
|
|
156
|
+
```json
|
|
157
|
+
{
|
|
158
|
+
"developerInitials": "abc",
|
|
159
|
+
"email": "developer@example.com",
|
|
160
|
+
"configured": true
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
**Project Settings** (`local_deploy/project-settings.json`):
|
|
165
|
+
```json
|
|
166
|
+
{
|
|
167
|
+
"versioningStrategy": {
|
|
168
|
+
"prefix": "v1.",
|
|
169
|
+
"startMinor": 30,
|
|
170
|
+
"dailyIncrement": 1,
|
|
171
|
+
"configured": true
|
|
172
|
+
},
|
|
173
|
+
"autoMergeConfig": {
|
|
174
|
+
"enabled": true,
|
|
175
|
+
"targetBranch": "main",
|
|
176
|
+
"strategy": "pull-request"
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## CI/CD Setup
|
|
182
|
+
|
|
183
|
+
### Automatic Setup in CI
|
|
184
|
+
|
|
185
|
+
The DevOps Agent detects CI environments and auto-configures:
|
|
186
|
+
|
|
187
|
+
```yaml
|
|
188
|
+
# GitHub Actions Example
|
|
189
|
+
- name: Install DevOps Agent
|
|
190
|
+
run: npm install -g s9n-devops-agent
|
|
191
|
+
|
|
192
|
+
# House rules are auto-created in CI
|
|
193
|
+
# No prompts, fully automated
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### Supported CI Environments
|
|
197
|
+
|
|
198
|
+
Automatically detected:
|
|
199
|
+
- GitHub Actions (`GITHUB_ACTIONS`)
|
|
200
|
+
- GitLab CI (`GITLAB_CI`)
|
|
201
|
+
- Jenkins (`JENKINS_URL`)
|
|
202
|
+
- Travis CI (`TRAVIS`)
|
|
203
|
+
- CircleCI (`CI`)
|
|
204
|
+
|
|
205
|
+
### Force Automation
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
# Force automatic setup (no prompts)
|
|
209
|
+
DEVOPS_AUTO_SETUP=true npm start
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
## Typical Workflow
|
|
213
|
+
|
|
214
|
+
### 1. Start Your Day
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
npm start
|
|
218
|
+
# Creates new daily branch automatically
|
|
219
|
+
# No rollover prompts - it's automatic!
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### 2. Create a Session
|
|
223
|
+
|
|
224
|
+
```
|
|
225
|
+
Select an Option:
|
|
226
|
+
N) Create a new session
|
|
227
|
+
|
|
228
|
+
Enter task/feature name: implement-api
|
|
229
|
+
Agent type [claude]: claude
|
|
230
|
+
|
|
231
|
+
Creating session...
|
|
232
|
+
✓ Worktree created
|
|
233
|
+
✓ House rules applied
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### 3. Copy Instructions to AI
|
|
237
|
+
|
|
238
|
+
The tool provides exact instructions for your AI:
|
|
239
|
+
|
|
240
|
+
```
|
|
241
|
+
CRITICAL FIRST STEP:
|
|
242
|
+
1. Read and follow the house rules: cat "/path/to/worktree/houserules.md"
|
|
243
|
+
2. Switch to the working directory: cd "/path/to/worktree"
|
|
244
|
+
|
|
245
|
+
FILE COORDINATION PROTOCOL (from house rules):
|
|
246
|
+
Before editing ANY files, you MUST:
|
|
247
|
+
- Declare your intent in .file-coordination/active-edits/
|
|
248
|
+
- Check for conflicts with other agents
|
|
249
|
+
- Only edit files you've declared
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
### 4. AI Works in Isolation
|
|
253
|
+
|
|
254
|
+
- AI writes code in its worktree
|
|
255
|
+
- Commits are automatic
|
|
256
|
+
- Pushes happen seamlessly
|
|
257
|
+
- No conflicts with other agents
|
|
258
|
+
|
|
259
|
+
### 5. End of Day
|
|
260
|
+
|
|
261
|
+
```bash
|
|
262
|
+
# Sessions auto-merge if configured
|
|
263
|
+
# Daily branches roll over at midnight
|
|
264
|
+
# Everything is automated!
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
## Troubleshooting
|
|
268
|
+
|
|
269
|
+
### House Rules Issues
|
|
270
|
+
|
|
271
|
+
**House rules deleted accidentally?**
|
|
272
|
+
```bash
|
|
273
|
+
npm run house-rules:repair
|
|
274
|
+
# Auto-detects and recreates
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
**House rules out of date?**
|
|
278
|
+
```bash
|
|
279
|
+
npm start
|
|
280
|
+
# Prompts to update on startup
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
**Want to force update?**
|
|
284
|
+
```bash
|
|
285
|
+
npm run house-rules:update
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
### Session Issues
|
|
289
|
+
|
|
290
|
+
**Session not starting?**
|
|
291
|
+
```bash
|
|
292
|
+
# Check prerequisites
|
|
293
|
+
node --version # Should be 16+
|
|
294
|
+
git --version # Should be 2.20+
|
|
295
|
+
|
|
296
|
+
# Clean up and retry
|
|
297
|
+
npm run devops:cleanup
|
|
298
|
+
npm start
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
**AI not following house rules?**
|
|
302
|
+
- Ensure AI reads: `cat houserules.md` first
|
|
303
|
+
- Check coordination: `ls .file-coordination/active-edits/`
|
|
304
|
+
- View alerts: `ls .coordination-alert-*.md`
|
|
305
|
+
|
|
306
|
+
### Permission Issues
|
|
307
|
+
|
|
308
|
+
```bash
|
|
309
|
+
# Fix script permissions
|
|
310
|
+
chmod +x scripts/*.sh
|
|
311
|
+
chmod +x start-devops-session.sh
|
|
312
|
+
|
|
313
|
+
# Fix npm permissions (if needed)
|
|
314
|
+
npm config set prefix ~/.npm-global
|
|
315
|
+
export PATH=~/.npm-global/bin:$PATH
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
## Advanced Features
|
|
319
|
+
|
|
320
|
+
### Multi-Agent Setup
|
|
321
|
+
|
|
322
|
+
```bash
|
|
323
|
+
# Terminal 1: Claude on backend
|
|
324
|
+
npm start
|
|
325
|
+
# Create session for "backend-api"
|
|
326
|
+
|
|
327
|
+
# Terminal 2: Copilot on frontend
|
|
328
|
+
npm start
|
|
329
|
+
# Create session for "ui-components"
|
|
330
|
+
|
|
331
|
+
# Both work without conflicts!
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
### Docker Integration
|
|
335
|
+
|
|
336
|
+
```bash
|
|
337
|
+
# If docker-compose.yml exists:
|
|
338
|
+
npm start
|
|
339
|
+
# -> Auto-restart Docker containers? Y
|
|
340
|
+
# -> Rebuild on restart? N
|
|
341
|
+
# -> Service to restart: app
|
|
342
|
+
|
|
343
|
+
# Now Docker restarts after each push!
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
### Custom Configurations
|
|
347
|
+
|
|
348
|
+
```bash
|
|
349
|
+
# Skip all prompts with environment
|
|
350
|
+
export DEVOPS_AUTO_SETUP=true
|
|
351
|
+
export AC_BRANCH_PREFIX="team_"
|
|
352
|
+
export AC_VERSION_PREFIX="v2."
|
|
353
|
+
export AC_TZ="Europe/London"
|
|
354
|
+
|
|
355
|
+
npm start # Uses all environment settings
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
## Getting Help
|
|
359
|
+
|
|
360
|
+
- **Documentation**: [GitHub Wiki](https://github.com/SecondBrainAICo/CS_DevOpsAgent/wiki)
|
|
361
|
+
- **Issues**: [GitHub Issues](https://github.com/SecondBrainAICo/CS_DevOpsAgent/issues)
|
|
362
|
+
- **NPM Package**: [npmjs.com/package/s9n-devops-agent](https://www.npmjs.com/package/s9n-devops-agent)
|
|
363
|
+
|
|
364
|
+
---
|
|
365
|
+
|
|
366
|
+
**Remember**: The beauty of v1.3.0 is that `npm start` handles everything. No complex setup, no multiple commands - just run and go! 🚀
|
package/docs/houserules.md
CHANGED
|
@@ -1,5 +1,56 @@
|
|
|
1
1
|
# Claude House Rules for CS_DevOpsAgent
|
|
2
2
|
|
|
3
|
+
## 🚨 CRITICAL: File Coordination Protocol (MUST FOLLOW)
|
|
4
|
+
|
|
5
|
+
**IMPORTANT: Always check the house rules at the beginning of each session!**
|
|
6
|
+
|
|
7
|
+
To prevent conflicts with other agents editing the same files, you MUST follow this protocol:
|
|
8
|
+
|
|
9
|
+
### Before Editing ANY Files:
|
|
10
|
+
|
|
11
|
+
1. **DECLARE YOUR INTENT FIRST**
|
|
12
|
+
Create a file at `.file-coordination/active-edits/<your-name>-<session>.json` with:
|
|
13
|
+
```json
|
|
14
|
+
{
|
|
15
|
+
"agent": "<your-name>",
|
|
16
|
+
"session": "<session-id>",
|
|
17
|
+
"files": ["list", "of", "files", "you", "will", "edit"],
|
|
18
|
+
"operation": "edit",
|
|
19
|
+
"reason": "Brief description of what you're doing",
|
|
20
|
+
"declaredAt": "<current-ISO-8601-timestamp>",
|
|
21
|
+
"estimatedDuration": 300
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
2. **CHECK FOR CONFLICTS**
|
|
26
|
+
- Read ALL files in `.file-coordination/active-edits/`
|
|
27
|
+
- If ANY other agent has declared the same files, you must:
|
|
28
|
+
- WAIT for them to finish, OR
|
|
29
|
+
- Choose different files to edit
|
|
30
|
+
|
|
31
|
+
3. **ONLY EDIT DECLARED FILES**
|
|
32
|
+
- Never edit files you haven't declared
|
|
33
|
+
- Stay within your declared scope
|
|
34
|
+
|
|
35
|
+
4. **RELEASE WHEN DONE**
|
|
36
|
+
- Delete your declaration file after completing edits
|
|
37
|
+
- Or move it to `.file-coordination/completed-edits/`
|
|
38
|
+
|
|
39
|
+
### If You Detect a Conflict:
|
|
40
|
+
- DO NOT proceed with edits
|
|
41
|
+
- Report the conflict to the user
|
|
42
|
+
- Wait or choose alternative files
|
|
43
|
+
|
|
44
|
+
### Helper Scripts Available:
|
|
45
|
+
- `./scripts/coordination/check-file-availability.sh <files>` - Check if files are available
|
|
46
|
+
- `./scripts/coordination/declare-file-edits.sh <agent> <session> <files>` - Declare your intent
|
|
47
|
+
- `./scripts/coordination/release-file-edits.sh <agent> <session>` - Release files after editing
|
|
48
|
+
|
|
49
|
+
**This coordination prevents wasted work and merge conflicts!**
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
|
|
3
54
|
## Testing Policy (Required)
|
|
4
55
|
|
|
5
56
|
Goal: Every bug fix and feature ships with an executable test.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "s9n-devops-agent",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.3",
|
|
4
4
|
"description": "CS_DevOpsAgent - Intelligent Git Automation System with multi-agent support and session management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/cs-devops-agent-worker.js",
|
|
@@ -25,6 +25,10 @@
|
|
|
25
25
|
"devops:close": "node src/close-session.js",
|
|
26
26
|
"devops:cleanup": "./cleanup-sessions.sh",
|
|
27
27
|
"setup": "node src/setup-cs-devops-agent.js",
|
|
28
|
+
"postinstall": "node scripts/post-install.js || true",
|
|
29
|
+
"house-rules:status": "node src/house-rules-manager.js status",
|
|
30
|
+
"house-rules:update": "node src/house-rules-manager.js update",
|
|
31
|
+
"house-rules:repair": "./scripts/repair-house-rules.sh",
|
|
28
32
|
"test": "jest test_cases/",
|
|
29
33
|
"test:watch": "jest --watch",
|
|
30
34
|
"test:coverage": "jest --coverage",
|