decocms 0.16.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 (111) hide show
  1. package/README.md +95 -0
  2. package/dist/cli.d.ts +3 -0
  3. package/dist/cli.d.ts.map +1 -0
  4. package/dist/cli.js +373 -0
  5. package/dist/cli.js.map +1 -0
  6. package/dist/commands/add/add.d.ts +7 -0
  7. package/dist/commands/add/add.d.ts.map +1 -0
  8. package/dist/commands/add/add.js +90 -0
  9. package/dist/commands/add/add.js.map +1 -0
  10. package/dist/commands/auth/login.d.ts +2 -0
  11. package/dist/commands/auth/login.d.ts.map +1 -0
  12. package/dist/commands/auth/login.js +125 -0
  13. package/dist/commands/auth/login.js.map +1 -0
  14. package/dist/commands/auth/whoami.d.ts +2 -0
  15. package/dist/commands/auth/whoami.d.ts.map +1 -0
  16. package/dist/commands/auth/whoami.js +51 -0
  17. package/dist/commands/auth/whoami.js.map +1 -0
  18. package/dist/commands/config/configure.d.ts +2 -0
  19. package/dist/commands/config/configure.d.ts.map +1 -0
  20. package/dist/commands/config/configure.js +51 -0
  21. package/dist/commands/config/configure.js.map +1 -0
  22. package/dist/commands/create/create.d.ts +3 -0
  23. package/dist/commands/create/create.d.ts.map +1 -0
  24. package/dist/commands/create/create.js +238 -0
  25. package/dist/commands/create/create.js.map +1 -0
  26. package/dist/commands/dev/dev.d.ts +8 -0
  27. package/dist/commands/dev/dev.d.ts.map +1 -0
  28. package/dist/commands/dev/dev.js +64 -0
  29. package/dist/commands/dev/dev.js.map +1 -0
  30. package/dist/commands/dev/link.d.ts +8 -0
  31. package/dist/commands/dev/link.d.ts.map +1 -0
  32. package/dist/commands/dev/link.js +124 -0
  33. package/dist/commands/dev/link.js.map +1 -0
  34. package/dist/commands/gen/gen.d.ts +11 -0
  35. package/dist/commands/gen/gen.d.ts.map +1 -0
  36. package/dist/commands/gen/gen.js +341 -0
  37. package/dist/commands/gen/gen.js.map +1 -0
  38. package/dist/commands/hosting/deploy.d.ts +19 -0
  39. package/dist/commands/hosting/deploy.d.ts.map +1 -0
  40. package/dist/commands/hosting/deploy.js +194 -0
  41. package/dist/commands/hosting/deploy.js.map +1 -0
  42. package/dist/commands/hosting/list.d.ts +6 -0
  43. package/dist/commands/hosting/list.d.ts.map +1 -0
  44. package/dist/commands/hosting/list.js +26 -0
  45. package/dist/commands/hosting/list.js.map +1 -0
  46. package/dist/commands/hosting/promote.d.ts +11 -0
  47. package/dist/commands/hosting/promote.d.ts.map +1 -0
  48. package/dist/commands/hosting/promote.js +153 -0
  49. package/dist/commands/hosting/promote.js.map +1 -0
  50. package/dist/commands/update/update.d.ts +4 -0
  51. package/dist/commands/update/update.d.ts.map +1 -0
  52. package/dist/commands/update/update.js +242 -0
  53. package/dist/commands/update/update.js.map +1 -0
  54. package/dist/commands/update/upgrade.d.ts +4 -0
  55. package/dist/commands/update/upgrade.d.ts.map +1 -0
  56. package/dist/commands/update/upgrade.js +157 -0
  57. package/dist/commands/update/upgrade.js.map +1 -0
  58. package/dist/lib/config.d.ts +309 -0
  59. package/dist/lib/config.d.ts.map +1 -0
  60. package/dist/lib/config.js +262 -0
  61. package/dist/lib/config.js.map +1 -0
  62. package/dist/lib/constants.d.ts +10 -0
  63. package/dist/lib/constants.d.ts.map +1 -0
  64. package/dist/lib/constants.js +16 -0
  65. package/dist/lib/constants.js.map +1 -0
  66. package/dist/lib/fs.d.ts +40 -0
  67. package/dist/lib/fs.d.ts.map +1 -0
  68. package/dist/lib/fs.js +162 -0
  69. package/dist/lib/fs.js.map +1 -0
  70. package/dist/lib/mcp.d.ts +34 -0
  71. package/dist/lib/mcp.d.ts.map +1 -0
  72. package/dist/lib/mcp.js +19 -0
  73. package/dist/lib/mcp.js.map +1 -0
  74. package/dist/lib/parse-binding-tool.d.ts +12 -0
  75. package/dist/lib/parse-binding-tool.d.ts.map +1 -0
  76. package/dist/lib/parse-binding-tool.js +15 -0
  77. package/dist/lib/parse-binding-tool.js.map +1 -0
  78. package/dist/lib/prompt-ide-setup.d.ts +27 -0
  79. package/dist/lib/prompt-ide-setup.d.ts.map +1 -0
  80. package/dist/lib/prompt-ide-setup.js +158 -0
  81. package/dist/lib/prompt-ide-setup.js.map +1 -0
  82. package/dist/lib/prompt-integrations.d.ts +7 -0
  83. package/dist/lib/prompt-integrations.d.ts.map +1 -0
  84. package/dist/lib/prompt-integrations.js +84 -0
  85. package/dist/lib/prompt-integrations.js.map +1 -0
  86. package/dist/lib/prompt-workspace.d.ts +2 -0
  87. package/dist/lib/prompt-workspace.d.ts.map +1 -0
  88. package/dist/lib/prompt-workspace.js +93 -0
  89. package/dist/lib/prompt-workspace.js.map +1 -0
  90. package/dist/lib/runtime.d.ts +5 -0
  91. package/dist/lib/runtime.d.ts.map +1 -0
  92. package/dist/lib/runtime.js +15 -0
  93. package/dist/lib/runtime.js.map +1 -0
  94. package/dist/lib/session.d.ts +39 -0
  95. package/dist/lib/session.d.ts.map +1 -0
  96. package/dist/lib/session.js +124 -0
  97. package/dist/lib/session.js.map +1 -0
  98. package/dist/lib/slugify.d.ts +13 -0
  99. package/dist/lib/slugify.d.ts.map +1 -0
  100. package/dist/lib/slugify.js +27 -0
  101. package/dist/lib/slugify.js.map +1 -0
  102. package/dist/lib/supabase.d.ts +5 -0
  103. package/dist/lib/supabase.d.ts.map +1 -0
  104. package/dist/lib/supabase.js +19 -0
  105. package/dist/lib/supabase.js.map +1 -0
  106. package/dist/lib/wrangler.d.ts +9 -0
  107. package/dist/lib/wrangler.d.ts.map +1 -0
  108. package/dist/lib/wrangler.js +118 -0
  109. package/dist/lib/wrangler.js.map +1 -0
  110. package/dist/rules/deco-chat.mdc +902 -0
  111. package/package.json +79 -0
@@ -0,0 +1,309 @@
1
+ import { z } from "zod";
2
+ export declare const CONFIG_FILE = "wrangler.toml";
3
+ declare const DecoBindingSchema: z.ZodUnion<[z.ZodObject<{
4
+ name: z.ZodString;
5
+ type: z.ZodString;
6
+ integration_id: z.ZodString;
7
+ }, "strip", z.ZodTypeAny, {
8
+ type: string;
9
+ name: string;
10
+ integration_id: string;
11
+ }, {
12
+ type: string;
13
+ name: string;
14
+ integration_id: string;
15
+ }>, z.ZodObject<{
16
+ name: z.ZodString;
17
+ type: z.ZodString;
18
+ integration_name: z.ZodString;
19
+ }, "strip", z.ZodTypeAny, {
20
+ type: string;
21
+ name: string;
22
+ integration_name: string;
23
+ }, {
24
+ type: string;
25
+ name: string;
26
+ integration_name: string;
27
+ }>, z.ZodObject<{
28
+ name: z.ZodString;
29
+ type: z.ZodLiteral<"contract">;
30
+ contract: z.ZodObject<{
31
+ body: z.ZodString;
32
+ clauses: z.ZodArray<z.ZodObject<{
33
+ id: z.ZodString;
34
+ price: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
35
+ }, "strip", z.ZodTypeAny, {
36
+ id: string;
37
+ price: string | number;
38
+ }, {
39
+ id: string;
40
+ price: string | number;
41
+ }>, "many">;
42
+ }, "strip", z.ZodTypeAny, {
43
+ body: string;
44
+ clauses: {
45
+ id: string;
46
+ price: string | number;
47
+ }[];
48
+ }, {
49
+ body: string;
50
+ clauses: {
51
+ id: string;
52
+ price: string | number;
53
+ }[];
54
+ }>;
55
+ }, "strip", z.ZodTypeAny, {
56
+ type: "contract";
57
+ name: string;
58
+ contract: {
59
+ body: string;
60
+ clauses: {
61
+ id: string;
62
+ price: string | number;
63
+ }[];
64
+ };
65
+ }, {
66
+ type: "contract";
67
+ name: string;
68
+ contract: {
69
+ body: string;
70
+ clauses: {
71
+ id: string;
72
+ price: string | number;
73
+ }[];
74
+ };
75
+ }>]>;
76
+ export type DecoBinding = z.infer<typeof DecoBindingSchema>;
77
+ declare const decoConfigSchema: z.ZodObject<{
78
+ workspace: z.ZodString;
79
+ bindings: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodObject<{
80
+ name: z.ZodString;
81
+ type: z.ZodString;
82
+ integration_id: z.ZodString;
83
+ }, "strip", z.ZodTypeAny, {
84
+ type: string;
85
+ name: string;
86
+ integration_id: string;
87
+ }, {
88
+ type: string;
89
+ name: string;
90
+ integration_id: string;
91
+ }>, z.ZodObject<{
92
+ name: z.ZodString;
93
+ type: z.ZodString;
94
+ integration_name: z.ZodString;
95
+ }, "strip", z.ZodTypeAny, {
96
+ type: string;
97
+ name: string;
98
+ integration_name: string;
99
+ }, {
100
+ type: string;
101
+ name: string;
102
+ integration_name: string;
103
+ }>, z.ZodObject<{
104
+ name: z.ZodString;
105
+ type: z.ZodLiteral<"contract">;
106
+ contract: z.ZodObject<{
107
+ body: z.ZodString;
108
+ clauses: z.ZodArray<z.ZodObject<{
109
+ id: z.ZodString;
110
+ price: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
111
+ }, "strip", z.ZodTypeAny, {
112
+ id: string;
113
+ price: string | number;
114
+ }, {
115
+ id: string;
116
+ price: string | number;
117
+ }>, "many">;
118
+ }, "strip", z.ZodTypeAny, {
119
+ body: string;
120
+ clauses: {
121
+ id: string;
122
+ price: string | number;
123
+ }[];
124
+ }, {
125
+ body: string;
126
+ clauses: {
127
+ id: string;
128
+ price: string | number;
129
+ }[];
130
+ }>;
131
+ }, "strip", z.ZodTypeAny, {
132
+ type: "contract";
133
+ name: string;
134
+ contract: {
135
+ body: string;
136
+ clauses: {
137
+ id: string;
138
+ price: string | number;
139
+ }[];
140
+ };
141
+ }, {
142
+ type: "contract";
143
+ name: string;
144
+ contract: {
145
+ body: string;
146
+ clauses: {
147
+ id: string;
148
+ price: string | number;
149
+ }[];
150
+ };
151
+ }>]>, "many">>>;
152
+ local: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
153
+ enable_workflows: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
154
+ }, "strip", z.ZodTypeAny, {
155
+ workspace: string;
156
+ bindings: ({
157
+ type: string;
158
+ name: string;
159
+ integration_id: string;
160
+ } | {
161
+ type: string;
162
+ name: string;
163
+ integration_name: string;
164
+ } | {
165
+ type: "contract";
166
+ name: string;
167
+ contract: {
168
+ body: string;
169
+ clauses: {
170
+ id: string;
171
+ price: string | number;
172
+ }[];
173
+ };
174
+ })[];
175
+ local: boolean;
176
+ enable_workflows: boolean;
177
+ }, {
178
+ workspace: string;
179
+ bindings?: ({
180
+ type: string;
181
+ name: string;
182
+ integration_id: string;
183
+ } | {
184
+ type: string;
185
+ name: string;
186
+ integration_name: string;
187
+ } | {
188
+ type: "contract";
189
+ name: string;
190
+ contract: {
191
+ body: string;
192
+ clauses: {
193
+ id: string;
194
+ price: string | number;
195
+ }[];
196
+ };
197
+ })[] | undefined;
198
+ local?: boolean | undefined;
199
+ enable_workflows?: boolean | undefined;
200
+ }>;
201
+ export declare const setLocal: (l: boolean) => void;
202
+ export declare const getLocal: () => boolean;
203
+ export type Config = z.infer<typeof decoConfigSchema>;
204
+ export interface WranglerConfig {
205
+ [key: string]: unknown;
206
+ name?: string;
207
+ scope?: string;
208
+ assets?: {
209
+ directory?: string;
210
+ };
211
+ migrations?: {
212
+ tag: string;
213
+ new_classes: string[];
214
+ }[];
215
+ durable_objects?: {
216
+ bindings?: {
217
+ name: string;
218
+ class_name: string;
219
+ }[];
220
+ };
221
+ deco?: Partial<Config>;
222
+ }
223
+ export declare const readWranglerConfig: (cwd?: string) => Promise<WranglerConfig>;
224
+ /**
225
+ * Write the entire wrangler config to the config file.
226
+ * @param config - The wrangler config to write.
227
+ * @param cwd - The current working directory to write config to.
228
+ * @param merge - Whether to merge with existing config or replace it.
229
+ */
230
+ export declare const writeWranglerConfig: (config: Partial<WranglerConfig>, cwd?: string) => Promise<void>;
231
+ export declare const addWorkflowDO: () => Promise<void>;
232
+ /**
233
+ * Write the config to the current directory or any parent directory.
234
+ * @param config - The config to write.
235
+ * @param cwd - The current working directory to write config to.
236
+ */
237
+ export declare const writeConfigFile: (config: Partial<Config>, cwd?: string, merge?: boolean) => Promise<void>;
238
+ /**
239
+ * Get the config for the current project considering the passed root directory and inline options.
240
+ * @param rootDir - The root directory to read the config from.
241
+ * @param inlineOptions - The inline options to merge with the config.
242
+ * @param cwd - The current working directory to read config from.
243
+ * @returns The config.
244
+ */
245
+ export declare const getConfig: ({ inlineOptions, cwd, }?: {
246
+ inlineOptions?: Partial<Config>;
247
+ cwd?: string;
248
+ }) => Promise<{
249
+ workspace: string;
250
+ bindings: ({
251
+ type: string;
252
+ name: string;
253
+ integration_id: string;
254
+ } | {
255
+ type: string;
256
+ name: string;
257
+ integration_name: string;
258
+ } | {
259
+ type: "contract";
260
+ name: string;
261
+ contract: {
262
+ body: string;
263
+ clauses: {
264
+ id: string;
265
+ price: string | number;
266
+ }[];
267
+ };
268
+ })[];
269
+ local: boolean;
270
+ enable_workflows: boolean;
271
+ }>;
272
+ /**
273
+ * Get the path to the config file in the current directory or any parent directory.
274
+ * Useful for finding the config file when the current directory is not the root directory of the project.
275
+ * @param cwd - The current working directory.
276
+ * @returns The path to the config file or null if not found.
277
+ */
278
+ export declare const getConfigFilePath: (cwd: string) => string | null;
279
+ /**
280
+ * Generate a unique app UUID based on workspace and app name.
281
+ * Uses MD5 hash of workspace+app to ensure consistent UUIDs for the same project.
282
+ * @param workspace - The workspace name
283
+ * @param app - The app name
284
+ * @returns A unique UUID string based on the workspace and app name.
285
+ */
286
+ export declare const getAppUUID: (workspace?: string, app?: string) => string;
287
+ /**
288
+ * Generate a domain for the app based on workspace and app name.
289
+ * Uses the app UUID to create a consistent domain for the same project.
290
+ * @param workspace - The workspace name
291
+ * @param app - The app name
292
+ * @returns A domain string for the app.
293
+ */
294
+ export declare const getAppDomain: (workspace: string, app: string) => string;
295
+ export type MCPConfig = {
296
+ mcpServers: {
297
+ [key: string]: {
298
+ type: "http";
299
+ url: string;
300
+ };
301
+ };
302
+ };
303
+ export declare function getMCPConfig(workspace: string, app: string): MCPConfig;
304
+ export declare const getMCPConfigVersion: () => string;
305
+ export declare const getRulesConfig: () => Promise<{
306
+ "deco-chat.mdc": string;
307
+ }>;
308
+ export {};
309
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"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workers is stored in the wrangler.toml file, so
4
+ * we're a superset of the wrangler config.
5
+ */
6
+ import { parse, stringify } from "smol-toml";
7
+ import { promises as fs, statSync } from "fs";
8
+ import { dirname, join } from "path";
9
+ import { fileURLToPath } from "url";
10
+ import { z } from "zod";
11
+ import { readSession } from "./session.js";
12
+ import { createHash } from "crypto";
13
+ import process from "node:process";
14
+ const __filename = fileURLToPath(import.meta.url);
15
+ const __dirname = dirname(__filename);
16
+ // MD5 hash function using Node.js crypto
17
+ function md5Hash(input) {
18
+ const hash = createHash("sha1");
19
+ hash.update(input);
20
+ return hash.digest("hex");
21
+ }
22
+ export const CONFIG_FILE = "wrangler.toml";
23
+ const requiredErrorForProp = (prop) => `Property ${prop} is required. Please provide an inline value using --${prop} or configure it using 'deco configure'.`;
24
+ const DecoBindingSchema = z.union([
25
+ z.object({
26
+ name: z.string().min(1),
27
+ type: z.string().min(1),
28
+ integration_id: z.string().min(1),
29
+ }),
30
+ z.object({
31
+ name: z.string().min(1),
32
+ type: z.string().min(1),
33
+ integration_name: z.string().min(1),
34
+ }),
35
+ z.object({
36
+ name: z.string().min(1),
37
+ type: z.literal("contract"),
38
+ contract: z.object({
39
+ body: z.string().min(1),
40
+ clauses: z
41
+ .array(z.object({
42
+ id: z.string().min(1),
43
+ price: z.union([z.string(), z.number()]),
44
+ }))
45
+ .min(1),
46
+ }),
47
+ }),
48
+ ]);
49
+ const decoConfigSchema = z.object({
50
+ workspace: z.string({
51
+ required_error: requiredErrorForProp("workspace"),
52
+ }),
53
+ bindings: z.array(DecoBindingSchema).optional().default([]),
54
+ local: z.boolean().optional().default(false),
55
+ enable_workflows: z.boolean().optional().default(true),
56
+ });
57
+ let local;
58
+ export const setLocal = (l) => {
59
+ local = l;
60
+ };
61
+ export const getLocal = () => {
62
+ return local;
63
+ };
64
+ export const readWranglerConfig = async (cwd) => {
65
+ const configPath = getConfigFilePath(cwd || process.cwd());
66
+ if (!configPath) {
67
+ return {};
68
+ }
69
+ try {
70
+ const config = await fs.readFile(configPath, "utf-8");
71
+ return parse(config);
72
+ }
73
+ catch (_error) {
74
+ return {};
75
+ }
76
+ };
77
+ /**
78
+ * Read the config file from the current directory or any parent directory.
79
+ * If no config file is found, returns an empty object, so we can still merge with inline options
80
+ * and work without a config file.
81
+ *
82
+ * @param cwd - The current working directory to read config from.
83
+ * @returns The partial config.
84
+ */
85
+ const readConfigFile = async (cwd) => {
86
+ const wranglerConfig = await readWranglerConfig(cwd);
87
+ const decoConfig = wranglerConfig.deco ?? {};
88
+ return decoConfig;
89
+ };
90
+ const DECO_CHAT_WORKFLOW_BINDING = {
91
+ name: "DECO_CHAT_WORKFLOW_DO",
92
+ class_name: "Workflow",
93
+ };
94
+ const addSchemaNotation = (stringified) => {
95
+ return `#:schema node_modules/@deco/workers-runtime/config-schema.json\n${stringified}`;
96
+ };
97
+ /**
98
+ * Write the entire wrangler config to the config file.
99
+ * @param config - The wrangler config to write.
100
+ * @param cwd - The current working directory to write config to.
101
+ * @param merge - Whether to merge with existing config or replace it.
102
+ */
103
+ export const writeWranglerConfig = async (config, cwd) => {
104
+ const targetCwd = cwd || process.cwd();
105
+ const currentConfig = await readWranglerConfig(targetCwd);
106
+ const mergedConfig = { ...currentConfig, ...config };
107
+ mergedConfig.scope ??= mergedConfig.scope ?? mergedConfig?.deco?.workspace;
108
+ const configPath = getConfigFilePath(targetCwd) ?? join(targetCwd, CONFIG_FILE);
109
+ await fs.writeFile(configPath, addSchemaNotation(stringify(mergedConfig)));
110
+ console.log(`✅ Wrangler configuration written to: ${configPath}`);
111
+ };
112
+ export const addWorkflowDO = async () => {
113
+ const wranglerConfig = await readWranglerConfig(process.cwd());
114
+ const currentDOs = wranglerConfig.durable_objects?.bindings ?? [];
115
+ const workflowsBindings = {
116
+ migrations: [
117
+ ...(wranglerConfig.migrations ?? []).filter((m) => !m.new_classes?.includes(DECO_CHAT_WORKFLOW_BINDING.class_name)),
118
+ {
119
+ tag: "v1",
120
+ new_classes: [DECO_CHAT_WORKFLOW_BINDING.class_name],
121
+ },
122
+ ],
123
+ durable_objects: {
124
+ bindings: [
125
+ ...currentDOs.filter((b) => b.name !== DECO_CHAT_WORKFLOW_BINDING.name),
126
+ DECO_CHAT_WORKFLOW_BINDING,
127
+ ],
128
+ },
129
+ };
130
+ await writeWranglerConfig(wranglerConfig.deco?.enable_workflows ? workflowsBindings : {});
131
+ };
132
+ /**
133
+ * Write the config to the current directory or any parent directory.
134
+ * @param config - The config to write.
135
+ * @param cwd - The current working directory to write config to.
136
+ */
137
+ export const writeConfigFile = async (config, cwd, merge = true) => {
138
+ const targetCwd = cwd || process.cwd();
139
+ const wranglerConfig = await readWranglerConfig(targetCwd);
140
+ const current = wranglerConfig.deco ?? {};
141
+ const mergedConfig = merge ? { ...current, ...config } : config;
142
+ const configPath = getConfigFilePath(targetCwd) ?? join(targetCwd, CONFIG_FILE);
143
+ await fs.writeFile(configPath, addSchemaNotation(stringify({
144
+ ...wranglerConfig,
145
+ deco: mergedConfig,
146
+ })));
147
+ console.log(`✅ Deco configuration written to: ${configPath}`);
148
+ };
149
+ /**
150
+ * Get the config for the current project considering the passed root directory and inline options.
151
+ * @param rootDir - The root directory to read the config from.
152
+ * @param inlineOptions - The inline options to merge with the config.
153
+ * @param cwd - The current working directory to read config from.
154
+ * @returns The config.
155
+ */
156
+ export const getConfig = async ({ inlineOptions = {}, cwd, } = {}) => {
157
+ const config = await readConfigFile(cwd);
158
+ const merged = {
159
+ ...config,
160
+ ...Object.fromEntries(Object.entries(inlineOptions).filter(([_key, value]) => value !== undefined)),
161
+ };
162
+ if (!merged.workspace) {
163
+ const session = await readSession();
164
+ merged.workspace = session?.workspace;
165
+ }
166
+ merged.local = getLocal() ?? merged.local;
167
+ return decoConfigSchema.parse(merged);
168
+ };
169
+ /**
170
+ * Get the path to the config file in the current directory or any parent directory.
171
+ * Useful for finding the config file when the current directory is not the root directory of the project.
172
+ * @param cwd - The current working directory.
173
+ * @returns The path to the config file or null if not found.
174
+ */
175
+ export const getConfigFilePath = (cwd) => {
176
+ // First, try the direct path
177
+ const directPath = join(cwd, CONFIG_FILE);
178
+ try {
179
+ const stat = statSync(directPath);
180
+ if (stat.isFile()) {
181
+ return directPath;
182
+ }
183
+ }
184
+ catch {
185
+ // File doesn't exist, continue searching
186
+ }
187
+ // If direct path fails, search parent directories
188
+ const dirs = cwd.split(/[/\\]/); // Handle both Unix and Windows path separators
189
+ const maxDepth = dirs.length;
190
+ for (let i = maxDepth; i >= 1; i--) {
191
+ const path = dirs.slice(0, i).join("/") || "/";
192
+ const configPath = join(path, CONFIG_FILE);
193
+ try {
194
+ const stat = statSync(configPath);
195
+ if (stat.isFile()) {
196
+ return configPath;
197
+ }
198
+ }
199
+ catch {
200
+ // File doesn't exist, continue searching
201
+ }
202
+ }
203
+ return null;
204
+ };
205
+ /**
206
+ * Generate a unique app UUID based on workspace and app name.
207
+ * Uses MD5 hash of workspace+app to ensure consistent UUIDs for the same project.
208
+ * @param workspace - The workspace name
209
+ * @param app - The app name
210
+ * @returns A unique UUID string based on the workspace and app name.
211
+ */
212
+ export const getAppUUID = (workspace = "default", app = "my-app") => {
213
+ try {
214
+ const combined = `${workspace}-${app}`;
215
+ const hash = md5Hash(combined);
216
+ return hash.slice(0, 8); // Use first 8 characters for shorter, readable UUID
217
+ }
218
+ catch (_error) {
219
+ // Fallback to random UUID if hash generation fails
220
+ console.warn("Could not generate hash for UUID, using random fallback:", _error);
221
+ return crypto.randomUUID().slice(0, 8);
222
+ }
223
+ };
224
+ /**
225
+ * Generate a domain for the app based on workspace and app name.
226
+ * Uses the app UUID to create a consistent domain for the same project.
227
+ * @param workspace - The workspace name
228
+ * @param app - The app name
229
+ * @returns A domain string for the app.
230
+ */
231
+ export const getAppDomain = (workspace, app) => {
232
+ const appUUID = getAppUUID(workspace, app);
233
+ return `localhost-${appUUID}.deco.host`;
234
+ };
235
+ export function getMCPConfig(workspace, app) {
236
+ const appDomain = getAppDomain(workspace, app);
237
+ return {
238
+ mcpServers: {
239
+ [app]: {
240
+ type: "http",
241
+ url: `https://${appDomain}/mcp`,
242
+ },
243
+ },
244
+ };
245
+ }
246
+ export const getMCPConfigVersion = () => md5Hash(getMCPConfig.toString());
247
+ export const getRulesConfig = async () => {
248
+ const rulesPath = join(__dirname, "../rules/deco-chat.mdc");
249
+ try {
250
+ const content = await fs.readFile(rulesPath, "utf-8");
251
+ return {
252
+ "deco-chat.mdc": content,
253
+ };
254
+ }
255
+ catch (error) {
256
+ console.warn("Could not read rules file:", error);
257
+ return {
258
+ "deco-chat.mdc": "",
259
+ };
260
+ }
261
+ };
262
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,OAAO,MAAM,cAAc,CAAC;AAEnC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAEtC,yCAAyC;AACzC,SAAS,OAAO,CAAC,KAAa;IAC5B,MAAM,IAAI,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;IAChC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACnB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,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SUPABASE_URL = "https://auth.deco.cx";
2
+ export declare const SUPABASE_ANON_KEY = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im96a3NnZG15cnFjeGN3aG5iZXBnIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NDc3ODI5NjYsImV4cCI6MjA2MzM1ODk2Nn0.fx_Ouo3V-s4ZWr0MJ8gP5PFkr11xEkxThKiNDZSLRyY";
3
+ export declare const DECO_CHAT_WEB: string;
4
+ export declare const DECO_CHAT_API_PROD = "https://api.deco.chat";
5
+ export declare const DECO_CHAT_API_LOCAL = "http://localhost:3001";
6
+ export declare const DECO_CHAT_API: string;
7
+ export declare const AUTH_PORT_CLI = 3457;
8
+ export declare const AUTH_URL_CLI = "http://localhost:3457";
9
+ export declare const DECO_CHAT_LOGIN: string;
10
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/lib/constants.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,YAAY,yBAAyB,CAAC;AACnD,eAAO,MAAM,iBAAiB,qNACsL,CAAC;AAErN,eAAO,MAAM,aAAa,QAEH,CAAC;AAExB,eAAO,MAAM,kBAAkB,0BAA0B,CAAC;AAC1D,eAAO,MAAM,mBAAmB,0BAA0B,CAAC;AAE3D,eAAO,MAAM,aAAa,QAEJ,CAAC;AAEvB,eAAO,MAAM,aAAa,OAAO,CAAC;AAClC,eAAO,MAAM,YAAY,0BAAsC,CAAC;AAEhE,eAAO,MAAM,eAAe,QAA4C,CAAC"}
@@ -0,0 +1,16 @@
1
+ import process from "node:process";
2
+ const LOCAL_DEBUGGER = process.env.VITE_USE_LOCAL_BACKEND === "true";
3
+ export const SUPABASE_URL = "https://auth.deco.cx";
4
+ export const SUPABASE_ANON_KEY = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im96a3NnZG15cnFjeGN3aG5iZXBnIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NDc3ODI5NjYsImV4cCI6MjA2MzM1ODk2Nn0.fx_Ouo3V-s4ZWr0MJ8gP5PFkr11xEkxThKiNDZSLRyY";
5
+ export const DECO_CHAT_WEB = LOCAL_DEBUGGER
6
+ ? "http://localhost:3000"
7
+ : "https://deco.chat";
8
+ export const DECO_CHAT_API_PROD = "https://api.deco.chat";
9
+ export const DECO_CHAT_API_LOCAL = "http://localhost:3001";
10
+ export const DECO_CHAT_API = LOCAL_DEBUGGER
11
+ ? DECO_CHAT_API_LOCAL
12
+ : DECO_CHAT_API_PROD;
13
+ export const AUTH_PORT_CLI = 3457;
14
+ export const AUTH_URL_CLI = `http://localhost:${AUTH_PORT_CLI}`;
15
+ export const DECO_CHAT_LOGIN = new URL("/login?cli", DECO_CHAT_WEB).href;
16
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/lib/constants.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,MAAM,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC,sBAAsB,KAAK,MAAM,CAAC;AAErE,MAAM,CAAC,MAAM,YAAY,GAAG,sBAAsB,CAAC;AACnD,MAAM,CAAC,MAAM,iBAAiB,GAC5B,kNAAkN,CAAC;AAErN,MAAM,CAAC,MAAM,aAAa,GAAG,cAAc;IACzC,CAAC,CAAC,uBAAuB;IACzB,CAAC,CAAC,mBAAmB,CAAC;AAExB,MAAM,CAAC,MAAM,kBAAkB,GAAG,uBAAuB,CAAC;AAC1D,MAAM,CAAC,MAAM,mBAAmB,GAAG,uBAAuB,CAAC;AAE3D,MAAM,CAAC,MAAM,aAAa,GAAG,cAAc;IACzC,CAAC,CAAC,mBAAmB;IACrB,CAAC,CAAC,kBAAkB,CAAC;AAEvB,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,CAAC;AAClC,MAAM,CAAC,MAAM,YAAY,GAAG,oBAAoB,aAAa,EAAE,CAAC;AAEhE,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC,IAAI,CAAC"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Ensure that a directory exists, creating it if necessary (recursive)
3
+ * Node.js equivalent of Deno's ensureDir
4
+ */
5
+ export declare function ensureDir(dirPath: string): Promise<void>;
6
+ export interface CopyOptions {
7
+ overwrite?: boolean;
8
+ }
9
+ /**
10
+ * Copy a file or directory from source to destination
11
+ * Node.js equivalent of Deno's copy
12
+ */
13
+ export declare function copy(src: string, dest: string, options?: CopyOptions): Promise<void>;
14
+ export interface WalkEntry {
15
+ path: string;
16
+ name: string;
17
+ isFile: boolean;
18
+ isDirectory: boolean;
19
+ isSymlink: boolean;
20
+ }
21
+ export interface WalkOptions {
22
+ maxDepth?: number;
23
+ includeFiles?: boolean;
24
+ includeDirs?: boolean;
25
+ followSymlinks?: boolean;
26
+ exts?: string[];
27
+ match?: RegExp[];
28
+ skip?: RegExp[];
29
+ }
30
+ /**
31
+ * Recursively walk a directory tree and yield entries
32
+ * Node.js equivalent of Deno's walk
33
+ */
34
+ export declare function walk(root: string, options?: WalkOptions): AsyncGenerator<WalkEntry, void, unknown>;
35
+ /**
36
+ * Collect all walk entries into an array
37
+ * Convenience function for when you need all entries at once
38
+ */
39
+ export declare function walkArray(root: string, options?: WalkOptions): Promise<WalkEntry[]>;
40
+ //# sourceMappingURL=fs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../src/lib/fs.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,wBAAsB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAS9D;AA0CD,MAAM,WAAW,WAAW;IAC1B,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;GAGG;AACH,wBAAsB,IAAI,CACxB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,WAAgB,GACxB,OAAO,CAAC,IAAI,CAAC,CAkBf;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAED;;;GAGG;AACH,wBAAuB,IAAI,CACzB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,WAAgB,GACxB,cAAc,CAAC,SAAS,EAAE,IAAI,EAAE,OAAO,CAAC,CAwF1C;AAED;;;GAGG;AACH,wBAAsB,SAAS,CAC7B,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,WAAgB,GACxB,OAAO,CAAC,SAAS,EAAE,CAAC,CAMtB"}