Skip to content

refactor(project create): migrate human output to markdown rendering system#341

Merged
BYK merged 2 commits intomainfrom
byk/refactor-project-create-markdown
Mar 4, 2026
Merged

refactor(project create): migrate human output to markdown rendering system#341
BYK merged 2 commits intomainfrom
byk/refactor-project-create-markdown

Conversation

@BYK
Copy link
Copy Markdown
Member

@BYK BYK commented Mar 4, 2026

Migrate project create from ad-hoc stdout.write() + writeKeyValue() formatting to the markdown-first rendering pipeline used by all other detail/view commands.

Changes

  • New formatProjectCreated() in human.ts — Builds CommonMark using mdKvTable(), escapeMarkdownInline(), safeCodeSpan(), and renderMarkdown(). Notes (slug divergence, auto-created/auto-selected team) use markdown blockquotes. Tip footer uses italic text.

  • Simplified create.ts output path — Replaced ~30 lines of multi-write output with a single formatProjectCreated() call. JSON output and error handling unchanged.

  • Removed writeKeyValue() from output.ts — Dead code; project create was its only consumer.

  • Updated test assertions — Slug divergence note now uses backtick code spans instead of single quotes. All 32 tests pass.

Output

TTY — Unicode box-drawing tables, styled headings, terminal hyperlinks:

Created project 'my-app' in acme-corp

  Note: Using team 'engineering'. See all teams: sentry team list

╭──────────┬──────────────────────────────────────────────╮
│ Project  │ my-app                                       │
│ Slug     │ my-app                                       │
│ Org      │ acme-corp                                    │
│ Team     │ engineering                                  │
│ Platform │ python                                       │
│ DSN      │ https://abc@o123.ingest.us.sentry.io/999     │
│ URL      │ https://sentry.io/settings/acme-corp/…      │
╰──────────┴──────────────────────────────────────────────╯

Tip: Use sentry project view acme-corp/my-app for details

Plain/piped — Clean CommonMark (same as all other commands).

…system

Replace ad-hoc stdout.write() + writeKeyValue() calls in project create
with the markdown-first rendering pipeline used by all other detail views
(issue view, project view, org view, event view).

Changes:
- Add formatProjectCreated() to src/lib/formatters/human.ts using
  mdKvTable(), escapeMarkdownInline(), safeCodeSpan(), and renderMarkdown()
- Refactor create.ts human output to a single formatProjectCreated() call
- Migrate notes (slug divergence, auto-created team, auto-selected team)
  to markdown blockquotes
- Remove writeKeyValue() from output.ts (project create was its only consumer)
- Update test assertions: slug divergence note now uses backtick code spans
  instead of single quotes

TTY output gets Unicode box-drawing tables, styled headings, and terminal
hyperlinks. Plain/piped output emits clean CommonMark.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 4, 2026

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

Trace

Other

  • (api) Add --data/-d flag and auto-detect JSON body in fields by BYK in #320
  • (formatters) Render all terminal output as markdown by BYK in #297
  • (install) Add Sentry error telemetry to install script by BYK in #334
  • (issue-list) Global limit with fair distribution, compound cursor, and richer progress by BYK in #306
  • (log-list) Add --trace flag to filter logs by trace ID by BYK in #329
  • (logger) Add consola-based structured logging with Sentry integration by BYK in #338
  • (project) Add project create command by betegon in #237
  • (upgrade) Add binary delta patching via TRDIFF10/bsdiff by BYK in #327

Bug Fixes 🐛

Api

  • Use numeric project ID to avoid "not actively selected" error by betegon in #312
  • Use limit param for issues endpoint page size by BYK in #309
  • Auto-correct ':' to '=' in --field values with a warning by BYK in #302

Formatters

  • Expand streaming table to fill terminal width by betegon in #314
  • Fix HTML entities and escaped underscores in table output by betegon in #313

Setup

  • Suppress agent skills and welcome messages on upgrade by BYK in #328
  • Suppress shell completion messages on upgrade by BYK in #326

Upgrade

  • Replace Bun.mmap with arrayBuffer on macOS to prevent SIGKILL by BYK in #340
  • Use MAP_PRIVATE mmap to prevent macOS SIGKILL during delta upgrade by BYK in #339

Other

  • (ci) Generate JUnit XML to silence codecov-action warnings by BYK in #300
  • (install) Fix nightly digest extraction on macOS by BYK in #331
  • (nightly) Push to GHCR from artifacts dir so layer titles are bare filenames by BYK in #301
  • (project create) Auto-correct dot-separated platform to hyphens by BYK in #336
  • (region) Resolve DSN org prefix at resolution layer by BYK in #316
  • (test) Handle 0/-0 in getComparator anti-symmetry property test by BYK in #308
  • (trace-logs) Timestamp_precise is a number, not a string by BYK in #323

Documentation 📚

  • Document SENTRY_URL and self-hosted setup by BYK in #337

Internal Changes 🔧

Api

  • Upgrade @sentry/api to 0.21.0, remove raw HTTP pagination workarounds by BYK in #321
  • Wire listIssuesPaginated through @sentry/api SDK for type safety by BYK in #310

Other

  • (craft) Add sentry-release-registry target by BYK in #325
  • (project create) Migrate human output to markdown rendering system by BYK in #341

🤖 This preview updates automatically when you update the PR.

@BYK BYK marked this pull request as ready for review March 4, 2026 21:50
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 4, 2026

Codecov Results 📊

2681 passed | Total: 2681 | Pass Rate: 100% | Execution Time: 0ms

📊 Comparison with Base Branch

Metric Change
Total Tests
Passed Tests
Failed Tests
Skipped Tests

✨ No test changes detected

All tests are passing successfully.

✅ Patch coverage is 100.00%. Project has 3107 uncovered lines.
✅ Project coverage is 82.64%. Comparing base (base) to head (head).

Files with missing lines (3)
File Patch % Lines
human.ts 96.33% ⚠️ 31 Missing
create.ts 95.58% ⚠️ 11 Missing
output.ts 89.47% ⚠️ 2 Missing
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    82.62%    82.64%    +0.02%
==========================================
  Files          127       127         —
  Lines        17883     17895       +12
  Branches         0         0         —
==========================================
+ Hits         14775     14788       +13
- Misses        3108      3107        -1
- Partials         0         0         —

Generated by Codecov Action

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

…ated

The old code used `project.platform || platform` where `platform` was
the user's CLI argument. The migration lost this fallback by hardcoding
"unknown". Add `requestedPlatform` field to `ProjectCreatedResult` and
use it as fallback when the API response has no platform set.
@BYK BYK merged commit c774e74 into main Mar 4, 2026
20 checks passed
@BYK BYK deleted the byk/refactor-project-create-markdown branch March 4, 2026 22:02
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