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

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,151 @@
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.
119
84
 
120
- - Node.js 16.0.0 or higher
121
- - Git repository
122
- - Any AI assistant (Claude, Cursor, Copilot, Cline, etc.)
85
+ ### 📋 House Rules System
86
+ - **Context Injection:** AI agents read `docs/houserules.md` to understand your coding conventions.
87
+ - **Enforcement:** The agent checks commits against these rules.
123
88
 
124
- ## Documentation
89
+ ---
125
90
 
126
- 📖 **Getting Started**
127
- - [Interactive Tutorial](docs/V2_IMPLEMENTATION_GUIDE.md) - Learn by doing
128
- - [Installation Guide](docs/INSTALLATION_GUIDE.md) - Detailed setup
91
+ ## 📖 Usage Guide
129
92
 
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
93
+ ### Using Kora (Chat)
94
+ ```bash
95
+ $ s9n-devops-agent chat
135
96
 
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
97
+ 🤖 Kora - Smart DevOps Assistant
98
+ Powered by Groq (llama-3.3-70b-versatile)
99
+ ============================================================
140
100
 
141
- ## Troubleshooting
101
+ Kora > Hi! I'm Kora. How can I help you today?
142
102
 
143
- **Session not found?**
144
- ```bash
145
- s9n-devops-agent list --all # Check closed sessions
146
- ```
103
+ You > Start a session for user auth
147
104
 
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
105
+ Kora > Starting new session for: user-auth...
154
106
  ```
155
107
 
156
- **Need help?**
108
+ ### Managing Sessions
157
109
  ```bash
158
- s9n-devops-agent help-topics # Browse all help topics
159
- s9n-devops-agent tutorial # Re-run tutorial
160
- ```
110
+ # List all active sessions
111
+ s9n-devops-agent list
161
112
 
162
- ## Configuration
163
-
164
- Configure via environment variables or project settings:
113
+ # Close the current session (merge and cleanup)
114
+ s9n-devops-agent close
115
+ ```
165
116
 
117
+ ### Contract Testing
118
+ Run these tests to ensure your code complies with `House_Rules_Contracts/`:
166
119
  ```bash
167
- # Branch naming
168
- export AC_BRANCH_PREFIX="dev_initials_"
169
-
170
- # Auto-push (default: true)
171
- export AC_PUSH=true
120
+ npm run test:contracts
121
+ ```
172
122
 
173
- # Debug logging
174
- export AC_DEBUG=true
123
+ ---
175
124
 
176
- # Timezone for daily rollover
177
- export AC_TZ="America/New_York"
178
- ```
125
+ ## ⚙️ Configuration
179
126
 
180
- See [Configuration Guide](docs/INSTALLATION_GUIDE.md#configuration-files) for details.
127
+ The setup wizard (`s9n-devops-agent setup`) creates a `.env` file in your project root.
181
128
 
182
- ## Contributing
129
+ | Variable | Description |
130
+ |----------|-------------|
131
+ | `GROQ_API_KEY` | **Required** for Kora and AI commits. Get one at [console.groq.com](https://console.groq.com). |
132
+ | `AC_BRANCH_PREFIX` | Prefix for branch names (e.g., `dev_abc_`). |
133
+ | `AC_PUSH` | `true` to auto-push commits, `false` for local only. |
134
+ | `AC_DEBUG` | `true` for verbose logging. |
183
135
 
184
- Contributions welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
136
+ ---
185
137
 
186
- ## License
138
+ ## 📚 Documentation
139
+ - [Installation Guide](docs/INSTALLATION_GUIDE.md)
140
+ - [Testing Guide](TESTING_GUIDE.md)
141
+ - [House Rules Guide](docs/houserules-guide.md)
142
+ - [Contract Automation](scripts/contract-automation/README.md)
187
143
 
188
- MIT License - see [LICENSE](LICENSE) file for details.
144
+ ---
189
145
 
190
146
  ## Support
191
-
192
147
  - 🐛 [Report Issues](https://github.com/SecondBrainAICo/CS_DevOpsAgent/issues)
193
- - 💬 [Discussions](https://github.com/SecondBrainAICo/CS_DevOpsAgent/discussions)
194
148
  - 📦 [npm Package](https://www.npmjs.com/package/s9n-devops-agent)
195
- - 📖 [Documentation](https://github.com/SecondBrainAICo/CS_DevOpsAgent/wiki)
196
149
 
197
150
  ---
198
-
199
151
  **Built with ❤️ by [SecondBrain Labs](https://secondbrain.ai)**
200
-
201
- *Making AI-powered development safe, efficient, and conflict-free.*
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.2",
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",
@@ -150,19 +150,51 @@ This structure is compatible with the DevOps Agent's automation tools.
150
150
  }
151
151
 
152
152
  function checkContractsExist(projectRoot) {
153
- const contractsDir = path.join(projectRoot, 'House_Rules_Contracts');
154
- if (!fs.existsSync(contractsDir)) return false;
155
-
156
- const requiredContracts = [
157
- 'FEATURES_CONTRACT.md',
158
- 'API_CONTRACT.md',
159
- 'DATABASE_SCHEMA_CONTRACT.md',
160
- 'SQL_CONTRACT.json',
161
- 'THIRD_PARTY_INTEGRATIONS.md',
162
- 'INFRA_CONTRACT.md'
163
- ];
164
-
165
- return requiredContracts.every(file => fs.existsSync(path.join(contractsDir, file)));
153
+ // Search recursively for contract folders
154
+ try {
155
+ // Find all directories named 'House_Rules_Contracts' or 'contracts'
156
+ // Ignoring node_modules and .git
157
+ const findCommand = `find "${projectRoot}" -type d \\( -name "House_Rules_Contracts" -o -name "contracts" \\) -not -path "*/node_modules/*" -not -path "*/.git/*" -not -path "*/local_deploy/*"`;
158
+
159
+ const output = execSync(findCommand, { encoding: 'utf8' }).trim();
160
+ const locations = output.split('\n').filter(Boolean);
161
+
162
+ let contractsDir = null;
163
+ if (locations.length > 0) {
164
+ // Prefer House_Rules_Contracts if available
165
+ contractsDir = locations.find(l => l.endsWith('House_Rules_Contracts')) || locations[0];
166
+ log.info(`Found contracts directory at: ${contractsDir}`);
167
+ }
168
+
169
+ if (!contractsDir) return false;
170
+
171
+ const requiredContracts = [
172
+ 'FEATURES_CONTRACT.md',
173
+ 'API_CONTRACT.md',
174
+ 'DATABASE_SCHEMA_CONTRACT.md',
175
+ 'SQL_CONTRACT.json',
176
+ 'THIRD_PARTY_INTEGRATIONS.md',
177
+ 'INFRA_CONTRACT.md'
178
+ ];
179
+
180
+ // Check if we have multiple similar contracts that might need merging
181
+ const files = fs.readdirSync(contractsDir);
182
+ const potentialDuplicates = files.filter(f =>
183
+ (f.includes('FEATURE') && f !== 'FEATURES_CONTRACT.md') ||
184
+ (f.includes('API') && f !== 'API_CONTRACT.md')
185
+ );
186
+
187
+ if (potentialDuplicates.length > 0) {
188
+ log.info(`Found potential split contract files in ${contractsDir}:`);
189
+ potentialDuplicates.forEach(f => console.log(` - ${f}`));
190
+ console.log('You may want to merge these into single contract files per type.');
191
+ }
192
+
193
+ return requiredContracts.every(file => fs.existsSync(path.join(contractsDir, file)));
194
+ } catch (error) {
195
+ log.warn(`Error searching for contracts: ${error.message}`);
196
+ return false;
197
+ }
166
198
  }
167
199
 
168
200
  async function generateContracts(projectRoot) {
@@ -951,12 +983,10 @@ ${colors.dim}This takes about 2 minutes.${colors.reset}
951
983
  log.info(`Project root: ${projectRoot}`);
952
984
 
953
985
  // Ensure ScriptCS_DevOpsAgent directory exists
954
- const scriptsDir = path.join(projectRoot, 'ScriptCS_DevOpsAgent');
955
- if (!fs.existsSync(scriptsDir)) {
956
- log.error('ScriptCS_DevOpsAgent folder not found! Please copy the folder to your project root.');
957
- log.info('Run: cp -r ScriptCS_DevOpsAgent /path/to/your/project/');
958
- process.exit(1);
959
- }
986
+ // const scriptsDir = path.join(projectRoot, 'ScriptCS_DevOpsAgent');
987
+ // if (!fs.existsSync(scriptsDir)) {
988
+ // log.warn('ScriptCS_DevOpsAgent folder not found. Assuming global install or custom setup.');
989
+ // }
960
990
 
961
991
  // Get developer initials
962
992
  console.log();