@@ -51,10 +51,11 @@ export async function capsule({
5151 type : CapsulePropertyTypes . Function ,
5252 value : async function ( this : any ) : Promise < string > {
5353 const { stat, mkdir } = await import ( 'fs/promises' )
54+ const { join } = await import ( 'path' )
5455 const chalk = ( await import ( 'chalk' ) ) . default
5556
5657 const config = await this . $HomeRegistryConfig . config
57- const defaultDir = await this . Home . registryDir
58+ const defaultHomeDir = await this . Home . homeDir
5859
5960 let chosenDir : string
6061
@@ -73,15 +74,15 @@ export async function capsule({
7374 }
7475 chosenDir = config . rootDir
7576 } else {
76- // rootDir not set — prompt user
77- console . log ( chalk . cyan ( `\n🏠 Home Registry Setup\n` ) )
78- console . log ( chalk . gray ( ' The home registry is the place in your home directory that keeps ' ) )
79- console . log ( chalk . gray ( ' details about your workspaces and projects .' ) )
77+ // rootDir not set — prompt user for home directory
78+ console . log ( chalk . cyan ( `\n🏠 Home Directory Setup\n` ) )
79+ console . log ( chalk . gray ( ' The home directory is where your workspace keeps its registry, ' ) )
80+ console . log ( chalk . gray ( ' SSH keys, and other workspace-related files .' ) )
8081 console . log ( '' )
8182
82- chosenDir = await this . WorkspacePrompt . input ( {
83- message : 'Enter the home registry directory:' ,
84- defaultValue : defaultDir ,
83+ const chosenHomeDir = await this . WorkspacePrompt . input ( {
84+ message : 'Enter the home directory:' ,
85+ defaultValue : defaultHomeDir ,
8586 validate : ( input : string ) => {
8687 if ( ! input || input . trim ( ) . length === 0 ) {
8788 return 'Directory path cannot be empty'
@@ -90,18 +91,18 @@ export async function capsule({
9091 }
9192 } )
9293
93- // Check if directory exists
94- let dirExists = false
94+ // Check if home directory exists
95+ let homeDirExists = false
9596 try {
96- const s = await stat ( chosenDir )
97- dirExists = s . isDirectory ( )
97+ const s = await stat ( chosenHomeDir )
98+ homeDirExists = s . isDirectory ( )
9899 } catch {
99100 // Does not exist
100101 }
101102
102- if ( dirExists ) {
103+ if ( homeDirExists ) {
103104 const confirmed = await this . WorkspacePrompt . confirm ( {
104- message : `Directory '${ chosenDir } ' already exists. Use this existing registry as the home registry for your workspace?` ,
105+ message : `Directory '${ chosenHomeDir } ' already exists. Use it as the home directory for your workspace?` ,
105106 defaultValue : true
106107 } )
107108
@@ -110,11 +111,16 @@ export async function capsule({
110111 process . exit ( 0 )
111112 }
112113 } else {
113- // Create the directory
114- await mkdir ( chosenDir , { recursive : true } )
115- console . log ( chalk . green ( `\n ✓ Created home registry directory: ${ chosenDir } \n` ) )
114+ // Create the home directory
115+ await mkdir ( chosenHomeDir , { recursive : true } )
116+ console . log ( chalk . green ( `\n ✓ Created home directory: ${ chosenHomeDir } \n` ) )
116117 }
117118
119+ // Derive registry dir from home dir
120+ chosenDir = join ( chosenHomeDir , '.o/workspace.foundation' )
121+ await mkdir ( chosenDir , { recursive : true } )
122+
123+ await this . $HomeRegistryConfig . setConfigValue ( [ 'homeDir' ] , chosenHomeDir )
118124 await this . $HomeRegistryConfig . setConfigValue ( [ 'rootDir' ] , chosenDir )
119125 }
120126
0 commit comments