s9n-devops-agent 2.0.18-dev.0 → 2.0.18-dev.11

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 CHANGED
@@ -1,201 +1,152 @@
1
1
  # DevOps Agent - AI-Powered Git Workflow Automation
2
2
 
3
- > Let AI assistants work safely on your codebase with automatic commits, branch management, and multi-agent conflict prevention.
3
+ > **Now with Kora 🤖 - Your Smart DevOps Assistant**
4
+
5
+ DevOps Agent acts as a bridge between human developers and AI coding assistants. It manages git operations, prevents multi-agent conflicts, ensures architectural compliance, and now talks to you to streamline your workflow.
4
6
 
5
7
  [![npm version](https://badge.fury.io/js/s9n-devops-agent.svg)](https://www.npmjs.com/package/s9n-devops-agent)
6
8
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
9
 
8
- ## What It Does
9
-
10
- 🤖 **Works with Any AI Assistant** - Claude, Cursor, GitHub Copilot, Cline
11
- 🔄 **Automatic Git Operations** - Watches changes, commits with proper messages, pushes automatically
12
- 🛡️ **Multi-Agent Coordination** - Prevents multiple AIs from editing the same files simultaneously
13
- 🌲 **Smart Branch Management** - Hierarchical structure: session → daily → weekly → main
14
- 📋 **House Rules System** - Teaches AI agents your project conventions and testing requirements
15
-
16
- ## Quick Start (2 Minutes)
17
-
18
- ```bash
19
- # Install
20
- npm install -g s9n-devops-agent
21
-
22
- # Learn (recommended for first-time users)
23
- s9n-devops-agent tutorial
24
-
25
- # Setup
26
- s9n-devops-agent setup
27
-
28
- # Start working
29
- s9n-devops-agent start
30
- ```
10
+ ---
31
11
 
32
- ## How It Works
12
+ ## 🚀 New in v2.0: Smart Features
33
13
 
34
- **The Concept:** Give each AI assistant its own private workspace (called a "session")
14
+ ### 🤖 Meet Kora
15
+ Kora is a conversational AI assistant built into the DevOps Agent. She knows your project's **House Rules**, understands your **Architecture Contracts**, and can manage your development sessions.
35
16
 
36
- 1. **You start a session** Creates isolated workspace (git worktree)
37
- 2. **AI assistant works there** Following house rules you define
38
- 3. **DevOps Agent watches** Auto-commits and pushes changes
39
- 4. **Session closes** → Merges to daily branch, then to main
17
+ - **Ask Questions:** "What are the rules for API endpoints?"
18
+ - **Start Work:** "Start a new session to fix the login bug."
19
+ - **Check Status:** "Are there any open sessions?"
40
20
 
41
- ### What's a Session?
21
+ ### 📜 Contract Automation
22
+ Ensure your code matches your architecture. The agent now includes tools to:
23
+ - **Validate Compliance:** Checks if your code implements the defined contracts (API, DB, Features).
24
+ - **Auto-Generate Contracts:** Reverse-engineer documentation from existing code.
25
+ - **Test:** Run `npm run test:contracts` to verify compliance in CI/CD.
42
26
 
43
- Think of it like giving each AI assistant their own office:
44
- - **Separate directory** with full git history
45
- - **Own branch** auto-named based on task
46
- - **File locks** prevent conflicts with other agents
47
- - **Auto-monitoring** commits and pushes automatically
27
+ ### 🧠 AI-Powered Commits
28
+ The agent analyzes your staged changes and generates semantic, conventional commit messages that adhere to your specific House Rules.
48
29
 
49
- ## Core Features
30
+ ---
50
31
 
51
- ### 🔄 Auto-Commit System
52
- **What:** Watches your workspace and commits changes automatically
53
- **Why:** AI can't run git commands, so we do it for them
54
- **How:** AI writes commit message to special file, agent reads and commits
32
+ ## 📦 Installation
55
33
 
56
- ### 🛡️ File Coordination
57
- **What:** Prevents multiple AI agents from editing same files
58
- **Why:** Avoids merge conflicts when working with multiple agents
59
- **How:** Agents "declare" files before editing, system checks for conflicts
34
+ ### Stable Version
35
+ ```bash
36
+ npm install -g s9n-devops-agent
37
+ ```
60
38
 
61
- ### 🌲 Branch Hierarchy
62
- **What:** Organized structure: session/* daily/* weekly/* → main
63
- **Why:** Easy rollbacks, clear progress tracking, organized history
64
- **How:** Auto-merges happen at session close and nightly rollover
39
+ ### Development Version (Latest Features)
40
+ To access Kora and the latest smart features:
41
+ ```bash
42
+ npm install -g s9n-devops-agent@dev
43
+ ```
65
44
 
66
- ### 📋 House Rules
67
- **What:** Instructions for AI assistants in `docs/houserules.md`
68
- **Why:** Consistent behavior across agents, follows your conventions
69
- **How:** Markdown file that AI reads first, auto-updated by agent
45
+ ---
70
46
 
71
- ## Commands
47
+ ## ⚡ Quick Start
72
48
 
49
+ ### 1. Setup
50
+ Run the setup wizard to configure your environment and API keys.
73
51
  ```bash
74
- # New User Commands
75
- s9n-devops-agent tutorial # Interactive learning (start here!)
76
- s9n-devops-agent setup # First-time configuration
77
- s9n-devops-agent help-topics # Browse comprehensive help
78
-
79
- # Session Management
80
- s9n-devops-agent start # Create/resume session
81
- s9n-devops-agent list # Show all sessions
82
- s9n-devops-agent close # Close active session
83
-
84
- # Advanced
85
- s9n-devops-agent create --task api --agent claude # Create specific session
86
- s9n-devops-agent cleanup # Clean up stale sessions
52
+ s9n-devops-agent setup
87
53
  ```
54
+ > **Note:** You will be prompted for a `GROQ_API_KEY` to enable Kora and AI features.
88
55
 
89
- ## Common Workflows
90
-
91
- ### Single AI Agent
56
+ ### 2. Talk to Kora
57
+ Start the conversational interface to manage your work.
92
58
  ```bash
93
- s9n-devops-agent start # Create session
94
- # Copy instructions to Claude/Cursor
95
- # AI works, agent commits automatically
96
- s9n-devops-agent close # Merge and cleanup
59
+ s9n-devops-agent chat
97
60
  ```
98
61
 
99
- ### Multiple AI Agents (Parallel Work)
62
+ ### 3. Start a Session (Classic Mode)
63
+ If you prefer the CLI menu:
100
64
  ```bash
101
- # Terminal 1: Claude on backend
102
- s9n-devops-agent create --task api --agent claude
65
+ s9n-devops-agent start
66
+ ```
103
67
 
104
- # Terminal 2: Cursor on frontend
105
- s9n-devops-agent create --task ui --agent cursor
68
+ ---
106
69
 
107
- # They work independently, no conflicts!
108
- ```
70
+ ## 🛠️ Core Features
109
71
 
110
- ## What Makes It Special?
72
+ ### 🔄 Auto-Commit System
73
+ - **Watches** your workspace in real-time.
74
+ - **Commits** changes automatically when your AI assistant saves files.
75
+ - **Pushes** to the remote repository.
111
76
 
112
- **Zero Manual Git Commands** - AI can't run git, we handle it all
113
- ✅ **Conflict-Free Multi-Agent** - File coordination prevents chaos
114
- **Production-Ready** - Used in real projects with multiple developers
115
- ✅ **Framework Agnostic** - Works with any codebase, any language
116
- ✅ **Git Platform Agnostic** - GitHub, GitLab, Bitbucket, self-hosted
77
+ ### 🛡️ Multi-Agent Coordination
78
+ - **File Locking:** Prevents multiple agents (or humans) from editing the same files simultaneously.
79
+ - **Worktrees:** Each session gets an isolated git worktree, keeping your main branch clean.
117
80
 
118
- ## Requirements
81
+ ### 🌲 Smart Branch Management
82
+ - **Hierarchy:** `session/task` → `daily/date` → `main`.
83
+ - **Auto-Merge:** Sessions automatically merge into daily branches, which roll over to main.
84
+ - **Base Branch Selection:** Choose any branch (main, develop, etc.) as the starting point for your session worktree.
119
85
 
120
- - Node.js 16.0.0 or higher
121
- - Git repository
122
- - Any AI assistant (Claude, Cursor, Copilot, Cline, etc.)
86
+ ### 📋 House Rules System
87
+ - **Context Injection:** AI agents read `docs/houserules.md` to understand your coding conventions.
88
+ - **Enforcement:** The agent checks commits against these rules.
123
89
 
124
- ## Documentation
90
+ ---
125
91
 
126
- 📖 **Getting Started**
127
- - [Interactive Tutorial](docs/V2_IMPLEMENTATION_GUIDE.md) - Learn by doing
128
- - [Installation Guide](docs/INSTALLATION_GUIDE.md) - Detailed setup
92
+ ## 📖 Usage Guide
129
93
 
130
- 📚 **Feature Guides**
131
- - [Version Strategies](docs/version-strategies.md) - Daily version incrementing
132
- - [File Coordination](docs/file-coordination-guide.md) - Multi-agent prevention
133
- - [Multi-Agent Setup](docs/multi-agent-guide.md) - Working with multiple AIs
134
- - [House Rules](docs/houserules-guide.md) - Teaching AI your conventions
94
+ ### Using Kora (Chat)
95
+ ```bash
96
+ $ s9n-devops-agent chat
135
97
 
136
- 🔧 **Advanced Topics**
137
- - [Branch Management](docs/branch-management.md) - Hierarchical structure
138
- - [Docker Integration](docs/V2_IMPLEMENTATION_GUIDE.md) - Auto-restart containers
139
- - [Session Management](docs/SESSION_MANAGEMENT.md) - Advanced workflows
98
+ 🤖 Kora - Smart DevOps Assistant
99
+ Powered by Groq (llama-3.3-70b-versatile)
100
+ ============================================================
140
101
 
141
- ## Troubleshooting
102
+ Kora > Hi! I'm Kora. How can I help you today?
142
103
 
143
- **Session not found?**
144
- ```bash
145
- s9n-devops-agent list --all # Check closed sessions
146
- ```
104
+ You > Start a session for user auth
147
105
 
148
- **Agent not detecting changes?**
149
- ```bash
150
- # Check commit message file exists and has content
151
- ls -la .devops-commit-*.msg
152
- # Enable debug mode
153
- AC_DEBUG=true s9n-devops-agent start
106
+ Kora > Starting new session for: user-auth...
154
107
  ```
155
108
 
156
- **Need help?**
109
+ ### Managing Sessions
157
110
  ```bash
158
- s9n-devops-agent help-topics # Browse all help topics
159
- s9n-devops-agent tutorial # Re-run tutorial
160
- ```
111
+ # List all active sessions
112
+ s9n-devops-agent list
161
113
 
162
- ## Configuration
163
-
164
- Configure via environment variables or project settings:
114
+ # Close the current session (merge and cleanup)
115
+ s9n-devops-agent close
116
+ ```
165
117
 
118
+ ### Contract Testing
119
+ Run these tests to ensure your code complies with `House_Rules_Contracts/`:
166
120
  ```bash
167
- # Branch naming
168
- export AC_BRANCH_PREFIX="dev_initials_"
169
-
170
- # Auto-push (default: true)
171
- export AC_PUSH=true
121
+ npm run test:contracts
122
+ ```
172
123
 
173
- # Debug logging
174
- export AC_DEBUG=true
124
+ ---
175
125
 
176
- # Timezone for daily rollover
177
- export AC_TZ="America/New_York"
178
- ```
126
+ ## ⚙️ Configuration
179
127
 
180
- See [Configuration Guide](docs/INSTALLATION_GUIDE.md#configuration-files) for details.
128
+ The setup wizard (`s9n-devops-agent setup`) creates a `.env` file in your project root.
181
129
 
182
- ## Contributing
130
+ | Variable | Description |
131
+ |----------|-------------|
132
+ | `GROQ_API_KEY` | **Required** for Kora and AI commits. Get one at [console.groq.com](https://console.groq.com). |
133
+ | `AC_BRANCH_PREFIX` | Prefix for branch names (e.g., `dev_abc_`). |
134
+ | `AC_PUSH` | `true` to auto-push commits, `false` for local only. |
135
+ | `AC_DEBUG` | `true` for verbose logging. |
183
136
 
184
- Contributions welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
137
+ ---
185
138
 
186
- ## License
139
+ ## 📚 Documentation
140
+ - [Installation Guide](docs/INSTALLATION_GUIDE.md)
141
+ - [Testing Guide](TESTING_GUIDE.md)
142
+ - [House Rules Guide](docs/houserules-guide.md)
143
+ - [Contract Automation](scripts/contract-automation/README.md)
187
144
 
188
- MIT License - see [LICENSE](LICENSE) file for details.
145
+ ---
189
146
 
190
147
  ## Support
191
-
192
148
  - 🐛 [Report Issues](https://github.com/SecondBrainAICo/CS_DevOpsAgent/issues)
193
- - 💬 [Discussions](https://github.com/SecondBrainAICo/CS_DevOpsAgent/discussions)
194
149
  - 📦 [npm Package](https://www.npmjs.com/package/s9n-devops-agent)
195
- - 📖 [Documentation](https://github.com/SecondBrainAICo/CS_DevOpsAgent/wiki)
196
150
 
197
151
  ---
198
-
199
152
  **Built with ❤️ by [SecondBrain Labs](https://secondbrain.ai)**
200
-
201
- *Making AI-powered development safe, efficient, and conflict-free.*
@@ -54,21 +54,11 @@ function runShellScript(scriptPath, scriptArgs = []) {
54
54
  switch(command) {
55
55
  case 'start':
56
56
  case 'session':
57
- // Start interactive session manager
58
- // On Windows, always use Node.js coordinator (bash may not be available)
59
- if (process.platform === 'win32') {
60
- console.log('Starting DevOps Agent session manager...\n');
61
- runScript(join(rootDir, 'src', 'session-coordinator.js'), ['start', ...args.slice(1)]);
62
- } else {
63
- // Unix/Mac: use bash script
64
- const sessionScript = join(rootDir, 'start-devops-session.sh');
65
- if (fs.existsSync(sessionScript)) {
66
- runShellScript(sessionScript, args.slice(1));
67
- } else {
68
- console.error('Session script not found. Please ensure the package is properly installed.');
69
- process.exit(1);
70
- }
71
- }
57
+ case 'chat':
58
+ // Unified entry point: Run Kora (Smart Assistant)
59
+ // Kora handles session creation and management conversationally
60
+ console.log('Starting Kora (Smart DevOps Assistant)...');
61
+ runScript(join(rootDir, 'src', 'agent-chat.js'), args.slice(1));
72
62
  break;
73
63
 
74
64
  case 'worker':
@@ -101,6 +91,11 @@ switch(command) {
101
91
  runScript(join(rootDir, 'src', 'session-coordinator.js'), ['create', ...args.slice(1)]);
102
92
  break;
103
93
 
94
+ case 'resume':
95
+ // Resume existing session
96
+ runScript(join(rootDir, 'src', 'session-coordinator.js'), ['resume', ...args.slice(1)]);
97
+ break;
98
+
104
99
  case 'close':
105
100
  // Close session
106
101
  runScript(join(rootDir, 'src', 'close-session.js'), args.slice(1));
@@ -118,7 +113,7 @@ switch(command) {
118
113
  break;
119
114
 
120
115
  case 'chat':
121
- // Run the chat agent
116
+ // Run the chat agent (kept for backward compatibility, now same as start)
122
117
  runScript(join(rootDir, 'src', 'agent-chat.js'), args.slice(1));
123
118
  break;
124
119
 
@@ -207,11 +202,12 @@ For more information, visit: https://github.com/SecondBrainAICo/CS_DevOpsAgent
207
202
  break;
208
203
 
209
204
  default:
210
- // Default to chat if no command provided, or if unknown command
211
- // This replaces the prior UX where help was default
205
+ // Default to Kora (Smart Assistant) if no command provided
206
+ // This provides the unified experience
212
207
  if (!command || !command.startsWith('-')) {
213
- console.log('Starting Kora Smart Assistant...');
214
- runScript(join(rootDir, 'src', 'agent-chat.js'), args.slice(1));
208
+ console.log('Starting Kora (Smart DevOps Assistant)...');
209
+ // Pass all args to agent-chat
210
+ runScript(join(rootDir, 'src', 'agent-chat.js'), args);
215
211
  } else {
216
212
  // Show help for flags like -h, --help, or unknown flags
217
213
  console.log(`\nCS_DevOpsAgent - Intelligent Git Automation System`);
@@ -1,3 +1,18 @@
1
+ # Release Notes - s9n-devops-agent v2.0.18-dev.3
2
+
3
+ ## 🚀 Enhancements
4
+ - **Base Branch Selection**: You can now select a base branch (e.g., main, develop) when starting a session, allowing for cleaner feature branching from stable points.
5
+ - **Enhanced Setup Wizard**:
6
+ - Finds and merges contract files from subdirectories.
7
+ - Ensures versioning strategy is configured.
8
+ - Persists credentials in user home directory to survive package updates.
9
+
10
+ ## 🐛 Fixes
11
+ - **Update Logic**: Fixed update checker to respect dev versions.
12
+ - **Credentials**: Fixed issue where API keys were lost during updates.
13
+
14
+ ---
15
+
1
16
  # Release Notes - s9n-devops-agent v2.0.11-dev.0
2
17
 
3
18
  ## 🐛 Fixed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "s9n-devops-agent",
3
- "version": "2.0.18-dev.0",
3
+ "version": "2.0.18-dev.11",
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",
@@ -0,0 +1,100 @@
1
+ #!/bin/bash
2
+
3
+ # Deploy DevOpsAgent locally to a target directory
4
+ # Usage: ./scripts/deploy-local.sh <target_directory>
5
+
6
+ TARGET_DIR="$1"
7
+
8
+ if [ -z "$TARGET_DIR" ]; then
9
+ echo "Usage: $0 <target_directory>"
10
+ exit 1
11
+ fi
12
+
13
+ if [ ! -d "$TARGET_DIR" ]; then
14
+ echo "Error: Target directory $TARGET_DIR does not exist"
15
+ exit 1
16
+ fi
17
+
18
+ SOURCE_DIR="$(pwd)"
19
+ DEST_DIR="$TARGET_DIR/DevOpsAgent"
20
+
21
+ echo "Deploying DevOpsAgent to $DEST_DIR..."
22
+
23
+ # Create destination directory
24
+ mkdir -p "$DEST_DIR"
25
+
26
+ # Copy files
27
+ echo "Copying files..."
28
+ rsync -av --exclude 'node_modules' \
29
+ --exclude '.git' \
30
+ --exclude '.DS_Store' \
31
+ --exclude 'local_deploy' \
32
+ --exclude 'coverage' \
33
+ --exclude 'test_cases' \
34
+ "$SOURCE_DIR/" "$DEST_DIR/"
35
+
36
+ # Install dependencies in the target
37
+ echo "Installing dependencies in $DEST_DIR..."
38
+ cd "$DEST_DIR"
39
+ npm install --production --silent
40
+ cd "$SOURCE_DIR"
41
+
42
+ # Create universal runner script
43
+ RUNNER="$TARGET_DIR/devops"
44
+ LOG_FILE="$TARGET_DIR/devops-agent.log"
45
+
46
+ echo "Creating 'devops' CLI wrapper..."
47
+
48
+ cat > "$RUNNER" << EOF
49
+ #!/bin/bash
50
+
51
+ # DevOps Agent CLI Wrapper
52
+ # Supports all standard commands: start, chat, setup, worker, etc.
53
+
54
+ DIR="\$(cd "\$(dirname "\$0")" && pwd)"
55
+ AGENT_DIR="\$DIR/DevOpsAgent"
56
+ LOG_FILE="\$DIR/devops-agent.log"
57
+
58
+ # Ensure executable permissions
59
+ chmod +x "\$AGENT_DIR/bin/cs-devops-agent"
60
+
61
+ # If first arg is 'worker' or 'background', run in background
62
+ if [ "\$1" == "background" ]; then
63
+ echo "Starting worker in background..."
64
+ echo "--- Worker Start: \$(date) ---" >> "\$LOG_FILE"
65
+ export AC_DEBUG="true"
66
+ node "\$AGENT_DIR/src/cs-devops-agent-worker.js" >> "\$LOG_FILE" 2>&1 &
67
+ echo "Worker PID: \$!"
68
+ echo "Logs: \$LOG_FILE"
69
+ exit 0
70
+ fi
71
+
72
+ # Otherwise run interactive CLI
73
+ node "\$AGENT_DIR/bin/cs-devops-agent" "\$@"
74
+ EOF
75
+
76
+ chmod +x "$RUNNER"
77
+
78
+ # Add to gitignore in target
79
+ GITIGNORE="$TARGET_DIR/.gitignore"
80
+ if [ -f "$GITIGNORE" ]; then
81
+ if ! grep -q "DevOpsAgent/" "$GITIGNORE"; then
82
+ echo "" >> "$GITIGNORE"
83
+ echo "# DevOps Agent" >> "$GITIGNORE"
84
+ echo "DevOpsAgent/" >> "$GITIGNORE"
85
+ echo "devops-agent.log" >> "$GITIGNORE"
86
+ echo "devops" >> "$GITIGNORE"
87
+ echo "Added DevOpsAgent files to .gitignore"
88
+ fi
89
+ fi
90
+
91
+ echo "Deployment complete!"
92
+ echo "Use the './devops' script to interact with the agent:"
93
+ echo ""
94
+ echo " ./devops setup # Run first-time setup"
95
+ echo " ./devops chat # Chat with Kora"
96
+ echo " ./devops start # Start session manager (Interactive)"
97
+ echo " ./devops background # Run worker silently"
98
+ echo " ./devops --help # See all commands"
99
+ echo ""
100
+ echo "Logs location: '$LOG_FILE'"