Skip to content

Commit 2bde569

Browse files
committed
chore: run prettier --write on cli
1 parent a54c14f commit 2bde569

File tree

101 files changed

+4239
-3559
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+4239
-3559
lines changed

extensions/cli/AGENTS.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,30 @@ This is a CLI tool for Continue Dev that provides an interactive AI-assisted dev
1818
### Core Components
1919

2020
1. **Entry Point** (`src/index.ts`): Main CLI logic with two modes:
21+
2122
- **Headless mode**: Non-interactive mode for automation/CI
2223
- **TUI mode**: Terminal User Interface using Ink/React
2324
- **Standard mode**: Traditional readline-based chat interface
2425

2526
2. **Authentication** (`src/auth/`): WorkOS-based authentication system
27+
2628
- `ensureAuth.ts`: Handles authentication flow
2729
- `workos.ts`: WorkOS configuration and token management
2830

2931
3. **Continue SDK Integration** (`src/continueSDK.ts`): Initializes the Continue SDK client with:
32+
3033
- API key authentication
3134
- Assistant configuration (slug-based)
3235
- Organization support
3336

3437
4. **Terminal UI** (`src/ui/`): React/Ink-based TUI components
38+
3539
- `TUIChat.tsx`: Main chat interface component
3640
- `UserInput.tsx`: Input handling with multi-line support
3741
- `TextBuffer.ts`: Text display utilities
3842

3943
5. **Tools System** (`src/tools/`): Built-in development tools including:
44+
4045
- File operations (read, write, list)
4146
- Code search functionality
4247
- Terminal command execution

extensions/cli/spec/config-loading.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,13 @@ This document specifies the behavior of the CLI's configuration loading system,
2323
**When CLI is invoked, config source is determined in this order:**
2424

2525
1. **CLI `--config` Flag** (highest priority)
26+
2627
- File path (starts with `.`, `/`, `~`): Loads local YAML file
2728
- Assistant slug (`owner/package`): Fetches from Continue platform
2829
- Overrides any saved preferences
2930

3031
2. **Saved Config URI** (if no `--config` flag)
32+
3133
- Retrieved from authentication config
3234
- Converts `file://` URIs back to file paths
3335
- Converts `slug://` URIs back to assistant slugs

extensions/cli/spec/onboarding.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ When a user first runs `cn` in interactive mode, they will be taken through "onb
88

99
1. If the --config flag is provided, load this config
1010
2. Otherwise, we will present the user with two options:
11+
1112
- 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
1213
- 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
1314

extensions/cli/src/args.test.ts

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { vi } from 'vitest';
1+
import { vi } from "vitest";
22

33
import { parseArgs, processRule } from "./args.js";
44

@@ -20,7 +20,6 @@ describe("parseArgs", () => {
2020
expect(result).toEqual({});
2121
});
2222

23-
2423
it("should set resume to true when --resume flag is present", () => {
2524
process.argv = ["node", "script.js", "--resume"];
2625
const result = parseArgs();
@@ -33,7 +32,6 @@ describe("parseArgs", () => {
3332
expect(result.readonly).toBe(true);
3433
});
3534

36-
3735
it("should parse config path from --config flag", () => {
3836
process.argv = ["node", "script.js", "--config", "/path/to/config.yaml"];
3937
const result = parseArgs();
@@ -189,8 +187,7 @@ describe("parseArgs", () => {
189187
it("should handle empty arguments array", () => {
190188
process.argv = ["node", "script.js"];
191189
const result = parseArgs();
192-
expect(result).toEqual({
193-
});
190+
expect(result).toEqual({});
194191
});
195192

196193
it("should handle multiple boolean flags", () => {
@@ -224,15 +221,15 @@ describe("processRule (loadRuleFromHub integration)", () => {
224221
// Mock fetch for hub tests
225222
const originalFetch = global.fetch;
226223
const mockFetch = vi.fn() as any;
227-
224+
228225
beforeAll(() => {
229226
global.fetch = mockFetch;
230227
});
231228

232229
afterAll(() => {
233230
global.fetch = originalFetch;
234231
});
235-
232+
236233
beforeEach(() => {
237234
mockFetch.mockClear();
238235
});
@@ -242,22 +239,26 @@ describe("processRule (loadRuleFromHub integration)", () => {
242239
// Create a mock zip file containing a markdown rule
243240
const JSZip = (await import("jszip")).default;
244241
const zip = new JSZip();
245-
const ruleContent = "# Sentry Next.js Rule\n\nThis is a sample rule for Sentry integration with Next.js applications.";
242+
const ruleContent =
243+
"# Sentry Next.js Rule\n\nThis is a sample rule for Sentry integration with Next.js applications.";
246244
zip.file("rule.md", ruleContent);
247-
245+
248246
const zipBuffer = await zip.generateAsync({ type: "arraybuffer" });
249-
247+
250248
// Mock successful fetch response
251249
mockFetch.mockResolvedValue({
252250
ok: true,
253251
arrayBuffer: () => Promise.resolve(zipBuffer),
254252
} as Response);
255253

256254
const result = await processRule("continuedev/sentry-nextjs");
257-
255+
258256
expect(result).toBe(ruleContent);
259257
expect(mockFetch).toHaveBeenCalledWith(
260-
new URL("v0/continuedev/sentry-nextjs/latest/download", "https://api.continue.dev/")
258+
new URL(
259+
"v0/continuedev/sentry-nextjs/latest/download",
260+
"https://api.continue.dev/",
261+
),
261262
);
262263
});
263264

@@ -269,38 +270,38 @@ describe("processRule (loadRuleFromHub integration)", () => {
269270
} as Response);
270271

271272
await expect(processRule("continuedev/nonexistent-rule")).rejects.toThrow(
272-
'Failed to load rule from hub "continuedev/nonexistent-rule": HTTP 404: Not Found'
273+
'Failed to load rule from hub "continuedev/nonexistent-rule": HTTP 404: Not Found',
273274
);
274275
});
275276

276277
it("should handle network errors when loading from hub", async () => {
277278
mockFetch.mockRejectedValue(new Error("Network error"));
278279

279280
await expect(processRule("continuedev/sentry-nextjs")).rejects.toThrow(
280-
'Failed to load rule from hub "continuedev/sentry-nextjs": Network error'
281+
'Failed to load rule from hub "continuedev/sentry-nextjs": Network error',
281282
);
282283
});
283284

284285
it("should handle invalid slug format", async () => {
285286
// "invalid-slug" doesn't contain "/" so it's treated as direct content, not a hub slug
286287
// Let's test with a slug that has wrong format but contains "/"
287288
await expect(processRule("invalid/slug/too/many/parts")).rejects.toThrow(
288-
'Invalid hub slug format. Expected "owner/package", got: invalid/slug/too/many/parts'
289+
'Invalid hub slug format. Expected "owner/package", got: invalid/slug/too/many/parts',
289290
);
290291
});
291292

292293
it("should handle empty zip file", async () => {
293294
const JSZip = (await import("jszip")).default;
294295
const zip = new JSZip();
295296
const zipBuffer = await zip.generateAsync({ type: "arraybuffer" });
296-
297+
297298
mockFetch.mockResolvedValue({
298299
ok: true,
299300
arrayBuffer: () => Promise.resolve(zipBuffer),
300301
} as Response);
301302

302303
await expect(processRule("continuedev/empty-rule")).rejects.toThrow(
303-
'Failed to load rule from hub "continuedev/empty-rule": No rule content found in downloaded zip file'
304+
'Failed to load rule from hub "continuedev/empty-rule": No rule content found in downloaded zip file',
304305
);
305306
});
306307

@@ -309,14 +310,14 @@ describe("processRule (loadRuleFromHub integration)", () => {
309310
const zip = new JSZip();
310311
zip.folder("docs"); // Create a directory but no files
311312
const zipBuffer = await zip.generateAsync({ type: "arraybuffer" });
312-
313+
313314
mockFetch.mockResolvedValue({
314315
ok: true,
315316
arrayBuffer: () => Promise.resolve(zipBuffer),
316317
} as Response);
317318

318319
await expect(processRule("continuedev/directory-only")).rejects.toThrow(
319-
'Failed to load rule from hub "continuedev/directory-only": No rule content found in downloaded zip file'
320+
'Failed to load rule from hub "continuedev/directory-only": No rule content found in downloaded zip file',
320321
);
321322
});
322323

@@ -325,20 +326,20 @@ describe("processRule (loadRuleFromHub integration)", () => {
325326
const zip = new JSZip();
326327
const mdContent = "# Main Rule\n\nThis is the markdown rule content.";
327328
const txtContent = "This is just a text file.";
328-
329+
329330
zip.file("README.txt", txtContent);
330331
zip.file("rule.md", mdContent);
331332
zip.file("package.json", '{"name": "test"}');
332-
333+
333334
const zipBuffer = await zip.generateAsync({ type: "arraybuffer" });
334-
335+
335336
mockFetch.mockResolvedValue({
336337
ok: true,
337338
arrayBuffer: () => Promise.resolve(zipBuffer),
338339
} as Response);
339340

340341
const result = await processRule("continuedev/mixed-files");
341-
342+
342343
expect(result).toBe(mdContent);
343344
});
344345

@@ -347,33 +348,33 @@ describe("processRule (loadRuleFromHub integration)", () => {
347348
const zip = new JSZip();
348349
const rule1Content = "# First Rule\n\nThis is the first rule.";
349350
const rule2Content = "# Second Rule\n\nThis is the second rule.";
350-
351+
351352
zip.file("rule1.md", rule1Content);
352353
zip.file("rule2.md", rule2Content);
353-
354+
354355
const zipBuffer = await zip.generateAsync({ type: "arraybuffer" });
355-
356+
356357
mockFetch.mockResolvedValue({
357358
ok: true,
358359
arrayBuffer: () => Promise.resolve(zipBuffer),
359360
} as Response);
360361

361362
const result = await processRule("continuedev/multiple-rules");
362-
363+
363364
// Should use the first markdown file found (alphabetically)
364365
expect(result).toBe(rule1Content);
365366
});
366367

367368
it("should handle malformed zip files", async () => {
368369
const invalidZipBuffer = new ArrayBuffer(10);
369-
370+
370371
mockFetch.mockResolvedValue({
371372
ok: true,
372373
arrayBuffer: () => Promise.resolve(invalidZipBuffer),
373374
} as Response);
374375

375376
await expect(processRule("continuedev/corrupted-zip")).rejects.toThrow(
376-
'Failed to load rule from hub "continuedev/corrupted-zip"'
377+
'Failed to load rule from hub "continuedev/corrupted-zip"',
377378
);
378379
});
379380
});
@@ -384,7 +385,7 @@ describe("processRule (loadRuleFromHub integration)", () => {
384385
const zip = new JSZip();
385386
zip.file("rule.md", "# Hub Rule");
386387
const zipBuffer = await zip.generateAsync({ type: "arraybuffer" });
387-
388+
388389
mockFetch.mockResolvedValue({
389390
ok: true,
390391
arrayBuffer: () => Promise.resolve(zipBuffer),
@@ -406,9 +407,9 @@ describe("processRule (loadRuleFromHub integration)", () => {
406407
// This would be treated as a file path, not a hub slug
407408
// since it starts with "."
408409
await expect(processRule("./owner/package")).rejects.toThrow(
409-
'Failed to read rule file "./owner/package": Rule file not found'
410+
'Failed to read rule file "./owner/package": Rule file not found',
410411
);
411412
expect(mockFetch).not.toHaveBeenCalled();
412413
});
413414
});
414-
});
415+
});

extensions/cli/src/asciiArt.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { getDisplayableAsciiArt, CONTINUE_ASCII_ART } from "./asciiArt.js";
44

55
describe("asciiArt", () => {
66
let originalColumns: number | undefined;
7-
7+
88
beforeEach(() => {
99
originalColumns = process.stdout.columns;
1010
});
@@ -23,7 +23,7 @@ describe("asciiArt", () => {
2323
process.stdout.columns = 80;
2424

2525
const result = getDisplayableAsciiArt();
26-
26+
2727
expect(result).toBe(CONTINUE_ASCII_ART);
2828
});
2929

@@ -32,7 +32,7 @@ describe("asciiArt", () => {
3232
process.stdout.columns = 60;
3333

3434
const result = getDisplayableAsciiArt();
35-
35+
3636
expect(result).toContain("CONTINUE");
3737
expect(result).toContain("v0.0.0-dev");
3838
expect(result).not.toBe(CONTINUE_ASCII_ART);
@@ -45,7 +45,7 @@ describe("asciiArt", () => {
4545
process.stdout.columns = 74;
4646

4747
const result = getDisplayableAsciiArt();
48-
48+
4949
expect(result).toContain("CONTINUE");
5050
expect(result).not.toBe(CONTINUE_ASCII_ART);
5151
});
@@ -55,7 +55,7 @@ describe("asciiArt", () => {
5555
process.stdout.columns = 75;
5656

5757
const result = getDisplayableAsciiArt();
58-
58+
5959
expect(result).toBe(CONTINUE_ASCII_ART);
6060
});
6161

@@ -64,8 +64,8 @@ describe("asciiArt", () => {
6464
delete (process.stdout as any).columns;
6565

6666
const result = getDisplayableAsciiArt();
67-
67+
6868
expect(result).toBe(CONTINUE_ASCII_ART);
6969
});
7070
});
71-
});
71+
});

extensions/cli/src/auth/workos-org.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,12 @@ describe("ensureOrganization with CLI organization slug", () => {
7979
const consoleInfoSpy = vi.spyOn(console, "info");
8080

8181
await expect(
82-
ensureOrganization(mockAuthConfig, true, "invalid-org")
82+
ensureOrganization(mockAuthConfig, true, "invalid-org"),
8383
).rejects.toThrow('Organization "invalid-org" not found');
8484

8585
expect(consoleInfoSpy).toHaveBeenCalledWith(
8686
chalk.yellow("Available organizations:"),
87-
expect.stringContaining("personal")
87+
expect.stringContaining("personal"),
8888
);
8989
});
9090
});
@@ -99,13 +99,13 @@ describe("ensureOrganization with CLI organization slug", () => {
9999
});
100100

101101
await expect(
102-
ensureOrganization(mockAuthConfig, false, "org-one")
102+
ensureOrganization(mockAuthConfig, false, "org-one"),
103103
).rejects.toThrow("Process exit");
104104

105105
expect(consoleErrorSpy).toHaveBeenCalledWith(
106106
chalk.red(
107-
"The --org flag is only supported in headless mode (with -p/--print flag)"
108-
)
107+
"The --org flag is only supported in headless mode (with -p/--print flag)",
108+
),
109109
);
110110
expect(processExitSpy).toHaveBeenCalledWith(1);
111111

@@ -141,7 +141,7 @@ describe("ensureOrganization with CLI organization slug", () => {
141141
const result = await ensureOrganization(
142142
mockEnvAuthConfig,
143143
true,
144-
"org-two"
144+
"org-two",
145145
);
146146

147147
expect(result).toMatchObject({
@@ -192,7 +192,7 @@ describe("ensureOrganization with CLI organization slug", () => {
192192
vi.mocked(getApiClient).mockReturnValue(apiClient as any);
193193

194194
await expect(
195-
ensureOrganization(mockAuthConfig, true, "org-one")
195+
ensureOrganization(mockAuthConfig, true, "org-one"),
196196
).rejects.toThrow("API Error");
197197
});
198198
});

0 commit comments

Comments
 (0)