@intentius/chant-lexicon-gcp 0.0.22 → 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/dist/integrity.json +7 -7
- package/dist/manifest.json +1 -1
- package/dist/rules/wgc101.ts +1 -1
- package/dist/skills/{chant-gke.md → chant-gcp-gke.md} +1 -1
- package/dist/skills/chant-gcp-patterns.md +3 -2
- package/dist/skills/chant-gcp-security.md +3 -2
- package/dist/skills/chant-gcp.md +360 -28
- package/package.json +5 -2
- package/src/composites/cloud-function.ts +23 -15
- package/src/composites/cloud-run-service.ts +20 -13
- package/src/composites/cloud-sql-instance.ts +31 -15
- package/src/composites/composites.test.ts +94 -62
- package/src/composites/gcs-bucket.ts +13 -9
- package/src/composites/gke-cluster.ts +91 -16
- package/src/composites/index.ts +13 -11
- package/src/composites/managed-certificate.ts +19 -15
- package/src/composites/memorystore-redis.ts +101 -0
- package/src/composites/private-service.ts +23 -15
- package/src/composites/pubsub-pipeline.ts +30 -18
- package/src/composites/secure-project.ts +42 -27
- package/src/composites/vpc-network.ts +52 -35
- package/src/index.ts +13 -11
- package/src/lint/post-synth/post-synth.test.ts +2 -1
- package/src/lint/post-synth/wgc101.test.ts +2 -1
- package/src/lint/post-synth/wgc101.ts +1 -1
- package/src/plugin.ts +92 -180
- package/src/skills/{chant-gke.md → chant-gcp-gke.md} +1 -1
- package/src/skills/chant-gcp-patterns.md +3 -2
- package/src/skills/chant-gcp-security.md +3 -2
- package/src/skills/chant-gcp.md +360 -28
package/src/plugin.ts
CHANGED
|
@@ -6,14 +6,16 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { createRequire } from "module";
|
|
9
|
-
import type { LexiconPlugin,
|
|
9
|
+
import type { LexiconPlugin, InitTemplateSet, ResourceMetadata } from "@intentius/chant/lexicon";
|
|
10
10
|
const require = createRequire(import.meta.url);
|
|
11
11
|
import type { LintRule } from "@intentius/chant/lint/rule";
|
|
12
|
-
import type { PostSynthCheck } from "@intentius/chant/lint/post-synth";
|
|
13
12
|
import type { TemplateParser } from "@intentius/chant/import/parser";
|
|
14
13
|
import type { TypeScriptGenerator } from "@intentius/chant/import/generator";
|
|
15
14
|
import type { CompletionContext, CompletionItem, HoverContext, HoverInfo } from "@intentius/chant/lsp/types";
|
|
16
|
-
import
|
|
15
|
+
import { discoverPostSynthChecks } from "@intentius/chant/lint/discover";
|
|
16
|
+
import { createSkillsLoader, createDiffTool, createCatalogResource } from "@intentius/chant/lexicon-plugin-helpers";
|
|
17
|
+
import { join, dirname } from "path";
|
|
18
|
+
import { fileURLToPath } from "url";
|
|
17
19
|
import { gcpSerializer } from "./serializer";
|
|
18
20
|
|
|
19
21
|
export const gcpPlugin: LexiconPlugin = {
|
|
@@ -27,37 +29,9 @@ export const gcpPlugin: LexiconPlugin = {
|
|
|
27
29
|
return [hardcodedProjectRule, hardcodedRegionRule, publicIamRule];
|
|
28
30
|
},
|
|
29
31
|
|
|
30
|
-
postSynthChecks()
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
const { wgc103 } = require("./lint/post-synth/wgc103");
|
|
34
|
-
const { wgc104 } = require("./lint/post-synth/wgc104");
|
|
35
|
-
const { wgc105 } = require("./lint/post-synth/wgc105");
|
|
36
|
-
const { wgc106 } = require("./lint/post-synth/wgc106");
|
|
37
|
-
const { wgc107 } = require("./lint/post-synth/wgc107");
|
|
38
|
-
const { wgc108 } = require("./lint/post-synth/wgc108");
|
|
39
|
-
const { wgc109 } = require("./lint/post-synth/wgc109");
|
|
40
|
-
const { wgc110 } = require("./lint/post-synth/wgc110");
|
|
41
|
-
const { wgc201 } = require("./lint/post-synth/wgc201");
|
|
42
|
-
const { wgc202 } = require("./lint/post-synth/wgc202");
|
|
43
|
-
const { wgc203 } = require("./lint/post-synth/wgc203");
|
|
44
|
-
const { wgc204 } = require("./lint/post-synth/wgc204");
|
|
45
|
-
const { wgc301 } = require("./lint/post-synth/wgc301");
|
|
46
|
-
const { wgc302 } = require("./lint/post-synth/wgc302");
|
|
47
|
-
const { wgc303 } = require("./lint/post-synth/wgc303");
|
|
48
|
-
const { wgc111 } = require("./lint/post-synth/wgc111");
|
|
49
|
-
const { wgc112 } = require("./lint/post-synth/wgc112");
|
|
50
|
-
const { wgc113 } = require("./lint/post-synth/wgc113");
|
|
51
|
-
const { wgc401 } = require("./lint/post-synth/wgc401");
|
|
52
|
-
const { wgc402 } = require("./lint/post-synth/wgc402");
|
|
53
|
-
const { wgc403 } = require("./lint/post-synth/wgc403");
|
|
54
|
-
return [
|
|
55
|
-
wgc101, wgc102, wgc103, wgc104, wgc105, wgc106, wgc107, wgc108, wgc109, wgc110,
|
|
56
|
-
wgc111, wgc112, wgc113,
|
|
57
|
-
wgc201, wgc202, wgc203, wgc204,
|
|
58
|
-
wgc301, wgc302, wgc303,
|
|
59
|
-
wgc401, wgc402, wgc403,
|
|
60
|
-
];
|
|
32
|
+
postSynthChecks() {
|
|
33
|
+
const postSynthDir = join(dirname(fileURLToPath(import.meta.url)), "lint", "post-synth");
|
|
34
|
+
return discoverPostSynthChecks(postSynthDir, import.meta.url);
|
|
61
35
|
},
|
|
62
36
|
|
|
63
37
|
intrinsics() {
|
|
@@ -353,50 +327,13 @@ export const bucketReader = new IAMPolicyMember({
|
|
|
353
327
|
return resources;
|
|
354
328
|
},
|
|
355
329
|
|
|
356
|
-
mcpTools()
|
|
357
|
-
return [
|
|
358
|
-
{
|
|
359
|
-
name: "diff",
|
|
360
|
-
description: "Compare current build output against previous output for GCP Config Connector manifests",
|
|
361
|
-
inputSchema: {
|
|
362
|
-
type: "object" as const,
|
|
363
|
-
properties: {
|
|
364
|
-
path: {
|
|
365
|
-
type: "string",
|
|
366
|
-
description: "Path to the infrastructure project directory",
|
|
367
|
-
},
|
|
368
|
-
},
|
|
369
|
-
required: ["path"],
|
|
370
|
-
},
|
|
371
|
-
async handler(params: Record<string, unknown>): Promise<unknown> {
|
|
372
|
-
const { diffCommand } = await import("@intentius/chant/cli/commands/diff");
|
|
373
|
-
const result = await diffCommand({
|
|
374
|
-
path: (params.path as string) ?? ".",
|
|
375
|
-
serializers: [gcpSerializer],
|
|
376
|
-
});
|
|
377
|
-
return result;
|
|
378
|
-
},
|
|
379
|
-
},
|
|
380
|
-
];
|
|
330
|
+
mcpTools() {
|
|
331
|
+
return [createDiffTool(gcpSerializer, "Compare current build output against previous output for GCP Config Connector manifests")];
|
|
381
332
|
},
|
|
382
333
|
|
|
383
|
-
mcpResources()
|
|
334
|
+
mcpResources() {
|
|
384
335
|
return [
|
|
385
|
-
|
|
386
|
-
uri: "resource-catalog",
|
|
387
|
-
name: "GCP Config Connector Resource Catalog",
|
|
388
|
-
description: "JSON list of all supported GCP Config Connector resource types",
|
|
389
|
-
mimeType: "application/json",
|
|
390
|
-
async handler(): Promise<string> {
|
|
391
|
-
const lexicon = require("./generated/lexicon-gcp.json") as Record<string, { resourceType: string; kind: string }>;
|
|
392
|
-
const entries = Object.entries(lexicon).map(([className, entry]) => ({
|
|
393
|
-
className,
|
|
394
|
-
resourceType: entry.resourceType,
|
|
395
|
-
kind: entry.kind,
|
|
396
|
-
}));
|
|
397
|
-
return JSON.stringify(entries);
|
|
398
|
-
},
|
|
399
|
-
},
|
|
336
|
+
createCatalogResource(import.meta.url, "GCP Config Connector Resource Catalog", "JSON list of all supported GCP Config Connector resource types", "lexicon-gcp.json"),
|
|
400
337
|
{
|
|
401
338
|
uri: "examples/basic-bucket",
|
|
402
339
|
name: "Basic GCS Bucket Example",
|
|
@@ -422,111 +359,86 @@ export const bucket = new StorageBucket({
|
|
|
422
359
|
];
|
|
423
360
|
},
|
|
424
361
|
|
|
425
|
-
skills
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
{
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
{
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
{
|
|
506
|
-
title: "Deploy GKE microservice",
|
|
507
|
-
input: "Deploy a GKE project end-to-end",
|
|
508
|
-
output: "npm run bootstrap && npm run deploy",
|
|
509
|
-
},
|
|
510
|
-
],
|
|
511
|
-
},
|
|
512
|
-
];
|
|
513
|
-
|
|
514
|
-
for (const skill of skillFiles) {
|
|
515
|
-
try {
|
|
516
|
-
const content = readFileSync(join(dir, "skills", skill.file), "utf-8");
|
|
517
|
-
skills.push({
|
|
518
|
-
name: skill.name,
|
|
519
|
-
description: skill.description,
|
|
520
|
-
content,
|
|
521
|
-
triggers: skill.triggers,
|
|
522
|
-
parameters: skill.parameters,
|
|
523
|
-
examples: skill.examples,
|
|
524
|
-
});
|
|
525
|
-
} catch { /* skip missing skills */ }
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
return skills;
|
|
529
|
-
},
|
|
362
|
+
skills: createSkillsLoader(import.meta.url, [
|
|
363
|
+
{
|
|
364
|
+
file: "chant-gcp.md",
|
|
365
|
+
name: "chant-gcp",
|
|
366
|
+
description: "Build, validate, and deploy GCP Config Connector manifests from a chant project",
|
|
367
|
+
triggers: [
|
|
368
|
+
{ type: "file-pattern" as const, value: "*.gcp.ts" },
|
|
369
|
+
{ type: "context" as const, value: "gcp" },
|
|
370
|
+
],
|
|
371
|
+
parameters: [
|
|
372
|
+
{
|
|
373
|
+
name: "resourceType",
|
|
374
|
+
type: "string",
|
|
375
|
+
description: "GCP Config Connector resource type to work with",
|
|
376
|
+
},
|
|
377
|
+
],
|
|
378
|
+
examples: [
|
|
379
|
+
{
|
|
380
|
+
title: "Create a Storage Bucket",
|
|
381
|
+
output: "new StorageBucket({ location: \"US\", storageClass: \"STANDARD\" })",
|
|
382
|
+
},
|
|
383
|
+
{
|
|
384
|
+
title: "Create a GKE Cluster",
|
|
385
|
+
output: "new GKECluster({ location: GCP.Region, releaseChannel: { channel: \"REGULAR\" } })",
|
|
386
|
+
},
|
|
387
|
+
],
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
file: "chant-gcp-security.md",
|
|
391
|
+
name: "chant-gcp-security",
|
|
392
|
+
description: "GCP security best practices for infrastructure",
|
|
393
|
+
triggers: [
|
|
394
|
+
{ type: "context" as const, value: "gcp security" },
|
|
395
|
+
{ type: "context" as const, value: "gcp iam" },
|
|
396
|
+
],
|
|
397
|
+
parameters: [],
|
|
398
|
+
examples: [
|
|
399
|
+
{
|
|
400
|
+
title: "Secure Storage Bucket",
|
|
401
|
+
input: "Create a storage bucket with encryption and uniform access",
|
|
402
|
+
output: "import { GcsBucket } from \"@intentius/chant-lexicon-gcp\";\n\nconst { bucket } = GcsBucket({ name: \"my-bucket\", kmsKeyName: \"...\" });",
|
|
403
|
+
},
|
|
404
|
+
],
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
file: "chant-gcp-patterns.md",
|
|
408
|
+
name: "chant-gcp-patterns",
|
|
409
|
+
description: "Advanced GCP Config Connector patterns",
|
|
410
|
+
triggers: [
|
|
411
|
+
{ type: "context" as const, value: "gcp patterns" },
|
|
412
|
+
{ type: "context" as const, value: "gcp composites" },
|
|
413
|
+
],
|
|
414
|
+
parameters: [],
|
|
415
|
+
examples: [
|
|
416
|
+
{
|
|
417
|
+
title: "VPC with Subnets",
|
|
418
|
+
input: "Create a VPC network with private subnets",
|
|
419
|
+
output: "import { VpcNetwork } from \"@intentius/chant-lexicon-gcp\";\n\nconst { network, subnets } = VpcNetwork({ name: \"my-vpc\", subnets: [...] });",
|
|
420
|
+
},
|
|
421
|
+
],
|
|
422
|
+
},
|
|
423
|
+
{
|
|
424
|
+
file: "chant-gcp-gke.md",
|
|
425
|
+
name: "chant-gcp-gke",
|
|
426
|
+
description: "End-to-end GKE workflow bridging GCP infrastructure and Kubernetes workloads",
|
|
427
|
+
triggers: [
|
|
428
|
+
{ type: "context" as const, value: "gke" },
|
|
429
|
+
{ type: "context" as const, value: "gcp kubernetes" },
|
|
430
|
+
{ type: "context" as const, value: "config connector" },
|
|
431
|
+
],
|
|
432
|
+
parameters: [],
|
|
433
|
+
examples: [
|
|
434
|
+
{
|
|
435
|
+
title: "Deploy GKE microservice",
|
|
436
|
+
input: "Deploy a GKE project end-to-end",
|
|
437
|
+
output: "npm run bootstrap && npm run deploy",
|
|
438
|
+
},
|
|
439
|
+
],
|
|
440
|
+
},
|
|
441
|
+
]),
|
|
530
442
|
|
|
531
443
|
async generate(options?: { verbose?: boolean }): Promise<void> {
|
|
532
444
|
const { generate, writeGeneratedFiles } = await import("./codegen/generate");
|