PseudoScript
Module

cli

data

AddOpts #

public
cli::AddOpts
Entities Entity diagram scroll to zoom · drag to pan
RECORDAddOptsurlstringtagstringrevstringbranchstringpathstringnamestring
component

Args #

private
cli::Args

Parses argv with clap-derive into the chosen subcommand and its options, then dispatches to the matching command handler.

Parent

Sequence Sequence — dispatch scroll to zoom · drag to pan
SEQUENCEdispatchPERSONcallerCOMPONENTArgsPseudoscript::CliParses argv withclap-derive into the1dispatch(command: cli::Command)↩ return number
component

CheckCmd #

private
cli::CheckCmd

`pds check` — parse and statically check one file, print each diagnostic as `path:line:col: severity: message`, and exit non-zero on any error-severity diagnostic. Emits no diagram.

Parent

Outbound

Scenarios

CheckExitCode

`pds check` exits non-zero when any error diagnostic is produced.

  • given a .pds source file
  • when the developer runs `pds check` on it
  • then every diagnostic is printed as path:line:col: severity: message
  • but the command exits non-zero if any diagnostic is error-severity
  • and a well-formed model prints nothing and exits zero
Flow Flow — CheckExitCode scroll to zoom · drag to pan
FEATURECheckExitCodefor CheckCmdGIVENa .pds source fileWHENthe developer runs `pds check` on itTHENevery diagnostic is printed aspath:line:col: severity: messageBUTthe command exits non-zero if anydiagnostic is error-severityANDa well-formed model prints nothing andexits zero
Sequence Sequence — run scroll to zoom · drag to pan
SEQUENCErunalt[found.isErr][else]alt[else self.isDirectory()]alt[root.isErr][else]COMPONENTCheckCmdPseudoscript::Cli`pds check` — parseand statically checkCOMPONENTLoaderPseudoscript::CliThe CLI loader:resolves the projectCONTAINERProjectPseudoscript`crates/pseudoscript-project`.The disk-facingCOMPONENTLoaderPseudoscript::ProjectResolves and reads aworkspace off disk:1findRoot(start: string)2findRoot(start: string)3findRoot(start: string)↩ return Result<string, project::IoError>↩ return Result<string, project::IoError>4ioError↩ Err<cli::IoError>↩ Ok<string>5isDirectory6checkRootless7checkWorkspace
Sequence Sequence — runAll scroll to zoom · drag to pan
SEQUENCErunAllalt[else roots.isErr]COMPONENTCheckCmdPseudoscript::Cli`pds check` — parseand statically checkCOMPONENTLoaderPseudoscript::CliThe CLI loader:resolves the project1discoverWorkspaces(root: string)↩ return Result<string[], cli::IoError>2checkEach
data

CheckOpts #

public
cli::CheckOpts
Entities Entity diagram scroll to zoom · drag to pan
RECORDCheckOptsfilestringallbool
container

Cli #

public
cli::Cli

`crates/pseudoscript` — the binary crate (`pds`). The composition root and only I/O edge; a thin frontend that wires the pure library crates to disk, HTTP, and a filesystem watcher.

Inbound

Outbound

Scenarios

CompositionRoot

The CLI is the composition root and the only I/O edge.

  • given the library crates that are pure over in-memory modules
  • when the CLI runs any subcommand
  • then all file reading, writing, HTTP serving, and watching happen in the CLI
  • and the pure core receives module text and returns values
  • but I/O and load failures are the only things that fail a command, via the exit code
Flow Flow — CompositionRoot scroll to zoom · drag to pan
FEATURECompositionRootfor CliGIVENthe library crates that are pure overin-memory modulesWHENthe CLI runs any subcommandTHENall file reading, writing, HTTPserving, and watching happen in theCLIANDthe pure core receives module text andreturns valuesBUTI/O and load failures are the onlythings that fail a command, via theexit code
ParseSubcommand

argv is parsed into one subcommand and dispatched.

  • given a command line for one of init, doc, check, eval, fmt, tokens, outline, svg, lsp, lang, skill, add, install, update, remove, list, or upgrade
  • when the CLI starts
  • then clap parses argv into the chosen subcommand and its options
  • and the matching command handler is invoked
  • but an unrecognised command or bad option is rejected with a usage error
Flow Flow — ParseSubcommand scroll to zoom · drag to pan
FEATUREParseSubcommandfor CliGIVENa command line for one of init, doc,check, eval, fmt, tokens, outline,svg, lsp, lang, skill, add, install,update, remove, list, or upgradeWHENthe CLI startsTHENclap parses argv into the chosensubcommand and its optionsANDthe matching command handler isinvokedBUTan unrecognised command or bad optionis rejected with a usage error
Components Component diagram scroll to zoom · drag to pan
PseudoscriptCliCOMPONENTInitCmd`pds init` — bootstrap a workspace: write`pds.toml` and a starter `main.pds`. Refuse…COMPONENTArgsParses argv with clap-derive into the chosensubcommand and its options, then dispatches…COMPONENTLoaderThe CLI loader: resolves the project rootand reads its modules through the `project`…COMPONENTDocCmd`pds doc` — the headline command (ADR-017).Load the workspace, check it per module…COMPONENTCheckCmd`pds check` — parse and statically check onefile, print each diagnostic as…COMPONENTEvalCmd`pds eval` — read a model from stdin andstatically check it, printing each…COMPONENTFmtCmd`pds fmt` — format to canonicalPseudoScript; `--write` overwrites the file…COMPONENTTokensCmd`pds tokens` — print the conformance tokenstream (`KIND@line:col "lexeme"`) to stdout…COMPONENTLspHost`pds lsp` — boot a Tokio runtime and launchthe language server over stdio. Spawned as …COMPONENTReferenceCmd`pds lang` (alias `spec`) and `pds skill` —print the bundled, version-pinned language…COMPONENTOutlineCmd`pds outline` — walk the workspace'smodules, build its graph, and print the…COMPONENTSvgCmd`pds svg` — render a single diagram to aself-contained SVG on stdout. With…COMPONENTDeps`pds add`/`install`/`update`/`remove`/`list`— git workspace dependency management…COMPONENTUpgradeCmd`pds upgrade` — download a release andinstall it over the running binary.COMPONENTHttpServerHTTP host for the generated site(`--serve`/`--watch`): `tiny_http` on…COMPONENTWatcherFilesystem watcher (`--watch`, via`notify`): watches the project root…CONTAINERDoc`crates/pseudoscript-doc`. Turns a resolvedgraph into a Svelte-rendered,…CONTAINERFormat`crates/pseudoscript-format`. The canonicalformatter: parse, then pretty-print the tre…CONTAINERLsp`crates/pseudoscript-lsp`. The stdiolanguage server (tower-lsp): workspace…CONTAINERModel`crates/pseudoscript-model`. AST to oneresolved graph; static checks (resolution,…CONTAINERProject`crates/pseudoscript-project`. Thedisk-facing loader: resolves the workspace…CONTAINERSyntax`crates/pseudoscript-syntax`. The foundationcrate: source text to tokens and a typed…discoverWorkspacesfindRootloadcheckcheckWorkspaceservediscoverWorkspacesfindRootloadwatchprepareDiagnosticsrenderrenderMarkdowncheckWorkspaceModulesgraphcheckformatfindRootloadrunStdiofindRootloadModulesgraphfindRootloadModulesgraphrenderTokensparseparse
data

Command #

public
cli::Command

The subcommand clap parsed from argv, with its resolved options.

Entities Entity diagram scroll to zoom · drag to pan
UNIONCommandInitCmdDocOptsCheckOptsEvalOptsFmtOptsTokensOptsOutlineOptsSvgOptsLspOptsLangOptsSkillOptsAddOptsInstallOptsUpdateOptsRemoveOptsListOptsUpgradeOptsRECORDDocOptspathstringserveboolwatchboolportnumberallboolformatstringRECORDCheckOptsfilestringallboolRECORDFmtOptsfilestringwriteboolRECORDTokensOptsfilestringRECORDOutlineOptspathstringRECORDSvgOptspathstringsymbolstringviewstringtargetstringthemestringRECORDAddOptsurlstringtagstringrevstringbranchstringpathstringnamestringRECORDRemoveOptsnamestringRECORDListOptsrootstringRECORDUpgradeOptsversionstring
component

Deps #

private
cli::Deps

`pds add`/`install`/`update`/`remove`/`list` — git workspace dependency management (§8.3). `add` resolves a git URL into `pds.toml` + `pds.lock` and vendors it; `install` restores `pds_modules/` from the lock; `update` re-pins; `remove` drops one; `list` discovers every workspace under a root. Resolution delegates to `project`; fetching is the CLI's I/O.

Parent

Scenarios

ManageDependencies

Dependency commands manage git workspaces via pds.toml and pds.lock (§8.3).

  • given a workspace declaring git dependencies
  • when the developer runs add, install, update, remove, or list
  • then add pins and vendors a dependency, install restores from the lock, update re-pins, remove drops one
  • and resolution delegates to the project crate while fetching is the CLI's I/O
Flow Flow — ManageDependencies scroll to zoom · drag to pan
FEATUREManageDependenciesfor DepsGIVENa workspace declaring git dependenciesWHENthe developer runs add, install,update, remove, or listTHENadd pins and vendors a dependency,install restores from the lock, updatere-pins, remove drops oneANDresolution delegates to the projectcrate while fetching is the CLI's I/O
Sequence Sequence — add scroll to zoom · drag to pan
SEQUENCEaddPERSONcallerCOMPONENTDepsPseudoscript::Cli`pdsadd`/`install`/`updat…1add(url: string, tag: string, rev: string, branch: string, path: string, name: string)↩ return Result<void, cli::IoError>
Sequence Sequence — install scroll to zoom · drag to pan
SEQUENCEinstallPERSONcallerCOMPONENTDepsPseudoscript::Cli`pdsadd`/`install`/`updat…1install()↩ return Result<void, cli::IoError>
Sequence Sequence — list scroll to zoom · drag to pan
SEQUENCElistPERSONcallerCOMPONENTDepsPseudoscript::Cli`pdsadd`/`install`/`updat…1list(root: string)↩ return Result<void, cli::IoError>
Sequence Sequence — remove scroll to zoom · drag to pan
SEQUENCEremovePERSONcallerCOMPONENTDepsPseudoscript::Cli`pdsadd`/`install`/`updat…1remove(name: string)↩ return Result<void, cli::IoError>
Sequence Sequence — update scroll to zoom · drag to pan
SEQUENCEupdatePERSONcallerCOMPONENTDepsPseudoscript::Cli`pdsadd`/`install`/`updat…1update()↩ return Result<void, cli::IoError>
component

DocCmd #

private
cli::DocCmd

`pds doc` — the headline command (ADR-017). Load the workspace, check it per module (reported but non-fatal, like `cargo doc` — the same findings feed the site's health page), project the resolved graph, and render a static doc site. The output format is resolved by precedence — an explicit `--format` over the manifest `[doc].format`, else HTML — then a fork renders the SSR HTML site (every diagram as server SVG, logo copied) or a flat Markdown site (SVG assets, no logo). `--serve` hosts the HTML site over HTTP; `--watch` adds a filesystem watcher and browser live reload; both are skipped for Markdown output, which only writes.

#headline

Parent

Inbound

Outbound

Scenarios

DocPipeline

`pds doc` runs the headline pipeline end to end.

  • given a project rooted at a pds.toml with one or more .pds modules
  • and no --format override, so the HTML default applies
  • when the developer runs `pds doc`
  • then the workspace is loaded and checked
  • and the resolved graph is built and rendered to the HTML site
  • and every site file is written under the output directory
  • and the configured logo is copied beside the site
Flow Flow — DocPipeline scroll to zoom · drag to pan
FEATUREDocPipelinefor DocCmdGIVENa project rooted at a pds.toml withone or more .pds modulesANDno --format override, so the HTMLdefault appliesWHENthe developer runs `pds doc`THENthe workspace is loaded and checkedANDthe resolved graph is built andrendered to the HTML siteANDevery site file is written under theoutput directoryANDthe configured logo is copied besidethe site
ResolveDocFormat

The output format is resolved by precedence and forks the renderer.

  • given a workspace whose `[doc].format` and the `--format` flag may each set a format
  • when the developer runs `pds doc`
  • then an explicit `--format` wins over the manifest `[doc].format`, else HTML
  • and HTML renders the SSR site and copies the logo
  • but Markdown renders the flat site with its SVG inlined and copies no logo
Flow Flow — ResolveDocFormat scroll to zoom · drag to pan
FEATUREResolveDocFormatfor DocCmdGIVENa workspace whose `[doc].format` andthe `--format` flag may each set aformatWHENthe developer runs `pds doc`THENan explicit `--format` wins over themanifest `[doc].format`, else HTMLANDHTML renders the SSR site and copiesthe logoBUTMarkdown renders the flat site withits SVG inlined and copies no logo
MarkdownSkipsServing

Markdown output writes but never serves or watches.

  • given the resolved format is Markdown
  • when the developer runs `pds doc --serve` or `--watch`
  • then the Markdown site is written to the output directory
  • but serving and watching are skipped, so the command returns after writing
Flow Flow — MarkdownSkipsServing scroll to zoom · drag to pan
FEATUREMarkdownSkipsServingfor DocCmdGIVENthe resolved format is MarkdownWHENthe developer runs `pds doc --serve`or `--watch`THENthe Markdown site is written to theoutput directoryBUTserving and watching are skipped, sothe command returns after writing
CheckIsNonFatal

The workspace check is reported but never aborts generation.

  • given a workspace whose model has warnings or errors
  • when the developer runs `pds doc`
  • then every diagnostic is printed to stderr
  • but generation continues like `cargo doc`, so a partial model still documents
  • and only an I/O or load failure exits non-zero
Flow Flow — CheckIsNonFatal scroll to zoom · drag to pan
FEATURECheckIsNonFatalfor DocCmdGIVENa workspace whose model has warningsor errorsWHENthe developer runs `pds doc`THENevery diagnostic is printed to stderrBUTgeneration continues like `cargo doc`,so a partial model still documentsANDonly an I/O or load failure exitsnon-zero
Sequence Sequence — runAll scroll to zoom · drag to pan
SEQUENCErunAllalt[else roots.isErr]COMPONENTDocCmdPseudoscript::Cli`pds doc` — theheadline commandCOMPONENTLoaderPseudoscript::CliThe CLI loader:resolves the project1discoverWorkspaces(root: string)↩ return Result<string[], cli::IoError>2buildEach
Sequence Sequence — serve scroll to zoom · drag to pan
SEQUENCEservealt[watch]alt[else !self.shouldServe()]alt[else !self.isHtml()]alt[else built.isErr]COMPONENTDocCmdPseudoscript::Cli`pds doc` — theheadline commandCOMPONENTWatcherPseudoscript::CliFilesystem watcher(`--watch`, viaCOMPONENTHttpServerPseudoscript::CliHTTP host for thegenerated site1run2isHtml3shouldServe4watch(root: string, port: number)↩ return Result<void, cli::IoError>5serve(path: string, port: number, reload: bool)↩ return Result<void, cli::IoError>
data

DocOpts #

public
cli::DocOpts
Entities Entity diagram scroll to zoom · drag to pan
RECORDDocOptspathstringserveboolwatchboolportnumberallboolformatstring
component

EvalCmd #

private
cli::EvalCmd

`pds eval` — read a model from stdin and statically check it, printing each diagnostic as `<stdin>:line:col: severity: message` and exiting non-zero on any error. The fileless path: an agent pipes a snippet to check it without writing a file.

Parent

Outbound

Scenarios

EvalExitCode

`pds eval` reads stdin and exits non-zero when any error diagnostic is produced.

  • given a model piped to stdin
  • when the developer or an agent runs `pds eval`
  • then every diagnostic is printed as <stdin>:line:col: severity: message
  • but the command exits non-zero if any diagnostic is error-severity
  • and a well-formed model prints nothing and exits zero
Flow Flow — EvalExitCode scroll to zoom · drag to pan
FEATUREEvalExitCodefor EvalCmdGIVENa model piped to stdinWHENthe developer or an agent runs `pdseval`THENevery diagnostic is printed as<stdin>:line:col: severity: messageBUTthe command exits non-zero if anydiagnostic is error-severityANDa well-formed model prints nothing andexits zero
Sequence Sequence — run scroll to zoom · drag to pan
SEQUENCErunCOMPONENTEvalCmdPseudoscript::Cli`pds eval` — read amodel from stdin andCONTAINERModelPseudoscript`crates/pseudoscript-model`.AST to one resolvedCOMPONENTChecksPseudoscript::ModelStatic analysis(LANG.md §2.2, §2.3,CONTAINERSyntaxPseudoscript`crates/pseudoscript-syntax`.The foundation crate:COMPONENTParserPseudoscript::SyntaxRecursive-descentparser for the §10COMPONENTLexerPseudoscript::SyntaxHand-written lexer forLANG.md §2. One pass1check(text: string)2check(text: string)3parse(text: string)4parse(text: string)5lex(text: string)↩ return syntax::Lexed6parseModule7diagnostics↩ return syntax::Parsed↩ return syntax::Parsed8analyze↩ return syntax::Diagnostic[]↩ return syntax::Diagnostic[]9anyError
component

FmtCmd #

private
cli::FmtCmd

`pds fmt` — format to canonical PseudoScript; `--write` overwrites the file in place, otherwise prints to stdout. A parse error is reported and the file is left untouched.

Parent

Outbound

Scenarios

FormatInPlaceOrStdout

`pds fmt --write` overwrites in place; otherwise it prints.

  • given a .pds source file
  • when the developer runs `pds fmt`
  • then the source is parsed and pretty-printed to canonical PseudoScript
  • and with `--write` the file is overwritten in place
  • but without `--write` the canonical text is printed to stdout
  • and unparseable source is reported and the file is left untouched
Flow Flow — FormatInPlaceOrStdout scroll to zoom · drag to pan
FEATUREFormatInPlaceOrStdoutfor FmtCmdGIVENa .pds source fileWHENthe developer runs `pds fmt`THENthe source is parsed andpretty-printed to canonicalPseudoScriptANDwith `--write` the file is overwrittenin placeBUTwithout `--write` the canonical textis printed to stdoutANDunparseable source is reported and thefile is left untouched
Sequence Sequence — run scroll to zoom · drag to pan
SEQUENCErunalt[self.hasErrors()][else]alt[write][else]alt[else out.isErr]COMPONENTFmtCmdPseudoscript::Cli`pds fmt` — format tocanonicalCONTAINERFormatPseudoscript`crates/pseudoscript-format`.The canonicalCOMPONENTFormatterPseudoscript::FormatDrives the headlineflow: parse theCONTAINERSyntaxPseudoscript`crates/pseudoscript-syntax`.The foundation crate:COMPONENTParserPseudoscript::SyntaxRecursive-descentparser for the §10COMPONENTLexerPseudoscript::SyntaxHand-written lexer forLANG.md §2. One passCOMPONENTPrinterPseudoscript::FormatThe canonicalpretty-printer: walks1format(text: string)2format(text: string)3parse(text: string)4parse(text: string)5lex(text: string)↩ return syntax::Lexed6parseModule7diagnostics↩ return syntax::Parsed↩ return syntax::Parsed8hasErrors9collectErrors↩ Err<format::FormatError>10print(ast: syntax::Module)11writeModule12finish↩ return string↩ Ok<string>↩ return Result<string, format::FormatError>13overwrite14print
data

FmtOpts #

public
cli::FmtOpts
Entities Entity diagram scroll to zoom · drag to pan
RECORDFmtOptsfilestringwritebool
component

HttpServer #

private
cli::HttpServer

HTTP host for the generated site (`--serve`/`--watch`): `tiny_http` on `127.0.0.1:port`, maps `/` to `index.html`, rejects paths escaping the output dir, and on watch injects a live-reload poll and answers `/__livereload` with the current version. Blocks until the process is stopped.

Parent

Inbound

Scenarios

ServeOverHttp

`pds doc --serve` hosts the generated site over HTTP on localhost.

  • given a generated documentation site
  • when the developer runs `pds doc --serve`
  • then the site is hosted over HTTP on 127.0.0.1 at the chosen port
  • and `/` maps to index.html
  • but a request path that escapes the output directory yields 404
Flow Flow — ServeOverHttp scroll to zoom · drag to pan
FEATUREServeOverHttpfor HttpServerGIVENa generated documentation siteWHENthe developer runs `pds doc --serve`THENthe site is hosted over HTTP on127.0.0.1 at the chosen portAND`/` maps to index.htmlBUTa request path that escapes the outputdirectory yields 404
Sequence Sequence — serve scroll to zoom · drag to pan
SEQUENCEservePERSONclientCOMPONENTHttpServerPseudoscript::CliHTTP host for thegenerated site1serve(path: string, port: number, reload: bool)↩ return Result<void, cli::IoError>
component

InitCmd #

private
cli::InitCmd

`pds init` — bootstrap a workspace: write `pds.toml` and a starter `main.pds`. Refuses to overwrite an existing manifest; the starter is written only when absent.

Parent

Outbound

  • from cli::Result

Scenarios

InitWorkspace

`pds init` bootstraps a workspace and refuses to clobber an existing one.

  • given a target directory with no pds.toml
  • when the developer runs `pds init`
  • then the directory is created if absent
  • and a pds.toml carrying a [doc] table is written
  • and a starter main.pds is written when none exists
  • but an existing pds.toml aborts the command without overwriting it
Flow Flow — InitWorkspace scroll to zoom · drag to pan
FEATUREInitWorkspacefor InitCmdGIVENa target directory with no pds.tomlWHENthe developer runs `pds init`THENthe directory is created if absentANDa pds.toml carrying a [doc] table iswrittenANDa starter main.pds is written whennone existsBUTan existing pds.toml aborts thecommand without overwriting it
Sequence Sequence — run scroll to zoom · drag to pan
SEQUENCErunalt[else exists.isErr]COMPONENTInitCmdPseudoscript::Cli`pds init` — bootstrapa workspace: write1manifestExists2writeFiles
data

IoError #

public
cli::IoError

A filesystem, parse-config, or serving failure surfaced to the CLI exit code.

Entities Entity diagram scroll to zoom · drag to pan
RECORDIoErrormessagestring
data

ListOpts #

public
cli::ListOpts
Entities Entity diagram scroll to zoom · drag to pan
RECORDListOptsrootstring
component

Loader #

private
cli::Loader

The CLI loader: resolves the project root and reads its modules through the `project` crate (the shared filesystem edge), then parses the cli-specific `[doc]` table on top. Root-finding and module-walking are `project`'s job; the manifest's doc config is the CLI's.

Parent

Inbound

Outbound

  • call project::Project · findRoot
  • from cli::Result
  • from cli::Result
  • from cli::Result
  • call project::Project · load
  • from cli::Result
  • from cli::Result
  • from cli::Result
  • from cli::Result
  • from cli::Result
  • from cli::Result
  • from cli::Result
  • from cli::Result
  • from cli::Result
  • from cli::Result

Scenarios

ResolveProjectRoot

The project root is found by walking up to the nearest pds.toml.

  • given a path somewhere inside a project tree
  • when the CLI loads the workspace
  • then it walks ancestor directories to the nearest pds.toml
  • and the [doc] config and every .pds module beneath it load, sorted by FQN
  • but a tree with no pds.toml is an error
Flow Flow — ResolveProjectRoot scroll to zoom · drag to pan
FEATUREResolveProjectRootfor LoaderGIVENa path somewhere inside a project treeWHENthe CLI loads the workspaceTHENit walks ancestor directories to thenearest pds.tomlANDthe [doc] config and every .pds modulebeneath it load, sorted by FQNBUTa tree with no pds.toml is an error
component

LspHost #

private
cli::LspHost

`pds lsp` — boot a Tokio runtime and launch the language server over stdio. Spawned as a child process by an editor (`context::Editor.openDocument`).

Parent

Inbound

Outbound

Scenarios

LaunchLanguageServer

`pds lsp` launches the language server over stdio.

  • given an editor that speaks the Language Server Protocol
  • when the editor spawns `pds lsp` as a child process
  • then a Tokio runtime boots and the server runs over stdio
  • and the editor drives it with document changes and renders its diagnostics
Flow Flow — LaunchLanguageServer scroll to zoom · drag to pan
FEATURELaunchLanguageServerfor LspHostGIVENan editor that speaks the LanguageServer ProtocolWHENthe editor spawns `pds lsp` as a childprocessTHENa Tokio runtime boots and the serverruns over stdioANDthe editor drives it with documentchanges and renders its diagnostics
component

OutlineCmd #

private
cli::OutlineCmd

`pds outline` — walk the workspace's modules, build its graph, and print the symbol outline as JSON: each node's `fqn`, `name`, `kind`, `parent`, whether it is a triggered flow entry, and its declaration site. The structure tree an editor draws. Outlining reads the walked modules straight, skipping the manifest `[doc]` parse and dependency resolution: the structure tree never depends on presentation config or external modules.

Parent

Outbound

Scenarios

OutlineAsJson

`pds outline` prints the workspace symbol tree as JSON.

  • given a workspace under the path
  • when the developer runs `pds outline`
  • then the workspace's modules are walked and its graph is built
  • and each node's fqn, name, kind, parent, triggered flag, and declaration site is printed as JSON
  • but the manifest [doc] config and dependency modules are not loaded
Flow Flow — OutlineAsJson scroll to zoom · drag to pan
FEATUREOutlineAsJsonfor OutlineCmdGIVENa workspace under the pathWHENthe developer runs `pds outline`THENthe workspace's modules are walked andits graph is builtANDeach node's fqn, name, kind, parent,triggered flag, and declaration siteis printed as JSONBUTthe manifest [doc] config anddependency modules are not loaded
Sequence Sequence — run scroll to zoom · drag to pan
SEQUENCErunalt[found.isErr][else]alt[modules.isErr][else]alt[files.isErr][else]alt[loaded.isErr][else]alt[else modules.isErr]alt[else root.isErr]COMPONENTOutlineCmdPseudoscript::Cli`pds outline` — walkthe workspace'sCOMPONENTLoaderPseudoscript::CliThe CLI loader:resolves the projectCONTAINERProjectPseudoscript`crates/pseudoscript-project`.The disk-facingCOMPONENTLoaderPseudoscript::ProjectResolves and reads aworkspace off disk:CONTAINERModelPseudoscript`crates/pseudoscript-model`.AST to one resolvedCOMPONENTBuilderPseudoscript::ModelProjects the parsed,resolved workspaceCOMPONENTWorkspacePseudoscript::ModelThe resolved set ofmodules keyed by FQN1findRoot(start: string)2findRoot(start: string)3findRoot(start: string)↩ return Result<string, project::IoError>↩ return Result<string, project::IoError>4ioError↩ Err<cli::IoError>↩ Ok<string>5loadModules(root: string)6load(root: string)7load(root: string)8findModules↩ Err<project::IoError>9readEach↩ Err<project::IoError>↩ Ok<model::WorkspaceModule[]>↩ return Result<model::WorkspaceModule[], project::IoError>10ioError↩ Err<cli::IoError>↩ Ok<model::WorkspaceModule[]>11graph(modules: model::WorkspaceModule[])12graph(modules: model::WorkspaceModule[])13build(modules: model::WorkspaceModule[])14noExternals15buildWithExternals↩ return model::ModuleEntry[]16graphOf↩ return model::Graph↩ return model::Graph17render18print
data

OutlineOpts #

public
cli::OutlineOpts
Entities Entity diagram scroll to zoom · drag to pan
RECORDOutlineOptspathstring
component

ReferenceCmd #

private
cli::ReferenceCmd

`pds lang` (alias `spec`) and `pds skill` — print the bundled, version-pinned language reference and the authoring skill to stdout. Fed to an LLM to author `.pds`; no workspace needed.

Parent

Scenarios

PrintReference

`pds lang`/`pds skill` print the bundled reference and authoring skill.

  • given no workspace is needed
  • when the developer runs `pds lang` or `pds skill`
  • then the version-pinned language reference or the authoring skill is printed to stdout
Flow Flow — PrintReference scroll to zoom · drag to pan
FEATUREPrintReferencefor ReferenceCmdGIVENno workspace is neededWHENthe developer runs `pds lang` or `pdsskill`THENthe version-pinned language referenceor the authoring skill is printed tostdout
Sequence Sequence — lang scroll to zoom · drag to pan
SEQUENCElangPERSONcallerCOMPONENTReferenceCmdPseudoscript::Cli`pds lang` (alias`spec`) and `pds1lang()↩ return
Sequence Sequence — skill scroll to zoom · drag to pan
SEQUENCEskillPERSONcallerCOMPONENTReferenceCmdPseudoscript::Cli`pds lang` (alias`spec`) and `pds1skill()↩ return
data

RemoveOpts #

public
cli::RemoveOpts
Entities Entity diagram scroll to zoom · drag to pan
RECORDRemoveOptsnamestring
component

SvgCmd #

private
cli::SvgCmd

`pds svg` — render a single diagram to a self-contained SVG on stdout. With `--symbol`, draws that symbol's fitting view; otherwise draws `--view` (paired with `--target`) over the whole workspace. The static counterpart of the IDE canvas. Like `pds outline`, it reads the walked modules straight, skipping the manifest `[doc]` parse and dependency resolution: a diagram never depends on presentation config or external modules.

Parent

Outbound

Scenarios

RenderOneSvg

`pds svg` renders one diagram to a self-contained SVG.

  • given a workspace and either a --symbol or a --view/--target selection
  • when the developer runs `pds svg`
  • then the chosen view is projected and rendered to a standalone SVG on stdout
  • but a missing or wrong-kind target fails non-zero with the projection error
Flow Flow — RenderOneSvg scroll to zoom · drag to pan
FEATURERenderOneSvgfor SvgCmdGIVENa workspace and either a --symbol or a--view/--target selectionWHENthe developer runs `pds svg`THENthe chosen view is projected andrendered to a standalone SVG on stdoutBUTa missing or wrong-kind target failsnon-zero with the projection error
Sequence Sequence — run scroll to zoom · drag to pan
SEQUENCErunalt[found.isErr][else]alt[modules.isErr][else]alt[files.isErr][else]alt[loaded.isErr][else]alt[scene.isErr][else]alt[else modules.isErr]alt[else root.isErr]alt[!self.isKnownTheme()][else]COMPONENTSvgCmdPseudoscript::Cli`pds svg` — render asingle diagram to aCOMPONENTLoaderPseudoscript::CliThe CLI loader:resolves the projectCONTAINERProjectPseudoscript`crates/pseudoscript-project`.The disk-facingCOMPONENTLoaderPseudoscript::ProjectResolves and reads aworkspace off disk:CONTAINERModelPseudoscript`crates/pseudoscript-model`.AST to one resolvedCOMPONENTBuilderPseudoscript::ModelProjects the parsed,resolved workspaceCOMPONENTWorkspacePseudoscript::ModelThe resolved set ofmodules keyed by FQN1isKnownTheme2unknownTheme3findRoot(start: string)4findRoot(start: string)5findRoot(start: string)↩ return Result<string, project::IoError>↩ return Result<string, project::IoError>6ioError↩ Err<cli::IoError>↩ Ok<string>7loadModules(root: string)8load(root: string)9load(root: string)10findModules↩ Err<project::IoError>11readEach↩ Err<project::IoError>↩ Ok<model::WorkspaceModule[]>↩ return Result<model::WorkspaceModule[], project::IoError>12ioError↩ Err<cli::IoError>↩ Ok<model::WorkspaceModule[]>13graph(modules: model::WorkspaceModule[])14graph(modules: model::WorkspaceModule[])15build(modules: model::WorkspaceModule[])16noExternals17buildWithExternals↩ return model::ModuleEntry[]18graphOf↩ return model::Graph↩ return model::Graph19projectChosen20emitError21renderThemed22print
data

SvgOpts #

public
cli::SvgOpts
Entities Entity diagram scroll to zoom · drag to pan
RECORDSvgOptspathstringsymbolstringviewstringtargetstringthemestring
component

TokensCmd #

private
cli::TokensCmd

`pds tokens` — print the conformance token stream (`KIND@line:col "lexeme"`) to stdout, for debugging the lexer.

Parent

Outbound

Scenarios

PrintTokenStream

`pds tokens` prints the conformance token stream.

  • given a .pds source file
  • when the developer runs `pds tokens`
  • then the lexical token stream is printed as KIND@line:col \"lexeme\"
Flow Flow — PrintTokenStream scroll to zoom · drag to pan
FEATUREPrintTokenStreamfor TokensCmdGIVENa .pds source fileWHENthe developer runs `pds tokens`THENthe lexical token stream is printed asKIND@line:col \"lexeme\"
Sequence Sequence — run scroll to zoom · drag to pan
SEQUENCErunCOMPONENTTokensCmdPseudoscript::Cli`pds tokens` — printthe conformance tokenCONTAINERSyntaxPseudoscript`crates/pseudoscript-syntax`.The foundation crate:COMPONENTLexerPseudoscript::SyntaxHand-written lexer forLANG.md §2. One passCOMPONENTLineIndexPseudoscript::SyntaxPrecomputed newlineoffsets turning a byt…1renderTokens(text: string)2renderTokens(text: string)3tokenize4build(src: string)↩ return syntax::LineIndex5renderStream↩ return string↩ return string6print
data

TokensOpts #

public
cli::TokensOpts
Entities Entity diagram scroll to zoom · drag to pan
RECORDTokensOptsfilestring
component

UpgradeCmd #

private
cli::UpgradeCmd

`pds upgrade` — download a release and install it over the running binary.

Parent

Sequence Sequence — run scroll to zoom · drag to pan
SEQUENCErunPERSONcallerCOMPONENTUpgradeCmdPseudoscript::Cli`pds upgrade` —download a release an…1run(version: string)↩ return Result<void, cli::IoError>
data

UpgradeOpts #

public
cli::UpgradeOpts
Entities Entity diagram scroll to zoom · drag to pan
RECORDUpgradeOptsversionstring
component

Watcher #

private
cli::Watcher

Filesystem watcher (`--watch`, via `notify`): watches the project root recursively, debounces each save burst, and on a relevant change rebuilds the site and bumps the version the browser's live-reload poll reads. Events under the output dir are ignored so writing the site never re-triggers a build.

Parent

Inbound

Scenarios

WatchAndLiveReload

`pds doc --watch` rebuilds on change and live-reloads the browser.

  • given a site served with `--watch`
  • when a .pds file or pds.toml under the root changes
  • then the watcher debounces the save burst and rebuilds the site
  • and the live-reload version is bumped
  • and the browser, polling /__livereload, reloads to the new version
  • but writes under the output directory are ignored so the build does not loop
Flow Flow — WatchAndLiveReload scroll to zoom · drag to pan
FEATUREWatchAndLiveReloadfor WatcherGIVENa site served with `--watch`WHENa .pds file or pds.toml under the rootchangesTHENthe watcher debounces the save burstand rebuilds the siteANDthe live-reload version is bumpedANDthe browser, polling /__livereload,reloads to the new versionBUTwrites under the output directory areignored so the build does not loop
data

Workspace #

public
cli::Workspace

The loaded project: the `[doc]` config, the resolved output directory (`<root>/<out>`, default `target/doc`), every module sorted by FQN, the dependency-name-prefixed dependency modules (§8.3; empty without a `pds.lock`), and the preferred doc output format. Produced from the nearest `pds.toml`.

Entities Entity diagram scroll to zoom · drag to pan
RECORDWorkspaceconfigdoc::DocConfigoutDirstringmodulesmodel::WorkspaceModule[]dependenciesmodel::WorkspaceModule[]formatstringRECORDDocConfignamestringthemedoc::Themelogostringdocsdoc::DocGroup[]RECORDWorkspaceModulefqnstringsourcestring
Generated by pds doc.