@codedrifters/configulator 0.0.154 → 0.0.156

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.ts CHANGED
@@ -671,6 +671,20 @@ interface AgentConfigOptions {
671
671
  * Names of individual rules to exclude from any source.
672
672
  */
673
673
  readonly excludeRules?: ReadonlyArray<string>;
674
+ /**
675
+ * Additional content to append to existing rules (from bundles or custom rules).
676
+ * Keys are rule names, values are markdown content appended after a horizontal rule.
677
+ * Use this to supplement bundle rules with project-specific additions without
678
+ * replacing the entire rule.
679
+ *
680
+ * @example
681
+ * ```ts
682
+ * ruleExtensions: {
683
+ * 'typescript-conventions': '## Additional Conventions\n\n- Use branded types for IDs',
684
+ * }
685
+ * ```
686
+ */
687
+ readonly ruleExtensions?: Readonly<Record<string, string>>;
674
688
  /**
675
689
  * Claude Code settings.json configuration.
676
690
  * Generated to .claude/settings.json (committed, team-shared).
@@ -718,16 +732,326 @@ declare class AgentConfig extends Component {
718
732
  private resolveRules;
719
733
  private resolveSkills;
720
734
  private resolveSubAgents;
735
+ /**
736
+ * Resolves template variables in rule content using project metadata.
737
+ * Emits synthesis warnings for rules with unresolved variables.
738
+ */
739
+ private resolveTemplates;
740
+ /**
741
+ * Resolves template variables in skill instructions using project metadata.
742
+ */
743
+ private resolveSkillTemplates;
744
+ /**
745
+ * Resolves template variables in sub-agent prompts using project metadata.
746
+ */
747
+ private resolveSubAgentTemplates;
721
748
  }
722
749
 
750
+ /**
751
+ * AWS CDK bundle — auto-detected when `aws-cdk-lib` is in dependencies.
752
+ */
753
+ declare const awsCdkBundle: AgentRuleBundle;
754
+
755
+ /**
756
+ * Base bundle — always included unless `includeBaseRules: false`.
757
+ * Contains project-overview, interaction-style, and general-conventions rules.
758
+ */
759
+ declare const baseBundle: AgentRuleBundle;
760
+
761
+ /**
762
+ * Jest bundle — auto-detected when Jest is in dependencies.
763
+ */
764
+ declare const jestBundle: AgentRuleBundle;
765
+
766
+ /**
767
+ * PNPM bundle — auto-detected when the PnpmWorkspace component is present.
768
+ */
769
+ declare const pnpmBundle: AgentRuleBundle;
770
+
771
+ /**
772
+ * Projen bundle — auto-detected when `projen` is in dependencies.
773
+ */
774
+ declare const projenBundle: AgentRuleBundle;
775
+
776
+ /**
777
+ * Turborepo bundle — auto-detected when the TurboRepo component is present.
778
+ */
779
+ declare const turborepoBundle: AgentRuleBundle;
780
+
781
+ /**
782
+ * TypeScript bundle — auto-detected when a tsconfig is present.
783
+ */
784
+ declare const typescriptBundle: AgentRuleBundle;
785
+
786
+ /**
787
+ * Vitest bundle — auto-detected when the Vitest component is present.
788
+ */
789
+ declare const vitestBundle: AgentRuleBundle;
790
+
723
791
  /**
724
792
  * Built-in rule bundles that ship with configulator.
725
793
  * Each bundle is auto-detected based on project introspection.
726
794
  *
727
- * Actual bundles are added in issue #101.
795
+ * Order matters: base is first so its rules can be overridden by
796
+ * more specific bundles. The base bundle's `appliesWhen` always
797
+ * returns true; it is filtered by the `includeBaseRules` option
798
+ * in AgentConfig.
728
799
  */
729
800
  declare const BUILT_IN_BUNDLES: ReadonlyArray<AgentRuleBundle>;
730
801
 
802
+ /*******************************************************************************
803
+ *
804
+ * Repository Metadata
805
+ *
806
+ ******************************************************************************/
807
+ /**
808
+ * Repository identity. Required fields are auto-detected when not provided.
809
+ */
810
+ interface RepositoryMetadata {
811
+ /**
812
+ * Repository owner (GitHub user or organization).
813
+ * Auto-detected from package.json repository URL when not provided.
814
+ * @example 'codedrifters'
815
+ */
816
+ readonly owner?: string;
817
+ /**
818
+ * Repository name.
819
+ * Auto-detected from package.json repository URL when not provided.
820
+ * @example 'packages'
821
+ */
822
+ readonly name?: string;
823
+ /**
824
+ * Default branch name.
825
+ * @default 'main'
826
+ */
827
+ readonly defaultBranch?: string;
828
+ }
829
+ /*******************************************************************************
830
+ *
831
+ * GitHub Projects Metadata
832
+ *
833
+ ******************************************************************************/
834
+ /**
835
+ * A board or view within a GitHub Project.
836
+ */
837
+ interface GitHubBoardMetadata {
838
+ /** Board/view name. */
839
+ readonly name: string;
840
+ /** Board/view ID. */
841
+ readonly id?: string;
842
+ }
843
+ /**
844
+ * Sprint/iteration field metadata for GitHub Projects.
845
+ */
846
+ interface GitHubSprintMetadata {
847
+ /** Name of the iteration field in GitHub Projects. */
848
+ readonly fieldName?: string;
849
+ /** Current sprint/iteration name. */
850
+ readonly current?: string;
851
+ /** Known sprint/iteration names. */
852
+ readonly iterations?: ReadonlyArray<string>;
853
+ }
854
+ /**
855
+ * GitHub Projects (v2) context for workflow automation.
856
+ */
857
+ interface GitHubProjectMetadata {
858
+ /**
859
+ * GitHub Project name.
860
+ * @example 'CodeDrifters Packages'
861
+ */
862
+ readonly name?: string;
863
+ /**
864
+ * GitHub Project number (visible in the project URL).
865
+ * @example 3
866
+ */
867
+ readonly number?: number;
868
+ /**
869
+ * GitHub Project node ID (for GraphQL API).
870
+ * @example 'PVT_kwHOABCDEf4AGHIJ'
871
+ */
872
+ readonly nodeId?: string;
873
+ /**
874
+ * Board or view definitions within the project.
875
+ */
876
+ readonly boards?: ReadonlyArray<GitHubBoardMetadata>;
877
+ /**
878
+ * Sprint/iteration field metadata.
879
+ */
880
+ readonly sprints?: GitHubSprintMetadata;
881
+ /**
882
+ * Kanban column (status field) definitions.
883
+ * @example [{ name: 'To Do', id: 'status_1' }, { name: 'In Progress', id: 'status_2' }]
884
+ */
885
+ readonly columns?: ReadonlyArray<{
886
+ readonly name: string;
887
+ readonly id?: string;
888
+ }>;
889
+ }
890
+ /*******************************************************************************
891
+ *
892
+ * Organization Metadata
893
+ *
894
+ ******************************************************************************/
895
+ /**
896
+ * Organization or team context.
897
+ */
898
+ interface OrganizationMetadata {
899
+ /**
900
+ * Organization or team display name.
901
+ * Used in generated documentation and rule content.
902
+ * @example 'CodeDrifters'
903
+ */
904
+ readonly name?: string;
905
+ /**
906
+ * GitHub organization login (may differ from display name).
907
+ * @example 'codedrifters'
908
+ */
909
+ readonly githubOrg?: string;
910
+ }
911
+ /*******************************************************************************
912
+ *
913
+ * Slack Metadata
914
+ *
915
+ ******************************************************************************/
916
+ /**
917
+ * Slack channel references for workflow skills.
918
+ */
919
+ interface SlackMetadata {
920
+ /**
921
+ * Primary project channel.
922
+ * @example '#packages-dev'
923
+ */
924
+ readonly projectChannel?: string;
925
+ /**
926
+ * Alerts or notifications channel.
927
+ * @example '#packages-alerts'
928
+ */
929
+ readonly alertsChannel?: string;
930
+ /**
931
+ * Additional named channels. Keys are purpose identifiers.
932
+ * @example { releases: '#releases', support: '#customer-support' }
933
+ */
934
+ readonly channels?: Readonly<Record<string, string>>;
935
+ }
936
+ /*******************************************************************************
937
+ *
938
+ * Deployment Metadata
939
+ *
940
+ ******************************************************************************/
941
+ /**
942
+ * Deployment and environment hints.
943
+ */
944
+ interface DeploymentMetadata {
945
+ /**
946
+ * AWS account ID for the primary deployment target.
947
+ * @example '123456789012'
948
+ */
949
+ readonly awsAccountId?: string;
950
+ /**
951
+ * Primary AWS region.
952
+ * @example 'us-east-1'
953
+ */
954
+ readonly awsRegion?: string;
955
+ /**
956
+ * Named environments.
957
+ * @example { dev: { accountId: '111', region: 'us-east-1' }, prod: { accountId: '222', region: 'us-east-1' } }
958
+ */
959
+ readonly environments?: Readonly<Record<string, {
960
+ readonly accountId?: string;
961
+ readonly region?: string;
962
+ }>>;
963
+ }
964
+ /*******************************************************************************
965
+ *
966
+ * ProjectMetadata Options & Resolved Shape
967
+ *
968
+ ******************************************************************************/
969
+ /**
970
+ * Options for the ProjectMetadata component.
971
+ */
972
+ interface ProjectMetadataOptions {
973
+ /**
974
+ * Repository identity. When omitted, auto-detected from the Projen
975
+ * project's package.json repository field.
976
+ */
977
+ readonly repository?: RepositoryMetadata;
978
+ /**
979
+ * GitHub Projects (v2) context for workflow automation.
980
+ * Optional — only needed when skills or rules reference project boards.
981
+ */
982
+ readonly githubProject?: GitHubProjectMetadata;
983
+ /**
984
+ * Organization or team metadata.
985
+ * Optional — used in branch naming, PR conventions, and rule content.
986
+ */
987
+ readonly organization?: OrganizationMetadata;
988
+ /**
989
+ * Slack channel references for workflow skills.
990
+ * Optional — only needed when skills post to or reference Slack channels.
991
+ */
992
+ readonly slack?: SlackMetadata;
993
+ /**
994
+ * Important label names used by the project.
995
+ * Optional — allows skills and rules to reference canonical labels.
996
+ * @example ['auto-approve', 'wontfix', 'breaking-change']
997
+ */
998
+ readonly labels?: ReadonlyArray<string>;
999
+ /**
1000
+ * Milestone names or IDs for release planning.
1001
+ * Optional — allows skills to reference milestones by name.
1002
+ */
1003
+ readonly milestones?: ReadonlyArray<string>;
1004
+ /**
1005
+ * Documentation base path (relative to repo root) or external URL.
1006
+ * Optional — used by "reference docs" skills to point to the right location.
1007
+ * @example 'docs/' or 'https://docs.example.com'
1008
+ */
1009
+ readonly docsPath?: string;
1010
+ /**
1011
+ * Deployment or environment hints.
1012
+ * Optional — used by deploy-related skills or rules.
1013
+ */
1014
+ readonly deployment?: DeploymentMetadata;
1015
+ }
1016
+ /**
1017
+ * Resolved project metadata with auto-detected values filled in.
1018
+ * Consumed by AgentConfig and other configulator features at synthesis time.
1019
+ */
1020
+ interface ResolvedProjectMetadata {
1021
+ readonly repository: {
1022
+ readonly owner: string | undefined;
1023
+ readonly name: string | undefined;
1024
+ /** Always has a value (default: 'main'). */
1025
+ readonly defaultBranch: string;
1026
+ };
1027
+ readonly githubProject?: GitHubProjectMetadata;
1028
+ readonly organization?: OrganizationMetadata;
1029
+ readonly slack?: SlackMetadata;
1030
+ readonly labels?: ReadonlyArray<string>;
1031
+ readonly milestones?: ReadonlyArray<string>;
1032
+ readonly docsPath?: string;
1033
+ readonly deployment?: DeploymentMetadata;
1034
+ }
1035
+
1036
+ /**
1037
+ * Result of template variable resolution.
1038
+ */
1039
+ interface TemplateResolveResult {
1040
+ /** The template string with all variables resolved or replaced with fallbacks. */
1041
+ readonly resolved: string;
1042
+ /** Template variable keys that could not be resolved from metadata. */
1043
+ readonly unresolvedKeys: ReadonlyArray<string>;
1044
+ }
1045
+ /**
1046
+ * Resolves `{{dotted.path}}` template variables in a string using project metadata.
1047
+ * Unresolved variables are replaced with their fallback placeholders.
1048
+ *
1049
+ * @param template - String potentially containing `{{variable}}` patterns
1050
+ * @param metadata - Resolved project metadata, or undefined if not available
1051
+ * @returns The resolved string and a list of any unresolved variable keys
1052
+ */
1053
+ declare function resolveTemplateVariables(template: string, metadata: ResolvedProjectMetadata | undefined): TemplateResolveResult;
1054
+
731
1055
  /*******************************************************************************
732
1056
  *
733
1057
  * Git configs for this repo. This venn diagram has a great deal of overlap
@@ -2037,6 +2361,30 @@ interface MonorepoProjectOptions extends Omit<TypeScriptProjectOptions$1, "defau
2037
2361
  * @default true
2038
2362
  */
2039
2363
  readonly configulatorRegistryConsumer?: boolean;
2364
+ /**
2365
+ * Project metadata configuration. Provides repository identity,
2366
+ * GitHub project context, and organizational details consumed by
2367
+ * AgentConfig and other features at synthesis time.
2368
+ *
2369
+ * - `undefined` or `{}`: auto-instantiate with auto-detection (default)
2370
+ * - `ProjectMetadataOptions`: explicit metadata configuration
2371
+ * - `false`: disable ProjectMetadata entirely
2372
+ *
2373
+ * @default {} (auto-detect from package.json)
2374
+ */
2375
+ readonly projectMetadata?: ProjectMetadataOptions | false;
2376
+ /**
2377
+ * Enable AI agent configuration (Cursor, Claude Code rules).
2378
+ * When true, generates rule files at the monorepo root with auto-detected
2379
+ * bundles based on project and subproject introspection.
2380
+ *
2381
+ * @default false
2382
+ */
2383
+ readonly agentConfig?: boolean;
2384
+ /**
2385
+ * Options for the AgentConfig component. Only used when `agentConfig` is true.
2386
+ */
2387
+ readonly agentConfigOptions?: AgentConfigOptions;
2040
2388
  }
2041
2389
  declare class MonorepoProject extends TypeScriptAppProject {
2042
2390
  /**
@@ -2061,6 +2409,38 @@ declare class MonorepoProject extends TypeScriptAppProject {
2061
2409
  postSynthesize(): void;
2062
2410
  }
2063
2411
 
2412
+ /**
2413
+ * Provides structured project metadata consumed by AgentConfig, skills,
2414
+ * and other configulator features at synthesis time.
2415
+ *
2416
+ * This is a project-level component — it describes the project itself,
2417
+ * not any specific feature. It lives alongside MonorepoProject and
2418
+ * TypeScriptProject and is discovered by consumers via the static
2419
+ * `.of()` factory method.
2420
+ */
2421
+ declare class ProjectMetadata extends Component {
2422
+ /**
2423
+ * Returns the ProjectMetadata instance for a project, or undefined
2424
+ * if the component has not been added.
2425
+ */
2426
+ static of(project: Project): ProjectMetadata | undefined;
2427
+ /** Resolved metadata with auto-detected values filled in. */
2428
+ readonly metadata: ResolvedProjectMetadata;
2429
+ constructor(project: Project, options?: ProjectMetadataOptions);
2430
+ /**
2431
+ * Merges explicit options with auto-detected values.
2432
+ * Auto-detection reads the repository URL from package.json
2433
+ * (via Projen's NodePackage manifest) and parses GitHub owner/name.
2434
+ * Explicit options always take precedence over auto-detected values.
2435
+ */
2436
+ private resolveMetadata;
2437
+ /**
2438
+ * Attempts to auto-detect repository owner and name from the Projen
2439
+ * project's package.json repository field.
2440
+ */
2441
+ private autoDetectRepository;
2442
+ }
2443
+
2064
2444
  /**
2065
2445
  * Options for the Vitest config (test block in vitest.config).
2066
2446
  *
@@ -2309,5 +2689,5 @@ declare const COMPLETE_JOB_ID = "complete";
2309
2689
  */
2310
2690
  declare function addBuildCompleteJob(buildWorkflow: BuildWorkflow): void;
2311
2691
 
2312
- 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, 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, getLatestEligibleVersion };
2313
- 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, CursorHookAction, CursorHooksConfig, CursorSettingsConfig, DeployWorkflowOptions, GitBranch, IDependencyResolver, McpServerConfig, McpTransport, MergeMethod, MonorepoProjectOptions, PnpmWorkspaceOptions, RemoteCacheOptions, ResetTaskOptions, TurboRepoOptions, TurboRepoTaskOptions, TypeScriptProjectOptions, VersionKey, VitestConfigOptions, VitestOptions };
2692
+ 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 };
2693
+ 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, 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 };