stackcanvas 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +126 -0
- package/dist/cli.js +1042 -0
- package/package.json +32 -0
- package/src/server.ts +104 -0
- package/ui-dist/assets/index-BLiLN0HR.js +88 -0
- package/ui-dist/assets/index-C-khjgwU.css +1 -0
- package/ui-dist/index.html +13 -0
package/README.md
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# stackcanvas
|
|
2
|
+
|
|
3
|
+
[Telemetry: opt-in, anonymous, no infra data — see TELEMETRY.md](TELEMETRY.md)
|
|
4
|
+
|
|
5
|
+
Live infrastructure canvas for [Claude Code](https://claude.com/claude-code).
|
|
6
|
+
The agent writes and plans your Terraform — stackcanvas shows it as a living
|
|
7
|
+
diagram. Drag new resources onto the canvas; the agent turns them into
|
|
8
|
+
idiomatic HCL. No SaaS, no credentials leave your machine: everything runs on
|
|
9
|
+
localhost, reading your local state and plan.
|
|
10
|
+
|
|
11
|
+

|
|
12
|
+
|
|
13
|
+
## How it works
|
|
14
|
+
|
|
15
|
+
1. `open_canvas` starts a local web UI for your Terraform root.
|
|
16
|
+
2. The graph re-renders live whenever `*.tfstate` or `.stackcanvas/plan.json`
|
|
17
|
+
change — you watch the agent work.
|
|
18
|
+
3. You drag resources from the palette (or right-click existing ones to
|
|
19
|
+
request changes / removal) and hit **Apply**. Connections between two
|
|
20
|
+
not-yet-created (draft) resources aren't included in the intent yet —
|
|
21
|
+
connect drafts to existing resources, or describe the relation in the
|
|
22
|
+
draft's wishes field.
|
|
23
|
+
4. The agent receives your edits as a structured intent via
|
|
24
|
+
`await_canvas_intent`, writes the HCL, runs `terraform plan`, and the
|
|
25
|
+
canvas highlights what will change. Only the agent executes Terraform —
|
|
26
|
+
the canvas has no apply button by design.
|
|
27
|
+
|
|
28
|
+
## Install (Claude Code)
|
|
29
|
+
|
|
30
|
+
claude plugin marketplace add pshenok/stackcanvas
|
|
31
|
+
claude plugin install stackcanvas@stackcanvas
|
|
32
|
+
|
|
33
|
+
or without the plugin system:
|
|
34
|
+
|
|
35
|
+
claude mcp add stackcanvas -- npx -y stackcanvas
|
|
36
|
+
|
|
37
|
+
Then, inside a repo with Terraform:
|
|
38
|
+
|
|
39
|
+
/stackcanvas
|
|
40
|
+
|
|
41
|
+
This is the verified path — the CI `check-plugin` job validates the plugin
|
|
42
|
+
and marketplace manifests on every push.
|
|
43
|
+
|
|
44
|
+
## Other MCP clients
|
|
45
|
+
|
|
46
|
+
stackcanvas is a standard [MCP](https://modelcontextprotocol.io) server, so
|
|
47
|
+
any MCP-compatible client can run it. The snippets below are **reported to
|
|
48
|
+
work as standard MCP servers; not yet CI-verified** — only the Claude Code
|
|
49
|
+
path above is exercised in CI.
|
|
50
|
+
|
|
51
|
+
**Cursor** (`.cursor/mcp.json`):
|
|
52
|
+
|
|
53
|
+
```json
|
|
54
|
+
{
|
|
55
|
+
"mcpServers": {
|
|
56
|
+
"stackcanvas": { "command": "npx", "args": ["-y", "stackcanvas"] }
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**Windsurf** (`~/.codeium/windsurf/mcp_config.json`):
|
|
62
|
+
|
|
63
|
+
```json
|
|
64
|
+
{
|
|
65
|
+
"mcpServers": {
|
|
66
|
+
"stackcanvas": { "command": "npx", "args": ["-y", "stackcanvas"] }
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Multi-cloud
|
|
72
|
+
|
|
73
|
+
The canvas is provider-agnostic: **any Terraform provider in your state renders** —
|
|
74
|
+
AWS, GCP, Azure, Cloudflare, Datadog, `random`, all of them, in one graph
|
|
75
|
+
(a single Terraform root often mixes providers, so there is no "cloud switcher").
|
|
76
|
+
What's provider-specific is only the curation layer, shipped as **provider packs**:
|
|
77
|
+
|
|
78
|
+
- a palette pack (`packages/ui/src/resource-palette.ts`) — curated drag-and-drop types
|
|
79
|
+
- containment rules (`DEFAULT_CONTAINMENT_RULES` in `@stackcanvas/core`) — which
|
|
80
|
+
resources render as visual containers (AWS VPC/subnet today)
|
|
81
|
+
- icon patterns (`packages/ui/src/icons.tsx`)
|
|
82
|
+
|
|
83
|
+
AWS ships first. Adding a GCP/Azure/other pack is pure data and makes a great
|
|
84
|
+
first PR.
|
|
85
|
+
|
|
86
|
+
## OpenTofu
|
|
87
|
+
|
|
88
|
+
stackcanvas works with [OpenTofu](https://opentofu.org) as a drop-in replacement
|
|
89
|
+
for Terraform: it looks for a `terraform` binary on `PATH` first, then falls
|
|
90
|
+
back to `tofu`. Override the choice with `--tf-bin <path>` on `stackcanvas serve`,
|
|
91
|
+
or set `STACKCANVAS_TF_BIN` (e.g. in your MCP client's `.mcp.json` `env` block)
|
|
92
|
+
to pin it — both take precedence over auto-detection.
|
|
93
|
+
|
|
94
|
+
## Tools
|
|
95
|
+
|
|
96
|
+
| Tool | Purpose |
|
|
97
|
+
|------|---------|
|
|
98
|
+
| `open_canvas` | Start the canvas for a Terraform root, open the browser |
|
|
99
|
+
| `load_plan` | Register a plan (JSON or binary) for diff highlighting |
|
|
100
|
+
| `get_graph_summary` | Text summary of the graph for the agent |
|
|
101
|
+
| `await_canvas_intent` | Block until the user clicks Apply; returns their edits |
|
|
102
|
+
|
|
103
|
+
## Demo
|
|
104
|
+
|
|
105
|
+
`examples/demo` contains a small AWS config. Run `terraform init && terraform plan -out=tfplan && terraform show -json tfplan > .stackcanvas/plan.json` there and open the canvas to see create-highlighting. `plan` does not create or modify any resources — nothing is provisioned until `terraform apply` (note: the AWS provider still needs credentials and makes read-only API calls during plan).
|
|
106
|
+
|
|
107
|
+
## Telemetry
|
|
108
|
+
|
|
109
|
+
stackcanvas can send a handful of anonymous usage counters (installs,
|
|
110
|
+
canvases opened, edits sent, scans run) — **opt-in only**, nothing is sent
|
|
111
|
+
until you click **Allow** on the one-time canvas banner, and `DO_NOT_TRACK=1`
|
|
112
|
+
/ `STACKCANVAS_TELEMETRY=0` always turn it off regardless of that decision.
|
|
113
|
+
No resource names, infrastructure data, or file paths ever leave your
|
|
114
|
+
machine. Full payload, consent model, and how to verify it yourself:
|
|
115
|
+
[TELEMETRY.md](TELEMETRY.md).
|
|
116
|
+
|
|
117
|
+
## Development
|
|
118
|
+
|
|
119
|
+
pnpm install
|
|
120
|
+
pnpm test # unit + integration
|
|
121
|
+
pnpm e2e # playwright smoke
|
|
122
|
+
pnpm build:pkg # build the publishable package
|
|
123
|
+
|
|
124
|
+
## License
|
|
125
|
+
|
|
126
|
+
MIT
|