Skip to content

Commit d368529

Browse files
authored
ci: fix release workflows to block if version check fails (#7350)
* ci: fix release workflows to block if version check fails * fix: better readline for cli * fix: npm run lint fixes
1 parent 41937a2 commit d368529

File tree

8 files changed

+375
-61
lines changed

8 files changed

+375
-61
lines changed

.github/workflows/main.yaml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,24 @@ jobs:
2626
echo "should_run=false" >> $GITHUB_OUTPUT
2727
fi
2828
29+
check-version:
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v5
34+
with:
35+
fetch-depth: 0 # This ensures all tags are fetched
36+
37+
- name: Checkout tag
38+
run: git checkout ${GITHUB_REF#refs/tags/}
39+
40+
- name: Make sure version isn't odd
41+
run: |
42+
cd extensions/vscode
43+
node scripts/versionCheck.js
44+
2945
build:
30-
needs: check_release_name
46+
needs: [check_release_name, check-version]
3147
if: needs.check_release_name.outputs.should_run == 'true' || github.event_name == 'workflow_dispatch'
3248
runs-on: ${{ matrix.os }}
3349
strategy:
@@ -88,22 +104,6 @@ jobs:
88104
name: ${{ matrix.platform }}-${{ matrix.arch }}-vsix
89105
path: "extensions/vscode/*.vsix"
90106

91-
check-version:
92-
runs-on: ubuntu-latest
93-
steps:
94-
- name: Checkout
95-
uses: actions/checkout@v5
96-
with:
97-
fetch-depth: 0 # This ensures all tags are fetched
98-
99-
- name: Checkout tag
100-
run: git checkout ${GITHUB_REF#refs/tags/}
101-
102-
- name: Make sure version isn't odd
103-
run: |
104-
cd extensions/vscode
105-
node scripts/versionCheck.js
106-
107107
release:
108108
permissions:
109109
contents: write

extensions/cli/package-lock.json

Lines changed: 0 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

extensions/cli/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@
7777
"@types/jszip": "^3.4.0",
7878
"@types/nock": "^10.0.3",
7979
"@types/react": "^19.1.8",
80-
"@types/readline-sync": "^1.4.8",
8180
"@types/shell-quote": "^1.7.5",
8281
"@types/supertest": "^6.0.3",
8382
"@types/turndown": "^5.0.5",
@@ -122,7 +121,6 @@
122121
"prettier": "^3.6.2",
123122
"prettier-plugin-tailwindcss": "^0.6.14",
124123
"react": "^19.1.0",
125-
"readline-sync": "^1.4.10",
126124
"semantic-release": "^24.2.7",
127125
"shell-quote": "^1.8.3",
128126
"supertest": "^7.1.3",

extensions/cli/src/commands/chat.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { ModelConfig } from "@continuedev/config-yaml";
22
import chalk from "chalk";
3-
import type { ChatHistoryItem, Session } from "core/index.js";
3+
import { ChatHistoryItem, Session } from "core";
44
import { ChatDescriber } from "core/util/chatDescriber.js";
5-
import * as readlineSync from "readline-sync";
65

76
import { compactChatHistory, findCompactionIndex } from "../compaction.js";
87
import { processCommandFlags } from "../flags/flagProcessor.js";
@@ -25,6 +24,7 @@ import { startTUIChat } from "../ui/index.js";
2524
import { gracefulExit } from "../util/exit.js";
2625
import { formatAnthropicError, formatError } from "../util/formatError.js";
2726
import { logger } from "../util/logger.js";
27+
import { question } from "../util/prompt.js";
2828
import {
2929
calculateContextUsagePercentage,
3030
countChatHistoryTokens,
@@ -454,7 +454,7 @@ async function runHeadlessMode(
454454
const userInput =
455455
isFirstMessage && initialUserInput
456456
? initialUserInput
457-
: readlineSync.question(`\n${chalk.bold.green("You:")} `);
457+
: await question(`\n${chalk.bold.green("You:")} `);
458458

459459
isFirstMessage = false;
460460

extensions/cli/src/freeTrialTransition.ts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ import * as path from "path";
44

55
import chalk from "chalk";
66
import open from "open";
7-
import * as readlineSync from "readline-sync";
87

98
import { env } from "./env.js";
109
import {
11-
isValidAnthropicApiKey,
1210
getApiKeyValidationError,
11+
isValidAnthropicApiKey,
1312
} from "./util/apiKeyValidation.js";
1413
import { gracefulExit } from "./util/exit.js";
14+
import { question, questionWithChoices } from "./util/prompt.js";
1515
import { updateAnthropicModelInYaml } from "./util/yamlConfigUpdater.js";
1616

1717
const CONFIG_PATH = path.join(env.continueHome, "config.yaml");
@@ -52,10 +52,12 @@ export async function handleMaxedOutFreeTrial(
5252
console.log(chalk.white("1. 💳 Sign up for models add-on"));
5353
console.log(chalk.white("2. 🔑 Enter your Anthropic API key"));
5454

55-
const choice = readlineSync.question(chalk.yellow("\nEnter choice (1): "), {
56-
limit: ["1", "2", ""],
57-
limitMessage: chalk.dim("Please enter 1 or 2"),
58-
});
55+
const choice = await questionWithChoices(
56+
chalk.yellow("\nEnter choice (1): "),
57+
["1", "2", ""],
58+
"1",
59+
chalk.dim("Please enter 1 or 2"),
60+
);
5961

6062
if (choice === "1" || choice === "") {
6163
// Option 1: Open models setup page
@@ -81,15 +83,12 @@ export async function handleMaxedOutFreeTrial(
8183
}
8284

8385
// Wait for user to acknowledge
84-
readlineSync.question(chalk.dim("\nPress Enter to exit..."));
86+
await question(chalk.dim("\nPress Enter to exit..."));
8587
await gracefulExit(0);
8688
} else if (choice === "2") {
8789
// Option 2: Enter Anthropic API key
88-
const apiKey = readlineSync.question(
90+
const apiKey = await question(
8991
chalk.white("\nEnter your Anthropic API key: "),
90-
{
91-
hideEchoBack: true,
92-
},
9392
);
9493

9594
if (!isValidAnthropicApiKey(apiKey)) {

extensions/cli/src/onboarding.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { AssistantUnrolled, ModelConfig } from "@continuedev/config-yaml";
55
import { BaseLlmApi } from "@continuedev/openai-adapters";
66
import { DefaultApiInterface } from "@continuedev/sdk/dist/api/dist/index.js";
77
import chalk from "chalk";
8-
import * as readlineSync from "readline-sync";
98

109
import { processPromptOrRule } from "./args.js";
1110
import { AuthConfig, isAuthenticated, login } from "./auth/workos.js";
@@ -16,6 +15,7 @@ import {
1615
getApiKeyValidationError,
1716
isValidAnthropicApiKey,
1817
} from "./util/apiKeyValidation.js";
18+
import { question, questionWithChoices } from "./util/prompt.js";
1919
import { updateAnthropicModelInYaml } from "./util/yamlConfigUpdater.js";
2020

2121
const CONFIG_PATH = path.join(env.continueHome, "config.yaml");
@@ -97,10 +97,12 @@ async function runOnboardingFlow(
9797
console.log(chalk.white("1. ⏩ Log in with Continue"));
9898
console.log(chalk.white("2. 🔑 Enter your Anthropic API key"));
9999

100-
const choice = readlineSync.question(chalk.yellow("\nEnter choice (1): "), {
101-
limit: ["1", "2", ""],
102-
limitMessage: chalk.dim("Please enter 1 or 2"),
103-
});
100+
const choice = await questionWithChoices(
101+
chalk.yellow("\nEnter choice (1): "),
102+
["1", "2", ""],
103+
"1",
104+
chalk.dim("Please enter 1 or 2"),
105+
);
104106

105107
if (choice === "1" || choice === "") {
106108
const newAuthConfig = await login();
@@ -111,11 +113,8 @@ async function runOnboardingFlow(
111113
const result = await initialize(finalAuthConfig, undefined);
112114
return { ...result, wasOnboarded: true };
113115
} else if (choice === "2") {
114-
const apiKey = readlineSync.question(
116+
const apiKey = await question(
115117
chalk.white("\nEnter your Anthropic API key: "),
116-
{
117-
hideEchoBack: true,
118-
},
119118
);
120119

121120
if (!isValidAnthropicApiKey(apiKey)) {

0 commit comments

Comments
 (0)