passport-bridge 0.48.2 → 0.49.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.
Files changed (111) hide show
  1. package/dist/cliHookAfter.js +10 -1
  2. package/dist/cliHookDecide.d.ts +9 -3
  3. package/dist/cliHookDecide.js +182 -28
  4. package/dist/cliHookSessionState.d.ts +4 -1
  5. package/dist/cliHookSessionState.js +1 -1
  6. package/dist/connectorKit/callEffects.generated.d.ts +36 -0
  7. package/dist/connectorKit/callEffects.generated.js +73 -0
  8. package/dist/connectorKit/cli.generated.js +5 -2
  9. package/dist/connectorKit/engine.generated.d.ts +1 -1
  10. package/dist/connectorKit/engine.generated.js +32 -13
  11. package/dist/connectorKit/githubIds.generated.d.ts +1 -1
  12. package/dist/connectorKit/githubIds.generated.js +3 -2
  13. package/dist/connectorKit/manifest.generated.d.ts +34 -14
  14. package/dist/connectorKit/manifests/cloudflare.generated.d.ts +2 -0
  15. package/dist/connectorKit/manifests/cloudflare.generated.js +186 -0
  16. package/dist/connectorKit/manifests/cloudflareApi.generated.d.ts +4 -0
  17. package/dist/connectorKit/manifests/cloudflareApi.generated.js +207 -0
  18. package/dist/connectorKit/manifests/cloudflareCatalog.generated.d.ts +18 -0
  19. package/dist/connectorKit/manifests/cloudflareCatalog.generated.js +83 -0
  20. package/dist/connectorKit/manifests/cloudflareCli.generated.d.ts +2 -0
  21. package/dist/connectorKit/manifests/cloudflareCli.generated.js +441 -0
  22. package/dist/connectorKit/manifests/githubCapture.generated.js +19 -1
  23. package/dist/connectorKit/manifests/githubReads.generated.js +0 -3
  24. package/dist/connectorKit/manifests/kubernetes.generated.d.ts +76 -0
  25. package/dist/connectorKit/manifests/kubernetes.generated.js +210 -0
  26. package/dist/connectorKit/manifests/kubernetesArgs.generated.d.ts +21 -0
  27. package/dist/connectorKit/manifests/kubernetesArgs.generated.js +82 -0
  28. package/dist/connectorKit/manifests/kubernetesCli.generated.d.ts +30 -0
  29. package/dist/connectorKit/manifests/kubernetesCli.generated.js +530 -0
  30. package/dist/connectorKit/manifests/kubernetesEffects.generated.d.ts +15 -0
  31. package/dist/connectorKit/manifests/kubernetesEffects.generated.js +111 -0
  32. package/dist/connectorKit/manifests/kubernetesObjects.generated.d.ts +24 -0
  33. package/dist/connectorKit/manifests/kubernetesObjects.generated.js +154 -0
  34. package/dist/connectorKit/manifests/railwayHooks.generated.js +11 -5
  35. package/dist/connectorKit/manifests/sentry.generated.d.ts +6 -0
  36. package/dist/connectorKit/manifests/sentry.generated.js +27 -0
  37. package/dist/connectorKit/manifests/sentryApi.generated.d.ts +6 -0
  38. package/dist/connectorKit/manifests/sentryApi.generated.js +282 -0
  39. package/dist/connectorKit/manifests/sentryCapture.generated.d.ts +2 -0
  40. package/dist/connectorKit/manifests/sentryCapture.generated.js +165 -0
  41. package/dist/connectorKit/manifests/sentryCatalog.generated.d.ts +5 -0
  42. package/dist/connectorKit/manifests/sentryCatalog.generated.js +70 -0
  43. package/dist/connectorKit/manifests/sentryCli.generated.d.ts +2 -0
  44. package/dist/connectorKit/manifests/sentryCli.generated.js +230 -0
  45. package/dist/connectorKit/manifests/sentryIssues.generated.d.ts +20 -0
  46. package/dist/connectorKit/manifests/sentryIssues.generated.js +204 -0
  47. package/dist/connectorKit/manifests/supabase.generated.js +3 -2
  48. package/dist/connectorKit/manifests/supabaseApi.generated.js +52 -52
  49. package/dist/connectorKit/manifests/supabaseCapture.generated.js +22 -21
  50. package/dist/connectorKit/manifests/supabaseCatalog.generated.d.ts +2 -2
  51. package/dist/connectorKit/manifests/supabaseCatalog.generated.js +8 -7
  52. package/dist/connectorKit/manifests/supabaseCli.generated.js +32 -32
  53. package/dist/connectorKit/manifests/supabaseProbes.generated.js +29 -29
  54. package/dist/connectorKit/manifests/terraform.generated.d.ts +5 -0
  55. package/dist/connectorKit/manifests/terraform.generated.js +214 -0
  56. package/dist/connectorKit/manifests/terraformLink.generated.d.ts +30 -0
  57. package/dist/connectorKit/manifests/terraformLink.generated.js +73 -0
  58. package/dist/connectorKit/manifests/terraformPlan.generated.d.ts +48 -0
  59. package/dist/connectorKit/manifests/terraformPlan.generated.js +192 -0
  60. package/dist/connectorKit/params.generated.js +2 -0
  61. package/dist/connectorKit/shell.generated.d.ts +5 -1
  62. package/dist/connectorKit/shell.generated.js +121 -20
  63. package/dist/connectorKit/sources/cloudflare/api-operations.generated.d.ts +37 -0
  64. package/dist/connectorKit/sources/cloudflare/api-operations.generated.js +2 -0
  65. package/dist/connectorKit/sources/cloudflare/cli-flags.generated.d.ts +617 -0
  66. package/dist/connectorKit/sources/cloudflare/cli-flags.generated.js +2 -0
  67. package/dist/connectorKit/sources/cloudflare/mcp-tools.generated.d.ts +16 -0
  68. package/dist/connectorKit/sources/cloudflare/mcp-tools.generated.js +2 -0
  69. package/dist/connectorKit/sources/sentry/api-operations.generated.d.ts +121 -0
  70. package/dist/connectorKit/sources/sentry/api-operations.generated.js +2 -0
  71. package/dist/connectorKit/sources/sentry/cli-commands.generated.d.ts +530 -0
  72. package/dist/connectorKit/sources/sentry/cli-commands.generated.js +2 -0
  73. package/dist/connectorKit/sources/sentry/mcp-tools.generated.d.ts +32 -0
  74. package/dist/connectorKit/sources/sentry/mcp-tools.generated.js +2 -0
  75. package/dist/connectorKit/template.generated.d.ts +8 -4
  76. package/dist/connectorKit/template.generated.js +19 -6
  77. package/dist/controlPlane.generated.d.ts +11 -2
  78. package/dist/controlPlaneActions.generated.d.ts +52 -12
  79. package/dist/controlPlaneActions.generated.js +40 -11
  80. package/dist/controlPlaneCloudflare.d.ts +70 -0
  81. package/dist/controlPlaneCloudflare.js +188 -0
  82. package/dist/controlPlaneKubernetes.d.ts +72 -0
  83. package/dist/controlPlaneKubernetes.js +260 -0
  84. package/dist/controlPlaneModel.generated.d.ts +6 -0
  85. package/dist/controlPlaneNpm.generated.d.ts +83 -0
  86. package/dist/controlPlaneNpm.generated.js +307 -0
  87. package/dist/controlPlaneNpmCommands.generated.d.ts +35 -0
  88. package/dist/controlPlaneNpmCommands.generated.js +567 -0
  89. package/dist/controlPlaneNpmGuard.d.ts +44 -0
  90. package/dist/controlPlaneNpmGuard.js +210 -0
  91. package/dist/controlPlaneOffline.d.ts +1 -1
  92. package/dist/controlPlaneRailway.generated.js +2 -2
  93. package/dist/controlPlaneRailwayCli.generated.js +13 -2
  94. package/dist/controlPlaneRailwayModel.generated.d.ts +5 -0
  95. package/dist/controlPlaneRailwayModel.generated.js +15 -1
  96. package/dist/controlPlaneSentry.d.ts +68 -0
  97. package/dist/controlPlaneSentry.js +205 -0
  98. package/dist/controlPlaneTerraform.d.ts +86 -0
  99. package/dist/controlPlaneTerraform.js +273 -0
  100. package/dist/controlPlaneUnnamed.generated.d.ts +41 -2
  101. package/dist/controlPlaneUnnamed.generated.js +148 -2
  102. package/dist/cpCli.d.ts +1 -1
  103. package/dist/cpCli.js +1 -1
  104. package/dist/pluginPin.d.ts +1 -1
  105. package/dist/pluginPin.js +1 -1
  106. package/dist/terraformPlans.d.ts +45 -0
  107. package/dist/terraformPlans.js +96 -0
  108. package/dist/version.d.ts +1 -1
  109. package/dist/version.js +1 -1
  110. package/npm-shrinkwrap.json +2 -2
  111. package/package.json +1 -1
@@ -61,7 +61,7 @@ export const SUPABASE_PROBES = [
61
61
  changes: [
62
62
  {
63
63
  on: "added",
64
- action: "supabase.unclassified",
64
+ action: "supabase.project.change",
65
65
  summary: "Create project {name}"
66
66
  },
67
67
  {
@@ -88,7 +88,7 @@ export const SUPABASE_PROBES = [
88
88
  field: "status",
89
89
  from: "ACTIVE_HEALTHY",
90
90
  to: "RESTORING",
91
- action: "supabase.unclassified",
91
+ action: "supabase.project.change",
92
92
  summary: "Restore a backup of project {name}"
93
93
  },
94
94
  {
@@ -116,7 +116,7 @@ export const SUPABASE_PROBES = [
116
116
  },
117
117
  {
118
118
  on: "removed",
119
- action: "supabase.unclassified",
119
+ action: "supabase.project.change",
120
120
  summary: "Delete function {slug}"
121
121
  },
122
122
  {
@@ -130,7 +130,7 @@ export const SUPABASE_PROBES = [
130
130
  field: "verify_jwt",
131
131
  from: true,
132
132
  to: false,
133
- action: "supabase.unclassified",
133
+ action: "supabase.project.change",
134
134
  summary: "Turn off the JWT check on function {slug}"
135
135
  }
136
136
  ],
@@ -161,12 +161,12 @@ export const SUPABASE_PROBES = [
161
161
  changes: [
162
162
  {
163
163
  on: "added",
164
- action: "supabase.unclassified",
164
+ action: "supabase.project.change",
165
165
  summary: "Create branch {name}"
166
166
  },
167
167
  {
168
168
  on: "removed",
169
- action: "supabase.unclassified",
169
+ action: "supabase.project.change",
170
170
  summary: "Delete branch {name}"
171
171
  },
172
172
  {
@@ -210,7 +210,7 @@ export const SUPABASE_PROBES = [
210
210
  },
211
211
  {
212
212
  on: "removed",
213
- action: "supabase.unclassified",
213
+ action: "supabase.project.change",
214
214
  summary: "Remove migration {version} from history"
215
215
  }
216
216
  ],
@@ -228,18 +228,18 @@ export const SUPABASE_PROBES = [
228
228
  changes: [
229
229
  {
230
230
  on: "added",
231
- action: "supabase.unclassified",
231
+ action: "supabase.project.change",
232
232
  summary: "Set secret {name}"
233
233
  },
234
234
  {
235
235
  on: "changed",
236
236
  field: "updated_at",
237
- action: "supabase.unclassified",
237
+ action: "supabase.project.change",
238
238
  summary: "Set secret {name}"
239
239
  },
240
240
  {
241
241
  on: "removed",
242
- action: "supabase.unclassified",
242
+ action: "supabase.project.change",
243
243
  summary: "Delete secret {name}"
244
244
  }
245
245
  ],
@@ -256,18 +256,18 @@ export const SUPABASE_PROBES = [
256
256
  changes: [
257
257
  {
258
258
  on: "added",
259
- action: "supabase.unclassified",
259
+ action: "supabase.project.change",
260
260
  summary: "Create API key {name}"
261
261
  },
262
262
  {
263
263
  on: "removed",
264
- action: "supabase.unclassified",
264
+ action: "supabase.project.change",
265
265
  summary: "Delete API key {name}"
266
266
  },
267
267
  {
268
268
  on: "changed",
269
269
  field: "updated_at",
270
- action: "supabase.unclassified",
270
+ action: "supabase.project.change",
271
271
  summary: "Change API key {name}"
272
272
  }
273
273
  ],
@@ -285,18 +285,18 @@ export const SUPABASE_PROBES = [
285
285
  changes: [
286
286
  {
287
287
  on: "added",
288
- action: "supabase.unclassified",
288
+ action: "supabase.project.change",
289
289
  summary: "Create a JWT signing key"
290
290
  },
291
291
  {
292
292
  on: "removed",
293
- action: "supabase.unclassified",
293
+ action: "supabase.project.change",
294
294
  summary: "Delete a JWT signing key"
295
295
  },
296
296
  {
297
297
  on: "changed",
298
298
  field: "status",
299
- action: "supabase.unclassified",
299
+ action: "supabase.project.change",
300
300
  summary: "Change a JWT signing key to {status}"
301
301
  }
302
302
  ],
@@ -314,12 +314,12 @@ export const SUPABASE_PROBES = [
314
314
  changes: [
315
315
  {
316
316
  on: "added",
317
- action: "supabase.unclassified",
317
+ action: "supabase.project.change",
318
318
  summary: "Create bucket {name}"
319
319
  },
320
320
  {
321
321
  on: "removed",
322
- action: "supabase.unclassified",
322
+ action: "supabase.project.change",
323
323
  summary: "Delete bucket {name}"
324
324
  },
325
325
  {
@@ -335,7 +335,7 @@ export const SUPABASE_PROBES = [
335
335
  field: "public",
336
336
  from: true,
337
337
  to: false,
338
- action: "supabase.unclassified",
338
+ action: "supabase.project.change",
339
339
  summary: "Make bucket {name} private"
340
340
  }
341
341
  ],
@@ -353,7 +353,7 @@ export const SUPABASE_PROBES = [
353
353
  changes: [
354
354
  {
355
355
  on: "changed",
356
- action: "supabase.unclassified",
356
+ action: "supabase.project.change",
357
357
  summary: "Change storage settings"
358
358
  }
359
359
  ],
@@ -372,7 +372,7 @@ export const SUPABASE_PROBES = [
372
372
  {
373
373
  on: "changed",
374
374
  field: "config",
375
- action: "supabase.unclassified",
375
+ action: "supabase.project.change",
376
376
  summary: "Change network restrictions"
377
377
  }
378
378
  ],
@@ -393,7 +393,7 @@ export const SUPABASE_PROBES = [
393
393
  field: "currentConfig.database",
394
394
  from: true,
395
395
  to: false,
396
- action: "supabase.unclassified",
396
+ action: "supabase.project.change",
397
397
  summary: "Turn off SSL enforcement"
398
398
  },
399
399
  {
@@ -401,7 +401,7 @@ export const SUPABASE_PROBES = [
401
401
  field: "currentConfig.database",
402
402
  from: false,
403
403
  to: true,
404
- action: "supabase.unclassified",
404
+ action: "supabase.project.change",
405
405
  summary: "Turn on SSL enforcement"
406
406
  }
407
407
  ],
@@ -423,7 +423,7 @@ export const SUPABASE_PROBES = [
423
423
  field: "disable_signup",
424
424
  from: true,
425
425
  to: false,
426
- action: "supabase.unclassified",
426
+ action: "supabase.project.change",
427
427
  summary: "Open sign-ups"
428
428
  },
429
429
  {
@@ -431,7 +431,7 @@ export const SUPABASE_PROBES = [
431
431
  field: "mailer_autoconfirm",
432
432
  from: false,
433
433
  to: true,
434
- action: "supabase.unclassified",
434
+ action: "supabase.project.change",
435
435
  summary: "Turn off email confirmation"
436
436
  },
437
437
  {
@@ -513,18 +513,18 @@ export const SUPABASE_PROBES = [
513
513
  changes: [
514
514
  {
515
515
  on: "added",
516
- action: "supabase.unclassified",
516
+ action: "supabase.project.change",
517
517
  summary: "Add {type} add-on"
518
518
  },
519
519
  {
520
520
  on: "removed",
521
- action: "supabase.unclassified",
521
+ action: "supabase.project.change",
522
522
  summary: "Remove {type} add-on"
523
523
  },
524
524
  {
525
525
  on: "changed",
526
526
  field: "variant",
527
- action: "supabase.unclassified",
527
+ action: "supabase.project.change",
528
528
  summary: "Change {type} add-on"
529
529
  }
530
530
  ],
@@ -543,7 +543,7 @@ export const SUPABASE_PROBES = [
543
543
  {
544
544
  on: "changed",
545
545
  field: "pitr_enabled",
546
- action: "supabase.unclassified",
546
+ action: "supabase.project.change",
547
547
  summary: "Change point-in-time recovery"
548
548
  }
549
549
  ],
@@ -0,0 +1,5 @@
1
+ import type { ResourceTypeDef } from "../../controlPlane.generated.js";
2
+ import { type Manifest, type ManifestAction } from "../manifest.generated.js";
3
+ export declare const TERRAFORM_TYPES: readonly ResourceTypeDef[];
4
+ export declare const TERRAFORM_ACTIONS: readonly ManifestAction[];
5
+ export declare const TERRAFORM: Manifest;
@@ -0,0 +1,214 @@
1
+ import { MANIFEST_SCHEMA } from "../manifest.generated.js";
2
+ import { flagSpecs } from "./flagSpec.generated.js";
3
+ /**
4
+ * Terraform and OpenTofu (`terraform`, `tofu`) through the CLI guard (2026-11-21). No App setup: Terraform has no
5
+ * account Passport reads, so every workspace governs it and its nodes are the ones the guard names. The tree is the
6
+ * state Terraform writes to: the backend (an S3 bucket and key, a Terraform Cloud organization and workspace, or the
7
+ * folder's local state) and its workspaces. The guard reads the folder's backend and workspace from `.terraform/`
8
+ * (`terraformLink.ts`, never running Terraform for it), and reduces a saved plan to counts and resource-type names
9
+ * (`terraformPlan.ts`). Flags are Go's: one dash or two, `-out=plan` or `-out plan`.
10
+ */
11
+ const node = (type, label) => ({ type, label, service: "states", depth: "node" });
12
+ export const TERRAFORM_TYPES = [node("backend", "Backend"), node("workspace", "Workspace")];
13
+ /** Every action is on a workspace: what Terraform changes is the state one workspace holds. */
14
+ const ACTIONS = [
15
+ ["terraform.workspace.apply", "change", "Apply changes", "Rocket"],
16
+ ["terraform.workspace.destroy", "delete", "Destroy resources", "Trash2"],
17
+ ["terraform.workspace.test", "change", "Run tests", "FlaskConical"],
18
+ ["terraform.workspace.create", "create", "Create a workspace", "FolderPlus"],
19
+ ["terraform.workspace.delete", "delete", "Delete a workspace", "FolderX"],
20
+ ["terraform.state.change", "change", "Change state", "FilePen"],
21
+ ["terraform.state.remove", "delete", "Remove from state", "FileMinus"],
22
+ ["terraform.state.import", "create", "Import into state", "FileInput"],
23
+ ["terraform.state.push", "change", "Push a local state file", "FileUp"],
24
+ ["terraform.state.unlock", "change", "Force-unlock state", "LockOpen"],
25
+ // Anything the manifest can't name: its own kind, Unclassified (2026-11-17), never assumed to be a Delete.
26
+ ["terraform.unclassified", "unclassified", "Unclassified action", "CircleHelp"]
27
+ ];
28
+ export const TERRAFORM_ACTIONS = ACTIONS.map(([key, kind, label, icon]) => ({
29
+ key,
30
+ kind,
31
+ appliesTo: "workspace",
32
+ label,
33
+ icon
34
+ }));
35
+ /* ------------------------------------------------------------------ */
36
+ /* Flags (Terraform 1.10, OpenTofu 1.9) */
37
+ /* ------------------------------------------------------------------ */
38
+ /** Before the command: `-chdir=DIR` (another folder), help and version. */
39
+ const GLOBAL = flagSpecs("chdir= help h version v");
40
+ const LOCK = "lock= lock-timeout= ignore-remote-version";
41
+ const VARS = "var=+ var-file=+";
42
+ const STATE_FILES = "state= state-out= backup=";
43
+ const PLANNING = `${VARS} ${LOCK} destroy refresh-only refresh= replace=+ target=+ exclude=+ input= parallelism= ` +
44
+ "compact-warnings concise json no-color consolidate-warnings consolidate-errors";
45
+ const COMMANDS = {
46
+ plan: flagSpecs(`${PLANNING} out= detailed-exitcode generate-config-out= state= show-sensitive`),
47
+ apply: flagSpecs(`${PLANNING} auto-approve ${STATE_FILES} show-sensitive`),
48
+ destroy: flagSpecs(`${PLANNING} auto-approve ${STATE_FILES} show-sensitive`),
49
+ refresh: flagSpecs(`${VARS} ${LOCK} target=+ exclude=+ input= parallelism= compact-warnings no-color ${STATE_FILES}`),
50
+ show: flagSpecs("json no-color show-sensitive"),
51
+ output: flagSpecs("json raw no-color state= show-sensitive"),
52
+ validate: flagSpecs("json no-color no-tests test-directory="),
53
+ fmt: flagSpecs("list= write= diff check recursive no-color"),
54
+ graph: flagSpecs("type= plan= draw-cycles module-depth="),
55
+ init: flagSpecs(`${VARS} ${LOCK} backend= backend-config=+ cloud= force-copy from-module= get= input= no-color plugin-dir=+ ` +
56
+ "reconfigure migrate-state upgrade lockfile= json test-directory="),
57
+ get: flagSpecs("update no-color test-directory="),
58
+ console: flagSpecs(`${VARS} state= plan`),
59
+ test: flagSpecs(`${VARS} filter=+ json test-directory= verbose cloud-run= parallelism= junit-xml= no-color state=`),
60
+ import: flagSpecs(`${VARS} ${LOCK} config= allow-missing-config input= no-color provider= ${STATE_FILES}`),
61
+ taint: flagSpecs(`${LOCK} allow-missing ${STATE_FILES}`),
62
+ untaint: flagSpecs(`${LOCK} allow-missing ${STATE_FILES}`),
63
+ "force-unlock": flagSpecs("force"),
64
+ "state list": flagSpecs("state= id="),
65
+ "state show": flagSpecs("state= show-sensitive"),
66
+ "state pull": [],
67
+ "state rm": flagSpecs(`dry-run ${LOCK} ${STATE_FILES}`),
68
+ "state mv": flagSpecs(`dry-run ${LOCK} ${STATE_FILES}`),
69
+ "state push": flagSpecs(`force ${LOCK}`),
70
+ "state replace-provider": flagSpecs(`auto-approve ${LOCK} ${STATE_FILES}`),
71
+ "workspace new": flagSpecs(`${LOCK} state=`),
72
+ "workspace delete": flagSpecs(`force ${LOCK}`),
73
+ "workspace select": flagSpecs("or-create"),
74
+ "workspace list": [],
75
+ "workspace show": [],
76
+ "providers lock": flagSpecs("platform=+ fs-mirror= net-mirror= enable-plugin-cache"),
77
+ "providers mirror": flagSpecs("platform=+ lock-file="),
78
+ "providers schema": flagSpecs("json"),
79
+ version: flagSpecs("json"),
80
+ "metadata functions": flagSpecs("json"),
81
+ modules: flagSpecs("json")
82
+ };
83
+ /* ------------------------------------------------------------------ */
84
+ /* Rules */
85
+ /* ------------------------------------------------------------------ */
86
+ const rule = (match, action, summary, extra = {}) => ({
87
+ match,
88
+ action,
89
+ on: "workspace",
90
+ summary,
91
+ ...extra
92
+ });
93
+ const APPLY = "terraform.workspace.apply";
94
+ const DESTROY = "terraform.workspace.destroy";
95
+ const STATE = "terraform.state.change";
96
+ /** A workspace the command names, not the folder's: `workspace new staging`. */
97
+ const NAMED = { args: ["name"], from: { workspace: "name" } };
98
+ const DRY_RUN = "A dry run lists what it would change and changes nothing";
99
+ const CLI_RULES = [
100
+ // `apply -destroy` is a destroy; `-refresh-only` only updates the state from what exists.
101
+ rule("apply", DESTROY, "Destroy targeted resources", { when: { destroy: true, target: true } }),
102
+ rule("apply", DESTROY, "Destroy every resource", { when: { destroy: true } }),
103
+ rule("apply", STATE, "Refresh state from real infrastructure", { when: { "refresh-only": true } }),
104
+ rule("apply", APPLY, "Apply a saved plan", { args: ["plan"], when: { plan: true } }),
105
+ rule("apply", APPLY, "Apply changes", { args: ["plan"] }),
106
+ rule("destroy", DESTROY, "Destroy targeted resources", { when: { target: true } }),
107
+ rule("destroy", DESTROY, "Destroy every resource"),
108
+ rule("refresh", STATE, "Refresh state from real infrastructure"),
109
+ rule("test", "terraform.workspace.test", "Run tests"),
110
+ rule("init", STATE, "Move state to a new backend", { args: ["dir"], when: { "migrate-state": true } }),
111
+ rule("init", STATE, "Move state to a new backend", { args: ["dir"], when: { "force-copy": true } }),
112
+ rule("init", "read", "", {
113
+ args: ["dir"],
114
+ because: "Sets this folder up: downloads providers and modules, and reads the backend"
115
+ }),
116
+ rule("import", "terraform.state.import", "Import a resource into state", { args: ["address", "id"] }),
117
+ rule("taint", STATE, "Mark a resource for replacement", { args: ["address"] }),
118
+ rule("untaint", STATE, "Unmark a resource for replacement", { args: ["address"] }),
119
+ rule("force-unlock", "terraform.state.unlock", "Force-unlock state", { args: ["lockId"] }),
120
+ rule("state rm", "read", "", { args: ["...addresses"], when: { "dry-run": true }, because: DRY_RUN }),
121
+ rule("state rm", "terraform.state.remove", "Remove resources from state", { args: ["...addresses"] }),
122
+ rule("state mv", "read", "", { args: ["source", "destination"], when: { "dry-run": true }, because: DRY_RUN }),
123
+ rule("state mv", STATE, "Move a resource within state", { args: ["source", "destination"] }),
124
+ rule("state push", "terraform.state.push", "Push a local state file, forced", {
125
+ args: ["path"],
126
+ when: { force: true }
127
+ }),
128
+ rule("state push", "terraform.state.push", "Push a local state file", { args: ["path"] }),
129
+ rule("state replace-provider", STATE, "Replace a provider in state", { args: ["from", "to"] }),
130
+ rule("workspace new", "terraform.workspace.create", "Create workspace {name}", NAMED),
131
+ rule("workspace select", "terraform.workspace.create", "Select or create workspace {name}", {
132
+ ...NAMED,
133
+ when: { "or-create": true }
134
+ }),
135
+ rule("workspace select", "read", "", {
136
+ args: ["name"],
137
+ because: "Switches this folder's workspace; changes nothing remote"
138
+ }),
139
+ rule("workspace delete", "terraform.workspace.delete", "Delete workspace {name}, forced", {
140
+ ...NAMED,
141
+ when: { force: true }
142
+ }),
143
+ rule("workspace delete", "terraform.workspace.delete", "Delete workspace {name}", NAMED)
144
+ ];
145
+ /** What only reads, or writes only on this computer. */
146
+ const READS = {
147
+ plan: "Shows what an apply would do; writes a plan file only on this computer",
148
+ show: "Prints the state or a saved plan",
149
+ output: "Prints the state's outputs",
150
+ validate: "Checks the configuration on this computer",
151
+ fmt: "Rewrites only local files",
152
+ graph: "Prints the dependency graph",
153
+ get: "Downloads modules into this folder",
154
+ console: "Evaluates expressions against the state",
155
+ "state list": "Lists what the state holds",
156
+ "state show": "Prints one resource from the state",
157
+ "state pull": "Prints the state",
158
+ "workspace list": "Lists the backend's workspaces",
159
+ "workspace show": "Prints the current workspace",
160
+ "providers lock": "Writes the lock file on this computer",
161
+ "providers mirror": "Copies providers into a local folder",
162
+ "providers schema": "Prints provider schemas",
163
+ providers: "Lists the providers the configuration needs",
164
+ version: "Prints the version",
165
+ "metadata functions": "Prints the function signatures",
166
+ modules: "Lists the configuration's modules",
167
+ login: "Signs this computer in to Terraform Cloud",
168
+ logout: "Signs this computer out of Terraform Cloud"
169
+ };
170
+ export const TERRAFORM = {
171
+ schema: MANIFEST_SCHEMA,
172
+ platform: "terraform",
173
+ label: "Terraform",
174
+ // 1: the first manifest (2026-11-21).
175
+ version: 1,
176
+ plans: ["cli"],
177
+ identity: "member",
178
+ services: [{ key: "states", label: "State" }],
179
+ types: TERRAFORM_TYPES,
180
+ nodes: {
181
+ backend: { key: "{backend}", name: "{backendName}", parent: "service" },
182
+ workspace: { key: "{backend}#{workspace}", name: "{workspace}", parent: { type: "backend" } }
183
+ },
184
+ actions: TERRAFORM_ACTIONS,
185
+ capture: {
186
+ // The folder's backend and workspace, from `.terraform/` (`terraformLink.ts`).
187
+ params: {
188
+ backend: { cli: ["@linked.backend"] },
189
+ backendName: { cli: ["@linked.backendName"] },
190
+ workspace: { cli: ["@linked.workspace"] }
191
+ },
192
+ cli: {
193
+ programs: ["terraform", "tofu"],
194
+ framework: "go",
195
+ // TF_WORKSPACE picks the workspace; TF_CLI_ARGS adds flags and TF_DATA_DIR moves `.terraform/`, so either set
196
+ // on the command line fails closed.
197
+ env: { TF_WORKSPACE: "workspace" },
198
+ envPrefixes: ["TF_CLI_ARGS", "TF_DATA_DIR"],
199
+ infoFlags: ["help", "h", "version", "v"],
200
+ contextFlags: ["chdir"],
201
+ flags: { global: GLOBAL, commands: COMMANDS },
202
+ remoteFlags: [],
203
+ localFlags: [],
204
+ rules: CLI_RULES,
205
+ reads: READS
206
+ },
207
+ mcp: { prefixes: [], rules: [], reads: {} },
208
+ api: { base: "https://app.terraform.io", rules: [], reads: {} },
209
+ sql: {},
210
+ unclassified: "terraform.unclassified"
211
+ },
212
+ probes: [],
213
+ logs: []
214
+ };
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Where a Terraform command's state lives, read from the files Terraform itself keeps in the root module's folder
3
+ * (2026-11-21), never by running Terraform: `.terraform/terraform.tfstate` names the backend (`terraform init` writes
4
+ * it), `.terraform/environment` the selected workspace (what `terraform workspace show` prints), and `TF_WORKSPACE`
5
+ * wins over both. Only a backend's location is read (a bucket and key, an organization and workspace); a backend
6
+ * whose settings may hold credentials (a connection string, an address) is named by its type and the folder alone.
7
+ */
8
+ export type TerraformLink = {
9
+ /** The backend node's key: "s3:acme-state/network/terraform.tfstate", "local:infra/network". */
10
+ backend: string;
11
+ backendName: string;
12
+ workspace: string;
13
+ };
14
+ export declare const DEFAULT_WORKSPACE = "default";
15
+ /** The folder as a label: its last two segments ("infra/network"). */
16
+ export declare function folderLabel(folder: string): string;
17
+ export type LinkFiles = {
18
+ /** The root module's folder, absolute. */
19
+ folder: string;
20
+ /** `.terraform/terraform.tfstate`, as text. */
21
+ backendFile?: string;
22
+ /** `.terraform/environment`, as text. */
23
+ environmentFile?: string;
24
+ /** `TF_WORKSPACE`, when set. */
25
+ envWorkspace?: string;
26
+ };
27
+ /** The backend and workspace a command in this folder acts on. */
28
+ export declare function terraformLink(files: LinkFiles): TerraformLink;
29
+ /** A tfvars file or a folder named for production: "prod.tfvars", "production.auto.tfvars", ".../prod". */
30
+ export declare function productionHint(folder: string, varFiles: readonly string[]): boolean;
@@ -0,0 +1,73 @@
1
+ // Generated by scripts/generate-control-plane-classifier.mjs. Do not edit.
2
+ import { PRODUCTION_NAME } from "../../controlPlaneActions.generated.js";
3
+ const SAFE = /^[A-Za-z0-9][A-Za-z0-9._\-/:]{0,199}$/;
4
+ const WORKSPACE = /^[A-Za-z0-9][A-Za-z0-9._-]{0,89}$/;
5
+ export const DEFAULT_WORKSPACE = "default";
6
+ const text = (value) => typeof value === "string" && SAFE.test(value) && !value.includes("..") ? value : undefined;
7
+ /** The folder as a label: its last two segments ("infra/network"). */
8
+ export function folderLabel(folder) {
9
+ const parts = folder.split(/[\\/]/).filter(Boolean);
10
+ return parts.slice(-2).join("/") || "root";
11
+ }
12
+ /** A `workspaces { … }` block, as an object or a list of one. */
13
+ function workspacesOf(config) {
14
+ const block = Array.isArray(config.workspaces) ? config.workspaces[0] : config.workspaces;
15
+ return block && typeof block === "object" ? block : {};
16
+ }
17
+ function located(type, config) {
18
+ const join = (...parts) => (parts.every(Boolean) ? parts.join("/") : undefined);
19
+ let where;
20
+ switch (type) {
21
+ case "s3":
22
+ where = join(text(config.bucket), text(config.key));
23
+ break;
24
+ case "gcs":
25
+ where = join(text(config.bucket), text(config.prefix) ?? "default.tfstate");
26
+ break;
27
+ case "azurerm":
28
+ where = join(text(config.storage_account_name), text(config.container_name), text(config.key));
29
+ break;
30
+ case "remote":
31
+ case "cloud": {
32
+ const ws = workspacesOf(config);
33
+ where = join(text(config.organization), text(ws.name) ?? text(ws.prefix) ?? text(ws.project) ?? "tagged");
34
+ const host = text(config.hostname);
35
+ if (where && host && host !== "app.terraform.io")
36
+ where = `${host}/${where}`;
37
+ break;
38
+ }
39
+ default:
40
+ return null;
41
+ }
42
+ // The name people read: the state file's own name left off ("acme-state/network", not ".../terraform.tfstate").
43
+ return where
44
+ ? { key: `${type}:${where}`, name: where.replace(/\/?(?:terraform|default)?\.tfstate$/, "") || where }
45
+ : null;
46
+ }
47
+ /** The backend and workspace a command in this folder acts on. */
48
+ export function terraformLink(files) {
49
+ const label = folderLabel(files.folder);
50
+ let type = "local";
51
+ let config = {};
52
+ try {
53
+ const parsed = files.backendFile ? JSON.parse(files.backendFile) : {};
54
+ const backend = parsed.backend;
55
+ if (backend && typeof backend.type === "string" && /^[a-z0-9_]{1,40}$/.test(backend.type)) {
56
+ type = backend.type;
57
+ config = backend.config && typeof backend.config === "object" ? backend.config : {};
58
+ }
59
+ }
60
+ catch {
61
+ // An unreadable backend file: the folder's local state names it.
62
+ }
63
+ const found = located(type, config);
64
+ const backend = found ?? { key: `${type}:${label}`, name: type === "local" ? label : `${label} (${type})` };
65
+ const cloudName = type === "cloud" || type === "remote" ? text(workspacesOf(config).name) : undefined;
66
+ const chosen = [files.envWorkspace, cloudName, files.environmentFile?.trim()].find((name) => typeof name === "string" && WORKSPACE.test(name));
67
+ return { backend: backend.key, backendName: backend.name, workspace: chosen ?? DEFAULT_WORKSPACE };
68
+ }
69
+ /** A tfvars file or a folder named for production: "prod.tfvars", "production.auto.tfvars", ".../prod". */
70
+ export function productionHint(folder, varFiles) {
71
+ const base = (path) => path.split(/[\\/]/).filter(Boolean).pop() ?? "";
72
+ return (PRODUCTION_NAME.test(base(folder)) || varFiles.some((file) => PRODUCTION_NAME.test(base(file).replace(/\..*$/, ""))));
73
+ }
@@ -0,0 +1,48 @@
1
+ import type { Classification } from "../../controlPlane.generated.js";
2
+ /**
3
+ * A Terraform or OpenTofu plan, reduced on the guard's computer (2026-11-21): from `terraform show -json <planfile>`,
4
+ * how many resources it creates, updates, replaces and deletes, and the resource types whose change touches access
5
+ * (IAM, roles, policies) or makes something reachable by anyone (a public S3 ACL, an ingress rule open to 0.0.0.0/0).
6
+ * Plans hold secrets: values are read here only to answer those two questions and never leave; what leaves is the
7
+ * counts and resource-type names, written into the action's summary (`planSummary`), which the server reads back into
8
+ * effects (`terraformEffects.ts`).
9
+ */
10
+ export type TerraformPlan = {
11
+ create: number;
12
+ update: number;
13
+ replace: number;
14
+ delete: number;
15
+ /** Resource types whose change touches access, sorted, each once. */
16
+ access: string[];
17
+ /** Resource types a change makes reachable by anyone, sorted, each once. */
18
+ public: string[];
19
+ };
20
+ /** Where an apply's plan came from: the saved plan it was given, or the last `plan -out` this session made here. */
21
+ export type PlanSource = "saved" | "last";
22
+ /** Whether a resource's planned settings make it reachable by anyone. Read here only; never sent. */
23
+ export declare function makesPublic(type: string, after: unknown): boolean;
24
+ /** `terraform show -json <planfile>` (or `tofu show -json`), reduced; null when it isn't a plan. */
25
+ export declare function terraformPlanOf(json: unknown): TerraformPlan | null;
26
+ export declare const APPLY_KEY = "terraform.workspace.apply";
27
+ export declare const DESTROY_KEY = "terraform.workspace.destroy";
28
+ /** An apply's or destroy's summary from its plan: "Apply 7 changes, auto-approved (create 3, …)". */
29
+ export declare function planSummary(actionKey: string, plan: TerraformPlan, from: PlanSource, auto: boolean): string;
30
+ export type ParsedPlan = Omit<TerraformPlan, "access" | "public"> & {
31
+ total: number;
32
+ access: boolean;
33
+ public: boolean;
34
+ };
35
+ /** What an apply's or destroy's summary says its plan does; null when no plan was read. Pure. */
36
+ export declare function parsePlanSummary(summary: string): ParsedPlan | null;
37
+ /** What the guard knows beyond the kit's rule: the command's flags and arguments, and the plan it read. */
38
+ export type FinishInput = {
39
+ /** The normalized command's params (`-auto-approve` → "auto-approve", positional arguments as `$1`…). */
40
+ params: Readonly<Record<string, unknown>>;
41
+ plan?: {
42
+ plan: TerraformPlan;
43
+ from: PlanSource;
44
+ } | null;
45
+ };
46
+ /** A kit classification with what the guard knows written into its summary: the plan's counts and types, how many
47
+ * resources `state rm` removes, and `-auto-approve`. Never an address, a value or a path. Pure. */
48
+ export declare function finishTerraform(found: Classification, input: FinishInput): Classification;