proteum 2.1.1 → 2.1.3-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.
@@ -9,15 +9,71 @@ class InitCommand extends ProteumCommand {
9
9
 
10
10
  public static usage = buildUsage('init');
11
11
 
12
- public legacyArgs = Option.Rest();
12
+ public name = Option.String('--name', { description: 'Human-readable app name.' });
13
+ public description = Option.String('--description', { description: 'App description used in identity.yaml and package.json.' });
14
+ public identifier = Option.String('--identifier', { description: 'Application class and identity identifier.' });
15
+ public port = Option.String('--port', { description: 'Default local router port used in .env.' });
16
+ public url = Option.String('--url', { description: 'Default absolute URL used in .env.' });
17
+ public proteumVersion = Option.String('--proteum-version', {
18
+ description: 'Override the Proteum dependency written to package.json.',
19
+ });
20
+ public install = Option.Boolean('--install', false, { description: 'Run npm install after scaffolding.' });
21
+ public dryRun = Option.Boolean('--dry-run', false, { description: 'Print the scaffold plan without writing files.' });
22
+ public json = Option.Boolean('--json', false, { description: 'Print machine-readable scaffold output.' });
23
+ public force = Option.Boolean('--force', false, { description: 'Allow writing into a non-empty target directory.' });
24
+ public args = Option.Rest();
13
25
 
14
26
  public async execute() {
15
- assertNoLegacyArgs('init', this.legacyArgs);
16
- this.setCliArgs();
27
+ const [directory = ''] = this.args;
28
+
29
+ this.setCliArgs({
30
+ directory,
31
+ name: this.name ?? '',
32
+ description: this.description ?? '',
33
+ identifier: this.identifier ?? '',
34
+ port: this.port ?? '',
35
+ url: this.url ?? '',
36
+ proteumVersion: this.proteumVersion ?? '',
37
+ install: this.install,
38
+ dryRun: this.dryRun,
39
+ json: this.json,
40
+ force: this.force,
41
+ });
17
42
  await runCommandModule(() => import('../commands/init'));
18
43
  }
19
44
  }
20
45
 
46
+ class CreateCommand extends ProteumCommand {
47
+ public static paths = [['create']];
48
+
49
+ public static usage = buildUsage('create');
50
+
51
+ public route = Option.String('--route', { description: 'Explicit URL path used for page or route scaffolds.' });
52
+ public method = Option.String('--method', { description: 'Method name used for controller or command scaffolds.' });
53
+ public httpMethod = Option.String('--http-method', { description: 'HTTP verb used for route scaffolds.' });
54
+ public json = Option.Boolean('--json', false, { description: 'Print machine-readable scaffold output.' });
55
+ public dryRun = Option.Boolean('--dry-run', false, { description: 'Print the scaffold plan without writing files.' });
56
+ public force = Option.Boolean('--force', false, { description: 'Allow overwriting generated target files.' });
57
+ public args = Option.Rest();
58
+
59
+ public async execute() {
60
+ const [kind = '', target = ''] = this.args;
61
+
62
+ this.setCliArgs({
63
+ kind,
64
+ target,
65
+ route: this.route ?? '',
66
+ method: this.method ?? '',
67
+ httpMethod: this.httpMethod ?? '',
68
+ json: this.json,
69
+ dryRun: this.dryRun,
70
+ force: this.force,
71
+ });
72
+
73
+ await runCommandModule(() => import('../commands/create'));
74
+ }
75
+ }
76
+
21
77
  class DevCommand extends ProteumCommand {
22
78
  public static paths = [['dev']];
23
79
 
@@ -240,8 +296,35 @@ class CommandCommand extends ProteumCommand {
240
296
  }
241
297
  }
242
298
 
299
+ class SessionCommand extends ProteumCommand {
300
+ public static paths = [['session']];
301
+
302
+ public static usage = buildUsage('session');
303
+
304
+ public role = Option.String('--role', { description: 'Require the resolved user to have the given role.' });
305
+ public port = Option.String('--port', { description: 'Target an existing dev server on the given port.' });
306
+ public url = Option.String('--url', { description: 'Target an existing dev server at the given base URL.' });
307
+ public json = Option.Boolean('--json', false, { description: 'Print JSON output.' });
308
+ public args = Option.Rest();
309
+
310
+ public async execute() {
311
+ const [email = ''] = this.args;
312
+
313
+ this.setCliArgs({
314
+ email,
315
+ role: this.role ?? '',
316
+ port: this.port ?? '',
317
+ url: this.url ?? '',
318
+ json: this.json,
319
+ });
320
+
321
+ await runCommandModule(() => import('../commands/session'));
322
+ }
323
+ }
324
+
243
325
  export const registeredCommands = {
244
326
  init: InitCommand,
327
+ create: CreateCommand,
245
328
  dev: DevCommand,
246
329
  refresh: RefreshCommand,
247
330
  build: BuildCommand,
@@ -252,6 +335,7 @@ export const registeredCommands = {
252
335
  explain: ExplainCommand,
253
336
  trace: TraceCommand,
254
337
  command: CommandCommand,
338
+ session: SessionCommand,
255
339
  } as const;
256
340
 
257
341
  export const createCli = (version: string) => {
@@ -265,6 +349,7 @@ export const createCli = (version: string) => {
265
349
  clipanion.register(Builtins.VersionCommand);
266
350
  clipanion.register(Builtins.DefinitionsCommand);
267
351
  clipanion.register(InitCommand);
352
+ clipanion.register(CreateCommand);
268
353
  clipanion.register(DevCommand);
269
354
  clipanion.register(RefreshCommand);
270
355
  clipanion.register(BuildCommand);
@@ -275,6 +360,7 @@ export const createCli = (version: string) => {
275
360
  clipanion.register(ExplainCommand);
276
361
  clipanion.register(TraceCommand);
277
362
  clipanion.register(CommandCommand);
363
+ clipanion.register(SessionCommand);
278
364
 
279
365
  return clipanion;
280
366
  };