원클릭으로
add-command
// Add support for a new CLI command. Use when implementing a handler or adding to SIMPLE_SAFE.
// Add support for a new CLI command. Use when implementing a handler or adding to SIMPLE_SAFE.
| name | add-command |
| description | Add support for a new CLI command. Use when implementing a handler or adding to SIMPLE_SAFE. |
| argument-hint | <command> |
| disable-model-invocation | true |
Add support for $ARGUMENTS in Dippy.
tldr pages:
ls ~/source/tldr/pages/*/$ARGUMENTS*.md
cat ~/source/tldr/pages/*/$ARGUMENTS.md
CLI docs:
$ARGUMENTS --help
man $ARGUMENTS
Note which operations are read-only vs mutations.
Add to SIMPLE_SAFE in src/dippy/core/allowlists.py and add tests to tests/test_simple.py in the appropriate category. Skip to step 5.
Create tests/cli/test_$ARGUMENTS.py:
"""Test cases for $ARGUMENTS."""
import pytest
from conftest import is_approved, needs_confirmation
TESTS = [
# Safe operations
("$ARGUMENTS <safe-subcommand>", True),
("$ARGUMENTS --help", True),
# Unsafe operations
("$ARGUMENTS <unsafe-subcommand>", False),
]
@pytest.mark.parametrize("command,expected", TESTS)
def test_command(check, command: str, expected: bool):
result = check(command)
if expected:
assert is_approved(result), f"Expected approve: {command}"
else:
assert needs_confirmation(result), f"Expected confirm: {command}"
Create src/dippy/cli/$ARGUMENTS.py:
"""$ARGUMENTS handler for Dippy."""
from dippy.cli import Classification, HandlerContext
COMMANDS = ["$ARGUMENTS"]
SAFE_ACTIONS = frozenset({"list", "show", "status"})
def classify(ctx: HandlerContext) -> Classification:
tokens = ctx.tokens
action = tokens[1] if len(tokens) > 1 else None
if action in SAFE_ACTIONS:
return Classification("allow", description=f"$ARGUMENTS {action}")
return Classification("ask", description="$ARGUMENTS")
For handler patterns (nested subcommands, flag-checking, delegation), see patterns.md.
just test
Fix failures until tests pass.
just check MUST pass before you're done.
Verify numerical claims in documentation are still accurate
Create a release PR with version bump and changelog
Ensure comprehensive test coverage for a CLI handler. Use when adding a new command or auditing existing handler coverage.
Debug incorrect Dippy approval or block behavior