@timbrix/cli 0.1.0

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 (104) hide show
  1. package/README.md +319 -0
  2. package/bin/run.js +5 -0
  3. package/dist/commands/api-keys/create.d.ts +12 -0
  4. package/dist/commands/api-keys/create.d.ts.map +1 -0
  5. package/dist/commands/api-keys/create.js +65 -0
  6. package/dist/commands/api-keys/delete.d.ts +14 -0
  7. package/dist/commands/api-keys/delete.d.ts.map +1 -0
  8. package/dist/commands/api-keys/delete.js +55 -0
  9. package/dist/commands/api-keys/get.d.ts +13 -0
  10. package/dist/commands/api-keys/get.d.ts.map +1 -0
  11. package/dist/commands/api-keys/get.js +46 -0
  12. package/dist/commands/api-keys/list.d.ts +10 -0
  13. package/dist/commands/api-keys/list.d.ts.map +1 -0
  14. package/dist/commands/api-keys/list.js +61 -0
  15. package/dist/commands/login.d.ts +11 -0
  16. package/dist/commands/login.d.ts.map +1 -0
  17. package/dist/commands/login.js +67 -0
  18. package/dist/commands/logout.d.ts +7 -0
  19. package/dist/commands/logout.d.ts.map +1 -0
  20. package/dist/commands/logout.js +19 -0
  21. package/dist/commands/oauth-apps/create.d.ts +12 -0
  22. package/dist/commands/oauth-apps/create.d.ts.map +1 -0
  23. package/dist/commands/oauth-apps/create.js +96 -0
  24. package/dist/commands/oauth-apps/delete.d.ts +13 -0
  25. package/dist/commands/oauth-apps/delete.d.ts.map +1 -0
  26. package/dist/commands/oauth-apps/delete.js +49 -0
  27. package/dist/commands/oauth-apps/get.d.ts +10 -0
  28. package/dist/commands/oauth-apps/get.d.ts.map +1 -0
  29. package/dist/commands/oauth-apps/get.js +41 -0
  30. package/dist/commands/oauth-apps/list.d.ts +10 -0
  31. package/dist/commands/oauth-apps/list.d.ts.map +1 -0
  32. package/dist/commands/oauth-apps/list.js +55 -0
  33. package/dist/commands/organizations/create.d.ts +11 -0
  34. package/dist/commands/organizations/create.d.ts.map +1 -0
  35. package/dist/commands/organizations/create.js +69 -0
  36. package/dist/commands/organizations/delete.d.ts +13 -0
  37. package/dist/commands/organizations/delete.d.ts.map +1 -0
  38. package/dist/commands/organizations/delete.js +50 -0
  39. package/dist/commands/organizations/get.d.ts +10 -0
  40. package/dist/commands/organizations/get.d.ts.map +1 -0
  41. package/dist/commands/organizations/get.js +46 -0
  42. package/dist/commands/organizations/list.d.ts +7 -0
  43. package/dist/commands/organizations/list.d.ts.map +1 -0
  44. package/dist/commands/organizations/list.js +40 -0
  45. package/dist/commands/products/create.d.ts +17 -0
  46. package/dist/commands/products/create.d.ts.map +1 -0
  47. package/dist/commands/products/create.js +112 -0
  48. package/dist/commands/products/delete.d.ts +12 -0
  49. package/dist/commands/products/delete.d.ts.map +1 -0
  50. package/dist/commands/products/delete.js +52 -0
  51. package/dist/commands/products/get.d.ts +11 -0
  52. package/dist/commands/products/get.d.ts.map +1 -0
  53. package/dist/commands/products/get.js +54 -0
  54. package/dist/commands/products/list.d.ts +13 -0
  55. package/dist/commands/products/list.d.ts.map +1 -0
  56. package/dist/commands/products/list.js +75 -0
  57. package/dist/commands/products/update.d.ts +18 -0
  58. package/dist/commands/products/update.d.ts.map +1 -0
  59. package/dist/commands/products/update.js +86 -0
  60. package/dist/commands/update.d.ts +16 -0
  61. package/dist/commands/update.d.ts.map +1 -0
  62. package/dist/commands/update.js +91 -0
  63. package/dist/commands/webhooks/create.d.ts +11 -0
  64. package/dist/commands/webhooks/create.d.ts.map +1 -0
  65. package/dist/commands/webhooks/create.js +120 -0
  66. package/dist/commands/webhooks/delete.d.ts +14 -0
  67. package/dist/commands/webhooks/delete.d.ts.map +1 -0
  68. package/dist/commands/webhooks/delete.js +55 -0
  69. package/dist/commands/webhooks/get.d.ts +13 -0
  70. package/dist/commands/webhooks/get.d.ts.map +1 -0
  71. package/dist/commands/webhooks/get.js +45 -0
  72. package/dist/commands/webhooks/list.d.ts +10 -0
  73. package/dist/commands/webhooks/list.d.ts.map +1 -0
  74. package/dist/commands/webhooks/list.js +49 -0
  75. package/dist/config/auth.d.ts +31 -0
  76. package/dist/config/auth.d.ts.map +1 -0
  77. package/dist/config/auth.js +57 -0
  78. package/dist/help.d.ts +16 -0
  79. package/dist/help.d.ts.map +1 -0
  80. package/dist/help.js +22 -0
  81. package/dist/hooks/init/update-check.d.ts +8 -0
  82. package/dist/hooks/init/update-check.d.ts.map +1 -0
  83. package/dist/hooks/init/update-check.js +9 -0
  84. package/dist/index.d.ts +2 -0
  85. package/dist/index.d.ts.map +1 -0
  86. package/dist/index.js +1 -0
  87. package/dist/utils/client.d.ts +6 -0
  88. package/dist/utils/client.d.ts.map +1 -0
  89. package/dist/utils/client.js +18 -0
  90. package/dist/utils/error.d.ts +6 -0
  91. package/dist/utils/error.d.ts.map +1 -0
  92. package/dist/utils/error.js +15 -0
  93. package/dist/utils/logo.d.ts +14 -0
  94. package/dist/utils/logo.d.ts.map +1 -0
  95. package/dist/utils/logo.js +27 -0
  96. package/dist/utils/table.d.ts +6 -0
  97. package/dist/utils/table.d.ts.map +1 -0
  98. package/dist/utils/table.js +30 -0
  99. package/dist/utils/update-notifier.d.ts +13 -0
  100. package/dist/utils/update-notifier.d.ts.map +1 -0
  101. package/dist/utils/update-notifier.js +19 -0
  102. package/oclif.manifest.json +1054 -0
  103. package/package.json +71 -0
  104. package/theme.json +27 -0
@@ -0,0 +1,120 @@
1
+ import { checkbox, input } from "@inquirer/prompts";
2
+ import { Command, Flags } from "@oclif/core";
3
+ import chalk from "chalk";
4
+ import ora from "ora";
5
+ import { createClient } from "../../utils/client.js";
6
+ import { getErrorMessage } from "../../utils/error.js";
7
+ const AVAILABLE_EVENTS = [
8
+ {
9
+ value: "organization.created",
10
+ name: "Organization Created",
11
+ },
12
+ {
13
+ value: "organization.updated",
14
+ name: "Organization Updated",
15
+ },
16
+ {
17
+ value: "organization.deleted",
18
+ name: "Organization Deleted",
19
+ },
20
+ {
21
+ value: "member.added",
22
+ name: "Member Added",
23
+ },
24
+ {
25
+ value: "member.removed",
26
+ name: "Member Removed",
27
+ },
28
+ {
29
+ value: "member.role_updated",
30
+ name: "Member Role Updated",
31
+ },
32
+ {
33
+ value: "invite.created",
34
+ name: "Invite Created",
35
+ },
36
+ {
37
+ value: "invite.accepted",
38
+ name: "Invite Accepted",
39
+ },
40
+ {
41
+ value: "invite.cancelled",
42
+ name: "Invite Cancelled",
43
+ },
44
+ {
45
+ value: "oauth_app.created",
46
+ name: "OAuth App Created",
47
+ },
48
+ {
49
+ value: "oauth_app.revoked",
50
+ name: "OAuth App Revoked",
51
+ },
52
+ {
53
+ value: "webhook.created",
54
+ name: "Webhook Created",
55
+ },
56
+ ];
57
+ export default class WebhooksCreate extends Command {
58
+ static description = "Create a new webhook";
59
+ static examples = [
60
+ "<%= config.bin %> <%= command.id %> --org acme-corp-id",
61
+ "<%= config.bin %> <%= command.id %> --org acme-corp-id --url https://example.com/webhook",
62
+ ];
63
+ static flags = {
64
+ org: Flags.string({
65
+ char: "o",
66
+ description: "Organization ID",
67
+ required: true,
68
+ }),
69
+ url: Flags.string({
70
+ char: "u",
71
+ description: "Webhook URL",
72
+ }),
73
+ };
74
+ async run() {
75
+ const { flags } = await this.parse(WebhooksCreate);
76
+ const client = createClient();
77
+ try {
78
+ // Get webhook URL
79
+ const url = flags.url ||
80
+ (await input({
81
+ message: "Webhook URL:",
82
+ validate: (value) => {
83
+ try {
84
+ new URL(value);
85
+ return true;
86
+ }
87
+ catch {
88
+ return "Please enter a valid URL";
89
+ }
90
+ },
91
+ }));
92
+ // Select events
93
+ const events = await checkbox({
94
+ message: "Select events to subscribe to:",
95
+ choices: AVAILABLE_EVENTS,
96
+ required: true,
97
+ });
98
+ if (events.length === 0) {
99
+ this.error("You must select at least one event");
100
+ }
101
+ const spinner = ora("Creating webhook...").start();
102
+ const webhook = await client.webhooks.create(flags.org, {
103
+ url,
104
+ events: events,
105
+ });
106
+ spinner.succeed(chalk.green("✓ Webhook created successfully!"));
107
+ this.log(chalk.gray("\nWebhook Details:"));
108
+ this.log(` ${chalk.bold("ID:")} ${webhook.id}`);
109
+ this.log(` ${chalk.bold("URL:")} ${webhook.url}`);
110
+ this.log(` ${chalk.bold("Events:")} ${webhook.events.join(", ")}`);
111
+ this.log(` ${chalk.bold("Active:")} ${webhook.isActive ? "Yes" : "No"}`);
112
+ if (webhook.secret) {
113
+ this.log(chalk.yellow(`\n⚠️ Save this secret - it won't be shown again:\n ${webhook.secret}`));
114
+ }
115
+ }
116
+ catch (error) {
117
+ this.error(chalk.red(`Failed to create webhook: ${getErrorMessage(error)}`));
118
+ }
119
+ }
120
+ }
@@ -0,0 +1,14 @@
1
+ import { Command } from "@oclif/core";
2
+ export default class WebhooksDelete extends Command {
3
+ static description: string;
4
+ static examples: string[];
5
+ static args: {
6
+ id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
7
+ };
8
+ static flags: {
9
+ org: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
10
+ force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
+ };
12
+ run(): Promise<void>;
13
+ }
14
+ //# sourceMappingURL=delete.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../src/commands/webhooks/delete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAe,MAAM,aAAa,CAAA;AAOlD,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,OAAO;IACjD,OAAgB,WAAW,SAAiC;IAE5D,OAAgB,QAAQ,WAGvB;IAED,OAAgB,IAAI;;MAKnB;IAED,OAAgB,KAAK;;;MAWpB;IAEY,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAkClC"}
@@ -0,0 +1,55 @@
1
+ import { Command, Args, Flags } from "@oclif/core";
2
+ import { confirm } from "@inquirer/prompts";
3
+ import { createClient } from "../../utils/client.js";
4
+ import { getErrorMessage } from "../../utils/error.js";
5
+ import chalk from "chalk";
6
+ import ora from "ora";
7
+ export default class WebhooksDelete extends Command {
8
+ static description = "Delete a webhook (PERMANENT)";
9
+ static examples = [
10
+ "<%= config.bin %> <%= command.id %> webhook-id --org acme-corp-id",
11
+ "<%= config.bin %> <%= command.id %> webhook-id --org acme-corp-id --force",
12
+ ];
13
+ static args = {
14
+ id: Args.string({
15
+ description: "Webhook ID",
16
+ required: true,
17
+ }),
18
+ };
19
+ static flags = {
20
+ org: Flags.string({
21
+ char: "o",
22
+ description: "Organization ID",
23
+ required: true,
24
+ }),
25
+ force: Flags.boolean({
26
+ char: "f",
27
+ description: "Skip confirmation prompt",
28
+ default: false,
29
+ }),
30
+ };
31
+ async run() {
32
+ const { args, flags } = await this.parse(WebhooksDelete);
33
+ const client = createClient();
34
+ try {
35
+ // Confirm deletion
36
+ if (!flags.force) {
37
+ const confirmed = await confirm({
38
+ message: chalk.yellow(`Are you sure you want to delete this webhook? This action cannot be undone.`),
39
+ default: false,
40
+ });
41
+ if (!confirmed) {
42
+ this.log(chalk.gray("Deletion cancelled"));
43
+ return;
44
+ }
45
+ }
46
+ const spinner = ora("Deleting webhook...").start();
47
+ await client.webhooks.delete(flags.org, args.id);
48
+ spinner.succeed(chalk.green("✓ Webhook deleted successfully!"));
49
+ this.log(chalk.gray("\nThe webhook will stop receiving events immediately."));
50
+ }
51
+ catch (error) {
52
+ this.error(chalk.red(`Failed to delete webhook: ${getErrorMessage(error)}`));
53
+ }
54
+ }
55
+ }
@@ -0,0 +1,13 @@
1
+ import { Command } from "@oclif/core";
2
+ export default class WebhooksGet extends Command {
3
+ static description: string;
4
+ static examples: string[];
5
+ static args: {
6
+ id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
7
+ };
8
+ static flags: {
9
+ org: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
10
+ };
11
+ run(): Promise<void>;
12
+ }
13
+ //# sourceMappingURL=get.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../src/commands/webhooks/get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAe,MAAM,aAAa,CAAA;AAMlD,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,OAAO;IAC9C,OAAgB,WAAW,SAAwB;IAEnD,OAAgB,QAAQ,WAEvB;IAED,OAAgB,IAAI;;MAKnB;IAED,OAAgB,KAAK;;MAMpB;IAEY,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA6BlC"}
@@ -0,0 +1,45 @@
1
+ import { Command, Args, Flags } from "@oclif/core";
2
+ import { createClient } from "../../utils/client.js";
3
+ import { getErrorMessage } from "../../utils/error.js";
4
+ import chalk from "chalk";
5
+ import ora from "ora";
6
+ export default class WebhooksGet extends Command {
7
+ static description = "Get webhook details";
8
+ static examples = [
9
+ "<%= config.bin %> <%= command.id %> webhook-id --org acme-corp-id",
10
+ ];
11
+ static args = {
12
+ id: Args.string({
13
+ description: "Webhook ID",
14
+ required: true,
15
+ }),
16
+ };
17
+ static flags = {
18
+ org: Flags.string({
19
+ char: "o",
20
+ description: "Organization ID",
21
+ required: true,
22
+ }),
23
+ };
24
+ async run() {
25
+ const { args, flags } = await this.parse(WebhooksGet);
26
+ const client = createClient();
27
+ const spinner = ora("Fetching webhook...").start();
28
+ try {
29
+ const webhook = await client.webhooks.get(flags.org, args.id);
30
+ spinner.stop();
31
+ this.log(chalk.cyan.bold("\nWebhook Details:"));
32
+ this.log(` ${chalk.bold("ID:")} ${webhook.id}`);
33
+ this.log(` ${chalk.bold("Organization ID:")} ${webhook.organizationId}`);
34
+ this.log(` ${chalk.bold("URL:")} ${webhook.url}`);
35
+ this.log(` ${chalk.bold("Events:")} ${webhook.events.join(", ")}`);
36
+ this.log(` ${chalk.bold("Active:")} ${webhook.isActive ? chalk.green("Yes") : chalk.red("No")}`);
37
+ this.log(` ${chalk.bold("Created:")} ${new Date(webhook.createdAt).toLocaleString()}`);
38
+ this.log(` ${chalk.bold("Updated:")} ${new Date(webhook.updatedAt).toLocaleString()}`);
39
+ }
40
+ catch (error) {
41
+ spinner.fail(chalk.red("Failed to fetch webhook"));
42
+ this.error(getErrorMessage(error));
43
+ }
44
+ }
45
+ }
@@ -0,0 +1,10 @@
1
+ import { Command } from "@oclif/core";
2
+ export default class WebhooksList extends Command {
3
+ static description: string;
4
+ static examples: string[];
5
+ static flags: {
6
+ org: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
7
+ };
8
+ run(): Promise<void>;
9
+ }
10
+ //# sourceMappingURL=list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/webhooks/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAS,MAAM,aAAa,CAAA;AAQ5C,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,OAAO;IAC/C,OAAgB,WAAW,SAA0C;IAErE,OAAgB,QAAQ,WAEvB;IAED,OAAgB,KAAK;;MAMpB;IAEY,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAuClC"}
@@ -0,0 +1,49 @@
1
+ import { Command, Flags } from "@oclif/core";
2
+ import chalk from "chalk";
3
+ import ora from "ora";
4
+ import { createClient } from "../../utils/client.js";
5
+ import { getErrorMessage } from "../../utils/error.js";
6
+ import { createTable, truncate } from "../../utils/table.js";
7
+ export default class WebhooksList extends Command {
8
+ static description = "List all webhooks for an organization";
9
+ static examples = [
10
+ "<%= config.bin %> <%= command.id %> --org acme-corp-id",
11
+ ];
12
+ static flags = {
13
+ org: Flags.string({
14
+ char: "o",
15
+ description: "Organization ID",
16
+ required: true,
17
+ }),
18
+ };
19
+ async run() {
20
+ const { flags } = await this.parse(WebhooksList);
21
+ const client = createClient();
22
+ const spinner = ora("Fetching webhooks...").start();
23
+ try {
24
+ const webhooks = await client.webhooks.list(flags.org);
25
+ spinner.stop();
26
+ if (webhooks.length === 0) {
27
+ this.log(chalk.yellow("No webhooks found"));
28
+ this.log(chalk.gray(`\nCreate a webhook with: timbrix webhooks create --org ${flags.org}`));
29
+ return;
30
+ }
31
+ const table = createTable(["ID", "URL", "Events", "Active", "Created"]);
32
+ webhooks.forEach((webhook) => {
33
+ table.push([
34
+ webhook.id.substring(0, 8) + "...",
35
+ truncate(webhook.url, 40),
36
+ webhook.events.length.toString(),
37
+ webhook.isActive ? chalk.green("✓") : chalk.red("✗"),
38
+ new Date(webhook.createdAt).toLocaleDateString(),
39
+ ]);
40
+ });
41
+ this.log(table.toString());
42
+ this.log(chalk.gray(`\nTotal: ${webhooks.length} webhook(s)`));
43
+ }
44
+ catch (error) {
45
+ spinner.fail(chalk.red("Failed to fetch webhooks"));
46
+ this.error(getErrorMessage(error));
47
+ }
48
+ }
49
+ }
@@ -0,0 +1,31 @@
1
+ export declare class AuthManager {
2
+ /**
3
+ * Save authentication credentials
4
+ */
5
+ static save(token: string, email: string, baseUrl?: string): void;
6
+ /**
7
+ * Get bearer token
8
+ */
9
+ static getToken(): string | undefined;
10
+ /**
11
+ * Get email
12
+ */
13
+ static getEmail(): string | undefined;
14
+ /**
15
+ * Get base URL
16
+ */
17
+ static getBaseUrl(): string;
18
+ /**
19
+ * Check if user is authenticated
20
+ */
21
+ static isAuthenticated(): boolean;
22
+ /**
23
+ * Clear authentication (logout)
24
+ */
25
+ static clear(): void;
26
+ /**
27
+ * Get config file path
28
+ */
29
+ static getConfigPath(): string;
30
+ }
31
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/config/auth.ts"],"names":[],"mappings":"AAgBA,qBAAa,WAAW;IACtB;;OAEG;IACH,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI;IAQjE;;OAEG;IACH,MAAM,CAAC,QAAQ,IAAI,MAAM,GAAG,SAAS;IAIrC;;OAEG;IACH,MAAM,CAAC,QAAQ,IAAI,MAAM,GAAG,SAAS;IAIrC;;OAEG;IACH,MAAM,CAAC,UAAU,IAAI,MAAM;IAI3B;;OAEG;IACH,MAAM,CAAC,eAAe,IAAI,OAAO;IAIjC;;OAEG;IACH,MAAM,CAAC,KAAK,IAAI,IAAI;IAKpB;;OAEG;IACH,MAAM,CAAC,aAAa,IAAI,MAAM;CAG/B"}
@@ -0,0 +1,57 @@
1
+ import Conf from "conf";
2
+ import { homedir } from "node:os";
3
+ import { join } from "node:path";
4
+ const config = new Conf({
5
+ projectName: "timbrix",
6
+ configName: "config",
7
+ cwd: join(homedir(), ".timbrix"),
8
+ });
9
+ export class AuthManager {
10
+ /**
11
+ * Save authentication credentials
12
+ */
13
+ static save(token, email, baseUrl) {
14
+ config.set("bearerToken", token);
15
+ config.set("email", email);
16
+ if (baseUrl) {
17
+ config.set("baseUrl", baseUrl);
18
+ }
19
+ }
20
+ /**
21
+ * Get bearer token
22
+ */
23
+ static getToken() {
24
+ return config.get("bearerToken");
25
+ }
26
+ /**
27
+ * Get email
28
+ */
29
+ static getEmail() {
30
+ return config.get("email");
31
+ }
32
+ /**
33
+ * Get base URL
34
+ */
35
+ static getBaseUrl() {
36
+ return config.get("baseUrl") || "http://localhost:3001/api";
37
+ }
38
+ /**
39
+ * Check if user is authenticated
40
+ */
41
+ static isAuthenticated() {
42
+ return !!config.get("bearerToken");
43
+ }
44
+ /**
45
+ * Clear authentication (logout)
46
+ */
47
+ static clear() {
48
+ config.delete("bearerToken");
49
+ config.delete("email");
50
+ }
51
+ /**
52
+ * Get config file path
53
+ */
54
+ static getConfigPath() {
55
+ return config.path;
56
+ }
57
+ }
package/dist/help.d.ts ADDED
@@ -0,0 +1,16 @@
1
+ import { Help } from "@oclif/core";
2
+ /**
3
+ * Custom help class that displays the Timbrix logo
4
+ * before showing help content
5
+ */
6
+ export default class CustomHelp extends Help {
7
+ /**
8
+ * Show root help with logo
9
+ */
10
+ showRootHelp(): Promise<void>;
11
+ /**
12
+ * Show command help with logo
13
+ */
14
+ showCommandHelp(command: Parameters<Help["showCommandHelp"]>[0]): Promise<void>;
15
+ }
16
+ //# sourceMappingURL=help.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../src/help.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAGlC;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,IAAI;IAC1C;;OAEG;IACG,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAKnC;;OAEG;IACG,eAAe,CACnB,OAAO,EAAE,UAAU,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,GAC9C,OAAO,CAAC,IAAI,CAAC;CAIjB"}
package/dist/help.js ADDED
@@ -0,0 +1,22 @@
1
+ import { Help } from "@oclif/core";
2
+ import { displayLogo } from "./utils/logo.js";
3
+ /**
4
+ * Custom help class that displays the Timbrix logo
5
+ * before showing help content
6
+ */
7
+ export default class CustomHelp extends Help {
8
+ /**
9
+ * Show root help with logo
10
+ */
11
+ async showRootHelp() {
12
+ displayLogo(false);
13
+ await super.showRootHelp();
14
+ }
15
+ /**
16
+ * Show command help with logo
17
+ */
18
+ async showCommandHelp(command) {
19
+ displayLogo(false);
20
+ await super.showCommandHelp(command);
21
+ }
22
+ }
@@ -0,0 +1,8 @@
1
+ import { Hook } from "@oclif/core";
2
+ /**
3
+ * Init hook that checks for CLI updates before any command runs.
4
+ * This hook runs when the CLI is initialized, before a command is found to run.
5
+ */
6
+ declare const hook: Hook.Init;
7
+ export default hook;
8
+ //# sourceMappingURL=update-check.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-check.d.ts","sourceRoot":"","sources":["../../../src/hooks/init/update-check.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAGlC;;;GAGG;AACH,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,IAEhB,CAAA;AAED,eAAe,IAAI,CAAA"}
@@ -0,0 +1,9 @@
1
+ import { checkForUpdates } from "../../utils/update-notifier.js";
2
+ /**
3
+ * Init hook that checks for CLI updates before any command runs.
4
+ * This hook runs when the CLI is initialized, before a command is found to run.
5
+ */
6
+ const hook = async function () {
7
+ checkForUpdates();
8
+ };
9
+ export default hook;
@@ -0,0 +1,2 @@
1
+ export { run } from "@oclif/core";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ export { run } from "@oclif/core";
@@ -0,0 +1,6 @@
1
+ import { Timbrix } from "@timbrix/sdk";
2
+ /**
3
+ * Create an authenticated Timbrix client
4
+ */
5
+ export declare function createClient(): Timbrix;
6
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/utils/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAItC;;GAEG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAetC"}
@@ -0,0 +1,18 @@
1
+ import { Timbrix } from "@timbrix/sdk";
2
+ import chalk from "chalk";
3
+ import { AuthManager } from "../config/auth.js";
4
+ /**
5
+ * Create an authenticated Timbrix client
6
+ */
7
+ export function createClient() {
8
+ const token = AuthManager.getToken();
9
+ const baseUrl = AuthManager.getBaseUrl();
10
+ if (!token) {
11
+ console.error(chalk.red("Error: Not authenticated. Please run 'timbrix login' first."));
12
+ process.exit(1);
13
+ }
14
+ return new Timbrix({
15
+ bearerToken: token,
16
+ baseUrl,
17
+ });
18
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Extract error message from various error types
3
+ * Handles ky HTTPError, regular Error, and unknown errors
4
+ */
5
+ export declare function getErrorMessage(error: unknown): string;
6
+ //# sourceMappingURL=error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/utils/error.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAWtD"}
@@ -0,0 +1,15 @@
1
+ import { HTTPError } from "ky";
2
+ /**
3
+ * Extract error message from various error types
4
+ * Handles ky HTTPError, regular Error, and unknown errors
5
+ */
6
+ export function getErrorMessage(error) {
7
+ if (error instanceof HTTPError) {
8
+ // HTTPError.message usually contains useful information
9
+ return error.message;
10
+ }
11
+ if (error instanceof Error) {
12
+ return error.message;
13
+ }
14
+ return "An unknown error occurred";
15
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Timbrix ASCII logo
3
+ * Displayed at CLI startup and help commands
4
+ */
5
+ export declare const logo: string;
6
+ /**
7
+ * Compact version of the logo for smaller displays
8
+ */
9
+ export declare const logoCompact: string;
10
+ /**
11
+ * Display the logo with optional tagline
12
+ */
13
+ export declare function displayLogo(showTagline?: boolean): void;
14
+ //# sourceMappingURL=logo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logo.d.ts","sourceRoot":"","sources":["../../src/utils/logo.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,IAAI,QAOhB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,WAAW,QAA6B,CAAA;AAErD;;GAEG;AACH,wBAAgB,WAAW,CAAC,WAAW,UAAO,GAAG,IAAI,CAMpD"}
@@ -0,0 +1,27 @@
1
+ import chalk from "chalk";
2
+ /**
3
+ * Timbrix ASCII logo
4
+ * Displayed at CLI startup and help commands
5
+ */
6
+ export const logo = `
7
+ ${chalk.cyan(" _____ _ _ _ ")}
8
+ ${chalk.cyan(" |_ _(_)_ __ ___ | |__ _ __(_)_ __")}
9
+ ${chalk.cyan(" | | | | '_ ` _ \\| '_ \\| '__| \\ \\/ /")}
10
+ ${chalk.cyan(" | | | | | | | | | |_) | | | |> < ")}
11
+ ${chalk.cyan(" |_| |_|_| |_| |_|_.__/|_| |_/_/\\_\\")}
12
+ ${chalk.cyan(" ")}
13
+ `;
14
+ /**
15
+ * Compact version of the logo for smaller displays
16
+ */
17
+ export const logoCompact = chalk.cyan.bold("TIMBRIX");
18
+ /**
19
+ * Display the logo with optional tagline
20
+ */
21
+ export function displayLogo(showTagline = true) {
22
+ console.log(logo);
23
+ if (showTagline) {
24
+ console.log(chalk.dim(" CLI tool for Timbrix API"));
25
+ console.log();
26
+ }
27
+ }
@@ -0,0 +1,6 @@
1
+ import Table from "cli-table3";
2
+ export declare function createTable(headers: string[]): Table.Table;
3
+ export declare function formatDate(date: string): string;
4
+ export declare function formatDateTime(date: string): string;
5
+ export declare function truncate(str: string, length: number): string;
6
+ //# sourceMappingURL=table.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../src/utils/table.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,YAAY,CAAA;AAG9B,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC,KAAK,CAQ1D;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAM/C;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQnD;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAE5D"}
@@ -0,0 +1,30 @@
1
+ import Table from "cli-table3";
2
+ import chalk from "chalk";
3
+ export function createTable(headers) {
4
+ return new Table({
5
+ head: headers.map((h) => chalk.cyan.bold(h)),
6
+ style: {
7
+ head: [],
8
+ border: ["gray"],
9
+ },
10
+ });
11
+ }
12
+ export function formatDate(date) {
13
+ return new Date(date).toLocaleDateString("en-US", {
14
+ year: "numeric",
15
+ month: "short",
16
+ day: "numeric",
17
+ });
18
+ }
19
+ export function formatDateTime(date) {
20
+ return new Date(date).toLocaleString("en-US", {
21
+ year: "numeric",
22
+ month: "short",
23
+ day: "numeric",
24
+ hour: "2-digit",
25
+ minute: "2-digit",
26
+ });
27
+ }
28
+ export function truncate(str, length) {
29
+ return str.length > length ? str.substring(0, length - 3) + "..." : str;
30
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Check for updates to the CLI and notify the user if a new version is available.
3
+ * Uses update-notifier with a 1-week check interval.
4
+ *
5
+ * The update check is done in a non-blocking child process and will:
6
+ * - Skip in CI environments
7
+ * - Skip during tests (NODE_ENV=test)
8
+ * - Respect NO_UPDATE_NOTIFIER environment variable
9
+ * - Only notify in TTY environments
10
+ * - Defer notification until process exit
11
+ */
12
+ export declare function checkForUpdates(): void;
13
+ //# sourceMappingURL=update-notifier.d.ts.map