deplhoy 0.4.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/dist/core.js +72 -3
- package/dist/index.js +36 -6
- package/dist/mcp.js +44 -2
- package/dist/setup.js +14 -7
- package/package.json +2 -1
package/dist/core.js
CHANGED
|
@@ -5,8 +5,9 @@ import { collectFiles, defaultName, detectBuildDir, formatBytes, MAX_VERSION_BYT
|
|
|
5
5
|
import { DEFAULT_API, readAccount, readProject, readProjects, writeProject } from './config.js';
|
|
6
6
|
import { gitInfo } from './git.js';
|
|
7
7
|
import { scanFiles } from './secrets.js';
|
|
8
|
-
export const VERSION = '0.
|
|
8
|
+
export const VERSION = '0.5.0';
|
|
9
9
|
export const BEHAVIOR_MAX_BYTES = 4 * 1024; // same limit as the API
|
|
10
|
+
export const CHANGES_MAX_BYTES = 1024; // L12, same limit as the API
|
|
10
11
|
export class CliError extends Error {
|
|
11
12
|
code;
|
|
12
13
|
constructor(message, code = 1) {
|
|
@@ -95,6 +96,10 @@ export async function publishBuild(ctx, opts, say = () => { }) {
|
|
|
95
96
|
}
|
|
96
97
|
const sitemap = readSitemap(ctx, opts, warnings);
|
|
97
98
|
const behavior = readBehavior(ctx, opts, warnings);
|
|
99
|
+
const changes = opts.changes?.trim() || null;
|
|
100
|
+
if (changes && Buffer.byteLength(changes) > CHANGES_MAX_BYTES) {
|
|
101
|
+
throw new CliError(`The changes note is ${(Buffer.byteLength(changes) / 1024).toFixed(1)} KB. The limit is 1 KB: say what changed and which comments it addresses, in a few lines.`);
|
|
102
|
+
}
|
|
98
103
|
const saved = readProject(ctx.cwd, buildKey);
|
|
99
104
|
const name = opts.name?.trim() || saved?.name || defaultName(ctx.cwd, dir, detected);
|
|
100
105
|
const prototypeId = saved && saved.name.toLowerCase() === name.toLowerCase() ? saved.id : null;
|
|
@@ -103,7 +108,7 @@ export async function publishBuild(ctx, opts, say = () => { }) {
|
|
|
103
108
|
if (symlinks.length)
|
|
104
109
|
warnings.push(`Skipped ${symlinks.length} symbolic link(s), e.g. ${symlinks[0]}`);
|
|
105
110
|
const manifest = files.map((f) => ({ path: f.path, size: f.size, sha256: sha256File(f.abs) }));
|
|
106
|
-
const start = await call(ctx, '/v1/versions', { method: 'POST', token: account.token, body: JSON.stringify({ name, prototype_id: prototypeId, files: manifest, git: gitInfo(ctx.cwd), sitemap, behavior }) });
|
|
111
|
+
const start = await call(ctx, '/v1/versions', { method: 'POST', token: account.token, body: JSON.stringify({ name, prototype_id: prototypeId, files: manifest, git: gitInfo(ctx.cwd), sitemap, behavior, changes }) });
|
|
107
112
|
warnings.push(...(start.warnings ?? []));
|
|
108
113
|
const byPath = new Map(files.map((f) => [f.path, f]));
|
|
109
114
|
const queue = [...start.uploads];
|
|
@@ -155,18 +160,82 @@ const forAgent = (t, live) => ({
|
|
|
155
160
|
comment: t.number, kind: t.kind, version: `v${t.version}`, pending: t.version !== live, page: t.page, device: t.device, target: t.target,
|
|
156
161
|
instruction: t.instruction ?? null,
|
|
157
162
|
thread: t.comments.map((c) => ({ author: c.via === 'agent' ? `${c.author.email ?? 'someone'} (agent)` : c.author.name ?? c.author.email ?? 'someone', text: c.body, at: c.created_at })),
|
|
163
|
+
screenshot: !!t.shot,
|
|
158
164
|
});
|
|
159
165
|
export async function getComments(ctx, prototype) {
|
|
160
166
|
const account = requireAccount(ctx);
|
|
161
167
|
const p = await resolvePrototype(ctx, prototype);
|
|
162
|
-
const r = await
|
|
168
|
+
const [r, c] = await Promise.all([
|
|
169
|
+
call(ctx, `/v1/prototypes/${p.slug}/comments?open=1`, { token: account.token }),
|
|
170
|
+
call(ctx, `/v1/prototypes/${p.slug}/context`, { token: account.token }).catch(() => null),
|
|
171
|
+
]);
|
|
172
|
+
const hasContext = !!c && (!!c.brief.body || c.links.length > 0 || c.notes.length > 0);
|
|
163
173
|
return {
|
|
174
|
+
// L14: the owners' brief, links and flow notes: read them (get_context) before changing the prototype
|
|
175
|
+
...(hasContext ? { context: `This prototype has ${[c.brief.body ? 'a brief' : '', c.links.length ? `${c.links.length} link${c.links.length === 1 ? '' : 's'}` : '', c.notes.length ? `${c.notes.length} flow note${c.notes.length === 1 ? '' : 's'}` : ''].filter(Boolean).join(', ')} from its owners: read them with get_context first.` } : {}),
|
|
164
176
|
prototype: { slug: p.slug, name: p.name, live_version: `v${r.prototype.live_version}`, url: p.url },
|
|
165
177
|
// only the comments an owner sent to agents; `waiting` more wait for an owner's decision in the app (decision 39)
|
|
166
178
|
comments: r.comments.map((t) => forAgent(t, r.prototype.live_version)),
|
|
167
179
|
waiting_for_owner: r.waiting ?? 0,
|
|
168
180
|
};
|
|
169
181
|
}
|
|
182
|
+
/** The brief, links, flow notes and owner notes of a prototype, as one markdown text plus the parts. */
|
|
183
|
+
export async function getContext(ctx, prototype) {
|
|
184
|
+
const account = requireAccount(ctx);
|
|
185
|
+
const p = await resolvePrototype(ctx, prototype);
|
|
186
|
+
const [c, open] = await Promise.all([
|
|
187
|
+
call(ctx, `/v1/prototypes/${p.slug}/context`, { token: account.token }),
|
|
188
|
+
call(ctx, `/v1/prototypes/${p.slug}/comments?open=1`, { token: account.token }),
|
|
189
|
+
]);
|
|
190
|
+
const notes = open.comments.filter((t) => t.kind === 'note');
|
|
191
|
+
const L = [`# ${p.name}: context`, ''];
|
|
192
|
+
L.push('## Brief', '', c.brief.body?.trim() || '_No brief yet._', '');
|
|
193
|
+
if (c.links.length) {
|
|
194
|
+
L.push('## Links', '');
|
|
195
|
+
for (const l of c.links)
|
|
196
|
+
L.push(`- [${l.label}](${l.url})${l.kind !== 'other' ? ` (${l.kind})` : ''}`);
|
|
197
|
+
L.push('');
|
|
198
|
+
}
|
|
199
|
+
if (c.notes.length) {
|
|
200
|
+
L.push('## Notes on the flow', '');
|
|
201
|
+
for (const n of c.notes)
|
|
202
|
+
L.push(`- ${n.to_route ? `\`${n.route}\` → \`${n.to_route}\`` : `\`${n.route}\``}: ${n.body.replace(/\s+/g, ' ')}`);
|
|
203
|
+
L.push('');
|
|
204
|
+
}
|
|
205
|
+
if (notes.length) {
|
|
206
|
+
L.push('## Owner notes on elements', '');
|
|
207
|
+
for (const t of notes)
|
|
208
|
+
L.push(`- #${t.number} ${t.target}: ${t.comments[0]?.body.replace(/\s+/g, ' ') ?? ''}`);
|
|
209
|
+
L.push('');
|
|
210
|
+
}
|
|
211
|
+
return {
|
|
212
|
+
prototype: { slug: p.slug, name: p.name, url: p.url },
|
|
213
|
+
markdown: L.join('\n').trim(),
|
|
214
|
+
brief: c.brief.body, links: c.links.map(({ label, url, kind }) => ({ label, url, kind })),
|
|
215
|
+
flow_notes: c.notes.map((n) => ({ page: n.route, to: n.to_route, note: n.body })),
|
|
216
|
+
owner_notes: notes.map((t) => ({ comment: t.number, target: t.target, note: t.comments[0]?.body ?? '' })),
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
/** L13 (COM-7): the capture of one comment, as JPEG bytes. */
|
|
220
|
+
export async function getCommentScreenshot(ctx, comment, prototype) {
|
|
221
|
+
const account = requireAccount(ctx);
|
|
222
|
+
const n = Number(String(comment).replace(/^#/, ''));
|
|
223
|
+
if (!Number.isInteger(n) || n < 1)
|
|
224
|
+
throw new CliError(`“${comment}” is not a comment number. Use the number from get_comments, e.g. 3.`);
|
|
225
|
+
const p = await resolvePrototype(ctx, prototype);
|
|
226
|
+
let res;
|
|
227
|
+
try {
|
|
228
|
+
res = await ctx.fetch(`${apiBase(ctx)}/v1/prototypes/${p.slug}/comments/${n}/shot`, { headers: { authorization: `Bearer ${account.token}` } });
|
|
229
|
+
}
|
|
230
|
+
catch {
|
|
231
|
+
throw new CliError(`Cannot reach ${apiBase(ctx)}. Check the network connection.`);
|
|
232
|
+
}
|
|
233
|
+
if (res.status === 401)
|
|
234
|
+
throw new CliError('The deplhoy session expired or was revoked. Run `deplhoy login` in a terminal.');
|
|
235
|
+
if (!res.ok)
|
|
236
|
+
throw new CliError(`Comment #${n} has no capture you can see (only comments sent to agents, made in the app, have one).`);
|
|
237
|
+
return { comment: n, slug: p.slug, jpeg: new Uint8Array(await res.arrayBuffer()) };
|
|
238
|
+
}
|
|
170
239
|
export async function resolveComment(ctx, comment, opts = {}) {
|
|
171
240
|
const account = requireAccount(ctx);
|
|
172
241
|
const n = Number(String(comment).replace(/^#/, ''));
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/* deplhoy CLI. L1: login, logout, publish, list. L2: mcp, setup, --sitemap and --behavior. L4: comments, resolve. */
|
|
3
3
|
import { spawn } from 'node:child_process';
|
|
4
|
-
import { realpathSync } from 'node:fs';
|
|
4
|
+
import { realpathSync, writeFileSync } from 'node:fs';
|
|
5
|
+
import { join, resolve as resolvePath } from 'node:path';
|
|
5
6
|
import { fileURLToPath } from 'node:url';
|
|
6
|
-
import { hostname } from 'node:os';
|
|
7
|
+
import { hostname, tmpdir } from 'node:os';
|
|
7
8
|
import { parseArgs } from 'node:util';
|
|
8
9
|
import { DEFAULT_API, readAccount, writeAccount } from './config.js';
|
|
9
|
-
import { apiBase, call, CliError, getComments, listPrototypes, orgOf, publishBuild, resolveComment, VERSION } from './core.js';
|
|
10
|
+
import { apiBase, call, CliError, getComments, getCommentScreenshot, getContext, listPrototypes, orgOf, publishBuild, resolveComment, VERSION } from './core.js';
|
|
10
11
|
import { serveMcp } from './mcp.js';
|
|
11
12
|
import { setupProject } from './setup.js';
|
|
12
13
|
const HELP = `deplhoy ${VERSION} · publish prototypes from your agent
|
|
@@ -21,12 +22,17 @@ Commands
|
|
|
21
22
|
--name <name> Prototype name (default: package.json name or folder name)
|
|
22
23
|
--sitemap <file> Pages and links (default .deplhoy/sitemap.json)
|
|
23
24
|
--behavior <file> Behavior note, markdown, 4 KB max (default .deplhoy/behavior.md)
|
|
25
|
+
--changes <text> What changed since the previous version and which comments it addresses (1 KB max)
|
|
24
26
|
--json Print the result as JSON (for agents)
|
|
25
27
|
list Prototypes you can see, with their live version
|
|
26
28
|
setup Teach this project's agents to publish (AGENTS.md, CLAUDE.md, skill)
|
|
27
|
-
mcp Start the MCP server over stdio (tools: publish, list, get_comments, resolve_comment)
|
|
29
|
+
mcp Start the MCP server over stdio (tools: publish, list, get_context, get_comments, get_comment_screenshot, resolve_comment)
|
|
28
30
|
comments [prototype] Open comments: on the live version and pending from earlier ones
|
|
29
31
|
--json Print them as JSON (for agents)
|
|
32
|
+
context [prototype] The owners' brief, links and notes on the flow
|
|
33
|
+
--json Print them as JSON (for agents)
|
|
34
|
+
screenshot <number> Save what the reviewer saw when writing a comment (a JPEG)
|
|
35
|
+
-o, --out <file> Where to save it (default: a file in the temp folder)
|
|
30
36
|
resolve <number> Close a comment, e.g. deplhoy resolve 3
|
|
31
37
|
--message <text> Say what changed (added as a reply)
|
|
32
38
|
--prototype <name> When the project publishes more than one
|
|
@@ -74,8 +80,8 @@ async function logout(ctx) {
|
|
|
74
80
|
}
|
|
75
81
|
/* ---- publish (PUB-3 to PUB-8) ---- */
|
|
76
82
|
async function publish(ctx, args) {
|
|
77
|
-
const { values, positionals } = parseArgs({ args, allowPositionals: true, options: { name: { type: 'string' }, sitemap: { type: 'string' }, behavior: { type: 'string' }, json: { type: 'boolean' } } });
|
|
78
|
-
const r = await publishBuild(ctx, { dir: positionals[0], name: values.name, sitemapFile: values.sitemap, behaviorFile: values.behavior }, values.json ? () => { } : ctx.out);
|
|
83
|
+
const { values, positionals } = parseArgs({ args, allowPositionals: true, options: { name: { type: 'string' }, sitemap: { type: 'string' }, behavior: { type: 'string' }, changes: { type: 'string' }, json: { type: 'boolean' } } });
|
|
84
|
+
const r = await publishBuild(ctx, { dir: positionals[0], name: values.name, sitemapFile: values.sitemap, behaviorFile: values.behavior, changes: values.changes }, values.json ? () => { } : ctx.out);
|
|
79
85
|
if (values.json) {
|
|
80
86
|
ctx.out(JSON.stringify(r));
|
|
81
87
|
return 0;
|
|
@@ -116,6 +122,8 @@ async function comments(ctx, args) {
|
|
|
116
122
|
ctx.out(` ${m.author}: ${m.text.replace(/\n/g, '\n ')}`);
|
|
117
123
|
if (c.instruction)
|
|
118
124
|
ctx.out(` Owner's instruction: ${c.instruction.replace(/\n/g, '\n ')}`);
|
|
125
|
+
if (c.screenshot)
|
|
126
|
+
ctx.out(` What they saw: deplhoy screenshot ${c.comment}`);
|
|
119
127
|
}
|
|
120
128
|
if (waiting)
|
|
121
129
|
ctx.out(`\n${waiting}`);
|
|
@@ -129,6 +137,24 @@ async function resolve(ctx, args) {
|
|
|
129
137
|
ctx.out(`Closed comment #${r.comment} (${r.version}).\n ${r.url}`);
|
|
130
138
|
return 0;
|
|
131
139
|
}
|
|
140
|
+
/* L14 (CTX-4): the owners' brief, links and flow notes */
|
|
141
|
+
async function context(ctx, args) {
|
|
142
|
+
const { values, positionals } = parseArgs({ args, allowPositionals: true, options: { json: { type: 'boolean' } } });
|
|
143
|
+
const r = await getContext(ctx, positionals[0]);
|
|
144
|
+
ctx.out(values.json ? JSON.stringify(r) : r.markdown);
|
|
145
|
+
return 0;
|
|
146
|
+
}
|
|
147
|
+
/* L13 (COM-7): saves a comment's capture, for agents that use the terminal instead of the MCP server */
|
|
148
|
+
async function screenshot(ctx, args) {
|
|
149
|
+
const { values, positionals } = parseArgs({ args, allowPositionals: true, options: { out: { type: 'string', short: 'o' }, prototype: { type: 'string' } } });
|
|
150
|
+
if (!positionals[0])
|
|
151
|
+
throw new CliError('Which comment? deplhoy screenshot <number>, e.g. deplhoy screenshot 3');
|
|
152
|
+
const r = await getCommentScreenshot(ctx, positionals[0], values.prototype);
|
|
153
|
+
const file = values.out ? resolvePath(ctx.cwd, values.out) : join(tmpdir(), `deplhoy-${r.slug}-comment-${r.comment}.jpg`);
|
|
154
|
+
writeFileSync(file, r.jpeg);
|
|
155
|
+
ctx.out(`Saved what the reviewer saw on #${r.comment} to ${file} (the orange dot is where they clicked).`);
|
|
156
|
+
return 0;
|
|
157
|
+
}
|
|
132
158
|
function setup(ctx) {
|
|
133
159
|
const local = ctx.env.DEPLHOY_LOCAL_BIN;
|
|
134
160
|
for (const line of setupProject(ctx.cwd, local ?? 'npx -y deplhoy'))
|
|
@@ -168,6 +194,10 @@ export async function run(argv, partial = {}) {
|
|
|
168
194
|
return await comments(ctx, rest);
|
|
169
195
|
if (cmd === 'resolve')
|
|
170
196
|
return await resolve(ctx, rest);
|
|
197
|
+
if (cmd === 'screenshot')
|
|
198
|
+
return await screenshot(ctx, rest);
|
|
199
|
+
if (cmd === 'context')
|
|
200
|
+
return await context(ctx, rest);
|
|
171
201
|
ctx.err(`Unknown command: ${cmd}\n\n${HELP}`);
|
|
172
202
|
return 1;
|
|
173
203
|
}
|
package/dist/mcp.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
Tools: publish, list (L2), get_comments, resolve_comment (L4). Agents close comments; they never move them (PUB-9). */
|
|
5
5
|
import { createInterface } from 'node:readline';
|
|
6
6
|
import { GUIDE } from './setup.js';
|
|
7
|
-
import { CliError, getComments, listPrototypes, publishBuild, resolveComment, VERSION } from './core.js';
|
|
7
|
+
import { CliError, getComments, getCommentScreenshot, getContext, listPrototypes, publishBuild, resolveComment, VERSION } from './core.js';
|
|
8
8
|
/* Sent to every agent that connects (MCP initialize), so publishing needs no `deplhoy setup` in each project (PUB-10). */
|
|
9
9
|
const INSTRUCTIONS = `deplhoy publishes static prototypes (HTML/CSS/JS builds) and returns a private URL for the person's team.
|
|
10
10
|
Use it when the person says "deplhoy this" or asks to publish, share or put the prototype online for review, or to work on its review comments.
|
|
@@ -18,13 +18,18 @@ const TOOLS = [
|
|
|
18
18
|
'Publishes a static build (a folder with index.html: dist, build or out by default) and returns its URL; every call is a new immutable version. ' +
|
|
19
19
|
'First build the project as static files, then write .deplhoy/sitemap.json (every page, and the links between them with the text of the control) and .deplhoy/behavior.md ' +
|
|
20
20
|
'(what it does, states, edge cases, fake data, open questions; at most 4 KB), or pass them as arguments: reviewers get the flow and developers the handoff. ' +
|
|
21
|
-
'
|
|
21
|
+
'A project with a backend of its own is not a reason to stop: build a static version that fakes the API in the browser (example data in localStorage, behind a build flag) and say so in behavior.md. ' +
|
|
22
|
+
'Otherwise do not change the prototype to publish it. Needs network access. The server instructions have the details.',
|
|
22
23
|
inputSchema: {
|
|
23
24
|
type: 'object',
|
|
24
25
|
properties: {
|
|
25
26
|
dir: { type: 'string', description: 'Build folder, relative to the project. Default: dist, build or out with an index.html, else the project folder.' },
|
|
26
27
|
name: { type: 'string', description: 'Prototype name. Default: the name used last time for this folder, else package.json name.' },
|
|
27
28
|
behavior: { type: 'string', description: 'Markdown, at most 4 KB: what the prototype does, its states, data and assumptions. Default: .deplhoy/behavior.md' },
|
|
29
|
+
changes: {
|
|
30
|
+
type: 'string',
|
|
31
|
+
description: 'For a new version of an existing prototype: what changed since the previous version and which comment numbers it addresses, in a few lines (markdown, at most 1 KB), e.g. "Taxes shown in the price (#12). Phone layout of the summary (#14)." Reviewers, including people outside the team, read it. Leave it out on the first publish.',
|
|
32
|
+
},
|
|
28
33
|
sitemap: {
|
|
29
34
|
type: 'object',
|
|
30
35
|
description: 'Pages and the links between them. Default: .deplhoy/sitemap.json',
|
|
@@ -58,6 +63,32 @@ const TOOLS = [
|
|
|
58
63
|
},
|
|
59
64
|
annotations: { readOnlyHint: true, openWorldHint: true },
|
|
60
65
|
},
|
|
66
|
+
{
|
|
67
|
+
name: 'get_context',
|
|
68
|
+
title: 'Read the prototype’s brief and notes',
|
|
69
|
+
description: 'The owners\' context for a prototype: its brief (goal, users, decisions, constraints), links (Figma, tickets, docs), notes on pages and arrows of the flow, and owner notes on elements. ' +
|
|
70
|
+
'Read it before working on review comments or changing the prototype, and follow it; an owner\'s instruction on a specific comment still wins.',
|
|
71
|
+
inputSchema: {
|
|
72
|
+
type: 'object',
|
|
73
|
+
properties: { prototype: { type: 'string', description: 'Slug or name. Default: the prototype this project publishes to (.deplhoy/project.json).' } },
|
|
74
|
+
},
|
|
75
|
+
annotations: { readOnlyHint: true, openWorldHint: true },
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: 'get_comment_screenshot',
|
|
79
|
+
title: 'See what a reviewer saw',
|
|
80
|
+
description: 'The capture taken when a reviewer wrote a comment (comments with screenshot: true in get_comments): the screen as they saw it, with an orange dot where they clicked. ' +
|
|
81
|
+
'Look at it when the element or state the comment is about is not clear from its target and text (an open modal, a filled form, an error message).',
|
|
82
|
+
inputSchema: {
|
|
83
|
+
type: 'object',
|
|
84
|
+
properties: {
|
|
85
|
+
comment: { type: 'integer', description: 'The comment number from get_comments.' },
|
|
86
|
+
prototype: { type: 'string', description: 'Slug or name. Default: the prototype this project publishes to.' },
|
|
87
|
+
},
|
|
88
|
+
required: ['comment'],
|
|
89
|
+
},
|
|
90
|
+
annotations: { readOnlyHint: true, openWorldHint: true },
|
|
91
|
+
},
|
|
61
92
|
{
|
|
62
93
|
name: 'resolve_comment',
|
|
63
94
|
title: 'Close a review comment',
|
|
@@ -86,6 +117,7 @@ async function callTool(ctx, name, args) {
|
|
|
86
117
|
dir: typeof args.dir === 'string' ? args.dir : undefined,
|
|
87
118
|
name: typeof args.name === 'string' ? args.name : undefined,
|
|
88
119
|
behavior: typeof args.behavior === 'string' ? args.behavior : undefined,
|
|
120
|
+
changes: typeof args.changes === 'string' ? args.changes : undefined,
|
|
89
121
|
sitemap: args.sitemap ?? undefined,
|
|
90
122
|
});
|
|
91
123
|
return text({ url: r.url, version: r.version, build_url: r.build_url, pages: r.pages, connections: r.connections, warnings: r.warnings });
|
|
@@ -97,6 +129,16 @@ async function callTool(ctx, name, args) {
|
|
|
97
129
|
const str = (x) => (typeof x === 'string' && x.trim() ? x : undefined);
|
|
98
130
|
if (name === 'get_comments')
|
|
99
131
|
return text(await getComments(ctx, str(args.prototype)));
|
|
132
|
+
if (name === 'get_context') {
|
|
133
|
+
const r = await getContext(ctx, str(args.prototype));
|
|
134
|
+
return { content: [{ type: 'text', text: r.markdown }], structuredContent: r };
|
|
135
|
+
}
|
|
136
|
+
if (name === 'get_comment_screenshot') {
|
|
137
|
+
if (args.comment === undefined)
|
|
138
|
+
return text('Pass the comment number from get_comments.', true);
|
|
139
|
+
const r = await getCommentScreenshot(ctx, args.comment, str(args.prototype));
|
|
140
|
+
return { content: [{ type: 'image', data: Buffer.from(r.jpeg).toString('base64'), mimeType: 'image/jpeg' }, { type: 'text', text: `What the reviewer saw when writing #${r.comment}; the orange dot is where they clicked.` }] };
|
|
141
|
+
}
|
|
100
142
|
if (name === 'resolve_comment') {
|
|
101
143
|
if (args.comment === undefined)
|
|
102
144
|
return text('Pass the comment number from get_comments.', true);
|
package/dist/setup.js
CHANGED
|
@@ -13,7 +13,13 @@ export const GUIDE = `## Publishing prototypes with deplhoy
|
|
|
13
13
|
|
|
14
14
|
When the person asks to publish, share or "deplhoy" this prototype:
|
|
15
15
|
|
|
16
|
-
1. **Build it as static files** (\`npm run build\` or the project's equivalent). deplhoy serves HTML, CSS and JS only: no server code, no API routes, no secrets in the build.
|
|
16
|
+
1. **Build it as static files** (\`npm run build\` or the project's equivalent). deplhoy serves HTML, CSS and JS only: no server code, no API routes, no secrets in the build.
|
|
17
|
+
- **If the prototype has a backend of its own** (a Node/Express/Next API, a database, realtime sync), don't give up: publish a static version that fakes it in the browser. People review the screens and the flow, not the server.
|
|
18
|
+
- Put the fake behind the code that calls the API (its client, fetch wrapper or store): seed it with realistic example data and keep changes in \`localStorage\`, so creating, editing and deleting still work and survive a reload. Keep the real path intact: a build flag (e.g. \`VITE_DEPLHOY=1\`) or a branch, never by deleting the backend code.
|
|
19
|
+
- Server rendering or server actions: export the pages statically and move what they fetched into the same fake.
|
|
20
|
+
- Keys for paid services (an AI model, payments, email): never put them in the build. Use canned example responses instead.
|
|
21
|
+
- Write in behavior.md what is faked and what that means for reviewers (e.g. "each reviewer sees their own data; there is no live sync"), and tell the person in your reply.
|
|
22
|
+
- Stop and ask only if faking would defeat the point of the review (e.g. the prototype is about a real integration's live results).
|
|
17
23
|
- Next.js: set \`output: 'export'\` and \`images: { unoptimized: true }\` in next.config. Dynamic routes whose ids only exist in the browser become a query string (\`/cards?id=…\` instead of \`/cards/[id]\`). Make these changes on a branch and say so.
|
|
18
24
|
- Vite, React, Vue, Svelte, plain HTML: build as usual.
|
|
19
25
|
2. **Update \`.deplhoy/sitemap.json\`**: every page a person can reach, and the links between pages with the text of the control that navigates. Group pages by flow if it helps. A page that only shows other data by query string (\`/product?id=…\`) goes once, with one example; list a query variant as its own page only when it is a different state (\`/checkout?price=up\`). deplhoy draws the flow from this file and adds the pages people reach that are missing.
|
|
@@ -30,14 +36,15 @@ When the person asks to publish, share or "deplhoy" this prototype:
|
|
|
30
36
|
If the project has design-system components, keep \`data-ds-component="Name"\` (and \`data-ds-variant\`) on their root element: the handoff lists them with their measures and CSS variables.
|
|
31
37
|
3. **Update \`.deplhoy/behavior.md\`** (at most 4 KB): what the prototype does, its states and edge cases, which data is fake, what is out of scope, and open questions. Reviewers and developers read it.
|
|
32
38
|
4. **Publish** with the deplhoy MCP tool \`publish\`, or \`npx deplhoy publish\` in a terminal. Building and publishing need network access: ask for it if you run in a sandbox.
|
|
39
|
+
- **For a new version** of a prototype already published, pass \`changes\` (\`--changes\` in the terminal): what changed since the previous version and which comment numbers it addresses, in a few lines, e.g. "Taxes shown in the price (#12). Phone layout of the summary (#14)." Reviewers outside the team read it too: describe the prototype, not the people or the internal discussion. Leave it out on the first publish.
|
|
33
40
|
5. **Reply** with the URL and the version, plus any warnings. If publishing reports secret keys, show the file and line and do not remove anything without asking.
|
|
34
41
|
|
|
35
|
-
Publishing does not change the prototype: do not edit its content or copy to publish it. If you notice a problem, mention it in the reply or under open questions in behavior.md.
|
|
42
|
+
Publishing does not change the prototype: do not edit its content or copy to publish it (faking a backend as above is the one exception, and it keeps the screens as they are). If you notice a problem, mention it in the reply or under open questions in behavior.md.
|
|
36
43
|
|
|
37
44
|
When the person asks to work on the review comments:
|
|
38
|
-
1. Read them with the MCP tool \`get_comments\` (or \`npx deplhoy comments --json\`). You only get the comments an owner sent to agents. Each one says the element it is pinned to (role, text, page, device), its thread and, when the owner gave one, an \`instruction\`: follow it, it is the owner's decision on that feedback. Comments "pending" from an earlier version may already be fixed: check the code.
|
|
39
|
-
2. Change the prototype, only what the comments ask (mention anything else you notice), then build and publish as above.
|
|
40
|
-
3.
|
|
45
|
+
1. Read them with the MCP tool \`get_comments\` (or \`npx deplhoy comments --json\`). You only get the comments an owner sent to agents. Each one says the element it is pinned to (role, text, page, device), its thread and, when the owner gave one, an \`instruction\`: follow it, it is the owner's decision on that feedback. Comments "pending" from an earlier version may already be fixed: check the code. A comment with \`screenshot: true\` has a capture of what the reviewer saw, with a dot where they clicked: look at it with \`get_comment_screenshot\` (or \`npx deplhoy screenshot <number>\`) when the target and text are not enough. When \`get_comments\` says the prototype has context, read it first with \`get_context\` (or \`npx deplhoy context\`): the owners' brief (goal, users, decisions, constraints), links and notes on the flow. Follow it.
|
|
46
|
+
2. Change the prototype, only what the comments ask (mention anything else you notice), then build and publish as above, with \`changes\` naming the comments it addresses.
|
|
47
|
+
3. After publishing, close each comment you addressed with \`resolve_comment\` (or \`npx deplhoy resolve <number> -m "…"\`) and a short message saying what changed: it is resolved in the version you just published, and the people who wrote in it get one email. Leave the others open and say why in your reply. Never close owner notes; you cannot move comments between versions. If \`waiting_for_owner\` is above 0, tell the person how many comments wait for their decision in the app.
|
|
41
48
|
|
|
42
49
|
\`.deplhoy/project.json\` remembers which prototype this folder publishes to: keep it out of git.`;
|
|
43
50
|
export const AGENT_INSTRUCTIONS = `${START}\n${GUIDE}\n${END}`;
|
|
@@ -50,9 +57,9 @@ description: Publish this prototype to deplhoy and get a private URL for the tea
|
|
|
50
57
|
|
|
51
58
|
Follow the "Publishing prototypes with deplhoy" section of AGENTS.md in this project. In short:
|
|
52
59
|
|
|
53
|
-
1. Build static files.
|
|
60
|
+
1. Build static files. If it has a backend of its own, fake it in the browser (example data in localStorage, behind a build flag), say so in behavior.md, and publish that.
|
|
54
61
|
2. Update \`.deplhoy/sitemap.json\` (entry, pages, links with the text of the control) and \`.deplhoy/behavior.md\` (at most 4 KB).
|
|
55
|
-
3. Call the \`publish\` tool of the deplhoy MCP server (or run \`npx deplhoy publish\`). It needs network access.
|
|
62
|
+
3. Call the \`publish\` tool of the deplhoy MCP server (or run \`npx deplhoy publish\`). It needs network access. For a new version, pass \`changes\`: what changed and which comment numbers it addresses.
|
|
56
63
|
4. Reply with the URL, the version and any warnings.
|
|
57
64
|
|
|
58
65
|
For review comments: \`get_comments\`, change and publish, then \`resolve_comment\` with what changed for each one you addressed.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "deplhoy",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Publish prototypes from your agent and get a URL. CLI + MCP server.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"prototype",
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"deploy"
|
|
13
13
|
],
|
|
14
14
|
"homepage": "https://deplhoy.app",
|
|
15
|
+
"author": "Terracotes Design S.L.",
|
|
15
16
|
"license": "UNLICENSED",
|
|
16
17
|
"type": "module",
|
|
17
18
|
"bin": {
|