Skip to content

Archive command moves changes to incorrect path (openspec/changes/archive) #412

@otakai

Description

@otakai

This bug was reproduced in version 0.17.2 of @fission-ai/openspec.

Description:
The openspec archive command moves the change directory to openspec/changes/archive/<date>-<name>.
However, the project structure and other parts of the CLI (like item-discovery.js) expect archived changes to reside in openspec/archive/.
This causes the archived change to be "lost" or misplaced, and subsequent commands like openspec list or validation checks fail to find it correctly or clutter the changes/ directory.

Environment:

Reproduction:

  1. Initialize a project with openspec init.
  2. Create a change with openspec scaffold fix-something.
  3. Run openspec archive fix-something.
  4. Observe that openspec/changes/fix-something moves to openspec/changes/archive/... instead of openspec/archive/....

Proposed Fix:
The implementation in dist/core/archive.js incorrectly joins changesDir instead of targetPath (project root) when defining archiveDir.

In openspec/dist/core/archive.js:

// Current (Buggy)
const archiveDir = path.join(changesDir, 'archive');

// Fixed
const archiveDir = path.join(targetPath, 'openspec', 'archive');

Also, item-discovery.js needs alignment if it isn't already looking in the root archive folder.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions