aidevops 2.143.0 → 2.145.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/VERSION CHANGED
@@ -1 +1 @@
1
- 2.143.0
1
+ 2.145.0
package/aidevops.sh CHANGED
@@ -3,7 +3,7 @@
3
3
  # AI DevOps Framework CLI
4
4
  # Usage: aidevops <command> [options]
5
5
  #
6
- # Version: 2.143.0
6
+ # Version: 2.145.0
7
7
 
8
8
  set -euo pipefail
9
9
 
@@ -1295,18 +1295,119 @@ EOF
1295
1295
  # Plugins deploy to ~/.aidevops/agents/<namespace>/ (namespaced, no collisions)
1296
1296
  print_success "Created .aidevops.json"
1297
1297
 
1298
- # Create .agents symlink (or migrate from legacy .agent)
1299
- if [[ -L "$project_root/.agent" || -d "$project_root/.agent" ]]; then
1300
- # Migrate legacy .agent symlink to .agents
1301
- rm -f "$project_root/.agent"
1302
- ln -s "$AGENTS_DIR" "$project_root/.agents"
1303
- print_success "Migrated .agent -> .agents symlink"
1304
- elif [[ ! -e "$project_root/.agents" ]]; then
1305
- print_info "Creating .agents symlink..."
1306
- ln -s "$AGENTS_DIR" "$project_root/.agents"
1307
- print_success "Created .agents -> $AGENTS_DIR"
1298
+ # Derive repo name for scaffolding
1299
+ # In worktrees, basename gives the worktree dir name (e.g., "repo-chore-foo"),
1300
+ # not the actual repo name. Prefer: git remote URL > main worktree basename > cwd basename.
1301
+ local repo_name
1302
+ local remote_url
1303
+ remote_url=$(git -C "$project_root" remote get-url origin 2>/dev/null || true)
1304
+ if [[ -n "$remote_url" ]]; then
1305
+ repo_name=$(basename "$remote_url" .git)
1308
1306
  else
1309
- print_warning ".agents already exists, skipping symlink"
1307
+ # No remote try main worktree path (first line of `git worktree list`)
1308
+ local main_wt
1309
+ main_wt=$(git -C "$project_root" worktree list --porcelain 2>/dev/null | head -1 | sed 's/^worktree //')
1310
+ if [[ -n "$main_wt" ]]; then
1311
+ repo_name=$(basename "$main_wt")
1312
+ else
1313
+ repo_name=$(basename "$project_root")
1314
+ fi
1315
+ fi
1316
+
1317
+ # Create .agents/ directory for project-specific agent context
1318
+ # (The aidevops framework is loaded globally via ~/.aidevops/agents/ — this
1319
+ # directory is for project-specific agents, conventions, and architecture docs)
1320
+ if [[ -L "$project_root/.agents" ]]; then
1321
+ # Migrate legacy symlink to real directory
1322
+ rm -f "$project_root/.agents"
1323
+ print_info "Removed legacy .agents symlink (framework is loaded globally now)"
1324
+ fi
1325
+ # Also clean up legacy .agent symlink/directory
1326
+ if [[ -L "$project_root/.agent" ]]; then
1327
+ rm -f "$project_root/.agent"
1328
+ print_info "Removed legacy .agent symlink"
1329
+ elif [[ -d "$project_root/.agent" && ! -d "$project_root/.agents" ]]; then
1330
+ mv "$project_root/.agent" "$project_root/.agents"
1331
+ print_success "Migrated .agent/ -> .agents/ directory"
1332
+ fi
1333
+
1334
+ if [[ ! -d "$project_root/.agents" ]]; then
1335
+ mkdir -p "$project_root/.agents"
1336
+ print_success "Created .agents/ directory"
1337
+ fi
1338
+
1339
+ # Scaffold .agents/AGENTS.md if missing
1340
+ if [[ ! -f "$project_root/.agents/AGENTS.md" ]]; then
1341
+ cat >"$project_root/.agents/AGENTS.md" <<'AGENTSEOF'
1342
+ # Agent Instructions
1343
+
1344
+ This directory contains project-specific agent context. The [aidevops](https://aidevops.sh)
1345
+ framework is loaded separately via the global config (`~/.aidevops/agents/`).
1346
+
1347
+ ## Purpose
1348
+
1349
+ Files in `.agents/` provide project-specific instructions that AI assistants
1350
+ read when working in this repository. Use this for:
1351
+
1352
+ - Domain-specific conventions not covered by the framework
1353
+ - Project architecture decisions and patterns
1354
+ - API design rules, data models, naming conventions
1355
+ - Integration details (third-party services, deployment targets)
1356
+
1357
+ ## Adding Agents
1358
+
1359
+ Create `.md` files in this directory for domain-specific context:
1360
+
1361
+ ```text
1362
+ .agents/
1363
+ AGENTS.md # This file - overview and index
1364
+ api-patterns.md # API design conventions
1365
+ deployment.md # Deployment procedures
1366
+ data-model.md # Database schema and relationships
1367
+ ```
1368
+
1369
+ Each file is read on demand by AI assistants when relevant to the task.
1370
+ AGENTSEOF
1371
+ print_success "Created .agents/AGENTS.md"
1372
+ fi
1373
+
1374
+ # Scaffold root AGENTS.md if missing
1375
+ if [[ ! -f "$project_root/AGENTS.md" ]]; then
1376
+ cat >"$project_root/AGENTS.md" <<ROOTAGENTSEOF
1377
+ # $repo_name
1378
+
1379
+ <!-- AI-CONTEXT-START -->
1380
+
1381
+ ## Quick Reference
1382
+
1383
+ - **Build**: \`# TODO: add build command\`
1384
+ - **Test**: \`# TODO: add test command\`
1385
+ - **Deploy**: \`# TODO: add deploy command\`
1386
+
1387
+ ## Project Overview
1388
+
1389
+ <!-- Brief description of what this project does and why it exists. -->
1390
+
1391
+ ## Architecture
1392
+
1393
+ <!-- Key architectural decisions, tech stack, directory structure. -->
1394
+
1395
+ ## Conventions
1396
+
1397
+ - Commits: [Conventional Commits](https://www.conventionalcommits.org/)
1398
+ - Branches: \`feature/\`, \`bugfix/\`, \`hotfix/\`, \`refactor/\`, \`chore/\`
1399
+
1400
+ ## Key Files
1401
+
1402
+ | File | Purpose |
1403
+ |------|---------|
1404
+ | \`.agents/AGENTS.md\` | Project-specific agent instructions |
1405
+ | \`TODO.md\` | Task tracking |
1406
+ | \`CHANGELOG.md\` | Version history |
1407
+
1408
+ <!-- AI-CONTEXT-END -->
1409
+ ROOTAGENTSEOF
1410
+ print_success "Created AGENTS.md"
1310
1411
  fi
1311
1412
 
1312
1413
  # Create planning files if enabled
@@ -1534,28 +1635,68 @@ SOPSEOF
1534
1635
  fi
1535
1636
  fi
1536
1637
 
1537
- # Add to .gitignore if needed
1638
+ # Add aidevops runtime artifacts to .gitignore
1639
+ # Note: .agents/ itself is NOT ignored — it contains committed project-specific agents.
1640
+ # Only runtime artifacts (loop state, tmp, memory) are ignored.
1538
1641
  local gitignore="$project_root/.gitignore"
1539
1642
  if [[ -f "$gitignore" ]]; then
1540
- if ! grep -q "^\.agents$" "$gitignore" 2>/dev/null; then
1643
+ local gitignore_updated=false
1644
+
1645
+ # Remove legacy bare ".agents" entry if present (was added by older versions)
1646
+ if grep -q "^\.agents$" "$gitignore" 2>/dev/null; then
1647
+ sed -i '' '/^\.agents$/d' "$gitignore" 2>/dev/null ||
1648
+ sed -i '/^\.agents$/d' "$gitignore" 2>/dev/null || true
1649
+ # Also remove the "# aidevops" comment if it's now orphaned
1650
+ sed -i '' '/^# aidevops$/{ N; /^# aidevops\n$/d; }' "$gitignore" 2>/dev/null || true
1651
+ print_info "Removed legacy bare .agents from .gitignore (now tracked)"
1652
+ gitignore_updated=true
1653
+ fi
1654
+
1655
+ # Remove legacy bare ".agent" entry if present
1656
+ if grep -q "^\.agent$" "$gitignore" 2>/dev/null; then
1657
+ sed -i '' '/^\.agent$/d' "$gitignore" 2>/dev/null ||
1658
+ sed -i '/^\.agent$/d' "$gitignore" 2>/dev/null || true
1659
+ gitignore_updated=true
1660
+ fi
1661
+
1662
+ # Add runtime artifact ignores
1663
+ if ! grep -q "^\.agents/loop-state/" "$gitignore" 2>/dev/null; then
1541
1664
  {
1542
1665
  echo ""
1543
- echo "# aidevops"
1544
- echo ".agents"
1666
+ echo "# aidevops runtime artifacts"
1667
+ echo ".agents/loop-state/"
1668
+ echo ".agents/tmp/"
1669
+ echo ".agents/memory/"
1545
1670
  } >>"$gitignore"
1546
- print_success "Added .agents to .gitignore"
1547
- # Also add legacy .agent for backward compatibility
1548
- if ! grep -q "^\.agent$" "$gitignore" 2>/dev/null; then
1549
- echo ".agent" >>"$gitignore"
1671
+ print_success "Added .agents/ runtime artifact ignores to .gitignore"
1672
+ gitignore_updated=true
1673
+ fi
1674
+
1675
+ # Add .aidevops.json to gitignore (local config, not committed).
1676
+ # If .aidevops.json is already tracked by git (committed by older framework
1677
+ # versions), untrack it first — adding a tracked file to .gitignore is a
1678
+ # no-op and the file keeps showing in git diff on every re-init (#2570 bug 3).
1679
+ if ! grep -q "^\.aidevops\.json$" "$gitignore" 2>/dev/null; then
1680
+ if git -C "$project_root" ls-files --error-unmatch .aidevops.json &>/dev/null; then
1681
+ git -C "$project_root" rm --cached .aidevops.json &>/dev/null || true
1682
+ print_info "Untracked .aidevops.json from git (was committed by older version)"
1550
1683
  fi
1684
+ echo ".aidevops.json" >>"$gitignore"
1685
+ gitignore_updated=true
1551
1686
  fi
1687
+
1552
1688
  # Add .beads if beads is enabled
1553
1689
  if [[ "$enable_beads" == "true" ]]; then
1554
1690
  if ! grep -q "^\.beads$" "$gitignore" 2>/dev/null; then
1555
1691
  echo ".beads" >>"$gitignore"
1556
1692
  print_success "Added .beads to .gitignore"
1693
+ gitignore_updated=true
1557
1694
  fi
1558
1695
  fi
1696
+
1697
+ if [[ "$gitignore_updated" == "true" ]]; then
1698
+ print_info "Updated .gitignore"
1699
+ fi
1559
1700
  fi
1560
1701
 
1561
1702
  # Generate collaborator pointer files (lightweight AGENTS.md references)
@@ -1606,6 +1747,43 @@ SOPSEOF
1606
1747
  # Register repo in repos.json
1607
1748
  register_repo "$project_root" "$aidevops_version" "$features_list"
1608
1749
 
1750
+ # Auto-commit initialized files so they don't linger as mystery unstaged
1751
+ # changes (#2570 bug 2). Collect all files that cmd_init creates/modifies.
1752
+ local init_files=()
1753
+ [[ -f "$project_root/.gitignore" ]] && init_files+=(".gitignore")
1754
+ [[ -d "$project_root/.agents" ]] && init_files+=(".agents/")
1755
+ [[ -f "$project_root/AGENTS.md" ]] && init_files+=("AGENTS.md")
1756
+ [[ -f "$project_root/TODO.md" ]] && init_files+=("TODO.md")
1757
+ [[ -d "$project_root/todo" ]] && init_files+=("todo/")
1758
+ [[ -f "$project_root/MODELS.md" ]] && init_files+=("MODELS.md")
1759
+ [[ -f "$project_root/LICENCE" ]] && init_files+=("LICENCE")
1760
+ [[ -f "$project_root/CHANGELOG.md" ]] && init_files+=("CHANGELOG.md")
1761
+ [[ -f "$project_root/README.md" ]] && init_files+=("README.md")
1762
+ [[ -f "$project_root/.cursorrules" ]] && init_files+=(".cursorrules")
1763
+ [[ -f "$project_root/.windsurfrules" ]] && init_files+=(".windsurfrules")
1764
+ [[ -f "$project_root/.clinerules" ]] && init_files+=(".clinerules")
1765
+ [[ -d "$project_root/.github" ]] && init_files+=(".github/")
1766
+ [[ -f "$project_root/.sops.yaml" ]] && init_files+=(".sops.yaml")
1767
+ [[ -d "$project_root/schemas" ]] && init_files+=("schemas/")
1768
+ [[ -d "$project_root/migrations" ]] && init_files+=("migrations/")
1769
+ [[ -d "$project_root/seeds" ]] && init_files+=("seeds/")
1770
+
1771
+ local committed=false
1772
+ if [[ ${#init_files[@]} -gt 0 ]]; then
1773
+ # Stage all init files (--force not needed; .aidevops.json is gitignored above)
1774
+ if git -C "$project_root" add -- "${init_files[@]}" 2>/dev/null; then
1775
+ # Only commit if there are staged changes
1776
+ if ! git -C "$project_root" diff --cached --quiet 2>/dev/null; then
1777
+ if git -C "$project_root" commit -m "chore: initialize aidevops v${aidevops_version}" 2>/dev/null; then
1778
+ committed=true
1779
+ print_success "Committed initialized files"
1780
+ else
1781
+ print_warning "Auto-commit failed (pre-commit hook rejected?)"
1782
+ fi
1783
+ fi
1784
+ fi
1785
+ fi
1786
+
1609
1787
  echo ""
1610
1788
  print_success "AI DevOps initialized!"
1611
1789
  echo ""
@@ -1620,19 +1798,31 @@ SOPSEOF
1620
1798
  [[ -f "$project_root/MODELS.md" ]] && echo " ✓ MODELS.md (per-repo model performance leaderboard)"
1621
1799
  echo ""
1622
1800
  echo "Next steps:"
1801
+ local step=1
1802
+ if [[ "$committed" != "true" ]]; then
1803
+ echo " ${step}. Commit the initialized files: git add -A && git commit -m 'chore: initialize aidevops'"
1804
+ ((step++))
1805
+ fi
1623
1806
  if [[ "$enable_beads" == "true" ]]; then
1624
- echo " 1. Add tasks to TODO.md with dependencies (blocked-by:t001)"
1625
- echo " 2. Run /ready to see unblocked tasks"
1626
- echo " 3. Run /sync-beads to sync with Beads graph"
1627
- echo " 4. Use 'bd' CLI for graph visualization"
1807
+ echo " ${step}. Add tasks to TODO.md with dependencies (blocked-by:t001)"
1808
+ ((step++))
1809
+ echo " ${step}. Run /ready to see unblocked tasks"
1810
+ ((step++))
1811
+ echo " ${step}. Run /sync-beads to sync with Beads graph"
1812
+ ((step++))
1813
+ echo " ${step}. Use 'bd' CLI for graph visualization"
1628
1814
  elif [[ "$enable_database" == "true" ]]; then
1629
- echo " 1. Add schema files to schemas/"
1630
- echo " 2. Run diff to generate migrations"
1631
- echo " 3. See .agents/workflows/sql-migrations.md"
1815
+ echo " ${step}. Add schema files to schemas/"
1816
+ ((step++))
1817
+ echo " ${step}. Run diff to generate migrations"
1818
+ ((step++))
1819
+ echo " ${step}. See .agents/workflows/sql-migrations.md"
1632
1820
  else
1633
- echo " 1. Add tasks to TODO.md"
1634
- echo " 2. Use /create-prd for complex features"
1635
- echo " 3. Use /feature to start development"
1821
+ echo " ${step}. Add tasks to TODO.md"
1822
+ ((step++))
1823
+ echo " ${step}. Use /create-prd for complex features"
1824
+ ((step++))
1825
+ echo " ${step}. Use /feature to start development"
1636
1826
  fi
1637
1827
 
1638
1828
  return 0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aidevops",
3
- "version": "2.143.0",
3
+ "version": "2.145.0",
4
4
  "description": "AI DevOps Framework - AI-assisted development workflows, code quality, and deployment automation",
5
5
  "type": "module",
6
6
  "bin": {
package/setup.sh CHANGED
@@ -10,7 +10,7 @@ shopt -s inherit_errexit 2>/dev/null || true
10
10
  # AI Assistant Server Access Framework Setup Script
11
11
  # Helps developers set up the framework for their infrastructure
12
12
  #
13
- # Version: 2.143.0
13
+ # Version: 2.145.0
14
14
  #
15
15
  # Quick Install:
16
16
  # npm install -g aidevops && aidevops update (recommended)
@@ -3,7 +3,7 @@ Add ~/.aidevops/agents/AGENTS.md to context for AI DevOps capabilities.
3
3
  ## aidevops Framework Status
4
4
 
5
5
  **On conversation start**:
6
- 1. If you have Bash tool: Run `bash ~/.aidevops/agents/scripts/aidevops-update-check.sh`
6
+ 1. If you have Bash tool: Run `bash ~/.aidevops/agents/scripts/aidevops-update-check.sh --interactive`
7
7
  2. If no Bash tool: Read `~/.aidevops/cache/session-greeting.txt` (cached by agents with Bash)
8
8
  3. Parse the first line of output (format: `aidevops v{version} running in {app} v{app_version} | {repo}`). Greet with: "Hi!\n\nWe're running https://aidevops.sh v{version} in {app} v{app_version}.\n\nWhat would you like to work on?"
9
9
  4. Then respond to the user's actual message