silgi 0.28.10 → 0.28.12

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/dev.mjs CHANGED
@@ -46,7 +46,6 @@ import 'silgi/runtime';
46
46
  import 'unstorage';
47
47
  import 'scule';
48
48
  import 'node:child_process';
49
- import 'picocolors';
50
49
 
51
50
  async function reloadScan(path, _stats) {
52
51
  const silgi = useSilgiCLI();
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { defineCommand, runMain } from 'citty';
3
3
 
4
- const version = "0.28.10";
4
+ const version = "0.28.12";
5
5
  const packageJson = {
6
6
  version: version};
7
7
 
@@ -24,9 +24,7 @@ const main = defineCommand({
24
24
  install: () => import('./install.mjs').then((m) => m.default),
25
25
  dev: () => import('./dev.mjs').then((m) => m.default)
26
26
  },
27
- run({ args }) {
28
- if (args.version)
29
- console.warn("Silgi version:", packageJson.version);
27
+ run() {
30
28
  }
31
29
  });
32
30
  runMain(main);
package/dist/cli/init.mjs CHANGED
@@ -42,7 +42,6 @@ import 'silgi/runtime';
42
42
  import 'unstorage';
43
43
  import 'scule';
44
44
  import 'node:child_process';
45
- import 'picocolors';
46
45
  import '../_chunks/silgiApp.mjs';
47
46
  import 'unctx';
48
47
 
@@ -4,11 +4,13 @@ import { defineCommand, runCommand } from 'citty';
4
4
  import { consola } from 'consola';
5
5
  import { resolve } from 'pathe';
6
6
  import { version } from 'silgi/meta';
7
+ import { addNPMPackage, addTemplate } from 'silgi/kit';
8
+ import { u as useSilgiCLI } from '../_chunks/silgiApp.mjs';
7
9
  import { a as commonArgs, c as command$1 } from './prepare.mjs';
8
10
  import { l as loadOptions } from './types.mjs';
11
+ import 'unctx';
9
12
  import './silgi.mjs';
10
13
  import 'apiful/openapi';
11
- import 'silgi/kit';
12
14
  import 'node:fs/promises';
13
15
  import 'knitwork';
14
16
  import 'mlly';
@@ -35,9 +37,6 @@ import 'klona';
35
37
  import 'silgi/runtime';
36
38
  import 'unstorage';
37
39
  import 'scule';
38
- import 'picocolors';
39
- import '../_chunks/silgiApp.mjs';
40
- import 'unctx';
41
40
  import 'c12';
42
41
  import 'compatx';
43
42
  import 'klona/full';
@@ -46,6 +45,44 @@ import 'consola/utils';
46
45
  import 'escape-string-regexp';
47
46
  import 'pkg-types';
48
47
 
48
+ async function installPackages(silgi = useSilgiCLI()) {
49
+ await addNPMPackage([
50
+ {
51
+ name: "@fastify/deepmerge",
52
+ isDev: false
53
+ },
54
+ {
55
+ name: "@silgi/ecosystem",
56
+ isDev: false
57
+ },
58
+ {
59
+ name: "unadapter",
60
+ isDev: false
61
+ }
62
+ ]);
63
+ const packages = {
64
+ dependencies: {
65
+ ...silgi.options.installPackages?.dependencies
66
+ },
67
+ devDependencies: {
68
+ ...silgi.options.installPackages?.devDependencies
69
+ }
70
+ };
71
+ if (silgi.options.preset === "npm-package") {
72
+ packages.devDependencies = {
73
+ ...packages.devDependencies,
74
+ ...packages.dependencies
75
+ };
76
+ packages.dependencies = {};
77
+ }
78
+ addTemplate({
79
+ filename: "install.json",
80
+ where: ".silgi",
81
+ write: true,
82
+ getContents: () => JSON.stringify(packages, null, 2)
83
+ });
84
+ }
85
+
49
86
  const command = defineCommand({
50
87
  meta: {
51
88
  name: "install",
@@ -64,6 +101,7 @@ const command = defineCommand({
64
101
  rawArgs: []
65
102
  }).catch(() => {
66
103
  });
104
+ await installPackages();
67
105
  const silgiConfig = await loadOptions({});
68
106
  const commandArgs = process.argv.slice(process.argv.indexOf("install") + 1);
69
107
  const extraArgs = commandArgs.length ? ` ${commandArgs.join(" ")}` : "";
@@ -3,13 +3,14 @@ import { resolve } from 'pathe';
3
3
  import { version } from 'silgi/meta';
4
4
  import { p as prepareEnv, c as createSilgiCLI, b as build } from './silgi.mjs';
5
5
  import { execSync } from 'node:child_process';
6
- import { readFileSync } from 'node:fs';
7
6
  import * as p from '@clack/prompts';
7
+ import { isCancel, cancel } from '@clack/prompts';
8
8
  import { consola } from 'consola';
9
9
  import { createJiti } from 'dev-jiti';
10
- import color from 'picocolors';
11
- import { useSilgiCLI } from 'silgi';
12
- import { a as silgiCLIIClose } from '../_chunks/silgiApp.mjs';
10
+ import { useSilgiCLI as useSilgiCLI$1 } from 'silgi';
11
+ import { u as useSilgiCLI, a as silgiCLIIClose } from '../_chunks/silgiApp.mjs';
12
+ import { addTemplate } from 'silgi/kit';
13
+ import { generateTypes, resolveSchema } from 'untyped';
13
14
  import { l as loadOptions } from './types.mjs';
14
15
 
15
16
  const commonArgs = {
@@ -24,6 +25,72 @@ const commonArgs = {
24
25
  }
25
26
  };
26
27
 
28
+ function debugMode(name) {
29
+ const silgi = useSilgiCLI();
30
+ if (silgi.options.debug === true || typeof silgi.options.debug === "object" && silgi.options.debug[name]) {
31
+ return true;
32
+ }
33
+ return false;
34
+ }
35
+
36
+ async function scanCommands(silgi = useSilgiCLI()) {
37
+ const commands = [];
38
+ await silgi.callHook("prepare:commands", commands);
39
+ if (debugMode("command")) {
40
+ addTemplate({
41
+ filename: "cli.json",
42
+ where: ".silgi",
43
+ write: true,
44
+ getContents: () => JSON.stringify(commands, null, 2)
45
+ });
46
+ }
47
+ silgi.hook("prepare:schema.ts", async (object) => {
48
+ const allTags = commands.reduce((acc, commandGroup) => {
49
+ Object.values(commandGroup).forEach((command) => {
50
+ if (command.tags) {
51
+ command.tags.forEach((tag) => acc.add(tag));
52
+ }
53
+ });
54
+ return acc;
55
+ }, /* @__PURE__ */ new Set());
56
+ const data = [
57
+ "",
58
+ generateTypes(
59
+ await resolveSchema(
60
+ {
61
+ ...Object.fromEntries(Array.from(allTags.values()).map((tag) => [tag, "string"]))
62
+ }
63
+ ),
64
+ {
65
+ interfaceName: "SilgiCommandsExtended",
66
+ addExport: false,
67
+ addDefaults: false,
68
+ allowExtraKeys: false,
69
+ indentation: 0
70
+ }
71
+ ),
72
+ ""
73
+ ];
74
+ object.customImports?.push(...data);
75
+ });
76
+ return commands;
77
+ }
78
+
79
+ function cancelOnCancel({
80
+ value,
81
+ message = "Cancelled",
82
+ onBeforeExit,
83
+ exitCode = 0
84
+ } = {}) {
85
+ const handleCancel = () => {
86
+ cancel(message);
87
+ onBeforeExit?.();
88
+ process.exit(exitCode);
89
+ };
90
+ if (!value || isCancel(value))
91
+ handleCancel();
92
+ }
93
+
27
94
  const command$1 = defineCommand({
28
95
  meta: {
29
96
  name: "run",
@@ -49,192 +116,53 @@ const command$1 = defineCommand({
49
116
  const data = args.active ? await runCommand(command, {
50
117
  rawArgs: ["--commands", "run"]
51
118
  }) : void 0;
52
- globalThis.__nitro__ = globalThis.__nitro__ || {};
53
- globalThis.__nitro__.useRuntimeConfig = function() {
54
- return data?.result?.silgi?.options?.runtimeConfig || {};
55
- };
119
+ const silgi = useSilgiCLI$1();
120
+ const commands = await scanCommands();
56
121
  if (!data?.result?.silgi && args.active) {
57
122
  consola.error("Silgi not found");
58
123
  return;
59
124
  }
60
- const silgi = useSilgiCLI();
61
125
  const tags = args.tag?.split(",").map((t) => t.trim());
62
- p.intro(color.bold(`Silgi CLI ${color.green(`v${version}`)}`));
63
126
  const silgiConfig = await loadOptions({});
64
- const getCli = resolve(silgiConfig.build.dir, "cli.json");
65
- const cli = readFileSync(getCli, "utf-8");
66
- const cliJson = JSON.parse(cli);
67
127
  await prepareEnv(silgiConfig);
68
128
  let selectedCommands = [];
69
- if (tags) {
70
- for (const commandName of Object.keys(cliJson)) {
71
- const scripts = cliJson[commandName];
72
- for (const scriptName of Object.keys(scripts)) {
73
- const script = scripts[scriptName];
74
- if (script.tags && script.tags.some((tag) => tags.includes(tag))) {
75
- selectedCommands.push({
76
- command: commandName,
77
- script: scriptName,
78
- handler: script
79
- });
80
- }
81
- }
82
- }
83
- if (selectedCommands.length === 0) {
84
- return;
85
- }
129
+ if (tags?.length) {
130
+ selectedCommands = commands.filter((cmd) => cmd.tags?.some((tag) => tags.includes(tag))).filter((cmd) => cmd.when !== false);
86
131
  } else {
87
- if (!silgi) {
88
- consola.error("Silgi not found");
89
- return;
90
- }
91
- if (Object.keys(cliJson).length === 0) {
92
- consola.warn("No commands found in cli.json");
93
- return;
94
- }
95
- const allTags = Object.values(silgi.commands).reduce((acc, commandGroup) => {
96
- Object.values(commandGroup).forEach((command2) => {
97
- if (command2.tags) {
98
- command2.tags.forEach((tag) => acc.add(tag));
99
- }
100
- });
101
- return acc;
102
- }, /* @__PURE__ */ new Set());
103
- const commandName = await p.select({
104
- message: "Select a command to run",
105
- options: [
106
- ...allTags.size ? [{
107
- value: "command-tags",
108
- label: "Command Tags",
109
- hint: "It executes all commands that are related to the tags you select."
110
- }] : [],
111
- {
112
- value: "functions",
113
- label: "Functions",
114
- hint: "Select and run individual functions"
115
- },
116
- ...Object.keys(cliJson).filter((key) => {
117
- const scripts = cliJson[key];
118
- const scriptValues = Object.values(scripts);
119
- return scriptValues;
120
- }).map((key) => ({
121
- label: key,
122
- value: key
123
- }))
124
- ]
125
- });
126
- if (!commandName)
127
- return;
128
- if (commandName === "command-tags") {
129
- const tags2 = Array.from(allTags);
130
- const selectedTags = await p.select({
131
- message: "Select tags to run",
132
- options: tags2.map((tag) => ({
133
- label: tag,
134
- value: tag
135
- }))
136
- });
137
- if (!selectedTags)
138
- return;
139
- selectedCommands = Object.keys(cliJson).map(
140
- (commandName2) => {
141
- const scripts = cliJson[commandName2];
142
- return Object.keys(scripts).map((scriptName) => ({
143
- command: commandName2,
144
- script: scriptName,
145
- handler: scripts[scriptName]
146
- })).filter((script) => script.handler.tags?.includes(selectedTags));
147
- }
148
- ).flat();
149
- } else if (commandName === "functions") {
150
- const functionGroups = Object.keys(cliJson).reduce((groups, cmdName) => {
151
- const scripts2 = cliJson[cmdName];
152
- if (!Object.values(scripts2).some((script) => script.type === "function")) {
153
- return groups;
154
- }
155
- groups.push(cmdName);
156
- return groups;
157
- }, []);
158
- if (functionGroups.length === 0) {
159
- consola.warn("No function groups found in cli.json");
160
- return;
161
- }
162
- const selectedGroup = await p.select({
163
- message: "Select a project group",
164
- options: functionGroups.map((group) => ({
165
- label: group,
166
- value: group
167
- }))
168
- });
169
- if (!selectedGroup)
170
- return;
171
- const availableFunctions = [];
172
- const scripts = cliJson[selectedGroup];
173
- for (const scriptName of Object.keys(scripts)) {
174
- const script = scripts[scriptName];
175
- if (script && script.type === "function") {
176
- availableFunctions.push({
177
- command: selectedGroup,
178
- script: scriptName,
179
- handler: script
180
- });
181
- }
182
- }
183
- if (availableFunctions.length === 0) {
184
- consola.warn(`No functions found in the ${selectedGroup} group`);
185
- return;
186
- }
187
- const selectedFunction = await p.select({
188
- message: `Select a function from ${selectedGroup}`,
189
- options: availableFunctions.map((fn, index) => ({
190
- label: fn.script,
191
- value: index.toString(),
192
- hint: fn.handler.description || void 0
193
- }))
194
- });
195
- if (!selectedFunction)
196
- return;
197
- const selectedIndex = Number.parseInt(selectedFunction, 10);
198
- const selectedFunctionObj = availableFunctions[selectedIndex];
199
- if (!selectedFunctionObj || !selectedFunctionObj.handler) {
200
- consola.error("Selected function not found or invalid");
201
- return;
202
- }
203
- selectedCommands = [{
204
- command: selectedFunctionObj.command,
205
- script: selectedFunctionObj.script,
206
- handler: selectedFunctionObj.handler
207
- }];
208
- } else {
209
- const scripts = cliJson[commandName];
210
- const scriptName = await p.select({
211
- message: "Select a script to run",
212
- options: Object.keys(scripts).filter((key) => !scripts[key].tags?.length).map((key) => ({
213
- label: key,
214
- value: key
215
- }))
216
- });
217
- if (!scriptName)
218
- return;
219
- selectedCommands = [{
220
- command: commandName,
221
- script: scriptName,
222
- handler: scripts[scriptName]
223
- }];
224
- }
132
+ selectedCommands = commands.filter((cmd) => cmd.when !== false);
225
133
  }
226
- for (const cmd of selectedCommands) {
227
- if (cmd.handler.enabled === false) {
228
- continue;
134
+ const multiSelect = await p.groupMultiselect({
135
+ message: "Select commands to run",
136
+ required: true,
137
+ options: {
138
+ ...selectedCommands.reduce((acc, cmd) => {
139
+ acc[cmd.group || ""] = [
140
+ {
141
+ label: cmd.name,
142
+ value: cmd,
143
+ hint: cmd.description
144
+ }
145
+ ];
146
+ return acc;
147
+ }, {})
229
148
  }
230
- if (cmd.handler.type === "command") {
231
- execSync(cmd.handler.handler, { stdio: "inherit" });
149
+ });
150
+ cancelOnCancel({ value: multiSelect });
151
+ selectedCommands = multiSelect;
152
+ const spinner = p.spinner({
153
+ indicator: "dots"
154
+ });
155
+ for (const cmd of selectedCommands) {
156
+ const data2 = cmd.getContents({ app: silgi });
157
+ spinner.start(`[${cmd.group}] ${cmd.name}...`);
158
+ if (cmd.type === "command") {
159
+ execSync(data2, { stdio: "inherit" });
232
160
  }
233
- if (cmd.handler.type === "function") {
161
+ if (cmd.type === "function") {
234
162
  const jiti = createJiti(import.meta.url, {
235
163
  alias: silgiConfig.alias
236
164
  });
237
- let cleanHandler = cmd.handler.handler.replace(/\n/g, "");
165
+ let cleanHandler = cmd.getContents({ app: silgi }).replace(/\n/g, "");
238
166
  cleanHandler = `import { silgiCLICtx } from 'silgi'
239
167
  ${cleanHandler}
240
168
  `;
@@ -245,6 +173,8 @@ const command$1 = defineCommand({
245
173
  forceTranspile: true
246
174
  });
247
175
  }
176
+ spinner.stop();
177
+ consola.success(`[${cmd.group}] ${cmd.name} done`);
248
178
  }
249
179
  await silgiCLIIClose();
250
180
  }
@@ -1,7 +1,7 @@
1
1
  import { generateDTS } from 'apiful/openapi';
2
2
  import consola$1, { consola } from 'consola';
3
3
  import { join, resolve, dirname, isAbsolute, relative, basename, extname } from 'pathe';
4
- import { hasSilgiModule, addTemplate, normalizeTemplate, useLogger, genEnsureSafeVar, hash, relativeWithDot, writeFile, isDirectory, resolveAlias as resolveAlias$1, directoryToURL, hasError, parseServices, addNPMPackage, resolveSilgiPath } from 'silgi/kit';
4
+ import { hasSilgiModule, addTemplate, normalizeTemplate, useLogger, genEnsureSafeVar, hash, relativeWithDot, writeFile, isDirectory, resolveAlias as resolveAlias$1, directoryToURL, hasError, parseServices, resolveSilgiPath } from 'silgi/kit';
5
5
  import { mkdirSync, existsSync, writeFileSync, promises, readFileSync } from 'node:fs';
6
6
  import { readdir, readFile } from 'node:fs/promises';
7
7
  import { genObjectFromRawEntries, genObjectFromRaw, genObjectFromValues } from 'knitwork';
@@ -1534,49 +1534,6 @@ ${cycleStr}`);
1534
1534
  return order;
1535
1535
  }
1536
1536
 
1537
- async function commands(silgi) {
1538
- const commands2 = {
1539
- ...silgi.options.commands
1540
- };
1541
- await silgi.callHook("prepare:commands", commands2);
1542
- addTemplate({
1543
- filename: "cli.json",
1544
- where: ".silgi",
1545
- write: true,
1546
- getContents: () => JSON.stringify(commands2, null, 2)
1547
- });
1548
- silgi.commands = commands2;
1549
- silgi.hook("prepare:schema.ts", async (object) => {
1550
- const allTags = Object.values(commands2).reduce((acc, commandGroup) => {
1551
- Object.values(commandGroup).forEach((command) => {
1552
- if (command.tags) {
1553
- command.tags.forEach((tag) => acc.add(tag));
1554
- }
1555
- });
1556
- return acc;
1557
- }, /* @__PURE__ */ new Set());
1558
- const data = [
1559
- "",
1560
- generateTypes(
1561
- await resolveSchema(
1562
- {
1563
- ...Object.fromEntries(Array.from(allTags.values()).map((tag) => [tag, "string"]))
1564
- }
1565
- ),
1566
- {
1567
- interfaceName: "SilgiCommandsExtended",
1568
- addExport: false,
1569
- addDefaults: false,
1570
- allowExtraKeys: false,
1571
- indentation: 0
1572
- }
1573
- ),
1574
- ""
1575
- ];
1576
- object.customImports?.push(...data);
1577
- });
1578
- }
1579
-
1580
1537
  function resolveIgnorePatterns(silgi, relativePath) {
1581
1538
  if (!silgi) {
1582
1539
  return [];
@@ -2188,45 +2145,6 @@ async function createStorageCLI(silgi) {
2188
2145
  return storage;
2189
2146
  }
2190
2147
 
2191
- async function installPackages(silgi) {
2192
- await addNPMPackage([
2193
- {
2194
- name: "@fastify/deepmerge",
2195
- isDev: false
2196
- },
2197
- {
2198
- name: "@silgi/ecosystem",
2199
- isDev: false
2200
- },
2201
- {
2202
- name: "unadapter",
2203
- isDev: false
2204
- }
2205
- ]);
2206
- const packages = {
2207
- dependencies: {
2208
- ...silgi.options.installPackages?.dependencies
2209
- },
2210
- devDependencies: {
2211
- ...silgi.options.installPackages?.devDependencies
2212
- }
2213
- };
2214
- console.log(packages);
2215
- if (silgi.options.preset === "npm-package") {
2216
- packages.devDependencies = {
2217
- ...packages.devDependencies,
2218
- ...packages.dependencies
2219
- };
2220
- packages.dependencies = {};
2221
- }
2222
- addTemplate({
2223
- filename: "install.json",
2224
- where: ".silgi",
2225
- write: true,
2226
- getContents: () => JSON.stringify(packages, null, 2)
2227
- });
2228
- }
2229
-
2230
2148
  function useCLIRuntimeConfig(silgi) {
2231
2149
  const safeRuntimeConfig = JSON.parse(JSON.stringify(silgi.options.runtimeConfig));
2232
2150
  silgi.hook("prepare:configs.ts", (data) => {
@@ -2345,7 +2263,6 @@ async function createSilgiCLI(config = {}, opts = {}) {
2345
2263
  options,
2346
2264
  hooks,
2347
2265
  errors: [],
2348
- commands: {},
2349
2266
  _requiredModules: {},
2350
2267
  logger: consola.withTag("silgi"),
2351
2268
  close: () => silgi.hooks.callHook("close", silgi),
@@ -2402,8 +2319,6 @@ async function createSilgiCLI(config = {}, opts = {}) {
2402
2319
  silgi.hooks.addHooks(silgi.options.hooks);
2403
2320
  await installModules(silgi);
2404
2321
  await silgi.hooks.callHook("scanFiles:done", silgi);
2405
- await commands(silgi);
2406
- await installPackages(silgi);
2407
2322
  await generateApp(silgi);
2408
2323
  if (silgi.options.imports) {
2409
2324
  silgi.options.imports.dirs ??= [];
@@ -126,7 +126,6 @@ const SilgiCLIDefaults = {
126
126
  conditions: [],
127
127
  nodeModulesDirs: [],
128
128
  hooks: {},
129
- commands: {},
130
129
  // Framework
131
130
  framework: {
132
131
  name: "h3",
@@ -269,7 +269,6 @@ declare function getIpAddress(event: SilgiEvents): string | boolean;
269
269
  declare function ipAddress(req: IncomingMessage): string;
270
270
 
271
271
  declare function relativeWithDot(from: string, to: string): string;
272
- /** @since 3.9.0 */
273
272
  declare function toArray<T>(value: T | T[]): T[];
274
273
  /**
275
274
  * Filter out items from an array in place. This function mutates the array.
@@ -22,6 +22,7 @@ import 'unctx';
22
22
  import 'semver/functions/satisfies.js';
23
23
  import 'silgi/meta';
24
24
 
25
+ const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
25
26
  async function addNPMPackage(data) {
26
27
  const silgi = useSilgiCLI();
27
28
  for (const item of data) {
@@ -32,6 +33,11 @@ async function addNPMPackage(data) {
32
33
  `pnpm info ${item.name} version`,
33
34
  { encoding: "utf-8" }
34
35
  );
36
+ silgi.logger.withTag("add-npm").success(
37
+ "Checking package version",
38
+ item.name,
39
+ getPackageVersion.trim()
40
+ );
35
41
  let version = item.version || getPackageVersion.trim();
36
42
  version = `^${version}`;
37
43
  if (item.isDev) {
@@ -39,6 +45,7 @@ async function addNPMPackage(data) {
39
45
  } else {
40
46
  silgi.options.installPackages.dependencies[item.name] = version;
41
47
  }
48
+ await delay(50);
42
49
  }
43
50
  }
44
51
 
@@ -47,8 +47,6 @@ interface ImportItem {
47
47
  customImports: string[];
48
48
  customContent?: string[];
49
49
  }
50
- interface SilgiCommands {
51
- }
52
50
  interface SilgiCLI {
53
51
  _ignore?: Ignore;
54
52
  errors: {
@@ -82,13 +80,6 @@ interface SilgiCLI {
82
80
  }>;
83
81
  options: SilgiCLIOptions;
84
82
  _requiredModules: Record<string, boolean>;
85
- commands: Record<string, Record<string, {
86
- type: 'function' | 'command';
87
- handler: string;
88
- description?: string;
89
- tags?: (keyof SilgiCommands)[];
90
- enabled?: boolean;
91
- }>>;
92
83
  adapters: Record<string, Adapter<Record<string, any>, TablesSchema, InferModelTypes<TablesSchema>>>;
93
84
  }
94
85
  type SilgiCLIDynamicConfig = Pick<SilgiCLIConfig, 'routeRules'>;
@@ -605,7 +596,9 @@ interface SilgiCLIOptions extends PresetOptions {
605
596
  modules: (SilgiModule<any> | string | [SilgiModule | string, Record<string, any>] | undefined | null | false)[];
606
597
  _modules: (SilgiModule<any> | string | [SilgiModule | string, Record<string, any>] | undefined | null | false)[];
607
598
  isPreparingModules: boolean;
608
- debug: boolean;
599
+ debug: true | {
600
+ command?: boolean;
601
+ };
609
602
  preset: PresetName;
610
603
  static: boolean;
611
604
  logLevel: LogLevel;
@@ -805,11 +798,6 @@ interface SilgiCLIOptions extends PresetOptions {
805
798
  * ```
806
799
  */
807
800
  ignoreOptions: Options;
808
- commands: Record<string, Record<string, {
809
- type: 'function' | 'command';
810
- handler: string;
811
- description?: string;
812
- }>>;
813
801
  installPackages: Record<'dependencies' | 'devDependencies', Record<string, string>>;
814
802
  apiFul: ApifulConfig;
815
803
  adapters: Record<string, Adapter<Record<string, any>, TablesSchema, InferModelTypes<TablesSchema>>>;
@@ -1159,6 +1147,20 @@ interface GraphQLJSON {
1159
1147
  references: any;
1160
1148
  }
1161
1149
 
1150
+ interface SilgiCommands {
1151
+ }
1152
+ interface Commands {
1153
+ name: string;
1154
+ description?: string;
1155
+ group: string;
1156
+ when?: boolean;
1157
+ type: 'function' | 'command';
1158
+ tags?: (keyof SilgiCommands)[] | (string | object)[];
1159
+ getContents: (data: {
1160
+ app: SilgiCLI;
1161
+ }) => string;
1162
+ }
1163
+
1162
1164
  interface BaseNamespaceType extends Record<keyof DefaultNamespaces, Record<string, BaseSchemaType<StandardSchemaV1>>> {
1163
1165
  }
1164
1166
  type Namespaces<T extends BaseNamespaceType> = {
@@ -1178,4 +1180,4 @@ interface ServiceParseModule {
1178
1180
  (params: ServiceParse): Awaited<void> | void;
1179
1181
  }
1180
1182
 
1181
- export type { AllPaths, AppConfig, Awaitable, BaseNamespaceType, BaseSchemaType, BaseSilgiMethodType, CaptureError, CapturedErrorContext, CommandType, CreateScope, DeepPartial, DeepRequired, DefaultHooks, DefaultNamespaces, DefaultRouteConfig, DefaultRouteRules, DotenvOptions, EnvOptions, EventHandlerResponse, ExtendContext, ExtendShared, ExtractInputFromURI, ExtractOutputFromURI, ExtractPathParams, ExtractPathParamsFromURI, ExtractQueryParamsFromURI, ExtractSourceFromURI, FrameworkContext, GenerateAppOptions, GraphQLJSON, HookResult, HttpMethod, ImportItem, LoadConfigOptions, MergedSilgiSchema, MethodHandlerType, ModuleDefinition, ModuleHookContext, ModuleMeta, ModuleOptionsCustom, ModuleSetupInstallResult, ModuleSetupReturn, Namespaces, NitroBuildInfo, PrepareCore, RequiredServiceType, ResolvedMethodHandlerType, ResolvedModuleMeta, ResolvedModuleOptions, ResolvedServiceType, ResolvedSilgiTemplate, RouteRules, RouterParams, ScanFile, ServiceParse, ServiceParseModule, ServiceType, Silgi, SilgiAppPlugin, SilgiCLI, SilgiCLIConfig, SilgiCLIDynamicConfig, SilgiCLIHooks, SilgiCLIOptions, SilgiCommands, SilgiCompatibility, SilgiCompatibilityIssue, SilgiCompatibilityIssues, SilgiConfig, SilgiEvents, SilgiFetchClient, SilgiFetchOptions, SilgiFrameworkInfo, SilgiFunction, SilgiHooks, SilgiModule, SilgiModuleInput, SilgiModuleOptions, SilgiNamespaces, SilgiOperation, SilgiOptions, SilgiPreset, SilgiPresetMeta, SilgiRouteRules, SilgiRouterTypes, SilgiRuntimeActions, SilgiRuntimeConfig, SilgiRuntimeContext, SilgiRuntimeHooks, SilgiRuntimeMethods, SilgiRuntimeOptions, SilgiRuntimeRouteRules, SilgiRuntimeRouteRulesConfig, SilgiRuntimeShareds, SilgiRuntimeSharedsExtend, SilgiSchema, SilgiServiceInterface, SilgiStorageBase, SilgiTemplate, SilgiURIs, StorageConfig, StorageKeyGenerator, StorageKeyParams, StorageMounts, TSReference, TrimAfterFourSlashes, URIsTypes };
1183
+ export type { AllPaths, AppConfig, Awaitable, BaseNamespaceType, BaseSchemaType, BaseSilgiMethodType, CaptureError, CapturedErrorContext, CommandType, Commands, CreateScope, DeepPartial, DeepRequired, DefaultHooks, DefaultNamespaces, DefaultRouteConfig, DefaultRouteRules, DotenvOptions, EnvOptions, EventHandlerResponse, ExtendContext, ExtendShared, ExtractInputFromURI, ExtractOutputFromURI, ExtractPathParams, ExtractPathParamsFromURI, ExtractQueryParamsFromURI, ExtractSourceFromURI, FrameworkContext, GenerateAppOptions, GraphQLJSON, HookResult, HttpMethod, ImportItem, LoadConfigOptions, MergedSilgiSchema, MethodHandlerType, ModuleDefinition, ModuleHookContext, ModuleMeta, ModuleOptionsCustom, ModuleSetupInstallResult, ModuleSetupReturn, Namespaces, NitroBuildInfo, PrepareCore, RequiredServiceType, ResolvedMethodHandlerType, ResolvedModuleMeta, ResolvedModuleOptions, ResolvedServiceType, ResolvedSilgiTemplate, RouteRules, RouterParams, ScanFile, ServiceParse, ServiceParseModule, ServiceType, Silgi, SilgiAppPlugin, SilgiCLI, SilgiCLIConfig, SilgiCLIDynamicConfig, SilgiCLIHooks, SilgiCLIOptions, SilgiCommands, SilgiCompatibility, SilgiCompatibilityIssue, SilgiCompatibilityIssues, SilgiConfig, SilgiEvents, SilgiFetchClient, SilgiFetchOptions, SilgiFrameworkInfo, SilgiFunction, SilgiHooks, SilgiModule, SilgiModuleInput, SilgiModuleOptions, SilgiNamespaces, SilgiOperation, SilgiOptions, SilgiPreset, SilgiPresetMeta, SilgiRouteRules, SilgiRouterTypes, SilgiRuntimeActions, SilgiRuntimeConfig, SilgiRuntimeContext, SilgiRuntimeHooks, SilgiRuntimeMethods, SilgiRuntimeOptions, SilgiRuntimeRouteRules, SilgiRuntimeRouteRulesConfig, SilgiRuntimeShareds, SilgiRuntimeSharedsExtend, SilgiSchema, SilgiServiceInterface, SilgiStorageBase, SilgiTemplate, SilgiURIs, StorageConfig, StorageKeyGenerator, StorageKeyParams, StorageMounts, TSReference, TrimAfterFourSlashes, URIsTypes };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "silgi",
3
3
  "type": "module",
4
- "version": "0.28.10",
4
+ "version": "0.28.12",
5
5
  "private": false,
6
6
  "sideEffects": false,
7
7
  "exports": {