Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ memberstack whoami
## Usage

```bash
memberstack <command> <subcommand> [options]
memberstack <command> [subcommand] [params] [options]
```

## Install Agent Skill (Optional)
Expand Down
4 changes: 3 additions & 1 deletion src/commands/apps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ const APP_FIELDS = `
allowMemberSelfDelete
`;

export const appsCommand = new Command("apps").description("Manage apps");
export const appsCommand = new Command("apps")
.usage("<command> [options]")
.description("Manage apps");

appsCommand
.command("current")
Expand Down
6 changes: 3 additions & 3 deletions src/commands/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ const findAvailablePort = (): Promise<number> =>
server.on("error", reject);
});

export const authCommand = new Command("auth").description(
"Manage OAuth authentication"
);
export const authCommand = new Command("auth")
.usage("<command> [options]")
.description("Manage OAuth authentication");

authCommand
.command("login")
Expand Down
6 changes: 3 additions & 3 deletions src/commands/custom-fields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ const CUSTOM_FIELD_FIELDS = `
tableOrder
`;

export const customFieldsCommand = new Command("custom-fields").description(
"Manage custom fields"
);
export const customFieldsCommand = new Command("custom-fields")
.usage("<command> [options]")
.description("Manage custom fields");

customFieldsCommand
.command("list")
Expand Down
6 changes: 3 additions & 3 deletions src/commands/members.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,9 @@ const collect = (value: string, previous: string[]): string[] => [
value,
];

export const membersCommand = new Command("members").description(
"Manage members"
);
export const membersCommand = new Command("members")
.usage("<command> [options]")
.description("Manage members");

membersCommand
.command("list")
Expand Down
4 changes: 3 additions & 1 deletion src/commands/plans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,9 @@ const parseRedirects = (entries: string[]): Record<string, string> => {
return redirects;
};

export const plansCommand = new Command("plans").description("Manage plans");
export const plansCommand = new Command("plans")
.usage("<command> [options]")
.description("Manage plans");

plansCommand
.command("list")
Expand Down
6 changes: 3 additions & 3 deletions src/commands/records.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ const resolveTableId = async (tableKey: string): Promise<string> => {
return result.dataTable.id;
};

export const recordsCommand = new Command("records").description(
"Manage data table records"
);
export const recordsCommand = new Command("records")
.usage("<command> [options]")
.description("Manage data table records");

recordsCommand
.command("create")
Expand Down
6 changes: 3 additions & 3 deletions src/commands/skills.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ const runSkillsCommand = async (args: string[]): Promise<void> => {
await execAsync(`npx skills ${args.join(" ")}`);
};

export const skillsCommand = new Command("skills").description(
"Manage Memberstack skills"
);
export const skillsCommand = new Command("skills")
.usage("<command> [options]")
.description("Manage Memberstack skills");

skillsCommand
.command("add")
Expand Down
6 changes: 3 additions & 3 deletions src/commands/tables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ const TABLE_FIELDS = `
}
`;

export const tablesCommand = new Command("tables").description(
"Manage data tables"
);
export const tablesCommand = new Command("tables")
.usage("<command> [options]")
.description("Manage data tables");

tablesCommand
.command("list")
Expand Down
20 changes: 17 additions & 3 deletions src/lib/program.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
import { Command } from "commander";

declare const __VERSION__: string | undefined;
const version = typeof __VERSION__ !== "undefined" ? __VERSION__ : "dev";

export const program = new Command();

program
.name("Memberstack CLI")
.name("memberstack")
.usage("<command> [subcommand] [params] [options]")
.description("Manage your Memberstack account from the terminal.")
.version("0.0.0")
.version(version)
.option("-j, --json", "Output raw JSON instead of formatted tables")
.option("--live", "Use live environment instead of sandbox");
.option("--live", "Use live environment instead of sandbox")
.addHelpText(
"after",
`
Examples:
$ memberstack auth login
$ memberstack members list --json
$ memberstack plans create --name "Pro Plan"
$ memberstack records find users --where "status equals active"
$ memberstack skills add memberstack-cli`
);
6 changes: 6 additions & 0 deletions tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import { readFileSync } from "node:fs";
import { defineConfig } from "tsup";

const pkg = JSON.parse(readFileSync("./package.json", "utf-8"));

export default defineConfig({
entry: ["src/index.ts"],
format: ["esm"],
banner: {
js: "#!/usr/bin/env node",
},
clean: true,
define: {
__VERSION__: JSON.stringify(pkg.version),
},
});