Skip to content

feat(cli): add org get and project get commands#16

Merged
betegon merged 4 commits intomainfrom
feat/org-project-get
Jan 19, 2026
Merged

feat(cli): add org get and project get commands#16
betegon merged 4 commits intomainfrom
feat/org-project-get

Conversation

@betegon
Copy link
Member

@betegon betegon commented Jan 19, 2026

Summary

  • Add sentry org get [org-slug] command to retrieve detailed organization information
  • Add sentry project get [project-slug] --org <org> command to retrieve detailed project information
  • Both commands support DSN-based auto-detection when no arguments provided
  • Add formatOrgDetails() and formatProjectDetails() formatters with human-readable output
  • Fix null check for optional features array in formatters

Commands

# Get organization details
sentry org get bete-dev
sentry org get --json

# Get project details  
sentry project get spotlight-electron --org bete-dev
sentry project get --json

Testing

  • Added E2E tests for both commands
  • All 222 tests pass

Add commands to retrieve detailed information about organizations and projects:

- sentry org get [org-slug] - Get organization details with DSN auto-detection
- sentry project get [project-slug] --org <org> - Get project details with DSN auto-detection

Both commands support:
- Positional slug argument or DSN-based auto-detection
- --json flag for JSON output
- Human-readable formatted output with key details

Also adds formatOrgDetails() and formatProjectDetails() formatters with proper
null checks for optional features array.
- Add formatFeaturesList() helper to eliminate duplicated features formatting
- Add MAX_DISPLAY_FEATURES constant for configurable truncation limit
- Improve JSDoc on writeHumanOutput helpers in org/project get commands
- Make features field optional in SentryOrganization and SentryProject types
  to match actual API behavior
- Add formatDetailsHeader() helper to handle empty name/slug edge cases
- Add test for partial flags error (--org without project slug)
Add a simple Writer interface ({ write(s: string): void }) to avoid
dependency on Node.js-specific types. This is more idiomatic for Bun
while maintaining testability through the context pattern.

Files updated:
- types/index.ts: Add Writer type
- formatters/json.ts: Use Writer
- All command files: Use Writer instead of NodeJS.WriteStream
@betegon betegon merged commit 7835aed into main Jan 19, 2026
2 checks passed
@betegon betegon deleted the feat/org-project-get branch January 19, 2026 13:05
betegon added a commit that referenced this pull request Mar 3, 2026
…ase caching (#307)

## Summary

Two optimizations to reduce round-trips during the init wizard:

1. **Pre-computed directory listing** — sends a pre-computed directory
listing with the first API call so the server can skip its initial
`list-dir` suspend. Saves one full HTTP round-trip in the
`discover-context` step.

2. **`_prevPhases` for cross-phase caching** — tracks per-step result
history (`stepHistory`) and sends `_prevPhases` with each resume
payload. This lets the server reuse results from earlier phases (e.g.
the `read-files` phase can reuse data from `analyze`) without
re-requesting them.

## Changes

- Exports `precomputeDirListing` from `local-ops.ts` — reuses the
existing `listDir` function with the same params the server would
request (recursive, maxDepth 3, maxEntries 500). The wizard runner calls
it before `startAsync` and includes the result as `dirListing` in
`inputData`.
- Adds a `stepHistory` map to track accumulated local-op results per
step. Each resume payload now includes `_prevPhases` containing results
from prior phases of the same step.

Companion server change: getsentry/cli-init-api#16

## Test plan

- [x] Init tests pass (`bun test test/lib/init/`)
- [x] Lint passes
- [ ] End-to-end with local dev server

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant