diff --git a/packages/core/src/config.ts b/packages/core/src/config.ts index 7e55021005a..81fde962095 100644 --- a/packages/core/src/config.ts +++ b/packages/core/src/config.ts @@ -171,7 +171,11 @@ export const layer = Layer.effect( const discovered = locationIsGlobal ? [] : yield* fs - .up({ targets: [".opencode", ...names.toReversed()], start: location.directory, stop: location.project.directory }) + .up({ + targets: [".opencode", ...names.toReversed()], + start: location.directory, + stop: location.project.directory, + }) .pipe(Effect.orDie) const directories = [ globalDirectory, diff --git a/packages/core/src/config/plugin/agent.ts b/packages/core/src/config/plugin/agent.ts index cf10684faf4..4f3d2b97646 100644 --- a/packages/core/src/config/plugin/agent.ts +++ b/packages/core/src/config/plugin/agent.ts @@ -19,7 +19,19 @@ const legacySources = [ const decodeAgent = Schema.decodeUnknownOption(ConfigAgent.Info) const decodeLegacyAgent = Schema.decodeUnknownOption(ConfigAgentV1.Info) const decodeConfig = Schema.decodeUnknownOption(Config.Info) -const agentKeys = new Set(["model", "variant", "request", "system", "description", "mode", "hidden", "color", "steps", "disabled", "permissions"]) +const agentKeys = new Set([ + "model", + "variant", + "request", + "system", + "description", + "mode", + "hidden", + "color", + "steps", + "disabled", + "permissions", +]) export const Plugin = PluginV2.define({ id: PluginV2.ID.make("config-agent"), @@ -37,7 +49,9 @@ export const Plugin = PluginV2.define({ Effect.catch(() => Effect.succeed(undefined)), ), ).pipe( - Effect.map((documents) => documents.filter((document): document is Config.Document => document !== undefined)), + Effect.map((documents) => + documents.filter((document): document is Config.Document => document !== undefined), + ), ) }) }).pipe(Effect.map((documents) => documents.flat())) @@ -88,7 +102,9 @@ function discover(fs: FSUtil.Interface, directory: string) { return Effect.forEach(legacySources, (source) => fs .glob(source.pattern, { cwd: directory, absolute: true, dot: true, symlink: true }) - .pipe(Effect.map((files) => files.toSorted().map((filepath) => ({ directory, filepath, primary: source.primary })))), + .pipe( + Effect.map((files) => files.toSorted().map((filepath) => ({ directory, filepath, primary: source.primary }))), + ), ).pipe( Effect.map((files) => files.flat()), Effect.catch(() => Effect.succeed([])), diff --git a/packages/core/src/config/plugin/skill.ts b/packages/core/src/config/plugin/skill.ts index 315e08387d1..a6c1bccdecb 100644 --- a/packages/core/src/config/plugin/skill.ts +++ b/packages/core/src/config/plugin/skill.ts @@ -18,7 +18,7 @@ export const Plugin = PluginV2.define({ const skill = yield* SkillV2.Service const transform = yield* skill.transform() const entries = yield* config.entries() - const items = entries.flatMap((entry) => (entry.type === "document" ? entry.info.skills ?? [] : [])) + const items = entries.flatMap((entry) => (entry.type === "document" ? (entry.info.skills ?? []) : [])) yield* transform((editor) => { for (const item of items) { diff --git a/packages/core/src/skill.ts b/packages/core/src/skill.ts index de670ece1f2..d1a8c7d6b50 100644 --- a/packages/core/src/skill.ts +++ b/packages/core/src/skill.ts @@ -108,13 +108,15 @@ export const layer = Layer.effect( ? path.basename(filepath, ".md") : undefined if (!name) continue - skills.push(new Info({ - name, - description: frontmatter.description, - slash: frontmatter.slash, - location: AbsolutePath.make(filepath), - content: markdown.content, - })) + skills.push( + new Info({ + name, + description: frontmatter.description, + slash: frontmatter.slash, + location: AbsolutePath.make(filepath), + content: markdown.content, + }), + ) } } return skills diff --git a/packages/core/test/config/config.test.ts b/packages/core/test/config/config.test.ts index a4ec9312b7b..5b218dae521 100644 --- a/packages/core/test/config/config.test.ts +++ b/packages/core/test/config/config.test.ts @@ -110,7 +110,9 @@ describe("Config", () => { const config = yield* Config.Service const entries = yield* config.entries() - expect(entries).toEqual([new Config.Directory({ type: "directory", path: AbsolutePath.make(path.join(tmp.path, "global")) })]) + expect(entries).toEqual([ + new Config.Directory({ type: "directory", path: AbsolutePath.make(path.join(tmp.path, "global")) }), + ]) }).pipe(Effect.provide(testLayer(tmp.path))), ), ), @@ -157,11 +159,11 @@ describe("Config", () => { yield* Effect.promise(() => fs.writeFile(path.join(tmp.path, "opencode.jsonc"), JSON.stringify({ $schema: "changed" })), ) - expect((yield* config.entries()).filter((entry) => entry.type === "document").map((document) => document.info.$schema)).toEqual([ - "base", - "middle", - "last", - ]) + expect( + (yield* config.entries()) + .filter((entry) => entry.type === "document") + .map((document) => document.info.$schema), + ).toEqual(["base", "middle", "last"]) }).pipe(Effect.provide(testLayer(tmp.path))) }), ), diff --git a/packages/core/test/config/skill.test.ts b/packages/core/test/config/skill.test.ts index 2b63f9da1f3..a4841cb957d 100644 --- a/packages/core/test/config/skill.test.ts +++ b/packages/core/test/config/skill.test.ts @@ -57,11 +57,13 @@ describe("ConfigSkillPlugin.Plugin", () => { expect(sources).toEqual([ new SkillV2.DirectorySource({ type: "directory", path: AbsolutePath.make(path.join(directory, "skills")) }), - new SkillV2.DirectorySource({ type: "directory", path: AbsolutePath.make(path.join("/home/test", "shared-skills")) }), + new SkillV2.DirectorySource({ + type: "directory", + path: AbsolutePath.make(path.join("/home/test", "shared-skills")), + }), new SkillV2.DirectorySource({ type: "directory", path: AbsolutePath.make("/opt/skills") }), new SkillV2.UrlSource({ type: "url", url: "https://example.test/skills/" }), ]) }), ) - }) diff --git a/packages/core/test/project-reference.test.ts b/packages/core/test/project-reference.test.ts index e5962f8ac7d..a54ee31cf4d 100644 --- a/packages/core/test/project-reference.test.ts +++ b/packages/core/test/project-reference.test.ts @@ -254,10 +254,7 @@ function testLayer(input: { ), ), ), - Layer.succeed( - Config.Service, - Config.Service.of({ entries: () => Effect.succeed(input.documents) }), - ), + Layer.succeed(Config.Service, Config.Service.of({ entries: () => Effect.succeed(input.documents) })), Layer.succeed(RepositoryCache.Service, RepositoryCache.Service.of({ ensure: input.ensure })), ), ),