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
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 ScriptAutoCommit Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
# CS_DevOpsAgent 🚀
|
|
2
|
+
|
|
3
|
+
[](https://badge.fury.io/js/s9n-devops-agent)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
[](https://github.com/SecondBrainAICo/CS_DevOpsAgent)
|
|
6
|
+
|
|
7
|
+
An intelligent Git automation system with multi-agent support, session management, and seamless integration with AI coding assistants like Claude, GitHub Copilot, and Cursor.
|
|
8
|
+
|
|
9
|
+
## 🔗 Quick Links
|
|
10
|
+
|
|
11
|
+
- **GitHub Repository**: [https://github.com/SecondBrainAICo/CS_DevOpsAgent](https://github.com/SecondBrainAICo/CS_DevOpsAgent)
|
|
12
|
+
- **NPM Package**: [https://www.npmjs.com/package/s9n-devops-agent](https://www.npmjs.com/package/s9n-devops-agent)
|
|
13
|
+
- **Issues & Support**: [GitHub Issues](https://github.com/SecondBrainAICo/CS_DevOpsAgent/issues)
|
|
14
|
+
- **Documentation**: [GitHub Wiki](https://github.com/SecondBrainAICo/CS_DevOpsAgent/wiki)
|
|
15
|
+
|
|
16
|
+
## Features ✨
|
|
17
|
+
|
|
18
|
+
- **🤖 Multi-Agent Support**: Work with Claude, GitHub Copilot, Cursor, and other AI coding assistants
|
|
19
|
+
- **📁 Git Worktree Management**: Isolated workspaces for each session to prevent conflicts
|
|
20
|
+
- **🔄 Automatic Commits & Push**: Monitors changes and commits with proper messages
|
|
21
|
+
- **📅 Daily Version Rollover**: Automatic version management with customizable increments
|
|
22
|
+
- **🎯 Session Management**: Create, manage, and track multiple development sessions
|
|
23
|
+
- **⚙️ VS Code Integration**: Seamlessly integrates with VS Code tasks
|
|
24
|
+
- **🔐 Safe Concurrent Development**: Multiple agents can work simultaneously without conflicts
|
|
25
|
+
- **🏷️ Smart Branching**: Automatic branch creation with configurable naming patterns
|
|
26
|
+
|
|
27
|
+
## Installation 📦
|
|
28
|
+
|
|
29
|
+
### Option 1: NPM Package (Recommended for Users)
|
|
30
|
+
|
|
31
|
+
#### Global Installation
|
|
32
|
+
```bash
|
|
33
|
+
npm install -g s9n-devops-agent
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
#### Local Installation
|
|
37
|
+
```bash
|
|
38
|
+
npm install s9n-devops-agent --save-dev
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Option 2: From Source (For Contributors)
|
|
42
|
+
|
|
43
|
+
#### Clone the Repository
|
|
44
|
+
```bash
|
|
45
|
+
# Clone the repository
|
|
46
|
+
git clone https://github.com/SecondBrainAICo/CS_DevOpsAgent.git
|
|
47
|
+
cd CS_DevOpsAgent
|
|
48
|
+
|
|
49
|
+
# Install dependencies
|
|
50
|
+
npm install
|
|
51
|
+
|
|
52
|
+
# Link globally for development
|
|
53
|
+
npm link
|
|
54
|
+
|
|
55
|
+
# Now you can use s9n-devops-agent command globally
|
|
56
|
+
s9n-devops-agent --help
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
#### Development Setup
|
|
60
|
+
```bash
|
|
61
|
+
# Clone and setup for development
|
|
62
|
+
git clone https://github.com/SecondBrainAICo/CS_DevOpsAgent.git
|
|
63
|
+
cd CS_DevOpsAgent
|
|
64
|
+
|
|
65
|
+
# Install dependencies
|
|
66
|
+
npm install
|
|
67
|
+
|
|
68
|
+
# Run tests
|
|
69
|
+
npm test
|
|
70
|
+
|
|
71
|
+
# Start development session
|
|
72
|
+
npm run dev
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Quick Start 🚀
|
|
76
|
+
|
|
77
|
+
### First-Time Setup
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
# Run the interactive setup wizard
|
|
81
|
+
s9n-devops-agent setup
|
|
82
|
+
|
|
83
|
+
# This will configure:
|
|
84
|
+
# - Your developer initials (used in branch names)
|
|
85
|
+
# - Version numbering strategy
|
|
86
|
+
# - Default timezone for daily rollover
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Start a DevOps Session
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# Start the interactive session manager
|
|
93
|
+
s9n-devops-agent start
|
|
94
|
+
|
|
95
|
+
# Or create a new session directly
|
|
96
|
+
s9n-devops-agent create --task "implement-api"
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Working with AI Assistants
|
|
100
|
+
|
|
101
|
+
When you start a session, you'll receive instructions to paste into your AI assistant:
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
I'm working in a DevOps-managed session with the following setup:
|
|
105
|
+
- Session ID: 8a3s-45b1
|
|
106
|
+
- Working Directory: /path/to/worktree
|
|
107
|
+
- Task: implement-api
|
|
108
|
+
|
|
109
|
+
Please switch to this directory before making any changes:
|
|
110
|
+
cd "/path/to/worktree"
|
|
111
|
+
|
|
112
|
+
Write commit messages to: .devops-commit-8a3s-45b1.msg
|
|
113
|
+
The DevOps agent will automatically commit and push changes.
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Commands 📝
|
|
117
|
+
|
|
118
|
+
### Session Management
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
# Start interactive session manager
|
|
122
|
+
s9n-devops-agent start
|
|
123
|
+
|
|
124
|
+
# List all active sessions
|
|
125
|
+
s9n-devops-agent list
|
|
126
|
+
|
|
127
|
+
# Create a new session
|
|
128
|
+
s9n-devops-agent create --task "feature-name" --agent claude
|
|
129
|
+
|
|
130
|
+
# Close an active session
|
|
131
|
+
s9n-devops-agent close <session-id>
|
|
132
|
+
|
|
133
|
+
# Clean up stale sessions
|
|
134
|
+
s9n-devops-agent cleanup
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Direct Operations
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
# Run the worker directly (for CI/CD)
|
|
141
|
+
s9n-devops-agent worker
|
|
142
|
+
|
|
143
|
+
# Manage worktrees
|
|
144
|
+
s9n-devops-agent worktree create
|
|
145
|
+
s9n-devops-agent worktree list
|
|
146
|
+
|
|
147
|
+
# Run setup wizard
|
|
148
|
+
s9n-devops-agent setup
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## Configuration 🔧
|
|
152
|
+
|
|
153
|
+
### Environment Variables
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
# Branch naming prefix
|
|
157
|
+
export AC_BRANCH_PREFIX="dev_initials_"
|
|
158
|
+
|
|
159
|
+
# Enable auto-push (default: true)
|
|
160
|
+
export AC_PUSH=true
|
|
161
|
+
|
|
162
|
+
# Enable debug logging
|
|
163
|
+
export AC_DEBUG=true
|
|
164
|
+
|
|
165
|
+
# Set timezone for daily rollover
|
|
166
|
+
export AC_TZ="America/New_York"
|
|
167
|
+
|
|
168
|
+
# Version configuration
|
|
169
|
+
export AC_VERSION_PREFIX="v0."
|
|
170
|
+
export AC_VERSION_START_MINOR="20"
|
|
171
|
+
export AC_VERSION_INCREMENT="1" # 1 = 0.01, 10 = 0.1
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### Configuration Files
|
|
175
|
+
|
|
176
|
+
Configuration is stored in:
|
|
177
|
+
- **Global settings**: `~/.devops-agent/settings.json` (developer initials, email)
|
|
178
|
+
- **Project settings**: `local_deploy/project-settings.json` (version strategy, auto-merge)
|
|
179
|
+
|
|
180
|
+
## Workflow Example 💡
|
|
181
|
+
|
|
182
|
+
1. **Start a Session**:
|
|
183
|
+
```bash
|
|
184
|
+
s9n-devops-agent start
|
|
185
|
+
# Select: N) Create a new session
|
|
186
|
+
# Enter task: implement-authentication
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
2. **Copy Instructions to AI Assistant**:
|
|
190
|
+
- The tool provides instructions to paste into Claude/Copilot
|
|
191
|
+
- The AI works in the isolated worktree
|
|
192
|
+
|
|
193
|
+
3. **AI Makes Changes**:
|
|
194
|
+
- AI writes code in the worktree directory
|
|
195
|
+
- Creates commit message in `.devops-commit-{session-id}.msg`
|
|
196
|
+
|
|
197
|
+
4. **Automatic Processing**:
|
|
198
|
+
- Agent detects changes
|
|
199
|
+
- Reads commit message
|
|
200
|
+
- Commits and pushes automatically
|
|
201
|
+
|
|
202
|
+
5. **Close Session**:
|
|
203
|
+
```bash
|
|
204
|
+
s9n-devops-agent close
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
## VS Code Integration 🔌
|
|
208
|
+
|
|
209
|
+
Add to `.vscode/tasks.json`:
|
|
210
|
+
|
|
211
|
+
```json
|
|
212
|
+
{
|
|
213
|
+
"version": "2.0.0",
|
|
214
|
+
"tasks": [
|
|
215
|
+
{
|
|
216
|
+
"label": "Start DevOps Agent",
|
|
217
|
+
"type": "shell",
|
|
218
|
+
"command": "s9n-devops-agent",
|
|
219
|
+
"args": ["start"],
|
|
220
|
+
"problemMatcher": [],
|
|
221
|
+
"isBackground": true
|
|
222
|
+
}
|
|
223
|
+
]
|
|
224
|
+
}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
## Advanced Features 🔬
|
|
228
|
+
|
|
229
|
+
### Multi-Agent Collaboration
|
|
230
|
+
|
|
231
|
+
Multiple AI assistants can work on different features simultaneously:
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
# Terminal 1: Claude working on API
|
|
235
|
+
s9n-devops-agent create --task "api-endpoints" --agent claude
|
|
236
|
+
|
|
237
|
+
# Terminal 2: Copilot working on frontend
|
|
238
|
+
s9n-devops-agent create --task "ui-components" --agent copilot
|
|
239
|
+
|
|
240
|
+
# Each gets their own worktree and branch
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### Custom Version Strategies
|
|
244
|
+
|
|
245
|
+
Configure daily version increments:
|
|
246
|
+
- `0.01` increments: v0.20 → v0.21 → v0.22
|
|
247
|
+
- `0.1` increments: v0.20 → v0.30 → v0.40
|
|
248
|
+
- `0.2` increments: v0.20 → v0.40 → v0.60
|
|
249
|
+
|
|
250
|
+
### Automatic Daily Rollover
|
|
251
|
+
|
|
252
|
+
At midnight (configurable timezone):
|
|
253
|
+
1. Merges current day's work into version branch
|
|
254
|
+
2. Creates new version branch (e.g., v0.21)
|
|
255
|
+
3. Creates new daily branch
|
|
256
|
+
4. Preserves work continuity
|
|
257
|
+
|
|
258
|
+
## Platform Compatibility 🖥️
|
|
259
|
+
|
|
260
|
+
- ✅ **Git Platforms**: GitHub, GitLab, Bitbucket, Gitea, self-hosted Git
|
|
261
|
+
- ✅ **Operating Systems**: macOS, Linux, Windows (WSL recommended)
|
|
262
|
+
- ✅ **AI Assistants**: Claude, GitHub Copilot, Cursor, Cody, any AI that can write files
|
|
263
|
+
- ✅ **Node.js**: Version 16.0.0 or higher
|
|
264
|
+
|
|
265
|
+
## Troubleshooting 🔍
|
|
266
|
+
|
|
267
|
+
### Common Issues
|
|
268
|
+
|
|
269
|
+
**Session files showing as uncommitted**:
|
|
270
|
+
```bash
|
|
271
|
+
# Files are automatically gitignored
|
|
272
|
+
# If issue persists, run:
|
|
273
|
+
s9n-devops-agent cleanup
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
**Permission denied errors**:
|
|
277
|
+
```bash
|
|
278
|
+
# Ensure scripts are executable
|
|
279
|
+
chmod +x $(npm root -g)/s9n-devops-agent/bin/s9n-devops-agent
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
**Agent not detecting changes**:
|
|
283
|
+
```bash
|
|
284
|
+
# Check if running in correct directory
|
|
285
|
+
pwd
|
|
286
|
+
# Ensure message file exists
|
|
287
|
+
ls -la .devops-commit-*.msg
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
## Contributing 🤝
|
|
291
|
+
|
|
292
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
293
|
+
|
|
294
|
+
1. Fork the repository
|
|
295
|
+
2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
|
|
296
|
+
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
|
|
297
|
+
4. Push to the branch (`git push origin feature/AmazingFeature`)
|
|
298
|
+
5. Open a Pull Request
|
|
299
|
+
|
|
300
|
+
## License 📄
|
|
301
|
+
|
|
302
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
303
|
+
|
|
304
|
+
## Support 💬
|
|
305
|
+
|
|
306
|
+
- 📧 Email: support@secondbrain.ai
|
|
307
|
+
- 🐛 Issues: [GitHub Issues](https://github.com/SecondBrainAICo/CS_DevOpsAgent/issues)
|
|
308
|
+
- 📖 Documentation: [GitHub Wiki](https://github.com/SecondBrainAICo/CS_DevOpsAgent/wiki)
|
|
309
|
+
|
|
310
|
+
## Acknowledgments 🙏
|
|
311
|
+
|
|
312
|
+
Built with ❤️ by [SecondBrain Labs](https://secondbrain.ai)
|
|
313
|
+
|
|
314
|
+
Special thanks to all contributors and the open-source community.
|
|
315
|
+
|
|
316
|
+
---
|
|
317
|
+
|
|
318
|
+
**Copyright © 2024 SecondBrain Labs. All rights reserved.**
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* CS_DevOpsAgent CLI Entry Point
|
|
5
|
+
* This is the main executable when installed via npm
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { fileURLToPath } from 'url';
|
|
9
|
+
import { dirname, join } from 'path';
|
|
10
|
+
import { spawn } from 'child_process';
|
|
11
|
+
import fs from 'fs';
|
|
12
|
+
|
|
13
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
14
|
+
const __dirname = dirname(__filename);
|
|
15
|
+
const rootDir = join(__dirname, '..');
|
|
16
|
+
|
|
17
|
+
// Parse command line arguments
|
|
18
|
+
const args = process.argv.slice(2);
|
|
19
|
+
const command = args[0] || 'help';
|
|
20
|
+
|
|
21
|
+
// Helper function to run a script
|
|
22
|
+
function runScript(scriptPath, scriptArgs = []) {
|
|
23
|
+
const child = spawn('node', [scriptPath, ...scriptArgs], {
|
|
24
|
+
stdio: 'inherit',
|
|
25
|
+
cwd: process.cwd()
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
child.on('exit', (code) => {
|
|
29
|
+
process.exit(code);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Helper function to run a shell script
|
|
34
|
+
function runShellScript(scriptPath, scriptArgs = []) {
|
|
35
|
+
const child = spawn('bash', [scriptPath, ...scriptArgs], {
|
|
36
|
+
stdio: 'inherit',
|
|
37
|
+
cwd: process.cwd()
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
child.on('exit', (code) => {
|
|
41
|
+
process.exit(code);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Command handlers
|
|
46
|
+
switch(command) {
|
|
47
|
+
case 'start':
|
|
48
|
+
case 'session':
|
|
49
|
+
// Start interactive session manager
|
|
50
|
+
const sessionScript = join(rootDir, 'start-devops-session.sh');
|
|
51
|
+
if (fs.existsSync(sessionScript)) {
|
|
52
|
+
runShellScript(sessionScript, args.slice(1));
|
|
53
|
+
} else {
|
|
54
|
+
console.error('Session script not found. Please ensure the package is properly installed.');
|
|
55
|
+
process.exit(1);
|
|
56
|
+
}
|
|
57
|
+
break;
|
|
58
|
+
|
|
59
|
+
case 'worker':
|
|
60
|
+
// Run the worker directly
|
|
61
|
+
runScript(join(rootDir, 'src', 'cs-devops-agent-worker.js'), args.slice(1));
|
|
62
|
+
break;
|
|
63
|
+
|
|
64
|
+
case 'setup':
|
|
65
|
+
// Run setup wizard
|
|
66
|
+
runScript(join(rootDir, 'src', 'setup-cs-devops-agent.js'), args.slice(1));
|
|
67
|
+
break;
|
|
68
|
+
|
|
69
|
+
case 'worktree':
|
|
70
|
+
// Manage worktrees
|
|
71
|
+
runScript(join(rootDir, 'src', 'worktree-manager.js'), args.slice(1));
|
|
72
|
+
break;
|
|
73
|
+
|
|
74
|
+
case 'coordinator':
|
|
75
|
+
// Run session coordinator
|
|
76
|
+
runScript(join(rootDir, 'src', 'session-coordinator.js'), args.slice(1));
|
|
77
|
+
break;
|
|
78
|
+
|
|
79
|
+
case 'list':
|
|
80
|
+
// List sessions
|
|
81
|
+
runScript(join(rootDir, 'src', 'session-coordinator.js'), ['list']);
|
|
82
|
+
break;
|
|
83
|
+
|
|
84
|
+
case 'create':
|
|
85
|
+
// Create new session
|
|
86
|
+
runScript(join(rootDir, 'src', 'session-coordinator.js'), ['create', ...args.slice(1)]);
|
|
87
|
+
break;
|
|
88
|
+
|
|
89
|
+
case 'close':
|
|
90
|
+
// Close session
|
|
91
|
+
runScript(join(rootDir, 'src', 'close-session.js'), args.slice(1));
|
|
92
|
+
break;
|
|
93
|
+
|
|
94
|
+
case 'cleanup':
|
|
95
|
+
// Cleanup sessions
|
|
96
|
+
const cleanupScript = join(rootDir, 'cleanup-sessions.sh');
|
|
97
|
+
if (fs.existsSync(cleanupScript)) {
|
|
98
|
+
runShellScript(cleanupScript, args.slice(1));
|
|
99
|
+
} else {
|
|
100
|
+
console.error('Cleanup script not found.');
|
|
101
|
+
process.exit(1);
|
|
102
|
+
}
|
|
103
|
+
break;
|
|
104
|
+
|
|
105
|
+
case 'version':
|
|
106
|
+
case '--version':
|
|
107
|
+
case '-v':
|
|
108
|
+
const packageJson = JSON.parse(fs.readFileSync(join(rootDir, 'package.json'), 'utf8'));
|
|
109
|
+
console.log(`CS_DevOpsAgent v${packageJson.version}`);
|
|
110
|
+
break;
|
|
111
|
+
|
|
112
|
+
case 'help':
|
|
113
|
+
case '--help':
|
|
114
|
+
case '-h':
|
|
115
|
+
default:
|
|
116
|
+
console.log(`
|
|
117
|
+
CS_DevOpsAgent - Intelligent Git Automation System
|
|
118
|
+
Version: ${JSON.parse(fs.readFileSync(join(rootDir, 'package.json'), 'utf8')).version}
|
|
119
|
+
|
|
120
|
+
Usage: cs-devops-agent [command] [options]
|
|
121
|
+
|
|
122
|
+
Commands:
|
|
123
|
+
start, session Start interactive DevOps session manager
|
|
124
|
+
worker Run the DevOps agent worker directly
|
|
125
|
+
setup Run interactive setup wizard
|
|
126
|
+
worktree Manage git worktrees for agents
|
|
127
|
+
coordinator Session coordinator operations
|
|
128
|
+
list List all active sessions
|
|
129
|
+
create Create a new session
|
|
130
|
+
close Close an active session
|
|
131
|
+
cleanup Clean up stale sessions
|
|
132
|
+
version Show version information
|
|
133
|
+
help Show this help message
|
|
134
|
+
|
|
135
|
+
Examples:
|
|
136
|
+
cs-devops-agent start # Start interactive session manager
|
|
137
|
+
cs-devops-agent setup # Run first-time setup
|
|
138
|
+
cs-devops-agent list # List active sessions
|
|
139
|
+
cs-devops-agent create --task api # Create new session for API work
|
|
140
|
+
cs-devops-agent worker # Run worker directly
|
|
141
|
+
|
|
142
|
+
Environment Variables:
|
|
143
|
+
AC_BRANCH_PREFIX Branch prefix for daily branches
|
|
144
|
+
AC_PUSH Enable auto-push (true/false)
|
|
145
|
+
AC_DEBUG Enable debug logging (true/false)
|
|
146
|
+
AC_TZ Timezone for daily rollover
|
|
147
|
+
|
|
148
|
+
For more information, visit: https://github.com/SecondBrainAICo/CS_DevOpsAgent
|
|
149
|
+
`);
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
# ============================================================================
|
|
4
|
+
# CLEANUP SCRIPT - Remove all worktrees and sessions
|
|
5
|
+
# ============================================================================
|
|
6
|
+
|
|
7
|
+
echo "🧹 Cleaning up all DevOps Agent sessions and worktrees..."
|
|
8
|
+
echo
|
|
9
|
+
|
|
10
|
+
# Colors
|
|
11
|
+
RED='\033[0;31m'
|
|
12
|
+
GREEN='\033[0;32m'
|
|
13
|
+
YELLOW='\033[1;33m'
|
|
14
|
+
NC='\033[0m' # No Color
|
|
15
|
+
|
|
16
|
+
# 1. List current worktrees
|
|
17
|
+
echo -e "${YELLOW}Current worktrees:${NC}"
|
|
18
|
+
git worktree list
|
|
19
|
+
echo
|
|
20
|
+
|
|
21
|
+
# 2. Remove git worktrees
|
|
22
|
+
echo -e "${YELLOW}Removing git worktrees...${NC}"
|
|
23
|
+
git worktree prune
|
|
24
|
+
|
|
25
|
+
# Remove specific worktrees if they exist
|
|
26
|
+
for worktree in $(git worktree list --porcelain | grep "worktree" | cut -d' ' -f2 | grep -v "$(git rev-parse --show-toplevel)$"); do
|
|
27
|
+
if [[ "$worktree" == *"worktrees"* ]] || [[ "$worktree" == *"local_deploy"* ]]; then
|
|
28
|
+
echo "Removing worktree: $worktree"
|
|
29
|
+
git worktree remove -f "$worktree" 2>/dev/null || true
|
|
30
|
+
fi
|
|
31
|
+
done
|
|
32
|
+
|
|
33
|
+
# 3. Clean up local_deploy directories
|
|
34
|
+
echo -e "${YELLOW}Cleaning local_deploy directories...${NC}"
|
|
35
|
+
rm -rf local_deploy/worktrees/* 2>/dev/null
|
|
36
|
+
rm -rf local_deploy/session-locks/* 2>/dev/null
|
|
37
|
+
rm -rf local_deploy/sessions/* 2>/dev/null
|
|
38
|
+
rm -rf local_deploy/instructions/* 2>/dev/null
|
|
39
|
+
rm -f local_deploy/claude-sessions.json 2>/dev/null
|
|
40
|
+
rm -f local_deploy/.devops-sessions.json 2>/dev/null
|
|
41
|
+
|
|
42
|
+
# 4. Clean up any worktrees in wrong locations
|
|
43
|
+
echo -e "${YELLOW}Cleaning up misplaced worktrees...${NC}"
|
|
44
|
+
rm -rf .worktrees 2>/dev/null
|
|
45
|
+
rm -rf .session-locks 2>/dev/null
|
|
46
|
+
rm -rf .claude-sessions.json 2>/dev/null
|
|
47
|
+
rm -rf .devops-sessions 2>/dev/null
|
|
48
|
+
rm -rf .claude-instructions 2>/dev/null
|
|
49
|
+
|
|
50
|
+
# 5. Clean up git branches
|
|
51
|
+
echo -e "${YELLOW}Cleaning up session branches...${NC}"
|
|
52
|
+
for branch in $(git branch | grep -E "claude/|warp/|agent/" | tr -d ' '); do
|
|
53
|
+
echo "Deleting branch: $branch"
|
|
54
|
+
git branch -D "$branch" 2>/dev/null || true
|
|
55
|
+
done
|
|
56
|
+
|
|
57
|
+
# 6. Create clean local_deploy structure
|
|
58
|
+
echo -e "${YELLOW}Creating clean directory structure...${NC}"
|
|
59
|
+
mkdir -p local_deploy/worktrees
|
|
60
|
+
mkdir -p local_deploy/session-locks
|
|
61
|
+
mkdir -p local_deploy/sessions
|
|
62
|
+
mkdir -p local_deploy/instructions
|
|
63
|
+
mkdir -p local_deploy/logs
|
|
64
|
+
|
|
65
|
+
echo -e "${GREEN}✅ Cleanup complete!${NC}"
|
|
66
|
+
echo
|
|
67
|
+
echo "You can now start fresh with:"
|
|
68
|
+
echo " npm start # Interactive session manager"
|
|
69
|
+
echo " ./start-devops-session.sh # Same as npm start"
|
|
70
|
+
echo
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# Code Studio CS_DevOpsAgent Agent - Project Information
|
|
2
|
+
|
|
3
|
+
## Repository Details
|
|
4
|
+
|
|
5
|
+
- **GitHub Repository**: https://github.com/SecondBrainAICo/CS_DevOpsAgent
|
|
6
|
+
- **Organization**: SecondBrain AI
|
|
7
|
+
|
|
8
|
+
## Project Structure
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
CS_DevOpsAgent/
|
|
12
|
+
├── src/ # Source code files
|
|
13
|
+
│ ├── cs-devops-agent-worker.js # Main worker
|
|
14
|
+
│ ├── setup-cs-devops-agent.js # Setup wizard
|
|
15
|
+
│ ├── worktree-manager.js # Agent isolation
|
|
16
|
+
│ └── run-with-agent.js # Agent runner
|
|
17
|
+
├── docs/ # Documentation
|
|
18
|
+
│ ├── PROJECT_INFO.md # This file
|
|
19
|
+
│ ├── TESTING.md # Test guide
|
|
20
|
+
│ └── infrastructure.md # Change tracking
|
|
21
|
+
├── test_scripts/ # Test scripts
|
|
22
|
+
├── test_cases/ # Jest test cases
|
|
23
|
+
├── deploy_test/ # Deployment tests
|
|
24
|
+
├── package.json # NPM configuration
|
|
25
|
+
├── LICENSE # MIT License
|
|
26
|
+
├── README.md # Main documentation
|
|
27
|
+
└── .gitignore # Git ignore rules
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Key Features
|
|
31
|
+
|
|
32
|
+
- **Automatic Git Commits**: Watches for file changes and commit messages
|
|
33
|
+
- **Daily Branching**: Creates daily development branches (dev_{initials}_YYYY-MM-DD)
|
|
34
|
+
- **Version Management**: Micro-revision versioning (v0.20, v0.21, etc.)
|
|
35
|
+
- **VS Code Integration**: Tasks and settings for seamless workflow
|
|
36
|
+
- **Developer Personalization**: Each developer gets their own branch prefix
|
|
37
|
+
- **Claude AI Integration**: Generates CLAUDE.md house rules for AI assistance
|
|
38
|
+
|
|
39
|
+
## Quick Commands
|
|
40
|
+
|
|
41
|
+
### Setup (for new projects)
|
|
42
|
+
```bash
|
|
43
|
+
# Clone to a new project
|
|
44
|
+
git clone https://github.com/secondbrainAI-limited/code_studio_cs-devops-agentAgent.git CS_DevOpsAgent
|
|
45
|
+
cd CS_DevOpsAgent
|
|
46
|
+
./quick-start.sh
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Daily Usage
|
|
50
|
+
```bash
|
|
51
|
+
# Start the worker
|
|
52
|
+
npm run cs-devops-agent
|
|
53
|
+
|
|
54
|
+
# Create a commit message
|
|
55
|
+
echo "feat(module): description" > .claude-commit-msg
|
|
56
|
+
|
|
57
|
+
# Stop the worker
|
|
58
|
+
pkill -f "node.*cs-devops-agent-worker"
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Git Commands
|
|
62
|
+
|
|
63
|
+
### Push to GitHub
|
|
64
|
+
```bash
|
|
65
|
+
git push -u origin main
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Pull Latest Changes
|
|
69
|
+
```bash
|
|
70
|
+
git pull origin main
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Check Remote Status
|
|
74
|
+
```bash
|
|
75
|
+
git remote -v
|
|
76
|
+
git branch -vv
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Environment Variables
|
|
80
|
+
|
|
81
|
+
The system uses these environment variables (set during setup):
|
|
82
|
+
|
|
83
|
+
- `AC_BRANCH_PREFIX`: Developer's branch prefix (e.g., dev_sdd_)
|
|
84
|
+
- `AC_TZ`: Timezone for daily rollover (default: Asia/Dubai)
|
|
85
|
+
- `AC_PUSH`: Auto-push to remote (default: true)
|
|
86
|
+
- `AC_DEBUG`: Enable debug logging (default: false)
|
|
87
|
+
|
|
88
|
+
## Development Workflow
|
|
89
|
+
|
|
90
|
+
1. **Initial Setup**: Run `./quick-start.sh` in your project root
|
|
91
|
+
2. **Start Worker**: `npm run cs-devops-agent`
|
|
92
|
+
3. **Make Changes**: Edit your files normally
|
|
93
|
+
4. **Commit**: Write message to `.claude-commit-msg`
|
|
94
|
+
5. **Auto-Process**: Worker stages, commits, and pushes automatically
|
|
95
|
+
6. **Daily Rollover**: Handled automatically at midnight
|
|
96
|
+
|
|
97
|
+
## Integration with SecondBrain Projects
|
|
98
|
+
|
|
99
|
+
This cs-devops-agent system is designed to work seamlessly with:
|
|
100
|
+
- SecondBrain MVPEmails
|
|
101
|
+
- DistilledConceptExtractor
|
|
102
|
+
- Other SecondBrain Code Studio projects
|
|
103
|
+
|
|
104
|
+
## Support
|
|
105
|
+
|
|
106
|
+
- **Issues**: https://github.com/secondbrainAI-limited/code_studio_cs-devops-agentAgent/issues
|
|
107
|
+
- **Organization**: https://github.com/secondbrainAI-limited
|
|
108
|
+
|
|
109
|
+
## License
|
|
110
|
+
|
|
111
|
+
MIT License - See LICENSE file for details
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
*Last Updated: 2025-09-25*
|