@@ -6,10 +6,10 @@ export type CliCommandPluginLoadPolicy =
66 | "always"
77 | "text-only"
88 | ( ( ctx : { argv : string [ ] ; commandPath : string [ ] ; jsonOutputMode : boolean } ) => boolean ) ;
9- type CliRouteConfigGuardPolicy = "never " | "always " | "when-suppressed" ;
10- type CliConfigGuardBypassPolicy =
11- | boolean
12- | ( ( ctx : { argv : string [ ] ; commandPath : string [ ] } ) => boolean ) ;
9+ type CliConfigGuardMode = "run " | "skip " | "when-suppressed" ;
10+ type CliConfigGuardPolicy =
11+ | CliConfigGuardMode
12+ | ( ( ctx : { argv : string [ ] ; commandPath : string [ ] } ) => CliConfigGuardMode ) ;
1313export type CliPluginRegistryScope = "all" | "channels" | "configured-channels" ;
1414export type CliPluginRegistryPolicy = {
1515 scope : CliPluginRegistryScope ;
@@ -36,8 +36,7 @@ type CliRoutedCommandId =
3636 | "plugins-list" ;
3737
3838export type CliCommandPathPolicy = {
39- bypassConfigGuard : CliConfigGuardBypassPolicy ;
40- routeConfigGuard : CliRouteConfigGuardPolicy ;
39+ configGuard : CliConfigGuardPolicy ;
4140 loadPlugins : CliCommandPluginLoadPolicy ;
4241 pluginRegistry : CliPluginRegistryPolicy ;
4342 ownsProtocolStdout : boolean ;
@@ -72,22 +71,22 @@ function hasCliOption(argv: readonly string[], name: string): boolean {
7271export const cliCommandCatalog : readonly CliCommandCatalogEntry [ ] = [
7372 {
7473 commandPath : [ "setup" ] ,
75- policy : { bypassConfigGuard : true , loadPlugins : "never" , ensureCliPath : false } ,
74+ policy : { configGuard : "skip" , loadPlugins : "never" , ensureCliPath : false } ,
7675 } ,
7776 {
7877 commandPath : [ "qa" ] ,
7978 // Private QA commands create or inspect repo-owned fixtures. They must not
8079 // read, validate, migrate, or inherit proxy policy from operator state.
81- policy : { bypassConfigGuard : true , loadPlugins : "never" , networkProxy : "bypass" } ,
80+ policy : { configGuard : "skip" , loadPlugins : "never" , networkProxy : "bypass" } ,
8281 } ,
8382 {
8483 commandPath : [ "crestodian" ] , // hidden alias
85- policy : { bypassConfigGuard : true , loadPlugins : "never" , ensureCliPath : false } ,
84+ policy : { configGuard : "skip" , loadPlugins : "never" , ensureCliPath : false } ,
8685 } ,
8786 {
8887 commandPath : [ "agent" ] ,
8988 policy : {
90- bypassConfigGuard : ( { argv } ) => ! hasFlag ( argv , "--local" ) ,
89+ configGuard : ( { argv } ) => ( hasFlag ( argv , "--local" ) ? "run" : "skip ") ,
9190 loadPlugins : ( { argv } ) => hasFlag ( argv , "--local" ) ,
9291 pluginRegistry : { scope : "all" } ,
9392 networkProxy : ( { argv } ) => ( hasFlag ( argv , "--local" ) ? "default" : "bypass" ) ,
@@ -96,15 +95,15 @@ export const cliCommandCatalog: readonly CliCommandCatalogEntry[] = [
9695 {
9796 commandPath : [ "agent" , "exec" ] ,
9897 policy : {
99- bypassConfigGuard : true ,
98+ configGuard : "skip" ,
10099 loadPlugins : "never" ,
101100 ownsProtocolStdout : true ,
102101 hideBanner : true ,
103102 networkProxy : "default" ,
104103 } ,
105104 } ,
106105 { commandPath : [ "message" ] , policy : { loadPlugins : "never" } } ,
107- { commandPath : [ "docs" ] , policy : { bypassConfigGuard : true } } ,
106+ { commandPath : [ "docs" ] , policy : { configGuard : "skip" } } ,
108107 {
109108 commandPath : [ "channels" ] ,
110109 policy : {
@@ -117,7 +116,7 @@ export const cliCommandCatalog: readonly CliCommandCatalogEntry[] = [
117116 {
118117 commandPath : [ "agents" ] ,
119118 exact : true ,
120- policy : { loadPlugins : "never" , networkProxy : "bypass" } ,
119+ policy : { configGuard : "skip" , loadPlugins : "never" , networkProxy : "bypass" } ,
121120 route : { id : "agents-list" } ,
122121 } ,
123122 {
@@ -145,24 +144,25 @@ export const cliCommandCatalog: readonly CliCommandCatalogEntry[] = [
145144 exact : true ,
146145 policy : { loadPlugins : "never" } ,
147146 } ,
148- { commandPath : [ "configure" ] , policy : { bypassConfigGuard : true , loadPlugins : "never" } } ,
147+ { commandPath : [ "configure" ] , policy : { configGuard : "skip" , loadPlugins : "never" } } ,
149148 {
150149 commandPath : [ "config" ] ,
151150 exact : true ,
152- policy : { bypassConfigGuard : true , loadPlugins : "never" , networkProxy : "bypass" } ,
151+ policy : { configGuard : "skip" , loadPlugins : "never" , networkProxy : "bypass" } ,
153152 } ,
154153 {
155154 commandPath : [ "config" , "models" ] ,
156155 exact : true ,
157- policy : { bypassConfigGuard : true , loadPlugins : "never" , networkProxy : "bypass" } ,
156+ policy : { configGuard : "skip" , loadPlugins : "never" , networkProxy : "bypass" } ,
158157 } ,
159158 {
160159 commandPath : [ "migrate" ] ,
161- policy : { bypassConfigGuard : true , loadPlugins : "never" , networkProxy : "bypass" } ,
160+ policy : { configGuard : "skip" , loadPlugins : "never" , networkProxy : "bypass" } ,
162161 } ,
163162 {
164163 commandPath : [ "status" ] ,
165164 policy : {
165+ configGuard : "skip" ,
166166 loadPlugins : "never" ,
167167 pluginRegistry : { scope : "channels" } ,
168168 ensureCliPath : false ,
@@ -173,6 +173,7 @@ export const cliCommandCatalog: readonly CliCommandCatalogEntry[] = [
173173 {
174174 commandPath : [ "health" ] ,
175175 policy : {
176+ configGuard : "skip" ,
176177 loadPlugins : "never" ,
177178 pluginRegistry : { scope : "channels" } ,
178179 ensureCliPath : false ,
@@ -191,7 +192,7 @@ export const cliCommandCatalog: readonly CliCommandCatalogEntry[] = [
191192 commandPath : [ "gateway" , "status" ] ,
192193 exact : true ,
193194 policy : {
194- routeConfigGuard : "always " ,
195+ configGuard : "skip " ,
195196 loadPlugins : "never" ,
196197 networkProxy : "bypass" ,
197198 } ,
@@ -206,7 +207,7 @@ export const cliCommandCatalog: readonly CliCommandCatalogEntry[] = [
206207 exact : true ,
207208 // The routed JSON command owns its config read; running the startup guard first
208209 // duplicates config/state initialization before the health socket can open.
209- policy : { routeConfigGuard : "always " , networkProxy : "bypass" } ,
210+ policy : { configGuard : "skip " , networkProxy : "bypass" } ,
210211 route : { id : "gateway-health" } ,
211212 } ,
212213 { commandPath : [ "gateway" , "install" ] , exact : true , policy : { networkProxy : "bypass" } } ,
@@ -220,7 +221,12 @@ export const cliCommandCatalog: readonly CliCommandCatalogEntry[] = [
220221 {
221222 commandPath : [ "sessions" ] ,
222223 exact : true ,
223- policy : { ensureCliPath : false , ownsProtocolStdout : true , networkProxy : "bypass" } ,
224+ policy : {
225+ configGuard : "skip" ,
226+ ensureCliPath : false ,
227+ ownsProtocolStdout : true ,
228+ networkProxy : "bypass" ,
229+ } ,
224230 route : { id : "sessions" } ,
225231 } ,
226232 {
@@ -235,15 +241,15 @@ export const cliCommandCatalog: readonly CliCommandCatalogEntry[] = [
235241 commandPath : [ "agents" , "list" ] ,
236242 // Text and JSON output are derived from config plus read-only channel
237243 // metadata, so the route should not preload bundled plugin runtimes.
238- policy : { loadPlugins : "never" , networkProxy : "bypass" } ,
244+ policy : { configGuard : "skip" , loadPlugins : "never" , networkProxy : "bypass" } ,
239245 route : { id : "agents-list" } ,
240246 } ,
241247 {
242248 commandPath : [ "config" , "file" ] ,
243249 exact : true ,
244250 // A path query must work before config validation and must not initialize state.
245251 policy : {
246- bypassConfigGuard : true ,
252+ configGuard : "skip" ,
247253 ensureCliPath : false ,
248254 loadPlugins : "never" ,
249255 ownsProtocolStdout : true ,
@@ -254,8 +260,7 @@ export const cliCommandCatalog: readonly CliCommandCatalogEntry[] = [
254260 commandPath : [ "config" , "get" ] ,
255261 exact : true ,
256262 policy : {
257- bypassConfigGuard : true ,
258- routeConfigGuard : "always" ,
263+ configGuard : "skip" ,
259264 ensureCliPath : false ,
260265 networkProxy : "bypass" ,
261266 } ,
@@ -264,21 +269,21 @@ export const cliCommandCatalog: readonly CliCommandCatalogEntry[] = [
264269 {
265270 commandPath : [ "config" , "unset" ] ,
266271 exact : true ,
267- policy : { ensureCliPath : false , networkProxy : "bypass" } ,
272+ policy : { configGuard : "run" , ensureCliPath : false , networkProxy : "bypass" } ,
268273 route : { id : "config-unset" } ,
269274 } ,
270275 {
271276 commandPath : [ "models" , "list" ] ,
272277 exact : true ,
273- policy : { ensureCliPath : false , routeConfigGuard : "always" , networkProxy : "bypass" } ,
278+ policy : { configGuard : "skip" , ensureCliPath : false , networkProxy : "bypass" } ,
274279 route : { id : "models-list" } ,
275280 } ,
276281 {
277282 commandPath : [ "models" , "status" ] ,
278283 exact : true ,
279284 policy : {
280285 ensureCliPath : false ,
281- routeConfigGuard : "always " ,
286+ configGuard : "skip " ,
282287 networkProxy : ( { argv } ) => ( hasFlag ( argv , "--probe" ) ? "default" : "bypass" ) ,
283288 } ,
284289 route : { id : "models-status" } ,
@@ -287,6 +292,7 @@ export const cliCommandCatalog: readonly CliCommandCatalogEntry[] = [
287292 commandPath : [ "tasks" , "list" ] ,
288293 exact : true ,
289294 policy : {
295+ configGuard : "skip" ,
290296 ensureCliPath : false ,
291297 loadPlugins : "never" ,
292298 networkProxy : "bypass" ,
@@ -297,6 +303,7 @@ export const cliCommandCatalog: readonly CliCommandCatalogEntry[] = [
297303 commandPath : [ "tasks" , "audit" ] ,
298304 exact : true ,
299305 policy : {
306+ configGuard : "skip" ,
300307 ensureCliPath : false ,
301308 loadPlugins : "never" ,
302309 networkProxy : "bypass" ,
@@ -306,6 +313,7 @@ export const cliCommandCatalog: readonly CliCommandCatalogEntry[] = [
306313 {
307314 commandPath : [ "tasks" ] ,
308315 policy : {
316+ configGuard : "skip" ,
309317 ensureCliPath : false ,
310318 loadPlugins : "never" ,
311319 networkProxy : "bypass" ,
@@ -328,11 +336,14 @@ export const cliCommandCatalog: readonly CliCommandCatalogEntry[] = [
328336 } ,
329337 { commandPath : [ "approvals" ] , policy : { networkProxy : "bypass" } } ,
330338 // automations is a commander alias for cron; argv-derived command paths keep the typed token.
331- { commandPath : [ "automations" ] , policy : { networkProxy : "bypass" } } ,
332- { commandPath : [ "backup" ] , policy : { bypassConfigGuard : true , networkProxy : "bypass" } } ,
339+ {
340+ commandPath : [ "automations" ] ,
341+ policy : { configGuard : "skip" , networkProxy : "bypass" } ,
342+ } ,
343+ { commandPath : [ "backup" ] , policy : { configGuard : "skip" , networkProxy : "bypass" } } ,
333344 { commandPath : [ "chat" ] , policy : { networkProxy : "bypass" } } ,
334345 { commandPath : [ "config" ] , policy : { networkProxy : "bypass" } } ,
335- { commandPath : [ "cron" ] , policy : { networkProxy : "bypass" } } ,
346+ { commandPath : [ "cron" ] , policy : { configGuard : "skip" , networkProxy : "bypass" } } ,
336347 { commandPath : [ "dashboard" ] , policy : { networkProxy : "bypass" } } ,
337348 { commandPath : [ "daemon" ] , policy : { networkProxy : "bypass" } } ,
338349 { commandPath : [ "devices" ] , policy : { networkProxy : "bypass" } } ,
@@ -347,7 +358,7 @@ export const cliCommandCatalog: readonly CliCommandCatalogEntry[] = [
347358 {
348359 commandPath : [ "doctor" ] ,
349360 policy : {
350- bypassConfigGuard : true ,
361+ configGuard : "skip" ,
351362 loadPlugins : "never" ,
352363 // Shared-state maintenance must acquire exclusive ownership before any
353364 // config-health observation can open the canonical SQLite database.
@@ -387,7 +398,7 @@ export const cliCommandCatalog: readonly CliCommandCatalogEntry[] = [
387398 commandPath : [ "worker" ] ,
388399 exact : true ,
389400 policy : {
390- bypassConfigGuard : true ,
401+ configGuard : "skip" ,
391402 hideBanner : true ,
392403 loadPlugins : "never" ,
393404 ownsProtocolStdout : true ,
@@ -402,12 +413,12 @@ export const cliCommandCatalog: readonly CliCommandCatalogEntry[] = [
402413 {
403414 commandPath : [ "completion" ] ,
404415 policy : {
405- bypassConfigGuard : true ,
416+ configGuard : "skip" ,
406417 hideBanner : true ,
407418 networkProxy : "bypass" ,
408419 } ,
409420 } ,
410- { commandPath : [ "secrets" ] , policy : { bypassConfigGuard : true , networkProxy : "bypass" } } ,
421+ { commandPath : [ "secrets" ] , policy : { configGuard : "skip" , networkProxy : "bypass" } } ,
411422 { commandPath : [ "security" ] , policy : { networkProxy : "bypass" } } ,
412423 { commandPath : [ "system" ] , policy : { networkProxy : "bypass" } } ,
413424 { commandPath : [ "terminal" ] , policy : { networkProxy : "bypass" } } ,
@@ -417,12 +428,12 @@ export const cliCommandCatalog: readonly CliCommandCatalogEntry[] = [
417428 {
418429 commandPath : [ "config" , "validate" ] ,
419430 exact : true ,
420- policy : { bypassConfigGuard : true , networkProxy : "bypass" } ,
431+ policy : { configGuard : "skip" , networkProxy : "bypass" } ,
421432 } ,
422433 {
423434 commandPath : [ "config" , "schema" ] ,
424435 exact : true ,
425- policy : { bypassConfigGuard : true , ownsProtocolStdout : true , networkProxy : "bypass" } ,
436+ policy : { configGuard : "skip" , ownsProtocolStdout : true , networkProxy : "bypass" } ,
426437 } ,
427438 {
428439 commandPath : [ "plugins" , "update" ] ,
@@ -432,7 +443,12 @@ export const cliCommandCatalog: readonly CliCommandCatalogEntry[] = [
432443 {
433444 commandPath : [ "plugins" , "list" ] ,
434445 exact : true ,
435- policy : { ensureCliPath : false , loadPlugins : "never" , networkProxy : "bypass" } ,
446+ policy : {
447+ configGuard : "skip" ,
448+ ensureCliPath : false ,
449+ loadPlugins : "never" ,
450+ networkProxy : "bypass" ,
451+ } ,
436452 route : { id : "plugins-list" } ,
437453 } ,
438454 {
@@ -443,17 +459,17 @@ export const cliCommandCatalog: readonly CliCommandCatalogEntry[] = [
443459 {
444460 commandPath : [ "onboard" , "recommendations" ] ,
445461 exact : true ,
446- policy : { bypassConfigGuard : true , loadPlugins : "never" , networkProxy : "bypass" } ,
462+ policy : { configGuard : "skip" , loadPlugins : "never" , networkProxy : "bypass" } ,
447463 } ,
448464 {
449465 commandPath : [ "onboard" , "recommendations" , "acknowledge" ] ,
450466 exact : true ,
451- policy : { bypassConfigGuard : true , loadPlugins : "never" , networkProxy : "bypass" } ,
467+ policy : { configGuard : "skip" , loadPlugins : "never" , networkProxy : "bypass" } ,
452468 } ,
453469 {
454470 commandPath : [ "onboard" , "recommendations" , "refresh" ] ,
455471 exact : true ,
456- policy : { bypassConfigGuard : true , loadPlugins : "never" , networkProxy : "bypass" } ,
472+ policy : { configGuard : "skip" , loadPlugins : "never" , networkProxy : "bypass" } ,
457473 } ,
458474 {
459475 commandPath : [ "channels" , "add" ] ,
@@ -485,8 +501,7 @@ export const cliCommandCatalog: readonly CliCommandCatalogEntry[] = [
485501 commandPath : [ "channels" , "status" ] ,
486502 exact : true ,
487503 policy : {
488- bypassConfigGuard : true ,
489- routeConfigGuard : "always" ,
504+ configGuard : "skip" ,
490505 loadPlugins : "never" ,
491506 networkProxy : ( { argv } ) => ( hasFlag ( argv , "--probe" ) ? "default" : "bypass" ) ,
492507 } ,
@@ -495,7 +510,7 @@ export const cliCommandCatalog: readonly CliCommandCatalogEntry[] = [
495510 {
496511 commandPath : [ "channels" , "list" ] ,
497512 exact : true ,
498- policy : { loadPlugins : "never" , networkProxy : "bypass" } ,
513+ policy : { configGuard : "skip" , loadPlugins : "never" , networkProxy : "bypass" } ,
499514 route : { id : "channels-list" } ,
500515 } ,
501516 { commandPath : [ "skills" ] , exact : true , policy : { networkProxy : "bypass" } } ,
0 commit comments