@@ -17,6 +17,7 @@ import { Filesystem } from "../../src/util/filesystem"
1717import { tmpdir } from "../fixture/fixture"
1818import { assertReplay , it , run } from "./harness"
1919import { replays } from "./replay"
20+ import TeamPlugin from "../../../guardrails/profile/plugins/team"
2021
2122const managed = process . env . OPENCODE_TEST_MANAGED_CONFIG_DIR !
2223const profile = path . resolve ( import . meta. dir , "../../../guardrails/profile" )
@@ -699,6 +700,85 @@ test("guardrail profile blocks write-capable background workers until team runs"
699700 } )
700701} )
701702
703+ test ( "project-specific bash allows beat profile wildcard asks" , async ( ) => {
704+ await withProfile ( async ( ) => {
705+ await using tmp = await tmpdir ( {
706+ git : true ,
707+ init : async ( dir ) => {
708+ await write ( dir , "opencode.json" , {
709+ $schema : "https://opencode.ai/config.json" ,
710+ permission : {
711+ bash : {
712+ "*" : "ask" ,
713+ "supabase *" : "allow" ,
714+ } ,
715+ } ,
716+ } )
717+ } ,
718+ } )
719+
720+ await Instance . provide ( {
721+ directory : tmp . path ,
722+ fn : async ( ) => {
723+ const agent = await Agent . get ( "build" )
724+ expect ( perm ( agent , "bash" , "supabase db query" ) ) . toBe ( "allow" )
725+ expect ( perm ( agent , "bash" , "unknown cmd" ) ) . toBe ( "ask" )
726+ } ,
727+ } )
728+ } )
729+ } )
730+
731+ test ( "team tool allows a single read-only task" , async ( ) => {
732+ await withProfile ( async ( ) => {
733+ await using tmp = await tmpdir ( { git : true , config : { share : "auto" } } )
734+
735+ const plugin = await TeamPlugin ( {
736+ client : {
737+ session : {
738+ create : async ( ) => ( { data : { id : "child" } } ) ,
739+ promptAsync : async ( ) => ( { } ) ,
740+ prompt : async ( ) => ( { } ) ,
741+ status : async ( ) => ( { data : { child : { type : "idle" } } } ) ,
742+ messages : async ( ) => ( {
743+ data : [ { info : { role : "assistant" } , parts : [ { type : "text" , text : "ok" } ] } ] ,
744+ } ) ,
745+ abort : async ( ) => ( { } ) ,
746+ } ,
747+ } ,
748+ worktree : tmp . path ,
749+ directory : tmp . path ,
750+ } )
751+
752+ const result = await plugin . tool . team . execute (
753+ {
754+ strategy : "parallel" ,
755+ limit : 1 ,
756+ tasks : [
757+ {
758+ id : "inspect" ,
759+ description : "inspect only" ,
760+ prompt : "Inspect src/index.ts and report findings without editing files." ,
761+ write : false ,
762+ worktree : false ,
763+ } ,
764+ ] ,
765+ } ,
766+ {
767+ sessionID : "session_team_single" ,
768+ messageID : "" ,
769+ agent : "build" ,
770+ directory : tmp . path ,
771+ worktree : tmp . path ,
772+ abort : AbortSignal . any ( [ ] ) ,
773+ metadata : ( ) => { } ,
774+ ask : async ( ) => { } ,
775+ } ,
776+ )
777+
778+ expect ( result ) . toContain ( "run_id:" )
779+ } )
780+ } )
781+
702782test ( "guardrail profile plugin records factcheck and review freshness state" , async ( ) => {
703783 await withProfile ( async ( ) => {
704784 await using tmp = await tmpdir ( {
0 commit comments