spectater 0.1.0 → 0.2.0

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
@@ -1,61 +1,114 @@
1
1
  # SpecTater
2
2
 
3
- Read and comment on one local OpenSpec change. Markdown stays authoritative; feedback and source snapshots persist privately outside the repository.
3
+ [![Check](https://github.com/morhaf-ko/spectater/actions/workflows/check.yml/badge.svg)](https://github.com/morhaf-ko/spectater/actions/workflows/check.yml)
4
+ [![npm](https://img.shields.io/npm/v/spectater)](https://www.npmjs.com/package/spectater)
5
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue)](LICENSE)
4
6
 
5
- ## Run
7
+ Review [OpenSpec](https://github.com/Fission-AI/OpenSpec) changes in your browser and send selected-text feedback straight to your coding agent.
6
8
 
7
- Use Bun 1.4.4 and OpenSpec 1.16.1 (also verified: 1.15.0). OpenSpec retains its upstream Node prerequisites; Node 24 is tested. Native Git enables optional source comparisons.
9
+ Your agent drafts a proposal, design, specs and tasks. SpecTater opens them in a local reader where you select text, comment, and submit. The agent receives your comments as structured JSON, revises the Markdown, and replies. The page updates as the files change. Everything stays on your machine.
10
+
11
+ ## Quick start
12
+
13
+ Install the skill for your agent:
8
14
 
9
15
  ```sh
10
- bun install --frozen-lockfile --ignore-scripts
11
- bun run bin/spectater.js open --project /path/to/project --change change-id
16
+ npx skills add morhaf-ko/spectater
12
17
  ```
13
18
 
14
- For the published package, install with `bun add --global spectater@0.1.0` and use `spectater` instead of the checkout launcher. Automatic opening is implemented for macOS; elsewhere use `--no-open` and the printed URL. The URL uses the change name; its secret fragment disappears after opening. Keep the initial link private. Ctrl-C stops the server without deleting saved feedback.
19
+ Then ask your agent to review a change, for example "review the add-dark-mode proposal with spectater". The skill tells the agent to run `npx -y spectater`, so there is nothing else to install.
15
20
 
16
- ## Review
21
+ Without the skill, tell the agent: "Run `npx -y spectater workflow` and follow it for the add-dark-mode change."
17
22
 
18
- 1. Read rendered Markdown or exact Source. Select text to open the comment popover. Selections across formatting/paragraphs use labeled enclosing-source precision.
19
- 2. Save comments, then submit new or changed feedback. A listening agent receives the batch; otherwise it stays queued.
20
- 3. Before delivery, Edit queued pauses a batch for correction and explicit replacement. Cancel submission preserves its comments. After delivery, Send correction creates new feedback without recalling instructions.
21
- 4. Source saves update the reader automatically. Old comments become stale/orphaned; reattachment is explicit. What changed compares the latest source update with the previous one, including added/removed files.
22
- 5. End review preserves read-only history and tells a waiting agent to stop listening. Deliver or cancel queued batches first. Resume review or `open --reopen` explicitly resumes; a normal open does not silently restart an ended review.
23
+ Requirements: Node 22.12 or newer, OpenSpec 1.15 or newer, macOS or Linux. Git is optional; it powers the "What changed" diff.
23
24
 
24
- The sun/moon button initially follows your system. Details restores System appearance. Metadata, withdrawn history and copy/download use collapsed disclosures. Draft text may recover in the same tab; save comments for durable storage.
25
+ ## How it works
25
26
 
26
- Submission, replies, task completion and End review never grant implementation, merge or deployment approval. SpecTater does not start, interrupt or wake models. See [the existing-conversation workflow](docs/workflow.md) for bounded waiting, replies and the supplied on-demand skill.
27
+ ```
28
+ agent: spectater open add-dark-mode → server starts in the background, browser opens
29
+ you: select text, comment, Submit → feedback is saved and queued
30
+ agent: spectater wait add-dark-mode → receives the batch as JSON
31
+ agent: spectater reply … --status working, edits Markdown, spectater reply … --message-file result.md
32
+ you: see the update and the reply; comment again or click End review
33
+ ```
27
34
 
28
- ## Preferences and storage
35
+ Every agent command prints one JSON object with a `status` and a `next_step`, so the agent always knows what to do next:
29
36
 
30
- No config is required. Defaults are rendered view, a browser-opening attempt and private platform storage. An optional JSON file at `$XDG_CONFIG_HOME/spectater/config.json` (otherwise `~/.config/spectater/config.json`) may contain:
37
+ | `status` | Meaning | Exit code |
38
+ | ------------------- | ---------------------------------------------- | --------- |
39
+ | `batch` | Feedback delivered in `batch` | 0 |
40
+ | `timeout` | No feedback within `--timeout` (default 540 s) | 0 |
41
+ | `ended` | You ended the review | 0 |
42
+ | `error` | The command failed; see `error` | 1 |
43
+ | `stopped` | The review server is not running | 3 |
44
+ | `listener_active` | Another `wait` is already listening | 4 |
45
+ | `listener_replaced` | Another `wait --takeover` replaced this one | 5 |
31
46
 
32
- ```json
33
- {
34
- "defaultView": "source",
35
- "openBrowser": false
36
- }
37
- ```
47
+ Until the agent replies to a batch, `wait` returns that batch again, so feedback is never lost if the agent is interrupted.
48
+
49
+ Other commands report `ready` or `reused` (`open`), `recorded` (`reply`), `refreshed` (`refresh`), `ended` (`end`), `stopping` or `not_running` (`stop`), and `stopped` (exit 3) when no server is running. Any command can return `error` (exit 1).
38
50
 
39
- `stateDirectory` optionally selects an absolute private path. `--config` overrides `SPECTATER_CONFIG`, which overrides the default config path; `SPECTATER_STATE_DIR` overrides the storage preference. `--no-open` always suppresses opening. Repo content cannot configure the process. Invalid settings fail visibly.
51
+ ## In the browser
40
52
 
41
- Storage defaults to `~/Library/Application Support/SpecTater` on macOS and `$XDG_STATE_HOME/spectater` (otherwise `~/.local/state/spectater`) on Linux. Back it up separately from Git; feedback exports are not full state backups. Corrupt state is preserved, and conflicting writers are refused. After a crash, verify the recorded writer has stopped before explicitly removing its lock. Moving a worktree or changing storage does not migrate review identity automatically.
53
+ - Select text in the rendered view or the Markdown source, then comment. Enter saves; Cmd/Ctrl+Enter saves and submits.
54
+ - Write a message to the agent that is not tied to a selection.
55
+ - Submit sends only new or changed comments. Until the agent picks a batch up you can edit or cancel it.
56
+ - **Send & End** submits and ends the review once the agent has received the final batch.
57
+ - Comments on text that later changes are marked stale (with a suggested re-anchor) or orphaned; nothing is silently moved.
58
+ - "What changed" diffs the latest source update against the previous one.
42
59
 
43
- ## Boundaries
60
+ ## Commands
44
61
 
45
- Native OpenSpec selects the root, schema and artifact paths, including declared/explicit stores and isolated worktrees. Unselected global stores are refused. Only that selected change is observed; there is no polling scanner, account, hosted backend or installed hook.
62
+ | Command | Description |
63
+ | ----------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
64
+ | `spectater` | List open reviews and usage. |
65
+ | `spectater open <change>` | Start or reuse the review server and open the browser. `--no-open`, `--reopen`. |
66
+ | `spectater wait <change>` | Wait for feedback. `--timeout <seconds>`, `--takeover`, `--format markdown`. |
67
+ | `spectater reply <change>` | `--status working`, or post a result with `--message` / `--message-file`. `--batch <n>` targets an earlier batch. |
68
+ | `spectater feedback <change> --batch <n>` | Print a submitted batch without recording delivery. |
69
+ | `spectater refresh <change>` | Re-read the change from disk. |
70
+ | `spectater end <change>` | End the review. |
71
+ | `spectater stop <change>` | Stop the server. Saved feedback is kept. |
72
+ | `spectater workflow` | Print the agent review loop. |
73
+ | `spectater skill` | Print the agent skill. |
74
+ | `spectater setup hooks` | Add SessionStart hooks (see below). `--remove` undoes it. |
46
75
 
47
- Raw HTML and diagrams remain inert; remote images do not load. Relative links do not navigate. Unmapped selection boundaries require Source. Limits are 1 MiB/file, 128 artifacts, 16 MiB current source, 64 MiB private state, 10,000 characters/selection or comment, and 256 observed directories. Git comparisons are bounded to 3 seconds/256 KiB output.
76
+ Run commands from the project directory, or pass `--project <dir>`. Use `--store <id>` for an OpenSpec store.
48
77
 
49
- macOS and Linux storage/IPC/browser flows are exercised. Automatic opening is macOS-only; Linux prints the manual URL. Windows storage/IPC/opening are unsupported. See [security](SECURITY.md), [the security pass](docs/security-review.md) and [verification](docs/verification.md).
78
+ ## Session hooks (optional)
50
79
 
51
- ## Development
80
+ To have new agent sessions see reviews that are already open, install SpecTater globally and add the hooks:
52
81
 
53
82
  ```sh
54
- bun run check
83
+ npm install -g spectater
84
+ spectater setup hooks
85
+ ```
86
+
87
+ For each agent that is installed, this adds a SessionStart hook for Claude Code (`~/.claude/settings.json`), Codex (`~/.codex/hooks.json`; approve it once with `/hooks`), OpenCode (`~/.config/opencode/plugins/spectater.js`) and GitHub Copilot CLI (`~/.copilot/hooks/spectater.json`). The hook runs `spectater status --hook`, which prints open reviews for the current project and nothing otherwise. It never blocks or drives the agent. Restart your agent sessions afterwards.
88
+
89
+ ## Configuration
90
+
91
+ No configuration is required. An optional `~/.config/spectater/config.json` (or `$XDG_CONFIG_HOME/spectater/config.json`, or `--config <file>`, or `SPECTATER_CONFIG`) accepts:
92
+
93
+ ```json
94
+ { "defaultView": "source", "openBrowser": false, "stateDirectory": "/absolute/path" }
55
95
  ```
56
96
 
57
- This runs Biome formatting/import/lint checks, contract/browser/package tests, the owned smoke, strict OpenSpec validation, whitespace checks and dependency audit. Use `bun run format` to apply Biome fixes. Install Chrome with `bun run playwright install chrome` if absent. Package installation and dependency audit require registry access. `bun run benchmark` measures an isolated fixture; add `-- --project . --change local-change-review` for a full change.
97
+ | Variable | Effect |
98
+ | ------------------------ | ---------------------------------------------------------------------------------------------------------------------------- |
99
+ | `SPECTATER_STATE_DIR` | Where reviews are stored. Default: `~/Library/Application Support/SpecTater` on macOS, `$XDG_STATE_HOME/spectater` on Linux. |
100
+ | `SPECTATER_IDLE_TIMEOUT` | Seconds before an unused server stops itself. Default 1800; `0` disables. |
101
+
102
+ Review state lives outside your repository and is never uploaded. Back it up separately if you need the history.
103
+
104
+ ## Security and limits
105
+
106
+ The server listens on `127.0.0.1` only. The URL contains a private token; anyone with it can read and comment on the review, so do not share it. Markdown is rendered without raw HTML, scripts or remote images, and SpecTater never writes to your Markdown. Limits: 1 MiB per file, 128 artifacts, 10,000 characters per selection, comment or message. Windows is not supported. See [SECURITY.md](SECURITY.md) to report a vulnerability.
107
+
108
+ ## Contributing
109
+
110
+ See [CONTRIBUTING.md](CONTRIBUTING.md). Requirements live in [`openspec/specs`](openspec/specs) and in-flight changes in [`openspec/changes`](openspec/changes).
58
111
 
59
- The public CI workflow pins its actions and uses repository runner variables configured for isolated GitHub-hosted runners. The same-repository condition limits automatic execution; it is not a runner security boundary. Renovate is the sole update producer; automatic merges remain disabled pending reporting and required checks.
112
+ ## License
60
113
 
61
- Requirements/design/tasks live in [the OpenSpec change](openspec/changes/local-change-review/); [DESIGN.md](DESIGN.md) contains reusable visual tokens. The change remains unarchived pending acceptance. MIT license; see LICENSE.
114
+ [MIT](LICENSE). Interface tokens adapt the Apache-2.0 [Open Design](https://github.com/nexu-io/open-design) Clean system; see [docs/licenses/open-design.txt](docs/licenses/open-design.txt).