Skip to content

chant workspace graph <dir> --discover, with no declaration and no writes #5095

Closed

Description

@lex00

chant workspace graph reads a repository only when it has a chant.workspace.json. Any tool that wants the graph of a plain infrastructure repo must write a declaration first. behold does that today, for Terraform only, in its temp directory. --discover runs the kinds' probes under a directory and composes what they find as if a declaration listed it, and writes nothing inside the directory. Part of #5094 and INTENTIUS/behold#1049, phase 1.

Today

  • With no declaration, locateWorkspace (packages/core/src/workspace/which-chant.ts) fails with declaration-missing.
  • The pieces exist. resolveKind (packages/core/src/workspace/kinds.ts) picks a directory's kind by probe and precedence and reports ties. Reader projects are written outside the workspace (kind-readers.ts), and the member cache lives in the user's cache directory (graph-cache.ts).
  • loadKindRegistry(pins, workspaceRoot) takes its pins from the declaration.
  • The terraform probe matches any *.tf file, so it would also claim a local module directory.
  • behold's workaround writes behold-tf-<hash> and behold-tfws-<hash> under the OS temp directory (behold src/terraform-member.ts). It reads 49 roots in 2.1 s.

Change

  • Add --discover. Walk <dir>, skipping .git and node_modules, resolve each directory with resolveKind, and compose through the same path as a declared read. --member, --detail and --no-cache keep working.
  • Name each member from its path relative to <dir>, so names stay stable across revisions. Member names cannot hold /.
  • A directory that a root calls through a local source is a module and does not become a member.
  • Add an additive discovered list giving each member's directory, kind and probe, plus every tie.
  • Decisions for the implementer: which installed packages supply kinds, whether --at is supported, and what happens when a declaration exists.

Done when

  • Fixture fx/: infra/net/main.tf (a provider and a resource, calling ../modules/vpc), infra/modules/vpc/main.tf, and argo/app.yaml (an Application). chant workspace graph fx --discover prints a contract-1 document with members infra/net and argo, and none for the module.
  • A file listing and content hash of fx/ are identical before and after the run.
  • A directory claimed by two kinds of equal precedence appears in discovered with both kinds and is not read.
  • With no declaration, the command without --discover still fails with declaration-missing.
  • The output validates against packages/core/src/workspace/graph.schema.json.

Depends on

Nothing.

Not in this issue

Switching behold's reader to --discover, which is a behold issue.

Activity

  1. added
    wave:1
    epic:surfaces
    on Nov 15, 2026
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

    epic:surfaceswave:1

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions