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
{{ message }}
Repository navigation
Commit 6d29675
Browse filesBrowse the repository at this point in the historyBrowse files
// A config file's name goes where its format takes it: a JSON/YAML key to the query command, a TOML/INI table to `section` (measured, `config-get "cfg.toml" tool` exits 1 on a table while `section "cfg.toml::tool"` returns it), a .properties key to config-get. A JSON property is never put in a `section` slot: `token-goat section "package.json::name"` exits 1.
49
49
constoutline=outlineCommand(hintPath)
50
-
if(isXml)returnleadWithCommand('token-goat xml-outline '+quotedArg(hintPath),'to inspect structure, or `token-goat xml-query '+quotedArgs(hintPath,'<selector>').join(' ')+'` to query specific nodes',reason)
50
+
if(isXml)returnxmlQueryHint(hintPath,reason)
51
51
if(isEnv)returnleadWithCommand(configGetCommand(hintPath,target.name),'to read a specific variable',reason)
52
52
// .properties has no outline extractor (measured 2026-10-03: `outline app.properties` exits 1), so it gets config-get for a key it holds and a grep otherwise.
Copy file name to clipboardExpand all lines: src/canonical_skill.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -76,6 +76,7 @@ Sub-agent briefs must carry this gate verbatim: a sub-agent inherits none of thi
76
76
77
77
### Keep command output surgical
78
78
79
+
- For JSON and XML, inspect structure with `token-goat json-outline file` or `token-goat xml-outline file`, then query narrowly: `token-goat json-query file 'items[*].id' --head 20` or `token-goat xml-query file 'root.child'`. XPath goes in `--xpath`, for example `token-goat xml-query file --xpath '//root/child'`. JSON queries print arrays and objects directly, so PowerShell `ConvertFrom-Json` wrappers are unnecessary; use `token-goat web-output` for browser results.
79
80
- For searches, set the match budget you can use: `token-goat grep 'pattern' src --max-lines 20`. Patterns are regexes; invalid regex syntax (such as an unfinished `addText(`) falls back to literal substring matching, while overlong or potentially stalling patterns are refused. Add `-C 2` only when nearby lines matter; add `--symbol` only when you need the enclosing declaration.
80
81
- For a long document, read a bounded section: `token-goat section "README.md::Install" --max-lines 40`. Add `--grep 'pattern'` to keep matching body lines with their nearest sub-heading.
81
82
- To locate a heading without reading its body, use `token-goat section README.md --list --grep 'Install'`.
// Fetch the whole doc once up front (honoring --fresh) so its raw byte size is available as the "full source" side of the bytes-saved calculation below, mirroring cmdSessionOutline/ cmdSessionSlice's convention. fetchDoc() always writes its result to the on-disk web-output cache before returning, so the getSectionContent/getDocSections calls below can safely pass `fresh: false` -- they read through to the entry this call just (re)populated, guaranteeing exactly one network fetch even with --fresh, instead of two.
returnleadWithCommand(examples.outline,`to inspect the element structure, then \`${examples.path}\` for a dot path or \`${examples.xpath}\` for XPath`,reason)
321
+
}
322
+
297
323
/** The hint for one section of a prose document: `section` with the `outline` alternative only where it runs, and a plain grep for a file type neither serves. */
returnleadWithCommand('token-goat '+format+'-outline '+quotedArg(shownPath),'to list the top-level keys, then `token-goat '+format+'-query '+quotedArgs(shownPath,'<key>').join(' ')+'` to read one value',reason)
338
338
}
339
339
if(/\.(toml|ini|cfg)$/i.test(shownPath))returnleadWithCommand(configGetCommand(shownPath,'<key>'),'to read one value',reason)
340
-
if(/\.(xml|csproj)$/i.test(shownPath))returnleadWithCommand('token-goat xml-outline '+quotedArg(shownPath),'to see the element structure, then `token-goat xml-query '+quotedArgs(shownPath,'<path>').join(' ')+'` to read one element',reason)
`token-goat available for this file type, consider \`token-goat xml-query ${quotedArgs(target,'<xpath>').join(' ')}\` or \`token-goat xml-outline ${quotedArg(target)}\` first instead of terminal XML parsing (${nameSubject('tool',toolOrScript)}).`,
382
+
`token-goat available for this file type. Use \`${queries.outline}\` to inspect structure, then \`${queries.path}\` for a dot path or \`${queries.xpath}\` for XPath instead of terminal XML parsing (${nameSubject('tool',toolOrScript)}).`,
382
383
)
383
384
}
384
385
@@ -478,11 +479,11 @@ function preBashHandlerInner(event: HookEvent): HookOutput {
'PowerShell `ConvertFrom-Json` pipeline detected. Use `token-goat json-query '+quotedArgs(hintPath,'<selector>').join(' ')+'` to extract fields directly without shell conversion scripts.',
482
+
'PowerShell `ConvertFrom-Json` pipeline detected. Use `'+jsonQueryExample(hintPath)+'` to select and print JSON values directly (arrays and objects included) without PowerShell conversion scripts.',
482
483
)
483
484
}
484
485
returncontextOutput(
485
-
'PowerShell `ConvertFrom-Json` pipeline detected. Use `token-goat json-query <file> "<selector>"` or `token-goat web-output` to extract fields directly.',
486
+
'PowerShell `ConvertFrom-Json` pipeline detected. For a file, use `'+jsonQueryExample('file.json')+'` to select and print JSON values directly (arrays and objects included); use `token-goat web-output` for browser results.',
// A .txt file has no headings, so `section` exits 1 on it; grep is the command that runs.
298
298
returnfileQueryHint(filePath,'','pattern')
@@ -1547,7 +1547,7 @@ function preReadHandlerInner(event: HookEvent): HookOutput {
1547
1547
: sectionOrRangeCommand(shown,target)
1548
1548
}
1549
1549
constnudge=isXmlNudge
1550
-
? `Note: token-goat available for this file type, consider xml-query/xml-outline first: \`token-goat xml-outline ${quotedArg(shown)}\` or \`token-goat xml-query ${quotedArgs(shown,'<selector>').join(' ')}\``
1550
+
? `Note: token-goat available for this file type. ${xmlQueryHint(shown)}`
1551
1551
: isDocNudge
1552
1552
? `Note: token-goat available for this file type, consider ${docSectionExhausted ? 'outline' : 'section'} first: \`${docSectionCommand}\``
0 commit comments