---
name: complete-step
description: Mark a step as complete in the active MASTER_PLAN
arguments: "[N]"
---

# /complete-step Command

Mark a step as done in the active MASTER_PLAN file and update WORKFLOW_STATE.md with the commit hash.

## Arguments

- `N` (optional) — Step number to complete. Defaults to the first unchecked step.

## Behavior

### Step 1: Read Active Phase

Read `WORKFLOW_STATE.md` and find the `## Active Phase` section.

**If no active phase** (Phase is `idle` or section is missing):
> No active phase. Use `/promote` to activate a plan first.

Then stop.

### Step 2: Parse the Plan

Extract the `Plan:` filename from the Active Phase section.

Run the parse script:

```bash
bash "${CLAUDE_PLUGIN_ROOT}/scripts/parse-plan-steps.sh" "PLAN_FILE"
```

### Step 3: Determine Target Step

If `N` was provided, use it. Otherwise, find the first unchecked step number from the parsed output.

**If the target step is already checked:**
> Step N is already complete.

Then stop.

**If no unchecked steps remain:**
> All steps are already complete! Use `/archive` to archive this plan.

Then stop.

### Step 4: Update MASTER_PLAN File

Read the MASTER_PLAN file. Find the line matching `- [ ] **N. ` and replace `- [ ]` with `- [x]`.

Use the Edit tool to make this change.

### Step 5: Get Current Commit Hash

```bash
git rev-parse --short HEAD
```

### Step 6: Update WORKFLOW_STATE.md

Read `WORKFLOW_STATE.md`. In the `### Steps` table under `## Active Phase`, update the row for step N:
- Change `pending` to the short commit hash (e.g., `abc1234`)

### Step 7: Re-parse and Report

Run the parse script again to get updated counts.

Display:
```
Completed step N: [step title]
Commit: [hash]
Progress: DONE/TOTAL steps complete
```

**If all steps are now done:**
> Phase complete! All TOTAL steps done.
> Use `/archive` to archive the plan and reset the active phase.

**Otherwise:**
> Next step: **M. [next step title]**
