@pratik7368patil/anchor-core 0.1.14 → 0.1.17
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 +305 -4
- package/dist/index.js +2341 -100
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/db/schema.sql +64 -0
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,18 @@ type FreshnessStatus = "current" | "possibly_stale" | "stale";
|
|
|
8
8
|
type CoverageGrade = "empty" | "poor" | "fair" | "good" | "excellent";
|
|
9
9
|
type ArchitectureArea = "api" | "service" | "component" | "hook" | "route" | "store" | "test" | "schema" | "type" | "config" | "util" | "unknown";
|
|
10
10
|
type ReliabilityGateStatus = "passed" | "weak" | "failed";
|
|
11
|
+
type GitHubFetchBackend = "graphql" | "rest";
|
|
12
|
+
type GitHubGraphQLFetchCheckpoint = {
|
|
13
|
+
repo: string;
|
|
14
|
+
scope: string;
|
|
15
|
+
cursor?: string | null;
|
|
16
|
+
scannedPullRequests: number;
|
|
17
|
+
matchedMergedPullRequests: number;
|
|
18
|
+
pageSize: number;
|
|
19
|
+
resetAt?: string | null;
|
|
20
|
+
reason: string;
|
|
21
|
+
updatedAt: string;
|
|
22
|
+
};
|
|
11
23
|
type EvidenceRef = {
|
|
12
24
|
prNumber: number;
|
|
13
25
|
prUrl: string;
|
|
@@ -211,12 +223,102 @@ type RankedRegressionEvent = RegressionEvent & {
|
|
|
211
223
|
matchReasons: string[];
|
|
212
224
|
rankSignals: Record<string, number>;
|
|
213
225
|
};
|
|
226
|
+
type TestCommand = {
|
|
227
|
+
command: string;
|
|
228
|
+
reason: string;
|
|
229
|
+
confidence: ConfidenceLevel;
|
|
230
|
+
filePath?: string;
|
|
231
|
+
};
|
|
232
|
+
type TaskPlan = {
|
|
233
|
+
targetFiles: string[];
|
|
234
|
+
likelySymbols: string[];
|
|
235
|
+
implementationSteps: string[];
|
|
236
|
+
risks: string[];
|
|
237
|
+
recommendedTests: string[];
|
|
238
|
+
evidence: EvidenceRef[];
|
|
239
|
+
testCommands: TestCommand[];
|
|
240
|
+
};
|
|
241
|
+
type ArchitectureMapFormat = "mermaid" | "json";
|
|
242
|
+
type ArchitectureMapNode = {
|
|
243
|
+
id: string;
|
|
244
|
+
label: string;
|
|
245
|
+
area: ArchitectureArea;
|
|
246
|
+
path?: string;
|
|
247
|
+
};
|
|
248
|
+
type ArchitectureMapEdge = {
|
|
249
|
+
source: string;
|
|
250
|
+
target: string;
|
|
251
|
+
relationship: string;
|
|
252
|
+
weight: number;
|
|
253
|
+
};
|
|
254
|
+
type ArchitectureMap = {
|
|
255
|
+
format: ArchitectureMapFormat;
|
|
256
|
+
nodes: ArchitectureMapNode[];
|
|
257
|
+
edges: ArchitectureMapEdge[];
|
|
258
|
+
mermaid?: string;
|
|
259
|
+
};
|
|
260
|
+
type RetrievalEvalCase = {
|
|
261
|
+
id: string;
|
|
262
|
+
task: string;
|
|
263
|
+
files: string[];
|
|
264
|
+
expectedPrs: number[];
|
|
265
|
+
expectedCategories: WisdomCategory[];
|
|
266
|
+
};
|
|
267
|
+
type RetrievalEvalResult = {
|
|
268
|
+
id: string;
|
|
269
|
+
task: string;
|
|
270
|
+
passed: boolean;
|
|
271
|
+
expectedPrs: number[];
|
|
272
|
+
foundPrs: number[];
|
|
273
|
+
missingPrs: number[];
|
|
274
|
+
expectedCategories: WisdomCategory[];
|
|
275
|
+
foundCategories: WisdomCategory[];
|
|
276
|
+
missingCategories: WisdomCategory[];
|
|
277
|
+
};
|
|
278
|
+
type RetrievalEvalRunResult = {
|
|
279
|
+
ok: boolean;
|
|
280
|
+
path: string;
|
|
281
|
+
total: number;
|
|
282
|
+
passed: number;
|
|
283
|
+
failed: number;
|
|
284
|
+
results: RetrievalEvalResult[];
|
|
285
|
+
};
|
|
286
|
+
type FeedbackRating = "useful" | "not-useful";
|
|
287
|
+
type FeedbackEvent = {
|
|
288
|
+
resultId: string;
|
|
289
|
+
rating: FeedbackRating;
|
|
290
|
+
note?: string;
|
|
291
|
+
createdAt: string;
|
|
292
|
+
};
|
|
293
|
+
type Playbook = {
|
|
294
|
+
id: string;
|
|
295
|
+
title: string;
|
|
296
|
+
body: string;
|
|
297
|
+
evidence: EvidenceRef[];
|
|
298
|
+
createdAt: string;
|
|
299
|
+
};
|
|
300
|
+
type OnboardingPack = {
|
|
301
|
+
title: string;
|
|
302
|
+
areas: Array<{
|
|
303
|
+
area: ArchitectureArea;
|
|
304
|
+
files: string[];
|
|
305
|
+
patternCount: number;
|
|
306
|
+
}>;
|
|
307
|
+
importantFiles: string[];
|
|
308
|
+
riskyModules: string[];
|
|
309
|
+
relevantTests: string[];
|
|
310
|
+
topRules: TeamRule[];
|
|
311
|
+
playbooks: Playbook[];
|
|
312
|
+
starterPrompts: string[];
|
|
313
|
+
architectureMap: ArchitectureMap;
|
|
314
|
+
};
|
|
214
315
|
type FetchPullRequestsProgress = {
|
|
215
316
|
stage: "discovering_pull_requests";
|
|
216
317
|
repo: string;
|
|
217
318
|
all: boolean;
|
|
218
319
|
limit?: number;
|
|
219
320
|
since?: string;
|
|
321
|
+
backend?: GitHubFetchBackend;
|
|
220
322
|
} | {
|
|
221
323
|
stage: "scanned_pull_request_page";
|
|
222
324
|
repo: string;
|
|
@@ -224,6 +326,8 @@ type FetchPullRequestsProgress = {
|
|
|
224
326
|
limit?: number;
|
|
225
327
|
scannedPullRequests: number;
|
|
226
328
|
matchedMergedPullRequests: number;
|
|
329
|
+
backend?: GitHubFetchBackend;
|
|
330
|
+
pageSize?: number;
|
|
227
331
|
} | {
|
|
228
332
|
stage: "discovered_pull_requests";
|
|
229
333
|
repo: string;
|
|
@@ -231,6 +335,7 @@ type FetchPullRequestsProgress = {
|
|
|
231
335
|
total: number;
|
|
232
336
|
limit?: number;
|
|
233
337
|
detailConcurrency: number;
|
|
338
|
+
backend?: GitHubFetchBackend;
|
|
234
339
|
} | {
|
|
235
340
|
stage: "fetching_pull_request_details";
|
|
236
341
|
repo: string;
|
|
@@ -245,6 +350,61 @@ type FetchPullRequestsProgress = {
|
|
|
245
350
|
total: number;
|
|
246
351
|
prNumber: number;
|
|
247
352
|
detailConcurrency: number;
|
|
353
|
+
} | {
|
|
354
|
+
stage: "enriching_pull_request_patches";
|
|
355
|
+
repo: string;
|
|
356
|
+
current: number;
|
|
357
|
+
total: number;
|
|
358
|
+
prNumber: number;
|
|
359
|
+
detailConcurrency: number;
|
|
360
|
+
} | {
|
|
361
|
+
stage: "enriched_pull_request_patches";
|
|
362
|
+
repo: string;
|
|
363
|
+
current: number;
|
|
364
|
+
total: number;
|
|
365
|
+
prNumber: number;
|
|
366
|
+
detailConcurrency: number;
|
|
367
|
+
patches: number;
|
|
368
|
+
} | {
|
|
369
|
+
stage: "skipped_pull_request_patch_enrichment";
|
|
370
|
+
repo: string;
|
|
371
|
+
current: number;
|
|
372
|
+
total: number;
|
|
373
|
+
prNumber: number;
|
|
374
|
+
reason: string;
|
|
375
|
+
} | {
|
|
376
|
+
stage: "github_fetch_backend_fallback";
|
|
377
|
+
repo: string;
|
|
378
|
+
from: GitHubFetchBackend;
|
|
379
|
+
to: GitHubFetchBackend;
|
|
380
|
+
reason: string;
|
|
381
|
+
} | {
|
|
382
|
+
stage: "github_graphql_page_size_reduced";
|
|
383
|
+
repo: string;
|
|
384
|
+
previousPageSize: number;
|
|
385
|
+
nextPageSize: number;
|
|
386
|
+
reason: string;
|
|
387
|
+
} | {
|
|
388
|
+
stage: "github_graphql_page_size_selected";
|
|
389
|
+
repo: string;
|
|
390
|
+
previousPageSize: number;
|
|
391
|
+
nextPageSize: number;
|
|
392
|
+
remaining?: number | null;
|
|
393
|
+
averageCostPerPr?: number;
|
|
394
|
+
} | {
|
|
395
|
+
stage: "github_graphql_budget_deferred";
|
|
396
|
+
repo: string;
|
|
397
|
+
remaining?: number | null;
|
|
398
|
+
reserve: number;
|
|
399
|
+
resetAt?: string | null;
|
|
400
|
+
matchedMergedPullRequests: number;
|
|
401
|
+
} | {
|
|
402
|
+
stage: "github_graphql_checkpoint_resumed";
|
|
403
|
+
repo: string;
|
|
404
|
+
scannedPullRequests: number;
|
|
405
|
+
matchedMergedPullRequests: number;
|
|
406
|
+
pageSize: number;
|
|
407
|
+
resetAt?: string | null;
|
|
248
408
|
} | {
|
|
249
409
|
stage: "github_rate_limited";
|
|
250
410
|
repo: string;
|
|
@@ -439,6 +599,11 @@ type IndexStatus = {
|
|
|
439
599
|
architectureComponentCount: number;
|
|
440
600
|
architecturePatternCount: number;
|
|
441
601
|
architectureImportCount: number;
|
|
602
|
+
architectureMapEdgeCount: number;
|
|
603
|
+
testCommandCount: number;
|
|
604
|
+
retrievalEvalCount: number;
|
|
605
|
+
feedbackEventCount: number;
|
|
606
|
+
playbookCount: number;
|
|
442
607
|
historyCoverage?: "limited" | "all" | "unknown";
|
|
443
608
|
historyLimit?: number;
|
|
444
609
|
staleEvidenceCount: number;
|
|
@@ -447,6 +612,7 @@ type IndexStatus = {
|
|
|
447
612
|
lastCodeIndexTime?: string;
|
|
448
613
|
lastArchitectureIndexTime?: string;
|
|
449
614
|
lastRuleIndexTime?: string;
|
|
615
|
+
lastWatchIndexTime?: string;
|
|
450
616
|
lastSuccessfulRun?: string;
|
|
451
617
|
lastFailedRun?: string;
|
|
452
618
|
staleCodeIndex?: boolean;
|
|
@@ -537,6 +703,15 @@ declare function updateSyncState(db: AnchorDatabase, repo: string, lastIndexedPr
|
|
|
537
703
|
historyLimit?: number;
|
|
538
704
|
historySince?: string;
|
|
539
705
|
}): void;
|
|
706
|
+
declare function graphQLFetchCheckpointScope(input: {
|
|
707
|
+
repo: string;
|
|
708
|
+
all?: boolean;
|
|
709
|
+
limit?: number;
|
|
710
|
+
since?: string;
|
|
711
|
+
}): string;
|
|
712
|
+
declare function getGraphQLFetchCheckpoint(db: AnchorDatabase, repo: string, scope: string): GitHubGraphQLFetchCheckpoint | undefined;
|
|
713
|
+
declare function saveGraphQLFetchCheckpoint(db: AnchorDatabase, checkpoint: GitHubGraphQLFetchCheckpoint): void;
|
|
714
|
+
declare function clearGraphQLFetchCheckpoint(db: AnchorDatabase, repo: string, scope?: string): void;
|
|
540
715
|
declare function upsertPullRequest(db: AnchorDatabase, pr: PullRequestRecord, wisdomUnits: WisdomUnit[], regressionEvents?: RegressionEvent[]): {
|
|
541
716
|
files: number;
|
|
542
717
|
comments: number;
|
|
@@ -635,7 +810,7 @@ type FormattedResult = {
|
|
|
635
810
|
markdown: string;
|
|
636
811
|
metadata: Record<string, unknown>;
|
|
637
812
|
};
|
|
638
|
-
declare function formatAnchorContext(units: RankedWisdomUnit[], input: AnchorContextInput, codeChunks?: RankedCodeChunk[], teamRules?: RankedTeamRule[], warnings?: string[], relevantTests?: RankedTestFile[], regressionEvents?: RankedRegressionEvent[], architecturePatterns?: RankedArchitecturePattern[], extraMetadata?: Record<string, unknown
|
|
813
|
+
declare function formatAnchorContext(units: RankedWisdomUnit[], input: AnchorContextInput, codeChunks?: RankedCodeChunk[], teamRules?: RankedTeamRule[], warnings?: string[], relevantTests?: RankedTestFile[], regressionEvents?: RankedRegressionEvent[], architecturePatterns?: RankedArchitecturePattern[], extraMetadata?: Record<string, unknown>, testCommands?: TestCommand[]): FormattedResult;
|
|
639
814
|
declare function formatSearchHistory(units: RankedWisdomUnit[]): FormattedResult;
|
|
640
815
|
declare function formatIndexStatus(status: IndexStatus): FormattedResult;
|
|
641
816
|
|
|
@@ -643,11 +818,21 @@ declare function buildAnchorContextResult(db: AnchorDatabase, cwd: string, input
|
|
|
643
818
|
|
|
644
819
|
declare function explainFile(db: AnchorDatabase, cwd: string, input: AnchorExplainFileInput): FormattedResult;
|
|
645
820
|
|
|
821
|
+
type ArchitectureMapInput = {
|
|
822
|
+
file?: string;
|
|
823
|
+
area?: ArchitectureArea;
|
|
824
|
+
format?: ArchitectureMapFormat;
|
|
825
|
+
maxNodes?: number;
|
|
826
|
+
};
|
|
827
|
+
declare function buildArchitectureMap(db: AnchorDatabase, input?: ArchitectureMapInput): ArchitectureMap;
|
|
828
|
+
|
|
646
829
|
type ArchitectureContextInput = {
|
|
647
830
|
file?: string;
|
|
648
831
|
area?: ArchitectureArea;
|
|
649
832
|
query?: string;
|
|
650
833
|
maxResults?: number;
|
|
834
|
+
map?: boolean;
|
|
835
|
+
format?: "mermaid" | "json";
|
|
651
836
|
};
|
|
652
837
|
type ArchitectureCheckInput = {
|
|
653
838
|
diff: string;
|
|
@@ -655,12 +840,25 @@ type ArchitectureCheckInput = {
|
|
|
655
840
|
maxResults?: number;
|
|
656
841
|
};
|
|
657
842
|
declare function architectureFilesFromDiff(diff: string): string[];
|
|
843
|
+
declare function getArchitectureMapContext(db: AnchorDatabase, input?: ArchitectureMapInput): FormattedResult;
|
|
658
844
|
declare function getArchitectureContext(db: AnchorDatabase, _cwd: string, input?: ArchitectureContextInput): FormattedResult;
|
|
659
845
|
declare function checkArchitecture(db: AnchorDatabase, _cwd: string, input: ArchitectureCheckInput): FormattedResult;
|
|
660
846
|
|
|
661
847
|
declare function filesFromDiff(diff: string): string[];
|
|
662
848
|
declare function reviewDiff(db: AnchorDatabase, cwd: string, input: AnchorReviewDiffInput): FormattedResult;
|
|
663
849
|
|
|
850
|
+
declare function planTask(db: AnchorDatabase, cwd: string, input: AnchorContextInput): FormattedResult;
|
|
851
|
+
|
|
852
|
+
declare function detectTestCommandsForFile(db: AnchorDatabase, cwd: string, filePath: string): TestCommand[];
|
|
853
|
+
declare function detectTestCommands(db: AnchorDatabase, cwd: string, files?: string[]): TestCommand[];
|
|
854
|
+
declare function refreshTestCommands(db: AnchorDatabase, cwd: string, repo: string, files?: string[]): TestCommand[];
|
|
855
|
+
|
|
856
|
+
type OnboardingInput = {
|
|
857
|
+
file?: string;
|
|
858
|
+
area?: ArchitectureArea;
|
|
859
|
+
};
|
|
860
|
+
declare function buildOnboardingPack(db: AnchorDatabase, cwd: string, input?: OnboardingInput): FormattedResult;
|
|
861
|
+
|
|
664
862
|
type LocalEmbeddingProvider = {
|
|
665
863
|
name: string;
|
|
666
864
|
isAvailable(): boolean;
|
|
@@ -753,7 +951,7 @@ declare function countValidTeamRules(cwd: string): {
|
|
|
753
951
|
lastRuleIndexTime?: string;
|
|
754
952
|
};
|
|
755
953
|
|
|
756
|
-
type CoverageInput = Pick<IndexStatus, "prCount" | "wisdomUnitCount" | "codeFileCount" | "codeChunkCount" | "testLinkCount" | "regressionEventCount" | "architecturePatternCount" | "teamRuleCount" | "historyCoverage" | "staleEvidenceCount" | "staleCodeIndex">;
|
|
954
|
+
type CoverageInput = Pick<IndexStatus, "prCount" | "wisdomUnitCount" | "codeFileCount" | "codeChunkCount" | "testLinkCount" | "testCommandCount" | "regressionEventCount" | "architecturePatternCount" | "architectureMapEdgeCount" | "teamRuleCount" | "retrievalEvalCount" | "playbookCount" | "historyCoverage" | "staleEvidenceCount" | "staleCodeIndex">;
|
|
757
955
|
type CoverageReport = {
|
|
758
956
|
coverageScore: number;
|
|
759
957
|
coverageGrade: CoverageGrade;
|
|
@@ -763,13 +961,60 @@ type CoverageReport = {
|
|
|
763
961
|
declare function calculateCoverage(input: CoverageInput): CoverageReport;
|
|
764
962
|
|
|
765
963
|
type SuggestedPrompt = {
|
|
766
|
-
id: "before_edit" | "explain_file" | "strict_mode" | "review_diff";
|
|
964
|
+
id: "before_edit" | "plan_task" | "test_command" | "explain_file" | "strict_mode" | "review_diff" | "onboarding" | "playbook";
|
|
767
965
|
title: string;
|
|
768
966
|
prompt: string;
|
|
769
967
|
};
|
|
770
968
|
declare function getSuggestedPrompts(): SuggestedPrompt[];
|
|
771
969
|
declare function getSuggestedPromptTexts(): string[];
|
|
772
970
|
|
|
971
|
+
declare const ANCHOR_EVALS_FILE = "anchor.evals.json";
|
|
972
|
+
declare function initRetrievalEvals(cwd: string): {
|
|
973
|
+
path: string;
|
|
974
|
+
created: boolean;
|
|
975
|
+
};
|
|
976
|
+
declare function addRetrievalEval(db: AnchorDatabase, cwd: string, input: {
|
|
977
|
+
task: string;
|
|
978
|
+
files?: string[];
|
|
979
|
+
expectedPrs?: number[];
|
|
980
|
+
expectedCategories?: WisdomCategory[];
|
|
981
|
+
}): RetrievalEvalCase;
|
|
982
|
+
declare function runRetrievalEvals(db: AnchorDatabase, cwd: string): RetrievalEvalRunResult;
|
|
983
|
+
|
|
984
|
+
declare function recordFeedback(db: AnchorDatabase, input: {
|
|
985
|
+
resultId: string;
|
|
986
|
+
rating: FeedbackRating;
|
|
987
|
+
note?: string;
|
|
988
|
+
}): FeedbackEvent;
|
|
989
|
+
declare function feedbackAdjustedScore(db: AnchorDatabase, resultId: string, baseScore: number): number;
|
|
990
|
+
declare function listFeedbackEvents(db: AnchorDatabase, limit?: number): FeedbackEvent[];
|
|
991
|
+
|
|
992
|
+
declare const ANCHOR_PLAYBOOKS_FILE = "anchor.playbooks.json";
|
|
993
|
+
declare function initPlaybooks(cwd: string): {
|
|
994
|
+
path: string;
|
|
995
|
+
created: boolean;
|
|
996
|
+
};
|
|
997
|
+
declare function listPlaybooks(cwd: string): Playbook[];
|
|
998
|
+
declare function getPlaybook(cwd: string, id: string): Playbook | undefined;
|
|
999
|
+
declare function suggestPlaybooks(db: AnchorDatabase, _cwd: string): Playbook[];
|
|
1000
|
+
declare function syncPlaybooksToDatabase(db: AnchorDatabase, cwd: string): number;
|
|
1001
|
+
|
|
1002
|
+
type WatchRefreshInput = {
|
|
1003
|
+
cwd: string;
|
|
1004
|
+
repo?: string;
|
|
1005
|
+
};
|
|
1006
|
+
declare function refreshWatchIndex(db: AnchorDatabase, input: WatchRefreshInput): CodeIndexSummary;
|
|
1007
|
+
declare function watchCodebase(db: AnchorDatabase, input: WatchRefreshInput & {
|
|
1008
|
+
intervalSeconds?: number;
|
|
1009
|
+
onRefresh?: (summary: CodeIndexSummary) => void;
|
|
1010
|
+
}): () => void;
|
|
1011
|
+
|
|
1012
|
+
type AnchorCiInput = {
|
|
1013
|
+
strict?: boolean;
|
|
1014
|
+
minCoverage?: number;
|
|
1015
|
+
};
|
|
1016
|
+
declare function runAnchorCi(db: AnchorDatabase, cwd: string, input?: AnchorCiInput): FormattedResult;
|
|
1017
|
+
|
|
773
1018
|
declare const DEMO_REPO = "anchor/demo";
|
|
774
1019
|
declare const DEMO_PULL_REQUESTS: PullRequestRecord[];
|
|
775
1020
|
declare const DEMO_CODE_FILES: Record<string, string>;
|
|
@@ -789,6 +1034,11 @@ type GitHubRateLimitController = {
|
|
|
789
1034
|
now?: () => number;
|
|
790
1035
|
blockedUntilMs?: number;
|
|
791
1036
|
};
|
|
1037
|
+
type GitHubGraphQLRateLimitState = {
|
|
1038
|
+
cost?: number | null;
|
|
1039
|
+
remaining?: number | null;
|
|
1040
|
+
resetAt?: string | null;
|
|
1041
|
+
};
|
|
792
1042
|
type GitHubRateLimitErrorLike = {
|
|
793
1043
|
status?: number;
|
|
794
1044
|
message?: string;
|
|
@@ -805,6 +1055,8 @@ declare function getGitHubRateLimitDelayMs(error: GitHubRateLimitErrorLike, atte
|
|
|
805
1055
|
delayMs: number;
|
|
806
1056
|
reason: string;
|
|
807
1057
|
};
|
|
1058
|
+
declare function isGitHubGraphQLResourceLimitError(error: unknown): boolean;
|
|
1059
|
+
declare function updateGitHubGraphQLRateLimitState(controller: GitHubRateLimitController, rateLimit: GitHubGraphQLRateLimitState | undefined, requestName: string): void;
|
|
808
1060
|
declare function requestWithGitHubRateLimit<T>(request: () => Promise<T>, options: {
|
|
809
1061
|
controller: GitHubRateLimitController;
|
|
810
1062
|
requestName: string;
|
|
@@ -813,8 +1065,35 @@ declare function requestWithGitHubRateLimit<T>(request: () => Promise<T>, option
|
|
|
813
1065
|
declare function paginateWithGitHubRateLimit<T>(requestPage: (page: number) => Promise<GitHubResponse<T[]>>, options: {
|
|
814
1066
|
controller: GitHubRateLimitController;
|
|
815
1067
|
requestName: string;
|
|
1068
|
+
maxRetries?: number;
|
|
816
1069
|
}): Promise<T[]>;
|
|
817
1070
|
|
|
1071
|
+
type GitHubGraphQLFetch = typeof fetch;
|
|
1072
|
+
type GitHubGraphQLResponse<T> = {
|
|
1073
|
+
data: T;
|
|
1074
|
+
headers: Record<string, string | number | undefined>;
|
|
1075
|
+
};
|
|
1076
|
+
declare class GitHubGraphQLError extends Error {
|
|
1077
|
+
readonly status: number;
|
|
1078
|
+
readonly response: {
|
|
1079
|
+
headers: Record<string, string | number | undefined>;
|
|
1080
|
+
};
|
|
1081
|
+
constructor(message: string, options: {
|
|
1082
|
+
status: number;
|
|
1083
|
+
headers: Record<string, string | number | undefined>;
|
|
1084
|
+
});
|
|
1085
|
+
}
|
|
1086
|
+
declare function createGitHubGraphQLRequester(options: {
|
|
1087
|
+
token: string;
|
|
1088
|
+
fetchImpl?: GitHubGraphQLFetch;
|
|
1089
|
+
}): <T extends {
|
|
1090
|
+
rateLimit?: GitHubGraphQLRateLimitState;
|
|
1091
|
+
}>(query: string, variables: Record<string, unknown>, requestOptions: {
|
|
1092
|
+
controller: GitHubRateLimitController;
|
|
1093
|
+
requestName: string;
|
|
1094
|
+
maxRetries?: number;
|
|
1095
|
+
}) => Promise<GitHubGraphQLResponse<T>>;
|
|
1096
|
+
|
|
818
1097
|
type FetchPullRequestsOptions = {
|
|
819
1098
|
token: string;
|
|
820
1099
|
repo: string;
|
|
@@ -823,17 +1102,39 @@ type FetchPullRequestsOptions = {
|
|
|
823
1102
|
detailConcurrency?: number;
|
|
824
1103
|
since?: string;
|
|
825
1104
|
onProgress?: (progress: FetchPullRequestsProgress) => void;
|
|
1105
|
+
fetchImpl?: GitHubGraphQLFetch;
|
|
1106
|
+
restClient?: Octokit;
|
|
1107
|
+
graphQLCheckpoint?: GitHubGraphQLFetchCheckpoint;
|
|
1108
|
+
onGraphQLCheckpoint?: (checkpoint: GitHubGraphQLFetchCheckpoint | null) => void;
|
|
826
1109
|
};
|
|
827
1110
|
declare function resolvePullRequestFetchLimit(options: Pick<FetchPullRequestsOptions, "all" | "limit">): number | undefined;
|
|
828
1111
|
declare function resolvePullRequestDetailConcurrency(options: Pick<FetchPullRequestsOptions, "detailConcurrency">): number;
|
|
829
1112
|
declare function fetchMergedPullRequests(options: FetchPullRequestsOptions): Promise<PullRequestRecord[]>;
|
|
830
1113
|
|
|
1114
|
+
type FetchMergedPullRequestsGraphQLOptions = {
|
|
1115
|
+
token: string;
|
|
1116
|
+
repo: string;
|
|
1117
|
+
limit?: number;
|
|
1118
|
+
all?: boolean;
|
|
1119
|
+
detailConcurrency: number;
|
|
1120
|
+
since?: string;
|
|
1121
|
+
controller: GitHubRateLimitController;
|
|
1122
|
+
restController?: GitHubRateLimitController;
|
|
1123
|
+
graphQLCheckpoint?: GitHubGraphQLFetchCheckpoint;
|
|
1124
|
+
onGraphQLCheckpoint?: (checkpoint: GitHubGraphQLFetchCheckpoint | null) => void;
|
|
1125
|
+
onProgress?: (progress: FetchPullRequestsProgress) => void;
|
|
1126
|
+
fetchImpl?: GitHubGraphQLFetch;
|
|
1127
|
+
restClient?: Octokit;
|
|
1128
|
+
};
|
|
1129
|
+
declare function fetchMergedPullRequestsWithGraphQL(options: FetchMergedPullRequestsGraphQLOptions): Promise<PullRequestRecord[]>;
|
|
1130
|
+
|
|
831
1131
|
declare function fetchPullRequestDetails(octokit: Octokit, repoFullName: string, pullNumber: number, controller?: GitHubRateLimitController): Promise<PullRequestRecord>;
|
|
832
1132
|
|
|
833
1133
|
type DoctorOptions = {
|
|
834
1134
|
cwd: string;
|
|
835
1135
|
env?: NodeJS.ProcessEnv;
|
|
836
1136
|
githubClientFactory?: (token: string) => Pick<Octokit, "repos">;
|
|
1137
|
+
githubGraphQLCheck?: (token: string) => Promise<boolean> | boolean;
|
|
837
1138
|
mcpServerCheck?: () => Promise<boolean> | boolean;
|
|
838
1139
|
};
|
|
839
1140
|
declare function runDoctor(options: DoctorOptions): Promise<DoctorReport>;
|
|
@@ -843,4 +1144,4 @@ declare function getAnchorIndexHealth(cwd: string): AnchorIndexHealth & {
|
|
|
843
1144
|
indexStatus: IndexStatus;
|
|
844
1145
|
};
|
|
845
1146
|
|
|
846
|
-
export { ANCHOR_CURSOR_RULE, type AnchorContextInput, type AnchorDatabase, type AnchorExplainFileInput, type AnchorIndexHealth, type AnchorReviewDiffInput, type ArchitectureArea, type ArchitectureCheckInput, type ArchitectureComponent, type ArchitectureContextInput, type ArchitectureIndexData, 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 FetchPullRequestsOptions, type FetchPullRequestsProgress, type FormattedResult, type FreshnessResult, type FreshnessStatus, 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 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 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, architectureFilesFromDiff, buildAnchorContextResult, buildArchitectureIndex, buildFtsQuery, buildQueryTerms, calculateCoverage, canonicalizeText, categorizeWisdom, checkArchitecture, checkSchema, checkTeamRuleEvidence, chunkCodeFile, chunkHistoricalText, claimKeyFor, clampMaxResults, classifyArchitectureArea, clipSentence, confidenceAtLeast, confidenceLevelFor, confidenceRank, confidenceReasonsFor, countValidTeamRules, createGitHubClient, defaultDatabasePath, detectGitHubRepo, detectGitRoot, discoverCodeFiles, emptyCodeIndexSummary, ensureAnchorGitExclude, ensureCursorConfig, ensureCursorRule, ensureRepository, ensureTeamRulesFile, evaluateFreshness, evaluateIndexHealth, evaluateReliabilityGate, evidenceForWisdom, explainFile, extractCodeImports, extractCodeSymbols, extractRegressionEvents, extractSymbols, extractWisdomUnits, fetchMergedPullRequests, fetchPullRequestDetails, filesFromDiff, formatAnchorContext, formatIndexStatus, formatSearchHistory, getAnchorIndexHealth, getArchitectureContext, getGitHubRateLimitDelayMs, getIndexStatus, getLastSyncTime, getSemanticStatus, getSuggestedPromptTexts, getSuggestedPrompts, getWisdomCategoryCounts, githubAuthFixMessage, hasHighSignalLanguage, indexCodebase, indexPullRequests, inferTestAwareness, initializeSchema, isGitHubRateLimitError, isHardExcludedCodePath, isTestFilePath, loadCurrentCodeSnapshot, loadTeamRulesFile, mergeAnchorMcpConfig, normalizePullRequest, openAnchorDatabase, paginateWithGitHubRateLimit, parseGitHubRemote, rankArchitecturePatterns, rankCodeChunks, rankRegressionEvents, rankRelevantTests, rankTeamRules, rankWisdomUnits, recordIndexRun, redactSecrets, redactedHistoricalText, replaceCodeIndex, requestWithGitHubRateLimit, resolveGitHubToken, resolvePullRequestDetailConcurrency, resolvePullRequestFetchLimit, reviewDiff, runDoctor, sanitizeHistoricalText, shouldSyncSince, sourceTypeLabel, stripPromptInjection, suggestTeamRules, tokenizeSearchText, truncateText, uniqueStrings, updateSyncState, upsertPullRequest, validateTeamRulesFile };
|
|
1147
|
+
export { ANCHOR_CURSOR_RULE, ANCHOR_EVALS_FILE, ANCHOR_PLAYBOOKS_FILE, type AnchorCiInput, type AnchorContextInput, type AnchorDatabase, type AnchorExplainFileInput, type AnchorIndexHealth, 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 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 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, addRetrievalEval, addTeamRule, anchorMcpEntry, architectureFilesFromDiff, buildAnchorContextResult, buildArchitectureIndex, buildArchitectureMap, buildFtsQuery, buildOnboardingPack, buildQueryTerms, calculateCoverage, canonicalizeText, categorizeWisdom, checkArchitecture, checkSchema, checkTeamRuleEvidence, chunkCodeFile, chunkHistoricalText, claimKeyFor, clampMaxResults, classifyArchitectureArea, clearGraphQLFetchCheckpoint, clipSentence, confidenceAtLeast, confidenceLevelFor, confidenceRank, confidenceReasonsFor, countValidTeamRules, createGitHubClient, createGitHubGraphQLRequester, defaultDatabasePath, 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, formatAnchorContext, formatIndexStatus, formatSearchHistory, getAnchorIndexHealth, getArchitectureContext, getArchitectureMapContext, getGitHubRateLimitDelayMs, getGraphQLFetchCheckpoint, getIndexStatus, getLastSyncTime, getPlaybook, getSemanticStatus, getSuggestedPromptTexts, getSuggestedPrompts, getWisdomCategoryCounts, githubAuthFixMessage, graphQLFetchCheckpointScope, hasHighSignalLanguage, indexCodebase, indexPullRequests, inferTestAwareness, initPlaybooks, initRetrievalEvals, initializeSchema, isGitHubGraphQLResourceLimitError, isGitHubRateLimitError, isHardExcludedCodePath, isTestFilePath, listFeedbackEvents, listPlaybooks, loadCurrentCodeSnapshot, loadTeamRulesFile, mergeAnchorMcpConfig, normalizePullRequest, openAnchorDatabase, paginateWithGitHubRateLimit, parseGitHubRemote, planTask, rankArchitecturePatterns, rankCodeChunks, rankRegressionEvents, rankRelevantTests, rankTeamRules, rankWisdomUnits, recordFeedback, recordIndexRun, redactSecrets, redactedHistoricalText, refreshTestCommands, refreshWatchIndex, replaceCodeIndex, requestWithGitHubRateLimit, resolveGitHubToken, resolvePullRequestDetailConcurrency, resolvePullRequestFetchLimit, reviewDiff, runAnchorCi, runDoctor, runRetrievalEvals, sanitizeHistoricalText, saveGraphQLFetchCheckpoint, shouldSyncSince, sourceTypeLabel, stripPromptInjection, suggestPlaybooks, suggestTeamRules, syncPlaybooksToDatabase, tokenizeSearchText, truncateText, uniqueStrings, updateGitHubGraphQLRateLimitState, updateSyncState, upsertPullRequest, validateTeamRulesFile, watchCodebase };
|