Commit graph

42 commits

Author SHA1 Message Date
Claude
69af9938c6
build: update compiled main.js artifact
https://claude.ai/code/session_016QvEfqw6YZ3RjwBHrJ4w8S
2026-04-26 06:21:53 +00:00
Claude
02fc5678ae
feat: add folder-level batch summarization command
Register parallel-reader-batch-generate command. It prompts the user for a
folder path via a Modal, finds all .md files in that folder (non-recursive),
skips files whose cache is still valid, and runs runForFile() sequentially
on the rest, showing per-file progress notices. Add i18n keys for the new
UI strings in both zh and en.

https://claude.ai/code/session_016QvEfqw6YZ3RjwBHrJ4w8S
2026-04-26 06:18:58 +00:00
Claude
10d811f197
refactor: upgrade Biome lint rules
Promote noExplicitAny from warn to error and enable noNonNullAssertion
at warn level. Fix the two resulting errors in src/schema.ts by introducing
a JsonSchema interface to replace the any-typed local variables.

https://claude.ai/code/session_016QvEfqw6YZ3RjwBHrJ4w8S
2026-04-26 06:16:36 +00:00
Claude
a74e7c3e07
test: add tests for i18n, streaming, and cli modules
Extend tests/modules.test.js with:
- parseSseBuffer: partial buffer, multi-event chunk, skipped non-data lines,
  malformed JSON line handling
- i18n: multi-variable interpolation, zh translation, missing-key fallback
- cli: resolveCliPath with override path trimming and mocked fs.existsSync
  to verify filesystem search and bare-name fallback

https://claude.ai/code/session_016QvEfqw6YZ3RjwBHrJ4w8S
2026-04-26 06:15:30 +00:00
Claude
e7384fd875
feat: add streaming timeout protection
Add streamingTimeoutMs field to PluginSettings (default 120000ms). In
streamingFetch(), use Promise.race between the stream reader and a timeout
promise that aborts the AbortController and throws a clear timeout error.
External cancellation signals are forwarded to the same controller so only
one abort path is needed.

https://claude.ai/code/session_016QvEfqw6YZ3RjwBHrJ4w8S
2026-04-26 06:13:52 +00:00
Claude
dbb8ea4a5b
refactor: make cache entry updates immutable
touchCacheEntry() now returns a new object via spread instead of mutating
the entry in-place. CacheManager.replaceCards() likewise creates a new entry
object instead of mutating existing fields. Update tests to assert the new
immutable semantics (returned value differs from input by reference).

https://claude.ai/code/session_016QvEfqw6YZ3RjwBHrJ4w8S
2026-04-26 06:12:55 +00:00
Claude
64ebbaef36
refactor: replace any types in providers.ts with proper interfaces
Define RequestUrlFunction, AnthropicMessagesBody, OpenAiChatBody,
OpenAiResponsesBody, GeminiBody/GeminiGenerationConfig typed interfaces.
Replace all ~14 any usages with unknown + type narrowing or concrete types.
Drop the eslint-disable comments that were papering over the any usages.

https://claude.ai/code/session_016QvEfqw6YZ3RjwBHrJ4w8S
2026-04-26 06:10:28 +00:00
Claude
57d25501d6
refactor: add typed wrappers for Obsidian API boundaries
Add CmEditorView, ObsidianEditorWithCm, ObsidianMenuItem, and ObsidianMenu
interfaces to src/types.ts. Replace (editor as any).cm and (it: any) casts
in main.ts with these typed wrappers, eliminating all any casts in the
scroll-sync and file-menu code paths.

https://claude.ai/code/session_016QvEfqw6YZ3RjwBHrJ4w8S
2026-04-26 06:08:46 +00:00
Claude
87904811e2
refactor: extract CacheManager from main.ts
Move all cache persistence methods and state (_cacheSaveTimer, _cacheDirty)
into a new CacheManager class in src/cache-manager.ts. Plugin delegates to
it via thin wrappers that preserve the existing method names tested by the
test suite. main.ts reduced from 826 to 713 lines.

https://claude.ai/code/session_016QvEfqw6YZ3RjwBHrJ4w8S
2026-04-26 06:07:03 +00:00
wujunchen
f86f45fe73 docs: simplify CLI backend description to match auto-detection
Change-Id: I8bc223bb1c0508b1669159b0528859a99586fa08
2026-04-26 12:14:19 +08:00
wujunchen
68163219a6 docs: simplify installation guide for non-technical users
Change-Id: I452fb6eef4c07c083153c7a8742d02110b407279
2026-04-26 12:13:45 +08:00
wujunchen
4cace369bf chore: bump version to 1.0.1
Change-Id: I1341830221a8859b0783d2d69aaee85e2c6be3bb
2026-04-26 11:29:32 +08:00
wujunchen
38ba0acdb2 fix: parse Claude Code JSON array output and drop --model flag
Claude Code `--output-format json` returns a JSON array of event
objects, not a single object. Parse the array and extract the
result event. Also stop passing --model to let Claude Code use
its own default model. Revert timeout to 120s.

Change-Id: I5b5d4aa589ff78c0a2806a3e700bac0676a9b354
2026-04-26 11:09:47 +08:00
wujunchen
625ac4e5fe fix: raise CLI timeout from 120s to 300s
Change-Id: I1c6a66ed23c6908d6045042e57e50efce1910f9e
2026-04-26 11:08:13 +08:00
wujunchen
2bc7288a44 docs: modern English README with badges and star history
Switch to English as default README with badge bar (release, CI,
license, stars) and star-history chart. Add separate README.zh-CN.md
for Chinese version. Remove project structure section.

Change-Id: I3bc378bb024e1e75db95e08fd932b29e4d4b1c63
2026-04-26 11:00:29 +08:00
wujunchen
89265a93bb fix: remove authorUrl pointing to repo (rejected by marketplace)
Change-Id: I2ae72b8364de9e62b957c528d18c737556723358
2026-04-26 10:54:17 +08:00
wujunchen
b123a9364f chore: prepare 1.0.0 for Obsidian community plugin submission
- Add description and authorUrl to manifest.json
- Bump version to 1.0.0
- Add versions.json mapping plugin version to min Obsidian version

Change-Id: Ic88d1219befe8433bf4eae7148a3d7383fd2af5d
2026-04-26 10:41:18 +08:00
wujunchen
d60999d8df feat: raise default max input from 20K to 100K characters
Change-Id: Ie5b895eb1a4dba02bb84fd83adf1ef0216af067b
2026-04-26 10:23:42 +08:00
wujunchen
c4b1543046 fix: cross-platform CLI path detection for Windows
Add Windows-specific candidate paths (AppData\Roaming\npm,
scoop\shims, etc.) and probe .cmd/.exe extensions. Unix paths
unchanged.

Change-Id: I8a431cfadc7143fa7d5db18817e2152e896e7243
2026-04-26 10:22:28 +08:00
wujunchen
c8a13b5553 feat: restore Codex CLI backend
Add back Codex CLI alongside Claude Code CLI and API backends.
All three backends are now available in the settings dropdown.

Change-Id: If93e0e93b724bf0dc18308d54f8d39b47c55deb4
2026-04-26 10:11:59 +08:00
wujunchen
84095fa0eb feat: restore Claude Code CLI backend
Add back Claude Code CLI as a backend option alongside API. Claude
Code's `-p --output-format json` is a documented interface that works
well with prompt mode. API remains the default.

Change-Id: I048936a7d59e6768952e0cb007382f75413d1ba0
2026-04-26 10:08:54 +08:00
wujunchen
9e369ae1fa refactor: remove CLI backends, add Chinese README
Remove Claude Code CLI and Codex CLI backends — they depend on
unstable CLI flags and macOS Keychain ACLs. API backend is now the
only path, default provider is Anthropic.

Replace English README with Chinese version focused on API usage.
Add .agent/ to .gitignore.

Change-Id: I7b2488d9bca23e753cc3d461f5f7bc39052dcbef
2026-04-26 09:57:30 +08:00
wujunchen
b7d1a25543 security: strip path traversal segments from vault paths
Reject '..' and '.' segments in normalizeVaultPath to prevent
exportFolder from escaping the vault root directory.

Change-Id: Ib4da19f9d0aa1236a3b77b6f2cc722fcff408131
2026-04-26 09:48:19 +08:00
wujunchen
d37e6c5e72 ci: add GitHub Actions workflow for build, typecheck, test, and lint
Runs on push to main and on pull requests. Uses Node 22 with npm cache.
Executes build, typecheck, all test suites, and biome lint.

Change-Id: I77738f7afc50eae4393769b005d4f17844a6d551
2026-04-26 09:31:38 +08:00
wujunchen
447ad1414b feat: add streaming API responses for OpenAI Chat and Anthropic
Implement SSE streaming for API backends that support it (OpenAI Chat
Completions and Anthropic Messages). During generation the view shows
a live streaming preview with accumulated text. Adds a streaming toggle
in settings (enabled by default). Non-streaming-capable formats (Gemini,
OpenAI Responses) and CLI backends continue using the existing path.

Change-Id: I3361a5ca5aec3e25a7d16e4fb585185f6fc0695e
2026-04-26 09:30:51 +08:00
wujunchen
3b02cfa480 test: add comprehensive unit tests for pure modules
Cover anchor, schema, cache, cards, navigation, markdown, vault, i18n,
scroll, settings, prompt, providers, and generation-job-manager modules
with focused assertions testing edge cases and expected behavior.

Change-Id: I49e1f104e04a3dbafe66c19adf24ac5d0e3a7c54
2026-04-26 09:25:23 +08:00
wujunchen
58ab0fa77f refactor: enable full TypeScript strict mode
Switch from incremental strict flags to strict: true. Fix property
initializers with definite assignment assertions and inline defaults,
and annotate all catch clauses with unknown type.

Change-Id: I805047eebea7dc5414ff7001aca96eac5a099d02
2026-04-26 09:21:54 +08:00
wujunchen
a49e5cd2ec chore: upgrade biome noExplicitAny from off to warn
Enable noExplicitAny as a warning so remaining any usages are visible
in lint output. 20 warnings exist in API response handlers and Obsidian
internal type access — these are intentional and documented.

Change-Id: I96c190e594bc3391256f77a59e155f23436d3db3
2026-04-26 08:59:40 +08:00
wujunchen
31e57c8b19 refactor: enable noImplicitAny and add type annotations
Turn on noImplicitAny in tsconfig.json. Add explicit type annotations
to all 137 previously untyped parameters across main.ts, view.ts,
modal.ts, settings-tab.ts, providers.ts, cli.ts, anchor.ts, scroll.ts,
ui-helpers.ts, vault.ts, and settings.ts.

Change-Id: Icc5a69ab57113e9f6dc08dd97e3a8fa5e7e24937
2026-04-26 08:58:41 +08:00
wujunchen
89139c37dc refactor: replace PluginHost any types with Obsidian App/TFile
Use App, TFile, PluginManifest from obsidian in PluginHost interface.
Remove `as any` cast in ParallelReaderSettingTab by accepting
Plugin & PluginHost intersection type. Add typed params to vault.ts
and modal.ts constructors.

Change-Id: I94487d2654fd829c69364dabe9fbd5dc009097b6
2026-04-26 08:48:23 +08:00
wujunchen
22f0781334 chore: add .editorconfig for consistent formatting
Change-Id: I087941201d8ce1b801b4663c4897f005f275ed5a
2026-04-25 23:48:27 +08:00
wujunchen
83f35f8ccb feat: add Biome for lint and format
Install @biomejs/biome with lint and format config.
Add npm lint/lint:fix scripts. Auto-fix formatting across all source
files. Update tsconfig lib to ES2022 for Object.hasOwn support.

Change-Id: I13e3ba2f106f7e3d03349080b7ed515d427d24a1
2026-04-25 23:47:49 +08:00
wujunchen
3a776691e6 refactor: enable strictNullChecks and strictFunctionTypes
Turn on strictNullChecks, strictFunctionTypes, strictBindCallApply,
and noImplicitThis in tsconfig.json. Fix 13 resulting type errors
across main.ts, anchor.ts, providers.ts, schema.ts, prompt.ts.

Change-Id: Ib747b9c0cb809d99a7b3d3d7b177ee5918a74dfd
2026-04-25 23:44:28 +08:00
wujunchen
532cd31ef4 refactor: extract View, Modal, and SettingsTab from main.ts
Move ParallelReaderView to src/view.ts (341 lines),
CardEditModal to src/modal.ts (56 lines),
ParallelReaderSettingTab to src/settings-tab.ts (370 lines).
Add PluginHost interface in types.ts to break circular deps.
main.ts reduced from 1613 to 588 lines.

Change-Id: I90902e914f162ff92b9a7f7c190b4d397a2c8c12
2026-04-25 23:40:56 +08:00
wujunchen
f3afc4fbe0 refactor: add TypeScript interfaces for core types
Create src/types.ts with RawCard, ResolvedCard, CardPatch, CacheEntry,
PluginSettings, ApiProviderPreset, ApiFormat, GenerationPhase, ErrorKind,
and PromptPair. Update all source modules to use typed signatures,
replacing `any` with concrete interfaces.

Change-Id: I87b7dd6f3a240c95597d7a796b4d1885386aa632
2026-04-25 23:34:45 +08:00
wujunchen
d8880d41b2 refactor: split UI helpers module
Change-Id: I1abcd20b75608261b2d004550c011eeba76d35bf
2026-04-25 21:32:32 +08:00
wujunchen
5f6f18677b refactor: split CLI backend module
Change-Id: I7450dface429972b71b173973e6f71393d83303e
2026-04-25 19:58:29 +08:00
wujunchen
206a50f8d0 fix: guard regeneration and scroll sync
Change-Id: I08e2c55d5e88a51bad9a007e57962ebe48dc7c64
2026-04-25 19:52:27 +08:00
wujunchen
5c2c97fdbe feat: improve reader cache and card UX
Change-Id: Ie1b5c5ba1a6538b701af2591effd1845dca2f670
2026-04-25 19:44:39 +08:00
wujunchen
08f510c65c refactor: split prompt and add localized UI
Move prompt and anchor matching into dedicated modules, add Chinese/English UI translation support, and cover cache fingerprint and translation behavior with tests.

Change-Id: Ieadc2197cba31cf750b83e2893909127da8ecca5
2026-04-25 15:15:26 +08:00
wujunchen
1fada9f472 feat: add TypeScript build and provider architecture
Introduce an esbuild/TypeScript source layout while keeping the generated Obsidian main.js entrypoint. Add provider-format adapters, structured-output requests, settings-aware bounded cache, prompt controls, concurrency guards, and regression tests.

Change-Id: I8ecbc4c6eff3925249778732bd75747619b818e4
2026-04-25 14:12:17 +08:00
wujunchen
ff856f719b init: Obsidian Parallel Reader v0.1.0
Split-view reading plugin for long-form notes:
- LLM self-adaptive segmentation (no heading dependency)
- Anchor-based line resolution with fallbacks
- Scroll-sync highlight + click-to-jump
- Right-click context menu for copy actions
- MarkdownRenderer for native table/bold/code rendering
- SHA-1 content-hash cache with stale-detection banner
- Three backends: Claude Code CLI / Codex CLI / Anthropic API

Change-Id: I105c57e3df0b2d8d1570c31e3e3a689ecf52ff71
2026-04-24 19:31:23 +08:00