deplhoy 0.3.0 → 0.4.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 +2 -3
- package/dist/config.js +11 -0
- package/dist/core.js +1 -1
- package/dist/index.js +10 -1
- package/dist/mcp.js +12 -7
- package/dist/setup.js +6 -11
- 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.0';
|
|
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/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
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';
|
|
5
|
+
import { fileURLToPath } from 'node:url';
|
|
4
6
|
import { hostname } from 'node:os';
|
|
5
7
|
import { parseArgs } from 'node:util';
|
|
6
8
|
import { DEFAULT_API, readAccount, writeAccount } from './config.js';
|
|
@@ -181,6 +183,13 @@ function openInBrowser(url) {
|
|
|
181
183
|
}
|
|
182
184
|
catch { /* the URL is printed anyway */ }
|
|
183
185
|
}
|
|
184
|
-
|
|
186
|
+
/* npx and npm install run the CLI through a symlink (node_modules/.bin/deplhoy): compare real paths */
|
|
187
|
+
const realPath = (p) => { try {
|
|
188
|
+
return realpathSync(p);
|
|
189
|
+
}
|
|
190
|
+
catch {
|
|
191
|
+
return p;
|
|
192
|
+
} };
|
|
193
|
+
const isMain = !!process.argv[1] && realPath(process.argv[1]) === realPath(fileURLToPath(import.meta.url));
|
|
185
194
|
if (isMain)
|
|
186
195
|
run(process.argv.slice(2)).then((code) => { process.exitCode = code; });
|
package/dist/mcp.js
CHANGED
|
@@ -3,17 +3,22 @@
|
|
|
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
|
+
'Do not change the prototype to publish it. Needs network access. The server instructions have the details.',
|
|
17
22
|
inputSchema: {
|
|
18
23
|
type: 'object',
|
|
19
24
|
properties: {
|
|
@@ -44,7 +49,7 @@ const TOOLS = [
|
|
|
44
49
|
{
|
|
45
50
|
name: 'get_comments',
|
|
46
51
|
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 ' +
|
|
52
|
+
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
53
|
'(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
54
|
'waiting_for_owner counts comments the owner has not decided on yet: you cannot see or close them.',
|
|
50
55
|
inputSchema: {
|
package/dist/setup.js
CHANGED
|
@@ -4,10 +4,12 @@
|
|
|
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
|
|
|
@@ -37,8 +39,8 @@ When the person asks to work on the review comments:
|
|
|
37
39
|
2. Change the prototype, only what the comments ask (mention anything else you notice), then build and publish as above.
|
|
38
40
|
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
41
|
|
|
40
|
-
\`.deplhoy/project.json\` remembers which prototype this folder publishes to: keep it out of git
|
|
41
|
-
${END}`;
|
|
42
|
+
\`.deplhoy/project.json\` remembers which prototype this folder publishes to: keep it out of git.`;
|
|
43
|
+
export const AGENT_INSTRUCTIONS = `${START}\n${GUIDE}\n${END}`;
|
|
42
44
|
export const SKILL = `---
|
|
43
45
|
name: deplhoy
|
|
44
46
|
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.
|
|
@@ -73,13 +75,6 @@ export function upsertBlock(path, block) {
|
|
|
73
75
|
writeFileSync(path, current.replace(/\s*$/, '\n\n') + block + '\n');
|
|
74
76
|
return 'added';
|
|
75
77
|
}
|
|
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
78
|
export function setupProject(cwd, mcpCommand) {
|
|
84
79
|
const done = [];
|
|
85
80
|
const agents = join(cwd, 'AGENTS.md');
|