Skip to content

feat: add "Import as template" to File Tree context menu#602

Open
Adityakk9031 wants to merge 1 commit into
inkeep:mainfrom
Adityakk9031:#590
Open

feat: add "Import as template" to File Tree context menu#602
Adityakk9031 wants to merge 1 commit into
inkeep:mainfrom
Adityakk9031:#590

Conversation

@Adityakk9031

Copy link
Copy Markdown

Resolves #590

Description

This PR addresses the feature request to easily convert existing documents into templates. It adds an Import as template option directly to the right-click context menu of standard markdown files in the File Tree.

Users can now choose to:

  • Keep original file: Copies the content and its frontmatter directly into a new template within .ok/templates/.
  • Convert (delete original): Copies the file to the templates directory and safely removes the source document, updating the UI automatically.

Changes Made

  • API (Core & Server): Added a secure POST /api/template/import endpoint (handleTemplateImport) which atomically extracts the source file's frontmatter, manages potential disk/sync conflicts, and persists the new template.
  • Frontend (FileTree.tsx & Client API): Added the nested context menu items using the Lucide FileKey icon, bound them to a new importTemplate client wrapper, and handled immediate UI state cleanups (closing open tabs and removing deleted source files from the view).
  • Changeset: Added a patch changeset for the release notes.

@CLAassistant

CLAassistant commented Jul 10, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Allow drag-and-drop or import existing files as templates

2 participants