chad-code 1.3.7 → 1.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -6
- package/src/bun/index.ts +1 -1
- package/src/cli/cmd/tui/context/sync.tsx +1 -1
- package/src/cli/ui.ts +1 -1
- package/src/config/config.ts +1 -1
- package/src/config/markdown.ts +1 -1
- package/src/file/ripgrep.ts +1 -1
- package/src/ide/index.ts +1 -1
- package/src/index.ts +1 -1
- package/src/installation/index.ts +1 -1
- package/src/lsp/client.ts +1 -1
- package/src/mcp/index.ts +1 -1
- package/src/project/project.ts +1 -1
- package/src/provider/auth.ts +1 -1
- package/src/provider/provider.ts +1 -1
- package/src/pty/index.ts +1 -1
- package/src/server/server.ts +1 -1
- package/src/session/message-v2.ts +1 -1
- package/src/session/message.ts +1 -1
- package/src/session/prompt.ts +1 -1
- package/src/session/retry.ts +1 -1
- package/src/skill/skill.ts +1 -1
- package/src/storage/storage.ts +1 -1
- package/src/util/binary.ts +41 -0
- package/src/util/error.ts +54 -0
- package/src/worktree/index.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.8",
|
|
4
4
|
"name": "chad-code",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -25,7 +25,6 @@
|
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@babel/core": "7.28.4",
|
|
27
27
|
"@octokit/webhooks-types": "7.6.1",
|
|
28
|
-
"@opencode-ai/script": "workspace:*",
|
|
29
28
|
"@parcel/watcher-darwin-arm64": "2.5.1",
|
|
30
29
|
"@parcel/watcher-darwin-x64": "2.5.1",
|
|
31
30
|
"@parcel/watcher-linux-arm64-glibc": "2.5.1",
|
|
@@ -63,10 +62,8 @@
|
|
|
63
62
|
"@octokit/graphql": "9.0.2",
|
|
64
63
|
"@octokit/rest": "22.0.0",
|
|
65
64
|
"@openauthjs/openauth": "0.0.0-20250322224806",
|
|
66
|
-
"@opencode-ai/plugin": "
|
|
67
|
-
"@opencode-ai/
|
|
68
|
-
"@opencode-ai/sdk": "workspace:*",
|
|
69
|
-
"@opencode-ai/util": "workspace:*",
|
|
65
|
+
"@opencode-ai/plugin": "1.1.13",
|
|
66
|
+
"@opencode-ai/sdk": "1.1.13",
|
|
70
67
|
"@opentui/core": "0.1.68",
|
|
71
68
|
"@opentui/solid": "0.1.68",
|
|
72
69
|
"@parcel/watcher": "2.5.1",
|
package/src/bun/index.ts
CHANGED
|
@@ -2,7 +2,7 @@ import z from "zod"
|
|
|
2
2
|
import { Global } from "../global"
|
|
3
3
|
import { Log } from "../util/log"
|
|
4
4
|
import path from "path"
|
|
5
|
-
import { NamedError } from "
|
|
5
|
+
import { NamedError } from "@/util/error"
|
|
6
6
|
import { readableStreamToText } from "bun"
|
|
7
7
|
import { createRequire } from "module"
|
|
8
8
|
import { Lock } from "../util/lock"
|
|
@@ -19,7 +19,7 @@ import type {
|
|
|
19
19
|
} from "@opencode-ai/sdk/v2"
|
|
20
20
|
import { createStore, produce, reconcile } from "solid-js/store"
|
|
21
21
|
import { useSDK } from "@tui/context/sdk"
|
|
22
|
-
import { Binary } from "
|
|
22
|
+
import { Binary } from "@/util/binary"
|
|
23
23
|
import { createSimpleContext } from "./helper"
|
|
24
24
|
import type { Snapshot } from "@/snapshot"
|
|
25
25
|
import { useExit } from "./exit"
|
package/src/cli/ui.ts
CHANGED
package/src/config/config.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { mergeDeep, pipe, unique } from "remeda"
|
|
|
9
9
|
import { Global } from "../global"
|
|
10
10
|
import fs from "fs/promises"
|
|
11
11
|
import { lazy } from "../util/lazy"
|
|
12
|
-
import { NamedError } from "
|
|
12
|
+
import { NamedError } from "@/util/error"
|
|
13
13
|
import { Flag } from "../flag/flag"
|
|
14
14
|
import { Auth } from "../auth"
|
|
15
15
|
import { type ParseError as JsoncParseError, parse as parseJsonc, printParseErrorCode } from "jsonc-parser"
|
package/src/config/markdown.ts
CHANGED
package/src/file/ripgrep.ts
CHANGED
|
@@ -3,7 +3,7 @@ import path from "path"
|
|
|
3
3
|
import { Global } from "../global"
|
|
4
4
|
import fs from "fs/promises"
|
|
5
5
|
import z from "zod"
|
|
6
|
-
import { NamedError } from "
|
|
6
|
+
import { NamedError } from "@/util/error"
|
|
7
7
|
import { lazy } from "../util/lazy"
|
|
8
8
|
import { $ } from "bun"
|
|
9
9
|
|
package/src/ide/index.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { BusEvent } from "@/bus/bus-event"
|
|
|
2
2
|
import { Bus } from "@/bus"
|
|
3
3
|
import { spawn } from "bun"
|
|
4
4
|
import z from "zod"
|
|
5
|
-
import { NamedError } from "
|
|
5
|
+
import { NamedError } from "@/util/error"
|
|
6
6
|
import { Log } from "../util/log"
|
|
7
7
|
|
|
8
8
|
const SUPPORTED_IDES = [
|
package/src/index.ts
CHANGED
|
@@ -10,7 +10,7 @@ import { UninstallCommand } from "./cli/cmd/uninstall"
|
|
|
10
10
|
import { ModelsCommand } from "./cli/cmd/models"
|
|
11
11
|
import { UI } from "./cli/ui"
|
|
12
12
|
import { Installation } from "./installation"
|
|
13
|
-
import { NamedError } from "
|
|
13
|
+
import { NamedError } from "@/util/error"
|
|
14
14
|
import { FormatError } from "./cli/error"
|
|
15
15
|
import { ServeCommand } from "./cli/cmd/serve"
|
|
16
16
|
import { DebugCommand } from "./cli/cmd/debug"
|
|
@@ -2,7 +2,7 @@ import { BusEvent } from "@/bus/bus-event"
|
|
|
2
2
|
import path from "path"
|
|
3
3
|
import { $ } from "bun"
|
|
4
4
|
import z from "zod"
|
|
5
|
-
import { NamedError } from "
|
|
5
|
+
import { NamedError } from "@/util/error"
|
|
6
6
|
import { Log } from "../util/log"
|
|
7
7
|
import { iife } from "@/util/iife"
|
|
8
8
|
import { Flag } from "../flag/flag"
|
package/src/lsp/client.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { Log } from "../util/log"
|
|
|
8
8
|
import { LANGUAGE_EXTENSIONS } from "./language"
|
|
9
9
|
import z from "zod"
|
|
10
10
|
import type { LSPServer } from "./server"
|
|
11
|
-
import { NamedError } from "
|
|
11
|
+
import { NamedError } from "@/util/error"
|
|
12
12
|
import { withTimeout } from "../util/timeout"
|
|
13
13
|
import { Instance } from "../project/instance"
|
|
14
14
|
import { Filesystem } from "../util/filesystem"
|
package/src/mcp/index.ts
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from "@modelcontextprotocol/sdk/types.js"
|
|
12
12
|
import { Config } from "../config/config"
|
|
13
13
|
import { Log } from "../util/log"
|
|
14
|
-
import { NamedError } from "
|
|
14
|
+
import { NamedError } from "@/util/error"
|
|
15
15
|
import z from "zod/v4"
|
|
16
16
|
import { Instance } from "../project/instance"
|
|
17
17
|
import { Installation } from "../installation"
|
package/src/project/project.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { Log } from "../util/log"
|
|
|
8
8
|
import { Flag } from "@/flag/flag"
|
|
9
9
|
import { Session } from "../session"
|
|
10
10
|
import { work } from "../util/queue"
|
|
11
|
-
import { fn } from "
|
|
11
|
+
import { fn } from "@/util/fn"
|
|
12
12
|
import { BusEvent } from "@/bus/bus-event"
|
|
13
13
|
import { iife } from "@/util/iife"
|
|
14
14
|
import { GlobalBus } from "@/bus/global"
|
package/src/provider/auth.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { map, filter, pipe, fromEntries, mapValues } from "remeda"
|
|
|
4
4
|
import z from "zod"
|
|
5
5
|
import { fn } from "@/util/fn"
|
|
6
6
|
import type { AuthOuathResult, Hooks } from "@opencode-ai/plugin"
|
|
7
|
-
import { NamedError } from "
|
|
7
|
+
import { NamedError } from "@/util/error"
|
|
8
8
|
import { Auth } from "@/auth"
|
|
9
9
|
|
|
10
10
|
export namespace ProviderAuth {
|
package/src/provider/provider.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { Config } from "../config/config"
|
|
|
3
3
|
import { mapValues, mergeDeep } from "remeda"
|
|
4
4
|
import { NoSuchModelError, type Provider as SDK } from "ai"
|
|
5
5
|
import { Log } from "../util/log"
|
|
6
|
-
import { NamedError } from "
|
|
6
|
+
import { NamedError } from "@/util/error"
|
|
7
7
|
import { Env } from "../env"
|
|
8
8
|
import { Instance } from "../project/instance"
|
|
9
9
|
import { createOpenAICompatible } from "@ai-sdk/openai-compatible"
|
package/src/pty/index.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { Identifier } from "../id/id"
|
|
|
6
6
|
import { Log } from "../util/log"
|
|
7
7
|
import type { WSContext } from "hono/ws"
|
|
8
8
|
import { Instance } from "../project/instance"
|
|
9
|
-
import { lazy } from "
|
|
9
|
+
import { lazy } from "@/util/lazy"
|
|
10
10
|
import { Shell } from "@/shell/shell"
|
|
11
11
|
|
|
12
12
|
export namespace Pty {
|
package/src/server/server.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { Session } from "../session"
|
|
|
11
11
|
import z from "zod"
|
|
12
12
|
import { Provider } from "../provider/provider"
|
|
13
13
|
import { filter, mapValues, sortBy, pipe } from "remeda"
|
|
14
|
-
import { NamedError } from "
|
|
14
|
+
import { NamedError } from "@/util/error"
|
|
15
15
|
import { ModelsDev } from "../provider/models"
|
|
16
16
|
import { Ripgrep } from "../file/ripgrep"
|
|
17
17
|
import { Config } from "../config/config"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BusEvent } from "@/bus/bus-event"
|
|
2
2
|
import z from "zod"
|
|
3
|
-
import { NamedError } from "
|
|
3
|
+
import { NamedError } from "@/util/error"
|
|
4
4
|
import { APICallError, convertToModelMessages, LoadAPIKeyError, type ModelMessage, type UIMessage } from "ai"
|
|
5
5
|
import { Identifier } from "../id/id"
|
|
6
6
|
import { LSP } from "../lsp"
|
package/src/session/message.ts
CHANGED
package/src/session/prompt.ts
CHANGED
|
@@ -34,7 +34,7 @@ import { Command } from "../command"
|
|
|
34
34
|
import { $, fileURLToPath } from "bun"
|
|
35
35
|
import { ConfigMarkdown } from "../config/markdown"
|
|
36
36
|
import { SessionSummary } from "./summary"
|
|
37
|
-
import { NamedError } from "
|
|
37
|
+
import { NamedError } from "@/util/error"
|
|
38
38
|
import { fn } from "@/util/fn"
|
|
39
39
|
import { SessionProcessor } from "./processor"
|
|
40
40
|
import { TaskTool } from "@/tool/task"
|
package/src/session/retry.ts
CHANGED
package/src/skill/skill.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import z from "zod"
|
|
2
2
|
import { Config } from "../config/config"
|
|
3
3
|
import { Instance } from "../project/instance"
|
|
4
|
-
import { NamedError } from "
|
|
4
|
+
import { NamedError } from "@/util/error"
|
|
5
5
|
import { ConfigMarkdown } from "../config/markdown"
|
|
6
6
|
import { Log } from "../util/log"
|
|
7
7
|
import { Global } from "@/global"
|
package/src/storage/storage.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { Global } from "../global"
|
|
|
5
5
|
import { lazy } from "../util/lazy"
|
|
6
6
|
import { Lock } from "../util/lock"
|
|
7
7
|
import { $ } from "bun"
|
|
8
|
-
import { NamedError } from "
|
|
8
|
+
import { NamedError } from "@/util/error"
|
|
9
9
|
import z from "zod"
|
|
10
10
|
|
|
11
11
|
export namespace Storage {
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export namespace Binary {
|
|
2
|
+
export function search<T>(array: T[], id: string, compare: (item: T) => string): { found: boolean; index: number } {
|
|
3
|
+
let left = 0
|
|
4
|
+
let right = array.length - 1
|
|
5
|
+
|
|
6
|
+
while (left <= right) {
|
|
7
|
+
const mid = Math.floor((left + right) / 2)
|
|
8
|
+
const midId = compare(array[mid])
|
|
9
|
+
|
|
10
|
+
if (midId === id) {
|
|
11
|
+
return { found: true, index: mid }
|
|
12
|
+
} else if (midId < id) {
|
|
13
|
+
left = mid + 1
|
|
14
|
+
} else {
|
|
15
|
+
right = mid - 1
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return { found: false, index: left }
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function insert<T>(array: T[], item: T, compare: (item: T) => string): T[] {
|
|
23
|
+
const id = compare(item)
|
|
24
|
+
let left = 0
|
|
25
|
+
let right = array.length
|
|
26
|
+
|
|
27
|
+
while (left < right) {
|
|
28
|
+
const mid = Math.floor((left + right) / 2)
|
|
29
|
+
const midId = compare(array[mid])
|
|
30
|
+
|
|
31
|
+
if (midId < id) {
|
|
32
|
+
left = mid + 1
|
|
33
|
+
} else {
|
|
34
|
+
right = mid
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
array.splice(left, 0, item)
|
|
39
|
+
return array
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import z from "zod"
|
|
2
|
+
|
|
3
|
+
export abstract class NamedError extends Error {
|
|
4
|
+
abstract schema(): z.core.$ZodType
|
|
5
|
+
abstract toObject(): { name: string; data: any }
|
|
6
|
+
|
|
7
|
+
static create<Name extends string, Data extends z.core.$ZodType>(name: Name, data: Data) {
|
|
8
|
+
const schema = z
|
|
9
|
+
.object({
|
|
10
|
+
name: z.literal(name),
|
|
11
|
+
data,
|
|
12
|
+
})
|
|
13
|
+
.meta({
|
|
14
|
+
ref: name,
|
|
15
|
+
})
|
|
16
|
+
const result = class extends NamedError {
|
|
17
|
+
public static readonly Schema = schema
|
|
18
|
+
|
|
19
|
+
public override readonly name = name as Name
|
|
20
|
+
|
|
21
|
+
constructor(
|
|
22
|
+
public readonly data: z.input<Data>,
|
|
23
|
+
options?: ErrorOptions,
|
|
24
|
+
) {
|
|
25
|
+
super(name, options)
|
|
26
|
+
this.name = name
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
static isInstance(input: any): input is InstanceType<typeof result> {
|
|
30
|
+
return typeof input === "object" && "name" in input && input.name === name
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
schema() {
|
|
34
|
+
return schema
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
toObject() {
|
|
38
|
+
return {
|
|
39
|
+
name: name,
|
|
40
|
+
data: this.data,
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
Object.defineProperty(result, "name", { value: name })
|
|
45
|
+
return result
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public static readonly Unknown = NamedError.create(
|
|
49
|
+
"UnknownError",
|
|
50
|
+
z.object({
|
|
51
|
+
message: z.string(),
|
|
52
|
+
}),
|
|
53
|
+
)
|
|
54
|
+
}
|
package/src/worktree/index.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { $ } from "bun"
|
|
|
2
2
|
import fs from "fs/promises"
|
|
3
3
|
import path from "path"
|
|
4
4
|
import z from "zod"
|
|
5
|
-
import { NamedError } from "
|
|
5
|
+
import { NamedError } from "@/util/error"
|
|
6
6
|
import { Global } from "../global"
|
|
7
7
|
import { Instance } from "../project/instance"
|
|
8
8
|
import { Project } from "../project/project"
|