@r_masseater/masseater-utils 0.0.0 → 0.1.2

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 (130) hide show
  1. package/LICENSE +87 -0
  2. package/README.md +97 -1
  3. package/dist/context-B_4aJtEC.mjs +6 -0
  4. package/dist/context-B_4aJtEC.mjs.map +1 -0
  5. package/dist/failure-CjeINRVu.mjs +19 -0
  6. package/dist/failure-CjeINRVu.mjs.map +1 -0
  7. package/dist/github-workflow.d.mts +77 -0
  8. package/dist/github-workflow.mjs +110 -0
  9. package/dist/github-workflow.mjs.map +1 -0
  10. package/dist/index-CUo4CRam.d.mts +1 -0
  11. package/dist/index-Cb8YSEwo.d.mts +31 -0
  12. package/dist/index-DudHILTn.d.mts +6 -0
  13. package/dist/index-KNezbJnC.d.mts +121 -0
  14. package/dist/kestrion-node.d.mts +6 -0
  15. package/dist/kestrion-node.mjs +9 -0
  16. package/dist/kestrion-node.mjs.map +1 -0
  17. package/dist/kestrion-npm.d.mts +25 -0
  18. package/dist/kestrion-npm.mjs +54 -0
  19. package/dist/kestrion-npm.mjs.map +1 -0
  20. package/dist/kestrion-pnpm.d.mts +29 -0
  21. package/dist/kestrion-pnpm.mjs +68 -0
  22. package/dist/kestrion-pnpm.mjs.map +1 -0
  23. package/dist/kestrion.d.mts +2 -0
  24. package/dist/kestrion.mjs +46 -0
  25. package/dist/kestrion.mjs.map +1 -0
  26. package/dist/mapped-import-mapper.d.mts +24 -0
  27. package/dist/mapped-import-mapper.mjs +34 -0
  28. package/dist/mapped-import-mapper.mjs.map +1 -0
  29. package/dist/mapped-import-vite.d.mts +21 -0
  30. package/dist/mapped-import-vite.mjs +49 -0
  31. package/dist/mapped-import-vite.mjs.map +1 -0
  32. package/dist/mapped-import.d.mts +2 -0
  33. package/dist/mapped-import.mjs +36 -0
  34. package/dist/mapped-import.mjs.map +1 -0
  35. package/dist/node-main.d.mts +19 -0
  36. package/dist/node-main.mjs +59 -0
  37. package/dist/node-main.mjs.map +1 -0
  38. package/dist/normalize-CogX79EO.mjs +76 -0
  39. package/dist/normalize-CogX79EO.mjs.map +1 -0
  40. package/dist/otlp-ohapzeFh.mjs +18 -0
  41. package/dist/otlp-ohapzeFh.mjs.map +1 -0
  42. package/dist/otlp-schema-CDBPGJ5s.mjs +125 -0
  43. package/dist/otlp-schema-CDBPGJ5s.mjs.map +1 -0
  44. package/dist/otlp-spans-D88555DO.mjs +52 -0
  45. package/dist/otlp-spans-D88555DO.mjs.map +1 -0
  46. package/dist/package-json-CYRyaF9U.mjs +58 -0
  47. package/dist/package-json-CYRyaF9U.mjs.map +1 -0
  48. package/dist/plugin-kit.d.mts +5663 -0
  49. package/dist/plugin-kit.mjs +11501 -0
  50. package/dist/plugin-kit.mjs.map +1 -0
  51. package/dist/receive-S2txZwcV.mjs +61 -0
  52. package/dist/receive-S2txZwcV.mjs.map +1 -0
  53. package/dist/route-handlers-Cn3O2hmf.mjs +14 -0
  54. package/dist/route-handlers-Cn3O2hmf.mjs.map +1 -0
  55. package/dist/route-handlers-E2lwhaAf.d.mts +14 -0
  56. package/dist/run-Cc5W9mi8.mjs +13 -0
  57. package/dist/run-Cc5W9mi8.mjs.map +1 -0
  58. package/dist/run-D59Owiv1.d.mts +5 -0
  59. package/dist/skerm.d.mts +6 -0
  60. package/dist/skerm.mjs +128 -0
  61. package/dist/skerm.mjs.map +1 -0
  62. package/dist/span-BKjRu617.mjs +60 -0
  63. package/dist/span-BKjRu617.mjs.map +1 -0
  64. package/dist/telemetry-BEWIE8tU.d.mts +51 -0
  65. package/dist/vitest-otlp-collector-files.d.mts +8 -0
  66. package/dist/vitest-otlp-collector-files.mjs +13 -0
  67. package/dist/vitest-otlp-collector-files.mjs.map +1 -0
  68. package/dist/vitest-otlp-current-receiver-8c7rIP1N.mjs +13 -0
  69. package/dist/vitest-otlp-current-receiver-8c7rIP1N.mjs.map +1 -0
  70. package/dist/vitest-otlp-current-receiver-DphmM9Ha.d.mts +10 -0
  71. package/dist/vitest-otlp-semconv.d.mts +3 -0
  72. package/dist/vitest-otlp-semconv.mjs +92 -0
  73. package/dist/vitest-otlp-semconv.mjs.map +1 -0
  74. package/dist/vitest-otlp-setup.d.mts +1 -0
  75. package/dist/vitest-otlp-setup.mjs +295 -0
  76. package/dist/vitest-otlp-setup.mjs.map +1 -0
  77. package/dist/vitest-otlp-tail-to-otlp.mjs +271 -0
  78. package/dist/vitest-otlp-tail-to-otlp.mjs.map +1 -0
  79. package/dist/vitest-otlp-workers.d.mts +26 -0
  80. package/dist/vitest-otlp-workers.mjs +54 -0
  81. package/dist/vitest-otlp-workers.mjs.map +1 -0
  82. package/dist/vitest-otlp.d.mts +51 -0
  83. package/dist/vitest-otlp.mjs +66 -0
  84. package/dist/vitest-otlp.mjs.map +1 -0
  85. package/dist/workers-tracing-alchemy.d.mts +22 -0
  86. package/dist/workers-tracing-alchemy.mjs +124 -0
  87. package/dist/workers-tracing-alchemy.mjs.map +1 -0
  88. package/dist/workers-tracing-browser-logs.d.mts +4 -0
  89. package/dist/workers-tracing-browser-logs.mjs +67 -0
  90. package/dist/workers-tracing-browser-logs.mjs.map +1 -0
  91. package/dist/workers-tracing-browser-spans.d.mts +4 -0
  92. package/dist/workers-tracing-browser-spans.mjs +13 -0
  93. package/dist/workers-tracing-browser-spans.mjs.map +1 -0
  94. package/dist/workers-tracing-effect-tracing.d.mts +8 -0
  95. package/dist/workers-tracing-effect-tracing.mjs +68 -0
  96. package/dist/workers-tracing-effect-tracing.mjs.map +1 -0
  97. package/dist/workers-tracing-effect-tracing.plain.d.mts +7 -0
  98. package/dist/workers-tracing-effect-tracing.plain.mjs +9 -0
  99. package/dist/workers-tracing-effect-tracing.plain.mjs.map +1 -0
  100. package/dist/workers-tracing-elysia.d.mts +5 -0
  101. package/dist/workers-tracing-elysia.mjs +53 -0
  102. package/dist/workers-tracing-elysia.mjs.map +1 -0
  103. package/dist/workers-tracing-elysia.plain.d.mts +3 -0
  104. package/dist/workers-tracing-elysia.plain.mjs +3 -0
  105. package/dist/workers-tracing-oxlint.d.mts +6 -0
  106. package/dist/workers-tracing-oxlint.mjs +8 -0
  107. package/dist/workers-tracing-oxlint.mjs.map +1 -0
  108. package/dist/workers-tracing-tanstack-start.d.mts +22 -0
  109. package/dist/workers-tracing-tanstack-start.mjs +28 -0
  110. package/dist/workers-tracing-tanstack-start.mjs.map +1 -0
  111. package/dist/workers-tracing-tanstack-start.plain.d.mts +9 -0
  112. package/dist/workers-tracing-tanstack-start.plain.mjs +10 -0
  113. package/dist/workers-tracing-tanstack-start.plain.mjs.map +1 -0
  114. package/dist/workers-tracing-trace-sink.d.mts +7 -0
  115. package/dist/workers-tracing-trace-sink.mjs +29 -0
  116. package/dist/workers-tracing-trace-sink.mjs.map +1 -0
  117. package/dist/workers-tracing-workers-ai.d.mts +33 -0
  118. package/dist/workers-tracing-workers-ai.mjs +108 -0
  119. package/dist/workers-tracing-workers-ai.mjs.map +1 -0
  120. package/package.json +252 -5
  121. package/skills/add-scroll-chip-row/SKILL.md +59 -0
  122. package/skills/assert-exported-telemetry/SKILL.md +131 -0
  123. package/skills/find-cache-folder/SKILL.md +36 -0
  124. package/skills/import-custom-format/SKILL.md +76 -0
  125. package/skills/read-hook-input/SKILL.md +39 -0
  126. package/skills/read-node-ecosystem/SKILL.md +131 -0
  127. package/skills/run-effect-main/SKILL.md +82 -0
  128. package/skills/trace-workers/SKILL.md +152 -0
  129. package/skills/write-actions-steps/SKILL.md +76 -0
  130. package/src/app/skerm.css +139 -0
@@ -0,0 +1,76 @@
1
+ ---
2
+ name: write-actions-steps
3
+ description: >
4
+ Use when a GitHub Actions step is written in TypeScript with Effect and must call the GitHub API
5
+ of its own repository, write GITHUB_OUTPUT or GITHUB_ENV, mask a value, emit annotations, or run
6
+ a command: getJson, postJson, post, patch, remove, writeOutputs, setEnv, mask, warn, fail,
7
+ succeeds, mustSucceed, outputOf, finished and sha256Of.
8
+ metadata:
9
+ type: core
10
+ library: "@r_masseater/masseater-utils"
11
+ sources:
12
+ - src/app/github-workflow*
13
+ - src/shared/api/github/**
14
+ - src/shared/lib/workflow.ts
15
+ - src/shared/lib/process.ts
16
+ - src/shared/lib/digest.ts
17
+ - README.md
18
+ ---
19
+
20
+ # write-actions-steps
21
+
22
+ A step written with this library reads everything it needs from the environment GitHub Actions sets, so the step takes no repository or token argument.
23
+
24
+ ## Setup
25
+
26
+ ```sh
27
+ vp add @r_masseater/masseater-utils effect
28
+ ```
29
+
30
+ Give the step `GITHUB_REPOSITORY` and one of `GH_TOKEN` or `GITHUB_TOKEN`. The API functions fail with a `ConfigError` when they are missing.
31
+
32
+ ## Call the API
33
+
34
+ ```ts
35
+ import { getJson, patch } from "@r_masseater/masseater-utils/github-workflow";
36
+ import { Schema } from "effect";
37
+
38
+ const Issue = Schema.Struct({ state: Schema.String });
39
+
40
+ export const read = getJson(Issue)("issues/1");
41
+ export const close = patch({ path: "issues/1", body: { state: "closed" } });
42
+ ```
43
+
44
+ Run the effect with an HTTP client, for example the one `@r_masseater/masseater-utils/node-main` provides.
45
+
46
+ ## Report results
47
+
48
+ ```ts
49
+ import { fail, writeOutputs } from "@r_masseater/masseater-utils/github-workflow";
50
+
51
+ export const ok = writeOutputs({ changed: "true" });
52
+ export const ng = fail("The check failed.");
53
+ ```
54
+
55
+ Call `mask` before a secret reaches any output. `fail` both prints the annotation and fails the effect.
56
+
57
+ ## Run commands
58
+
59
+ ```ts
60
+ import { mustSucceed, outputOf } from "@r_masseater/masseater-utils/github-workflow";
61
+
62
+ export const build = mustSucceed({ command: "vp", args: ["run", "build"] });
63
+ export const head = outputOf({ command: "git", args: ["rev-parse", "HEAD"] });
64
+ ```
65
+
66
+ ## Common mistakes
67
+
68
+ ### Passing the token as an argument
69
+
70
+ Wrong:
71
+
72
+ ```ts
73
+ getJson(Issue)("issues/1", { token });
74
+ ```
75
+
76
+ Correct: set `GH_TOKEN` in the step's `env` and call `getJson(Issue)("issues/1")`.
@@ -0,0 +1,139 @@
1
+ @property --skerm-fade-start {
2
+ syntax: "<number>";
3
+ inherits: false;
4
+ initial-value: 0;
5
+ }
6
+
7
+ @property --skerm-fade-end {
8
+ syntax: "<number>";
9
+ inherits: false;
10
+ initial-value: 0;
11
+ }
12
+
13
+ @keyframes skerm-fade-start {
14
+ to {
15
+ --skerm-fade-start: 1;
16
+ }
17
+ }
18
+
19
+ @keyframes skerm-fade-end {
20
+ from {
21
+ --skerm-fade-end: 1;
22
+ }
23
+ }
24
+
25
+ @keyframes skerm-arrow-show {
26
+ to {
27
+ opacity: 1;
28
+ visibility: visible;
29
+ }
30
+ }
31
+
32
+ [data-slot="skerm-row"] {
33
+ timeline-scope: --skerm-row;
34
+ position: relative;
35
+ min-width: 0;
36
+ max-width: 100%;
37
+ }
38
+
39
+ [data-slot="skerm-scroller"] {
40
+ --skerm-fade-size: 3rem;
41
+ --skerm-fade-dir: right;
42
+ --skerm-fade-start-pos: 0;
43
+ --skerm-fade-end-pos: 100%;
44
+ display: flex;
45
+ align-items: center;
46
+ gap: 0.5rem;
47
+ margin: -0.25rem;
48
+ padding: 0.25rem;
49
+ list-style: none;
50
+ overflow-x: auto;
51
+ overscroll-behavior-x: contain;
52
+ scrollbar-width: none;
53
+ scroll-padding-inline: var(--skerm-fade-size);
54
+ scroll-timeline: --skerm-row inline;
55
+ mask:
56
+ linear-gradient(black, black) no-clip subtract,
57
+ linear-gradient(to var(--skerm-fade-dir), black, transparent) var(--skerm-fade-start-pos) 0 /
58
+ calc(var(--skerm-fade-size) * var(--skerm-fade-start)) 100% no-repeat no-clip,
59
+ linear-gradient(to var(--skerm-fade-dir), transparent, black) var(--skerm-fade-end-pos) 0 /
60
+ calc(var(--skerm-fade-size) * var(--skerm-fade-end)) 100% no-repeat no-clip;
61
+ animation-name: skerm-fade-start, skerm-fade-end;
62
+ animation-duration: auto;
63
+ animation-timing-function: linear;
64
+ animation-fill-mode: both;
65
+ animation-timeline: scroll(self inline);
66
+ animation-range:
67
+ 0 var(--skerm-fade-size),
68
+ calc(100% - var(--skerm-fade-size)) 100%;
69
+ }
70
+
71
+ [data-slot="skerm-scroller"]:dir(rtl) {
72
+ --skerm-fade-dir: left;
73
+ --skerm-fade-start-pos: 100%;
74
+ --skerm-fade-end-pos: 0;
75
+ }
76
+
77
+ [data-slot="skerm-scroller"]::-webkit-scrollbar {
78
+ display: none;
79
+ }
80
+
81
+ [data-slot="skerm-scroller"] > * {
82
+ flex: none;
83
+ white-space: nowrap;
84
+ }
85
+
86
+ @media (prefers-reduced-motion: no-preference) {
87
+ [data-slot="skerm-scroller"] {
88
+ scroll-behavior: smooth;
89
+ }
90
+ }
91
+
92
+ [data-slot="skerm-arrow"] {
93
+ position: absolute;
94
+ inset-block: 0;
95
+ display: none;
96
+ align-items: center;
97
+ opacity: 0;
98
+ visibility: hidden;
99
+ animation: skerm-arrow-show linear both;
100
+ animation-timeline: --skerm-row;
101
+ }
102
+
103
+ @media (hover: hover) and (pointer: fine) {
104
+ [data-slot="skerm-arrow"] {
105
+ display: flex;
106
+ }
107
+ }
108
+
109
+ [data-slot="skerm-arrow"][data-side="start"] {
110
+ inset-inline-start: 0;
111
+ animation-range: 0 1rem;
112
+ }
113
+
114
+ [data-slot="skerm-arrow"][data-side="end"] {
115
+ inset-inline-end: 0;
116
+ animation-direction: reverse;
117
+ animation-range: calc(100% - 1rem) 100%;
118
+ }
119
+
120
+ [data-slot="skerm-arrow-button"] {
121
+ display: grid;
122
+ width: 2rem;
123
+ height: 2rem;
124
+ place-items: center;
125
+ border: 1px solid var(--skerm-border, GrayText);
126
+ border-radius: 9999px;
127
+ background: var(--skerm-surface, Canvas);
128
+ color: var(--skerm-on-surface, CanvasText);
129
+ cursor: pointer;
130
+ }
131
+
132
+ [data-slot="skerm-arrow-button"]:hover {
133
+ background: var(--skerm-hover, color-mix(in srgb, CanvasText 8%, Canvas));
134
+ }
135
+
136
+ [data-slot="skerm-arrow-icon"] {
137
+ width: 1rem;
138
+ height: 1rem;
139
+ }