Skip to content

Add lattice-scholar-extension extension - #27132

Merged
raycastbot merged 5 commits into
raycast:mainfrom
frank-miao:ext/lattice-scholar-extension
May 4, 2026
Merged

raycastbot merged 5 commits into
raycast:mainfrom
frank-miao:ext/lattice-scholar-extension

Conversation

@frank-miao

@frank-miao frank-miao commented Apr 13, 2026 •

Copy link
Copy Markdown
Contributor

Description

Add a raycast extension to work with a new scholar app -- Lattice Scholar

This extension just uses the local API --- 127.0.0.1:<port> to manage literature.

Screencast

lattice-search-1 lattice-search-2 lattice-status-1

Checklist

- Add configurable API port, status command, and docs for alias/hotkey
- Update raycast-extension/src/lattice-search.tsx
- Remove \'Open in Lattice\' feature from README and Chinese docs
- Add Chinese documentation and link from README
- Add Raycast extension for Lattice literature search
- update localAPI docs
- Point Word add-in docs to new release repo
- Initial import of Lattice plugins
@raycastbot

Copy link
Copy Markdown
Collaborator

Congratulations on your new Raycast extension! 🚀

We're currently experiencing a high volume of incoming requests. As a result, the initial review may take up to 10-15 business days.

Once the PR is approved and merged, the extension will be available on our Store.

@frank-miao
frank-miao marked this pull request as ready for review April 13, 2026 08:47
Copilot AI review requested due to automatic review settings April 13, 2026 08:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds a new Raycast extension (“Lattice Scholar Extension”) to search and view details from a local Lattice API, including copy actions for citation data.

Changes:

  • Introduces two Raycast commands: literature search and API connection status.
  • Adds project configuration (TypeScript, ESLint, Prettier) and extension metadata.
  • Adds end-user documentation (English + Chinese), plus changelog and agent guidance docs.

Reviewed changes

Copilot reviewed 12 out of 20 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
extensions/lattice-scholar-extension/tsconfig.json TypeScript configuration for the new extension.
extensions/lattice-scholar-extension/src/lattice-status.tsx Implements a status/health-check command for the Lattice local API.
extensions/lattice-scholar-extension/src/lattice-search.tsx Implements search, detail view, and clipboard actions for papers.
extensions/lattice-scholar-extension/package.json Declares extension metadata, preferences, commands, and dependencies.
extensions/lattice-scholar-extension/eslint.config.js Adds ESLint configuration using Raycast’s shared config.
extensions/lattice-scholar-extension/README.md English documentation and screenshots.
extensions/lattice-scholar-extension/README.zh-CN.md Chinese documentation and screenshots.
extensions/lattice-scholar-extension/CHANGELOG.md Initial changelog entry for v0.1.0.
extensions/lattice-scholar-extension/AGENTS.md Agent/developer guidance for working on the extension.
extensions/lattice-scholar-extension/CLAUDE.md Additional agent guidance file (currently duplicates/mislabels).
extensions/lattice-scholar-extension/.prettierrc Prettier configuration.
extensions/lattice-scholar-extension/.gitignore Extension-local ignore rules.

Comment on lines +17 to +19
if (error) {
showToast({ style: Toast.Style.Failure, title: "Lattice not reachable", message: error.message });
}

Copilot AI Apr 13, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Calling showToast(...) during render will fire on every re-render while error is set, which can spam toasts. Move this side-effect into a useEffect keyed on error (and optionally dedupe by message) so it only triggers when the error changes.

Copilot uses AI. Check for mistakes.
Comment on lines +104 to +106
if (error) {
showToast({ style: Toast.Style.Failure, title: "Failed to load paper", message: error.message });
}

Copilot AI Apr 13, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This toast is triggered during render and will repeat on re-renders while error exists. Use a useEffect tied to error to avoid repeated toasts and keep render side-effect free.

Copilot uses AI. Check for mistakes.
Comment on lines +158 to +160
export default function Command() {
const [query, setQuery] = useState("");
const [selectedId, setSelectedId] = useState<string | null>(null);

Copilot AI Apr 13, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replacing the entire command UI with return <PaperDetail .../> removes Raycast’s built-in navigation stack, so the user may have no obvious way to go back to the results list. Prefer Action.Push to push a detail view (or add an explicit 'Back to Results' action that clears selectedId) so navigation is predictable.

Copilot uses AI. Check for mistakes.
Comment on lines +170 to +172
if (selectedId) {
return <PaperDetail id={selectedId} />;
}

Copilot AI Apr 13, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replacing the entire command UI with return <PaperDetail .../> removes Raycast’s built-in navigation stack, so the user may have no obvious way to go back to the results list. Prefer Action.Push to push a detail view (or add an explicit 'Back to Results' action that clears selectedId) so navigation is predictable.

Copilot uses AI. Check for mistakes.
accessories={[{ text: item.citekey }]}
actions={
<ActionPanel>
<Action title="View Details" onAction={() => setSelectedId(item.id)} />

Copilot AI Apr 13, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replacing the entire command UI with return <PaperDetail .../> removes Raycast’s built-in navigation stack, so the user may have no obvious way to go back to the results list. Prefer Action.Push to push a detail view (or add an explicit 'Back to Results' action that clears selectedId) so navigation is predictable.

Copilot uses AI. Check for mistakes.
Comment on lines +5 to +6
const { port } = getPreferenceValues<{ port: string }>();
const BASE = `http://127.0.0.1:${port || "52731"}/api/v1`;

Copilot AI Apr 13, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BASE construction is duplicated in multiple commands, which makes future changes (host, path, default port behavior) easy to miss. Consider extracting a small shared helper (e.g., src/api.ts) to build the base URL once and reuse it across commands.

Suggested change
const { port } = getPreferenceValues<{ port: string }>();
const BASE = `http://127.0.0.1:${port || "52731"}/api/v1`;
function getBaseUrl(port?: string): string {
return `http://127.0.0.1:${port || "52731"}/api/v1`;
}
const { port } = getPreferenceValues<{ port: string }>();
const BASE = getBaseUrl(port);

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,12 @@
# Lattice Scholar Changelog

## [0.1.0] - {PR_MERGE_DATE}

Copilot AI Apr 13, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changelog uses a {PR_MERGE_DATE} placeholder; this should be replaced with an actual date before merging/publishing so the changelog is valid and user-facing.

Suggested change
## [0.1.0] - {PR_MERGE_DATE}
## [0.1.0] - 2026-04-13

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +3
# AGENTS.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Copilot AI Apr 13, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

File name/content mismatch: CLAUDE.md starts with the heading # AGENTS.md and appears to duplicate AGENTS.md. Please either (a) rename/remove one of these files, or (b) update CLAUDE.md to have the correct title and distinct content to avoid confusion for contributors/tools.

Suggested change
# AGENTS.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
# CLAUDE.md
This file provides Claude Code (claude.ai/code)-specific guidance for working with the code in this repository.

Copilot uses AI. Check for mistakes.

## Usage

1. Open Raycast and run **Lattice Search**

Copilot AI Apr 13, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs refer to the command as Lattice Search, but package.json registers the command title as Search Literature. Align the README with the actual command title users will see in Raycast to reduce confusion.

Suggested change
1. Open Raycast and run **Lattice Search**
1. Open Raycast and run **Search Literature**

Copilot uses AI. Check for mistakes.
Comment on lines +71 to +74
const body = fields
.filter(([, v]) => v)
.map(([k, v]) => ` ${k} = {${v}}`)
.join(",\n");

Copilot AI Apr 13, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The BibTeX generator interpolates raw field values without escaping characters that can break BibTeX syntax (notably } and potentially newlines). Consider escaping/normalizing field values (and/or wrapping with additional braces/encoding) before interpolation so copied entries remain valid for a wider range of titles/authors.

Copilot uses AI. Check for mistakes.
@greptile-apps

greptile-apps Bot commented Apr 13, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds a new Raycast extension for the Lattice Scholar reference manager, providing three commands: full-text library search with multi-format citation export, a connection status checker, and a browser-based DOI detector that resolves metadata from CrossRef and arXiv. The implementation is clean and well-structured with only two minor P2 findings.

Confidence Score: 5/5

Safe to merge; only P2 findings present.

Both findings are P2: a changelog date placeholder and a defensive style-injection edge case. No logic errors, security issues, or breaking API misuses were found.

CHANGELOG.md (missing {PR_MERGE_DATE} on top entry), export-clipboard.ts (style injection regex)

Important Files Changed

Filename Overview
extensions/lattice-scholar-extension/CHANGELOG.md Top entry uses a hardcoded date instead of the required {PR_MERGE_DATE} placeholder.
extensions/lattice-scholar-extension/src/export-clipboard.ts Clipboard export helper; style-injection regex may produce duplicate style attributes for elements that already carry one.
extensions/lattice-scholar-extension/src/export-formats.ts Format registry and citation rendering; caches templates correctly and handles both structured and CSL formats.
extensions/lattice-scholar-extension/src/lattice-search.tsx Main search command; properly uses generated Preference types and wraps side effects in useEffect.
extensions/lattice-scholar-extension/src/lattice-status.tsx Connection status command; clean, minimal, properly deferred error toast.
extensions/lattice-scholar-extension/src/lattice-doi.tsx DOI detection command using browser extension; state machine approach is clean and all effects are properly deferred.
extensions/lattice-scholar-extension/src/metadata.ts CrossRef and arXiv metadata fetchers; straightforward and correctly handles both sources.
extensions/lattice-scholar-extension/package.json Well-formed package.json with $schema, correct platforms, proper categories, and all dependencies used.
Prompt To Fix All With AI
Fix the following 2 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 2
extensions/lattice-scholar-extension/CHANGELOG.md:3
The newest entry introduced in this PR should use the `{PR_MERGE_DATE}` placeholder rather than a hardcoded date. Raycast automatically substitutes it with the actual merge date, which is the established convention for the top-of-file entry in each submitted PR.

```suggestion
## [0.4.1] - {PR_MERGE_DATE}
```

### Issue 2 of 2
extensions/lattice-scholar-extension/src/export-clipboard.ts:39-45
**Duplicate `style` attribute when element already has one**

The regex replaces only the tag-name portion (`<tagname`) and immediately appends `style="..."`. If the incoming HTML from `@citation-js/plugin-csl` already contains an element with its own `style` attribute, the result is a malformed string where the original attribute spills outside the tag. While current citation-js output for plain bibliography probably lacks inline styles, this will silently corrupt any element that does carry a `style` attribute.

Reviews (2): Last reviewed commit: "Update CHANGELOG.md and optimise images" | Re-trigger Greptile

- Update screenshots to metadata dir and fix React hook violations
- Update AGENTS.md and CHANGELOG.md for v0.2.0
- update readme
- Merge pull request raycast#1 from frank-miao/feature/raycast-extension
- Remove unused export format helpers
- Update raycast-extension/CHANGELOG.md
- Fix search defaults and remove EndNote export
- docs: sync readmes and agent guide
- Integrate Citation-JS library for citation format conversion
- Add CSL citation styles for multi-format bibliography export
- Add clipboard export module with inline font styles and auto-close
- Refactor export-formats.ts for improved type safety and maintainability
- Replace CSL plugin with local citation formatter
- Improve error handling and navigation in Raycast extension
- Fix font stack generation for clipboard HTML output
- Integrate Citation-JS for proper citation formatting and Word-compatible exports
- Update screenshots and assets for extension polish
- Update documentation for multi-format citation export
- Add multi-format citation export (BibTeX, RIS, APA, MLA, etc.)
- Add lattice-doi command documentation and cleanup
- Add lattice-doi command and metadata module

@pernielsentikaer pernielsentikaer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, approved 🔥

@raycastbot
raycastbot merged commit f529ea4 into raycast:main May 4, 2026
2 checks passed
@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor

@raycastbot

Copy link
Copy Markdown
Collaborator

🎉 🎉 🎉

We've rewarded your Raycast account with some credits. You will soon be able to exchange them for some swag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new extension Label for PRs with new extensions platform: macOS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants