@pratik7368patil/anchor-core 0.1.9 → 0.1.11
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/index.d.ts +44 -1
- package/dist/index.js +576 -37
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ type SourceType = "pr_body" | "review_comment" | "issue_comment" | "review_summa
|
|
|
5
5
|
type WisdomCategory = "architecture_decision" | "constraint" | "rejected_approach" | "bug_regression" | "testing_rule" | "api_contract" | "performance_note" | "security_note" | "style_convention" | "unknown";
|
|
6
6
|
type ConfidenceLevel = "strong" | "moderate" | "weak";
|
|
7
7
|
type FreshnessStatus = "current" | "possibly_stale" | "stale";
|
|
8
|
+
type CoverageGrade = "empty" | "poor" | "fair" | "good" | "excellent";
|
|
8
9
|
type EvidenceRef = {
|
|
9
10
|
prNumber: number;
|
|
10
11
|
prUrl: string;
|
|
@@ -70,6 +71,10 @@ type TeamRule = {
|
|
|
70
71
|
evidence: EvidenceRef[];
|
|
71
72
|
confidenceLevel: ConfidenceLevel;
|
|
72
73
|
};
|
|
74
|
+
type TeamRuleSuggestion = TeamRule & {
|
|
75
|
+
repeatedEvidenceCount: number;
|
|
76
|
+
reason: string;
|
|
77
|
+
};
|
|
73
78
|
type RankedTeamRule = TeamRule & {
|
|
74
79
|
score: number;
|
|
75
80
|
freshnessStatus: FreshnessStatus;
|
|
@@ -292,12 +297,14 @@ type AnchorExplainFileInput = {
|
|
|
292
297
|
symbols?: string[];
|
|
293
298
|
strict?: boolean;
|
|
294
299
|
maxResults?: number;
|
|
300
|
+
share?: boolean;
|
|
295
301
|
};
|
|
296
302
|
type AnchorReviewDiffInput = {
|
|
297
303
|
diff: string;
|
|
298
304
|
files?: string[];
|
|
299
305
|
strict?: boolean;
|
|
300
306
|
maxResults?: number;
|
|
307
|
+
share?: boolean;
|
|
301
308
|
};
|
|
302
309
|
type IndexRunRecord = {
|
|
303
310
|
id?: number;
|
|
@@ -323,6 +330,10 @@ type AnchorIndexHealth = {
|
|
|
323
330
|
staleCodeIndex: boolean;
|
|
324
331
|
lastSuccessfulRun?: string;
|
|
325
332
|
lastFailedRun?: string;
|
|
333
|
+
coverageScore: number;
|
|
334
|
+
coverageGrade: CoverageGrade;
|
|
335
|
+
coverageReasons: string[];
|
|
336
|
+
suggestedPrompts: string[];
|
|
326
337
|
};
|
|
327
338
|
type SemanticStatus = {
|
|
328
339
|
enabled: boolean;
|
|
@@ -353,6 +364,10 @@ type IndexStatus = {
|
|
|
353
364
|
lastFailedRun?: string;
|
|
354
365
|
staleCodeIndex?: boolean;
|
|
355
366
|
suggestedNextCommand?: string;
|
|
367
|
+
coverageScore: number;
|
|
368
|
+
coverageGrade: CoverageGrade;
|
|
369
|
+
coverageReasons: string[];
|
|
370
|
+
suggestedPrompts: string[];
|
|
356
371
|
githubTokenConfigured: boolean;
|
|
357
372
|
health: "ok" | "missing_database" | "schema_invalid" | "empty_index";
|
|
358
373
|
};
|
|
@@ -444,6 +459,7 @@ declare function upsertPullRequest(db: AnchorDatabase, pr: PullRequestRecord, wi
|
|
|
444
459
|
declare function replaceCodeIndex(db: AnchorDatabase, repo: string, codeFiles: CodeFileRecord[], codeChunks: CodeChunk[], skippedFiles: number, cwd: string): CodeIndexSummary;
|
|
445
460
|
declare function recordIndexRun(db: AnchorDatabase, run: IndexRunRecord): void;
|
|
446
461
|
declare function getIndexStatus(cwd: string, githubTokenConfigured?: boolean, databasePath?: string): IndexStatus;
|
|
462
|
+
declare function getWisdomCategoryCounts(db: AnchorDatabase): Record<WisdomCategory, number>;
|
|
447
463
|
|
|
448
464
|
declare const SCHEMA_SQL: string;
|
|
449
465
|
|
|
@@ -599,6 +615,11 @@ type RulesEvidenceCheckResult = {
|
|
|
599
615
|
}>;
|
|
600
616
|
errors: string[];
|
|
601
617
|
};
|
|
618
|
+
type RulesSuggestOptions = {
|
|
619
|
+
category?: WisdomCategory;
|
|
620
|
+
minConfidence?: ConfidenceLevel;
|
|
621
|
+
maxResults?: number;
|
|
622
|
+
};
|
|
602
623
|
declare function ensureTeamRulesFile(cwd: string): RulesInitResult;
|
|
603
624
|
declare function loadTeamRulesFile(cwd: string): TeamRulesValidationResult & {
|
|
604
625
|
exists: boolean;
|
|
@@ -607,11 +628,33 @@ declare function validateTeamRulesFile(cwd: string): TeamRulesValidationResult;
|
|
|
607
628
|
declare function addTeamRule(cwd: string, input: RulesAddInput): RulesAddResult;
|
|
608
629
|
declare function checkTeamRuleEvidence(cwd: string): RulesEvidenceCheckResult;
|
|
609
630
|
declare function rankTeamRules(db: AnchorDatabase, cwd: string, input: AnchorContextInput): RankedTeamRule[];
|
|
631
|
+
declare function suggestTeamRules(db: AnchorDatabase, cwd: string, options?: RulesSuggestOptions): TeamRuleSuggestion[];
|
|
610
632
|
declare function countValidTeamRules(cwd: string): {
|
|
611
633
|
count: number;
|
|
612
634
|
lastRuleIndexTime?: string;
|
|
613
635
|
};
|
|
614
636
|
|
|
637
|
+
type CoverageInput = Pick<IndexStatus, "prCount" | "wisdomUnitCount" | "codeFileCount" | "codeChunkCount" | "testLinkCount" | "regressionEventCount" | "teamRuleCount" | "historyCoverage" | "staleEvidenceCount" | "staleCodeIndex">;
|
|
638
|
+
type CoverageReport = {
|
|
639
|
+
coverageScore: number;
|
|
640
|
+
coverageGrade: CoverageGrade;
|
|
641
|
+
coverageReasons: string[];
|
|
642
|
+
suggestedPrompts: string[];
|
|
643
|
+
};
|
|
644
|
+
declare function calculateCoverage(input: CoverageInput): CoverageReport;
|
|
645
|
+
|
|
646
|
+
type SuggestedPrompt = {
|
|
647
|
+
id: "before_edit" | "explain_file" | "strict_mode" | "review_diff";
|
|
648
|
+
title: string;
|
|
649
|
+
prompt: string;
|
|
650
|
+
};
|
|
651
|
+
declare function getSuggestedPrompts(): SuggestedPrompt[];
|
|
652
|
+
declare function getSuggestedPromptTexts(): string[];
|
|
653
|
+
|
|
654
|
+
declare const DEMO_REPO = "anchor/demo";
|
|
655
|
+
declare const DEMO_PULL_REQUESTS: PullRequestRecord[];
|
|
656
|
+
declare const DEMO_CODE_FILES: Record<string, string>;
|
|
657
|
+
|
|
615
658
|
declare function createGitHubClient(token: string): Octokit;
|
|
616
659
|
|
|
617
660
|
type FetchPullRequestsOptions = {
|
|
@@ -642,4 +685,4 @@ declare function getAnchorIndexHealth(cwd: string): AnchorIndexHealth & {
|
|
|
642
685
|
indexStatus: IndexStatus;
|
|
643
686
|
};
|
|
644
687
|
|
|
645
|
-
export { ANCHOR_CURSOR_RULE, type AnchorContextInput, type AnchorDatabase, type AnchorExplainFileInput, type AnchorIndexHealth, type AnchorReviewDiffInput, type ChunkableCodeFile, type CodeChunk, type CodeFileDiscoveryResult, type CodeFileRecord, type CodeIndexProgress, type CodeIndexSummary, type ConfidenceLevel, type CurrentCodeSnapshot, type CursorMcpConfig, DEFAULT_MAX_CODE_FILE_BYTES, type DiscoveredCodeFile, type DoctorCheck, type DoctorOptions, type DoctorReport, type EvidenceRef, type FetchPullRequestsOptions, type FetchPullRequestsProgress, type FormattedResult, type FreshnessResult, type FreshnessStatus, type GitHubRepo, type GitHubTokenResolution, type GitHubTokenResolverOptions, type GitHubTokenSource, type IndexPullRequestsProgress, type IndexRunRecord, type IndexStatus, type IndexSummary, type LocalEmbeddingProvider, type PullRequestComment, type PullRequestCommit, type PullRequestFile, type PullRequestPerson, type PullRequestRecord, type RankedCodeChunk, type RankedRegressionEvent, type RankedTeamRule, type RankedTestFile, type RankedWisdomUnit, type RegressionEvent, type RulesAddInput, type RulesAddResult, type RulesEvidenceCheckResult, type RulesInitResult, SCHEMA_SQL, type SearchHistoryInput, type SemanticStatus, type SourceType, TEAM_RULES_FILE, type TeamRule, type TeamRulesValidationResult, type TestFileRecord, type TestLink, type WisdomCategory, type WisdomUnit, addTeamRule, anchorMcpEntry, buildAnchorContextResult, buildFtsQuery, buildQueryTerms, canonicalizeText, categorizeWisdom, checkSchema, checkTeamRuleEvidence, chunkCodeFile, chunkHistoricalText, claimKeyFor, clampMaxResults, clipSentence, confidenceAtLeast, confidenceLevelFor, confidenceRank, confidenceReasonsFor, countValidTeamRules, createGitHubClient, defaultDatabasePath, detectGitHubRepo, detectGitRoot, discoverCodeFiles, emptyCodeIndexSummary, ensureAnchorGitExclude, ensureCursorConfig, ensureCursorRule, ensureRepository, ensureTeamRulesFile, evaluateFreshness, evaluateIndexHealth, evidenceForWisdom, explainFile, extractCodeSymbols, extractRegressionEvents, extractSymbols, extractWisdomUnits, fetchMergedPullRequests, fetchPullRequestDetails, filesFromDiff, formatAnchorContext, formatIndexStatus, formatSearchHistory, getAnchorIndexHealth, getIndexStatus, getLastSyncTime, getSemanticStatus, githubAuthFixMessage, hasHighSignalLanguage, indexCodebase, indexPullRequests, inferTestAwareness, initializeSchema, isHardExcludedCodePath, isTestFilePath, loadCurrentCodeSnapshot, loadTeamRulesFile, mergeAnchorMcpConfig, normalizePullRequest, openAnchorDatabase, parseGitHubRemote, rankCodeChunks, rankRegressionEvents, rankRelevantTests, rankTeamRules, rankWisdomUnits, recordIndexRun, redactSecrets, redactedHistoricalText, replaceCodeIndex, resolveGitHubToken, resolvePullRequestDetailConcurrency, resolvePullRequestFetchLimit, reviewDiff, runDoctor, sanitizeHistoricalText, shouldSyncSince, sourceTypeLabel, stripPromptInjection, tokenizeSearchText, truncateText, uniqueStrings, updateSyncState, upsertPullRequest, validateTeamRulesFile };
|
|
688
|
+
export { ANCHOR_CURSOR_RULE, type AnchorContextInput, type AnchorDatabase, type AnchorExplainFileInput, type AnchorIndexHealth, type AnchorReviewDiffInput, type ChunkableCodeFile, type CodeChunk, type CodeFileDiscoveryResult, type CodeFileRecord, type CodeIndexProgress, type CodeIndexSummary, type ConfidenceLevel, type CoverageGrade, type CoverageInput, type CoverageReport, type CurrentCodeSnapshot, type CursorMcpConfig, DEFAULT_MAX_CODE_FILE_BYTES, DEMO_CODE_FILES, DEMO_PULL_REQUESTS, DEMO_REPO, type DiscoveredCodeFile, type DoctorCheck, type DoctorOptions, type DoctorReport, type EvidenceRef, type FetchPullRequestsOptions, type FetchPullRequestsProgress, type FormattedResult, type FreshnessResult, type FreshnessStatus, type GitHubRepo, type GitHubTokenResolution, type GitHubTokenResolverOptions, type GitHubTokenSource, type IndexPullRequestsProgress, type IndexRunRecord, type IndexStatus, type IndexSummary, type LocalEmbeddingProvider, type PullRequestComment, type PullRequestCommit, type PullRequestFile, type PullRequestPerson, type PullRequestRecord, type RankedCodeChunk, type RankedRegressionEvent, type RankedTeamRule, type RankedTestFile, type RankedWisdomUnit, type RegressionEvent, type RulesAddInput, type RulesAddResult, type RulesEvidenceCheckResult, type RulesInitResult, type RulesSuggestOptions, SCHEMA_SQL, type SearchHistoryInput, type SemanticStatus, type SourceType, type SuggestedPrompt, TEAM_RULES_FILE, type TeamRule, type TeamRuleSuggestion, type TeamRulesValidationResult, type TestFileRecord, type TestLink, type WisdomCategory, type WisdomUnit, addTeamRule, anchorMcpEntry, buildAnchorContextResult, buildFtsQuery, buildQueryTerms, calculateCoverage, canonicalizeText, categorizeWisdom, checkSchema, checkTeamRuleEvidence, chunkCodeFile, chunkHistoricalText, claimKeyFor, clampMaxResults, clipSentence, confidenceAtLeast, confidenceLevelFor, confidenceRank, confidenceReasonsFor, countValidTeamRules, createGitHubClient, defaultDatabasePath, detectGitHubRepo, detectGitRoot, discoverCodeFiles, emptyCodeIndexSummary, ensureAnchorGitExclude, ensureCursorConfig, ensureCursorRule, ensureRepository, ensureTeamRulesFile, evaluateFreshness, evaluateIndexHealth, evidenceForWisdom, explainFile, extractCodeSymbols, extractRegressionEvents, extractSymbols, extractWisdomUnits, fetchMergedPullRequests, fetchPullRequestDetails, filesFromDiff, formatAnchorContext, formatIndexStatus, formatSearchHistory, getAnchorIndexHealth, getIndexStatus, getLastSyncTime, getSemanticStatus, getSuggestedPromptTexts, getSuggestedPrompts, getWisdomCategoryCounts, githubAuthFixMessage, hasHighSignalLanguage, indexCodebase, indexPullRequests, inferTestAwareness, initializeSchema, isHardExcludedCodePath, isTestFilePath, loadCurrentCodeSnapshot, loadTeamRulesFile, mergeAnchorMcpConfig, normalizePullRequest, openAnchorDatabase, parseGitHubRemote, rankCodeChunks, rankRegressionEvents, rankRelevantTests, rankTeamRules, rankWisdomUnits, recordIndexRun, redactSecrets, redactedHistoricalText, replaceCodeIndex, resolveGitHubToken, resolvePullRequestDetailConcurrency, resolvePullRequestFetchLimit, reviewDiff, runDoctor, sanitizeHistoricalText, shouldSyncSince, sourceTypeLabel, stripPromptInjection, suggestTeamRules, tokenizeSearchText, truncateText, uniqueStrings, updateSyncState, upsertPullRequest, validateTeamRulesFile };
|