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 @@
{
".": "0.11.0"
".": "1.0.0"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 30
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-c90f13e3cf4b9ae6a1d8f22c0e7285ab12d412d3a659a51a247a97adc7f08121.yml
openapi_spec_hash: bf7879be38ebf3397a939c80b261a47a
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-fb56935a194e69348fecd985f7cf8b249795b46af2fb32f6c5c8ef648cf10c15.yml
openapi_spec_hash: 7260a560474283b7ad6ac5d426058ac9
config_hash: daabb160675d86b354711da1e77e5129
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 1.0.0 (2026-07-12)

Full Changelog: [v0.11.0...v1.0.0](https://github.com/context-dot-dev/context-dev-cli/compare/v0.11.0...v1.0.0)

### Features

* **api:** api update ([47fc775](https://github.com/context-dot-dev/context-dev-cli/commit/47fc77546b9d9979e7d14d80d0bed7a6cfaa9e44))

## 0.11.0 (2026-07-12)

Full Changelog: [v0.10.0...v0.11.0](https://github.com/context-dot-dev/context-dev-cli/compare/v0.10.0...v0.11.0)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/charmbracelet/bubbletea v1.3.6
github.com/charmbracelet/lipgloss v1.1.0
github.com/charmbracelet/x/term v0.2.1
github.com/context-dot-dev/context-go-sdk/v2 v2.2.0
github.com/context-dot-dev/context-go-sdk/v2 v2.3.0
github.com/goccy/go-yaml v1.18.0
github.com/itchyny/json2yaml v0.1.4
github.com/muesli/reflow v0.3.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payR
github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U=
github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ=
github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg=
github.com/context-dot-dev/context-go-sdk/v2 v2.2.0 h1:4jIQ8PVy5Q27H/50je4gSrt5GwO4cpaRyy6idy2ZbCA=
github.com/context-dot-dev/context-go-sdk/v2 v2.2.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8=
github.com/context-dot-dev/context-go-sdk/v2 v2.3.0 h1:5EJ87AXgixxMYsmwd5mlz/4NeW3qDmdPsKCDOAg58Ik=
github.com/context-dot-dev/context-go-sdk/v2 v2.3.0/go.mod h1:CvRANWLP0FHj5XyUwzEVX79ujdwr/2Jy375UVzKNQm8=
github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w=
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
Expand Down
47 changes: 23 additions & 24 deletions pkg/cmd/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import (
"github.com/urfave/cli/v3"
)

var parseHandle = cli.Command{
var parseHandle = requestflag.WithInnerFlags(cli.Command{
Name: "handle",
Usage: "Converts raw text, source code, web/data, PDF, Microsoft Office, and image bytes\ninto LLM-usable Markdown.",
Usage: "Converts raw text, source code, web/data, PDF, Microsoft Office, and image bytes\ninto LLM-usable Markdown. The base request costs 1 credit. When OCR runs\n(requires ocr=true), the entire call costs 5 credits; ocr=true requests where no\nOCR ends up running still cost 1 credit.",
Suggest: true,
Flags: []cli.Flag{
&requestflag.Flag[string]{
Expand All @@ -27,21 +27,11 @@ var parseHandle = cli.Command{
BodyRoot: true,
FileInput: true,
},
&requestflag.Flag[string]{
Name: "base-url",
Usage: "Optional HTTP(S) source document URL used to resolve relative links and image references. Relative references remain relative when omitted.",
QueryPath: "baseUrl",
},
&requestflag.Flag[string]{
Name: "extension",
Usage: "Optional file extension hint, such as pdf, docx, xlsx, pptx, html, json, csv, md, py, rtf, jpg, png, or txt.",
Usage: `Optional file extension hint. Case-insensitive; a leading dot is accepted (e.g. ".pdf").`,
QueryPath: "extension",
},
&requestflag.Flag[string]{
Name: "filename",
Usage: "Optional filename hint used to infer the extension when extension is omitted.",
QueryPath: "filename",
},
&requestflag.Flag[bool]{
Name: "include-images",
Usage: "Include image references in Markdown output",
Expand All @@ -56,19 +46,15 @@ var parseHandle = cli.Command{
},
&requestflag.Flag[bool]{
Name: "ocr",
Usage: "When true for PDF inputs, detect and OCR images embedded in the selected pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. pdfStart/pdfEnd limit the inclusive page range. This is separate from automatic scanned-PDF OCR fallback.",
Usage: "Gates all OCR. When true, PDFs get embedded-image OCR (recognized text inserted at each image's position in page reading order, preserving the text layer; pdf.start/pdf.end limit the page range), scanned PDFs with no text layer get full-document OCR, and raster images get their visible text transcribed. When false, no OCR runs: scanned PDFs may yield no content and images return only format/dimension metadata. Calls where OCR actually runs cost 5 credits instead of 1.",
Default: false,
QueryPath: "ocr",
},
&requestflag.Flag[int64]{
Name: "pdf-end",
Usage: "Last 1-based PDF page to parse. When omitted, parsing ends at the last page. Must be greater than or equal to pdfStart when both are provided.",
QueryPath: "pdfEnd",
},
&requestflag.Flag[int64]{
Name: "pdf-start",
Usage: "First 1-based PDF page to parse. When omitted, parsing starts at the first page.",
QueryPath: "pdfStart",
&requestflag.Flag[map[string]any]{
Name: "pdf",
Usage: "PDF page-range controls. Use start/end to limit parsing (and OCR when ocr=true) to an inclusive 1-based page range.",
Default: map[string]any{},
QueryPath: "pdf",
},
&requestflag.Flag[bool]{
Name: "shorten-base64-images",
Expand All @@ -85,7 +71,20 @@ var parseHandle = cli.Command{
},
Action: handleParseHandle,
HideHelpCommand: true,
}
}, map[string][]requestflag.HasOuterFlag{
"pdf": {
&requestflag.InnerFlag[int64]{
Name: "pdf.end",
Usage: "Last 1-based PDF page to parse. When omitted, parsing ends at the last page. Must be greater than or equal to start when both are provided.",
InnerField: "end",
},
&requestflag.InnerFlag[int64]{
Name: "pdf.start",
Usage: "First 1-based PDF page to parse. When omitted, parsing starts at the first page.",
InnerField: "start",
},
},
})

func handleParseHandle(ctx context.Context, cmd *cli.Command) error {
client := contextdev.NewClient(getDefaultRequestOptions(cmd)...)
Expand Down
36 changes: 26 additions & 10 deletions pkg/cmd/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"testing"

"github.com/context-dot-dev/context-dev-cli/internal/mocktest"
"github.com/context-dot-dev/context-dev-cli/internal/requestflag"
)

func TestParseHandle(t *testing.T) {
Expand All @@ -16,14 +17,32 @@ func TestParseHandle(t *testing.T) {
"--api-key", "string",
"parse", "handle",
"--body", mocktest.TestFile(t, "Example data"),
"--base-url", "https://example.com",
"--extension", "extension",
"--filename", "filename",
"--extension", "txt",
"--include-images=true",
"--include-links=true",
"--ocr=true",
"--pdf-end", "1",
"--pdf-start", "1",
"--pdf", "{end: 1, start: 1}",
"--shorten-base64-images=true",
"--use-main-content-only=true",
)
})

t.Run("inner flags", func(t *testing.T) {
// Check that inner flags have been set up correctly
requestflag.CheckInnerFlags(parseHandle)

// Alternative argument passing style using inner flags
mocktest.TestRunMockTestWithFlags(
t,
"--api-key", "string",
"parse", "handle",
"--body", mocktest.TestFile(t, "Example data"),
"--extension", "txt",
"--include-images=true",
"--include-links=true",
"--ocr=true",
"--pdf.end", "1",
"--pdf.start", "1",
"--shorten-base64-images=true",
"--use-main-content-only=true",
)
Expand All @@ -36,14 +55,11 @@ func TestParseHandle(t *testing.T) {
t, pipeData,
"--api-key", "string",
"parse", "handle",
"--base-url", "https://example.com",
"--extension", "extension",
"--filename", "filename",
"--extension", "txt",
"--include-images=true",
"--include-links=true",
"--ocr=true",
"--pdf-end", "1",
"--pdf-start", "1",
"--pdf", "{end: 1, start: 1}",
"--shorten-base64-images=true",
"--use-main-content-only=true",
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

package cmd

const Version = "0.11.0" // x-release-please-version
const Version = "1.0.0" // x-release-please-version
Loading