@mercury-fw/cli 0.28.2 → 0.28.3
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 +7 -0
- package/package.json +3 -3
- package/src/render.ts +24 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @mercury-fw/cli
|
|
2
2
|
|
|
3
|
+
## 0.28.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 5175e10: An app created with the HTTP channel publishes the surface's port on the host (`HTTP_SURFACE_PORT`, 4100 when unset), so it's reachable from outside the container; its README says where it listens and that it has no authentication.
|
|
8
|
+
- @mercury-fw/core@0.28.3
|
|
9
|
+
|
|
3
10
|
## 0.28.2
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mercury-fw/cli",
|
|
3
|
-
"version": "0.28.
|
|
3
|
+
"version": "0.28.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -36,13 +36,13 @@
|
|
|
36
36
|
"comment:shape": "The Mercury CLI (`mfw`). `mfw create <dir>` writes a new Mercury app from the template. The framework packages move in lockstep with it, so a new app gets them at the CLI's own version; plugins and channels at the registry's latest. The plugin and channel packages are devDependencies only for the catalog test. `main(argv)` is exported for create-mercury-agent.",
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@clack/prompts": "^1.8.1",
|
|
39
|
-
"@mercury-fw/core": "0.28.
|
|
39
|
+
"@mercury-fw/core": "0.28.3",
|
|
40
40
|
"commander": "^15.0.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@mercury-fw/channel-google-chat": "0.1.2",
|
|
44
44
|
"@mercury-fw/channel-http": "0.1.0",
|
|
45
|
-
"@mercury-fw/formatter": "0.28.
|
|
45
|
+
"@mercury-fw/formatter": "0.28.3",
|
|
46
46
|
"@mercury-fw/plugin-atlassian-admin": "0.1.0",
|
|
47
47
|
"@mercury-fw/plugin-bitbucket": "0.1.0",
|
|
48
48
|
"@mercury-fw/plugin-jira": "0.1.1",
|
package/src/render.ts
CHANGED
|
@@ -70,7 +70,7 @@ export function renderApp(input: RenderInput): Map<string, string> {
|
|
|
70
70
|
[".gitignore", gitignore],
|
|
71
71
|
["Dockerfile", renderDockerfile(tools)],
|
|
72
72
|
["README.md", renderReadme(input.name, channels, tools)],
|
|
73
|
-
["docker-compose.yml", renderCompose(input.name, tools.length > 0)],
|
|
73
|
+
["docker-compose.yml", renderCompose(input.name, tools.length > 0, channels.some((c) => c.id === "http"))],
|
|
74
74
|
["markdown.d.ts", markdownDts],
|
|
75
75
|
["mercury.config.ts", renderConfig(channels, tools)],
|
|
76
76
|
["package.json", renderPackageJson(input.name, channels, tools, input.versions)],
|
|
@@ -318,8 +318,9 @@ function renderEnv(channels: CatalogEntry[], tools: CatalogEntry[]): string {
|
|
|
318
318
|
}
|
|
319
319
|
|
|
320
320
|
/** `docker-compose.yml`: the app and Qdrant, with named volumes prefixed by the
|
|
321
|
-
* app's name; the CLI credentials volume only when a tool plugin was chosen
|
|
322
|
-
|
|
321
|
+
* app's name; the CLI credentials volume only when a tool plugin was chosen,
|
|
322
|
+
* the HTTP surface's port published on the host only with the HTTP channel. */
|
|
323
|
+
function renderCompose(name: string, hasTools: boolean, hasHttp: boolean): string {
|
|
323
324
|
const credentialsMount = hasTools
|
|
324
325
|
? [
|
|
325
326
|
" # The tool plugins' CLI credentials, on a volume so what a CLI writes back",
|
|
@@ -327,6 +328,13 @@ function renderCompose(name: string, hasTools: boolean): string {
|
|
|
327
328
|
" - cli-credentials:/home/mercury/.config",
|
|
328
329
|
]
|
|
329
330
|
: [];
|
|
331
|
+
const httpPort = hasHttp
|
|
332
|
+
? [
|
|
333
|
+
" # The HTTP surface, on the host: no authentication, keep it off the public network.",
|
|
334
|
+
" ports:",
|
|
335
|
+
' - "${HTTP_SURFACE_PORT:-4100}:${HTTP_SURFACE_PORT:-4100}"',
|
|
336
|
+
]
|
|
337
|
+
: [];
|
|
330
338
|
const credentialsVolume = hasTools ? [" cli-credentials:", ` name: ${name}_cli-credentials`] : [];
|
|
331
339
|
return [
|
|
332
340
|
"services:",
|
|
@@ -340,6 +348,7 @@ function renderCompose(name: string, hasTools: boolean): string {
|
|
|
340
348
|
" volumes:",
|
|
341
349
|
" - wiki-vault:/app/wiki-vault",
|
|
342
350
|
...credentialsMount,
|
|
351
|
+
...httpPort,
|
|
343
352
|
" extra_hosts:",
|
|
344
353
|
' - "host.docker.internal:host-gateway"',
|
|
345
354
|
" depends_on:",
|
|
@@ -387,7 +396,18 @@ bunx mfw repl
|
|
|
387
396
|
\`\`\`
|
|
388
397
|
|
|
389
398
|
\`bun install\` here gives your editor, \`bun run typecheck\` and \`mfw\` the packages (tool plugins download their CLI binary as they install); the image installs its own copy when it builds. \`bunx mfw start\` builds the image and starts the app with Qdrant in the background, \`bunx mfw repl\` opens a terminal conversation with the assistant. \`bunx mfw --help\` lists the rest: stopping and restarting, logs, a shell in the container, the wiki and the memory, and resetting them.
|
|
390
|
-
${renderCredentialsSection(withCredentials(tools))}`;
|
|
399
|
+
${renderHttpSection(channels)}${renderCredentialsSection(withCredentials(tools))}`;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
/** The README section on the HTTP surface, for an app with the HTTP channel;
|
|
403
|
+
* nothing without it. */
|
|
404
|
+
function renderHttpSection(channels: CatalogEntry[]): string {
|
|
405
|
+
if (!channels.some((c) => c.id === "http")) return "";
|
|
406
|
+
return `
|
|
407
|
+
## HTTP surface
|
|
408
|
+
|
|
409
|
+
The HTTP channel listens on \`http://<host>:4100\`, the port in \`HTTP_SURFACE_PORT\` (the compose file publishes whatever port it holds on the host). It has no authentication: whoever reaches the port can talk to the assistant, so keep it on a network you trust.
|
|
410
|
+
`;
|
|
391
411
|
}
|
|
392
412
|
|
|
393
413
|
/** The README section on CLI credentials, for an app with tool plugins;
|