@batonfx/skills 0.1.0 → 0.1.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.
@@ -1,5 +1,5 @@
1
1
  $ bun build ./src/index.ts --outdir dist --target bun --format esm
2
- Bundled 247 modules in 654ms
2
+ Bundled 247 modules in 643ms
3
3
 
4
4
  index.js 1.14 MB (entry point)
5
5
 
package/dist/index.js CHANGED
@@ -34777,20 +34777,22 @@ var parseHeader = (source, block) => exports_Effect.sync(() => {
34777
34777
  }
34778
34778
  return parsed;
34779
34779
  }).pipe(exports_Effect.catchCause((cause) => exports_Effect.fail(sourceError(source, "Invalid SKILL.md frontmatter", cause))));
34780
- var splitDocument = (source, content) => exports_Effect.sync(() => {
34780
+ var splitDocument = (source, content) => exports_Effect.gen(function* () {
34781
34781
  const normalized = content.replace(/^\uFEFF/, "").replace(/\r\n/g, `
34782
34782
  `);
34783
34783
  const lines = normalized.split(`
34784
34784
  `);
34785
- if (lines[0] !== "---")
34786
- throw new Error("missing opening frontmatter fence");
34785
+ if (lines[0] !== "---") {
34786
+ return yield* exports_Effect.fail(sourceError(source, "Invalid SKILL.md document: missing opening frontmatter fence"));
34787
+ }
34787
34788
  const close2 = lines.findIndex((line, index2) => index2 > 0 && line === "---");
34788
- if (close2 === -1)
34789
- throw new Error("missing closing frontmatter fence");
34789
+ if (close2 === -1) {
34790
+ return yield* exports_Effect.fail(sourceError(source, "Invalid SKILL.md document: missing closing frontmatter fence"));
34791
+ }
34790
34792
  return [lines.slice(1, close2).join(`
34791
34793
  `), lines.slice(close2 + 1).join(`
34792
34794
  `)];
34793
- }).pipe(exports_Effect.catchCause((cause) => exports_Effect.fail(sourceError(source, "Invalid SKILL.md document", cause))));
34795
+ });
34794
34796
  var namespacedName = (path, relativeFile, explicitName) => {
34795
34797
  const directory = path.dirname(relativeFile);
34796
34798
  const segments = directory === "." ? [] : directory.split("/").filter((part) => part.length > 0);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@batonfx/skills",
4
- "version": "0.1.0",
4
+ "version": "0.1.1",
5
5
  "private": false,
6
6
  "type": "module",
7
7
  "exports": {
@@ -14,7 +14,7 @@
14
14
  "typecheck": "bun tsc --noEmit"
15
15
  },
16
16
  "dependencies": {
17
- "@batonfx/core": "0.1.0",
17
+ "@batonfx/core": "0.1.1",
18
18
  "effect": "4.0.0-beta.93"
19
19
  },
20
20
  "devDependencies": {
@@ -126,14 +126,18 @@ const splitDocument = (
126
126
  source: string,
127
127
  content: string,
128
128
  ): Effect.Effect<readonly [string, string], SkillSource.SkillSourceError> =>
129
- Effect.sync(() => {
129
+ Effect.gen(function* () {
130
130
  const normalized = content.replace(/^\uFEFF/, "").replace(/\r\n/g, "\n")
131
131
  const lines = normalized.split("\n")
132
- if (lines[0] !== "---") throw new Error("missing opening frontmatter fence")
132
+ if (lines[0] !== "---") {
133
+ return yield* Effect.fail(sourceError(source, "Invalid SKILL.md document: missing opening frontmatter fence"))
134
+ }
133
135
  const close = lines.findIndex((line, index) => index > 0 && line === "---")
134
- if (close === -1) throw new Error("missing closing frontmatter fence")
136
+ if (close === -1) {
137
+ return yield* Effect.fail(sourceError(source, "Invalid SKILL.md document: missing closing frontmatter fence"))
138
+ }
135
139
  return [lines.slice(1, close).join("\n"), lines.slice(close + 1).join("\n")] as const
136
- }).pipe(Effect.catchCause((cause) => Effect.fail(sourceError(source, "Invalid SKILL.md document", cause))))
140
+ })
137
141
 
138
142
  const namespacedName = (path: Path.Path, relativeFile: string, explicitName: string | undefined): string => {
139
143
  const directory = path.dirname(relativeFile)