Merge pull request #70 from continuedev/onboarding-more
Onboarding-more
This commit is contained in:
commit
4dfc838d36
4 changed files with 21 additions and 23 deletions
|
|
@ -33,13 +33,6 @@
|
|||
"pkgRoot": "."
|
||||
}
|
||||
],
|
||||
[
|
||||
"@semantic-release/git",
|
||||
{
|
||||
"assets": ["package.json", "CHANGELOG.md"],
|
||||
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
|
||||
}
|
||||
],
|
||||
"@semantic-release/github"
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,9 +4,10 @@ When a user first runs `cn` in interactive mode, they will be taken through "onb
|
|||
|
||||
## Onboarding flow
|
||||
|
||||
**The onboarding flow runs when the user hasn't completed onboarding before, regardless of whether they have a valid config.yaml file.**
|
||||
|
||||
1. If the --config flag is provided, load this config
|
||||
2. If the user has a ~/.continue/config.yaml with an acceptable model, load this config automatically
|
||||
3. Otherwise, we will present the user with two options:
|
||||
2. Otherwise, we will present the user with two options:
|
||||
|
||||
- Log in with Continue: log them in, which will automatically create their assistant and then we can load the first assistant from the first org
|
||||
- Enter your Anthropic API key: let them enter the key, and then either create a ~/.continue/config.yaml with the following contents OR update the existing config.yaml to add the model
|
||||
|
|
@ -26,8 +27,10 @@ When something in the onboarding flow is done automatically, we should tell the
|
|||
|
||||
## Normal flow
|
||||
|
||||
**The normal flow runs when the user has already completed onboarding.**
|
||||
|
||||
1. If the --config flag is provided, load this config
|
||||
2. If the user is logged in, look for the first assistant in the selected org
|
||||
3. If there are no assistants in that org, then look for a local ~/.continue/config.yaml
|
||||
4. If there is no config.yaml, look for an ANTHROPIC_API_KEY in the environment and manually construct the config object to include just the claude-4-sonnet model with that API key
|
||||
5. If none of the above, then bring the user to step 3 of the onboarding flow
|
||||
5. If none of the above, then bring the user to step 3 of the onboarding flow
|
||||
|
|
@ -1,5 +1,14 @@
|
|||
import * as fs from "fs";
|
||||
import * as os from "os";
|
||||
import * as path from "path";
|
||||
import { logout as workosLogout } from "../auth/workos.js";
|
||||
|
||||
export async function logout() {
|
||||
workosLogout();
|
||||
}
|
||||
|
||||
// Remove onboarding completion flag so user will go through onboarding again
|
||||
const onboardingFlagPath = path.join(os.homedir(), ".continue", ".onboarding_complete");
|
||||
if (fs.existsSync(onboardingFlagPath)) {
|
||||
fs.unlinkSync(onboardingFlagPath);
|
||||
}
|
||||
}
|
||||
|
|
@ -111,14 +111,7 @@ export async function runOnboardingFlow(
|
|||
return { ...result, wasOnboarded: false };
|
||||
}
|
||||
|
||||
// Step 2: Check if user has ~/.continue/config.yaml with acceptable model
|
||||
if (await checkHasAcceptableModel(CONFIG_PATH)) {
|
||||
console.log(chalk.blue(`✓ Using existing ${CONFIG_PATH}`));
|
||||
const result = await initialize(authConfig, CONFIG_PATH);
|
||||
return { ...result, wasOnboarded: true };
|
||||
}
|
||||
|
||||
// Step 3: Present user with two options
|
||||
// Step 2: Present user with two options (no longer auto-load config.yaml)
|
||||
console.log(chalk.yellow("Choose how you'd like to set up your agent:"));
|
||||
console.log(chalk.white("1. Log in with Continue"));
|
||||
console.log(chalk.white("2. Enter your Anthropic API key"));
|
||||
|
|
@ -181,7 +174,7 @@ export async function runNormalFlow(
|
|||
if (isAuthenticated()) {
|
||||
try {
|
||||
const result = await initialize(authConfig, undefined);
|
||||
return { ...result, wasOnboarded: true };
|
||||
return { ...result, wasOnboarded: false };
|
||||
} catch (error) {}
|
||||
}
|
||||
|
||||
|
|
@ -189,7 +182,7 @@ export async function runNormalFlow(
|
|||
if (fs.existsSync(CONFIG_PATH)) {
|
||||
try {
|
||||
const result = await initialize(authConfig, CONFIG_PATH);
|
||||
return { ...result, wasOnboarded: true };
|
||||
return { ...result, wasOnboarded: false };
|
||||
} catch (error) {
|
||||
console.log(chalk.yellow("⚠ Invalid config file found"));
|
||||
}
|
||||
|
|
@ -201,7 +194,7 @@ export async function runNormalFlow(
|
|||
await createOrUpdateConfig(process.env.ANTHROPIC_API_KEY);
|
||||
console.log(chalk.gray(` Config saved to: ${CONFIG_PATH}`));
|
||||
const result = await initialize(authConfig, CONFIG_PATH);
|
||||
return { ...result, wasOnboarded: true };
|
||||
return { ...result, wasOnboarded: false };
|
||||
}
|
||||
|
||||
// Step 5: Fall back to onboarding flow
|
||||
|
|
@ -243,4 +236,4 @@ export async function initializeWithOnboarding(
|
|||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue