mirror of
https://github.com/Fission-AI/OpenSpec.git
synced 2026-09-14 20:16:53 +08:00
fa5df9a329
- Add Specification Format section to openspec-conventions with: - Requirement headers for consistent structure - Scenario headers with bold WHEN/THEN/AND keywords - Format flexibility for different content types - Update all CLI command specs to use structured format: - cli-init: Convert all behavioral sections - cli-list: Apply structured format throughout - cli-update: Restructure requirements and edge cases - cli-diff: Update all behavior sections - cli-archive: Convert complex behaviors to scenarios - Update openspec-conventions spec itself to follow its own format - Mark all tasks as completed
2.5 KiB
2.5 KiB
Update Command Specification
Purpose
As a developer using OpenSpec, I want to update the OpenSpec instructions in my project when new versions are released, so that I can benefit from improvements to AI agent instructions.
Core Requirements
Requirement: Update Behavior
The update command SHALL update OpenSpec instruction files to the latest templates.
Scenario: Running update command
- WHEN a user runs
openspec update - THEN the command SHALL:
- Check if the
openspecdirectory exists - Replace
openspec/README.mdwith the latest template (complete replacement) - Update the OpenSpec-managed block in
CLAUDE.mdusing markers- Preserve user content outside markers
- Create
CLAUDE.mdif missing
- Display ASCII-safe success message: "Updated OpenSpec instructions"
- Check if the
Requirement: Prerequisites
The command SHALL require an existing OpenSpec structure before allowing updates.
Scenario: Checking prerequisites
- GIVEN the command requires an existing
openspecdirectory (created byopenspec init) - WHEN the
openspecdirectory does not exist - THEN display error: "No OpenSpec directory found. Run 'openspec init' first."
- AND exit with code 1
Requirement: File Handling
The update command SHALL handle file updates in a predictable and safe manner.
Scenario: Updating files
- WHEN updating files
- THEN completely replace
openspec/README.mdwith the latest template - AND update only the OpenSpec-managed block in
CLAUDE.mdusing markers - AND use the default directory name
openspec - AND be idempotent (repeated runs have no additional effect)
Edge Cases
Requirement: Error Handling
The command SHALL handle edge cases gracefully.
Scenario: File permission errors
- WHEN file write fails
- THEN let the error bubble up naturally with file path
Scenario: Missing CLAUDE.md
- WHEN CLAUDE.md doesn't exist
- THEN create it with the template content
Scenario: Custom directory names
- WHEN considering custom directory names
- THEN not supported in this change
- AND the default directory name
openspecSHALL be used
Success Criteria
Users SHALL be able to:
- Update OpenSpec instructions with a single command
- Get the latest AI agent instructions
- See clear confirmation of the update
The update process SHALL be:
- Simple and fast (no version checking)
- Predictable (same result every time)
- Self-contained (no network required)