dsh-output-styles 0.4.0 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,67 +4,58 @@
4
4
 
5
5
  **Claude Code `outputStyles` for DeepSeek Harness** — switch the model's output style at runtime, per session, durably.
6
6
 
7
- [![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
8
- [![CI](https://github.com/PerryLink/dsh-output-styles/actions/workflows/ci.yml/badge.svg)](https://github.com/PerryLink/dsh-output-styles/actions/workflows/ci.yml)
7
+ *`/style concise` — and every reply from now on is terse. `/style off` — back to the project default.*
8
+
9
+ [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)
10
+ [![DSH plugin](https://img.shields.io/badge/dsh-plugin-✅-green)](https://github.com/topics/dsh-plugin)
11
+ [![Node](https://img.shields.io/badge/node-%5E22.19%20%7C%7C%20%3E%3D24-brightgreen.svg)](#)
12
+ [![CI](https://img.shields.io/github/actions/workflow/status/PerryLink/dsh-output-styles/ci.yml?branch=main&label=CI)](https://github.com/PerryLink/dsh-output-styles/actions)
13
+ [![Version](https://img.shields.io/github/v/tag/PerryLink/dsh-output-styles?label=version)](https://github.com/PerryLink/dsh-output-styles/releases)
9
14
  [![npm version](https://img.shields.io/npm/v/dsh-output-styles)](https://www.npmjs.com/package/dsh-output-styles)
10
15
  [![npm downloads](https://img.shields.io/npm/dm/dsh-output-styles)](https://www.npmjs.com/package/dsh-output-styles)
11
- [![Node](https://img.shields.io/badge/node-%5E22.19%20%7C%7C%20%3E%3D24-brightgreen.svg)](#)
12
- [![DSH](https://img.shields.io/badge/deepseek--harness-0.1.0--rc.6-4d6bfe.svg)](#)
13
- [![TypeScript](https://img.shields.io/badge/TypeScript-strict-3178c6.svg)](#)
14
16
 
15
- 🌐 [English](README.md) · [中文](README.zh.md) · [日本語](README.ja.md) · [한국어](README.ko.md) · [Español](README.es.md)
17
+ [English](README.md) · [简体中文](README.zh.md) · [Español](README.es.md) · [Português](README.pt.md) · [हिन्दी](README.hi.md)
16
18
 
17
19
  </div>
18
20
 
19
21
  ---
20
22
 
21
- `/style concise` — and every reply from now on is terse. `/style step-by-step` — and the model narrates numbered steps. `/style off` — back to the project default. One command per session, persisted across restarts, zero changes to the agent loop.
23
+ ## Compatibility
22
24
 
23
- ## ✨ Features
24
-
25
- | | |
25
+ | Surface | Status |
26
26
  |---|---|
27
- | 🗂️ **Style library** | One Markdown file per style (`styles/*.md`); frontmatter for metadata, body = the model directive. `name` defaults to the file name and may contain spaces (`Diagrams first`). Six built-ins ship in the box, including Claude Code-parity `proactive` and `learning`. |
28
- | ⌨️ **`/style` command** | No argument lists styles (with descriptions) + current selection; `/style <name>` switches; `/style off` restores the project default. The whole remainder after `/style` is the style name. |
29
- | 💾 **Session-scoped persistence** | The choice lives in the `output_style` storage domain, keyed by sessionId — two sessions never interfere, and the choice survives restarts. |
30
- | 🧩 **System-prompt injection** | A `systemPrompt.section()` contribution (order 90) injects the current session's style body at every assembly; bodies are truncated at a configurable budget. |
31
- | 🎭 **Claude Code `keep-coding-instructions`** | Styles with `keep-coding-instructions: false` (the default, like Claude Code) replace the whole system prompt — for styles that leave software engineering behind. |
32
- | 📌 **Forced styles** | Claude Code's `force-for-plugin` (alias `force`) applies a style unconditionally, overriding any session selection; two forced styles fail the load. |
33
- | 🔁 **Claude Code compatibility** | Loads `outputStyles` JSON collections (`{ name, description, prompt }`), single entries or `settings.json`-style arrays; unparseable entries are skipped with a warning. |
34
- | 📚 **Layered directories** | `stylesDir` is a list; later directories override earlier ones (bundled `styles/` is the lowest layer, disable with `includeBuiltins: false`). |
35
- | 🔄 **Hot reload** | Style-file changes are picked up without restarting (`watchStyles: false` to opt out). |
36
- | ⚙️ **Project default over settings** | Sessions that never selected one fall back to `output-style.style` from the DSH settings seam, then to `defaultStyle`. |
37
- | 🖱️ **Web picker** | A `dsh.client` entry (`dsh-output-styles/client`) decorates the host `/style` command with a projection-backed popup picker. |
38
- | 📊 **Session projection** | A `style` projection (`{ options, currentValue }`) for the Web UI, folded from settled commands in the session log. |
39
- | 🎨 **Renderer registry (`output.render.*`)** | `ctx.outputRenderers` lets any plugin register a presenter — `{ id, match (tool/content-type), presenter, priority }` — applied through the `output.render/before` waterfall (listeners must `next()`). Built-in renderers: `concise`, `step-by-step`. Registration is reversible and owned by the caller's `ctx.effect`. |
40
- | 🧾 **Per-session/per-tool rules** | `rules: [{ match: { tool: 'bash' }, style: 'concise' }]` — first matching rule (by priority) names the renderer; `match.session` scopes a rule to one session. Editable through the `output-style-rules` settings section. |
41
- | 📤 **`/export`** | Renders the current session's message surface to Markdown or sanitized HTML through the render pipeline (`/export [markdown|html] [--renderer=<id>]`); every render keeps its original text beside the rendered one, and the original always stays reconstructable from the session log. |
42
- | 🧯 **Fail loud, skip cleanly** | Misconfiguration throws at load; a bad style file is skipped with a warning and never breaks the profile. |
43
- | 🌐 **Five-language docs** | EN · 中文 · 日本語 · 한국어 · Español. |
44
-
45
- ## 🚀 Quick start
27
+ | Harness | DeepSeek Harness `0.1.0-rc.8` |
28
+ | Node | `^22.19.0 || >=24.0.0` |
29
+ | Platforms | All (host + web client) |
30
+ | Model | Any (system-prompt injection) |
31
+
32
+ ## What you get
33
+
34
+ `dsh-output-styles` is the Claude Code `outputStyles` equivalent for DeepSeek Harness: a `/style` command that switches the model's output style at runtime, persisted per session, injected at every prompt assembly.
35
+
36
+ - **Style library** — one Markdown file per style (`styles/*.md`); frontmatter for metadata, body = the model directive. Six built-ins ship in the box (`concise`, `explanatory`, `formal`, `learning`, `proactive`, `step-by-step`), including Claude Code-parity `proactive` and `learning`.
37
+ - **`/style` command** — no argument lists styles (with descriptions) plus the current selection; `/style <name>` switches; `/style off` restores the project default.
38
+ - **Session-scoped persistence** — the choice lives in the `output_style` storage domain, keyed by sessionId, and survives restarts.
39
+ - **System-prompt injection** — a `systemPrompt.section()` contribution (order `sectionOrder`) injects the current session's style body at every assembly, truncated at a configurable budget.
40
+ - **Claude Code parity** — `keep-coding-instructions`, `force-for-plugin` (`force` alias), `outputStyles` JSON compatibility, layered `stylesDir` directories, hot reload, and project-default fallback over the DSH settings seam.
41
+ - **Renderer registry (`output.render.*`)** — `ctx.outputRenderers` lets any plugin register a pure presenter, applied through the `output.render/before` waterfall; built-in renderers `concise` and `step-by-step`.
42
+ - **Per-session/per-tool rules** — `rules: [{ match: { tool: 'bash' }, style: 'concise' }]` name the renderer for matching requests; editable through the `output-style-rules` settings section.
43
+ - **`/export`** — render the current session to Markdown or sanitized HTML through the render pipeline; every render keeps the original text beside the rendered one.
44
+
45
+ ## Quick start
46
46
 
47
47
  ```sh
48
- # 1. Install — the package is a bundle layer, so one command composes
49
- # storage + storage-json + storage-domain + the plugin row:
50
- dsh plugin --profile <name> add dsh-output-styles
51
-
52
- # 2. Boot and switch
53
- dsh --profile <name>
54
- /style # → output style off, then one line per style
55
- /style concise # → switched to concise
56
- /style Diagrams first # → names with spaces work too
57
- /style off # → back to the project default
58
- ```
48
+ # 1. install the bundle into your profile
49
+ dsh plugin --profile web add "github:PerryLink/dsh-output-styles#main"
59
50
 
60
- The layer is idempotent over web profiles (insert-by-id replaces same-id rows), which compose `storage` in box. For the Web picker, add the client row to the profile:
51
+ # or from npm (published releases)
52
+ dsh plugin --profile web add dsh-output-styles
61
53
 
62
- ```yaml
63
- - id: output-styles-client
64
- name: 'dsh-output-styles/client'
54
+ # 2. restart and verify the row
55
+ dsh --profile web --dump-config | grep -A3 'id: output-styles'
65
56
  ```
66
57
 
67
- ## 🎬 Demo
58
+ ## Demo
68
59
 
69
60
  ```
70
61
  You > /style
@@ -83,7 +74,7 @@ You > 请只用一句话介绍你自己。
83
74
  AI > 我是运行在 DeepSeek Harness 插件化平台上、基于 deepseek-v4-pro 模型的 AI 编码代理。
84
75
  ```
85
76
 
86
- ## 🧠 How it works
77
+ ## How it works
87
78
 
88
79
  ```mermaid
89
80
  flowchart LR
@@ -98,69 +89,47 @@ flowchart LR
98
89
 
99
90
  Everything the model sees is reconstructable from the session log — no new session event type, no agent-loop changes. The style name comes from `command/run`, the exact injected text from `request/header`, and the provenance marker `{ kind: 'plugin', plugin: 'dsh-output-styles' }` rides in the domain record. Styles apply to the main conversation only; subagent sessions keep their own prompts (matching Claude Code).
100
91
 
101
- ## ⚙️ Configuration
92
+ ## Install & uninstall
102
93
 
103
- Every tunable is a validated Schemastery `Config` field (invalid values fail the load):
94
+ - **git channel** (latest `main`): `dsh plugin --profile web add "github:PerryLink/dsh-output-styles#main"` — the `prepare` script builds with production dependencies only.
95
+ - **npm channel** (published releases): `dsh plugin --profile web add dsh-output-styles`.
96
+ - **tarball channel**: `pnpm pack` in this repo, then `dsh plugin --profile web add ./dsh-output-styles-<version>.tgz`.
97
+ - **uninstall**: `dsh plugin --profile web remove dsh-output-styles`.
104
98
 
105
- | Field | Default | Meaning |
106
- |---|---|---|
107
- | `stylesDir` | `[]` | Style-library directories, resolved against cwd; later entries override earlier ones. `[]` = the bundled `styles/` only. A bare string is a single-directory list. |
108
- | `maxStyleChars` | `4000` | Style-body budget (code points, ≥ 1); longer bodies are truncated with a marker. |
109
- | `defaultStyle` | `''` | Style for sessions that never selected one (and no settings default exists); `''` = no style. |
110
- | `compatJson` | `true` | Load Claude Code `outputStyles` JSON entries (single objects or arrays). |
111
- | `sectionOrder` | `90` | Order of the injected section (0 = persona, 100–199 = tool guidance). |
112
- | `truncationMarker` | `"\n\n[style truncated]"` | Marker appended at the truncation point. |
113
- | `includeBuiltins` | `true` | Include the package's bundled `styles/` as the lowest-priority layer. |
114
- | `watchStyles` | `true` | Reload the library when a style file changes on disk. |
115
- | `rules` | `[]` | Per-session/per-tool render rules: `[{ match: { tool?, contentType?, session? }, style, priority? }]` — `style` names a renderer id (built-ins mirror the style names). |
116
- | `enableExport` | `true` | Register the `/export` command (Markdown/HTML session export, renderer-aware). |
117
-
118
- ## 📚 Style library
119
-
120
- <details>
121
- <summary><code>styles/concise.md</code></summary>
122
-
123
- ```markdown
124
- ---
125
- name: concise
126
- description: Terse, direct answers — minimal prose, no preamble.
127
- whenToUse: Daily coding work, tool-heavy sessions, or when prompt length matters.
128
- keep-coding-instructions: true
129
- ---
130
-
131
- You are in the concise output style for this conversation.
132
- - Lead with the direct answer; skip preamble, restatements, and filler.
133
- - 回答语言跟随用户语言:中文提问用中文回答,英文提问用英文回答。
134
- ```
135
-
136
- </details>
99
+ ## Configuration
137
100
 
138
- Frontmatter fields:
101
+ All tunables are Schemastery `Config` fields (changeable from cordis.yml). Invalid values fail the load.
139
102
 
140
- | Field | Default | Meaning |
103
+ | Key | Default | Meaning |
141
104
  |---|---|---|
142
- | `name` | file name | Switch target; letters, digits, spaces, and hyphens (no leading/trailing space; `off` is reserved). |
143
- | `description` | — (required) | One sentence shown in listings and the picker. |
144
- | `whenToUse` | — | Optional guidance appended to listings. |
145
- | `keep-coding-instructions` | `false` | Keep the harness prompt (identity, persona, tool guidance) when `true`; replace it entirely when `false` (Claude Code semantics). |
146
- | `force-for-plugin` | `false` | Claude Code's field: apply unconditionally, overriding any session selection; `force` is accepted as an alias, and at most one style may set it. |
147
-
148
- <details>
149
- <summary>Claude Code <code>outputStyles</code> JSON (<code>compatJson: true</code>)</summary>
150
-
151
- ```json
152
- { "name": "explain", "description": "Explain like a teacher.", "prompt": "Teach in small steps." }
153
- ```
154
-
155
- Entries accept `keep-coding-instructions` and `force-for-plugin` exactly as Claude Code writes them. Legacy `settings.json` arrays (`[{ … }, { … }]`) load as-is; bad entries are skipped with a warning.
156
-
157
- </details>
105
+ | `stylesDir` | `[]` | Style-library directories, resolved against cwd; later entries override earlier ones. `[]` = the bundled `styles/` only |
106
+ | `maxStyleChars` | `4000` | Style-body budget (≥ 1); longer bodies are truncated with a marker |
107
+ | `defaultStyle` | `''` | Style for sessions that never selected one (and no settings default exists); `''` = no style |
108
+ | `compatJson` | `true` | Load Claude Code `outputStyles` JSON entries (single objects or arrays) |
109
+ | `sectionOrder` | `90` | Order of the injected section (0 = persona, 100–199 = tool guidance) |
110
+ | `truncationMarker` | `"\n\n[style truncated]"` | Marker appended at the truncation point |
111
+ | `includeBuiltins` | `true` | Include the package's bundled `styles/` as the lowest-priority layer |
112
+ | `watchStyles` | `true` | Reload the library when a style file changes on disk |
113
+ | `rules` | `[]` | Per-session/per-tool render rules: `[{ match: { tool?, contentType?, session? }, style, priority? }]` |
114
+ | `enableExport` | `true` | Register the `/export` command (Markdown/HTML session export, renderer-aware) |
115
+
116
+ ## Tools & surfaces
117
+
118
+ | Surface | Kind | Notes |
119
+ |---|---|---|
120
+ | `/style` | command | List styles, switch, or restore the project default |
121
+ | `/export` | command | Render the current session to Markdown or sanitized HTML |
122
+ | `output_style` | storage domain | Session-scoped style choice, keyed by sessionId |
123
+ | `systemPrompt.section()` | contribution | Injects the current style body at every assembly |
124
+ | `output.render.*` | renderer registry | `ctx.outputRenderers` + the `output.render/before` waterfall |
125
+ | `style` | projection | `{ options, currentValue }` folded from settled commands |
126
+ | Web picker | client entry | `dsh-output-styles/client` decorates `/style` with a popup picker |
158
127
 
159
- ## ⌨️ Command reference
128
+ ## Command reference
160
129
 
161
130
  | Input | Outcome |
162
131
  |---|---|
163
- | `/style` | List current selection + one line per style (name — description) |
132
+ | `/style` | List the current selection + one line per style (name — description) |
164
133
  | `/style concise` | Switch (durable write), `switched to concise` |
165
134
  | `/style Diagrams first` | Multi-word names are the whole remainder |
166
135
  | `/style off` | Restore the project default (settings default, then `defaultStyle`) |
@@ -169,37 +138,34 @@ Entries accept `keep-coding-instructions` and `force-for-plugin` exactly as Clau
169
138
  | `/export html` | Render to sanitized HTML |
170
139
  | `/export --renderer=concise` | Render with one renderer forced (rules bypassed) |
171
140
 
172
- ## 🎨 Renderer protocol
141
+ ## Style library
173
142
 
174
- The `output.render.*` protocol turns the presentation layer into an extension point. A renderer is a **pure presenter** — `presenter(text, context)` maps args to display data, never touches the DOM — matched by tool name and content type, ordered by priority:
143
+ One Markdown file per style; frontmatter for metadata, body = the model directive. `name` defaults to the file name and may contain spaces (`Diagrams first`).
175
144
 
176
- ```ts
177
- // Third-party plugin registering a custom renderer (register() returns the disposer)
178
- ctx.effect(() => ctx.outputRenderers.register({
179
- id: 'sql-table',
180
- name: 'SQL table compactor',
181
- description: 'Truncates oversized SQL result sets to the head plus a row count.',
182
- match: [{ tool: 'sql', contentType: 'text' }],
183
- priority: 20,
184
- presenter: (text, context) => compactRows(text, 50),
185
- }))
186
- ```
145
+ | Field | Default | Meaning |
146
+ |---|---|---|
147
+ | `name` | file name | Switch target; letters, digits, spaces, and hyphens (`off` is reserved) |
148
+ | `description` | — (required) | One sentence shown in listings and the picker |
149
+ | `whenToUse` | — | Optional guidance appended to listings |
150
+ | `keep-coding-instructions` | `false` | Keep the harness prompt when `true`; replace it when `false` (Claude Code semantics) |
151
+ | `force-for-plugin` | `false` | Apply unconditionally, overriding any session selection; `force` is an alias, at most one style may set it |
187
152
 
188
- - **Waterfall first**: every render request passes through `output.render/before` (`{ text, context }`) — listeners transform the request and **must call `next()`**; returning without it short-circuits the pipeline.
189
- - **Rules**: `rules: [{ match: { tool: 'bash' }, style: 'concise' }]` names the renderer for matching requests (tool, content type, or exact session); ties break by `priority`, then rule order. Rules live in cordis.yml and the `output-style-rules` settings section.
190
- - **Built-ins**: `concise` (whitespace compaction + budget truncation) and `step-by-step` (consistent step numbering) — ids mirror the two headline style names.
191
- - **Auditability**: every render result carries `{ original, rendered, rendererId, changed }`. The rendered text is what surfaces; the original text is the session log itself, and the render application is deterministic — so rendered output and its source always reconstruct together.
192
- - Full protocol reference (including a worked third-party example): [docs/renderer-protocol.md](docs/renderer-protocol.md) (中文: [docs/renderer-protocol.zh.md](docs/renderer-protocol.zh.md)).
153
+ With `compatJson: true`, Claude Code `outputStyles` JSON entries (`{ name, description, prompt }`) load beside Markdown styles; unparseable entries are skipped with a warning.
193
154
 
194
- ## 🖱️ Web picker
155
+ ## Renderer protocol
195
156
 
196
- The `dsh.client` entry decorates the host `/style` command's bare invocation with a popup picker: an "off" row plus one row per library style (`description · whenToUse`), the active row marked. Picking submits `/style <name>` through the command Remote, so every switch keeps the host's durable command lifecycle and the `style` projection stays the single displayed fact. The picker follows the Web UI's shipped `zh`/`en` locale pair.
157
+ The `output.render.*` protocol turns presentation into an extension point. A renderer is a **pure presenter** — `presenter(text, context)` maps args to display data, never touches the DOM — matched by tool name and content type, ordered by priority.
197
158
 
198
- ## 🔍 Conflict check
159
+ - **Waterfall first**: every render request passes through `output.render/before` (`{ text, context }`); listeners must call `next()`.
160
+ - **Rules**: `rules: [{ match: { tool: 'bash' }, style: 'concise' }]` names the renderer for matching requests; ties break by `priority`, then rule order.
161
+ - **Built-ins**: `concise` (whitespace compaction + budget truncation) and `step-by-step` (consistent step numbering).
162
+ - **Auditability**: every render result carries `{ original, rendered, rendererId, changed }`; the rendered text is what surfaces, the original stays reconstructable from the session log.
199
163
 
200
- Screened against the DSH ecosystem before development (2026-08 snapshot): no `style`/`output-style` repository under [topic:dsh-plugin](https://github.com/topics/dsh-plugin), no output-style category in the four major [awesome lists](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin), and no entry in the [dsh-hub catalog](https://github.com/omdsh-dev/dsh-hub-workshop). The closest neighbors — [dsh-soul-md](https://github.com/Scorp1o117/dsh-soul-md) (persona) and [dsh-claude-marketplace](https://github.com/ben7am1n/dsh-claude-marketplace) (output styles explicitly deferred to v0.2+) — are adjacent, not conflicting.
164
+ ## Web picker
165
+
166
+ The `dsh.client` entry decorates the host `/style` command's bare invocation with a popup picker: an "off" row plus one row per library style (`description · whenToUse`), the active row marked. Picking submits `/style <name>` through the command Remote, so every switch keeps the host's durable command lifecycle. The picker follows the Web UI's shipped `zh`/`en` locale pair.
201
167
 
202
- ## 🆚 Differences from Claude Code
168
+ ## Differences from Claude Code
203
169
 
204
170
  | | Claude Code | dsh-output-styles |
205
171
  |---|---|---|
@@ -210,7 +176,29 @@ Screened against the DSH ecosystem before development (2026-08 snapshot): no `st
210
176
  | Subagents | Styles do not apply | Same — subagent sessions keep their own prompts |
211
177
  | Switching | `/config` menu or `outputStyle` setting (the `/output-style` command was removed in v2.1.91) | `/style` command + Web picker + settings `output-style.style` |
212
178
 
213
- ## 🧪 Development
179
+ ## Conflict check
180
+
181
+ Screened against the DSH ecosystem before development (2026-08 snapshot): no `style`/`output-style` repository under [topic:dsh-plugin](https://github.com/topics/dsh-plugin), no output-style category in the four major [awesome lists](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin), and no entry in the [dsh-hub catalog](https://github.com/omdsh-dev/dsh-hub-workshop). The closest neighbors — [dsh-soul-md](https://github.com/Scorp1o117/dsh-soul-md) (persona) and [dsh-claude-marketplace](https://github.com/ben7am1n/dsh-claude-marketplace) (output styles explicitly deferred to v0.2+) — are adjacent, not conflicting.
182
+
183
+ ## Permissions & data
184
+
185
+ - **Permissions**: declares `fs:read`, `fs:watch`, `storage:read`, `storage:write`, and `settings:read` in its workshop manifest.
186
+ - **Data**: the style choice lives in the `output_style` storage domain (keyed by sessionId); no other state is persisted, no network requests.
187
+ - **Session log**: the style name comes from `command/run`, the exact injected text from `request/header`; the provenance marker `{ kind: 'plugin', plugin: 'dsh-output-styles' }` rides in the domain record.
188
+
189
+ ## Security boundaries
190
+
191
+ - **Public services only.** Contributes `systemPrompt`, commands, storage, and settings; no engine / agent-loop / apiproxy / official-UI changes.
192
+ - **Model-visible ⟺ logged.** Everything the model sees is reconstructable from the session log — no new session event type, no agent-loop changes.
193
+ - **Original always kept.** Every render (and `/export`) keeps the original text beside the rendered one; sanitized HTML is used for HTML export.
194
+
195
+ ## Known limitations
196
+
197
+ - **Main conversation only.** Styles apply to the main conversation; subagent sessions keep their own prompts (matching Claude Code).
198
+ - **Truncation.** Style bodies longer than `maxStyleChars` are truncated with a marker.
199
+ - **Skipped style files.** A bad style file is skipped with a warning and never breaks the profile.
200
+
201
+ ## Development
214
202
 
215
203
  ```sh
216
204
  pnpm install
@@ -221,18 +209,16 @@ pnpm run build # lib/ artifacts (host + client bundles)
221
209
  pnpm pack # tarball for dsh plugin add
222
210
  ```
223
211
 
224
- Releases: pushing a `v*` tag whose suffix matches the `package.json` version triggers the Publish workflow — full verification, then an npm publish with provenance. Any `npm publish` also passes the `verify` gate through `prepublishOnly`.
212
+ Releases: pushing a `v*` tag whose suffix matches the `package.json` version triggers the Publish workflow — full verification, then an npm publish with provenance.
225
213
 
226
- Structure follows the [omdsh-dev/plugin-template](https://github.com/omdsh-dev/plugin-template): `src/index.ts` (plugin metadata), `src/config.ts` (schema), `src/runtime.ts` (runtime service + activation), `src/invariant.ts` (invariants), `src/client/` (Web picker), `styles/` (built-ins).
214
+ ## Topics
227
215
 
228
- ## 👥 Contributors
216
+ `deepseek-harness`, `dsh`, `dsh-plugin`, `output-style`, `output-styles`, `claude-code`
229
217
 
230
- Thanks to everyone who helped build this project:
218
+ ## Contributors
231
219
 
232
220
  - [@PerryLink](https://github.com/PerryLink) — author and maintainer: plugin architecture, style library, bundle install, Web picker, five-language docs, and CI/release tooling.
233
221
 
234
- Found a bug or an idea? Open an [issue](https://github.com/PerryLink/dsh-output-styles/issues) or send a [pull request](https://github.com/PerryLink/dsh-output-styles/pulls) — contributions in any language are welcome.
235
-
236
222
  ## PerryLink DSH Plugin Family
237
223
 
238
224
  This project is one of the [15 DeepSeek Harness plugins](https://github.com/PerryLink) maintained by [PerryLink](https://github.com/PerryLink). If this one helps you, the others likely will too:
@@ -255,10 +241,6 @@ This project is one of the [15 DeepSeek Harness plugins](https://github.com/Perr
255
241
  | [dsh-plugin-guide](https://github.com/PerryLink/dsh-plugin-guide) | Plugin-development knowledge base as an on-demand agent skill |
256
242
  | [dsh-claude-move](https://github.com/PerryLink/dsh-claude-move) | Migrate Claude Code sessions, memory, skills and CLAUDE.md into DSH |
257
243
 
258
- ## 📄 License
259
-
260
- [Apache-2.0](LICENSE) © 2026 dsh-output-styles contributors
261
-
262
- ---
244
+ ## License
263
245
 
264
- <sub>Topics: `dsh` · `dsh-plugin` · `deepseek-harness` · `output-styles` · `claude-code`</sub>
246
+ [Apache License 2.0](LICENSE) © 2026 dsh-output-styles contributors
package/README.pt.md ADDED
@@ -0,0 +1,246 @@
1
+ <div align="center">
2
+
3
+ # 🎨 dsh-output-styles
4
+
5
+ **O `outputStyles` do Claude Code para o DeepSeek Harness**: alterne o estilo de saída do modelo em tempo de execução, por sessão, de forma durável.
6
+
7
+ *`/style concise` — e a partir de agora toda resposta é concisa. `/style off` — de volta ao padrão do projeto.*
8
+
9
+ [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)
10
+ [![DSH plugin](https://img.shields.io/badge/dsh-plugin-✅-green)](https://github.com/topics/dsh-plugin)
11
+ [![Node](https://img.shields.io/badge/node-%5E22.19%20%7C%7C%20%3E%3D24-brightgreen.svg)](#)
12
+ [![CI](https://img.shields.io/github/actions/workflow/status/PerryLink/dsh-output-styles/ci.yml?branch=main&label=CI)](https://github.com/PerryLink/dsh-output-styles/actions)
13
+ [![Version](https://img.shields.io/github/v/tag/PerryLink/dsh-output-styles?label=version)](https://github.com/PerryLink/dsh-output-styles/releases)
14
+ [![npm version](https://img.shields.io/npm/v/dsh-output-styles)](https://www.npmjs.com/package/dsh-output-styles)
15
+ [![npm downloads](https://img.shields.io/npm/dm/dsh-output-styles)](https://www.npmjs.com/package/dsh-output-styles)
16
+
17
+ [English](README.md) · [简体中文](README.zh.md) · [Español](README.es.md) · [Português](README.pt.md) · [हिन्दी](README.hi.md)
18
+
19
+ </div>
20
+
21
+ ---
22
+
23
+ ## Compatibility
24
+
25
+ | Surface | Status |
26
+ |---|---|
27
+ | Harness | DeepSeek Harness `0.1.0-rc.8` |
28
+ | Node | `^22.19.0 || >=24.0.0` |
29
+ | Platforms | Todas (host + cliente web) |
30
+ | Model | Qualquer (injeção no prompt do sistema) |
31
+
32
+ ## What you get
33
+
34
+ O `dsh-output-styles` é o equivalente do `outputStyles` do Claude Code para o DeepSeek Harness: um comando `/style` que alterna o estilo de saída do modelo em tempo de execução, persistido por sessão e injetado a cada montagem do prompt.
35
+
36
+ - **Biblioteca de estilos** — um arquivo Markdown por estilo (`styles/*.md`); frontmatter para metadados, corpo = a diretiva do modelo. Seis estilos integrados (`concise`, `explanatory`, `formal`, `learning`, `proactive`, `step-by-step`), incluindo `proactive` e `learning` com paridade Claude Code.
37
+ - **Comando `/style`** — sem argumento lista os estilos (com descrições) e a seleção atual; `/style <name>` alterna; `/style off` restaura o padrão do projeto.
38
+ - **Persistência por sessão** — a escolha vive no domínio de armazenamento `output_style`, indexada por sessionId, e sobrevive a reinícios.
39
+ - **Injeção no prompt do sistema** — uma contribuição `systemPrompt.section()` (ordem `sectionOrder`) injeta o corpo do estilo atual a cada montagem, truncado em um orçamento configurável.
40
+ - **Paridade Claude Code** — `keep-coding-instructions`, `force-for-plugin` (alias `force`), compatibilidade JSON `outputStyles`, diretórios `stylesDir` em camadas, recarga a quente e fallback do projeto sobre a costura de settings do DSH.
41
+ - **Registro de renderers (`output.render.*`)** — `ctx.outputRenderers` permite a qualquer plugin registrar um presenter puro, aplicado pela cascata `output.render/before`; renderers integrados `concise` e `step-by-step`.
42
+ - **Regras por sessão/por ferramenta** — `rules: [{ match: { tool: 'bash' }, style: 'concise' }]` nomeiam o renderer para solicitações coincidentes; editáveis pela seção de settings `output-style-rules`.
43
+ - **`/export`** — renderiza a sessão atual para Markdown ou HTML saneado pela pipeline de render; cada render mantém o texto original ao lado do renderizado.
44
+
45
+ ## Quick start
46
+
47
+ ```sh
48
+ # 1. install the bundle into your profile
49
+ dsh plugin --profile web add "github:PerryLink/dsh-output-styles#main"
50
+
51
+ # or from npm (published releases)
52
+ dsh plugin --profile web add dsh-output-styles
53
+
54
+ # 2. restart and verify the row
55
+ dsh --profile web --dump-config | grep -A3 'id: output-styles'
56
+ ```
57
+
58
+ ## Demo
59
+
60
+ ```
61
+ You > /style
62
+ output style off
63
+ concise — Terse, direct answers — minimal prose, no preamble. (Daily coding work, tool-heavy sessions, or when prompt length matters.)
64
+ explanatory — Educational answers with short "Insights" that teach as you work. (Learning a codebase, onboarding, …)
65
+ formal — Formal, precise prose with complete sentences and defined terms. (Reports, documentation, release notes, …)
66
+ learning — Collaborative learn-by-doing mode with short "Insights" and small hands-on steps for the user. (Pairing, onboarding, …)
67
+ proactive — Execute immediately, assume reasonable defaults, and prefer action over planning. (Routine multi-step work, …)
68
+ step-by-step — Numbered reasoning steps with explicit intermediate results. (Debugging, design decisions, …)
69
+
70
+ You > /style concise
71
+ switched to concise
72
+
73
+ You > 请只用一句话介绍你自己。
74
+ AI > 我是运行在 DeepSeek Harness 插件化平台上、基于 deepseek-v4-pro 模型的 AI 编码代理。
75
+ ```
76
+
77
+ ## How it works
78
+
79
+ ```mermaid
80
+ flowchart LR
81
+ U[You type /style concise] --> C[command registry]
82
+ C -->|command/run logged| L[(session log)]
83
+ C -->|put {style, source}| D[(output_style domain)]
84
+ D --> R[OutputStyleRuntime]
85
+ R -->|body at every assembly| S[systemPrompt section order 90]
86
+ S --> M[Model request]
87
+ M -->|full system prompt| H[request/header logged]
88
+ ```
89
+
90
+ Tudo o que o modelo vê é reconstruível a partir do log de sessão — sem novo tipo de evento de sessão, sem alterações no agent-loop. O nome do estilo vem de `command/run`, o texto exato injetado de `request/header`, e o marcador de procedência `{ kind: 'plugin', plugin: 'dsh-output-styles' }` viaja no registro do domínio. Os estilos se aplicam apenas à conversa principal; sessões de subagente mantêm seus próprios prompts (como no Claude Code).
91
+
92
+ ## Install & uninstall
93
+
94
+ - **canal git** (último `main`): `dsh plugin --profile web add "github:PerryLink/dsh-output-styles#main"` — o script `prepare` compila apenas com dependências de produção.
95
+ - **canal npm** (versões publicadas): `dsh plugin --profile web add dsh-output-styles`.
96
+ - **canal tarball**: `pnpm pack` neste repo, depois `dsh plugin --profile web add ./dsh-output-styles-<version>.tgz`.
97
+ - **desinstalar**: `dsh plugin --profile web remove dsh-output-styles`.
98
+
99
+ ## Configuration
100
+
101
+ Todos os parâmetros são campos Schemastery `Config` (alteráveis pelo cordis.yml). Valores inválidos falham a carga.
102
+
103
+ | Key | Default | Meaning |
104
+ |---|---|---|
105
+ | `stylesDir` | `[]` | Diretórios da biblioteca, resolvidos contra o cwd; entradas posteriores sobrescrevem as anteriores. `[]` = somente os `styles/` integrados |
106
+ | `maxStyleChars` | `4000` | Orçamento do corpo do estilo (≥ 1); corpos mais longos são truncados com um marcador |
107
+ | `defaultStyle` | `''` | Estilo para sessões que nunca escolheram um (e sem padrão em settings); `''` = sem estilo |
108
+ | `compatJson` | `true` | Carregar entradas JSON `outputStyles` do Claude Code (objetos avulsos ou arrays) |
109
+ | `sectionOrder` | `90` | Ordem da seção injetada (0 = persona, 100–199 = guia de ferramentas) |
110
+ | `truncationMarker` | `"\n\n[style truncated]"` | Marcador anexado no ponto de truncamento |
111
+ | `includeBuiltins` | `true` | Incluir os `styles/` do pacote como camada de menor prioridade |
112
+ | `watchStyles` | `true` | Recarregar a biblioteca quando um arquivo de estilo muda em disco |
113
+ | `rules` | `[]` | Regras de render por sessão/ferramenta: `[{ match: { tool?, contentType?, session? }, style, priority? }]` |
114
+ | `enableExport` | `true` | Registrar o comando `/export` (exportação de sessão Markdown/HTML, ciente do renderer) |
115
+
116
+ ## Tools & surfaces
117
+
118
+ | Surface | Kind | Notes |
119
+ |---|---|---|
120
+ | `/style` | command | Lista estilos, alterna ou restaura o padrão do projeto |
121
+ | `/export` | command | Renderiza a sessão atual para Markdown ou HTML saneado |
122
+ | `output_style` | storage domain | Escolha de estilo por sessão, indexada por sessionId |
123
+ | `systemPrompt.section()` | contribution | Injeta o corpo do estilo atual a cada montagem |
124
+ | `output.render.*` | renderer registry | `ctx.outputRenderers` + a cascata `output.render/before` |
125
+ | `style` | projection | `{ options, currentValue }` dobrado a partir de comandos assentados |
126
+ | Web picker | client entry | `dsh-output-styles/client` decora `/style` com um seletor pop-up |
127
+
128
+ ## Command reference
129
+
130
+ | Input | Outcome |
131
+ |---|---|
132
+ | `/style` | Lista a seleção atual + uma linha por estilo (nome — descrição) |
133
+ | `/style concise` | Alterna (escrita durável), `switched to concise` |
134
+ | `/style Diagrams first` | Nomes com várias palavras são o restante inteiro |
135
+ | `/style off` | Restaura o padrão do projeto (default de settings, depois `defaultStyle`) |
136
+ | `/style nope` | `error: unknown output style "nope" (available: …)` |
137
+ | `/export` | Renderiza a sessão atual para Markdown pela pipeline de render |
138
+ | `/export html` | Renderiza para HTML saneado |
139
+ | `/export --renderer=concise` | Renderiza forçando um renderer (regras ignoradas) |
140
+
141
+ ## Style library
142
+
143
+ Um arquivo Markdown por estilo; frontmatter para metadados, corpo = a diretiva do modelo. `name` toma por padrão o nome do arquivo e pode conter espaços (`Diagrams first`).
144
+
145
+ | Field | Default | Meaning |
146
+ |---|---|---|
147
+ | `name` | nome do arquivo | Alvo da alternância; letras, dígitos, espaços e hífens (`off` é reservado) |
148
+ | `description` | — (obrigatório) | Uma frase exibida nas listagens e no seletor |
149
+ | `whenToUse` | — | Orientação opcional anexada às listagens |
150
+ | `keep-coding-instructions` | `false` | Manter o prompt do harness quando `true`; substituí-lo quando `false` (semântica Claude Code) |
151
+ | `force-for-plugin` | `false` | Aplicar incondicionalmente, sobrescrevendo qualquer seleção de sessão; `force` é um alias, no máximo um estilo pode defini-lo |
152
+
153
+ Com `compatJson: true`, entradas JSON `outputStyles` do Claude Code (`{ name, description, prompt }`) carregam ao lado dos estilos Markdown; entradas não analisáveis são omitidas com um aviso.
154
+
155
+ ## Renderer protocol
156
+
157
+ O protocolo `output.render.*` transforma a apresentação em um ponto de extensão. Um renderer é um **presenter puro** — `presenter(text, context)` mapeia argumentos para dados de exibição, nunca toca o DOM — emparelhado por nome de ferramenta e tipo de conteúdo, ordenado por prioridade.
158
+
159
+ - **Waterfall primeiro**: toda solicitação de render passa por `output.render/before` (`{ text, context }`); os listeners devem chamar `next()`.
160
+ - **Rules**: `rules: [{ match: { tool: 'bash' }, style: 'concise' }]` nomeia o renderer para solicitações coincidentes; empates se resolvem por `priority` e depois pela ordem da regra.
161
+ - **Built-ins**: `concise` (compactação de espaços + truncamento por orçamento) e `step-by-step` (numeração de passos consistente).
162
+ - **Auditabilidade**: cada resultado de render carrega `{ original, rendered, rendererId, changed }`; o texto renderizado é o que aparece, o original permanece reconstruível a partir do log de sessão.
163
+
164
+ ## Web picker
165
+
166
+ A entrada `dsh.client` decora a invocação nua do comando `/style` com um seletor pop-up: uma linha "off" mais uma linha por estilo da biblioteca (`description · whenToUse`), com a linha ativa marcada. Escolher envia `/style <name>` pelo Remote de comandos, de modo que cada alternância mantém o ciclo de vida durável do comando host. O seletor segue o par de idiomas `zh`/`en` da Web UI.
167
+
168
+ ## Differences from Claude Code
169
+
170
+ | | Claude Code | dsh-output-styles |
171
+ |---|---|---|
172
+ | Arquivos de estilo | `.claude/output-styles` em níveis usuário/projeto/gerenciado | diretórios `stylesDir` + `styles/` integrados, vence o diretório posterior |
173
+ | Estilos personalizados | Markdown, frontmatter `name`/`description`/`keep-coding-instructions`/`force-for-plugin` | Mesmos campos (`force-for-plugin` aceito textualmente, `force` como alias) + `whenToUse` |
174
+ | JSON legado | array `outputStyles` em `settings.json` | Carregado textualmente (`compatJson: true`) |
175
+ | Quando entra em vigor | Após `/clear` ou uma sessão nova | Imediatamente — o prompt do sistema se remonta por solicitação |
176
+ | Subagentes | Estilos não se aplicam | Igual — sessões de subagente mantêm seus próprios prompts |
177
+ | Alternância | menu `/config` ou ajuste `outputStyle` (o comando `/output-style` foi removido na v2.1.91) | comando `/style` + Web picker + settings `output-style.style` |
178
+
179
+ ## Conflict check
180
+
181
+ Filtrado contra o ecossistema DSH antes do desenvolvimento (instantânea 2026-08): nenhum repositório `style`/`output-style` sob [topic:dsh-plugin](https://github.com/topics/dsh-plugin), nenhuma categoria de output-style nas quatro principais [awesome lists](https://github.com/awesome-dsh-plugin/awesome-dsh-plugin), e nenhuma entrada no [catálogo dsh-hub](https://github.com/omdsh-dev/dsh-hub-workshop). Os vizinhos mais próximos — [dsh-soul-md](https://github.com/Scorp1o117/dsh-soul-md) (persona) e [dsh-claude-marketplace](https://github.com/ben7am1n/dsh-claude-marketplace) (estilos de saída diferidos explicitamente para v0.2+) — são adjacentes, não conflitantes.
182
+
183
+ ## Permissions & data
184
+
185
+ - **Permissions**: o manifesto de workshop declara `fs:read`, `fs:watch`, `storage:read`, `storage:write` e `settings:read`.
186
+ - **Data**: a escolha de estilo vive no domínio de armazenamento `output_style` (indexada por sessionId); nenhum outro estado é persistido, sem solicitações de rede.
187
+ - **Session log**: o nome do estilo vem de `command/run`, o texto exato injetado de `request/header`; o marcador de procedência `{ kind: 'plugin', plugin: 'dsh-output-styles' }` viaja no registro do domínio.
188
+
189
+ ## Security boundaries
190
+
191
+ - **Somente serviços públicos.** Contribui `systemPrompt`, comandos, armazenamento e settings; sem alterações em engine / agent-loop / apiproxy / UI oficial.
192
+ - **Visível para o modelo ⟺ registrado.** Tudo o que o modelo vê é reconstruível a partir do log de sessão — sem novo tipo de evento de sessão, sem alterações no agent-loop.
193
+ - **Original sempre conservado.** Cada render (e `/export`) mantém o texto original ao lado do renderizado; a exportação HTML usa HTML saneado.
194
+
195
+ ## Known limitations
196
+
197
+ - **Somente conversa principal.** Os estilos se aplicam à conversa principal; sessões de subagente mantêm seus próprios prompts (como no Claude Code).
198
+ - **Truncamento.** Corpos de estilo mais longos que `maxStyleChars` são truncados com um marcador.
199
+ - **Arquivos omitidos.** Um arquivo de estilo defeituoso é omitido com um aviso e nunca quebra o profile.
200
+
201
+ ## Development
202
+
203
+ ```sh
204
+ pnpm install
205
+ pnpm run typecheck # ambos os projetos tsc
206
+ pnpm test # vitest — 107 tests
207
+ pnpm run verify # typecheck + tests + self-contained (a porta de prepublishOnly)
208
+ pnpm run build # artefatos lib/ (bundles host + client)
209
+ pnpm pack # tarball para dsh plugin add
210
+ ```
211
+
212
+ Lançamentos: empurrar uma etiqueta `v*` cujo sufixo coincide com a versão de `package.json` dispara o workflow Publish — verificação completa e depois publicação no npm com procedência.
213
+
214
+ ## Topics
215
+
216
+ `deepseek-harness`, `dsh`, `dsh-plugin`, `output-style`, `output-styles`, `claude-code`
217
+
218
+ ## Contributors
219
+
220
+ - [@PerryLink](https://github.com/PerryLink) — autor e mantenedor: arquitetura do plugin, biblioteca de estilos, instalação de bundle, Web picker, documentação em cinco idiomas e ferramentas de CI/lançamento.
221
+
222
+ ## PerryLink DSH Plugin Family
223
+
224
+ Este projeto é um dos [15 plugins do DeepSeek Harness](https://github.com/PerryLink) mantidos por [PerryLink](https://github.com/PerryLink). Se este te ajuda, os demais provavelmente também:
225
+
226
+ | Plugin | One-liner |
227
+ |---|---|
228
+ | [dsh-mcp-panel](https://github.com/PerryLink/dsh-mcp-panel) | Read-only MCP runtime panel: /mcp command + Settings tab with status, tools and errors |
229
+ | [dsh-doublecheck](https://github.com/PerryLink/dsh-doublecheck) | Engineering-discipline guard: requirements grill, test gates, adversary review |
230
+ | [dsh-background-agents](https://github.com/PerryLink/dsh-background-agents) | Durable background child agents with a Web UI sidebar, messaging and interrupt |
231
+ | [dsh-lsp-actions](https://github.com/PerryLink/dsh-lsp-actions) | LSP diagnostics, formatting, completion, code actions and rename over language servers |
232
+ | **[dsh-output-styles](https://github.com/PerryLink/dsh-output-styles)** | Claude Code outputStyles-equivalent runtime style switching |
233
+ | [dsh-checkpoint-rewind](https://github.com/PerryLink/dsh-checkpoint-rewind) | Claude Code /rewind-equivalent: snapshots, session forks, one-shot restore |
234
+ | [dsh-permission-rules](https://github.com/PerryLink/dsh-permission-rules) | Claude Code-style declarative allow/deny/ask permission rules with audit |
235
+ | [dsh-auto-review](https://github.com/PerryLink/dsh-auto-review) | Second-model auto-review on the approval chain, fail-closed by default |
236
+ | [dsh-memento](https://github.com/PerryLink/dsh-memento) | Approval-gated cross-session memory: ctx.memory seam + SQLite + memory tool |
237
+ | [dsh-skill-pack-security](https://github.com/PerryLink/dsh-skill-pack-security) | Security-audit skill pack: secret scan, dependency and supply-chain review |
238
+ | [dsh-session-pin](https://github.com/PerryLink/dsh-session-pin) | Pin sessions in the Web sidebar with durable ordering |
239
+ | [dsh-composer-history](https://github.com/PerryLink/dsh-composer-history) | Terminal-style input history for the web composer: arrows, Ctrl+R search |
240
+ | [dsh-github](https://github.com/PerryLink/dsh-github) | GitHub PR/issues integration for DSH, every write gated by approval |
241
+ | [dsh-plugin-guide](https://github.com/PerryLink/dsh-plugin-guide) | Plugin-development knowledge base as an on-demand agent skill |
242
+ | [dsh-claude-move](https://github.com/PerryLink/dsh-claude-move) | Migrate Claude Code sessions, memory, skills and CLAUDE.md into DSH |
243
+
244
+ ## License
245
+
246
+ [Apache License 2.0](LICENSE) © 2026 dsh-output-styles contributors