@sanjay5114/cdx 1.0.0 → 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 (3) hide show
  1. package/README.md +67 -0
  2. package/index.js +13 -11
  3. package/package.json +2 -1
package/README.md ADDED
@@ -0,0 +1,67 @@
1
+ # CDX
2
+
3
+ CDX — a fast, focused command-line tool that helps developers and teams manage projects, tasks, and settings from the terminal.
4
+
5
+ Why CDX exists
6
+ - Problem: Developers waste time switching tools and writing repetitive setup scripts.
7
+ - Solution: CDX centralizes common project operations (create, configure, run tasks) with simple commands so you can spend time building, not managing.
8
+
9
+ Key benefits
10
+ - Save time: Quick project scaffolding and repeatable commands.
11
+ - Consistency: Standardize workflows across machines and teams.
12
+ - Lightweight: Focused feature set that integrates with your existing stack.
13
+
14
+ Core features
15
+ - Create new projects from templates: `cdx create <name>`
16
+ - Configure project and user settings: `cdx config set <key> <value>`
17
+ - Authentication helpers for secure workflows: `cdx auth login / logout`
18
+ - Task runner for common routines: `cdx run <task>`
19
+ - Scriptable and CI-friendly: works in scripts and automation pipelines
20
+
21
+ Install
22
+ - From npm: `npm install -g cdx`
23
+ - From local folder: `npm install -g .`
24
+
25
+ Quick start
26
+ 1. Create a project
27
+ - `cdx create my-app`
28
+ 2. Set configuration
29
+ - `cdx config set editor vim`
30
+ 3. Run a task
31
+ - `cdx run build`
32
+ 4. Authenticate (uses secure storage or environment-driven flow)
33
+ - `cdx auth login`
34
+
35
+ Examples
36
+ - Create and bootstrap:
37
+ - `cdx create blog && cd blog && cdx run init`
38
+ - Save a setting:
39
+ - `cdx config set project.timeout 30`
40
+
41
+ Configuration
42
+ - Use `cdx config get/set` to manage settings.
43
+ - Configured values can be sourced from environment variables or secure stores; avoid storing sensitive secrets in plaintext files.
44
+
45
+ Security & privacy
46
+ - Do not commit passwords, API keys, or private tokens to version control.
47
+ - Prefer environment variables, system keychains, or dedicated secret managers for credentials.
48
+ - CDX is designed to avoid embedding sensitive provider-specific implementation details in the README or default configs.
49
+
50
+ Best practices
51
+ - Add CDX commands to project README or contributor docs for consistent onboarding.
52
+ - Use CI environment variables for automation rather than local secrets.
53
+ - Create lightweight templates for teams to standardize projects.
54
+
55
+ Contribution
56
+ - Found a bug or have a feature idea? Open an issue or submit a pull request.
57
+ - Keep changes small and well-documented. Add tests for new behavior where possible.
58
+
59
+ License
60
+ - See `package.json` for the license. Ensure you follow the license when redistributing.
61
+
62
+ Support & contact
63
+ - Open an issue in the repository for help or feature requests.
64
+ - Include command output and steps to reproduce when reporting bugs.
65
+
66
+ Thank you for using CDX — built to reduce repetitive work and help teams move faster.
67
+
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.0",
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",