chore: generate
This commit is contained in:
@@ -22,7 +22,9 @@ export const Plugin = PluginV2.define({
|
||||
const documents = yield* Effect.forEach(yield* config.entries(), (entry) => {
|
||||
if (entry.type === "document") return Effect.succeed([{ commands: entry.info.commands }])
|
||||
return loadDirectory(fs, entry.path).pipe(
|
||||
Effect.map((commands) => [{ commands: Object.fromEntries(commands.map((command) => [command.name, command.info])) }]),
|
||||
Effect.map((commands) => [
|
||||
{ commands: Object.fromEntries(commands.map((command) => [command.name, command.info])) },
|
||||
]),
|
||||
)
|
||||
}).pipe(Effect.map((documents) => documents.flat()))
|
||||
|
||||
|
||||
@@ -23,8 +23,12 @@ export const Plugin = PluginV2.define({
|
||||
|
||||
yield* transform((editor) => {
|
||||
for (const directory of directories) {
|
||||
editor.source(new SkillV2.DirectorySource({ type: "directory", path: AbsolutePath.make(path.join(directory, "skill")) }))
|
||||
editor.source(new SkillV2.DirectorySource({ type: "directory", path: AbsolutePath.make(path.join(directory, "skills")) }))
|
||||
editor.source(
|
||||
new SkillV2.DirectorySource({ type: "directory", path: AbsolutePath.make(path.join(directory, "skill")) }),
|
||||
)
|
||||
editor.source(
|
||||
new SkillV2.DirectorySource({ type: "directory", path: AbsolutePath.make(path.join(directory, "skills")) }),
|
||||
)
|
||||
}
|
||||
for (const item of items) {
|
||||
if (URL.canParse(item) && /^(https?:)$/.test(new URL(item).protocol)) {
|
||||
|
||||
@@ -10,7 +10,9 @@ export const Plugin = PluginV2.define({
|
||||
effect: Effect.gen(function* () {
|
||||
const skill = yield* SkillV2.Service
|
||||
const transform = yield* skill.transform()
|
||||
const content = yield* Effect.promise(() => Bun.file(new URL("./skill/customize-opencode.md", import.meta.url)).text())
|
||||
const content = yield* Effect.promise(() =>
|
||||
Bun.file(new URL("./skill/customize-opencode.md", import.meta.url)).text(),
|
||||
)
|
||||
|
||||
yield* transform((editor) => {
|
||||
editor.source(
|
||||
|
||||
@@ -37,7 +37,11 @@ export const Source = Schema.Union([DirectorySource, UrlSource, EmbeddedSource])
|
||||
return false
|
||||
},
|
||||
key: (source: DirectorySource | UrlSource | EmbeddedSource) =>
|
||||
source.type === "directory" ? `directory:${source.path}` : source.type === "url" ? `url:${source.url}` : `embedded:${source.skill.name}`,
|
||||
source.type === "directory"
|
||||
? `directory:${source.path}`
|
||||
: source.type === "url"
|
||||
? `url:${source.url}`
|
||||
: `embedded:${source.skill.name}`,
|
||||
})),
|
||||
)
|
||||
export type Source = typeof Source.Type
|
||||
|
||||
@@ -12,10 +12,7 @@ const project = AbsolutePath.make("/repo")
|
||||
const it = testEffect(
|
||||
CommandV2.locationLayer.pipe(
|
||||
Layer.provide(
|
||||
Layer.succeed(
|
||||
Location.Service,
|
||||
Location.Service.of(location({ directory }, { projectDirectory: project })),
|
||||
),
|
||||
Layer.succeed(Location.Service, Location.Service.of(location({ directory }, { projectDirectory: project }))),
|
||||
),
|
||||
),
|
||||
)
|
||||
@@ -26,7 +23,10 @@ describe("CommandPlugin.Plugin", () => {
|
||||
const command = yield* CommandV2.Service
|
||||
yield* CommandPlugin.Plugin.effect.pipe(
|
||||
Effect.provideService(CommandV2.Service, command),
|
||||
Effect.provideService(Location.Service, Location.Service.of(location({ directory }, { projectDirectory: project }))),
|
||||
Effect.provideService(
|
||||
Location.Service,
|
||||
Location.Service.of(location({ directory }, { projectDirectory: project })),
|
||||
),
|
||||
)
|
||||
|
||||
expect(yield* command.get("init")).toMatchObject({
|
||||
|
||||
Reference in New Issue
Block a user