Skip to content

feat: add saveTo to classify and section - #69

Open
mikesoennichsen wants to merge 1 commit into
mainfrom
feat/classify-section-save-to
Open

mikesoennichsen wants to merge 1 commit into
mainfrom
feat/classify-section-save-to

Conversation

@mikesoennichsen

Copy link
Copy Markdown
Collaborator

Summary

Wires saveTo into classify and section, mirroring the smart saveTo behavior shipped for parse, extract, and split in PR #62.

  • client.classify({..., saveTo: DIR}){input_stem}_classify_output.json
  • client.classify({..., saveTo: 'path/to/file.json'}) → exact path, parent dirs created
  • client.section({..., saveTo: DIR}) with parsed-markdown string → section_output.json (no redundant prefix)
  • client.section({..., saveTo: DIR}) with markdown ReadStream → {stem}_section_output.json
  • Reuses existing _getInputFilename and _saveResponse helpers — no new utility code

Both methods now accept the same body & { saveTo?: string } intersection pattern used by parse, extract, and split.

Test plan

  • Existing parse/extract/split saveTo unit tests still pass
  • tests/save-to.test.ts filename-format and redundant-prefix loops extended to include classify and section
  • All 18 tests in tests/save-to.test.ts pass locally
  • tsc --noEmit clean
  • Live integration (staging via sdk-testing): 5/5 — classify + section, both directory mode and full .json path mode

Mirrors the smart saveTo wire-up (PR #62) for the new classify and
section endpoints. Both methods accept the same body & { saveTo?: string }
intersection used by parse, extract, and split, with the same directory
and full-.json-path behavior. Reuses the existing _getInputFilename and
_saveResponse helpers — no new utility code.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds saveTo support to client.classify() and client.section() to match the existing “smart saveTo” behavior already implemented for parse, extract, and split.

Changes:

  • Extend classify and section request bodies to accept an optional saveTo?: string.
  • Wire saveTo into both methods using existing _getInputFilename and _saveResponse helpers.
  • Expand _saveResponse unit tests to include classify and section filename behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/client.ts Adds optional saveTo handling to classify/section, saving responses to directory or full .json path.
tests/save-to.test.ts Extends _saveResponse filename-format and redundant-prefix tests to cover classify and section.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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