-
Notifications
You must be signed in to change notification settings - Fork 955
feat: show archived changes in list and view commands #399
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Add --archived and --all flags to the list command to display archived changes. The view dashboard now includes an "Archived Changes" section with a count in the summary. - list --archived: shows only archived changes - list --all: shows both active and archived changes - view: displays archived changes section in dashboard 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
WalkthroughThe changes add support for listing and displaying archived changes through new CLI options Changes
Sequence Diagram(s)sequenceDiagram
participant User as User
participant CLI as CLI Handler
participant ListCmd as ListCommand
participant FS as FileSystem
participant View as View/Display
User->>CLI: list --archived / --all
CLI->>ListCmd: execute(path, mode, {archived, all})
rect rgb(240, 248, 255)
Note over ListCmd: Determine display flags
ListCmd->>ListCmd: showArchived, showActive = computed from options
end
rect rgb(240, 250, 240)
Note over ListCmd: Fetch Active Changes
ListCmd->>FS: read active changes (exclude "archive")
end
alt options.archived or options.all
rect rgb(255, 250, 240)
Note over ListCmd: Fetch Archived Changes
ListCmd->>FS: read archive directory
FS-->>ListCmd: archived change entries (or empty if dir missing)
end
end
rect rgb(245, 245, 245)
Note over ListCmd: Validate & Merge
ListCmd->>ListCmd: Check if changes exist<br/>Mark archived entries with archived: true<br/>Prepare display data
end
alt Changes found
ListCmd->>View: Display active + archived sections
View->>View: Render "Active Changes:" section
View->>View: Render "Archived Changes:" section
else No changes found
ListCmd->>View: Display context message<br/>(No active/archived/any changes)
end
View-->>User: Output
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
src/core/view.ts (2)
154-172: Consider removing unnecessaryasyncmodifier.The
getArchivedChangesDatamethod is markedasyncbut only uses synchronous filesystem operations (fs.existsSync,fs.readdirSync). This is inconsistent with other methods likegetChangesDataandgetSpecsDatawhich are alsoasyncbut use sync operations.While this works, consider either:
- Removing
asyncfrom all these methods since they don't useawait- Converting to async fs operations (
fs.promises) for consistency
174-177: Consider stronger typing for parameters.The
changesData.activeandspecsDataparameters useany[]which loses type safety. Consider using the actual types or defining interfaces:🔎 Suggested type improvement
private displaySummary( - changesData: { active: any[]; completed: any[] }, - specsData: any[], + changesData: { active: Array<{ name: string; progress: { total: number; completed: number } }>; completed: Array<{ name: string }> }, + specsData: Array<{ name: string; requirementCount: number }>, archivedData: Array<{ name: string }> = [] ): void {src/core/list.ts (1)
43-56: Minor duplication:archiveDiris computed twice.The archive directory path is computed on line 46 and again on line 83. Consider computing it once at the top of the changes mode block.
🔎 Suggested refactor
const changesDir = path.join(targetPath, 'openspec', 'changes'); + const archiveDir = path.join(changesDir, 'archive'); // Check if changes directory exists try { await fs.access(changesDir); } catch { throw new Error("No OpenSpec changes directory found. Run 'openspec init' first."); } const showArchived = options.archived || options.all; const showActive = !options.archived || options.all; // Get all directories in changes (excluding archive) const entries = await fs.readdir(changesDir, { withFileTypes: true }); const changeDirs = showActive ? entries .filter(entry => entry.isDirectory() && entry.name !== 'archive') .map(entry => entry.name) : []; // Get archived changes if requested let archivedDirs: string[] = []; if (showArchived) { - const archiveDir = path.join(changesDir, 'archive'); try { await fs.access(archiveDir); // ... rest of codeAnd remove the second declaration on line 83:
// Collect information about each archived change const archivedChanges: ChangeInfo[] = []; - const archiveDir = path.join(changesDir, 'archive'); for (const changeDir of archivedDirs) {Also applies to: 81-93
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/cli/index.tssrc/core/list.tssrc/core/view.ts
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-11-25T01:08:19.004Z
Learning: Applies to openspec/changes/**/specs/**/spec.md : Use `## ADDED|MODIFIED|REMOVED|RENAMED Requirements` headers in spec delta files
📚 Learning: 2025-11-25T01:08:19.004Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-11-25T01:08:19.004Z
Learning: Check `openspec/project.md` for project conventions before creating specs
Applied to files:
src/core/view.ts
📚 Learning: 2025-11-25T01:08:19.004Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-11-25T01:08:19.004Z
Learning: Move completed changes from `changes/[name]/` to `changes/archive/YYYY-MM-DD-[name]/` after deployment
Applied to files:
src/core/list.ts
🧬 Code graph analysis (2)
src/cli/index.ts (1)
src/core/list.ts (1)
ListCommand(20-168)
src/core/list.ts (1)
src/utils/task-progress.ts (2)
getTaskProgressForChange(27-35)formatTaskStatus(37-41)
🔇 Additional comments (5)
src/core/view.ts (1)
52-59: LGTM!The archived changes section follows the established pattern for other sections, with appropriate visual differentiation using gray styling and a distinct bullet character.
src/cli/index.ts (1)
98-104: LGTM!The new CLI options are well-integrated. The combination of
--archivedwith--allis technically redundant but handled gracefully inlist.tswhereshowArchived = options.archived || options.allensures correct behavior regardless.src/core/list.ts (3)
15-18: LGTM!The
ListOptionsinterface is well-designed and properly exported for use by CLI and potentially other consumers.
58-67: LGTM!The context-sensitive empty state messages provide clear feedback to users based on which filter flags they used.
99-124: LGTM!The display logic is clean with proper section separation and consistent formatting between active and archived changes.
Summary
--archivedflag toopenspec listcommand to show only archived changes--allflag toopenspec listcommand to show both active and archived changesopenspec viewdashboard with count in summaryTest plan
openspec list --archivedto verify only archived changes are displayedopenspec list --allto verify both active and archived changes are displayedopenspec viewto verify the "Archived Changes" section appears in the dashboardopenspec listbehavior (without flags) is unchanged🤖 Generated with Claude Code
Summary by CodeRabbit
--archivedand--allCLI options to filter and display archived items.✏️ Tip: You can customize this high-level summary in your review settings.