Skip to content

feat: draw generated files as a tree by default, --list for one per line - #61

Merged
Kinflou merged 1 commit into
mainfrom
feat/tree-output-by-default
Oct 13, 2026
Merged

Kinflou merged 1 commit into
mainfrom
feat/tree-output-by-default

Conversation

@Kinflou

@Kinflou Kinflou commented Oct 13, 2026

Copy link
Copy Markdown
Member

Reported from a transcript: the tree looked like the right way for generate
to report, but it only ever appeared under --dry-run. A real run printed one
line per file.

       package.json → generated/typescript/package.json
       tsconfig.json → generated/typescript/tsconfig.json
       src/index.ts → generated/typescript/src/index.ts
       src/none.ts → generated/typescript/src/none.ts
       src/std/index.ts → generated/typescript/src/std/index.ts
       ...

For a lib target that's a dozen near-identical lines sharing a prefix, when
the shape of the generated package is the thing worth seeing:

  ⚙️  language: typescript, version: 5.0, mode: lib
       generated/typescript/
       ├─ package.json
       ├─ src/
       │  ├─ index.ts
       │  ├─ none.ts
       │  ├─ std/
       │  │  ├─ http.ts
       │  │  ├─ index.ts
       │  │  └─ validators.ts
       │  └─ types.ts
       └─ tsconfig.json

The tree is now how generate reports, dry run or not. --list brings back
the per-file lines.

--dry-run and --list are independent

Previously --dry-run implied the tree and there was no way to get either
rendering with the other behaviour. Now one flag decides whether anything is
written and the other how it's reported, and they combine.

What --list keeps

The schema each file came from — api.ids → generated/rust/api.rs — which a
tree of destinations can't show, and the [0.0.1] tag when several package
versions are generated at once.

The tree doesn't need that tag: multi-version output requires
{{package_version}} in layout, so each tree's own root names its version
(generated/rust/0.0.1/). The multi-version test now asserts that rather
than taking it on trust.

Tests

Three tests asserted the old default. Rather than just moving them behind
--list, each now covers both renderings:

  • plain_uses_ascii_arrow → plain_uses_ascii_output: plain mode has two
    ASCII surfaces now, the branch glyphs and the arrow, so it checks both
  • the multi-version test checks the tree root and --list's tag
  • the default-layout test checks the tree

Plus two new ones: --list naming the source schema, and --dry-run --list
combining (writing nothing while listing).

29 + 63 green, fmt and clippy clean. Verified by eye on a real two-target
project in code and lib mode, under --plain (ASCII branches) and
--quiet (silent).

Docs follow once this is installed — scripts/check-cli-drift.py compares
cli.md against the installed binary, so documenting --list first would
fail that check.

… line

The tree already existed, but only `--dry-run` drew it - a real run printed
one `schema -> destination` line per file. For a `lib` target that is a dozen
near-identical lines sharing a prefix, where the shape of the package is the
thing you actually want to see.

So the tree becomes how `generate` reports, dry run or not, and `--list`
brings back the per-file lines. The two flags are now independent: `--dry-run`
decides whether anything is written, `--list` how it is reported, and they
combine.

`--list` keeps the one thing a tree can't show: which schema each file came
from (`api.ids -> generated/rust/api.rs`), and the `[version]` tag when
several package versions are generated at once. The tree doesn't need that
tag - multi-version output requires `{{package_version}}` in `layout`, so
each tree's root names its own version.

Three tests asserted the old default. Rather than just moving them behind
`--list`, they now cover both renderings: `plain` has two ASCII surfaces (the
branch glyphs and the arrow) and checks each, and the multi-version test
asserts the version shows up in the tree root as well as in `--list`'s tag.
@Kinflou
Kinflou merged commit 0b7700c into main Oct 13, 2026
2 checks passed
@Kinflou
Kinflou deleted the feat/tree-output-by-default branch October 13, 2026 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant