MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / writeLocalServerManifest

Function writeLocalServerManifest

apps/cli/src/local-server-manifest.ts:50–66  ·  view source on GitHub ↗
(
  manifest: ExecutorLocalServerManifest,
)

Source from the content-addressed store, hash-verified

48 });
49
50export const writeLocalServerManifest = (
51 manifest: ExecutorLocalServerManifest,
52): Effect.Effect<void, PlatformError, FileSystem.FileSystem | Path.Path> =>
53 Effect.gen(function* () {
54 const fs = yield* FileSystem.FileSystem;
55 const path = yield* Path.Path;
56 yield* fs.makeDirectory(serverControlDir(path), { recursive: true });
57 const manifestPath = localServerManifestPath(path);
58 // The manifest embeds the bearer token; create it owner-only so there's no
59 // window where it exists world-readable (mode applies only on create). The
60 // chmod after covers overwriting a pre-existing world-readable file, where
61 // the create mode is ignored.
62 yield* fs.writeFileString(manifestPath, serializeExecutorLocalServerManifest(manifest), {
63 mode: 0o600,
64 });
65 yield* fs.chmod(manifestPath, 0o600).pipe(Effect.ignore);
66 });
67
68export const removeLocalServerManifestIfOwnedBy = (input: {
69 readonly pid: number;

Callers 2

Calls 3

serverControlDirFunction · 0.70
localServerManifestPathFunction · 0.70

Tested by

no test coverage detected