dashnex 0.5.48 → 0.5.50

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/README.md CHANGED
@@ -30,9 +30,12 @@ dashnex <command> [options]
30
30
  | `app delete` | Delete application from DashNex |
31
31
  | `app deploy` | Deploy application to DashNex |
32
32
  | `app status` | Show current application status |
33
- | `install` | Install dependencies using pnpm or npm |
34
- | `dev` | Run the development server |
35
- | `check` | Run build-time validations |
33
+ | `app install` | Install dependencies using pnpm or npm |
34
+ | `app dev` | Run the development server |
35
+ | `app check` | Run build-time validations |
36
+ | `secrets list` | List all secret names bound to the worker |
37
+ | `secrets set` | Create or update a secret |
38
+ | `secrets delete` | Delete a secret |
36
39
 
37
40
  ### Options
38
41
 
@@ -55,3 +58,10 @@ dashnex <command> [options]
55
58
 
56
59
  **app delete**:
57
60
  - `-y, --yes` — Skip confirmation prompt
61
+
62
+ **secrets set**:
63
+ - `--name <name>` — Secret name (prompted if omitted)
64
+ - `--value <value>` — Secret value (prompted with masked input if omitted)
65
+
66
+ **secrets delete**:
67
+ - `--name <name>` — Secret name (prompted if omitted)
@@ -1 +1 @@
1
- import o from"./version.js";import{LoginCommand as s}from"./login.js";import{LogoutCommand as i}from"./logout.js";import{WhoamiCommand as e}from"./whoami.js";import n from"./app/index.js";const r=[{name:"version",description:"Display the version of the CLI",handler:new o,options:[]},{name:"login",description:"Log in to your DashNex account",handler:new s,options:[{flags:"--email <email>",description:"Email address (skip prompt)"},{flags:"--password <password>",description:"Password (skip prompt)"},{flags:"--code <code>",description:"2FA code (skip prompt)"},{flags:"--business <id>",description:"Business ID to select (skip prompt)"}]},{name:"logout",description:"Log out and remove local credentials",handler:new i,options:[]},{name:"whoami",description:"Show current logged-in business and user",handler:new e,options:[]},n];export{r as default};
1
+ import o from"./version.js";import{LoginCommand as s}from"./login.js";import{LogoutCommand as e}from"./logout.js";import{WhoamiCommand as i}from"./whoami.js";import r from"./app/index.js";import n from"./secrets/index.js";const t=[{name:"version",description:"Display the version of the CLI",handler:new o,options:[]},{name:"login",description:"Log in to your DashNex account",handler:new s,options:[{flags:"--email <email>",description:"Email address (skip prompt)"},{flags:"--password <password>",description:"Password (skip prompt)"},{flags:"--code <code>",description:"2FA code (skip prompt)"},{flags:"--business <id>",description:"Business ID to select (skip prompt)"}]},{name:"logout",description:"Log out and remove local credentials",handler:new e,options:[]},{name:"whoami",description:"Show current logged-in business and user",handler:new i,options:[]},r,n];export{t as default};
@@ -0,0 +1 @@
1
+ import e from"inquirer";import t from"chalk";import{debug as r,debugError as o}from"../../lib/debug.js";import{getBusinessApiBase as s}from"../../lib/api.js";import{ensureLoggedIn as i}from"../../services/auth.js";import{createSpinner as a}from"../../lib/spinner.js";import{isUserInterrupt as n,INTERRUPTED_MESSAGE as c}from"../../lib/errors.js";class l{async execute(l={}){r("Secrets delete flow started");let{name:m}=l;if(!m){m=(await e.prompt([{type:"input",name:"name",message:"Secret name:",validate:e=>""!==e.trim()||"Name is required"}])).name.trim()}const d=await i();if(!d)return;const u=`${s()}/business/v1/cli/secrets/${encodeURIComponent(m)}`;r(`DELETE ${u}`);const p=a();p.start(`Deleting secret '${m}'...`);try{const e=await fetch(u,{method:"DELETE",headers:{Authorization:`Bearer ${d.token}`}});if(p.stop(),r(`Response: ${e.status}`),!e.ok){let r="Failed to delete secret.";401===e.status||403===e.status?r="Please run 'dashnex login' to authenticate.":404===e.status?r=`Secret '${m}' not found.`:502===e.status&&(r="Error deleting secret. Make sure your application is deployed."),console.error(t.red(r)),process.exit(1)}r(`Secret '${m}' deleted successfully`),console.log(t.green(`Secret '${m}' deleted.`))}catch(f){if(p.stop(),o(f),f instanceof Error&&f.message.startsWith("EXIT:"))throw f;if(n(f))return void console.log(t.yellow(c));console.error(t.red("Could not reach DashNex API. Check your connection and try again.")),process.exit(1)}}}export{l as DeleteSecretCommand};
@@ -0,0 +1 @@
1
+ import{ListSecretsCommand as e}from"./list.js";import{SetSecretCommand as t}from"./set.js";import{DeleteSecretCommand as s}from"./delete.js";const n={name:"secrets",description:"Manage Cloudflare Worker secrets",handler:{execute:async()=>{}},options:[],subcommands:[{name:"list",description:"List all secret names bound to the worker",handler:new e,options:[]},{name:"set",description:"Create or update a secret",handler:new t,options:[{flags:"--name <name>",description:"Secret name"},{flags:"--value <value>",description:"Secret value"}]},{name:"delete",description:"Delete a secret",handler:new s,options:[{flags:"--name <name>",description:"Secret name"}]}]};export{n as default};
@@ -0,0 +1 @@
1
+ import e from"chalk";import{debug as s,debugError as o}from"../../lib/debug.js";import{getBusinessApiBase as t}from"../../lib/api.js";import{ensureLoggedIn as r}from"../../services/auth.js";import{createSpinner as n}from"../../lib/spinner.js";import{isUserInterrupt as i,INTERRUPTED_MESSAGE as a}from"../../lib/errors.js";class c{async execute(){s("Secrets list flow started");const c=await r();if(!c)return;const l=`${t()}/business/v1/cli/secrets`;s(`GET ${l}`);const h=n();h.start("Fetching secrets...");try{const o=await fetch(l,{headers:{Authorization:`Bearer ${c.token}`}});if(h.stop(),s(`Response: ${o.status}`),!o.ok){let s="Failed to fetch secrets.";401===o.status||403===o.status?s="Please run 'dashnex login' to authenticate.":404===o.status?s="Business has no application.":502===o.status&&(s="Error fetching secrets. Make sure your application is deployed."),console.error(e.red(s)),process.exit(1)}const t=(await o.json()).secrets??[];if(0===t.length)return void console.log(e.yellow("No secrets set."));console.log(e.bold(`\nSecrets (${t.length}):\n`)),t.forEach(({name:s})=>{console.log(` ${e.cyan(s)}`)}),console.log("")}catch(u){if(h.stop(),o(u),u instanceof Error&&u.message.startsWith("EXIT:"))throw u;if(i(u))return void console.log(e.yellow(a));console.error(e.red("Could not reach DashNex API. Check your connection and try again.")),process.exit(1)}}}export{c as ListSecretsCommand};
@@ -0,0 +1 @@
1
+ import e from"inquirer";import t from"chalk";import{debug as s,debugError as r}from"../../lib/debug.js";import{getBusinessApiBase as o}from"../../lib/api.js";import{ensureLoggedIn as a}from"../../services/auth.js";import{createSpinner as i}from"../../lib/spinner.js";import{isUserInterrupt as n,INTERRUPTED_MESSAGE as c}from"../../lib/errors.js";class l{async execute(l={}){s("Secrets set flow started");let{name:u,value:m}=l;if(!u){u=(await e.prompt([{type:"input",name:"name",message:"Secret name:",validate:e=>""!==e.trim()||"Name is required"}])).name.trim()}if(!m){m=(await e.prompt([{type:"password",name:"value",message:`Enter value for ${u}:`,mask:"*",validate:e=>""!==e||"Value is required"}])).value}const p=await a();if(!p)return;const f=`${o()}/business/v1/cli/secrets`;s(`PUT ${f}`);const d=i();d.start(`Setting secret '${u}'...`);try{const e=await fetch(f,{method:"PUT",headers:{Authorization:`Bearer ${p.token}`,"Content-Type":"application/json"},body:JSON.stringify({name:u,value:m})});if(d.stop(),s(`Response: ${e.status}`),!e.ok){let s="Failed to set secret.";401===e.status||403===e.status?s="Please run 'dashnex login' to authenticate.":400===e.status?s="Missing or empty name / value.":404===e.status?s="Business has no application.":502===e.status&&(s="Error setting secret. Make sure your application is deployed."),console.error(t.red(s)),process.exit(1)}s(`Secret '${u}' set successfully`),console.log(t.green(`Secret '${u}' set successfully.`))}catch(h){if(d.stop(),r(h),h instanceof Error&&h.message.startsWith("EXIT:"))throw h;if(n(h))return void console.log(t.yellow(c));console.error(t.red("Could not reach DashNex API. Check your connection and try again.")),process.exit(1)}}}export{l as SetSecretCommand};
@@ -1 +1 @@
1
- const e="@dashnex/cli",a="0.5.48",n="Command-line interface for DashNex framework",o={name:e,version:a,description:n};export{o as default,n as description,e as name,a as version};
1
+ const e="@dashnex/cli",a="0.5.50",n="Command-line interface for DashNex framework",o={name:e,version:a,description:n};export{o as default,n as description,e as name,a as version};
@@ -0,0 +1,7 @@
1
+ import { CliCommand } from '@dashnex/types';
2
+ export interface DeleteSecretCommandOptions {
3
+ name?: string;
4
+ }
5
+ export declare class DeleteSecretCommand implements CliCommand {
6
+ execute(options?: DeleteSecretCommandOptions): Promise<void>;
7
+ }
@@ -0,0 +1,3 @@
1
+ import { CliCommandConfig } from '@dashnex/types';
2
+ declare const secretsCommand: CliCommandConfig;
3
+ export default secretsCommand;
@@ -0,0 +1,4 @@
1
+ import { CliCommand } from '@dashnex/types';
2
+ export declare class ListSecretsCommand implements CliCommand {
3
+ execute(): Promise<void>;
4
+ }
@@ -0,0 +1,8 @@
1
+ import { CliCommand } from '@dashnex/types';
2
+ export interface SetSecretCommandOptions {
3
+ name?: string;
4
+ value?: string;
5
+ }
6
+ export declare class SetSecretCommand implements CliCommand {
7
+ execute(options?: SetSecretCommandOptions): Promise<void>;
8
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package",
3
3
  "name": "dashnex",
4
- "version": "0.5.48",
4
+ "version": "0.5.50",
5
5
  "description": "Command-line interface for DashNex framework",
6
6
  "homepage": "https://dashnex.io",
7
7
  "type": "module",