Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "1.2.0"
".": "1.3.0"
}
8 changes: 4 additions & 4 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 20
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev%2Fcontext.dev-56a21db16ac3a797f86daca01a2ea115a0365db4b2f9d8accdec4f4d3ee2eb83.yml
openapi_spec_hash: bfcef090896da96023c4485a3d69e350
config_hash: 38268bb88fc4dcbb8f2f94dd138b5910
configured_endpoints: 21
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev%2Fcontext.dev-97cdb78dc0d72e9df643a89660f2b0c9687f12c6e4d93f7767f6cfc1b4f2e4c7.yml
openapi_spec_hash: 92fc94fd8865fabe78c2667490ca3884
config_hash: 682b89b02a20f5d1c13e2c91ecbcf5ce
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 1.3.0 (2026-04-04)

Full Changelog: [v1.2.0...v1.3.0](https://github.com/context-dot-dev/context-ruby-sdk/compare/v1.2.0...v1.3.0)

### Features

* **api:** manual updates ([8e8fcc2](https://github.com/context-dot-dev/context-ruby-sdk/commit/8e8fcc26f2fbbb2bdcca9713fa3b9f8518303586))

## 1.2.0 (2026-04-03)

Full Changelog: [v1.1.0...v1.2.0](https://github.com/context-dot-dev/context-ruby-sdk/compare/v1.1.0...v1.2.0)
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ GIT
PATH
remote: .
specs:
context.dev (1.2.0)
context.dev (1.3.0)
cgi
connection_pool

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ To use this gem, install via Bundler by adding the following to your application
<!-- x-release-please-start-version -->

```ruby
gem "context.dev", "~> 1.2.0"
gem "context.dev", "~> 1.3.0"
```

<!-- x-release-please-end -->
Expand Down
2 changes: 2 additions & 0 deletions lib/context_dev.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@
require_relative "context_dev/models/utility_prefetch_response"
require_relative "context_dev/models/web_screenshot_params"
require_relative "context_dev/models/web_screenshot_response"
require_relative "context_dev/models/web_web_crawl_md_params"
require_relative "context_dev/models/web_web_crawl_md_response"
require_relative "context_dev/models/web_web_scrape_html_params"
require_relative "context_dev/models/web_web_scrape_html_response"
require_relative "context_dev/models/web_web_scrape_images_params"
Expand Down
2 changes: 2 additions & 0 deletions lib/context_dev/models.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ module ContextDev

WebScreenshotParams = ContextDev::Models::WebScreenshotParams

WebWebCrawlMdParams = ContextDev::Models::WebWebCrawlMdParams

WebWebScrapeHTMLParams = ContextDev::Models::WebWebScrapeHTMLParams

WebWebScrapeImagesParams = ContextDev::Models::WebWebScrapeImagesParams
Expand Down
92 changes: 92 additions & 0 deletions lib/context_dev/models/web_web_crawl_md_params.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# frozen_string_literal: true

module ContextDev
module Models
# @see ContextDev::Resources::Web#web_crawl_md
class WebWebCrawlMdParams < ContextDev::Internal::Type::BaseModel
extend ContextDev::Internal::Type::RequestParameters::Converter
include ContextDev::Internal::Type::RequestParameters

# @!attribute url
# The starting URL for the crawl (must include http:// or https:// protocol)
#
# @return [String]
required :url, String

# @!attribute follow_subdomains
# When true, follow links on subdomains of the starting URL's domain (e.g.
# docs.example.com when starting from example.com). www and apex are always
# treated as equivalent.
#
# @return [Boolean, nil]
optional :follow_subdomains, ContextDev::Internal::Type::Boolean, api_name: :followSubdomains

# @!attribute include_images
# Include image references in the Markdown output
#
# @return [Boolean, nil]
optional :include_images, ContextDev::Internal::Type::Boolean, api_name: :includeImages

# @!attribute include_links
# Preserve hyperlinks in the Markdown output
#
# @return [Boolean, nil]
optional :include_links, ContextDev::Internal::Type::Boolean, api_name: :includeLinks

# @!attribute max_depth
# Maximum link depth from the starting URL (0 = only the starting page)
#
# @return [Integer, nil]
optional :max_depth, Integer, api_name: :maxDepth

# @!attribute max_pages
# Maximum number of pages to crawl. Hard cap: 500.
#
# @return [Integer, nil]
optional :max_pages, Integer, api_name: :maxPages

# @!attribute shorten_base64_images
# Truncate base64-encoded image data in the Markdown output
#
# @return [Boolean, nil]
optional :shorten_base64_images, ContextDev::Internal::Type::Boolean, api_name: :shortenBase64Images

# @!attribute url_regex
# Regex pattern. Only URLs matching this pattern will be followed and scraped.
#
# @return [String, nil]
optional :url_regex, String, api_name: :urlRegex

# @!attribute use_main_content_only
# Extract only the main content, stripping headers, footers, sidebars, and
# navigation
#
# @return [Boolean, nil]
optional :use_main_content_only, ContextDev::Internal::Type::Boolean, api_name: :useMainContentOnly

# @!method initialize(url:, follow_subdomains: nil, include_images: nil, include_links: nil, max_depth: nil, max_pages: nil, shorten_base64_images: nil, url_regex: nil, use_main_content_only: nil, request_options: {})
# Some parameter documentations has been truncated, see
# {ContextDev::Models::WebWebCrawlMdParams} for more details.
#
# @param url [String] The starting URL for the crawl (must include http:// or https:// protocol)
#
# @param follow_subdomains [Boolean] When true, follow links on subdomains of the starting URL's domain (e.g. docs.ex
#
# @param include_images [Boolean] Include image references in the Markdown output
#
# @param include_links [Boolean] Preserve hyperlinks in the Markdown output
#
# @param max_depth [Integer] Maximum link depth from the starting URL (0 = only the starting page)
#
# @param max_pages [Integer] Maximum number of pages to crawl. Hard cap: 500.
#
# @param shorten_base64_images [Boolean] Truncate base64-encoded image data in the Markdown output
#
# @param url_regex [String] Regex pattern. Only URLs matching this pattern will be followed and scraped.
#
# @param use_main_content_only [Boolean] Extract only the main content, stripping headers, footers, sidebars, and navigat
#
# @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}]
end
end
end
121 changes: 121 additions & 0 deletions lib/context_dev/models/web_web_crawl_md_response.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# frozen_string_literal: true

module ContextDev
module Models
# @see ContextDev::Resources::Web#web_crawl_md
class WebWebCrawlMdResponse < ContextDev::Internal::Type::BaseModel
# @!attribute metadata
#
# @return [ContextDev::Models::WebWebCrawlMdResponse::Metadata]
required :metadata, -> { ContextDev::Models::WebWebCrawlMdResponse::Metadata }

# @!attribute results
#
# @return [Array<ContextDev::Models::WebWebCrawlMdResponse::Result>]
required :results,
-> { ContextDev::Internal::Type::ArrayOf[ContextDev::Models::WebWebCrawlMdResponse::Result] }

# @!method initialize(metadata:, results:)
# @param metadata [ContextDev::Models::WebWebCrawlMdResponse::Metadata]
# @param results [Array<ContextDev::Models::WebWebCrawlMdResponse::Result>]

# @see ContextDev::Models::WebWebCrawlMdResponse#metadata
class Metadata < ContextDev::Internal::Type::BaseModel
# @!attribute max_crawl_depth
# Maximum crawl depth reached during the crawl
#
# @return [Integer]
required :max_crawl_depth, Integer, api_name: :maxCrawlDepth

# @!attribute num_failed
# Number of pages that failed to crawl
#
# @return [Integer]
required :num_failed, Integer, api_name: :numFailed

# @!attribute num_succeeded
# Number of pages successfully crawled
#
# @return [Integer]
required :num_succeeded, Integer, api_name: :numSucceeded

# @!attribute num_urls
# Total number of URLs crawled
#
# @return [Integer]
required :num_urls, Integer, api_name: :numUrls

# @!method initialize(max_crawl_depth:, num_failed:, num_succeeded:, num_urls:)
# @param max_crawl_depth [Integer] Maximum crawl depth reached during the crawl
#
# @param num_failed [Integer] Number of pages that failed to crawl
#
# @param num_succeeded [Integer] Number of pages successfully crawled
#
# @param num_urls [Integer] Total number of URLs crawled
end

class Result < ContextDev::Internal::Type::BaseModel
# @!attribute markdown
# Extracted page content as Markdown (empty string on failure)
#
# @return [String]
required :markdown, String

# @!attribute metadata
#
# @return [ContextDev::Models::WebWebCrawlMdResponse::Result::Metadata]
required :metadata, -> { ContextDev::Models::WebWebCrawlMdResponse::Result::Metadata }

# @!method initialize(markdown:, metadata:)
# @param markdown [String] Extracted page content as Markdown (empty string on failure)
#
# @param metadata [ContextDev::Models::WebWebCrawlMdResponse::Result::Metadata]

# @see ContextDev::Models::WebWebCrawlMdResponse::Result#metadata
class Metadata < ContextDev::Internal::Type::BaseModel
# @!attribute crawl_depth
# Depth relative to the start URL. 0 = start URL, 1 = one link away.
#
# @return [Integer]
required :crawl_depth, Integer, api_name: :crawlDepth

# @!attribute status_code
# HTTP status code of the response
#
# @return [Integer]
required :status_code, Integer, api_name: :statusCode

# @!attribute success
# true if the page was fetched and parsed successfully
#
# @return [Boolean]
required :success, ContextDev::Internal::Type::Boolean

# @!attribute title
# The page's <title> content (empty string if unavailable)
#
# @return [String]
required :title, String

# @!attribute url
# The URL that was fetched
#
# @return [String]
required :url, String

# @!method initialize(crawl_depth:, status_code:, success:, title:, url:)
# @param crawl_depth [Integer] Depth relative to the start URL. 0 = start URL, 1 = one link away.
#
# @param status_code [Integer] HTTP status code of the response
#
# @param success [Boolean] true if the page was fetched and parsed successfully
#
# @param title [String] The page's <title> content (empty string if unavailable)
#
# @param url [String] The URL that was fetched
end
end
end
end
end
43 changes: 43 additions & 0 deletions lib/context_dev/resources/web.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,49 @@ def screenshot(params)
)
end

# Some parameter documentations has been truncated, see
# {ContextDev::Models::WebWebCrawlMdParams} for more details.
#
# Performs a crawl starting from a given URL, extracts page content as Markdown,
# and returns results for all crawled pages. Only follows links within the same
# domain as the starting URL. Costs 1 credit per successful page crawled.
#
# @overload web_crawl_md(url:, follow_subdomains: nil, include_images: nil, include_links: nil, max_depth: nil, max_pages: nil, shorten_base64_images: nil, url_regex: nil, use_main_content_only: nil, request_options: {})
#
# @param url [String] The starting URL for the crawl (must include http:// or https:// protocol)
#
# @param follow_subdomains [Boolean] When true, follow links on subdomains of the starting URL's domain (e.g. docs.ex
#
# @param include_images [Boolean] Include image references in the Markdown output
#
# @param include_links [Boolean] Preserve hyperlinks in the Markdown output
#
# @param max_depth [Integer] Maximum link depth from the starting URL (0 = only the starting page)
#
# @param max_pages [Integer] Maximum number of pages to crawl. Hard cap: 500.
#
# @param shorten_base64_images [Boolean] Truncate base64-encoded image data in the Markdown output
#
# @param url_regex [String] Regex pattern. Only URLs matching this pattern will be followed and scraped.
#
# @param use_main_content_only [Boolean] Extract only the main content, stripping headers, footers, sidebars, and navigat
#
# @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}, nil]
#
# @return [ContextDev::Models::WebWebCrawlMdResponse]
#
# @see ContextDev::Models::WebWebCrawlMdParams
def web_crawl_md(params)
parsed, options = ContextDev::WebWebCrawlMdParams.dump_request(params)
@client.request(
method: :post,
path: "web/crawl",
body: parsed,
model: ContextDev::Models::WebWebCrawlMdResponse,
options: options
)
end

# Scrapes the given URL and returns the raw HTML content of the page.
#
# @overload web_scrape_html(url:, request_options: {})
Expand Down
2 changes: 1 addition & 1 deletion lib/context_dev/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module ContextDev
VERSION = "1.2.0"
VERSION = "1.3.0"
end
2 changes: 2 additions & 0 deletions rbi/context_dev/models.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ module ContextDev

WebScreenshotParams = ContextDev::Models::WebScreenshotParams

WebWebCrawlMdParams = ContextDev::Models::WebWebCrawlMdParams

WebWebScrapeHTMLParams = ContextDev::Models::WebWebScrapeHTMLParams

WebWebScrapeImagesParams = ContextDev::Models::WebWebScrapeImagesParams
Expand Down
Loading
Loading