From 8a6274ef6af4516e0db1bd74d8a89cca12b86141 Mon Sep 17 00:00:00 2001 From: Chili Palmer Date: Tue, 21 Jul 2026 23:18:12 +0200 Subject: [PATCH] Normalize template and script slug changes. --- README.md | 2 +- crates/bds-core/src/engine/script.rs | 162 +++++++++++++++++++-- crates/bds-core/src/engine/template.rs | 150 ++++++++++++++++--- crates/bds-core/src/scripting/core_host.rs | 1 + crates/bds-server/src/tui.rs | 1 + crates/bds-ui/src/app.rs | 25 +++- specs/script.allium | 6 + specs/template.allium | 6 + 8 files changed, 312 insertions(+), 41 deletions(-) diff --git a/README.md b/README.md index 96317b6..b62af9b 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ The project is under active development. Core blogging workflows are broadly ava - Post and translation authoring with change-aware draft/published/archive lifecycle, file-backed change discard, canonical draft reopening after manual translation edits, non-disruptive automatic translation, desktop archive/unarchive actions, in-place published-frontmatter updates, metadata, tags, categories, live link/backlink graphs, media, and batch gallery-image import. - Media import, thumbnails, metadata translations, filters, validation, post assignment, and sequential drag-and-drop insertion into post editors. - WordPress WXR migration with saved analyses, HTML-to-Markdown and shortcode conversion, conflict/taxonomy review, recoverable 500-item execution batches, media-parent linking, progress reporting, and optional AI-assisted taxonomy mapping. -- Post, Liquid template, and Lua script editing with dedicated syntax highlighting, explicit syntax-check feedback, reference-safe template slug changes, and publish-time enforcement of the bDS2 Liquid tag/filter/operator subset, using a custom Ropey/Syntect/Cosmic Text editor and the documented, bDS2-signature-compatible project-scoped [`bds` host API](docs/scripting/API_REFERENCE.md) across utilities, rendered macros, and Blogmark transforms, including airplane-gated Git sync. +- Post, Liquid template, and Lua script editing with dedicated syntax highlighting, explicit syntax-check feedback, normalized collision-safe template/script slug changes, reference-safe template renames, and publish-time enforcement of the bDS2 Liquid tag/filter/operator subset, using a custom Ropey/Syntect/Cosmic Text editor and the documented, bDS2-signature-compatible project-scoped [`bds` host API](docs/scripting/API_REFERENCE.md) across utilities, rendered macros, and Blogmark transforms, including airplane-gated Git sync. - SQLite and filesystem persistence with frontmatter, relationship-safe media sidecars, rebuild, metadata diff/repair, stale post-path cleanup on republish, bDS2-compatible checksums and NFD slug generation, and FTS5 search. - Optional on-device multilingual semantic search and similar-post tag suggestions backed by a persistent USearch index, plus always-available partial-name tag autocomplete and duplicate-post review in the desktop workspace. - Read-only in-app browsers in the Help menu for the bundled global `DOCUMENTATION.md`, the generated Lua API reference with public types and runnable examples, the [CLI/server/TUI documentation](CLI.md), and the [MCP server documentation](MCP.md), with safe GFM rendering and confirmed external links. diff --git a/crates/bds-core/src/engine/script.rs b/crates/bds-core/src/engine/script.rs index cd0c5ff..6b5cade 100644 --- a/crates/bds-core/src/engine/script.rs +++ b/crates/bds-core/src/engine/script.rs @@ -8,6 +8,7 @@ use crate::db::queries::script as qs; use crate::engine::{EngineError, EngineResult, domain_events}; use crate::model::{DomainEntity, NotificationAction, Script, ScriptKind, ScriptStatus}; use crate::util::frontmatter::{ScriptFrontmatter, write_script_file}; +use crate::util::paths::script_file_path; use crate::util::{atomic_write_str, ensure_unique, now_unix_ms, slugify}; /// Create a new draft script. Content stored in DB, no file written. @@ -64,6 +65,7 @@ pub fn create_script( )] pub fn update_script( conn: &Connection, + data_dir: &Path, script_id: &str, project_id: &str, title: Option<&str>, @@ -74,23 +76,28 @@ pub fn update_script( content: Option<&str>, ) -> EngineResult