Skip to content

feat(opencode): add project usage cli command - #7546

Closed
allen-n wants to merge 3 commits into
anomalyco:devfrom
allen-n:allen/project-usage
Closed

allen-n wants to merge 3 commits into
anomalyco:devfrom
allen-n:allen/project-usage

Conversation

@allen-n

@allen-n allen-n commented Jan 10, 2026

Copy link
Copy Markdown

What does this PR do?

Adds a projects CLI command that lists all known projects with session counts, last-activity timestamps, and worktree status. Output now wraps full paths (no truncation), aligns with existing CLI patterns (UI.println, Locale.todayTimeOrDateTime), supports sorting/limit/active-only flags, and keeps the table frame intact across terminal widths (clamped to 80–120, defaults to 100 when unknown).

How did you verify your code works?

  • Unit test: bun test --cwd packages/opencode test/cli/projects.test.ts (verifies wrapping, no ellipsis, locale time, aligned frame)
  • Manual run on my machine: bun run --cwd packages/opencode src/index.ts projects --sort activity to see live output in the terminal.

Fixes #7545

Copilot AI review requested due to automatic review settings January 10, 2026 01:40
@github-actions

Copy link
Copy Markdown
Contributor

Hey! Your PR title Allen/project usage doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@allen-n allen-n changed the title Allen/project usage add project usage cli command Jan 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

@allen-n allen-n mentioned this pull request Jan 10, 2026
1 task done
@allen-n allen-n changed the title add project usage cli command feat(cli): add project usage cli command Jan 10, 2026
@allen-n allen-n changed the title feat(cli): add project usage cli command feat(opencode): add project usage cli command Jan 10, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new projects CLI command that displays project statistics including session counts, last activity timestamps, and worktree status. The implementation focuses on full path visibility with text wrapping instead of truncation, aligned table formatting across terminal widths, and proper locale-aware time formatting.

Key changes:

  • New projects CLI command with sorting, filtering, and limit options
  • Display function that wraps long paths without truncation and maintains table frame alignment
  • Unit test verifying wrapping behavior, frame alignment, and locale time formatting

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 8 comments.

File Description
packages/opencode/test/cli/projects.test.ts Adds test for displayProjectStats verifying path wrapping, frame alignment, and locale time formatting
packages/opencode/src/index.ts Registers new ProjectsCommand in CLI
packages/opencode/src/cli/cmd/projects.ts Implements projects command with aggregation, sorting, filtering, and table display logic

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…reads to avoid FS overload and compute lastActive safely, improved wrapText to prefer separators/spaces and avoid truncation.

- tests: Added reusable createProject helper and new coverage for empty list, multiple projects with totals, missing lastActive (“never”), and clamped narrow width while keeping path wrapping and frame alignment.
@github-actions

Copy link
Copy Markdown
Contributor

Closing this pull request because it has had no updates for more than 60 days. If you plan to continue working on it, feel free to reopen or open a new PR.

@github-actions github-actions Bot closed this Mar 12, 2026
@allen-n

allen-n commented Mar 15, 2026

Copy link
Copy Markdown
Author

Can I re-open this? would still love to use it.

@e-magon

e-magon commented May 20, 2026

Copy link
Copy Markdown

@allen-n can you reopen this pr please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: add projects listing command

3 participants