devwing 0.1.23 → 0.1.25
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/index.js +29 -51
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Command } from 'commander';
|
|
3
3
|
import chalk7 from 'chalk';
|
|
4
|
-
import
|
|
4
|
+
import inquirer from 'inquirer';
|
|
5
5
|
import axios2 from 'axios';
|
|
6
6
|
import Conf from 'conf';
|
|
7
7
|
import { AsyncEntry } from '@napi-rs/keyring';
|
|
@@ -529,7 +529,7 @@ async function loginCommand() {
|
|
|
529
529
|
try {
|
|
530
530
|
const existingKey = await configManager.getApiKey();
|
|
531
531
|
if (existingKey) {
|
|
532
|
-
const { overwrite } = await
|
|
532
|
+
const { overwrite } = await inquirer.prompt([
|
|
533
533
|
{
|
|
534
534
|
type: "confirm",
|
|
535
535
|
name: "overwrite",
|
|
@@ -542,7 +542,7 @@ async function loginCommand() {
|
|
|
542
542
|
return;
|
|
543
543
|
}
|
|
544
544
|
}
|
|
545
|
-
const { method } = await
|
|
545
|
+
const { method } = await inquirer.prompt([
|
|
546
546
|
{
|
|
547
547
|
type: "list",
|
|
548
548
|
name: "method",
|
|
@@ -569,7 +569,7 @@ async function loginCommand() {
|
|
|
569
569
|
}
|
|
570
570
|
}
|
|
571
571
|
async function loginWithEmail() {
|
|
572
|
-
const { email, password } = await
|
|
572
|
+
const { email, password } = await inquirer.prompt([
|
|
573
573
|
{
|
|
574
574
|
type: "input",
|
|
575
575
|
name: "email",
|
|
@@ -600,7 +600,7 @@ async function loginWithEmail() {
|
|
|
600
600
|
if (loginResult.requires_2fa) {
|
|
601
601
|
logger.succeedSpinner("Credentials verified");
|
|
602
602
|
logger.info("Two-factor authentication is enabled on your account");
|
|
603
|
-
const { totpCode } = await
|
|
603
|
+
const { totpCode } = await inquirer.prompt([
|
|
604
604
|
{
|
|
605
605
|
type: "input",
|
|
606
606
|
name: "totpCode",
|
|
@@ -715,7 +715,7 @@ async function loginWithApiKey() {
|
|
|
715
715
|
);
|
|
716
716
|
logger.info(`Get your API key from the ${dashboardUrl}`);
|
|
717
717
|
logger.newline();
|
|
718
|
-
const { apiKey } = await
|
|
718
|
+
const { apiKey } = await inquirer.prompt([
|
|
719
719
|
{
|
|
720
720
|
type: "password",
|
|
721
721
|
name: "apiKey",
|
|
@@ -755,7 +755,7 @@ async function logoutCommand() {
|
|
|
755
755
|
logger.info("You are not logged in");
|
|
756
756
|
return;
|
|
757
757
|
}
|
|
758
|
-
const { confirm } = await
|
|
758
|
+
const { confirm } = await inquirer.prompt([
|
|
759
759
|
{
|
|
760
760
|
type: "confirm",
|
|
761
761
|
name: "confirm",
|
|
@@ -1522,7 +1522,7 @@ var StreamingRenderer = class {
|
|
|
1522
1522
|
const requiresConfirmation = this.requiresConfirmation(tool);
|
|
1523
1523
|
let confirmed = true;
|
|
1524
1524
|
if (requiresConfirmation) {
|
|
1525
|
-
const answers = await
|
|
1525
|
+
const answers = await inquirer.prompt([
|
|
1526
1526
|
{
|
|
1527
1527
|
type: "confirm",
|
|
1528
1528
|
name: "confirmed",
|
|
@@ -1785,7 +1785,7 @@ async function memorySave(projectId, content) {
|
|
|
1785
1785
|
logger.error("Please provide content to save");
|
|
1786
1786
|
return;
|
|
1787
1787
|
}
|
|
1788
|
-
const { type } = await
|
|
1788
|
+
const { type } = await inquirer.prompt([
|
|
1789
1789
|
{
|
|
1790
1790
|
type: "list",
|
|
1791
1791
|
name: "type",
|
|
@@ -1838,7 +1838,7 @@ async function memoryShow(projectId) {
|
|
|
1838
1838
|
}
|
|
1839
1839
|
}
|
|
1840
1840
|
async function memoryClear(projectId) {
|
|
1841
|
-
const { confirm } = await
|
|
1841
|
+
const { confirm } = await inquirer.prompt([
|
|
1842
1842
|
{
|
|
1843
1843
|
type: "confirm",
|
|
1844
1844
|
name: "confirm",
|
|
@@ -2061,7 +2061,7 @@ async function updateCommand(options) {
|
|
|
2061
2061
|
}
|
|
2062
2062
|
logger.info(`Detected package manager: ${chalk7.cyan(packageManager)}`);
|
|
2063
2063
|
if (!options?.force) {
|
|
2064
|
-
const { confirm } = await
|
|
2064
|
+
const { confirm } = await inquirer.prompt([
|
|
2065
2065
|
{
|
|
2066
2066
|
type: "confirm",
|
|
2067
2067
|
name: "confirm",
|
|
@@ -2135,7 +2135,7 @@ async function demoLoginCommand(opts) {
|
|
|
2135
2135
|
if (!fromSession) {
|
|
2136
2136
|
const existingKey = await configManager.getApiKey();
|
|
2137
2137
|
if (existingKey) {
|
|
2138
|
-
const { overwrite } = await
|
|
2138
|
+
const { overwrite } = await inquirer.prompt([
|
|
2139
2139
|
{
|
|
2140
2140
|
type: "confirm",
|
|
2141
2141
|
name: "overwrite",
|
|
@@ -2149,7 +2149,7 @@ async function demoLoginCommand(opts) {
|
|
|
2149
2149
|
}
|
|
2150
2150
|
}
|
|
2151
2151
|
}
|
|
2152
|
-
const { method } = await
|
|
2152
|
+
const { method } = await inquirer.prompt([
|
|
2153
2153
|
{
|
|
2154
2154
|
type: "list",
|
|
2155
2155
|
name: "method",
|
|
@@ -2174,7 +2174,7 @@ async function demoLoginCommand(opts) {
|
|
|
2174
2174
|
}
|
|
2175
2175
|
}
|
|
2176
2176
|
async function demoLoginEmail(fromSession = false) {
|
|
2177
|
-
const { email, password } = await
|
|
2177
|
+
const { email, password } = await inquirer.prompt([
|
|
2178
2178
|
{
|
|
2179
2179
|
type: "input",
|
|
2180
2180
|
name: "email",
|
|
@@ -2229,7 +2229,7 @@ async function demoLoginBrowser(fromSession = false) {
|
|
|
2229
2229
|
async function demoLoginApiKey(fromSession = false) {
|
|
2230
2230
|
logger.info(`Get your API key from the dashboard`);
|
|
2231
2231
|
logger.newline();
|
|
2232
|
-
const { apiKey } = await
|
|
2232
|
+
const { apiKey } = await inquirer.prompt([
|
|
2233
2233
|
{
|
|
2234
2234
|
type: "password",
|
|
2235
2235
|
name: "apiKey",
|
|
@@ -2298,23 +2298,14 @@ async function demoLogoutCommand() {
|
|
|
2298
2298
|
logger.info("You are not logged in");
|
|
2299
2299
|
return;
|
|
2300
2300
|
}
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
type: "confirm",
|
|
2304
|
-
name: "confirm",
|
|
2305
|
-
message: "Are you sure you want to log out?",
|
|
2306
|
-
default: false
|
|
2307
|
-
}
|
|
2308
|
-
]);
|
|
2309
|
-
if (!confirm) {
|
|
2310
|
-
logger.info("Logout cancelled");
|
|
2311
|
-
return;
|
|
2312
|
-
}
|
|
2301
|
+
logger.startSpinner("Logging out...");
|
|
2302
|
+
await sleep(600);
|
|
2313
2303
|
await configManager.deleteApiKey();
|
|
2314
2304
|
const apiUrl = configManager.getApiUrl();
|
|
2315
2305
|
configManager.clear();
|
|
2316
2306
|
configManager.setApiUrl(apiUrl);
|
|
2317
|
-
logger.
|
|
2307
|
+
logger.succeedSpinner("Successfully logged out");
|
|
2308
|
+
logger.info("Credentials cleared from OS keychain");
|
|
2318
2309
|
}
|
|
2319
2310
|
async function demoMemoryCommand(action, content) {
|
|
2320
2311
|
if (action === "show") {
|
|
@@ -2342,24 +2333,11 @@ async function demoMemoryCommand(action, content) {
|
|
|
2342
2333
|
logger.error("Please provide content to save");
|
|
2343
2334
|
return;
|
|
2344
2335
|
}
|
|
2345
|
-
const { type } = await inquirer5.prompt([
|
|
2346
|
-
{
|
|
2347
|
-
type: "list",
|
|
2348
|
-
name: "type",
|
|
2349
|
-
message: "What type of memory is this?",
|
|
2350
|
-
choices: [
|
|
2351
|
-
{ name: "Context (general information)", value: "context" },
|
|
2352
|
-
{ name: "Rule (coding standard or guideline)", value: "rule" },
|
|
2353
|
-
{ name: "Decision (architectural decision)", value: "decision" },
|
|
2354
|
-
{ name: "Summary (project summary)", value: "summary" }
|
|
2355
|
-
]
|
|
2356
|
-
}
|
|
2357
|
-
]);
|
|
2358
2336
|
logger.startSpinner("Saving to project memory...");
|
|
2359
2337
|
await sleep(1e3);
|
|
2360
|
-
logger.succeedSpinner(
|
|
2338
|
+
logger.succeedSpinner("Memory saved as context");
|
|
2361
2339
|
} else if (action === "clear") {
|
|
2362
|
-
const { confirm } = await
|
|
2340
|
+
const { confirm } = await inquirer.prompt([
|
|
2363
2341
|
{
|
|
2364
2342
|
type: "confirm",
|
|
2365
2343
|
name: "confirm",
|
|
@@ -2702,7 +2680,7 @@ async function showToolCall(tool, args) {
|
|
|
2702
2680
|
if (args) console.log(chalk7.dim(` ${args}`));
|
|
2703
2681
|
console.log();
|
|
2704
2682
|
const label = tool === "write_file" ? `Write ${args}` : tool === "run_command" ? `Run: ${args}` : tool === "git_commit" ? `Create git commit` : tool === "delete_file" ? `Delete ${args}` : `Execute ${tool}`;
|
|
2705
|
-
const { allowed } = await
|
|
2683
|
+
const { allowed } = await inquirer.prompt([
|
|
2706
2684
|
{
|
|
2707
2685
|
type: "confirm",
|
|
2708
2686
|
name: "allowed",
|
|
@@ -2786,7 +2764,7 @@ function getVersion() {
|
|
|
2786
2764
|
continue;
|
|
2787
2765
|
}
|
|
2788
2766
|
}
|
|
2789
|
-
return "0.1.
|
|
2767
|
+
return "0.1.25";
|
|
2790
2768
|
}
|
|
2791
2769
|
var DEMO_USER2 = {
|
|
2792
2770
|
id: "usr_a1b2c3d4",
|
|
@@ -3219,9 +3197,10 @@ ${recent[recent.length - 1].content}`;
|
|
|
3219
3197
|
} else {
|
|
3220
3198
|
await loginCommand();
|
|
3221
3199
|
}
|
|
3222
|
-
restoreStdin();
|
|
3223
|
-
await sleep2(80);
|
|
3224
3200
|
await this.checkAuth();
|
|
3201
|
+
console.log();
|
|
3202
|
+
this.printSystemInfo();
|
|
3203
|
+
console.log();
|
|
3225
3204
|
}
|
|
3226
3205
|
async cmdLogout() {
|
|
3227
3206
|
if (this.isDemo) {
|
|
@@ -3229,9 +3208,10 @@ ${recent[recent.length - 1].content}`;
|
|
|
3229
3208
|
} else {
|
|
3230
3209
|
await logoutCommand();
|
|
3231
3210
|
}
|
|
3232
|
-
restoreStdin();
|
|
3233
|
-
await sleep2(80);
|
|
3234
3211
|
await this.checkAuth();
|
|
3212
|
+
console.log();
|
|
3213
|
+
this.printSystemInfo();
|
|
3214
|
+
console.log();
|
|
3235
3215
|
}
|
|
3236
3216
|
async cmdStatus() {
|
|
3237
3217
|
if (!this.isAuthenticated) {
|
|
@@ -3298,8 +3278,6 @@ ${recent[recent.length - 1].content}`;
|
|
|
3298
3278
|
const content = parts.slice(1).join(" ").trim();
|
|
3299
3279
|
if (this.isDemo) {
|
|
3300
3280
|
await demoMemoryCommand(sub, content || void 0);
|
|
3301
|
-
restoreStdin();
|
|
3302
|
-
await sleep2(80);
|
|
3303
3281
|
} else {
|
|
3304
3282
|
await memoryCommand(sub, content || void 0, this.options);
|
|
3305
3283
|
}
|