Skip to main content

preview

Path to markdown file, plan directory, or plans collection

来源信息

仓库
LongLeo287/SEOSONA-OS
最近来源活动
2026年8月4日 05:01
检测到的 SKILL.md 语言
英语
星标
2
分支
1

安装方式

默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。

检查来源文件

决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。

正在显示 SKILL.md

SKILL.md
来源说明 · 只读预览
name
preview
description
Path to markdown file, plan directory, or plans collection
metadata
{"author":"claudekit","version":"1.0.0"}
Universal viewer using `markdown-novel-viewer` skill - pass ANY path and see it rendered nicely. ## Usage - `/preview <file.md>` - View markdown file in novel-reader UI - `/preview <directory/>` - Browse directory contents - `/preview --stop` - Stop running server ## Examples ```bash /preview plans/my-plan/plan.md # View markdown file /preview plans/ # Browse plans directory /preview docs/ # Browse docs directory /preview any/path/to/file.md # View any markdown file /preview any/path/ # Browse any directory ``` ## Execution **IMPORTANT:** Run server as Claude Code background task using `run_in_background: true` with the Bash tool. This makes the server visible in `/tasks` and manageable via `KillShell`. Check if this script is located in the current workspace or in `$HOME/.opencode/skills/markdown-novel-viewer` directory: - If in current workspace: `$SKILL_DIR_PATH` = `./.opencode/skills/markdown-novel-viewer/` - If in home directory: `$SKILL_DIR_PATH` = `$HOME/.opencode/skills/markdown-novel-viewer/` ### Stop Server If `--stop` flag is provided: ```bash node $SKILL_DIR_PATH/scripts/server.cjs --stop ``` ### Start Server Otherwise, run the `markdown-novel-viewer` server as CC background task with `--foreground` flag (keeps process alive for CC task management): ```bash # Determine if path is file or directory INPUT_PATH="{{path}}" if [[ -d "$INPUT_PATH" ]]; then # Directory mode - browse node $SKILL_DIR_PATH/scripts/server.cjs \ --dir "$INPUT_PATH" \ --host 127.0.0.1 \ --open \ --foreground else # File mode - view markdown node $SKILL_DIR_PATH/scripts/server.cjs \ --file "$INPUT_PATH" \ --host 127.0.0.1 \ --open \ --foreground fi ``` **Critical:** When calling the Bash tool: - Set `run_in_background: true` to run as CC background task - Set `timeout: 300000` (5 minutes) to prevent premature termination - Parse JSON output and report URL to user Example Bash tool call: ```json { "command": "node .opencode/skills/markdown-novel-viewer/scripts/server.cjs --dir \"path\" --host 127.0.0.1 --open --foreground", "run_in_background": true, "timeout": 300000, "description": "Start preview server in background" } ``` After starting, parse the JSON output (e.g., `{"success":true,"url":"htt~/.seosona/path/:3456/view?file=...","networkUrl":"htt~/.seosona/path/:3456/view?file=..."}`) and report: - Local URL for browser access - Network URL only when explicitly authorized for remote device access - Inform user that server is now running as CC background task (visible in `/tasks`) **CRITICAL:** MUST display the FULL URL including path and query string (e.g., `htt~/.seosona/path/:3456/view?file=/path/to/file.md`). NEVER truncate to just `host:port` (e.g., `htt~/.seosona/path/:3456`). The full URL is required for direct file access.
在 GitHub 查看