Commit graph

9 commits

Author SHA1 Message Date
Kodai Nakamura
f9d5291e3d fix(candidate-scanner): honor ignored table rows
Why:

AI ambiguity scanning still inspected Markdown table rows when ignoreMarkdownTables was enabled, while replacement skipped those rows through centralized Markdown segmentation. That kept scanner and renderer semantics from fully matching.

What:

Route candidate occurrence scanning through segmentMarkdown protection, move table-row detection into the Markdown segment module, and add regressions for unlinked candidates, existing wikilinks, and AI requests inside ignored table rows.
2026-06-22 04:16:02 +09:00
Kodai Nakamura
9a98513ea8 fix(replace-links): share candidate scan semantics
Why:

The final architecture review found that AI ambiguity scanning and link replacement could diverge on scoped base-directory matching and raw Linear URL protection. The replacement renderer also still carried its own candidate traversal loop, which made that drift possible.

What:

Pass baseDir into ambiguity scanning, share raw URL protection across markdown segmentation and candidate scanning, and route replacement rendering through the scanner's single candidate-at-index matcher. Add regression coverage for baseDir scoped AI requests and Linear URL protection parity.
2026-06-22 04:07:36 +09:00
Kodai Nakamura
21fd68c7b9 fix(resolve-ambiguities): pass active file path into AI scan
Why:
AI ambiguity requests were scanned without the current file path, so preventSelfLinking could not filter self-link candidates on the AI path.

What:
- Thread an optional filePath through resolveAmbiguities() and pass it into the shared candidate scanner.
- Pass the active markdown path without .md from the AI command in main.ts.
- Add a regression proving self-link candidates are skipped before AI requests are built when the current file matches.
2026-06-22 01:59:23 +09:00
Kodai Nakamura
490e0c3277 fix(replace-links): align Korean ambiguity handling
Why:
- Task 1 still had drift between candidate scanning and Korean replacement special cases.
- The scanner could ask AI about Korean particle forms that replacement intentionally skips.
- The Korean suffix replacement path ignored resolved ambiguities and could apply a different target than the AI chose.

What:
- skip Korean particle trie hits in the Task 1 candidate scanner and ambiguity request path
- reuse a shared resolved-ambiguity link-content helper for the standard and Korean suffix replacement branches
- add Task 1 regressions and append the Task 1 fix report with focused and full verification results
2026-06-22 01:49:08 +09:00
Kodai Nakamura
b264541faa fix(candidate-scanner): skip existing wikilinks in inline code
Why:
- Existing wikilinks inside inline code were still being collected as candidate occurrences, which could drive resolveAmbiguities() to prepare AI work for text that replaceLinks() intentionally leaves untouched.

What:
- Added inline-code protected ranges to existing wikilink collection so matches inside backticks are ignored alongside the current block-level exclusions.
- Added regression coverage for scanCandidateOccurrences() and the resolveAmbiguities() request path.
- Appended the focused and full verification results to the task 1 report.
2026-06-22 01:41:26 +09:00
Kodai Nakamura
c3151b3f41 fix(replace-links): align candidate scanner semantics
Why:
- Task 1 scanner drifted from replaceLinks in two places that affect AI ambiguity review.
- Trie-hit namespace handling was filtering candidate sets differently from replacement-time behavior.
- Protected-region scanning was still walking fenced code, callouts, and ignored headings that replaceLinks already shields.

What:
- make trie-hit scanning use the original candidate set and first-candidate scoped checks, matching current replaceLinks behavior
- skip fenced code blocks, callouts, and ignored headings before protected-regex scanning while preserving original occurrence offsets
- add regressions for trie-hit namespace semantics and protected-region skipping, plus AI-side coverage and append the fix report
2026-06-22 01:33:56 +09:00
Kodai Nakamura
953688d96e refactor(replace-links): centralize candidate scanning
Why:
- Candidate detection was duplicated between link replacement and AI ambiguity resolution, which made matching behavior hard to reason about.
- A single scanner improves locality for namespace, protected-span, case, and CJK matching rules.

What:
- Add a shared candidate scanner module for unlinked text and existing wikilinks.
- Route AI ambiguity request construction through the scanner.
- Keep link rendering behavior unchanged and covered by existing replacement tests.
2026-06-22 01:22:38 +09:00
Kodai Nakamura
76e0da3ac9 fix: resolve lint and formatting errors in AI Link Enhancer implementation 2026-04-06 23:19:38 +09:00
Kodai Nakamura
706bbf91ef feat: add AI Link Enhancer for resolving ambiguous links
- Implemented AI-powered link disambiguation using local LLMs (Gemma 4 / LM Studio).
- Refactored Trie and candidate mapping to support multiple link candidates per word.
- Added 'AI Link Enhancer' command with a progress bar UI in Obsidian.
- Enhanced link replacement logic to verify existing links and resolve ambiguities using context.
- Added comprehensive unit tests for AI disambiguation and candidate mapping.
- Updated settings to include AI configuration (endpoint, model, context length).
2026-04-06 22:59:52 +09:00