s9n-devops-agent 1.5.7 → 1.5.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "s9n-devops-agent",
3
- "version": "1.5.7",
3
+ "version": "1.5.9",
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",
@@ -1681,8 +1681,72 @@ The DevOps agent is monitoring this worktree for changes.
1681
1681
  console.log(`${CONFIG.colors.dim}Could not check git status${CONFIG.colors.reset}`);
1682
1682
  }
1683
1683
 
1684
+ // Ask about merging to target branch before cleanup
1685
+ let rl = readline.createInterface({
1686
+ input: process.stdin,
1687
+ output: process.stdout
1688
+ });
1689
+
1690
+ console.log(`\n${CONFIG.colors.yellow}Worktree Cleanup Options${CONFIG.colors.reset}`);
1691
+
1692
+ const mergeFirst = await new Promise(resolve => {
1693
+ rl.question(`\nMerge ${session.branchName} to target branch before cleanup? (y/N): `, resolve);
1694
+ });
1695
+ rl.close();
1696
+
1697
+ if (mergeFirst.toLowerCase() === 'y') {
1698
+ // Get target branch from merge config or ask
1699
+ let targetBranch = session.mergeConfig?.targetBranch || 'main';
1700
+
1701
+ rl = readline.createInterface({
1702
+ input: process.stdin,
1703
+ output: process.stdout
1704
+ });
1705
+
1706
+ const confirmTarget = await new Promise(resolve => {
1707
+ rl.question(`Target branch [${targetBranch}]: `, resolve);
1708
+ });
1709
+ rl.close();
1710
+
1711
+ if (confirmTarget.trim()) {
1712
+ targetBranch = confirmTarget.trim();
1713
+ }
1714
+
1715
+ try {
1716
+ console.log(`\n${CONFIG.colors.blue}Merging ${session.branchName} into ${targetBranch}...${CONFIG.colors.reset}`);
1717
+
1718
+ // Switch to target branch in main repo
1719
+ execSync(`git checkout ${targetBranch}`, { cwd: this.repoRoot, stdio: 'pipe' });
1720
+
1721
+ // Pull latest
1722
+ execSync(`git pull origin ${targetBranch}`, { cwd: this.repoRoot, stdio: 'pipe' });
1723
+
1724
+ // Merge the session branch
1725
+ execSync(`git merge --no-ff ${session.branchName} -m "Merge session ${sessionId}: ${session.task}"`, {
1726
+ cwd: this.repoRoot,
1727
+ stdio: 'pipe'
1728
+ });
1729
+
1730
+ // Push merged changes
1731
+ execSync(`git push origin ${targetBranch}`, { cwd: this.repoRoot, stdio: 'pipe' });
1732
+
1733
+ console.log(`${CONFIG.colors.green}✓${CONFIG.colors.reset} Successfully merged to ${targetBranch}`);
1734
+
1735
+ // Delete remote branch after successful merge
1736
+ try {
1737
+ execSync(`git push origin --delete ${session.branchName}`, { cwd: this.repoRoot, stdio: 'pipe' });
1738
+ console.log(`${CONFIG.colors.green}✓${CONFIG.colors.reset} Deleted remote branch ${session.branchName}`);
1739
+ } catch (err) {
1740
+ console.log(`${CONFIG.colors.dim}Could not delete remote branch${CONFIG.colors.reset}`);
1741
+ }
1742
+ } catch (err) {
1743
+ console.error(`${CONFIG.colors.red}✗ Merge failed: ${err.message}${CONFIG.colors.reset}`);
1744
+ console.log(`${CONFIG.colors.yellow}You may need to resolve conflicts manually${CONFIG.colors.reset}`);
1745
+ }
1746
+ }
1747
+
1684
1748
  // Ask about removing worktree
1685
- const rl = readline.createInterface({
1749
+ rl = readline.createInterface({
1686
1750
  input: process.stdin,
1687
1751
  output: process.stdout
1688
1752
  });
@@ -1698,6 +1762,14 @@ The DevOps agent is monitoring this worktree for changes.
1698
1762
  execSync(`git worktree remove "${session.worktreePath}" --force`, { stdio: 'pipe' });
1699
1763
  console.log(`${CONFIG.colors.green}✓${CONFIG.colors.reset} Worktree removed`);
1700
1764
 
1765
+ // Delete local branch
1766
+ try {
1767
+ execSync(`git branch -D ${session.branchName}`, { cwd: this.repoRoot, stdio: 'pipe' });
1768
+ console.log(`${CONFIG.colors.green}✓${CONFIG.colors.reset} Deleted local branch ${session.branchName}`);
1769
+ } catch (err) {
1770
+ console.log(`${CONFIG.colors.dim}Could not delete local branch${CONFIG.colors.reset}`);
1771
+ }
1772
+
1701
1773
  // Prune worktree list
1702
1774
  execSync('git worktree prune', { stdio: 'pipe' });
1703
1775
  } catch (err) {
@@ -41,7 +41,7 @@ show_copyright() {
41
41
  echo "======================================================================"
42
42
  echo
43
43
  echo " CS_DevOpsAgent - Intelligent Git Automation System"
44
- echo " Version 1.5.7 | Build 20251009.9"
44
+ echo " Version 1.5.9 | Build 20251009.11"
45
45
  echo " "
46
46
  echo " Copyright (c) 2024 SecondBrain Labs"
47
47
  echo " Author: Sachin Dev Duggal"
@@ -302,107 +302,15 @@ setup_house_rules() {
302
302
  echo "prevent conflicts when multiple agents work on the same codebase."
303
303
  echo
304
304
 
305
- # Check for existing house rules
306
- local HOUSERULES_PATH=""
307
- local HOUSERULES_FOUND=false
305
+ # NOTE: House rules creation is now handled by session-coordinator's ensureHouseRulesSetup()
306
+ # This provides the interactive prompt for structured vs flexible organization
307
+ # We only need to ensure file coordination directory exists here
308
308
 
309
- # Function to search for house rules file
310
- find_house_rules() {
311
- local search_dir="$1"
312
- local depth="${2:-0}"
313
-
314
- # Limit search depth
315
- if [[ $depth -gt 5 ]]; then
316
- return 1
317
- fi
318
-
319
- # First check standard locations
320
- for possible_path in "houserules.md" "HOUSERULES.md" ".github/HOUSERULES.md" "docs/houserules.md" "docs/HOUSERULES.md"; do
321
- if [[ -f "$search_dir/$possible_path" ]]; then
322
- echo "$search_dir/$possible_path"
323
- return 0
324
- fi
325
- done
326
-
327
- # If not found, search recursively (excluding DevOps directories)
328
- while IFS= read -r -d '' file; do
329
- local rel_path="${file#$search_dir/}"
330
- if [[ ! "$file" =~ "DevOpsAgent" ]] &&
331
- [[ ! "$file" =~ "CS_DevOpsAgent" ]] &&
332
- [[ ! "$file" =~ "node_modules" ]] &&
333
- [[ ! "$file" =~ ".git" ]]; then
334
- echo "$file"
335
- return 0
336
- fi
337
- done < <(find "$search_dir" -maxdepth 3 -type f \( -iname "houserules.md" -o -iname "HOUSERULES.md" \) -print0 2>/dev/null)
338
-
339
- return 1
340
- }
341
-
342
- # Search for house rules file
343
- if FOUND_PATH=$(find_house_rules "$ROOT"); then
344
- HOUSERULES_PATH="$FOUND_PATH"
345
- HOUSERULES_FOUND=true
346
- # Make path relative for display
347
- local REL_PATH="${FOUND_PATH#$ROOT/}"
348
- echo -e "${GREEN}✓${NC} Found existing house rules at: $REL_PATH"
349
- else
350
- echo "No existing house rules found."
351
- echo
352
- echo "Would you like to:"
353
- echo " ${BOLD}1)${NC} Create comprehensive house rules (recommended)"
354
- echo " ${BOLD}2)${NC} Specify path to existing house rules"
355
- echo " ${BOLD}3)${NC} Skip for now"
356
- echo
357
- echo -n "Your choice [1]: "
358
- read CHOICE
359
-
360
- case "${CHOICE:-1}" in
361
- 1)
362
- HOUSERULES_PATH="$ROOT/houserules.md"
363
- HOUSERULES_FOUND=false
364
- echo -e "${GREEN}✓${NC} Will create comprehensive house rules at: houserules.md"
365
- ;;
366
- 2)
367
- echo -n "Enter path to your house rules (relative to $ROOT): "
368
- read CUSTOM_PATH
369
- if [[ -f "$ROOT/$CUSTOM_PATH" ]]; then
370
- HOUSERULES_PATH="$ROOT/$CUSTOM_PATH"
371
- HOUSERULES_FOUND=true
372
- echo -e "${GREEN}✓${NC} Using house rules at: $CUSTOM_PATH"
373
- else
374
- echo -e "${YELLOW}File not found. Creating new house rules at: houserules.md${NC}"
375
- HOUSERULES_PATH="$ROOT/houserules.md"
376
- HOUSERULES_FOUND=false
377
- fi
378
- ;;
379
- 3)
380
- echo -e "${YELLOW}⚠ Skipping house rules setup${NC}"
381
- echo "You can set them up later by running: ./scripts/setup-file-coordination.sh"
382
- return 0
383
- ;;
384
- esac
385
- fi
386
-
387
- echo
388
- echo -e "${BLUE}Setting up file coordination system...${NC}"
309
+ # Create file coordination directory if it doesn't exist
310
+ mkdir -p "$COORD_DIR/active-edits" "$COORD_DIR/completed-edits" "$COORD_DIR/conflicts"
389
311
 
390
- # Run the actual setup inline (simplified version)
391
- if [[ -f "$SCRIPT_DIR/scripts/setup-file-coordination.sh" ]]; then
392
- # Pass the house rules path we already found!
393
- HOUSERULES_PATH="$HOUSERULES_PATH" bash "$SCRIPT_DIR/scripts/setup-file-coordination.sh"
394
- else
395
- # Inline setup if script doesn't exist
396
- mkdir -p "$COORD_DIR/active-edits" "$COORD_DIR/completed-edits"
397
- echo -e "${GREEN}✓${NC} File coordination directories created"
398
- fi
399
-
400
- echo
401
- echo -e "${GREEN}✓ Setup complete!${NC} AI agents will now follow house rules and coordinate file edits."
402
- echo
403
- echo -e "${DIM}Press Enter to continue...${NC}"
404
- read -r
405
- echo
312
+ # House rules will be created by session-coordinator when needed
313
+ # with the proper structured/flexible prompt
406
314
  }
407
315
 
408
316
  # Main function