@aetherwing/fcp-terraform 0.1.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/LICENSE +21 -0
- package/README.md +252 -0
- package/dist/adapter.d.ts +14 -0
- package/dist/adapter.js +266 -0
- package/dist/hcl.d.ts +5 -0
- package/dist/hcl.js +176 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +14 -0
- package/dist/model.d.ts +38 -0
- package/dist/model.js +233 -0
- package/dist/ops.d.ts +4 -0
- package/dist/ops.js +346 -0
- package/dist/queries.d.ts +4 -0
- package/dist/queries.js +250 -0
- package/dist/types.d.ts +115 -0
- package/dist/types.js +1 -0
- package/dist/verbs.d.ts +3 -0
- package/dist/verbs.js +40 -0
- package/package.json +46 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kind of Terraform block.
|
|
3
|
+
*/
|
|
4
|
+
export type BlockKind = "resource" | "data" | "provider" | "variable" | "output" | "locals" | "module";
|
|
5
|
+
/**
|
|
6
|
+
* A single attribute on a block.
|
|
7
|
+
*/
|
|
8
|
+
export interface Attribute {
|
|
9
|
+
key: string;
|
|
10
|
+
value: string;
|
|
11
|
+
valueType: "string" | "number" | "bool" | "list" | "map" | "reference" | "expression";
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* A nested block within a resource (e.g., ingress {}, root_block_device {}).
|
|
15
|
+
*/
|
|
16
|
+
export interface NestedBlock {
|
|
17
|
+
id: string;
|
|
18
|
+
type: string;
|
|
19
|
+
attributes: Map<string, Attribute>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* A top-level Terraform block (resource, provider, variable, output, data, module).
|
|
23
|
+
*/
|
|
24
|
+
export interface TfBlock {
|
|
25
|
+
id: string;
|
|
26
|
+
kind: BlockKind;
|
|
27
|
+
label: string;
|
|
28
|
+
fullType: string;
|
|
29
|
+
provider: string;
|
|
30
|
+
attributes: Map<string, Attribute>;
|
|
31
|
+
nestedBlocks: NestedBlock[];
|
|
32
|
+
tags: Map<string, string>;
|
|
33
|
+
meta: {
|
|
34
|
+
count?: string;
|
|
35
|
+
forEach?: string;
|
|
36
|
+
dependsOn: string[];
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* A dependency connection between two blocks.
|
|
41
|
+
*/
|
|
42
|
+
export interface Connection {
|
|
43
|
+
id: string;
|
|
44
|
+
sourceId: string;
|
|
45
|
+
targetId: string;
|
|
46
|
+
sourceLabel: string;
|
|
47
|
+
targetLabel: string;
|
|
48
|
+
label?: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The full in-memory Terraform configuration.
|
|
52
|
+
*/
|
|
53
|
+
export interface TerraformConfig {
|
|
54
|
+
id: string;
|
|
55
|
+
title: string;
|
|
56
|
+
filePath: string | null;
|
|
57
|
+
blocks: Map<string, TfBlock>;
|
|
58
|
+
connections: Map<string, Connection>;
|
|
59
|
+
blockOrder: string[];
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Events for undo/redo.
|
|
63
|
+
*/
|
|
64
|
+
export type TerraformEvent = {
|
|
65
|
+
type: "block_added";
|
|
66
|
+
block: TfBlock;
|
|
67
|
+
} | {
|
|
68
|
+
type: "block_removed";
|
|
69
|
+
block: TfBlock;
|
|
70
|
+
} | {
|
|
71
|
+
type: "attribute_set";
|
|
72
|
+
blockId: string;
|
|
73
|
+
key: string;
|
|
74
|
+
before: Attribute | null;
|
|
75
|
+
after: Attribute;
|
|
76
|
+
} | {
|
|
77
|
+
type: "attribute_removed";
|
|
78
|
+
blockId: string;
|
|
79
|
+
key: string;
|
|
80
|
+
before: Attribute;
|
|
81
|
+
} | {
|
|
82
|
+
type: "nested_block_added";
|
|
83
|
+
blockId: string;
|
|
84
|
+
nestedBlock: NestedBlock;
|
|
85
|
+
} | {
|
|
86
|
+
type: "nested_block_removed";
|
|
87
|
+
blockId: string;
|
|
88
|
+
nestedBlock: NestedBlock;
|
|
89
|
+
} | {
|
|
90
|
+
type: "connection_added";
|
|
91
|
+
connection: Connection;
|
|
92
|
+
} | {
|
|
93
|
+
type: "connection_removed";
|
|
94
|
+
connection: Connection;
|
|
95
|
+
} | {
|
|
96
|
+
type: "tag_set";
|
|
97
|
+
blockId: string;
|
|
98
|
+
key: string;
|
|
99
|
+
before: string | null;
|
|
100
|
+
after: string;
|
|
101
|
+
} | {
|
|
102
|
+
type: "tag_removed";
|
|
103
|
+
blockId: string;
|
|
104
|
+
key: string;
|
|
105
|
+
before: string;
|
|
106
|
+
} | {
|
|
107
|
+
type: "block_renamed";
|
|
108
|
+
blockId: string;
|
|
109
|
+
before: string;
|
|
110
|
+
after: string;
|
|
111
|
+
} | {
|
|
112
|
+
type: "title_changed";
|
|
113
|
+
before: string;
|
|
114
|
+
after: string;
|
|
115
|
+
};
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/verbs.d.ts
ADDED
package/dist/verbs.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export const VERB_SPECS = [
|
|
2
|
+
// Resources & Providers
|
|
3
|
+
{ verb: "add", syntax: 'add resource TYPE LABEL [key:value...]', category: "Resources", description: "Add a resource, provider, variable, output, data source, or module" },
|
|
4
|
+
{ verb: "add", syntax: 'add provider PROVIDER [region:R] [key:value...]', category: "Resources" },
|
|
5
|
+
{ verb: "add", syntax: 'add variable NAME [type:T] [default:V] [description:D]', category: "Resources" },
|
|
6
|
+
{ verb: "add", syntax: 'add output NAME value:EXPR [description:D]', category: "Resources" },
|
|
7
|
+
{ verb: "add", syntax: 'add data TYPE LABEL [key:value...]', category: "Resources" },
|
|
8
|
+
{ verb: "add", syntax: 'add module LABEL source:PATH [key:value...]', category: "Resources" },
|
|
9
|
+
// Connections
|
|
10
|
+
{ verb: "connect", syntax: 'connect SRC -> TGT [label:TEXT]', category: "Connections", description: "Create a dependency between two blocks" },
|
|
11
|
+
{ verb: "disconnect", syntax: 'disconnect SRC -> TGT', category: "Connections", description: "Remove a dependency" },
|
|
12
|
+
// Editing
|
|
13
|
+
{ verb: "set", syntax: 'set LABEL key:value [key:value...]', category: "Editing", description: "Set attributes on an existing block" },
|
|
14
|
+
{ verb: "unset", syntax: 'unset LABEL KEY [KEY...]', category: "Editing", description: "Remove attributes from a block" },
|
|
15
|
+
{ verb: "remove", syntax: 'remove LABEL | remove @SELECTOR', category: "Editing", description: "Remove a block by label or selector" },
|
|
16
|
+
{ verb: "label", syntax: 'label OLD_LABEL "new_label"', category: "Editing", description: "Rename a block" },
|
|
17
|
+
{ verb: "style", syntax: 'style LABEL tags:"Key=Val,Key2=Val2"', category: "Editing", description: "Set tags on a resource" },
|
|
18
|
+
{ verb: "nest", syntax: 'nest LABEL BLOCK_TYPE [key:value...]', category: "Editing", description: "Add a nested block (e.g., ingress, root_block_device)" },
|
|
19
|
+
];
|
|
20
|
+
export const REFERENCE_CARD_SECTIONS = {
|
|
21
|
+
"Selectors": [
|
|
22
|
+
" @type:aws_instance All resources of a given type",
|
|
23
|
+
" @provider:aws All blocks from a given provider",
|
|
24
|
+
" @kind:resource All blocks of kind (resource, variable, output, data)",
|
|
25
|
+
" @tag:KEY or @tag:KEY=VAL Blocks matching a tag",
|
|
26
|
+
" @all All blocks",
|
|
27
|
+
].join("\n"),
|
|
28
|
+
"Response Prefixes": [
|
|
29
|
+
" + block created ~ connection created/modified",
|
|
30
|
+
" * block modified - block/connection removed",
|
|
31
|
+
" ! meta operation @ bulk operation",
|
|
32
|
+
].join("\n"),
|
|
33
|
+
"Conventions": [
|
|
34
|
+
" - Labels are unique short names — no full type paths needed",
|
|
35
|
+
" - Provider auto-detected from resource type prefix (aws_, google_, azurerm_)",
|
|
36
|
+
" - Use `plan` query to preview generated HCL without saving",
|
|
37
|
+
" - Use `graph` query to visualize dependency graph",
|
|
38
|
+
" - Call terraform_help for full reference",
|
|
39
|
+
].join("\n"),
|
|
40
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@aetherwing/fcp-terraform",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "MCP server for Terraform HCL generation through intent-level commands",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "tsc",
|
|
19
|
+
"test": "vitest run"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@aetherwing/fcp-core": "^0.1.0",
|
|
23
|
+
"@modelcontextprotocol/sdk": "^1.27.1"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@cdktf/hcl2json": "^0.21.0",
|
|
27
|
+
"@types/node": "^22.15.2",
|
|
28
|
+
"typescript": "^5.8.3",
|
|
29
|
+
"vitest": "^3.1.1"
|
|
30
|
+
},
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=22"
|
|
33
|
+
},
|
|
34
|
+
"license": "MIT",
|
|
35
|
+
"repository": {
|
|
36
|
+
"type": "git",
|
|
37
|
+
"url": "https://github.com/aetherwing-io/fcp-terraform"
|
|
38
|
+
},
|
|
39
|
+
"keywords": [
|
|
40
|
+
"terraform",
|
|
41
|
+
"hcl",
|
|
42
|
+
"infrastructure",
|
|
43
|
+
"mcp",
|
|
44
|
+
"fcp"
|
|
45
|
+
]
|
|
46
|
+
}
|