@danieljvdm/dev-kit 0.11.1 → 0.12.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 (75) hide show
  1. package/README.md +70 -76
  2. package/dev-kit.example.jsonc +0 -4
  3. package/package.json +10 -6
  4. package/schema/dev-kit.schema.json +1 -46
  5. package/skills/build-effect-apis/SKILL.md +77 -0
  6. package/skills/build-effect-apis/agents/openai.yaml +4 -0
  7. package/skills/build-effect-apis/references/cloudflare-workers.md +71 -0
  8. package/skills/build-effect-apis/references/effect-atom-client.md +161 -0
  9. package/skills/build-effect-apis/references/effect-atom-lifecycle.md +78 -0
  10. package/skills/build-effect-apis/references/effect-atom-testing.md +74 -0
  11. package/skills/build-effect-apis/references/runtime-assembly.md +56 -0
  12. package/skills/build-effect-apis/references/server-and-middleware.md +174 -0
  13. package/skills/build-effect-apis/references/shared-contracts.md +108 -0
  14. package/skills/build-effect-apis/references/tanstack-start.md +86 -0
  15. package/skills/build-effect-apis/references/verification.md +50 -0
  16. package/skills/dev-kit/SKILL.md +61 -49
  17. package/skills/effect-architecture-audit/SKILL.md +26 -0
  18. package/skills/effect-architecture-audit/agents/openai.yaml +4 -0
  19. package/skills/effect-architecture-audit/references/service-and-boundary-audit.md +150 -0
  20. package/skills/effect-ts/SKILL.md +21 -256
  21. package/skills/effect-ts/agents/openai.yaml +3 -3
  22. package/skills/testing/SKILL.md +5 -0
  23. package/src/catalog-manager.ts +16 -17
  24. package/src/catalog.ts +71 -16
  25. package/src/effect-source.ts +46 -24
  26. package/src/effect-tsgo.ts +49 -24
  27. package/src/gitignore.ts +5 -5
  28. package/src/index.ts +0 -6
  29. package/src/manifest.ts +0 -34
  30. package/src/node-symbolic-link.ts +2 -2
  31. package/src/oxfmt.js +5 -0
  32. package/src/oxfmt.ts +5 -0
  33. package/src/oxlint.js +10 -2
  34. package/src/oxlint.ts +10 -2
  35. package/src/package-skill-source.ts +51 -59
  36. package/src/path-digest.ts +7 -7
  37. package/src/project-package.ts +8 -7
  38. package/src/project-process-lock.ts +17 -12
  39. package/src/project-state.ts +1 -1
  40. package/src/skill-manager.ts +16 -14
  41. package/src/skill-selector.ts +12 -0
  42. package/src/sync.ts +170 -120
  43. package/src/tool-ignore-patterns.js +9 -0
  44. package/src/tool-ignore-patterns.ts +15 -0
  45. package/src/vendor.ts +67 -61
  46. package/src/vite-plus-dependency.ts +10 -11
  47. package/src/vite-plus-hooks.ts +24 -14
  48. package/src/vite-plus-quality.ts +21 -172
  49. package/src/vite-plus.js +81 -0
  50. package/src/vite-plus.ts +102 -0
  51. package/templates/AGENTS.md +1 -1
  52. package/templates/vite-plus/github-actions-check.yml +2 -4
  53. package/skills/effect-ts/UPSTREAM.md +0 -28
  54. package/skills/effect-ts/references/atom-cache-lifecycle.md +0 -72
  55. package/skills/effect-ts/references/atom-http-and-invalidation.md +0 -93
  56. package/skills/effect-ts/references/atom-tanstack-start.md +0 -69
  57. package/skills/effect-ts/references/atom-testing.md +0 -63
  58. package/skills/effect-ts/references/audit-services.md +0 -144
  59. package/skills/effect-ts/references/features.md +0 -525
  60. package/skills/effect-ts/references/guide-atom-data-fetching.md +0 -28
  61. package/skills/effect-ts/references/guide-cli.md +0 -107
  62. package/skills/effect-ts/references/guide-datetime.md +0 -72
  63. package/skills/effect-ts/references/guide-effect.md +0 -440
  64. package/skills/effect-ts/references/guide-error-handling.md +0 -565
  65. package/skills/effect-ts/references/guide-http-boundaries.md +0 -55
  66. package/skills/effect-ts/references/guide-layers.md +0 -989
  67. package/skills/effect-ts/references/guide-observability.md +0 -746
  68. package/skills/effect-ts/references/guide-retries.md +0 -434
  69. package/skills/effect-ts/references/guide-schedule.md +0 -343
  70. package/skills/effect-ts/references/guide-schema.md +0 -664
  71. package/skills/effect-ts/references/guide-sql.md +0 -536
  72. package/skills/effect-ts/references/guide-testing.md +0 -532
  73. package/skills/effect-ts/references/guide-type-safety-and-boundaries.md +0 -131
  74. package/skills/effect-ts/references/version-and-source.md +0 -86
  75. package/templates/vite-plus/vite.config.ts +0 -22
@@ -5,7 +5,7 @@ import { readDirectDependencyNames } from "./project-package.ts";
5
5
  import { isSkillName, parseSkillSelector } from "./skill-selector.ts";
6
6
  import { isTypeScriptPackageName } from "./typescript-package-name.ts";
7
7
 
8
- export class PackageSkillSourceError extends Schema.TaggedErrorClass<PackageSkillSourceError>()(
8
+ export class PackageSkillSourceError extends Schema.TaggedError<PackageSkillSourceError>()(
9
9
  "PackageSkillSourceError",
10
10
  { message: Schema.String },
11
11
  ) {}
@@ -121,26 +121,24 @@ const rejectNestedSymlinks = Effect.fn("rejectPackageSkillSymlinks")(function* (
121
121
 
122
122
  if (current === undefined) continue;
123
123
  if ((yield* observeSymbolicLink(current)).kind === "symlink") {
124
- return yield* new PackageSkillSourceError({
124
+ return yield* PackageSkillSourceError.make({
125
125
  message: `package skill contains a symlink: ${current}`,
126
126
  });
127
127
  }
128
- const info = yield* fs
129
- .stat(current)
130
- .pipe(
131
- Effect.mapError(
132
- () =>
133
- new PackageSkillSourceError({ message: `could not inspect package skill: ${current}` }),
134
- ),
135
- );
128
+ const info = yield* fs.stat(current).pipe(
129
+ Effect.mapError(() =>
130
+ PackageSkillSourceError.make({
131
+ message: `could not inspect package skill: ${current}`,
132
+ }),
133
+ ),
134
+ );
136
135
 
137
136
  if (info.type !== "Directory") continue;
138
137
  for (const entry of yield* fs
139
138
  .readDirectory(current)
140
139
  .pipe(
141
- Effect.mapError(
142
- () =>
143
- new PackageSkillSourceError({ message: `could not read package skill: ${current}` }),
140
+ Effect.mapError(() =>
141
+ PackageSkillSourceError.make({ message: `could not read package skill: ${current}` }),
144
142
  ),
145
143
  ))
146
144
  pending.push(path.join(current, entry));
@@ -163,80 +161,75 @@ const loadInstalledPackageSkills = Effect.fn("loadInstalledPackageSkills")(funct
163
161
  const path = yield* Path.Path;
164
162
  const packageLink = path.join(projectDir, "node_modules", ...packageName.split("/"));
165
163
  const packageRoot = yield* fs.realPath(packageLink).pipe(
166
- Effect.mapError(
167
- () =>
168
- new PackageSkillSourceError({
169
- message: `package skill package is not installed: ${packageName}`,
170
- }),
164
+ Effect.mapError(() =>
165
+ PackageSkillSourceError.make({
166
+ message: `package skill package is not installed: ${packageName}`,
167
+ }),
171
168
  ),
172
169
  );
173
170
  const packageInfo = yield* fs.stat(packageRoot).pipe(
174
- Effect.mapError(
175
- () =>
176
- new PackageSkillSourceError({
177
- message: `could not inspect package skill package: ${packageName}`,
178
- }),
171
+ Effect.mapError(() =>
172
+ PackageSkillSourceError.make({
173
+ message: `could not inspect package skill package: ${packageName}`,
174
+ }),
179
175
  ),
180
176
  );
181
177
 
182
178
  if (packageInfo.type !== "Directory")
183
- return yield* new PackageSkillSourceError({
179
+ return yield* PackageSkillSourceError.make({
184
180
  message: `package skill package is not a directory: ${packageName}`,
185
181
  });
186
182
  const metadata = yield* fs.readFileString(path.join(packageRoot, "package.json")).pipe(
187
183
  Effect.flatMap(Schema.decodeUnknownEffect(PackageMetadataSchema)),
188
- Effect.mapError(
189
- () =>
190
- new PackageSkillSourceError({
191
- message: `invalid package.json for package skill package: ${packageName}`,
192
- }),
184
+ Effect.mapError(() =>
185
+ PackageSkillSourceError.make({
186
+ message: `invalid package.json for package skill package: ${packageName}`,
187
+ }),
193
188
  ),
194
189
  );
195
190
 
196
191
  if (metadata.name !== packageName)
197
- return yield* new PackageSkillSourceError({
192
+ return yield* PackageSkillSourceError.make({
198
193
  message: `package.json name does not match package skill package: ${packageName}`,
199
194
  });
200
195
  if (!isSafePackageVersion(metadata.version))
201
- return yield* new PackageSkillSourceError({
196
+ return yield* PackageSkillSourceError.make({
202
197
  message: `package.json has an invalid version for package skill package: ${packageName}`,
203
198
  });
204
199
  if (!hasIntentDiscoveryMetadata(metadata))
205
- return yield* new PackageSkillSourceError({
200
+ return yield* PackageSkillSourceError.make({
206
201
  message: `package does not declare Intent-compatible discovery metadata: ${packageName}`,
207
202
  });
208
203
  const skillsPath = "skills";
209
204
  const skillsLink = path.join(packageLink, skillsPath);
210
205
 
211
206
  if ((yield* observeSymbolicLink(skillsLink)).kind === "symlink")
212
- return yield* new PackageSkillSourceError({
207
+ return yield* PackageSkillSourceError.make({
213
208
  message: `package skills path is a symlink: ${packageName}/${skillsPath}`,
214
209
  });
215
210
  const skillsRoot = yield* fs.realPath(skillsLink).pipe(
216
- Effect.mapError(
217
- () =>
218
- new PackageSkillSourceError({
219
- message: `package skill package has no skills directory: ${packageName}`,
220
- }),
211
+ Effect.mapError(() =>
212
+ PackageSkillSourceError.make({
213
+ message: `package skill package has no skills directory: ${packageName}`,
214
+ }),
221
215
  ),
222
216
  );
223
217
 
224
218
  if (!isContained(path, packageRoot, skillsRoot))
225
- return yield* new PackageSkillSourceError({
219
+ return yield* PackageSkillSourceError.make({
226
220
  message: `package skills path resolves outside package root: ${packageName}/${skillsPath}`,
227
221
  });
228
222
  const skillsInfo = yield* fs.stat(skillsRoot);
229
223
 
230
224
  if (skillsInfo.type !== "Directory")
231
- return yield* new PackageSkillSourceError({
225
+ return yield* PackageSkillSourceError.make({
232
226
  message: `package skills path is not a directory: ${packageName}/${skillsPath}`,
233
227
  });
234
228
  const names = (yield* fs.readDirectory(skillsRoot).pipe(
235
- Effect.mapError(
236
- () =>
237
- new PackageSkillSourceError({
238
- message: `package skill package has no readable skills directory: ${packageName}`,
239
- }),
229
+ Effect.mapError(() =>
230
+ PackageSkillSourceError.make({
231
+ message: `package skill package has no readable skills directory: ${packageName}`,
232
+ }),
240
233
  ),
241
234
  ))
242
235
  .filter(isSkillName)
@@ -259,21 +252,21 @@ const inspectPackageSkill = Effect.fn("inspectInstalledPackageSkill")(function*
259
252
  const path = yield* Path.Path;
260
253
 
261
254
  if (!isSkillName(name)) {
262
- return yield* new PackageSkillSourceError({ message: `invalid package skill name: ${name}` });
255
+ return yield* PackageSkillSourceError.make({ message: `invalid package skill name: ${name}` });
263
256
  }
264
257
  const selector = `${installed.package}#${name}`;
265
258
  const linkPath = path.join(installed.packageLink, "skills", name);
266
259
 
267
260
  if ((yield* observeSymbolicLink(linkPath)).kind === "symlink") {
268
- return yield* new PackageSkillSourceError({
261
+ return yield* PackageSkillSourceError.make({
269
262
  message: `package skill contains a symlink: ${selector}`,
270
263
  });
271
264
  }
272
265
  const skillRoot = yield* fs
273
266
  .realPath(linkPath)
274
267
  .pipe(
275
- Effect.mapError(
276
- () => new PackageSkillSourceError({ message: `package skill does not exist: ${selector}` }),
268
+ Effect.mapError(() =>
269
+ PackageSkillSourceError.make({ message: `package skill does not exist: ${selector}` }),
277
270
  ),
278
271
  );
279
272
 
@@ -281,29 +274,28 @@ const inspectPackageSkill = Effect.fn("inspectInstalledPackageSkill")(function*
281
274
  !isContained(path, installed.skillsRoot, skillRoot) ||
282
275
  (yield* fs.stat(skillRoot)).type !== "Directory"
283
276
  ) {
284
- return yield* new PackageSkillSourceError({
277
+ return yield* PackageSkillSourceError.make({
285
278
  message: `package skill is not a contained directory: ${selector}`,
286
279
  });
287
280
  }
288
281
  yield* rejectNestedSymlinks(skillRoot);
289
282
  const document = yield* fs.readFileString(path.join(skillRoot, "SKILL.md")).pipe(
290
- Effect.mapError(
291
- () =>
292
- new PackageSkillSourceError({
293
- message: `package skill is missing SKILL.md: ${selector}`,
294
- }),
283
+ Effect.mapError(() =>
284
+ PackageSkillSourceError.make({
285
+ message: `package skill is missing SKILL.md: ${selector}`,
286
+ }),
295
287
  ),
296
288
  );
297
289
 
298
290
  if (skillName(document) !== name) {
299
- return yield* new PackageSkillSourceError({
291
+ return yield* PackageSkillSourceError.make({
300
292
  message: `package skill SKILL.md name must match directory: ${selector}`,
301
293
  });
302
294
  }
303
295
  const description = skillDescription(document);
304
296
 
305
297
  if (description === undefined) {
306
- return yield* new PackageSkillSourceError({
298
+ return yield* PackageSkillSourceError.make({
307
299
  message: `package skill SKILL.md must declare a description: ${selector}`,
308
300
  });
309
301
  }
@@ -370,13 +362,13 @@ export const resolvePackageSkillSelector = Effect.fn("resolvePackageSkillSelecto
370
362
  const parsed = parseSkillSelector(selector);
371
363
 
372
364
  if (parsed?.type !== "package")
373
- return yield* new PackageSkillSourceError({
365
+ return yield* PackageSkillSourceError.make({
374
366
  message: `invalid package skill selector: ${selector}`,
375
367
  });
376
368
  const directDependencies = yield* readDirectDependencyNames(projectDir);
377
369
 
378
370
  if (!directDependencies.includes(parsed.package))
379
- return yield* new PackageSkillSourceError({
371
+ return yield* PackageSkillSourceError.make({
380
372
  message: `package skill package is not a direct dependency: ${parsed.package}`,
381
373
  });
382
374
 
@@ -9,7 +9,7 @@ export type ObservedPath =
9
9
  | { readonly kind: "missing" }
10
10
  | { readonly kind: "file" | "directory" | "symlink"; readonly digest: Digest };
11
11
 
12
- export class PathInspectionError extends Schema.TaggedErrorClass<PathInspectionError>()(
12
+ export class PathInspectionError extends Schema.TaggedError<PathInspectionError>()(
13
13
  "PathInspectionError",
14
14
  {
15
15
  path: Schema.String,
@@ -124,7 +124,7 @@ const digestFileSystemPath = Effect.fn("digestFileSystemPath")(function* (
124
124
  const child = yield* digestFileSystemPath(childPath, fileMode);
125
125
 
126
126
  if (child.kind === "missing") {
127
- return yield* new PathInspectionError({
127
+ return yield* PathInspectionError.make({
128
128
  path: childPath,
129
129
  operation: "inspect a stable directory tree",
130
130
  cause: "path disappeared during inspection",
@@ -136,7 +136,7 @@ const digestFileSystemPath = Effect.fn("digestFileSystemPath")(function* (
136
136
  return { kind: "directory", digest: yield* digestFrames(frames) };
137
137
  }
138
138
 
139
- return yield* new PathInspectionError({
139
+ return yield* PathInspectionError.make({
140
140
  path: absolutePath,
141
141
  operation: "inspect unsupported filesystem entry",
142
142
  cause: info.type,
@@ -146,9 +146,9 @@ const digestFileSystemPath = Effect.fn("digestFileSystemPath")(function* (
146
146
  export const observePath = Effect.fn("observeManagedPath")(function* (absolutePath: string) {
147
147
  return yield* digestFileSystemPath(absolutePath, canonicalFileMode).pipe(
148
148
  Effect.mapError((cause) =>
149
- cause instanceof PathInspectionError
149
+ Schema.is(PathInspectionError)(cause)
150
150
  ? cause
151
- : new PathInspectionError({ path: absolutePath, operation: "inspect", cause }),
151
+ : PathInspectionError.make({ path: absolutePath, operation: "inspect", cause }),
152
152
  ),
153
153
  );
154
154
  });
@@ -158,9 +158,9 @@ export const observePathWithRawModes = Effect.fn("observeManagedPathWithRawModes
158
158
  ) {
159
159
  return yield* digestFileSystemPath(absolutePath, rawFileMode).pipe(
160
160
  Effect.mapError((cause) =>
161
- cause instanceof PathInspectionError
161
+ Schema.is(PathInspectionError)(cause)
162
162
  ? cause
163
- : new PathInspectionError({ path: absolutePath, operation: "inspect", cause }),
163
+ : PathInspectionError.make({ path: absolutePath, operation: "inspect", cause }),
164
164
  ),
165
165
  );
166
166
  });
@@ -1,6 +1,6 @@
1
1
  import { Effect, FileSystem, Path, Schema } from "effect";
2
2
 
3
- export class ProjectPackageError extends Schema.TaggedErrorClass<ProjectPackageError>()(
3
+ export class ProjectPackageError extends Schema.TaggedError<ProjectPackageError>()(
4
4
  "ProjectPackageError",
5
5
  { message: Schema.String },
6
6
  ) {}
@@ -24,15 +24,16 @@ export const readProjectPackage = Effect.fn("readProjectPackage")(function* (pro
24
24
  const manifestPath = path.join(projectDir, "package.json");
25
25
 
26
26
  if (!(yield* fs.exists(manifestPath))) {
27
- return yield* new ProjectPackageError({ message: `package.json not found: ${manifestPath}` });
27
+ return yield* ProjectPackageError.make({
28
+ message: `package.json not found: ${manifestPath}`,
29
+ });
28
30
  }
29
31
  const manifest = yield* fs.readFileString(manifestPath).pipe(
30
32
  Effect.flatMap(Schema.decodeUnknownEffect(ProjectPackageSchema)),
31
- Effect.mapError(
32
- () =>
33
- new ProjectPackageError({
34
- message: `invalid project package.json: ${manifestPath}`,
35
- }),
33
+ Effect.mapError(() =>
34
+ ProjectPackageError.make({
35
+ message: `invalid project package.json: ${manifestPath}`,
36
+ }),
36
37
  ),
37
38
  );
38
39
 
@@ -4,7 +4,7 @@ import { DEV_KIT_VERSION } from "./tool-metadata.ts";
4
4
 
5
5
  export const PROJECT_PROCESS_LOCK_PATH = ".dev-kit/apply.lock";
6
6
 
7
- export class ProjectAlreadyLockedError extends Schema.TaggedErrorClass<ProjectAlreadyLockedError>()(
7
+ export class ProjectAlreadyLockedError extends Schema.TaggedError<ProjectAlreadyLockedError>()(
8
8
  "ProjectAlreadyLockedError",
9
9
  { path: Schema.String },
10
10
  ) {
@@ -13,6 +13,15 @@ export class ProjectAlreadyLockedError extends Schema.TaggedErrorClass<ProjectAl
13
13
  }
14
14
  }
15
15
 
16
+ const ProjectProcessLockOwnerSchema = Schema.fromJsonString(
17
+ Schema.Struct({
18
+ version: Schema.Literal(1),
19
+ toolVersion: Schema.String,
20
+ token: Schema.String,
21
+ startedAt: Schema.String,
22
+ }),
23
+ );
24
+
16
25
  export const acquireProjectProcessLock = Effect.fn("acquireProjectProcessLock")(function* (
17
26
  projectDir: string,
18
27
  ) {
@@ -24,16 +33,12 @@ export const acquireProjectProcessLock = Effect.fn("acquireProjectProcessLock")(
24
33
  const ownerPath = path.join(lockDir, "owner.json");
25
34
  const token = yield* crypto.randomUUIDv7;
26
35
  const startedAt = DateTime.formatIso(yield* DateTime.now);
27
- const ownerContents = `${JSON.stringify(
28
- {
29
- version: 1,
30
- toolVersion: DEV_KIT_VERSION,
31
- token,
32
- startedAt,
33
- },
34
- null,
35
- 2,
36
- )}\n`;
36
+ const ownerContents = `${yield* Schema.encodeEffect(ProjectProcessLockOwnerSchema)({
37
+ version: 1,
38
+ toolVersion: DEV_KIT_VERSION,
39
+ token,
40
+ startedAt,
41
+ }).pipe(Effect.orDie)}\n`;
37
42
 
38
43
  return yield* Effect.acquireRelease(
39
44
  Effect.gen(function* () {
@@ -46,7 +51,7 @@ export const acquireProjectProcessLock = Effect.fn("acquireProjectProcessLock")(
46
51
  .pipe(
47
52
  Effect.mapError((error) =>
48
53
  error.reason._tag === "AlreadyExists"
49
- ? new ProjectAlreadyLockedError({ path: lockDir })
54
+ ? ProjectAlreadyLockedError.make({ path: lockDir })
50
55
  : error,
51
56
  ),
52
57
  );
@@ -50,7 +50,7 @@ export const ManagedClaudeInstructionsOutputSchema = Schema.Struct({
50
50
  export type ManagedClaudeInstructionsOutput = typeof ManagedClaudeInstructionsOutputSchema.Type;
51
51
 
52
52
  export const ManagedGeneratedFileOutputSchema = Schema.Struct({
53
- resourceId: Schema.Literals(["setup:vite-plus-config", "setup:vite-plus-github-actions"]),
53
+ resourceId: Schema.Literal("setup:vite-plus-github-actions"),
54
54
  path: Schema.String,
55
55
  sourcePath: Schema.String,
56
56
  mode: Schema.Literal("copy"),
@@ -9,7 +9,7 @@ import { DevKitManifestSchema } from "./manifest.ts";
9
9
  import { observeSymbolicLink } from "./node-symbolic-link.ts";
10
10
  import { runProjectSkillPlan } from "./sync.ts";
11
11
 
12
- class SkillManagerError extends Schema.TaggedErrorClass<SkillManagerError>()("SkillManagerError", {
12
+ class SkillManagerError extends Schema.TaggedError<SkillManagerError>()("SkillManagerError", {
13
13
  message: Schema.String,
14
14
  }) {}
15
15
 
@@ -32,7 +32,7 @@ const resolvePaths = Effect.fn("resolveSkillManagerPaths")(function* (options: M
32
32
  const candidate = options.manifestPath ?? "dev-kit.jsonc";
33
33
 
34
34
  if (candidate.length === 0 || path.isAbsolute(candidate)) {
35
- return yield* new SkillManagerError({
35
+ return yield* SkillManagerError.make({
36
36
  message: "--manifest must be a non-empty project-relative path",
37
37
  });
38
38
  }
@@ -40,7 +40,7 @@ const resolvePaths = Effect.fn("resolveSkillManagerPaths")(function* (options: M
40
40
  const relative = path.relative(projectDir, manifestPath);
41
41
 
42
42
  if (relative === ".." || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative)) {
43
- return yield* new SkillManagerError({
43
+ return yield* SkillManagerError.make({
44
44
  message: "--manifest must resolve inside the project",
45
45
  });
46
46
  }
@@ -49,7 +49,7 @@ const resolvePaths = Effect.fn("resolveSkillManagerPaths")(function* (options: M
49
49
  for (const segment of relative.split(path.sep).slice(0, -1)) {
50
50
  ancestor = path.join(ancestor, segment);
51
51
  if ((yield* observeSymbolicLink(ancestor)).kind === "symlink") {
52
- return yield* new SkillManagerError({
52
+ return yield* SkillManagerError.make({
53
53
  message: `manifest ancestor is a symlink: ${path.relative(projectDir, ancestor)}`,
54
54
  });
55
55
  }
@@ -57,10 +57,12 @@ const resolvePaths = Effect.fn("resolveSkillManagerPaths")(function* (options: M
57
57
  const destination = yield* observeSymbolicLink(manifestPath);
58
58
 
59
59
  if (destination.kind === "symlink") {
60
- return yield* new SkillManagerError({ message: `manifest is a symlink: ${relative}` });
60
+ return yield* SkillManagerError.make({ message: `manifest is a symlink: ${relative}` });
61
61
  }
62
62
  if (destination.kind === "not-symlink" && (yield* fs.stat(manifestPath)).type !== "File") {
63
- return yield* new SkillManagerError({ message: `manifest is not a regular file: ${relative}` });
63
+ return yield* SkillManagerError.make({
64
+ message: `manifest is not a regular file: ${relative}`,
65
+ });
64
66
  }
65
67
 
66
68
  return {
@@ -128,7 +130,7 @@ const readManifest = Effect.fn("readManagedSkillManifest")(function* (
128
130
 
129
131
  if (!(yield* fs.exists(paths.manifestPath))) {
130
132
  if (!create) {
131
- return yield* new SkillManagerError({
133
+ return yield* SkillManagerError.make({
132
134
  message: "dev-kit.jsonc not found. Run `dev-kit init` first.",
133
135
  });
134
136
  }
@@ -139,10 +141,10 @@ const readManifest = Effect.fn("readManagedSkillManifest")(function* (
139
141
  const parsed = parseJsonc(raw, errors, { allowTrailingComma: true });
140
142
 
141
143
  if (errors.length > 0) {
142
- return yield* new SkillManagerError({ message: `could not parse ${paths.manifestPath}` });
144
+ return yield* SkillManagerError.make({ message: `could not parse ${paths.manifestPath}` });
143
145
  }
144
146
  const manifest = yield* Schema.decodeUnknownEffect(DevKitManifestSchema)(parsed).pipe(
145
- Effect.mapError((error) => new SkillManagerError({ message: error.message })),
147
+ Effect.mapError((error) => SkillManagerError.make({ message: error.message })),
146
148
  );
147
149
 
148
150
  return { ...paths, manifest, raw };
@@ -272,7 +274,7 @@ export const addSkills = Effect.fn("addManagedSkills")(function* (
272
274
  const unknown = names.filter((name) => !known.has(name));
273
275
 
274
276
  if (unknown.length > 0) {
275
- return yield* new SkillManagerError({
277
+ return yield* SkillManagerError.make({
276
278
  message: `unknown skill${unknown.length === 1 ? "" : "s"}: ${unknown.join(", ")}. Try \`dev-kit search ${unknown[0]}\`.`,
277
279
  });
278
280
  }
@@ -319,7 +321,7 @@ export const removeSkills = Effect.fn("removeManagedSkills")(function* (
319
321
  );
320
322
 
321
323
  if (absent.length > 0) {
322
- return yield* new SkillManagerError({ message: `not selected: ${absent.join(", ")}` });
324
+ return yield* SkillManagerError.make({ message: `not selected: ${absent.join(", ")}` });
323
325
  }
324
326
  const include = current.manifest.include.filter((name) => !names.includes(name));
325
327
  const excluded = new Set(current.manifest.exclude ?? []);
@@ -399,7 +401,7 @@ export const showSkill = Effect.fn("showCatalogSkill")(function* (
399
401
  const catalog = yield* loadSkillCatalog(yield* packageRoot(), paths.projectDir);
400
402
  const skill = catalog.skills.find((candidate) => candidate.selector === name);
401
403
 
402
- if (!skill) return yield* new SkillManagerError({ message: `unknown skill: ${name}` });
404
+ if (!skill) return yield* SkillManagerError.make({ message: `unknown skill: ${name}` });
403
405
  yield* printLine(skill.selector);
404
406
  if (skill.description) yield* printLine(displayValue(skill.description));
405
407
  if (skill.package) {
@@ -436,7 +438,7 @@ export const chooseSkillsToAdd = Effect.fn("chooseSkillsToAdd")(function* (
436
438
  options: ManagerOptions,
437
439
  ) {
438
440
  if (!(yield* isInteractiveTerminal)) {
439
- return yield* new SkillManagerError({
441
+ return yield* SkillManagerError.make({
440
442
  message: "pass one or more skill names, or run this command in a terminal",
441
443
  });
442
444
  }
@@ -471,7 +473,7 @@ export const chooseSkillsToRemove = Effect.fn("chooseSkillsToRemove")(function*
471
473
  options: ManagerOptions,
472
474
  ) {
473
475
  if (!(yield* isInteractiveTerminal)) {
474
- return yield* new SkillManagerError({
476
+ return yield* SkillManagerError.make({
475
477
  message: "pass one or more skill names, or run this command in a terminal",
476
478
  });
477
479
  }
@@ -28,6 +28,18 @@ export const SKILL_SELECTOR_PATTERN =
28
28
 
29
29
  export const isSkillName = (value: string): boolean => SKILL_NAME_PATTERN.test(value);
30
30
 
31
+ /**
32
+ * The package-qualified directory name for an installed package skill. The npm
33
+ * package name keeps its identity in the flattened output: `@` is dropped,
34
+ * every other non-alphanumeric run becomes one dash, and the bare skill name
35
+ * is appended. `@tanstack/table-core#core` installs as
36
+ * `tanstack-table-core-core`.
37
+ */
38
+ export const packageSkillInstallName = (packageName: string, skillName: string): string =>
39
+ `${packageName.replaceAll("@", "")}-${skillName}`
40
+ .replace(/[^a-z0-9]+/g, "-")
41
+ .replace(/^-+|-+$/g, "");
42
+
31
43
  /** Parse an exact, canonical manifest skill selector. */
32
44
  export const parseSkillSelector = (value: string): SkillSelector | undefined => {
33
45
  if (isSkillName(value)) return { type: "static", name: value };