@coldtea/pr-lens-agent-skill 0.3.0 → 0.5.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/SKILL.md CHANGED
@@ -33,17 +33,21 @@ Decide where the diagram lands before you write it: a canvas, or an SVG and a pu
33
33
  npx @coldtea/pr-lens-cli@latest render .pr-lens/graph.json --theme light
34
34
  ```
35
35
 
36
- Render light by default unless the user requests another theme. The SVGs, the manifest and `drawn.graph.json` land in `.pr-lens/`, which the CLI adds to the repository's .gitignore. Do not commit any of it. These files are rebuilt from the diff whenever anyone wants them again. Each SVG is named after its view, the theme and a content hash; `manifest.json` lists them by lens and view, so read the names from there or from the directory.
36
+ Render light by default unless the user requests another theme. The SVGs, the manifest and `drawn.graph.json` land in a directory of their own under `.pr-lens/`, named after the document's title. The render prints that path, so read it from there. The CLI adds `.pr-lens/` to the repository's .gitignore. Do not commit any of it. These files are rebuilt from the diff whenever anyone wants them again. Each SVG is named after its view, the theme and a content hash; `manifest.json` lists them by lens and view, so read the names from there or from the directory.
37
37
 
38
38
  If the user asked for a diagram, an explanation or a picture of the architecture and nothing more, put it on a canvas and hand back the link:
39
39
 
40
40
  ```bash
41
- npx @coldtea/pr-lens-cli@latest canvas push
41
+ npx @coldtea/pr-lens-cli@latest canvas push .pr-lens/<drawing>/drawn.graph.json
42
42
  ```
43
43
 
44
- This pushes `.pr-lens/drawn.graph.json` and prints three links. Give the user the view link, `https://prlens.dev/c/{id}`: that is the diagram, full screen, every view on one page, and it opens without a login. The edit link, the one ending in `#w=…`, lets its holder push over the canvas, so leave it out of the reply unless they ask, and never paste it anywhere public. The embed link serves the top view as an SVG for a README.
44
+ Pass the path the render printed. A bare `canvas push` finds the drawing when the checkout holds only one; with more than one it lists them and asks which, so always pass the path.
45
45
 
46
- Pushing the same file again updates the same canvas, so a follow-up such as "rename that node" or "add the queue" is: edit the document, validate, render, push. The link stays the same. If the push fails, say so and tell them where the SVGs are and which one is the top view.
46
+ It prints three links. Give the user the view link, `https://prlens.dev/c/{id}`: that is the diagram, full screen, every view on one page, and it opens without a login. The edit link, the one ending in `#w=…`, lets its holder push over the canvas, so leave it out of the reply unless they ask, and never paste it anywhere public. The embed link serves the top view as an SVG for a README.
47
+
48
+ Pushing the same document again updates the same canvas, so a follow-up such as "rename that node" or "add the queue" is: edit the document, validate, render, push. While the title stays the same, it renders to the same directory and pushes to the same canvas, so the link does not change. If the push fails, say so and tell them where the SVGs are and which one is the top view.
49
+
50
+ A different diagram only needs a different title. It renders into its own directory and pushes to its own canvas, and the first one stays as it was. `canvas list` shows them all.
47
51
 
48
52
  5. **Attach, when there is a pull request to attach to.** That means the user asked you to open a PR, asked for a diagram on one that exists, or you are opening a PR as part of changes made. Otherwise skip this step.
49
53
 
@@ -73,15 +77,91 @@ Decide where the diagram lands before you write it: a canvas, or an SVG and a pu
73
77
 
74
78
  ```bash
75
79
  npx @coldtea/pr-lens-cli@latest comment \
76
- --graph .pr-lens/drawn.graph.json \
77
- --manifest .pr-lens/manifest.json \
80
+ --graph .pr-lens/<drawing>/drawn.graph.json \
81
+ --manifest .pr-lens/<drawing>/manifest.json \
78
82
  --asset-base-url https://raw.githubusercontent.com/<owner>/<repo>/<branch>/<dir>
79
83
  ```
80
84
 
81
- `--graph` takes `drawn.graph.json`, not the document you wrote, because corrections change what the diagrams show and the CLI refuses a document its manifest does not describe. `--asset-base-url` is where you published the SVGs; leave it out and the markdown points at local paths no reader can fetch. The markdown goes to stdout, with each diagram as a `<picture>` pair; posting it is your business.
85
+ `--graph` takes the drawing's own `drawn.graph.json`, not the document you wrote, because corrections change what the diagrams show and the CLI refuses a document its manifest does not describe. `--asset-base-url` is where you published the SVGs; leave it out and the markdown points at local paths no reader can fetch. The markdown goes to stdout, with each diagram as a `<picture>` pair; posting it is your business.
82
86
 
83
87
  If you would rather not author the document yourself, `npx @coldtea/pr-lens-cli@latest analyze --base <ref>` does steps 1 and 2 by asking a provider — Gemini, OpenAI, or any endpoint speaking `/chat/completions` — with a key of your own. That is the only path here that needs one.
84
88
 
89
+ ## Answering beside an open canvas
90
+
91
+ Once a canvas is pushed, you can answer questions about it on the canvas itself. The reader keeps the page open, asks you in the terminal, and your answer plays there: the camera moves step by step, what you name lights up, and each name is a link.
92
+
93
+ Run this once, when the user wants to talk about a canvas they have open or are about to open. Name the drawing you pushed, the same path as the push:
94
+
95
+ ```bash
96
+ npx @coldtea/pr-lens-cli@latest canvas open .pr-lens/<drawing>/drawn.graph.json
97
+ ```
98
+
99
+ It opens one browser tab that follows you. Only that tab moves. Anyone else reading the same link sees the canvas as it was. Every command below talks to that tab, and takes the same path as `--drawing`. Always pass it: a checkout can hold several canvases, and the path says which one you mean.
100
+
101
+ **When the user says "this", "here" or "what I selected", look first.** They clicked a component, dragged a box or picked a part of a drawing in the tab, and you cannot see it:
102
+
103
+ ```bash
104
+ npx @coldtea/pr-lens-cli@latest canvas look --drawing .pr-lens/<drawing>/drawn.graph.json
105
+ ```
106
+
107
+ It prints JSON: the diagram they are on (`diagram.stage`, ready to paste into a step), what is on screen (`inFrame`), what they selected (`scope`), the answer they have open, and the drawing hung under the canvas (`fork`), if there is one. Answer about `scope` when it is set. `following: false` means they left agent mode: tell them the answer is waiting rather than saying you moved their canvas.
108
+
109
+ **Answer** with a JSON file, or `-` to pipe it in:
110
+
111
+ ```bash
112
+ npx @coldtea/pr-lens-cli@latest canvas answer .pr-lens/answer.json --drawing .pr-lens/<drawing>/drawn.graph.json
113
+ ```
114
+
115
+ ```json
116
+ {
117
+ "question": "What does push check first?",
118
+ "steps": [
119
+ {
120
+ "heading": "Push checks the token first",
121
+ "stage": { "kind": "view", "view": "overview" },
122
+ "focus": { "kind": "selection", "nodes": ["canvas-api"] },
123
+ "paragraphs": [
124
+ {
125
+ "parts": [
126
+ { "text": "The " },
127
+ { "text": "canvas API", "ref": { "kind": "component", "id": "canvas-api" } },
128
+ { "text": " refuses a push without the write token, before it draws anything." }
129
+ ]
130
+ }
131
+ ]
132
+ }
133
+ ]
134
+ }
135
+ ```
136
+
137
+ - One to four steps. Two is usual. Each step stops on one diagram, in the order a reader should follow.
138
+ - `heading` is a sentence of at most six words: who or what, a verb, what happens. The first step's heading is the answer. To a yes or no question it says yes or no.
139
+ - `stage` and `focus` work exactly as they do in a walkthrough. Leave `stage` out for the opening diagram. Light one or two things, not half the diagram.
140
+ - A paragraph is one or two sentences and at most 30 words. A second paragraph is for a failure or a risk the first did not name.
141
+ - Every place you name carries a `ref`: `component` is a node id, `message` is `flowId/messageId`, `diagram` is a view or flow id. Copy ids from the document exactly. Never make one up. The CLI checks every id against the drawing before sending, and the app checks again; a wrong one comes back with the ids that exist.
142
+ - When the canvas cannot answer part of the question, say what is missing in `cannotTell` rather than guessing.
143
+
144
+ **"Take me to X"** is a camera move, not an answer:
145
+
146
+ ```bash
147
+ npx @coldtea/pr-lens-cli@latest canvas show --drawing .pr-lens/<drawing>/drawn.graph.json \
148
+ --diagram send-pipeline --focus send-pipeline/enqueue --open send-pipeline/enqueue
149
+ ```
150
+
151
+ `--focus` takes node ids or `flow/message` and repeats. `--open` opens that message's sample payload.
152
+
153
+ **"What's inside X", "expand on X" or "break X down"** is a drawing. Write a small graph document of X's insides (up to ten nodes) and hang it under X:
154
+
155
+ ```bash
156
+ npx @coldtea/pr-lens-cli@latest canvas fork .pr-lens/inside-x.json --from x --drawing .pr-lens/<drawing>/drawn.graph.json
157
+ ```
158
+
159
+ The sketch can leave out `schemaVersion`, `kind` and `provenance`; they come from the canvas.
160
+
161
+ **When the question needs the diagram itself changed** (a missing component, a wrong arrow), edit the document, validate, render and `canvas push` as usual. The open tab reloads onto the new revision by itself.
162
+
163
+ After `answer`, `show` and `fork`, the CLI says where the reader is. If it says they stepped out, tell the user the answer is waiting in their Questions list, and that `/` opens it.
164
+
85
165
  ## The pull request body, when there is one
86
166
 
87
167
  A reviewer should understand the change before reading the diff, so the diagram goes where they look first: the description, not a trailing comment. Open with one sentence on why the change exists, then the architecture diagram, then whatever proves the change works, such as a screenshot of the result or a recording of the interaction. Use one visual per idea. A diagram that needs a paragraph of explanation has a document problem; go back to step 2.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coldtea/pr-lens-agent-skill",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "The PR Lens skill for coding agents: author a graph document from a diff, validate it, render it, and correct a repository's map.",
5
5
  "license": "MIT",
6
6
  "author": "Coldtea AI",
@@ -34,8 +34,8 @@
34
34
  "typescript": "7.0.2",
35
35
  "vitest": "4.1.11",
36
36
  "yaml": "^2.8.1",
37
- "@coldtea/pr-lens-schema": "^0.3.0",
38
- "@coldtea/pr-lens-renderer": "^0.2.5"
37
+ "@coldtea/pr-lens-schema": "^0.5.0",
38
+ "@coldtea/pr-lens-renderer": "^0.2.6"
39
39
  },
40
40
  "scripts": {
41
41
  "skill:sync": "tsx scripts/sync.ts",
@@ -88,6 +88,8 @@ The hosted App reads `github` settings from the PR's head commit. Other options
88
88
  | Setting | Default | Effect |
89
89
  | --- | --- | --- |
90
90
  | `github.comment.collapsed` | `false` | Start diagrams and details closed. Drawing still runs automatically. |
91
+ | `github.draw` | `auto` | `on-demand` leaves a pull request undrawn, with a short notice, until someone comments `@pr-lens draw`. |
92
+ | `github.comment.notice` | `true` | `false` drops that notice, so an on-demand repository hears nothing until someone asks. |
91
93
 
92
94
  ## Check it
93
95