btca 0.3.1 → 0.3.3
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/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/btca-windows-x64.exe +0 -0
- package/dist/index.js +137 -9
- package/package.json +1 -1
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
|
|
Binary file
|
package/dist/index.js
CHANGED
|
@@ -58985,6 +58985,8 @@ var withHandler2 = withHandler;
|
|
|
58985
58985
|
var withSubcommands3 = withSubcommands2;
|
|
58986
58986
|
var wizard7 = wizard6;
|
|
58987
58987
|
var run9 = run8;
|
|
58988
|
+
// src/services/cli.ts
|
|
58989
|
+
import * as readline2 from "readline";
|
|
58988
58990
|
// ../../node_modules/.bun/@opencode-ai+sdk@1.0.122/node_modules/@opencode-ai/sdk/dist/gen/core/serverSentEvents.gen.js
|
|
58989
58991
|
var createSseClient = ({ onSseError, onSseEvent, responseTransformer, responseValidator, sseDefaultRetryDelay, sseMaxRetryAttempts, sseMaxRetryDelay, sseSleepFn, url: url2, ...options7 }) => {
|
|
58990
58992
|
let lastEventId;
|
|
@@ -60649,7 +60651,16 @@ var configService = exports_Effect.gen(function* () {
|
|
|
60649
60651
|
config2 = { ...config2, repos: [...config2.repos, repo] };
|
|
60650
60652
|
yield* writeConfig(config2);
|
|
60651
60653
|
return repo;
|
|
60652
|
-
})
|
|
60654
|
+
}),
|
|
60655
|
+
removeRepo: (repoName) => exports_Effect.gen(function* () {
|
|
60656
|
+
const existing = config2.repos.find((r) => r.name === repoName);
|
|
60657
|
+
if (!existing) {
|
|
60658
|
+
return yield* exports_Effect.fail(new ConfigError({ message: `Repo "${repoName}" not found` }));
|
|
60659
|
+
}
|
|
60660
|
+
config2 = { ...config2, repos: config2.repos.filter((r) => r.name !== repoName) };
|
|
60661
|
+
yield* writeConfig(config2);
|
|
60662
|
+
}),
|
|
60663
|
+
getReposDirectory: () => exports_Effect.succeed(config2.reposDirectory)
|
|
60653
60664
|
};
|
|
60654
60665
|
});
|
|
60655
60666
|
|
|
@@ -60830,7 +60841,7 @@ class OcService extends exports_Effect.Service()("OcService", {
|
|
|
60830
60841
|
}
|
|
60831
60842
|
|
|
60832
60843
|
// src/services/cli.ts
|
|
60833
|
-
var VERSION = "0.3.
|
|
60844
|
+
var VERSION = "0.3.3";
|
|
60834
60845
|
var programLayer = exports_Layer.mergeAll(OcService.Default, ConfigService.Default);
|
|
60835
60846
|
var questionOption = exports_Options.text("question").pipe(exports_Options.withAlias("q"));
|
|
60836
60847
|
var techOption = exports_Options.text("tech").pipe(exports_Options.withAlias("t"));
|
|
@@ -60968,21 +60979,41 @@ var repoUrlOption = exports_Options.text("url").pipe(exports_Options.withAlias("
|
|
|
60968
60979
|
var repoBranchOption = exports_Options.text("branch").pipe(exports_Options.withAlias("b"), exports_Options.withDefault("main"));
|
|
60969
60980
|
var repoNotesOption = exports_Options.text("notes").pipe(exports_Options.optional);
|
|
60970
60981
|
var configReposAddCommand = exports_Command2.make("add", {
|
|
60971
|
-
name: repoNameOption,
|
|
60972
|
-
url: repoUrlOption,
|
|
60982
|
+
name: repoNameOption.pipe(exports_Options.optional),
|
|
60983
|
+
url: repoUrlOption.pipe(exports_Options.optional),
|
|
60973
60984
|
branch: repoBranchOption,
|
|
60974
60985
|
notes: repoNotesOption
|
|
60975
60986
|
}, ({ name, url: url2, branch, notes }) => exports_Effect.gen(function* () {
|
|
60976
60987
|
const config2 = yield* ConfigService;
|
|
60988
|
+
let repoName;
|
|
60989
|
+
if (name._tag === "Some") {
|
|
60990
|
+
repoName = name.value;
|
|
60991
|
+
} else {
|
|
60992
|
+
repoName = yield* askText("Enter repo name: ");
|
|
60993
|
+
}
|
|
60994
|
+
if (!repoName) {
|
|
60995
|
+
console.log("No repo name provided.");
|
|
60996
|
+
return;
|
|
60997
|
+
}
|
|
60998
|
+
let repoUrl;
|
|
60999
|
+
if (url2._tag === "Some") {
|
|
61000
|
+
repoUrl = url2.value;
|
|
61001
|
+
} else {
|
|
61002
|
+
repoUrl = yield* askText("Enter repo URL: ");
|
|
61003
|
+
}
|
|
61004
|
+
if (!repoUrl) {
|
|
61005
|
+
console.log("No repo URL provided.");
|
|
61006
|
+
return;
|
|
61007
|
+
}
|
|
60977
61008
|
const repo = {
|
|
60978
|
-
name,
|
|
60979
|
-
url:
|
|
61009
|
+
name: repoName,
|
|
61010
|
+
url: repoUrl,
|
|
60980
61011
|
branch,
|
|
60981
61012
|
...notes._tag === "Some" ? { specialNotes: notes.value } : {}
|
|
60982
61013
|
};
|
|
60983
61014
|
yield* config2.addRepo(repo);
|
|
60984
|
-
console.log(`Added repo "${
|
|
60985
|
-
console.log(` URL: ${
|
|
61015
|
+
console.log(`Added repo "${repoName}":`);
|
|
61016
|
+
console.log(` URL: ${repoUrl}`);
|
|
60986
61017
|
console.log(` Branch: ${branch}`);
|
|
60987
61018
|
if (notes._tag === "Some") {
|
|
60988
61019
|
console.log(` Notes: ${notes.value}`);
|
|
@@ -60991,13 +61022,110 @@ var configReposAddCommand = exports_Command2.make("add", {
|
|
|
60991
61022
|
console.error(`Error: ${e.message}`);
|
|
60992
61023
|
process.exit(1);
|
|
60993
61024
|
})), exports_Effect.provide(programLayer)));
|
|
61025
|
+
var askConfirmation = (question) => exports_Effect.async((resume2) => {
|
|
61026
|
+
const rl = readline2.createInterface({
|
|
61027
|
+
input: process.stdin,
|
|
61028
|
+
output: process.stdout
|
|
61029
|
+
});
|
|
61030
|
+
rl.question(question, (answer) => {
|
|
61031
|
+
rl.close();
|
|
61032
|
+
const normalized = answer.toLowerCase().trim();
|
|
61033
|
+
resume2(exports_Effect.succeed(normalized === "y" || normalized === "yes"));
|
|
61034
|
+
});
|
|
61035
|
+
});
|
|
61036
|
+
var askText = (question) => exports_Effect.async((resume2) => {
|
|
61037
|
+
const rl = readline2.createInterface({
|
|
61038
|
+
input: process.stdin,
|
|
61039
|
+
output: process.stdout
|
|
61040
|
+
});
|
|
61041
|
+
rl.question(question, (answer) => {
|
|
61042
|
+
rl.close();
|
|
61043
|
+
resume2(exports_Effect.succeed(answer.trim()));
|
|
61044
|
+
});
|
|
61045
|
+
});
|
|
61046
|
+
var configReposRemoveCommand = exports_Command2.make("remove", { name: repoNameOption.pipe(exports_Options.optional) }, ({ name }) => exports_Effect.gen(function* () {
|
|
61047
|
+
const config2 = yield* ConfigService;
|
|
61048
|
+
let repoName;
|
|
61049
|
+
if (name._tag === "Some") {
|
|
61050
|
+
repoName = name.value;
|
|
61051
|
+
} else {
|
|
61052
|
+
repoName = yield* askText("Enter repo name to remove: ");
|
|
61053
|
+
}
|
|
61054
|
+
if (!repoName) {
|
|
61055
|
+
console.log("No repo name provided.");
|
|
61056
|
+
return;
|
|
61057
|
+
}
|
|
61058
|
+
const repos = yield* config2.getRepos();
|
|
61059
|
+
const exists5 = repos.find((r) => r.name === repoName);
|
|
61060
|
+
if (!exists5) {
|
|
61061
|
+
console.error(`Error: Repo "${repoName}" not found.`);
|
|
61062
|
+
process.exit(1);
|
|
61063
|
+
}
|
|
61064
|
+
const confirmed = yield* askConfirmation(`Are you sure you want to remove repo "${repoName}" from config? (y/N): `);
|
|
61065
|
+
if (!confirmed) {
|
|
61066
|
+
console.log("Aborted.");
|
|
61067
|
+
return;
|
|
61068
|
+
}
|
|
61069
|
+
yield* config2.removeRepo(repoName);
|
|
61070
|
+
console.log(`Removed repo "${repoName}".`);
|
|
61071
|
+
}).pipe(exports_Effect.catchTag("ConfigError", (e) => exports_Effect.sync(() => {
|
|
61072
|
+
console.error(`Error: ${e.message}`);
|
|
61073
|
+
process.exit(1);
|
|
61074
|
+
})), exports_Effect.provide(programLayer)));
|
|
61075
|
+
var configReposClearCommand = exports_Command2.make("clear", {}, () => exports_Effect.gen(function* () {
|
|
61076
|
+
const config2 = yield* ConfigService;
|
|
61077
|
+
const fs = yield* exports_FileSystem.FileSystem;
|
|
61078
|
+
const reposDir = yield* config2.getReposDirectory();
|
|
61079
|
+
const exists5 = yield* fs.exists(reposDir);
|
|
61080
|
+
if (!exists5) {
|
|
61081
|
+
console.log("Repos directory does not exist. Nothing to clear.");
|
|
61082
|
+
return;
|
|
61083
|
+
}
|
|
61084
|
+
const entries2 = yield* fs.readDirectory(reposDir);
|
|
61085
|
+
const repoPaths = [];
|
|
61086
|
+
for (const entry of entries2) {
|
|
61087
|
+
const fullPath = `${reposDir}/${entry}`;
|
|
61088
|
+
const stat3 = yield* fs.stat(fullPath);
|
|
61089
|
+
if (stat3.type === "Directory") {
|
|
61090
|
+
repoPaths.push(fullPath);
|
|
61091
|
+
}
|
|
61092
|
+
}
|
|
61093
|
+
if (repoPaths.length === 0) {
|
|
61094
|
+
console.log("No repos found in the repos directory. Nothing to clear.");
|
|
61095
|
+
return;
|
|
61096
|
+
}
|
|
61097
|
+
console.log(`The following repos will be deleted:
|
|
61098
|
+
`);
|
|
61099
|
+
for (const repoPath of repoPaths) {
|
|
61100
|
+
console.log(` ${repoPath}`);
|
|
61101
|
+
}
|
|
61102
|
+
console.log();
|
|
61103
|
+
const confirmed = yield* askConfirmation("Are you sure you want to delete these repos? (y/N): ");
|
|
61104
|
+
if (!confirmed) {
|
|
61105
|
+
console.log("Aborted.");
|
|
61106
|
+
return;
|
|
61107
|
+
}
|
|
61108
|
+
for (const repoPath of repoPaths) {
|
|
61109
|
+
yield* fs.remove(repoPath, { recursive: true });
|
|
61110
|
+
console.log(`Deleted: ${repoPath}`);
|
|
61111
|
+
}
|
|
61112
|
+
console.log(`
|
|
61113
|
+
All repos have been cleared.`);
|
|
61114
|
+
}).pipe(exports_Effect.provide(programLayer)));
|
|
60994
61115
|
var configReposCommand = exports_Command2.make("repos", {}, () => exports_Effect.sync(() => {
|
|
60995
61116
|
console.log("Usage: btca config repos <command>");
|
|
60996
61117
|
console.log("");
|
|
60997
61118
|
console.log("Commands:");
|
|
60998
61119
|
console.log(" list List all configured repos");
|
|
60999
61120
|
console.log(" add Add a new repo");
|
|
61000
|
-
|
|
61121
|
+
console.log(" remove Remove a configured repo");
|
|
61122
|
+
console.log(" clear Clear all downloaded repos");
|
|
61123
|
+
})).pipe(exports_Command2.withSubcommands([
|
|
61124
|
+
configReposListCommand,
|
|
61125
|
+
configReposAddCommand,
|
|
61126
|
+
configReposRemoveCommand,
|
|
61127
|
+
configReposClearCommand
|
|
61128
|
+
]));
|
|
61001
61129
|
var configCommand = exports_Command2.make("config", {}, () => exports_Effect.gen(function* () {
|
|
61002
61130
|
const config2 = yield* ConfigService;
|
|
61003
61131
|
const configPath = yield* config2.getConfigPath();
|