Commit graph

65 commits

Author SHA1 Message Date
wujunchen
6e83d216c2 feat: add generate button to empty state panel
When a note has no cached parallel notes, the empty state now shows a
clickable "Generate" button so users can trigger generation directly
without going through the command palette. Closes #2.

Change-Id: I879897168ef77c44e0ab570e9c094fa9af9f66d4
2026-04-27 10:24:05 +08:00
wujunchen
6aba90bfd3 fix: remove unnecessary async from catch handler
The catch callback no longer contains any await expressions
after the previous refactor removed await on sync view methods.

Change-Id: I054c50fe209aba0e925bd1838896228bce686841
2026-04-26 21:12:16 +08:00
wujunchen
da535cb064 fix: address remaining Obsidian review bot required issues
- Remove unnecessary TFile cast (instanceof already narrows)
- Remove await on non-Promise view methods (loadFor, renderLoading, renderError)
- Remove async from CacheManager.touch() (no await expression)
- Replace this-aliasing with captured locals in batch modal
- Use CSS class instead of inline style for modal input width
- Fix sentence case in settings UI text

Change-Id: I2a222c6429eb7e4d69761cca8369956fef510054
2026-04-26 19:34:45 +08:00
wujunchen
de08ec778a chore: add eslint tooling dependencies
Change-Id: I3f855a85e1ed9ef45a0f77210d5a68081a967d59
2026-04-26 19:25:51 +08:00
wujunchen
3d8d72b66e refactor: split settings tab renderers
Change-Id: I456ddd16868150b2e22f5592c97d579a3540e48d
2026-04-26 19:17:12 +08:00
wujunchen
486060bddf test: cover cache manager with fake adapter
Change-Id: I83f6b71a46af31f783522faa53bffbfc6c4bc54d
2026-04-26 18:31:17 +08:00
wujunchen
557908ca44 fix: clean up streaming abort listener
Change-Id: I9fa8ace7bc0fa723466ef851f7ec2960c6638eba
2026-04-26 18:29:48 +08:00
wujunchen
bc51acd00e fix: parse multiline sse events
Change-Id: I9c013dbe6840a0892836eb5d71206c6fcde5ec78
2026-04-26 18:27:28 +08:00
wujunchen
846e32301a test: import pure modules directly
Change-Id: Ia029de2ac4c3cb3ddb7ea638c868d6347af5c67e
2026-04-26 18:25:50 +08:00
wujunchen
2364e62911 chore: check build artifact consistency
Change-Id: I485ee9ef2eaf584a1c1fcf890ee85fb82a34a8fb
2026-04-26 18:22:11 +08:00
wujunchen
70f9a39cd7 refactor: extract provider response parsers
Change-Id: I6884999f34594faec349378deb59e68972e07355
2026-04-26 18:20:49 +08:00
wujunchen
6dd7ef15a4 test: cover cli edge cases
Change-Id: Ia6114ab7ba24e32f7f86ff76710a596b0c24682c
2026-04-26 18:16:38 +08:00
wujunchen
174fa7295d feat: expose streaming timeout setting
Change-Id: Ide69c0f0fe208a557024f9f77d83c9d1215391cf
2026-04-26 18:14:43 +08:00
wujunchen
9098de6884 feat: validate batch folder input
Change-Id: I137fa046e77781e063ee782af4321b7277d64d51
2026-04-26 18:12:38 +08:00
wujunchen
d8dc82362b feat: support cancellable batch generation
Change-Id: I89302f58995e4e15fbf77c20c87a94832e572d20
2026-04-26 18:10:17 +08:00
wujunchen
ebc882c2f1 refactor: encapsulate cache rename
Change-Id: I89ee56c071c8e5404f8eb9ea744172957811d714
2026-04-26 18:05:38 +08:00
wujunchen
fe05ed1a2d test: cover generation orchestration
Change-Id: Iff416f01c0f09111e67e1ad67957b85fdb19623a
2026-04-26 17:59:35 +08:00
wujunchen
2d4bef9539 refactor: extract batch generation helpers
Change-Id: I16ad657b783b65cc5b3e36a6ea163cc19740b651
2026-04-26 17:54:35 +08:00
wujunchen
b199f56a35 refactor: extract generation orchestration
Change-Id: I17002ff04b0d79d8ec27da3dbb4b08df9bf3659e
2026-04-26 17:45:43 +08:00
wujunchen
9ed36570b5 refactor: restore strict lint hygiene
Change-Id: I26917328ec55e529242dfd8e4c42af0b3fcd58b7
2026-04-26 17:41:28 +08:00
wujunchen
89e1ab9d5c chore: bump version to 1.0.2
Change-Id: I40e3893b061e73620e9e7d8f818684d3620c1d9f
2026-04-26 16:01:39 +08:00
wujunchen
89d28d1113 fix: address all required issues from Obsidian plugin review bot
- Remove `parallel-reader-` prefix from command IDs (Obsidian auto-namespaces)
- Remove default hotkeys to avoid conflicts with user keybindings
- Replace `as TFile` casts with `instanceof TFile` checks
- Make onunload sync, remove detachLeavesOfType (preserves leaf positions)
- Use `vault.configDir` instead of hardcoded `.obsidian`
- Replace `window.confirm` with Obsidian Modal dialog
- Fix unhandled promises with `void` or `await`
- Remove unnecessary `async` from methods without `await`
- Use `new Setting().setHeading()` instead of raw HTML headings
- Fix promise-returning callbacks in event listeners
- Fix error type narrowing with `instanceof Error`
- Apply sentence case to UI text labels

Change-Id: I6e850d8a13b458d5cf1ad91227bf1772636b56b9
2026-04-26 15:57:16 +08:00
fancivez
e0acce7f6d
Merge pull request #1 from fancive/feat/engineering-improvements
refactor: engineering improvements batch
2026-04-26 15:43:18 +08:00
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