Skip to content

Commit e1a8499

Browse files
committed
feat(js): export a ValuesReport type for CLI --view values output
1 parent 3979b26 commit e1a8499

2 files changed

Lines changed: 47 additions & 0 deletions

File tree

packages/deckprobe-js/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,12 @@ does not mean the value is right 95% of the time. See
210210
`node_bytes` for byte input under Node, `local_file` from `probeFile()` and the
211211
native CLI, plus any custom value passed as `options.sourceKind`.
212212

213+
There is no `view` option. `--view values` is a CLI flag, so `probe()` and
214+
`probeFile()` always resolve the full evidence report and `ProbeResult` is
215+
`ProbeReport | ErrorReport`. If you parse `deckprobe --view values` output
216+
instead, the exported `ValuesReport` type describes that envelope — note its
217+
`unresolved_targets` sits at the top level rather than under `execution`.
218+
213219
Apple iWork files use the same selectors and target IDs as the native engine.
214220
For example:
215221

packages/deckprobe-js/src/types.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ export interface BudgetOverrides {
4646
timeoutMs?: number;
4747
}
4848

49+
/**
50+
* Options accepted by `probe()` and `probeFile()`.
51+
*
52+
* Note there is no `view` option. `--view values` is a CLI flag; the SDK always
53+
* resolves the full evidence report, so a values report is never returned here.
54+
* See {@link ValuesReport} if you are consuming CLI output instead.
55+
*/
4956
export interface ProbeOptions {
5057
targets?: string[];
5158
optionalTargets?: string[];
@@ -133,6 +140,40 @@ export interface ErrorReport {
133140
};
134141
}
135142

143+
/**
144+
* The compact envelope the **CLI** writes under `--view values`.
145+
*
146+
* This is deliberately not part of {@link ProbeResult}: the SDK has no `view`
147+
* option, so `probe()` and `probeFile()` cannot return this shape, and putting
148+
* it in the union would force every consumer to narrow against a variant that
149+
* can never occur. It is exported for programs that parse
150+
* `deckprobe --view values` output.
151+
*
152+
* Note the shape difference from {@link ProbeReport}: `unresolved_targets` is
153+
* top level here rather than nested under `execution`.
154+
*/
155+
export interface ValuesReport {
156+
schema_version: 2;
157+
tool_version: string;
158+
status: "ok" | "partial";
159+
view: "values";
160+
input: {
161+
display_name: string;
162+
source_kind: SourceKind;
163+
file_size: number;
164+
};
165+
driver: {
166+
id: string;
167+
profile: string;
168+
};
169+
/** Keyed by canonical target name, even when requested by a short alias. */
170+
values: Record<string, unknown>;
171+
unresolved_targets: string[];
172+
piggyback_targets?: string[];
173+
diagnostics: Diagnostic[];
174+
}
175+
176+
/** What `probe()` and `probeFile()` resolve to. See {@link ValuesReport} for CLI `--view values`. */
136177
export type ProbeResult = ProbeReport | ErrorReport;
137178

138179
export interface FormatsReport {

0 commit comments

Comments
 (0)