@fireberry/cli 0.2.1 → 0.2.2-beta.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.
package/CLAUDE.md CHANGED
@@ -107,7 +107,7 @@ Component utilities in [src/utils/components.utils.ts](src/utils/components.util
107
107
  # For global-menu type:
108
108
  displayName: "Menu Name"
109
109
  # For side-menu type:
110
- icon: "icon-name"
110
+ iconName: "icon-name"
111
111
  width: "S" | "M" | "L"
112
112
  ```
113
113
 
@@ -150,7 +150,7 @@ Component paths in manifest.yml are relative to the current working directory, n
150
150
  - **Component Settings Validation**: Each component type has required settings that are validated during `push`:
151
151
  - `record`: Must have `iconName`, `iconColor`, and `objectType`
152
152
  - `global-menu`: Must have `displayName`
153
- - `side-menu`: Must have `icon` and `width` (S/M/L)
153
+ - `side-menu`: Must have `iconName` and `width` (S/M/L)
154
154
  - **Build Zipping**: Single files are wrapped in a directory before tar.gz creation
155
155
  - **Template Location**: Templates are resolved from `src/templates/` at compile time, copied to `dist/templates/`
156
156
  - **Delete Safety**: Delete command requires user confirmation before executing (cannot be undone)
@@ -4,5 +4,4 @@ export declare const createApp: (manifest: Manifest) => Promise<void>;
4
4
  export declare const pushComponents: (appId: string, components: ZippedComponent[], manifest: Manifest) => Promise<void>;
5
5
  export declare const installApp: (manifest: Manifest) => Promise<void>;
6
6
  export declare const deleteApp: (manifest: Manifest) => Promise<void>;
7
- export declare const startDebug: (appId: string, componentId: string, debugUrl: string, manifest: Manifest) => Promise<void>;
8
- export declare const stopDebug: (appId: string, componentId: string, manifest: Manifest) => Promise<void>;
7
+ export declare const updateDebug: (componentId: string, manifest: Manifest, debugUrl?: string) => Promise<void>;
@@ -37,19 +37,10 @@ export const deleteApp = async (manifest) => {
37
37
  throw new Error(error instanceof Error ? error.message : "Unknown error");
38
38
  }
39
39
  };
40
- export const startDebug = async (appId, componentId, debugUrl, manifest) => {
40
+ export const updateDebug = async (componentId, manifest, debugUrl) => {
41
41
  const url = `${BASE_SERVICE_URL}/debug`;
42
42
  try {
43
- await api.post(url, { appId, componentId, debugUrl, manifest });
44
- }
45
- catch (error) {
46
- throw new Error(error instanceof Error ? error.message : "Unknown error");
47
- }
48
- };
49
- export const stopDebug = async (appId, componentId, manifest) => {
50
- const url = `${BASE_SERVICE_URL}/debug`;
51
- try {
52
- await api.delete(url, { appId, componentId, manifest });
43
+ await api.post(url, { componentId, debugUrl, manifest });
53
44
  }
54
45
  catch (error) {
55
46
  throw new Error(error instanceof Error ? error.message : "Unknown error");
@@ -27,9 +27,10 @@ export interface RecordComponentSettings {
27
27
  }
28
28
  export interface GlobalMenuComponentSettings {
29
29
  displayName: string;
30
+ iconName?: string;
30
31
  }
31
32
  export interface SideMenuComponentSettings {
32
- icon: string;
33
+ iconName: string;
33
34
  width: "S" | "M" | "L";
34
35
  }
35
36
  export type ComponentSettings = RecordComponentSettings | GlobalMenuComponentSettings | SideMenuComponentSettings;
@@ -1,6 +1,6 @@
1
1
  import ora from "ora";
2
2
  import chalk from "chalk";
3
- import { startDebug, stopDebug } from "../api/requests.js";
3
+ import { updateDebug } from "../api/requests.js";
4
4
  import { getManifest } from "../utils/components.utils.js";
5
5
  function validateDebugUrl(url) {
6
6
  const localhostPattern = /^localhost:\d+$/;
@@ -10,7 +10,7 @@ function validateDebugUrl(url) {
10
10
  }
11
11
  }
12
12
  function validateComponentExists(manifest, componentId) {
13
- const component = manifest.components?.find((comp) => comp.id === componentId);
13
+ const component = manifest.components?.find((comp) => comp.id.toLowerCase() === componentId.toLowerCase());
14
14
  if (!component) {
15
15
  throw new Error(`Component with ID "${componentId}" not found in manifest.\n` +
16
16
  `Available components:\n` +
@@ -24,23 +24,20 @@ export async function runDebug(componentId, url, options) {
24
24
  try {
25
25
  const manifest = await getManifest();
26
26
  spinner.succeed("Manifest loaded");
27
- // Validate component exists
28
27
  validateComponentExists(manifest, componentId);
29
28
  if (options?.stop) {
30
- // Stop debugging
31
29
  spinner.start("Stopping debug mode...");
32
- await stopDebug(manifest.app.id, componentId, manifest);
30
+ await updateDebug(componentId, manifest);
33
31
  spinner.succeed(chalk.green(`Debug mode stopped for component: ${componentId}`));
34
32
  }
35
33
  else {
36
- // Start debugging
37
34
  if (!url) {
38
35
  throw new Error("URL is required when starting debug mode.\n" +
39
36
  `Usage: fireberry debug ${componentId} localhost:[port]`);
40
37
  }
41
38
  validateDebugUrl(url);
42
39
  spinner.start(`Starting debug mode for component ${componentId}...`);
43
- await startDebug(manifest.app.id, componentId, url, manifest);
40
+ await updateDebug(componentId, manifest, url);
44
41
  spinner.succeed(chalk.green(`Debug mode started!\n` +
45
42
  ` Component: ${componentId}\n` +
46
43
  ` URL: ${url}\n\n` +
@@ -66,14 +66,17 @@ const validateGlobalMenuComponentSettings = (comp) => {
66
66
  if (typeof settings.displayName !== "string") {
67
67
  throw new Error(`Component "${comp.title}" (type: ${COMPONENT_TYPE.GLOBAL_MENU}) setting "displayName" must be a string`);
68
68
  }
69
+ if (settings.iconName && typeof settings.iconName !== "string") {
70
+ throw new Error(`Component "${comp.title}" (type: ${COMPONENT_TYPE.GLOBAL_MENU}) setting "iconName" must be a string`);
71
+ }
69
72
  };
70
73
  const validateSideMenuComponentSettings = (comp) => {
71
74
  const settings = comp.settings;
72
75
  if (!settings) {
73
76
  throw new Error(`Component "${comp.title}" (type: ${COMPONENT_TYPE.SIDE_MENU}) is missing required settings`);
74
77
  }
75
- if (!settings.icon) {
76
- throw new Error(`Component "${comp.title}" (type: ${COMPONENT_TYPE.SIDE_MENU}) setting "icon" must be a string`);
78
+ if (!settings.iconName) {
79
+ throw new Error(`Component "${comp.title}" (type: ${COMPONENT_TYPE.SIDE_MENU}) setting "iconName" must be a string`);
77
80
  }
78
81
  if (!settings.width) {
79
82
  throw new Error(`Component "${comp.title}" (type: ${COMPONENT_TYPE.SIDE_MENU}) setting "width" must be a S | M | L`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fireberry/cli",
3
- "version": "0.2.1",
3
+ "version": "0.2.2-beta.0",
4
4
  "description": "Fireberry CLI tool",
5
5
  "type": "module",
6
6
  "author": "",
@@ -43,28 +43,14 @@ export const deleteApp = async (manifest: Manifest): Promise<void> => {
43
43
  }
44
44
  };
45
45
 
46
- export const startDebug = async (
47
- appId: string,
46
+ export const updateDebug = async (
48
47
  componentId: string,
49
- debugUrl: string,
50
- manifest: Manifest
51
- ): Promise<void> => {
52
- const url = `${BASE_SERVICE_URL}/debug`;
53
- try {
54
- await api.post<void>(url, { appId, componentId, debugUrl, manifest });
55
- } catch (error) {
56
- throw new Error(error instanceof Error ? error.message : "Unknown error");
57
- }
58
- };
59
-
60
- export const stopDebug = async (
61
- appId: string,
62
- componentId: string,
63
- manifest: Manifest
48
+ manifest: Manifest,
49
+ debugUrl?: string
64
50
  ): Promise<void> => {
65
51
  const url = `${BASE_SERVICE_URL}/debug`;
66
52
  try {
67
- await api.delete<void>(url, { appId, componentId, manifest });
53
+ await api.post<void>(url, { componentId, debugUrl, manifest });
68
54
  } catch (error) {
69
55
  throw new Error(error instanceof Error ? error.message : "Unknown error");
70
56
  }
package/src/api/types.ts CHANGED
@@ -33,10 +33,11 @@ export interface RecordComponentSettings {
33
33
 
34
34
  export interface GlobalMenuComponentSettings {
35
35
  displayName: string;
36
+ iconName?: string;
36
37
  }
37
38
 
38
39
  export interface SideMenuComponentSettings {
39
- icon: string;
40
+ iconName: string;
40
41
  width: "S" | "M" | "L";
41
42
  }
42
43
 
@@ -1,7 +1,8 @@
1
1
  import ora from "ora";
2
2
  import chalk from "chalk";
3
- import { startDebug, stopDebug } from "../api/requests.js";
3
+ import { updateDebug } from "../api/requests.js";
4
4
  import { getManifest } from "../utils/components.utils.js";
5
+ import { Manifest, ManifestComponent } from "../api/types.js";
5
6
 
6
7
  function validateDebugUrl(url: string): void {
7
8
  const localhostPattern = /^localhost:\d+$/;
@@ -14,9 +15,13 @@ function validateDebugUrl(url: string): void {
14
15
  }
15
16
  }
16
17
 
17
- function validateComponentExists(manifest: any, componentId: string): void {
18
+ function validateComponentExists(
19
+ manifest: Manifest,
20
+ componentId: string
21
+ ): void {
18
22
  const component = manifest.components?.find(
19
- (comp: any) => comp.id === componentId
23
+ (comp: ManifestComponent) =>
24
+ comp.id.toLowerCase() === componentId.toLowerCase()
20
25
  );
21
26
 
22
27
  if (!component) {
@@ -24,7 +29,7 @@ function validateComponentExists(manifest: any, componentId: string): void {
24
29
  `Component with ID "${componentId}" not found in manifest.\n` +
25
30
  `Available components:\n` +
26
31
  manifest.components
27
- ?.map((comp: any) => ` - ${comp.title} (${comp.id})`)
32
+ ?.map((comp: ManifestComponent) => ` - ${comp.title} (${comp.id})`)
28
33
  .join("\n")
29
34
  );
30
35
  }
@@ -41,18 +46,15 @@ export async function runDebug(
41
46
  const manifest = await getManifest();
42
47
  spinner.succeed("Manifest loaded");
43
48
 
44
- // Validate component exists
45
49
  validateComponentExists(manifest, componentId);
46
50
 
47
51
  if (options?.stop) {
48
- // Stop debugging
49
52
  spinner.start("Stopping debug mode...");
50
- await stopDebug(manifest.app.id, componentId, manifest);
53
+ await updateDebug(componentId, manifest);
51
54
  spinner.succeed(
52
55
  chalk.green(`Debug mode stopped for component: ${componentId}`)
53
56
  );
54
57
  } else {
55
- // Start debugging
56
58
  if (!url) {
57
59
  throw new Error(
58
60
  "URL is required when starting debug mode.\n" +
@@ -63,7 +65,7 @@ export async function runDebug(
63
65
  validateDebugUrl(url);
64
66
 
65
67
  spinner.start(`Starting debug mode for component ${componentId}...`);
66
- await startDebug(manifest.app.id, componentId, url, manifest);
68
+ await updateDebug(componentId, manifest, url);
67
69
  spinner.succeed(
68
70
  chalk.green(
69
71
  `Debug mode started!\n` +
@@ -13,7 +13,7 @@ import {
13
13
  SideMenuComponentSettings,
14
14
  } from "../api/types.js";
15
15
  import { COMPONENT_TYPE } from "../constants/component-types.js";
16
- import { HEIGHT_OPTIONS } from "../constants/height-options.js";
16
+ import { HEIGHT_OPTIONS, HeightOption } from "../constants/height-options.js";
17
17
 
18
18
  export const getManifest = async (basePath?: string): Promise<Manifest> => {
19
19
  const manifestPath = path.join(basePath || process.cwd(), "manifest.yml");
@@ -90,13 +90,17 @@ const validateRecordComponentSettings = (
90
90
  }
91
91
  if (!settings.height) {
92
92
  throw new Error(
93
- `Component "${comp.title}" (type: ${COMPONENT_TYPE.RECORD}) setting "height" must be one of: ${HEIGHT_OPTIONS.join(" | ")}`
93
+ `Component "${comp.title}" (type: ${
94
+ COMPONENT_TYPE.RECORD
95
+ }) setting "height" must be one of: ${HEIGHT_OPTIONS.join(" | ")}`
94
96
  );
95
97
  }
96
98
 
97
- if (!HEIGHT_OPTIONS.includes(settings.height as any)) {
99
+ if (!HEIGHT_OPTIONS.includes(settings.height as HeightOption)) {
98
100
  throw new Error(
99
- `Component "${comp.title}" (type: ${COMPONENT_TYPE.RECORD}) setting "height" must be one of: ${HEIGHT_OPTIONS.join(" | ")}`
101
+ `Component "${comp.title}" (type: ${
102
+ COMPONENT_TYPE.RECORD
103
+ }) setting "height" must be one of: ${HEIGHT_OPTIONS.join(" | ")}`
100
104
  );
101
105
  }
102
106
  };
@@ -125,6 +129,12 @@ const validateGlobalMenuComponentSettings = (
125
129
  `Component "${comp.title}" (type: ${COMPONENT_TYPE.GLOBAL_MENU}) setting "displayName" must be a string`
126
130
  );
127
131
  }
132
+
133
+ if (settings.iconName && typeof settings.iconName !== "string") {
134
+ throw new Error(
135
+ `Component "${comp.title}" (type: ${COMPONENT_TYPE.GLOBAL_MENU}) setting "iconName" must be a string`
136
+ );
137
+ }
128
138
  };
129
139
 
130
140
  const validateSideMenuComponentSettings = (
@@ -140,9 +150,9 @@ const validateSideMenuComponentSettings = (
140
150
  );
141
151
  }
142
152
 
143
- if (!settings.icon) {
153
+ if (!settings.iconName) {
144
154
  throw new Error(
145
- `Component "${comp.title}" (type: ${COMPONENT_TYPE.SIDE_MENU}) setting "icon" must be a string`
155
+ `Component "${comp.title}" (type: ${COMPONENT_TYPE.SIDE_MENU}) setting "iconName" must be a string`
146
156
  );
147
157
  }
148
158