@@ -67,15 +67,15 @@ For stdout _summaries_, prefer YAML:
6767Raw data is the exception, not the default: expose it behind ` --json ` so the agent
6868can pipe it through ` jq ` , and keep the default human/agent-facing path as a summary.
6969
70- ## Serializing: use the ` yaml ` library, not ` Bun.YAML `
70+ ## Serialization
7171
72- ``` typescript
73- import { stringify } from ' yaml' // npm: yaml (eemeli/yaml), the js-yaml successor
72+ Return the result and let argc own stdout:
7473
75- process .stdout .write (stringify (value ))
74+ ``` typescript
75+ return value
7676```
7777
78- Why not ` Bun.YAML.stringify ` : its native serializer never emits ` | ` literal-block
78+ argc uses the ` yaml ` library rather than ` Bun.YAML.stringify ` : Bun's native serializer never emits ` | ` literal-block
7979scalars — multi-line strings come out as double-quoted with escaped ` \n `
8080(` preview: "<div>\n ..." ` ). That is intentional and test-locked in Bun through
81811.4, not a version gap that will close (the ` | ` /` > ` support in Bun's YAML docs is
@@ -189,18 +189,17 @@ async fetch({ input }) {
189189 await Bun .write (path , JSON .stringify (records )) // persist bulk to state dir
190190
191191 if (input .json ) { // --json: raw to the pipe
192- process .stdout .write (JSON .stringify (records ))
193- return
192+ return JSON .stringify (records )
194193 }
195194
196- process . stdout . write ( stringify ( { // default: summary to stdout
195+ return { // argc serializes this summary to stdout
197196 records: records .length ,
198197 written: path ,
199198 $hints: [
200199 ` Records at ${path } — slice with: jq '.[0:10]' ${path } ` ,
201200 ' Re-run with --json to stream raw records to a pipe' ,
202201 ],
203- }))
202+ }
204203}
205204```
206205
0 commit comments