diff --git a/packages/code/src/cli.ts b/packages/code/src/cli.ts index 4926bd6f..5b6675b6 100644 --- a/packages/code/src/cli.ts +++ b/packages/code/src/cli.ts @@ -1860,7 +1860,8 @@ async function main(): Promise { Run lc-code setup --help for setup options. librechat-code remains available as a compatibility alias. Legacy LIBRECHAT_CODE_* configuration takes precedence over the default profile. -Explicit profiles cannot be mixed with legacy settings or run options. +Saved profiles accept repository instruction settings. Mixing a profile with +other legacy settings or run options is unsupported. `); return; } diff --git a/packages/code/src/setup.test.ts b/packages/code/src/setup.test.ts index 0241f083..47fb8ccd 100644 --- a/packages/code/src/setup.test.ts +++ b/packages/code/src/setup.test.ts @@ -266,6 +266,24 @@ test('saved profile startup never merges legacy identity or permission settings' ); }); +test('saved profiles accept repository instruction settings without dropping profile arguments', async t => { + const { options, pair } = await fixture(t); + const saved = await setupWorker(options, { pair }); + const selected = await profileRunConfiguration( + ['--profile', saved.profilePath, '--no-repository-instructions'], + {}, + ); + assert.equal(selected.profilePath, saved.profilePath); + assert.deepEqual(selected.args, ['--default-workspace', '--no-repository-instructions']); + + const configured = await profileRunConfiguration([], { + LIBRECHAT_CODE_PROFILE_FILE: saved.profilePath, + LIBRECHAT_CODE_REPOSITORY_INSTRUCTIONS: 'false', + }); + assert.equal(configured.profilePath, saved.profilePath); + assert.deepEqual(configured.args, ['--default-workspace']); +}); + test('explicit profile parse rejects missing, repeated, absent, or corrupt profiles', async t => { const { options } = await fixture(t); await assert.rejects( diff --git a/packages/code/src/setup.ts b/packages/code/src/setup.ts index 486923b5..f1edd0ae 100644 --- a/packages/code/src/setup.ts +++ b/packages/code/src/setup.ts @@ -228,6 +228,7 @@ export async function profileRunConfiguration( ([key, value]) => key.startsWith('LIBRECHAT_CODE_') && key !== 'LIBRECHAT_CODE_PROFILE_FILE' && + key !== 'LIBRECHAT_CODE_REPOSITORY_INSTRUCTIONS' && value?.trim(), ); if (legacyConfiguration) { @@ -246,9 +247,17 @@ export async function profileRunConfiguration( ); return { args }; } - if (args.length) + const instructionOptions = args.filter( + arg => + arg === '--no-repository-instructions' || arg === '--repository-instructions', + ); + if (args.length !== instructionOptions.length) throw new Error( 'Saved profiles cannot be combined with run options; use a separate profile or the existing environment-variable configuration', ); - return { profilePath: path, profile, args: workerProfileArguments(profile) }; + return { + profilePath: path, + profile, + args: [...workerProfileArguments(profile), ...instructionOptions], + }; }