StaticFlow CLI Publisher
Use this skill to publish Markdown/blog notes into LanceDB and verify results.
When To Use
- •Publish one Markdown article (
write-article). - •Batch import images (
write-images) or sync a notes directory (sync-notes). - •Query/update/delete data in
articles,images, andtaxonomies. - •Run backend-equivalent local API queries for verification/debug.
- •Reclaim storage immediately (
db cleanup-orphans).
Execution Policy (Mandatory)
- •Context-first: read article and metadata from current context/local files first.
- •LLM-native generation: generate missing metadata and summary directly in-session.
- •Do not call external model APIs, proxy scripts, or sub-agent model commands.
- •Use CLI only for fetch fallback, write/sync, and verification.
- •Keep intermediate artifacts under
tmp/. - •Never run destructive operations unless explicitly requested.
Load Extra Context
- •Required:
references/publish-checklist.md - •If summary generation is needed:
../article-summary-architect/SKILL.md - •Optional docs:
README.md,docs/cli-user-guide.zh.md
Preconditions
- •Resolve CLI in this order:
- •
./bin/sf-cli - •
./target/release/sf-cli - •
./target/debug/sf-cli - •
../target/release/sf-cli - •
sf-clifromPATH
- •
- •Verify CLI works:
<cli> --help- •Build if needed:
cargo build -p sf-cli --release
- •Build if needed:
- •Verify DB path exists.
- •Verify DB tables:
- •
<cli> db --db-path <db_path> list-tables - •required:
articles,images,taxonomies
- •
- •If DB is uninitialized, ask user before:
- •
<cli> init --db-path <db_path>
- •
Publication Workflow
A) Single Article (write-article)
- •Read Markdown body/frontmatter.
- •Ensure required metadata in final payload:
- •
summary - •
tags - •
category - •
category_description - •when bilingual publish is requested:
content_enanddetailed_summary.zh/en
- •
- •Metadata priority:
- •frontmatter
- •explicit user CLI args
- •skill inference from content + existing taxonomy records
- •Preserve source date:
- •use
--datewhen user provides it - •else keep frontmatter
date - •else derive from file birth time/mtime (
YYYY-MM-DD) and pass--date
- •use
- •Summary gate (before publish):
- •regenerate
detailed_summary.zh/enwhen missing/stale/unstructured - •follow
article-summary-architectquality contract
- •regenerate
- •Publish command:
- •frontmatter complete:
- •
<cli> write-article --db-path <db_path> --file <post.md>
- •
- •frontmatter incomplete:
- •
<cli> write-article --db-path <db_path> --file <post.md> --summary "..." --tags "a,b" --category "..." --category-description "..."
- •
- •explicit bilingual files (preferred for non-frontmatter workflow):
- •
<cli> write-article --db-path <db_path> --file <post.md> --summary "..." --tags "a,b" --category "..." --category-description "..." --content-en-file <content_en.md> --summary-zh-file <summary_zh.md> --summary-en-file <summary_en.md>
- •
- •frontmatter complete:
- •Local image import (optional):
- •
--import-local-images - •optional
--media-root <path>(repeatable) - •optional
--generate-thumbnail --thumbnail-size <n> - •supports
,![[path]],![[path|alias]]
- •
- •Verify publication:
- •article row exists
- •taxonomy rows updated
- •images imported when expected
- •Report:
- •article id
- •inferred metadata (if any)
- •summary generated/reused
- •bilingual fields generated/reused (
content_en,detailed_summary.zh/en) - •image import count and warnings
B) Image Batch (write-images)
<cli> write-images --db-path <db_path> --dir <image_dir> [--recursive] [--generate-thumbnail] [--thumbnail-size <n>] [--no-auto-optimize]
C) Notes Sync (sync-notes)
<cli> sync-notes --db-path <db_path> --dir <notes_dir> [--recursive] [--generate-thumbnail] [--thumbnail-size <n>] [--language <en|zh>] [--default-category <name>] [--default-author <name>] [--no-auto-optimize]
DB and API Quick Map
- •DB ops:
<cli> db --db-path <db_path> <subcommand>- •common:
list-tables,query-rows,update-rows,delete-rows,ensure-indexes,optimize
- •common:
- •API-equivalent ops:
<cli> api --db-path <db_path> <subcommand>- •common:
get-article,search,semantic-search,list-tags,list-categories,search-images
- •common:
One-Click Immediate Prune
- •Single table:
- •
<cli> db --db-path <db_path> cleanup-orphans --table <table>
- •
- •All managed tables:
- •
<cli> db --db-path <db_path> cleanup-orphans
- •
Error Handling
- •Missing metadata: infer and continue, but report inferred fields explicitly.
- •Image resolution warnings: rerun with
--media-root. - •Partial success: rerun only failed steps, then verify again.
- •Never run
drop-tableordelete-rows --allunless user explicitly requests it.