@pratik7368patil/anchor-core 0.1.21 → 0.1.22

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 CHANGED
@@ -382,8 +382,13 @@ type OrgStatus = {
382
382
  codeChunkCount: number;
383
383
  wisdomUnitCount: number;
384
384
  crossRepoEdgeCount: number;
385
+ apiContractCount: number;
385
386
  apiConsumerCount: number;
386
387
  anomalyCount: number;
388
+ graphLastBuiltAt?: string;
389
+ graphLastStatus?: "success" | "failed" | "skipped" | "unknown";
390
+ graphLastDurationMs?: number;
391
+ graphLastError?: string;
387
392
  coverageScore: number;
388
393
  coverageGrade: CoverageGrade;
389
394
  coverageReasons: string[];
@@ -397,6 +402,63 @@ type OrgStatus = {
397
402
  lastError?: string;
398
403
  }>;
399
404
  };
405
+ type OrgGraphProgress = {
406
+ stage: "loading_package_manifests";
407
+ org: string;
408
+ totalRepos: number;
409
+ } | {
410
+ stage: "loaded_package_manifests";
411
+ org: string;
412
+ repos: number;
413
+ packageNames: number;
414
+ } | {
415
+ stage: "building_package_edges";
416
+ org: string;
417
+ current: number;
418
+ total: number;
419
+ repo: string;
420
+ edges: number;
421
+ } | {
422
+ stage: "loading_imports";
423
+ org: string;
424
+ } | {
425
+ stage: "building_import_edges";
426
+ org: string;
427
+ current: number;
428
+ total: number;
429
+ sourcePath: string;
430
+ edges: number;
431
+ } | {
432
+ stage: "loading_code_chunks";
433
+ org: string;
434
+ } | {
435
+ stage: "extracting_api_contracts";
436
+ org: string;
437
+ current: number;
438
+ total: number;
439
+ filePath: string;
440
+ contracts: number;
441
+ } | {
442
+ stage: "matching_api_consumers";
443
+ org: string;
444
+ current: number;
445
+ total: number;
446
+ filePath: string;
447
+ matches: number;
448
+ } | {
449
+ stage: "writing_org_graph";
450
+ org: string;
451
+ edges: number;
452
+ apiContracts: number;
453
+ apiConsumers: number;
454
+ } | {
455
+ stage: "completed_org_graph";
456
+ org: string;
457
+ edges: number;
458
+ apiContracts: number;
459
+ apiConsumers: number;
460
+ durationMs: number;
461
+ };
400
462
  type FetchPullRequestsProgress = {
401
463
  stage: "discovering_pull_requests";
402
464
  repo: string;
@@ -1256,6 +1318,21 @@ declare function recordOrgIndexRun(db: AnchorDatabase, input: {
1256
1318
  codeFilesIndexed?: number;
1257
1319
  failures?: string[];
1258
1320
  }): void;
1321
+ declare function recordOrgGraphState(db: AnchorDatabase, input: {
1322
+ org: string;
1323
+ status: "success" | "failed" | "skipped" | "unknown";
1324
+ builtAt?: string;
1325
+ durationMs?: number;
1326
+ edgeCount?: number;
1327
+ apiContractCount?: number;
1328
+ apiConsumerCount?: number;
1329
+ error?: string;
1330
+ }): void;
1331
+ declare function getOrgGraphCounts(db: AnchorDatabase, org: string): {
1332
+ edges: number;
1333
+ apiContracts: number;
1334
+ apiConsumers: number;
1335
+ };
1259
1336
  declare function getOrgStatus(db: AnchorDatabase, config: AnchorOrgConfig, baseDir?: string): OrgStatus;
1260
1337
 
1261
1338
  type GitCommandRunner = (command: string, args: string[], options: {
@@ -1269,6 +1346,22 @@ type OrgCloneResult = {
1269
1346
  currentCommit?: string;
1270
1347
  error?: string;
1271
1348
  };
1349
+ type OrgCloneProgress = {
1350
+ stage: "cloning_or_pulling_repo";
1351
+ org: string;
1352
+ repo: string;
1353
+ current: number;
1354
+ total: number;
1355
+ } | {
1356
+ stage: "cloned_or_pulled_repo";
1357
+ org: string;
1358
+ repo: string;
1359
+ current: number;
1360
+ total: number;
1361
+ cloned: boolean;
1362
+ pulled: boolean;
1363
+ error?: string;
1364
+ };
1272
1365
  declare function defaultGitCommandRunner(command: string, args: string[], options?: {
1273
1366
  cwd?: string;
1274
1367
  }): string;
@@ -1291,7 +1384,7 @@ declare function cloneOrgRepos(input: {
1291
1384
  concurrency?: number;
1292
1385
  baseDir?: string;
1293
1386
  runner?: GitCommandRunner;
1294
- onProgress?: (message: string) => void;
1387
+ onProgress?: (progress: OrgCloneProgress) => void;
1295
1388
  }): Promise<OrgCloneResult[]>;
1296
1389
  declare function orgCloneStateFromResult(org: string, repo: AnchorOrgRepoConfig, result: OrgCloneResult): OrgRepoCloneState;
1297
1390
 
@@ -1305,8 +1398,13 @@ type OrgGraphResult = {
1305
1398
  evidence: EvidenceRef[];
1306
1399
  confidence: number;
1307
1400
  }>;
1401
+ durationMs: number;
1402
+ };
1403
+ type RebuildOrgGraphOptions = {
1404
+ baseDir?: string;
1405
+ onProgress?: (progress: OrgGraphProgress) => void;
1308
1406
  };
1309
- declare function rebuildOrgGraph(db: AnchorDatabase, config: AnchorOrgConfig, baseDir?: string): OrgGraphResult;
1407
+ declare function rebuildOrgGraph(db: AnchorDatabase, config: AnchorOrgConfig, baseDirOrOptions?: string | RebuildOrgGraphOptions): OrgGraphResult;
1310
1408
 
1311
1409
  type OrgRepoIndexResult = {
1312
1410
  repo: string;
@@ -1323,6 +1421,8 @@ type OrgIndexResult = {
1323
1421
  edges: number;
1324
1422
  apiConsumers: number;
1325
1423
  apiContracts: number;
1424
+ skipped?: boolean;
1425
+ error?: string;
1326
1426
  };
1327
1427
  };
1328
1428
  type OrgIndexOptions = {
@@ -1330,6 +1430,7 @@ type OrgIndexOptions = {
1330
1430
  codeOnly?: boolean;
1331
1431
  prsOnly?: boolean;
1332
1432
  force?: boolean;
1433
+ noGraph?: boolean;
1333
1434
  since?: string;
1334
1435
  concurrency?: number;
1335
1436
  token?: string;
@@ -1339,6 +1440,7 @@ type OrgIndexOptions = {
1339
1440
  onFetchProgress?: (progress: FetchPullRequestsProgress) => void;
1340
1441
  onPrIndexProgress?: (progress: IndexPullRequestsProgress) => void;
1341
1442
  onCodeProgress?: (progress: CodeIndexProgress) => void;
1443
+ onGraphProgress?: (progress: OrgGraphProgress) => void;
1342
1444
  };
1343
1445
  declare function indexOrgRepos(db: AnchorDatabase, config: AnchorOrgConfig, options?: OrgIndexOptions): Promise<OrgIndexResult>;
1344
1446
 
@@ -1401,4 +1503,4 @@ declare function getAnchorIndexHealth(cwd: string): AnchorIndexHealth & {
1401
1503
  indexStatus: IndexStatus;
1402
1504
  };
1403
1505
 
1404
- export { ANCHOR_CURSOR_RULE, ANCHOR_EVALS_FILE, ANCHOR_PLAYBOOKS_FILE, type AnchorCiInput, type AnchorContextInput, type AnchorDatabase, type AnchorExplainFileInput, type AnchorIndexHealth, type AnchorOrgConfig, type AnchorOrgRepoConfig, type AnchorReviewDiffInput, type ArchitectureArea, type ArchitectureCheckInput, type ArchitectureComponent, type ArchitectureContextInput, type ArchitectureIndexData, type ArchitectureMap, type ArchitectureMapEdge, type ArchitectureMapFormat, type ArchitectureMapInput, type ArchitectureMapNode, type ArchitecturePattern, type ArchitectureQueryInput, type ChunkableCodeFile, type CodeChunk, type CodeFileDiscoveryResult, type CodeFileRecord, type CodeImport, 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 FeedbackEvent, type FeedbackRating, type FetchMergedPullRequestsGraphQLOptions, type FetchPullRequestsOptions, type FetchPullRequestsProgress, type FormattedResult, type FreshnessResult, type FreshnessStatus, type GitCommandRunner, type GitHubFetchBackend, GitHubGraphQLError, type GitHubGraphQLFetch, type GitHubGraphQLFetchCheckpoint, type GitHubGraphQLRateLimitState, type GitHubGraphQLResponse, type GitHubRateLimitController, type GitHubRateLimitErrorLike, type GitHubRateLimitProgress, type GitHubRepo, type GitHubTokenResolution, type GitHubTokenResolverOptions, type GitHubTokenSource, type IndexPullRequestsProgress, type IndexRunRecord, type IndexStatus, type IndexSummary, type LocalEmbeddingProvider, type OnboardingInput, type OnboardingPack, type OrgAnomaly, type OrgAnomalyCategory, type OrgApiConsumer, type OrgCloneResult, type OrgCrossRepoEdge, type OrgCrossRepoRelationship, type OrgFormattedResult, type OrgImpactResult, type OrgIndexOptions, type OrgIndexResult, type OrgRepoCloneState, type OrgRepoGroup, type OrgRepoIndexResult, type OrgStatus, type Playbook, type PullRequestComment, type PullRequestCommit, type PullRequestFile, type PullRequestPerson, type PullRequestRecord, type RankedArchitecturePattern, type RankedCodeChunk, type RankedRegressionEvent, type RankedTeamRule, type RankedTestFile, type RankedWisdomUnit, type RegressionEvent, type ReliabilityGate, type ReliabilityGateRejection, type ReliabilityGateResult, type ReliabilityGateStatus, type RetrievalEvalCase, type RetrievalEvalResult, type RetrievalEvalRunResult, type RulesAddInput, type RulesAddResult, type RulesEvidenceCheckResult, type RulesInitResult, type RulesSuggestOptions, SCHEMA_SQL, type SearchHistoryInput, type SemanticStatus, type SourceType, type SuggestedPrompt, TEAM_RULES_FILE, type TaskPlan, type TeamRule, type TeamRuleSuggestion, type TeamRulesValidationResult, type TestCommand, type TestFileRecord, type TestLink, type WatchRefreshInput, type WisdomCategory, type WisdomUnit, addOrgRepoConfig, addRetrievalEval, addTeamRule, anchorMcpEntry, architectureFilesFromDiff, buildAnchorContextResult, buildArchitectureIndex, buildArchitectureMap, buildFtsQuery, buildOnboardingPack, buildOrgContextResult, buildQueryTerms, calculateCoverage, canonicalizeText, categorizeWisdom, checkArchitecture, checkOrgImpact, checkSchema, checkTeamRuleEvidence, chunkCodeFile, chunkHistoricalText, claimKeyFor, clampMaxResults, classifyArchitectureArea, clearGraphQLFetchCheckpoint, clipSentence, cloneOrPullOrgRepo, cloneOrgRepos, confidenceAtLeast, confidenceLevelFor, confidenceRank, confidenceReasonsFor, countValidTeamRules, createGitHubClient, createGitHubGraphQLRequester, defaultDatabasePath, defaultGitCommandRunner, defaultOrgBaseDir, defaultOrgCloneUrl, detectGitHubRepo, detectGitRoot, detectTestCommands, detectTestCommandsForFile, discoverCodeFiles, emptyCodeIndexSummary, ensureAnchorGitExclude, ensureCursorConfig, ensureCursorRule, ensureRepository, ensureTeamRulesFile, evaluateFreshness, evaluateIndexHealth, evaluateReliabilityGate, evidenceForWisdom, explainFile, extractCodeImports, extractCodeSymbols, extractRegressionEvents, extractSymbols, extractWisdomUnits, feedbackAdjustedScore, fetchMergedPullRequests, fetchMergedPullRequestsWithGraphQL, fetchPullRequestDetails, filesFromDiff, findOrgApiConsumers, formatAnchorContext, formatIndexStatus, formatSearchHistory, getAnchorIndexHealth, getArchitectureContext, getArchitectureMapContext, getGitHubRateLimitDelayMs, getGraphQLFetchCheckpoint, getIndexStatus, getLastSyncTime, getOrgArchitectureMap, getOrgRepoState, getOrgStatus, getPlaybook, getSemanticStatus, getSuggestedPromptTexts, getSuggestedPrompts, getWisdomCategoryCounts, githubAuthFixMessage, graphQLFetchCheckpointScope, hasHighSignalLanguage, indexCodebase, indexOrgRepos, indexPullRequests, inferTestAwareness, initOrgConfig, initPlaybooks, initRetrievalEvals, initializeSchema, isGitHubGraphQLResourceLimitError, isGitHubRateLimitError, isHardExcludedCodePath, isTestFilePath, listFeedbackEvents, listOrgNames, listPlaybooks, loadCurrentCodeSnapshot, loadOrgConfig, loadTeamRulesFile, maybeLoadOrgConfig, mergeAnchorMcpConfig, normalizePullRequest, openAnchorDatabase, openOrgDatabase, orgCloneStateFromResult, orgConfigPath, orgDatabasePath, orgRepoLocalPath, orgReposRoot, orgRoot, paginateWithGitHubRateLimit, parseGitHubRemote, planTask, plannedOrgCloneCommands, rankArchitecturePatterns, rankCodeChunks, rankRegressionEvents, rankRelevantTests, rankTeamRules, rankWisdomUnits, rebuildOrgGraph, recordFeedback, recordIndexRun, recordOrgIndexRun, redactSecrets, redactedHistoricalText, refreshTestCommands, refreshWatchIndex, removeOrgRepoConfig, replaceCodeIndex, repoAliasFromFullName, requestWithGitHubRateLimit, resolveGitHubToken, resolveOrgForTool, resolvePullRequestDetailConcurrency, resolvePullRequestFetchLimit, reviewDiff, runAnchorCi, runDoctor, runRetrievalEvals, sanitizeHistoricalText, saveGraphQLFetchCheckpoint, saveOrgConfig, shouldFallbackToRestAfterGraphQLError, shouldSyncSince, sourceTypeLabel, stripPromptInjection, suggestPlaybooks, suggestTeamRules, syncOrgConfigToDatabase, syncPlaybooksToDatabase, tokenizeSearchText, truncateText, uniqueStrings, updateGitHubGraphQLRateLimitState, updateOrgRepoState, updateSyncState, upsertPullRequest, validateOrgName, validateOrgRepoFullName, validateOrgRepoGroup, validateTeamRulesFile, watchCodebase };
1506
+ export { ANCHOR_CURSOR_RULE, ANCHOR_EVALS_FILE, ANCHOR_PLAYBOOKS_FILE, type AnchorCiInput, type AnchorContextInput, type AnchorDatabase, type AnchorExplainFileInput, type AnchorIndexHealth, type AnchorOrgConfig, type AnchorOrgRepoConfig, type AnchorReviewDiffInput, type ArchitectureArea, type ArchitectureCheckInput, type ArchitectureComponent, type ArchitectureContextInput, type ArchitectureIndexData, type ArchitectureMap, type ArchitectureMapEdge, type ArchitectureMapFormat, type ArchitectureMapInput, type ArchitectureMapNode, type ArchitecturePattern, type ArchitectureQueryInput, type ChunkableCodeFile, type CodeChunk, type CodeFileDiscoveryResult, type CodeFileRecord, type CodeImport, 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 FeedbackEvent, type FeedbackRating, type FetchMergedPullRequestsGraphQLOptions, type FetchPullRequestsOptions, type FetchPullRequestsProgress, type FormattedResult, type FreshnessResult, type FreshnessStatus, type GitCommandRunner, type GitHubFetchBackend, GitHubGraphQLError, type GitHubGraphQLFetch, type GitHubGraphQLFetchCheckpoint, type GitHubGraphQLRateLimitState, type GitHubGraphQLResponse, type GitHubRateLimitController, type GitHubRateLimitErrorLike, type GitHubRateLimitProgress, type GitHubRepo, type GitHubTokenResolution, type GitHubTokenResolverOptions, type GitHubTokenSource, type IndexPullRequestsProgress, type IndexRunRecord, type IndexStatus, type IndexSummary, type LocalEmbeddingProvider, type OnboardingInput, type OnboardingPack, type OrgAnomaly, type OrgAnomalyCategory, type OrgApiConsumer, type OrgCloneProgress, type OrgCloneResult, type OrgCrossRepoEdge, type OrgCrossRepoRelationship, type OrgFormattedResult, type OrgGraphProgress, type OrgGraphResult, type OrgImpactResult, type OrgIndexOptions, type OrgIndexResult, type OrgRepoCloneState, type OrgRepoGroup, type OrgRepoIndexResult, type OrgStatus, type Playbook, type PullRequestComment, type PullRequestCommit, type PullRequestFile, type PullRequestPerson, type PullRequestRecord, type RankedArchitecturePattern, type RankedCodeChunk, type RankedRegressionEvent, type RankedTeamRule, type RankedTestFile, type RankedWisdomUnit, type RebuildOrgGraphOptions, type RegressionEvent, type ReliabilityGate, type ReliabilityGateRejection, type ReliabilityGateResult, type ReliabilityGateStatus, type RetrievalEvalCase, type RetrievalEvalResult, type RetrievalEvalRunResult, type RulesAddInput, type RulesAddResult, type RulesEvidenceCheckResult, type RulesInitResult, type RulesSuggestOptions, SCHEMA_SQL, type SearchHistoryInput, type SemanticStatus, type SourceType, type SuggestedPrompt, TEAM_RULES_FILE, type TaskPlan, type TeamRule, type TeamRuleSuggestion, type TeamRulesValidationResult, type TestCommand, type TestFileRecord, type TestLink, type WatchRefreshInput, type WisdomCategory, type WisdomUnit, addOrgRepoConfig, addRetrievalEval, addTeamRule, anchorMcpEntry, architectureFilesFromDiff, buildAnchorContextResult, buildArchitectureIndex, buildArchitectureMap, buildFtsQuery, buildOnboardingPack, buildOrgContextResult, buildQueryTerms, calculateCoverage, canonicalizeText, categorizeWisdom, checkArchitecture, checkOrgImpact, checkSchema, checkTeamRuleEvidence, chunkCodeFile, chunkHistoricalText, claimKeyFor, clampMaxResults, classifyArchitectureArea, clearGraphQLFetchCheckpoint, clipSentence, cloneOrPullOrgRepo, cloneOrgRepos, confidenceAtLeast, confidenceLevelFor, confidenceRank, confidenceReasonsFor, countValidTeamRules, createGitHubClient, createGitHubGraphQLRequester, defaultDatabasePath, defaultGitCommandRunner, defaultOrgBaseDir, defaultOrgCloneUrl, detectGitHubRepo, detectGitRoot, detectTestCommands, detectTestCommandsForFile, discoverCodeFiles, emptyCodeIndexSummary, ensureAnchorGitExclude, ensureCursorConfig, ensureCursorRule, ensureRepository, ensureTeamRulesFile, evaluateFreshness, evaluateIndexHealth, evaluateReliabilityGate, evidenceForWisdom, explainFile, extractCodeImports, extractCodeSymbols, extractRegressionEvents, extractSymbols, extractWisdomUnits, feedbackAdjustedScore, fetchMergedPullRequests, fetchMergedPullRequestsWithGraphQL, fetchPullRequestDetails, filesFromDiff, findOrgApiConsumers, formatAnchorContext, formatIndexStatus, formatSearchHistory, getAnchorIndexHealth, getArchitectureContext, getArchitectureMapContext, getGitHubRateLimitDelayMs, getGraphQLFetchCheckpoint, getIndexStatus, getLastSyncTime, getOrgArchitectureMap, getOrgGraphCounts, getOrgRepoState, getOrgStatus, getPlaybook, getSemanticStatus, getSuggestedPromptTexts, getSuggestedPrompts, getWisdomCategoryCounts, githubAuthFixMessage, graphQLFetchCheckpointScope, hasHighSignalLanguage, indexCodebase, indexOrgRepos, indexPullRequests, inferTestAwareness, initOrgConfig, initPlaybooks, initRetrievalEvals, initializeSchema, isGitHubGraphQLResourceLimitError, isGitHubRateLimitError, isHardExcludedCodePath, isTestFilePath, listFeedbackEvents, listOrgNames, listPlaybooks, loadCurrentCodeSnapshot, loadOrgConfig, loadTeamRulesFile, maybeLoadOrgConfig, mergeAnchorMcpConfig, normalizePullRequest, openAnchorDatabase, openOrgDatabase, orgCloneStateFromResult, orgConfigPath, orgDatabasePath, orgRepoLocalPath, orgReposRoot, orgRoot, paginateWithGitHubRateLimit, parseGitHubRemote, planTask, plannedOrgCloneCommands, rankArchitecturePatterns, rankCodeChunks, rankRegressionEvents, rankRelevantTests, rankTeamRules, rankWisdomUnits, rebuildOrgGraph, recordFeedback, recordIndexRun, recordOrgGraphState, recordOrgIndexRun, redactSecrets, redactedHistoricalText, refreshTestCommands, refreshWatchIndex, removeOrgRepoConfig, replaceCodeIndex, repoAliasFromFullName, requestWithGitHubRateLimit, resolveGitHubToken, resolveOrgForTool, resolvePullRequestDetailConcurrency, resolvePullRequestFetchLimit, reviewDiff, runAnchorCi, runDoctor, runRetrievalEvals, sanitizeHistoricalText, saveGraphQLFetchCheckpoint, saveOrgConfig, shouldFallbackToRestAfterGraphQLError, shouldSyncSince, sourceTypeLabel, stripPromptInjection, suggestPlaybooks, suggestTeamRules, syncOrgConfigToDatabase, syncPlaybooksToDatabase, tokenizeSearchText, truncateText, uniqueStrings, updateGitHubGraphQLRateLimitState, updateOrgRepoState, updateSyncState, upsertPullRequest, validateOrgName, validateOrgRepoFullName, validateOrgRepoGroup, validateTeamRulesFile, watchCodebase };