project-standalo-note-to-app/.claude/commands/workflow/diff.md

7.8 KiB
Raw Blame History

description allowed-tools
Compare workflow versions and show manifest changes Read, Bash

Workflow Version Diff

Compare workflow versions to see what changed in the project manifest.

EXECUTION PROTOCOL

Step 1: Parse Arguments

IF "$ARGUMENTS" = "":
  MODE = "current" (diff latest version with current)
ELSE IF "$ARGUMENTS" matches "v\d+ v\d+":
  MODE = "versions" (diff two specific versions)
ELSE IF "$ARGUMENTS" matches "v\d+":
  MODE = "single" (diff specific version with current)
ELSE IF "$ARGUMENTS" = "--changelog" or "--log":
  MODE = "changelog" (show all version changelogs)
ELSE IF "$ARGUMENTS" contains "--json":
  OUTPUT = "json"

Step 2: Get Available Versions

python3 skills/guardrail-orchestrator/scripts/manifest_diff.py versions

Step 3: Execute Diff Based on Mode

MODE: current (default)

# Get latest version
LATEST=$(ls -1 .workflow/versions/ 2>/dev/null | tail -1)

# Diff with current manifest
python3 skills/guardrail-orchestrator/scripts/manifest_diff.py diff $LATEST current

MODE: versions (e.g., "v001 v002")

# Diff two specific versions
python3 skills/guardrail-orchestrator/scripts/manifest_diff.py diff v001 v002

MODE: single (e.g., "v001")

# Diff specific version with current
python3 skills/guardrail-orchestrator/scripts/manifest_diff.py diff v001

MODE: changelog

# Show all changelogs
python3 skills/guardrail-orchestrator/scripts/manifest_diff.py changelog

JSON output

# Add --json for programmatic use
python3 skills/guardrail-orchestrator/scripts/manifest_diff.py diff v001 --json

Step 4: Display Results

The script outputs:

╔══════════════════════════════════════════════════════════════════════╗
║  MANIFEST DIFF: v001 → v002                                          ║
╠══════════════════════════════════════════════════════════════════════╣
║  SUMMARY                                                              ║
║    + Added:     3                                                     ║
║    ~ Modified:  2                                                     ║
║    - Removed:   1                                                     ║
║    = Unchanged: 5                                                     ║
╠══════════════════════════════════════════════════════════════════════╣
║  BY TYPE                                                              ║
║    pages: +1                                                          ║
║    components: +2 ~1                                                  ║
║    api_endpoints: ~1 -1                                               ║
╠══════════════════════════════════════════════════════════════════════╣
║   ADDED                                                             ║
║    + 📄 Profile (app/profile/page.tsx)                                ║
║    + 🧩 Button (app/components/Button.tsx)                            ║
║    + 🧩 Modal (app/components/Modal.tsx)                              ║
╠══════════════════════════════════════════════════════════════════════╣
║  📝 MODIFIED                                                          ║
║    ~ 🧩 Header (app/components/Header.tsx)                            ║
║        dependencies: [] → ['Button']                                  ║
║    ~ 🔌 users (app/api/users/route.ts)                                ║
║        status: PENDING → IMPLEMENTED                                  ║
╠══════════════════════════════════════════════════════════════════════╣
║   REMOVED                                                           ║
║    - 🔌 legacy (app/api/legacy/route.ts)                              ║
╚══════════════════════════════════════════════════════════════════════╝

USAGE EXAMPLES

# Compare latest version with current manifest
/workflow:diff

# Compare two specific versions
/workflow:diff v001 v002

# Compare specific version with current
/workflow:diff v003

# Show all version changelogs
/workflow:diff --changelog

# Output as JSON
/workflow:diff v001 --json

WHAT IT SHOWS

Entity Changes

  • Added: New pages, components, API endpoints, etc.
  • Modified: Status changes, dependency updates, path changes
  • Removed: Deleted entities from manifest

Entity Type Icons

  • 📄 page
  • 🧩 component
  • 🔌 api_endpoint
  • 📚 lib
  • 🪝 hook
  • 📝 type
  • ⚙️ config

Change Details

  • Entity name and file path
  • Specific field changes with before/after values
  • Summary statistics by type

CHANGELOG MODE

Show version history with changes:

/workflow:diff --changelog

Output:

╔══════════════════════════════════════════════════════════════════════╗
║  CHANGELOG: v001                                                     ║
╠══════════════════════════════════════════════════════════════════════╣
║  Feature: User authentication                                        ║
║  Status:  completed                                                  ║
║  Started: 2025-01-15 10:30:00                                        ║
║  Completed: 2025-01-15 14:45:00                                      ║
╠══════════════════════════════════════════════════════════════════════╣
║  CHANGES                                                             ║
║    + Added page: Login                                               ║
║    + Added page: Register                                            ║
║    + Added component: AuthForm                                       ║
║    + Added api_endpoint: auth                                        ║
╚══════════════════════════════════════════════════════════════════════╝

INTEGRATION

Uses Version Snapshots

The diff tool uses snapshots created by version_manager.py:

  • snapshot_before/manifest.json - Manifest at version start
  • snapshot_after/manifest.json - Manifest at version completion

These are automatically created when:

  • /workflow:spawn initializes a new version
  • /workflow:complete marks a version as done
  • /workflow:history - List all workflow versions
  • /workflow:status - Show current workflow state
  • /workflow:changelog <version> - Alias for --changelog