clavix 4.3.2 → 4.5.0

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.
Files changed (77) hide show
  1. package/dist/core/adapters/instructions-generator.d.ts +2 -1
  2. package/dist/core/adapters/instructions-generator.js +21 -8
  3. package/dist/core/intelligence/confidence-calculator.d.ts +93 -0
  4. package/dist/core/intelligence/confidence-calculator.js +124 -0
  5. package/dist/core/intelligence/index.d.ts +1 -0
  6. package/dist/core/intelligence/index.js +2 -0
  7. package/dist/core/intelligence/intent-detector.js +10 -8
  8. package/dist/core/intelligence/pattern-library.d.ts +47 -10
  9. package/dist/core/intelligence/pattern-library.js +151 -79
  10. package/dist/core/intelligence/patterns/actionability-enhancer.d.ts +10 -10
  11. package/dist/core/intelligence/patterns/actionability-enhancer.js +31 -6
  12. package/dist/core/intelligence/patterns/alternative-phrasing-generator.d.ts +10 -8
  13. package/dist/core/intelligence/patterns/alternative-phrasing-generator.js +21 -3
  14. package/dist/core/intelligence/patterns/ambiguity-detector.d.ts +10 -8
  15. package/dist/core/intelligence/patterns/ambiguity-detector.js +31 -3
  16. package/dist/core/intelligence/patterns/assumption-explicitizer.d.ts +10 -8
  17. package/dist/core/intelligence/patterns/assumption-explicitizer.js +26 -3
  18. package/dist/core/intelligence/patterns/base-pattern.d.ts +166 -8
  19. package/dist/core/intelligence/patterns/base-pattern.js +64 -4
  20. package/dist/core/intelligence/patterns/completeness-validator.d.ts +10 -10
  21. package/dist/core/intelligence/patterns/completeness-validator.js +26 -5
  22. package/dist/core/intelligence/patterns/conciseness-filter.d.ts +15 -7
  23. package/dist/core/intelligence/patterns/conciseness-filter.js +36 -4
  24. package/dist/core/intelligence/patterns/context-precision.d.ts +10 -8
  25. package/dist/core/intelligence/patterns/context-precision.js +28 -5
  26. package/dist/core/intelligence/patterns/conversation-summarizer.d.ts +14 -9
  27. package/dist/core/intelligence/patterns/conversation-summarizer.js +109 -29
  28. package/dist/core/intelligence/patterns/dependency-identifier.d.ts +11 -9
  29. package/dist/core/intelligence/patterns/dependency-identifier.js +21 -4
  30. package/dist/core/intelligence/patterns/domain-context-enricher.d.ts +10 -8
  31. package/dist/core/intelligence/patterns/domain-context-enricher.js +27 -3
  32. package/dist/core/intelligence/patterns/edge-case-identifier.d.ts +10 -8
  33. package/dist/core/intelligence/patterns/edge-case-identifier.js +21 -3
  34. package/dist/core/intelligence/patterns/error-tolerance-enhancer.d.ts +10 -8
  35. package/dist/core/intelligence/patterns/error-tolerance-enhancer.js +22 -4
  36. package/dist/core/intelligence/patterns/implicit-requirement-extractor.d.ts +14 -10
  37. package/dist/core/intelligence/patterns/implicit-requirement-extractor.js +193 -63
  38. package/dist/core/intelligence/patterns/objective-clarifier.d.ts +15 -7
  39. package/dist/core/intelligence/patterns/objective-clarifier.js +46 -17
  40. package/dist/core/intelligence/patterns/output-format-enforcer.d.ts +10 -8
  41. package/dist/core/intelligence/patterns/output-format-enforcer.js +20 -3
  42. package/dist/core/intelligence/patterns/prd-structure-enforcer.d.ts +10 -8
  43. package/dist/core/intelligence/patterns/prd-structure-enforcer.js +25 -3
  44. package/dist/core/intelligence/patterns/prerequisite-identifier.d.ts +10 -8
  45. package/dist/core/intelligence/patterns/prerequisite-identifier.js +28 -4
  46. package/dist/core/intelligence/patterns/requirement-prioritizer.d.ts +11 -9
  47. package/dist/core/intelligence/patterns/requirement-prioritizer.js +21 -4
  48. package/dist/core/intelligence/patterns/scope-definer.d.ts +10 -8
  49. package/dist/core/intelligence/patterns/scope-definer.js +27 -3
  50. package/dist/core/intelligence/patterns/step-decomposer.d.ts +10 -8
  51. package/dist/core/intelligence/patterns/step-decomposer.js +21 -3
  52. package/dist/core/intelligence/patterns/structure-organizer.d.ts +10 -10
  53. package/dist/core/intelligence/patterns/structure-organizer.js +25 -5
  54. package/dist/core/intelligence/patterns/success-criteria-enforcer.d.ts +10 -8
  55. package/dist/core/intelligence/patterns/success-criteria-enforcer.js +20 -3
  56. package/dist/core/intelligence/patterns/success-metrics-enforcer.d.ts +11 -9
  57. package/dist/core/intelligence/patterns/success-metrics-enforcer.js +27 -4
  58. package/dist/core/intelligence/patterns/technical-context-enricher.d.ts +16 -7
  59. package/dist/core/intelligence/patterns/technical-context-enricher.js +71 -38
  60. package/dist/core/intelligence/patterns/topic-coherence-analyzer.d.ts +13 -9
  61. package/dist/core/intelligence/patterns/topic-coherence-analyzer.js +202 -42
  62. package/dist/core/intelligence/patterns/user-persona-enricher.d.ts +11 -9
  63. package/dist/core/intelligence/patterns/user-persona-enricher.js +21 -4
  64. package/dist/core/intelligence/patterns/validation-checklist-creator.d.ts +11 -8
  65. package/dist/core/intelligence/patterns/validation-checklist-creator.js +31 -3
  66. package/dist/templates/slash-commands/_canonical/deep.md +1 -1
  67. package/dist/templates/slash-commands/_canonical/execute.md +1 -1
  68. package/dist/templates/slash-commands/_canonical/fast.md +1 -1
  69. package/dist/templates/slash-commands/_canonical/implement.md +1 -1
  70. package/dist/templates/slash-commands/_canonical/plan.md +1 -1
  71. package/dist/templates/slash-commands/_canonical/prd.md +1 -1
  72. package/dist/templates/slash-commands/_canonical/start.md +21 -1
  73. package/dist/templates/slash-commands/_canonical/summarize.md +43 -2
  74. package/dist/templates/slash-commands/_components/references/intent-types.md +3 -1
  75. package/dist/templates/slash-commands/_components/sections/pattern-visibility.md +9 -9
  76. package/dist/types/config.d.ts +24 -0
  77. package/package.json +1 -1
@@ -1,18 +1,20 @@
1
- import { BasePattern } from './base-pattern.js';
2
- import { PromptIntent, OptimizationMode, PatternContext, PatternResult } from '../types.js';
1
+ import { BasePattern, PatternMode, PatternPriority, PatternPhase, PatternConfigSchema } from './base-pattern.js';
2
+ import { PromptIntent, PatternContext, PatternResult } from '../types.js';
3
3
  /**
4
- * v4.3.2 PRD Pattern: RequirementPrioritizer
4
+ * v4.5 Pattern: Requirement Prioritizer
5
5
  *
6
6
  * Separates must-have from nice-to-have requirements in PRD content.
7
7
  * Helps clarify priorities and MVP scope.
8
8
  */
9
9
  export declare class RequirementPrioritizer extends BasePattern {
10
- id: string;
11
- name: string;
12
- description: string;
13
- applicableIntents: PromptIntent[];
14
- mode: OptimizationMode | 'both';
15
- priority: number;
10
+ readonly id = "requirement-prioritizer";
11
+ readonly name = "Requirement Prioritizer";
12
+ readonly description = "Separates must-have from nice-to-have requirements";
13
+ readonly applicableIntents: PromptIntent[];
14
+ readonly mode: PatternMode;
15
+ readonly priority: PatternPriority;
16
+ readonly phases: PatternPhase[];
17
+ static readonly configSchema: PatternConfigSchema;
16
18
  apply(prompt: string, _context: PatternContext): PatternResult;
17
19
  private hasFeatureContent;
18
20
  private hasPrioritization;
@@ -1,17 +1,34 @@
1
- import { BasePattern } from './base-pattern.js';
1
+ import { BasePattern, } from './base-pattern.js';
2
2
  /**
3
- * v4.3.2 PRD Pattern: RequirementPrioritizer
3
+ * v4.5 Pattern: Requirement Prioritizer
4
4
  *
5
5
  * Separates must-have from nice-to-have requirements in PRD content.
6
6
  * Helps clarify priorities and MVP scope.
7
7
  */
8
8
  export class RequirementPrioritizer extends BasePattern {
9
+ // -------------------------------------------------------------------------
10
+ // Pattern Metadata (v4.5 unified types)
11
+ // -------------------------------------------------------------------------
9
12
  id = 'requirement-prioritizer';
10
- name = 'RequirementPrioritizer';
13
+ name = 'Requirement Prioritizer';
11
14
  description = 'Separates must-have from nice-to-have requirements';
12
15
  applicableIntents = ['prd-generation', 'planning'];
13
16
  mode = 'deep';
14
- priority = 7;
17
+ priority = 7; // MEDIUM-HIGH - important enrichment
18
+ phases = ['question-validation', 'output-generation'];
19
+ // -------------------------------------------------------------------------
20
+ // Configuration Schema (v4.5)
21
+ // -------------------------------------------------------------------------
22
+ static configSchema = {
23
+ usePriorityLabels: {
24
+ type: 'boolean',
25
+ default: true,
26
+ description: 'Use P0/P1/P2 priority labels',
27
+ },
28
+ };
29
+ // -------------------------------------------------------------------------
30
+ // Pattern Application
31
+ // -------------------------------------------------------------------------
15
32
  apply(prompt, _context) {
16
33
  // Only apply to PRD-related content with features
17
34
  if (!this.hasFeatureContent(prompt)) {
@@ -1,18 +1,20 @@
1
- import { BasePattern } from './base-pattern.js';
1
+ import { BasePattern, PatternMode, PatternPriority, PatternPhase, PatternConfigSchema } from './base-pattern.js';
2
2
  import { PromptIntent, PatternContext, PatternResult } from '../types.js';
3
3
  /**
4
- * v4.0 Deep Mode Pattern: Scope Definer
4
+ * v4.5 Pattern: Scope Definer
5
5
  *
6
6
  * Adds explicit scope boundaries to prevent scope creep
7
7
  * and clarify what is/isn't included.
8
8
  */
9
9
  export declare class ScopeDefiner extends BasePattern {
10
- id: string;
11
- name: string;
12
- description: string;
13
- applicableIntents: PromptIntent[];
14
- mode: "deep";
15
- priority: number;
10
+ readonly id = "scope-definer";
11
+ readonly name = "Scope Definer";
12
+ readonly description = "Add explicit scope boundaries to prevent scope creep";
13
+ readonly applicableIntents: PromptIntent[];
14
+ readonly mode: PatternMode;
15
+ readonly priority: PatternPriority;
16
+ readonly phases: PatternPhase[];
17
+ static readonly configSchema: PatternConfigSchema;
16
18
  apply(prompt: string, context: PatternContext): PatternResult;
17
19
  private hasExistingScope;
18
20
  private defineScope;
@@ -1,11 +1,14 @@
1
- import { BasePattern } from './base-pattern.js';
1
+ import { BasePattern, } from './base-pattern.js';
2
2
  /**
3
- * v4.0 Deep Mode Pattern: Scope Definer
3
+ * v4.5 Pattern: Scope Definer
4
4
  *
5
5
  * Adds explicit scope boundaries to prevent scope creep
6
6
  * and clarify what is/isn't included.
7
7
  */
8
8
  export class ScopeDefiner extends BasePattern {
9
+ // -------------------------------------------------------------------------
10
+ // Pattern Metadata (v4.5 unified types)
11
+ // -------------------------------------------------------------------------
9
12
  id = 'scope-definer';
10
13
  name = 'Scope Definer';
11
14
  description = 'Add explicit scope boundaries to prevent scope creep';
@@ -17,7 +20,28 @@ export class ScopeDefiner extends BasePattern {
17
20
  'documentation',
18
21
  ];
19
22
  mode = 'deep';
20
- priority = 5;
23
+ priority = 5; // MEDIUM-LOW - supplementary
24
+ phases = ['all'];
25
+ // -------------------------------------------------------------------------
26
+ // Configuration Schema (v4.5)
27
+ // -------------------------------------------------------------------------
28
+ static configSchema = {
29
+ maxInScopeItems: {
30
+ type: 'number',
31
+ default: 5,
32
+ description: 'Maximum number of in-scope items to list',
33
+ validation: { min: 1, max: 10 },
34
+ },
35
+ maxOutOfScopeItems: {
36
+ type: 'number',
37
+ default: 5,
38
+ description: 'Maximum number of out-of-scope items to list',
39
+ validation: { min: 1, max: 10 },
40
+ },
41
+ };
42
+ // -------------------------------------------------------------------------
43
+ // Pattern Application
44
+ // -------------------------------------------------------------------------
21
45
  apply(prompt, context) {
22
46
  // Check if prompt already has scope definition
23
47
  if (this.hasExistingScope(prompt)) {
@@ -1,18 +1,20 @@
1
- import { BasePattern } from './base-pattern.js';
1
+ import { BasePattern, PatternMode, PatternPriority, PatternPhase, PatternConfigSchema } from './base-pattern.js';
2
2
  import { PromptIntent, PatternContext, PatternResult } from '../types.js';
3
3
  /**
4
- * v4.0 Both Mode Pattern: Step-by-Step Decomposer
4
+ * v4.5 Pattern: Step-by-Step Decomposer
5
5
  *
6
6
  * Breaks complex prompts into clear sequential steps.
7
7
  * Applicable in both fast and deep modes.
8
8
  */
9
9
  export declare class StepDecomposer extends BasePattern {
10
- id: string;
11
- name: string;
12
- description: string;
13
- applicableIntents: PromptIntent[];
14
- mode: "both";
15
- priority: number;
10
+ readonly id = "step-decomposer";
11
+ readonly name = "Step-by-Step Decomposer";
12
+ readonly description = "Break complex prompts into clear sequential steps";
13
+ readonly applicableIntents: PromptIntent[];
14
+ readonly mode: PatternMode;
15
+ readonly priority: PatternPriority;
16
+ readonly phases: PatternPhase[];
17
+ static readonly configSchema: PatternConfigSchema;
16
18
  apply(prompt: string, context: PatternContext): PatternResult;
17
19
  private needsDecomposition;
18
20
  private hasSteps;
@@ -1,11 +1,14 @@
1
- import { BasePattern } from './base-pattern.js';
1
+ import { BasePattern, } from './base-pattern.js';
2
2
  /**
3
- * v4.0 Both Mode Pattern: Step-by-Step Decomposer
3
+ * v4.5 Pattern: Step-by-Step Decomposer
4
4
  *
5
5
  * Breaks complex prompts into clear sequential steps.
6
6
  * Applicable in both fast and deep modes.
7
7
  */
8
8
  export class StepDecomposer extends BasePattern {
9
+ // -------------------------------------------------------------------------
10
+ // Pattern Metadata (v4.5 unified types)
11
+ // -------------------------------------------------------------------------
9
12
  id = 'step-decomposer';
10
13
  name = 'Step-by-Step Decomposer';
11
14
  description = 'Break complex prompts into clear sequential steps';
@@ -18,7 +21,22 @@ export class StepDecomposer extends BasePattern {
18
21
  'documentation',
19
22
  ];
20
23
  mode = 'both';
21
- priority = 7;
24
+ priority = 5; // MEDIUM-LOW - supplementary
25
+ phases = ['all'];
26
+ // -------------------------------------------------------------------------
27
+ // Configuration Schema (v4.5)
28
+ // -------------------------------------------------------------------------
29
+ static configSchema = {
30
+ minWordsForDecomposition: {
31
+ type: 'number',
32
+ default: 100,
33
+ description: 'Minimum word count before decomposition is applied',
34
+ validation: { min: 50, max: 500 },
35
+ },
36
+ };
37
+ // -------------------------------------------------------------------------
38
+ // Pattern Application
39
+ // -------------------------------------------------------------------------
22
40
  apply(prompt, context) {
23
41
  // Check if prompt is complex enough to benefit from decomposition
24
42
  if (!this.needsDecomposition(prompt)) {
@@ -1,20 +1,20 @@
1
- import { BasePattern } from './base-pattern.js';
1
+ import { BasePattern, PatternMode, PatternPriority, PatternPhase, PatternConfigSchema } from './base-pattern.js';
2
2
  import { PatternContext, PatternResult, PromptIntent } from '../types.js';
3
3
  /**
4
- * Structure Organizer Pattern
4
+ * v4.5 Pattern: Structure Organizer
5
5
  *
6
6
  * Reorders information logically following the flow:
7
7
  * Objective → Requirements → Technical Constraints → Expected Output → Success Criteria
8
- *
9
- * Priority: HIGH (8)
10
8
  */
11
9
  export declare class StructureOrganizer extends BasePattern {
12
- id: string;
13
- name: string;
14
- description: string;
15
- applicableIntents: PromptIntent[];
16
- mode: 'fast' | 'deep' | 'both';
17
- priority: number;
10
+ readonly id = "structure-organizer";
11
+ readonly name = "Structure Organizer";
12
+ readonly description = "Reorders information into logical sections";
13
+ readonly applicableIntents: PromptIntent[];
14
+ readonly mode: PatternMode;
15
+ readonly priority: PatternPriority;
16
+ readonly phases: PatternPhase[];
17
+ static readonly configSchema: PatternConfigSchema;
18
18
  apply(prompt: string, _context: PatternContext): PatternResult;
19
19
  private detectSections;
20
20
  private isWellOrdered;
@@ -1,13 +1,14 @@
1
- import { BasePattern } from './base-pattern.js';
1
+ import { BasePattern, } from './base-pattern.js';
2
2
  /**
3
- * Structure Organizer Pattern
3
+ * v4.5 Pattern: Structure Organizer
4
4
  *
5
5
  * Reorders information logically following the flow:
6
6
  * Objective → Requirements → Technical Constraints → Expected Output → Success Criteria
7
- *
8
- * Priority: HIGH (8)
9
7
  */
10
8
  export class StructureOrganizer extends BasePattern {
9
+ // -------------------------------------------------------------------------
10
+ // Pattern Metadata (v4.5 unified types)
11
+ // -------------------------------------------------------------------------
11
12
  id = 'structure-organizer';
12
13
  name = 'Structure Organizer';
13
14
  description = 'Reorders information into logical sections';
@@ -19,7 +20,26 @@ export class StructureOrganizer extends BasePattern {
19
20
  'documentation',
20
21
  ];
21
22
  mode = 'both';
22
- priority = 8; // High priority
23
+ priority = 8; // HIGH - core enhancement
24
+ phases = ['all'];
25
+ // -------------------------------------------------------------------------
26
+ // Configuration Schema (v4.5)
27
+ // -------------------------------------------------------------------------
28
+ static configSchema = {
29
+ addHeadersIfMissing: {
30
+ type: 'boolean',
31
+ default: true,
32
+ description: 'Add markdown headers if not present',
33
+ },
34
+ reorderSections: {
35
+ type: 'boolean',
36
+ default: true,
37
+ description: 'Reorder sections to follow logical flow',
38
+ },
39
+ };
40
+ // -------------------------------------------------------------------------
41
+ // Pattern Application
42
+ // -------------------------------------------------------------------------
23
43
  apply(prompt, _context) {
24
44
  // Detect existing sections
25
45
  const sections = this.detectSections(prompt);
@@ -1,18 +1,20 @@
1
- import { BasePattern } from './base-pattern.js';
1
+ import { BasePattern, PatternMode, PatternPriority, PatternPhase, PatternConfigSchema } from './base-pattern.js';
2
2
  import { PatternContext, PatternResult, PromptIntent } from '../types.js';
3
3
  /**
4
- * SuccessCriteriaEnforcer Pattern (v4.1)
4
+ * v4.5 Pattern: Success Criteria Enforcer
5
5
  *
6
6
  * Ensures prompts include measurable success criteria. Agents need to know
7
7
  * when they've successfully completed a task - this pattern adds that clarity.
8
8
  */
9
9
  export declare class SuccessCriteriaEnforcer extends BasePattern {
10
- id: string;
11
- name: string;
12
- description: string;
13
- applicableIntents: PromptIntent[];
14
- mode: 'fast' | 'deep' | 'both';
15
- priority: number;
10
+ readonly id = "success-criteria-enforcer";
11
+ readonly name = "Success Criteria Enforcer";
12
+ readonly description = "Adds measurable success criteria for task completion validation";
13
+ readonly applicableIntents: PromptIntent[];
14
+ readonly mode: PatternMode;
15
+ readonly priority: PatternPriority;
16
+ readonly phases: PatternPhase[];
17
+ static readonly configSchema: PatternConfigSchema;
16
18
  private successIndicators;
17
19
  private intentCriteria;
18
20
  apply(prompt: string, context: PatternContext): PatternResult;
@@ -1,11 +1,14 @@
1
- import { BasePattern } from './base-pattern.js';
1
+ import { BasePattern, } from './base-pattern.js';
2
2
  /**
3
- * SuccessCriteriaEnforcer Pattern (v4.1)
3
+ * v4.5 Pattern: Success Criteria Enforcer
4
4
  *
5
5
  * Ensures prompts include measurable success criteria. Agents need to know
6
6
  * when they've successfully completed a task - this pattern adds that clarity.
7
7
  */
8
8
  export class SuccessCriteriaEnforcer extends BasePattern {
9
+ // -------------------------------------------------------------------------
10
+ // Pattern Metadata (v4.5 unified types)
11
+ // -------------------------------------------------------------------------
9
12
  id = 'success-criteria-enforcer';
10
13
  name = 'Success Criteria Enforcer';
11
14
  description = 'Adds measurable success criteria for task completion validation';
@@ -19,7 +22,21 @@ export class SuccessCriteriaEnforcer extends BasePattern {
19
22
  'prd-generation',
20
23
  ];
21
24
  mode = 'both';
22
- priority = 6; // Medium priority
25
+ priority = 7; // MEDIUM-HIGH - important enrichment
26
+ phases = ['all'];
27
+ // -------------------------------------------------------------------------
28
+ // Configuration Schema (v4.5)
29
+ // -------------------------------------------------------------------------
30
+ static configSchema = {
31
+ showCheckboxes: {
32
+ type: 'boolean',
33
+ default: true,
34
+ description: 'Show criteria as checkboxes for progress tracking',
35
+ },
36
+ };
37
+ // -------------------------------------------------------------------------
38
+ // Pattern Data
39
+ // -------------------------------------------------------------------------
23
40
  // Indicators that success criteria already exist
24
41
  successIndicators = [
25
42
  'success criteria',
@@ -1,18 +1,20 @@
1
- import { BasePattern } from './base-pattern.js';
2
- import { PromptIntent, OptimizationMode, PatternContext, PatternResult } from '../types.js';
1
+ import { BasePattern, PatternMode, PatternPriority, PatternPhase, PatternConfigSchema } from './base-pattern.js';
2
+ import { PromptIntent, PatternContext, PatternResult } from '../types.js';
3
3
  /**
4
- * v4.3.2 PRD Pattern: SuccessMetricsEnforcer
4
+ * v4.5 Pattern: Success Metrics Enforcer
5
5
  *
6
6
  * Ensures measurable success criteria exist in PRD content.
7
7
  * Adds KPIs and metrics when missing.
8
8
  */
9
9
  export declare class SuccessMetricsEnforcer extends BasePattern {
10
- id: string;
11
- name: string;
12
- description: string;
13
- applicableIntents: PromptIntent[];
14
- mode: OptimizationMode | 'both';
15
- priority: number;
10
+ readonly id = "success-metrics-enforcer";
11
+ readonly name = "Success Metrics Enforcer";
12
+ readonly description = "Ensures measurable success criteria exist";
13
+ readonly applicableIntents: PromptIntent[];
14
+ readonly mode: PatternMode;
15
+ readonly priority: PatternPriority;
16
+ readonly phases: PatternPhase[];
17
+ static readonly configSchema: PatternConfigSchema;
16
18
  apply(prompt: string, _context: PatternContext): PatternResult;
17
19
  private hasSuccessMetrics;
18
20
  private needsMetrics;
@@ -1,17 +1,40 @@
1
- import { BasePattern } from './base-pattern.js';
1
+ import { BasePattern, } from './base-pattern.js';
2
2
  /**
3
- * v4.3.2 PRD Pattern: SuccessMetricsEnforcer
3
+ * v4.5 Pattern: Success Metrics Enforcer
4
4
  *
5
5
  * Ensures measurable success criteria exist in PRD content.
6
6
  * Adds KPIs and metrics when missing.
7
7
  */
8
8
  export class SuccessMetricsEnforcer extends BasePattern {
9
+ // -------------------------------------------------------------------------
10
+ // Pattern Metadata (v4.5 unified types)
11
+ // -------------------------------------------------------------------------
9
12
  id = 'success-metrics-enforcer';
10
- name = 'SuccessMetricsEnforcer';
13
+ name = 'Success Metrics Enforcer';
11
14
  description = 'Ensures measurable success criteria exist';
12
15
  applicableIntents = ['prd-generation', 'planning'];
13
16
  mode = 'deep';
14
- priority = 7;
17
+ priority = 7; // MEDIUM-HIGH - important enrichment
18
+ phases = ['question-validation', 'output-generation'];
19
+ // -------------------------------------------------------------------------
20
+ // Configuration Schema (v4.5)
21
+ // -------------------------------------------------------------------------
22
+ static configSchema = {
23
+ maxKPIs: {
24
+ type: 'number',
25
+ default: 4,
26
+ description: 'Maximum number of KPIs to suggest',
27
+ validation: { min: 1, max: 8 },
28
+ },
29
+ includeMeasurementGuidance: {
30
+ type: 'boolean',
31
+ default: true,
32
+ description: 'Include guidance on how to measure success',
33
+ },
34
+ };
35
+ // -------------------------------------------------------------------------
36
+ // Pattern Application
37
+ // -------------------------------------------------------------------------
15
38
  apply(prompt, _context) {
16
39
  // Check if success metrics already exist
17
40
  if (this.hasSuccessMetrics(prompt)) {
@@ -1,12 +1,21 @@
1
- import { BasePattern } from './base-pattern.js';
1
+ import { BasePattern, PatternMode, PatternPriority, PatternPhase, PatternConfigSchema, PatternDependency } from './base-pattern.js';
2
2
  import { PatternContext, PatternResult, PromptIntent } from '../types.js';
3
+ /**
4
+ * v4.5 Pattern: Technical Context Enricher
5
+ *
6
+ * Adds missing technical context (language, framework, versions).
7
+ * Detects technologies and suggests version specifications.
8
+ */
3
9
  export declare class TechnicalContextEnricher extends BasePattern {
4
- id: string;
5
- name: string;
6
- description: string;
7
- applicableIntents: PromptIntent[];
8
- mode: 'fast' | 'deep' | 'both';
9
- priority: number;
10
+ readonly id = "technical-context-enricher";
11
+ readonly name = "Technical Context Enricher";
12
+ readonly description = "Adds missing technical context (language, framework, versions)";
13
+ readonly applicableIntents: PromptIntent[];
14
+ readonly mode: PatternMode;
15
+ readonly priority: PatternPriority;
16
+ readonly phases: PatternPhase[];
17
+ readonly dependencies: PatternDependency;
18
+ static readonly configSchema: PatternConfigSchema;
10
19
  apply(prompt: string, context: PatternContext): PatternResult;
11
20
  private hasTechnicalContext;
12
21
  private detectLanguage;
@@ -1,11 +1,44 @@
1
- import { BasePattern } from './base-pattern.js';
1
+ import { BasePattern, } from './base-pattern.js';
2
+ /**
3
+ * v4.5 Pattern: Technical Context Enricher
4
+ *
5
+ * Adds missing technical context (language, framework, versions).
6
+ * Detects technologies and suggests version specifications.
7
+ */
2
8
  export class TechnicalContextEnricher extends BasePattern {
9
+ // -------------------------------------------------------------------------
10
+ // Pattern Metadata (v4.5 unified types)
11
+ // -------------------------------------------------------------------------
3
12
  id = 'technical-context-enricher';
4
13
  name = 'Technical Context Enricher';
5
14
  description = 'Adds missing technical context (language, framework, versions)';
6
15
  applicableIntents = ['code-generation', 'refinement', 'debugging'];
7
16
  mode = 'both';
8
- priority = 8;
17
+ priority = 5; // MEDIUM-LOW - supplementary context
18
+ phases = ['all'];
19
+ // v4.5: Dependencies
20
+ dependencies = {
21
+ runAfter: ['objective-clarifier'], // Clarify objective first, then add technical context
22
+ enhancedBy: ['domain-context-enricher'],
23
+ };
24
+ // -------------------------------------------------------------------------
25
+ // Configuration Schema (v4.5)
26
+ // -------------------------------------------------------------------------
27
+ static configSchema = {
28
+ detectFrameworks: {
29
+ type: 'boolean',
30
+ default: true,
31
+ description: 'Detect and add framework information',
32
+ },
33
+ suggestVersions: {
34
+ type: 'boolean',
35
+ default: true,
36
+ description: 'Suggest adding version information when missing',
37
+ },
38
+ };
39
+ // -------------------------------------------------------------------------
40
+ // Pattern Application
41
+ // -------------------------------------------------------------------------
9
42
  apply(prompt, context) {
10
43
  const lowerPrompt = prompt.toLowerCase();
11
44
  const enhancements = [];
@@ -16,9 +49,9 @@ export class TechnicalContextEnricher extends BasePattern {
16
49
  improvement: {
17
50
  dimension: 'completeness',
18
51
  description: 'Technical context already specified',
19
- impact: 'low'
52
+ impact: 'low',
20
53
  },
21
- applied: false
54
+ applied: false,
22
55
  };
23
56
  }
24
57
  // Detect language mentions without versions
@@ -40,22 +73,22 @@ export class TechnicalContextEnricher extends BasePattern {
40
73
  improvement: {
41
74
  dimension: 'completeness',
42
75
  description: 'No additional technical context needed',
43
- impact: 'low'
76
+ impact: 'low',
44
77
  },
45
- applied: false
78
+ applied: false,
46
79
  };
47
80
  }
48
81
  // Add technical context section
49
- const contextSection = `\n\n# Technical Constraints\n${enhancements.map(e => `- ${e}`).join('\n')}`;
82
+ const contextSection = `\n\n# Technical Constraints\n${enhancements.map((e) => `- ${e}`).join('\n')}`;
50
83
  const enhanced = prompt + contextSection;
51
84
  return {
52
85
  enhancedPrompt: enhanced,
53
86
  improvement: {
54
87
  dimension: 'completeness',
55
88
  description: `Added ${enhancements.length} technical context specifications`,
56
- impact: 'medium'
89
+ impact: 'medium',
57
90
  },
58
- applied: true
91
+ applied: true,
59
92
  };
60
93
  }
61
94
  hasTechnicalContext(prompt) {
@@ -63,25 +96,25 @@ export class TechnicalContextEnricher extends BasePattern {
63
96
  /version|v\d+\.\d+/i,
64
97
  /technical (context|constraints|requirements)/i,
65
98
  /language:.*framework:/i,
66
- /using (python|javascript|typescript|java|rust|go) \d/i
99
+ /using (python|javascript|typescript|java|rust|go) \d/i,
67
100
  ];
68
- return contextMarkers.some(marker => marker.test(prompt));
101
+ return contextMarkers.some((marker) => marker.test(prompt));
69
102
  }
70
103
  detectLanguage(prompt) {
71
104
  const languages = {
72
- 'python': 'Python',
73
- 'javascript': 'JavaScript',
74
- 'typescript': 'TypeScript',
75
- 'java': 'Java',
76
- 'rust': 'Rust',
77
- 'go': 'Go',
78
- 'php': 'PHP',
79
- 'ruby': 'Ruby',
80
- 'swift': 'Swift',
81
- 'kotlin': 'Kotlin',
105
+ python: 'Python',
106
+ javascript: 'JavaScript',
107
+ typescript: 'TypeScript',
108
+ java: 'Java',
109
+ rust: 'Rust',
110
+ go: 'Go',
111
+ php: 'PHP',
112
+ ruby: 'Ruby',
113
+ swift: 'Swift',
114
+ kotlin: 'Kotlin',
82
115
  'c++': 'C++',
83
- 'csharp': 'C#',
84
- 'c#': 'C#'
116
+ csharp: 'C#',
117
+ 'c#': 'C#',
85
118
  };
86
119
  for (const [key, name] of Object.entries(languages)) {
87
120
  if (prompt.includes(key)) {
@@ -102,21 +135,21 @@ export class TechnicalContextEnricher extends BasePattern {
102
135
  }
103
136
  detectFramework(prompt) {
104
137
  const frameworks = {
105
- 'react': 'React',
106
- 'vue': 'Vue.js',
107
- 'angular': 'Angular',
108
- 'svelte': 'Svelte',
109
- 'next': 'Next.js',
110
- 'nextjs': 'Next.js',
111
- 'nuxt': 'Nuxt.js',
112
- 'django': 'Django',
113
- 'flask': 'Flask',
114
- 'fastapi': 'FastAPI',
115
- 'express': 'Express.js',
116
- 'nestjs': 'NestJS',
117
- 'spring': 'Spring Boot',
118
- 'rails': 'Ruby on Rails',
119
- 'laravel': 'Laravel'
138
+ react: 'React',
139
+ vue: 'Vue.js',
140
+ angular: 'Angular',
141
+ svelte: 'Svelte',
142
+ next: 'Next.js',
143
+ nextjs: 'Next.js',
144
+ nuxt: 'Nuxt.js',
145
+ django: 'Django',
146
+ flask: 'Flask',
147
+ fastapi: 'FastAPI',
148
+ express: 'Express.js',
149
+ nestjs: 'NestJS',
150
+ spring: 'Spring Boot',
151
+ rails: 'Ruby on Rails',
152
+ laravel: 'Laravel',
120
153
  };
121
154
  for (const [key, name] of Object.entries(frameworks)) {
122
155
  if (prompt.includes(key)) {