@codedrifters/configulator 0.0.163 → 0.0.165
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/lib/index.d.mts +6 -1
- package/lib/index.d.ts +6 -1
- package/lib/index.js +200 -24
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +199 -24
- package/lib/index.mjs.map +1 -1
- package/package.json +1 -1
package/lib/index.mjs
CHANGED
|
@@ -262,6 +262,37 @@ var awsCdkBundle = {
|
|
|
262
262
|
"}",
|
|
263
263
|
"```",
|
|
264
264
|
"",
|
|
265
|
+
"## L2 Over L1 Construct Preference",
|
|
266
|
+
"",
|
|
267
|
+
"- Always prefer L2 constructs (e.g., `s3.Bucket`, `lambda.Function`) over L1 escape hatches (`CfnBucket`, `CfnFunction`)",
|
|
268
|
+
"- Only drop to L1 when the L2 construct is missing the feature you need or does not exist yet",
|
|
269
|
+
"- When using L1, add a comment explaining why the L2 was insufficient",
|
|
270
|
+
"",
|
|
271
|
+
"## Filename / Class Name Matching",
|
|
272
|
+
"",
|
|
273
|
+
"- Kebab-case filenames must mirror PascalCase class names (e.g., `my-construct.ts` \u2192 `MyConstruct`)",
|
|
274
|
+
"- One primary construct per file; supporting types (props interface, enums) live in the same file",
|
|
275
|
+
"- Test files follow the same pattern: `my-construct.spec.ts`",
|
|
276
|
+
"",
|
|
277
|
+
"## Cross-Stack Lookup Patterns",
|
|
278
|
+
"",
|
|
279
|
+
"- Lookups live on **service classes**, not component/construct classes",
|
|
280
|
+
"- Use static methods for cross-stack lookups so consumers don't need an instance:",
|
|
281
|
+
"",
|
|
282
|
+
"```typescript",
|
|
283
|
+
"export class MyService {",
|
|
284
|
+
" /** Look up a resource from another stack via SSM. */",
|
|
285
|
+
" public static lookupArn(scope: Construct, id: string): string {",
|
|
286
|
+
" return StringParameter.valueForStringParameter(",
|
|
287
|
+
" scope,",
|
|
288
|
+
" `/my-app/my-resource-arn`,",
|
|
289
|
+
" );",
|
|
290
|
+
" }",
|
|
291
|
+
"}",
|
|
292
|
+
"```",
|
|
293
|
+
"",
|
|
294
|
+
"- Store outputs in SSM parameters with well-known paths; do not pass values between stacks via props",
|
|
295
|
+
"",
|
|
265
296
|
"## AWS Best Practices",
|
|
266
297
|
"",
|
|
267
298
|
"- Use AWS CDK v2 (`aws-cdk-lib`)",
|
|
@@ -275,8 +306,30 @@ var awsCdkBundle = {
|
|
|
275
306
|
"",
|
|
276
307
|
"- Mock `Code.fromAsset` in any test file that synthesizes CDK stacks",
|
|
277
308
|
"- Use static S3 values (`mock-assets-bucket`, `mock-asset-key.zip`) so snapshots are stable",
|
|
278
|
-
"- Add the mock in `beforeAll` and restore in `afterAll
|
|
279
|
-
"
|
|
309
|
+
"- Add the mock in `beforeAll` and restore in `afterAll`:",
|
|
310
|
+
"",
|
|
311
|
+
"```typescript",
|
|
312
|
+
"let fromAssetMock: MockInstance;",
|
|
313
|
+
"",
|
|
314
|
+
"beforeAll(() => {",
|
|
315
|
+
' fromAssetMock = vi.spyOn(Code, "fromAsset").mockReturnValue({',
|
|
316
|
+
" isInline: false,",
|
|
317
|
+
" bind: () => ({",
|
|
318
|
+
" s3Location: {",
|
|
319
|
+
' bucketName: "mock-assets-bucket",',
|
|
320
|
+
' objectKey: "mock-asset-key.zip",',
|
|
321
|
+
" },",
|
|
322
|
+
" }),",
|
|
323
|
+
" } as unknown as AssetCode);",
|
|
324
|
+
"});",
|
|
325
|
+
"",
|
|
326
|
+
"afterAll(() => {",
|
|
327
|
+
" fromAssetMock.mockRestore();",
|
|
328
|
+
"});",
|
|
329
|
+
"```",
|
|
330
|
+
"",
|
|
331
|
+
"- Normalize the template before snapshotting when the stack includes asset-based Lambdas",
|
|
332
|
+
"- Use `Template.fromStack(stack)` and assert with `hasResourceProperties` for targeted checks"
|
|
280
333
|
].join("\n"),
|
|
281
334
|
tags: ["infrastructure"]
|
|
282
335
|
}
|
|
@@ -585,6 +638,98 @@ var baseBundle = {
|
|
|
585
638
|
]
|
|
586
639
|
};
|
|
587
640
|
|
|
641
|
+
// src/agent/bundles/github-workflow.ts
|
|
642
|
+
import { GitHub } from "projen/lib/github";
|
|
643
|
+
var githubWorkflowBundle = {
|
|
644
|
+
name: "github-workflow",
|
|
645
|
+
description: "GitHub issue and PR workflow automation patterns",
|
|
646
|
+
appliesWhen: (project) => hasComponent(project, GitHub),
|
|
647
|
+
rules: [
|
|
648
|
+
{
|
|
649
|
+
name: "issue-workflow",
|
|
650
|
+
description: "Automated workflow for starting work on a GitHub issue",
|
|
651
|
+
scope: AGENT_RULE_SCOPE.ALWAYS,
|
|
652
|
+
content: [
|
|
653
|
+
"# Issue Workflow",
|
|
654
|
+
"",
|
|
655
|
+
'## "Work on issue X" Automation',
|
|
656
|
+
"",
|
|
657
|
+
"When the user says **work on issue X** (or similar), follow these steps exactly:",
|
|
658
|
+
"",
|
|
659
|
+
"1. **Fetch issue details** \u2014 use `gh issue view <number>` to get the title, body, and labels",
|
|
660
|
+
"2. **Determine branch type** from the issue title prefix:",
|
|
661
|
+
" - `feat:` / `feature:` \u2192 `feat/`",
|
|
662
|
+
" - `fix:` / `bug:` \u2192 `fix/`",
|
|
663
|
+
" - `docs:` \u2192 `docs/`",
|
|
664
|
+
" - `chore:` / `refactor:` \u2192 `chore/`",
|
|
665
|
+
" - `test:` \u2192 `test/`",
|
|
666
|
+
" - No prefix \u2192 `feat/`",
|
|
667
|
+
"3. **Create a branch** following the naming convention: `<type>/<short-slug>-<issue-number>` (e.g., `feat/add-login-42`)",
|
|
668
|
+
"4. **Checkout the branch** locally",
|
|
669
|
+
"5. **Link the branch to the issue** by posting a comment: `gh issue comment <number> --body 'Branch: \\`<branch-name>\\`'`",
|
|
670
|
+
"6. **Stop and wait** for user instructions \u2014 do **NOT** start implementing",
|
|
671
|
+
"",
|
|
672
|
+
"### Important",
|
|
673
|
+
"",
|
|
674
|
+
"- Never begin implementation without explicit user direction",
|
|
675
|
+
"- If the issue title has no conventional prefix, default to `feat/`",
|
|
676
|
+
"- Keep the slug short (3-5 words max, kebab-case)"
|
|
677
|
+
].join("\n"),
|
|
678
|
+
tags: ["workflow"]
|
|
679
|
+
},
|
|
680
|
+
{
|
|
681
|
+
name: "pr-workflow",
|
|
682
|
+
description: "Automated workflow for opening a pull request",
|
|
683
|
+
scope: AGENT_RULE_SCOPE.ALWAYS,
|
|
684
|
+
content: [
|
|
685
|
+
"# PR Workflow",
|
|
686
|
+
"",
|
|
687
|
+
'## "Open a PR" Automation',
|
|
688
|
+
"",
|
|
689
|
+
"When the user says **open a PR** (or similar), follow these steps exactly:",
|
|
690
|
+
"",
|
|
691
|
+
"1. **Check for uncommitted changes** \u2014 if any exist, commit them with a conventional commit message",
|
|
692
|
+
"2. **Push the branch** to origin: `git push -u origin <branch>`",
|
|
693
|
+
"3. **Create the PR** using `gh pr create`:",
|
|
694
|
+
" - **Title**: use a conventional commit style title (e.g., `feat(scope): short description`)",
|
|
695
|
+
" - **Body**: include `Closes #<issue-number>` (derived from the branch name) and a brief summary of changes",
|
|
696
|
+
"4. **Display merge dialog text** for the user to copy-paste when merging:",
|
|
697
|
+
"",
|
|
698
|
+
"```",
|
|
699
|
+
"Commit message:",
|
|
700
|
+
"<conventional-commit-title>",
|
|
701
|
+
"",
|
|
702
|
+
"Extended description:",
|
|
703
|
+
"- Bullet points summarizing the changes",
|
|
704
|
+
"- Closes #<issue-number>",
|
|
705
|
+
"```",
|
|
706
|
+
"",
|
|
707
|
+
"### PR Body Template",
|
|
708
|
+
"",
|
|
709
|
+
"```markdown",
|
|
710
|
+
"## Summary",
|
|
711
|
+
"",
|
|
712
|
+
"<1-3 bullet points describing what changed and why>",
|
|
713
|
+
"",
|
|
714
|
+
"Closes #<issue-number>",
|
|
715
|
+
"",
|
|
716
|
+
"## Test Plan",
|
|
717
|
+
"",
|
|
718
|
+
"- [ ] Tests pass locally",
|
|
719
|
+
"- [ ] Relevant changes have been reviewed",
|
|
720
|
+
"```",
|
|
721
|
+
"",
|
|
722
|
+
"### Important",
|
|
723
|
+
"",
|
|
724
|
+
"- Always derive the issue number from the branch name (e.g., `feat/add-login-42` \u2192 `#42`)",
|
|
725
|
+
"- Use conventional commit format for the PR title",
|
|
726
|
+
"- Do not merge the PR \u2014 only create it and display the merge text"
|
|
727
|
+
].join("\n"),
|
|
728
|
+
tags: ["workflow"]
|
|
729
|
+
}
|
|
730
|
+
]
|
|
731
|
+
};
|
|
732
|
+
|
|
588
733
|
// src/agent/bundles/jest.ts
|
|
589
734
|
var jestBundle = {
|
|
590
735
|
name: "jest",
|
|
@@ -785,7 +930,35 @@ var projenBundle = {
|
|
|
785
930
|
"- Edit Projen configuration in:",
|
|
786
931
|
" - `.projenrc.ts` (root)",
|
|
787
932
|
" - `projenrc/*.ts` (package-specific)",
|
|
788
|
-
"- After making Projen changes,
|
|
933
|
+
"- After making Projen changes, run `npx projen` to synthesize",
|
|
934
|
+
"",
|
|
935
|
+
"## Workspace Dependencies",
|
|
936
|
+
"",
|
|
937
|
+
"When adding dependencies between packages in a monorepo:",
|
|
938
|
+
"",
|
|
939
|
+
'- Use the workspace protocol: `project.addDeps("@org/sibling-pkg@workspace:*")`',
|
|
940
|
+
"- This ensures the local version is always resolved, not a registry version",
|
|
941
|
+
'- For dev dependencies: `project.addDevDeps("@org/sibling-pkg@workspace:*")`',
|
|
942
|
+
"",
|
|
943
|
+
"## The `configureMyProject` Pattern",
|
|
944
|
+
"",
|
|
945
|
+
"Each package should expose a `configureMyProject(options)` factory function that creates and configures its Projen project:",
|
|
946
|
+
"",
|
|
947
|
+
"```typescript",
|
|
948
|
+
"export function configureMyProject(",
|
|
949
|
+
" options: MyProjectOptions,",
|
|
950
|
+
"): TypeScriptProject {",
|
|
951
|
+
" const project = new TypeScriptProject({",
|
|
952
|
+
" ...options,",
|
|
953
|
+
" // package-specific defaults",
|
|
954
|
+
" });",
|
|
955
|
+
"",
|
|
956
|
+
" // Attach components, configure rules, etc.",
|
|
957
|
+
" return project;",
|
|
958
|
+
"}",
|
|
959
|
+
"```",
|
|
960
|
+
"",
|
|
961
|
+
"This pattern keeps `.projenrc.ts` clean and makes package configuration reusable and testable.",
|
|
789
962
|
"",
|
|
790
963
|
"## Custom Projen Components",
|
|
791
964
|
"",
|
|
@@ -1393,7 +1566,8 @@ var BUILT_IN_BUNDLES = [
|
|
|
1393
1566
|
turborepoBundle,
|
|
1394
1567
|
pnpmBundle,
|
|
1395
1568
|
awsCdkBundle,
|
|
1396
|
-
projenBundle
|
|
1569
|
+
projenBundle,
|
|
1570
|
+
githubWorkflowBundle
|
|
1397
1571
|
];
|
|
1398
1572
|
|
|
1399
1573
|
// src/projects/project-metadata.ts
|
|
@@ -2224,7 +2398,7 @@ ${extra}`
|
|
|
2224
2398
|
};
|
|
2225
2399
|
|
|
2226
2400
|
// src/aws/aws-deployment-config.ts
|
|
2227
|
-
var
|
|
2401
|
+
var import_utils9 = __toESM(require_lib());
|
|
2228
2402
|
import { join, relative as relative2 } from "path";
|
|
2229
2403
|
import { Component as Component9 } from "projen";
|
|
2230
2404
|
var AwsDeploymentConfig = class _AwsDeploymentConfig extends Component9 {
|
|
@@ -2282,17 +2456,17 @@ var AwsDeploymentConfig = class _AwsDeploymentConfig extends Component9 {
|
|
|
2282
2456
|
*/
|
|
2283
2457
|
get prodTargets() {
|
|
2284
2458
|
return this.awsDeploymentTargets.filter(
|
|
2285
|
-
(target) => target.awsStageType ===
|
|
2459
|
+
(target) => target.awsStageType === import_utils9.AWS_STAGE_TYPE.PROD
|
|
2286
2460
|
);
|
|
2287
2461
|
}
|
|
2288
2462
|
get prodTargetsForCI() {
|
|
2289
2463
|
return this.awsDeploymentTargets.filter(
|
|
2290
|
-
(target) => target.awsStageType ===
|
|
2464
|
+
(target) => target.awsStageType === import_utils9.AWS_STAGE_TYPE.PROD && target.ciDeployment
|
|
2291
2465
|
);
|
|
2292
2466
|
}
|
|
2293
2467
|
get prodTargetsForLocal() {
|
|
2294
2468
|
return this.awsDeploymentTargets.filter(
|
|
2295
|
-
(target) => target.awsStageType ===
|
|
2469
|
+
(target) => target.awsStageType === import_utils9.AWS_STAGE_TYPE.PROD && target.localDeployment
|
|
2296
2470
|
);
|
|
2297
2471
|
}
|
|
2298
2472
|
/**
|
|
@@ -2301,17 +2475,17 @@ var AwsDeploymentConfig = class _AwsDeploymentConfig extends Component9 {
|
|
|
2301
2475
|
*/
|
|
2302
2476
|
get stageTargets() {
|
|
2303
2477
|
return this.awsDeploymentTargets.filter(
|
|
2304
|
-
(target) => target.awsStageType ===
|
|
2478
|
+
(target) => target.awsStageType === import_utils9.AWS_STAGE_TYPE.STAGE
|
|
2305
2479
|
);
|
|
2306
2480
|
}
|
|
2307
2481
|
get stageTargetsForCI() {
|
|
2308
2482
|
return this.awsDeploymentTargets.filter(
|
|
2309
|
-
(target) => target.awsStageType ===
|
|
2483
|
+
(target) => target.awsStageType === import_utils9.AWS_STAGE_TYPE.STAGE && target.ciDeployment
|
|
2310
2484
|
);
|
|
2311
2485
|
}
|
|
2312
2486
|
get stageTargetsForLocal() {
|
|
2313
2487
|
return this.awsDeploymentTargets.filter(
|
|
2314
|
-
(target) => target.awsStageType ===
|
|
2488
|
+
(target) => target.awsStageType === import_utils9.AWS_STAGE_TYPE.STAGE && target.localDeployment
|
|
2315
2489
|
);
|
|
2316
2490
|
}
|
|
2317
2491
|
/**
|
|
@@ -2320,17 +2494,17 @@ var AwsDeploymentConfig = class _AwsDeploymentConfig extends Component9 {
|
|
|
2320
2494
|
*/
|
|
2321
2495
|
get devTargets() {
|
|
2322
2496
|
return this.awsDeploymentTargets.filter(
|
|
2323
|
-
(target) => target.awsStageType ===
|
|
2497
|
+
(target) => target.awsStageType === import_utils9.AWS_STAGE_TYPE.DEV
|
|
2324
2498
|
);
|
|
2325
2499
|
}
|
|
2326
2500
|
get devTargetsForCI() {
|
|
2327
2501
|
return this.awsDeploymentTargets.filter(
|
|
2328
|
-
(target) => target.awsStageType ===
|
|
2502
|
+
(target) => target.awsStageType === import_utils9.AWS_STAGE_TYPE.DEV && target.ciDeployment
|
|
2329
2503
|
);
|
|
2330
2504
|
}
|
|
2331
2505
|
get devTargetsForLocal() {
|
|
2332
2506
|
return this.awsDeploymentTargets.filter(
|
|
2333
|
-
(target) => target.awsStageType ===
|
|
2507
|
+
(target) => target.awsStageType === import_utils9.AWS_STAGE_TYPE.DEV && target.localDeployment
|
|
2334
2508
|
);
|
|
2335
2509
|
}
|
|
2336
2510
|
preSynthesize() {
|
|
@@ -2343,7 +2517,7 @@ var AwsDeploymentConfig = class _AwsDeploymentConfig extends Component9 {
|
|
|
2343
2517
|
};
|
|
2344
2518
|
|
|
2345
2519
|
// src/aws/aws-deployment-target.ts
|
|
2346
|
-
var
|
|
2520
|
+
var import_utils10 = __toESM(require_lib());
|
|
2347
2521
|
import { Component as Component10 } from "projen";
|
|
2348
2522
|
var AwsDeploymentTarget = class _AwsDeploymentTarget extends Component10 {
|
|
2349
2523
|
constructor(project, options) {
|
|
@@ -2410,11 +2584,11 @@ var AwsDeploymentTarget = class _AwsDeploymentTarget extends Component10 {
|
|
|
2410
2584
|
};
|
|
2411
2585
|
this.account = options.account;
|
|
2412
2586
|
this.region = options.region;
|
|
2413
|
-
this.awsStageType = options.awsStageType ||
|
|
2414
|
-
const role = options.deploymentTargetRole ?? options.awsEnvironmentType ??
|
|
2587
|
+
this.awsStageType = options.awsStageType || import_utils10.AWS_STAGE_TYPE.DEV;
|
|
2588
|
+
const role = options.deploymentTargetRole ?? options.awsEnvironmentType ?? import_utils10.DEPLOYMENT_TARGET_ROLE.PRIMARY;
|
|
2415
2589
|
this.deploymentTargetRole = role;
|
|
2416
2590
|
this.awsEnvironmentType = role;
|
|
2417
|
-
this.branches = options.branches ?? (this.awsStageType ===
|
|
2591
|
+
this.branches = options.branches ?? (this.awsStageType === import_utils10.AWS_STAGE_TYPE.PROD ? [
|
|
2418
2592
|
{
|
|
2419
2593
|
branch: "main"
|
|
2420
2594
|
}
|
|
@@ -2423,7 +2597,7 @@ var AwsDeploymentTarget = class _AwsDeploymentTarget extends Component10 {
|
|
|
2423
2597
|
branch: "feature/*"
|
|
2424
2598
|
}
|
|
2425
2599
|
]);
|
|
2426
|
-
this.localDeployment = options.localDeployment ?? this.awsStageType ===
|
|
2600
|
+
this.localDeployment = options.localDeployment ?? this.awsStageType === import_utils10.AWS_STAGE_TYPE.DEV;
|
|
2427
2601
|
if (this.localDeployment) {
|
|
2428
2602
|
const roleName = options.localDeploymentConfig?.roleName?.toLowerCase() || "poweruseraccess";
|
|
2429
2603
|
const profile = options.localDeploymentConfig?.profile || `${roleName}-${this.awsStageType}-${this.account}-${this.region}`;
|
|
@@ -3358,10 +3532,10 @@ var TypeScriptConfig = class extends Component14 {
|
|
|
3358
3532
|
};
|
|
3359
3533
|
|
|
3360
3534
|
// src/workflows/aws-deploy-workflow.ts
|
|
3361
|
-
var
|
|
3535
|
+
var import_utils11 = __toESM(require_lib());
|
|
3362
3536
|
import { Component as Component15 } from "projen";
|
|
3363
3537
|
import { BuildWorkflow } from "projen/lib/build";
|
|
3364
|
-
import { GitHub } from "projen/lib/github";
|
|
3538
|
+
import { GitHub as GitHub2 } from "projen/lib/github";
|
|
3365
3539
|
import { JobPermission as JobPermission4 } from "projen/lib/github/workflows-model";
|
|
3366
3540
|
var PROD_DEPLOY_NAME = "prod-deploy";
|
|
3367
3541
|
var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component15 {
|
|
@@ -3375,7 +3549,7 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component15 {
|
|
|
3375
3549
|
* @deprecated Use deployment target role terminology elsewhere. This property is maintained for backward compatibility.
|
|
3376
3550
|
* @default 'primary' (this is the only type supported currently)
|
|
3377
3551
|
*/
|
|
3378
|
-
this.awsEnvironmentType =
|
|
3552
|
+
this.awsEnvironmentType = import_utils11.DEPLOYMENT_TARGET_ROLE.PRIMARY;
|
|
3379
3553
|
this.setupNode = () => {
|
|
3380
3554
|
return [
|
|
3381
3555
|
{
|
|
@@ -3477,7 +3651,7 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component15 {
|
|
|
3477
3651
|
);
|
|
3478
3652
|
}
|
|
3479
3653
|
this.rootProject = project.root;
|
|
3480
|
-
const github =
|
|
3654
|
+
const github = GitHub2.of(this.rootProject);
|
|
3481
3655
|
if (!github) {
|
|
3482
3656
|
throw new Error(
|
|
3483
3657
|
"AwsDeployWorkflow requires a GitHub component in the root project"
|
|
@@ -3485,7 +3659,7 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component15 {
|
|
|
3485
3659
|
}
|
|
3486
3660
|
const turbo = TurboRepo.of(this.rootProject);
|
|
3487
3661
|
const buildWorkflowOptions = turbo?.remoteCacheOptions ? TurboRepo.buildWorkflowOptions(turbo.remoteCacheOptions) : {};
|
|
3488
|
-
this.awsStageType = options.awsStageType ??
|
|
3662
|
+
this.awsStageType = options.awsStageType ?? import_utils11.AWS_STAGE_TYPE.DEV;
|
|
3489
3663
|
this.awsDeploymentTargets = options.awsDeploymentTargets ?? AwsDeploymentConfig.of(project)?.awsDeploymentTargets.filter(
|
|
3490
3664
|
(target) => target.awsStageType === this.awsStageType && target.ciDeployment
|
|
3491
3665
|
) ?? [];
|
|
@@ -3664,6 +3838,7 @@ export {
|
|
|
3664
3838
|
awsCdkBundle,
|
|
3665
3839
|
baseBundle,
|
|
3666
3840
|
getLatestEligibleVersion,
|
|
3841
|
+
githubWorkflowBundle,
|
|
3667
3842
|
jestBundle,
|
|
3668
3843
|
pnpmBundle,
|
|
3669
3844
|
projenBundle,
|