@loj-lang/cli 0.5.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 (36) hide show
  1. package/README.md +87 -0
  2. package/agent-assets/loj-authoring/SKILL.md +179 -0
  3. package/agent-assets/loj-authoring/agents/openai.yaml +3 -0
  4. package/agent-assets/loj-authoring/metadata.json +6 -0
  5. package/agent-assets/loj-authoring/references/backend-family.md +340 -0
  6. package/agent-assets/loj-authoring/references/backend-targets.md +171 -0
  7. package/agent-assets/loj-authoring/references/frontend-family.md +794 -0
  8. package/agent-assets/loj-authoring/references/frontend-runtime-trace.md +204 -0
  9. package/agent-assets/loj-authoring/references/policy-rules-proof.md +178 -0
  10. package/agent-assets/loj-authoring/references/project-and-transport.md +454 -0
  11. package/agent-assets/loj-authoring/references/workflow-flow-proof.md +263 -0
  12. package/dist/database-native-sql.d.ts +4 -0
  13. package/dist/database-native-sql.d.ts.map +1 -0
  14. package/dist/database-native-sql.js +266 -0
  15. package/dist/database-native-sql.js.map +1 -0
  16. package/dist/env.d.ts +31 -0
  17. package/dist/env.d.ts.map +1 -0
  18. package/dist/env.js +229 -0
  19. package/dist/env.js.map +1 -0
  20. package/dist/fastapi-dev-runner.d.ts +3 -0
  21. package/dist/fastapi-dev-runner.d.ts.map +1 -0
  22. package/dist/fastapi-dev-runner.js +263 -0
  23. package/dist/fastapi-dev-runner.js.map +1 -0
  24. package/dist/flow-proof.d.ts +3 -0
  25. package/dist/flow-proof.d.ts.map +1 -0
  26. package/dist/flow-proof.js +2 -0
  27. package/dist/flow-proof.js.map +1 -0
  28. package/dist/index.d.ts +36 -0
  29. package/dist/index.d.ts.map +1 -0
  30. package/dist/index.js +5353 -0
  31. package/dist/index.js.map +1 -0
  32. package/dist/rules-proof.d.ts +3 -0
  33. package/dist/rules-proof.d.ts.map +1 -0
  34. package/dist/rules-proof.js +2 -0
  35. package/dist/rules-proof.js.map +1 -0
  36. package/package.json +49 -0
@@ -0,0 +1,171 @@
1
+ # Backend Targets: Spring Boot And FastAPI
2
+
3
+ Use this reference when the task depends on the selected backend target rather than the shared
4
+ `.api.loj` syntax.
5
+
6
+ ## Implemented Triples
7
+
8
+ ### Spring
9
+
10
+ ```yaml
11
+ compiler:
12
+ target: spring-boot
13
+ language: java
14
+ profile: mvc-jpa-security
15
+ ```
16
+
17
+ ### FastAPI
18
+
19
+ ```yaml
20
+ compiler:
21
+ target: fastapi
22
+ language: python
23
+ profile: rest-sqlalchemy-auth
24
+ ```
25
+
26
+ No other backend-family target triple is implemented today.
27
+
28
+ ## Shared Rule
29
+
30
+ Both targets reuse the same backend-family source primitives:
31
+
32
+ - `app`
33
+ - `compiler`
34
+ - `imports`
35
+ - `model`
36
+ - `resource`
37
+ - `readModel`
38
+ - linked `.rules.loj`
39
+ - linked `.flow.loj`
40
+
41
+ Do not fork source syntax just because the target changes.
42
+
43
+ ## Spring Boot Target
44
+
45
+ Current stack:
46
+
47
+ - Spring Boot
48
+ - Java
49
+ - Spring MVC
50
+ - Spring Data JPA
51
+ - Spring Security
52
+ - Maven
53
+
54
+ Generated output typically includes:
55
+
56
+ - `src/main/java/.../Application.java`
57
+ - `controller/`
58
+ - `service/`
59
+ - `repository/`
60
+ - `domain/`
61
+ - `dto/`
62
+ - generated runtime helpers/config
63
+ - `src/test/java/...`
64
+ - `pom.xml`
65
+ - `application.properties`
66
+
67
+ Current target behavior:
68
+
69
+ - local default database profile is still H2 unless project-shell `database:` overrides it
70
+ - generated mutation paths are transactional by default with `@Transactional`
71
+ - linked `@sql("./queries/x")` read-model handlers generate a `NamedParameterJdbcTemplate` adapter
72
+ - project-shell `runtime` may rewrite graceful shutdown, probe endpoints, CORS, forwarded headers,
73
+ trusted-proxy behavior, request-size limits, and backend `basePath`
74
+
75
+ ## FastAPI Target
76
+
77
+ Current stack:
78
+
79
+ - FastAPI
80
+ - Python
81
+ - SQLAlchemy `Session`
82
+ - pytest
83
+
84
+ Generated output typically includes:
85
+
86
+ - `app/main.py`
87
+ - `app/config.py`
88
+ - `app/db.py`
89
+ - `app/security.py`
90
+ - `app/models/*.py`
91
+ - `app/schemas/*.py`
92
+ - `app/routes/*.py`
93
+ - `app/services/*.py`
94
+ - generated runtime middleware/helpers
95
+ - `tests/test_*_api.py`
96
+ - `pyproject.toml`
97
+
98
+ Current target behavior:
99
+
100
+ - local default database profile is still SQLite unless project-shell `database:` overrides it
101
+ - generated mutation paths are transactional by default through explicit `Session` commit/rollback
102
+ boundaries
103
+ - linked `@sql("./queries/x")` read-model handlers generate a `sqlalchemy.text(...)` adapter
104
+ - project-shell `runtime` may rewrite lifespan/debug runner/proxy-header/request-size behavior and
105
+ backend `root_path`
106
+
107
+ ## Database Rule
108
+
109
+ Database choice is not a core `.api.loj` primitive.
110
+
111
+ It currently belongs to:
112
+
113
+ - target/profile defaults
114
+ - or project-shell `targets.<alias>.database`
115
+
116
+ Do not add database vendors to `.api.loj` source.
117
+
118
+ ## Auth Rule
119
+
120
+ Auth in source DSL stays narrow:
121
+
122
+ ```yaml
123
+ auth:
124
+ mode: authenticated
125
+ roles: [ADMIN]
126
+ ```
127
+
128
+ Target implementation differences stay target-side:
129
+
130
+ - Spring -> Spring Security configuration and principal adapters
131
+ - FastAPI -> dependency-based auth wiring and current-user injection
132
+
133
+ Do not leak framework-specific auth details into source DSL.
134
+
135
+ ## Transport Alignment
136
+
137
+ Both targets align to the same neutral transport baseline:
138
+
139
+ - list: raw array or `{ items: [...] }` or `{ data: [...] }`
140
+ - item: raw object or `{ item: {...} }` or `{ data: {...} }`
141
+ - error: JSON object with string `message`
142
+ - returned records include `id`
143
+ - server pagination metadata is still optional
144
+
145
+ ## Escape-Hatch Direction
146
+
147
+ Current backend-family escapes are broader than the old auth-only slice.
148
+
149
+ Supported today:
150
+
151
+ - `resource auth.policy: '@fn("./policies/x")'`
152
+ - `resource auth.policy: '@rules("./policies/x")'`
153
+ - `resource create.rules: '@rules("./rules/x")'`
154
+ - `readModel rules: '@rules("./rules/x")'`
155
+ - `resource workflow: '@flow("./workflows/x")'`
156
+ - `readModel handler: '@fn("./handlers/x")'`
157
+ - `readModel handler: '@sql("./queries/x")'`
158
+
159
+ Rules:
160
+
161
+ - prefer extensionless logical ids first
162
+ - Spring resolves logical ids to `.java`
163
+ - FastAPI resolves logical ids to `.py`
164
+ - `.sql` stays explicit and file-backed
165
+ - explicit suffixes are deliberate target lock-in, not the default style
166
+
167
+ ## Target Guardrails
168
+
169
+ - Do not invent Spring/FastAPI-specific DSL keys.
170
+ - Do not move transactions, database vendors, proxy behavior, or graceful shutdown into `.api.loj`.
171
+ - Keep target/runtime/deploy intent in `loj.project.yaml`.