@mano8/astro-prompt-m8 0.1.0-alpha.1

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 (163) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +116 -0
  3. package/dist/src/integration.d.ts +42 -0
  4. package/dist/src/integration.d.ts.map +1 -0
  5. package/dist/src/integration.js +86 -0
  6. package/dist/src/integration.js.map +1 -0
  7. package/dist/src/lib/csp.d.ts +25 -0
  8. package/dist/src/lib/csp.d.ts.map +1 -0
  9. package/dist/src/lib/csp.js +53 -0
  10. package/dist/src/lib/csp.js.map +1 -0
  11. package/dist/src/middleware.d.ts +4 -0
  12. package/dist/src/middleware.d.ts.map +1 -0
  13. package/dist/src/middleware.js +24 -0
  14. package/dist/src/middleware.js.map +1 -0
  15. package/dist/src/runtime/api/admin.d.ts +15 -0
  16. package/dist/src/runtime/api/admin.d.ts.map +1 -0
  17. package/dist/src/runtime/api/admin.js +39 -0
  18. package/dist/src/runtime/api/admin.js.map +1 -0
  19. package/dist/src/runtime/api/blocks.d.ts +24 -0
  20. package/dist/src/runtime/api/blocks.d.ts.map +1 -0
  21. package/dist/src/runtime/api/blocks.js +74 -0
  22. package/dist/src/runtime/api/blocks.js.map +1 -0
  23. package/dist/src/runtime/api/categories.d.ts +7 -0
  24. package/dist/src/runtime/api/categories.d.ts.map +1 -0
  25. package/dist/src/runtime/api/categories.js +49 -0
  26. package/dist/src/runtime/api/categories.js.map +1 -0
  27. package/dist/src/runtime/api/dashboard.d.ts +6 -0
  28. package/dist/src/runtime/api/dashboard.d.ts.map +1 -0
  29. package/dist/src/runtime/api/dashboard.js +21 -0
  30. package/dist/src/runtime/api/dashboard.js.map +1 -0
  31. package/dist/src/runtime/api/index.d.ts +46 -0
  32. package/dist/src/runtime/api/index.d.ts.map +1 -0
  33. package/dist/src/runtime/api/index.js +48 -0
  34. package/dist/src/runtime/api/index.js.map +1 -0
  35. package/dist/src/runtime/api/internal.server.d.ts +18 -0
  36. package/dist/src/runtime/api/internal.server.d.ts.map +1 -0
  37. package/dist/src/runtime/api/internal.server.js +43 -0
  38. package/dist/src/runtime/api/internal.server.js.map +1 -0
  39. package/dist/src/runtime/api/templates.d.ts +14 -0
  40. package/dist/src/runtime/api/templates.d.ts.map +1 -0
  41. package/dist/src/runtime/api/templates.js +108 -0
  42. package/dist/src/runtime/api/templates.js.map +1 -0
  43. package/dist/src/runtime/authAdapter.d.ts +48 -0
  44. package/dist/src/runtime/authAdapter.d.ts.map +1 -0
  45. package/dist/src/runtime/authAdapter.js +62 -0
  46. package/dist/src/runtime/authAdapter.js.map +1 -0
  47. package/dist/src/runtime/client.d.ts +24 -0
  48. package/dist/src/runtime/client.d.ts.map +1 -0
  49. package/dist/src/runtime/client.js +85 -0
  50. package/dist/src/runtime/client.js.map +1 -0
  51. package/dist/src/runtime/compatibility.d.ts +32 -0
  52. package/dist/src/runtime/compatibility.d.ts.map +1 -0
  53. package/dist/src/runtime/compatibility.js +97 -0
  54. package/dist/src/runtime/compatibility.js.map +1 -0
  55. package/dist/src/runtime/config.d.ts +16 -0
  56. package/dist/src/runtime/config.d.ts.map +1 -0
  57. package/dist/src/runtime/config.js +22 -0
  58. package/dist/src/runtime/config.js.map +1 -0
  59. package/dist/src/runtime/errors.d.ts +23 -0
  60. package/dist/src/runtime/errors.d.ts.map +1 -0
  61. package/dist/src/runtime/errors.js +50 -0
  62. package/dist/src/runtime/errors.js.map +1 -0
  63. package/dist/src/runtime/hooks/index.d.ts +9 -0
  64. package/dist/src/runtime/hooks/index.d.ts.map +1 -0
  65. package/dist/src/runtime/hooks/index.js +9 -0
  66. package/dist/src/runtime/hooks/index.js.map +1 -0
  67. package/dist/src/runtime/hooks/useComposePrompt.d.ts +13 -0
  68. package/dist/src/runtime/hooks/useComposePrompt.d.ts.map +1 -0
  69. package/dist/src/runtime/hooks/useComposePrompt.js +17 -0
  70. package/dist/src/runtime/hooks/useComposePrompt.js.map +1 -0
  71. package/dist/src/runtime/hooks/usePromptAdmin.d.ts +10 -0
  72. package/dist/src/runtime/hooks/usePromptAdmin.d.ts.map +1 -0
  73. package/dist/src/runtime/hooks/usePromptAdmin.js +33 -0
  74. package/dist/src/runtime/hooks/usePromptAdmin.js.map +1 -0
  75. package/dist/src/runtime/hooks/usePromptBlock.d.ts +18 -0
  76. package/dist/src/runtime/hooks/usePromptBlock.d.ts.map +1 -0
  77. package/dist/src/runtime/hooks/usePromptBlock.js +25 -0
  78. package/dist/src/runtime/hooks/usePromptBlock.js.map +1 -0
  79. package/dist/src/runtime/hooks/usePromptBlocks.d.ts +22 -0
  80. package/dist/src/runtime/hooks/usePromptBlocks.d.ts.map +1 -0
  81. package/dist/src/runtime/hooks/usePromptBlocks.js +53 -0
  82. package/dist/src/runtime/hooks/usePromptBlocks.js.map +1 -0
  83. package/dist/src/runtime/hooks/usePromptCategories.d.ts +20 -0
  84. package/dist/src/runtime/hooks/usePromptCategories.d.ts.map +1 -0
  85. package/dist/src/runtime/hooks/usePromptCategories.js +53 -0
  86. package/dist/src/runtime/hooks/usePromptCategories.js.map +1 -0
  87. package/dist/src/runtime/hooks/usePromptDashboard.d.ts +13 -0
  88. package/dist/src/runtime/hooks/usePromptDashboard.d.ts.map +1 -0
  89. package/dist/src/runtime/hooks/usePromptDashboard.js +11 -0
  90. package/dist/src/runtime/hooks/usePromptDashboard.js.map +1 -0
  91. package/dist/src/runtime/hooks/usePromptTemplate.d.ts +33 -0
  92. package/dist/src/runtime/hooks/usePromptTemplate.d.ts.map +1 -0
  93. package/dist/src/runtime/hooks/usePromptTemplate.js +43 -0
  94. package/dist/src/runtime/hooks/usePromptTemplate.js.map +1 -0
  95. package/dist/src/runtime/hooks/usePromptTemplates.d.ts +37 -0
  96. package/dist/src/runtime/hooks/usePromptTemplates.d.ts.map +1 -0
  97. package/dist/src/runtime/hooks/usePromptTemplates.js +106 -0
  98. package/dist/src/runtime/hooks/usePromptTemplates.js.map +1 -0
  99. package/dist/src/runtime/listParams.d.ts +27 -0
  100. package/dist/src/runtime/listParams.d.ts.map +1 -0
  101. package/dist/src/runtime/listParams.js +67 -0
  102. package/dist/src/runtime/listParams.js.map +1 -0
  103. package/dist/src/runtime/queryKeys.d.ts +25 -0
  104. package/dist/src/runtime/queryKeys.d.ts.map +1 -0
  105. package/dist/src/runtime/queryKeys.js +29 -0
  106. package/dist/src/runtime/queryKeys.js.map +1 -0
  107. package/dist/src/runtime/react/AdminPromptPanel.d.ts +21 -0
  108. package/dist/src/runtime/react/AdminPromptPanel.d.ts.map +1 -0
  109. package/dist/src/runtime/react/AdminPromptPanel.js +53 -0
  110. package/dist/src/runtime/react/AdminPromptPanel.js.map +1 -0
  111. package/dist/src/runtime/react/PromptBlockLibrary.d.ts +36 -0
  112. package/dist/src/runtime/react/PromptBlockLibrary.d.ts.map +1 -0
  113. package/dist/src/runtime/react/PromptBlockLibrary.js +122 -0
  114. package/dist/src/runtime/react/PromptBlockLibrary.js.map +1 -0
  115. package/dist/src/runtime/react/PromptComposer.d.ts +24 -0
  116. package/dist/src/runtime/react/PromptComposer.d.ts.map +1 -0
  117. package/dist/src/runtime/react/PromptComposer.js +48 -0
  118. package/dist/src/runtime/react/PromptComposer.js.map +1 -0
  119. package/dist/src/runtime/react/PromptProvider.d.ts +16 -0
  120. package/dist/src/runtime/react/PromptProvider.d.ts.map +1 -0
  121. package/dist/src/runtime/react/PromptProvider.js +79 -0
  122. package/dist/src/runtime/react/PromptProvider.js.map +1 -0
  123. package/dist/src/runtime/react/PromptQueryProvider.d.ts +8 -0
  124. package/dist/src/runtime/react/PromptQueryProvider.d.ts.map +1 -0
  125. package/dist/src/runtime/react/PromptQueryProvider.js +11 -0
  126. package/dist/src/runtime/react/PromptQueryProvider.js.map +1 -0
  127. package/dist/src/runtime/react/PromptTemplateEditor.d.ts +36 -0
  128. package/dist/src/runtime/react/PromptTemplateEditor.d.ts.map +1 -0
  129. package/dist/src/runtime/react/PromptTemplateEditor.js +141 -0
  130. package/dist/src/runtime/react/PromptTemplateEditor.js.map +1 -0
  131. package/dist/src/runtime/react/RequireSuperuser.d.ts +7 -0
  132. package/dist/src/runtime/react/RequireSuperuser.d.ts.map +1 -0
  133. package/dist/src/runtime/react/RequireSuperuser.js +10 -0
  134. package/dist/src/runtime/react/RequireSuperuser.js.map +1 -0
  135. package/dist/src/runtime/react/default-ui/index.d.ts +17 -0
  136. package/dist/src/runtime/react/default-ui/index.d.ts.map +1 -0
  137. package/dist/src/runtime/react/default-ui/index.js +23 -0
  138. package/dist/src/runtime/react/default-ui/index.js.map +1 -0
  139. package/dist/src/runtime/react/index.d.ts +8 -0
  140. package/dist/src/runtime/react/index.d.ts.map +1 -0
  141. package/dist/src/runtime/react/index.js +8 -0
  142. package/dist/src/runtime/react/index.js.map +1 -0
  143. package/dist/src/runtime/routes.d.ts +17 -0
  144. package/dist/src/runtime/routes.d.ts.map +1 -0
  145. package/dist/src/runtime/routes.js +33 -0
  146. package/dist/src/runtime/routes.js.map +1 -0
  147. package/dist/src/runtime/schemas.d.ts +286 -0
  148. package/dist/src/runtime/schemas.d.ts.map +1 -0
  149. package/dist/src/runtime/schemas.js +172 -0
  150. package/dist/src/runtime/schemas.js.map +1 -0
  151. package/package.json +99 -0
  152. package/registry/r/admin-prompt-dashboard.json +23 -0
  153. package/registry/r/prompt-block-editor.json +20 -0
  154. package/registry/r/prompt-dashboard-overview.json +22 -0
  155. package/registry/r/prompt-maintenance-panel.json +23 -0
  156. package/registry/r/prompt-template-editor.json +20 -0
  157. package/registry/r/registry.json +37 -0
  158. package/registry.json +86 -0
  159. package/src/routes/admin/prompts.astro +11 -0
  160. package/src/routes/blocks.astro +11 -0
  161. package/src/routes/composer.astro +12 -0
  162. package/src/routes/templates.astro +11 -0
  163. package/src/scaffold/styles/prompt.css +9 -0
@@ -0,0 +1,172 @@
1
+ import { z } from "zod";
2
+ // ---------------------------------------------------------------------------
3
+ // Enums — mirror promt_engine_service/schemas/base.py & db_models/prompts.py
4
+ // ---------------------------------------------------------------------------
5
+ export const PromptBlockTypeSchema = z.enum([
6
+ "role",
7
+ "task",
8
+ "context",
9
+ "instruction",
10
+ "example",
11
+ "format"
12
+ ]);
13
+ export const CategoryTypeSchema = z.enum(["prompt_block", "prompt_template"]);
14
+ // ---------------------------------------------------------------------------
15
+ // Response envelopes — mirror auth_sdk_m8.schemas.base
16
+ // ---------------------------------------------------------------------------
17
+ export const ResponseMessageSchema = z
18
+ .object({
19
+ success: z.boolean(),
20
+ msg: z.string()
21
+ })
22
+ .strict();
23
+ export const ResponseModelBaseSchema = z
24
+ .object({
25
+ success: z.boolean(),
26
+ data: z.unknown()
27
+ })
28
+ .strict();
29
+ export const ResponseModelOrMessageSchema = z.union([
30
+ ResponseModelBaseSchema,
31
+ ResponseMessageSchema
32
+ ]);
33
+ // ---------------------------------------------------------------------------
34
+ // Prompt blocks
35
+ // ---------------------------------------------------------------------------
36
+ const ownerIdSchema = z.string();
37
+ export const PromptBlockPublicSchema = z
38
+ .object({
39
+ id: z.number().int(),
40
+ name: z.string().min(1).max(100),
41
+ slug: z.string().min(1).max(100),
42
+ description: z.string().nullable(),
43
+ content: z.string().min(1).max(5000),
44
+ type: PromptBlockTypeSchema,
45
+ is_dynamic: z.boolean(),
46
+ is_public: z.boolean(),
47
+ owner_id: ownerIdSchema
48
+ })
49
+ .strict();
50
+ export const PromptBlockCreateSchema = z
51
+ .object({
52
+ name: z.string().min(1).max(100),
53
+ description: z.string().max(1000).nullable().optional(),
54
+ content: z.string().min(1).max(5000),
55
+ type: PromptBlockTypeSchema,
56
+ is_dynamic: z.boolean().optional(),
57
+ is_public: z.boolean().optional(),
58
+ slug: z.string().nullable().optional()
59
+ })
60
+ .strict();
61
+ export const PromptBlockUpdateSchema = PromptBlockCreateSchema;
62
+ export const PromptBlocksPublicSchema = z
63
+ .object({
64
+ data: z.array(PromptBlockPublicSchema),
65
+ count: z.number().int().nonnegative()
66
+ })
67
+ .strict();
68
+ // ---------------------------------------------------------------------------
69
+ // Prompt templates
70
+ // ---------------------------------------------------------------------------
71
+ export const TemplateBlockPublicSchema = z
72
+ .object({
73
+ id: z.number().int(),
74
+ block_id: z.number().int(),
75
+ template_id: z.number().int(),
76
+ name: z.string().min(1).max(100),
77
+ slug: z.string().min(1).max(100),
78
+ description: z.string().nullable(),
79
+ content: z.string().min(1).max(5000),
80
+ type: PromptBlockTypeSchema,
81
+ is_dynamic: z.boolean(),
82
+ is_public: z.boolean(),
83
+ position: z.number().int().nonnegative()
84
+ })
85
+ .strict();
86
+ export const PromptTemplatePublicSchema = z
87
+ .object({
88
+ id: z.number().int(),
89
+ name: z.string().min(1).max(100),
90
+ slug: z.string().min(1).max(100),
91
+ description: z.string().nullable(),
92
+ is_public: z.boolean(),
93
+ blocks: z.array(TemplateBlockPublicSchema)
94
+ })
95
+ .strict();
96
+ export const PromptTemplateCreateSchema = z
97
+ .object({
98
+ name: z.string().min(1).max(100),
99
+ description: z.string().max(1000).nullable().optional(),
100
+ is_public: z.boolean().optional(),
101
+ slug: z.string().nullable().optional()
102
+ })
103
+ .strict();
104
+ export const PromptTemplateUpdateSchema = PromptTemplateCreateSchema;
105
+ export const PromptTemplatesPublicSchema = z
106
+ .object({
107
+ data: z.array(PromptTemplatePublicSchema),
108
+ count: z.number().int().nonnegative()
109
+ })
110
+ .strict();
111
+ // ---------------------------------------------------------------------------
112
+ // Compose
113
+ // ---------------------------------------------------------------------------
114
+ export const DynamicBlockSchema = z
115
+ .object({
116
+ id: z.number().int().positive(),
117
+ content: z.string().min(1).max(5000)
118
+ })
119
+ .strict();
120
+ export const ComposedPromptSchema = z
121
+ .object({
122
+ content: z.string()
123
+ })
124
+ .strict();
125
+ // ---------------------------------------------------------------------------
126
+ // Categories
127
+ // ---------------------------------------------------------------------------
128
+ export const CategoryPublicSchema = z
129
+ .object({
130
+ id: z.number().int(),
131
+ name: z.string().min(1).max(50),
132
+ slug: z.string().min(1).max(50),
133
+ type: CategoryTypeSchema,
134
+ owner_id: ownerIdSchema
135
+ })
136
+ .strict();
137
+ export const CategoriesPublicSchema = z
138
+ .object({
139
+ data: z.array(CategoryPublicSchema),
140
+ count: z.number().int().nonnegative()
141
+ })
142
+ .strict();
143
+ export const CategoryCreateSchema = z
144
+ .object({
145
+ name: z.string().min(1).max(50)
146
+ })
147
+ .strict();
148
+ export const CategoryUpdateSchema = CategoryCreateSchema;
149
+ // ---------------------------------------------------------------------------
150
+ // Dashboard (mirror schemas/dashboard.py UsersActivity)
151
+ // ---------------------------------------------------------------------------
152
+ export const ActivityCounterSchema = z
153
+ .object({
154
+ model: z.string(),
155
+ updated: z.number().int(),
156
+ added: z.number().int()
157
+ })
158
+ .strict();
159
+ export const ActivityStatsSchema = z
160
+ .object({
161
+ min: z.number().int(),
162
+ max: z.number().int(),
163
+ activity: z.array(ActivityCounterSchema)
164
+ })
165
+ .strict();
166
+ export const UsersActivitySchema = z
167
+ .object({
168
+ nb_users: z.number().int().nonnegative(),
169
+ activity: ActivityStatsSchema
170
+ })
171
+ .strict();
172
+ //# sourceMappingURL=schemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../../src/runtime/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,8EAA8E;AAC9E,6EAA6E;AAC7E,8EAA8E;AAE9E,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,IAAI,CAAC;IAC1C,MAAM;IACN,MAAM;IACN,SAAS;IACT,aAAa;IACb,SAAS;IACT,QAAQ;CACT,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,cAAc,EAAE,iBAAiB,CAAC,CAAC,CAAC;AAG9E,8EAA8E;AAC9E,uDAAuD;AACvD,8EAA8E;AAE9E,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC;KACnC,MAAM,CAAC;IACN,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;IACpB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ACzC,CAAC;KACD,MAAM,EAAE,CAAC;AAGZ,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC;KACjC,MAAM,CAAC;IACN,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;IACxC,QAAQ,EAAE,mBAAmB;CAC9B,CAAC;KACD,MAAM,EAAE,CAAC"}
package/package.json ADDED
@@ -0,0 +1,99 @@
1
+ {
2
+ "name": "@mano8/astro-prompt-m8",
3
+ "version": "0.1.0-alpha.1",
4
+ "description": "Astro integration and headless client for prompt-engine-m8.",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/mano8/astro-prompt-m8.git"
10
+ },
11
+ "publishConfig": {
12
+ "access": "public"
13
+ },
14
+ "keywords": [
15
+ "astro-integration",
16
+ "astro",
17
+ "prompt-engine",
18
+ "prompt-engine-m8",
19
+ "m8"
20
+ ],
21
+ "files": [
22
+ "dist",
23
+ "src/routes",
24
+ "src/scaffold/styles",
25
+ "registry.json",
26
+ "registry/r",
27
+ "README.md",
28
+ "LICENSE"
29
+ ],
30
+ "exports": {
31
+ ".": "./dist/src/integration.js",
32
+ "./api": "./dist/src/runtime/api/index.js",
33
+ "./client": "./dist/src/runtime/client.js",
34
+ "./schemas": "./dist/src/runtime/schemas.js",
35
+ "./auth-adapter": "./dist/src/runtime/authAdapter.js",
36
+ "./hooks": "./dist/src/runtime/hooks/index.js",
37
+ "./react": "./dist/src/runtime/react/index.js",
38
+ "./default-ui": "./dist/src/runtime/react/default-ui/index.js",
39
+ "./list-params": "./dist/src/runtime/listParams.js",
40
+ "./routes": "./dist/src/runtime/routes.js",
41
+ "./routes/blocks.astro": "./src/routes/blocks.astro",
42
+ "./routes/templates.astro": "./src/routes/templates.astro",
43
+ "./routes/composer.astro": "./src/routes/composer.astro",
44
+ "./routes/admin/prompts.astro": "./src/routes/admin/prompts.astro",
45
+ "./middleware": "./dist/src/middleware.js",
46
+ "./internal-server": "./dist/src/runtime/api/internal.server.js",
47
+ "./compatibility": "./dist/src/runtime/compatibility.js"
48
+ },
49
+ "types": "./dist/src/integration.d.ts",
50
+ "scripts": {
51
+ "build": "tsc -p tsconfig.json && npm run build:registry",
52
+ "build:registry": "node scripts/build-registry.mjs",
53
+ "test": "vitest run --coverage",
54
+ "typecheck": "tsc -p tsconfig.json --noEmit",
55
+ "test:unit": "vitest run"
56
+ },
57
+ "peerDependencies": {
58
+ "@mano8/astro-auth-m8": "^0.1.0-alpha.1",
59
+ "@tanstack/react-query": "^5.101.1",
60
+ "astro": "^5.0.0 || ^6.0.0",
61
+ "react": "^18.0.0 || ^19.0.0",
62
+ "react-dom": "^18.0.0 || ^19.0.0",
63
+ "zod": "^4.0.0"
64
+ },
65
+ "peerDependenciesMeta": {
66
+ "react": {
67
+ "optional": true
68
+ },
69
+ "react-dom": {
70
+ "optional": true
71
+ }
72
+ },
73
+ "devDependencies": {
74
+ "@mano8/astro-auth-m8": "^0.1.0-alpha.1",
75
+ "@tanstack/react-query": "^5.101.1",
76
+ "@types/node": "^22.0.0",
77
+ "@types/react": "^19.0.0",
78
+ "@vitest/coverage-v8": "^4.1.9",
79
+ "astro": "^6.0.0",
80
+ "jsdom": "^29.1.1",
81
+ "react": "^19.0.0",
82
+ "react-dom": "^19.0.0",
83
+ "typescript": "^5.9.3",
84
+ "vitest": "^4.1.9",
85
+ "zod": "^4.0.0"
86
+ },
87
+ "overrides": {
88
+ "esbuild": "^0.28.1"
89
+ },
90
+ "promptEngineM8": {
91
+ "contract": "prompt-engine-m8@0.0",
92
+ "testedServiceVersion": "0.0.1",
93
+ "serviceVersionRange": ">=0.0.1 <0.1.0"
94
+ },
95
+ "allowScripts": {
96
+ "esbuild@0.28.1": true,
97
+ "sharp@0.34.5": true
98
+ }
99
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "admin-prompt-dashboard",
4
+ "type": "registry:component",
5
+ "title": "Admin Prompt Dashboard",
6
+ "description": "Prompt admin view whose first/landing tab is the overview dashboard and destructive ops live in a guarded Maintenance tab; wraps the package's PromptProvider + RequireSuperuser. Requires @mano8/astro-prompt-m8 (and a fa-auth-m8 token adapter) installed.",
7
+ "dependencies": [
8
+ "lucide-react"
9
+ ],
10
+ "registryDependencies": [
11
+ "tabs",
12
+ "./node_modules/@mano8/astro-prompt-m8/registry/r/prompt-dashboard-overview.json",
13
+ "./node_modules/@mano8/astro-prompt-m8/registry/r/prompt-maintenance-panel.json"
14
+ ],
15
+ "files": [
16
+ {
17
+ "path": "registry/blocks/admin/admin-prompt-dashboard.tsx",
18
+ "content": "\"use client\";\r\n\r\n// Complete prompt admin dashboard: first/landing tab is the overview dashboard,\r\n// secondary tab covers the maintenance-like surface (per-resource create/edit\r\n// panels behind confirmation). For prompt-engine-m8 the danger ops are create/\r\n// edit/delete on blocks and templates, each behind `AlertDialog` confirmation.\r\n// Logic is a live dependency (@mano8/astro-prompt-m8/react + /hooks); this file\r\n// is only the shadcn skin, copied via the @mano8-prompt registry — edit per app.\r\nimport * as React from \"react\";\r\nimport { LayoutDashboard, PencilLine } from \"lucide-react\";\r\nimport {\r\n PromptProvider,\r\n RequireSuperuser,\r\n type PromptContextValue\r\n} from \"@mano8/astro-prompt-m8/react\";\r\n\r\nimport { Tabs, TabsContent, TabsList, TabsTrigger } from \"@/components/ui/tabs\";\r\nimport {\r\n PromptDashboardOverview,\r\n type PromptDashboardOverviewLabels\r\n} from \"@/components/fa-prompt/prompt-dashboard-overview\";\r\nimport {\r\n PromptMaintenancePanel,\r\n type PromptMaintenanceLabels\r\n} from \"@/components/fa-prompt/prompt-maintenance-panel\";\r\n\r\nexport interface AdminPromptDashboardLabels {\r\n dashboardTab: string;\r\n maintenanceTab: string;\r\n forbidden: string;\r\n overview: Partial<PromptDashboardOverviewLabels>;\r\n maintenance: Partial<PromptMaintenanceLabels>;\r\n}\r\n\r\nconst DEFAULT_LABELS: AdminPromptDashboardLabels = {\r\n dashboardTab: \"Dashboard\",\r\n maintenanceTab: \"Maintenance\",\r\n forbidden: \"You need administrator access to view this page.\",\r\n overview: {},\r\n maintenance: {}\r\n};\r\n\r\nexport interface AdminPromptDashboardProps {\r\n config?: React.ComponentProps<typeof PromptProvider>[\"config\"];\r\n adapter?: PromptContextValue[\"adapter\"];\r\n labels?: Partial<AdminPromptDashboardLabels>;\r\n}\r\n\r\nfunction AdminPromptShell({ labels }: { labels: AdminPromptDashboardLabels }) {\r\n return (\r\n <RequireSuperuser\r\n fallback={\r\n <div className=\"not-content mx-auto w-full max-w-md py-10 text-center text-sm text-muted-foreground\">\r\n {labels.forbidden}\r\n </div>\r\n }\r\n >\r\n <Tabs defaultValue=\"dashboard\" className=\"not-content mx-auto w-full max-w-6xl space-y-4\">\r\n <TabsList className=\"flex h-auto flex-wrap justify-start gap-1\">\r\n <TabsTrigger value=\"dashboard\" className=\"gap-2\">\r\n <LayoutDashboard className=\"size-4\" />\r\n {labels.dashboardTab}\r\n </TabsTrigger>\r\n <TabsTrigger value=\"maintenance\" className=\"gap-2\">\r\n <PencilLine className=\"size-4\" />\r\n {labels.maintenanceTab}\r\n </TabsTrigger>\r\n </TabsList>\r\n <TabsContent value=\"dashboard\">\r\n <PromptDashboardOverview labels={labels.overview} />\r\n </TabsContent>\r\n <TabsContent value=\"maintenance\">\r\n <PromptMaintenancePanel labels={labels.maintenance} />\r\n </TabsContent>\r\n </Tabs>\r\n </RequireSuperuser>\r\n );\r\n}\r\n\r\nexport default function AdminPromptDashboard({\r\n config,\r\n adapter,\r\n labels\r\n}: AdminPromptDashboardProps) {\r\n const resolved: AdminPromptDashboardLabels = {\r\n ...DEFAULT_LABELS,\r\n ...labels,\r\n overview: { ...DEFAULT_LABELS.overview, ...labels?.overview },\r\n maintenance: { ...DEFAULT_LABELS.maintenance, ...labels?.maintenance }\r\n };\r\n return (\r\n <PromptProvider config={config} adapter={adapter}>\r\n <AdminPromptShell labels={resolved} />\r\n </PromptProvider>\r\n );\r\n}",
19
+ "type": "registry:component",
20
+ "target": "components/fa-prompt/admin-prompt-dashboard.tsx"
21
+ }
22
+ ]
23
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "prompt-block-editor",
4
+ "type": "registry:component",
5
+ "title": "Prompt Block Editor",
6
+ "description": "Shadcn skin for the package PromptBlockLibrary (CRUD for reusable prompt blocks), driven by usePromptBlocks. Requires @mano8/astro-prompt-m8 installed.",
7
+ "dependencies": [],
8
+ "registryDependencies": [
9
+ "card",
10
+ "button"
11
+ ],
12
+ "files": [
13
+ {
14
+ "path": "registry/blocks/library/prompt-block-editor.tsx",
15
+ "content": "\"use client\";\r\n\r\n// Generic prompt-block editor skin: wraps the live `PromptBlockLibrary` from\r\n// the package and re-exports it so consumers can `npx shadcn add` to keep a\r\n// local copy that imports the live logic from `@mano8/astro-prompt-m8/react`.\r\n// Edit freely per app — labels and styling can be overridden without forking\r\n// the headless contract.\r\nimport {\r\n PromptBlockLibrary,\r\n type PromptBlockLibraryLabels\r\n} from \"@mano8/astro-prompt-m8/react\";\r\n\r\nexport type { PromptBlockLibraryLabels };\r\nexport { PromptBlockLibrary };\r\n\r\nexport interface PromptBlockEditorProps {\r\n labels?: Partial<PromptBlockLibraryLabels>;\r\n}\r\n\r\nexport default function PromptBlockEditor({ labels }: PromptBlockEditorProps) {\r\n return <PromptBlockLibrary labels={labels} />;\r\n}",
16
+ "type": "registry:component",
17
+ "target": "components/fa-prompt/prompt-block-editor.tsx"
18
+ }
19
+ ]
20
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "prompt-dashboard-overview",
4
+ "type": "registry:component",
5
+ "title": "Prompt Admin Dashboard Overview",
6
+ "description": "Prompt-engine dashboard (stat cards + activity) driven by usePromptAdmin. Requires @mano8/astro-prompt-m8 installed.",
7
+ "dependencies": [
8
+ "lucide-react"
9
+ ],
10
+ "registryDependencies": [
11
+ "card",
12
+ "skeleton"
13
+ ],
14
+ "files": [
15
+ {
16
+ "path": "registry/blocks/admin/prompt-dashboard-overview.tsx",
17
+ "content": "\"use client\";\r\n\r\n// Prompt admin landing view: a dashboard built from the package's headless\r\n// `usePromptAdmin` hook. Logic stays a live dependency\r\n// (@mano8/astro-prompt-m8/hooks); this file is only the shadcn skin, copied\r\n// into the consumer via the @mano8-prompt registry — edit freely per app.\r\nimport * as React from \"react\";\r\nimport { Boxes, FileText, FolderTree, Users } from \"lucide-react\";\r\nimport { usePromptAdmin } from \"@mano8/astro-prompt-m8/hooks\";\r\n\r\nimport { Card, CardContent, CardHeader, CardTitle } from \"@/components/ui/card\";\r\nimport { Skeleton } from \"@/components/ui/skeleton\";\r\n\r\nexport interface PromptDashboardOverviewLabels {\r\n title: string;\r\n subtitle: string;\r\n blocks: string;\r\n templates: string;\r\n categories: string;\r\n users: string;\r\n activityTitle: string;\r\n activityModel: string;\r\n activityEmpty: string;\r\n noCategories: string;\r\n error: string;\r\n}\r\n\r\nconst DEFAULT_LABELS: PromptDashboardOverviewLabels = {\r\n title: \"Overview\",\r\n subtitle: \"Prompt-engine usage at a glance.\",\r\n blocks: \"Blocks\",\r\n templates: \"Templates\",\r\n categories: \"Categories\",\r\n users: \"Active users\",\r\n activityTitle: \"Recent activity\",\r\n activityModel: \"Model\",\r\n activityEmpty: \"No recent activity.\",\r\n noCategories: \"No categories yet.\",\r\n error: \"Could not load admin data.\"\r\n};\r\n\r\nexport interface PromptDashboardOverviewProps {\r\n labels?: Partial<PromptDashboardOverviewLabels>;\r\n}\r\n\r\nfunction StatCard({\r\n label,\r\n value,\r\n icon: Icon\r\n}: {\r\n label: string;\r\n value: React.ReactNode;\r\n icon: React.ComponentType<{ className?: string }>;\r\n}) {\r\n return (\r\n <Card className=\"h-full\">\r\n <CardHeader className=\"flex flex-row items-center justify-between space-y-0 pb-2\">\r\n <CardTitle className=\"text-sm font-medium text-muted-foreground\">{label}</CardTitle>\r\n <Icon className=\"size-4 text-muted-foreground\" />\r\n </CardHeader>\r\n <CardContent>\r\n <div className=\"text-2xl font-semibold tabular-nums\">{value}</div>\r\n </CardContent>\r\n </Card>\r\n );\r\n}\r\n\r\nexport function PromptDashboardOverview({ labels }: PromptDashboardOverviewProps) {\r\n const t = { ...DEFAULT_LABELS, ...labels };\r\n const { overview, error, load } = usePromptAdmin();\r\n const [ready, setReady] = React.useState(false);\r\n\r\n React.useEffect(() => {\r\n let cancelled = false;\r\n void load()\r\n .catch(() => undefined)\r\n .finally(() => {\r\n if (!cancelled) setReady(true);\r\n });\r\n return () => {\r\n cancelled = true;\r\n };\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, []);\r\n\r\n if (!ready) {\r\n return (\r\n <div className=\"not-content space-y-4\" aria-busy=\"true\">\r\n <div className=\"grid auto-rows-fr gap-4 sm:grid-cols-2 lg:grid-cols-4\">\r\n {[0, 1, 2, 3].map((i) => (\r\n <Skeleton key={i} className=\"h-28 w-full\" />\r\n ))}\r\n </div>\r\n </div>\r\n );\r\n }\r\n\r\n if (error && !overview) {\r\n return (\r\n <Card role=\"alert\" className=\"border-destructive/50\">\r\n <CardContent className=\"py-6 text-sm text-destructive\">{t.error}</CardContent>\r\n </Card>\r\n );\r\n }\r\n\r\n const counters = overview?.activity.activity.activity ?? [];\r\n\r\n return (\r\n <div className=\"not-content space-y-6\">\r\n <div className=\"space-y-1\">\r\n <h2 className=\"text-xl font-semibold tracking-tight\">{t.title}</h2>\r\n <p className=\"text-sm text-muted-foreground\">{t.subtitle}</p>\r\n </div>\r\n\r\n <div className=\"grid auto-rows-fr gap-4 sm:grid-cols-2 lg:grid-cols-4\">\r\n <StatCard\r\n label={t.blocks}\r\n value={(overview?.blocks.count ?? 0).toLocaleString()}\r\n icon={Boxes}\r\n />\r\n <StatCard\r\n label={t.templates}\r\n value={(overview?.templates.count ?? 0).toLocaleString()}\r\n icon={FileText}\r\n />\r\n <StatCard\r\n label={t.categories}\r\n value={(overview?.categories?.count ?? 0).toLocaleString()}\r\n icon={FolderTree}\r\n />\r\n <StatCard\r\n label={t.users}\r\n value={(overview?.activity.nb_users ?? 0).toLocaleString()}\r\n icon={Users}\r\n />\r\n </div>\r\n\r\n <Card>\r\n <CardHeader>\r\n <CardTitle className=\"text-base\">{t.activityTitle}</CardTitle>\r\n </CardHeader>\r\n <CardContent>\r\n {overview?.categories === null && overview?.templates.data.length === 0 ? (\r\n <p className=\"py-8 text-center text-sm text-muted-foreground\">{t.noCategories}</p>\r\n ) : counters.length === 0 ? (\r\n <p className=\"py-8 text-center text-sm text-muted-foreground\">{t.activityEmpty}</p>\r\n ) : (\r\n <ul className=\"space-y-1 text-sm\">\r\n {counters.map((c) => (\r\n <li key={c.model} className=\"flex justify-between border-b pb-1\">\r\n <span>{t.activityModel}: {c.model}</span>\r\n <span className=\"tabular-nums\">+{c.added} · ↻{c.updated}</span>\r\n </li>\r\n ))}\r\n </ul>\r\n )}\r\n </CardContent>\r\n </Card>\r\n </div>\r\n );\r\n}",
18
+ "type": "registry:component",
19
+ "target": "components/fa-prompt/prompt-dashboard-overview.tsx"
20
+ }
21
+ ]
22
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "prompt-maintenance-panel",
4
+ "type": "registry:component",
5
+ "title": "Prompt Admin Maintenance Panel",
6
+ "description": "Prompt admin danger zone (delete block / delete template), each behind a shadcn alert-dialog confirmation, driven by usePromptBlocks + usePromptTemplates. Requires @mano8/astro-prompt-m8 installed.",
7
+ "dependencies": [
8
+ "lucide-react"
9
+ ],
10
+ "registryDependencies": [
11
+ "card",
12
+ "button",
13
+ "alert-dialog"
14
+ ],
15
+ "files": [
16
+ {
17
+ "path": "registry/blocks/admin/prompt-maintenance-panel.tsx",
18
+ "content": "\"use client\";\r\n\r\n// Prompt admin \"Maintenance / Danger zone\": the destructive create/edit/delete\r\n// operations on blocks and templates, each behind a shadcn `alert-dialog`\r\n// confirmation. Logic stays a live dependency\r\n// (@mano8/astro-prompt-m8/hooks); this file is only the shadcn skin, copied\r\n// into the consumer via the @mano8-prompt registry — edit freely per app.\r\nimport * as React from \"react\";\r\nimport { AlertTriangle } from \"lucide-react\";\r\nimport { usePromptBlocks } from \"@mano8/astro-prompt-m8/hooks\";\r\nimport { usePromptTemplates } from \"@mano8/astro-prompt-m8/hooks\";\r\n\r\nimport { Card, CardContent, CardDescription, CardHeader, CardTitle } from \"@/components/ui/card\";\r\nimport { Button } from \"@/components/ui/button\";\r\nimport {\r\n AlertDialog,\r\n AlertDialogAction,\r\n AlertDialogCancel,\r\n AlertDialogContent,\r\n AlertDialogDescription,\r\n AlertDialogFooter,\r\n AlertDialogHeader,\r\n AlertDialogTitle,\r\n AlertDialogTrigger\r\n} from \"@/components/ui/alert-dialog\";\r\n\r\nexport interface PromptMaintenanceLabels {\r\n title: string;\r\n subtitle: string;\r\n blocksTitle: string;\r\n blocksDescription: string;\r\n templatesTitle: string;\r\n templatesDescription: string;\r\n confirmTitle: string;\r\n cancel: string;\r\n confirm: string;\r\n running: string;\r\n error: string;\r\n empty: string;\r\n blockDelete: string;\r\n templateDelete: string;\r\n}\r\n\r\nconst DEFAULT_LABELS: PromptMaintenanceLabels = {\r\n title: \"Maintenance\",\r\n subtitle: \"Destructive prompt-engine operations. Each action is irreversible.\",\r\n blocksTitle: \"Delete a prompt block\",\r\n blocksDescription: \"Blocks used by a template cannot be deleted; detach them first.\",\r\n templatesTitle: \"Delete a prompt template\",\r\n templatesDescription: \"Removes the template and detaches all its blocks.\",\r\n confirmTitle: \"Are you sure?\",\r\n cancel: \"Cancel\",\r\n confirm: \"Delete\",\r\n running: \"Deleting…\",\r\n error: \"Deletion failed.\",\r\n empty: \"Nothing to delete.\",\r\n blockDelete: \"Delete block\",\r\n templateDelete: \"Delete template\"\r\n};\r\n\r\nexport interface PromptMaintenancePanelProps {\r\n labels?: Partial<PromptMaintenanceLabels>;\r\n}\r\n\r\nexport function PromptMaintenancePanel({ labels }: PromptMaintenancePanelProps) {\r\n const t = { ...DEFAULT_LABELS, ...labels };\r\n const blockHook = usePromptBlocks();\r\n const templateHook = usePromptTemplates();\r\n const [error, setError] = React.useState<string | null>(null);\r\n\r\n const deleteBlock = async (id: number) => {\r\n try {\r\n setError(null);\r\n await blockHook.deleteMutation.mutateAsync(id);\r\n } catch {\r\n setError(t.error);\r\n }\r\n };\r\n\r\n const deleteTemplate = async (id: number) => {\r\n try {\r\n setError(null);\r\n await templateHook.deleteMutation.mutateAsync(id);\r\n } catch {\r\n setError(t.error);\r\n }\r\n };\r\n\r\n return (\r\n <div className=\"not-content space-y-6\">\r\n <div className=\"space-y-1\">\r\n <h2 className=\"text-xl font-semibold tracking-tight\">{t.title}</h2>\r\n <p className=\"text-sm text-muted-foreground\">{t.subtitle}</p>\r\n </div>\r\n\r\n <Card>\r\n <CardHeader>\r\n <CardTitle className=\"text-base\">{t.blocksTitle}</CardTitle>\r\n <CardDescription>{t.blocksDescription}</CardDescription>\r\n </CardHeader>\r\n <CardContent className=\"space-y-2\">\r\n {(blockHook.data?.data ?? []).length === 0 ? (\r\n <p className=\"text-sm text-muted-foreground\">{t.empty}</p>\r\n ) : (\r\n (blockHook.data?.data ?? []).map((block) => (\r\n <div\r\n key={block.id}\r\n className=\"flex items-center justify-between rounded-md border p-3\"\r\n >\r\n <div>\r\n <p className=\"text-sm font-medium\">{block.name}</p>\r\n <p className=\"text-xs text-muted-foreground\">{block.type}</p>\r\n </div>\r\n <AlertDialog>\r\n <AlertDialogTrigger asChild>\r\n <Button variant=\"outline\" size=\"sm\" className=\"gap-2 text-destructive\">\r\n <AlertTriangle className=\"size-4\" />\r\n {t.blockDelete}\r\n </Button>\r\n </AlertDialogTrigger>\r\n <AlertDialogContent>\r\n <AlertDialogHeader>\r\n <AlertDialogTitle>{t.confirmTitle}</AlertDialogTitle>\r\n <AlertDialogDescription>\r\n {block.name} — {t.blocksDescription}\r\n </AlertDialogDescription>\r\n </AlertDialogHeader>\r\n <AlertDialogFooter>\r\n <AlertDialogCancel>{t.cancel}</AlertDialogCancel>\r\n <AlertDialogAction\r\n disabled={blockHook.deleteMutation.isPending}\r\n onClick={() => void deleteBlock(block.id)}\r\n >\r\n {blockHook.deleteMutation.isPending ? t.running : t.confirm}\r\n </AlertDialogAction>\r\n </AlertDialogFooter>\r\n </AlertDialogContent>\r\n </AlertDialog>\r\n </div>\r\n ))\r\n )}\r\n </CardContent>\r\n </Card>\r\n\r\n <Card>\r\n <CardHeader>\r\n <CardTitle className=\"text-base\">{t.templatesTitle}</CardTitle>\r\n <CardDescription>{t.templatesDescription}</CardDescription>\r\n </CardHeader>\r\n <CardContent className=\"space-y-2\">\r\n {(templateHook.data?.data ?? []).length === 0 ? (\r\n <p className=\"text-sm text-muted-foreground\">{t.empty}</p>\r\n ) : (\r\n (templateHook.data?.data ?? []).map((tpl) => (\r\n <div\r\n key={tpl.id}\r\n className=\"flex items-center justify-between rounded-md border p-3\"\r\n >\r\n <div>\r\n <p className=\"text-sm font-medium\">{tpl.name}</p>\r\n <p className=\"text-xs text-muted-foreground\">\r\n {tpl.blocks.length} blocks\r\n </p>\r\n </div>\r\n <AlertDialog>\r\n <AlertDialogTrigger asChild>\r\n <Button variant=\"outline\" size=\"sm\" className=\"gap-2 text-destructive\">\r\n <AlertTriangle className=\"size-4\" />\r\n {t.templateDelete}\r\n </Button>\r\n </AlertDialogTrigger>\r\n <AlertDialogContent>\r\n <AlertDialogHeader>\r\n <AlertDialogTitle>{t.confirmTitle}</AlertDialogTitle>\r\n <AlertDialogDescription>\r\n {tpl.name} — {t.templatesDescription}\r\n </AlertDialogDescription>\r\n </AlertDialogHeader>\r\n <AlertDialogFooter>\r\n <AlertDialogCancel>{t.cancel}</AlertDialogCancel>\r\n <AlertDialogAction\r\n disabled={templateHook.deleteMutation.isPending}\r\n onClick={() => void deleteTemplate(tpl.id)}\r\n >\r\n {templateHook.deleteMutation.isPending ? t.running : t.confirm}\r\n </AlertDialogAction>\r\n </AlertDialogFooter>\r\n </AlertDialogContent>\r\n </AlertDialog>\r\n </div>\r\n ))\r\n )}\r\n </CardContent>\r\n </Card>\r\n\r\n {error ? (\r\n <p role=\"alert\" className=\"text-sm text-destructive\">\r\n {error}\r\n </p>\r\n ) : null}\r\n </div>\r\n );\r\n}",
19
+ "type": "registry:component",
20
+ "target": "components/fa-prompt/prompt-maintenance-panel.tsx"
21
+ }
22
+ ]
23
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "prompt-template-editor",
4
+ "type": "registry:component",
5
+ "title": "Prompt Template Editor",
6
+ "description": "Shadcn skin for the package PromptTemplateEditor (create / edit / block ordering / compose preview), driven by usePromptTemplates + useComposePrompt. Requires @mano8/astro-prompt-m8 installed.",
7
+ "dependencies": [],
8
+ "registryDependencies": [
9
+ "card",
10
+ "button"
11
+ ],
12
+ "files": [
13
+ {
14
+ "path": "registry/blocks/editor/prompt-template-editor.tsx",
15
+ "content": "\"use client\";\r\n\r\n// Generic prompt-template editor skin: wraps the live `PromptTemplateEditor`\r\n// from the package and re-exports it so consumers can `npx shadcn add` to keep\r\n// a local copy that imports the live logic from `@mano8/astro-prompt-m8/react`.\r\nimport {\r\n PromptTemplateEditor,\r\n type PromptTemplateEditorLabels\r\n} from \"@mano8/astro-prompt-m8/react\";\r\n\r\nexport type { PromptTemplateEditorLabels };\r\nexport { PromptTemplateEditor };\r\n\r\nexport interface PromptTemplateEditorSkinProps {\r\n labels?: Partial<PromptTemplateEditorLabels>;\r\n}\r\n\r\nexport default function PromptTemplateEditorSkin({\r\n labels\r\n}: PromptTemplateEditorSkinProps) {\r\n return <PromptTemplateEditor labels={labels} />;\r\n}",
16
+ "type": "registry:component",
17
+ "target": "components/fa-prompt/prompt-template-editor.tsx"
18
+ }
19
+ ]
20
+ }
@@ -0,0 +1,37 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry.json",
3
+ "name": "mano8-prompt",
4
+ "homepage": "https://github.com/mano8/astro-prompt-m8",
5
+ "items": [
6
+ {
7
+ "name": "prompt-block-editor",
8
+ "type": "registry:component",
9
+ "title": "Prompt Block Editor",
10
+ "description": "Shadcn skin for the package PromptBlockLibrary (CRUD for reusable prompt blocks), driven by usePromptBlocks. Requires @mano8/astro-prompt-m8 installed."
11
+ },
12
+ {
13
+ "name": "prompt-template-editor",
14
+ "type": "registry:component",
15
+ "title": "Prompt Template Editor",
16
+ "description": "Shadcn skin for the package PromptTemplateEditor (create / edit / block ordering / compose preview), driven by usePromptTemplates + useComposePrompt. Requires @mano8/astro-prompt-m8 installed."
17
+ },
18
+ {
19
+ "name": "prompt-dashboard-overview",
20
+ "type": "registry:component",
21
+ "title": "Prompt Admin Dashboard Overview",
22
+ "description": "Prompt-engine dashboard (stat cards + activity) driven by usePromptAdmin. Requires @mano8/astro-prompt-m8 installed."
23
+ },
24
+ {
25
+ "name": "prompt-maintenance-panel",
26
+ "type": "registry:component",
27
+ "title": "Prompt Admin Maintenance Panel",
28
+ "description": "Prompt admin danger zone (delete block / delete template), each behind a shadcn alert-dialog confirmation, driven by usePromptBlocks + usePromptTemplates. Requires @mano8/astro-prompt-m8 installed."
29
+ },
30
+ {
31
+ "name": "admin-prompt-dashboard",
32
+ "type": "registry:component",
33
+ "title": "Admin Prompt Dashboard",
34
+ "description": "Prompt admin view whose first/landing tab is the overview dashboard and destructive ops live in a guarded Maintenance tab; wraps the package's PromptProvider + RequireSuperuser. Requires @mano8/astro-prompt-m8 (and a fa-auth-m8 token adapter) installed."
35
+ }
36
+ ]
37
+ }
package/registry.json ADDED
@@ -0,0 +1,86 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry.json",
3
+ "name": "mano8-prompt",
4
+ "homepage": "https://github.com/mano8/astro-prompt-m8",
5
+ "items": [
6
+ {
7
+ "name": "prompt-block-editor",
8
+ "type": "registry:component",
9
+ "title": "Prompt Block Editor",
10
+ "description": "Shadcn skin for the package PromptBlockLibrary (CRUD for reusable prompt blocks), driven by usePromptBlocks. Requires @mano8/astro-prompt-m8 installed.",
11
+ "dependencies": [],
12
+ "registryDependencies": ["card", "button"],
13
+ "files": [
14
+ {
15
+ "path": "registry/blocks/library/prompt-block-editor.tsx",
16
+ "type": "registry:component",
17
+ "target": "components/fa-prompt/prompt-block-editor.tsx"
18
+ }
19
+ ]
20
+ },
21
+ {
22
+ "name": "prompt-template-editor",
23
+ "type": "registry:component",
24
+ "title": "Prompt Template Editor",
25
+ "description": "Shadcn skin for the package PromptTemplateEditor (create / edit / block ordering / compose preview), driven by usePromptTemplates + useComposePrompt. Requires @mano8/astro-prompt-m8 installed.",
26
+ "dependencies": [],
27
+ "registryDependencies": ["card", "button"],
28
+ "files": [
29
+ {
30
+ "path": "registry/blocks/editor/prompt-template-editor.tsx",
31
+ "type": "registry:component",
32
+ "target": "components/fa-prompt/prompt-template-editor.tsx"
33
+ }
34
+ ]
35
+ },
36
+ {
37
+ "name": "prompt-dashboard-overview",
38
+ "type": "registry:component",
39
+ "title": "Prompt Admin Dashboard Overview",
40
+ "description": "Prompt-engine dashboard (stat cards + activity) driven by usePromptAdmin. Requires @mano8/astro-prompt-m8 installed.",
41
+ "dependencies": ["lucide-react"],
42
+ "registryDependencies": ["card", "skeleton"],
43
+ "files": [
44
+ {
45
+ "path": "registry/blocks/admin/prompt-dashboard-overview.tsx",
46
+ "type": "registry:component",
47
+ "target": "components/fa-prompt/prompt-dashboard-overview.tsx"
48
+ }
49
+ ]
50
+ },
51
+ {
52
+ "name": "prompt-maintenance-panel",
53
+ "type": "registry:component",
54
+ "title": "Prompt Admin Maintenance Panel",
55
+ "description": "Prompt admin danger zone (delete block / delete template), each behind a shadcn alert-dialog confirmation, driven by usePromptBlocks + usePromptTemplates. Requires @mano8/astro-prompt-m8 installed.",
56
+ "dependencies": ["lucide-react"],
57
+ "registryDependencies": ["card", "button", "alert-dialog"],
58
+ "files": [
59
+ {
60
+ "path": "registry/blocks/admin/prompt-maintenance-panel.tsx",
61
+ "type": "registry:component",
62
+ "target": "components/fa-prompt/prompt-maintenance-panel.tsx"
63
+ }
64
+ ]
65
+ },
66
+ {
67
+ "name": "admin-prompt-dashboard",
68
+ "type": "registry:component",
69
+ "title": "Admin Prompt Dashboard",
70
+ "description": "Prompt admin view whose first/landing tab is the overview dashboard and destructive ops live in a guarded Maintenance tab; wraps the package's PromptProvider + RequireSuperuser. Requires @mano8/astro-prompt-m8 (and a fa-auth-m8 token adapter) installed.",
71
+ "dependencies": ["lucide-react"],
72
+ "registryDependencies": [
73
+ "tabs",
74
+ "./node_modules/@mano8/astro-prompt-m8/registry/r/prompt-dashboard-overview.json",
75
+ "./node_modules/@mano8/astro-prompt-m8/registry/r/prompt-maintenance-panel.json"
76
+ ],
77
+ "files": [
78
+ {
79
+ "path": "registry/blocks/admin/admin-prompt-dashboard.tsx",
80
+ "type": "registry:component",
81
+ "target": "components/fa-prompt/admin-prompt-dashboard.tsx"
82
+ }
83
+ ]
84
+ }
85
+ ]
86
+ }
@@ -0,0 +1,11 @@
1
+ ---
2
+ import { AdminPromptView } from "@mano8/astro-prompt-m8/default-ui";
3
+ import "../../scaffold/styles/prompt.css";
4
+
5
+ const config = {
6
+ apiBase: import.meta.env.PUBLIC_FA_PROMPT_API_BASE,
7
+ apiPrefix: import.meta.env.PUBLIC_FA_PROMPT_API_PREFIX,
8
+ adminRole: import.meta.env.PUBLIC_FA_PROMPT_ADMIN_ROLE
9
+ };
10
+ ---
11
+ <AdminPromptView client:load config={config} />
@@ -0,0 +1,11 @@
1
+ ---
2
+ import { BlocksView } from "@mano8/astro-prompt-m8/default-ui";
3
+ import "../scaffold/styles/prompt.css";
4
+
5
+ const config = {
6
+ apiBase: import.meta.env.PUBLIC_FA_PROMPT_API_BASE,
7
+ apiPrefix: import.meta.env.PUBLIC_FA_PROMPT_API_PREFIX,
8
+ adminRole: import.meta.env.PUBLIC_FA_PROMPT_ADMIN_ROLE
9
+ };
10
+ ---
11
+ <BlocksView client:load config={config} />
@@ -0,0 +1,12 @@
1
+ ---
2
+ import { ComposerView } from "@mano8/astro-prompt-m8/default-ui";
3
+ import "../scaffold/styles/prompt.css";
4
+
5
+ const config = {
6
+ apiBase: import.meta.env.PUBLIC_FA_PROMPT_API_BASE,
7
+ apiPrefix: import.meta.env.PUBLIC_FA_PROMPT_API_PREFIX,
8
+ adminRole: import.meta.env.PUBLIC_FA_PROMPT_ADMIN_ROLE
9
+ };
10
+ const templateId = Number(Astro.url.searchParams.get("template")) || undefined;
11
+ ---
12
+ <ComposerView client:load config={config} templateId={templateId} />
@@ -0,0 +1,11 @@
1
+ ---
2
+ import { TemplatesView } from "@mano8/astro-prompt-m8/default-ui";
3
+ import "../scaffold/styles/prompt.css";
4
+
5
+ const config = {
6
+ apiBase: import.meta.env.PUBLIC_FA_PROMPT_API_BASE,
7
+ apiPrefix: import.meta.env.PUBLIC_FA_PROMPT_API_PREFIX,
8
+ adminRole: import.meta.env.PUBLIC_FA_PROMPT_ADMIN_ROLE
9
+ };
10
+ ---
11
+ <TemplatesView client:load config={config} />
@@ -0,0 +1,9 @@
1
+ /* Minimal neutral styles for the starter prompt routes when no app stylesheet is present.
2
+ Apps that ship Tailwind tokens (e.g. fa-ui-m8) override these via `views.layout`. */
3
+ :where(.not-content) {
4
+ box-sizing: border-box;
5
+ color: var(--fa-prompt-fg, currentColor);
6
+ }
7
+ :where(.not-content) :where(button, input, select, textarea) {
8
+ font: inherit;
9
+ }