Skip to content

meta gen writes a regenerable per-target shadow copy under .metaobjects/<target>/ that meta init's .gitignore doesn't exclude (committed by default) #75

Description

@dmealing

Summary

For a multi-target codegen config, meta gen writes generated output to each target's configured outDir and a regenerable shadow copy under .metaobjects/<targetName>/src/generated/. But meta init scaffolds .metaobjects/.gitignore containing only .gen-state/, so this shadow copy is not ignored and gets committed by default.

Repro

  1. meta init (TypeScript). The generated .metaobjects/.gitignore contains just .gen-state/.
  2. Add a second output target whose outDir points outside the project root (e.g. a sibling package, ../shared/src/generated).
  3. Run meta gen.
  4. Observe: generated files land at the configured outDir and at .metaobjects/<targetName>/src/generated/*.ts. The latter shows up as untracked but is not gitignored, so it's trivially committed.

Why it matters

  • The .metaobjects/<target>/ copy is regenerable: deleting it and re-running meta gen recreates it, and meta gen then reports it unchanged. It is not the canonical output (that lives at the configured outDir).
  • Because it isn't covered by the meta init gitignore, every multi-target project silently commits a duplicate, regenerable copy of generated code under .metaobjects/.

Expected

The regenerable per-target shadow shouldn't be committed by default — either write it under the already-ignored .gen-state/, or have meta init add the per-target shadow dirs to .metaobjects/.gitignore (METAOBJECTS_GITIGNORE_BODY in cli/src/commands/init.ts).

Correctly-tracked, for contrast

.metaobjects/migrations/ (per-migration up.sql/down.sql + .schema.postgres.json drift baseline) is meant to be tracked — this report is only about the regenerable per-target generated-code shadow under .metaobjects/<target>/.

Environment

@metaobjectsdev/* 0.12.0 (TypeScript), multi-target config with a cross-package target outDir.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions