AGENT SKILL

switch

Use when changing the active spec by name or path.

License 许可
MIT
所属仓库
mugsun/curdx-flow
最近更新
2026-08-19
Stars
★ 4
Forks
0

01 前言 Front Matter

name
switch
description
Use when changing the active spec by name or path.
allowed-tools
Read Write Bash Glob Agent
argument-hint
<spec-name-or-path>
disable-model-invocation
true

03 SKILL.md 正文

Switch Active Spec

You are switching the active specification.

Multi-Directory Resolution

This command uses the plugin runtime for multi-root spec discovery:

curdx-flow specs list
curdx-flow specs resolve [name-or-path]
curdx-flow specs find <name>

Parse Arguments

From $ARGUMENTS:

  • input: The spec name OR full path to switch to (required for switching)
    • If starts with ./ or /: treat as full path
    • Otherwise: treat as spec name to search for

Validate

  1. If no input provided, list available specs and ask user to choose
  2. If input is a full path (starts with ./):
    • Check if path exists as directory
    • If not, error: "Spec path '$input' not found"
  3. If input is a spec name:
    • Use curdx-flow specs find "$input" to search all configured specs_dirs
    • Exit code 0 (found unique): proceed with switch
    • Exit code 1 (not found): error with list of searched directories
    • Exit code 2 (ambiguous): show disambiguation prompt

List Available (if no argument)

If $ARGUMENTS is empty:

  1. Use curdx-flow specs list to gather all specs from all roots
  2. Read active from the same runtime output
  3. Group specs by their root directory with numbered options
  4. Show list with current marked and directory context
  5. If no specs found, guide user to create one

With specs found:

Available specs:

./specs (default):
  1. feature-a [ACTIVE]
  2. feature-b

./packages/api/specs:
  3. api-auth
  4. api-users

./packages/web/specs:
  5. web-login

Examples:
  /curdx-flow:switch feature-b
  /curdx-flow:switch api-auth
  /curdx-flow:switch ./packages/api/specs/api-auth  (full path for disambiguation)

No specs found:

No specs found in configured directories.

Searched:
  - ./specs (default)
  - ./packages/api/specs
  - ./packages/web/specs

To create a new spec:
  /curdx-flow:new my-feature
  /curdx-flow:new my-feature --specs-dir ./packages/api/specs

Handle Disambiguation

If spec name exists in multiple roots (exit code 2 from find):

Multiple specs named 'api-auth' found:

1. ./specs/api-auth
   Location: default specs directory
   Run: /curdx-flow:switch ./specs/api-auth

2. ./packages/api/specs/api-auth
   Location: packages/api
   Run: /curdx-flow:switch ./packages/api/specs/api-auth

Select by running the command for your desired spec.

Do NOT automatically select one. User must specify the full path with the exact command shown.

Handle Not Found

If spec name does not exist (exit code 1 from find):

No spec named 'my-feature' found.

Searched directories:
  - ./specs (default)
  - ./packages/api/specs
  - ./packages/web/specs

To see available specs: /curdx-flow:switch
To create a new spec: /curdx-flow:new my-feature

List all configured specs_dirs that were searched, helping user understand where to create the spec.

Execute Switch

  1. Determine the full path:

    • If input was a full path: use as-is
    • If input was a name with single match: use the resolved path
  2. Update ./specs/.current-spec:

    • For specs in default ./specs/ root: write bare name (backward compat)
    • For specs in other roots: write full path
    # Example for default root:
    echo "my-feature" > ./specs/.current-spec
    
    # Example for non-default root:
    echo "./packages/api/specs/api-auth" > ./specs/.current-spec
    
  3. Read the spec's state:

    • .curdx-state.json for phase and progress
    • .progress.md for context

Output

Switched to spec: $name

Location: $full_path
Current phase: <phase>
Progress: <taskIndex>/<totalTasks> tasks

Files present:
- [x/blank] research.md
- [x/blank] requirements.md
- [x/blank] design.md
- [x/blank] tasks.md

Next: Run /curdx-flow:<appropriate-phase> to continue

04 同仓库更多 Skills