@evref-bl/pharo-agent 0.3.4 → 0.3.6

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pharo-agent",
3
3
  "displayName": "Pharo Agent",
4
- "version": "0.3.4",
4
+ "version": "0.3.6",
5
5
  "description": "Terminal-first Pharo image setup for coding agents.",
6
6
  "author": {
7
7
  "name": "Evref-BL",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evref-bl/pharo-agent",
3
- "version": "0.3.4",
3
+ "version": "0.3.6",
4
4
  "private": false,
5
5
  "description": "Terminal-first Pharo integration for coding agents.",
6
6
  "license": "Apache-2.0",
@@ -32,8 +32,8 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@evref-bl/pharo-mcp": "1.5.0",
35
- "@evref-bl/plexus": "0.4.2",
36
- "@evref-bl/plexus-gateway": "0.4.2",
35
+ "@evref-bl/plexus": "0.4.4",
36
+ "@evref-bl/plexus-gateway": "0.4.4",
37
37
  "@modelcontextprotocol/sdk": "1.32.1"
38
38
  }
39
39
  }
package/plugin.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
3
3
  "name": "pharo-agent",
4
- "version": "0.3.4",
4
+ "version": "0.3.6",
5
5
  "description": "Terminal-first Pharo image setup for coding agents.",
6
6
  "author": {
7
7
  "name": "Evref-BL",
@@ -8,7 +8,7 @@ Run this only when the user asks to enable Pharo tooling in this project.
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.3.4 init --host codex
11
+ npx --yes @evref-bl/pharo-agent@0.3.6 init --host codex
12
12
  ```
13
13
 
14
14
  Use `--host claude` in Claude Code and `--host opencode` in OpenCode.
package/src/live.js CHANGED
@@ -1,7 +1,15 @@
1
+ import { spawnSync } from "node:child_process";
1
2
  import fs from "node:fs";
2
3
  import path from "node:path";
3
- import { ScopedPharoLauncher, closeProject, openProject } from "@evref-bl/plexus";
4
+ import {
5
+ ScopedPharoLauncher,
6
+ closeProject,
7
+ homeDependencyRepositoryCachePath,
8
+ openProject,
9
+ resolvePlexusHomePath,
10
+ } from "@evref-bl/plexus";
4
11
  import { callImageTool } from "./gateway.js";
12
+ import { readProjectConfig } from "./project.js";
5
13
  import {
6
14
  defaultImageId,
7
15
  readConfig,
@@ -16,13 +24,7 @@ import {
16
24
  export const pifsRelease = "v0.4.1";
17
25
 
18
26
  export function pifsStartCode(mountPath, imageName) {
19
- return `"A shared Iceberg clone is never refetched, so a tag released after it was cloned cannot resolve."
20
- IceRepository registry
21
- detect: [ :each | each name = 'pharo-image-fs' ]
22
- ifFound: [ :repository |
23
- (repository tags anySatisfy: [ :tag | tag name = '${pifsRelease}' ])
24
- ifFalse: [ [ repository fetch ] on: Error do: [ :error | "the load below reports the real failure" ] ] ].
25
- Metacello new
27
+ return `Metacello new
26
28
  baseline: 'PharoImageFS';
27
29
  repository: 'github://Evref-BL/pharo-image-fs:${pifsRelease}/src';
28
30
  load: 'Core'.
@@ -85,12 +87,32 @@ export async function runLifecycle(action, fallback) {
85
87
  }
86
88
  }
87
89
 
90
+
91
+ export function pifsCloneDirectory(projectRoot) {
92
+ const cache = homeDependencyRepositoryCachePath(
93
+ resolvePlexusHomePath({ config: readProjectConfig(projectRoot) }),
94
+ );
95
+ return path.join(cache, "Evref-BL", "pharo-image-fs");
96
+ }
97
+
98
+ export function fetchPifsRelease(cloneDirectory, release = pifsRelease) {
99
+ // The shared clone is reused as it was cloned, so a tag released later is
100
+ // missing. Fetch here rather than in the image: the clone may have an ssh
101
+ // remote, and only the host has the credentials for it.
102
+ if (!fs.existsSync(cloneDirectory)) return false;
103
+ const git = (...args) =>
104
+ spawnSync("git", ["-C", cloneDirectory, ...args], { stdio: "ignore" }).status === 0;
105
+ if (git("rev-parse", "--verify", `refs/tags/${release}`)) return false;
106
+ return git("fetch", "--tags", "--quiet", "origin");
107
+ }
108
+
88
109
  export async function openAgentImage(projectRoot, imageId) {
89
110
  const resolved = resolveImageId(projectRoot, imageId);
90
111
  const openImages = readOpenImages(projectRoot);
91
112
  if (openImages[resolved]) {
92
113
  return { alreadyOpen: true, ...openImages[resolved] };
93
114
  }
115
+ fetchPifsRelease(pifsCloneDirectory(projectRoot));
94
116
  const launcher = new ScopedPharoLauncher({ projectRoot });
95
117
  const created = needsImageCreation(launcher.listImages(), resolved);
96
118
  if (created) {