Main entry point and loop.
Internal sentinel recording the TERM_PROGRAM present when dcode started.
Not user-facing. The resume hint echoes TERM_PROGRAM only when the launch
environment supplied it (an inline TERM_PROGRAM=x dcode, a terminal's own
export, or a shell alias), so the value set by a project or global .env file
after launch must not leak in. The app itself never sets TERM_PROGRAM, so
cli_main snapshotting the variable here at entry means a set sentinel always
marks an explicit launch value; the update re-exec inherits it unchanged,
which is correct because the relaunch runs the command the user typed.
Process-wide path snapshot captured before any dotenv loader can run.
Maximum characters in one rubric or goal acceptance-criteria value.
Return the immutable launch-time user profile root.
Reject criteria that cannot fit their persistent context budget.
Build the plain-text output for the --version CLI flag.
Includes the CLI and SDK versions and any installed optional dependencies. For editable installs it also reports the source path and the resolved versions of the core LangChain-ecosystem dependencies.
Reports the same version facts as the /version slash command, in the
same section order (versions, editable path, update status, core dependencies,
optional dependencies). Release-age suffixes stay omitted so --version
remains offline; update status comes only from the fresh local cache.
Check if optional dependencies are installed.
Check for recommended external tools and return missing tool names.
Skips tools that the user has suppressed via
[warnings].suppress in config.toml.
Build a PendingNotification for a missing optional tool.
The returned entry carries the install hint (or URL) in a typed payload so the notification center action handler can copy it / open it without re-running platform detection.
Format a missing-tool warning for non-interactive console output.
Parse command line arguments.
Run the Textual TUI interface (async version).
Starts a LangGraph server in a subprocess and connects the TUI to it via the
langgraph-sdk client.
Read piped stdin and merge it into the parsed CLI arguments.
When stdin is not a TTY (i.e. input is piped), reads all available text
and applies it to the argument namespace. If stdin is a TTY or the piped
input is empty/whitespace-only, the function returns without modifying
args. Leading and trailing whitespace is stripped from piped input.
non_interactive_message is already set (-n), prepends the
piped text to it (the CLI still runs non-interactively):cat context.txt | dcode -n "summarize this"
# non_interactive_message = "{contents of context.txt}\n\nsummarize this"
initial_prompt is already set (-m, but not -n), prepends
the piped text to it (the CLI still runs interactively):cat error.log | dcode -m "explain this"
# initial_prompt = "{contents of error.log}\n\nexplain this"
initial_skill is already set (--skill, but not -n/-m) and the
pipe was auto-detected (no explicit --stdin), stores the piped text in
initial_prompt so the skill receives it as the seed for the
interactive TUI:cat diff.txt | dcode --skill code-review
# initial_prompt = "{contents of diff.txt}"
When --stdin is passed explicitly, this convenience is skipped: the
piped text falls through to non_interactive_message so the skill runs
headless (see below):
cat diff.txt | dcode --skill code-review --stdin
# non_interactive_message = "{contents of diff.txt}"
non_interactive_message to the piped text, causing
the CLI to run non-interactively with it as the prompt:echo "fix the typo in README.md" | dcode
# non_interactive_message = "fix the typo in README.md"Block on a refresh / continue / mute / abort picker for stale dependencies.
Lives here (not in _dep_floor_check) beside the other pre-TUI trust
prompts so the picker implementation is shared. The prompt prints to
stderr and runs before the Textual alternate screen mounts, so it stays
visible.
Entry point for console script.
Tool-approval policy selected for an interactive thread.
Character glyphs for TUI display.
Decides whether project-scoped hooks may run in a given directory.
Trust is a property of the workspace, not of the session, so it must be re-resolved every time the working directory moves. A session that starts in a trusted project and later moves into an untrusted one must not carry the original grant forward.
Callers hand this policy to HooksManager, which resolves it on load and on
every reload; nothing upstream needs to hold or reinterpret the decision.
A single notice waiting for user action.
Immutable value object: the registry owns the
key-to-toast-identity binding (see NotificationRegistry) so
external callers cannot corrupt click-routing indices by mutating
notifications after construction.