devwing 0.1.13 → 0.1.15

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 CHANGED
@@ -2135,21 +2135,24 @@ 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
- const existingKey = await configManager.getApiKey();
2141
- if (existingKey) {
2142
- const { overwrite } = await inquirer5.prompt([
2143
- {
2144
- type: "confirm",
2145
- name: "overwrite",
2146
- message: "You are already logged in. Do you want to log in with a different account?",
2147
- default: false
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
2158
  const { method } = await inquirer5.prompt([
@@ -2165,18 +2168,18 @@ async function demoLoginCommand() {
2165
2168
  }
2166
2169
  ]);
2167
2170
  if (method === "email") {
2168
- await demoLoginEmail();
2171
+ await demoLoginEmail(fromSession);
2169
2172
  } else if (method === "browser") {
2170
- await demoLoginBrowser();
2173
+ await demoLoginBrowser(fromSession);
2171
2174
  } else {
2172
- await demoLoginApiKey();
2175
+ await demoLoginApiKey(fromSession);
2173
2176
  }
2174
2177
  } catch (error) {
2175
2178
  logger.error("Login failed");
2176
2179
  if (error.message) logger.error(error.message);
2177
2180
  }
2178
2181
  }
2179
- async function demoLoginEmail() {
2182
+ async function demoLoginEmail(fromSession = false) {
2180
2183
  const { email, password } = await inquirer5.prompt([
2181
2184
  {
2182
2185
  type: "input",
@@ -2207,9 +2210,9 @@ async function demoLoginEmail() {
2207
2210
  logger.succeedSpinner(`Welcome back, ${DEMO_USER.full_name}!`);
2208
2211
  logger.success(`Plan: ${DEMO_USER.subscription_plan.toUpperCase()}`);
2209
2212
  logger.newline();
2210
- showQuickStart2();
2213
+ if (!fromSession) showQuickStart2();
2211
2214
  }
2212
- async function demoLoginBrowser() {
2215
+ async function demoLoginBrowser(fromSession = false) {
2213
2216
  logger.startSpinner("Initiating browser authentication...");
2214
2217
  await sleep(1e3);
2215
2218
  logger.succeedSpinner("Device code created");
@@ -2227,9 +2230,9 @@ async function demoLoginBrowser() {
2227
2230
  logger.succeedSpinner(`Welcome, ${DEMO_USER.full_name}!`);
2228
2231
  logger.success(`Plan: ${DEMO_USER.subscription_plan.toUpperCase()}`);
2229
2232
  logger.newline();
2230
- showQuickStart2();
2233
+ if (!fromSession) showQuickStart2();
2231
2234
  }
2232
- async function demoLoginApiKey() {
2235
+ async function demoLoginApiKey(fromSession = false) {
2233
2236
  logger.info(`Get your API key from the dashboard`);
2234
2237
  logger.newline();
2235
2238
  const { apiKey } = await inquirer5.prompt([
@@ -2256,7 +2259,7 @@ async function demoLoginApiKey() {
2256
2259
  logger.succeedSpinner(`Authenticated as ${DEMO_USER.full_name}!`);
2257
2260
  logger.success(`Plan: ${DEMO_USER.subscription_plan.toUpperCase()}`);
2258
2261
  logger.newline();
2259
- showQuickStart2();
2262
+ if (!fromSession) showQuickStart2();
2260
2263
  }
2261
2264
  function showQuickStart2() {
2262
2265
  logger.box(
@@ -2771,7 +2774,7 @@ function getVersion() {
2771
2774
  continue;
2772
2775
  }
2773
2776
  }
2774
- return "0.1.10";
2777
+ return "0.1.15";
2775
2778
  }
2776
2779
  var DEMO_USER2 = {
2777
2780
  id: "usr_a1b2c3d4-e5f6-7890-abcd-ef1234567890",
@@ -2998,14 +3001,16 @@ var InteractiveSession = class {
2998
3001
  // ============================================================
2999
3002
  async checkAuthStatus() {
3000
3003
  try {
3001
- const apiKey = await configManager.getApiKey();
3002
3004
  if (this.isDemo) {
3003
- if (apiKey) {
3004
- this.isAuthenticated = true;
3005
- this.userProfile = { ...DEMO_USER2 };
3005
+ this.isAuthenticated = true;
3006
+ this.userProfile = { ...DEMO_USER2 };
3007
+ const existing = await configManager.getApiKey();
3008
+ if (!existing) {
3009
+ await configManager.setApiKey("dw_sk_demo_4xK9mQzR2pLvBnWcYjEtHuFi");
3006
3010
  }
3007
3011
  return;
3008
3012
  }
3013
+ const apiKey = await configManager.getApiKey();
3009
3014
  if (!apiKey) return;
3010
3015
  try {
3011
3016
  const profile = await apiClient.getProfile();
@@ -3339,7 +3344,14 @@ ${recent[recent.length - 1].content}`;
3339
3344
  async cmdLogin() {
3340
3345
  console.log();
3341
3346
  if (this.isDemo) {
3342
- await demoLoginCommand();
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 });
3343
3355
  } else {
3344
3356
  await loginCommand();
3345
3357
  }