devwing 0.1.12 → 0.1.14
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 +48 -40
- package/dist/index.js.map +1 -1
- package/package.json +18 -11
package/dist/index.js
CHANGED
|
@@ -2135,25 +2135,26 @@ var DEMO_MEMORIES = [
|
|
|
2135
2135
|
{ id: "mem_003", type: "decision", content: "Chose PostgreSQL over MongoDB for ACID compliance \u2014 government data requires strict consistency", created_at: "2026-03-10T09:00:00Z" },
|
|
2136
2136
|
{ id: "mem_004", type: "summary", content: 'Kano Smart serves 16M residents via kanostate.gov.ng and smart.kano.gov.ng \u2014 all responses branded "Powered by devwing.ai"', created_at: "2026-03-15T11:00:00Z" }
|
|
2137
2137
|
];
|
|
2138
|
-
async function demoLoginCommand() {
|
|
2138
|
+
async function demoLoginCommand(opts) {
|
|
2139
|
+
const fromSession = opts?.fromSession ?? false;
|
|
2139
2140
|
try {
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
{
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2141
|
+
if (!fromSession) {
|
|
2142
|
+
const existingKey = await configManager.getApiKey();
|
|
2143
|
+
if (existingKey) {
|
|
2144
|
+
const { overwrite } = await inquirer5.prompt([
|
|
2145
|
+
{
|
|
2146
|
+
type: "confirm",
|
|
2147
|
+
name: "overwrite",
|
|
2148
|
+
message: "You are already logged in. Do you want to log in with a different account?",
|
|
2149
|
+
default: false
|
|
2150
|
+
}
|
|
2151
|
+
]);
|
|
2152
|
+
if (!overwrite) {
|
|
2153
|
+
logger.info("Login cancelled");
|
|
2154
|
+
return;
|
|
2148
2155
|
}
|
|
2149
|
-
]);
|
|
2150
|
-
if (!overwrite) {
|
|
2151
|
-
logger.info("Login cancelled");
|
|
2152
|
-
return;
|
|
2153
2156
|
}
|
|
2154
2157
|
}
|
|
2155
|
-
logger.printBanner();
|
|
2156
|
-
logger.newline();
|
|
2157
2158
|
const { method } = await inquirer5.prompt([
|
|
2158
2159
|
{
|
|
2159
2160
|
type: "list",
|
|
@@ -2167,18 +2168,18 @@ async function demoLoginCommand() {
|
|
|
2167
2168
|
}
|
|
2168
2169
|
]);
|
|
2169
2170
|
if (method === "email") {
|
|
2170
|
-
await demoLoginEmail();
|
|
2171
|
+
await demoLoginEmail(fromSession);
|
|
2171
2172
|
} else if (method === "browser") {
|
|
2172
|
-
await demoLoginBrowser();
|
|
2173
|
+
await demoLoginBrowser(fromSession);
|
|
2173
2174
|
} else {
|
|
2174
|
-
await demoLoginApiKey();
|
|
2175
|
+
await demoLoginApiKey(fromSession);
|
|
2175
2176
|
}
|
|
2176
2177
|
} catch (error) {
|
|
2177
2178
|
logger.error("Login failed");
|
|
2178
2179
|
if (error.message) logger.error(error.message);
|
|
2179
2180
|
}
|
|
2180
2181
|
}
|
|
2181
|
-
async function demoLoginEmail() {
|
|
2182
|
+
async function demoLoginEmail(fromSession = false) {
|
|
2182
2183
|
const { email, password } = await inquirer5.prompt([
|
|
2183
2184
|
{
|
|
2184
2185
|
type: "input",
|
|
@@ -2209,9 +2210,9 @@ async function demoLoginEmail() {
|
|
|
2209
2210
|
logger.succeedSpinner(`Welcome back, ${DEMO_USER.full_name}!`);
|
|
2210
2211
|
logger.success(`Plan: ${DEMO_USER.subscription_plan.toUpperCase()}`);
|
|
2211
2212
|
logger.newline();
|
|
2212
|
-
showQuickStart2();
|
|
2213
|
+
if (!fromSession) showQuickStart2();
|
|
2213
2214
|
}
|
|
2214
|
-
async function demoLoginBrowser() {
|
|
2215
|
+
async function demoLoginBrowser(fromSession = false) {
|
|
2215
2216
|
logger.startSpinner("Initiating browser authentication...");
|
|
2216
2217
|
await sleep(1e3);
|
|
2217
2218
|
logger.succeedSpinner("Device code created");
|
|
@@ -2229,9 +2230,9 @@ async function demoLoginBrowser() {
|
|
|
2229
2230
|
logger.succeedSpinner(`Welcome, ${DEMO_USER.full_name}!`);
|
|
2230
2231
|
logger.success(`Plan: ${DEMO_USER.subscription_plan.toUpperCase()}`);
|
|
2231
2232
|
logger.newline();
|
|
2232
|
-
showQuickStart2();
|
|
2233
|
+
if (!fromSession) showQuickStart2();
|
|
2233
2234
|
}
|
|
2234
|
-
async function demoLoginApiKey() {
|
|
2235
|
+
async function demoLoginApiKey(fromSession = false) {
|
|
2235
2236
|
logger.info(`Get your API key from the dashboard`);
|
|
2236
2237
|
logger.newline();
|
|
2237
2238
|
const { apiKey } = await inquirer5.prompt([
|
|
@@ -2258,7 +2259,7 @@ async function demoLoginApiKey() {
|
|
|
2258
2259
|
logger.succeedSpinner(`Authenticated as ${DEMO_USER.full_name}!`);
|
|
2259
2260
|
logger.success(`Plan: ${DEMO_USER.subscription_plan.toUpperCase()}`);
|
|
2260
2261
|
logger.newline();
|
|
2261
|
-
showQuickStart2();
|
|
2262
|
+
if (!fromSession) showQuickStart2();
|
|
2262
2263
|
}
|
|
2263
2264
|
function showQuickStart2() {
|
|
2264
2265
|
logger.box(
|
|
@@ -2773,7 +2774,7 @@ function getVersion() {
|
|
|
2773
2774
|
continue;
|
|
2774
2775
|
}
|
|
2775
2776
|
}
|
|
2776
|
-
return "0.1.
|
|
2777
|
+
return "0.1.14";
|
|
2777
2778
|
}
|
|
2778
2779
|
var DEMO_USER2 = {
|
|
2779
2780
|
id: "usr_a1b2c3d4-e5f6-7890-abcd-ef1234567890",
|
|
@@ -3000,24 +3001,24 @@ var InteractiveSession = class {
|
|
|
3000
3001
|
// ============================================================
|
|
3001
3002
|
async checkAuthStatus() {
|
|
3002
3003
|
try {
|
|
3003
|
-
const apiKey = await configManager.getApiKey();
|
|
3004
|
-
if (!apiKey) {
|
|
3005
|
-
this.isAuthenticated = false;
|
|
3006
|
-
this.userProfile = null;
|
|
3007
|
-
return;
|
|
3008
|
-
}
|
|
3009
3004
|
if (this.isDemo) {
|
|
3010
3005
|
this.isAuthenticated = true;
|
|
3011
3006
|
this.userProfile = { ...DEMO_USER2 };
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
this.isAuthenticated = true;
|
|
3016
|
-
this.userProfile = profile;
|
|
3017
|
-
} catch {
|
|
3018
|
-
this.isAuthenticated = true;
|
|
3019
|
-
this.userProfile = null;
|
|
3007
|
+
const existing = await configManager.getApiKey();
|
|
3008
|
+
if (!existing) {
|
|
3009
|
+
await configManager.setApiKey("dw_sk_demo_4xK9mQzR2pLvBnWcYjEtHuFi");
|
|
3020
3010
|
}
|
|
3011
|
+
return;
|
|
3012
|
+
}
|
|
3013
|
+
const apiKey = await configManager.getApiKey();
|
|
3014
|
+
if (!apiKey) return;
|
|
3015
|
+
try {
|
|
3016
|
+
const profile = await apiClient.getProfile();
|
|
3017
|
+
this.isAuthenticated = true;
|
|
3018
|
+
this.userProfile = profile;
|
|
3019
|
+
} catch {
|
|
3020
|
+
this.isAuthenticated = true;
|
|
3021
|
+
this.userProfile = null;
|
|
3021
3022
|
}
|
|
3022
3023
|
} catch {
|
|
3023
3024
|
this.isAuthenticated = false;
|
|
@@ -3343,7 +3344,14 @@ ${recent[recent.length - 1].content}`;
|
|
|
3343
3344
|
async cmdLogin() {
|
|
3344
3345
|
console.log();
|
|
3345
3346
|
if (this.isDemo) {
|
|
3346
|
-
|
|
3347
|
+
if (this.isAuthenticated) {
|
|
3348
|
+
const name = this.userProfile?.full_name || this.userProfile?.email || "you";
|
|
3349
|
+
const plan = (this.userProfile?.subscription_plan || "free").toUpperCase();
|
|
3350
|
+
logger.success(`Already logged in as ${chalk7.bold(name)} (${plan})`);
|
|
3351
|
+
logger.info("Type /logout to switch accounts, or /status for details.");
|
|
3352
|
+
return;
|
|
3353
|
+
}
|
|
3354
|
+
await demoLoginCommand({ fromSession: true });
|
|
3347
3355
|
} else {
|
|
3348
3356
|
await loginCommand();
|
|
3349
3357
|
}
|