You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR changes the JSON output of instruction-based scrape commands to return the extracted structured data directly, rather than wrapping it in the full DataSpace response object. The refactoring introduces extractScrapeStructuredData as a shared helper used by both JSON and text paths.
JSON mode with instructions: now returns the unwrapped structured.data payload instead of the full response, removing markdown, session, and other envelope fields from machine-readable output.
Text mode restructure: the inline success/error/data checks are replaced with calls to the new helper, which uses json.Marshal+json.Unmarshal instead of the previous AsBaseModel() call to flatten the union-type wrapper.
Tests: two new JSON-shape assertions are added — one confirming markdown is absent for instruction scrapes, and one confirming markdown is present for non-instruction scrapes.
Confidence Score: 5/5
Safe to merge — the change is narrowly scoped to JSON output formatting for instruction-based scrapes and does not touch auth, data persistence, or session logic.
The core logic is straightforward and the new helper is well-guarded. Both JSON output shapes are covered by the updated tests. The one edge case (nil resp.Structured falling through in text mode) is cosmetic and unreachable under normal API responses.
No files require special attention.
Important Files Changed
Filename
Overview
internal/cmd/output_helpers.go
Refactors PrintScrapeResponse to extract structured data via a new helper; JSON mode with instructions now returns unwrapped structured data instead of the full response
internal/cmd/sessions_test.go
Adds assertions verifying both JSON output shapes (structured-only for instruction scrapes, full response otherwise) and updates fixture data to include realistic structured fields
giordano-lucas
changed the title
Unwrap structured scrape JSON output
[NOT-464] Unwrap structured scrape JSON output
Jul 10, 2026
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
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
Linear: NOT-464 https://linear.app/nottelabsinc/issue/NOT-464/notte-cli-pr-48-unwrap-structured-scrape-json-output
Tests