Skip to content

Ctrlc apply http inputs#50

Closed
jsbroks wants to merge 1 commit intomainfrom
cursor/ctrlc-apply-http-inputs-2f34
Closed

Ctrlc apply http inputs#50
jsbroks wants to merge 1 commit intomainfrom
cursor/ctrlc-apply-http-inputs-2f34

Conversation

@jsbroks
Copy link
Member

@jsbroks jsbroks commented Feb 3, 2026

Add support for HTTP(S) URLs as input to ctrlc apply -f to allow applying configurations directly from remote YAML files.


Open in Cursor Open in Web


Note

Medium Risk
Introduces outbound HTTP fetching and URL handling in the CLI apply path, which can affect reliability and security expectations (timeouts, remote content, and error handling).

Overview
ctrlc apply -f now accepts HTTP(S) URLs in addition to local file paths/globs, and the help text/examples were updated accordingly.

Input handling was extended with ParseInput to fetch remote YAML (30s timeout, error on non-2xx) and parse it like local files, while expandGlob was updated to treat URLs as explicit candidates with include/exclude semantics; new tests cover URL inclusion/exclusion and HTTP fetch/status error cases.

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

Summary by CodeRabbit

  • New Features

    • Added support for applying YAML files from remote URLs in the apply command.
    • Include/exclude patterns now work with HTTP(S) URLs using last-match-wins semantics.
  • Improvements

    • Enhanced URL input handling with a 30-second timeout for HTTP requests.
    • Updated error messaging for improved clarity during input processing.

Co-authored-by: justin <justin@wandb.com>
@cursor
Copy link

cursor bot commented Feb 3, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 3, 2026

📝 Walkthrough

Walkthrough

The PR adds support for applying YAML files from remote HTTP(S) URLs in the apply command. It introduces a new input handling module that detects URLs and fetches them via HTTP, updates ExpandGlob to recognize URL patterns, replaces ParseFile with ParseInput throughout the flow, and adds comprehensive tests for URL validation and HTTP error scenarios.

Changes

Cohort / File(s) Summary
Apply command updates
cmd/ctrlc/root/apply/cmd.go
Refactored resource parsing to use ParseInput instead of ParseFile; updated ExpandGlob to recognize and handle URL patterns with isURL flag and last-match-wins semantics; added URL support to usage examples and help text.
Input handling module
cmd/ctrlc/root/apply/input.go
New module introducing ParseInput function that dispatches HTTP fetch for remote URLs or local file parsing; includes isHTTPURL validator, fetchHTTP with 30s timeout and 2xx status checking, and error wrapping for all failure paths.
Test coverage
cmd/ctrlc/root/apply/cmd_test.go, cmd/ctrlc/root/apply/input_test.go
Added four new tests: URL inclusion/exclusion in ExpandGlob, ParseInput with HTTP server returning valid YAML, and ParseInput error handling for 404 responses.

Sequence Diagram

sequenceDiagram
    participant User as User/CLI
    participant Apply as Apply Command
    participant Input as Input Handler
    participant HTTP as HTTP Client
    participant Parser as YAML Parser

    User->>Apply: apply <input>
    
    alt input is URL
        Apply->>Input: ParseInput(ctx, url)
        Input->>Input: isHTTPURL(url)
        Input->>HTTP: GET with 30s timeout
        HTTP-->>Input: response body
        Input->>Parser: ParseYAML(body)
        Parser-->>Input: []Document
        Input-->>Apply: []Document
    else input is file path
        Apply->>Input: ParseInput(ctx, path)
        Input->>Input: ParseFile(path)
        Input-->>Apply: []Document
    end
    
    Apply->>Apply: Apply documents
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 Remote URLs now hop through the apply command's gate,
HTTP fetches dance with YAML's parsed fate,
Pattern rules bloom with URL-aware sight,
From distant servers to resources—whoosh—all right! 🌐✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 27.27% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Ctrlc apply http inputs' directly aligns with the PR's main objective of adding HTTP(S) URL support to the apply command.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch cursor/ctrlc-apply-http-inputs-2f34

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@jsbroks jsbroks marked this pull request as ready for review February 3, 2026 18:30
@jsbroks jsbroks closed this Feb 7, 2026
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