Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/code/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1860,7 +1860,8 @@ async function main(): Promise<void> {
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;
}
Expand Down
18 changes: 18 additions & 0 deletions packages/code/src/setup.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
13 changes: 11 additions & 2 deletions packages/code/src/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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],
};
}
Loading