fix(cli): accept a folder wherever a file or a glob is expected #318

Merged
abiwab merged 1 commit from fix/check-directory-argument into main 2026-11-29 20:15:32 +01:00
Owner

Summary

gram check . (or gram check recipes/), the first command a newcomer types, failed with a raw EISDIR shown as a COMPILE_ERROR. A folder given where a file or a glob is expected now stands for every .gram file inside it, sorted like a glob's matches. Every command built on resolveGlob gains it: check, format, build, shop, db sync, suggest --pattern.

  • packages/cli/src/core/glob.ts: a pattern without * that names a folder expands to **/*.gram under it; a missing path still reaches the reader, which reports why.
  • Unit tests (., sub, sub/, an empty folder, a missing file) and an e2e test per command: gram X recettes/ reads exactly like gram X "recettes/**/*.gram" (7 of 8 fail without the fix).
  • cli.mdx (en + fr): gram check examples with a folder.

Pre-release audit 1.6, finding M1. After the merge: merge main into dev/1.6.

Type of change

  • Bug fix (non-breaking change fixing an issue)

Quality checklist

  • Code formatted with Biome (bun run lint:fix)
  • TypeScript types validated (bun run typecheck)
  • Package tests passing (bun test)
  • If changing a published package, a changeset is included (bun run change)
## Summary `gram check .` (or `gram check recipes/`), the first command a newcomer types, failed with a raw `EISDIR` shown as a `COMPILE_ERROR`. A folder given where a file or a glob is expected now stands for every `.gram` file inside it, sorted like a glob's matches. Every command built on `resolveGlob` gains it: `check`, `format`, `build`, `shop`, `db sync`, `suggest --pattern`. - `packages/cli/src/core/glob.ts`: a pattern without `*` that names a folder expands to `**/*.gram` under it; a missing path still reaches the reader, which reports why. - Unit tests (`.`, `sub`, `sub/`, an empty folder, a missing file) and an e2e test per command: `gram X recettes/` reads exactly like `gram X "recettes/**/*.gram"` (7 of 8 fail without the fix). - `cli.mdx` (en + fr): `gram check` examples with a folder. Pre-release audit 1.6, finding M1. After the merge: merge `main` into `dev/1.6`. ## Type of change - [x] Bug fix (non-breaking change fixing an issue) ## Quality checklist - [x] Code formatted with Biome (`bun run lint:fix`) - [x] TypeScript types validated (`bun run typecheck`) - [x] Package tests passing (`bun test`) - [x] If changing a published package, a changeset is included (`bun run change`)
fix(cli): accept a folder wherever a file or a glob is expected
All checks were successful
CI / Build & Test (pull_request) Successful in 5m57s
c49c2442c1
abiwab merged commit f485883ce6 into main 2026-11-29 20:15:32 +01:00
Sign in to join this conversation.
No description provided.