Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
170 changes: 170 additions & 0 deletions .agent/scripts/generate-opencode-commands.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1361,6 +1361,169 @@ EOF
((command_count++))
echo -e " ${GREEN}✓${NC} Created /ralph-task command"

# =============================================================================
# FULL-LOOP COMMAND
# =============================================================================
# End-to-end development loop (task → preflight → PR → postflight → deploy)

cat > "$OPENCODE_COMMAND_DIR/full-loop.md" << 'EOF'
---
description: Start end-to-end development loop (task → preflight → PR → postflight → deploy)
agent: Build+
---

Read ~/.aidevops/agents/scripts/commands/full-loop.md and follow its instructions.

Start a full development loop for: $ARGUMENTS

**Full Loop Phases:**
```text
Task Development → Preflight → PR Create → PR Review → Postflight → Deploy
```

**Usage:**
```bash
/full-loop "Implement feature X with tests"
/full-loop "Fix bug Y" --max-task-iterations 30
```

**Options:**
- `--max-task-iterations N` - Max iterations for task (default: 50)
- `--skip-preflight` - Skip preflight checks
- `--skip-postflight` - Skip postflight monitoring
- `--no-auto-pr` - Pause for manual PR creation

**Completion promise:** `<promise>FULL_LOOP_COMPLETE</promise>`
EOF
((command_count++))
echo -e " ${GREEN}✓${NC} Created /full-loop command"

# =============================================================================
# CODE-SIMPLIFIER COMMAND
# =============================================================================
# Simplify and refine code for clarity

cat > "$OPENCODE_COMMAND_DIR/code-simplifier.md" << 'EOF'
---
description: Simplify and refine code for clarity, consistency, and maintainability
agent: Build+
---

Read ~/.aidevops/agents/tools/code-review/code-simplifier.md and follow its instructions.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The /code-simplifier stub points directly to ~/.aidevops/agents/tools/code-review/code-simplifier.md, but this command also has a wrapper doc under scripts/commands/ (and the PR description mentions generating those); consider aligning this reference so the generated OpenCode command stays consistent with the canonical command doc.

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎


Target: $ARGUMENTS

**Usage:**
```bash
/code-simplifier # Simplify recently modified code
/code-simplifier src/ # Simplify code in specific directory
/code-simplifier --all # Review entire codebase (use sparingly)
```

**Key Principles:**
- Preserve exact functionality
- Clarity over brevity
- Avoid nested ternaries
- Remove obvious comments
- Apply project standards
EOF
((command_count++))
echo -e " ${GREEN}✓${NC} Created /code-simplifier command"

# =============================================================================
# SESSION-REVIEW COMMAND
# =============================================================================
# Review session for completeness before ending

cat > "$OPENCODE_COMMAND_DIR/session-review.md" << 'EOF'
---
description: Review session for completeness before ending
agent: Build+
---

Read ~/.aidevops/agents/scripts/commands/session-review.md and follow its instructions.

Review the current session for: $ARGUMENTS

**Checks performed:**
1. All objectives completed
2. Workflow best practices followed
3. Knowledge captured for future sessions
4. Clear next steps identified

**Usage:**
```bash
/session-review # Review current session
/session-review --capture # Also capture learnings to memory
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This usage example advertises a --capture flag, but the canonical scripts/commands/session-review.md describes positional “focus” arguments (e.g., workflow, knowledge); this may confuse users if they rely on the help text.

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎

```
EOF
((command_count++))
echo -e " ${GREEN}✓${NC} Created /session-review command"

# =============================================================================
# REMEMBER COMMAND
# =============================================================================
# Store a memory for cross-session recall

cat > "$OPENCODE_COMMAND_DIR/remember.md" << 'EOF'
---
description: Store a memory for cross-session recall
agent: Build+
---

Read ~/.aidevops/agents/scripts/commands/remember.md and follow its instructions.

Remember: $ARGUMENTS

**Usage:**
```bash
/remember "User prefers worktrees over checkout"
/remember "The auth module uses JWT with 24h expiry"
/remember --type WORKING_SOLUTION "Fixed by adding explicit return"
```

**Memory types:**
- WORKING_SOLUTION - Solutions that worked
- FAILED_APPROACH - Approaches that didn't work
- CODEBASE_PATTERN - Patterns in this codebase
- USER_PREFERENCE - User preferences
- TOOL_CONFIG - Tool configurations
- DECISION - Decisions made
- CONTEXT - General context

**Storage:** ~/.aidevops/.agent-workspace/memory/memory.db
EOF
((command_count++))
echo -e " ${GREEN}✓${NC} Created /remember command"

# =============================================================================
# RECALL COMMAND
# =============================================================================
# Search memories from previous sessions

cat > "$OPENCODE_COMMAND_DIR/recall.md" << 'EOF'
---
description: Search memories from previous sessions
agent: Build+
---

Read ~/.aidevops/agents/scripts/commands/recall.md and follow its instructions.

Search for: $ARGUMENTS

**Usage:**
```bash
/recall authentication # Search for auth-related memories
/recall --recent # Show 10 most recent memories
/recall --stats # Show memory statistics
/recall --type WORKING_SOLUTION # Filter by type
```

**Storage:** ~/.aidevops/.agent-workspace/memory/memory.db
EOF
((command_count++))
echo -e " ${GREEN}✓${NC} Created /recall command"

Comment on lines +1364 to +1526

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This pull request adds several new commands, and each one repeats a significant amount of boilerplate code (comment headers, cat redirection, counter increment, and echo status). To improve maintainability and reduce redundancy, consider abstracting this logic into a helper function.

For example, you could define a function like this (perhaps at the top of the script):

# Helper function to generate a command file
generate_command() {
  local name="$1"
  local description="$2"
  
  echo ""
  echo "# ============================================================================="
  echo "# ${name^^} COMMAND"
  echo "# ============================================================================="
  echo "# $description"

  cat > "$OPENCODE_COMMAND_DIR/$name.md"

  ((command_count++))
  echo -e "  ${GREEN}${NC} Created /$name command"
}

Then, you could generate each new command much more concisely, like this for /full-loop:

generate_command "full-loop" "End-to-end development loop (task → preflight → PR → postflight → deploy)" << 'EOF'
---
description: Start end-to-end development loop (task → preflight → PR → postflight → deploy)
agent: Build+
---

Read ~/.aidevops/agents/scripts/commands/full-loop.md and follow its instructions.

Start a full development loop for: $ARGUMENTS

# ... (rest of the heredoc content)

EOF

Applying this pattern to all the new commands would make the script cleaner and easier to extend in the future.

# =============================================================================
# SUMMARY
# =============================================================================
Expand All @@ -1385,6 +1548,7 @@ echo " /postflight - Check code audit feedback on latest push"
echo " /linters-local - Run local linting (ShellCheck, secretlint)"
echo " /code-audit-remote - Run remote auditing (CodeRabbit, Codacy, SonarCloud)"
echo " /code-standards - Check against documented standards"
echo " /code-simplifier - Simplify code for clarity and maintainability"
echo ""
echo " Git & Release:"
echo " /feature - Create feature branch"
Expand All @@ -1405,13 +1569,19 @@ echo " Utilities:"
echo " /onboarding - Interactive setup wizard (START HERE for new users)"
echo " /setup-aidevops - Deploy latest agent changes locally"
echo " /agent-review - Review and improve agent instructions"
echo " /session-review - Review session for completeness before ending"
echo " /context - Build AI context"
echo " /list-keys - List API keys with storage locations"
echo " /log-time-spent - Log time spent on a task"
echo ""
echo " Memory:"
echo " /remember - Store a memory for cross-session recall"
echo " /recall - Search memories from previous sessions"
echo ""
echo " Automation (Ralph Loops):"
echo " /ralph-loop - Start iterative AI development loop"
echo " /ralph-task - Run Ralph loop for a TODO.md task by ID"
echo " /full-loop - End-to-end: task → preflight → PR → postflight"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The summary description for /full-loop is inconsistent with its detailed documentation. The documentation (in full-loop.md) specifies the final step as deploy, which is missing here. To ensure consistency, please add it to the summary.

Suggested change
echo " /full-loop - End-to-end: task → preflight → PR → postflight"
echo " /full-loop - End-to-end: task → preflight → PR → postflight → deploy"

echo " /cancel-ralph - Cancel active Ralph loop"
echo " /ralph-status - Show Ralph loop status"
echo " /preflight-loop - Iterative preflight until all pass"
Expand Down
Loading