feat(core): add project reference guidance (#31601)
This commit is contained in:
parent
0fc33e2a06
commit
8a2cfc00c9
2 changed files with 753 additions and 165 deletions
|
|
@ -14,6 +14,7 @@ import { Plugin } from "../../src/plugin"
|
|||
import { Provider } from "../../src/provider/provider"
|
||||
import { Skill } from "../../src/skill"
|
||||
import { Truncate } from "../../src/tool/truncate"
|
||||
import { LocationServiceMap } from "@opencode-ai/core/location-layer"
|
||||
|
||||
const agentLayer = (flags: Partial<RuntimeFlags.Info> = {}) =>
|
||||
Agent.layer.pipe(
|
||||
|
|
@ -22,6 +23,7 @@ const agentLayer = (flags: Partial<RuntimeFlags.Info> = {}) =>
|
|||
Layer.provide(Auth.defaultLayer),
|
||||
Layer.provide(Config.defaultLayer),
|
||||
Layer.provide(Skill.defaultLayer),
|
||||
Layer.provide(LocationServiceMap.layer),
|
||||
Layer.provide(RuntimeFlags.layer(flags)),
|
||||
)
|
||||
|
||||
|
|
@ -119,7 +121,7 @@ it.instance(
|
|||
}),
|
||||
{
|
||||
config: {
|
||||
reference: {
|
||||
references: {
|
||||
effect: "github.com/effect/effect-smol",
|
||||
effectFull: {
|
||||
repository: "Effect-TS/effect",
|
||||
|
|
@ -601,6 +603,25 @@ description: Permission skill.
|
|||
{ git: true },
|
||||
)
|
||||
|
||||
it.instance(
|
||||
"project reference directories are allowed for external_directory",
|
||||
() =>
|
||||
Effect.gen(function* () {
|
||||
const test = yield* TestInstance
|
||||
const build = yield* load((svc) => svc.get("build"))
|
||||
const target = path.resolve(test.directory, "../docs/reference/notes.md")
|
||||
expect(Permission.evaluate("external_directory", target, build!.permission).action).toBe("allow")
|
||||
}),
|
||||
{
|
||||
git: true,
|
||||
config: {
|
||||
references: {
|
||||
docs: "../docs",
|
||||
},
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
it.instance("defaultAgent returns build when no default_agent config", () =>
|
||||
Effect.gen(function* () {
|
||||
const agent = yield* load((svc) => svc.defaultAgent())
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { expect } from "bun:test"
|
||||
import { FSUtil } from "@opencode-ai/core/fs-util"
|
||||
import { LocationServiceMap } from "@opencode-ai/core/location-layer"
|
||||
import { Effect, Layer } from "effect"
|
||||
import { FetchHttpClient } from "effect/unstable/http"
|
||||
import path from "path"
|
||||
|
|
@ -43,6 +44,7 @@ const agentLayer = Agent.layer.pipe(
|
|||
Layer.provide(SkillTest.empty),
|
||||
Layer.provide(provider.layer),
|
||||
Layer.provide(pluginLayer),
|
||||
Layer.provide(LocationServiceMap.layer),
|
||||
Layer.provide(RuntimeFlags.layer({ disableDefaultPlugins: true })),
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue