proteum 2.0.0 → 2.1.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 (94) hide show
  1. package/AGENTS.md +13 -1
  2. package/README.md +375 -0
  3. package/agents/framework/AGENTS.md +917 -0
  4. package/agents/project/AGENTS.md +138 -0
  5. package/agents/{codex → project}/CODING_STYLE.md +3 -2
  6. package/agents/project/client/AGENTS.md +108 -0
  7. package/agents/{codex → project}/client/pages/AGENTS.md +8 -8
  8. package/agents/{codex → project}/server/routes/AGENTS.md +2 -1
  9. package/agents/project/server/services/AGENTS.md +170 -0
  10. package/agents/{codex → project}/tests/AGENTS.md +1 -0
  11. package/cli/app/config.ts +3 -2
  12. package/cli/app/index.ts +6 -66
  13. package/cli/bin.js +7 -2
  14. package/cli/commands/build.ts +94 -27
  15. package/cli/commands/check.ts +15 -1
  16. package/cli/commands/dev.ts +288 -132
  17. package/cli/commands/doctor.ts +108 -0
  18. package/cli/commands/explain.ts +226 -0
  19. package/cli/commands/init.ts +76 -70
  20. package/cli/commands/lint.ts +18 -1
  21. package/cli/commands/refresh.ts +16 -6
  22. package/cli/commands/typecheck.ts +14 -1
  23. package/cli/compiler/artifacts/controllers.ts +150 -0
  24. package/cli/compiler/artifacts/discovery.ts +132 -0
  25. package/cli/compiler/artifacts/manifest.ts +267 -0
  26. package/cli/compiler/artifacts/routing.ts +315 -0
  27. package/cli/compiler/artifacts/services.ts +480 -0
  28. package/cli/compiler/artifacts/shared.ts +12 -0
  29. package/cli/compiler/client/identite.ts +2 -1
  30. package/cli/compiler/client/index.ts +13 -3
  31. package/cli/compiler/common/controllers.ts +23 -28
  32. package/cli/compiler/common/files/style.ts +3 -4
  33. package/cli/compiler/common/generatedRouteModules.ts +333 -19
  34. package/cli/compiler/common/proteumManifest.ts +133 -0
  35. package/cli/compiler/index.ts +33 -896
  36. package/cli/compiler/server/index.ts +21 -4
  37. package/cli/context.ts +71 -0
  38. package/cli/index.ts +39 -181
  39. package/cli/presentation/commands.ts +208 -0
  40. package/cli/presentation/compileReporter.ts +65 -0
  41. package/cli/presentation/devSession.ts +70 -0
  42. package/cli/presentation/help.ts +193 -0
  43. package/cli/presentation/ink.ts +69 -0
  44. package/cli/presentation/layout.ts +83 -0
  45. package/cli/runtime/argv.ts +49 -0
  46. package/cli/runtime/command.ts +25 -0
  47. package/cli/runtime/commands.ts +221 -0
  48. package/cli/runtime/importEsm.ts +7 -0
  49. package/cli/runtime/verbose.ts +15 -0
  50. package/cli/utils/agents.ts +5 -4
  51. package/cli/utils/keyboard.ts +12 -6
  52. package/client/app/index.ts +0 -6
  53. package/client/services/router/index.tsx +1 -1
  54. package/client/services/router/response/index.tsx +2 -2
  55. package/common/dev/serverHotReload.ts +12 -0
  56. package/common/router/index.ts +3 -2
  57. package/common/router/layouts.ts +1 -1
  58. package/common/router/pageSetup.ts +1 -0
  59. package/package.json +10 -8
  60. package/prettier/router-registration-plugin.cjs +52 -0
  61. package/prettier.config.cjs +1 -0
  62. package/scripts/cleanup-generated-controllers.ts +2 -2
  63. package/scripts/fix-reference-app-typing.ts +2 -2
  64. package/scripts/format-router-registrations.ts +119 -0
  65. package/scripts/migrate-explicit-controllers-and-request.ts +423 -0
  66. package/scripts/refactor-server-controllers.ts +19 -18
  67. package/scripts/refactor-server-runtime-aliases.ts +1 -1
  68. package/server/app/commands.ts +309 -25
  69. package/server/app/container/config.ts +1 -1
  70. package/server/app/container/index.ts +2 -2
  71. package/server/app/controller/index.ts +13 -4
  72. package/server/app/index.ts +53 -37
  73. package/server/app/service/container.ts +26 -28
  74. package/server/app/service/index.ts +10 -20
  75. package/server/app.tsconfig.json +9 -2
  76. package/server/index.ts +32 -1
  77. package/server/services/auth/index.ts +234 -15
  78. package/server/services/auth/router/index.ts +39 -7
  79. package/server/services/auth/router/request.ts +40 -8
  80. package/server/services/disks/index.ts +1 -1
  81. package/server/services/prisma/Facet.ts +2 -2
  82. package/server/services/prisma/index.ts +22 -5
  83. package/server/services/prisma/mariadb.ts +47 -0
  84. package/server/services/router/http/index.ts +9 -1
  85. package/server/services/router/index.ts +10 -4
  86. package/server/services/router/response/index.ts +26 -6
  87. package/types/auth-check-rules.test.ts +51 -0
  88. package/types/controller-request-context.test.ts +55 -0
  89. package/types/service-config.test.ts +39 -0
  90. package/agents/codex/AGENTS.md +0 -95
  91. package/agents/codex/client/AGENTS.md +0 -102
  92. package/agents/codex/server/services/AGENTS.md +0 -137
  93. package/server/services/models.7z +0 -0
  94. /package/agents/{codex → project}/agents.md.zip +0 -0
@@ -1,137 +0,0 @@
1
- # Server Services
2
-
3
- Stack:
4
- - Typescript with strict mode
5
- - NodeJS
6
- - Prisma 7 ORM
7
-
8
- ## 1. Create the service file in `/server/services/<service name>/index.ts`
9
-
10
- Template:
11
-
12
- ```typescript
13
- /*----------------------------------
14
- - DEPENDANCE
15
- ----------------------------------*/
16
-
17
- // Core libs
18
- import Service from '@server/app/service';
19
-
20
- /*----------------------------------
21
- - TYPES
22
- ----------------------------------*/
23
-
24
- export type Config = <ServiceConfig>;
25
-
26
- /*----------------------------------
27
- - SERVICE
28
- ----------------------------------*/
29
-
30
- export default class ServiceName extends Service<Config, {}, CrossPath, CrossPath> {
31
-
32
- public async MethodName(data: { param1: string }) {
33
- const { OtherService } = this.services;
34
-
35
- return OtherService.OtherMethod(data);
36
- }
37
- }
38
- ```
39
-
40
- `<ServiceConfig>` is an object containing api keys and other variables we can adjust in the future.
41
-
42
- ## 2. Create the controller file in `/server/services/<service name>/<ServiceName>.controller.ts`
43
-
44
- Template:
45
-
46
- ```typescript
47
- import Controller, { schema } from '@server/app/controller';
48
- import type { TMethodInput } from './index';
49
-
50
- const MethodInput = schema.object({
51
- param1: schema.string(),
52
- });
53
-
54
- export default class ServiceNameController extends Controller {
55
-
56
- public async MethodName() {
57
- const data = this.input(MethodInput);
58
- const { ServiceName } = this.services;
59
- const { auth, request, user } = this.request;
60
-
61
- return ServiceName.MethodName(data);
62
- }
63
- }
64
- ```
65
-
66
- Rules:
67
- - Only `*.controller.ts` files are indexed as callable API endpoints
68
- - Route path is derived from the controller file path and the method name
69
- - `this.input(schema)` is the only validation entrypoint
70
- - Call `this.input(...)` at most once per controller method
71
- - Request-scoped state exists only on `this.request`
72
-
73
- ## 3. Create the service metas file in `/server/services/<service name>/service.json`
74
-
75
- ```json
76
- {
77
- "id": "CrossPath/ServiceName",
78
- "name": "CrossPathServiceName",
79
- "parent": "app",
80
- "dependences": []
81
- }
82
- ```
83
-
84
- ## 4. Register the service in `/server/config/<app>.ts`
85
-
86
- ```typescript
87
- app.setup('ServiceName', 'CrossPath/ServiceName', <ServiceConfig>);
88
- ```
89
-
90
- ## 5. Keep classes clean
91
-
92
- If the class grows too large, split business concerns into subservices.
93
-
94
- ## 6. Use request-aware features only in controllers
95
-
96
- Use:
97
-
98
- ```typescript
99
- const { auth, request, user, response } = this.request;
100
- ```
101
-
102
- - Never import runtime request state from `@request`
103
- - Never access request-scoped state inside normal service methods unless the controller passes the minimal values explicitly
104
-
105
- ## 7. Fetch and return data from the database
106
-
107
- Use runtime models through `this.models`:
108
-
109
- ```typescript
110
- const users = await this.models.user.findMany({
111
- select: {
112
- id: true,
113
- },
114
- });
115
- ```
116
-
117
- Use prisma typings through `@models/types` only:
118
-
119
- ```typescript
120
- import type * as Models from '@models/types';
121
- ```
122
-
123
- Rules:
124
- - Never edit prisma files, except the schema
125
- - Never use runtime `@models` imports
126
- - In all queries and joins, always specify what fields to select
127
-
128
- ## DTO and typing rules
129
-
130
- - Prefer inferred return types:
131
- `export type TResult = Awaited<ReturnType<MyService["MethodName"]>>;`
132
- - Never create manual DTO types when the exact return type can be inferred
133
-
134
- ## Errors handling
135
-
136
- Unhandled errors are passed to the `bug` app hook.
137
- Never silent caught errors. Throw `Anomaly` with enough detail and the original error when needed.
Binary file
File without changes