@nebulit/embuilder 0.1.43 → 0.1.45
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/dist/cli.js +2 -2
- package/package.json +1 -1
- package/templates/backend/prompt.md +6 -6
- package/templates/frontend/prompt.md +24 -0
- package/templates/frontend/src/lib/api-client.ts +60 -98
- package/templates/frontend/src/lib/api.ts +28 -1028
- package/templates/frontend/src/pages/Register.tsx +3 -3
- package/templates/prompt.md +7 -6
- package/templates/frontend/src/components/tables/ReservationTemplates.tsx +0 -189
- package/templates/frontend/src/pages/Menus.tsx +0 -224
package/dist/cli.js
CHANGED
|
@@ -27,8 +27,8 @@ program
|
|
|
27
27
|
console.error(` Package location: ${__dirname}`);
|
|
28
28
|
console.error('');
|
|
29
29
|
console.error('This might be caused by:');
|
|
30
|
-
console.error(' 1. Old cached version - try: npx --yes
|
|
31
|
-
console.error(' 2. Package not published correctly - reinstall with: npm install -g @
|
|
30
|
+
console.error(' 1. Old cached version - try: npx --yes @@nebulit/embuilder@latest install');
|
|
31
|
+
console.error(' 2. Package not published correctly - reinstall with: npm install -g @nebulit/embuilder@latest');
|
|
32
32
|
console.error('');
|
|
33
33
|
console.error('If the problem persists, please report at:');
|
|
34
34
|
console.error(' https://github.com/dilgerma/embuilder/issues');
|
package/package.json
CHANGED
|
@@ -7,10 +7,10 @@ The structure defined in the Project-Skills is relevant.
|
|
|
7
7
|
## Your Task
|
|
8
8
|
|
|
9
9
|
0. Do not read the entire code base. Focus on the tasks in this description.
|
|
10
|
-
1. Read the description at `.slices/index.json` (in the same directory as this file). Every item in status "planned" is a task.
|
|
10
|
+
1. Read the description at `.slices/index.json` (in the same directory as this file). Every item in status "planned" and assigned to "backend_worker" is a task.
|
|
11
11
|
2. Read the progress log at `progress.txt` (check Codebase Patterns section first)
|
|
12
12
|
3. Make sure you are on the right branch "feature/<slicename>", if unsure, start from main.
|
|
13
|
-
5. Pick the **highest priority**
|
|
13
|
+
5. Pick the **highest priority** task assigned to backend_worker. This becomes your PRD. Set the status "InProgress", add a started_date ( including date and time ) in the index.json. If no slice has status planned, reply with:
|
|
14
14
|
<promise>NO_TASKS</promise> and stop. Do not work on other slices.
|
|
15
15
|
6. Pick the slice definition from the project root /.slices in <folder> defined in the prd. Never work on more than one slice per iteration.
|
|
16
16
|
7. A slice can define additional prompts as codegen/backendPrompt. any additional prompts defined in backend are hints for the implementation of the slice and have to be taken into account. If you use the additional prompt, add a line in progress.txt
|
|
@@ -21,12 +21,12 @@ The structure defined in the Project-Skills is relevant.
|
|
|
21
21
|
10. The slice in the json is always true, the code follows what is defined in the json
|
|
22
22
|
11. the backend of a slice is only 'Done' if business logic is implemented as defined in the JSON, APIs are implemented, all scenarios in JSON are implemented in code and it
|
|
23
23
|
fulfills the slice.json. There must be no specification in json, that has no equivalent in code.
|
|
24
|
-
12. make sure to write the ui-prompt.md as defined if defined in the skill
|
|
24
|
+
12. make sure to write the ui-prompt.md for the ui_worker as defined if defined in the skill
|
|
25
25
|
13. Run quality checks ( npm run build, npm run test ) - Attention - it´s enough to run the tests for the slice. Do not run all tests.
|
|
26
26
|
14. even if the slice is fully implemented, run your test-analyzer skill and provide the code-slice.json file as defined in the skill
|
|
27
|
-
15. Update the Slice in the index.json back to status 'Planned' and assign the 'ui-worker'
|
|
28
|
-
16. If checks pass, commit ALL changes with message: `feat: [Slice Name]
|
|
29
|
-
|
|
27
|
+
15. if the slice is an automation slice, set status to 'Done'. Otherwise - Update the Slice in the index.json back to status 'Planned' and assign the 'ui-worker'
|
|
28
|
+
16. If checks pass, commit ALL changes with message: `feat: [Slice Name]`.
|
|
29
|
+
17. if the slice stauts is 'Done', merge back.
|
|
30
30
|
17. Append your progress to `progress.txt` after each step in the iteration.
|
|
31
31
|
18. append your new learnings to AGENTS.md in a compressed form, reusable for future iterations. Only add learnings if they are not already there.
|
|
32
32
|
19. change the assignee to ui_worker and set it back to planned.
|
|
@@ -2,6 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
Build React + TypeScript UI components from slice JSON definitions using established patterns.
|
|
4
4
|
|
|
5
|
+
## Your Task
|
|
6
|
+
|
|
7
|
+
0. Do not read the entire code base. read /frontend/AGENTS.md. Focus on the tasks in this description.
|
|
8
|
+
1. Read the description at `.slices/index.json` (in the same directory as this file). Every item in status "planned" and assigned to "ui_worker" is a task.
|
|
9
|
+
2. Read the progress log at `progress.txt` (check Codebase Patterns section first)
|
|
10
|
+
3. Make sure you are on the right branch "feature/<slicename>", the branch should exist.
|
|
11
|
+
5. Pick the **highest priority** task assigned to ui_worker. This becomes your PRD. Set the status "InProgress", add a started_date ( including date and time ) in the index.json. If no slice has status planned, reply with:
|
|
12
|
+
<promise>NO_TASKS</promise> and stop. Do not work on other slices.
|
|
13
|
+
6. Pick the slice definition from the project root /.slices in <folder> defined in the prd. Never work on more than one slice per iteration.
|
|
14
|
+
7. A slice can define additional prompts as codegen/uiPrompt. any additional prompts defined in backend are hints for the implementation of the slice and have to be taken into account. If you use the additional prompt, add a line in progress.txt
|
|
15
|
+
8. Write a short progress one liner after each step to progress.txt
|
|
16
|
+
9. Analyze and Implement according to the Rest of the instructions in this file, make use of the skills in the skills directory, but also your previsously collected
|
|
17
|
+
knowledge. Make a list TODO list for what needs to be done. Also make sure to adjust the implementation according to the json definition.
|
|
18
|
+
10. The slice in the json is always true, the code follows what is defined in the json
|
|
19
|
+
11. the slice is only 'Done' if APIs are implemented.
|
|
20
|
+
12. make sure to read the ui-prompt.md in /backend/src/slices/<slice>
|
|
21
|
+
13. Run quality checks ( npm run build, tsc ) - Attention - it´s enough to run the tests for the slice. Do not run all tests.
|
|
22
|
+
15. Update the Slice in the index.json to status 'Done' and remove assignment
|
|
23
|
+
16. If checks pass, commit ALL changes with message: `feat: [Slice Name]` and merge back to main as FF merge ( update
|
|
24
|
+
first )
|
|
25
|
+
17. Append your progress to `progress.txt` after each step in the iteration.
|
|
26
|
+
18. append your new learnings to frontend/AGENTS.md in a compressed form, reusable for future iterations. Only add learnings if they are not already there.
|
|
27
|
+
20. Finish the iteration.
|
|
28
|
+
|
|
5
29
|
---
|
|
6
30
|
|
|
7
31
|
## 0. Available Skills (Use These!)
|
|
@@ -4,133 +4,95 @@
|
|
|
4
4
|
const DEFAULT_API_URL = import.meta.env.VITE_BASE_URL ?? "http://localhost:3000";
|
|
5
5
|
|
|
6
6
|
export const getApiUrl = (): string => {
|
|
7
|
-
|
|
7
|
+
return DEFAULT_API_URL;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
export const setApiUrl = (url: string): void => {
|
|
11
|
-
|
|
11
|
+
localStorage.setItem("api_base_url", url);
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
export interface ApiContext {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
token: string;
|
|
16
|
+
tenantId?: string;
|
|
17
|
+
userId?: string;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
interface ApiRequestOptions {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
method?: "GET" | "POST" | "PUT" | "DELETE";
|
|
22
|
+
body?: unknown;
|
|
23
|
+
headers?: Record<string, string>;
|
|
24
|
+
correlationId?: string;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
interface ApiResponse<T> {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
data?: T;
|
|
29
|
+
error?: string;
|
|
30
|
+
ok: boolean;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
export async function apiRequest<T>(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
endpoint: string,
|
|
35
|
+
ctx: ApiContext,
|
|
36
|
+
options: ApiRequestOptions = {}
|
|
37
37
|
): Promise<ApiResponse<T>> {
|
|
38
|
-
|
|
38
|
+
const {method = "GET", body, headers = {}, correlationId} = options;
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
const baseUrl = getApiUrl();
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
if (ctx.token) {
|
|
48
|
-
requestHeaders["Authorization"] = `Bearer ${ctx.token}`;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
if (ctx.tenantId) {
|
|
52
|
-
requestHeaders["x-tenant-id"] = ctx.tenantId;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if (ctx.userId) {
|
|
56
|
-
requestHeaders["x-user-id"] = ctx.userId;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (correlationId) {
|
|
60
|
-
requestHeaders["correlation_id"] = correlationId;
|
|
61
|
-
}
|
|
42
|
+
const requestHeaders: Record<string, string> = {
|
|
43
|
+
"Content-Type": "application/json",
|
|
44
|
+
...headers,
|
|
45
|
+
};
|
|
62
46
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
headers: requestHeaders,
|
|
67
|
-
body: body ? JSON.stringify(body) : undefined,
|
|
68
|
-
});
|
|
47
|
+
if (ctx.token) {
|
|
48
|
+
requestHeaders["Authorization"] = `Bearer ${ctx.token}`;
|
|
49
|
+
}
|
|
69
50
|
|
|
70
|
-
const data = await response.json();
|
|
71
51
|
|
|
72
|
-
if (
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
52
|
+
if (ctx.userId) {
|
|
53
|
+
requestHeaders["x-user-id"] = ctx.userId;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* if (ctx.tenantId) {
|
|
57
|
+
* requestHeaders["x-tenant-id"] = ctx.tenantId;
|
|
58
|
+
* }
|
|
59
|
+
*/
|
|
60
|
+
|
|
61
|
+
if (correlationId) {
|
|
62
|
+
requestHeaders["correlation_id"] = correlationId;
|
|
77
63
|
}
|
|
78
64
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
65
|
+
try {
|
|
66
|
+
const response = await fetch(`${baseUrl}${endpoint}`, {
|
|
67
|
+
method,
|
|
68
|
+
headers: requestHeaders,
|
|
69
|
+
body: body ? JSON.stringify(body) : undefined,
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
const data = await response.json();
|
|
73
|
+
|
|
74
|
+
if (!response.ok) {
|
|
75
|
+
return {
|
|
76
|
+
ok: false,
|
|
77
|
+
error: data.error || `HTTP ${response.status}: ${response.statusText}`,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return {ok: true, data};
|
|
82
|
+
} catch (error) {
|
|
83
|
+
return {
|
|
84
|
+
ok: false,
|
|
85
|
+
error: error instanceof Error ? error.message : "Network error",
|
|
86
|
+
};
|
|
87
|
+
}
|
|
86
88
|
}
|
|
87
89
|
|
|
88
90
|
// Query endpoints (GET)
|
|
89
91
|
export const queryEndpoints = {
|
|
90
|
-
|
|
91
|
-
shifts: "/api/query/shifts-collection",
|
|
92
|
-
clerks: "/api/query/clerks-collection",
|
|
93
|
-
clerksToInvite: "/api/query/clerkstoinvite-collection",
|
|
94
|
-
tasks: "/api/query/tasks-collection",
|
|
95
|
-
menus: "/api/query/uploadedmenus-collection",
|
|
96
|
-
serviceDays: "/api/query/servicedays-collection",
|
|
97
|
-
timeslots: "/api/query/configuredtimeslots-collection",
|
|
98
|
-
vacations: "/api/query/plannedvacations-collection",
|
|
99
|
-
shiftAssignments: "/api/query/shiftassignments-collection",
|
|
100
|
-
shiftsForAssignments: "/api/query/shiftsforassignments-collection",
|
|
101
|
-
images: "/api/query/uploadedimages-collection",
|
|
92
|
+
//tables: "/api/query/tables-collection",
|
|
102
93
|
};
|
|
103
94
|
|
|
104
95
|
// Command endpoints (POST)
|
|
105
96
|
export const commandEndpoints = {
|
|
106
|
-
|
|
107
|
-
addTable: "/api/addtable",
|
|
108
|
-
updateTable: "/api/updatetable",
|
|
109
|
-
removeTable: "/api/removetable",
|
|
110
|
-
blockTableReservation: "/api/blocktablereservation",
|
|
111
|
-
unblockTableReservation: "/api/unblocktablereservation",
|
|
112
|
-
createShift: "/api/createshift",
|
|
113
|
-
activateShift: "/api/activateshift",
|
|
114
|
-
deleteShift: "/api/deleteshift",
|
|
115
|
-
assignShift: "/api/assignshift",
|
|
116
|
-
unassignShift: "/api/unassignshift",
|
|
117
|
-
registerClerk: "/api/registerclerk",
|
|
118
|
-
deactivateClerk: "/api/deactivateclerk",
|
|
119
|
-
removeClerk: "/api/removeclerk",
|
|
120
|
-
confirmInvitation: "/api/confirminvitation",
|
|
121
|
-
|
|
122
|
-
updateTask: "/api/updatetask",
|
|
123
|
-
deleteTask: "/api/deletetask",
|
|
124
|
-
uploadMenu: "/api/uploadmenu",
|
|
125
|
-
deleteMenu: "/api/deletemenu",
|
|
126
|
-
uploadImage: "/api/uploadimage",
|
|
127
|
-
cancelReservation: "/api/cancelreservation",
|
|
128
|
-
addServiceDay: "/api/addserviceday",
|
|
129
|
-
configureTimeslot: "/api/configuretimeslot",
|
|
130
|
-
planVacation: "/api/planvacation",
|
|
131
|
-
cancelVacation: "/api/cancelvacation",
|
|
132
|
-
activateOnlineReservation: "/api/activateonlinereservation",
|
|
133
|
-
deactivateOnlineReservation: "/api/deactivateonlinereservation",
|
|
134
|
-
registerNoShow: "/api/registernoshow",
|
|
135
|
-
registerShowUp: "/api/registershowup",
|
|
97
|
+
//addTable: "/api/addtable",
|
|
136
98
|
};
|