@codedrifters/configulator 0.0.194 → 0.0.196

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.mjs CHANGED
@@ -872,28 +872,7 @@ var githubWorkflowBundle = {
872
872
  "",
873
873
  '## "Work on issue X" Automation',
874
874
  "",
875
- "When the user says **work on issue X** (or similar), follow these steps exactly:",
876
- "",
877
- "1. **Ensure you have the latest code** \u2014 switch to the default branch and pull:",
878
- " - `git checkout {{repository.defaultBranch}} && git pull origin {{repository.defaultBranch}}`",
879
- "2. **Fetch issue details** \u2014 use `gh issue view <number>` to get the title, body, and labels",
880
- "3. **Determine branch type** from the issue title prefix:",
881
- " - `feat:` / `feature:` \u2192 `feat/`",
882
- " - `fix:` / `bug:` \u2192 `fix/`",
883
- " - `docs:` \u2192 `docs/`",
884
- " - `chore:` / `refactor:` \u2192 `chore/`",
885
- " - `test:` \u2192 `test/`",
886
- " - No prefix \u2192 `feat/`",
887
- "4. **Create a branch** following the naming convention: `<type>/<issue-number>-<issue-slug>` (e.g., `feat/42-add-login`)",
888
- "5. **Checkout the branch** locally",
889
- "6. **Link the branch to the issue** by posting a comment: `gh issue comment <number> --body 'Branch: \\`<branch-name>\\`'`",
890
- "7. **Create an implementation plan** \u2014 analyze the issue requirements, explore the relevant codebase, and present a plan for the user to approve before starting any implementation",
891
- "",
892
- "### Important",
893
- "",
894
- "- Never begin implementation without the user approving the plan",
895
- "- If the issue title has no conventional prefix, default to `feat/`",
896
- "- Keep the slug short (3-5 words max, kebab-case)"
875
+ "When the user says **work on issue X** (or similar), invoke the `issue-worker` agent in interactive mode, passing the issue number in the prompt. Do not perform the branch creation, issue fetching, or planning steps yourself \u2014 the agent handles the full workflow (claim, branch, plan, implement, PR) and will pause for your approval at the appropriate checkpoints."
897
876
  ].join("\n"),
898
877
  tags: ["workflow"]
899
878
  },
@@ -5607,8 +5586,14 @@ var TestRunner = {
5607
5586
  };
5608
5587
  var TypeScriptProject = class extends typescript.TypeScriptProject {
5609
5588
  constructor(userOptions) {
5610
- const pnpmVersion = userOptions.parent && userOptions.parent instanceof MonorepoProject ? userOptions.parent.pnpmVersion : VERSION.PNPM_VERSION;
5611
- const pnpmWorkspace = userOptions.parent && userOptions.parent instanceof MonorepoProject ? PnpmWorkspace.of(userOptions.parent) : void 0;
5589
+ if (!(userOptions.parent instanceof MonorepoProject)) {
5590
+ throw new Error(
5591
+ "TypeScriptProject must be parented to a MonorepoProject. Pass `parent: <MonorepoProject>` in the project options."
5592
+ );
5593
+ }
5594
+ const parent = userOptions.parent;
5595
+ const pnpmVersion = parent.pnpmVersion;
5596
+ const pnpmWorkspace = PnpmWorkspace.of(parent);
5612
5597
  const testRunner = userOptions.testRunner ?? TestRunner.JEST;
5613
5598
  const useJest = testRunner === TestRunner.JEST;
5614
5599
  const defaultOptions = {
@@ -5874,44 +5859,24 @@ var DEFAULT_INDEX_ASTRO = `---
5874
5859
  var DEFAULT_FAVICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128"><path d="M64 8a56 56 0 1 0 0 112A56 56 0 0 0 64 8Z" fill="#ff5d01"/></svg>
5875
5860
  `;
5876
5861
 
5877
- // src/typescript/typescript-config.ts
5878
- import { relative as relative4 } from "path";
5879
- import { Component as Component16 } from "projen";
5880
- import { ensureRelativePathStartsWithDot } from "projen/lib/util/path";
5881
- var TypeScriptConfig = class extends Component16 {
5882
- constructor(project) {
5883
- super(project);
5884
- let tsPaths = {};
5885
- const workspaceDeps = project.deps.all.filter(
5886
- (d) => d.version === "workspace:*"
5887
- );
5888
- workspaceDeps.forEach((dep) => {
5889
- const subproject = project.root.subprojects.find((p) => p.package.packageName === dep.name);
5890
- if (!subproject) {
5891
- throw new Error(`Could not find subproject ${dep.name} in monorepo.`);
5892
- }
5893
- tsPaths = {
5894
- ...tsPaths,
5895
- [dep.name]: [
5896
- ensureRelativePathStartsWithDot(
5897
- relative4(project.outdir, subproject.outdir)
5898
- )
5899
- ]
5900
- };
5901
- });
5902
- project.tsconfig?.file.addOverride("compilerOptions.paths", tsPaths);
5903
- project.tsconfigDev?.file.addOverride("compilerOptions.paths", tsPaths);
5904
- }
5905
- };
5862
+ // src/projects/aws-cdk-project.ts
5863
+ import { awscdk } from "projen";
5864
+ import {
5865
+ NodePackageManager as NodePackageManager3,
5866
+ Transform as Transform2,
5867
+ UpgradeDependenciesSchedule as UpgradeDependenciesSchedule3
5868
+ } from "projen/lib/javascript";
5869
+ import { ReleaseTrigger as ReleaseTrigger2 } from "projen/lib/release";
5870
+ import { merge as merge3 } from "ts-deepmerge";
5906
5871
 
5907
5872
  // src/workflows/aws-deploy-workflow.ts
5908
5873
  var import_utils11 = __toESM(require_lib());
5909
- import { Component as Component17 } from "projen";
5874
+ import { Component as Component16 } from "projen";
5910
5875
  import { BuildWorkflow } from "projen/lib/build";
5911
5876
  import { GitHub as GitHub2 } from "projen/lib/github";
5912
5877
  import { JobPermission as JobPermission5 } from "projen/lib/github/workflows-model";
5913
5878
  var PROD_DEPLOY_NAME = "prod-deploy";
5914
- var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component17 {
5879
+ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component16 {
5915
5880
  constructor(project, options = {}) {
5916
5881
  super(project);
5917
5882
  this.project = project;
@@ -6174,6 +6139,226 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends Component17 {
6174
6139
  super.preSynthesize();
6175
6140
  }
6176
6141
  };
6142
+
6143
+ // src/projects/aws-cdk-project.ts
6144
+ var AwsCdkProject = class extends awscdk.AwsCdkTypeScriptApp {
6145
+ constructor(userOptions) {
6146
+ if (!(userOptions.parent instanceof MonorepoProject)) {
6147
+ throw new Error(
6148
+ "AwsCdkProject must be parented to a MonorepoProject. Pass `parent: <MonorepoProject>` in the project options."
6149
+ );
6150
+ }
6151
+ const parent = userOptions.parent;
6152
+ const pnpmVersion = parent.pnpmVersion;
6153
+ const pnpmWorkspace = PnpmWorkspace.of(parent);
6154
+ const testRunner = userOptions.testRunner ?? TestRunner.JEST;
6155
+ const useJest = testRunner === TestRunner.JEST;
6156
+ const defaultOptions = {
6157
+ defaultReleaseBranch: "main",
6158
+ /**
6159
+ * Enable reset task by default.
6160
+ */
6161
+ resetTask: true,
6162
+ /**
6163
+ * Packaging options.
6164
+ */
6165
+ packageManager: NodePackageManager3.PNPM,
6166
+ pnpmVersion,
6167
+ licensed: userOptions.license !== void 0 || false,
6168
+ copyrightOwner: "CodeDrifters",
6169
+ release: false,
6170
+ /**
6171
+ * Don't add sample code.
6172
+ */
6173
+ sampleCode: false,
6174
+ /**
6175
+ * CDK versions sourced from the configulator-managed catalog.
6176
+ */
6177
+ cdkVersion: VERSION.AWS_CDK_LIB_VERSION,
6178
+ cdkCliVersion: VERSION.AWS_CDK_CLI_VERSION,
6179
+ ...useJest ? {
6180
+ /**
6181
+ * Make sure jest config is stored outside of package.json and use
6182
+ * SWC for faster compilation (matches TypeScriptProject).
6183
+ */
6184
+ jestOptions: {
6185
+ configFilePath: "jest.config.json",
6186
+ jestConfig: {
6187
+ roots: [`<rootDir>/src`],
6188
+ transform: {
6189
+ ["^.+\\.[t]sx?$"]: new Transform2("@swc/jest")
6190
+ },
6191
+ moduleFileExtensions: ["js", "ts"]
6192
+ }
6193
+ },
6194
+ devDeps: ["@swc/jest", "@swc/core"]
6195
+ } : {
6196
+ jest: false,
6197
+ devDeps: []
6198
+ },
6199
+ /**
6200
+ * Turn on prettier formatting.
6201
+ */
6202
+ prettier: true,
6203
+ /**
6204
+ * Don't package test files.
6205
+ */
6206
+ npmIgnoreOptions: {
6207
+ ignorePatterns: ["*.spec.*", "*.test.*"]
6208
+ },
6209
+ /**
6210
+ * Options for the automated dependency upgrade task / workflow.
6211
+ * Exclude any packages managed by the parent project's default catalog
6212
+ * so the catalog stays the source of truth.
6213
+ */
6214
+ depsUpgrade: true,
6215
+ depsUpgradeOptions: {
6216
+ workflow: false,
6217
+ exclude: Object.keys(pnpmWorkspace?.defaultCatalog || {}),
6218
+ workflowOptions: {
6219
+ schedule: UpgradeDependenciesSchedule3.WEEKLY
6220
+ },
6221
+ cooldown: 1
6222
+ },
6223
+ /**
6224
+ * Only release when the package source content or package.json changes.
6225
+ */
6226
+ releaseTrigger: ReleaseTrigger2.continuous({
6227
+ paths: [
6228
+ `${userOptions.outdir}/src/**`,
6229
+ `${userOptions.outdir}/package.json`
6230
+ ]
6231
+ })
6232
+ };
6233
+ const options = merge3(defaultOptions, userOptions);
6234
+ super(options);
6235
+ this.addDevDeps("@types/node@catalog:");
6236
+ this.tsconfig?.addExclude("**/*.test.*");
6237
+ this.tsconfig?.addExclude("**/*.spec.*");
6238
+ if (testRunner === TestRunner.VITEST) {
6239
+ new Vitest(this, {
6240
+ config: {
6241
+ include: ["src/**/*.{test,spec}.?(c|m)[jt]s?(x)"],
6242
+ ...options.vitestOptions?.config
6243
+ },
6244
+ ...options.vitestOptions
6245
+ });
6246
+ } else {
6247
+ this.deps.removeDependency("ts-jest");
6248
+ }
6249
+ this.package.file.addOverride(
6250
+ "packageManager",
6251
+ `pnpm@${options.pnpmVersion}`
6252
+ );
6253
+ this.eslint?.addOverride({
6254
+ files: ["**/*.test.*", "**/*.spec.*"],
6255
+ rules: {
6256
+ "import/no-extraneous-dependencies": "off"
6257
+ }
6258
+ });
6259
+ this.gitignore?.addPatterns(".DS_Store", "test-reports", "cdk.out");
6260
+ this.npmignore?.addPatterns("*.spec.*", "*.test.*", "__fixtures__");
6261
+ new AwsDeploymentConfig(this);
6262
+ (options.deploymentTargets ?? []).forEach(
6263
+ (targetOptions) => this.addDeploymentTarget(targetOptions)
6264
+ );
6265
+ const targetsForAutoDerive = AwsDeploymentConfig.of(this)?.awsDeploymentTargets ?? [];
6266
+ const deployWorkflows = options.deployWorkflows ?? Array.from(new Set(targetsForAutoDerive.map((t) => t.awsStageType))).map(
6267
+ (awsStageType) => ({
6268
+ awsStageType,
6269
+ buildWorkflow: options.sharedBuildWorkflow
6270
+ })
6271
+ );
6272
+ deployWorkflows.forEach(
6273
+ (workflowOptions) => new AwsDeployWorkflow(this, workflowOptions)
6274
+ );
6275
+ const turboActive = TurboRepo.of(parent) !== void 0;
6276
+ if (turboActive) {
6277
+ const turbo = new TurboRepo(this);
6278
+ turbo.postCompileTask?.outputs.push("dist/**");
6279
+ turbo.postCompileTask?.inputs.push("src/**");
6280
+ }
6281
+ if (options.agentConfig === true || typeof options.agentConfig === "object") {
6282
+ new AgentConfig(
6283
+ this,
6284
+ typeof options.agentConfig === "object" ? options.agentConfig : {}
6285
+ );
6286
+ }
6287
+ if (options.resetTask !== false) {
6288
+ const defaultResetTaskOptions = {
6289
+ pathsToRemove: [
6290
+ "node_modules",
6291
+ "dist",
6292
+ "lib",
6293
+ "cdk.out",
6294
+ "coverage",
6295
+ "test-reports",
6296
+ ".turbo",
6297
+ "tsconfig.tsbuildinfo",
6298
+ this.artifactsDirectory
6299
+ ]
6300
+ };
6301
+ const userResetTaskOptions = options.resetTaskOptions ?? {};
6302
+ const resetTaskOptions = merge3(
6303
+ defaultResetTaskOptions,
6304
+ {
6305
+ ...userResetTaskOptions,
6306
+ pathsToRemove: [
6307
+ ...defaultResetTaskOptions.pathsToRemove ?? [],
6308
+ ...userResetTaskOptions.pathsToRemove ?? []
6309
+ ]
6310
+ }
6311
+ );
6312
+ new ResetTask(this, resetTaskOptions);
6313
+ }
6314
+ const originalResolve = this.package.resolveDepsAndWritePackageJson;
6315
+ this.package.installDependencies = () => {
6316
+ parent.requestInstallDependencies({
6317
+ resolveDepsAndWritePackageJson: () => originalResolve.apply(this.package)
6318
+ });
6319
+ };
6320
+ this.package.resolveDepsAndWritePackageJson = () => {
6321
+ };
6322
+ }
6323
+ /**
6324
+ * Add an AWS deployment target to this project after construction. The
6325
+ * target is registered on the existing `AwsDeploymentConfig` and immediately
6326
+ * available for `AwsDeployWorkflow` consumption.
6327
+ */
6328
+ addDeploymentTarget(options) {
6329
+ return new AwsDeploymentTarget(this, options);
6330
+ }
6331
+ };
6332
+
6333
+ // src/typescript/typescript-config.ts
6334
+ import { relative as relative4 } from "path";
6335
+ import { Component as Component17 } from "projen";
6336
+ import { ensureRelativePathStartsWithDot } from "projen/lib/util/path";
6337
+ var TypeScriptConfig = class extends Component17 {
6338
+ constructor(project) {
6339
+ super(project);
6340
+ let tsPaths = {};
6341
+ const workspaceDeps = project.deps.all.filter(
6342
+ (d) => d.version === "workspace:*"
6343
+ );
6344
+ workspaceDeps.forEach((dep) => {
6345
+ const subproject = project.root.subprojects.find((p) => p.package.packageName === dep.name);
6346
+ if (!subproject) {
6347
+ throw new Error(`Could not find subproject ${dep.name} in monorepo.`);
6348
+ }
6349
+ tsPaths = {
6350
+ ...tsPaths,
6351
+ [dep.name]: [
6352
+ ensureRelativePathStartsWithDot(
6353
+ relative4(project.outdir, subproject.outdir)
6354
+ )
6355
+ ]
6356
+ };
6357
+ });
6358
+ project.tsconfig?.file.addOverride("compilerOptions.paths", tsPaths);
6359
+ project.tsconfigDev?.file.addOverride("compilerOptions.paths", tsPaths);
6360
+ }
6361
+ };
6177
6362
  export {
6178
6363
  AGENT_MODEL,
6179
6364
  AGENT_PLATFORM,
@@ -6182,6 +6367,7 @@ export {
6182
6367
  AstroConfig,
6183
6368
  AstroOutput,
6184
6369
  AstroProject,
6370
+ AwsCdkProject,
6185
6371
  AwsDeployWorkflow,
6186
6372
  AwsDeploymentConfig,
6187
6373
  AwsDeploymentTarget,