btca 0.1.4 → 0.2.1
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/README.md +127 -5
- package/dist/btca-darwin-arm64 +0 -0
- package/dist/btca-darwin-x64 +0 -0
- package/dist/btca-linux-arm64 +0 -0
- package/dist/btca-linux-x64 +0 -0
- package/dist/index.js +339 -130
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,15 +1,137 @@
|
|
|
1
|
-
#
|
|
1
|
+
# btca
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A CLI tool for asking questions about technologies using their source code repositories.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
4
6
|
|
|
5
7
|
```bash
|
|
6
8
|
bun install
|
|
7
9
|
```
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
bun run src/index.ts
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Or after building:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
btca <command>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Commands
|
|
24
|
+
|
|
25
|
+
### `btca`
|
|
26
|
+
|
|
27
|
+
Show version information.
|
|
28
|
+
|
|
29
|
+
### `btca ask`
|
|
30
|
+
|
|
31
|
+
Ask a question about a technology.
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
btca ask -t <tech> -q <question>
|
|
35
|
+
btca ask --tech svelte --question "How do I create a reactive store?"
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Options:
|
|
39
|
+
- `-t, --tech` - The technology/repo to query
|
|
40
|
+
- `-q, --question` - The question to ask
|
|
41
|
+
|
|
42
|
+
### `btca chat`
|
|
43
|
+
|
|
44
|
+
Start an interactive TUI chat session.
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
btca chat -t <tech>
|
|
48
|
+
btca chat --tech nextjs
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Options:
|
|
52
|
+
- `-t, --tech` - The technology/repo to chat about
|
|
53
|
+
|
|
54
|
+
### `btca serve`
|
|
55
|
+
|
|
56
|
+
Start an HTTP server to answer questions via API.
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
btca serve
|
|
60
|
+
btca serve -p 3000
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Options:
|
|
64
|
+
- `-p, --port` - Port to listen on (default: 8080)
|
|
65
|
+
|
|
66
|
+
Endpoint:
|
|
67
|
+
- `POST /question` - Send `{ "tech": "svelte", "question": "..." }` to get answers
|
|
68
|
+
|
|
69
|
+
### `btca open`
|
|
70
|
+
|
|
71
|
+
Hold an OpenCode instance in the background for faster subsequent queries.
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
btca open
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### `btca config`
|
|
78
|
+
|
|
79
|
+
Manage CLI configuration. Shows the config file path when run without subcommands.
|
|
10
80
|
|
|
11
81
|
```bash
|
|
12
|
-
|
|
82
|
+
btca config
|
|
13
83
|
```
|
|
14
84
|
|
|
15
|
-
|
|
85
|
+
#### `btca config model`
|
|
86
|
+
|
|
87
|
+
View or set the model and provider.
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
# View current model/provider
|
|
91
|
+
btca config model
|
|
92
|
+
|
|
93
|
+
# Set model and provider
|
|
94
|
+
btca config model -p <provider> -m <model>
|
|
95
|
+
btca config model --provider anthropic --model claude-3-opus
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Options:
|
|
99
|
+
- `-p, --provider` - The provider to use
|
|
100
|
+
- `-m, --model` - The model to use
|
|
101
|
+
|
|
102
|
+
Both options must be specified together when updating.
|
|
103
|
+
|
|
104
|
+
#### `btca config repos list`
|
|
105
|
+
|
|
106
|
+
List all configured repositories.
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
btca config repos list
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
#### `btca config repos add`
|
|
113
|
+
|
|
114
|
+
Add a new repository to the configuration.
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
btca config repos add -n <name> -u <url> [-b <branch>] [--notes <notes>]
|
|
118
|
+
btca config repos add --name react --url https://github.com/facebook/react --branch main
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Options:
|
|
122
|
+
- `-n, --name` - Unique name for the repo (required)
|
|
123
|
+
- `-u, --url` - Git repository URL (required)
|
|
124
|
+
- `-b, --branch` - Branch to use (default: "main")
|
|
125
|
+
- `--notes` - Special instructions for the AI when using this repo
|
|
126
|
+
|
|
127
|
+
## Configuration
|
|
128
|
+
|
|
129
|
+
Configuration is stored at `~/.config/btca/btca.json`. The config file includes:
|
|
130
|
+
|
|
131
|
+
- `promptsDirectory` - Directory for system prompts
|
|
132
|
+
- `reposDirectory` - Directory where repos are cloned
|
|
133
|
+
- `port` - Default server port
|
|
134
|
+
- `maxInstances` - Maximum concurrent OpenCode instances
|
|
135
|
+
- `repos` - Array of configured repositories
|
|
136
|
+
- `model` - AI model to use
|
|
137
|
+
- `provider` - AI provider to use
|
package/dist/btca-darwin-arm64
CHANGED
|
Binary file
|
package/dist/btca-darwin-x64
CHANGED
|
Binary file
|
package/dist/btca-linux-arm64
CHANGED
|
Binary file
|
package/dist/btca-linux-x64
CHANGED
|
Binary file
|
package/dist/index.js
CHANGED
|
@@ -45041,6 +45041,28 @@ class ResponseError extends (/* @__PURE__ */ TypeIdError(TypeId23, "ResponseErro
|
|
|
45041
45041
|
}
|
|
45042
45042
|
}
|
|
45043
45043
|
|
|
45044
|
+
// ../../node_modules/.bun/@effect+platform@0.93.5+98f5f49933c9d4f7/node_modules/@effect/platform/dist/esm/FileSystem.js
|
|
45045
|
+
var exports_FileSystem = {};
|
|
45046
|
+
__export(exports_FileSystem, {
|
|
45047
|
+
makeNoop: () => makeNoop2,
|
|
45048
|
+
make: () => make62,
|
|
45049
|
+
layerNoop: () => layerNoop2,
|
|
45050
|
+
isFile: () => isFile,
|
|
45051
|
+
WatchEventUpdate: () => WatchEventUpdate,
|
|
45052
|
+
WatchEventRemove: () => WatchEventRemove,
|
|
45053
|
+
WatchEventCreate: () => WatchEventCreate,
|
|
45054
|
+
WatchBackend: () => WatchBackend,
|
|
45055
|
+
TiB: () => TiB2,
|
|
45056
|
+
Size: () => Size2,
|
|
45057
|
+
PiB: () => PiB2,
|
|
45058
|
+
MiB: () => MiB2,
|
|
45059
|
+
KiB: () => KiB2,
|
|
45060
|
+
GiB: () => GiB2,
|
|
45061
|
+
FileTypeId: () => FileTypeId,
|
|
45062
|
+
FileSystem: () => FileSystem,
|
|
45063
|
+
FileDescriptor: () => FileDescriptor
|
|
45064
|
+
});
|
|
45065
|
+
|
|
45044
45066
|
// ../../node_modules/.bun/effect@3.19.8/node_modules/effect/dist/esm/Brand.js
|
|
45045
45067
|
var RefinedConstructorsTypeId = /* @__PURE__ */ Symbol.for("effect/Brand/Refined");
|
|
45046
45068
|
var nominal = () => {
|
|
@@ -45082,8 +45104,13 @@ var unwrapScoped8 = unwrapScoped4;
|
|
|
45082
45104
|
// ../../node_modules/.bun/@effect+platform@0.93.5+98f5f49933c9d4f7/node_modules/@effect/platform/dist/esm/internal/fileSystem.js
|
|
45083
45105
|
var tag2 = /* @__PURE__ */ GenericTag("@effect/platform/FileSystem");
|
|
45084
45106
|
var Size = (bytes) => typeof bytes === "bigint" ? bytes : BigInt(bytes);
|
|
45107
|
+
var KiB = (n) => Size(n * 1024);
|
|
45108
|
+
var MiB = (n) => Size(n * 1024 * 1024);
|
|
45109
|
+
var GiB = (n) => Size(n * 1024 * 1024 * 1024);
|
|
45110
|
+
var TiB = (n) => Size(n * 1024 * 1024 * 1024 * 1024);
|
|
45085
45111
|
var bigint1024 = /* @__PURE__ */ BigInt(1024);
|
|
45086
45112
|
var bigintPiB = bigint1024 * bigint1024 * bigint1024 * bigint1024 * bigint1024;
|
|
45113
|
+
var PiB = (n) => Size(BigInt(n) * bigintPiB);
|
|
45087
45114
|
var make61 = (impl) => {
|
|
45088
45115
|
return tag2.of({
|
|
45089
45116
|
...impl,
|
|
@@ -45239,9 +45266,17 @@ var stream2 = (file, {
|
|
|
45239
45266
|
|
|
45240
45267
|
// ../../node_modules/.bun/@effect+platform@0.93.5+98f5f49933c9d4f7/node_modules/@effect/platform/dist/esm/FileSystem.js
|
|
45241
45268
|
var Size2 = Size;
|
|
45269
|
+
var KiB2 = KiB;
|
|
45270
|
+
var MiB2 = MiB;
|
|
45271
|
+
var GiB2 = GiB;
|
|
45272
|
+
var TiB2 = TiB;
|
|
45273
|
+
var PiB2 = PiB;
|
|
45242
45274
|
var FileSystem = tag2;
|
|
45243
45275
|
var make62 = make61;
|
|
45276
|
+
var makeNoop2 = makeNoop;
|
|
45277
|
+
var layerNoop2 = layerNoop;
|
|
45244
45278
|
var FileTypeId = /* @__PURE__ */ Symbol.for("@effect/platform/FileSystem/File");
|
|
45279
|
+
var isFile = (u) => typeof u === "object" && u !== null && (FileTypeId in u);
|
|
45245
45280
|
var FileDescriptor = /* @__PURE__ */ nominal();
|
|
45246
45281
|
var WatchEventCreate = /* @__PURE__ */ tagged2("Create");
|
|
45247
45282
|
var WatchEventUpdate = /* @__PURE__ */ tagged2("Update");
|
|
@@ -47404,7 +47439,7 @@ function make70({
|
|
|
47404
47439
|
onField,
|
|
47405
47440
|
onError: onError5,
|
|
47406
47441
|
onDone: onDone3,
|
|
47407
|
-
isFile = defaultIsFile,
|
|
47442
|
+
isFile: isFile2 = defaultIsFile,
|
|
47408
47443
|
maxParts = Infinity,
|
|
47409
47444
|
maxTotalSize = Infinity,
|
|
47410
47445
|
maxPartSize = Infinity,
|
|
@@ -47515,7 +47550,7 @@ function make70({
|
|
|
47515
47550
|
headers: result.headers
|
|
47516
47551
|
};
|
|
47517
47552
|
state.state = State2.body;
|
|
47518
|
-
state.isFile =
|
|
47553
|
+
state.isFile = isFile2(state.info);
|
|
47519
47554
|
if (state.isFile) {
|
|
47520
47555
|
state.onChunk = onPart(state.info);
|
|
47521
47556
|
}
|
|
@@ -47583,6 +47618,14 @@ var make71 = make70;
|
|
|
47583
47618
|
var defaultIsFile2 = defaultIsFile;
|
|
47584
47619
|
var decodeField2 = decodeField;
|
|
47585
47620
|
|
|
47621
|
+
// ../../node_modules/.bun/@effect+platform@0.93.5+98f5f49933c9d4f7/node_modules/@effect/platform/dist/esm/Path.js
|
|
47622
|
+
var exports_Path = {};
|
|
47623
|
+
__export(exports_Path, {
|
|
47624
|
+
layer: () => layer2,
|
|
47625
|
+
TypeId: () => TypeId36,
|
|
47626
|
+
Path: () => Path2
|
|
47627
|
+
});
|
|
47628
|
+
|
|
47586
47629
|
// ../../node_modules/.bun/@effect+platform@0.93.5+98f5f49933c9d4f7/node_modules/@effect/platform/dist/esm/internal/path.js
|
|
47587
47630
|
var TypeId35 = /* @__PURE__ */ Symbol.for("@effect/platform/Path");
|
|
47588
47631
|
var Path = /* @__PURE__ */ GenericTag("@effect/platform/Path");
|
|
@@ -48071,6 +48114,7 @@ var layer = /* @__PURE__ */ succeed9(Path, posixImpl);
|
|
|
48071
48114
|
// ../../node_modules/.bun/@effect+platform@0.93.5+98f5f49933c9d4f7/node_modules/@effect/platform/dist/esm/Path.js
|
|
48072
48115
|
var TypeId36 = TypeId35;
|
|
48073
48116
|
var Path2 = Path;
|
|
48117
|
+
var layer2 = layer;
|
|
48074
48118
|
|
|
48075
48119
|
// ../../node_modules/.bun/@effect+platform@0.93.5+98f5f49933c9d4f7/node_modules/@effect/platform/dist/esm/Multipart.js
|
|
48076
48120
|
var TypeId37 = /* @__PURE__ */ Symbol.for("@effect/platform/Multipart");
|
|
@@ -49691,7 +49735,7 @@ var fromFileInfo = (info) => {
|
|
|
49691
49735
|
var fromFileWeb = (file4) => {
|
|
49692
49736
|
return `${file4.size.toString(16)}-${file4.lastModified.toString(16)}`;
|
|
49693
49737
|
};
|
|
49694
|
-
var
|
|
49738
|
+
var layer3 = /* @__PURE__ */ succeed9(tag4, /* @__PURE__ */ tag4.of({
|
|
49695
49739
|
[GeneratorTypeId]: GeneratorTypeId,
|
|
49696
49740
|
fromFileInfo(info) {
|
|
49697
49741
|
return sync4(() => ({
|
|
@@ -49725,7 +49769,7 @@ var layerWeak = /* @__PURE__ */ succeed9(tag4, /* @__PURE__ */ tag4.of({
|
|
|
49725
49769
|
// ../../node_modules/.bun/@effect+platform@0.93.5+98f5f49933c9d4f7/node_modules/@effect/platform/dist/esm/Etag.js
|
|
49726
49770
|
var toString3 = toString2;
|
|
49727
49771
|
var Generator = tag4;
|
|
49728
|
-
var
|
|
49772
|
+
var layer4 = layer3;
|
|
49729
49773
|
var layerWeak2 = layerWeak;
|
|
49730
49774
|
|
|
49731
49775
|
// ../../node_modules/.bun/@effect+platform@0.93.5+98f5f49933c9d4f7/node_modules/@effect/platform/dist/esm/internal/httpPlatform.js
|
|
@@ -49764,7 +49808,7 @@ var make76 = (impl) => gen2(function* () {
|
|
|
49764
49808
|
}
|
|
49765
49809
|
});
|
|
49766
49810
|
});
|
|
49767
|
-
var
|
|
49811
|
+
var layer5 = /* @__PURE__ */ effect(tag5, flatMap13(FileSystem, (fs) => make76({
|
|
49768
49812
|
fileResponse(path, status2, statusText, headers, start3, end6, contentLength) {
|
|
49769
49813
|
return stream5(fs.stream(path, {
|
|
49770
49814
|
offset: start3,
|
|
@@ -49805,7 +49849,7 @@ var formatAddress = (address) => {
|
|
|
49805
49849
|
var addressWith = (effect4) => flatMap13(serverTag, (server) => effect4(server.address));
|
|
49806
49850
|
var addressFormattedWith = (effect4) => flatMap13(serverTag, (server) => effect4(formatAddress(server.address)));
|
|
49807
49851
|
var logAddress = /* @__PURE__ */ addressFormattedWith((_) => log3(`Listening on ${_}`));
|
|
49808
|
-
var withLogAddress = (
|
|
49852
|
+
var withLogAddress = (layer6) => effectDiscard(logAddress).pipe(provideMerge2(layer6));
|
|
49809
49853
|
var makeTestClient = /* @__PURE__ */ addressWith((address) => flatMap13(HttpClient, (client) => {
|
|
49810
49854
|
if (address._tag === "UnixAddress") {
|
|
49811
49855
|
return die7(new Error("HttpServer.layerTestClient: UnixAddress not supported"));
|
|
@@ -49815,7 +49859,7 @@ var makeTestClient = /* @__PURE__ */ addressWith((address) => flatMap13(HttpClie
|
|
|
49815
49859
|
return succeed8(mapRequest2(client, prependUrl2(url2)));
|
|
49816
49860
|
}));
|
|
49817
49861
|
var layerTestClient = /* @__PURE__ */ effect(HttpClient, makeTestClient);
|
|
49818
|
-
var layerContext = /* @__PURE__ */ mergeAll6(
|
|
49862
|
+
var layerContext = /* @__PURE__ */ mergeAll6(layer5, layer, layerWeak).pipe(/* @__PURE__ */ provideMerge2(/* @__PURE__ */ layerNoop({})));
|
|
49819
49863
|
|
|
49820
49864
|
// ../../node_modules/.bun/@effect+platform@0.93.5+98f5f49933c9d4f7/node_modules/@effect/platform/dist/esm/HttpServer.js
|
|
49821
49865
|
var TypeId44 = TypeId43;
|
|
@@ -50434,12 +50478,12 @@ var fetch2 = /* @__PURE__ */ make64((request2, url2, signal, fiber) => {
|
|
|
50434
50478
|
}
|
|
50435
50479
|
return send(undefined);
|
|
50436
50480
|
});
|
|
50437
|
-
var
|
|
50481
|
+
var layer6 = /* @__PURE__ */ layerMergedContext(/* @__PURE__ */ succeed8(fetch2));
|
|
50438
50482
|
|
|
50439
50483
|
// ../../node_modules/.bun/@effect+platform@0.93.5+98f5f49933c9d4f7/node_modules/@effect/platform/dist/esm/FetchHttpClient.js
|
|
50440
50484
|
class RequestInit extends (/* @__PURE__ */ Tag2(requestInitTagKey)()) {
|
|
50441
50485
|
}
|
|
50442
|
-
var
|
|
50486
|
+
var layer7 = layer6;
|
|
50443
50487
|
|
|
50444
50488
|
// ../../node_modules/.bun/@effect+platform-bun@0.85.0+14ebd8287bc0fbbb/node_modules/@effect/platform-bun/dist/esm/BunHttpServer.js
|
|
50445
50489
|
var exports_BunHttpServer = {};
|
|
@@ -50449,13 +50493,13 @@ __export(exports_BunHttpServer, {
|
|
|
50449
50493
|
layerServer: () => layerServer2,
|
|
50450
50494
|
layerContext: () => layerContext4,
|
|
50451
50495
|
layerConfig: () => layerConfig2,
|
|
50452
|
-
layer: () =>
|
|
50496
|
+
layer: () => layer25
|
|
50453
50497
|
});
|
|
50454
50498
|
|
|
50455
50499
|
// ../../node_modules/.bun/@effect+platform-bun@0.85.0+14ebd8287bc0fbbb/node_modules/@effect/platform-bun/dist/esm/BunContext.js
|
|
50456
50500
|
var exports_BunContext = {};
|
|
50457
50501
|
__export(exports_BunContext, {
|
|
50458
|
-
layer: () =>
|
|
50502
|
+
layer: () => layer21
|
|
50459
50503
|
});
|
|
50460
50504
|
|
|
50461
50505
|
// ../../node_modules/.bun/@effect+platform@0.93.5+98f5f49933c9d4f7/node_modules/@effect/platform/dist/esm/internal/commandExecutor.js
|
|
@@ -50830,13 +50874,13 @@ var runCommand = (fileSystem) => (command) => {
|
|
|
50830
50874
|
}
|
|
50831
50875
|
}
|
|
50832
50876
|
};
|
|
50833
|
-
var
|
|
50877
|
+
var layer8 = /* @__PURE__ */ effect(CommandExecutor2, /* @__PURE__ */ pipe(FileSystem, /* @__PURE__ */ map17((fileSystem) => makeExecutor2(runCommand(fileSystem)))));
|
|
50834
50878
|
|
|
50835
50879
|
// ../../node_modules/.bun/@effect+platform-node-shared@0.55.0+14ebd8287bc0fbbb/node_modules/@effect/platform-node-shared/dist/esm/NodeCommandExecutor.js
|
|
50836
|
-
var
|
|
50880
|
+
var layer9 = layer8;
|
|
50837
50881
|
|
|
50838
50882
|
// ../../node_modules/.bun/@effect+platform-bun@0.85.0+14ebd8287bc0fbbb/node_modules/@effect/platform-bun/dist/esm/BunCommandExecutor.js
|
|
50839
|
-
var
|
|
50883
|
+
var layer10 = layer9;
|
|
50840
50884
|
|
|
50841
50885
|
// ../../node_modules/.bun/@effect+platform@0.93.5+98f5f49933c9d4f7/node_modules/@effect/platform/dist/esm/internal/effectify.js
|
|
50842
50886
|
var effectify = (fn2, onError5, onSyncError) => (...args2) => async((resume2) => {
|
|
@@ -51214,13 +51258,13 @@ var makeFileSystem = /* @__PURE__ */ map17(/* @__PURE__ */ serviceOption2(WatchB
|
|
|
51214
51258
|
},
|
|
51215
51259
|
writeFile: writeFile2
|
|
51216
51260
|
}));
|
|
51217
|
-
var
|
|
51261
|
+
var layer11 = /* @__PURE__ */ effect(FileSystem, makeFileSystem);
|
|
51218
51262
|
|
|
51219
51263
|
// ../../node_modules/.bun/@effect+platform-node-shared@0.55.0+14ebd8287bc0fbbb/node_modules/@effect/platform-node-shared/dist/esm/NodeFileSystem.js
|
|
51220
|
-
var
|
|
51264
|
+
var layer12 = layer11;
|
|
51221
51265
|
|
|
51222
51266
|
// ../../node_modules/.bun/@effect+platform-bun@0.85.0+14ebd8287bc0fbbb/node_modules/@effect/platform-bun/dist/esm/BunFileSystem.js
|
|
51223
|
-
var
|
|
51267
|
+
var layer13 = layer12;
|
|
51224
51268
|
|
|
51225
51269
|
// ../../node_modules/.bun/@effect+platform-node-shared@0.55.0+14ebd8287bc0fbbb/node_modules/@effect/platform-node-shared/dist/esm/internal/path.js
|
|
51226
51270
|
import * as NodePath from "path";
|
|
@@ -51255,7 +51299,7 @@ var layerWin32 = /* @__PURE__ */ succeed9(Path2, /* @__PURE__ */ Path2.of({
|
|
|
51255
51299
|
fromFileUrl: fromFileUrl2,
|
|
51256
51300
|
toFileUrl: toFileUrl2
|
|
51257
51301
|
}));
|
|
51258
|
-
var
|
|
51302
|
+
var layer14 = /* @__PURE__ */ succeed9(Path2, /* @__PURE__ */ Path2.of({
|
|
51259
51303
|
[TypeId36]: TypeId36,
|
|
51260
51304
|
...NodePath,
|
|
51261
51305
|
fromFileUrl: fromFileUrl2,
|
|
@@ -51263,10 +51307,10 @@ var layer13 = /* @__PURE__ */ succeed9(Path2, /* @__PURE__ */ Path2.of({
|
|
|
51263
51307
|
}));
|
|
51264
51308
|
|
|
51265
51309
|
// ../../node_modules/.bun/@effect+platform-node-shared@0.55.0+14ebd8287bc0fbbb/node_modules/@effect/platform-node-shared/dist/esm/NodePath.js
|
|
51266
|
-
var
|
|
51310
|
+
var layer15 = layer14;
|
|
51267
51311
|
|
|
51268
51312
|
// ../../node_modules/.bun/@effect+platform-bun@0.85.0+14ebd8287bc0fbbb/node_modules/@effect/platform-bun/dist/esm/BunPath.js
|
|
51269
|
-
var
|
|
51313
|
+
var layer16 = layer15;
|
|
51270
51314
|
|
|
51271
51315
|
// ../../node_modules/.bun/@effect+platform@0.93.5+98f5f49933c9d4f7/node_modules/@effect/platform/dist/esm/internal/terminal.js
|
|
51272
51316
|
var tag6 = /* @__PURE__ */ GenericTag("@effect/platform/Terminal");
|
|
@@ -51344,13 +51388,13 @@ var make80 = /* @__PURE__ */ fnUntraced2(function* (shouldQuit = defaultShouldQu
|
|
|
51344
51388
|
display
|
|
51345
51389
|
});
|
|
51346
51390
|
});
|
|
51347
|
-
var
|
|
51391
|
+
var layer17 = /* @__PURE__ */ scoped3(Terminal, /* @__PURE__ */ make80(defaultShouldQuit));
|
|
51348
51392
|
|
|
51349
51393
|
// ../../node_modules/.bun/@effect+platform-node-shared@0.55.0+14ebd8287bc0fbbb/node_modules/@effect/platform-node-shared/dist/esm/NodeTerminal.js
|
|
51350
|
-
var
|
|
51394
|
+
var layer18 = layer17;
|
|
51351
51395
|
|
|
51352
51396
|
// ../../node_modules/.bun/@effect+platform-bun@0.85.0+14ebd8287bc0fbbb/node_modules/@effect/platform-bun/dist/esm/BunTerminal.js
|
|
51353
|
-
var
|
|
51397
|
+
var layer19 = layer18;
|
|
51354
51398
|
|
|
51355
51399
|
// ../../node_modules/.bun/@effect+platform-bun@0.85.0+14ebd8287bc0fbbb/node_modules/@effect/platform-bun/dist/esm/internal/worker.js
|
|
51356
51400
|
var platformWorkerImpl = /* @__PURE__ */ makePlatform2()({
|
|
@@ -51398,7 +51442,7 @@ var layerManager3 = /* @__PURE__ */ provide3(layerManager2, layerWorker);
|
|
|
51398
51442
|
var layerManager4 = layerManager3;
|
|
51399
51443
|
|
|
51400
51444
|
// ../../node_modules/.bun/@effect+platform-bun@0.85.0+14ebd8287bc0fbbb/node_modules/@effect/platform-bun/dist/esm/BunContext.js
|
|
51401
|
-
var
|
|
51445
|
+
var layer21 = /* @__PURE__ */ pipe(/* @__PURE__ */ mergeAll6(layer16, layer10, layer19, layerManager4), /* @__PURE__ */ provideMerge2(layer13));
|
|
51402
51446
|
|
|
51403
51447
|
// ../../node_modules/.bun/@effect+platform@0.93.5+98f5f49933c9d4f7/node_modules/@effect/platform/dist/esm/HttpPlatform.js
|
|
51404
51448
|
var HttpPlatform = tag5;
|
|
@@ -51425,10 +51469,10 @@ var make83 = /* @__PURE__ */ make82({
|
|
|
51425
51469
|
});
|
|
51426
51470
|
}
|
|
51427
51471
|
});
|
|
51428
|
-
var
|
|
51472
|
+
var layer22 = /* @__PURE__ */ effect(HttpPlatform, make83).pipe(/* @__PURE__ */ provide3(layer12), /* @__PURE__ */ provide3(layer4));
|
|
51429
51473
|
|
|
51430
51474
|
// ../../node_modules/.bun/@effect+platform-bun@0.85.0+14ebd8287bc0fbbb/node_modules/@effect/platform-bun/dist/esm/BunHttpPlatform.js
|
|
51431
|
-
var
|
|
51475
|
+
var layer23 = layer22;
|
|
51432
51476
|
|
|
51433
51477
|
// ../../node_modules/.bun/multipasta@0.2.7/node_modules/multipasta/dist/esm/web.js
|
|
51434
51478
|
var make84 = (config2) => {
|
|
@@ -51788,11 +51832,11 @@ var makeResponse = (request2, response, runtime6) => {
|
|
|
51788
51832
|
}
|
|
51789
51833
|
};
|
|
51790
51834
|
var layerServer = (options5) => scoped3(HttpServer, make85(options5));
|
|
51791
|
-
var layerContext3 = /* @__PURE__ */ mergeAll6(
|
|
51792
|
-
var
|
|
51793
|
-
var layerTest = /* @__PURE__ */ layerTestClient2.pipe(/* @__PURE__ */ provide3(/* @__PURE__ */
|
|
51835
|
+
var layerContext3 = /* @__PURE__ */ mergeAll6(layer23, layerWeak2, layer21);
|
|
51836
|
+
var layer24 = (options5) => mergeAll6(scoped3(HttpServer, make85(options5)), layerContext3);
|
|
51837
|
+
var layerTest = /* @__PURE__ */ layerTestClient2.pipe(/* @__PURE__ */ provide3(/* @__PURE__ */ layer7.pipe(/* @__PURE__ */ provide3(/* @__PURE__ */ succeed9(RequestInit, {
|
|
51794
51838
|
keepalive: false
|
|
51795
|
-
})))), /* @__PURE__ */ provideMerge2(/* @__PURE__ */
|
|
51839
|
+
})))), /* @__PURE__ */ provideMerge2(/* @__PURE__ */ layer24({
|
|
51796
51840
|
port: 0
|
|
51797
51841
|
})));
|
|
51798
51842
|
var layerConfig = (options5) => mergeAll6(scoped3(HttpServer, flatMap13(unwrap5(options5), make85)), layerContext3);
|
|
@@ -51994,7 +52038,7 @@ var removeHost2 = (url2) => {
|
|
|
51994
52038
|
// ../../node_modules/.bun/@effect+platform-bun@0.85.0+14ebd8287bc0fbbb/node_modules/@effect/platform-bun/dist/esm/BunHttpServer.js
|
|
51995
52039
|
var make86 = make85;
|
|
51996
52040
|
var layerServer2 = layerServer;
|
|
51997
|
-
var
|
|
52041
|
+
var layer25 = layer24;
|
|
51998
52042
|
var layerTest2 = layerTest;
|
|
51999
52043
|
var layerConfig2 = layerConfig;
|
|
52000
52044
|
var layerContext4 = layerContext3;
|
|
@@ -52453,11 +52497,11 @@ var setBold = (bold) => ({
|
|
|
52453
52497
|
_tag: "SetBold",
|
|
52454
52498
|
bold
|
|
52455
52499
|
});
|
|
52456
|
-
var setColor = (color, vivid,
|
|
52500
|
+
var setColor = (color, vivid, layer26) => ({
|
|
52457
52501
|
_tag: "SetColor",
|
|
52458
52502
|
color,
|
|
52459
52503
|
vivid,
|
|
52460
|
-
layer:
|
|
52504
|
+
layer: layer26
|
|
52461
52505
|
});
|
|
52462
52506
|
var setItalicized = (italicized) => ({
|
|
52463
52507
|
_tag: "SetItalicized",
|
|
@@ -58865,8 +58909,8 @@ var withHandler = /* @__PURE__ */ dual(2, (self, handler) => makeDerive(self, {
|
|
|
58865
58909
|
var transformHandler = /* @__PURE__ */ dual(2, (self, f) => makeDerive(self, {
|
|
58866
58910
|
transform: f
|
|
58867
58911
|
}));
|
|
58868
|
-
var provide4 = /* @__PURE__ */ dual(2, (self,
|
|
58869
|
-
transform: (effect4, config2) => provide2(effect4, typeof
|
|
58912
|
+
var provide4 = /* @__PURE__ */ dual(2, (self, layer26) => makeDerive(self, {
|
|
58913
|
+
transform: (effect4, config2) => provide2(effect4, typeof layer26 === "function" ? layer26(config2) : layer26)
|
|
58870
58914
|
}));
|
|
58871
58915
|
var provideEffect = /* @__PURE__ */ dual(3, (self, tag8, effect_) => makeDerive(self, {
|
|
58872
58916
|
transform: (self2, config2) => {
|
|
@@ -60293,9 +60337,6 @@ async function createOpencode(options7) {
|
|
|
60293
60337
|
// src/services/oc.ts
|
|
60294
60338
|
var {spawn: spawn3 } = globalThis.Bun;
|
|
60295
60339
|
|
|
60296
|
-
// src/services/config.ts
|
|
60297
|
-
import * as path3 from "path";
|
|
60298
|
-
|
|
60299
60340
|
// src/lib/prompts.ts
|
|
60300
60341
|
var getDocsAgentPrompt = (args2) => `
|
|
60301
60342
|
You are an expert internal agent who's job is to answer coding questions and provide accurate and up to date info on ${args2.repoName} based on the codebase you have access to. It may be the source code, or it may be the documentation. You are running in the background, and the user cannot ask follow up questions. You must always answer the question based on the codebase you have access to. If the question is not related to the codebase you have access to, you must say so and that you are not able to answer the question.
|
|
@@ -60308,6 +60349,12 @@ This is what you have access to:
|
|
|
60308
60349
|
|
|
60309
60350
|
When asked a question regarding ${args2.repoName}, search the codebase to get an accurate answer.
|
|
60310
60351
|
|
|
60352
|
+
${args2.specialNotes ? `
|
|
60353
|
+
Special notes about the codebase you have access to:
|
|
60354
|
+
|
|
60355
|
+
'${args2.specialNotes}'
|
|
60356
|
+
` : ""}
|
|
60357
|
+
|
|
60311
60358
|
Always search the codebase first before using the web to try to answer the question.
|
|
60312
60359
|
|
|
60313
60360
|
When you are searching the codebase, be very careful that you do not read too much at once. Only read a small amount at a time as you're searching, avoid reading dozens of files at once...
|
|
@@ -60374,17 +60421,25 @@ var pullRepo = (args2) => exports_Effect.tryPromise({
|
|
|
60374
60421
|
});
|
|
60375
60422
|
|
|
60376
60423
|
// src/lib/utils/files.ts
|
|
60377
|
-
|
|
60378
|
-
|
|
60379
|
-
|
|
60380
|
-
|
|
60381
|
-
|
|
60382
|
-
|
|
60383
|
-
|
|
60384
|
-
|
|
60385
|
-
|
|
60386
|
-
|
|
60387
|
-
|
|
60424
|
+
var expandHome = (filePath) => exports_Effect.gen(function* () {
|
|
60425
|
+
const path2 = yield* exports_Path.Path;
|
|
60426
|
+
if (filePath.startsWith("~/")) {
|
|
60427
|
+
const homeDir = Bun.env.HOME ?? Bun.env.USERPROFILE ?? "";
|
|
60428
|
+
return path2.join(homeDir, filePath.slice(2));
|
|
60429
|
+
}
|
|
60430
|
+
return filePath;
|
|
60431
|
+
});
|
|
60432
|
+
var directoryExists = (dir2) => exports_Effect.gen(function* () {
|
|
60433
|
+
const fs = yield* exports_FileSystem.FileSystem;
|
|
60434
|
+
const exists5 = yield* fs.exists(dir2);
|
|
60435
|
+
if (!exists5)
|
|
60436
|
+
return false;
|
|
60437
|
+
const stat3 = yield* fs.stat(dir2);
|
|
60438
|
+
return stat3.type === "Directory";
|
|
60439
|
+
}).pipe(exports_Effect.catchAll((error4) => exports_Effect.fail(new ConfigError({
|
|
60440
|
+
message: "Failed to check directory",
|
|
60441
|
+
cause: error4
|
|
60442
|
+
}))));
|
|
60388
60443
|
|
|
60389
60444
|
// src/services/config.ts
|
|
60390
60445
|
var CONFIG_DIRECTORY = "~/.config/btca";
|
|
@@ -60392,7 +60447,8 @@ var CONFIG_FILENAME = "btca.json";
|
|
|
60392
60447
|
var repoSchema = exports_Schema.Struct({
|
|
60393
60448
|
name: exports_Schema.String,
|
|
60394
60449
|
url: exports_Schema.String,
|
|
60395
|
-
branch: exports_Schema.String
|
|
60450
|
+
branch: exports_Schema.String,
|
|
60451
|
+
specialNotes: exports_Schema.String.pipe(exports_Schema.optional)
|
|
60396
60452
|
});
|
|
60397
60453
|
var configSchema = exports_Schema.Struct({
|
|
60398
60454
|
promptsDirectory: exports_Schema.String,
|
|
@@ -60412,12 +60468,14 @@ var DEFAULT_CONFIG = {
|
|
|
60412
60468
|
{
|
|
60413
60469
|
name: "svelte",
|
|
60414
60470
|
url: "https://github.com/sveltejs/svelte.dev",
|
|
60415
|
-
branch: "main"
|
|
60471
|
+
branch: "main",
|
|
60472
|
+
specialNotes: "This is the svelte docs website repo, not the actual svelte repo. Use the docs to answer questions about svelte."
|
|
60416
60473
|
},
|
|
60417
60474
|
{
|
|
60418
|
-
name: "
|
|
60419
|
-
url: "https://github.com/
|
|
60420
|
-
branch: "main"
|
|
60475
|
+
name: "tailwindcss",
|
|
60476
|
+
url: "https://github.com/tailwindlabs/tailwindcss.com",
|
|
60477
|
+
branch: "main",
|
|
60478
|
+
specialNotes: "This is the tailwindcss docs website repo, not the actual tailwindcss repo. Use the docs to answer questions about tailwindcss."
|
|
60421
60479
|
},
|
|
60422
60480
|
{
|
|
60423
60481
|
name: "nextjs",
|
|
@@ -60428,91 +60486,128 @@ var DEFAULT_CONFIG = {
|
|
|
60428
60486
|
model: "big-pickle",
|
|
60429
60487
|
provider: "opencode"
|
|
60430
60488
|
};
|
|
60431
|
-
var
|
|
60432
|
-
|
|
60433
|
-
|
|
60434
|
-
|
|
60435
|
-
|
|
60436
|
-
|
|
60437
|
-
|
|
60438
|
-
|
|
60439
|
-
|
|
60440
|
-
|
|
60441
|
-
|
|
60442
|
-
|
|
60443
|
-
|
|
60444
|
-
|
|
60445
|
-
|
|
60446
|
-
|
|
60447
|
-
|
|
60448
|
-
|
|
60449
|
-
|
|
60450
|
-
|
|
60451
|
-
|
|
60452
|
-
|
|
60453
|
-
|
|
60454
|
-
|
|
60455
|
-
|
|
60456
|
-
|
|
60457
|
-
|
|
60458
|
-
|
|
60459
|
-
|
|
60460
|
-
|
|
60489
|
+
var collapseHome = (path2) => {
|
|
60490
|
+
const home = process.env.HOME ?? process.env.USERPROFILE ?? "";
|
|
60491
|
+
if (home && path2.startsWith(home)) {
|
|
60492
|
+
return "~" + path2.slice(home.length);
|
|
60493
|
+
}
|
|
60494
|
+
return path2;
|
|
60495
|
+
};
|
|
60496
|
+
var writeConfig = (config2) => exports_Effect.gen(function* () {
|
|
60497
|
+
const path2 = yield* exports_Path.Path;
|
|
60498
|
+
const fs = yield* exports_FileSystem.FileSystem;
|
|
60499
|
+
const configDir = yield* expandHome(CONFIG_DIRECTORY);
|
|
60500
|
+
const configPath = path2.join(configDir, CONFIG_FILENAME);
|
|
60501
|
+
const configToWrite = {
|
|
60502
|
+
...config2,
|
|
60503
|
+
promptsDirectory: collapseHome(config2.promptsDirectory),
|
|
60504
|
+
reposDirectory: collapseHome(config2.reposDirectory)
|
|
60505
|
+
};
|
|
60506
|
+
yield* fs.writeFileString(configPath, JSON.stringify(configToWrite, null, 2)).pipe(exports_Effect.catchAll((error4) => exports_Effect.fail(new ConfigError({
|
|
60507
|
+
message: "Failed to write config",
|
|
60508
|
+
cause: error4
|
|
60509
|
+
}))));
|
|
60510
|
+
return configToWrite;
|
|
60511
|
+
});
|
|
60512
|
+
var OPENCODE_CONFIG = (args2) => exports_Effect.gen(function* () {
|
|
60513
|
+
const path2 = yield* exports_Path.Path;
|
|
60514
|
+
return {
|
|
60515
|
+
agent: {
|
|
60516
|
+
build: {
|
|
60517
|
+
disable: true
|
|
60518
|
+
},
|
|
60519
|
+
explore: {
|
|
60520
|
+
disable: true
|
|
60521
|
+
},
|
|
60522
|
+
general: {
|
|
60523
|
+
disable: true
|
|
60461
60524
|
},
|
|
60462
|
-
|
|
60463
|
-
|
|
60464
|
-
|
|
60465
|
-
|
|
60466
|
-
|
|
60467
|
-
|
|
60468
|
-
|
|
60469
|
-
|
|
60470
|
-
|
|
60471
|
-
|
|
60472
|
-
|
|
60473
|
-
|
|
60474
|
-
|
|
60525
|
+
plan: {
|
|
60526
|
+
disable: true
|
|
60527
|
+
},
|
|
60528
|
+
docs: {
|
|
60529
|
+
prompt: getDocsAgentPrompt({
|
|
60530
|
+
repoName: args2.repoName,
|
|
60531
|
+
repoPath: path2.join(args2.reposDirectory, args2.repoName),
|
|
60532
|
+
specialNotes: args2.specialNotes
|
|
60533
|
+
}),
|
|
60534
|
+
disable: false,
|
|
60535
|
+
description: "Get answers about libraries and frameworks by searching their source code",
|
|
60536
|
+
permission: {
|
|
60537
|
+
webfetch: "deny",
|
|
60538
|
+
edit: "deny",
|
|
60539
|
+
bash: "deny",
|
|
60540
|
+
external_directory: "allow",
|
|
60541
|
+
doom_loop: "deny"
|
|
60542
|
+
},
|
|
60543
|
+
mode: "primary",
|
|
60544
|
+
tools: {
|
|
60545
|
+
write: false,
|
|
60546
|
+
bash: false,
|
|
60547
|
+
delete: false,
|
|
60548
|
+
read: true,
|
|
60549
|
+
grep: true,
|
|
60550
|
+
glob: true,
|
|
60551
|
+
list: true,
|
|
60552
|
+
path: false,
|
|
60553
|
+
todowrite: false,
|
|
60554
|
+
todoread: false,
|
|
60555
|
+
websearch: false
|
|
60556
|
+
}
|
|
60475
60557
|
}
|
|
60476
60558
|
}
|
|
60477
|
-
}
|
|
60559
|
+
};
|
|
60478
60560
|
});
|
|
60479
60561
|
var onStartLoadConfig = exports_Effect.gen(function* () {
|
|
60480
|
-
const
|
|
60481
|
-
const
|
|
60482
|
-
const
|
|
60562
|
+
const path2 = yield* exports_Path.Path;
|
|
60563
|
+
const fs = yield* exports_FileSystem.FileSystem;
|
|
60564
|
+
const configDir = yield* expandHome(CONFIG_DIRECTORY);
|
|
60565
|
+
const configPath = path2.join(configDir, CONFIG_FILENAME);
|
|
60566
|
+
const exists5 = yield* fs.exists(configPath);
|
|
60483
60567
|
if (!exists5) {
|
|
60484
60568
|
yield* exports_Effect.log(`Config file not found at ${configPath}, creating default config...`);
|
|
60485
|
-
yield* exports_Effect.
|
|
60486
|
-
|
|
60487
|
-
|
|
60488
|
-
|
|
60489
|
-
|
|
60490
|
-
})
|
|
60491
|
-
});
|
|
60569
|
+
yield* fs.makeDirectory(configDir, { recursive: true }).pipe(exports_Effect.catchAll(() => exports_Effect.void));
|
|
60570
|
+
yield* fs.writeFileString(configPath, JSON.stringify(DEFAULT_CONFIG, null, 2)).pipe(exports_Effect.catchAll((error4) => exports_Effect.fail(new ConfigError({
|
|
60571
|
+
message: "Failed to create default config",
|
|
60572
|
+
cause: error4
|
|
60573
|
+
}))));
|
|
60492
60574
|
yield* exports_Effect.log(`Default config created at ${configPath}`);
|
|
60493
|
-
|
|
60575
|
+
const promptsDir = yield* expandHome(DEFAULT_CONFIG.promptsDirectory);
|
|
60576
|
+
const reposDir = yield* expandHome(DEFAULT_CONFIG.reposDirectory);
|
|
60577
|
+
const config2 = {
|
|
60494
60578
|
...DEFAULT_CONFIG,
|
|
60495
|
-
promptsDirectory:
|
|
60496
|
-
reposDirectory:
|
|
60579
|
+
promptsDirectory: promptsDir,
|
|
60580
|
+
reposDirectory: reposDir
|
|
60581
|
+
};
|
|
60582
|
+
return {
|
|
60583
|
+
config: config2,
|
|
60584
|
+
configPath
|
|
60497
60585
|
};
|
|
60498
60586
|
} else {
|
|
60499
|
-
|
|
60500
|
-
|
|
60501
|
-
|
|
60502
|
-
|
|
60503
|
-
|
|
60504
|
-
|
|
60505
|
-
|
|
60506
|
-
|
|
60587
|
+
const content = yield* fs.readFileString(configPath).pipe(exports_Effect.catchAll((error4) => exports_Effect.fail(new ConfigError({
|
|
60588
|
+
message: "Failed to load config",
|
|
60589
|
+
cause: error4
|
|
60590
|
+
}))));
|
|
60591
|
+
const parsed = JSON.parse(content);
|
|
60592
|
+
return yield* exports_Effect.succeed(parsed).pipe(exports_Effect.flatMap(exports_Schema.decode(configSchema)), exports_Effect.flatMap((loadedConfig) => exports_Effect.gen(function* () {
|
|
60593
|
+
const promptsDir = yield* expandHome(loadedConfig.promptsDirectory);
|
|
60594
|
+
const reposDir = yield* expandHome(loadedConfig.reposDirectory);
|
|
60595
|
+
const config2 = {
|
|
60507
60596
|
...loadedConfig,
|
|
60508
|
-
promptsDirectory:
|
|
60509
|
-
reposDirectory:
|
|
60597
|
+
promptsDirectory: promptsDir,
|
|
60598
|
+
reposDirectory: reposDir
|
|
60510
60599
|
};
|
|
60511
|
-
|
|
60600
|
+
return {
|
|
60601
|
+
config: config2,
|
|
60602
|
+
configPath
|
|
60603
|
+
};
|
|
60604
|
+
})));
|
|
60512
60605
|
}
|
|
60513
60606
|
});
|
|
60514
60607
|
var configService = exports_Effect.gen(function* () {
|
|
60515
|
-
const
|
|
60608
|
+
const path2 = yield* exports_Path.Path;
|
|
60609
|
+
const loadedConfig = yield* onStartLoadConfig;
|
|
60610
|
+
let { config: config2, configPath } = loadedConfig;
|
|
60516
60611
|
const getRepo = ({
|
|
60517
60612
|
repoName,
|
|
60518
60613
|
config: config3
|
|
@@ -60524,9 +60619,10 @@ var configService = exports_Effect.gen(function* () {
|
|
|
60524
60619
|
return repo;
|
|
60525
60620
|
});
|
|
60526
60621
|
return {
|
|
60622
|
+
getConfigPath: () => exports_Effect.succeed(configPath),
|
|
60527
60623
|
cloneOrUpdateOneRepoLocally: (repoName) => exports_Effect.gen(function* () {
|
|
60528
60624
|
const repo = yield* getRepo({ repoName, config: config2 });
|
|
60529
|
-
const repoDir =
|
|
60625
|
+
const repoDir = path2.join(config2.reposDirectory, repo.name);
|
|
60530
60626
|
const branch = repo.branch ?? "main";
|
|
60531
60627
|
const exists5 = yield* directoryExists(repoDir);
|
|
60532
60628
|
if (exists5) {
|
|
@@ -60540,10 +60636,30 @@ var configService = exports_Effect.gen(function* () {
|
|
|
60540
60636
|
return repo;
|
|
60541
60637
|
}),
|
|
60542
60638
|
getOpenCodeConfig: (args2) => exports_Effect.gen(function* () {
|
|
60543
|
-
const { repoName }
|
|
60544
|
-
return OPENCODE_CONFIG({
|
|
60639
|
+
const repo = yield* getRepo({ repoName: args2.repoName, config: config2 }).pipe(exports_Effect.catchTag("ConfigError", () => exports_Effect.succeed(undefined)));
|
|
60640
|
+
return yield* OPENCODE_CONFIG({
|
|
60641
|
+
repoName: args2.repoName,
|
|
60642
|
+
reposDirectory: config2.reposDirectory,
|
|
60643
|
+
specialNotes: repo?.specialNotes
|
|
60644
|
+
});
|
|
60545
60645
|
}),
|
|
60546
|
-
rawConfig: () => exports_Effect.succeed(config2)
|
|
60646
|
+
rawConfig: () => exports_Effect.succeed(config2),
|
|
60647
|
+
getRepos: () => exports_Effect.succeed(config2.repos),
|
|
60648
|
+
getModel: () => exports_Effect.succeed({ provider: config2.provider, model: config2.model }),
|
|
60649
|
+
updateModel: (args2) => exports_Effect.gen(function* () {
|
|
60650
|
+
config2 = { ...config2, provider: args2.provider, model: args2.model };
|
|
60651
|
+
yield* writeConfig(config2);
|
|
60652
|
+
return { provider: config2.provider, model: config2.model };
|
|
60653
|
+
}),
|
|
60654
|
+
addRepo: (repo) => exports_Effect.gen(function* () {
|
|
60655
|
+
const existing = config2.repos.find((r) => r.name === repo.name);
|
|
60656
|
+
if (existing) {
|
|
60657
|
+
return yield* exports_Effect.fail(new ConfigError({ message: `Repo "${repo.name}" already exists` }));
|
|
60658
|
+
}
|
|
60659
|
+
config2 = { ...config2, repos: [...config2.repos, repo] };
|
|
60660
|
+
yield* writeConfig(config2);
|
|
60661
|
+
return repo;
|
|
60662
|
+
})
|
|
60547
60663
|
};
|
|
60548
60664
|
});
|
|
60549
60665
|
|
|
@@ -60724,8 +60840,8 @@ class OcService extends exports_Effect.Service()("OcService", {
|
|
|
60724
60840
|
}
|
|
60725
60841
|
|
|
60726
60842
|
// src/services/cli.ts
|
|
60727
|
-
var VERSION = "0.1
|
|
60728
|
-
var programLayer = exports_Layer.mergeAll(OcService.Default);
|
|
60843
|
+
var VERSION = "0.2.1";
|
|
60844
|
+
var programLayer = exports_Layer.mergeAll(OcService.Default, ConfigService.Default);
|
|
60729
60845
|
var questionOption = exports_Options.text("question").pipe(exports_Options.withAlias("q"));
|
|
60730
60846
|
var techOption = exports_Options.text("tech").pipe(exports_Options.withAlias("t"));
|
|
60731
60847
|
var askCommand = exports_Command2.make("ask", { question: questionOption, tech: techOption }, ({ question, tech }) => exports_Effect.gen(function* () {
|
|
@@ -60816,9 +60932,102 @@ var serveCommand = exports_Command2.make("serve", { port: portOption }, ({ port:
|
|
|
60816
60932
|
const HttpLive = router.pipe(exports_HttpServer.serve(), exports_HttpServer.withLogAddress, exports_Layer.provide(ServerLive));
|
|
60817
60933
|
return yield* exports_Layer.launch(HttpLive);
|
|
60818
60934
|
}).pipe(exports_Effect.scoped, exports_Effect.provide(programLayer)));
|
|
60935
|
+
var providerOption = exports_Options.text("provider").pipe(exports_Options.withAlias("p"), exports_Options.optional);
|
|
60936
|
+
var modelOption = exports_Options.text("model").pipe(exports_Options.withAlias("m"), exports_Options.optional);
|
|
60937
|
+
var configModelCommand = exports_Command2.make("model", { provider: providerOption, model: modelOption }, ({ provider, model }) => exports_Effect.gen(function* () {
|
|
60938
|
+
const config2 = yield* ConfigService;
|
|
60939
|
+
if (provider._tag === "Some" && model._tag === "Some") {
|
|
60940
|
+
const result = yield* config2.updateModel({
|
|
60941
|
+
provider: provider.value,
|
|
60942
|
+
model: model.value
|
|
60943
|
+
});
|
|
60944
|
+
console.log(`Updated model configuration:`);
|
|
60945
|
+
console.log(` Provider: ${result.provider}`);
|
|
60946
|
+
console.log(` Model: ${result.model}`);
|
|
60947
|
+
} else if (provider._tag === "Some" || model._tag === "Some") {
|
|
60948
|
+
console.error("Error: Both --provider and --model must be specified together");
|
|
60949
|
+
process.exit(1);
|
|
60950
|
+
} else {
|
|
60951
|
+
const current2 = yield* config2.getModel();
|
|
60952
|
+
console.log(`Current model configuration:`);
|
|
60953
|
+
console.log(` Provider: ${current2.provider}`);
|
|
60954
|
+
console.log(` Model: ${current2.model}`);
|
|
60955
|
+
}
|
|
60956
|
+
}).pipe(exports_Effect.provide(programLayer)));
|
|
60957
|
+
var configReposListCommand = exports_Command2.make("list", {}, () => exports_Effect.gen(function* () {
|
|
60958
|
+
const config2 = yield* ConfigService;
|
|
60959
|
+
const repos = yield* config2.getRepos();
|
|
60960
|
+
if (repos.length === 0) {
|
|
60961
|
+
console.log("No repos configured.");
|
|
60962
|
+
return;
|
|
60963
|
+
}
|
|
60964
|
+
console.log(`Configured repos:
|
|
60965
|
+
`);
|
|
60966
|
+
for (const repo of repos) {
|
|
60967
|
+
console.log(` ${repo.name}`);
|
|
60968
|
+
console.log(` URL: ${repo.url}`);
|
|
60969
|
+
console.log(` Branch: ${repo.branch}`);
|
|
60970
|
+
if (repo.specialNotes) {
|
|
60971
|
+
console.log(` Notes: ${repo.specialNotes}`);
|
|
60972
|
+
}
|
|
60973
|
+
console.log();
|
|
60974
|
+
}
|
|
60975
|
+
}).pipe(exports_Effect.provide(programLayer)));
|
|
60976
|
+
var repoNameOption = exports_Options.text("name").pipe(exports_Options.withAlias("n"));
|
|
60977
|
+
var repoUrlOption = exports_Options.text("url").pipe(exports_Options.withAlias("u"));
|
|
60978
|
+
var repoBranchOption = exports_Options.text("branch").pipe(exports_Options.withAlias("b"), exports_Options.withDefault("main"));
|
|
60979
|
+
var repoNotesOption = exports_Options.text("notes").pipe(exports_Options.optional);
|
|
60980
|
+
var configReposAddCommand = exports_Command2.make("add", {
|
|
60981
|
+
name: repoNameOption,
|
|
60982
|
+
url: repoUrlOption,
|
|
60983
|
+
branch: repoBranchOption,
|
|
60984
|
+
notes: repoNotesOption
|
|
60985
|
+
}, ({ name, url: url2, branch, notes }) => exports_Effect.gen(function* () {
|
|
60986
|
+
const config2 = yield* ConfigService;
|
|
60987
|
+
const repo = {
|
|
60988
|
+
name,
|
|
60989
|
+
url: url2,
|
|
60990
|
+
branch,
|
|
60991
|
+
...notes._tag === "Some" ? { specialNotes: notes.value } : {}
|
|
60992
|
+
};
|
|
60993
|
+
yield* config2.addRepo(repo);
|
|
60994
|
+
console.log(`Added repo "${name}":`);
|
|
60995
|
+
console.log(` URL: ${url2}`);
|
|
60996
|
+
console.log(` Branch: ${branch}`);
|
|
60997
|
+
if (notes._tag === "Some") {
|
|
60998
|
+
console.log(` Notes: ${notes.value}`);
|
|
60999
|
+
}
|
|
61000
|
+
}).pipe(exports_Effect.catchTag("ConfigError", (e) => exports_Effect.sync(() => {
|
|
61001
|
+
console.error(`Error: ${e.message}`);
|
|
61002
|
+
process.exit(1);
|
|
61003
|
+
})), exports_Effect.provide(programLayer)));
|
|
61004
|
+
var configReposCommand = exports_Command2.make("repos", {}, () => exports_Effect.sync(() => {
|
|
61005
|
+
console.log("Usage: btca config repos <command>");
|
|
61006
|
+
console.log("");
|
|
61007
|
+
console.log("Commands:");
|
|
61008
|
+
console.log(" list List all configured repos");
|
|
61009
|
+
console.log(" add Add a new repo");
|
|
61010
|
+
})).pipe(exports_Command2.withSubcommands([configReposListCommand, configReposAddCommand]));
|
|
61011
|
+
var configCommand = exports_Command2.make("config", {}, () => exports_Effect.gen(function* () {
|
|
61012
|
+
const config2 = yield* ConfigService;
|
|
61013
|
+
const configPath = yield* config2.getConfigPath();
|
|
61014
|
+
console.log(`Config file: ${configPath}`);
|
|
61015
|
+
console.log("");
|
|
61016
|
+
console.log("Usage: btca config <command>");
|
|
61017
|
+
console.log("");
|
|
61018
|
+
console.log("Commands:");
|
|
61019
|
+
console.log(" model View or set the model and provider");
|
|
61020
|
+
console.log(" repos Manage configured repos");
|
|
61021
|
+
}).pipe(exports_Effect.provide(programLayer))).pipe(exports_Command2.withSubcommands([configModelCommand, configReposCommand]));
|
|
60819
61022
|
var mainCommand = exports_Command2.make("btca", {}, () => exports_Effect.sync(() => {
|
|
60820
61023
|
console.log(`btca v${VERSION}. run btca --help for more information.`);
|
|
60821
|
-
})).pipe(exports_Command2.withSubcommands([
|
|
61024
|
+
})).pipe(exports_Command2.withSubcommands([
|
|
61025
|
+
askCommand,
|
|
61026
|
+
serveCommand,
|
|
61027
|
+
openCommand,
|
|
61028
|
+
chatCommand,
|
|
61029
|
+
configCommand
|
|
61030
|
+
]));
|
|
60822
61031
|
var cliService = exports_Effect.gen(function* () {
|
|
60823
61032
|
return {
|
|
60824
61033
|
run: (argv) => exports_Command2.run(mainCommand, {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "btca",
|
|
3
3
|
"author": "Ben Davis",
|
|
4
|
-
"version": "0.1
|
|
4
|
+
"version": "0.2.1",
|
|
5
5
|
"description": "CLI tool for asking questions about technologies using OpenCode",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "MIT",
|
|
@@ -32,12 +32,12 @@
|
|
|
32
32
|
"build:targets": "bun run scripts/build-binaries.ts",
|
|
33
33
|
"build:artifacts": "bun run build && bun run build:targets",
|
|
34
34
|
"prepublishOnly": "bun run build:artifacts",
|
|
35
|
-
"
|
|
35
|
+
"check": "tsc --noEmit",
|
|
36
36
|
"prepare": "effect-language-service patch"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@effect/cli": "^0.72.1",
|
|
40
|
-
"@effect/language-service": "^0.
|
|
40
|
+
"@effect/language-service": "^0.62.1",
|
|
41
41
|
"@effect/platform": "^0.93.5",
|
|
42
42
|
"@effect/platform-bun": "^0.85.0",
|
|
43
43
|
"@effect/printer": "^0.47.0",
|