@plannotator/pi-extension 0.27.5 → 0.27.6

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
@@ -270,6 +270,8 @@ Plannotator does not send `Continue with the approved plan`, enter its executing
270
270
 
271
271
  Run `/plannotator-annotate <file.md>` to open any markdown file in the annotation UI. Useful for reviewing documentation or design specs with the agent.
272
272
 
273
+ URL targets work too. A loopback `http` URL that answers with an HTML page (a running dev app, e.g. `http://localhost:5173`) opens **live**: the app is served through a local reverse proxy and annotated in place, with HMR and WebSockets passed through. `--static` forces the classic markdown conversion; `--app` requires a live session and errors instead of falling back. Live sessions are unavailable in remote mode (`PLANNOTATOR_REMOTE`).
274
+
273
275
  ### Annotate last message
274
276
 
275
277
  Run `/plannotator-last` to annotate the agent's most recent response. The message opens in the annotation UI where you can highlight text, add comments, and send structured feedback back to the agent.
@@ -47,6 +47,10 @@ export interface ParsedAnnotateArgs {
47
47
  renderHtml: boolean;
48
48
  renderMarkdown: boolean;
49
49
  noJina: boolean;
50
+ /** --app: force a live app session (recognized only with `liveFlags`). */
51
+ app: boolean;
52
+ /** --static: force the classic conversion pipeline (only with `liveFlags`). */
53
+ static: boolean;
50
54
  }
51
55
 
52
56
  type Segment = { type: "ws" | "tok"; text: string };
@@ -60,9 +64,27 @@ const FLAG_MAP = {
60
64
  "--no-jina": "noJina",
61
65
  } as const satisfies Record<string, keyof Omit<ParsedAnnotateArgs, "filePath" | "rawFilePath">>;
62
66
 
63
- export function parseAnnotateArgs(raw: string): ParsedAnnotateArgs {
67
+ /** Live-mode flags, recognized only where the host actually supports live
68
+ * app sessions (`liveFlags: true` — Pi today). A host that cannot act on
69
+ * --app must NOT silently strip it: leaving the token in the path keeps the
70
+ * legacy "File not found: --app ..." error, which is honest about the flag
71
+ * being unsupported there. */
72
+ const LIVE_FLAG_MAP = {
73
+ "--app": "app",
74
+ "--static": "static",
75
+ } as const satisfies Record<string, keyof Omit<ParsedAnnotateArgs, "filePath" | "rawFilePath">>;
76
+
77
+ export interface ParseAnnotateArgsOptions {
78
+ /** Recognize --app / --static (hosts with live app annotation support). */
79
+ liveFlags?: boolean;
80
+ }
81
+
82
+ export function parseAnnotateArgs(raw: string, opts?: ParseAnnotateArgsOptions): ParsedAnnotateArgs {
64
83
  const s = (raw ?? "").trim();
65
- const flags = { gate: false, json: false, hook: false, renderHtml: false, renderMarkdown: false, noJina: false };
84
+ const flags = { gate: false, json: false, hook: false, renderHtml: false, renderMarkdown: false, noJina: false, app: false, static: false };
85
+ const flagMap: Record<string, keyof typeof flags> = opts?.liveFlags
86
+ ? { ...FLAG_MAP, ...LIVE_FLAG_MAP }
87
+ : { ...FLAG_MAP };
66
88
 
67
89
  const segments: Segment[] = [];
68
90
  for (let i = 0; i < s.length;) {
@@ -76,7 +98,7 @@ export function parseAnnotateArgs(raw: string): ParsedAnnotateArgs {
76
98
  for (let j = 0; j < segments.length; j++) {
77
99
  const seg = segments[j];
78
100
  if (seg.type !== "tok") continue;
79
- const key = FLAG_MAP[seg.text as keyof typeof FLAG_MAP];
101
+ const key = flagMap[seg.text];
80
102
  if (!key) continue;
81
103
 
82
104
  flags[key] = true;