@sanjay5114/cdx 1.0.1 → 1.0.2

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.
Files changed (2) hide show
  1. package/index.js +13 -11
  2. package/package.json +2 -1
package/index.js CHANGED
@@ -26,7 +26,7 @@ const sleep = ms => new Promise(r => setTimeout(r, ms));
26
26
  // AUTH GATE — runs before any command action
27
27
  // Returns the logged-in user, or null if login was cancelled/failed
28
28
  // ─────────────────────────────────────────────────────────────────────────────
29
- async function requireAuth(inquirer) {
29
+ async function requireAuth(inquirer, opts = {}) {
30
30
  // 1. Try to restore existing session silently
31
31
  const spin = spinner("Checking session…").start();
32
32
  await sleep(300);
@@ -38,13 +38,16 @@ async function requireAuth(inquirer) {
38
38
  return user;
39
39
  }
40
40
 
41
- spin.warn("No active session — authentication required");
42
- console.log();
41
+ spin.warn("No active session");
42
+
43
+ // 2. If silent mode, return null without prompting
44
+ if (opts.silent) {
45
+ return null;
46
+ }
43
47
 
44
- // 2. Show Dex prompting login
45
- dex("Hey there! I'm Dex, your documentation assistant. You'll need to sign in before we can get started.", "idle");
48
+ // 3. Prompt user for action
49
+ dex("Hey there! I'm Dex, your documentation assistant. You can sign in for full features, or continue without login.", "idle");
46
50
 
47
- // 3. Login / signup choice
48
51
  const { authChoice } = await inquirer.prompt([{
49
52
  type : "list",
50
53
  name : "authChoice",
@@ -52,15 +55,14 @@ async function requireAuth(inquirer) {
52
55
  choices: [
53
56
  { name: ` ${T.brand("◉")} ${T.whiteBold("Sign In")} ${T.dim("I already have an account")}`, value: "login" },
54
57
  { name: ` ${T.success("◉")} ${T.whiteBold("Sign Up")} ${T.dim("Create a new CDX account")}`, value: "signup" },
55
- { name: ` ${T.dim("◉")} ${T.dim("Exit")}`, value: "exit" },
58
+ { name: ` ${T.dim("◉")} ${T.dim("Continue without login")}`, value: "continue" },
56
59
  ],
57
60
  prefix: ` ${T.accent(ICONS.arrow)}`,
58
61
  }]);
59
62
 
60
- if (authChoice === "exit") {
61
- await typewrite(`\n ${T.dim("Goodbye! Come back when you're ready.")}`, 18);
62
- footer();
63
- process.exit(0);
63
+ if (authChoice === "continue") {
64
+ note("Continuing without authentication. Some features may be unavailable.");
65
+ return null;
64
66
  }
65
67
 
66
68
  const apiKey = store.get("firebaseApiKey"); // always returns bundled key
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanjay5114/cdx",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Lightning-fast extensible CLI for developer productivity with modular commands, AI integrations, and automation.",
5
5
  "keywords": [
6
6
  "cli",
@@ -25,6 +25,7 @@
25
25
  "access": "public"
26
26
  },
27
27
  "dependencies": {
28
+ "cdx": "^0.0.1",
28
29
  "chalk": "^4.1.2",
29
30
  "commander": "^11.1.0",
30
31
  "inquirer": "^8.2.6",