feat(cliproxy): pool onboarding hints for existing multi-profile users

- ccs doctor, native account launch, and ccs auth create now surface a
  one-line pool suggestion when >=2 native Claude profiles exist and no
  pool is enabled; shared once-per-install dismissal; TTY-gated; hint
  failures can never break a launch (guarded, single config read)
- credential import from native profiles evaluated and REJECTED:
  refresh tokens are client_id-bound and not replayable cross-client;
  pool setup requires fresh OAuth per account (verdict report in plan)

Part of #1464 account pools (phase 5).
This commit is contained in:
Tam Nhu Tran committed 2026-06-11 12:09:53 -04:00
1 parent 0f0e709b4f
commit 0343734665
6 files changed
+732 -1

No files matched your search

+17 -1
View File
@@ -29,7 +29,11 @@ import { exitWithError } from '../../errors';
import { ExitCode } from '../../errors/exit-codes';
import { CommandContext, parseArgs, rejectUnsupportedAuthOptions } from './types';
import { stripAmbientProviderCredentials } from './create-command-env';
import { isUnifiedMode } from '../../config/config-loader-facade';
import { isUnifiedMode, hasUnifiedConfig } from '../../config/config-loader-facade';
import {
maybeShowPoolOnboardingHint,
countNativeClaudeProfiles,
} from '../../cliproxy/routing/pool-onboarding-hint';
function sanitizeProfileNameForInstance(name: string): string {
return name.replace(/[^a-zA-Z0-9_-]/g, '-').toLowerCase();
@@ -185,6 +189,18 @@ export async function handleCreate(ctx: CommandContext, args: string[]): Promise
}
};
// Pool suggestion: when creating a 2nd+ native Claude profile, show the
// once-per-install onboarding hint. Print-only, TTY-gated, never blocks.
// Pass existingCount + 1 so the hint sees the post-create count (>= 2).
// Gated on hasUnifiedConfig() so legacy profiles.json-only installs receive
// the hint from ccs doctor only (where dismissal semantics are preserved).
if (!profileExistedBeforeCreate && hasUnifiedConfig()) {
const existingCount = countNativeClaudeProfiles();
if (existingCount >= 1) {
maybeShowPoolOnboardingHint(existingCount + 1);
}
}
try {
// Create instance directory
console.log(info(`Creating profile: ${profileName}`));