@@ -8,7 +8,11 @@ const path = require('path')
88const { spawnSync } = require ( 'child_process' )
99const { buildDeploymentDescriptors } = require ( './lib/deployment-descriptors' )
1010const { buildCliHostUtils } = require ( './lib/cli-host-utils' )
11- const { mergeGrokPluginRegistration, removeGrokPluginRegistration } = require ( './lib/host-adapter-scope' )
11+ const {
12+ mergeGrokPluginRegistration,
13+ removeGrokPluginRegistration,
14+ syncGrokWorkspacePluginInstallation
15+ } = require ( './lib/host-adapter-scope' )
1216const { buildGrokLaunchPlan } = require ( './lib/grok-workspace-launcher' )
1317
1418const ROOT = path . resolve ( __dirname , '..' )
@@ -122,6 +126,28 @@ assert.throws(
122126 'an explicit user disable must fail closed without being overwritten'
123127)
124128
129+ const noCliWorkspace = path . join ( FIXTURE_ROOT , 'no-cli-workspace' )
130+ const noCliActiveRoot = path . join ( noCliWorkspace , '.devcodex' , 'workspace' )
131+ const noCliGrokHome = path . join ( FIXTURE_ROOT , 'no-cli-grok-home' )
132+ const noCliPlugin = path . join ( noCliWorkspace , '.grok' , 'devcodex' , 'plugins' , 'devcodex-workspace' )
133+ const noCliLegacy = path . join ( noCliWorkspace , '.grok' , 'plugins' , 'devcodex-workspace' )
134+ fs . mkdirSync ( noCliPlugin , { recursive : true } )
135+ fs . mkdirSync ( noCliLegacy , { recursive : true } )
136+ fs . mkdirSync ( noCliGrokHome , { recursive : true } )
137+ fs . writeFileSync ( path . join ( noCliPlugin , 'plugin.json' ) , '{"name":"devcodex-workspace"}\n' , 'utf8' )
138+ fs . writeFileSync ( path . join ( noCliLegacy , 'plugin.json' ) , '{"name":"devcodex-workspace-legacy"}\n' , 'utf8' )
139+ fs . writeFileSync ( path . join ( noCliGrokHome , 'config.toml' ) , '[plugins]\nenabled = ["project-owned"]\n' , 'utf8' )
140+ const noCliReceipt = syncGrokWorkspacePluginInstallation ( {
141+ pluginPath : noCliPlugin ,
142+ legacyPluginPaths : [ noCliLegacy ] ,
143+ activeRoot : noCliActiveRoot ,
144+ env : { ...process . env , GROK_HOME : noCliGrokHome , PATH : '' }
145+ } )
146+ assert . strictEqual ( noCliReceipt . status , 'unavailable' )
147+ assert . match ( fs . readFileSync ( path . join ( noCliGrokHome , 'config.toml' ) , 'utf8' ) , / e n a b l e d = \[ " p r o j e c t - o w n e d " , " d e v c o d e x - w o r k s p a c e " \] / )
148+ assert ( fs . existsSync ( noCliLegacy ) , 'no-CLI migration must retain the legacy source' )
149+ assert ( fs . existsSync ( path . join ( noCliActiveRoot , 'managed' , 'grok-plugin-migration.json' ) ) , 'no-CLI migration receipt must be recorded' )
150+
125151const hostUtils = buildCliHostUtils ( {
126152 fs,
127153 path,
0 commit comments