@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.js CHANGED
@@ -182,6 +182,7 @@ __export(index_exports, {
182
182
  AstroConfig: () => AstroConfig,
183
183
  AstroOutput: () => AstroOutput,
184
184
  AstroProject: () => AstroProject,
185
+ AwsCdkProject: () => AwsCdkProject,
185
186
  AwsDeployWorkflow: () => AwsDeployWorkflow,
186
187
  AwsDeploymentConfig: () => AwsDeploymentConfig,
187
188
  AwsDeploymentTarget: () => AwsDeploymentTarget,
@@ -934,28 +935,7 @@ var githubWorkflowBundle = {
934
935
  "",
935
936
  '## "Work on issue X" Automation',
936
937
  "",
937
- "When the user says **work on issue X** (or similar), follow these steps exactly:",
938
- "",
939
- "1. **Ensure you have the latest code** \u2014 switch to the default branch and pull:",
940
- " - `git checkout {{repository.defaultBranch}} && git pull origin {{repository.defaultBranch}}`",
941
- "2. **Fetch issue details** \u2014 use `gh issue view <number>` to get the title, body, and labels",
942
- "3. **Determine branch type** from the issue title prefix:",
943
- " - `feat:` / `feature:` \u2192 `feat/`",
944
- " - `fix:` / `bug:` \u2192 `fix/`",
945
- " - `docs:` \u2192 `docs/`",
946
- " - `chore:` / `refactor:` \u2192 `chore/`",
947
- " - `test:` \u2192 `test/`",
948
- " - No prefix \u2192 `feat/`",
949
- "4. **Create a branch** following the naming convention: `<type>/<issue-number>-<issue-slug>` (e.g., `feat/42-add-login`)",
950
- "5. **Checkout the branch** locally",
951
- "6. **Link the branch to the issue** by posting a comment: `gh issue comment <number> --body 'Branch: \\`<branch-name>\\`'`",
952
- "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",
953
- "",
954
- "### Important",
955
- "",
956
- "- Never begin implementation without the user approving the plan",
957
- "- If the issue title has no conventional prefix, default to `feat/`",
958
- "- Keep the slug short (3-5 words max, kebab-case)"
938
+ "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."
959
939
  ].join("\n"),
960
940
  tags: ["workflow"]
961
941
  },
@@ -5660,8 +5640,14 @@ var TestRunner = {
5660
5640
  };
5661
5641
  var TypeScriptProject = class extends import_projen16.typescript.TypeScriptProject {
5662
5642
  constructor(userOptions) {
5663
- const pnpmVersion = userOptions.parent && userOptions.parent instanceof MonorepoProject ? userOptions.parent.pnpmVersion : VERSION.PNPM_VERSION;
5664
- const pnpmWorkspace = userOptions.parent && userOptions.parent instanceof MonorepoProject ? PnpmWorkspace.of(userOptions.parent) : void 0;
5643
+ if (!(userOptions.parent instanceof MonorepoProject)) {
5644
+ throw new Error(
5645
+ "TypeScriptProject must be parented to a MonorepoProject. Pass `parent: <MonorepoProject>` in the project options."
5646
+ );
5647
+ }
5648
+ const parent = userOptions.parent;
5649
+ const pnpmVersion = parent.pnpmVersion;
5650
+ const pnpmWorkspace = PnpmWorkspace.of(parent);
5665
5651
  const testRunner = userOptions.testRunner ?? TestRunner.JEST;
5666
5652
  const useJest = testRunner === TestRunner.JEST;
5667
5653
  const defaultOptions = {
@@ -5927,44 +5913,20 @@ var DEFAULT_INDEX_ASTRO = `---
5927
5913
  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>
5928
5914
  `;
5929
5915
 
5930
- // src/typescript/typescript-config.ts
5931
- var import_node_path2 = require("path");
5932
- var import_projen18 = require("projen");
5933
- var import_path2 = require("projen/lib/util/path");
5934
- var TypeScriptConfig = class extends import_projen18.Component {
5935
- constructor(project) {
5936
- super(project);
5937
- let tsPaths = {};
5938
- const workspaceDeps = project.deps.all.filter(
5939
- (d) => d.version === "workspace:*"
5940
- );
5941
- workspaceDeps.forEach((dep) => {
5942
- const subproject = project.root.subprojects.find((p) => p.package.packageName === dep.name);
5943
- if (!subproject) {
5944
- throw new Error(`Could not find subproject ${dep.name} in monorepo.`);
5945
- }
5946
- tsPaths = {
5947
- ...tsPaths,
5948
- [dep.name]: [
5949
- (0, import_path2.ensureRelativePathStartsWithDot)(
5950
- (0, import_node_path2.relative)(project.outdir, subproject.outdir)
5951
- )
5952
- ]
5953
- };
5954
- });
5955
- project.tsconfig?.file.addOverride("compilerOptions.paths", tsPaths);
5956
- project.tsconfigDev?.file.addOverride("compilerOptions.paths", tsPaths);
5957
- }
5958
- };
5916
+ // src/projects/aws-cdk-project.ts
5917
+ var import_projen19 = require("projen");
5918
+ var import_javascript5 = require("projen/lib/javascript");
5919
+ var import_release2 = require("projen/lib/release");
5920
+ var import_ts_deepmerge3 = require("ts-deepmerge");
5959
5921
 
5960
5922
  // src/workflows/aws-deploy-workflow.ts
5961
5923
  var import_utils11 = __toESM(require_lib());
5962
- var import_projen19 = require("projen");
5924
+ var import_projen18 = require("projen");
5963
5925
  var import_build = require("projen/lib/build");
5964
5926
  var import_github2 = require("projen/lib/github");
5965
5927
  var import_workflows_model5 = require("projen/lib/github/workflows-model");
5966
5928
  var PROD_DEPLOY_NAME = "prod-deploy";
5967
- var AwsDeployWorkflow = class _AwsDeployWorkflow extends import_projen19.Component {
5929
+ var AwsDeployWorkflow = class _AwsDeployWorkflow extends import_projen18.Component {
5968
5930
  constructor(project, options = {}) {
5969
5931
  super(project);
5970
5932
  this.project = project;
@@ -6227,6 +6189,226 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends import_projen19.Compone
6227
6189
  super.preSynthesize();
6228
6190
  }
6229
6191
  };
6192
+
6193
+ // src/projects/aws-cdk-project.ts
6194
+ var AwsCdkProject = class extends import_projen19.awscdk.AwsCdkTypeScriptApp {
6195
+ constructor(userOptions) {
6196
+ if (!(userOptions.parent instanceof MonorepoProject)) {
6197
+ throw new Error(
6198
+ "AwsCdkProject must be parented to a MonorepoProject. Pass `parent: <MonorepoProject>` in the project options."
6199
+ );
6200
+ }
6201
+ const parent = userOptions.parent;
6202
+ const pnpmVersion = parent.pnpmVersion;
6203
+ const pnpmWorkspace = PnpmWorkspace.of(parent);
6204
+ const testRunner = userOptions.testRunner ?? TestRunner.JEST;
6205
+ const useJest = testRunner === TestRunner.JEST;
6206
+ const defaultOptions = {
6207
+ defaultReleaseBranch: "main",
6208
+ /**
6209
+ * Enable reset task by default.
6210
+ */
6211
+ resetTask: true,
6212
+ /**
6213
+ * Packaging options.
6214
+ */
6215
+ packageManager: import_javascript5.NodePackageManager.PNPM,
6216
+ pnpmVersion,
6217
+ licensed: userOptions.license !== void 0 || false,
6218
+ copyrightOwner: "CodeDrifters",
6219
+ release: false,
6220
+ /**
6221
+ * Don't add sample code.
6222
+ */
6223
+ sampleCode: false,
6224
+ /**
6225
+ * CDK versions sourced from the configulator-managed catalog.
6226
+ */
6227
+ cdkVersion: VERSION.AWS_CDK_LIB_VERSION,
6228
+ cdkCliVersion: VERSION.AWS_CDK_CLI_VERSION,
6229
+ ...useJest ? {
6230
+ /**
6231
+ * Make sure jest config is stored outside of package.json and use
6232
+ * SWC for faster compilation (matches TypeScriptProject).
6233
+ */
6234
+ jestOptions: {
6235
+ configFilePath: "jest.config.json",
6236
+ jestConfig: {
6237
+ roots: [`<rootDir>/src`],
6238
+ transform: {
6239
+ ["^.+\\.[t]sx?$"]: new import_javascript5.Transform("@swc/jest")
6240
+ },
6241
+ moduleFileExtensions: ["js", "ts"]
6242
+ }
6243
+ },
6244
+ devDeps: ["@swc/jest", "@swc/core"]
6245
+ } : {
6246
+ jest: false,
6247
+ devDeps: []
6248
+ },
6249
+ /**
6250
+ * Turn on prettier formatting.
6251
+ */
6252
+ prettier: true,
6253
+ /**
6254
+ * Don't package test files.
6255
+ */
6256
+ npmIgnoreOptions: {
6257
+ ignorePatterns: ["*.spec.*", "*.test.*"]
6258
+ },
6259
+ /**
6260
+ * Options for the automated dependency upgrade task / workflow.
6261
+ * Exclude any packages managed by the parent project's default catalog
6262
+ * so the catalog stays the source of truth.
6263
+ */
6264
+ depsUpgrade: true,
6265
+ depsUpgradeOptions: {
6266
+ workflow: false,
6267
+ exclude: Object.keys(pnpmWorkspace?.defaultCatalog || {}),
6268
+ workflowOptions: {
6269
+ schedule: import_javascript5.UpgradeDependenciesSchedule.WEEKLY
6270
+ },
6271
+ cooldown: 1
6272
+ },
6273
+ /**
6274
+ * Only release when the package source content or package.json changes.
6275
+ */
6276
+ releaseTrigger: import_release2.ReleaseTrigger.continuous({
6277
+ paths: [
6278
+ `${userOptions.outdir}/src/**`,
6279
+ `${userOptions.outdir}/package.json`
6280
+ ]
6281
+ })
6282
+ };
6283
+ const options = (0, import_ts_deepmerge3.merge)(defaultOptions, userOptions);
6284
+ super(options);
6285
+ this.addDevDeps("@types/node@catalog:");
6286
+ this.tsconfig?.addExclude("**/*.test.*");
6287
+ this.tsconfig?.addExclude("**/*.spec.*");
6288
+ if (testRunner === TestRunner.VITEST) {
6289
+ new Vitest(this, {
6290
+ config: {
6291
+ include: ["src/**/*.{test,spec}.?(c|m)[jt]s?(x)"],
6292
+ ...options.vitestOptions?.config
6293
+ },
6294
+ ...options.vitestOptions
6295
+ });
6296
+ } else {
6297
+ this.deps.removeDependency("ts-jest");
6298
+ }
6299
+ this.package.file.addOverride(
6300
+ "packageManager",
6301
+ `pnpm@${options.pnpmVersion}`
6302
+ );
6303
+ this.eslint?.addOverride({
6304
+ files: ["**/*.test.*", "**/*.spec.*"],
6305
+ rules: {
6306
+ "import/no-extraneous-dependencies": "off"
6307
+ }
6308
+ });
6309
+ this.gitignore?.addPatterns(".DS_Store", "test-reports", "cdk.out");
6310
+ this.npmignore?.addPatterns("*.spec.*", "*.test.*", "__fixtures__");
6311
+ new AwsDeploymentConfig(this);
6312
+ (options.deploymentTargets ?? []).forEach(
6313
+ (targetOptions) => this.addDeploymentTarget(targetOptions)
6314
+ );
6315
+ const targetsForAutoDerive = AwsDeploymentConfig.of(this)?.awsDeploymentTargets ?? [];
6316
+ const deployWorkflows = options.deployWorkflows ?? Array.from(new Set(targetsForAutoDerive.map((t) => t.awsStageType))).map(
6317
+ (awsStageType) => ({
6318
+ awsStageType,
6319
+ buildWorkflow: options.sharedBuildWorkflow
6320
+ })
6321
+ );
6322
+ deployWorkflows.forEach(
6323
+ (workflowOptions) => new AwsDeployWorkflow(this, workflowOptions)
6324
+ );
6325
+ const turboActive = TurboRepo.of(parent) !== void 0;
6326
+ if (turboActive) {
6327
+ const turbo = new TurboRepo(this);
6328
+ turbo.postCompileTask?.outputs.push("dist/**");
6329
+ turbo.postCompileTask?.inputs.push("src/**");
6330
+ }
6331
+ if (options.agentConfig === true || typeof options.agentConfig === "object") {
6332
+ new AgentConfig(
6333
+ this,
6334
+ typeof options.agentConfig === "object" ? options.agentConfig : {}
6335
+ );
6336
+ }
6337
+ if (options.resetTask !== false) {
6338
+ const defaultResetTaskOptions = {
6339
+ pathsToRemove: [
6340
+ "node_modules",
6341
+ "dist",
6342
+ "lib",
6343
+ "cdk.out",
6344
+ "coverage",
6345
+ "test-reports",
6346
+ ".turbo",
6347
+ "tsconfig.tsbuildinfo",
6348
+ this.artifactsDirectory
6349
+ ]
6350
+ };
6351
+ const userResetTaskOptions = options.resetTaskOptions ?? {};
6352
+ const resetTaskOptions = (0, import_ts_deepmerge3.merge)(
6353
+ defaultResetTaskOptions,
6354
+ {
6355
+ ...userResetTaskOptions,
6356
+ pathsToRemove: [
6357
+ ...defaultResetTaskOptions.pathsToRemove ?? [],
6358
+ ...userResetTaskOptions.pathsToRemove ?? []
6359
+ ]
6360
+ }
6361
+ );
6362
+ new ResetTask(this, resetTaskOptions);
6363
+ }
6364
+ const originalResolve = this.package.resolveDepsAndWritePackageJson;
6365
+ this.package.installDependencies = () => {
6366
+ parent.requestInstallDependencies({
6367
+ resolveDepsAndWritePackageJson: () => originalResolve.apply(this.package)
6368
+ });
6369
+ };
6370
+ this.package.resolveDepsAndWritePackageJson = () => {
6371
+ };
6372
+ }
6373
+ /**
6374
+ * Add an AWS deployment target to this project after construction. The
6375
+ * target is registered on the existing `AwsDeploymentConfig` and immediately
6376
+ * available for `AwsDeployWorkflow` consumption.
6377
+ */
6378
+ addDeploymentTarget(options) {
6379
+ return new AwsDeploymentTarget(this, options);
6380
+ }
6381
+ };
6382
+
6383
+ // src/typescript/typescript-config.ts
6384
+ var import_node_path2 = require("path");
6385
+ var import_projen20 = require("projen");
6386
+ var import_path2 = require("projen/lib/util/path");
6387
+ var TypeScriptConfig = class extends import_projen20.Component {
6388
+ constructor(project) {
6389
+ super(project);
6390
+ let tsPaths = {};
6391
+ const workspaceDeps = project.deps.all.filter(
6392
+ (d) => d.version === "workspace:*"
6393
+ );
6394
+ workspaceDeps.forEach((dep) => {
6395
+ const subproject = project.root.subprojects.find((p) => p.package.packageName === dep.name);
6396
+ if (!subproject) {
6397
+ throw new Error(`Could not find subproject ${dep.name} in monorepo.`);
6398
+ }
6399
+ tsPaths = {
6400
+ ...tsPaths,
6401
+ [dep.name]: [
6402
+ (0, import_path2.ensureRelativePathStartsWithDot)(
6403
+ (0, import_node_path2.relative)(project.outdir, subproject.outdir)
6404
+ )
6405
+ ]
6406
+ };
6407
+ });
6408
+ project.tsconfig?.file.addOverride("compilerOptions.paths", tsPaths);
6409
+ project.tsconfigDev?.file.addOverride("compilerOptions.paths", tsPaths);
6410
+ }
6411
+ };
6230
6412
  // Annotate the CommonJS export names for ESM import in node:
6231
6413
  0 && (module.exports = {
6232
6414
  AGENT_MODEL,
@@ -6236,6 +6418,7 @@ var AwsDeployWorkflow = class _AwsDeployWorkflow extends import_projen19.Compone
6236
6418
  AstroConfig,
6237
6419
  AstroOutput,
6238
6420
  AstroProject,
6421
+ AwsCdkProject,
6239
6422
  AwsDeployWorkflow,
6240
6423
  AwsDeploymentConfig,
6241
6424
  AwsDeploymentTarget,