@codedrifters/configulator 0.0.256 → 0.0.258

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
@@ -243,8 +243,12 @@ __export(index_exports, {
243
243
  pnpmBundle: () => pnpmBundle,
244
244
  prReviewBundle: () => prReviewBundle,
245
245
  projenBundle: () => projenBundle,
246
+ renderCustomDocSectionBlock: () => renderCustomDocSectionBlock,
247
+ renderCustomDocSections: () => renderCustomDocSections,
246
248
  renderFocusSection: () => renderFocusSection,
249
+ renderMeetingTypesSection: () => renderMeetingTypesSection,
247
250
  renderPriorityRulesSection: () => renderPriorityRulesSection,
251
+ renderSourceTierExamples: () => renderSourceTierExamples,
248
252
  requirementsAnalystBundle: () => requirementsAnalystBundle,
249
253
  requirementsReviewerBundle: () => requirementsReviewerBundle,
250
254
  requirementsWriterBundle: () => requirementsWriterBundle,
@@ -1389,6 +1393,98 @@ var baseBundle = {
1389
1393
  ].join("\n"),
1390
1394
  tags: ["project"]
1391
1395
  },
1396
+ {
1397
+ name: "source-quality-verification",
1398
+ description: "Source tier hierarchy (T1\u2013T4), conflict resolution, temporal validity, and source-annotation format for research-producing agents",
1399
+ scope: AGENT_RULE_SCOPE.ALWAYS,
1400
+ content: [
1401
+ "# Source Quality & Verification",
1402
+ "",
1403
+ "All research-producing agents must follow this source hierarchy when",
1404
+ "writing profiles and reference documents. The tiers govern which",
1405
+ "source to prefer when claims conflict and when time-sensitive claims",
1406
+ "need re-verification.",
1407
+ "",
1408
+ "## Source Tier Hierarchy",
1409
+ "",
1410
+ "### T1 \u2014 Primary Living",
1411
+ "",
1412
+ "Authoritative sources that update when reality changes.",
1413
+ "Use these for current-state claims. Examples:",
1414
+ "",
1415
+ "- Official product docs and API references",
1416
+ "- Company about / leadership / team pages",
1417
+ "- Live government registries (SEC EDGAR, Companies House)",
1418
+ "- Current-role LinkedIn profiles",
1419
+ "- Investor relations pages",
1420
+ "",
1421
+ "### T2 \u2014 Primary Snapshot",
1422
+ "",
1423
+ "Authoritative but time-stamped sources straight from the subject.",
1424
+ "Trust for current state only when fresh (< 6 months) and no T1",
1425
+ "source contradicts them. Examples:",
1426
+ "",
1427
+ "- Press releases from the entity",
1428
+ "- Earnings transcripts and investor calls",
1429
+ "- Regulatory filings (10-K, 10-Q, 8-K)",
1430
+ "- Official announcements and conference presentations",
1431
+ "",
1432
+ "### T3 \u2014 Secondary",
1433
+ "",
1434
+ "Third-party sources that interpret or re-report primary material.",
1435
+ "Good for context and triangulation; T1 wins on conflict. Examples:",
1436
+ "",
1437
+ "- News articles and trade press",
1438
+ "- Industry reports and analyst research",
1439
+ "- Database aggregators (Crunchbase, PitchBook, Owler)",
1440
+ "",
1441
+ "### T4 \u2014 Self-Reported / Marketing",
1442
+ "",
1443
+ "Promotional or unverified sources. Use for discovery and leads only",
1444
+ "\u2014 never as the sole source for a factual claim, and always note the",
1445
+ "self-reported nature in the annotation. Examples:",
1446
+ "",
1447
+ "- Vendor comparison pages and customer testimonials on vendor sites",
1448
+ "- Social-media posts",
1449
+ "- Job postings",
1450
+ "- Wikipedia",
1451
+ "",
1452
+ "## Conflict Resolution",
1453
+ "",
1454
+ "Higher tier wins. Within the same tier, more recent wins. If a newer",
1455
+ "T2 source contradicts an older T1 source on a time-sensitive claim,",
1456
+ "flag for re-verification \u2014 the T1 source may simply not have been",
1457
+ "updated yet.",
1458
+ "",
1459
+ "## Temporal Validity",
1460
+ "",
1461
+ "Some claims decay faster than others. When a fast-decay claim comes",
1462
+ "from a source older than 6 months, agents **must** attempt to",
1463
+ "corroborate it with a T1 living source. If no T1 source is available,",
1464
+ "add an inline note: `_(source: YYYY-MM, may need re-verification)_`.",
1465
+ "",
1466
+ "| Decay | Re-verify if source older than | Typical claims |",
1467
+ "|-------|-------------------------------|----------------|",
1468
+ "| **Fast** | 6 months | Leadership roles, employee count, pricing, product features, funding status, office locations |",
1469
+ "| **Slow** | 18 months | Founding year, ownership structure, core business description, industry classification, HQ location |",
1470
+ "| **Stable** | Verify once, note source date | Historical facts (acquisition dates, founding story), published financials for a specific period |",
1471
+ "",
1472
+ "## Source Annotation Format",
1473
+ "",
1474
+ "In the `## Sources` section of profiles and reference documents,",
1475
+ "annotate each source with its tier and date:",
1476
+ "",
1477
+ "```",
1478
+ "1. [Company Leadership Page](https://...) \u2014 T1, accessed 2026-04",
1479
+ "2. [Company press release](https://...) \u2014 T2, published 2026-02",
1480
+ "3. [TechCrunch coverage](https://...) \u2014 T3, published 2025-11",
1481
+ "```",
1482
+ "",
1483
+ "Use `accessed YYYY-MM` for living sources (T1) and `published YYYY-MM`",
1484
+ "for snapshot sources (T2, T3, T4)."
1485
+ ].join("\n"),
1486
+ tags: ["workflow"]
1487
+ },
1392
1488
  {
1393
1489
  name: "issue-conventions",
1394
1490
  description: "Issue title prefixes, GitHub issue type mapping, prerequisite issues",
@@ -14582,6 +14678,141 @@ var vitestBundle = {
14582
14678
  }
14583
14679
  };
14584
14680
 
14681
+ // src/agent/bundles/features.ts
14682
+ var SOURCE_TIER_HEADINGS = [
14683
+ { key: "t1", heading: "### T1 \u2014 Primary Living" },
14684
+ { key: "t2", heading: "### T2 \u2014 Primary Snapshot" },
14685
+ { key: "t3", heading: "### T3 \u2014 Secondary" },
14686
+ { key: "t4", heading: "### T4 \u2014 Self-Reported / Marketing" }
14687
+ ];
14688
+ function renderSourceTierExamples(content, examples) {
14689
+ if (!examples) {
14690
+ return content;
14691
+ }
14692
+ const tierEntries = SOURCE_TIER_HEADINGS.flatMap(({ key, heading }) => {
14693
+ const list = examples[key];
14694
+ if (!list || list.length === 0) {
14695
+ return [];
14696
+ }
14697
+ return [{ heading, list }];
14698
+ });
14699
+ if (tierEntries.length === 0) {
14700
+ return content;
14701
+ }
14702
+ let updated = content;
14703
+ for (const { heading, list } of tierEntries) {
14704
+ const injection = [
14705
+ "",
14706
+ "**Project-specific examples:**",
14707
+ "",
14708
+ ...list.map((ex) => `- ${ex}`)
14709
+ ].join("\n");
14710
+ updated = insertAfterHeadingBlock(updated, heading, injection);
14711
+ }
14712
+ return updated;
14713
+ }
14714
+ function renderCustomDocSections(bundle, sections) {
14715
+ const matching = sections.filter((s) => s.bundleName === bundle.name);
14716
+ if (matching.length === 0) {
14717
+ return bundle;
14718
+ }
14719
+ let rules = bundle.rules;
14720
+ const currentAnchorByTarget = /* @__PURE__ */ new Map();
14721
+ for (const section of matching) {
14722
+ const injection = renderCustomDocSectionBlock(section);
14723
+ const seededAnchor = currentAnchorByTarget.get(section.afterSection);
14724
+ let targetIndex = -1;
14725
+ let targetHeading = "";
14726
+ for (let i = 0; i < rules.length; i += 1) {
14727
+ if (seededAnchor && rules[i].content.includes(seededAnchor)) {
14728
+ targetIndex = i;
14729
+ targetHeading = seededAnchor;
14730
+ break;
14731
+ }
14732
+ if (!seededAnchor) {
14733
+ const match = findHeadingForTitle(
14734
+ rules[i].content,
14735
+ section.afterSection
14736
+ );
14737
+ if (match) {
14738
+ targetIndex = i;
14739
+ targetHeading = match;
14740
+ break;
14741
+ }
14742
+ }
14743
+ }
14744
+ if (targetIndex === -1) {
14745
+ continue;
14746
+ }
14747
+ const targetRule = rules[targetIndex];
14748
+ const updatedRule = {
14749
+ ...targetRule,
14750
+ content: insertAfterHeadingBlock(
14751
+ targetRule.content,
14752
+ targetHeading,
14753
+ injection
14754
+ )
14755
+ };
14756
+ rules = [
14757
+ ...rules.slice(0, targetIndex),
14758
+ updatedRule,
14759
+ ...rules.slice(targetIndex + 1)
14760
+ ];
14761
+ currentAnchorByTarget.set(
14762
+ section.afterSection,
14763
+ `## ${section.sectionTitle}`
14764
+ );
14765
+ }
14766
+ if (rules === bundle.rules) {
14767
+ return bundle;
14768
+ }
14769
+ return { ...bundle, rules };
14770
+ }
14771
+ function renderCustomDocSectionBlock(section) {
14772
+ const body = section.body.replace(/[\r\n]+$/u, "");
14773
+ return ["", `## ${section.sectionTitle}`, "", body].join("\n");
14774
+ }
14775
+ function findHeadingForTitle(content, title) {
14776
+ const lines = content.split("\n");
14777
+ for (const line of lines) {
14778
+ const match = line.match(/^(#{1,6}) (.+)$/u);
14779
+ if (match && match[2] === title) {
14780
+ return line;
14781
+ }
14782
+ }
14783
+ return void 0;
14784
+ }
14785
+ function insertAfterHeadingBlock(content, heading, injection) {
14786
+ const lines = content.split("\n");
14787
+ const headingIndex = lines.findIndex((line) => line === heading);
14788
+ if (headingIndex === -1) {
14789
+ return content;
14790
+ }
14791
+ const headingLevel = countLeadingHashes(heading);
14792
+ let endIndex = lines.length - 1;
14793
+ for (let i = headingIndex + 1; i < lines.length; i += 1) {
14794
+ const nextLevel = countLeadingHashes(lines[i]);
14795
+ if (nextLevel > 0 && nextLevel <= headingLevel) {
14796
+ endIndex = i - 1;
14797
+ break;
14798
+ }
14799
+ }
14800
+ while (endIndex > headingIndex && lines[endIndex] === "") {
14801
+ endIndex -= 1;
14802
+ }
14803
+ const injectionLines = injection.split("\n");
14804
+ const next = [
14805
+ ...lines.slice(0, endIndex + 1),
14806
+ ...injectionLines,
14807
+ ...lines.slice(endIndex + 1)
14808
+ ];
14809
+ return next.join("\n");
14810
+ }
14811
+ function countLeadingHashes(line) {
14812
+ const match = line.match(/^(#{1,6}) /u);
14813
+ return match ? match[1].length : 0;
14814
+ }
14815
+
14585
14816
  // src/agent/bundles/focus.ts
14586
14817
  var DEFAULT_FOCUS_FILE_PATH = ".claude/focus.json";
14587
14818
  var DEFAULT_SCHEMA_VERSION = 1;
@@ -14702,6 +14933,70 @@ function renderFocusSection(focus) {
14702
14933
  return lines.join("\n");
14703
14934
  }
14704
14935
 
14936
+ // src/agent/bundles/meeting-types.ts
14937
+ var DEFAULT_AGENDA_TEMPLATE_ROOT = "<meetingsRoot>/_agenda-templates";
14938
+ function renderMeetingTypesSection(meetings) {
14939
+ if (!meetings) {
14940
+ return "";
14941
+ }
14942
+ const types = meetings.meetingTypes ?? [];
14943
+ const areas = meetings.meetingAreas ?? [];
14944
+ if (types.length === 0 && areas.length === 0) {
14945
+ return "";
14946
+ }
14947
+ const sections = [];
14948
+ if (types.length > 0) {
14949
+ sections.push(renderMeetingTypes(types, meetings.agendaTemplateRoot));
14950
+ }
14951
+ if (areas.length > 0) {
14952
+ sections.push(renderMeetingAreas(areas));
14953
+ }
14954
+ return sections.join("\n\n");
14955
+ }
14956
+ function renderMeetingTypes(types, agendaTemplateRoot) {
14957
+ const resolvedRoot = agendaTemplateRoot ?? DEFAULT_AGENDA_TEMPLATE_ROOT;
14958
+ const lines = [
14959
+ "## Recognized meeting types",
14960
+ "",
14961
+ "This project declares a meeting-type taxonomy through",
14962
+ "`AgentConfigOptions.meetings.meetingTypes`. When classifying a",
14963
+ "meeting transcript, pick the `id` from this list that best fits the",
14964
+ "meeting; do **not** invent new type identifiers. Agenda-template",
14965
+ `paths below are resolved relative to \`${resolvedRoot}\`.`,
14966
+ "",
14967
+ "| ID | Label | Scope | Cadence | Default duration | Agenda template |",
14968
+ "|----|-------|-------|---------|------------------|-----------------|"
14969
+ ];
14970
+ for (const type of types) {
14971
+ const cadence = type.cadence ? `\`${type.cadence}\`` : "\u2014";
14972
+ const duration = type.defaultDurationMinutes !== void 0 ? `${type.defaultDurationMinutes} min` : "\u2014";
14973
+ const template = type.agendaTemplatePath ? `\`${type.agendaTemplatePath}\`` : "\u2014";
14974
+ lines.push(
14975
+ `| \`${type.id}\` | ${type.label} | \`${type.scope}\` | ${cadence} | ${duration} | ${template} |`
14976
+ );
14977
+ }
14978
+ return lines.join("\n");
14979
+ }
14980
+ function renderMeetingAreas(areas) {
14981
+ const lines = [
14982
+ "## Area \u2192 doc-root mapping",
14983
+ "",
14984
+ "This project declares a meeting-area routing map through",
14985
+ "`AgentConfigOptions.meetings.meetingAreas`. When a meeting note's",
14986
+ "frontmatter carries an `area:` value matching an `id` below, route",
14987
+ "phase-4 direct edits into the corresponding sub-tree of the docs",
14988
+ "root (`AgentPathsConfig.docsRoot`). Meetings whose `area` does not",
14989
+ "match any declared entry fall back to the default meetings root.",
14990
+ "",
14991
+ "| Area ID | Label | Doc-root sub-folder |",
14992
+ "|---------|-------|---------------------|"
14993
+ ];
14994
+ for (const area of areas) {
14995
+ lines.push(`| \`${area.id}\` | ${area.label} | \`${area.docRoot}\` |`);
14996
+ }
14997
+ return lines.join("\n");
14998
+ }
14999
+
14705
15000
  // src/agent/bundles/priority-rules.ts
14706
15001
  function renderPriorityRulesSection(rules) {
14707
15002
  if (rules.length === 0) {
@@ -15488,6 +15783,19 @@ var AgentConfig = class _AgentConfig extends import_projen8.Component {
15488
15783
  const isAgentConfig = (c) => c instanceof _AgentConfig;
15489
15784
  return project.components.find(isAgentConfig);
15490
15785
  }
15786
+ /**
15787
+ * Returns `true` when at least one tier array on the supplied
15788
+ * `SourceTierExamples` is non-empty, signalling that the consuming
15789
+ * repo has opted into rendering the base bundle's
15790
+ * `source-quality-verification` rule. Returns `false` for
15791
+ * `undefined`, `{}`, or a fully-empty `{ t1: [], t2: [], t3: [], t4: [] }`.
15792
+ */
15793
+ static hasActiveTierExamples(examples) {
15794
+ if (!examples) {
15795
+ return false;
15796
+ }
15797
+ return (examples.t1?.length ?? 0) > 0 || (examples.t2?.length ?? 0) > 0 || (examples.t3?.length ?? 0) > 0 || (examples.t4?.length ?? 0) > 0;
15798
+ }
15491
15799
  /**
15492
15800
  * Merges default Claude permissions with bundle and user-supplied settings.
15493
15801
  *
@@ -15691,6 +15999,40 @@ ${section}`
15691
15999
  }
15692
16000
  }
15693
16001
  }
16002
+ if (this.options.meetings) {
16003
+ const meetingRule = ruleMap.get("meeting-processing-workflow");
16004
+ if (meetingRule) {
16005
+ const section = renderMeetingTypesSection(this.options.meetings);
16006
+ if (section.length > 0) {
16007
+ ruleMap.set("meeting-processing-workflow", {
16008
+ ...meetingRule,
16009
+ content: `${meetingRule.content}
16010
+
16011
+ ---
16012
+
16013
+ ${section}`
16014
+ });
16015
+ }
16016
+ }
16017
+ }
16018
+ const tierExamples = this.options.features?.sourceTierExamples;
16019
+ if (_AgentConfig.hasActiveTierExamples(tierExamples)) {
16020
+ const sourceRule = ruleMap.get("source-quality-verification");
16021
+ if (sourceRule) {
16022
+ const updated = renderSourceTierExamples(
16023
+ sourceRule.content,
16024
+ tierExamples
16025
+ );
16026
+ if (updated !== sourceRule.content) {
16027
+ ruleMap.set("source-quality-verification", {
16028
+ ...sourceRule,
16029
+ content: updated
16030
+ });
16031
+ }
16032
+ }
16033
+ } else {
16034
+ ruleMap.delete("source-quality-verification");
16035
+ }
15694
16036
  return [...ruleMap.values()].sort((a, b) => {
15695
16037
  if (a.name === "project-overview") return -1;
15696
16038
  if (b.name === "project-overview") return 1;
@@ -15703,19 +16045,24 @@ ${section}`
15703
16045
  /**
15704
16046
  * Return a bundle's rules with `filePatterns` narrowed to the projects
15705
16047
  * that actually matched the bundle's detection predicate (when the bundle
15706
- * provides `findApplicableProjects`). Rules with `ALWAYS` scope and rules
15707
- * on bundles that don't implement the hook are returned unchanged.
16048
+ * provides `findApplicableProjects`) and any project-specified
16049
+ * `features.customDocSections` entries injected into the matching rule
16050
+ * content. Rules with `ALWAYS` scope and rules on bundles that don't
16051
+ * implement the hook are returned with only the custom-section
16052
+ * transformation (if any) applied.
15708
16053
  */
15709
16054
  bundleRulesFor(bundle) {
15710
- if (!bundle.findApplicableProjects) {
15711
- return bundle.rules;
16055
+ const customSections = this.options.features?.customDocSections ?? [];
16056
+ const withCustomSections = customSections.length > 0 ? renderCustomDocSections(bundle, customSections) : bundle;
16057
+ if (!withCustomSections.findApplicableProjects) {
16058
+ return withCustomSections.rules;
15712
16059
  }
15713
- const detected = bundle.findApplicableProjects(this.project);
16060
+ const detected = withCustomSections.findApplicableProjects(this.project);
15714
16061
  if (detected.length === 0) {
15715
- return bundle.rules;
16062
+ return withCustomSections.rules;
15716
16063
  }
15717
16064
  const scoped = scopeFilePatternsToProjects(this.project, detected);
15718
- return bundle.rules.map(
16065
+ return withCustomSections.rules.map(
15719
16066
  (rule) => rule.scope === AGENT_RULE_SCOPE.FILE_PATTERN ? { ...rule, filePatterns: scoped } : rule
15720
16067
  );
15721
16068
  }
@@ -18502,8 +18849,12 @@ var TypeScriptConfig = class extends import_projen22.Component {
18502
18849
  pnpmBundle,
18503
18850
  prReviewBundle,
18504
18851
  projenBundle,
18852
+ renderCustomDocSectionBlock,
18853
+ renderCustomDocSections,
18505
18854
  renderFocusSection,
18855
+ renderMeetingTypesSection,
18506
18856
  renderPriorityRulesSection,
18857
+ renderSourceTierExamples,
18507
18858
  requirementsAnalystBundle,
18508
18859
  requirementsReviewerBundle,
18509
18860
  requirementsWriterBundle,