guardian-framework 0.1.81 → 0.1.83
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.js +1 -1
- package/dist/exports.js +1 -1
- package/package.json +1 -1
- package/templates/pi/architecture/modules/module-template.md +19 -0
- package/templates/pi/context/patterns.md +13 -8
- package/templates/pi/preflight_report.json +3 -3
- package/templates/pi/skills/java-spring-enterprise-codegen.md +28 -11
package/dist/cli.js
CHANGED
|
@@ -3197,7 +3197,7 @@ __export(exports_package, {
|
|
|
3197
3197
|
bin: () => bin,
|
|
3198
3198
|
author: () => author
|
|
3199
3199
|
});
|
|
3200
|
-
var name = "guardian-framework", version = "0.1.
|
|
3200
|
+
var name = "guardian-framework", version = "0.1.83", description = "Token-optimized agentic framework scaffolder with pi-first architecture", type = "module", main = "dist/exports.js", exports, types = "dist/exports.d.ts", bin, files, engines, scripts, publishConfig, pi, repository, homepage = "https://github.com/arman-jalili/guardian-framework#readme", bugs, dependencies, devDependencies, keywords, author = "Arman Wolkensteiner-Jalili", license = "MIT", package_default;
|
|
3201
3201
|
var init_package = __esm(() => {
|
|
3202
3202
|
exports = {
|
|
3203
3203
|
".": {
|
package/dist/exports.js
CHANGED
|
@@ -1982,7 +1982,7 @@ __export(exports_package, {
|
|
|
1982
1982
|
bin: () => bin,
|
|
1983
1983
|
author: () => author
|
|
1984
1984
|
});
|
|
1985
|
-
var name = "guardian-framework", version = "0.1.
|
|
1985
|
+
var name = "guardian-framework", version = "0.1.83", description = "Token-optimized agentic framework scaffolder with pi-first architecture", type = "module", main = "dist/exports.js", exports, types = "dist/exports.d.ts", bin, files, engines, scripts, publishConfig, pi, repository, homepage = "https://github.com/arman-jalili/guardian-framework#readme", bugs, dependencies, devDependencies, keywords, author = "Arman Wolkensteiner-Jalili", license = "MIT", package_default;
|
|
1986
1986
|
var init_package = __esm(() => {
|
|
1987
1987
|
exports = {
|
|
1988
1988
|
".": {
|
package/package.json
CHANGED
|
@@ -170,6 +170,8 @@ before the implementation issue can be closed. These ACs flow into the generated
|
|
|
170
170
|
## Error Handling
|
|
171
171
|
|
|
172
172
|
**Domain errors (domain/):**
|
|
173
|
+
|
|
174
|
+
TypeScript:
|
|
173
175
|
```typescript
|
|
174
176
|
class [ErrorType] extends Error {
|
|
175
177
|
constructor(code: string, message: string, retriable?: boolean) {
|
|
@@ -179,6 +181,23 @@ class [ErrorType] extends Error {
|
|
|
179
181
|
}
|
|
180
182
|
```
|
|
181
183
|
|
|
184
|
+
Java:
|
|
185
|
+
```java
|
|
186
|
+
// domain/error/DomainException.java — abstract base
|
|
187
|
+
public abstract class DomainException extends RuntimeException {
|
|
188
|
+
private final ErrorCode code;
|
|
189
|
+
protected DomainException(ErrorCode code, String message) {
|
|
190
|
+
super(message); this.code = code;
|
|
191
|
+
}
|
|
192
|
+
public ErrorCode getCode() { return code; }
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// domain/error/DomainError.java — concrete error
|
|
196
|
+
public class DomainError extends DomainException {
|
|
197
|
+
public DomainError(ErrorCode code, String message) { super(code, message); }
|
|
198
|
+
}
|
|
199
|
+
```
|
|
200
|
+
|
|
182
201
|
**Recovery:**
|
|
183
202
|
- [Error 1]: [Recovery strategy]
|
|
184
203
|
- [Error 2]: [Recovery strategy]
|
|
@@ -5,27 +5,32 @@
|
|
|
5
5
|
|
|
6
6
|
## Error Handling
|
|
7
7
|
|
|
8
|
-
{{
|
|
8
|
+
**Pattern:** {{ERROR_HANDLING_PATTERN}}
|
|
9
9
|
|
|
10
|
-
**Rule:**
|
|
10
|
+
**Rule:**
|
|
11
|
+
- **Java:** Domain errors extend `DomainException` (abstract base in `domain/error/`), never `RuntimeException` directly. Use `ErrorCode` enum for machine-readable types. Catch at controller advice layer.
|
|
12
|
+
- **TypeScript:** Use Result type pattern (`ok()`/`err()`) for recoverable errors. Throw typed `extends Error` classes for unrecoverable.
|
|
13
|
+
- **Rust:** Use `Result<T, E>` with custom error enums implementing `std::error::Error`.
|
|
14
|
+
- **Python:** Use custom exception classes inheriting from `Exception`.
|
|
15
|
+
- **Go:** Use sentinel errors with `errors.Is/As`.
|
|
11
16
|
|
|
12
17
|
## Tracing
|
|
13
18
|
|
|
14
|
-
{{
|
|
19
|
+
**Pattern:** {{TRACING_PATTERN}}
|
|
15
20
|
|
|
16
|
-
**Rule:**
|
|
21
|
+
**Rule:** Every handler must propagate trace context. Use correlation IDs across service boundaries.
|
|
17
22
|
|
|
18
23
|
## Cancellation
|
|
19
24
|
|
|
20
|
-
{{
|
|
25
|
+
**Pattern:** {{CANCELLATION_PATTERN}}
|
|
21
26
|
|
|
22
|
-
**Rule:**
|
|
27
|
+
**Rule:** Every async operation must respect cancellation signals. Clean up resources on cancellation.
|
|
23
28
|
|
|
24
29
|
## Atomic Writes
|
|
25
30
|
|
|
26
|
-
{{
|
|
31
|
+
**Pattern:** {{ATOMIC_WRITE_PATTERN}}
|
|
27
32
|
|
|
28
|
-
**Rule:**
|
|
33
|
+
**Rule:** Never write files in place. Use write-rename pattern (`.tmp` then rename) or transactional storage.
|
|
29
34
|
|
|
30
35
|
## Retry Logic
|
|
31
36
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"timestamp": "2026-07-16T13:
|
|
2
|
+
"timestamp": "2026-07-16T13:07:30Z",
|
|
3
3
|
"mode": "all",
|
|
4
4
|
"stages_run": [],
|
|
5
5
|
"summary": {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"failed": 1,
|
|
9
9
|
"skipped": 12
|
|
10
10
|
},
|
|
11
|
-
"duration_seconds":
|
|
11
|
+
"duration_seconds": 0,
|
|
12
12
|
"results": [
|
|
13
13
|
{
|
|
14
14
|
"name": "check_mr_traceability.sh",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"name": "cargo test --lib",
|
|
57
57
|
"status": "fail",
|
|
58
58
|
"message": "unit test failures",
|
|
59
|
-
"duration":
|
|
59
|
+
"duration": 0
|
|
60
60
|
},
|
|
61
61
|
{
|
|
62
62
|
"name": "integration",
|
|
@@ -29,7 +29,9 @@ module/
|
|
|
29
29
|
│ ├── repository/ # Repository interfaces
|
|
30
30
|
│ │ └── EntityRepository.java
|
|
31
31
|
│ └── error/ # Typed exception classes
|
|
32
|
-
│
|
|
32
|
+
│ ├── DomainException.java # Abstract base for all domain errors
|
|
33
|
+
│ ├── DomainError.java # Concrete domain error
|
|
34
|
+
│ └── ErrorCode.java # Machine-readable error codes
|
|
33
35
|
├── application/ # Service interfaces and DTOs
|
|
34
36
|
│ ├── service/ # Service interfaces
|
|
35
37
|
│ │ └── EntityService.java
|
|
@@ -177,25 +179,39 @@ public enum Status {
|
|
|
177
179
|
## 3. Domain Error Handling
|
|
178
180
|
|
|
179
181
|
```java
|
|
180
|
-
// domain/error/
|
|
182
|
+
// domain/error/DomainException.java
|
|
181
183
|
|
|
182
184
|
package com.project.module.domain.error;
|
|
183
185
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
+
/**
|
|
187
|
+
* Base exception for all domain errors.
|
|
188
|
+
* Extending this (rather than RuntimeException directly) allows
|
|
189
|
+
* catching all domain-level errors in a single handler.
|
|
190
|
+
*/
|
|
191
|
+
public abstract class DomainException extends RuntimeException {
|
|
186
192
|
private final ErrorCode code;
|
|
187
193
|
|
|
188
|
-
|
|
189
|
-
super(message);
|
|
190
|
-
this.code = ErrorCode.VALIDATION;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
public DomainError(ErrorCode code, String message) {
|
|
194
|
+
protected DomainException(ErrorCode code, String message) {
|
|
194
195
|
super(message);
|
|
195
196
|
this.code = code;
|
|
196
197
|
}
|
|
197
198
|
|
|
198
199
|
public ErrorCode getCode() { return code; }
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// domain/error/DomainError.java
|
|
203
|
+
|
|
204
|
+
package com.project.module.domain.error;
|
|
205
|
+
|
|
206
|
+
public class DomainError extends DomainException {
|
|
207
|
+
|
|
208
|
+
public DomainError(String message) {
|
|
209
|
+
super(ErrorCode.VALIDATION, message);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
public DomainError(ErrorCode code, String message) {
|
|
213
|
+
super(code, message);
|
|
214
|
+
}
|
|
199
215
|
|
|
200
216
|
public static DomainError notFound(String id) {
|
|
201
217
|
return new DomainError(ErrorCode.NOT_FOUND, "Resource " + id + " not found");
|
|
@@ -221,7 +237,8 @@ public enum ErrorCode {
|
|
|
221
237
|
```
|
|
222
238
|
|
|
223
239
|
### Rules
|
|
224
|
-
- ✅ Use `
|
|
240
|
+
- ✅ Use `DomainException` subclasses for domain errors (never `RuntimeException` directly)
|
|
241
|
+
- ✅ Define `DomainException` as an abstract base in `domain/error/`
|
|
225
242
|
- ✅ Use `ErrorCode` enum for machine-readable error types
|
|
226
243
|
- ✅ Use `record` for value objects (Java 16+)
|
|
227
244
|
- ❌ Don't use Spring annotations in domain layer
|