devsess 0.1.0 → 0.3.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.
Files changed (38) hide show
  1. package/README.md +37 -24
  2. package/dist/async/define-cli.d.ts +7 -3
  3. package/dist/async/define-cli.d.ts.map +1 -1
  4. package/dist/async/dev-sessions.d.ts +10 -5
  5. package/dist/async/dev-sessions.d.ts.map +1 -1
  6. package/dist/async/index.d.ts +1 -0
  7. package/dist/async/index.d.ts.map +1 -1
  8. package/dist/async/index.js +52 -35
  9. package/dist/async/index.js.map +1 -1
  10. package/dist/async/platform.d.ts +41 -0
  11. package/dist/async/platform.d.ts.map +1 -0
  12. package/dist/async/run-dev-cli.d.ts +20 -0
  13. package/dist/async/run-dev-cli.d.ts.map +1 -0
  14. package/dist/async/run.d.ts +4 -4
  15. package/dist/async/run.d.ts.map +1 -1
  16. package/dist/async/session-state.d.ts +3 -1
  17. package/dist/async/session-state.d.ts.map +1 -1
  18. package/dist/chunk-Z7T6KVWK.js +331 -0
  19. package/dist/chunk-Z7T6KVWK.js.map +1 -0
  20. package/dist/current-session.d.ts +29 -0
  21. package/dist/current-session.d.ts.map +1 -0
  22. package/dist/dev/running-signal.d.ts +11 -0
  23. package/dist/dev/running-signal.d.ts.map +1 -1
  24. package/dist/dev/sticky-port.d.ts +3 -1
  25. package/dist/dev/sticky-port.d.ts.map +1 -1
  26. package/dist/dev-sessions.d.ts +29 -1
  27. package/dist/dev-sessions.d.ts.map +1 -1
  28. package/dist/index.d.ts +5 -3
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +31 -38
  31. package/dist/index.js.map +1 -1
  32. package/package.json +1 -2
  33. package/dist/chunk-IEQZ3AJH.js +0 -282
  34. package/dist/chunk-IEQZ3AJH.js.map +0 -1
  35. package/dist/dev/define-cli.d.ts +0 -25
  36. package/dist/dev/define-cli.d.ts.map +0 -1
  37. package/dist/dev/run-dev-cli.d.ts +0 -20
  38. package/dist/dev/run-dev-cli.d.ts.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "devsess",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "Isolated, managed dev servers — each worktree gets its own session, with its own port and its own database",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/fdarian/devsess#readme",
@@ -63,7 +63,6 @@
63
63
  "random-word-slugs": "^0.1.7"
64
64
  },
65
65
  "peerDependencies": {
66
- "@effect/platform-node": "^4.0.0-beta.101",
67
66
  "@electric-sql/pglite": ">=0.2.0",
68
67
  "drizzle-orm": ">=0.30.0",
69
68
  "effect": "^4.0.0-beta.101"
@@ -1,282 +0,0 @@
1
- // src/dev-sessions.ts
2
- import { Array as A, Context, Effect, Layer, Option } from "effect";
3
- import { FileSystem } from "effect/FileSystem";
4
- import { Path } from "effect/Path";
5
- import { generateSlug } from "random-word-slugs";
6
- var DevSession;
7
- ((DevSession2) => {
8
- function make(input) {
9
- return {
10
- name: input.name,
11
- lastModifiedAt: input.lastModifiedAt,
12
- path: (relativePath) => Effect.succeed(input.pathJoin(relativePath)),
13
- toString: () => input.name
14
- };
15
- }
16
- DevSession2.make = make;
17
- })(DevSession || (DevSession = {}));
18
- var DevSessions = class extends Context.Service()("devsess/DevSessions") {
19
- };
20
- var makeDevSessionsLayer = (rootDir) => Layer.effect(
21
- DevSessions,
22
- Effect.gen(function* () {
23
- const fs = yield* FileSystem;
24
- const path = yield* Path;
25
- yield* Effect.logDebug(`DevSessions dir: ${rootDir}`);
26
- const getPath2 = (relativePath) => path.join(rootDir, relativePath);
27
- const getSessions = Effect.gen(function* () {
28
- const entries = yield* fs.readDirectory(rootDir).pipe(Effect.catch(() => Effect.succeed([])));
29
- const possibleSessions = yield* Effect.all(
30
- entries.map(
31
- (entry) => Effect.gen(function* () {
32
- const stat = yield* fs.stat(getPath2(entry));
33
- if (stat.type !== "Directory") return Option.none();
34
- return Option.some(
35
- DevSession.make({
36
- name: entry,
37
- lastModifiedAt: Option.getOrNull(stat.mtime),
38
- rootDir,
39
- pathJoin: (relativePath) => path.join(rootDir, entry, relativePath)
40
- })
41
- );
42
- })
43
- ),
44
- { concurrency: "unbounded" }
45
- );
46
- return A.getSomes(possibleSessions);
47
- });
48
- const createSession = Effect.gen(function* () {
49
- const slug = generateSlug(1, { partsOfSpeech: ["noun"] });
50
- yield* fs.makeDirectory(getPath2(slug), { recursive: true });
51
- return DevSession.make({
52
- name: slug,
53
- lastModifiedAt: null,
54
- rootDir,
55
- pathJoin: (relativePath) => path.join(rootDir, slug, relativePath)
56
- });
57
- });
58
- return {
59
- dir: rootDir,
60
- path: getPath2,
61
- getSessions,
62
- createSession,
63
- getLatestOrCreate: Effect.gen(function* () {
64
- yield* fs.makeDirectory(rootDir, { recursive: true });
65
- const sessions = yield* getSessions;
66
- if (sessions.length > 0) {
67
- sessions.sort(
68
- (a, b) => (b.lastModifiedAt?.getTime() ?? 0) - (a.lastModifiedAt?.getTime() ?? 0)
69
- );
70
- const latest = sessions[0];
71
- return latest;
72
- }
73
- return yield* createSession;
74
- })
75
- };
76
- })
77
- );
78
-
79
- // src/dev/session-state.ts
80
- import { Data, Effect as Effect2 } from "effect";
81
- import { FileSystem as FileSystem2 } from "effect/FileSystem";
82
- import { Path as Path2 } from "effect/Path";
83
- import * as S from "effect/Schema";
84
- var SessionStateError = class extends Data.TaggedError("SessionStateError") {
85
- };
86
- function getPath(session) {
87
- return session.path("sess.json");
88
- }
89
- function read(filePath) {
90
- return Effect2.gen(function* () {
91
- const fs = yield* FileSystem2;
92
- if (!(yield* fs.exists(filePath))) {
93
- return null;
94
- }
95
- return yield* fs.readFileString(filePath);
96
- });
97
- }
98
- var SessionState;
99
- ((SessionState2) => {
100
- function slot(schema) {
101
- return {
102
- read: (session) => Effect2.gen(function* () {
103
- const filePath = yield* getPath(session);
104
- const content = yield* read(filePath);
105
- if (content == null) return null;
106
- return yield* S.decodeEffect(S.fromJsonString(schema))(content).pipe(
107
- Effect2.catchTag("SchemaError", () => Effect2.succeed(null))
108
- );
109
- }),
110
- write: (session, data) => Effect2.gen(function* () {
111
- const fs = yield* FileSystem2;
112
- const path = yield* Path2;
113
- const filePath = yield* getPath(session);
114
- yield* fs.makeDirectory(path.dirname(filePath), { recursive: true });
115
- const existing = yield* read(filePath);
116
- const parsed = yield* Effect2.try({
117
- try: () => JSON.parse(existing ?? "{}"),
118
- catch: (cause) => new SessionStateError({
119
- message: `Failed to parse ${filePath} as JSON`,
120
- cause
121
- })
122
- });
123
- const merged = { ...parsed, ...data };
124
- yield* fs.writeFileString(filePath, JSON.stringify(merged));
125
- })
126
- };
127
- }
128
- SessionState2.slot = slot;
129
- })(SessionState || (SessionState = {}));
130
-
131
- // src/dev/run-dev-cli.ts
132
- import { join } from "path";
133
- import { NodeRuntime, NodeServices } from "@effect/platform-node";
134
- import { Effect as Effect3, Layer as Layer2 } from "effect";
135
- import * as cli from "effect/unstable/cli";
136
- var runDevCli = (config) => {
137
- const command = cli.Command.make(
138
- config.name,
139
- config.options ?? {},
140
- (opts) => config.makeHandler(opts)
141
- );
142
- return (argv) => {
143
- const layer = makeDevSessionsLayer(join(config.dir, ".data/sessions")).pipe(
144
- Layer2.provideMerge(NodeServices.layer)
145
- );
146
- const program = cli.Command.runWith(command, {
147
- version: "0.0.0"
148
- })(argv);
149
- NodeRuntime.runMain(Effect3.scoped(Effect3.provide(program, layer)));
150
- };
151
- };
152
-
153
- // src/dev/running-signal.ts
154
- import { watch as fsWatch, realpathSync } from "fs";
155
- import { createRequire } from "module";
156
- import { dirname, join as join2, resolve } from "path";
157
- import { Deferred, Effect as Effect4 } from "effect";
158
- import { FileSystem as FileSystem3 } from "effect/FileSystem";
159
- import { Path as Path3 } from "effect/Path";
160
- var RUNNING_SIGNAL_FILE = ".data/running.json";
161
- var runningSignalPath = (dir) => join2(dir, RUNNING_SIGNAL_FILE);
162
- var resolveSiblingDir = (spec, fromDir) => {
163
- if (spec.startsWith(".") || spec.startsWith("/")) {
164
- return resolve(fromDir, spec);
165
- }
166
- const require2 = createRequire(join2(fromDir, "package.json"));
167
- const pkgJsonPath = require2.resolve(`${spec}/package.json`);
168
- return dirname(realpathSync(pkgJsonPath));
169
- };
170
- var publishRunningSignal = (filePath, value) => Effect4.acquireRelease(
171
- Effect4.gen(function* () {
172
- const fs = yield* FileSystem3;
173
- const path = yield* Path3;
174
- const tmp = `${filePath}.tmp`;
175
- yield* fs.makeDirectory(path.dirname(filePath), { recursive: true });
176
- yield* fs.writeFileString(tmp, JSON.stringify(value));
177
- yield* fs.rename(tmp, filePath);
178
- }),
179
- () => Effect4.gen(function* () {
180
- const fs = yield* FileSystem3;
181
- yield* fs.remove(filePath).pipe(Effect4.catch(() => Effect4.void));
182
- })
183
- );
184
- var awaitRunningSignal = (filePath, opts) => Effect4.scoped(
185
- Effect4.gen(function* () {
186
- const fs = yield* FileSystem3;
187
- const path = yield* Path3;
188
- const dir = path.dirname(filePath);
189
- const filename = path.basename(filePath);
190
- const deferred = yield* Deferred.make();
191
- const tryRead = Effect4.gen(function* () {
192
- if (!(yield* fs.exists(filePath))) return false;
193
- const raw = yield* fs.readFileString(filePath).pipe(Effect4.catch(() => Effect4.succeed(null)));
194
- if (raw == null) return false;
195
- const parsed = yield* Effect4.try(() => opts.parse(raw)).pipe(
196
- Effect4.catch(() => Effect4.succeed(null))
197
- );
198
- if (parsed == null) return false;
199
- yield* Deferred.succeed(deferred, parsed);
200
- return true;
201
- });
202
- yield* fs.makeDirectory(dir, { recursive: true });
203
- yield* Effect4.acquireRelease(
204
- Effect4.sync(
205
- () => (
206
- // Watch parent dir — the file may not exist yet, and watching a missing file errors.
207
- fsWatch(dir, { recursive: false }, (eventType, eventFilename) => {
208
- if (eventFilename !== filename) return;
209
- if (eventType !== "rename" && eventType !== "change") return;
210
- Effect4.runFork(tryRead);
211
- })
212
- )
213
- ),
214
- (watcher) => Effect4.sync(() => watcher.close())
215
- );
216
- yield* tryRead;
217
- return yield* Deferred.await(deferred);
218
- })
219
- );
220
-
221
- // src/dev/sticky-port.ts
222
- import { Effect as Effect5 } from "effect";
223
- import * as S2 from "effect/Schema";
224
- import getPort from "get-port";
225
- var StickyPort = SessionState.slot(S2.Struct({ port: S2.Number }));
226
- var getStickyPort = (session) => Effect5.gen(function* () {
227
- const file = yield* StickyPort.read(session);
228
- const preferred = file?.port;
229
- const port = yield* Effect5.promise(
230
- async () => getPort({
231
- port: preferred !== void 0 ? [preferred] : void 0
232
- })
233
- );
234
- yield* StickyPort.write(session, { port });
235
- return port;
236
- });
237
-
238
- // src/dev/subprocess.ts
239
- import { Effect as Effect6 } from "effect";
240
- import { ChildProcess } from "effect/unstable/process";
241
- var runManagedSubprocess = (cmd, args, opts) => Effect6.gen(function* () {
242
- const command = ChildProcess.make(cmd, args, {
243
- stdin: "inherit",
244
- stdout: "inherit",
245
- stderr: "inherit",
246
- env: { ...process.env, ...opts?.env ?? {} }
247
- });
248
- const label = [cmd, ...args].join(" ");
249
- const child = yield* Effect6.acquireRelease(
250
- Effect6.gen(function* () {
251
- const proc = yield* command;
252
- yield* Effect6.logInfo(`[dev] started: ${label} (pid=${proc.pid})`);
253
- return proc;
254
- }),
255
- (proc) => Effect6.gen(function* () {
256
- yield* Effect6.logInfo(`[dev] stopping: ${label} (pid=${proc.pid})`);
257
- yield* proc.kill().pipe(
258
- Effect6.catch(
259
- (err) => Effect6.logError(
260
- `[dev] failed to stop ${label} (pid=${proc.pid}): ${err}`
261
- )
262
- )
263
- );
264
- })
265
- );
266
- return yield* child.exitCode;
267
- });
268
-
269
- export {
270
- DevSessions,
271
- makeDevSessionsLayer,
272
- runDevCli,
273
- runningSignalPath,
274
- resolveSiblingDir,
275
- publishRunningSignal,
276
- awaitRunningSignal,
277
- SessionStateError,
278
- SessionState,
279
- getStickyPort,
280
- runManagedSubprocess
281
- };
282
- //# sourceMappingURL=chunk-IEQZ3AJH.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/dev-sessions.ts","../src/dev/session-state.ts","../src/dev/run-dev-cli.ts","../src/dev/running-signal.ts","../src/dev/sticky-port.ts","../src/dev/subprocess.ts"],"sourcesContent":["import { Array as A, Context, Effect, Layer, Option } from 'effect';\nimport { FileSystem } from 'effect/FileSystem';\nimport { Path } from 'effect/Path';\nimport type { PlatformError } from 'effect/PlatformError';\nimport { generateSlug } from 'random-word-slugs';\n\nnamespace DevSession {\n\ttype DevSessionInput = {\n\t\tname: string;\n\t\tlastModifiedAt: Date | null;\n\t\trootDir: string;\n\t\tpathJoin: (relativePath: string) => string;\n\t};\n\n\texport function make(input: DevSessionInput) {\n\t\treturn {\n\t\t\tname: input.name,\n\t\t\tlastModifiedAt: input.lastModifiedAt,\n\t\t\tpath: (relativePath: string) =>\n\t\t\t\tEffect.succeed(input.pathJoin(relativePath)),\n\t\t\ttoString: () => input.name,\n\t\t};\n\t}\n}\n\nexport type DevSession = ReturnType<typeof DevSession.make>;\n\nexport class DevSessions extends Context.Service<\n\tDevSessions,\n\t{\n\t\treadonly dir: string;\n\t\treadonly path: (relativePath: string) => string;\n\t\treadonly getSessions: Effect.Effect<Array<DevSession>, PlatformError>;\n\t\treadonly createSession: Effect.Effect<DevSession, PlatformError>;\n\t\treadonly getLatestOrCreate: Effect.Effect<DevSession, PlatformError>;\n\t}\n>()('devsess/DevSessions') {}\n\nexport const makeDevSessionsLayer = (rootDir: string) =>\n\tLayer.effect(\n\t\tDevSessions,\n\t\tEffect.gen(function* () {\n\t\t\tconst fs = yield* FileSystem;\n\t\t\tconst path = yield* Path;\n\n\t\t\tyield* Effect.logDebug(`DevSessions dir: ${rootDir}`);\n\t\t\tconst getPath = (relativePath: string) =>\n\t\t\t\tpath.join(rootDir, relativePath);\n\n\t\t\tconst getSessions = Effect.gen(function* () {\n\t\t\t\tconst entries = yield* fs\n\t\t\t\t\t.readDirectory(rootDir)\n\t\t\t\t\t.pipe(Effect.catch(() => Effect.succeed([] as Array<string>)));\n\n\t\t\t\tconst possibleSessions = yield* Effect.all(\n\t\t\t\t\tentries.map((entry) =>\n\t\t\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\t\t\tconst stat = yield* fs.stat(getPath(entry));\n\t\t\t\t\t\t\tif (stat.type !== 'Directory') return Option.none();\n\t\t\t\t\t\t\treturn Option.some(\n\t\t\t\t\t\t\t\tDevSession.make({\n\t\t\t\t\t\t\t\t\tname: entry,\n\t\t\t\t\t\t\t\t\tlastModifiedAt: Option.getOrNull(stat.mtime),\n\t\t\t\t\t\t\t\t\trootDir,\n\t\t\t\t\t\t\t\t\tpathJoin: (relativePath: string) =>\n\t\t\t\t\t\t\t\t\t\tpath.join(rootDir, entry, relativePath),\n\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t\t{ concurrency: 'unbounded' },\n\t\t\t\t);\n\n\t\t\t\treturn A.getSomes(possibleSessions);\n\t\t\t});\n\n\t\t\tconst createSession = Effect.gen(function* () {\n\t\t\t\tconst slug = generateSlug(1, { partsOfSpeech: ['noun'] });\n\t\t\t\tyield* fs.makeDirectory(getPath(slug), { recursive: true });\n\t\t\t\treturn DevSession.make({\n\t\t\t\t\tname: slug,\n\t\t\t\t\tlastModifiedAt: null,\n\t\t\t\t\trootDir,\n\t\t\t\t\tpathJoin: (relativePath: string) =>\n\t\t\t\t\t\tpath.join(rootDir, slug, relativePath),\n\t\t\t\t});\n\t\t\t});\n\n\t\t\treturn {\n\t\t\t\tdir: rootDir,\n\t\t\t\tpath: getPath,\n\t\t\t\tgetSessions,\n\t\t\t\tcreateSession,\n\t\t\t\tgetLatestOrCreate: Effect.gen(function* () {\n\t\t\t\t\tyield* fs.makeDirectory(rootDir, { recursive: true });\n\n\t\t\t\t\tconst sessions = yield* getSessions;\n\t\t\t\t\tif (sessions.length > 0) {\n\t\t\t\t\t\tsessions.sort(\n\t\t\t\t\t\t\t(a, b) =>\n\t\t\t\t\t\t\t\t(b.lastModifiedAt?.getTime() ?? 0) -\n\t\t\t\t\t\t\t\t(a.lastModifiedAt?.getTime() ?? 0),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconst latest = sessions[0];\n\t\t\t\t\t\treturn latest as DevSession;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn yield* createSession;\n\t\t\t\t}),\n\t\t\t};\n\t\t}),\n\t);\n","import { Data, Effect } from 'effect';\nimport { FileSystem } from 'effect/FileSystem';\nimport { Path } from 'effect/Path';\nimport * as S from 'effect/Schema';\nimport type { DevSession } from '../dev-sessions';\n\nexport class SessionStateError extends Data.TaggedError('SessionStateError')<{\n\tmessage: string;\n\tcause?: unknown;\n}> {}\n\nfunction getPath(session: DevSession) {\n\treturn session.path('sess.json');\n}\n\nfunction read(filePath: string) {\n\treturn Effect.gen(function* () {\n\t\tconst fs = yield* FileSystem;\n\t\tif (!(yield* fs.exists(filePath))) {\n\t\t\treturn null;\n\t\t}\n\t\treturn yield* fs.readFileString(filePath);\n\t});\n}\n\nexport namespace SessionState {\n\ttype Shape = S.Top;\n\n\texport function slot<T extends Shape>(schema: T) {\n\t\treturn {\n\t\t\tread: (session: DevSession) =>\n\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\tconst filePath = yield* getPath(session);\n\t\t\t\t\tconst content = yield* read(filePath);\n\t\t\t\t\tif (content == null) return null;\n\t\t\t\t\treturn yield* S.decodeEffect(S.fromJsonString(schema))(content).pipe(\n\t\t\t\t\t\tEffect.catchTag('SchemaError', () => Effect.succeed(null)),\n\t\t\t\t\t);\n\t\t\t\t}),\n\t\t\twrite: (session: DevSession, data: T['Type']) =>\n\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\tconst fs = yield* FileSystem;\n\t\t\t\t\tconst path = yield* Path;\n\t\t\t\t\tconst filePath = yield* getPath(session);\n\t\t\t\t\tyield* fs.makeDirectory(path.dirname(filePath), { recursive: true });\n\t\t\t\t\tconst existing = yield* read(filePath);\n\t\t\t\t\tconst parsed = yield* Effect.try({\n\t\t\t\t\t\ttry: () => JSON.parse(existing ?? '{}') as Record<string, unknown>,\n\t\t\t\t\t\tcatch: (cause) =>\n\t\t\t\t\t\t\tnew SessionStateError({\n\t\t\t\t\t\t\t\tmessage: `Failed to parse ${filePath} as JSON`,\n\t\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t});\n\t\t\t\t\tconst merged = { ...parsed, ...(data as Record<string, unknown>) };\n\t\t\t\t\tyield* fs.writeFileString(filePath, JSON.stringify(merged));\n\t\t\t\t}),\n\t\t};\n\t}\n}\n","import { join } from 'node:path';\nimport { NodeRuntime, NodeServices } from '@effect/platform-node';\nimport { Effect, Layer, type Scope } from 'effect';\nimport * as cli from 'effect/unstable/cli';\nimport { type DevSessions, makeDevSessionsLayer } from '../dev-sessions';\n\nexport type CommandConfig = typeof cli.Command.make extends (\n\tname: string,\n\tconfig: infer C,\n\t...rest: Array<unknown>\n) => unknown\n\t? C\n\t: never;\n\ntype CliHandler = (\n\topts: Record<string, unknown>,\n) => Effect.Effect<\n\tvoid,\n\tunknown,\n\tDevSessions | NodeServices.NodeServices | Scope.Scope\n>;\n\n/**\n * Shared CLI scaffolding used by both `defineDevCli` facades (`src/dev/define-cli.ts`\n * for Effect, `src/async/define-cli.ts` for plain-async): builds the `cli.Command`,\n * wires the per-project `DevSessions` + Node platform services layer, and runs it via\n * `NodeRuntime.runMain`. Only the effectful `makeHandler` differs between the two.\n */\nexport const runDevCli = (config: {\n\tname: string;\n\tdir: string;\n\toptions?: CommandConfig;\n\tmakeHandler: CliHandler;\n}): ((argv: string[]) => void) => {\n\tconst command = cli.Command.make(config.name, config.options ?? {}, (opts) =>\n\t\tconfig.makeHandler(opts as Record<string, unknown>),\n\t);\n\n\treturn (argv) => {\n\t\tconst layer = makeDevSessionsLayer(join(config.dir, '.data/sessions')).pipe(\n\t\t\tLayer.provideMerge(NodeServices.layer),\n\t\t);\n\n\t\tconst program = cli.Command.runWith(command, {\n\t\t\tversion: '0.0.0',\n\t\t})(argv);\n\n\t\tNodeRuntime.runMain(Effect.scoped(Effect.provide(program, layer)));\n\t};\n};\n","import { watch as fsWatch, realpathSync } from 'node:fs';\nimport { createRequire } from 'node:module';\nimport { dirname, join, resolve } from 'node:path';\nimport { Deferred, Effect } from 'effect';\nimport { FileSystem } from 'effect/FileSystem';\nimport { Path } from 'effect/Path';\n\nconst RUNNING_SIGNAL_FILE = '.data/running.json';\n\n/** Path to the running-signal file for a dev-session (or sibling package) directory. */\nexport const runningSignalPath = (dir: string) =>\n\tjoin(dir, RUNNING_SIGNAL_FILE);\n\n/**\n * Resolves `spec` to a directory: relative/absolute paths are resolved against\n * `fromDir`, anything else is treated as a package name and resolved via its\n * `package.json`.\n */\nexport const resolveSiblingDir = (spec: string, fromDir: string) => {\n\tif (spec.startsWith('.') || spec.startsWith('/')) {\n\t\treturn resolve(fromDir, spec);\n\t}\n\tconst require = createRequire(join(fromDir, 'package.json'));\n\tconst pkgJsonPath = require.resolve(`${spec}/package.json`);\n\treturn dirname(realpathSync(pkgJsonPath));\n};\n\n/** Atomically writes `value` as JSON to `filePath` and removes it on release. */\nexport const publishRunningSignal = (filePath: string, value: unknown) =>\n\tEffect.acquireRelease(\n\t\tEffect.gen(function* () {\n\t\t\tconst fs = yield* FileSystem;\n\t\t\tconst path = yield* Path;\n\t\t\tconst tmp = `${filePath}.tmp`;\n\t\t\tyield* fs.makeDirectory(path.dirname(filePath), { recursive: true });\n\t\t\t// Write to a temp file then rename atomically so readers never see a partial file.\n\t\t\tyield* fs.writeFileString(tmp, JSON.stringify(value));\n\t\t\tyield* fs.rename(tmp, filePath);\n\t\t}),\n\t\t() =>\n\t\t\tEffect.gen(function* () {\n\t\t\t\tconst fs = yield* FileSystem;\n\t\t\t\tyield* fs.remove(filePath).pipe(Effect.catch(() => Effect.void));\n\t\t\t}),\n\t);\n\n/** Watches parent directory for the signal file and resolves once it can be parsed. */\nexport const awaitRunningSignal = <T>(\n\tfilePath: string,\n\topts: { parse: (raw: string) => T },\n) =>\n\tEffect.scoped(\n\t\tEffect.gen(function* () {\n\t\t\tconst fs = yield* FileSystem;\n\t\t\tconst path = yield* Path;\n\t\t\tconst dir = path.dirname(filePath);\n\t\t\tconst filename = path.basename(filePath);\n\n\t\t\tconst deferred = yield* Deferred.make<T>();\n\n\t\t\tconst tryRead = Effect.gen(function* () {\n\t\t\t\tif (!(yield* fs.exists(filePath))) return false;\n\t\t\t\tconst raw = yield* fs\n\t\t\t\t\t.readFileString(filePath)\n\t\t\t\t\t.pipe(Effect.catch(() => Effect.succeed(null)));\n\t\t\t\tif (raw == null) return false;\n\t\t\t\tconst parsed = yield* Effect.try(() => opts.parse(raw)).pipe(\n\t\t\t\t\tEffect.catch(() => Effect.succeed(null)),\n\t\t\t\t);\n\t\t\t\tif (parsed == null) return false;\n\t\t\t\tyield* Deferred.succeed(deferred, parsed);\n\t\t\t\treturn true;\n\t\t\t});\n\n\t\t\t// fsWatch throws synchronously if `dir` doesn't exist yet — e.g. a sibling\n\t\t\t// package's dev script has never run — so ensure it's there first.\n\t\t\tyield* fs.makeDirectory(dir, { recursive: true });\n\n\t\t\tyield* Effect.acquireRelease(\n\t\t\t\tEffect.sync(() =>\n\t\t\t\t\t// Watch parent dir — the file may not exist yet, and watching a missing file errors.\n\t\t\t\t\tfsWatch(dir, { recursive: false }, (eventType, eventFilename) => {\n\t\t\t\t\t\tif (eventFilename !== filename) return;\n\t\t\t\t\t\tif (eventType !== 'rename' && eventType !== 'change') return;\n\t\t\t\t\t\tEffect.runFork(tryRead);\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t\t(watcher) => Effect.sync(() => watcher.close()),\n\t\t\t);\n\n\t\t\tyield* tryRead;\n\t\t\treturn yield* Deferred.await(deferred);\n\t\t}),\n\t);\n","import { Effect } from 'effect';\nimport * as S from 'effect/Schema';\nimport getPort from 'get-port';\nimport type { DevSession } from '../dev-sessions';\nimport { SessionState } from './session-state';\n\nconst StickyPort = SessionState.slot(S.Struct({ port: S.Number }));\n\nexport const getStickyPort = (session: DevSession) =>\n\tEffect.gen(function* () {\n\t\tconst file = yield* StickyPort.read(session);\n\t\tconst preferred = file?.port;\n\n\t\tconst port = yield* Effect.promise(async () =>\n\t\t\tgetPort({\n\t\t\t\tport: preferred !== undefined ? [preferred] : undefined,\n\t\t\t}),\n\t\t);\n\n\t\tyield* StickyPort.write(session, { port });\n\n\t\treturn port;\n\t});\n","import { Effect } from 'effect';\nimport { ChildProcess } from 'effect/unstable/process';\n\nexport const runManagedSubprocess = (\n\tcmd: string,\n\targs: string[],\n\topts?: { env?: Record<string, string> },\n) =>\n\tEffect.gen(function* () {\n\t\tconst command = ChildProcess.make(cmd, args, {\n\t\t\tstdin: 'inherit',\n\t\t\tstdout: 'inherit',\n\t\t\tstderr: 'inherit',\n\t\t\tenv: { ...process.env, ...(opts?.env ?? {}) },\n\t\t});\n\n\t\tconst label = [cmd, ...args].join(' ');\n\n\t\t// Registers against the ambient scope, not a scope of its own — the\n\t\t// child must outlive this call (it doesn't resolve until the child\n\t\t// exits) and get killed only when the caller's scope closes.\n\t\tconst child = yield* Effect.acquireRelease(\n\t\t\tEffect.gen(function* () {\n\t\t\t\tconst proc = yield* command;\n\t\t\t\tyield* Effect.logInfo(`[dev] started: ${label} (pid=${proc.pid})`);\n\t\t\t\treturn proc;\n\t\t\t}),\n\t\t\t(proc) =>\n\t\t\t\tEffect.gen(function* () {\n\t\t\t\t\tyield* Effect.logInfo(`[dev] stopping: ${label} (pid=${proc.pid})`);\n\t\t\t\t\tyield* proc\n\t\t\t\t\t\t.kill()\n\t\t\t\t\t\t.pipe(\n\t\t\t\t\t\t\tEffect.catch((err) =>\n\t\t\t\t\t\t\t\tEffect.logError(\n\t\t\t\t\t\t\t\t\t`[dev] failed to stop ${label} (pid=${proc.pid}): ${err}`,\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\t\t\t\t}),\n\t\t);\n\n\t\treturn yield* child.exitCode;\n\t});\n"],"mappings":";AAAA,SAAS,S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,KAAK,SAAS,KAAK,GAAG,GAAG;AACjE,aAAO;AAAA,IACR,CAAC;AAAA,IACD,CAAC,SACAA,QAAO,IAAI,aAAa;AACvB,aAAOA,QAAO,QAAQ,mBAAmB,KAAK,SAAS,KAAK,GAAG,GAAG;AAClE,aAAO,KACL,KAAK,EACL;AAAA,QACAA,QAAO;AAAA,UAAM,CAAC,QACbA,QAAO;AAAA,YACN,wBAAwB,KAAK,SAAS,KAAK,GAAG,MAAM,GAAG;AAAA,UACxD;AAAA,QACD;AAAA,MACD;AAAA,IACF,CAAC;AAAA,EACH;AAEA,SAAO,OAAO,MAAM;AACrB,CAAC;","names":["DevSession","getPath","Effect","FileSystem","Path","SessionState","Effect","Layer","Layer","Effect","join","Effect","FileSystem","Path","require","Effect","S","Effect","Effect"]}
@@ -1,25 +0,0 @@
1
- import type { NodeServices } from '@effect/platform-node';
2
- import { Effect, type Scope } from 'effect';
3
- import type { FileSystem } from 'effect/FileSystem';
4
- import type { Path } from 'effect/Path';
5
- import type { PlatformError } from 'effect/PlatformError';
6
- import { type DevSession, DevSessions } from '../dev-sessions';
7
- import { type CommandConfig } from './run-dev-cli';
8
- import { getStickyPort } from './sticky-port';
9
- import { runManagedSubprocess } from './subprocess';
10
- type RunContext = {
11
- session: Effect.Effect<DevSession, PlatformError>;
12
- getStickyPort: () => ReturnType<typeof getStickyPort>;
13
- runManagedSubprocess: typeof runManagedSubprocess;
14
- publishRunning: (data: unknown) => Effect.Effect<void, PlatformError, Scope.Scope | FileSystem | Path>;
15
- awaitRunning: <T>(pkg: string) => Effect.Effect<T, PlatformError, FileSystem | Path>;
16
- };
17
- type RunEffect = Effect.Effect<void, unknown, DevSessions | NodeServices.NodeServices | Scope.Scope>;
18
- export declare const defineDevCli: (config: {
19
- name: string;
20
- dir: string;
21
- options?: CommandConfig;
22
- run: (ctx: RunContext, opts: Record<string, unknown>) => RunEffect;
23
- }) => ((argv: string[]) => void);
24
- export {};
25
- //# sourceMappingURL=define-cli.d.ts.map
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,CACrD,CAAC;AAEF,eAAO,MAAM,YAAY,WAAY;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,GAAG,EAAE,CAAC,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,SAAS,CAAC;CACnE,KAAG,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,IAAI,CAyB1B,CAAC"}
@@ -1,20 +0,0 @@
1
- import { NodeServices } from '@effect/platform-node';
2
- import { Effect, type Scope } from 'effect';
3
- import * as cli from 'effect/unstable/cli';
4
- import { type DevSessions } from '../dev-sessions';
5
- export type CommandConfig = typeof cli.Command.make extends (name: string, config: infer C, ...rest: Array<unknown>) => unknown ? C : never;
6
- type CliHandler = (opts: Record<string, unknown>) => Effect.Effect<void, unknown, DevSessions | NodeServices.NodeServices | Scope.Scope>;
7
- /**
8
- * Shared CLI scaffolding used by both `defineDevCli` facades (`src/dev/define-cli.ts`
9
- * for Effect, `src/async/define-cli.ts` for plain-async): builds the `cli.Command`,
10
- * wires the per-project `DevSessions` + Node platform services layer, and runs it via
11
- * `NodeRuntime.runMain`. Only the effectful `makeHandler` differs between the two.
12
- */
13
- export declare const runDevCli: (config: {
14
- name: string;
15
- dir: string;
16
- options?: CommandConfig;
17
- makeHandler: CliHandler;
18
- }) => ((argv: string[]) => void);
19
- export {};
20
- //# sourceMappingURL=run-dev-cli.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"run-dev-cli.d.ts","sourceRoot":"","sources":["../../src/dev/run-dev-cli.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,MAAM,EAAS,KAAK,KAAK,EAAE,MAAM,QAAQ,CAAC;AACnD,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,KAAK,WAAW,EAAwB,MAAM,iBAAiB,CAAC;AAEzE,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,CAAC,OAAO,CAAC,IAAI,SAAS,CAC3D,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,CAAC,EACf,GAAG,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,KACnB,OAAO,GACT,CAAC,GACD,KAAK,CAAC;AAET,KAAK,UAAU,GAAG,CACjB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KACzB,MAAM,CAAC,MAAM,CACjB,IAAI,EACJ,OAAO,EACP,WAAW,GAAG,YAAY,CAAC,YAAY,GAAG,KAAK,CAAC,KAAK,CACrD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,SAAS,WAAY;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,WAAW,EAAE,UAAU,CAAC;CACxB,KAAG,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,IAAI,CAgB5B,CAAC"}