@kolisachint/hoocode-agent 0.5.41 → 0.5.42
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/CHANGELOG.md +89 -0
- package/dist/core/builtin-skills.d.ts +11 -0
- package/dist/core/builtin-skills.d.ts.map +1 -1
- package/dist/core/builtin-skills.js +31 -0
- package/dist/core/builtin-skills.js.map +1 -1
- package/dist/core/canvas/scaffold.d.ts +1 -1
- package/dist/core/canvas/scaffold.d.ts.map +1 -1
- package/dist/core/canvas/scaffold.js +100 -5
- package/dist/core/canvas/scaffold.js.map +1 -1
- package/dist/extensions/core/canvas.d.ts.map +1 -1
- package/dist/extensions/core/canvas.js +2 -1
- package/dist/extensions/core/canvas.js.map +1 -1
- package/dist/init-templates.generated.d.ts.map +1 -1
- package/dist/init-templates.generated.js +4 -0
- package/dist/init-templates.generated.js.map +1 -1
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package.json +1 -1
- package/package.json +4 -4
- package/templates/agents/code-review.md +61 -0
- package/templates/agents/security-review.md +69 -0
- package/templates/skills/artifact-design/SKILL.md +191 -0
- package/templates/skills/canvas-design/SKILL.md +117 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: artifact-design
|
|
3
|
+
description: Build a self-contained HTML visual written to disk — page, report, dashboard, mockup, diagram, or poster. Load before the first line of markup or CSS whenever something has to look right, or a redesign is asked for. Not for app code the project's own design system already governs.
|
|
4
|
+
allowed-tools: read, write, edit, grep, find, ls
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Designing a visual
|
|
8
|
+
|
|
9
|
+
hoocode writes visuals as one self-contained `.html` file on disk. There is no
|
|
10
|
+
host, no CSP, and no gallery: fonts and libraries may come from a CDN or from
|
|
11
|
+
local files, and the page is yours to lay out however the subject demands. The
|
|
12
|
+
constraint that remains is the only one that ever mattered — it has to be good.
|
|
13
|
+
|
|
14
|
+
Not for a canvas extension. A canvas serves a live page from its own loopback
|
|
15
|
+
server, under constraints that contradict half of this file, and `/new-canvas`
|
|
16
|
+
points at `../canvas-design/SKILL.md` for it.
|
|
17
|
+
|
|
18
|
+
## First, read the request
|
|
19
|
+
|
|
20
|
+
Decide the treatment, not whether to design. Every visual gets real typographic
|
|
21
|
+
hierarchy, considered spacing, and a deliberate palette. What varies is how far
|
|
22
|
+
past that you go.
|
|
23
|
+
|
|
24
|
+
- **Utilitarian** — a report, a plan, a status page, a diagram. Most requests.
|
|
25
|
+
Make it clean and well-composed. Skip the oversized hero. Keep flourishes few.
|
|
26
|
+
- **Editorial** — a landing page, a poster, something the user will show other
|
|
27
|
+
people. Take a real point of view and one deliberate risk.
|
|
28
|
+
|
|
29
|
+
When unsure, build the well-composed version. A restrained page is never wrong;
|
|
30
|
+
an over-designed one sometimes is.
|
|
31
|
+
|
|
32
|
+
## Honor what already exists
|
|
33
|
+
|
|
34
|
+
Look before you invent. If the repo has a design system — a tokens file, a
|
|
35
|
+
theme, CSS variables, an existing stylesheet, a brand section in a project
|
|
36
|
+
context file — use it. Precedence is always:
|
|
37
|
+
|
|
38
|
+
1. What the user asked for, in their words
|
|
39
|
+
2. The project's existing system
|
|
40
|
+
3. Your own choices
|
|
41
|
+
|
|
42
|
+
Your choices fill gaps. They never override the first two.
|
|
43
|
+
|
|
44
|
+
## Write the plan before the markup
|
|
45
|
+
|
|
46
|
+
This is the part that does the work. Before any code, write down:
|
|
47
|
+
|
|
48
|
+
- **Color** — 4 to 6 named hex values. Name them by role (`ink`, `ground`,
|
|
49
|
+
`accent`, `muted`), not by hue.
|
|
50
|
+
- **Type** — at least two faces with distinct jobs: one with character for
|
|
51
|
+
display, one comfortable for body text, and a third for data or captions if
|
|
52
|
+
the content needs it. Name the fallback stack for each.
|
|
53
|
+
- **Layout** — the structural idea in one or two sentences.
|
|
54
|
+
|
|
55
|
+
Then build from the plan and derive every color and type decision from it. A
|
|
56
|
+
page assembled without a plan reads as assembled without a plan.
|
|
57
|
+
|
|
58
|
+
## Fundamentals
|
|
59
|
+
|
|
60
|
+
**Ground it in the subject.** One concrete subject, one audience, one job for
|
|
61
|
+
the page. Distinctive choices come from the subject's own world — its materials,
|
|
62
|
+
its vocabulary, how people in it actually talk. Use real content throughout.
|
|
63
|
+
Never lorem, never placeholder rows.
|
|
64
|
+
|
|
65
|
+
**Type carries the page,** including when the page is not about type. Keep
|
|
66
|
+
running text near 65 characters wide. Set a scale and stay on it. Give headings
|
|
67
|
+
`text-wrap: balance`, give body text line-height room, give uppercase labels a
|
|
68
|
+
little letter-spacing. Always declare a real fallback stack — a silent fallback
|
|
69
|
+
is the most common way a good design ships looking wrong.
|
|
70
|
+
|
|
71
|
+
**Pick the neutrals.** A pure mid-grey reads as unconsidered. Bias the greys
|
|
72
|
+
slightly toward the accent hue and they read as chosen. Pure white and near-black
|
|
73
|
+
are fine grounds when the subject wants them; the point is that you decided.
|
|
74
|
+
|
|
75
|
+
**Let layout do the spacing.** Flex or grid with `gap`, not per-element margins
|
|
76
|
+
that collapse or double unpredictably. Wide content — tables, code blocks,
|
|
77
|
+
diagrams — gets its own `overflow-x: auto` container so the page body never
|
|
78
|
+
scrolls sideways. Use `font-variant-numeric: tabular-nums` wherever digits line
|
|
79
|
+
up in a column.
|
|
80
|
+
|
|
81
|
+
**Design both themes.** A local page sees only `prefers-color-scheme`, so this
|
|
82
|
+
is simpler here than on a hosted target: define the complete palette as custom
|
|
83
|
+
properties on `:root`, redefine only those properties inside
|
|
84
|
+
`@media (prefers-color-scheme: dark)`, and style every component through the
|
|
85
|
+
properties. Never give a color its only definition inside the media block — that
|
|
86
|
+
is how a page ends up rendering one theme's text on the other theme's ground.
|
|
87
|
+
Set an explicit `background` on `body`. Give the second theme the same attention
|
|
88
|
+
as the first rather than inverting it mechanically; check that the accent still
|
|
89
|
+
works on both grounds. A page that deliberately commits to one visual world may
|
|
90
|
+
stay single-theme, but then paint every color explicitly so it holds either way.
|
|
91
|
+
|
|
92
|
+
**Structure should encode something true.** Numbered markers, eyebrows,
|
|
93
|
+
dividers, and section labels are information, not decoration. Number things only
|
|
94
|
+
when the order actually matters to the reader.
|
|
95
|
+
|
|
96
|
+
**When it is a UI, not a document,** the craft shifts from typography to
|
|
97
|
+
information design. A dashboard is scanned, not read. Put the summary above the
|
|
98
|
+
detail. Encode state in form as well as in number — a pill, a chip, a severity
|
|
99
|
+
stripe — so what needs attention is visible at a glance. Semantic color (good,
|
|
100
|
+
warning, critical) is a separate system from your accent and does not count as
|
|
101
|
+
using it. Anything interactive should look interactive.
|
|
102
|
+
|
|
103
|
+
## Avoid the generated look
|
|
104
|
+
|
|
105
|
+
Machine-generated design keeps landing on the same handful of looks. When the
|
|
106
|
+
user has specified a direction, follow it exactly, including if it is one of
|
|
107
|
+
these. When nothing is specified, do not spend the freedom here:
|
|
108
|
+
|
|
109
|
+
- Warm cream ground, serif display face, terracotta accent
|
|
110
|
+
- Near-black ground with a single acid-green or vermilion pop
|
|
111
|
+
- Hairline rules and dense columns imitating a broadsheet
|
|
112
|
+
- Purple-to-blue gradient hero on white
|
|
113
|
+
- Inter or Space Grotesk chosen as the safe default
|
|
114
|
+
- Emoji as section markers
|
|
115
|
+
- Everything centered
|
|
116
|
+
- Uniform large corner radii on every surface
|
|
117
|
+
- A colored accent rail down the side of every card
|
|
118
|
+
|
|
119
|
+
## Words are design material
|
|
120
|
+
|
|
121
|
+
Write from the reader's side of the screen. Name things the way they would name
|
|
122
|
+
them, not the way the system is built. Active voice. A control says exactly what
|
|
123
|
+
it does, and the confirmation matches it. Errors say what went wrong and what to
|
|
124
|
+
do about it. Specific beats clever.
|
|
125
|
+
|
|
126
|
+
Give the page a real `<title>` — a short, specific noun phrase, not a category
|
|
127
|
+
label and not a name with an explainer bolted on after a dash.
|
|
128
|
+
|
|
129
|
+
## Libraries, and why the answer is usually none
|
|
130
|
+
|
|
131
|
+
A hosted page and a file on disk fail differently, and that decides this. A
|
|
132
|
+
hosted page is always viewed online, so a CDN dependency is free. A file gets
|
|
133
|
+
moved, attached to mail, and opened on a laptop in a tunnel — and there a
|
|
134
|
+
runtime dependency does not degrade, it collapses. Tailwind from a CDN with no
|
|
135
|
+
network is an unstyled document. React from a CDN with no network is a blank
|
|
136
|
+
one.
|
|
137
|
+
|
|
138
|
+
So the default is no runtime dependency at all. Write plain CSS; modern CSS has
|
|
139
|
+
custom properties, grid, `clamp()`, and container queries, and a page that needs
|
|
140
|
+
a utility framework to be laid out usually needs a clearer layout instead.
|
|
141
|
+
|
|
142
|
+
There is no build step here and nothing bundles this file, so a framework that
|
|
143
|
+
expects one — Vite, a JSX pipeline, anything importing bare module specifiers —
|
|
144
|
+
is not an option regardless.
|
|
145
|
+
|
|
146
|
+
When a library genuinely earns its place, and that is mostly charting or syntax
|
|
147
|
+
highlighting rather than layout:
|
|
148
|
+
|
|
149
|
+
- Inline it into the file if its licence permits, and the page stays whole.
|
|
150
|
+
- Otherwise pin an exact version, give the feature a readable fallback for when
|
|
151
|
+
the script does not load, and tell the user the page needs network.
|
|
152
|
+
|
|
153
|
+
Webfonts are the one dependency that degrades gracefully, because a real
|
|
154
|
+
fallback stack keeps the page readable when the link fails. Use one, and always
|
|
155
|
+
declare the stack.
|
|
156
|
+
|
|
157
|
+
## Build cleanly
|
|
158
|
+
|
|
159
|
+
- Watch selector specificity. Type-level and element-level selectors fighting
|
|
160
|
+
over the same padding is how spacing silently comes undone.
|
|
161
|
+
- Close every non-void element and double-quote every attribute.
|
|
162
|
+
- Give keyboard focus a visible state.
|
|
163
|
+
- Respect `prefers-reduced-motion`.
|
|
164
|
+
- For generative or decorative graphics, reach for Canvas or WebGL rather than
|
|
165
|
+
hand-authoring long SVG path data.
|
|
166
|
+
- Before finishing, scan the stylesheet for any color declared only inside a
|
|
167
|
+
media query.
|
|
168
|
+
|
|
169
|
+
## Delivering it
|
|
170
|
+
|
|
171
|
+
Write one self-contained `.html` file. Inline the page's own CSS and JS; embed
|
|
172
|
+
small assets as data URIs so the file survives being moved or sent to someone.
|
|
173
|
+
|
|
174
|
+
Put it where the user would expect it — alongside the data it visualizes, or in
|
|
175
|
+
the directory they named. Then give them the path as a markdown link with a
|
|
176
|
+
`file://` URL:
|
|
177
|
+
|
|
178
|
+
```
|
|
179
|
+
[tokens.html](file:///abs/path/to/tokens.html)
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
hoocode's markdown renderer turns that into an OSC 8 hyperlink wherever the
|
|
183
|
+
terminal supports one, so it is clickable in kitty, iTerm2, WezTerm and others,
|
|
184
|
+
and still readable as plain text everywhere else. Offer to open it rather than
|
|
185
|
+
opening it unasked.
|
|
186
|
+
|
|
187
|
+
Canvas is not a viewer for this. `/canvas` hosts canvas extensions — a directory
|
|
188
|
+
with an `extension.mjs` speaking the canvas JSON-RPC protocol — and `/canvas
|
|
189
|
+
open` takes an extension id, not a file path. A page you can hand someone is a
|
|
190
|
+
file; reach for `/new-canvas` only when the user wants a live surface the agent
|
|
191
|
+
can call typed actions on, which is a different and larger job than a visual.
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: canvas-design
|
|
3
|
+
description: How to make a canvas extension's page good — layout, styling, live state, and the dependency and token constraints the surface imposes. Read when building or editing a canvas; the /new-canvas brief points here.
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
allowed-tools: read, write, edit, grep, find, ls
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Designing a canvas
|
|
9
|
+
|
|
10
|
+
A canvas is not a document. It is a small application: a page served over
|
|
11
|
+
loopback that a person operates while you drive the same state through typed
|
|
12
|
+
actions. Both of you are live on it at once, and that is the whole design
|
|
13
|
+
problem.
|
|
14
|
+
|
|
15
|
+
Read `../artifact-design/SKILL.md` for the fundamentals — treatment, the
|
|
16
|
+
color/type/layout plan you write before any markup, neutrals, spacing, the
|
|
17
|
+
generated-look list. All of it applies. This file covers only what is different
|
|
18
|
+
because the surface is a canvas, and where the two disagree, this file wins.
|
|
19
|
+
|
|
20
|
+
## What the catalog already tells you
|
|
21
|
+
|
|
22
|
+
Of the 23 extensions in GitHub's canvas catalog, 22 import nothing but
|
|
23
|
+
`@github/copilot-sdk` and `node:` builtins. The single exception ships a README
|
|
24
|
+
telling the user to `npm install` by hand. Zero dependencies is not a
|
|
25
|
+
restriction someone imposed on you; it is what working canvases actually do.
|
|
26
|
+
|
|
27
|
+
The flagship, `pr-artifact-explorer`, is a rich **read** surface the agent
|
|
28
|
+
navigates — its shared state is a cache and a route, and neither party co-edits
|
|
29
|
+
content. It sidesteps concurrent editing entirely. Treat that as evidence about
|
|
30
|
+
what is easy and what is not: a canvas that shows state well is worth far more
|
|
31
|
+
than one that lets both parties type into the same field.
|
|
32
|
+
|
|
33
|
+
## The page lives inside a template string
|
|
34
|
+
|
|
35
|
+
The HTML is a JavaScript template literal in `extension.mjs`, not a file. Two
|
|
36
|
+
consequences worth planning around rather than discovering:
|
|
37
|
+
|
|
38
|
+
- Every backtick and `${` in your CSS or markup needs escaping. A `grid-template`
|
|
39
|
+
value or a JS snippet with a template literal inside it will break the outer
|
|
40
|
+
string. Prefer plain quotes and avoid nesting template literals.
|
|
41
|
+
- There is no stylesheet to open in an editor. Keep the CSS in one clearly
|
|
42
|
+
delimited chunk near the top of the served string so it stays findable, rather
|
|
43
|
+
than scattering inline `style=` attributes.
|
|
44
|
+
|
|
45
|
+
If the page grows past a screenful of markup, serve it from a separate file in
|
|
46
|
+
the extension directory and read it at request time. The extension is already an
|
|
47
|
+
HTTP server; it can serve its own assets. That is the escape hatch from string
|
|
48
|
+
escaping, and it does not violate the no-dependency rule.
|
|
49
|
+
|
|
50
|
+
## No dependencies, and no build
|
|
51
|
+
|
|
52
|
+
`package.json` and `node_modules` are forbidden in the extension directory, so
|
|
53
|
+
there is nothing to install and nothing to bundle. Write plain CSS and plain
|
|
54
|
+
DOM. Modern CSS has custom properties, grid, and `clamp()`; a canvas that needs
|
|
55
|
+
a utility framework needs a clearer layout instead.
|
|
56
|
+
|
|
57
|
+
Do not reach for a CDN either. The page is served from `127.0.0.1`, so it works
|
|
58
|
+
with no network — a CDN script throws that away and turns an offline-capable
|
|
59
|
+
local tool into a broken one.
|
|
60
|
+
|
|
61
|
+
## You own the theme completely
|
|
62
|
+
|
|
63
|
+
The canvas protocol carries no theme, no palette, and no styling hook. Nothing
|
|
64
|
+
is inherited. A page that sets no colors gets browser defaults, which is why the
|
|
65
|
+
scaffold's placeholder looks like nothing.
|
|
66
|
+
|
|
67
|
+
So define the full palette as custom properties on `:root`, redefine them under
|
|
68
|
+
`@media (prefers-color-scheme: dark)`, and style everything through them. Set an
|
|
69
|
+
explicit `background` on `body`. This is the same discipline as any page, with
|
|
70
|
+
one simplification: there is no host stamping `data-theme`, so two states is the
|
|
71
|
+
whole problem.
|
|
72
|
+
|
|
73
|
+
## Design for two operators
|
|
74
|
+
|
|
75
|
+
The person changes state through the page. You change the same state through
|
|
76
|
+
`invoke_canvas_action`. The page has to be honest about that:
|
|
77
|
+
|
|
78
|
+
- **Render from server state, not from what the user just clicked.** After an
|
|
79
|
+
action mutates state, the page must be able to show the new truth. Poll on a
|
|
80
|
+
short interval, or push with SSE — both are a few lines with no dependency.
|
|
81
|
+
- **Make agent-reachable state visible.** If an action can add a note, the notes
|
|
82
|
+
should be on screen. State only you can see is state the person cannot trust.
|
|
83
|
+
- **Do not build co-editing.** Concurrent edits to one field is the hard problem
|
|
84
|
+
the reference canvas declined to solve. Prefer append, toggle, and select over
|
|
85
|
+
a shared text buffer.
|
|
86
|
+
- **Show that something changed.** When state moves underneath the person, a
|
|
87
|
+
brief highlight on the changed row beats a silent re-render.
|
|
88
|
+
|
|
89
|
+
## Actions are tool schemas, so they cost
|
|
90
|
+
|
|
91
|
+
Every action becomes an agent-callable tool while the instance is open, and its
|
|
92
|
+
name, description, and `inputSchema` are re-sent on every request for as long as
|
|
93
|
+
it stays open. Declare the actions the canvas actually needs and give each a
|
|
94
|
+
tight schema — not one per button.
|
|
95
|
+
|
|
96
|
+
Action results land in the model's context too. Return a summary and a count,
|
|
97
|
+
not the whole collection; where a list is genuinely useful, slice it and set a
|
|
98
|
+
flag saying you did. Measure with `hoocode --print-token-surface` while a canvas
|
|
99
|
+
is open.
|
|
100
|
+
|
|
101
|
+
## Reload replaces the URL
|
|
102
|
+
|
|
103
|
+
Reloading forks a new process and hands back a **new** URL; the tab the person
|
|
104
|
+
had open dies with the old one. Two design consequences:
|
|
105
|
+
|
|
106
|
+
- Keep meaningful state on the server side of the canvas, not in the page. A
|
|
107
|
+
scroll position is fine to lose; a half-filled form is not.
|
|
108
|
+
- Give the person the new URL every time you reload, and say the old tab is
|
|
109
|
+
dead. A page that silently stopped updating looks like a bug you caused.
|
|
110
|
+
|
|
111
|
+
## Before you call it done
|
|
112
|
+
|
|
113
|
+
- Open it and look, rather than reasoning about the markup.
|
|
114
|
+
- Check both color schemes.
|
|
115
|
+
- Resize narrow — a canvas is often a side window, not a full screen.
|
|
116
|
+
- Invoke each action and confirm the page reflects it without a manual refresh.
|
|
117
|
+
- Confirm the page still renders with the network off.
|