@@ -27,19 +27,19 @@ const log = createLogger('module-symlink');
2727 * Create a symlink to the .commando directory in node_modules/.commando-project/
2828 * Returns the path to import through the symlink
2929 */
30- export async function symlinkForgeDir ( forgeDir : string ) : Promise < string > {
31- log . debug ( { forgeDir } , 'Creating symlink for forge directory' ) ;
30+ export async function symlinkCommandoDir ( commandoDir : string ) : Promise < string > {
31+ log . debug ( { commandoDir } , 'Creating symlink for commando directory' ) ;
3232
33- // Generate hash from absolute forge dir path (16 chars = 64 bits)
34- const hash = createHash ( 'sha256' ) . update ( forgeDir ) . digest ( 'hex' ) . slice ( 0 , 16 ) ;
33+ // Generate hash from absolute commando dir path (16 chars = 64 bits)
34+ const hash = createHash ( 'sha256' ) . update ( commandoDir ) . digest ( 'hex' ) . slice ( 0 , 16 ) ;
3535
3636 // Bucket by first 2 chars to avoid flat directory (like git objects)
3737 const bucket = hash . slice ( 0 , 2 ) ;
3838 const hashSuffix = hash . slice ( 2 ) ;
3939
40- log . debug ( { forgeDir , hash, bucket, hashSuffix } , 'Computed symlink hash' ) ;
40+ log . debug ( { commandoDir , hash, bucket, hashSuffix } , 'Computed symlink hash' ) ;
4141
42- // Symlink location in forge -home node_modules
42+ // Symlink location in commando -home node_modules
4343 const nodeModules = getNodeModulesPath ( ) ;
4444 const symlinkDir = join ( nodeModules , '.commando-project' , bucket ) ;
4545 const symlinkPath = join ( symlinkDir , hashSuffix ) ;
@@ -61,14 +61,14 @@ export async function symlinkForgeDir(forgeDir: string): Promise<string> {
6161 const target = await readlink ( symlinkPath ) ;
6262 log . debug ( { symlinkPath, target } , 'Symlink exists, checking target' ) ;
6363
64- if ( target === forgeDir ) {
64+ if ( target === commandoDir ) {
6565 log . debug ( { symlinkPath, target } , 'Symlink already correct' ) ;
6666 return symlinkPath ;
6767 } else {
6868 log . warn ( {
6969 symlinkPath,
7070 currentTarget : target ,
71- expectedTarget : forgeDir
71+ expectedTarget : commandoDir
7272 } , 'Symlink points to wrong target' ) ;
7373 // Could delete and recreate, but for now just use it
7474 }
@@ -80,10 +80,10 @@ export async function symlinkForgeDir(forgeDir: string): Promise<string> {
8080 // Create the symlink
8181 log . debug ( { symlinkPath } , 'Symlink does not exist, creating' ) ;
8282 try {
83- await symlink ( forgeDir , symlinkPath , 'dir' ) ;
84- log . debug ( { forgeDir , symlinkPath } , 'Symlink created successfully' ) ;
83+ await symlink ( commandoDir , symlinkPath , 'dir' ) ;
84+ log . debug ( { commandoDir , symlinkPath } , 'Symlink created successfully' ) ;
8585 } catch ( e : any ) {
86- log . debug ( { forgeDir , symlinkPath, error : e . message } , 'Symlink creation failed' ) ;
86+ log . debug ( { commandoDir , symlinkPath, error : e . message } , 'Symlink creation failed' ) ;
8787 throw e ;
8888 }
8989 }
@@ -95,39 +95,39 @@ export async function symlinkForgeDir(forgeDir: string): Promise<string> {
9595 * Convert a module path within .commando to go through the symlink
9696 *
9797 * Input: /path/to/user/project/.commando/commands.ts
98- * Output: /forge -home/node_modules/.commando-project/abc123/commands.ts
98+ * Output: /commando -home/node_modules/.commando-project/abc123/commands.ts
9999 *
100100 * If the path is NOT in .commando, returns it unchanged.
101101 *
102102 * Note: The symlink should already exist (created during project setup in cli.ts)
103103 */
104- export async function rewriteModulePath ( fullPath : string , forgeDir : string ) : Promise < string > {
105- log . debug ( { fullPath, forgeDir } , 'Checking if path needs rewrite' ) ;
104+ export async function rewriteModulePath ( fullPath : string , commandoDir : string ) : Promise < string > {
105+ log . debug ( { fullPath, commandoDir } , 'Checking if path needs rewrite' ) ;
106106
107107 // Only rewrite paths that are actually in the .commando directory
108- if ( ! fullPath . startsWith ( forgeDir ) ) {
108+ if ( ! fullPath . startsWith ( commandoDir ) ) {
109109 log . debug ( {
110110 fullPath,
111- forgeDir ,
112- reason : 'path outside forgeDir '
111+ commandoDir ,
112+ reason : 'path outside commandoDir '
113113 } , 'Skipping rewrite' ) ;
114114 return fullPath ;
115115 }
116116
117117 log . debug ( { fullPath } , 'Rewriting path through symlink' ) ;
118118
119119 // Symlink should already exist, just compute the path (16 chars = 64 bits)
120- const hash = createHash ( 'sha256' ) . update ( forgeDir ) . digest ( 'hex' ) . slice ( 0 , 16 ) ;
120+ const hash = createHash ( 'sha256' ) . update ( commandoDir ) . digest ( 'hex' ) . slice ( 0 , 16 ) ;
121121
122- // Bucket by first 2 chars (matching symlinkForgeDir structure)
122+ // Bucket by first 2 chars (matching symlinkCommandoDir structure)
123123 const bucket = hash . slice ( 0 , 2 ) ;
124124 const hashSuffix = hash . slice ( 2 ) ;
125125
126126 const nodeModules = getNodeModulesPath ( ) ;
127127 const symlinkPath = join ( nodeModules , '.commando-project' , bucket , hashSuffix ) ;
128128
129129 // Replace the .commando directory with the symlink path
130- const relativePath = fullPath . substring ( forgeDir . length ) ;
130+ const relativePath = fullPath . substring ( commandoDir . length ) ;
131131 const rewrittenPath = join ( symlinkPath , relativePath ) ;
132132
133133 log . debug ( {
0 commit comments