refactor(core): consolidate filesystem services (#30447)

This commit is contained in:
Dax
2026-06-02 16:09:26 -04:00
committed by GitHub
parent b93963e462
commit 604a5f781f
153 changed files with 2553 additions and 4312 deletions

View File

@@ -1,5 +1,5 @@
import { describe, expect, beforeAll, afterAll } from "bun:test"
import { AppFileSystem } from "@opencode-ai/core/filesystem"
import { FSUtil } from "@opencode-ai/core/fs-util"
import { Effect, Layer } from "effect"
import { Discovery } from "../../src/skill/discovery"
import { Global } from "@opencode-ai/core/global"
@@ -14,7 +14,7 @@ let downloadCount = 0
const fixturePath = path.join(import.meta.dir, "../fixture/skills")
const cacheDir = path.join(Global.Path.cache, "skills")
const it = testEffect(Layer.mergeAll(Discovery.defaultLayer, AppFileSystem.defaultLayer))
const it = testEffect(Layer.mergeAll(Discovery.defaultLayer, FSUtil.defaultLayer))
beforeAll(async () => {
await rm(cacheDir, { recursive: true, force: true })
@@ -52,7 +52,7 @@ afterAll(async () => {
describe("Discovery.pull", () => {
it.live("downloads skills from cloudflare url", () =>
Effect.gen(function* () {
const fsys = yield* AppFileSystem.Service
const fsys = yield* FSUtil.Service
const discovery = yield* Discovery.Service
const dirs = yield* discovery.pull(CLOUDFLARE_SKILLS_URL)
expect(dirs.length).toBeGreaterThan(0)
@@ -66,7 +66,7 @@ describe("Discovery.pull", () => {
it.live("url without trailing slash works", () =>
Effect.gen(function* () {
const fsys = yield* AppFileSystem.Service
const fsys = yield* FSUtil.Service
const discovery = yield* Discovery.Service
const dirs = yield* discovery.pull(CLOUDFLARE_SKILLS_URL.replace(/\/$/, ""))
expect(dirs.length).toBeGreaterThan(0)
@@ -96,7 +96,7 @@ describe("Discovery.pull", () => {
it.live("downloads reference files alongside SKILL.md", () =>
Effect.gen(function* () {
const fsys = yield* AppFileSystem.Service
const fsys = yield* FSUtil.Service
const discovery = yield* Discovery.Service
const dirs = yield* discovery.pull(CLOUDFLARE_SKILLS_URL)
// find a skill dir that should have reference files (e.g. agents-sdk)

View File

@@ -6,7 +6,7 @@ import { RuntimeFlags } from "../../src/effect/runtime-flags"
import { EventV2Bridge } from "../../src/event-v2-bridge"
import { Config } from "../../src/config/config"
import { CrossSpawnSpawner } from "@opencode-ai/core/cross-spawn-spawner"
import { AppFileSystem } from "@opencode-ai/core/filesystem"
import { FSUtil } from "@opencode-ai/core/fs-util"
import { Global } from "@opencode-ai/core/global"
import { provideInstance, provideTmpdirInstance, testInstanceStoreLayer, tmpdir } from "../fixture/fixture"
import { testEffect } from "../lib/effect"
@@ -22,7 +22,7 @@ const itWithoutClaudeCodeSkills = testEffect(
Layer.provide(Discovery.defaultLayer),
Layer.provide(Config.defaultLayer),
Layer.provide(EventV2Bridge.defaultLayer),
Layer.provide(AppFileSystem.defaultLayer),
Layer.provide(FSUtil.defaultLayer),
Layer.provide(Global.layer),
Layer.provide(RuntimeFlags.layer({ disableClaudeCodeSkills: true })),
),
@@ -36,7 +36,7 @@ const itWithoutExternalSkills = testEffect(
Layer.provide(Discovery.defaultLayer),
Layer.provide(Config.defaultLayer),
Layer.provide(EventV2Bridge.defaultLayer),
Layer.provide(AppFileSystem.defaultLayer),
Layer.provide(FSUtil.defaultLayer),
Layer.provide(Global.layer),
Layer.provide(RuntimeFlags.layer({ disableExternalSkills: true })),
),