Repository navigation
feat: link std in lib mode, name the mode, and add generate --dry-run - #58
Merged
Merged
Conversation
…run`
**`lib` links `comline_std` instead of inlining std.** The machinery was
already there - `external_std` filters std's schemas out and adds the
dependency - it was just off for everyone. Now the default follows the mode,
because the two modes differ in whether there is anywhere to put a
dependency: `lib` writes the package manifest, so the generator adds
`comline_std` to it and every crate links one shared std; `code` emits loose
files with no manifest, so all a generator can do is leave a comment naming
the line to add by hand, and inlining stays the honest default there.
A `lib` crate carried its own private copy of std before this, drifting from
everyone else's. On a schema using `std::http::Request`, generation drops
from 7 files to 4.
It stays a default, not a rule: `external_std = false` on the target or in
`[generate]` still inlines std in `lib` mode. `--no-external-std` joins
`--external-std` for the same reason - the default is no longer a fixed
`false`, so either direction can be the one a run needs to override.
**The target line names the mode.** `language: rust, version: 1.70.0,
mode: lib`. The header stays as it was: mode is a per-target decision and
would be a lie up there the moment two targets disagreed.
**`generate --dry-run`** prints the tree each target would write and writes
nothing. The generators are pure and `write_file` is the only side effect in
this command, so a dry run is the real run with the write suppressed - what
it prints is what *would* be written, not a prediction of it. That matters
most for `lib`, where `out` often points outside the project entirely:
• Generating code - dry run, nothing written
⚙️ language: rust, version: 1.70.0, mode: lib
../libdemo-rs/
├─ Cargo.toml
└─ src/
├─ greeting.rs
├─ lib.rs
└─ types.rs
✓ Would write 4 file(s)
**`comline new` scaffolds `src/greeting.ids`.** `main` is a reserved schema
name as of core#91, so the scaffold names itself after what it declares,
like the repo's own `examples/` do. Five test fixtures that used the name
move to `api.ids` for the same reason.
Three places still claimed `code` was the only implemented mode - the
`generate` long help, the `--mode` flag help and the scaffolded
`comline.toml`'s own comment. `lib` has worked since G2a; only `dylib` is
unbuilt.
Including comline-rust#38's STD_REV repoint, so a `lib`-mode crate this CLI generates links the current comline_std rather than the one the previous pin named. `comline-codegen` stays on the rev the generator crates themselves pin - cli has no [patch] to unify two of them.
Kinflou
pushed a commit
that referenced
this pull request
Oct 12, 2026
The `lib` mode work (#58) landed unformatted, turning CI's Lint job red on main; this branch added more of the same. `cargo fmt --all` over the four files it touched, no behaviour change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
liblinkscomline_stdinstead of inlining stdThe machinery was already there —
external_stdfilters std's schemas outand adds the dependency — it was just off for everyone. The default now
follows the mode, because the two modes differ in whether there is anywhere
to put a dependency:
libwrites the package manifest, so the generator addscomline_stdto it and every crate links one shared std;codeemits loosefiles with no manifest, so all a generator can do is leave a comment naming
the line to add by hand, and inlining stays the honest default there.
A
libcrate carried its own private copy of std before this, drifting fromeveryone else's. On a schema using
std::http::Request, generation dropsfrom 7 files to 4, and the result builds against the real
comline_std.It stays a default, not a rule:
external_std = falseon the target or in[generate]still inlines std inlibmode.--no-external-stdjoins--external-stdfor the same reason — the default is no longer a fixedfalse, so either direction can be the one a run needs to override.The target line names the mode
The header stays as it was: mode is a per-target decision and would be a lie
up there the moment two targets disagreed.
generate --dry-runThe generators are pure and
write_fileis the only side effect in thiscommand, so a dry run is the real run with the write suppressed — what it
prints is what would be written, not a prediction of it. That matters most
for
lib, whereoutoften points outside the project entirely:comline newscaffoldssrc/greeting.idsmainis a reserved schema name as of ComlineProject/core#91, so the scaffoldnames itself after what it declares, like the repo's own
examples/do. Fivetest fixtures that used the name move to
api.idsfor the same reason.Three places still claimed
codewas the only implemented mode — thegeneratelong help, the--modeflag help and the scaffoldedcomline.toml's own comment.libhas worked since G2a; onlydylibisunbuilt.
Depends on ComlineProject/core#91, ComlineProject/generation#46,
ComlineProject/comline-rust#37 and ComlineProject/comline-typescript#31.