feat: add saveTo to classify and section - #69
Open
mikesoennichsen wants to merge 1 commit into
Open
mikesoennichsen wants to merge 1 commit into
mikesoennichsen wants to merge 1 commit into
Conversation
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>
Contributor
There was a problem hiding this comment.
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
classifyandsectionrequest bodies to accept an optionalsaveTo?: string. - Wire
saveTointo both methods using existing_getInputFilenameand_saveResponsehelpers. - Expand
_saveResponseunit tests to includeclassifyandsectionfilename 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Wires
saveTointoclassifyandsection, mirroring the smart saveTo behavior shipped forparse,extract, andsplitin PR #62.client.classify({..., saveTo: DIR})→{input_stem}_classify_output.jsonclient.classify({..., saveTo: 'path/to/file.json'})→ exact path, parent dirs createdclient.section({..., saveTo: DIR})with parsed-markdown string →section_output.json(no redundant prefix)client.section({..., saveTo: DIR})with markdown ReadStream →{stem}_section_output.json_getInputFilenameand_saveResponsehelpers — no new utility codeBoth methods now accept the same
body & { saveTo?: string }intersection pattern used byparse,extract, andsplit.Test plan
tests/save-to.test.tsfilename-format and redundant-prefix loops extended to includeclassifyandsectiontests/save-to.test.tspass locallytsc --noEmitclean.jsonpath mode