@sagmans/dsh-plannotator 0.2.0 → 0.3.1

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,7 +4,7 @@ Browser review for the DeepSeek Harness terminal profile: read a plan, a
4
4
  document, or a code change in [Plannotator](https://github.com/plannotator/plannotator)'s
5
5
  interface, then send what you think back to the agent — without leaving the TUI.
6
6
 
7
- ```
7
+ ```text
8
8
  /plannotator-plan review this session's plan
9
9
  /plannotator-review review the worktree or a pull request
10
10
  /plannotator-annotate annotate a file, a folder, or a URL
@@ -26,9 +26,11 @@ still works exactly as before.
26
26
 
27
27
  ## Requirements
28
28
 
29
- - DeepSeek Harness `0.1.5-rc.1` or newer, `0.3.0` or older. The releases
30
- driven against a real profile are `0.1.5-rc.2`, `0.1.5-rc.3`, `0.1.7-rc.2`, and
31
- `0.2.0-rc.2`; `package.json` `dsh.compatibility.dshReleases` lists them.
29
+ - DeepSeek Harness `0.1.5-rc.1` or newer, older than `0.3.0` and its
30
+ prereleases. The releases driven against a real profile are `0.1.5-rc.2`,
31
+ `0.1.5-rc.3`, `0.1.7-rc.2`, `0.2.0-rc.2`, `0.2.1-rc.2`, `0.2.1-rc.3`,
32
+ `0.2.1-rc.5`, `0.2.2-rc.1`, and `0.2.2-rc.5`; `package.json`
33
+ `dsh.compatibility.dshReleases` lists them.
32
34
  - The `plannotator` CLI on `PATH`, or pointed at by configuration. Install it
33
35
  the way its own documentation describes; this plugin never downloads it.
34
36
  - A browser on the machine that runs the CLI. For a remote host, either forward
@@ -174,3 +176,29 @@ composition fault, not a review fault: the reviewer's words did arrive.
174
176
  ## License
175
177
 
176
178
  MIT
179
+
180
+ ## Git hooks
181
+
182
+ Checks run in tracked local Git hooks instead of push/PR CI. Run
183
+ `scripts/setup-hooks` once after cloning; it points this clone's
184
+ `core.hooksPath` at `.githooks`. Each hook runs the generic checks first
185
+ (sign-off and commit message format, a gitleaks secret scan, and signed,
186
+ signed-off commits on push), then this repository's checks in
187
+ `.githooks/<hook>.d/` in name order. Install
188
+ [gitleaks](https://github.com/gitleaks/gitleaks) first. Every check must pass
189
+ before you push; never use `--no-verify`. Pre-push checks test exactly each
190
+ pushed commit: in place only when it is the clean, unmodified checkout,
191
+ otherwise in a temporary worktree of that commit.
192
+
193
+ This repository's checks:
194
+
195
+ - `pre-commit`: staged whitespace and conflict-marker check.
196
+ - `pre-push`: `npm audit signatures`, `pnpm run check`,
197
+ `pnpm audit --audit-level high`, and a warning when the harness registry
198
+ serves an unverified `latest`.
199
+
200
+ A pushed change to `pnpm-workspace.yaml`'s build policy, or a lockfile change to
201
+ a package allowed to build (`node-pty`), makes `pre-push` print a warning that
202
+ names each change. The push continues. List those changes in the push approval
203
+ request, so the maintainer reviews them before the push. Commits carry no
204
+ trailer other than `Signed-off-by`.
package/dist/args.js CHANGED
@@ -11,7 +11,7 @@
11
11
  *
12
12
  * @module dsh-plannotator/args
13
13
  */
14
- import { CLI_ANNOTATE, CLI_ANNOTATE_LAST, CLI_REVIEW, FLAG_APP, FLAG_BASE, FLAG_DIFF_TYPE, FLAG_GATE, FLAG_GIT, FLAG_GITBUTLER, FLAG_JSON, FLAG_LOCAL, FLAG_MARKDOWN, FLAG_NO_GIT_REMOTE_CHECK, FLAG_NO_JINA, FLAG_NO_LOCAL, FLAG_RENDER_HTML, FLAG_REQUIRE_APPROVAL, FLAG_STATIC, FLAG_STDIN, FLAG_TAILSCALE, } from "./constants.js";
14
+ import { CLI_ANNOTATE, CLI_ANNOTATE_LAST, CLI_REVIEW, FLAG_APP, FLAG_BASE, FLAG_DIFF_TYPE, FLAG_GATE, FLAG_GIT, FLAG_GITBUTLER, FLAG_JSON, FLAG_LOCAL, FLAG_MARKDOWN, FLAG_NO_GIT_REMOTE_CHECK, FLAG_NO_JINA, FLAG_NO_LOCAL, FLAG_RENDER_HTML, FLAG_REQUIRE_APPROVAL, FLAG_STATIC, FLAG_STDIN, FLAG_TAILSCALE, } from './constants.js';
15
15
  /** Flags `plannotator review` accepts from a typed line. */
16
16
  export const REVIEW_FLAGS = [
17
17
  { flag: FLAG_GIT, takesValue: false },
@@ -58,13 +58,13 @@ export function parseTypedLine(tokens, allowlist) {
58
58
  const spec = byName.get(token);
59
59
  if (spec === undefined) {
60
60
  const accepted = allowlist.map((entry) => entry.flag).join(' ');
61
- return { ok: false, error: 'unknown option ' + token + '; accepted: ' + accepted };
61
+ return { ok: false, error: `unknown option ${token}; accepted: ${accepted}` };
62
62
  }
63
63
  flags.push(token);
64
64
  if (spec.takesValue) {
65
65
  const value = tokens[index + 1];
66
66
  if (value === undefined)
67
- return { ok: false, error: token + ' requires a value' };
67
+ return { ok: false, error: `${token} requires a value` };
68
68
  flags.push(value);
69
69
  index += 1;
70
70
  }
package/dist/binary.js CHANGED
@@ -8,10 +8,9 @@
8
8
  *
9
9
  * @module dsh-plannotator/binary
10
10
  */
11
- import { constants as fsConstants, statSync } from 'node:fs';
12
- import { accessSync } from 'node:fs';
11
+ import { accessSync, constants as fsConstants, statSync } from 'node:fs';
13
12
  import { delimiter, isAbsolute, resolve } from 'node:path';
14
- import { BINARY_ENV } from "./constants.js";
13
+ import { BINARY_ENV } from './constants.js';
15
14
  /** The environment name the resolved binary is reported under, so a failure is actionable. */
16
15
  const SEARCH_ORDER = `config.binary, $${BINARY_ENV}, then PATH`;
17
16
  /** True when anyone but the owner may write the file. */
package/dist/cli.js CHANGED
@@ -11,7 +11,7 @@
11
11
  * @module dsh-plannotator/cli
12
12
  */
13
13
  import { spawn } from 'node:child_process';
14
- import { KILL_GRACE_MS, STREAM_CAP_BYTES } from "./constants.js";
14
+ import { KILL_GRACE_MS, STREAM_CAP_BYTES } from './constants.js';
15
15
  /** Collects a stream while keeping memory bounded. */
16
16
  class StreamCapture {
17
17
  chunks = [];
@@ -97,14 +97,32 @@ export function runPlannotator(request) {
97
97
  });
98
98
  child.on('close', (code, signal) => {
99
99
  if (cancelled) {
100
- finish({ kind: 'exited', code: code ?? -1, cancelled: true, stdout: stdout.snapshot(), stderr: stderr.snapshot() });
100
+ finish({
101
+ kind: 'exited',
102
+ code: code ?? -1,
103
+ cancelled: true,
104
+ stdout: stdout.snapshot(),
105
+ stderr: stderr.snapshot(),
106
+ });
101
107
  return;
102
108
  }
103
109
  if (code === null) {
104
- finish({ kind: 'signalled', signal, cancelled: false, stdout: stdout.snapshot(), stderr: stderr.snapshot() });
110
+ finish({
111
+ kind: 'signalled',
112
+ signal,
113
+ cancelled: false,
114
+ stdout: stdout.snapshot(),
115
+ stderr: stderr.snapshot(),
116
+ });
105
117
  return;
106
118
  }
107
- finish({ kind: 'exited', code, cancelled: false, stdout: stdout.snapshot(), stderr: stderr.snapshot() });
119
+ finish({
120
+ kind: 'exited',
121
+ code,
122
+ cancelled: false,
123
+ stdout: stdout.snapshot(),
124
+ stderr: stderr.snapshot(),
125
+ });
108
126
  });
109
127
  if (request.signal !== undefined) {
110
128
  if (request.signal.aborted)
package/dist/commands.js CHANGED
@@ -12,16 +12,16 @@
12
12
  */
13
13
  import { existsSync, statSync } from 'node:fs';
14
14
  import { isAbsolute, resolve } from 'node:path';
15
- import { ANNOTATE_FLAGS, buildAnnotateArgs, buildAnnotateLastArgs, buildReviewArgs, classifyTarget, parseTypedLine, REVIEW_FLAGS, } from "./args.js";
16
- import { NODE_BINARY_PROBE, resolveBinary, } from "./binary.js";
17
- import { runPlannotator } from "./cli.js";
18
- import { resolveDataDir, resolvePlansDir, } from "./config.js";
19
- import { COMMAND_ANNOTATE, COMMAND_LAST, COMMAND_PLAN, COMMAND_REVIEW, } from "./constants.js";
20
- import { outcomeFromAnnotate, outcomeFromAnnotateLast, outcomeFromReview, } from "./decisions.js";
21
- import { feedbackFor, steerText } from "./feedback.js";
22
- import { newestPlan } from "./plan-source.js";
23
- import { newestAssistantText } from "./transcript.js";
24
- import { planSnapshotPath, writePlanSnapshot } from "./workspace.js";
15
+ import { ANNOTATE_FLAGS, buildAnnotateArgs, buildAnnotateLastArgs, buildReviewArgs, classifyTarget, parseTypedLine, REVIEW_FLAGS, } from './args.js';
16
+ import { NODE_BINARY_PROBE, resolveBinary } from './binary.js';
17
+ import { runPlannotator } from './cli.js';
18
+ import { resolveDataDir, resolvePlansDir } from './config.js';
19
+ import { COMMAND_ANNOTATE, COMMAND_LAST, COMMAND_PLAN, COMMAND_REVIEW } from './constants.js';
20
+ import { outcomeFromAnnotate, outcomeFromAnnotateLast, outcomeFromReview, } from './decisions.js';
21
+ import { feedbackFor, steerText } from './feedback.js';
22
+ import { newestPlan } from './plan-source.js';
23
+ import { newestAssistantText } from './transcript.js';
24
+ import { planSnapshotPath, writePlanSnapshot } from './workspace.js';
25
25
  /** The session's working directory, which is what the review must run against. */
26
26
  function sessionCwd(agent) {
27
27
  const cwd = agent.session.header.cwd;
@@ -36,10 +36,10 @@ function notice(surface, outcome, steered) {
36
36
  const approved = outcome.decision === 'approved';
37
37
  const subject = surface === 'plan' ? 'plan' : surface === 'review' ? 'code review' : 'annotation';
38
38
  if (approved)
39
- return subject + ' approved';
39
+ return `${subject} approved`;
40
40
  if (steered)
41
- return subject + ' feedback sent to the agent';
42
- return subject + ' closed without feedback';
41
+ return `${subject} feedback sent to the agent`;
42
+ return `${subject} closed without feedback`;
43
43
  }
44
44
  /**
45
45
  * Run one review and report it.
@@ -50,7 +50,10 @@ function notice(surface, outcome, steered) {
50
50
  async function runOne(options) {
51
51
  const { ctx, deps, agent, surface } = options;
52
52
  if (options.busy.current) {
53
- return { kind: 'error', text: 'a plannotator review is already open; finish it before starting another' };
53
+ return {
54
+ kind: 'error',
55
+ text: 'a plannotator review is already open; finish it before starting another',
56
+ };
54
57
  }
55
58
  const cwd = sessionCwd(agent);
56
59
  const resolution = resolveBinary({
@@ -62,7 +65,7 @@ async function runOne(options) {
62
65
  probe: deps.probe,
63
66
  });
64
67
  if (!resolution.ok) {
65
- return { kind: 'error', text: 'plannotator: ' + resolution.reason };
68
+ return { kind: 'error', text: `plannotator: ${resolution.reason}` };
66
69
  }
67
70
  // The command's own signal is not enough: unloading the plugin has to stop a
68
71
  // review too, so one controller owns the child for both cancellation paths.
@@ -87,7 +90,7 @@ async function runOne(options) {
87
90
  const mapped = options.map(result);
88
91
  if (!mapped.ok) {
89
92
  ctx.logger.warn(`${surface} review failed: ${mapped.error}`);
90
- return { kind: 'error', text: 'plannotator: ' + mapped.error };
93
+ return { kind: 'error', text: `plannotator: ${mapped.error}` };
91
94
  }
92
95
  const message = deps.config.steerFeedback
93
96
  ? feedbackFor(mapped.outcome, options.target, deps.config.approveNotes)
@@ -113,10 +116,10 @@ async function runOne(options) {
113
116
  function existingPath(cwd, token, want) {
114
117
  const path = resolveTypedPath(cwd, token);
115
118
  if (!existsSync(path))
116
- return { ok: false, error: path + ' does not exist' };
119
+ return { ok: false, error: `${path} does not exist` };
117
120
  const facts = statSync(path);
118
121
  if (want === 'file' && !facts.isFile())
119
- return { ok: false, error: path + ' is not a file' };
122
+ return { ok: false, error: `${path} is not a file` };
120
123
  return { ok: true, path };
121
124
  }
122
125
  /** Enforce the input bound before anything is written or piped. */
@@ -153,11 +156,14 @@ export function registerPlannotatorCommands(ctx, deps) {
153
156
  return { kind: 'error', text: parsed.error };
154
157
  const operand = singleOperand(parsed.value);
155
158
  if (operand === null)
156
- return { kind: 'error', text: 'usage: /' + COMMAND_PLAN + ' [file.md]' };
159
+ return { kind: 'error', text: `usage: /${COMMAND_PLAN} [file.md]` };
157
160
  let target;
158
161
  if (operand !== undefined) {
159
162
  if (classifyTarget(operand) !== 'path') {
160
- return { kind: 'error', text: 'usage: /' + COMMAND_PLAN + ' [file.md] — a URL has no plan to review' };
163
+ return {
164
+ kind: 'error',
165
+ text: `usage: /${COMMAND_PLAN} [file.md] — a URL has no plan to review`,
166
+ };
161
167
  }
162
168
  const vetted = existingPath(sessionCwd(invocation.agent), operand, 'file');
163
169
  if (!vetted.ok)
@@ -169,17 +175,20 @@ export function registerPlannotatorCommands(ctx, deps) {
169
175
  if (plan === undefined) {
170
176
  return {
171
177
  kind: 'error',
172
- text: 'no plan in this session yet; pass a markdown file: /' + COMMAND_PLAN + ' plan.md',
178
+ text: `no plan in this session yet; pass a markdown file: /${COMMAND_PLAN} plan.md`,
173
179
  };
174
180
  }
175
181
  if (oversize(plan, deps.config.maxInputBytes)) {
176
- return { kind: 'error', text: 'the plan is larger than maxInputBytes; write it to a file and pass the path' };
182
+ return {
183
+ kind: 'error',
184
+ text: 'the plan is larger than maxInputBytes; write it to a file and pass the path',
185
+ };
177
186
  }
178
187
  // The snapshot path is what the reviewer's URL and the CLI's plan
179
188
  // history both key on, so it is resolved before the run, not after.
180
189
  const written = writePlanSnapshot(plansDir, invocation.agent.session.id, plan, deps.snapshotIo);
181
190
  if (!written.ok) {
182
- return { kind: 'error', text: 'could not write the plan snapshot: ' + written.error };
191
+ return { kind: 'error', text: `could not write the plan snapshot: ${written.error}` };
183
192
  }
184
193
  target = planSnapshotPath(plansDir, invocation.agent.session.id);
185
194
  }
@@ -201,19 +210,23 @@ export function registerPlannotatorCommands(ctx, deps) {
201
210
  {
202
211
  name: COMMAND_REVIEW,
203
212
  description: 'Review working-tree changes or a pull request in the browser',
204
- input: { hint: '[--git|--gitbutler] [--base <ref>] [--diff-type <type>] [--no-local] [--tailscale] [PR_URL]' },
213
+ input: {
214
+ hint: '[--git|--gitbutler] [--base <ref>] [--diff-type <type>] [--no-local] [--tailscale] [PR_URL]',
215
+ },
205
216
  handler: async (invocation) => {
206
217
  const parsed = parseTypedLine(invocation.rawInput.trim().split(/\s+/u), REVIEW_FLAGS);
207
218
  if (!parsed.ok)
208
219
  return { kind: 'error', text: parsed.error };
209
220
  const operand = singleOperand(parsed.value);
210
221
  if (operand === null) {
211
- return { kind: 'error', text: 'usage: /' + COMMAND_REVIEW + ' [options] [PR_URL]' };
222
+ return { kind: 'error', text: `usage: /${COMMAND_REVIEW} [options] [PR_URL]` };
212
223
  }
213
224
  if (operand !== undefined && classifyTarget(operand) !== 'url') {
214
225
  return {
215
226
  kind: 'error',
216
- text: 'usage: /' + COMMAND_REVIEW + ' [options] [PR_URL] — a code review reads the worktree or a PR URL',
227
+ text: 'usage: /' +
228
+ COMMAND_REVIEW +
229
+ ' [options] [PR_URL] — a code review reads the worktree or a PR URL',
217
230
  };
218
231
  }
219
232
  const target = operand ?? sessionCwd(invocation.agent);
@@ -242,11 +255,11 @@ export function registerPlannotatorCommands(ctx, deps) {
242
255
  return { kind: 'error', text: parsed.error };
243
256
  const operand = singleOperand(parsed.value);
244
257
  if (operand === undefined || operand === null) {
245
- return { kind: 'error', text: 'usage: /' + COMMAND_ANNOTATE + ' <file|folder|URL>' };
258
+ return { kind: 'error', text: `usage: /${COMMAND_ANNOTATE} <file|folder|URL>` };
246
259
  }
247
260
  const kind = classifyTarget(operand);
248
261
  if (kind === undefined) {
249
- return { kind: 'error', text: 'usage: /' + COMMAND_ANNOTATE + ' <file|folder|URL>' };
262
+ return { kind: 'error', text: `usage: /${COMMAND_ANNOTATE} <file|folder|URL>` };
250
263
  }
251
264
  let target = operand;
252
265
  if (kind === 'path') {
@@ -279,14 +292,17 @@ export function registerPlannotatorCommands(ctx, deps) {
279
292
  if (!parsed.ok)
280
293
  return { kind: 'error', text: parsed.error };
281
294
  if (parsed.value.positionals.length > 0) {
282
- return { kind: 'error', text: 'usage: /' + COMMAND_LAST + ' (no arguments)' };
295
+ return { kind: 'error', text: `usage: /${COMMAND_LAST} (no arguments)` };
283
296
  }
284
297
  const text = newestAssistantText(invocation.agent.session.deriveMessages());
285
298
  if (text === undefined) {
286
299
  return { kind: 'error', text: 'this session has no assistant message to annotate yet' };
287
300
  }
288
301
  if (oversize(text, deps.config.maxInputBytes)) {
289
- return { kind: 'error', text: 'the message is larger than maxInputBytes; annotate a file instead' };
302
+ return {
303
+ kind: 'error',
304
+ text: 'the message is larger than maxInputBytes; annotate a file instead',
305
+ };
290
306
  }
291
307
  return runOne({
292
308
  ctx,
package/dist/config.d.ts CHANGED
@@ -10,7 +10,7 @@
10
10
  */
11
11
  import z from '@deepseek-ai/schemastery';
12
12
  /** How approved-plan notes are treated: forwarded as guidance, or dropped. */
13
- export declare const APPROVE_NOTES_MODES: readonly ["steer", "ignore"];
13
+ export declare const APPROVE_NOTES_MODES: readonly ['steer', 'ignore'];
14
14
  export type ApproveNotesMode = (typeof APPROVE_NOTES_MODES)[number];
15
15
  /** Every field the row may set, after defaults are applied. */
16
16
  export interface PlannotatorConfig {
@@ -34,25 +34,25 @@ export interface PlannotatorConfig {
34
34
  /** The values a profile gets when it sets nothing. */
35
35
  export declare const CONFIG_DEFAULTS: PlannotatorConfig;
36
36
  /** Loader-facing schema; every field defaulted so a row config may name any subset. */
37
- export declare const Config: z<Schemastery.ObjectS<{
38
- binary: z<string, string>;
39
- dataDir: z<string, string>;
40
- reviewTimeoutMs: z<number, number>;
41
- tailscale: z<boolean, boolean>;
42
- steerFeedback: z<boolean, boolean>;
43
- approveNotes: z<"ignore" | "steer", "ignore" | "steer">;
44
- allowUntrustedBinary: z<boolean, boolean>;
45
- maxInputBytes: z<number, number>;
46
- }>, Schemastery.ObjectT<{
47
- binary: z<string, string>;
48
- dataDir: z<string, string>;
49
- reviewTimeoutMs: z<number, number>;
50
- tailscale: z<boolean, boolean>;
51
- steerFeedback: z<boolean, boolean>;
52
- approveNotes: z<"ignore" | "steer", "ignore" | "steer">;
53
- allowUntrustedBinary: z<boolean, boolean>;
54
- maxInputBytes: z<number, number>;
55
- }>>;
37
+ export declare const Config: z<Schemastery.ObjectS<NoInfer<{
38
+ binary: z<string, string, "defined">;
39
+ dataDir: z<string, string, "defined">;
40
+ reviewTimeoutMs: z<number, number, "defined">;
41
+ tailscale: z<boolean, boolean, "defined">;
42
+ steerFeedback: z<boolean, boolean, "defined">;
43
+ approveNotes: z<"ignore" | "steer", "ignore" | "steer", "defined">;
44
+ allowUntrustedBinary: z<boolean, boolean, "defined">;
45
+ maxInputBytes: z<number, number, "defined">;
46
+ }>>, Schemastery.ObjectT<NoInfer<{
47
+ binary: z<string, string, "defined">;
48
+ dataDir: z<string, string, "defined">;
49
+ reviewTimeoutMs: z<number, number, "defined">;
50
+ tailscale: z<boolean, boolean, "defined">;
51
+ steerFeedback: z<boolean, boolean, "defined">;
52
+ approveNotes: z<"ignore" | "steer", "ignore" | "steer", "defined">;
53
+ allowUntrustedBinary: z<boolean, boolean, "defined">;
54
+ maxInputBytes: z<number, number, "defined">;
55
+ }>>, "plain">;
56
56
  /**
57
57
  * Apply defaults to a config object the loader did not validate.
58
58
  *
package/dist/config.js CHANGED
@@ -11,7 +11,7 @@
11
11
  import { homedir } from 'node:os';
12
12
  import { join } from 'node:path';
13
13
  import z from '@deepseek-ai/schemastery';
14
- import { DATA_DIR_ENV, DATA_DIR_FALLBACK_NAME, DATA_DIR_NAMESPACE, DEFAULT_MAX_INPUT_BYTES, PLANS_SUBDIR, } from "./constants.js";
14
+ import { DATA_DIR_ENV, DATA_DIR_FALLBACK_NAME, DATA_DIR_NAMESPACE, DEFAULT_MAX_INPUT_BYTES, PLANS_SUBDIR, } from './constants.js';
15
15
  /** How approved-plan notes are treated: forwarded as guidance, or dropped. */
16
16
  export const APPROVE_NOTES_MODES = ['steer', 'ignore'];
17
17
  /** The values a profile gets when it sets nothing. */
@@ -34,7 +34,9 @@ export const Config = z.object({
34
34
  reviewTimeoutMs: z.natural().default(CONFIG_DEFAULTS.reviewTimeoutMs),
35
35
  tailscale: z.boolean().default(CONFIG_DEFAULTS.tailscale),
36
36
  steerFeedback: z.boolean().default(CONFIG_DEFAULTS.steerFeedback),
37
- approveNotes: z.union([z.const('steer'), z.const('ignore')]).default(CONFIG_DEFAULTS.approveNotes),
37
+ approveNotes: z
38
+ .union([z.const('steer'), z.const('ignore')])
39
+ .default(CONFIG_DEFAULTS.approveNotes),
38
40
  allowUntrustedBinary: z.boolean().default(CONFIG_DEFAULTS.allowUntrustedBinary),
39
41
  maxInputBytes: z.natural().default(CONFIG_DEFAULTS.maxInputBytes),
40
42
  });
@@ -16,8 +16,8 @@
16
16
  *
17
17
  * @module dsh-plannotator/decisions
18
18
  */
19
- import { DECISION_ANNOTATED, DECISION_APPROVED, DECISION_DISMISSED } from './constants.ts';
20
19
  import type { RunResult } from './cli.ts';
20
+ import { DECISION_ANNOTATED, DECISION_APPROVED, DECISION_DISMISSED } from './constants.ts';
21
21
  /** The three verdicts every plannotator surface shares. */
22
22
  export type ReviewDecision = typeof DECISION_APPROVED | typeof DECISION_ANNOTATED | typeof DECISION_DISMISSED;
23
23
  /** One settled review. */
package/dist/decisions.js CHANGED
@@ -16,7 +16,7 @@
16
16
  *
17
17
  * @module dsh-plannotator/decisions
18
18
  */
19
- import { DECISION_ANNOTATED, DECISION_APPROVED, DECISION_DISMISSED, EXIT_APPROVED, EXIT_GATE_FAILURE, EXIT_NOT_APPROVED, STDERR_TAIL_CHARS, } from "./constants.js";
19
+ import { DECISION_ANNOTATED, DECISION_APPROVED, DECISION_DISMISSED, EXIT_APPROVED, EXIT_GATE_FAILURE, EXIT_NOT_APPROVED, STDERR_TAIL_CHARS, } from './constants.js';
20
20
  function isRecord(value) {
21
21
  return typeof value === 'object' && value !== null && !Array.isArray(value);
22
22
  }
@@ -77,23 +77,26 @@ function stderrTail(result) {
77
77
  const text = result.stderr.text.trim();
78
78
  if (text === '')
79
79
  return 'no diagnostic output';
80
- return text.length > STDERR_TAIL_CHARS ? '…' + text.slice(-STDERR_TAIL_CHARS) : text;
80
+ return text.length > STDERR_TAIL_CHARS ? `…${text.slice(-STDERR_TAIL_CHARS)}` : text;
81
81
  }
82
82
  /** The outcome of a run that never produced a verdict. */
83
83
  function failure(result, context) {
84
84
  if (result.kind === 'spawn-failed') {
85
- return { ok: false, error: context + ': ' + result.message };
85
+ return { ok: false, error: `${context}: ${result.message}` };
86
86
  }
87
87
  if (result.kind === 'timed-out') {
88
- return { ok: false, error: context + ': the review timed out before a decision' };
88
+ return { ok: false, error: `${context}: the review timed out before a decision` };
89
89
  }
90
90
  if (result.kind === 'exited' && result.cancelled) {
91
- return { ok: false, error: context + ': the review was cancelled' };
91
+ return { ok: false, error: `${context}: the review was cancelled` };
92
92
  }
93
93
  if (result.kind === 'signalled') {
94
- return { ok: false, error: context + ': the review process was killed (' + String(result.signal) + ')' };
94
+ return {
95
+ ok: false,
96
+ error: `${context}: the review process was killed (${String(result.signal)})`,
97
+ };
95
98
  }
96
- return { ok: false, error: context + ': ' + stderrTail(result) };
99
+ return { ok: false, error: `${context}: ${stderrTail(result)}` };
97
100
  }
98
101
  /**
99
102
  * Map a strict `annotate` run (exit codes carry the verdict).
@@ -102,7 +105,9 @@ function failure(result, context) {
102
105
  * @returns the reviewer's decision, or why the gate failed.
103
106
  */
104
107
  export function outcomeFromAnnotate(result) {
105
- if (result.kind === 'spawn-failed' || result.kind === 'signalled' || result.kind === 'timed-out') {
108
+ if (result.kind === 'spawn-failed' ||
109
+ result.kind === 'signalled' ||
110
+ result.kind === 'timed-out') {
106
111
  return failure(result, 'browser review did not finish');
107
112
  }
108
113
  if (result.cancelled)
@@ -116,9 +121,9 @@ export function outcomeFromAnnotate(result) {
116
121
  return { ok: true, outcome: { decision, feedback } };
117
122
  }
118
123
  if (result.code === EXIT_GATE_FAILURE) {
119
- return { ok: false, error: 'the review could not start: ' + stderrTail(result) };
124
+ return { ok: false, error: `the review could not start: ${stderrTail(result)}` };
120
125
  }
121
- return failure(result, 'browser review failed (exit ' + String(result.code) + ')');
126
+ return failure(result, `browser review failed (exit ${String(result.code)})`);
122
127
  }
123
128
  /**
124
129
  * Map an `annotate-last` run, which publishes no strict exit-code contract.
@@ -142,7 +147,7 @@ export function outcomeFromAnnotateLast(result) {
142
147
  // A record-less success is the CLI's plaintext close; nothing was written.
143
148
  return { ok: true, outcome: { decision: DECISION_DISMISSED, feedback: '' } };
144
149
  }
145
- return failure(result, 'annotation did not finish (exit ' + String(result.code) + ')');
150
+ return failure(result, `annotation did not finish (exit ${String(result.code)})`);
146
151
  }
147
152
  return { ok: true, outcome: { decision, feedback: readText(record, 'feedback') } };
148
153
  }
@@ -164,7 +169,7 @@ export function outcomeFromReview(result) {
164
169
  const record = readJsonRecord(result.stdout.text);
165
170
  const decision = readDecision(record);
166
171
  if (decision === undefined) {
167
- return failure(result, 'code review did not finish (exit ' + String(result.code) + ')');
172
+ return failure(result, `code review did not finish (exit ${String(result.code)})`);
168
173
  }
169
174
  return { ok: true, outcome: { decision, feedback: readText(record, 'message') } };
170
175
  }
package/dist/feedback.js CHANGED
@@ -10,7 +10,7 @@
10
10
  * @module dsh-plannotator/feedback
11
11
  */
12
12
  import { createUserMessage } from '@deepseek-ai/dsh-llm';
13
- import { FEEDBACK_PREFIX, PLUGIN_NAME } from "./constants.js";
13
+ import { FEEDBACK_PREFIX, PLUGIN_NAME } from './constants.js';
14
14
  /**
15
15
  * Frame reviewer text so the model can attribute it.
16
16
  *
@@ -23,7 +23,7 @@ import { FEEDBACK_PREFIX, PLUGIN_NAME } from "./constants.js";
23
23
  * @returns the message body to steer.
24
24
  */
25
25
  export function frameFeedback(target, body) {
26
- return FEEDBACK_PREFIX + ' Reviewer feedback on ' + target + ':\n\n' + body.trim();
26
+ return `${FEEDBACK_PREFIX} Reviewer feedback on ${target}:\n\n${body.trim()}`;
27
27
  }
28
28
  /**
29
29
  * Frame an approval that carried notes.
package/dist/index.d.ts CHANGED
@@ -15,9 +15,9 @@
15
15
  * @module @sagmans/dsh-plannotator
16
16
  */
17
17
  import type { Context } from '@deepseek-ai/cordis';
18
- export { Config as configSchema, normalizeConfig, resolveDataDir, resolvePlansDir } from './config.ts';
19
18
  export type { ApproveNotesMode, PlannotatorConfig } from './config.ts';
20
- export { COMMAND_ANNOTATE, COMMAND_LAST, COMMAND_PLAN, COMMAND_REVIEW, PLUGIN_NAME } from './constants.ts';
19
+ export { Config as configSchema, normalizeConfig, resolveDataDir, resolvePlansDir, } from './config.ts';
20
+ export { COMMAND_ANNOTATE, COMMAND_LAST, COMMAND_PLAN, COMMAND_REVIEW, PLUGIN_NAME, } from './constants.ts';
21
21
  /** Stable Loader identity; the profile patch row's id and the module name agree. */
22
22
  export declare const name = "plannotator";
23
23
  /**
@@ -30,25 +30,25 @@ export declare const name = "plannotator";
30
30
  */
31
31
  export declare const inject: string[];
32
32
  /** Validated row config; every field is defaulted, so a profile may set a subset. */
33
- export declare const Config: import("@deepseek-ai/schemastery").default<Schemastery.ObjectS<{
34
- binary: import("@deepseek-ai/schemastery").default<string, string>;
35
- dataDir: import("@deepseek-ai/schemastery").default<string, string>;
36
- reviewTimeoutMs: import("@deepseek-ai/schemastery").default<number, number>;
37
- tailscale: import("@deepseek-ai/schemastery").default<boolean, boolean>;
38
- steerFeedback: import("@deepseek-ai/schemastery").default<boolean, boolean>;
39
- approveNotes: import("@deepseek-ai/schemastery").default<"ignore" | "steer", "ignore" | "steer">;
40
- allowUntrustedBinary: import("@deepseek-ai/schemastery").default<boolean, boolean>;
41
- maxInputBytes: import("@deepseek-ai/schemastery").default<number, number>;
42
- }>, Schemastery.ObjectT<{
43
- binary: import("@deepseek-ai/schemastery").default<string, string>;
44
- dataDir: import("@deepseek-ai/schemastery").default<string, string>;
45
- reviewTimeoutMs: import("@deepseek-ai/schemastery").default<number, number>;
46
- tailscale: import("@deepseek-ai/schemastery").default<boolean, boolean>;
47
- steerFeedback: import("@deepseek-ai/schemastery").default<boolean, boolean>;
48
- approveNotes: import("@deepseek-ai/schemastery").default<"ignore" | "steer", "ignore" | "steer">;
49
- allowUntrustedBinary: import("@deepseek-ai/schemastery").default<boolean, boolean>;
50
- maxInputBytes: import("@deepseek-ai/schemastery").default<number, number>;
51
- }>>;
33
+ export declare const Config: import("@deepseek-ai/schemastery").default<Schemastery.ObjectS<NoInfer<{
34
+ binary: import("@deepseek-ai/schemastery").default<string, string, "defined">;
35
+ dataDir: import("@deepseek-ai/schemastery").default<string, string, "defined">;
36
+ reviewTimeoutMs: import("@deepseek-ai/schemastery").default<number, number, "defined">;
37
+ tailscale: import("@deepseek-ai/schemastery").default<boolean, boolean, "defined">;
38
+ steerFeedback: import("@deepseek-ai/schemastery").default<boolean, boolean, "defined">;
39
+ approveNotes: import("@deepseek-ai/schemastery").default<"ignore" | "steer", "ignore" | "steer", "defined">;
40
+ allowUntrustedBinary: import("@deepseek-ai/schemastery").default<boolean, boolean, "defined">;
41
+ maxInputBytes: import("@deepseek-ai/schemastery").default<number, number, "defined">;
42
+ }>>, Schemastery.ObjectT<NoInfer<{
43
+ binary: import("@deepseek-ai/schemastery").default<string, string, "defined">;
44
+ dataDir: import("@deepseek-ai/schemastery").default<string, string, "defined">;
45
+ reviewTimeoutMs: import("@deepseek-ai/schemastery").default<number, number, "defined">;
46
+ tailscale: import("@deepseek-ai/schemastery").default<boolean, boolean, "defined">;
47
+ steerFeedback: import("@deepseek-ai/schemastery").default<boolean, boolean, "defined">;
48
+ approveNotes: import("@deepseek-ai/schemastery").default<"ignore" | "steer", "ignore" | "steer", "defined">;
49
+ allowUntrustedBinary: import("@deepseek-ai/schemastery").default<boolean, boolean, "defined">;
50
+ maxInputBytes: import("@deepseek-ai/schemastery").default<number, number, "defined">;
51
+ }>>, "plain">;
52
52
  /**
53
53
  * Register the plannotator commands for this profile.
54
54
  *
package/dist/index.js CHANGED
@@ -14,11 +14,11 @@
14
14
  *
15
15
  * @module @sagmans/dsh-plannotator
16
16
  */
17
- import { defaultCommandDeps, registerPlannotatorCommands, } from "./commands.js";
18
- import { Config as configSchema, normalizeConfig } from "./config.js";
19
- import { PLUGIN_NAME } from "./constants.js";
20
- export { Config as configSchema, normalizeConfig, resolveDataDir, resolvePlansDir } from "./config.js";
21
- export { COMMAND_ANNOTATE, COMMAND_LAST, COMMAND_PLAN, COMMAND_REVIEW, PLUGIN_NAME } from "./constants.js";
17
+ import { defaultCommandDeps, registerPlannotatorCommands } from './commands.js';
18
+ import { Config as configSchema, normalizeConfig } from './config.js';
19
+ import { PLUGIN_NAME } from './constants.js';
20
+ export { Config as configSchema, normalizeConfig, resolveDataDir, resolvePlansDir, } from './config.js';
21
+ export { COMMAND_ANNOTATE, COMMAND_LAST, COMMAND_PLAN, COMMAND_REVIEW, PLUGIN_NAME, } from './constants.js';
22
22
  /** Stable Loader identity; the profile patch row's id and the module name agree. */
23
23
  export const name = PLUGIN_NAME;
24
24
  /**
@@ -41,5 +41,5 @@ export const Config = configSchema;
41
41
  export function apply(ctx, config) {
42
42
  const settings = normalizeConfig(config);
43
43
  const deps = defaultCommandDeps(settings, process.env);
44
- ctx.effect(() => registerPlannotatorCommands(ctx, { ...deps, snapshotIo: undefined }), PLUGIN_NAME + ' command lifecycle');
44
+ ctx.effect(() => registerPlannotatorCommands(ctx, { ...deps, snapshotIo: undefined }), `${PLUGIN_NAME} command lifecycle`);
45
45
  }
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * @module dsh-plannotator/plan-source
10
10
  */
11
- import { EXIT_PLAN_MODE_TOOL } from "./constants.js";
11
+ import { EXIT_PLAN_MODE_TOOL } from './constants.js';
12
12
  function isRecord(value) {
13
13
  return typeof value === 'object' && value !== null && !Array.isArray(value);
14
14
  }
package/dist/workspace.js CHANGED
@@ -11,7 +11,7 @@
11
11
  */
12
12
  import { mkdirSync, renameSync, writeFileSync } from 'node:fs';
13
13
  import { join } from 'node:path';
14
- import { SESSION_SEGMENT_MAX_CHARS, SNAPSHOT_DIR_MODE, SNAPSHOT_FILE_MODE, } from "./constants.js";
14
+ import { SESSION_SEGMENT_MAX_CHARS, SNAPSHOT_DIR_MODE, SNAPSHOT_FILE_MODE } from './constants.js';
15
15
  /** Production filesystem calls. */
16
16
  export const NODE_SNAPSHOT_IO = {
17
17
  mkdir: (path, options) => mkdirSync(path, options),
@@ -49,7 +49,7 @@ export function sessionSegment(sessionId) {
49
49
  * @returns absolute path to the session's plan snapshot.
50
50
  */
51
51
  export function planSnapshotPath(plansDir, sessionId) {
52
- return join(plansDir, sessionSegment(sessionId) + '.md');
52
+ return join(plansDir, `${sessionSegment(sessionId)}.md`);
53
53
  }
54
54
  /**
55
55
  * Write one plan snapshot atomically.
@@ -68,7 +68,7 @@ export function planSnapshotPath(plansDir, sessionId) {
68
68
  */
69
69
  export function writePlanSnapshot(plansDir, sessionId, text, io = NODE_SNAPSHOT_IO) {
70
70
  const path = planSnapshotPath(plansDir, sessionId);
71
- const temporary = path + '.tmp-' + String(process.pid) + '-' + Date.now().toString(36);
71
+ const temporary = `${path}.tmp-${String(process.pid)}-${Date.now().toString(36)}`;
72
72
  try {
73
73
  io.mkdir(plansDir, { recursive: true, mode: SNAPSHOT_DIR_MODE });
74
74
  io.writeFile(temporary, text, { mode: SNAPSHOT_FILE_MODE });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sagmans/dsh-plannotator",
3
- "version": "0.2.0",
3
+ "version": "0.3.1",
4
4
  "description": "Plannotator browser review surfaces for the DeepSeek Harness terminal profile: plan review, code review, file annotation, and last-answer annotation, driven on demand from slash commands.",
5
5
  "keywords": [
6
6
  "deepseek-harness",
@@ -32,7 +32,7 @@
32
32
  "LICENSE"
33
33
  ],
34
34
  "engines": {
35
- "node": ">=22.19"
35
+ "node": ">=22.19.0"
36
36
  },
37
37
  "packageManager": "pnpm@11.21.0",
38
38
  "publishConfig": {
@@ -52,12 +52,17 @@
52
52
  "patch": "./cordis.patch.yml"
53
53
  },
54
54
  "compatibility": {
55
- "dsh": ">=0.1.5-rc.1 <0.3.0",
55
+ "dsh": ">=0.1.5-rc.1 <0.1.6-0 || >=0.1.6-0 <0.1.7-0 || >=0.1.7-0 <0.2.0-0 || >=0.2.0-0 <0.2.1-0 || >=0.2.1-0 <0.2.2-0 || >=0.2.2-0 <0.3.0-0",
56
56
  "dshReleases": {
57
57
  "0.1.5-rc.2": "compatible",
58
58
  "0.1.5-rc.3": "compatible",
59
59
  "0.1.7-rc.2": "compatible",
60
- "0.2.0-rc.2": "compatible"
60
+ "0.2.0-rc.2": "compatible",
61
+ "0.2.1-rc.2": "compatible",
62
+ "0.2.1-rc.3": "compatible",
63
+ "0.2.1-rc.5": "compatible",
64
+ "0.2.2-rc.1": "compatible",
65
+ "0.2.2-rc.5": "compatible"
61
66
  },
62
67
  "profiles": [
63
68
  "tui"
@@ -71,29 +76,36 @@
71
76
  "test:build": "node --test \"tests/*.test.mjs\"",
72
77
  "pack-smoke": "node tools/pack-smoke.mjs",
73
78
  "drive": "node tools/pty-drive.mjs",
74
- "test:release": "python3 -m unittest discover -s tests/release -p 'test_*.py'",
75
- "check": "pnpm run typecheck && pnpm test && pnpm run build && pnpm run test:build && pnpm test:release && node tools/harness-matrix.mjs && pnpm run pack-smoke",
79
+ "test:release": "uv run --no-project --python-preference only-managed python -m unittest discover -s tests/release -p 'test_*.py'",
80
+ "check:tools": "bash scripts/stack-checks.sh tools",
81
+ "lint": "biome ci --error-on-warnings .",
82
+ "lint:fix": "biome check --write .",
83
+ "lint:py": "bash scripts/stack-checks.sh py-lint",
84
+ "typecheck:py": "bash scripts/stack-checks.sh py-typecheck",
85
+ "lint:sh": "bash scripts/stack-checks.sh sh",
86
+ "check": "pnpm run check:tools && node tools/python-policy.mjs && pnpm run lint && pnpm run lint:py && pnpm run typecheck:py && pnpm run lint:sh && pnpm run typecheck && pnpm test && pnpm run build && pnpm run test:build && pnpm test:release && node tools/harness-matrix.mjs && pnpm run pack-smoke",
76
87
  "prepack": "pnpm run build",
77
88
  "prepublishOnly": "pnpm run typecheck && pnpm test && pnpm test:release"
78
89
  },
79
90
  "peerDependencies": {
80
- "@deepseek-ai/cordis": "^4.0.2",
81
- "@deepseek-ai/dsh-agent": ">=0.1.5-rc.1 <0.3.0",
82
- "@deepseek-ai/dsh-commands": ">=0.1.5-rc.1 <0.3.0",
83
- "@deepseek-ai/dsh-llm": ">=0.1.5-rc.1 <0.3.0",
84
- "@deepseek-ai/dsh-session": ">=0.1.5-rc.1 <0.3.0",
85
- "@deepseek-ai/schemastery": "^3.18.2"
91
+ "@deepseek-ai/cordis": ">=4.0.2 <4.2.0-0",
92
+ "@deepseek-ai/dsh-agent": ">=0.1.5-rc.1 <0.1.6-0 || >=0.1.6-0 <0.1.7-0 || >=0.1.7-0 <0.2.0-0 || >=0.2.0-0 <0.2.1-0 || >=0.2.1-0 <0.2.2-0 || >=0.2.2-0 <0.3.0-0",
93
+ "@deepseek-ai/dsh-commands": ">=0.1.5-rc.1 <0.1.6-0 || >=0.1.6-0 <0.1.7-0 || >=0.1.7-0 <0.2.0-0 || >=0.2.0-0 <0.2.1-0 || >=0.2.1-0 <0.2.2-0 || >=0.2.2-0 <0.3.0-0",
94
+ "@deepseek-ai/dsh-llm": ">=0.1.5-rc.1 <0.1.6-0 || >=0.1.6-0 <0.1.7-0 || >=0.1.7-0 <0.2.0-0 || >=0.2.0-0 <0.2.1-0 || >=0.2.1-0 <0.2.2-0 || >=0.2.2-0 <0.3.0-0",
95
+ "@deepseek-ai/dsh-session": ">=0.1.5-rc.1 <0.1.6-0 || >=0.1.6-0 <0.1.7-0 || >=0.1.7-0 <0.2.0-0 || >=0.2.0-0 <0.2.1-0 || >=0.2.1-0 <0.2.2-0 || >=0.2.2-0 <0.3.0-0",
96
+ "@deepseek-ai/schemastery": ">=3.18.2 <3.20.0-0"
86
97
  },
87
98
  "devDependencies": {
88
- "@deepseek-ai/cordis": "4.0.2",
89
- "@deepseek-ai/dsh-agent": "0.2.0-rc.2",
90
- "@deepseek-ai/dsh-commands": "0.2.0-rc.2",
91
- "@deepseek-ai/dsh-llm": "0.2.0-rc.2",
92
- "@deepseek-ai/dsh-session": "0.2.0-rc.2",
93
- "@deepseek-ai/schemastery": "3.18.2",
94
- "@types/node": "22.20.0",
99
+ "@biomejs/biome": "2.6.3",
100
+ "@deepseek-ai/cordis": "4.1.0",
101
+ "@deepseek-ai/dsh-agent": "0.2.2-rc.5",
102
+ "@deepseek-ai/dsh-commands": "0.2.2-rc.5",
103
+ "@deepseek-ai/dsh-llm": "0.2.2-rc.5",
104
+ "@deepseek-ai/dsh-session": "0.2.2-rc.5",
105
+ "@deepseek-ai/schemastery": "3.19.0",
106
+ "@types/node": "26.6.5",
95
107
  "node-pty": "1.1.0",
96
- "tsx": "4.22.4",
97
- "typescript": "6.0.3"
108
+ "tsx": "4.23.15",
109
+ "typescript": "7.0.2"
98
110
  }
99
111
  }