deplhoy 0.3.1 → 0.4.1
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 +2 -3
- package/dist/config.js +11 -0
- package/dist/core.js +1 -1
- package/dist/mcp.js +13 -7
- package/dist/setup.js +15 -14
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,10 +6,9 @@ deplhoy is in closed beta: request access at [deplhoy.app](https://deplhoy.app).
|
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
npx -y deplhoy login # once: confirm in the browser
|
|
9
|
-
npx -y deplhoy setup # once per project: teaches your agent to publish (AGENTS.md, CLAUDE.md, skill)
|
|
10
9
|
```
|
|
11
10
|
|
|
12
|
-
Add the MCP server to your agent once:
|
|
11
|
+
Add the MCP server to your agent once (it tells the agent how to publish, in every project):
|
|
13
12
|
|
|
14
13
|
```bash
|
|
15
14
|
claude mcp add deplhoy -- npx -y deplhoy mcp # Claude Code
|
|
@@ -22,4 +21,4 @@ Then tell your agent "deplhoy this". Or publish a build folder yourself:
|
|
|
22
21
|
npx -y deplhoy publish dist --name "My prototype"
|
|
23
22
|
```
|
|
24
23
|
|
|
25
|
-
Run `npx -y deplhoy --help` for every command. Needs Node.js 20 or later.
|
|
24
|
+
Optional: `npx -y deplhoy setup` in a project writes the same instructions into its AGENTS.md and CLAUDE.md. Run `npx -y deplhoy --help` for every command. Needs Node.js 20 or later.
|
package/dist/config.js
CHANGED
|
@@ -45,4 +45,15 @@ export function writeProject(cwd, buildKey, entry) {
|
|
|
45
45
|
file.prototypes = { ...(file.prototypes ?? {}), [buildKey]: entry };
|
|
46
46
|
mkdirSync(dirname(path), { recursive: true });
|
|
47
47
|
writeFileSync(path, JSON.stringify(file, null, 2) + '\n');
|
|
48
|
+
// without `deplhoy setup` too: in a git project, which prototype a folder publishes to stays on this machine
|
|
49
|
+
if (existsSync(join(cwd, '.git')) || existsSync(join(cwd, '.gitignore')))
|
|
50
|
+
ensureLine(join(cwd, '.gitignore'), '.deplhoy/project.json');
|
|
51
|
+
}
|
|
52
|
+
/** Appends a line to a text file unless it is already there. True when it was added. */
|
|
53
|
+
export function ensureLine(path, line) {
|
|
54
|
+
const current = existsSync(path) ? readFileSync(path, 'utf8') : '';
|
|
55
|
+
if (current.split('\n').some((l) => l.trim() === line))
|
|
56
|
+
return false;
|
|
57
|
+
writeFileSync(path, current.replace(/\s*$/, current ? '\n' : '') + line + '\n');
|
|
58
|
+
return true;
|
|
48
59
|
}
|
package/dist/core.js
CHANGED
|
@@ -5,7 +5,7 @@ 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.4.1';
|
|
9
9
|
export const BEHAVIOR_MAX_BYTES = 4 * 1024; // same limit as the API
|
|
10
10
|
export class CliError extends Error {
|
|
11
11
|
code;
|
package/dist/mcp.js
CHANGED
|
@@ -3,17 +3,23 @@
|
|
|
3
3
|
stdout carries protocol messages only; anything for a human goes to stderr.
|
|
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
|
+
import { GUIDE } from './setup.js';
|
|
6
7
|
import { CliError, getComments, listPrototypes, publishBuild, resolveComment, VERSION } from './core.js';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
/* Sent to every agent that connects (MCP initialize), so publishing needs no `deplhoy setup` in each project (PUB-10). */
|
|
9
|
+
const INSTRUCTIONS = `deplhoy publishes static prototypes (HTML/CSS/JS builds) and returns a private URL for the person's team.
|
|
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.
|
|
11
|
+
|
|
12
|
+
${GUIDE.replace(/^## .*\n+/, '')}`;
|
|
11
13
|
const TOOLS = [
|
|
12
14
|
{
|
|
13
15
|
name: 'publish',
|
|
14
16
|
title: 'Publish a prototype',
|
|
15
|
-
description: '
|
|
16
|
-
'
|
|
17
|
+
description: 'Use when the person says "deplhoy this" or asks to publish or share the prototype. ' +
|
|
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
|
+
'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
|
+
'(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
|
+
'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.',
|
|
17
23
|
inputSchema: {
|
|
18
24
|
type: 'object',
|
|
19
25
|
properties: {
|
|
@@ -44,7 +50,7 @@ const TOOLS = [
|
|
|
44
50
|
{
|
|
45
51
|
name: 'get_comments',
|
|
46
52
|
title: 'Get open review comments',
|
|
47
|
-
description: 'Open review comments an owner sent to agents: on the live version, plus pending ones from earlier versions. Each has a number, the element it is pinned to ' +
|
|
53
|
+
description: 'Use when the person asks to work on the review comments or feedback. Open review comments an owner sent to agents: on the live version, plus pending ones from earlier versions. Each has a number, the element it is pinned to ' +
|
|
48
54
|
'(role, text, page, device), its thread and the owner\'s instruction, if any, which wins over the comment. Owner notes (kind "note") are context for the handoff: never close them. ' +
|
|
49
55
|
'waiting_for_owner counts comments the owner has not decided on yet: you cannot see or close them.',
|
|
50
56
|
inputSchema: {
|
package/dist/setup.js
CHANGED
|
@@ -4,14 +4,22 @@
|
|
|
4
4
|
Re-running it updates the block in place (between the deplhoy:start/end markers). */
|
|
5
5
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
6
6
|
import { dirname, join } from 'node:path';
|
|
7
|
+
import { ensureLine } from './config.js';
|
|
7
8
|
const START = '<!-- deplhoy:start -->';
|
|
8
9
|
const END = '<!-- deplhoy:end -->';
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
/** What an agent needs to know to publish with deplhoy. The MCP server sends it to every agent it connects to (so `setup`
|
|
11
|
+
is optional); `setup` also writes it into AGENTS.md and CLAUDE.md for agents without the MCP server. */
|
|
12
|
+
export const GUIDE = `## Publishing prototypes with deplhoy
|
|
11
13
|
|
|
12
14
|
When the person asks to publish, share or "deplhoy" this prototype:
|
|
13
15
|
|
|
14
|
-
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).
|
|
15
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.
|
|
16
24
|
- Vite, React, Vue, Svelte, plain HTML: build as usual.
|
|
17
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,15 +38,15 @@ When the person asks to publish, share or "deplhoy" this prototype:
|
|
|
30
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.
|
|
31
39
|
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.
|
|
32
40
|
|
|
33
|
-
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.
|
|
41
|
+
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.
|
|
34
42
|
|
|
35
43
|
When the person asks to work on the review comments:
|
|
36
44
|
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.
|
|
37
45
|
2. Change the prototype, only what the comments ask (mention anything else you notice), then build and publish as above.
|
|
38
46
|
3. Close each comment you addressed with \`resolve_comment\` (or \`npx deplhoy resolve <number> -m "…"\`) and a short message saying what changed. 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.
|
|
39
47
|
|
|
40
|
-
\`.deplhoy/project.json\` remembers which prototype this folder publishes to: keep it out of git
|
|
41
|
-
${END}`;
|
|
48
|
+
\`.deplhoy/project.json\` remembers which prototype this folder publishes to: keep it out of git.`;
|
|
49
|
+
export const AGENT_INSTRUCTIONS = `${START}\n${GUIDE}\n${END}`;
|
|
42
50
|
export const SKILL = `---
|
|
43
51
|
name: deplhoy
|
|
44
52
|
description: Publish this prototype to deplhoy and get a private URL for the team, and work on its review comments. Use when the person says "deplhoy this", asks to publish, share or put the prototype online for review, asks for a link to it, or asks to address the comments or feedback on it.
|
|
@@ -48,7 +56,7 @@ description: Publish this prototype to deplhoy and get a private URL for the tea
|
|
|
48
56
|
|
|
49
57
|
Follow the "Publishing prototypes with deplhoy" section of AGENTS.md in this project. In short:
|
|
50
58
|
|
|
51
|
-
1. Build static files.
|
|
59
|
+
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.
|
|
52
60
|
2. Update \`.deplhoy/sitemap.json\` (entry, pages, links with the text of the control) and \`.deplhoy/behavior.md\` (at most 4 KB).
|
|
53
61
|
3. Call the \`publish\` tool of the deplhoy MCP server (or run \`npx deplhoy publish\`). It needs network access.
|
|
54
62
|
4. Reply with the URL, the version and any warnings.
|
|
@@ -73,13 +81,6 @@ export function upsertBlock(path, block) {
|
|
|
73
81
|
writeFileSync(path, current.replace(/\s*$/, '\n\n') + block + '\n');
|
|
74
82
|
return 'added';
|
|
75
83
|
}
|
|
76
|
-
function ensureLine(path, line) {
|
|
77
|
-
const current = existsSync(path) ? readFileSync(path, 'utf8') : '';
|
|
78
|
-
if (current.split('\n').some((l) => l.trim() === line))
|
|
79
|
-
return false;
|
|
80
|
-
writeFileSync(path, current.replace(/\s*$/, current ? '\n' : '') + line + '\n');
|
|
81
|
-
return true;
|
|
82
|
-
}
|
|
83
84
|
export function setupProject(cwd, mcpCommand) {
|
|
84
85
|
const done = [];
|
|
85
86
|
const agents = join(cwd, 'AGENTS.md');
|