@aiready/core 0.21.21 → 0.22.1

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/dist/client.d.mts CHANGED
@@ -960,6 +960,21 @@ declare const TOOL_NAME_MAP: Record<string, string>;
960
960
  * Model context tiers for context-aware threshold calibration.
961
961
  */
962
962
  type ModelContextTier = 'compact' | 'standard' | 'extended' | 'frontier';
963
+ /**
964
+ * Scoring profiles for project-type-aware weighting.
965
+ */
966
+ declare enum ScoringProfile {
967
+ Default = "default",
968
+ Agentic = "agentic",// Focus on AI agent navigation and signal
969
+ Logic = "logic",// Focus on testability and complexity
970
+ UI = "ui",// Focus on consistency and context (lower penalty for magic literals)
971
+ Cost = "cost",// Focus on token waste (duplication and fragmentation)
972
+ Security = "security"
973
+ }
974
+ /**
975
+ * Project-type-aware tool weight presets.
976
+ */
977
+ declare const SCORING_PROFILES: Record<ScoringProfile, Record<string, number>>;
963
978
  /**
964
979
  * Context budget thresholds per tier.
965
980
  */
@@ -995,16 +1010,17 @@ declare function getRecommendedThreshold(fileCount: number, modelTier?: ModelCon
995
1010
  */
996
1011
  declare function normalizeToolName(shortName: string): string;
997
1012
  /**
998
- * Retrieve the weight for a specific tool, considering overrides
1013
+ * Retrieve the weight for a specific tool, considering overrides and profiles
999
1014
  *
1000
1015
  * @param toolName The canonical tool ID
1001
1016
  * @param toolConfig Optional configuration for the tool containing a weight
1002
1017
  * @param cliOverride Optional weight override from the CLI
1018
+ * @param profile Optional scoring profile to use
1003
1019
  * @returns The weight to be used for this tool in overall scoring
1004
1020
  */
1005
1021
  declare function getToolWeight(toolName: string, toolConfig?: {
1006
1022
  scoreWeight?: number;
1007
- }, cliOverride?: number): number;
1023
+ }, cliOverride?: number, profile?: ScoringProfile): number;
1008
1024
  /**
1009
1025
  * Parse a comma-separated weight string (e.g. "patterns:30,context:10")
1010
1026
  *
@@ -1075,4 +1091,4 @@ declare function formatToolScore(output: ToolScoringOutput): string;
1075
1091
  */
1076
1092
  declare function generateHTML(graph: GraphData): string;
1077
1093
 
1078
- export { type AIReadyConfig, type AcceptancePrediction, type AiSignalClarityConfig, type AnalysisResult, AnalysisResultSchema, AnalysisStatus, AnalysisStatusSchema, type BaseToolConfig, type BusinessReport, COMMON_FINE_TUNING_OPTIONS, CONTEXT_TIER_THRESHOLDS, type CommonASTNode, type ComprehensionDifficulty, type ContextAnalyzerConfig, type CostConfig, DEFAULT_TOOL_WEIGHTS, type ExportInfo, FRIENDLY_TOOL_NAMES, GLOBAL_INFRA_OPTIONS, GLOBAL_SCAN_OPTIONS, type GraphData, type GraphEdge, type GraphIssueSeverity, type GraphMetadata, type GraphNode, type ImportInfo, type Issue, IssueSchema, IssueType, IssueTypeSchema, LANGUAGE_EXTENSIONS, Language, type LanguageConfig, type LanguageParser, type Location, LocationSchema, type Metrics, MetricsSchema, type ModelContextTier, ModelTier, ModelTierSchema, type NamingConsistencyConfig, type NamingConvention, ParseError, type ParseResult, type ParseStatistics, type PatternDetectConfig, type ProductivityImpact, ReadinessRating, RecommendationPriority, type Report, SIZE_ADJUSTED_THRESHOLDS, type ScanOptions, type ScoringConfig, type ScoringResult, Severity, SeveritySchema, type SourceLocation, type SourceRange, type SpokeOutput, SpokeOutputSchema, type SpokeSummary, SpokeSummarySchema, TOOL_NAME_MAP, type TechnicalValueChain, type TechnicalValueChainSummary, type TokenBudget, ToolName, ToolNameSchema, type ToolScoringOutput, type UnifiedReport, UnifiedReportSchema, calculateOverallScore, formatScore, formatToolScore, generateHTML, getProjectSizeTier, getRating, getRatingDisplay, getRatingWithContext, getRecommendedThreshold, getToolWeight, normalizeToolName, parseWeightString };
1094
+ export { type AIReadyConfig, type AcceptancePrediction, type AiSignalClarityConfig, type AnalysisResult, AnalysisResultSchema, AnalysisStatus, AnalysisStatusSchema, type BaseToolConfig, type BusinessReport, COMMON_FINE_TUNING_OPTIONS, CONTEXT_TIER_THRESHOLDS, type CommonASTNode, type ComprehensionDifficulty, type ContextAnalyzerConfig, type CostConfig, DEFAULT_TOOL_WEIGHTS, type ExportInfo, FRIENDLY_TOOL_NAMES, GLOBAL_INFRA_OPTIONS, GLOBAL_SCAN_OPTIONS, type GraphData, type GraphEdge, type GraphIssueSeverity, type GraphMetadata, type GraphNode, type ImportInfo, type Issue, IssueSchema, IssueType, IssueTypeSchema, LANGUAGE_EXTENSIONS, Language, type LanguageConfig, type LanguageParser, type Location, LocationSchema, type Metrics, MetricsSchema, type ModelContextTier, ModelTier, ModelTierSchema, type NamingConsistencyConfig, type NamingConvention, ParseError, type ParseResult, type ParseStatistics, type PatternDetectConfig, type ProductivityImpact, ReadinessRating, RecommendationPriority, type Report, SCORING_PROFILES, SIZE_ADJUSTED_THRESHOLDS, type ScanOptions, type ScoringConfig, ScoringProfile, type ScoringResult, Severity, SeveritySchema, type SourceLocation, type SourceRange, type SpokeOutput, SpokeOutputSchema, type SpokeSummary, SpokeSummarySchema, TOOL_NAME_MAP, type TechnicalValueChain, type TechnicalValueChainSummary, type TokenBudget, ToolName, ToolNameSchema, type ToolScoringOutput, type UnifiedReport, UnifiedReportSchema, calculateOverallScore, formatScore, formatToolScore, generateHTML, getProjectSizeTier, getRating, getRatingDisplay, getRatingWithContext, getRecommendedThreshold, getToolWeight, normalizeToolName, parseWeightString };
package/dist/client.d.ts CHANGED
@@ -960,6 +960,21 @@ declare const TOOL_NAME_MAP: Record<string, string>;
960
960
  * Model context tiers for context-aware threshold calibration.
961
961
  */
962
962
  type ModelContextTier = 'compact' | 'standard' | 'extended' | 'frontier';
963
+ /**
964
+ * Scoring profiles for project-type-aware weighting.
965
+ */
966
+ declare enum ScoringProfile {
967
+ Default = "default",
968
+ Agentic = "agentic",// Focus on AI agent navigation and signal
969
+ Logic = "logic",// Focus on testability and complexity
970
+ UI = "ui",// Focus on consistency and context (lower penalty for magic literals)
971
+ Cost = "cost",// Focus on token waste (duplication and fragmentation)
972
+ Security = "security"
973
+ }
974
+ /**
975
+ * Project-type-aware tool weight presets.
976
+ */
977
+ declare const SCORING_PROFILES: Record<ScoringProfile, Record<string, number>>;
963
978
  /**
964
979
  * Context budget thresholds per tier.
965
980
  */
@@ -995,16 +1010,17 @@ declare function getRecommendedThreshold(fileCount: number, modelTier?: ModelCon
995
1010
  */
996
1011
  declare function normalizeToolName(shortName: string): string;
997
1012
  /**
998
- * Retrieve the weight for a specific tool, considering overrides
1013
+ * Retrieve the weight for a specific tool, considering overrides and profiles
999
1014
  *
1000
1015
  * @param toolName The canonical tool ID
1001
1016
  * @param toolConfig Optional configuration for the tool containing a weight
1002
1017
  * @param cliOverride Optional weight override from the CLI
1018
+ * @param profile Optional scoring profile to use
1003
1019
  * @returns The weight to be used for this tool in overall scoring
1004
1020
  */
1005
1021
  declare function getToolWeight(toolName: string, toolConfig?: {
1006
1022
  scoreWeight?: number;
1007
- }, cliOverride?: number): number;
1023
+ }, cliOverride?: number, profile?: ScoringProfile): number;
1008
1024
  /**
1009
1025
  * Parse a comma-separated weight string (e.g. "patterns:30,context:10")
1010
1026
  *
@@ -1075,4 +1091,4 @@ declare function formatToolScore(output: ToolScoringOutput): string;
1075
1091
  */
1076
1092
  declare function generateHTML(graph: GraphData): string;
1077
1093
 
1078
- export { type AIReadyConfig, type AcceptancePrediction, type AiSignalClarityConfig, type AnalysisResult, AnalysisResultSchema, AnalysisStatus, AnalysisStatusSchema, type BaseToolConfig, type BusinessReport, COMMON_FINE_TUNING_OPTIONS, CONTEXT_TIER_THRESHOLDS, type CommonASTNode, type ComprehensionDifficulty, type ContextAnalyzerConfig, type CostConfig, DEFAULT_TOOL_WEIGHTS, type ExportInfo, FRIENDLY_TOOL_NAMES, GLOBAL_INFRA_OPTIONS, GLOBAL_SCAN_OPTIONS, type GraphData, type GraphEdge, type GraphIssueSeverity, type GraphMetadata, type GraphNode, type ImportInfo, type Issue, IssueSchema, IssueType, IssueTypeSchema, LANGUAGE_EXTENSIONS, Language, type LanguageConfig, type LanguageParser, type Location, LocationSchema, type Metrics, MetricsSchema, type ModelContextTier, ModelTier, ModelTierSchema, type NamingConsistencyConfig, type NamingConvention, ParseError, type ParseResult, type ParseStatistics, type PatternDetectConfig, type ProductivityImpact, ReadinessRating, RecommendationPriority, type Report, SIZE_ADJUSTED_THRESHOLDS, type ScanOptions, type ScoringConfig, type ScoringResult, Severity, SeveritySchema, type SourceLocation, type SourceRange, type SpokeOutput, SpokeOutputSchema, type SpokeSummary, SpokeSummarySchema, TOOL_NAME_MAP, type TechnicalValueChain, type TechnicalValueChainSummary, type TokenBudget, ToolName, ToolNameSchema, type ToolScoringOutput, type UnifiedReport, UnifiedReportSchema, calculateOverallScore, formatScore, formatToolScore, generateHTML, getProjectSizeTier, getRating, getRatingDisplay, getRatingWithContext, getRecommendedThreshold, getToolWeight, normalizeToolName, parseWeightString };
1094
+ export { type AIReadyConfig, type AcceptancePrediction, type AiSignalClarityConfig, type AnalysisResult, AnalysisResultSchema, AnalysisStatus, AnalysisStatusSchema, type BaseToolConfig, type BusinessReport, COMMON_FINE_TUNING_OPTIONS, CONTEXT_TIER_THRESHOLDS, type CommonASTNode, type ComprehensionDifficulty, type ContextAnalyzerConfig, type CostConfig, DEFAULT_TOOL_WEIGHTS, type ExportInfo, FRIENDLY_TOOL_NAMES, GLOBAL_INFRA_OPTIONS, GLOBAL_SCAN_OPTIONS, type GraphData, type GraphEdge, type GraphIssueSeverity, type GraphMetadata, type GraphNode, type ImportInfo, type Issue, IssueSchema, IssueType, IssueTypeSchema, LANGUAGE_EXTENSIONS, Language, type LanguageConfig, type LanguageParser, type Location, LocationSchema, type Metrics, MetricsSchema, type ModelContextTier, ModelTier, ModelTierSchema, type NamingConsistencyConfig, type NamingConvention, ParseError, type ParseResult, type ParseStatistics, type PatternDetectConfig, type ProductivityImpact, ReadinessRating, RecommendationPriority, type Report, SCORING_PROFILES, SIZE_ADJUSTED_THRESHOLDS, type ScanOptions, type ScoringConfig, ScoringProfile, type ScoringResult, Severity, SeveritySchema, type SourceLocation, type SourceRange, type SpokeOutput, SpokeOutputSchema, type SpokeSummary, SpokeSummarySchema, TOOL_NAME_MAP, type TechnicalValueChain, type TechnicalValueChainSummary, type TokenBudget, ToolName, ToolNameSchema, type ToolScoringOutput, type UnifiedReport, UnifiedReportSchema, calculateOverallScore, formatScore, formatToolScore, generateHTML, getProjectSizeTier, getRating, getRatingDisplay, getRatingWithContext, getRecommendedThreshold, getToolWeight, normalizeToolName, parseWeightString };
package/dist/client.js CHANGED
@@ -41,7 +41,9 @@ __export(client_exports, {
41
41
  ParseError: () => ParseError,
42
42
  ReadinessRating: () => ReadinessRating,
43
43
  RecommendationPriority: () => RecommendationPriority,
44
+ SCORING_PROFILES: () => SCORING_PROFILES,
44
45
  SIZE_ADJUSTED_THRESHOLDS: () => SIZE_ADJUSTED_THRESHOLDS,
46
+ ScoringProfile: () => ScoringProfile,
45
47
  Severity: () => Severity,
46
48
  SeveritySchema: () => SeveritySchema,
47
49
  SpokeOutputSchema: () => SpokeOutputSchema,
@@ -333,6 +335,51 @@ var TOOL_NAME_MAP = {
333
335
  "change-amp": "change-amplification" /* ChangeAmplification */,
334
336
  "change-amplification": "change-amplification" /* ChangeAmplification */
335
337
  };
338
+ var ScoringProfile = /* @__PURE__ */ ((ScoringProfile2) => {
339
+ ScoringProfile2["Default"] = "default";
340
+ ScoringProfile2["Agentic"] = "agentic";
341
+ ScoringProfile2["Logic"] = "logic";
342
+ ScoringProfile2["UI"] = "ui";
343
+ ScoringProfile2["Cost"] = "cost";
344
+ ScoringProfile2["Security"] = "security";
345
+ return ScoringProfile2;
346
+ })(ScoringProfile || {});
347
+ var SCORING_PROFILES = {
348
+ ["default" /* Default */]: DEFAULT_TOOL_WEIGHTS,
349
+ ["agentic" /* Agentic */]: {
350
+ ["ai-signal-clarity" /* AiSignalClarity */]: 30,
351
+ ["agent-grounding" /* AgentGrounding */]: 30,
352
+ ["testability-index" /* TestabilityIndex */]: 20,
353
+ ["context-analyzer" /* ContextAnalyzer */]: 10,
354
+ ["naming-consistency" /* NamingConsistency */]: 10
355
+ },
356
+ ["logic" /* Logic */]: {
357
+ ["testability-index" /* TestabilityIndex */]: 40,
358
+ ["naming-consistency" /* NamingConsistency */]: 20,
359
+ ["context-analyzer" /* ContextAnalyzer */]: 20,
360
+ ["pattern-detect" /* PatternDetect */]: 10,
361
+ ["change-amplification" /* ChangeAmplification */]: 10
362
+ },
363
+ ["ui" /* UI */]: {
364
+ ["naming-consistency" /* NamingConsistency */]: 30,
365
+ ["context-analyzer" /* ContextAnalyzer */]: 30,
366
+ ["pattern-detect" /* PatternDetect */]: 20,
367
+ ["doc-drift" /* DocDrift */]: 10,
368
+ ["ai-signal-clarity" /* AiSignalClarity */]: 10
369
+ },
370
+ ["cost" /* Cost */]: {
371
+ ["pattern-detect" /* PatternDetect */]: 50,
372
+ ["context-analyzer" /* ContextAnalyzer */]: 30,
373
+ ["change-amplification" /* ChangeAmplification */]: 10,
374
+ ["dependency-health" /* DependencyHealth */]: 10
375
+ },
376
+ ["security" /* Security */]: {
377
+ ["naming-consistency" /* NamingConsistency */]: 40,
378
+ ["testability-index" /* TestabilityIndex */]: 30,
379
+ ["dependency-health" /* DependencyHealth */]: 20,
380
+ ["context-analyzer" /* ContextAnalyzer */]: 10
381
+ }
382
+ };
336
383
  var CONTEXT_TIER_THRESHOLDS = {
337
384
  compact: { idealTokens: 3e3, criticalTokens: 1e4, idealDepth: 4 },
338
385
  standard: { idealTokens: 5e3, criticalTokens: 15e3, idealDepth: 5 },
@@ -367,10 +414,11 @@ function getRecommendedThreshold(fileCount, modelTier = "standard") {
367
414
  function normalizeToolName(shortName) {
368
415
  return TOOL_NAME_MAP[shortName.toLowerCase()] || shortName;
369
416
  }
370
- function getToolWeight(toolName, toolConfig, cliOverride) {
417
+ function getToolWeight(toolName, toolConfig, cliOverride, profile = "default" /* Default */) {
371
418
  if (cliOverride !== void 0) return cliOverride;
372
419
  if (toolConfig?.scoreWeight !== void 0) return toolConfig.scoreWeight;
373
- return DEFAULT_TOOL_WEIGHTS[toolName] || 5;
420
+ const profileWeights = SCORING_PROFILES[profile] || DEFAULT_TOOL_WEIGHTS;
421
+ return profileWeights[toolName] ?? DEFAULT_TOOL_WEIGHTS[toolName] ?? 5;
374
422
  }
375
423
  function parseWeightString(weightStr) {
376
424
  const weights = /* @__PURE__ */ new Map();
@@ -392,11 +440,12 @@ function calculateOverallScore(toolOutputs, config, cliWeights) {
392
440
  if (toolOutputs.size === 0) {
393
441
  throw new Error("No tool outputs provided for scoring");
394
442
  }
443
+ const profile = config?.scoring?.profile || "default" /* Default */;
395
444
  const weights = /* @__PURE__ */ new Map();
396
445
  for (const [toolName] of toolOutputs.entries()) {
397
446
  const cliWeight = cliWeights?.get(toolName);
398
447
  const configWeight = config?.tools?.[toolName]?.scoreWeight;
399
- const weight = cliWeight ?? configWeight ?? DEFAULT_TOOL_WEIGHTS[toolName] ?? 5;
448
+ const weight = cliWeight ?? configWeight ?? getToolWeight(toolName, void 0, void 0, profile);
400
449
  weights.set(toolName, weight);
401
450
  }
402
451
  let weightedSum = 0;
@@ -688,7 +737,9 @@ function generateHTML(graph) {
688
737
  ParseError,
689
738
  ReadinessRating,
690
739
  RecommendationPriority,
740
+ SCORING_PROFILES,
691
741
  SIZE_ADJUSTED_THRESHOLDS,
742
+ ScoringProfile,
692
743
  Severity,
693
744
  SeveritySchema,
694
745
  SpokeOutputSchema,
package/dist/client.mjs CHANGED
@@ -20,7 +20,9 @@ import {
20
20
  ParseError,
21
21
  ReadinessRating,
22
22
  RecommendationPriority,
23
+ SCORING_PROFILES,
23
24
  SIZE_ADJUSTED_THRESHOLDS,
25
+ ScoringProfile,
24
26
  Severity,
25
27
  SeveritySchema,
26
28
  SpokeOutputSchema,
@@ -41,7 +43,7 @@ import {
41
43
  getToolWeight,
42
44
  normalizeToolName,
43
45
  parseWeightString
44
- } from "./chunk-SWTDBVYJ.mjs";
46
+ } from "./chunk-5HIXDC3X.mjs";
45
47
  export {
46
48
  AnalysisResultSchema,
47
49
  AnalysisStatus,
@@ -64,7 +66,9 @@ export {
64
66
  ParseError,
65
67
  ReadinessRating,
66
68
  RecommendationPriority,
69
+ SCORING_PROFILES,
67
70
  SIZE_ADJUSTED_THRESHOLDS,
71
+ ScoringProfile,
68
72
  Severity,
69
73
  SeveritySchema,
70
74
  SpokeOutputSchema,
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ToolName, ScanOptions, SpokeOutput, ToolScoringOutput, AIReadyConfig, ModelContextTier, CostConfig, TokenBudget, ProductivityImpact, AcceptancePrediction, ComprehensionDifficulty, TechnicalValueChainSummary, TechnicalValueChain, LanguageParser, Language, ExportInfo, ParseResult, NamingConvention } from './client.mjs';
2
- export { AiSignalClarityConfig, AnalysisResult, AnalysisResultSchema, AnalysisStatus, AnalysisStatusSchema, BaseToolConfig, BusinessReport, COMMON_FINE_TUNING_OPTIONS, CONTEXT_TIER_THRESHOLDS, CommonASTNode, ContextAnalyzerConfig, DEFAULT_TOOL_WEIGHTS, FRIENDLY_TOOL_NAMES, GLOBAL_INFRA_OPTIONS, GLOBAL_SCAN_OPTIONS, GraphData, GraphEdge, GraphIssueSeverity, GraphMetadata, GraphNode, ImportInfo, Issue, IssueSchema, IssueType, IssueTypeSchema, LANGUAGE_EXTENSIONS, LanguageConfig, Location, LocationSchema, Metrics, MetricsSchema, ModelTier, ModelTierSchema, NamingConsistencyConfig, ParseError, ParseStatistics, PatternDetectConfig, ReadinessRating, RecommendationPriority, Report, SIZE_ADJUSTED_THRESHOLDS, ScoringConfig, ScoringResult, Severity, SeveritySchema, SourceLocation, SourceRange, SpokeOutputSchema, SpokeSummary, SpokeSummarySchema, TOOL_NAME_MAP, ToolNameSchema, UnifiedReport, UnifiedReportSchema, calculateOverallScore, formatScore, formatToolScore, generateHTML, getProjectSizeTier, getRating, getRatingDisplay, getRatingWithContext, getRecommendedThreshold, getToolWeight, normalizeToolName, parseWeightString } from './client.mjs';
2
+ export { AiSignalClarityConfig, AnalysisResult, AnalysisResultSchema, AnalysisStatus, AnalysisStatusSchema, BaseToolConfig, BusinessReport, COMMON_FINE_TUNING_OPTIONS, CONTEXT_TIER_THRESHOLDS, CommonASTNode, ContextAnalyzerConfig, DEFAULT_TOOL_WEIGHTS, FRIENDLY_TOOL_NAMES, GLOBAL_INFRA_OPTIONS, GLOBAL_SCAN_OPTIONS, GraphData, GraphEdge, GraphIssueSeverity, GraphMetadata, GraphNode, ImportInfo, Issue, IssueSchema, IssueType, IssueTypeSchema, LANGUAGE_EXTENSIONS, LanguageConfig, Location, LocationSchema, Metrics, MetricsSchema, ModelTier, ModelTierSchema, NamingConsistencyConfig, ParseError, ParseStatistics, PatternDetectConfig, ReadinessRating, RecommendationPriority, Report, SCORING_PROFILES, SIZE_ADJUSTED_THRESHOLDS, ScoringConfig, ScoringProfile, ScoringResult, Severity, SeveritySchema, SourceLocation, SourceRange, SpokeOutputSchema, SpokeSummary, SpokeSummarySchema, TOOL_NAME_MAP, ToolNameSchema, UnifiedReport, UnifiedReportSchema, calculateOverallScore, formatScore, formatToolScore, generateHTML, getProjectSizeTier, getRating, getRatingDisplay, getRatingWithContext, getRecommendedThreshold, getToolWeight, normalizeToolName, parseWeightString } from './client.mjs';
3
3
  import { z } from 'zod';
4
4
  import * as Parser from 'web-tree-sitter';
5
5
  import { TSESTree } from '@typescript-eslint/typescript-estree';
@@ -769,6 +769,7 @@ declare function calculateAiSignalClarity(params: {
769
769
  deepCallbacks: number;
770
770
  ambiguousNames: number;
771
771
  undocumentedExports: number;
772
+ largeFiles?: number;
772
773
  totalSymbols: number;
773
774
  totalExports: number;
774
775
  }): AiSignalClarity;
@@ -987,4 +988,28 @@ declare function getRepoMetadata(directory: string): {
987
988
  author?: string;
988
989
  };
989
990
 
990
- export { AIReadyConfig, type ASTNode, AcceptancePrediction, type AgentGroundingScore, type AiSignalClarity, type AiSignalClaritySignal, type CLIOptions, CSharpParser, type ChangeAmplificationScore, type CognitiveLoad, ComprehensionDifficulty, type ConceptCohesion, CostConfig, DEFAULT_COST_CONFIG, DEFAULT_EXCLUDE, type DependencyHealthScore, type DocDriftRisk, ExportInfo, type ExportWithImports, type FileImport, type FileWithDomain, GoParser, JavaParser, type KnowledgeConcentrationRisk, Language, LanguageParser, type LoadFactor, MODEL_PRICING_PRESETS, ModelContextTier, type ModelPricingPreset, NamingConvention, ParseResult, ParserFactory, type PatternEntropy, ProductivityImpact, PythonParser, SEVERITY_TIME_ESTIMATES, ScanOptions, type ScoreHistoryEntry, type ScoreTrend, type SemanticDistance, SpokeOutput, type TechnicalDebtInterest, TechnicalValueChain, TechnicalValueChainSummary, type TestabilityIndex, TokenBudget, ToolName, type ToolProvider, ToolRegistry, ToolScoringOutput, TypeScriptParser, VAGUE_FILE_NAMES, calculateAgentGrounding, calculateAiSignalClarity, calculateBusinessROI, calculateChangeAmplification, calculateCognitiveLoad, calculateComprehensionDifficulty, calculateConceptCohesion, calculateDebtInterest, calculateDependencyHealth, calculateDocDrift, calculateExtendedFutureProofScore, calculateFutureProofScore, calculateImportSimilarity, calculateKnowledgeConcentration, calculateMonthlyCost, calculatePatternEntropy, calculateProductivityImpact, calculateSemanticDistance, calculateTechnicalValueChain, calculateTestabilityIndex, calculateTokenBudget, clearHistory, emitProgress, estimateCostFromBudget, estimateTokens, exportHistory, extractFunctions, extractImports, formatAcceptanceRate, formatCost, formatHours, generateValueChain, getElapsedTime, getFileCommitTimestamps, getFileExtension, getHistorySummary, getLineRangeLastModifiedCached, getModelPreset, getParser, getRepoMetadata, getSafetyIcon, getScoreBar, getSeverityColor, getSupportedLanguages, getWasmPath, handleCLIError, handleJSONOutput, initTreeSitter, initializeParsers, isFileSupported, isSourceFile, loadConfig, loadMergedConfig, loadScoreHistory, mergeConfigWithDefaults, parseCode, parseFileExports, predictAcceptanceRate, readFileContent, resolveOutputPath, saveScoreEntry, scanEntries, scanFiles, setupParser, validateSpokeOutput, validateWithSchema };
991
+ /**
992
+ * Utilities for GitHub Actions integration
993
+ */
994
+ /**
995
+ * Emit a GitHub Action annotation
996
+ * Format: ::(error|warning|notice) file={file},line={line},col={col},title={title}::{message}
997
+ */
998
+ declare function emitAnnotation(params: {
999
+ level: 'error' | 'warning' | 'notice';
1000
+ file: string;
1001
+ line?: number;
1002
+ col?: number;
1003
+ title?: string;
1004
+ message: string;
1005
+ }): void;
1006
+ /**
1007
+ * Map AIReady severity to GitHub Action annotation level
1008
+ */
1009
+ declare function severityToAnnotationLevel(severity: string): 'error' | 'warning' | 'notice';
1010
+ /**
1011
+ * Emit multiple annotations from an array of issues
1012
+ */
1013
+ declare function emitIssuesAsAnnotations(issues: any[]): void;
1014
+
1015
+ export { AIReadyConfig, type ASTNode, AcceptancePrediction, type AgentGroundingScore, type AiSignalClarity, type AiSignalClaritySignal, type CLIOptions, CSharpParser, type ChangeAmplificationScore, type CognitiveLoad, ComprehensionDifficulty, type ConceptCohesion, CostConfig, DEFAULT_COST_CONFIG, DEFAULT_EXCLUDE, type DependencyHealthScore, type DocDriftRisk, ExportInfo, type ExportWithImports, type FileImport, type FileWithDomain, GoParser, JavaParser, type KnowledgeConcentrationRisk, Language, LanguageParser, type LoadFactor, MODEL_PRICING_PRESETS, ModelContextTier, type ModelPricingPreset, NamingConvention, ParseResult, ParserFactory, type PatternEntropy, ProductivityImpact, PythonParser, SEVERITY_TIME_ESTIMATES, ScanOptions, type ScoreHistoryEntry, type ScoreTrend, type SemanticDistance, SpokeOutput, type TechnicalDebtInterest, TechnicalValueChain, TechnicalValueChainSummary, type TestabilityIndex, TokenBudget, ToolName, type ToolProvider, ToolRegistry, ToolScoringOutput, TypeScriptParser, VAGUE_FILE_NAMES, calculateAgentGrounding, calculateAiSignalClarity, calculateBusinessROI, calculateChangeAmplification, calculateCognitiveLoad, calculateComprehensionDifficulty, calculateConceptCohesion, calculateDebtInterest, calculateDependencyHealth, calculateDocDrift, calculateExtendedFutureProofScore, calculateFutureProofScore, calculateImportSimilarity, calculateKnowledgeConcentration, calculateMonthlyCost, calculatePatternEntropy, calculateProductivityImpact, calculateSemanticDistance, calculateTechnicalValueChain, calculateTestabilityIndex, calculateTokenBudget, clearHistory, emitAnnotation, emitIssuesAsAnnotations, emitProgress, estimateCostFromBudget, estimateTokens, exportHistory, extractFunctions, extractImports, formatAcceptanceRate, formatCost, formatHours, generateValueChain, getElapsedTime, getFileCommitTimestamps, getFileExtension, getHistorySummary, getLineRangeLastModifiedCached, getModelPreset, getParser, getRepoMetadata, getSafetyIcon, getScoreBar, getSeverityColor, getSupportedLanguages, getWasmPath, handleCLIError, handleJSONOutput, initTreeSitter, initializeParsers, isFileSupported, isSourceFile, loadConfig, loadMergedConfig, loadScoreHistory, mergeConfigWithDefaults, parseCode, parseFileExports, predictAcceptanceRate, readFileContent, resolveOutputPath, saveScoreEntry, scanEntries, scanFiles, setupParser, severityToAnnotationLevel, validateSpokeOutput, validateWithSchema };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ToolName, ScanOptions, SpokeOutput, ToolScoringOutput, AIReadyConfig, ModelContextTier, CostConfig, TokenBudget, ProductivityImpact, AcceptancePrediction, ComprehensionDifficulty, TechnicalValueChainSummary, TechnicalValueChain, LanguageParser, Language, ExportInfo, ParseResult, NamingConvention } from './client.js';
2
- export { AiSignalClarityConfig, AnalysisResult, AnalysisResultSchema, AnalysisStatus, AnalysisStatusSchema, BaseToolConfig, BusinessReport, COMMON_FINE_TUNING_OPTIONS, CONTEXT_TIER_THRESHOLDS, CommonASTNode, ContextAnalyzerConfig, DEFAULT_TOOL_WEIGHTS, FRIENDLY_TOOL_NAMES, GLOBAL_INFRA_OPTIONS, GLOBAL_SCAN_OPTIONS, GraphData, GraphEdge, GraphIssueSeverity, GraphMetadata, GraphNode, ImportInfo, Issue, IssueSchema, IssueType, IssueTypeSchema, LANGUAGE_EXTENSIONS, LanguageConfig, Location, LocationSchema, Metrics, MetricsSchema, ModelTier, ModelTierSchema, NamingConsistencyConfig, ParseError, ParseStatistics, PatternDetectConfig, ReadinessRating, RecommendationPriority, Report, SIZE_ADJUSTED_THRESHOLDS, ScoringConfig, ScoringResult, Severity, SeveritySchema, SourceLocation, SourceRange, SpokeOutputSchema, SpokeSummary, SpokeSummarySchema, TOOL_NAME_MAP, ToolNameSchema, UnifiedReport, UnifiedReportSchema, calculateOverallScore, formatScore, formatToolScore, generateHTML, getProjectSizeTier, getRating, getRatingDisplay, getRatingWithContext, getRecommendedThreshold, getToolWeight, normalizeToolName, parseWeightString } from './client.js';
2
+ export { AiSignalClarityConfig, AnalysisResult, AnalysisResultSchema, AnalysisStatus, AnalysisStatusSchema, BaseToolConfig, BusinessReport, COMMON_FINE_TUNING_OPTIONS, CONTEXT_TIER_THRESHOLDS, CommonASTNode, ContextAnalyzerConfig, DEFAULT_TOOL_WEIGHTS, FRIENDLY_TOOL_NAMES, GLOBAL_INFRA_OPTIONS, GLOBAL_SCAN_OPTIONS, GraphData, GraphEdge, GraphIssueSeverity, GraphMetadata, GraphNode, ImportInfo, Issue, IssueSchema, IssueType, IssueTypeSchema, LANGUAGE_EXTENSIONS, LanguageConfig, Location, LocationSchema, Metrics, MetricsSchema, ModelTier, ModelTierSchema, NamingConsistencyConfig, ParseError, ParseStatistics, PatternDetectConfig, ReadinessRating, RecommendationPriority, Report, SCORING_PROFILES, SIZE_ADJUSTED_THRESHOLDS, ScoringConfig, ScoringProfile, ScoringResult, Severity, SeveritySchema, SourceLocation, SourceRange, SpokeOutputSchema, SpokeSummary, SpokeSummarySchema, TOOL_NAME_MAP, ToolNameSchema, UnifiedReport, UnifiedReportSchema, calculateOverallScore, formatScore, formatToolScore, generateHTML, getProjectSizeTier, getRating, getRatingDisplay, getRatingWithContext, getRecommendedThreshold, getToolWeight, normalizeToolName, parseWeightString } from './client.js';
3
3
  import { z } from 'zod';
4
4
  import * as Parser from 'web-tree-sitter';
5
5
  import { TSESTree } from '@typescript-eslint/typescript-estree';
@@ -769,6 +769,7 @@ declare function calculateAiSignalClarity(params: {
769
769
  deepCallbacks: number;
770
770
  ambiguousNames: number;
771
771
  undocumentedExports: number;
772
+ largeFiles?: number;
772
773
  totalSymbols: number;
773
774
  totalExports: number;
774
775
  }): AiSignalClarity;
@@ -987,4 +988,28 @@ declare function getRepoMetadata(directory: string): {
987
988
  author?: string;
988
989
  };
989
990
 
990
- export { AIReadyConfig, type ASTNode, AcceptancePrediction, type AgentGroundingScore, type AiSignalClarity, type AiSignalClaritySignal, type CLIOptions, CSharpParser, type ChangeAmplificationScore, type CognitiveLoad, ComprehensionDifficulty, type ConceptCohesion, CostConfig, DEFAULT_COST_CONFIG, DEFAULT_EXCLUDE, type DependencyHealthScore, type DocDriftRisk, ExportInfo, type ExportWithImports, type FileImport, type FileWithDomain, GoParser, JavaParser, type KnowledgeConcentrationRisk, Language, LanguageParser, type LoadFactor, MODEL_PRICING_PRESETS, ModelContextTier, type ModelPricingPreset, NamingConvention, ParseResult, ParserFactory, type PatternEntropy, ProductivityImpact, PythonParser, SEVERITY_TIME_ESTIMATES, ScanOptions, type ScoreHistoryEntry, type ScoreTrend, type SemanticDistance, SpokeOutput, type TechnicalDebtInterest, TechnicalValueChain, TechnicalValueChainSummary, type TestabilityIndex, TokenBudget, ToolName, type ToolProvider, ToolRegistry, ToolScoringOutput, TypeScriptParser, VAGUE_FILE_NAMES, calculateAgentGrounding, calculateAiSignalClarity, calculateBusinessROI, calculateChangeAmplification, calculateCognitiveLoad, calculateComprehensionDifficulty, calculateConceptCohesion, calculateDebtInterest, calculateDependencyHealth, calculateDocDrift, calculateExtendedFutureProofScore, calculateFutureProofScore, calculateImportSimilarity, calculateKnowledgeConcentration, calculateMonthlyCost, calculatePatternEntropy, calculateProductivityImpact, calculateSemanticDistance, calculateTechnicalValueChain, calculateTestabilityIndex, calculateTokenBudget, clearHistory, emitProgress, estimateCostFromBudget, estimateTokens, exportHistory, extractFunctions, extractImports, formatAcceptanceRate, formatCost, formatHours, generateValueChain, getElapsedTime, getFileCommitTimestamps, getFileExtension, getHistorySummary, getLineRangeLastModifiedCached, getModelPreset, getParser, getRepoMetadata, getSafetyIcon, getScoreBar, getSeverityColor, getSupportedLanguages, getWasmPath, handleCLIError, handleJSONOutput, initTreeSitter, initializeParsers, isFileSupported, isSourceFile, loadConfig, loadMergedConfig, loadScoreHistory, mergeConfigWithDefaults, parseCode, parseFileExports, predictAcceptanceRate, readFileContent, resolveOutputPath, saveScoreEntry, scanEntries, scanFiles, setupParser, validateSpokeOutput, validateWithSchema };
991
+ /**
992
+ * Utilities for GitHub Actions integration
993
+ */
994
+ /**
995
+ * Emit a GitHub Action annotation
996
+ * Format: ::(error|warning|notice) file={file},line={line},col={col},title={title}::{message}
997
+ */
998
+ declare function emitAnnotation(params: {
999
+ level: 'error' | 'warning' | 'notice';
1000
+ file: string;
1001
+ line?: number;
1002
+ col?: number;
1003
+ title?: string;
1004
+ message: string;
1005
+ }): void;
1006
+ /**
1007
+ * Map AIReady severity to GitHub Action annotation level
1008
+ */
1009
+ declare function severityToAnnotationLevel(severity: string): 'error' | 'warning' | 'notice';
1010
+ /**
1011
+ * Emit multiple annotations from an array of issues
1012
+ */
1013
+ declare function emitIssuesAsAnnotations(issues: any[]): void;
1014
+
1015
+ export { AIReadyConfig, type ASTNode, AcceptancePrediction, type AgentGroundingScore, type AiSignalClarity, type AiSignalClaritySignal, type CLIOptions, CSharpParser, type ChangeAmplificationScore, type CognitiveLoad, ComprehensionDifficulty, type ConceptCohesion, CostConfig, DEFAULT_COST_CONFIG, DEFAULT_EXCLUDE, type DependencyHealthScore, type DocDriftRisk, ExportInfo, type ExportWithImports, type FileImport, type FileWithDomain, GoParser, JavaParser, type KnowledgeConcentrationRisk, Language, LanguageParser, type LoadFactor, MODEL_PRICING_PRESETS, ModelContextTier, type ModelPricingPreset, NamingConvention, ParseResult, ParserFactory, type PatternEntropy, ProductivityImpact, PythonParser, SEVERITY_TIME_ESTIMATES, ScanOptions, type ScoreHistoryEntry, type ScoreTrend, type SemanticDistance, SpokeOutput, type TechnicalDebtInterest, TechnicalValueChain, TechnicalValueChainSummary, type TestabilityIndex, TokenBudget, ToolName, type ToolProvider, ToolRegistry, ToolScoringOutput, TypeScriptParser, VAGUE_FILE_NAMES, calculateAgentGrounding, calculateAiSignalClarity, calculateBusinessROI, calculateChangeAmplification, calculateCognitiveLoad, calculateComprehensionDifficulty, calculateConceptCohesion, calculateDebtInterest, calculateDependencyHealth, calculateDocDrift, calculateExtendedFutureProofScore, calculateFutureProofScore, calculateImportSimilarity, calculateKnowledgeConcentration, calculateMonthlyCost, calculatePatternEntropy, calculateProductivityImpact, calculateSemanticDistance, calculateTechnicalValueChain, calculateTestabilityIndex, calculateTokenBudget, clearHistory, emitAnnotation, emitIssuesAsAnnotations, emitProgress, estimateCostFromBudget, estimateTokens, exportHistory, extractFunctions, extractImports, formatAcceptanceRate, formatCost, formatHours, generateValueChain, getElapsedTime, getFileCommitTimestamps, getFileExtension, getHistorySummary, getLineRangeLastModifiedCached, getModelPreset, getParser, getRepoMetadata, getSafetyIcon, getScoreBar, getSeverityColor, getSupportedLanguages, getWasmPath, handleCLIError, handleJSONOutput, initTreeSitter, initializeParsers, isFileSupported, isSourceFile, loadConfig, loadMergedConfig, loadScoreHistory, mergeConfigWithDefaults, parseCode, parseFileExports, predictAcceptanceRate, readFileContent, resolveOutputPath, saveScoreEntry, scanEntries, scanFiles, setupParser, severityToAnnotationLevel, validateSpokeOutput, validateWithSchema };
package/dist/index.js CHANGED
@@ -59,8 +59,10 @@ __export(index_exports, {
59
59
  PythonParser: () => PythonParser,
60
60
  ReadinessRating: () => ReadinessRating,
61
61
  RecommendationPriority: () => RecommendationPriority,
62
+ SCORING_PROFILES: () => SCORING_PROFILES,
62
63
  SEVERITY_TIME_ESTIMATES: () => SEVERITY_TIME_ESTIMATES,
63
64
  SIZE_ADJUSTED_THRESHOLDS: () => SIZE_ADJUSTED_THRESHOLDS,
65
+ ScoringProfile: () => ScoringProfile,
64
66
  Severity: () => Severity,
65
67
  SeveritySchema: () => SeveritySchema,
66
68
  SpokeOutputSchema: () => SpokeOutputSchema,
@@ -95,6 +97,8 @@ __export(index_exports, {
95
97
  calculateTestabilityIndex: () => calculateTestabilityIndex,
96
98
  calculateTokenBudget: () => calculateTokenBudget,
97
99
  clearHistory: () => clearHistory,
100
+ emitAnnotation: () => emitAnnotation,
101
+ emitIssuesAsAnnotations: () => emitIssuesAsAnnotations,
98
102
  emitProgress: () => emitProgress,
99
103
  estimateCostFromBudget: () => estimateCostFromBudget,
100
104
  estimateTokens: () => estimateTokens,
@@ -148,6 +152,7 @@ __export(index_exports, {
148
152
  scanEntries: () => scanEntries,
149
153
  scanFiles: () => scanFiles,
150
154
  setupParser: () => setupParser,
155
+ severityToAnnotationLevel: () => severityToAnnotationLevel,
151
156
  validateSpokeOutput: () => validateSpokeOutput,
152
157
  validateWithSchema: () => validateWithSchema
153
158
  });
@@ -3174,6 +3179,51 @@ var TOOL_NAME_MAP = {
3174
3179
  "change-amp": "change-amplification" /* ChangeAmplification */,
3175
3180
  "change-amplification": "change-amplification" /* ChangeAmplification */
3176
3181
  };
3182
+ var ScoringProfile = /* @__PURE__ */ ((ScoringProfile2) => {
3183
+ ScoringProfile2["Default"] = "default";
3184
+ ScoringProfile2["Agentic"] = "agentic";
3185
+ ScoringProfile2["Logic"] = "logic";
3186
+ ScoringProfile2["UI"] = "ui";
3187
+ ScoringProfile2["Cost"] = "cost";
3188
+ ScoringProfile2["Security"] = "security";
3189
+ return ScoringProfile2;
3190
+ })(ScoringProfile || {});
3191
+ var SCORING_PROFILES = {
3192
+ ["default" /* Default */]: DEFAULT_TOOL_WEIGHTS,
3193
+ ["agentic" /* Agentic */]: {
3194
+ ["ai-signal-clarity" /* AiSignalClarity */]: 30,
3195
+ ["agent-grounding" /* AgentGrounding */]: 30,
3196
+ ["testability-index" /* TestabilityIndex */]: 20,
3197
+ ["context-analyzer" /* ContextAnalyzer */]: 10,
3198
+ ["naming-consistency" /* NamingConsistency */]: 10
3199
+ },
3200
+ ["logic" /* Logic */]: {
3201
+ ["testability-index" /* TestabilityIndex */]: 40,
3202
+ ["naming-consistency" /* NamingConsistency */]: 20,
3203
+ ["context-analyzer" /* ContextAnalyzer */]: 20,
3204
+ ["pattern-detect" /* PatternDetect */]: 10,
3205
+ ["change-amplification" /* ChangeAmplification */]: 10
3206
+ },
3207
+ ["ui" /* UI */]: {
3208
+ ["naming-consistency" /* NamingConsistency */]: 30,
3209
+ ["context-analyzer" /* ContextAnalyzer */]: 30,
3210
+ ["pattern-detect" /* PatternDetect */]: 20,
3211
+ ["doc-drift" /* DocDrift */]: 10,
3212
+ ["ai-signal-clarity" /* AiSignalClarity */]: 10
3213
+ },
3214
+ ["cost" /* Cost */]: {
3215
+ ["pattern-detect" /* PatternDetect */]: 50,
3216
+ ["context-analyzer" /* ContextAnalyzer */]: 30,
3217
+ ["change-amplification" /* ChangeAmplification */]: 10,
3218
+ ["dependency-health" /* DependencyHealth */]: 10
3219
+ },
3220
+ ["security" /* Security */]: {
3221
+ ["naming-consistency" /* NamingConsistency */]: 40,
3222
+ ["testability-index" /* TestabilityIndex */]: 30,
3223
+ ["dependency-health" /* DependencyHealth */]: 20,
3224
+ ["context-analyzer" /* ContextAnalyzer */]: 10
3225
+ }
3226
+ };
3177
3227
  var CONTEXT_TIER_THRESHOLDS = {
3178
3228
  compact: { idealTokens: 3e3, criticalTokens: 1e4, idealDepth: 4 },
3179
3229
  standard: { idealTokens: 5e3, criticalTokens: 15e3, idealDepth: 5 },
@@ -3208,10 +3258,11 @@ function getRecommendedThreshold(fileCount, modelTier = "standard") {
3208
3258
  function normalizeToolName(shortName) {
3209
3259
  return TOOL_NAME_MAP[shortName.toLowerCase()] || shortName;
3210
3260
  }
3211
- function getToolWeight(toolName, toolConfig, cliOverride) {
3261
+ function getToolWeight(toolName, toolConfig, cliOverride, profile = "default" /* Default */) {
3212
3262
  if (cliOverride !== void 0) return cliOverride;
3213
3263
  if (toolConfig?.scoreWeight !== void 0) return toolConfig.scoreWeight;
3214
- return DEFAULT_TOOL_WEIGHTS[toolName] || 5;
3264
+ const profileWeights = SCORING_PROFILES[profile] || DEFAULT_TOOL_WEIGHTS;
3265
+ return profileWeights[toolName] ?? DEFAULT_TOOL_WEIGHTS[toolName] ?? 5;
3215
3266
  }
3216
3267
  function parseWeightString(weightStr) {
3217
3268
  const weights = /* @__PURE__ */ new Map();
@@ -3233,11 +3284,12 @@ function calculateOverallScore(toolOutputs, config, cliWeights) {
3233
3284
  if (toolOutputs.size === 0) {
3234
3285
  throw new Error("No tool outputs provided for scoring");
3235
3286
  }
3287
+ const profile = config?.scoring?.profile || "default" /* Default */;
3236
3288
  const weights = /* @__PURE__ */ new Map();
3237
3289
  for (const [toolName] of toolOutputs.entries()) {
3238
3290
  const cliWeight = cliWeights?.get(toolName);
3239
3291
  const configWeight = config?.tools?.[toolName]?.scoreWeight;
3240
- const weight = cliWeight ?? configWeight ?? DEFAULT_TOOL_WEIGHTS[toolName] ?? 5;
3292
+ const weight = cliWeight ?? configWeight ?? getToolWeight(toolName, void 0, void 0, profile);
3241
3293
  weights.set(toolName, weight);
3242
3294
  }
3243
3295
  let weightedSum = 0;
@@ -4011,6 +4063,8 @@ function calculateAiSignalClarity(params) {
4011
4063
  deepCallbacks,
4012
4064
  ambiguousNames,
4013
4065
  undocumentedExports,
4066
+ largeFiles = 0,
4067
+ // Default to 0 to prevent NaN
4014
4068
  totalSymbols,
4015
4069
  totalExports
4016
4070
  } = params;
@@ -4027,28 +4081,35 @@ function calculateAiSignalClarity(params) {
4027
4081
  const overloadSignal = {
4028
4082
  name: "Symbol Overloading",
4029
4083
  count: overloadedSymbols,
4030
- riskContribution: Math.round(Math.min(1, overloadRatio) * 100 * 0.25),
4084
+ riskContribution: Math.round(Math.min(1, overloadRatio) * 100 * 0.2),
4031
4085
  description: `${overloadedSymbols} overloaded symbols \u2014 AI picks wrong signature`
4032
4086
  };
4087
+ const largeFileSignal = {
4088
+ name: "Large Files",
4089
+ count: largeFiles,
4090
+ riskContribution: Math.round(Math.min(5, largeFiles) * 5),
4091
+ // up to 25 points
4092
+ description: `${largeFiles} large files \u2014 pushing AI context limits`
4093
+ };
4033
4094
  const magicRatio = magicLiterals / Math.max(1, totalSymbols * 2);
4034
4095
  const magicSignal = {
4035
4096
  name: "Magic Literals",
4036
4097
  count: magicLiterals,
4037
- riskContribution: Math.round(Math.min(1, magicRatio) * 100 * 0.2),
4098
+ riskContribution: Math.round(Math.min(1, magicRatio) * 100 * 0.15),
4038
4099
  description: `${magicLiterals} unnamed constants \u2014 AI invents wrong values`
4039
4100
  };
4040
4101
  const trapRatio = booleanTraps / Math.max(1, totalSymbols);
4041
4102
  const trapSignal = {
4042
4103
  name: "Boolean Traps",
4043
4104
  count: booleanTraps,
4044
- riskContribution: Math.round(Math.min(1, trapRatio) * 100 * 0.2),
4105
+ riskContribution: Math.round(Math.min(1, trapRatio) * 100 * 0.15),
4045
4106
  description: `${booleanTraps} boolean trap parameters \u2014 AI inverts intent`
4046
4107
  };
4047
4108
  const sideEffectRatio = implicitSideEffects / Math.max(1, totalExports);
4048
4109
  const sideEffectSignal = {
4049
4110
  name: "Implicit Side Effects",
4050
4111
  count: implicitSideEffects,
4051
- riskContribution: Math.round(Math.min(1, sideEffectRatio) * 100 * 0.15),
4112
+ riskContribution: Math.round(Math.min(1, sideEffectRatio) * 100 * 0.1),
4052
4113
  description: `${implicitSideEffects} functions with implicit side effects \u2014 AI misses contracts`
4053
4114
  };
4054
4115
  const callbackRatio = deepCallbacks / Math.max(1, totalSymbols * 0.1);
@@ -4062,18 +4123,19 @@ function calculateAiSignalClarity(params) {
4062
4123
  const ambiguousSignal = {
4063
4124
  name: "Ambiguous Names",
4064
4125
  count: ambiguousNames,
4065
- riskContribution: Math.round(Math.min(1, ambiguousRatio) * 100 * 0.1),
4126
+ riskContribution: Math.round(Math.min(1, ambiguousRatio) * 100 * 0.05),
4066
4127
  description: `${ambiguousNames} non-descriptive identifiers \u2014 AI guesses wrong intent`
4067
4128
  };
4068
4129
  const undocRatio = undocumentedExports / Math.max(1, totalExports);
4069
4130
  const undocSignal = {
4070
4131
  name: "Undocumented Exports",
4071
4132
  count: undocumentedExports,
4072
- riskContribution: Math.round(Math.min(1, undocRatio) * 100 * 0.1),
4133
+ riskContribution: Math.round(Math.min(1, undocRatio) * 100 * 0.05),
4073
4134
  description: `${undocumentedExports} public functions without docs \u2014 AI fabricates behavior`
4074
4135
  };
4075
4136
  const signals = [
4076
4137
  overloadSignal,
4138
+ largeFileSignal,
4077
4139
  magicSignal,
4078
4140
  trapSignal,
4079
4141
  sideEffectSignal,
@@ -4096,6 +4158,10 @@ function calculateAiSignalClarity(params) {
4096
4158
  );
4097
4159
  const topRisk = topSignal.riskContribution > 0 ? topSignal.description : "No significant issues detected";
4098
4160
  const recommendations = [];
4161
+ if (largeFileSignal.riskContribution > 5)
4162
+ recommendations.push(
4163
+ `Split ${largeFiles} large files (> 500 lines) into smaller, single-responsibility modules`
4164
+ );
4099
4165
  if (overloadSignal.riskContribution > 5)
4100
4166
  recommendations.push(
4101
4167
  `Rename ${overloadedSymbols} overloaded symbols to unique, intent-revealing names`
@@ -4731,6 +4797,46 @@ function getRepoMetadata(directory) {
4731
4797
  }
4732
4798
  return metadata;
4733
4799
  }
4800
+
4801
+ // src/utils/github-utils.ts
4802
+ function emitAnnotation(params) {
4803
+ const { level, file, line, col, title, message } = params;
4804
+ const parts = [];
4805
+ if (file) parts.push(`file=${file}`);
4806
+ if (line) parts.push(`line=${line}`);
4807
+ if (col) parts.push(`col=${col}`);
4808
+ if (title) parts.push(`title=${title}`);
4809
+ const metadata = parts.length > 0 ? ` ${parts.join(",")}` : "";
4810
+ console.log(`::${level}${metadata}::${message.replace(/\n/g, "%0A")}`);
4811
+ }
4812
+ function severityToAnnotationLevel(severity) {
4813
+ switch (severity.toLowerCase()) {
4814
+ case "critical":
4815
+ case "high-risk":
4816
+ case "blind-risk":
4817
+ return "error";
4818
+ case "major":
4819
+ case "moderate-risk":
4820
+ return "warning";
4821
+ case "minor":
4822
+ case "info":
4823
+ case "safe":
4824
+ default:
4825
+ return "notice";
4826
+ }
4827
+ }
4828
+ function emitIssuesAsAnnotations(issues) {
4829
+ issues.forEach((issue) => {
4830
+ emitAnnotation({
4831
+ level: severityToAnnotationLevel(issue.severity || "info"),
4832
+ file: issue.file || issue.fileName || "",
4833
+ line: issue.line || issue.location?.start?.line,
4834
+ col: issue.column || issue.location?.start?.column,
4835
+ title: `${issue.tool || "AIReady"}: ${issue.type || "Issue"}`,
4836
+ message: issue.message || issue.description || "No description provided"
4837
+ });
4838
+ });
4839
+ }
4734
4840
  // Annotate the CommonJS export names for ESM import in node:
4735
4841
  0 && (module.exports = {
4736
4842
  AnalysisResultSchema,
@@ -4762,8 +4868,10 @@ function getRepoMetadata(directory) {
4762
4868
  PythonParser,
4763
4869
  ReadinessRating,
4764
4870
  RecommendationPriority,
4871
+ SCORING_PROFILES,
4765
4872
  SEVERITY_TIME_ESTIMATES,
4766
4873
  SIZE_ADJUSTED_THRESHOLDS,
4874
+ ScoringProfile,
4767
4875
  Severity,
4768
4876
  SeveritySchema,
4769
4877
  SpokeOutputSchema,
@@ -4798,6 +4906,8 @@ function getRepoMetadata(directory) {
4798
4906
  calculateTestabilityIndex,
4799
4907
  calculateTokenBudget,
4800
4908
  clearHistory,
4909
+ emitAnnotation,
4910
+ emitIssuesAsAnnotations,
4801
4911
  emitProgress,
4802
4912
  estimateCostFromBudget,
4803
4913
  estimateTokens,
@@ -4851,6 +4961,7 @@ function getRepoMetadata(directory) {
4851
4961
  scanEntries,
4852
4962
  scanFiles,
4853
4963
  setupParser,
4964
+ severityToAnnotationLevel,
4854
4965
  validateSpokeOutput,
4855
4966
  validateWithSchema
4856
4967
  });