Skip to content

Add 'docs' command to view current stage instructions and update depe…#52

Merged
Arpan-206 merged 7 commits intomainfrom
arpan/cc-1963-add-codecrafters-docs-command
Oct 9, 2025
Merged

Add 'docs' command to view current stage instructions and update depe…#52
Arpan-206 merged 7 commits intomainfrom
arpan/cc-1963-add-codecrafters-docs-command

Conversation

@Arpan-206
Copy link
Copy Markdown
Contributor

@Arpan-206 Arpan-206 commented Oct 7, 2025

…ndencies.


Note

Introduces a docs command that fetches and displays current or specified stage instructions (optionally raw), backed by a new API client method and markdown rendering; updates Go/tooling and dependencies.

  • CLI:
    • Add docs command in cmd/codecrafters/main.go with flags: --stage (slug or relative offset) and --raw (no pretty-print).
    • Update usage text to list docs.
  • Commands:
    • New internal/commands/docs.go to fetch stages, resolve target stage, and render InstructionsMarkdown (via glamour) or print raw.
  • API Client:
    • Extend internal/utils/codecrafters_client.go with Stage, FetchStageListResponse, and FetchStageList() calling /services/cli/fetch_stage_list.
  • Dependencies/Tooling:
    • Bump Go to 1.23.0.
    • Add github.com/charmbracelet/glamour and related indirect deps; update several golang.org/x/* and go-isatty.

Written by Cursor Bugbot for commit d2a268c. This will update automatically on new commits. Configure here.

@linear
Copy link
Copy Markdown

linear Bot commented Oct 7, 2025

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@Arpan-206 Arpan-206 requested a review from rohitpaulk October 7, 2025 21:07
Comment thread cmd/codecrafters/main.go Outdated
$ codecrafters test # Run tests without committing changes
$ codecrafters test --previous # Run tests for the current stage and all previous stages without committing changes
$ codecrafters submit # Commit changes & submit to move to next step
$ codecrafters docs # View current stage instructions
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's remove this from the top-level examples too, isn't going to be a commonly used command

Comment thread internal/commands/docs.go Outdated
}

if currentStageIndex == -1 {
return fmt.Errorf("no current stage found")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's panic here, this shouldn't be an expected case

Comment thread internal/commands/docs.go Outdated
glamour.WithAutoStyle(),
)
if err != nil {
return fmt.Errorf("failed to create renderer: %w", err)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Panic here and below - anywhere it's clear its our fault, let's panic (Sentry will catch the error and register it)

@Arpan-206 Arpan-206 merged commit f6ae797 into main Oct 9, 2025
3 checks passed
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.

2 participants