@r_masseater/masseater-utils 0.5.0 → 0.6.1

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
@@ -90,20 +90,6 @@ The agent skills below describe every subpath in full: its API, the failures it
90
90
 
91
91
  The package ships agent skills in `skills/`, one per library. Add `permissions: { "@r_masseater/masseater-utils": { skills: true } }` to `pnpm-workspace.yaml` and `vp install` links them into the skill directories of your agents.
92
92
 
93
- | Skill | Library |
94
- | --------------------------- | ----------------- |
95
- | `add-scroll-chip-row` | `skerm` |
96
- | `read-hook-input` | `plugin-kit` |
97
- | `find-cache-folder` | `plugin-kit` |
98
- | `use-model-server` | `model-server` |
99
- | `run-effect-main` | `node-main` |
100
- | `write-actions-steps` | `github-workflow` |
101
- | `import-custom-format` | `mapped-import` |
102
- | `read-node-ecosystem` | `kestrion` |
103
- | `assert-exported-telemetry` | `vitest-otlp` |
104
- | `trace-workers` | `workers-tracing` |
105
- | `name-stack-resources` | `app-name` |
106
-
107
93
  ## License
108
94
 
109
95
  [MIT](LICENSE)
@@ -31,6 +31,11 @@ declare const readHookInput: <Codec extends Schema.Top>(schema: Codec) => Effect
31
31
  /** @internal */
32
32
  declare const writeHookOutput: <Codec extends Schema.Top>(schema: Codec) => (value: Codec["Type"]) => Effect.Effect<void, never, Stdio.Stdio | Codec["EncodingServices"]>;
33
33
  /** @internal */
34
- declare const runHook: (serviceName: string) => <Success, Failure>(program: Effect.Effect<Success, Failure, Platform>) => void;
35
- export { writeHookOutput as a, readHookInput as i, HookBlocked as n, runMain as o, blockHook as r, runMainWith as s, runHook as t };
36
- //# sourceMappingURL=index-Dq8LlOKp.d.mts.map
34
+ declare const runHookWith: <Provided, LayerFailure>({ serviceName, services }: Readonly<{
35
+ serviceName: string;
36
+ services: Layer.Layer<Provided, LayerFailure, Platform>;
37
+ }>) => Run<Provided>;
38
+ /** @internal */
39
+ declare const runHook: (serviceName: string) => Run<never>;
40
+ export { readHookInput as a, runMainWith as c, blockHook as i, runHookWith as n, writeHookOutput as o, HookBlocked as r, runMain as s, runHook as t };
41
+ //# sourceMappingURL=index-CeVmiNfF.d.mts.map
@@ -1,4 +1,4 @@
1
- import { o as runMain, s as runMainWith } from "./index-Dq8LlOKp.mjs";
1
+ import { c as runMainWith, s as runMain } from "./index-CeVmiNfF.mjs";
2
2
  import { Effect, Option } from "effect";
3
3
  export declare const whileParentAlive: (parentPid: Option.Option<string>) => <Value, Failure, Requirements>(program: Effect.Effect<Value, Failure, Requirements>) => Effect.Effect<void, Failure, Requirements>;
4
4
  export { runMain, runMainWith };
@@ -1,4 +1,4 @@
1
- import { a as writeHookOutput, i as readHookInput, n as HookBlocked, r as blockHook, t as runHook } from "./index-Dq8LlOKp.mjs";
1
+ import { a as readHookInput, i as blockHook, n as runHookWith, o as writeHookOutput, r as HookBlocked, t as runHook } from "./index-CeVmiNfF.mjs";
2
2
  import { Effect, Schema } from "effect";
3
3
  import { Option as Option$1 } from "effect/Option";
4
4
  declare const CacheRootError_base: Schema.Class<CacheRootError, Schema.TaggedStruct<"CacheRootError", {
@@ -14,5 +14,5 @@ export declare const isRecord: <I>(input: I) => input is I & {
14
14
  readonly [x: string]: unknown;
15
15
  };
16
16
  export declare const parseJson: (text: string) => Option$1<unknown>;
17
- export { HookBlocked, blockHook, readHookInput, runHook, writeHookOutput };
17
+ export { HookBlocked, blockHook, readHookInput, runHook, runHookWith, writeHookOutput };
18
18
  //# sourceMappingURL=plugin-kit.d.mts.map
@@ -1,5 +1,5 @@
1
- import { t as runMain } from "./run-main-BD4uT8sr.mjs";
2
- import { Array, Cause, Config, Effect, Option, Runtime, Schema, Stdio, Stream, pipe } from "effect";
1
+ import { n as runMainWith } from "./run-main-BD4uT8sr.mjs";
2
+ import { Array, Cause, Config, Effect, Layer, Option, Runtime, Schema, Stdio, Stream, pipe } from "effect";
3
3
  import { Record as Record$1, String as String$1, Unknown, decodeOption, fromJsonString, is } from "effect/Schema";
4
4
  // src/shared/lib/cache.ts
5
5
  const taggedError$1 = Schema.TaggedError;
@@ -62,9 +62,17 @@ const reportBlocked = (cause) => Option.match(blockedIn(cause), {
62
62
  onSome: (blocked) => writeStderr(`${blocked.reason}\n`)
63
63
  });
64
64
  /** @internal */
65
- const runHook = (serviceName) => (program) => {
66
- runMain(serviceName)(program.pipe(Effect.tapCause(reportBlocked)));
65
+ const runHookWith = ({ serviceName, services }) => (program) => {
66
+ runMainWith({
67
+ serviceName,
68
+ services
69
+ })(program.pipe(Effect.tapCause(reportBlocked)));
67
70
  };
68
- export { CACHE_DIRECTORY_NAME, CacheRootError, HookBlocked, blockHook, cacheRootEffect, cacheRootOf, isRecord, parseJson, readHookInput, runHook, writeHookOutput };
71
+ /** @internal */
72
+ const runHook = (serviceName) => runHookWith({
73
+ serviceName,
74
+ services: Layer.empty
75
+ });
76
+ export { CACHE_DIRECTORY_NAME, CacheRootError, HookBlocked, blockHook, cacheRootEffect, cacheRootOf, isRecord, parseJson, readHookInput, runHook, runHookWith, writeHookOutput };
69
77
 
70
78
  //# sourceMappingURL=plugin-kit.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-kit.mjs","names":["taggedError","Arr","RecordSchema","StringSchema"],"sources":["../src/shared/lib/cache.ts","../src/shared/lib/record.ts","../src/features/run-main/model/hook-io.ts","../src/features/run-main/model/run-hook.ts"],"sourcesContent":["import { Array as Arr, Config, Effect, Option, Schema, pipe } from \"effect\";\n\nconst taggedError = Schema.TaggedError;\n\nexport class CacheRootError extends taggedError<\n CacheRootError,\n { readonly brand: unique symbol }\n>()(\"CacheRootError\", { message: Schema.String }) {}\n\nconst SEPARATOR = \"/\";\nexport const CACHE_DIRECTORY_NAME = \".cache\";\n\nconst variable = (name: string): Effect.Effect<Option.Option<string>> =>\n Config.option(Config.NonEmptyString(name)).pipe(Effect.orElseSucceed(Option.none));\n\nconst baseDirectory: Effect.Effect<Option.Option<string>> = Effect.gen(function* baseDirectory() {\n const cacheHome = yield* variable(\"XDG_CACHE_HOME\");\n const home = yield* variable(\"HOME\");\n const profile = yield* variable(\"USERPROFILE\");\n return pipe(\n cacheHome,\n Option.orElse(() =>\n pipe(\n Option.orElse(home, () => profile),\n Option.map((directory) => `${directory}${SEPARATOR}${CACHE_DIRECTORY_NAME}`),\n ),\n ),\n );\n});\n\nexport const cacheRootEffect = (\n segments: readonly string[],\n): Effect.Effect<string, CacheRootError> =>\n baseDirectory.pipe(\n Effect.flatMap(\n Option.match({\n onNone: () => Effect.fail(CacheRootError.make({ message: \"set XDG_CACHE_HOME or HOME\" })),\n onSome: (base) => Effect.succeed(pipe([base, ...segments], Arr.join(SEPARATOR))),\n }),\n ),\n );\n\nexport const cacheRootOf = (segments: readonly string[]): Promise<string> =>\n Effect.runPromise(cacheRootEffect(segments));\n","import type { Option } from \"effect/Option\";\nimport {\n Record as RecordSchema,\n String as StringSchema,\n Unknown,\n decodeOption,\n fromJsonString,\n is,\n} from \"effect/Schema\";\n\nexport const isRecord = is(RecordSchema(StringSchema, Unknown));\n\nexport const parseJson = (text: string): Option<unknown> =>\n decodeOption(fromJsonString(Unknown))(text);\n","import { Effect, Runtime, Schema, Stdio, Stream } from \"effect\";\n\nconst EXIT_BLOCKING = 2;\n\nconst taggedError = Schema.TaggedError;\n\n/** @internal */\nexport class HookBlocked extends taggedError<HookBlocked, { readonly brand: unique symbol }>()(\n \"HookBlocked\",\n { reason: Schema.String },\n) {\n public override readonly [Runtime.errorExitCode] = EXIT_BLOCKING;\n public override readonly [Runtime.errorReported] = false;\n}\n\n/** @internal */\nexport const isHookBlocked = Schema.is(HookBlocked);\n\n/** @internal */\nexport const blockHook = (reason: string): Effect.Effect<never, HookBlocked> =>\n Effect.fail(HookBlocked.make({ reason }));\n\n/** @internal */\nexport const readStdin: Effect.Effect<string, never, Stdio.Stdio> = Effect.gen(\n function* readStdin() {\n const stdio = yield* Stdio.Stdio;\n return yield* stdio.stdin.pipe(Stream.decodeText, Stream.mkString, Effect.orDie);\n },\n);\n\n/** @internal */\nexport const readHookInput = <Codec extends Schema.Top>(\n schema: Codec,\n): Effect.Effect<Codec[\"Type\"], Schema.SchemaError, Stdio.Stdio | Codec[\"DecodingServices\"]> =>\n Effect.gen(function* read() {\n const text = yield* readStdin;\n const json = Schema.fromJsonString(schema);\n return yield* Schema.decodeEffect(json)(text);\n });\n\n/** @internal */\nexport const writeStdout = (text: string): Effect.Effect<void, never, Stdio.Stdio> =>\n Effect.gen(function* toStdout() {\n const stdio = yield* Stdio.Stdio;\n yield* Stream.make(text).pipe(Stream.run(stdio.stdout()), Effect.orDie);\n });\n\n/** @internal */\nexport const writeStderr = (text: string): Effect.Effect<void, never, Stdio.Stdio> =>\n Effect.gen(function* toStderr() {\n const stdio = yield* Stdio.Stdio;\n yield* Stream.make(text).pipe(Stream.run(stdio.stderr()), Effect.orDie);\n });\n\n/** @internal */\nexport const writeHookOutput =\n <Codec extends Schema.Top>(schema: Codec) =>\n (value: Codec[\"Type\"]): Effect.Effect<void, never, Stdio.Stdio | Codec[\"EncodingServices\"]> =>\n Schema.encodeEffect(Schema.fromJsonString(schema))(value).pipe(\n Effect.orDie,\n Effect.flatMap(writeStdout),\n );\n","import { Cause, Effect, Option } from \"effect\";\nimport type { Stdio } from \"effect\";\n\nimport { isHookBlocked, writeStderr } from \"./hook-io.ts\";\nimport type { HookBlocked } from \"./hook-io.ts\";\nimport { runMain } from \"./run-main.ts\";\nimport type { Platform } from \"./run-main.ts\";\n\nconst blockedIn = <Failure>(cause: Cause.Cause<Failure>): Option.Option<HookBlocked> =>\n Cause.findErrorOption(cause).pipe(\n Option.filter((error): error is Failure & HookBlocked => isHookBlocked(error)),\n );\n\nconst reportBlocked = <Failure>(\n cause: Cause.Cause<Failure>,\n): Effect.Effect<void, never, Stdio.Stdio> =>\n Option.match(blockedIn(cause), {\n onNone: () => Effect.void,\n onSome: (blocked) => writeStderr(`${blocked.reason}\\n`),\n });\n\n/** @internal */\nexport const runHook =\n (serviceName: string) =>\n <Success, Failure>(program: Eff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SAAS,YAAY,YAAY,GAAG,QAAQ,OAAO,GAAG;AACxD,CAAC;;AAGH,MAAa,WACV,iBACkB,YAA6D;CAC9E,QAAQ,WAAW,CAAC,CAAC,QAAQ,KAAK,OAAO,SAAS,aAAa,CAAC,CAAC;AACnE"}
1
+ {"version":3,"file":"plugin-kit.mjs","names":["taggedError","Arr","RecordSchema","StringSchema"],"sources":["../src/shared/lib/cache.ts","../src/shared/lib/record.ts","../src/features/run-main/model/hook-io.ts","../src/features/run-main/model/run-hook.ts"],"sourcesContent":["import { Array as Arr, Config, Effect, Option, Schema, pipe } from \"effect\";\n\nconst taggedError = Schema.TaggedError;\n\nexport class CacheRootError extends taggedError<\n CacheRootError,\n { readonly brand: unique symbol }\n>()(\"CacheRootError\", { message: Schema.String }) {}\n\nconst SEPARATOR = \"/\";\nexport const CACHE_DIRECTORY_NAME = \".cache\";\n\nconst variable = (name: string): Effect.Effect<Option.Option<string>> =>\n Config.option(Config.NonEmptyString(name)).pipe(Effect.orElseSucceed(Option.none));\n\nconst baseDirectory: Effect.Effect<Option.Option<string>> = Effect.gen(function* baseDirectory() {\n const cacheHome = yield* variable(\"XDG_CACHE_HOME\");\n const home = yield* variable(\"HOME\");\n const profile = yield* variable(\"USERPROFILE\");\n return pipe(\n cacheHome,\n Option.orElse(() =>\n pipe(\n Option.orElse(home, () => profile),\n Option.map((directory) => `${directory}${SEPARATOR}${CACHE_DIRECTORY_NAME}`),\n ),\n ),\n );\n});\n\nexport const cacheRootEffect = (\n segments: readonly string[],\n): Effect.Effect<string, CacheRootError> =>\n baseDirectory.pipe(\n Effect.flatMap(\n Option.match({\n onNone: () => Effect.fail(CacheRootError.make({ message: \"set XDG_CACHE_HOME or HOME\" })),\n onSome: (base) => Effect.succeed(pipe([base, ...segments], Arr.join(SEPARATOR))),\n }),\n ),\n );\n\nexport const cacheRootOf = (segments: readonly string[]): Promise<string> =>\n Effect.runPromise(cacheRootEffect(segments));\n","import type { Option } from \"effect/Option\";\nimport {\n Record as RecordSchema,\n String as StringSchema,\n Unknown,\n decodeOption,\n fromJsonString,\n is,\n} from \"effect/Schema\";\n\nexport const isRecord = is(RecordSchema(StringSchema, Unknown));\n\nexport const parseJson = (text: string): Option<unknown> =>\n decodeOption(fromJsonString(Unknown))(text);\n","import { Effect, Runtime, Schema, Stdio, Stream } from \"effect\";\n\nconst EXIT_BLOCKING = 2;\n\nconst taggedError = Schema.TaggedError;\n\n/** @internal */\nexport class HookBlocked extends taggedError<HookBlocked, { readonly brand: unique symbol }>()(\n \"HookBlocked\",\n { reason: Schema.String },\n) {\n public override readonly [Runtime.errorExitCode] = EXIT_BLOCKING;\n public override readonly [Runtime.errorReported] = false;\n}\n\n/** @internal */\nexport const isHookBlocked = Schema.is(HookBlocked);\n\n/** @internal */\nexport const blockHook = (reason: string): Effect.Effect<never, HookBlocked> =>\n Effect.fail(HookBlocked.make({ reason }));\n\n/** @internal */\nexport const readStdin: Effect.Effect<string, never, Stdio.Stdio> = Effect.gen(\n function* readStdin() {\n const stdio = yield* Stdio.Stdio;\n return yield* stdio.stdin.pipe(Stream.decodeText, Stream.mkString, Effect.orDie);\n },\n);\n\n/** @internal */\nexport const readHookInput = <Codec extends Schema.Top>(\n schema: Codec,\n): Effect.Effect<Codec[\"Type\"], Schema.SchemaError, Stdio.Stdio | Codec[\"DecodingServices\"]> =>\n Effect.gen(function* read() {\n const text = yield* readStdin;\n const json = Schema.fromJsonString(schema);\n return yield* Schema.decodeEffect(json)(text);\n });\n\n/** @internal */\nexport const writeStdout = (text: string): Effect.Effect<void, never, Stdio.Stdio> =>\n Effect.gen(function* toStdout() {\n const stdio = yield* Stdio.Stdio;\n yield* Stream.make(text).pipe(Stream.run(stdio.stdout()), Effect.orDie);\n });\n\n/** @internal */\nexport const writeStderr = (text: string): Effect.Effect<void, never, Stdio.Stdio> =>\n Effect.gen(function* toStderr() {\n const stdio = yield* Stdio.Stdio;\n yield* Stream.make(text).pipe(Stream.run(stdio.stderr()), Effect.orDie);\n });\n\n/** @internal */\nexport const writeHookOutput =\n <Codec extends Schema.Top>(schema: Codec) =>\n (value: Codec[\"Type\"]): Effect.Effect<void, never, Stdio.Stdio | Codec[\"EncodingServices\"]> =>\n Schema.encodeEffect(Schema.fromJsonString(schema))(value).pipe(\n Effect.orDie,\n Effect.flatMap(writeStdout),\n );\n","import { Cause, Effect, Layer, Option } from \"effect\";\nimport type { Stdio } from \"effect\";\n\nimport { isHookBlocked, writeStderr } from \"./hook-io.ts\";\nimport type { HookBlocked } from \"./hook-io.ts\";\nimport { runMainWith } from \"./run-main.ts\";\nimport type { Platform, Run } from \"./run-main.ts\";\n\nconst blockedIn = <Failure>(cause: Cause.Cause<Failure>): Option.Option<HookBlocked> =>\n Cause.findErrorOption(cause).pipe(\n Option.filter((error): error is Failure & HookBlocked => isHookBlocked(error)),\n );\n\nconst reportBlocked = <Failure>(\n cause: Cause.Cause<Failure>,\n): Effect.Effect<void, never, Stdio.Stdio> =>\n Option.match(blockedIn(cause), {\n onNone: () => Effect.void,\n onSome: (blocked) => writeStderr(`${blocked.reason}\\n`),\n });\n\n/** @internal */\nexport const runHookWith =\n <Provided, LayerFailure>({\n serviceName,\n services,\n }: Readonly<{\n serviceName: string;\n services: Layer.Layer<Provided, LayerFailure, Platform>;\n }>): Run<Provided> =>\n (program) => {\n runMainWith({ serviceName, services })(program.pipe(Effect.tapCause(reportBlocked)));\n };\n\n/** @internal */\nexport const runHook = (serviceName: string): Run<never> =>\n runHookWith({ serviceName, services: Layer.empty });\n"],"mappings":";;;;AAEA,MAAMA,gBAAc,OAAO;AAE3B,IAAa,iBAAb,cAAoCA,cAGlC,CAAC,CAAC,kBAAkB,EAAE,SAAS,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC;AAEnD,MAAM,YAAY;AAClB,MAAa,uBAAuB;AAEpC,MAAM,YAAY,SAChB,OAAO,OAAO,OAAO,eAAe,IAAI,CAAC,CAAC,CAAC,KAAK,OAAO,cAAc,OAAO,IAAI,CAAC;AAEnF,MAA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": "The small shared libraries of masseater's repositories as subpaths of one package: a chip row for React, Claude Code plugin helpers, Effect entry points for Node.js and GitHub Actions, file import mapping, Node package readers, OTLP assertions for Vitest and Cloudflare Workers tracing.",
5
5
  "keywords": [
6
6
  "actions",
@@ -2,7 +2,7 @@
2
2
  name: read-hook-input
3
3
  description: >
4
4
  Use when a Claude Code plugin hook or script must read JSON it did not write, such as a hook
5
- payload on stdin or a settings file: runHook, readHookInput, writeHookOutput and blockHook for a
5
+ payload on stdin or a settings file: runHook, runHookWith, readHookInput, writeHookOutput and blockHook for a
6
6
  hook written with Effect, and parseJson and isRecord for plain code.
7
7
  metadata:
8
8
  type: core
@@ -56,7 +56,7 @@ runHook("my-plugin")(
56
56
  );
57
57
  ```
58
58
 
59
- `readHookInput` decodes the JSON on stdin with the schema and keeps only the fields the schema names. `writeHookOutput` encodes the value and writes it to stdout. `blockHook` ends the hook with exit code 2 and writes the reason to stderr, which Claude Code shows to the model. `runHook` provides the Node services and sends traces under the given service name, like `runMain`. List `effect` and `@effect/platform-node` in the plugin's `dependencies`, because they are optional peers of this package and Claude Code installs only what the plugin lists.
59
+ `readHookInput` decodes the JSON on stdin with the schema and keeps only the fields the schema names. `writeHookOutput` encodes the value and writes it to stdout. `blockHook` ends the hook with exit code 2 and writes the reason to stderr, which Claude Code shows to the model. `runHook` provides the Node services and sends traces under the given service name, like `runMain`. When the hook needs another service, such as `Digest` from `effect/crypto`, use `runHookWith({ serviceName, services })` instead of providing the layer inside the program, as `runMainWith` does for scripts. List `effect` and `@effect/platform-node` in the plugin's `dependencies`, because they are optional peers of this package and Claude Code installs only what the plugin lists.
60
60
 
61
61
  ## Read a payload
62
62