Skip to content

spec-07: Infrastructure-as-Code language support#92

Merged
clay-good merged 5 commits into
mainfrom
openlore-spec-07-iac-languages
May 27, 2026
Merged

spec-07: Infrastructure-as-Code language support#92
clay-good merged 5 commits into
mainfrom
openlore-spec-07-iac-languages

Conversation

@clay-good
Copy link
Copy Markdown
Owner

Summary

Adds ingestion for six Infrastructure-as-Code ecosystems in one PR —
Terraform/HCL, Kubernetes, Helm, CloudFormation, Ansible, and Pulumi —
projected onto OpenLore's existing graph primitives.

  • No schema / MCP-tool changes. A normalized resource graph
    (IacResource/IacReference/IacModule) is produced per ecosystem and a
    single projector maps it onto FunctionNode/CallEdge/ClassNode. Edge
    direction is dependent → dependency, so depth-1 callers of a node =
    blast radius (analyze_impact), fanOut = what it needs. The only schema
    touch is additive: two new EdgeKind values (references, depends_on).
  • orient, search_code, get_subgraph, analyze_impact, the SCIP export,
    and the spec-05 federation manifest all work on IaC unchanged (manifest
    languages[] picks up IaC tags automatically; SCIP maps them to
    UnspecifiedLanguage).
  • No new runtime dependency. Terraform uses a tolerant, hand-rolled
    pure-JS HCL scanner (rationale: tree-sitter-hcl is a native addon and
    extraction only needs block boundaries + dotted-reference detection). The
    existing yaml dependency covers K8s/CFN/Helm/Ansible.
  • Static analysis only — no terraform plan, no Helm render, no Ansible run,
    no cloud calls, no external CLI required.
  • IaC logic is isolated under src/core/analyzer/iac/, mirroring
    src/core/scip/. See docs/iac.md.

Discovery

detectLanguage maps .tf/.tfvars/.tf.json → Terraform. Ambiguous
.yaml/.yml/.json route through a small pure classifyYaml(path, content)
plus chart-directory detection in the analyze pipeline. Unsure → unknown
(generic CI/compose/app config is never misclassified).

Follow-ups (TODO(spec-07-followup))

  • Terraform: refs to resource types without an underscore; structural *.tf.json.
  • Helm: .Values.xvalues.yaml key resolution.
  • Ansible: dynamic (templated) include targets.
  • Pulumi: Go programs; CDK/CDKTF (out of scope).

Test plan

  • Per-ecosystem unit tests with co-located fixtures (exact nodes + edges)
  • classify-yaml table test (incl. generic YAML → null)
  • Mixed app+IaC integration test through CallGraphBuilder (graph tools unchanged)
  • Determinism test (rebuild → identical IaC nodes/edges)
  • npm run lint / typecheck / test:run (2865 pass) / build all green
  • No regression to general-purpose extraction

🤖 Generated with Claude Code

clay-good and others added 5 commits May 27, 2026 13:50
Add ingestion for six IaC ecosystems — Terraform/HCL, Kubernetes, Helm,
CloudFormation, Ansible, and Pulumi — projected onto the existing
FunctionNode/CallEdge/ClassNode graph primitives so orient, search_code,
get_subgraph, and analyze_impact answer infrastructure blast-radius
questions with zero MCP-tool or schema changes (edge direction is
dependent → dependency; two additive EdgeKind values: references, depends_on).

- src/core/analyzer/iac/: normalized resource graph + single projector,
  per-ecosystem parsers, and classifyYaml content disambiguation.
- Terraform uses a hand-rolled pure-JS HCL scanner (no native dependency).
- Discovery: detectLanguage handles .tf/.tfvars/.tf.json; ambiguous YAML/JSON
  routes through classifyYaml + chart-dir detection in the analyze pipeline.
- IaC projection pass wired into CallGraphBuilder.build().
- Co-located tests + fixtures (fixtures excluded from tsconfig/eslint).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…refs, Helm values, Pulumi Go, Ansible static-loop includes)

- Terraform: resolve refs to resource types without an underscore (emit
  candidate, projector drops if unresolved); structural *.tf.json parsing.
- Helm: resolve .Values.x references to the longest matching values.yaml key,
  adding value-key nodes and template→value edges.
- Pulumi: detect Go programs (github.com/pulumi/pulumi-*, pkg.NewService(ctx,
  "name", ...)) alongside TS/JS/Python via a shared emit path.
- Ansible: resolve a templated include backed by a static loop/with_items list
  to each literal item; fully dynamic targets remain dropped by design.
- Tests + fixtures for every follow-up; docs/iac.md and spec log updated.

CDK/CDKTF remain intentionally out of scope per the spec contract.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Keeps the working tree in sync with the branch: the 1MB npm-pack tarball is
a build artifact (now gitignored, not committed), and the spec-08 prompt doc
is tracked so it stays versioned alongside the repo.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Detect CDK and CDKTF construct instantiations over existing TS/JS/Python/Go
source (new CDK / CDKTF language tags), distinguished from Pulumi by the
construct shape: scope is the first arg, logical id the second
(new s3.Bucket(this, "id", ...)). Go jsii.String("id") ids are unwrapped.
Resources project onto the same graph primitives; reference edges link a
construct to other constructs referenced in its args. SCIP maps the new tags
to UnspecifiedLanguage; the manifest languages[] picks them up automatically.

Adds cdk.ts + cdk.test.ts with TS/CDKTF/Python/Go fixtures; updates docs.
Extends spec-07 beyond its original CDK/CDKTF deferral at maintainer request.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@clay-good clay-good merged commit 15bdb62 into main May 27, 2026
4 checks passed
@clay-good clay-good deleted the openlore-spec-07-iac-languages branch May 27, 2026 19:24
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