proteum 2.1.0 → 2.1.2

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 (95) hide show
  1. package/AGENTS.md +44 -98
  2. package/README.md +143 -10
  3. package/agents/framework/AGENTS.md +146 -886
  4. package/agents/project/AGENTS.md +73 -127
  5. package/agents/project/client/AGENTS.md +22 -93
  6. package/agents/project/client/pages/AGENTS.md +24 -26
  7. package/agents/project/server/routes/AGENTS.md +10 -8
  8. package/agents/project/server/services/AGENTS.md +22 -159
  9. package/agents/project/tests/AGENTS.md +11 -8
  10. package/cli/app/config.ts +7 -20
  11. package/cli/bin.js +8 -0
  12. package/cli/commands/command.ts +243 -0
  13. package/cli/commands/commandLocalRunner.js +198 -0
  14. package/cli/commands/create.ts +5 -0
  15. package/cli/commands/deploy/web.ts +1 -2
  16. package/cli/commands/dev.ts +98 -2
  17. package/cli/commands/doctor.ts +8 -74
  18. package/cli/commands/explain.ts +8 -186
  19. package/cli/commands/init.ts +2 -94
  20. package/cli/commands/trace.ts +228 -0
  21. package/cli/compiler/artifacts/commands.ts +217 -0
  22. package/cli/compiler/artifacts/manifest.ts +35 -21
  23. package/cli/compiler/artifacts/services.ts +300 -1
  24. package/cli/compiler/client/index.ts +43 -8
  25. package/cli/compiler/common/commands.ts +175 -0
  26. package/cli/compiler/common/index.ts +1 -1
  27. package/cli/compiler/common/proteumManifest.ts +15 -114
  28. package/cli/compiler/index.ts +25 -2
  29. package/cli/compiler/server/index.ts +31 -6
  30. package/cli/index.ts +1 -4
  31. package/cli/paths.ts +16 -1
  32. package/cli/presentation/commands.ts +104 -14
  33. package/cli/presentation/devSession.ts +22 -3
  34. package/cli/presentation/proteum_logo_400x400_square_icon.txt +400 -0
  35. package/cli/runtime/commands.ts +121 -4
  36. package/cli/scaffold/index.ts +720 -0
  37. package/cli/scaffold/templates.ts +344 -0
  38. package/cli/scaffold/types.ts +26 -0
  39. package/cli/tsconfig.json +4 -1
  40. package/cli/utils/check.ts +1 -1
  41. package/client/app/component.tsx +13 -9
  42. package/client/dev/profiler/index.tsx +2511 -0
  43. package/client/dev/profiler/noop.tsx +5 -0
  44. package/client/dev/profiler/runtime.noop.ts +116 -0
  45. package/client/dev/profiler/runtime.ts +840 -0
  46. package/client/services/router/components/router.tsx +30 -2
  47. package/client/services/router/index.tsx +27 -3
  48. package/client/services/router/request/api.ts +133 -17
  49. package/commands/proteum/diagnostics.ts +11 -0
  50. package/common/dev/commands.ts +50 -0
  51. package/common/dev/diagnostics.ts +298 -0
  52. package/common/dev/profiler.ts +92 -0
  53. package/common/dev/proteumManifest.ts +135 -0
  54. package/common/dev/requestTrace.ts +115 -0
  55. package/common/env/proteumEnv.ts +284 -0
  56. package/common/router/index.ts +4 -22
  57. package/docs/dev-commands.md +93 -0
  58. package/docs/diagnostics.md +88 -0
  59. package/docs/request-tracing.md +132 -0
  60. package/eslint.js +11 -6
  61. package/package.json +3 -3
  62. package/server/app/commands.ts +35 -370
  63. package/server/app/commandsManager.ts +393 -0
  64. package/server/app/container/config.ts +11 -49
  65. package/server/app/container/console/index.ts +2 -3
  66. package/server/app/container/index.ts +5 -2
  67. package/server/app/container/trace/index.ts +364 -0
  68. package/server/app/devCommands.ts +192 -0
  69. package/server/app/devDiagnostics.ts +53 -0
  70. package/server/app/index.ts +29 -6
  71. package/server/index.ts +0 -1
  72. package/server/services/auth/index.ts +525 -61
  73. package/server/services/auth/router/index.ts +106 -7
  74. package/server/services/cron/CronTask.ts +73 -5
  75. package/server/services/cron/index.ts +34 -11
  76. package/server/services/fetch/index.ts +3 -10
  77. package/server/services/prisma/index.ts +66 -4
  78. package/server/services/router/http/index.ts +173 -6
  79. package/server/services/router/index.ts +200 -12
  80. package/server/services/router/request/api.ts +30 -1
  81. package/server/services/router/response/index.ts +83 -10
  82. package/server/services/router/response/page/document.tsx +16 -0
  83. package/server/services/router/response/page/index.tsx +27 -1
  84. package/skills/clean-project-code/SKILL.md +7 -2
  85. package/test-results/.last-run.json +4 -0
  86. package/types/aliases.d.ts +6 -0
  87. package/types/global/utils.d.ts +7 -14
  88. package/Rte.zip +0 -0
  89. package/agents/project/agents.md.zip +0 -0
  90. package/doc/TODO.md +0 -71
  91. package/doc/front/router.md +0 -27
  92. package/doc/workspace/workspace.png +0 -0
  93. package/doc/workspace/workspace2.png +0 -0
  94. package/doc/workspace/workspace_26.01.22.png +0 -0
  95. package/server/services/router/http/session.ts.old +0 -40
@@ -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
 
@@ -153,6 +209,7 @@ class ExplainCommand extends ProteumCommand {
153
209
  public env = Option.Boolean('--env', false, { description: 'Include the env section.' });
154
210
  public services = Option.Boolean('--services', false, { description: 'Include the services section.' });
155
211
  public controllers = Option.Boolean('--controllers', false, { description: 'Include the controllers section.' });
212
+ public commands = Option.Boolean('--commands', false, { description: 'Include the commands section.' });
156
213
  public routes = Option.Boolean('--routes', false, { description: 'Include the routes section.' });
157
214
  public layouts = Option.Boolean('--layouts', false, { description: 'Include the layouts section.' });
158
215
  public diagnostics = Option.Boolean('--diagnostics', false, {
@@ -169,6 +226,7 @@ class ExplainCommand extends ProteumCommand {
169
226
  env: this.env,
170
227
  services: this.services,
171
228
  controllers: this.controllers,
229
+ commands: this.commands,
172
230
  routes: this.routes,
173
231
  layouts: this.layouts,
174
232
  diagnostics: this.diagnostics,
@@ -177,7 +235,7 @@ class ExplainCommand extends ProteumCommand {
177
235
  applyLegacyBooleanArgs(
178
236
  'explain',
179
237
  this.legacyArgs,
180
- ['json', 'all', 'app', 'conventions', 'env', 'services', 'controllers', 'routes', 'layouts', 'diagnostics'],
238
+ ['json', 'all', 'app', 'conventions', 'env', 'services', 'controllers', 'commands', 'routes', 'layouts', 'diagnostics'],
181
239
  args,
182
240
  );
183
241
  this.setCliArgs(args);
@@ -185,8 +243,62 @@ class ExplainCommand extends ProteumCommand {
185
243
  }
186
244
  }
187
245
 
246
+ class TraceCommand extends ProteumCommand {
247
+ public static paths = [['trace']];
248
+
249
+ public static usage = buildUsage('trace');
250
+
251
+ public port = Option.String('--port', { description: 'Override the router port used to query the running dev server.' });
252
+ public url = Option.String('--url', { description: 'Override the full base URL used to query the running dev server.' });
253
+ public json = Option.Boolean('--json', false, { description: 'Print JSON output.' });
254
+ public capture = Option.String('--capture', { description: 'Capture mode used by `proteum trace arm`.' });
255
+ public output = Option.String('--output', { description: 'Output filepath used by `proteum trace export`.' });
256
+ public args = Option.Rest();
257
+
258
+ public async execute() {
259
+ const [action = 'latest', id = ''] = this.args;
260
+
261
+ this.setCliArgs({
262
+ action,
263
+ id,
264
+ port: this.port ?? '',
265
+ url: this.url ?? '',
266
+ json: this.json,
267
+ capture: this.capture ?? '',
268
+ output: this.output ?? '',
269
+ });
270
+
271
+ await runCommandModule(() => import('../commands/trace'));
272
+ }
273
+ }
274
+
275
+ class CommandCommand extends ProteumCommand {
276
+ public static paths = [['command']];
277
+
278
+ public static usage = buildUsage('command');
279
+
280
+ public port = Option.String('--port', { description: 'Target an existing dev server on the given port.' });
281
+ public url = Option.String('--url', { description: 'Target an existing dev server at the given base URL.' });
282
+ public json = Option.Boolean('--json', false, { description: 'Print JSON output.' });
283
+ public args = Option.Rest();
284
+
285
+ public async execute() {
286
+ const [path = ''] = this.args;
287
+
288
+ this.setCliArgs({
289
+ path,
290
+ port: this.port ?? '',
291
+ url: this.url ?? '',
292
+ json: this.json,
293
+ });
294
+
295
+ await runCommandModule(() => import('../commands/command'));
296
+ }
297
+ }
298
+
188
299
  export const registeredCommands = {
189
300
  init: InitCommand,
301
+ create: CreateCommand,
190
302
  dev: DevCommand,
191
303
  refresh: RefreshCommand,
192
304
  build: BuildCommand,
@@ -195,6 +307,8 @@ export const registeredCommands = {
195
307
  check: CheckCommand,
196
308
  doctor: DoctorCommand,
197
309
  explain: ExplainCommand,
310
+ trace: TraceCommand,
311
+ command: CommandCommand,
198
312
  } as const;
199
313
 
200
314
  export const createCli = (version: string) => {
@@ -208,6 +322,7 @@ export const createCli = (version: string) => {
208
322
  clipanion.register(Builtins.VersionCommand);
209
323
  clipanion.register(Builtins.DefinitionsCommand);
210
324
  clipanion.register(InitCommand);
325
+ clipanion.register(CreateCommand);
211
326
  clipanion.register(DevCommand);
212
327
  clipanion.register(RefreshCommand);
213
328
  clipanion.register(BuildCommand);
@@ -216,6 +331,8 @@ export const createCli = (version: string) => {
216
331
  clipanion.register(CheckCommand);
217
332
  clipanion.register(DoctorCommand);
218
333
  clipanion.register(ExplainCommand);
334
+ clipanion.register(TraceCommand);
335
+ clipanion.register(CommandCommand);
219
336
 
220
337
  return clipanion;
221
338
  };