@lumy-pack/line-lore 0.0.6 → 0.0.8

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.
@@ -5,7 +5,38 @@ export interface AncestryResult {
5
5
  subject: string;
6
6
  }
7
7
  export declare const DEFAULT_ANCESTRY_TIMEOUT = 30000;
8
+ /**
9
+ * @deprecated Use {@link findMergeCommits} (plural) instead.
10
+ * Returns only the first verified merge commit. The plural version returns
11
+ * multiple candidates from both first-parent and full ancestry paths.
12
+ */
8
13
  export declare function findMergeCommit(commitSha: string, options?: GitExecOptions & {
9
14
  ref?: string;
10
15
  }): Promise<AncestryResult | null>;
11
- export declare function extractPRFromMergeMessage(subject: string): number | null;
16
+ /**
17
+ * Verify that a merge commit actually introduced the target commit
18
+ * through its branch side (non-first parent), not from the mainline.
19
+ *
20
+ * Dual condition:
21
+ * 1. Target IS an ancestor of at least one non-first parent (branch side)
22
+ * 2. Target is NOT an ancestor of the first parent (mainline side)
23
+ *
24
+ * Returns false on git command failure (fail-skip policy).
25
+ */
26
+ export declare function verifyMergeIntroducesCommit(targetSha: string, mergeResult: AncestryResult, options?: GitExecOptions): Promise<boolean>;
27
+ /**
28
+ * Multi-candidate merge commit search.
29
+ * Returns up to MAX_CANDIDATES verified merge commits from both first-parent
30
+ * and full ancestry paths, deduplicated by mergeCommitSha and ordered with
31
+ * first-parent results first.
32
+ *
33
+ * Unlike `findMergeCommit` (singular) which returns only the first verified candidate,
34
+ * this function enables callers to iterate through multiple candidates when the
35
+ * first one doesn't yield a PR (e.g., bulk merge with non-standard message).
36
+ */
37
+ export declare function findMergeCommits(commitSha: string, options?: GitExecOptions & {
38
+ ref?: string;
39
+ }): Promise<AncestryResult[]>;
40
+ /** Retrieve the subject line of a single commit. Returns null on git failure. */
41
+ export declare function getCommitSubject(sha: string, options?: GitExecOptions): Promise<string | null>;
42
+ export declare function extractPRFromMergeMessage(subject: string, platform?: string): number | null;
@@ -1,2 +1,2 @@
1
- export { extractPRFromMergeMessage, findMergeCommit } from './ancestry.js';
1
+ export { extractPRFromMergeMessage, findMergeCommit, findMergeCommits, getCommitSubject, verifyMergeIntroducesCommit, } from './ancestry.js';
2
2
  export type { AncestryResult } from './ancestry.js';
@@ -1,3 +1,3 @@
1
- import type { BlameResult, BlameStageResult, GitExecOptions, LineRange } from '../../types/index.js';
2
- export declare function executeBlame(file: string, lineRange: LineRange, options?: GitExecOptions): Promise<BlameResult[]>;
1
+ import type { BlameExecOptions, BlameResult, BlameStageResult, GitExecOptions, LineRange } from '../../types/index.js';
2
+ export declare function executeBlame(file: string, lineRange: LineRange, options?: BlameExecOptions): Promise<BlameResult[]>;
3
3
  export declare function analyzeBlameResults(results: BlameResult[], filePath: string, options?: GitExecOptions): Promise<BlameStageResult[]>;
@@ -1,6 +1,6 @@
1
1
  export { analyzeBlameResults, executeBlame, isCosmeticDiff, parsePorcelainOutput, } from './blame/index.js';
2
2
  export { compareSymbolMaps, computeContentHash, computeExactHash, computeStructuralHash, extractSymbols, findContainingSymbol, findMatchAcrossFiles, traceByAst, } from './ast-diff/index.js';
3
- export { extractPRFromMergeMessage, findMergeCommit, } from './ancestry/index.js';
3
+ export { extractPRFromMergeMessage, findMergeCommit, findMergeCommits, } from './ancestry/index.js';
4
4
  export type { AncestryResult } from './ancestry/index.js';
5
5
  export { computePatchId, findPatchIdMatch, resetPatchIdCache, } from './patch-id/index.js';
6
6
  export type { PatchIdResult } from './patch-id/index.js';
@@ -1 +1,2 @@
1
1
  export { lookupPR, resetPRCache } from './pr-lookup.js';
2
+ export type { PRLookupResult, ResolvedVia } from './pr-lookup.js';
@@ -1,15 +1,31 @@
1
1
  import type { RepoIdentity } from '../../cache/index.js';
2
2
  import type { GitExecOptions, PRInfo, PlatformAdapter } from '../../types/index.js';
3
+ export type ResolvedVia = 'api' | 'ancestry' | 'message' | 'patch-id';
4
+ export interface PRLookupResult extends PRInfo {
5
+ resolvedVia: ResolvedVia;
6
+ }
3
7
  export interface PRLookupOptions extends GitExecOptions {
4
8
  noCache?: boolean;
5
9
  /** Return cached results only — skip all fallback strategies */
6
10
  cacheOnly?: boolean;
7
11
  deep?: boolean;
8
12
  repoId?: RepoIdentity;
9
- /** Skip Strategy 4 (patch-id scan) — set automatically for partial clone environments */
13
+ /** Skip Strategy 5 (patch-id scan) — set automatically for partial clone environments */
10
14
  skipPatchIdScan?: boolean;
15
+ /** Preferred base branch for PR selection — when multiple PRs match, prefer the one targeting this branch */
16
+ preferredBase?: string;
17
+ /** Platform type for platform-aware merge message parsing */
18
+ platform?: string;
11
19
  }
20
+ /**
21
+ * Multi-strategy PR lookup pipeline:
22
+ * Strategy 1: Cache
23
+ * Strategy 2: API direct (ground truth — Level 2)
24
+ * Strategy 3: Ancestry-path + merge commit verification (structural proof)
25
+ * Strategy 4: Blame commit message parsing (heuristic — squash merge detection)
26
+ * Strategy 5: Patch-ID matching + recursion (last resort)
27
+ */
12
28
  export declare function lookupPR(commitSha: string, adapter: PlatformAdapter | null, options?: PRLookupOptions,
13
29
  /** @internal recursion depth tracker — do not set from external callers */
14
- _recursionDepth?: number): Promise<PRInfo | null>;
30
+ _recursionDepth?: number): Promise<PRLookupResult | null>;
15
31
  export declare function resetPRCache(): void;