Repository navigation
Closed
Description
Summary
The CLI recognizes with doc and with repl, but both commands are explicit self-hosted compiler stubs. The spec lists both as stable toolchain commands, so each needs a real implementation or a deliberately scoped first milestone.
Spec
docs/with-specification.md:9608-9624 lists with doc [--open] and with repl as commands provided by the single with binary.
Current state
src/main.w:731-736 handles repl and doc by printing not yet available in self-hosted compiler errors and returning exit code 1. src/main.w:2485-2511 also omits both commands from the general usage output.
Implementation plan
- Split the work into two independently shippable command implementations.
- For
with doc:- parse
with doc [--open]and optional project/source selection, - reuse parser/sema metadata to collect public modules, declarations, signatures, doc comments, and links,
- emit deterministic HTML or markdown into
out/docor a documented default, - make
--openbest-effort only after successful generation.
- parse
- For
with repl:- start with a line-oriented interactive loop that parses and typechecks snippets through the normal compiler pipeline,
- keep state for previous bindings where feasible, or fail loudly for unsupported persistent-state cases,
- avoid introducing a separate mini-language or interpreter semantics that diverge from compiled With.
- Update help text and the inventory gate from Add the spec inventory gate (keywords/attributes/CLI/modules vs spec tables) #410 once behavior exists.
Test plan
- Add CLI tests that
with doc --helpandwith repl --helpsucceed once help is defined. - Add a deterministic
with docsmoke test for a tiny project with one public declaration and one private declaration. - Add a REPL smoke test using piped input if the command supports non-interactive stdin; otherwise add a lower-level test for the REPL evaluator/session component.
- Add negative tests for unsupported doc/repl inputs that must fail loudly and specifically.
Acceptance criteria
with docandwith replare no longer placeholder commands.- Help text lists both commands consistently with the spec.
- Unsupported subfeatures fail loudly with actionable diagnostics.
with build,with build :fixpoint,with build :test, andwith build :test-greenpass before this issue is closed.
Dependencies
Related to #410 for keeping the CLI command inventory synchronized with the spec.
Traceability
From the requirements campaign (docs/requirements.md, spec v7.1). Affected requirement IDs: 18.5.1.1.
Metadata
Metadata
Assignees
Labels
No labels
Activity
ehartford commentedon Jun 11, 2026
Implemented in a17be5a. Added real
with docandwith replcommands: docs generate deterministic Markdown for public functions/types across reachable project modules using compiler metadata and doc comments; repl runs accepted line snippets through the normal compile/link/run pipeline and rejects unsupported persistent declarations loudly. Added CLI self-host coverage for doc/repl help, doc public/private filtering including imported project modules, missing doc source diagnostics, repl smoke input, and repl persistent-declaration diagnostics. Verification passed:WITH=$PWD/out/bin/with ./out/bin/with build,WITH=$PWD/out/bin/with ./out/release/bin/with build :fixpoint,WITH=$PWD/out/bin/with ./out/release/bin/with build :test, andWITH=$PWD/out/bin/with ./out/release/bin/with build :test-green.