@edryslabs/edrys-dev 0.4.4 → 0.4.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.
package/README.md CHANGED
@@ -104,7 +104,7 @@ The quick way, for a new lab:
104
104
  npx @edryslabs/edrys-dev init my-lab
105
105
  ```
106
106
 
107
- This makes the folder `my-lab` with a starter `lab.yml`, the agent configuration for Claude Code (`.mcp.json`) and VS Code Copilot (`.vscode/mcp.json`), instructions for the agent (`AGENTS.md`, `CLAUDE.md`), Claude Code settings that let the agent use edrys-dev and edit `lab.yml` and `modules/` without asking each time (`.claude/settings.json`), and a `.gitignore`. In a folder that already has some of these files, it keeps them. If the edrys skills (step 2 below) are not installed yet, it offers to install them for you; if they are, it updates them when a newer version is out. Then open the folder in your agent and write "start".
107
+ This makes the folder `my-lab` with a starter `lab.yml`, the agent configuration for Claude Code (`.mcp.json`) and VS Code Copilot (`.vscode/mcp.json`), instructions for the agent (`AGENTS.md`, `CLAUDE.md`), Claude Code settings that let the agent use edrys-dev and edit `lab.yml` and `modules/` without asking each time (`.claude/settings.json`), and a `.gitignore`. If the edrys skills (step 2 below) are not installed yet, it offers to install them for you; if they are, it updates them when a newer version is out. Then open the folder in your agent and write "start".
108
108
 
109
109
  To give your students a [tutor](#a-tutor-for-your-students) as well:
110
110
 
@@ -114,6 +114,25 @@ npx @edryslabs/edrys-dev init my-lab --tutor
114
114
 
115
115
  The agent then starts edrys-dev with the tutor. The tutor needs Claude Code on your computer, also if you work with Copilot. Add `--tutor-agent codex` to have Codex answer instead of Claude Code. In a folder that already has its agent configuration, add `"--tutor"` to the `args` in `.mcp.json` (and `.vscode/mcp.json`) yourself, then restart the agent.
116
116
 
117
+ #### A lab you already have
118
+
119
+ Run `init` in the lab's folder, for example a lab repository you cloned:
120
+
121
+ ```bash
122
+ cd lab-web-serial
123
+ npx @edryslabs/edrys-dev init .
124
+ ```
125
+
126
+ `init` looks for the lab in the folder and two levels of folders below it (a YAML or JSON file with a list of `modules`), e.g. `laboratory/micropython.yaml`, and sets the agent up for that file. It creates no starter lab, and the lab keeps its name and place, so deploy links and import addresses that point to it keep working. If the folder has more than one lab, it asks which one, or name it yourself:
127
+
128
+ ```bash
129
+ npx @edryslabs/edrys-dev init . --lab laboratory/micropython.yaml
130
+ ```
131
+
132
+ Files that are there are kept. `init` adds only the edrys parts: the `edrys` server to `.mcp.json`, a section to `AGENTS.md`, `@AGENTS.md` to `CLAUDE.md`, and the permissions to `.claude/settings.json`. A file it can't change safely, such as a VS Code `mcp.json` with comments, stays as it is, and `init` tells you what to add. Commit these files or not, as you like: they don't change the lab.
133
+
134
+ A class you made only on https://edrys-labs.github.io has no file yet. Download it in the class under Settings → Import / Export (YAML file), put the file into a folder, run `init` there, and give students the new link: edrys-dev opens it as a new class.
135
+
117
136
  By hand:
118
137
 
119
138
  1. Create a file `.mcp.json` in your lab folder:
@@ -205,6 +224,8 @@ edrys-dev [lab.yml] [options]
205
224
  | `--tutor-per-hour <n>` | `200` | questions the tutor answers per hour for the whole class |
206
225
  | `--host <host>` | `127.0.0.1` | `0.0.0.0` lets others on your network open the class (and, with `--mcp`, write to your agent) |
207
226
  | `--mcp` | off | for AI agents; set it in `.mcp.json`, see above |
227
+ | `--lab <file>` | the lab `init` finds | with `init`: the lab that is already in the folder, see [A lab you already have](#a-lab-you-already-have) |
228
+ | `-v, --version` | | show the version of edrys-dev and of the edrys-Lite it serves |
208
229
  | `-h, --help` | | show help |
209
230
 
210
231
  ## Troubleshooting
package/dist/index.js CHANGED
@@ -3,17 +3,21 @@ import fs from 'node:fs';
3
3
  import path from 'node:path';
4
4
  import { parseArgs } from 'node:util';
5
5
  import open from 'open';
6
- import { startDevServer } from './server.js';
7
- import { startMcp, studentLink, localUrls } from './mcp.js';
6
+ import { startDevServer, edrysDist } from './server.js';
7
+ import { startMcp, studentLink, localUrls, VERSION } from './mcp.js';
8
8
  import { reachable } from './origin.js';
9
9
  import { readSaved } from './watch.js';
10
10
  import { CLASS_PER_HOUR, TUTOR_AGENTS, tutorAuth } from './tutor.js';
11
11
  const HELP = `edrys-dev: develop an edrys-Lite lab locally
12
12
 
13
13
  Usage: edrys-dev [lab.yml] [options]
14
- edrys-dev init [folder] set up a new lab for an AI agent: lab.yml,
15
- agent config and instructions; with
16
- --tutor, the agent starts it with the tutor
14
+ edrys-dev init [folder] set up a lab folder for an AI agent: agent
15
+ config and instructions, and lab.yml if
16
+ there is no lab yet; with --tutor, the
17
+ agent starts it with the tutor
18
+ --lab <file> with init: the lab that is there, e.g.
19
+ laboratory/micropython.yaml (default: the one
20
+ init finds in the folder)
17
21
 
18
22
  -i, --input <file> lab file (YAML or JSON), default ./lab.yml
19
23
  -p, --port <port> port, default 3210 (the next free one if taken)
@@ -43,6 +47,7 @@ Usage: edrys-dev [lab.yml] [options]
43
47
  -o, --open open the lab in the browser
44
48
  --mcp serve an AI agent over stdio (MCP); started by the
45
49
  agent from its MCP config, not by hand
50
+ -v, --version show the version of edrys-dev and its edrys-Lite
46
51
  -h, --help show this help
47
52
 
48
53
  The tab opened at /?dev owns the class and republishes it whenever the lab
@@ -52,6 +57,7 @@ const { values, positionals } = parseArgs({
52
57
  allowPositionals: true,
53
58
  options: {
54
59
  input: { type: 'string', short: 'i' },
60
+ lab: { type: 'string' },
55
61
  port: { type: 'string', short: 'p', default: '3210' },
56
62
  host: { type: 'string', default: '127.0.0.1' },
57
63
  local: { type: 'boolean', default: false },
@@ -64,6 +70,7 @@ const { values, positionals } = parseArgs({
64
70
  open: { type: 'boolean', short: 'o', default: false },
65
71
  mcp: { type: 'boolean', default: false },
66
72
  help: { type: 'boolean', short: 'h', default: false },
73
+ version: { type: 'boolean', short: 'v', default: false },
67
74
  },
68
75
  });
69
76
  // with --mcp, stdout carries the protocol
@@ -72,6 +79,15 @@ if (values.help) {
72
79
  say(HELP);
73
80
  process.exit(0);
74
81
  }
82
+ if (values.version) {
83
+ let lite = 'unknown';
84
+ try {
85
+ lite = JSON.parse(fs.readFileSync(path.join(edrysDist(), '..', 'package.json'), 'utf8')).version;
86
+ }
87
+ catch { }
88
+ say(`edrys-dev ${VERSION} (edrys-Lite ${lite})`);
89
+ process.exit(0);
90
+ }
75
91
  const tutorAgent = values['tutor-agent'];
76
92
  if (!TUTOR_AGENTS.includes(tutorAgent)) {
77
93
  console.error(`edrys-dev: --tutor-agent must be ${TUTOR_AGENTS.join(' or ')}, not ${tutorAgent}`);
@@ -93,9 +109,19 @@ if (positionals[0] === 'init' && !values.input) {
93
109
  ...(classPerHour !== CLASS_PER_HOUR ? ['--tutor-per-hour', String(classPerHour)] : []),
94
110
  ]
95
111
  : [];
96
- await init(positionals[1] ?? '.', tutor);
112
+ try {
113
+ await init(positionals[1] ?? '.', tutor, say, { lab: values.lab });
114
+ }
115
+ catch (error) {
116
+ console.error(`edrys-dev: ${error.message}`);
117
+ process.exit(1);
118
+ }
97
119
  process.exit(0);
98
120
  }
121
+ if (values.lab) {
122
+ console.error(`edrys-dev: --lab is for init; to start a lab, give its file: edrys-dev ${values.lab}`);
123
+ process.exit(1);
124
+ }
99
125
  const lab = path.resolve(values.input ?? positionals[0] ?? 'lab.yml');
100
126
  // an agent started in an empty folder gets a lab to work on, not a failed server
101
127
  if (!fs.existsSync(lab) && values.mcp && /\.ya?ml$/i.test(lab) && fs.statSync(path.dirname(lab), { throwIfNoEntry: false })?.isDirectory()) {
package/dist/init.js CHANGED
@@ -1,16 +1,22 @@
1
1
  // edrys-dev init: a lab folder that an AI agent can start in, without writing
2
- // any config by hand. Files that exist are kept.
2
+ // any config by hand. It works in a new folder and in one that already has a
3
+ // lab (e.g. laboratory/micropython.yaml in a published lab repository): files
4
+ // that exist are kept, and the edrys parts are added to them where it is safe.
3
5
  import { spawnSync } from 'node:child_process';
4
6
  import fs from 'node:fs';
5
7
  import os from 'node:os';
6
8
  import path from 'node:path';
7
9
  import readline from 'node:readline/promises';
10
+ import yaml from 'js-yaml';
8
11
  // `extra`: more options for edrys-dev, e.g. --tutor
9
- const server = (extra) => ({ command: 'npx', args: ['-y', '@edryslabs/edrys-dev', '--mcp', 'lab.yml', ...extra] });
10
- const SETTINGS = {
12
+ const server = ({ extra, lab }) => ({ command: 'npx', args: ['-y', '@edryslabs/edrys-dev', '--mcp', lab, ...extra] });
13
+ // edrys-dev serves the modules folder next to the lab
14
+ const modulesDir = (lab) => (path.posix.dirname(lab) === '.' ? '' : path.posix.dirname(lab) + '/') + 'modules';
15
+ // no prompts for the edrys server and for edits of the lab and its modules
16
+ const settings = (lab) => ({
11
17
  enabledMcpjsonServers: ['edrys'],
12
- permissions: { allow: ['mcp__edrys', 'Edit(/lab.yml)', 'Edit(/modules/**)'] },
13
- };
18
+ permissions: { allow: ['mcp__edrys', `Edit(/${lab})`, `Edit(/${modulesDir(lab)}/**)`] },
19
+ });
14
20
  /** A lab with a welcome page; also what `--mcp` starts with when there is no lab file. */
15
21
  export const starterLab = (name) => `name: ${JSON.stringify(name)}
16
22
  meta:
@@ -25,13 +31,13 @@ modules:
25
31
  width: full
26
32
  height: tall
27
33
  `;
28
- const agents = (name) => `# ${name}
29
-
30
- This folder is an edrys-Lite lab: \`lab.yml\` is the classroom configuration, \`modules/\` (if there) holds modules written for it. The user works in the class in their browser and talks to you through the chat there; they may not look at this session.
34
+ // also how an AGENTS.md from before is recognized as having this section
35
+ const MARKER = 'edrys MCP server';
36
+ const agentsBody = (lab) => `This folder is an edrys-Lite lab: \`${lab}\` is the classroom configuration, \`${modulesDir(lab)}/\` (if there) holds modules written for it. Keep the lab file where it is and under its name: deploy links and imports may point to it. The user works in the class in their browser and talks to you through the chat there; they may not look at this session.
31
37
 
32
38
  When a session starts:
33
39
 
34
- 1. Call \`get_state\` of the edrys MCP server. If \`connected\` is false, open its \`url\` in the browser (browser automation or the system's open command), or tell the user the address.
40
+ 1. Call \`get_state\` of the ${MARKER}. If \`connected\` is false, open its \`url\` in the browser (browser automation or the system's open command), or tell the user the address.
35
41
  2. If \`messages\` is above 0, call \`read_chat\` and pick up where the chat left off.
36
42
  3. Serve the chat until the user says stop: answer every chat event with the \`chat\` tool, as the edrys server's instructions say.
37
43
 
@@ -41,16 +47,174 @@ When they want to share the class or ask how students join, give them \`get_stat
41
47
 
42
48
  If the edrys-lab and edrys-module skills are installed, use them to write the lab and its modules.
43
49
  `;
50
+ const isObject = (value) => !!value && typeof value === 'object' && !Array.isArray(value);
51
+ /** `key`: where the servers are, mcpServers (Claude Code) or servers (VS Code) */
52
+ const mergeServer = (key, entry) => (text, ctx) => {
53
+ let data;
54
+ try {
55
+ data = JSON.parse(text);
56
+ }
57
+ catch {
58
+ // e.g. a VS Code mcp.json with comments, which we would lose
59
+ return { note: text.includes('edrys-dev') ? undefined : 'add the edrys server yourself, see the README' };
60
+ }
61
+ if (!isObject(data) || (data[key] !== undefined && !isObject(data[key])))
62
+ return { note: 'add the edrys server yourself, see the README' };
63
+ const edrys = data[key]?.edrys;
64
+ if (!edrys) {
65
+ data[key] = { ...data[key], edrys: entry(ctx) };
66
+ return { text: JSON.stringify(data, null, 2) + '\n', note: 'added the edrys server' };
67
+ }
68
+ const args = Array.isArray(edrys.args) ? edrys.args : [];
69
+ const notes = [];
70
+ if (!args.includes(ctx.lab))
71
+ notes.push(`its edrys server starts another lab, put "${ctx.lab}" into its args yourself`);
72
+ if (ctx.extra.length && !args.includes(ctx.extra[0]))
73
+ notes.push(`add ${ctx.extra.map((a) => `"${a}"`).join(', ')} to the args of edrys yourself`);
74
+ return { note: notes.join('; ') || undefined };
75
+ };
76
+ function mergeSettings(text, ctx) {
77
+ let data;
78
+ try {
79
+ data = JSON.parse(text);
80
+ }
81
+ catch {
82
+ return { note: 'not plain JSON, edrys-dev may ask before each edit' };
83
+ }
84
+ if (!isObject(data))
85
+ return { note: 'not a settings object, edrys-dev may ask before each edit' };
86
+ const want = settings(ctx.lab);
87
+ const servers = Array.isArray(data.enabledMcpjsonServers) ? data.enabledMcpjsonServers : [];
88
+ const permissions = isObject(data.permissions) ? data.permissions : {};
89
+ const allow = Array.isArray(permissions.allow) ? permissions.allow : [];
90
+ const addServers = want.enabledMcpjsonServers.filter((name) => !servers.includes(name));
91
+ const addAllow = want.permissions.allow.filter((rule) => !allow.includes(rule));
92
+ if (!addServers.length && !addAllow.length)
93
+ return {};
94
+ // a project that turned off its .mcp.json servers would not start edrys either
95
+ if (data.enableAllProjectMcpServers !== true)
96
+ data.enabledMcpjsonServers = [...servers, ...addServers];
97
+ data.permissions = { ...permissions, allow: [...allow, ...addAllow] };
98
+ return { text: JSON.stringify(data, null, 2) + '\n', note: 'added the edrys permissions' };
99
+ }
44
100
  const FILES = [
45
- ['lab.yml', starterLab],
46
- ['.mcp.json', (_, extra) => JSON.stringify({ mcpServers: { edrys: server(extra) } }, null, 2) + '\n'],
47
- ['.vscode/mcp.json', (_, extra) => JSON.stringify({ servers: { edrys: { type: 'stdio', ...server(extra) } } }, null, 2) + '\n'],
48
- ['AGENTS.md', agents],
101
+ {
102
+ file: '.mcp.json',
103
+ create: (ctx) => JSON.stringify({ mcpServers: { edrys: server(ctx) } }, null, 2) + '\n',
104
+ merge: mergeServer('mcpServers', server),
105
+ },
106
+ {
107
+ file: '.vscode/mcp.json',
108
+ create: (ctx) => JSON.stringify({ servers: { edrys: { type: 'stdio', ...server(ctx) } } }, null, 2) + '\n',
109
+ merge: mergeServer('servers', (ctx) => ({ type: 'stdio', ...server(ctx) })),
110
+ },
111
+ {
112
+ file: 'AGENTS.md',
113
+ create: ({ name, lab }) => `# ${name}\n\n${agentsBody(lab)}`,
114
+ merge: (text, { lab }) => text.includes(MARKER)
115
+ ? {}
116
+ : { text: text + (text === '' || text.endsWith('\n') ? '' : '\n') + `\n## edrys-Lite lab\n\n${agentsBody(lab)}`, note: 'added the edrys section' },
117
+ },
49
118
  // Claude Code reads CLAUDE.md, which imports AGENTS.md
50
- ['CLAUDE.md', () => '@AGENTS.md\n'],
51
- // no prompts for the edrys server and for edits of the lab and its modules
52
- ['.claude/settings.json', () => JSON.stringify(SETTINGS, null, 2) + '\n'],
119
+ {
120
+ file: 'CLAUDE.md',
121
+ create: () => '@AGENTS.md\n',
122
+ merge: (text) => text.includes('@AGENTS.md')
123
+ ? {}
124
+ : { text: text + (text === '' || text.endsWith('\n') ? '' : '\n') + '\n@AGENTS.md\n', note: 'added @AGENTS.md' },
125
+ },
126
+ {
127
+ file: '.claude/settings.json',
128
+ create: ({ lab }) => JSON.stringify(settings(lab), null, 2) + '\n',
129
+ merge: mergeSettings,
130
+ },
53
131
  ];
132
+ const LAB_FILE = /\.(ya?ml|json)$/i;
133
+ /** The config in `file` if it is an edrys lab, an object with a list of modules. */
134
+ function readLab(file) {
135
+ try {
136
+ if (fs.statSync(file).size > 2_000_000)
137
+ return null;
138
+ const text = fs.readFileSync(file, 'utf8');
139
+ const data = /\.json$/i.test(file) ? JSON.parse(text) : yaml.load(text);
140
+ return isObject(data) && Array.isArray(data.modules) ? data : null;
141
+ }
142
+ catch {
143
+ return null;
144
+ }
145
+ }
146
+ // modules hold the lab's own modules, not labs
147
+ const SKIP = new Set(['node_modules', 'modules', 'dist']);
148
+ /** Labs in `dir` and two levels of folders below it, e.g. laboratory/micropython.yaml. */
149
+ function findLabs(dir) {
150
+ const found = [];
151
+ let budget = 1000; // started in a big folder by mistake, it does not read all of it
152
+ const walk = (folder, depth) => {
153
+ let entries;
154
+ try {
155
+ entries = fs.readdirSync(folder, { withFileTypes: true });
156
+ }
157
+ catch {
158
+ return;
159
+ }
160
+ for (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {
161
+ if (budget-- <= 0)
162
+ return;
163
+ if (entry.name.startsWith('.'))
164
+ continue;
165
+ const full = path.join(folder, entry.name);
166
+ if (entry.isDirectory()) {
167
+ if (depth < 2 && !SKIP.has(entry.name))
168
+ walk(full, depth + 1);
169
+ }
170
+ else if (entry.isFile() && LAB_FILE.test(entry.name) && readLab(full))
171
+ found.push(full);
172
+ }
173
+ };
174
+ walk(dir, 0);
175
+ return found;
176
+ }
177
+ const relative = (dir, file) => path.relative(dir, file).split(path.sep).join('/');
178
+ /**
179
+ * The lab file to set up, relative to `dir`, or null for a new lab.yml.
180
+ * `given`: --lab, relative to the current folder.
181
+ */
182
+ async function chooseLab(dir, given, say) {
183
+ if (given) {
184
+ const file = path.resolve(given);
185
+ const lab = relative(dir, file);
186
+ if (!fs.statSync(file, { throwIfNoEntry: false })?.isFile())
187
+ throw new Error(`no lab file at ${file}`);
188
+ if (lab.startsWith('../') || path.isAbsolute(lab))
189
+ throw new Error(`the lab must be in the folder ${dir}, not at ${file}`);
190
+ if (!LAB_FILE.test(file))
191
+ throw new Error(`the lab must be a YAML or JSON file, not ${lab}`);
192
+ if (!readLab(file))
193
+ throw new Error(`${lab} is not an edrys lab: it has no list of modules`);
194
+ return lab;
195
+ }
196
+ if (fs.existsSync(path.join(dir, 'lab.yml')))
197
+ return 'lab.yml';
198
+ const labs = findLabs(dir).map((file) => relative(dir, file));
199
+ if (!labs.length)
200
+ return null;
201
+ if (labs.length === 1) {
202
+ if (!process.stdin.isTTY) {
203
+ say(` found ${labs[0]}, using it as the lab (pick another with --lab <file>)`);
204
+ return labs[0];
205
+ }
206
+ return /^(y|yes|)$/i.test(await ask(`Found the lab ${labs[0]}. Use it? (Y/n) `)) ? labs[0] : null;
207
+ }
208
+ const list = labs.map((lab, i) => ` ${i + 1}. ${lab}`).join('\n');
209
+ if (!process.stdin.isTTY)
210
+ throw new Error(`this folder has more than one lab:\n${list}\npick one with --lab <file>`);
211
+ say(`This folder has more than one lab:\n${list}`);
212
+ const answer = await ask(`Which one should the agent work on? (1-${labs.length}, or 0 for a new lab.yml) `);
213
+ const pick = Number(answer);
214
+ if (!Number.isInteger(pick) || pick < 0 || pick > labs.length)
215
+ throw new Error(`no lab ${JSON.stringify(answer)}, pick one with --lab <file>`);
216
+ return pick === 0 ? null : labs[pick - 1];
217
+ }
54
218
  // The edrys skills, for every lab of this user: in ~/.agents/skills, which
55
219
  // Copilot reads, linked into ~/.claude/skills. In the lab folder they would be
56
220
  // published with it.
@@ -68,24 +232,48 @@ async function ask(question) {
68
232
  rl.close();
69
233
  return answer;
70
234
  }
71
- /** `extra`: options the agent starts edrys-dev with, e.g. ['--tutor']. */
72
- export async function init(folder, extra = [], say = console.log) {
235
+ /**
236
+ * `extra`: options the agent starts edrys-dev with, e.g. ['--tutor'].
237
+ * `lab`: the lab file that is there (--lab); without it, init looks for one.
238
+ * Throws, before it writes anything, when it cannot tell which lab to use.
239
+ */
240
+ export async function init(folder, extra = [], say = console.log, options = {}) {
73
241
  const dir = path.resolve(folder);
242
+ if (options.lab && !fs.existsSync(dir))
243
+ throw new Error(`no folder ${dir}`);
74
244
  fs.mkdirSync(dir, { recursive: true });
245
+ const found = await chooseLab(dir, options.lab, say);
246
+ const lab = found ?? 'lab.yml';
75
247
  let name = path.basename(dir);
76
- if (process.stdin.isTTY && !fs.existsSync(path.join(dir, 'lab.yml'))) {
77
- name = (await ask(`Name of your lab (${name}): `)) || name;
248
+ if (found) {
249
+ const own = readLab(path.join(dir, found))?.name;
250
+ if (typeof own === 'string' && own.trim())
251
+ name = own.trim();
252
+ }
253
+ else {
254
+ if (process.stdin.isTTY)
255
+ name = (await ask(`Name of your lab (${name}): `)) || name;
256
+ fs.writeFileSync(path.join(dir, lab), starterLab(name));
257
+ say(` created ${lab}`);
78
258
  }
79
- for (const [file, content] of FILES) {
259
+ if (found)
260
+ say(` kept ${lab} (already there)`);
261
+ const ctx = { name, extra, lab };
262
+ for (const { file, create, merge } of FILES) {
80
263
  const target = path.join(dir, file);
81
- if (fs.existsSync(target)) {
82
- const missing = file.endsWith('mcp.json') && extra.length && !fs.readFileSync(target, 'utf8').includes(extra[0]);
83
- say(` kept ${file} (already there)` + (missing ? `: add ${extra.map((a) => `"${a}"`).join(', ')} to the args of edrys yourself` : ''));
264
+ if (!fs.existsSync(target)) {
265
+ fs.mkdirSync(path.dirname(target), { recursive: true });
266
+ fs.writeFileSync(target, create(ctx));
267
+ say(` created ${file}`);
84
268
  continue;
85
269
  }
86
- fs.mkdirSync(path.dirname(target), { recursive: true });
87
- fs.writeFileSync(target, content(name, extra));
88
- say(` created ${file}`);
270
+ const { text, note } = merge(fs.readFileSync(target, 'utf8'), ctx);
271
+ if (text !== undefined) {
272
+ fs.writeFileSync(target, text);
273
+ say(` changed ${file}: ${note}`);
274
+ }
275
+ else
276
+ say(` kept ${file} (already there)` + (note ? `: ${note}` : ''));
89
277
  }
90
278
  const ignore = path.join(dir, '.gitignore');
91
279
  const lines = fs.existsSync(ignore) ? fs.readFileSync(ignore, 'utf8') : null;
@@ -114,7 +302,7 @@ export async function init(folder, extra = [], say = console.log) {
114
302
  say(`Could not check the edrys skills for updates. To do it later: ${UPDATE_HINT}`);
115
303
  }
116
304
  say(`
117
- Your lab is ready in ${dir}
305
+ Your lab is ready in ${dir}${found ? `\nThe agent works on ${lab}.` : ''}
118
306
 
119
307
  Next: open this folder in your AI agent (Claude Code, or VS Code with Copilot)
120
308
  and write "start". The agent starts edrys-dev and opens the class in your
@@ -122,6 +310,6 @@ browser; from then on you can talk to it in the agent chat there (sparkles butto
122
310
  if (extra.includes('--tutor')) {
123
311
  say(`
124
312
  Your students get a tutor chat in the class, answered by the AI on this
125
- computer. Notes only for the tutor go into tutor.md in this folder.`);
313
+ computer. Notes only for the tutor go into tutor.md in ${path.posix.dirname(lab) === '.' ? 'this folder' : `${path.posix.dirname(lab)}/`}.`);
126
314
  }
127
315
  }
package/dist/mcp.js CHANGED
@@ -11,7 +11,7 @@ import { title } from './chat.js';
11
11
  import { readSaved } from './watch.js';
12
12
  // never answer 2026-07-28, see above
13
13
  const VERSIONS = ['2025-11-25', '2025-06-18', '2025-03-26', '2024-11-05'];
14
- const VERSION = JSON.parse(fs.readFileSync(new URL('../package.json', import.meta.url), 'utf8')).version;
14
+ export const VERSION = JSON.parse(fs.readFileSync(new URL('../package.json', import.meta.url), 'utf8')).version;
15
15
  // Claude Code cuts this text and every tool description at 2048 characters.
16
16
  const INSTRUCTIONS = `edrys-dev serves an edrys-Lite lab (a classroom configuration, YAML or JSON, at get_state.lab) in the user's browser. The tab at get_state.url owns the class and republishes it whenever the lab file changes: edit the file with your own file tools, never ask the user to reload. Students join through get_state.student_link.
17
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edryslabs/edrys-dev",
3
- "version": "0.4.4",
3
+ "version": "0.4.6",
4
4
  "description": "Develop edrys-Lite labs locally: serves edrys-Lite, syncs on its own port and republishes the class whenever the lab file changes",
5
5
  "type": "module",
6
6
  "bin": {
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "homepage": "https://github.com/edrys-labs/edrys-devserver#readme",
38
38
  "dependencies": {
39
- "@edryslabs/edrys-lite": "3.2.2",
39
+ "@edryslabs/edrys-lite": "3.3.0",
40
40
  "chokidar": "^4.0.3",
41
41
  "express": "^5.1.0",
42
42
  "js-yaml": "^4.3.2",