Repository navigation
dsh-baize-rules v0.2.0
- Rule tags. A rule (and a template) can carry free-text tags:
tag/untagon the command side, chip editing + chip filtering in the panel. Tags are panel-only by default —injectTags: trueopts into rendering them as- [tag,tag] body, and with the default off the injected<system-reminder>is byte-identical to 0.1.6, so retagging never triggers a redundant re-injection. Stored tags are optional and normalized (max 8 per rule, 24 chars each, case-insensitive dedupe), so pre-tag rule files load unchanged and are rewritten byte-identically. - Template library (
$DSH_HOME/rules/templates.json, global, not bound to a scope):tmpl list|add|edit|rm,save <id>to store a rule as a template, andfrom <id|#tag> [scope]to apply templates as rules (a#tagref applies every template carrying that tag; a same-text rule already in the target scope is skipped, so re-applying never piles up duplicates; applied templates bump a use counter). - Template import/export.
tmpl export [<file>]writes a versioned envelope (kind/schemaVersion/exportedAt) that deliberately omits ids;tmpl import <file> [--merge|--replace] [--dry-run] [--yes]is dry-run by default, dedupes by text, unions tags, and collects every entry error before writing anything. - Panel: two panes. 规则 (scope switch, tag chips, per-row
Edit / Save as template / Remove, and a "From template" multi-select picker) and 模板 (create/edit body+tags, delete, apply into a scope, export to file, import with a dry-run preview). Both panes refresh from a single response. - HTTP API grows an
opdispatch (rule.update,rule.setTags,rule.saveAsTemplate,rule.addFromTemplates,template.create|update|delete|export|import) whilePOST { raw, scope }keeps working unchanged for older panels;GETnow also returnstemplates. - Rule ids accept a unique prefix.
remove/edit/enable/disable/tag/untag/savetake the abbreviated 8-char id thatlistprints; an ambiguous prefix reportsambiguouswith the candidates instead of guessing. - Fixes.
/baize-rules clear projectcleared the session scope instead of project (clearonly branched onglobal), andexportomitted the project section. Both are corrected. - Review fixes (all found by auditing the feature before release):
- The panel silently dropped session/project edits when it had no
sessionId/cwd (the new-chat overlay renders the panel that way): the op answeredok:trueand the rule showed up, then it was gone on the next fetch — nothing was persisted. The API now refuses that write with a 400 that explains it, and the panel disables the scopes it cannot store (session/project) with a hint, defaulting to global. tmpl addreported an already-existing template as a command error, while the HTTP API treated the same call as success. Both paths now branch on an explicitok/changedresult instead of matching on message text; a failed template write no longer carries anextTemplatesside effect.- Template import froze the mode into the dry-run preview: toggling merge/replace after previewing used to apply something different from what was shown. Confirming now always applies exactly the previewed mode.
- A failed template/rule edit no longer exits edit mode (it used to discard the typed text), and a failed import no longer dismisses the dry-run report.
- A malformed JSON request body reported
empty raw; it now reportsinvalid JSON body. template.updatecan now clear tags (an explicit empty list replaces them; omitting tags still keeps them), a no-op write no longer bumpsupdatedAtor rewrites the file, and template ordering gained anupdatedAttie-break.- Follow-up to the scope fix: gating availability on the docs'
cwdwas wrong — theconversation.viewslot's owner share carries onlyinspect/onInspectDone(verified in the shippeddsh-client-ui-conversationbundle), soprojectwas empty even inside a conversation, the project scope got disabled everywhere, and the hint wrongly claimed "not attached to a session". Availability now keys offsessionIdalone: the host resolves that session's cwd itself when storing project rules (resolveProject), which was verified end-to-end — a request with a real sessionId and noprojectwroteprojects/<cwd-slug>.jsonsuccessfully. Only a genuinely session-less panel is limited to global.
- The panel silently dropped session/project edits when it had no
- Docs: README (EN + ZH) cover tags, templates, the new commands,
injectTags, the template file location and the extended API; install examples bumped to 0.2.0. - Docs: add the panel and slash-command screenshots to both READMEs, and rewrite the Publishing section to state what actually ships — the tag-driven CI
publishjob fails without theNPM_TOKENsecret, so a localnpm publish --access publicis the step that publishes (commit4317d1a, which landed after this entry was written and is folded in here).
Install: dsh plugin --profile web add dsh-baize-rules@0.2.0
Published to npm on 2026-09-15.