@codedrifters/configulator 0.0.162 → 0.0.164
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 +249 -24
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +248 -24
- package/lib/index.mjs.map +1 -1
- package/package.json +1 -1
package/lib/index.d.mts
CHANGED
|
@@ -848,6 +848,11 @@ declare const awsCdkBundle: AgentRuleBundle;
|
|
|
848
848
|
*/
|
|
849
849
|
declare const baseBundle: AgentRuleBundle;
|
|
850
850
|
|
|
851
|
+
/**
|
|
852
|
+
* GitHub workflow bundle — auto-detected when the project has a GitHub component.
|
|
853
|
+
*/
|
|
854
|
+
declare const githubWorkflowBundle: AgentRuleBundle;
|
|
855
|
+
|
|
851
856
|
/**
|
|
852
857
|
* Jest bundle — auto-detected when Jest is in dependencies.
|
|
853
858
|
*/
|
|
@@ -2793,4 +2798,4 @@ declare const COMPLETE_JOB_ID = "complete";
|
|
|
2793
2798
|
*/
|
|
2794
2799
|
declare function addBuildCompleteJob(buildWorkflow: BuildWorkflow): void;
|
|
2795
2800
|
|
|
2796
|
-
export { AGENT_MODEL, AGENT_PLATFORM, AGENT_RULE_SCOPE, AgentConfig, type AgentConfigOptions, type AgentModel, type AgentPlatform, type AgentPlatformOverrides, type AgentRule, type AgentRuleBundle, type AgentRuleScope, type AgentSkill, type AgentSubAgent, type AgentSubAgentPlatformOverrides, type ApproveMergeUpgradeOptions, type AwsAccount, AwsDeployWorkflow, AwsDeploymentConfig, AwsDeploymentTarget, type AwsDeploymentTargetOptions, type AwsLocalDeploymentConfig, type AwsOrganization, type AwsRegion, BUILT_IN_BUNDLES, CLAUDE_RULE_TARGET, COMPLETE_JOB_ID, type CiDeploymentConfig, type ClassTypeOptions, type ClaudeAutoModeConfig, type ClaudeHookAction, type ClaudeHookEntry, type ClaudeHooksConfig, type ClaudePermissionsConfig, type ClaudeRuleTarget, type ClaudeSandboxConfig, type ClaudeSettingsConfig, type CopilotHandoff, type CursorHookAction, type CursorHooksConfig, type CursorSettingsConfig, type DeployWorkflowOptions, type DeploymentMetadata, type GitBranch, type GitHubBoardMetadata, type GitHubProjectMetadata, type GitHubSprintMetadata, type IDependencyResolver, JsiiFaker, MCP_TRANSPORT, MERGE_METHODS, MIMIMUM_RELEASE_AGE, type McpServerConfig, type McpTransport, type MergeMethod, MonorepoProject, type MonorepoProjectOptions, type OrganizationMetadata, PROD_DEPLOY_NAME, PnpmWorkspace, type PnpmWorkspaceOptions, ProjectMetadata, type ProjectMetadataOptions, ROOT_CI_TASK_NAME, ROOT_TURBO_TASK_NAME, type RemoteCacheOptions, type RepositoryMetadata, ResetTask, type ResetTaskOptions, type ResolvedProjectMetadata, type SlackMetadata, type TemplateResolveResult, TestRunner, TurboRepo, type TurboRepoOptions, TurboRepoTask, type TurboRepoTaskOptions, TypeScriptConfig, TypeScriptProject, type TypeScriptProjectOptions, VERSION, VERSION_KEYS_SKIP, VERSION_NPM_PACKAGES, VSCodeConfig, type VersionKey, Vitest, type VitestConfigOptions, type VitestOptions, addApproveMergeUpgradeWorkflow, addBuildCompleteJob, awsCdkBundle, baseBundle, getLatestEligibleVersion, jestBundle, pnpmBundle, projenBundle, resolveTemplateVariables, turborepoBundle, typescriptBundle, vitestBundle };
|
|
2801
|
+
export { AGENT_MODEL, AGENT_PLATFORM, AGENT_RULE_SCOPE, AgentConfig, type AgentConfigOptions, type AgentModel, type AgentPlatform, type AgentPlatformOverrides, type AgentRule, type AgentRuleBundle, type AgentRuleScope, type AgentSkill, type AgentSubAgent, type AgentSubAgentPlatformOverrides, type ApproveMergeUpgradeOptions, type AwsAccount, AwsDeployWorkflow, AwsDeploymentConfig, AwsDeploymentTarget, type AwsDeploymentTargetOptions, type AwsLocalDeploymentConfig, type AwsOrganization, type AwsRegion, BUILT_IN_BUNDLES, CLAUDE_RULE_TARGET, COMPLETE_JOB_ID, type CiDeploymentConfig, type ClassTypeOptions, type ClaudeAutoModeConfig, type ClaudeHookAction, type ClaudeHookEntry, type ClaudeHooksConfig, type ClaudePermissionsConfig, type ClaudeRuleTarget, type ClaudeSandboxConfig, type ClaudeSettingsConfig, type CopilotHandoff, type CursorHookAction, type CursorHooksConfig, type CursorSettingsConfig, type DeployWorkflowOptions, type DeploymentMetadata, type GitBranch, type GitHubBoardMetadata, type GitHubProjectMetadata, type GitHubSprintMetadata, type IDependencyResolver, JsiiFaker, MCP_TRANSPORT, MERGE_METHODS, MIMIMUM_RELEASE_AGE, type McpServerConfig, type McpTransport, type MergeMethod, MonorepoProject, type MonorepoProjectOptions, type OrganizationMetadata, PROD_DEPLOY_NAME, PnpmWorkspace, type PnpmWorkspaceOptions, ProjectMetadata, type ProjectMetadataOptions, ROOT_CI_TASK_NAME, ROOT_TURBO_TASK_NAME, type RemoteCacheOptions, type RepositoryMetadata, ResetTask, type ResetTaskOptions, type ResolvedProjectMetadata, type SlackMetadata, type TemplateResolveResult, TestRunner, TurboRepo, type TurboRepoOptions, TurboRepoTask, type TurboRepoTaskOptions, TypeScriptConfig, TypeScriptProject, type TypeScriptProjectOptions, VERSION, VERSION_KEYS_SKIP, VERSION_NPM_PACKAGES, VSCodeConfig, type VersionKey, Vitest, type VitestConfigOptions, type VitestOptions, addApproveMergeUpgradeWorkflow, addBuildCompleteJob, awsCdkBundle, baseBundle, getLatestEligibleVersion, githubWorkflowBundle, jestBundle, pnpmBundle, projenBundle, resolveTemplateVariables, turborepoBundle, typescriptBundle, vitestBundle };
|
package/lib/index.d.ts
CHANGED
|
@@ -897,6 +897,11 @@ declare const awsCdkBundle: AgentRuleBundle;
|
|
|
897
897
|
*/
|
|
898
898
|
declare const baseBundle: AgentRuleBundle;
|
|
899
899
|
|
|
900
|
+
/**
|
|
901
|
+
* GitHub workflow bundle — auto-detected when the project has a GitHub component.
|
|
902
|
+
*/
|
|
903
|
+
declare const githubWorkflowBundle: AgentRuleBundle;
|
|
904
|
+
|
|
900
905
|
/**
|
|
901
906
|
* Jest bundle — auto-detected when Jest is in dependencies.
|
|
902
907
|
*/
|
|
@@ -2842,5 +2847,5 @@ declare const COMPLETE_JOB_ID = "complete";
|
|
|
2842
2847
|
*/
|
|
2843
2848
|
declare function addBuildCompleteJob(buildWorkflow: BuildWorkflow): void;
|
|
2844
2849
|
|
|
2845
|
-
export { AGENT_MODEL, AGENT_PLATFORM, AGENT_RULE_SCOPE, AgentConfig, AwsDeployWorkflow, AwsDeploymentConfig, AwsDeploymentTarget, BUILT_IN_BUNDLES, CLAUDE_RULE_TARGET, COMPLETE_JOB_ID, JsiiFaker, MCP_TRANSPORT, MERGE_METHODS, MIMIMUM_RELEASE_AGE, MonorepoProject, PROD_DEPLOY_NAME, PnpmWorkspace, ProjectMetadata, ROOT_CI_TASK_NAME, ROOT_TURBO_TASK_NAME, ResetTask, TestRunner, TurboRepo, TurboRepoTask, TypeScriptConfig, TypeScriptProject, VERSION, VERSION_KEYS_SKIP, VERSION_NPM_PACKAGES, VSCodeConfig, Vitest, addApproveMergeUpgradeWorkflow, addBuildCompleteJob, awsCdkBundle, baseBundle, getLatestEligibleVersion, jestBundle, pnpmBundle, projenBundle, resolveTemplateVariables, turborepoBundle, typescriptBundle, vitestBundle };
|
|
2850
|
+
export { AGENT_MODEL, AGENT_PLATFORM, AGENT_RULE_SCOPE, AgentConfig, AwsDeployWorkflow, AwsDeploymentConfig, AwsDeploymentTarget, BUILT_IN_BUNDLES, CLAUDE_RULE_TARGET, COMPLETE_JOB_ID, JsiiFaker, MCP_TRANSPORT, MERGE_METHODS, MIMIMUM_RELEASE_AGE, MonorepoProject, PROD_DEPLOY_NAME, PnpmWorkspace, ProjectMetadata, ROOT_CI_TASK_NAME, ROOT_TURBO_TASK_NAME, ResetTask, TestRunner, TurboRepo, TurboRepoTask, TypeScriptConfig, TypeScriptProject, VERSION, VERSION_KEYS_SKIP, VERSION_NPM_PACKAGES, VSCodeConfig, Vitest, addApproveMergeUpgradeWorkflow, addBuildCompleteJob, awsCdkBundle, baseBundle, getLatestEligibleVersion, githubWorkflowBundle, jestBundle, pnpmBundle, projenBundle, resolveTemplateVariables, turborepoBundle, typescriptBundle, vitestBundle };
|
|
2846
2851
|
export type { AgentConfigOptions, AgentModel, AgentPlatform, AgentPlatformOverrides, AgentRule, AgentRuleBundle, AgentRuleScope, AgentSkill, AgentSubAgent, AgentSubAgentPlatformOverrides, ApproveMergeUpgradeOptions, AwsAccount, AwsDeploymentTargetOptions, AwsLocalDeploymentConfig, AwsOrganization, AwsRegion, CiDeploymentConfig, ClassTypeOptions, ClaudeAutoModeConfig, ClaudeHookAction, ClaudeHookEntry, ClaudeHooksConfig, ClaudePermissionsConfig, ClaudeRuleTarget, ClaudeSandboxConfig, ClaudeSettingsConfig, CopilotHandoff, CursorHookAction, CursorHooksConfig, CursorSettingsConfig, DeployWorkflowOptions, DeploymentMetadata, GitBranch, GitHubBoardMetadata, GitHubProjectMetadata, GitHubSprintMetadata, IDependencyResolver, McpServerConfig, McpTransport, MergeMethod, MonorepoProjectOptions, OrganizationMetadata, PnpmWorkspaceOptions, ProjectMetadataOptions, RemoteCacheOptions, RepositoryMetadata, ResetTaskOptions, ResolvedProjectMetadata, SlackMetadata, TemplateResolveResult, TurboRepoOptions, TurboRepoTaskOptions, TypeScriptProjectOptions, VersionKey, VitestConfigOptions, VitestOptions };
|
package/lib/index.js
CHANGED
|
@@ -211,6 +211,7 @@ __export(index_exports, {
|
|
|
211
211
|
awsCdkBundle: () => awsCdkBundle,
|
|
212
212
|
baseBundle: () => baseBundle,
|
|
213
213
|
getLatestEligibleVersion: () => getLatestEligibleVersion,
|
|
214
|
+
githubWorkflowBundle: () => githubWorkflowBundle,
|
|
214
215
|
jestBundle: () => jestBundle,
|
|
215
216
|
pnpmBundle: () => pnpmBundle,
|
|
216
217
|
projenBundle: () => projenBundle,
|
|
@@ -311,6 +312,37 @@ var awsCdkBundle = {
|
|
|
311
312
|
"}",
|
|
312
313
|
"```",
|
|
313
314
|
"",
|
|
315
|
+
"## L2 Over L1 Construct Preference",
|
|
316
|
+
"",
|
|
317
|
+
"- Always prefer L2 constructs (e.g., `s3.Bucket`, `lambda.Function`) over L1 escape hatches (`CfnBucket`, `CfnFunction`)",
|
|
318
|
+
"- Only drop to L1 when the L2 construct is missing the feature you need or does not exist yet",
|
|
319
|
+
"- When using L1, add a comment explaining why the L2 was insufficient",
|
|
320
|
+
"",
|
|
321
|
+
"## Filename / Class Name Matching",
|
|
322
|
+
"",
|
|
323
|
+
"- Kebab-case filenames must mirror PascalCase class names (e.g., `my-construct.ts` \u2192 `MyConstruct`)",
|
|
324
|
+
"- One primary construct per file; supporting types (props interface, enums) live in the same file",
|
|
325
|
+
"- Test files follow the same pattern: `my-construct.spec.ts`",
|
|
326
|
+
"",
|
|
327
|
+
"## Cross-Stack Lookup Patterns",
|
|
328
|
+
"",
|
|
329
|
+
"- Lookups live on **service classes**, not component/construct classes",
|
|
330
|
+
"- Use static methods for cross-stack lookups so consumers don't need an instance:",
|
|
331
|
+
"",
|
|
332
|
+
"```typescript",
|
|
333
|
+
"export class MyService {",
|
|
334
|
+
" /** Look up a resource from another stack via SSM. */",
|
|
335
|
+
" public static lookupArn(scope: Construct, id: string): string {",
|
|
336
|
+
" return StringParameter.valueForStringParameter(",
|
|
337
|
+
" scope,",
|
|
338
|
+
" `/my-app/my-resource-arn`,",
|
|
339
|
+
" );",
|
|
340
|
+
" }",
|
|
341
|
+
"}",
|
|
342
|
+
"```",
|
|
343
|
+
"",
|
|
344
|
+
"- Store outputs in SSM parameters with well-known paths; do not pass values between stacks via props",
|
|
345
|
+
"",
|
|
314
346
|
"## AWS Best Practices",
|
|
315
347
|
"",
|
|
316
348
|
"- Use AWS CDK v2 (`aws-cdk-lib`)",
|
|
@@ -324,8 +356,30 @@ var awsCdkBundle = {
|
|
|
324
356
|
"",
|
|
325
357
|
"- Mock `Code.fromAsset` in any test file that synthesizes CDK stacks",
|
|
326
358
|
"- Use static S3 values (`mock-assets-bucket`, `mock-asset-key.zip`) so snapshots are stable",
|
|
327
|
-
"- Add the mock in `beforeAll` and restore in `afterAll
|
|
328
|
-
"
|
|
359
|
+
"- Add the mock in `beforeAll` and restore in `afterAll`:",
|
|
360
|
+
"",
|
|
361
|
+
"```typescript",
|
|
362
|
+
"let fromAssetMock: MockInstance;",
|
|
363
|
+
"",
|
|
364
|
+
"beforeAll(() => {",
|
|
365
|
+
' fromAssetMock = vi.spyOn(Code, "fromAsset").mockReturnValue({',
|
|
366
|
+
" isInline: false,",
|
|
367
|
+
" bind: () => ({",
|
|
368
|
+
" s3Location: {",
|
|
369
|
+
' bucketName: "mock-assets-bucket",',
|
|
370
|
+
' objectKey: "mock-asset-key.zip",',
|
|
371
|
+
" },",
|
|
372
|
+
" }),",
|
|
373
|
+
" } as unknown as AssetCode);",
|
|
374
|
+
"});",
|
|
375
|
+
"",
|
|
376
|
+
"afterAll(() => {",
|
|
377
|
+
" fromAssetMock.mockRestore();",
|
|
378
|
+
"});",
|
|
379
|
+
"```",
|
|
380
|
+
"",
|
|
381
|
+
"- Normalize the template before snapshotting when the stack includes asset-based Lambdas",
|
|
382
|
+
"- Use `Template.fromStack(stack)` and assert with `hasResourceProperties` for targeted checks"
|
|
329
383
|
].join("\n"),
|
|
330
384
|
tags: ["infrastructure"]
|
|
331
385
|
}
|
|
@@ -634,6 +688,98 @@ var baseBundle = {
|
|
|
634
688
|
]
|
|
635
689
|
};
|
|
636
690
|
|
|
691
|
+
// src/agent/bundles/github-workflow.ts
|
|
692
|
+
var import_github = require("projen/lib/github");
|
|
693
|
+
var githubWorkflowBundle = {
|
|
694
|
+
name: "github-workflow",
|
|
695
|
+
description: "GitHub issue and PR workflow automation patterns",
|
|
696
|
+
appliesWhen: (project) => hasComponent(project, import_github.GitHub),
|
|
697
|
+
rules: [
|
|
698
|
+
{
|
|
699
|
+
name: "issue-workflow",
|
|
700
|
+
description: "Automated workflow for starting work on a GitHub issue",
|
|
701
|
+
scope: AGENT_RULE_SCOPE.ALWAYS,
|
|
702
|
+
content: [
|
|
703
|
+
"# Issue Workflow",
|
|
704
|
+
"",
|
|
705
|
+
'## "Work on issue X" Automation',
|
|
706
|
+
"",
|
|
707
|
+
"When the user says **work on issue X** (or similar), follow these steps exactly:",
|
|
708
|
+
"",
|
|
709
|
+
"1. **Fetch issue details** \u2014 use `gh issue view <number>` to get the title, body, and labels",
|
|
710
|
+
"2. **Determine branch type** from the issue title prefix:",
|
|
711
|
+
" - `feat:` / `feature:` \u2192 `feat/`",
|
|
712
|
+
" - `fix:` / `bug:` \u2192 `fix/`",
|
|
713
|
+
" - `docs:` \u2192 `docs/`",
|
|
714
|
+
" - `chore:` / `refactor:` \u2192 `chore/`",
|
|
715
|
+
" - `test:` \u2192 `test/`",
|
|
716
|
+
" - No prefix \u2192 `feat/`",
|
|
717
|
+
"3. **Create a branch** following the naming convention: `<type>/<short-slug>-<issue-number>` (e.g., `feat/add-login-42`)",
|
|
718
|
+
"4. **Checkout the branch** locally",
|
|
719
|
+
"5. **Link the branch to the issue** by posting a comment: `gh issue comment <number> --body 'Branch: \\`<branch-name>\\`'`",
|
|
720
|
+
"6. **Stop and wait** for user instructions \u2014 do **NOT** start implementing",
|
|
721
|
+
"",
|
|
722
|
+
"### Important",
|
|
723
|
+
"",
|
|
724
|
+
"- Never begin implementation without explicit user direction",
|
|
725
|
+
"- If the issue title has no conventional prefix, default to `feat/`",
|
|
726
|
+
"- Keep the slug short (3-5 words max, kebab-case)"
|
|
727
|
+
].join("\n"),
|
|
728
|
+
tags: ["workflow"]
|
|
729
|
+
},
|
|
730
|
+
{
|
|
731
|
+
name: "pr-workflow",
|
|
732
|
+
description: "Automated workflow for opening a pull request",
|
|
733
|
+
scope: AGENT_RULE_SCOPE.ALWAYS,
|
|
734
|
+
content: [
|
|
735
|
+
"# PR Workflow",
|
|
736
|
+
"",
|
|
737
|
+
'## "Open a PR" Automation',
|
|
738
|
+
"",
|
|
739
|
+
"When the user says **open a PR** (or similar), follow these steps exactly:",
|
|
740
|
+
"",
|
|
741
|
+
"1. **Check for uncommitted changes** \u2014 if any exist, commit them with a conventional commit message",
|
|
742
|
+
"2. **Push the branch** to origin: `git push -u origin <branch>`",
|
|
743
|
+
"3. **Create the PR** using `gh pr create`:",
|
|
744
|
+
" - **Title**: use a conventional commit style title (e.g., `feat(scope): short description`)",
|
|
745
|
+
" - **Body**: include `Closes #<issue-number>` (derived from the branch name) and a brief summary of changes",
|
|
746
|
+
"4. **Display merge dialog text** for the user to copy-paste when merging:",
|
|
747
|
+
"",
|
|
748
|
+
"```",
|
|
749
|
+
"Commit message:",
|
|
750
|
+
"<conventional-commit-title>",
|
|
751
|
+
"",
|
|
752
|
+
"Extended description:",
|
|
753
|
+
"- Bullet points summarizing the changes",
|
|
754
|
+
"- Closes #<issue-number>",
|
|
755
|
+
"```",
|
|
756
|
+
"",
|
|
757
|
+
"### PR Body Template",
|
|
758
|
+
"",
|
|
759
|
+
"```markdown",
|
|
760
|
+
"## Summary",
|
|
761
|
+
"",
|
|
762
|
+
"<1-3 bullet points describing what changed and why>",
|
|
763
|
+
"",
|
|
764
|
+
"Closes #<issue-number>",
|
|
765
|
+
"",
|
|
766
|
+
"## Test Plan",
|
|
767
|
+
"",
|
|
768
|
+
"- [ ] Tests pass locally",
|
|
769
|
+
"- [ ] Relevant changes have been reviewed",
|
|
770
|
+
"```",
|
|
771
|
+
"",
|
|
772
|
+
"### Important",
|
|
773
|
+
"",
|
|
774
|
+
"- Always derive the issue number from the branch name (e.g., `feat/add-login-42` \u2192 `#42`)",
|
|
775
|
+
"- Use conventional commit format for the PR title",
|
|
776
|
+
"- Do not merge the PR \u2014 only create it and display the merge text"
|
|
777
|
+
].join("\n"),
|
|
778
|
+
tags: ["workflow"]
|
|
779
|
+
}
|
|
780
|
+
]
|
|
781
|
+
};
|
|
782
|
+
|
|
637
783
|
// src/agent/bundles/jest.ts
|
|
638
784
|
var jestBundle = {
|
|
639
785
|
name: "jest",
|
|
@@ -820,6 +966,28 @@ var projenBundle = {
|
|
|
820
966
|
description: "Projen conventions, synthesis workflow, .projenrc.ts patterns",
|
|
821
967
|
appliesWhen: (project) => hasDep(project, "projen"),
|
|
822
968
|
rules: [
|
|
969
|
+
{
|
|
970
|
+
name: "projen-sandbox-restrictions",
|
|
971
|
+
description: "Commands the agent must never run in Projen-managed projects",
|
|
972
|
+
scope: AGENT_RULE_SCOPE.ALWAYS,
|
|
973
|
+
content: [
|
|
974
|
+
"# Projen Sandbox Restrictions",
|
|
975
|
+
"",
|
|
976
|
+
"## Prohibited Commands",
|
|
977
|
+
"",
|
|
978
|
+
"The agent must **never** run the following commands \u2014 always ask the user to run them instead:",
|
|
979
|
+
"",
|
|
980
|
+
"- `pnpm install` / `pnpm i` \u2014 modifies the lockfile and may trigger synthesis",
|
|
981
|
+
"- `npx projen` \u2014 synthesizes generated files and must be run by the user",
|
|
982
|
+
"",
|
|
983
|
+
"## Rationale",
|
|
984
|
+
"",
|
|
985
|
+
"Projen-managed projects rely on synthesized files (`package.json`, `tsconfig.json`, etc.) that are regenerated from `.projenrc.ts`.",
|
|
986
|
+
"Running install or synthesis in the agent's sandbox can cause lockfile drift, phantom dependency changes, or overwrite user-controlled configuration.",
|
|
987
|
+
"The user must run these commands locally so they can review the resulting changes."
|
|
988
|
+
].join("\n"),
|
|
989
|
+
tags: ["workflow", "safety"]
|
|
990
|
+
},
|
|
823
991
|
{
|
|
824
992
|
name: "projen-conventions",
|
|
825
993
|
description: "Projen configuration patterns and best practices",
|
|
@@ -836,6 +1004,41 @@ var projenBundle = {
|
|
|
836
1004
|
" - `projenrc/*.ts` (package-specific)",
|
|
837
1005
|
"- After making Projen changes, ask the user to run `npx projen` locally (agent must not run it)",
|
|
838
1006
|
"",
|
|
1007
|
+
"## DO NOT Use Manual Package Manager Commands",
|
|
1008
|
+
"",
|
|
1009
|
+
"- **Never** run `pnpm add`, `pnpm remove`, `npm install`, or `yarn add` to modify dependencies",
|
|
1010
|
+
"- Dependencies must be added through Projen configuration (e.g., `project.addDeps()`, `project.addDevDeps()`)",
|
|
1011
|
+
"- Manual package manager commands bypass Projen's dependency management and will be overwritten on the next synthesis",
|
|
1012
|
+
"- Correct workflow: edit `.projenrc.ts` \u2192 ask user to run `npx projen` \u2192 user runs `pnpm install` if needed",
|
|
1013
|
+
"",
|
|
1014
|
+
"## Workspace Dependencies",
|
|
1015
|
+
"",
|
|
1016
|
+
"When adding dependencies between packages in a monorepo:",
|
|
1017
|
+
"",
|
|
1018
|
+
'- Use the workspace protocol: `project.addDeps("@org/sibling-pkg@workspace:*")`',
|
|
1019
|
+
"- This ensures the local version is always resolved, not a registry version",
|
|
1020
|
+
'- For dev dependencies: `project.addDevDeps("@org/sibling-pkg@workspace:*")`',
|
|
1021
|
+
"",
|
|
1022
|
+
"## The `configureMyProject` Pattern",
|
|
1023
|
+
"",
|
|
1024
|
+
"Each package should expose a `configureMyProject(options)` factory function that creates and configures its Projen project:",
|
|
1025
|
+
"",
|
|
1026
|
+
"```typescript",
|
|
1027
|
+
"export function configureMyProject(",
|
|
1028
|
+
" options: MyProjectOptions,",
|
|
1029
|
+
"): TypeScriptProject {",
|
|
1030
|
+
" const project = new TypeScriptProject({",
|
|
1031
|
+
" ...options,",
|
|
1032
|
+
" // package-specific defaults",
|
|
1033
|
+
" });",
|
|
1034
|
+
"",
|
|
1035
|
+
" // Attach components, configure rules, etc.",
|
|
1036
|
+
" return project;",
|
|
1037
|
+
"}",
|
|
1038
|
+
"```",
|
|
1039
|
+
"",
|
|
1040
|
+
"This pattern keeps `.projenrc.ts` clean and makes package configuration reusable and testable.",
|
|
1041
|
+
"",
|
|
839
1042
|
"## Custom Projen Components",
|
|
840
1043
|
"",
|
|
841
1044
|
"All custom components must extend `Component` from Projen and use a static `.of()` factory for discovery:",
|
|
@@ -1214,7 +1417,27 @@ var typescriptBundle = {
|
|
|
1214
1417
|
"- **Functions/Methods**: camelCase (e.g., `configureProject`)",
|
|
1215
1418
|
"- **Constants**: UPPER_SNAKE_CASE (e.g., `VERSION`, `AWS_STAGE_TYPE`)",
|
|
1216
1419
|
"- **Files**: kebab-case for multi-word files (e.g., `aws-deployment-config.ts`)",
|
|
1217
|
-
"- **
|
|
1420
|
+
"- **Component file naming**: kebab-case filename must mirror the PascalCase class name (e.g., `ResetTask` \u2192 `reset-task.ts`)",
|
|
1421
|
+
"- **Private members**: No prefix needed (TypeScript handles visibility)",
|
|
1422
|
+
"",
|
|
1423
|
+
"## Array Type Syntax",
|
|
1424
|
+
"",
|
|
1425
|
+
"- Prefer `Array<T>` over `T[]` for readability",
|
|
1426
|
+
"- For nested generics this is especially important: `Array<Array<string>>` is clearer than `string[][]`",
|
|
1427
|
+
"",
|
|
1428
|
+
"## Enum Preference",
|
|
1429
|
+
"",
|
|
1430
|
+
"- Prefer `as const` objects over TypeScript `enum` declarations",
|
|
1431
|
+
"- `as const` objects are more flexible: they support computed values, work with `keyof typeof`, and tree-shake better",
|
|
1432
|
+
"- Example:",
|
|
1433
|
+
" ```typescript",
|
|
1434
|
+
" // Prefer this:",
|
|
1435
|
+
" const Status = { Active: 'active', Inactive: 'inactive' } as const;",
|
|
1436
|
+
" type Status = (typeof Status)[keyof typeof Status];",
|
|
1437
|
+
"",
|
|
1438
|
+
" // Over this:",
|
|
1439
|
+
" enum Status { Active = 'active', Inactive = 'inactive' }",
|
|
1440
|
+
" ```"
|
|
1218
1441
|
].join("\n"),
|
|
1219
1442
|
tags: ["coding"]
|
|
1220
1443
|
}
|
|
@@ -1422,7 +1645,8 @@ var BUILT_IN_BUNDLES = [
|
|
|
1422
1645
|
turborepoBundle,
|
|
1423
1646
|
pnpmBundle,
|
|
1424
1647
|
awsCdkBundle,
|
|
1425
|
-
projenBundle
|
|
1648
|
+
projenBundle,
|
|
1649
|
+
githubWorkflowBundle
|
|
1426
1650
|
];
|
|
1427
1651
|
|
|
1428
1652
|
// src/projects/project-metadata.ts
|
|
@@ -2254,7 +2478,7 @@ ${extra}`
|
|
|
2254
2478
|
|
|
2255
2479
|
// src/aws/aws-deployment-config.ts
|
|
2256
2480
|
var import_node_path = require("path");
|
|
2257
|
-
var
|
|
2481
|
+
var import_utils9 = __toESM(require_lib());
|
|
2258
2482
|
var import_projen9 = require("projen");
|
|
2259
2483
|
var AwsDeploymentConfig = class _AwsDeploymentConfig extends import_projen9.Component {
|
|
2260
2484
|
constructor(project) {
|
|
@@ -2311,17 +2535,17 @@ var AwsDeploymentConfig = class _AwsDeploymentConfig extends import_projen9.Comp
|
|
|
2311
2535
|
*/
|
|
2312
2536
|
get prodTargets() {
|
|
2313
2537
|
return this.awsDeploymentTargets.filter(
|
|
2314
|
-
(target) => target.awsStageType ===
|
|
2538
|
+
(target) => target.awsStageType === import_utils9.AWS_STAGE_TYPE.PROD
|
|
2315
2539
|
);
|
|
2316
2540
|
}
|
|
2317
2541
|
get prodTargetsForCI() {
|
|
2318
2542
|
return this.awsDeploymentTargets.filter(
|
|
2319
|
-
(target) => target.awsStageType ===
|
|
2543
|
+
(target) => target.awsStageType === import_utils9.AWS_STAGE_TYPE.PROD && target.ciDeployment
|
|
2320
2544
|
);
|
|
2321
2545
|
}
|
|
2322
2546
|
get prodTargetsForLocal() {
|
|
2323
2547
|
return this.awsDeploymentTargets.filter(
|
|
2324
|
-
(target) => target.awsStageType ===
|
|
2548
|
+
(target) => target.awsStageType === import_utils9.AWS_STAGE_TYPE.PROD && target.localDeployment
|
|
2325
2549
|
);
|
|
2326
2550
|
}
|
|
2327
2551
|
/**
|
|
@@ -2330,17 +2554,17 @@ var AwsDeploymentConfig = class _AwsDeploymentConfig extends import_projen9.Comp
|
|
|
2330
2554
|
*/
|
|
2331
2555
|
get stageTargets() {
|
|
2332
2556
|
return this.awsDeploymentTargets.filter(
|
|
2333
|
-
(target) => target.awsStageType ===
|
|
2557
|
+
(target) => target.awsStageType === import_utils9.AWS_STAGE_TYPE.STAGE
|
|
2334
2558
|
);
|
|
2335
2559
|
}
|
|
2336
2560
|
get stageTargetsForCI() {
|
|
2337
2561
|
return this.awsDeploymentTargets.filter(
|
|
2338
|
-
(target) => target.awsStageType ===
|
|
2562
|
+
(target) => target.awsStageType === import_utils9.AWS_STAGE_TYPE.STAGE && target.ciDeployment
|
|
2339
2563
|
);
|
|
2340
2564
|
}
|
|
2341
2565
|
get stageTargetsForLocal() {
|
|
2342
2566
|
return this.awsDeploymentTargets.filter(
|
|
2343
|
-
(target) => target.awsStageType ===
|
|
2567
|
+
(target) => target.awsStageType === import_utils9.AWS_STAGE_TYPE.STAGE && target.localDeployment
|
|
2344
2568
|
);
|
|
2345
2569
|
}
|
|
2346
2570
|
/**
|
|
@@ -2349,17 +2573,17 @@ var AwsDeploymentConfig = class _AwsDeploymentConfig extends import_projen9.Comp
|
|
|
2349
2573
|
*/
|
|
2350
2574
|
get devTargets() {
|
|
2351
2575
|
return this.awsDeploymentTargets.filter(
|
|
2352
|
-
(target) => target.awsStageType ===
|
|
2576
|
+
(target) => target.awsStageType === import_utils9.AWS_STAGE_TYPE.DEV
|
|
2353
2577
|
);
|
|
2354
2578
|
}
|
|
2355
2579
|
get devTargetsForCI() {
|
|
2356
2580
|
return this.awsDeploymentTargets.filter(
|
|
2357
|
-
(target) => target.awsStageType ===
|
|
2581
|
+
(target) => target.awsStageType === import_utils9.AWS_STAGE_TYPE.DEV && target.ciDeployment
|
|
2358
2582
|
);
|
|
2359
2583
|
}
|
|
2360
2584
|
get devTargetsForLocal() {
|
|
2361
2585
|
return this.awsDeploymentTargets.filter(
|
|
2362
|
-
(target) => target.awsStageType ===
|
|
2586
|
+
(target) => target.awsStageType === import_utils9.AWS_STAGE_TYPE.DEV && target.localDeployment
|
|
2363
2587
|
);
|
|
2364
2588
|
}
|
|
2365
2589
|
preSynthesize() {
|
|
@@ -2372,7 +2596,7 @@ var AwsDeploymentConfig = class _AwsDeploymentConfig extends import_projen9.Comp
|
|
|
2372
2596
|
};
|
|
2373
2597
|
|
|
2374
2598
|
// src/aws/aws-deployment-target.ts
|
|
2375
|
-
var
|
|
2599
|
+
var import_utils10 = __toESM(require_lib());
|
|
2376
2600
|
var import_projen10 = require("projen");
|
|
2377
2601
|
var AwsDeploymentTarget = class _AwsDeploymentTarget extends import_projen10.Component {
|
|
2378
2602
|
constructor(project, options) {
|
|
@@ -2439,11 +2663,11 @@ var AwsDeploymentTarget = class _AwsDeploymentTarget extends import_projen10.Com
|
|
|
2439
2663
|
};
|
|
2440
2664
|
this.account = options.account;
|
|
2441
2665
|
this.region = options.region;
|
|
2442
|
-
this.awsStageType = options.awsStageType ||
|
|
2443
|
-
const role = options.deploymentTargetRole ?? options.awsEnvironmentType ??
|
|
2666
|
+
this.awsStageType = options.awsStageType || import_utils10.AWS_STAGE_TYPE.DEV;
|
|
2667
|
+
const role = options.deploymentTargetRole ?? options.awsEnvironmentType ?? import_utils10.DEPLOYMENT_TARGET_ROLE.PRIMARY;
|
|
2444
2668
|
this.deploymentTargetRole = role;
|
|
2445
2669
|
this.awsEnvironmentType = role;
|
|
2446
|
-
this.branches = options.branches ?? (this.awsStageType ===
|
|
2670
|
+
this.branches = options.branches ?? (this.awsStageType === import_utils10.AWS_STAGE_TYPE.PROD ? [
|
|
2447
2671
|
{
|
|
2448
2672
|
branch: "main"
|
|
2449
2673
|
}
|
|
@@ -2452,7 +2676,7 @@ var AwsDeploymentTarget = class _AwsDeploymentTarget extends import_projen10.Com
|
|
|
2452
2676
|
branch: "feature/*"
|
|
2453
2677
|
}
|
|
2454
2678
|
]);
|
|
2455
|
-
this.localDeployment = options.localDeployment ?? this.awsStageType ===
|
|
2679
|
+
this.localDeployment = options.localDeployment ?? this.awsStageType === import_utils10.AWS_STAGE_TYPE.DEV;
|
|
2456
2680
|
if (this.localDeployment) {
|
|
2457
2681
|
const roleName = options.localDeploymentConfig?.roleName?.toLowerCase() || "poweruseraccess";
|
|
2458
2682
|
const profile = options.localDeploymentConfig?.profile || `${roleName}-${this.awsStageType}-${this.account}-${this.region}`;
|
|
@@ -3378,10 +3602,10 @@ var TypeScriptConfig = class extends import_projen15.Component {
|
|
|
3378
3602
|
};
|
|
3379
3603
|
|
|
3380
3604
|
// src/workflows/aws-deploy-workflow.ts
|
|
3381
|
-
var
|
|
3605
|
+
var import_utils11 = __toESM(require_lib());
|
|
3382
3606
|
var import_projen16 = require("projen");
|
|
3383
3607
|
var import_build = require("projen/lib/build");
|
|
3384
|
-
var
|
|
3608
|
+
var import_github2 = require("projen/lib/github");
|
|
3385
3609
|
var import_workflows_model4 = require("projen/lib/github/workflows-model");
|
|
3386
3610
|
var PROD_DEPLOY_NAME = "prod-deploy";
|
|
3387
3611
|
var AwsDeployWorkflow = class _AwsDeployWorkflow extends import_projen16.Component {
|
|
@@ -3395,7 +3619,7 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends import_projen16.Compone
|
|
|
3395
3619
|
* @deprecated Use deployment target role terminology elsewhere. This property is maintained for backward compatibility.
|
|
3396
3620
|
* @default 'primary' (this is the only type supported currently)
|
|
3397
3621
|
*/
|
|
3398
|
-
this.awsEnvironmentType =
|
|
3622
|
+
this.awsEnvironmentType = import_utils11.DEPLOYMENT_TARGET_ROLE.PRIMARY;
|
|
3399
3623
|
this.setupNode = () => {
|
|
3400
3624
|
return [
|
|
3401
3625
|
{
|
|
@@ -3497,7 +3721,7 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends import_projen16.Compone
|
|
|
3497
3721
|
);
|
|
3498
3722
|
}
|
|
3499
3723
|
this.rootProject = project.root;
|
|
3500
|
-
const github =
|
|
3724
|
+
const github = import_github2.GitHub.of(this.rootProject);
|
|
3501
3725
|
if (!github) {
|
|
3502
3726
|
throw new Error(
|
|
3503
3727
|
"AwsDeployWorkflow requires a GitHub component in the root project"
|
|
@@ -3505,7 +3729,7 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends import_projen16.Compone
|
|
|
3505
3729
|
}
|
|
3506
3730
|
const turbo = TurboRepo.of(this.rootProject);
|
|
3507
3731
|
const buildWorkflowOptions = turbo?.remoteCacheOptions ? TurboRepo.buildWorkflowOptions(turbo.remoteCacheOptions) : {};
|
|
3508
|
-
this.awsStageType = options.awsStageType ??
|
|
3732
|
+
this.awsStageType = options.awsStageType ?? import_utils11.AWS_STAGE_TYPE.DEV;
|
|
3509
3733
|
this.awsDeploymentTargets = options.awsDeploymentTargets ?? AwsDeploymentConfig.of(project)?.awsDeploymentTargets.filter(
|
|
3510
3734
|
(target) => target.awsStageType === this.awsStageType && target.ciDeployment
|
|
3511
3735
|
) ?? [];
|
|
@@ -3685,6 +3909,7 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends import_projen16.Compone
|
|
|
3685
3909
|
awsCdkBundle,
|
|
3686
3910
|
baseBundle,
|
|
3687
3911
|
getLatestEligibleVersion,
|
|
3912
|
+
githubWorkflowBundle,
|
|
3688
3913
|
jestBundle,
|
|
3689
3914
|
pnpmBundle,
|
|
3690
3915
|
projenBundle,
|