sw-tsdocs
The sw-tsdocs command prints the documentation that ships inside the
@signalwire/sdk package: concept guides, API signatures read from the
package’s type declarations, examples, and tutorials. Because it reads the
installed package, its answers match the SDK version you have. People and
coding agents can both use it to look up an API without leaving the terminal.
Run it in a project that depends on @signalwire/sdk. With no arguments it
prints an index of what the SDK does and where to start.
Commands
A word that isn’t a topic or command is tried as an SDK name, then as a doc
name, and is treated as api <name> or show <name> when it matches.
Topics
sw-tsdocs <topic> prints the topic’s concepts, the installed docs to read,
related examples, and the API names to look up next. The topics are:
topic
One of the topic names above.
name
Optional, and read only by the skills topic: a built-in skill name, such
as weather_api, to print that skill’s description and parameters.
Parameters
api
name
An SDK class, function, or member, such as AgentBase or
FunctionResult.connect. Prints the source location, the signature, and the
JSDoc. When several names match, the first is printed and the rest are listed
under “Other matches”. Exits 1 when no name matches, and suggests similar
names.
examples
filter
Optional text that narrows the list of examples.
grep
regex
A case-insensitive regular expression, searched across the installed docs
and examples. Exits 1 when nothing matches.
--code
Search the SDK’s code as well.
--limit
The most matches to print. Must be 1 or more.
show
file
An installed doc. A partial name works when it matches one file; when it
matches several, the command lists them and exits 1.
--toc
Print the doc’s headings with line numbers instead of its text. Cannot be
combined with --section.
--section
Print only the section whose heading contains this text.
path
file
Optional. Without it, prints the directory the documentation is installed in. With it, prints the full path of each matching file.
tutorials
The tutorials topic lists the three tutorials that ship with the package and
the lesson files to read: a voice agent that answers questions from Wikipedia,
a reservation line built with Programmatically Governed Inference, and a
multi-agent sales tutorial. Print a lesson with sw-tsdocs show <file>.
init
Adds a note to the project that tells coding agents to use sw-tsdocs before
writing SignalWire code. The note covers running sw-tsdocs, checking
signatures with sw-tsdocs api, reading the pgi topic before building an
agent that takes real actions, and testing with swaig-test.
--dir
The project directory. It must exist, or the command exits 2.
--skill
Also write an Agent Skills SKILL.md.
Print the note to standard output and write nothing.
init writes these files, each reported as created, updated, or
unchanged: