@evref-bl/pharo-agent 0.5.5 → 0.6.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/.claude-plugin/plugin.json +1 -1
- package/README.md +18 -0
- package/package.json +4 -4
- package/plugin.json +1 -1
- package/skills/pharo-setup/SKILL.md +10 -3
- package/src/cli.js +7 -24
- package/src/help.js +92 -0
- package/src/init.js +7 -0
package/README.md
CHANGED
|
@@ -17,6 +17,20 @@ workflow skills that guidance refers to. From there the agent registers the
|
|
|
17
17
|
image the project needs, opens it and uses its tools by following what was
|
|
18
18
|
written; ask it for Pharo work as you would for anything else.
|
|
19
19
|
|
|
20
|
+
## Refreshing an existing project
|
|
21
|
+
|
|
22
|
+
After upgrading the plugin/CLI through your usual installation method, re-run
|
|
23
|
+
`pharo-agent init --host <claude|codex|opencode>` from the project root with
|
|
24
|
+
the same host. This refreshes the generated guidance, skills, and references
|
|
25
|
+
using that CLI version's pinned templates. Image declarations, existing plugin
|
|
26
|
+
settings, and guidance outside the host's managed block are preserved when
|
|
27
|
+
you omit `--mount-root`.
|
|
28
|
+
|
|
29
|
+
Generated/copied files are overwritten, so keep project-specific instructions
|
|
30
|
+
outside them. Refreshing project files does not upgrade the installed package
|
|
31
|
+
or update, restart, or save existing images. See [Hosts](docs/hosts.md) for
|
|
32
|
+
the file ownership rules and [Images](docs/images.md) for image-side MCP updates.
|
|
33
|
+
|
|
20
34
|
## Requirements
|
|
21
35
|
|
|
22
36
|
Node 22.12 or later.
|
|
@@ -26,6 +40,10 @@ The source projection currently supports macOS and needs
|
|
|
26
40
|
|
|
27
41
|
## What the agent gets
|
|
28
42
|
|
|
43
|
+
Use `pharo-agent --help` for the command overview, or append `--help` to a
|
|
44
|
+
command for its options, defaults, and an example: `pharo-agent init --help`
|
|
45
|
+
or `pharo-agent image add --help`. Help works before project setup.
|
|
46
|
+
|
|
29
47
|
Reference, for reading rather than typing: these are the commands the guidance
|
|
30
48
|
hands to the agent.
|
|
31
49
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@evref-bl/pharo-agent",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Terminal-first Pharo integration for coding agents.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
"test": "node --test"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@evref-bl/pharo-mcp": "2.
|
|
35
|
-
"@evref-bl/plexus": "0.5.
|
|
36
|
-
"@evref-bl/plexus-gateway": "0.5.
|
|
34
|
+
"@evref-bl/pharo-mcp": "2.2.0",
|
|
35
|
+
"@evref-bl/plexus": "0.5.6",
|
|
36
|
+
"@evref-bl/plexus-gateway": "0.5.6",
|
|
37
37
|
"@modelcontextprotocol/sdk": "1.32.1"
|
|
38
38
|
}
|
|
39
39
|
}
|
package/plugin.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: pharo-setup
|
|
3
|
-
description: Enable Pharo image tooling in the current Pharo project.
|
|
3
|
+
description: Enable or refresh Pharo image tooling in the current Pharo project.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
Run this only when the user asks to enable Pharo tooling in this project.
|
|
6
|
+
Run this only when the user asks to enable or refresh Pharo tooling in this project.
|
|
7
7
|
|
|
8
8
|
From the project root, run the released CLI that matches this plugin:
|
|
9
9
|
|
|
10
10
|
```sh
|
|
11
|
-
npx --yes @evref-bl/pharo-agent@0.
|
|
11
|
+
npx --yes @evref-bl/pharo-agent@0.6.0 init --host claude
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
Name the host this chat runs in: `--host claude` in Claude Code,
|
|
@@ -16,6 +16,13 @@ Name the host this chat runs in: `--host claude` in Claude Code,
|
|
|
16
16
|
Do not configure an MCP server in the agent host. The command adds only a
|
|
17
17
|
conditional instruction block, so Pharo guidance stays out of unrelated work.
|
|
18
18
|
|
|
19
|
+
After upgrading the plugin/CLI, re-run the setup command from the project root
|
|
20
|
+
with the same host to refresh the generated guide and copied skills/references.
|
|
21
|
+
Those files are overwritten; keep project-specific guidance outside the host's
|
|
22
|
+
managed block and outside generated/copied paths. Omit `--mount-root` to retain
|
|
23
|
+
existing settings. Image declarations, runtime state, and live image code are
|
|
24
|
+
preserved. This refresh does not install a newer package or upgrade image tools.
|
|
25
|
+
|
|
19
26
|
Setup initializes the current directory, creating `plexus.json` with
|
|
20
27
|
no image when it is absent. Register one before the first `pharo-agent open`:
|
|
21
28
|
|
package/src/cli.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { hostChoices, hostList } from "./hosts.js";
|
|
2
|
+
import { usage } from "./help.js";
|
|
2
3
|
import { initialize } from "./init.js";
|
|
3
4
|
import { addImage, listImages, removeImage, useImage } from "./images.js";
|
|
4
5
|
import { callImageTool, listImageTools, serveImagesMcp } from "./gateway.js";
|
|
@@ -72,24 +73,6 @@ function takeImageOption(args) {
|
|
|
72
73
|
return { image, rest: [...args.slice(0, index), ...args.slice(index + 2)] };
|
|
73
74
|
}
|
|
74
75
|
|
|
75
|
-
function usage() {
|
|
76
|
-
return [
|
|
77
|
-
"Usage:",
|
|
78
|
-
` pharo-agent init --host <${hostChoices()}> [--mount-root <path>]`,
|
|
79
|
-
" pharo-agent image list",
|
|
80
|
-
" pharo-agent image templates",
|
|
81
|
-
" pharo-agent image add <id> --template <name> [--category <name>] [--profile <id>]",
|
|
82
|
-
" pharo-agent image use <id>",
|
|
83
|
-
" pharo-agent image remove <id>",
|
|
84
|
-
" pharo-agent open [--image <id>]",
|
|
85
|
-
" pharo-agent status",
|
|
86
|
-
" pharo-agent close [--image <id>]",
|
|
87
|
-
" pharo-agent mcp [--image <id>]",
|
|
88
|
-
" pharo-agent pharo list [--image <id>]",
|
|
89
|
-
" pharo-agent pharo <tool> [arguments-json] [--image <id>]",
|
|
90
|
-
].join("\n");
|
|
91
|
-
}
|
|
92
|
-
|
|
93
76
|
function requireNoArguments(command, args) {
|
|
94
77
|
if (args.length > 0) {
|
|
95
78
|
throw new Error(`${command} does not accept arguments`);
|
|
@@ -120,16 +103,16 @@ export function exitCodeForToolResult(result) {
|
|
|
120
103
|
|
|
121
104
|
export async function main(args) {
|
|
122
105
|
const [command, ...rest] = args;
|
|
123
|
-
if (command === "init") {
|
|
124
|
-
const result = initialize(parseInit(rest));
|
|
125
|
-
console.log(JSON.stringify({ ok: true, ...result }, null, 2));
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
106
|
// A caller reaching for help is asking the same question wherever the word
|
|
129
107
|
// lands, and `image add --help` answering that it needs an image id is no
|
|
130
108
|
// answer at all.
|
|
131
109
|
if (!command || args.some((value) => value === "--help" || value === "help")) {
|
|
132
|
-
console.log(usage());
|
|
110
|
+
console.log(usage(args.filter((value) => value !== "--help" && value !== "help")));
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
if (command === "init") {
|
|
114
|
+
const result = initialize(parseInit(rest));
|
|
115
|
+
console.log(JSON.stringify({ ok: true, ...result }, null, 2));
|
|
133
116
|
return;
|
|
134
117
|
}
|
|
135
118
|
const projectRoot = findProjectRoot();
|
package/src/help.js
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { hostChoices, hostIds } from "./hosts.js";
|
|
2
|
+
|
|
3
|
+
const commands = {
|
|
4
|
+
init: {
|
|
5
|
+
usage: `init --host <${hostChoices()}> [--mount-root <path>]`,
|
|
6
|
+
description: "Initialize the current project for the required agent host. Write its managed instruction block,\n"
|
|
7
|
+
+ "pharo.AGENTS.md, and workflow skills/references. Re-run to refresh those generated files.\n"
|
|
8
|
+
+ "The mount root defaults to .pharo-agent/mounts; omit --mount-root to keep an existing setting.",
|
|
9
|
+
example: `init --host ${hostIds[0]}`,
|
|
10
|
+
},
|
|
11
|
+
"image list": {
|
|
12
|
+
usage: "image list",
|
|
13
|
+
description: "List the project's declared images, default image, and recorded open state.",
|
|
14
|
+
example: "image list",
|
|
15
|
+
},
|
|
16
|
+
"image templates": {
|
|
17
|
+
usage: "image templates",
|
|
18
|
+
description: "List available launcher templates and their categories. A name in several categories\n"
|
|
19
|
+
+ "needs --category when passed to image add.",
|
|
20
|
+
example: "image templates",
|
|
21
|
+
},
|
|
22
|
+
"image add": {
|
|
23
|
+
usage: "image add <id> --template <name> [--category <name>] [--profile <id>]",
|
|
24
|
+
description: "Declare an image with a required id and template name; open creates it later.\n"
|
|
25
|
+
+ "Use --category for an ambiguous template name and --profile to choose a launcher profile.\n"
|
|
26
|
+
+ "The first declared image becomes the default.",
|
|
27
|
+
example: "image add dev --template '<template name>'",
|
|
28
|
+
},
|
|
29
|
+
"image use": {
|
|
30
|
+
usage: "image use <id>",
|
|
31
|
+
description: "Make the required declared image the project's default. It may already be open.",
|
|
32
|
+
example: "image use dev",
|
|
33
|
+
},
|
|
34
|
+
"image remove": {
|
|
35
|
+
usage: "image remove <id>",
|
|
36
|
+
description: "Remove the required image declaration. Close the image first. Its image files are kept.\n"
|
|
37
|
+
+ "Removing the default image clears the default selection.",
|
|
38
|
+
example: "image remove dev",
|
|
39
|
+
},
|
|
40
|
+
open: {
|
|
41
|
+
usage: "open [--image <id>]",
|
|
42
|
+
description: "Create if needed and open an image with its tools and source projection. Omit --image\n"
|
|
43
|
+
+ "to use the project's default image. Other open images stay open. Pharo versions outside\n"
|
|
44
|
+
+ "the MCP support range open without tools or a source projection.",
|
|
45
|
+
example: "open --image dev",
|
|
46
|
+
},
|
|
47
|
+
status: {
|
|
48
|
+
usage: "status",
|
|
49
|
+
description: "Report all images this project has open. This command does not accept --image.",
|
|
50
|
+
example: "status",
|
|
51
|
+
},
|
|
52
|
+
close: {
|
|
53
|
+
usage: "close [--image <id>]",
|
|
54
|
+
description: "Close the selected image and its source projection. Omitting --image closes all images\n"
|
|
55
|
+
+ "this project opened, rather than only the default image.",
|
|
56
|
+
example: "close --image dev",
|
|
57
|
+
},
|
|
58
|
+
mcp: {
|
|
59
|
+
usage: "mcp [--image <id>]",
|
|
60
|
+
description: "Expose an open image's tools as a command-scoped stdio MCP server. Omit --image\n"
|
|
61
|
+
+ "to use the project's default image. The server exits with this command.",
|
|
62
|
+
example: "mcp --image dev",
|
|
63
|
+
},
|
|
64
|
+
"pharo list": {
|
|
65
|
+
usage: "pharo list [--image <id>]",
|
|
66
|
+
description: "List an open image's advertised tools. Omit --image to use the project's default image.\n"
|
|
67
|
+
+ "Use tool_search and tool_get to discover and inspect the rest of its catalogue.",
|
|
68
|
+
example: "pharo list",
|
|
69
|
+
},
|
|
70
|
+
pharo: {
|
|
71
|
+
usage: "pharo <tool> [arguments-json] [--image <id>]",
|
|
72
|
+
description: "Call a tool in an open image. Arguments must be a JSON object and default to {}.\n"
|
|
73
|
+
+ "Omit --image to use the project's default image. Inspect the tool's schema with tool_get\n"
|
|
74
|
+
+ "before calling it; a failed tool result makes the command exit unsuccessfully.",
|
|
75
|
+
example: 'pharo tool_get \'{"name":"class_search"}\'',
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export function usage(args = []) {
|
|
80
|
+
const key = ["image", "pharo"].includes(args[0]) && args[1]
|
|
81
|
+
? `${args[0]} ${args[1]}`
|
|
82
|
+
: args[0];
|
|
83
|
+
const command = Object.hasOwn(commands, key) ? commands[key]
|
|
84
|
+
: Object.hasOwn(commands, args[0]) ? commands[args[0]] : undefined;
|
|
85
|
+
if (command) {
|
|
86
|
+
return `Usage:\n pharo-agent ${command.usage}\n\n${command.description}\n\nExample:\n pharo-agent ${command.example}`;
|
|
87
|
+
}
|
|
88
|
+
const entries = Object.entries(commands)
|
|
89
|
+
.filter(([name]) => args[0] !== "image" || name.startsWith("image "));
|
|
90
|
+
return ["Usage:", ...entries.map(([, entry]) => ` pharo-agent ${entry.usage}`),
|
|
91
|
+
"", "Use pharo-agent <command> --help for options and examples."].join("\n");
|
|
92
|
+
}
|
package/src/init.js
CHANGED
|
@@ -76,6 +76,13 @@ function pharoGuide() {
|
|
|
76
76
|
|
|
77
77
|
${generatedBy}. Edits here are replaced the next time it runs.
|
|
78
78
|
|
|
79
|
+
After upgrading the plugin/CLI, re-run \`pharo-agent init --host <host>\` from
|
|
80
|
+
the project root with the same host to refresh this guide and the copied skills
|
|
81
|
+
and references. Omit \`--mount-root\` to keep existing settings. Image declarations,
|
|
82
|
+
runtime state, and live code are preserved. Keep project-specific instructions
|
|
83
|
+
outside generated/copied files and outside the host guide's managed block.
|
|
84
|
+
Refreshing project files does not install a newer package or upgrade image tools.
|
|
85
|
+
|
|
79
86
|
\`plexus.json\` declares this project's images. A freshly initialized
|
|
80
87
|
project declares none; register one before the first \`pharo-agent open\`:
|
|
81
88
|
|