Skip to content
Merged
Show file tree
Hide file tree
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
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ All commands are available under the `/5:` namespace:
| `/5:review-code` | 5 | AI-powered code review (Claude or CodeRabbit) |
| `/5:address-review-findings` | 5 | Apply annotated findings and address PR comments |
| `/5:quick-implement` | Fast | Streamlined workflow for small tasks |
| `/5:eject` | Utility | Permanently remove update infrastructure |
| `/5:unlock` | Utility | Remove planning guard lock |

## Configuration
Expand Down Expand Up @@ -264,6 +265,7 @@ After installation, your `.claude/` directory will contain:
│ ├── discuss-feature.md
│ ├── quick-implement.md
│ ├── configure.md
│ ├── eject.md
│ └── unlock.md
├── skills/ # Atomic operations
│ ├── build-project/
Expand Down Expand Up @@ -364,6 +366,21 @@ npx 5-phase-workflow
- User-created commands, agents, skills, hooks, and templates are preserved
- Only workflow-managed files are updated

### Ejecting

If you want to permanently opt out of the update system (e.g., to customize workflow files without future updates overwriting them), run:

```bash
/5:eject
```

This permanently removes the update infrastructure:
- Deletes `check-updates.js` hook, `update.md` and `eject.md` commands
- Deletes `.5/version.json` and `.5/.update-cache.json`
- Removes the update check hook entry from `.claude/settings.json`

All other workflow files remain untouched. **This is irreversible.** To restore update functionality, reinstall with `npx 5-phase-workflow`.

## Development

### Running Tests
Expand Down
1 change: 1 addition & 0 deletions bin/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,7 @@ function showCommandsHelp(isGlobal) {
log.info(' /5:address-review-findings - Apply review findings & PR comments');
log.info(' /5:configure - Interactive project setup');
log.info(' /5:reconfigure - Refresh docs/skills (no Q&A)');
log.info(' /5:eject - Eject from update mechanism');
log.info(' /5:unlock - Remove planning guard lock');
log.info('');
log.info(`Config file: ${path.join(getDataPath(isGlobal), 'config.json')}`);
Expand Down
91 changes: 91 additions & 0 deletions src/commands/5/eject.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
---
name: 5:eject
description: Eject from the update mechanism — permanently removes update infrastructure
allowed-tools: Bash, Read, Edit, AskUserQuestion
user-invocable: true
model: haiku
context: fork
---

<role>
You are a Workflow Ejector. You permanently remove the update infrastructure from this installation.
After ejecting, you are DONE.
</role>

# Eject from Update Mechanism

Ejecting permanently removes the update system from this installation. After ejecting:
- The update check hook (`check-updates.js`) is deleted
- The update command (`/5:update`) is deleted
- The eject command (`/5:eject`) is deleted
- Version tracking (`.5/version.json`) is deleted
- The update cache (`.5/.update-cache.json`) is deleted
- The `check-updates.js` hook entry is removed from `.claude/settings.json`

All other workflow files (commands, skills, hooks, templates) remain untouched.

**This is irreversible.** To restore update functionality, reinstall with `npx 5-phase-workflow`.

## Step 1: Check Current State

Read `.5/version.json`. If it doesn't exist, tell the user: "No 5-Phase Workflow installation found (or already ejected)." and stop.

Note the `packageVersion` for the confirmation message.

## Step 2: Confirm with User

Tell the user what ejecting means:

> **Eject from 5-Phase Workflow updates?**
>
> This will permanently delete:
> - `.claude/hooks/check-updates.js` (update check hook)
> - `.claude/commands/5/update.md` (update command)
> - `.claude/commands/5/eject.md` (this command)
> - `.5/version.json` (version tracking)
> - `.5/.update-cache.json` (update cache)
>
> The `check-updates.js` hook entry will also be removed from `.claude/settings.json`.
>
> All other workflow files remain untouched. To restore updates later, reinstall with `npx 5-phase-workflow`.

Ask: "Proceed with eject?"

If the user declines, stop here.

## Step 3: Delete Update Files

Run this command to delete the update-related files:

```bash
rm -f .claude/hooks/check-updates.js .claude/commands/5/update.md .claude/commands/5/eject.md .5/version.json .5/.update-cache.json
```

## Step 4: Clean Up settings.json

Read `.claude/settings.json`. Remove the hook entry from the `hooks.SessionStart` array where the command is `node .claude/hooks/check-updates.js`.

Specifically, find and remove the object in the `SessionStart` array that looks like:

```json
{
"matcher": "startup",
"hooks": [
{
"type": "command",
"command": "node .claude/hooks/check-updates.js",
"timeout": 10
}
]
}
```

If the `SessionStart` array becomes empty after removal, remove the `SessionStart` key entirely. Write the updated settings back.

## Step 5: Confirm

Tell the user:

> Ejected successfully. Update infrastructure has been removed from this installation (was v{packageVersion}).
>
> To restore update functionality, reinstall with: `npx 5-phase-workflow`
Loading