Commit graph

119 commits

Author SHA1 Message Date
Research Assistant
f9fbbfb2f0 fix(dashboard): fix _renderNextStepCard this.plugin is undefined
- Replace this.plugin with this.app.plugins.plugins['paperforge']
- PaperForgeStatusView does not have a plugin property
- Remove debug console.log lines
2026-05-10 17:12:22 +08:00
Research Assistant
b31d5e94d9 debug(dashboard): add console.log for discussion.json path troubleshooting 2026-05-10 16:58:15 +08:00
Research Assistant
71d44c8966 fix(dashboard): use Obsidian adapter API for discussion.json read (handles unicode paths reliably) 2026-05-10 16:41:38 +08:00
Research Assistant
68e548e637 fix(dashboard): reset expanded state on mode switch
- Clear _techDetailsExpanded when switching modes to prevent stale state
- Ensures technical details starts collapsed for each new paper
2026-05-10 16:10:26 +08:00
Research Assistant
1bb320b70e refactor(dashboard): restructure per-paper layout per visual spec
- Merge status strip + file buttons into one row (left pills, right buttons)
- Move OCR/Analyze toggles into technical details disclosure body
- Replace All Set card with compact complete state row
- Save/restore technical details expanded state to prevent toggle flash
- Delete unused _renderPaperStatusStrip and _renderPaperFilesRow methods
- UI text: use Chinese labels (打开 PDF, 打开全文, 加入 OCR, 标记精读)
2026-05-10 16:09:53 +08:00
Research Assistant
0f9aae4a88 style(dashboard): rewrite Sections 39-43 per Native Light Surface Design spec
- Remove all box-shadows and ::before elevation pseudo-elements
- Typography constrained to 4 sizes (16/14/13/12) and 3 weights (600/500/400)
- Cards only for primary content modules (overview, discussion, OCR pipe, issues)
- Status pills: 999px radius, text-only status colors (no colored backgrounds)
- Technical details: inline disclosure row, not a bordered box
- Workflow toggles: not a card (simple flex row)
- Contextual buttons: Obsidian interactive-normal variables
- Section labels: no accent border, simple uppercase 12px muted
- Dark theme: no shadows, only background tweaks
2026-05-10 16:05:45 +08:00
Research Assistant
f8fac94222 style(dashboard): establish CSS base --pf-* vars, typography tokens, utility classes 2026-05-10 15:59:20 +08:00
Research Assistant
82bcbc7946 fix(dashboard): remove redundant _refreshCurrentMode from checkbox handler
- processFrontMatter triggers modify event which auto-refreshes the view
- Double refresh was resetting technical details toggle state (flash on first click)
- Discussion card only shows for papers with ai/discussion.json (currently 2Y9M3ILK only)
2026-05-10 15:28:58 +08:00
Research Assistant
fd47d52c13 fix(dashboard): fix discussion card rendering after sync read migration
- Replace leftover .catch() from old Promise chain with proper try/catch
- Use fs.readFileSync for reliable file access in Obsidian plugin context
2026-05-10 15:19:59 +08:00
Research Assistant
806292febb style(dashboard): luxury-minimal visual refinement
- Section labels: accent left-border matching metric card pattern
- Cards: ::before pseudo-element for smooth elevation on hover
- Per-paper header: larger title (16px), author (13px)/year (12px faint) hierarchy
- Body text: bumped from 11px to 13.5px for overview/discussion
- Status pills: rgba() translucent backgrounds with colored text
- Dark theme: deeper shadow on card hover (0 2px 12px rgba(0,0,0,0.3))
- Refined spacing, font weights, and transition timing for premium feel
2026-05-10 14:57:12 +08:00
Research Assistant
25b91b29ca fix(dashboard): only show issue panel for serious blockers
- Collection view: remove issue summary entirely (health counts are workflow state, not errors)
- Global view: only show issues for runtime mismatch, index missing, export missing, token missing
- Remove pdfIssues aggregation (not critical)
- CSS: soften issue colors (orange left border instead of red, muted text)
2026-05-10 14:38:22 +08:00
Research Assistant
01dddfcd0a fix(dashboard): check OS env for PaddleOCR token (match doctor logic)
- Doctor reads PADDLEOCR_API_TOKEN from OS environment variables
- Dashboard now checks 3 sources: plugin settings → .env file → process.env
2026-05-10 14:31:36 +08:00
Research Assistant
2ad8af1474 fix(dashboard): fix discussion card path on Windows + OCR token fallback check
- Discussion card: use lastIndexOf('/') instead of path.dirname to avoid
  Windows backslash separator breaking Obsidian vault path resolution
- OCR token: also check .env PADDLEOCR_API_TOKEN as fallback when plugin
  settings paddleocr_api_key is empty
2026-05-10 14:29:32 +08:00
Research Assistant
6d70e1f857 refactor: inline testable.js into main.js to remove external module dependency
- ACTIONS, resolvePythonExecutable, getPluginVersion, checkRuntimeVersion,
  classifyError, buildRuntimeInstallCommand, parseRuntimeStatus,
  buildCommandArgs, runSubprocess now defined directly in main.js
- Plugin no longer needs src/testable.js at runtime
- Tests continue to import from src/testable.js (unchanged)
- Fixes 'Cannot find module ./src/testable' error in Obsidian plugin loader
2026-05-10 14:17:14 +08:00
Research Assistant
064644c7c6 test: update ACTIONS count from 6 to 4, remove copy-context test cases 2026-05-10 14:10:41 +08:00
Research Assistant
808cae61f6 feat(dashboard): add do_ocr/analyze workflow toggle checkboxes to per-paper view
- Replace OCR queue toggle button with checkbox pair (do_ocr + analyze)
- Mirrors Base view toggles: writes to formal note frontmatter via processFrontMatter
- Dashboard modify event handler picks up file change and auto-refreshes
- Workers (OCR, deep-reading) read frontmatter from note file on disk
2026-05-10 14:06:37 +08:00
Research Assistant
b9fb1c919c style(dashboard): add refined CSS for redesigned per-paper, collection, and global views
- Status strip pills matching existing badge design (color-green/text-error)
- Paper overview card with card-style hover border + accent left border via ::before
- Discussion card with session-based Q&A styling + expand/truncate
- Workflow overview funnel with centered stage pills and arrows
- Issue summary with subtle error border + dot indicators
- Library snapshot pills and system status grid for global view
- Contextual button base style shared across all views
- All new components use Obsidian CSS variables for dark/light theme support
2026-05-10 14:04:14 +08:00
Research Assistant
9226ad0f03 refactor(dashboard): contract global view to system homepage
- Remove OCR pipeline and metric cards from global mode (moved to base)
- Add library snapshot: papers, PDFs ready, OCR done, deep-read done
- Add system status grid: runtime, index, Zotero export, OCR token
- Add issues panel with contextual Run Doctor / Repair Issues (only when issues exist)
- Add contextual Start Working actions: Open Literature Hub + Sync Library
- Add null guards to _renderStats and _renderOcr for safe backwards compat
2026-05-10 13:56:17 +08:00
Research Assistant
c5097373f4 refactor(dashboard): redesign base/collection view as batch workflow workspace
- Replace metric cards + bar chart + health grid with workflow funnel overview
- Move OCR pipeline from global to base (same progress bar logic, new container)
- Replace health matrix with compact issue summary (only visible when issues exist)
- Add contextual action buttons: Sync Library + Run OCR
- Remove _renderCollectionHealth (replaced by inline issue summary)
2026-05-10 13:53:06 +08:00
Research Assistant
c39ee8fa60 refactor(dashboard): redesign per-paper view as reading companion
- Replace lifecycle stepper + health matrix + maturity gauge with compact status strip
- Add paper overview card: extract Pass 1 summary from formal note ## 🔍 精读
- Add recent discussion card: read ai/discussion.json with 150-char truncation + expand
- Add files row: Open PDF + Open Fulltext
- Add technical details section: collapsed by default
- Keep OCR queue toggle and simplified next-step card
2026-05-10 13:50:01 +08:00
Research Assistant
0475387c55 fix(dashboard): add workspace path detection for paper mode routing
- Add _extractZoteroKeyFromPath: extract key from dirname pattern '{KEY} - {title}'
- Modify _resolveModeForFile: fallback to workspace detection for any file type
- Fixes fulltext.md and other workspace files dropping to global mode
2026-05-10 13:46:18 +08:00
Research Assistant
36a8ba8400 refactor(dashboard): Phase 1 cleanup - remove Copy Context, deep-reading dead code, static Quick Actions grid
- Delete Copy Context and Copy Collection Context from ACTIONS array
- Remove all _renderDeep* dead methods (StatusCard, Pass1Card, QACard)
- Remove _getPassCompletion and _extractPass1Content helpers
- Remove deep-reading mode case from _renderModeHeader
- Remove Copy Context handlers from _runAction
- Remove copy-context command palette registrations
- Delete static Quick Actions section from _buildPanel
- Delete _renderActions method
- Replace ready-state Copy Context fallback in _renderNextStepCard
- Add implementation plan at docs/superpowers/plans/
2026-05-10 13:44:50 +08:00
Research Assistant
f885adae48 feat: skill auto-deploy in update + Copy Context as pure JS + shared skill_deploy service
- New services/skill_deploy.py: single source of truth for agent skill deployment
  - AGENT_CONFIGS with 9 platforms, all vault-local
  - deploy_skills() with install/update mode (overwrite flag)
  - Used by both setup wizard and update worker
- update.py: _deploy_all_skills() after pip/git/zip update
- setup_wizard.py: delegates skill deploy to shared service
- config.py: add agent_platform default
- main.js: Copy Context + Copy Collection Context now pure JS
  - Uses in-memory _cachedItems / _currentPaperEntry
  - No subprocess spawn, no timeout, no JSON parse errors
- testable.js: remove needsKey/needsFilter from context actions
- commands.test.mjs: update assertions for removed flags
2026-05-10 12:33:23 +08:00
Research Assistant
11c787ed96 fix: add v1.4.18 entry to versions.json — missing from bump script 2026-05-10 11:37:58 +08:00
Research Assistant
0adfde6ae9 bump: 1.4.17 -> 1.4.18 2026-05-10 11:25:45 +08:00
Research Assistant
06c2ce5f9d fix(plugin): extract testable functions to src/testable.js, fix vitest imports
- Move resolvePythonExecutable, getPluginVersion, classifyError, ACTIONS, etc. to src/testable.js
- main.js now requires from ./src/testable.js instead of inline duplication
- Tests import from ../src/testable.js (no obsidian dependency)
- Remove vitest obsidian mock setup (no longer needed)
- Fixes L3 Plugin Tests that failed because main.js requires 'obsidian'
2026-05-10 11:03:31 +08:00
Research Assistant
71d2d05f41 fix(plugin): mock obsidian module for vitest — main.js requires it at top level 2026-05-10 10:52:21 +08:00
Research Assistant
aff3cfe622 fix(plugin): update Vitest imports after src/ inline refactor
- Add named exports for testable functions (resolvePythonExecutable, getPluginVersion, etc.)
- Update test imports from ../src/*.js to ../main.js
- Fix repair action test: disabled flag was removed when ACTIONS was inlined
2026-05-10 10:48:06 +08:00
CTZ
152056d044 fix(plugin): cross-platform macOS Python/Zotero/BBT detection and pip bootstrap
- Add paperforgeEnrichedEnv() to enrich PATH for GUI Obsidian on macOS/Linux
- Add getPaperforgePythonCmd() preferring Homebrew/pyenv over Apple CLT Python
- Add tryExecPythonVersion() with multi-candidate fallback for pre-check
- Add scanBbtUnderProfiles() using real Zotero Profiles/extensions/ layout
- Add scanBbtDirectChildren() for safe shallow BBT folder detection
- Add macOS /Applications/Zotero.app and Linux Zotero install detection
- Use paperforgeEnrichedEnv() in setup wizard spawn calls
- Add --user flag to pip install on non-Windows
- Pass PaddleOCR key as --paddleocr-key CLI arg instead of env var
- Add Apple CLT stub Python specific error message in _formatSetupError()

Based on PR #1 by Chartreuse310
Original commit: 156f653 (improve setup modal i18n and update directory defaults)
Co-authored-by: CTZ <yoyflying@163.com>
2026-05-10 10:37:08 +08:00
Research Assistant
15d849f7e6 fix: remove deprecated control_dir from doctor/setup/repair; enable repair button; fix UTF-8 encoding in doctor output 2026-05-10 01:50:24 +08:00
Research Assistant
caab9ff9ee refactor: inline src/ modules back into main.js — single file, no runtime require 2026-05-09 23:48:08 +08:00
Research Assistant
ba1a5cc7e0 revert: remove formal-library deprecation console.warn from plugin 2026-05-09 23:13:02 +08:00
Research Assistant
05629bce82 refactor: v2.1 contract hardening — PFResult unification, ErrorCode expansion, adapter cleanup, SyncService orchestration
Core contract:
- ErrorCode: 8→26 with _missing_() graceful degradation for unknown codes
- PFResult: +warnings/next_actions, PFError: +suggestions
- OcrStatus: 4→9 granular states (NONE/QUEUED/BLOCKED/NO_PDF/DONE_INCOMPLETE restored 1:1)
- field_registry.yaml: +owner/deprecated/replacement/enum values/default

Adapter cleanup:
- new core/io.py (read_json/write_json), core/date_utils.py (extract_year)
- new adapters/collections.py (build_collection_lookup)
- adapters/bbt.py: cut worker dependency, _private→public+alias
- worker/_utils.py + _domain.py: re-export from core instead of duplicate defs

Command unification:
- All 6 commands (sync/status/ocr/deep/repair/dashboard) → PFResult
- cli.py --json dest unified to 'json' (was json_output on status/doctor)
- commands/sync.py → SyncService (no more int/dict/PFResult mixing)

Service hardening:
- SyncService.run() orchestrates full sync lifecycle (select→index→clean)
- cleanup loops (orphaned records, flat notes) migrated from worker
- worker/sync.py: freeze line + services→worker one-way dependency
- plugin/main.js: formal-library.json fallback deprecation warning

Verification: 181/181 tests, 0 new lint errors
2026-05-09 22:20:07 +08:00
Research Assistant
0d49b5d285 fix: pre-existing test issues blocking CI on non-Windows platforms
test_ocr_preflight: mock fitz.open (not builtins.open) + set needs_sanitize=True
  - Code uses fitz.open(), not builtins.open() — mock was targeting wrong function
  - fitz.open() only called when meta.needs_sanitize is true — mock returned {} which skipped it
  - These tests were always broken but CI never ran before v2.1

test_e2e_cli: guard against None stdout in doctor_verdict test on Windows CI

L3 runtime.test.mjs: use platform-agnostic path matching
  - path.join produces / on Linux but \\\\ on Windows — test used \\\\ only
2026-05-09 18:06:37 +08:00
Research Assistant
c16e3e5198 fix(ci): two pre-existing CI config issues blocking pipeline
L2: removed -m cli marker filter (no test had the marker → exit code 5)
L3: committed package-lock.json (npm ci failed without it)
gitignore: added paperforge/plugin/node_modules/
These are CI config issues, not code regressions from v2.1.
2026-05-09 17:50:38 +08:00
Research Assistant
bbd39a90d3 v1.4.17rc4
Milestone v2.1: Contract-Driven Architecture & Engineering Hardening

- Stop the Bleeding: version sync checker, PyYAML hardening, install docs unification
- Contract Layer: PFResult/PFError dataclasses, ErrorCode enum, --json wrapping
- Service Extraction: sync.py decomposed into 3 adapters + SyncService
- State Machine: PdfStatus/OcrStatus/Lifecycle enums, transitions, field registry
- Setup Modularization: setup_wizard.py decomposed into 6 classes

173 tests passing, 0 regressions.
2026-05-09 17:05:07 +08:00
Research Assistant
2cb223ddbb feat(53-001): extract src/ modules from main.js and add Vitest test infrastructure
- runtime.js: resolvePythonExecutable, getPluginVersion, checkRuntimeVersion
- errors.js: classifyError, buildRuntimeInstallCommand, parseRuntimeStatus
- commands.js: ACTIONS, buildCommandArgs, runSubprocess
- package.json with vitest + obsidian-test-mocks + jsdom
- vitest.config.ts with jsdom environment
- 42 Vitest tests across 3 test files
- Refactored main.js to import from src/ modules
2026-05-09 00:05:19 +08:00
Research Assistant
5ed8cf5916 fix: ensure switching class is always cleaned up after action 2026-05-08 19:37:47 +08:00
Research Assistant
44619e1560 fix: add missing v1.12 Chinese i18n keys and fix lang fallback 2026-05-08 19:25:26 +08:00
Research Assistant
2b5b649bd9 feat: enable Run Doctor quick action (backend was already functional) 2026-05-08 19:20:05 +08:00
Research Assistant
c117e43a5e chore: remove redundant Run All Pending OCR button 2026-05-08 19:16:43 +08:00
Research Assistant
d941acef1c fix: refresh dashboard stats after sync completes 2026-05-08 19:13:03 +08:00
Research Assistant
4c9bbd9917 bump: 1.4.17rc2 -> 1.4.17rc3 2026-05-08 17:48:10 +08:00
Research Assistant
7e6abc2070 test: prefer repo source for OCR doctor fixtures 2026-05-08 17:47:45 +08:00
Research Assistant
79b540e490 feat(54-001/003): add OCR queue buttons, /pf-deep handoff, pending action, and privacy modal
- Add i18n keys for OCR queue, /pf-deep handoff, and privacy warning (en/zh)
- Add OCR toggle button to per-paper dashboard card (set do_ocr via processFrontMatter)
- Change /pf-deep copy button to copy full '/pf-deep <key>' command
- Add agent platform label below copy button
- Add Run All Pending OCR dynamic action card
- Add once-per-session OCR privacy warning modal (PaperForgeOcrPrivacyModal)
- Add CSS for queue hint, pending action card, platform label, and privacy modal
2026-05-08 17:47:39 +08:00
Research Assistant
70767c413a feat(52-001): add Runtime Health UI, dashboard drift banner, extended error classification, Copy diagnostic
- Add Runtime Health section in settings showing Plugin vX vs Python vY
- Add match/mismatch badge (green/red) with version comparison
- Add 'Sync Runtime' button that runs pip install --upgrade
- Add Dashboard yellow drift warning banner on version mismatch
- Extend _formatSetupError to 10 categories (pip/network/SSL/disk/Python/etc)
- Add 'Copy diagnostic' button on setup failure with env info
- Add all i18n keys in both en and zh
- Add CSS for badge states, drift banner, and diagnostic button
2026-05-08 17:47:39 +08:00
Research Assistant
18b6f07ce6 chore(52-001): align manifest sources, bump minAppVersion to 1.9.0, add PyYAML dep
- Add clarifying comment in bump.py about canonical version source
- Update root and plugin manifest.json minAppVersion from 1.0.0 to 1.9.0
- Update versions.json compatibility mapping to 1.9.0
- Add pyyaml>=6.0 to pyproject.toml dependencies
2026-05-08 17:47:38 +08:00
Research Assistant
6bcc32a5b6 feat(51-001): consistent interpreter usage, zotero_data_dir required with validation
Part A: All 8 subprocess call sites now use resolvePythonExecutable with
settings and extraArgs propagation for py -3 support:
- _fetchVersion, _fetchStats, _runAction, _preCheck, _runInstall, _stepComplete,
  _autoUpdate, command palette
- Zero bare 'python' spawn/exec calls remain
- Spaces-in-path safe via execFile instead of shell-string exec

Part B: zotero_data_dir required with validation:
- field_zotero_placeholder i18n updated to 'Required'/'必填'
- Wizard placeholder uses t() call instead of hardcoded string
- _validateStep3 checks: non-empty -> exists -> isDirectory -> has storage/
- _validate() rejects missing zotero_data_dir with validate_zotero i18n key
- zotero_data_dir always passed to --zotero-data flag (no conditional)
2026-05-08 17:47:38 +08:00
Research Assistant
27d926d83b feat(51-001): add Python interpreter row, custom path input, and validate button to settings UI
- Add field_python_interp, field_python_custom, btn_validate i18n keys (en/zh)
- Add read-only resolved interpreter row with source label (auto-detected/manual/stale)
- Add custom path text input wired to settings.python_path with auto-save
- Add Validate button with full check chain: exists -> executable -> version >= 3.10 -> pip warn
- Stale saved override shows [!!] warning prefix in read-only row
- Input changes re-render the read-only row and clear/re-set stale flag
2026-05-08 17:47:38 +08:00
Research Assistant
31cd04b4cc feat(51-001): refactor resolvePythonExecutable with manual override and reload validation
- Add python_path to DEFAULT_SETTINGS for storing manual override path
- Refactor resolvePythonExecutable(vaultPath, settings) to return {path, source, extraArgs}
- Manual override (settings.python_path) bypasses auto-detection when set and exists
- Detection order: manual -> .paperforge-test-venv -> .venv -> venv -> py -3 -> python -> python3
- py -3 detection uses extraArgs for proper launcher argument passing
- Stale override re-validated on plugin load; _python_path_stale flag set without clearing
- Update all existing call sites to destructure .path from new return type
2026-05-08 17:47:38 +08:00