guardian-framework 0.1.11 → 0.1.12
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/extensions/architect-lib/generators.ts +2 -0
- package/templates/pi/extensions/architect-lib/helpers.ts +21 -0
- package/templates/pi/extensions/architect.ts +28 -1
- package/templates/pi/preflight_report.json +2 -2
- package/templates/pi/skills/agents/go-codegen.md +42 -0
- package/templates/pi/skills/agents/java-codegen.md +42 -0
- package/templates/pi/skills/agents/python-codegen.md +41 -0
- package/templates/pi/skills/agents/typescript-codegen.md +40 -0
- package/templates/pi/skills/go-enterprise-codegen.md +450 -0
- package/templates/pi/skills/java-spring-enterprise-codegen.md +498 -0
- package/templates/pi/skills/python-enterprise-codegen.md +381 -0
- package/templates/pi/skills/typescript-enterprise-codegen.md +411 -0
package/dist/cli.js
CHANGED
|
@@ -1335,7 +1335,7 @@ __export(exports_package, {
|
|
|
1335
1335
|
bin: () => bin,
|
|
1336
1336
|
author: () => author
|
|
1337
1337
|
});
|
|
1338
|
-
var name = "guardian-framework", version = "0.1.
|
|
1338
|
+
var name = "guardian-framework", version = "0.1.12", 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;
|
|
1339
1339
|
var init_package = __esm(() => {
|
|
1340
1340
|
exports = {
|
|
1341
1341
|
".": {
|
package/dist/exports.js
CHANGED
|
@@ -995,7 +995,7 @@ __export(exports_package, {
|
|
|
995
995
|
bin: () => bin,
|
|
996
996
|
author: () => author
|
|
997
997
|
});
|
|
998
|
-
var name = "guardian-framework", version = "0.1.
|
|
998
|
+
var name = "guardian-framework", version = "0.1.12", 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;
|
|
999
999
|
var init_package = __esm(() => {
|
|
1000
1000
|
exports = {
|
|
1001
1001
|
".": {
|
package/package.json
CHANGED
|
@@ -7,6 +7,7 @@ export function generateIssueMarkdown(
|
|
|
7
7
|
slice: ArchitectureSlice,
|
|
8
8
|
issueIndex: number,
|
|
9
9
|
totalIssues: number,
|
|
10
|
+
codegenSkill?: string,
|
|
10
11
|
): string {
|
|
11
12
|
const moduleId = slice.module.replace(/^module-/, "");
|
|
12
13
|
const componentName = component.name.toLowerCase().replace(/\s+/g, "-");
|
|
@@ -64,6 +65,7 @@ ${component.dependencies.map((d) => ` - "${d}"`).join("\n")}
|
|
|
64
65
|
|
|
65
66
|
implementation_notes: |
|
|
66
67
|
${component.description || "Implement this component according to the architecture module."}
|
|
68
|
+
${codegenSkill ? `Follow: .pi/skills/agents/${codegenSkill}.md` : ""}
|
|
67
69
|
|
|
68
70
|
file_changes:
|
|
69
71
|
- "create: src/${moduleId}/${componentName}/"
|
|
@@ -221,6 +221,27 @@ export function readGroupId(cwd: string): string {
|
|
|
221
221
|
return "com.example";
|
|
222
222
|
}
|
|
223
223
|
|
|
224
|
+
export function readLanguage(cwd: string): string {
|
|
225
|
+
const manifestPath = join(cwd, "guardian-manifest.json");
|
|
226
|
+
try {
|
|
227
|
+
const raw = readFileSync(manifestPath, "utf-8");
|
|
228
|
+
const manifest = JSON.parse(raw) as { language?: string };
|
|
229
|
+
if (manifest.language) return manifest.language;
|
|
230
|
+
} catch {}
|
|
231
|
+
return "typescript";
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
export function codegenSkillName(language: string): string {
|
|
235
|
+
const map: Record<string, string> = {
|
|
236
|
+
"rust": "rust-codegen",
|
|
237
|
+
"go": "go-codegen",
|
|
238
|
+
"python": "python-codegen",
|
|
239
|
+
"typescript": "typescript-codegen",
|
|
240
|
+
"java": "java-codegen",
|
|
241
|
+
};
|
|
242
|
+
return map[language] || "typescript-codegen";
|
|
243
|
+
}
|
|
244
|
+
|
|
224
245
|
export function findModuleByName(cwd: string, name: string): string | null {
|
|
225
246
|
const files = discoverModules(cwd);
|
|
226
247
|
const nameLower = name.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
@@ -180,6 +180,29 @@ function readRepository(cwd: string): string | null {
|
|
|
180
180
|
return null;
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
+
function readLanguage(cwd: string): string {
|
|
184
|
+
const manifestPath = join(cwd, "guardian-manifest.json");
|
|
185
|
+
try {
|
|
186
|
+
if (existsSync(manifestPath)) {
|
|
187
|
+
const raw = readFileSync(manifestPath, "utf-8");
|
|
188
|
+
const manifest = JSON.parse(raw) as { language?: string };
|
|
189
|
+
if (manifest.language) return manifest.language;
|
|
190
|
+
}
|
|
191
|
+
} catch {}
|
|
192
|
+
return "typescript";
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
function codegenSkillName(language: string): string {
|
|
196
|
+
const map: Record<string, string> = {
|
|
197
|
+
rust: "rust-codegen",
|
|
198
|
+
go: "go-codegen",
|
|
199
|
+
python: "python-codegen",
|
|
200
|
+
typescript: "typescript-codegen",
|
|
201
|
+
java: "java-codegen",
|
|
202
|
+
};
|
|
203
|
+
return map[language] || "typescript-codegen";
|
|
204
|
+
}
|
|
205
|
+
|
|
183
206
|
/**
|
|
184
207
|
* Get Git platform base URL. For GitLab, tries to detect self-hosted instances.
|
|
185
208
|
*/
|
|
@@ -693,6 +716,7 @@ function generateIssueMarkdown(
|
|
|
693
716
|
slice: ArchitectureSlice,
|
|
694
717
|
issueIndex: number,
|
|
695
718
|
totalIssues: number,
|
|
719
|
+
codegenSkill?: string,
|
|
696
720
|
): string {
|
|
697
721
|
const moduleId = slice.module.replace(/^module-/, "");
|
|
698
722
|
const componentName = component.name.toLowerCase().replace(/\s+/g, "-");
|
|
@@ -750,6 +774,7 @@ ${component.dependencies.map((d) => ` - "${d}"`).join("\n")}
|
|
|
750
774
|
|
|
751
775
|
implementation_notes: |
|
|
752
776
|
${component.description || "Implement this component according to the architecture module."}
|
|
777
|
+
${codegenSkill ? `Follow: .pi/skills/agents/${codegenSkill}.md` : ""}
|
|
753
778
|
|
|
754
779
|
file_changes:
|
|
755
780
|
- "create: src/${moduleId}/${componentName}/"
|
|
@@ -1275,6 +1300,8 @@ class EpicManager {
|
|
|
1275
1300
|
name: string,
|
|
1276
1301
|
trackingIssueId?: string,
|
|
1277
1302
|
): Promise<EpicState> {
|
|
1303
|
+
const lang = readLanguage(this.cwd);
|
|
1304
|
+
const skillName = codegenSkillName(lang);
|
|
1278
1305
|
const moduleFiles = discoverModules(this.cwd);
|
|
1279
1306
|
if (moduleFiles.length === 0) {
|
|
1280
1307
|
throw new Error("No architecture modules found in .pi/architecture/modules/.");
|
|
@@ -1411,7 +1438,7 @@ class EpicManager {
|
|
|
1411
1438
|
status: "planned" as string,
|
|
1412
1439
|
remoteIssueId: null as string | null,
|
|
1413
1440
|
};
|
|
1414
|
-
const md = generateIssueMarkdown(comp, slice, i, slice.nextLogicalSlice.length);
|
|
1441
|
+
const md = generateIssueMarkdown(comp, slice, i, slice.nextLogicalSlice.length, skillName);
|
|
1415
1442
|
writeFileSync(join(issuesDir, `${id}.md`), md);
|
|
1416
1443
|
if (hasRemote && remoteRepo) {
|
|
1417
1444
|
const result = createRemoteIssue(this.cwd, entry.title, join(issuesDir, `${id}.md`), "epic,implementation", remoteRepo);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"timestamp": "2026-07-
|
|
2
|
+
"timestamp": "2026-07-03T05:15:47Z",
|
|
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",
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: go-codegen
|
|
3
|
+
description: Minimal skill for Go code generation with DDD + Clean Architecture. References full patterns on demand — never loads inline. Use when implementing Go modules following enterprise patterns.
|
|
4
|
+
model: inherit
|
|
5
|
+
tools: [Read, Grep]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Go Code Generation — DDD + Clean Architecture Patterns
|
|
9
|
+
|
|
10
|
+
> Do NOT load the full reference document. Read specific sections when needed.
|
|
11
|
+
> Full reference: `.pi/skills/go-enterprise-codegen.md`
|
|
12
|
+
|
|
13
|
+
## Quick Reference
|
|
14
|
+
|
|
15
|
+
| When you need... | Read this section |
|
|
16
|
+
|-----------------|-------------------|
|
|
17
|
+
| Module structure | Section 1 — 4-layer DDD layout + dependency direction |
|
|
18
|
+
| Domain entities | Section 2 — entity.go, value.go, repository interface |
|
|
19
|
+
| Error handling | Section 3 — *DomainError, ErrorCode, sentinel errors |
|
|
20
|
+
| Application services | Section 4 — Service interface + implementation |
|
|
21
|
+
| Repository impl | Section 5 — GORM/sql implementation pattern |
|
|
22
|
+
| HTTP handlers | Section 6 — Handler → Service → Domain flow |
|
|
23
|
+
| Configuration | Section 7 — envconfig/viper pattern |
|
|
24
|
+
| Testing | Section 8 — unit tests, repository tests |
|
|
25
|
+
| Anti-patterns | Section 9 — what NOT to do |
|
|
26
|
+
| Project structure | Section 10 — cmd/ internal/ pkg/ layout |
|
|
27
|
+
|
|
28
|
+
## DDD Layer Contract
|
|
29
|
+
|
|
30
|
+
| Layer | Purpose | Dependencies |
|
|
31
|
+
|-------|---------|-------------|
|
|
32
|
+
| `domain/` | Pure business logic | None (stdlib only) |
|
|
33
|
+
| `application/` | Use case orchestration | `domain/` |
|
|
34
|
+
| `infrastructure/` | External adapters | `domain/` + `application/` |
|
|
35
|
+
| `interfaces/` | API contracts | `application/` |
|
|
36
|
+
|
|
37
|
+
## Rules
|
|
38
|
+
- NEVER read full reference — read specific sections
|
|
39
|
+
- Use `grep` + `Read offset/limit` to target sections
|
|
40
|
+
- Follow the DDD layer structure — no `contracts/` wrapper
|
|
41
|
+
- Always define repository interfaces in `domain/`, implement in `infrastructure/`
|
|
42
|
+
- Always use typed `*DomainError`, never bare strings
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: java-codegen
|
|
3
|
+
description: Minimal skill for Java/Spring Boot code generation with DDD + Clean Architecture. References full patterns on demand — never loads inline. Use when implementing Java modules following enterprise patterns.
|
|
4
|
+
model: inherit
|
|
5
|
+
tools: [Read, Grep]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Java/Spring Boot Code Generation — DDD + Clean Architecture Patterns
|
|
9
|
+
|
|
10
|
+
> Do NOT load the full reference document. Read specific sections when needed.
|
|
11
|
+
> Full reference: `.pi/skills/java-spring-enterprise-codegen.md`
|
|
12
|
+
|
|
13
|
+
## Quick Reference
|
|
14
|
+
|
|
15
|
+
| When you need... | Read this section |
|
|
16
|
+
|-----------------|-------------------|
|
|
17
|
+
| Module structure | Section 1 — 4-layer DDD layout + dependency direction |
|
|
18
|
+
| Domain entities | Section 2 — Entity.java, Value Object record, Repository interface |
|
|
19
|
+
| Error handling | Section 3 — DomainError, ErrorCode enum |
|
|
20
|
+
| Application services | Section 4 — @Service, interface + impl pattern |
|
|
21
|
+
| Repository impl | Section 5 — JPA EntityManager repository |
|
|
22
|
+
| REST controllers | Section 6 — @RestController, @ExceptionHandler |
|
|
23
|
+
| Testing | Section 7 — MockMvc, @SpringBootTest |
|
|
24
|
+
| Anti-patterns | Section 8 — what NOT to do |
|
|
25
|
+
| Project structure | Section 9 — Maven/Gradle module layout |
|
|
26
|
+
|
|
27
|
+
## DDD Layer Contract
|
|
28
|
+
|
|
29
|
+
| Layer | Purpose | Dependencies |
|
|
30
|
+
|-------|---------|-------------|
|
|
31
|
+
| `domain/` | Pure business logic | None (pure Java, no Spring) |
|
|
32
|
+
| `application/` | Use case orchestration | `domain/` |
|
|
33
|
+
| `infrastructure/` | External adapters | `domain/` + `application/` |
|
|
34
|
+
| `interfaces/` | API contracts | `application/` |
|
|
35
|
+
|
|
36
|
+
## Rules
|
|
37
|
+
- NEVER read full reference — read specific sections
|
|
38
|
+
- Use `grep` + `Read offset/limit` to target sections
|
|
39
|
+
- Follow the DDD layer structure — no `contracts/` wrapper
|
|
40
|
+
- Domain layer has ZERO Spring annotations
|
|
41
|
+
- Use constructor injection, NEVER field injection
|
|
42
|
+
- Use `record` for value objects (Java 16+)
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: python-codegen
|
|
3
|
+
description: Minimal skill for Python code generation with DDD + Clean Architecture. References full patterns on demand — never loads inline. Use when implementing Python modules following enterprise patterns.
|
|
4
|
+
model: inherit
|
|
5
|
+
tools: [Read, Grep]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Python Code Generation — DDD + Clean Architecture Patterns
|
|
9
|
+
|
|
10
|
+
> Do NOT load the full reference document. Read specific sections when needed.
|
|
11
|
+
> Full reference: `.pi/skills/python-enterprise-codegen.md`
|
|
12
|
+
|
|
13
|
+
## Quick Reference
|
|
14
|
+
|
|
15
|
+
| When you need... | Read this section |
|
|
16
|
+
|-----------------|-------------------|
|
|
17
|
+
| Module structure | Section 1 — 4-layer DDD layout + dependency direction |
|
|
18
|
+
| Domain entities | Section 2 — entity.py, value.py, repository ABC |
|
|
19
|
+
| Error handling | Section 3 — DomainError, ErrorCode enum |
|
|
20
|
+
| Application services | Section 4 — Service class |
|
|
21
|
+
| Repository impl | Section 5 — SQLAlchemy implementation pattern |
|
|
22
|
+
| API controllers | Section 6 — FastAPI route handlers, error mapping |
|
|
23
|
+
| Testing | Section 7 — pytest unit tests |
|
|
24
|
+
| Anti-patterns | Section 8 — what NOT to do |
|
|
25
|
+
| Project structure | Section 9 — src/ module layout |
|
|
26
|
+
|
|
27
|
+
## DDD Layer Contract
|
|
28
|
+
|
|
29
|
+
| Layer | Purpose | Dependencies |
|
|
30
|
+
|-------|---------|-------------|
|
|
31
|
+
| `domain/` | Pure business logic | None (stdlib only) |
|
|
32
|
+
| `application/` | Use case orchestration | `domain/` |
|
|
33
|
+
| `infrastructure/` | External adapters | `domain/` + `application/` |
|
|
34
|
+
| `interfaces/` | API contracts | `application/` |
|
|
35
|
+
|
|
36
|
+
## Rules
|
|
37
|
+
- NEVER read full reference — read specific sections
|
|
38
|
+
- Use `grep` + `Read offset/limit` to target sections
|
|
39
|
+
- Follow the DDD layer structure — no `contracts/` wrapper
|
|
40
|
+
- Use `@dataclass(frozen=True)` for value objects
|
|
41
|
+
- Use `ABC` for repository interfaces
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: typescript-codegen
|
|
3
|
+
description: Minimal skill for TypeScript/Node.js code generation with DDD + Clean Architecture. References full patterns on demand — never loads inline. Use when implementing TypeScript modules following enterprise patterns.
|
|
4
|
+
model: inherit
|
|
5
|
+
tools: [Read, Grep]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# TypeScript Code Generation — DDD + Clean Architecture Patterns
|
|
9
|
+
|
|
10
|
+
> Do NOT load the full reference document. Read specific sections when needed.
|
|
11
|
+
> Full reference: `.pi/skills/typescript-enterprise-codegen.md`
|
|
12
|
+
|
|
13
|
+
## Quick Reference
|
|
14
|
+
|
|
15
|
+
| When you need... | Read this section |
|
|
16
|
+
|-----------------|-------------------|
|
|
17
|
+
| Module structure | Section 1 — 4-layer DDD layout + dependency direction |
|
|
18
|
+
| Domain entities | Section 2 — entity.ts, value.ts, repository interface |
|
|
19
|
+
| Error handling | Section 3 — ErrorCode enum, DomainError class |
|
|
20
|
+
| Application services | Section 4 — Service interface + implementation |
|
|
21
|
+
| Repository impl | Section 5 — TypeORM implementation pattern |
|
|
22
|
+
| HTTP controllers | Section 6 — Express/Fastify router, error mapping |
|
|
23
|
+
| Testing | Section 7 — unit tests, integration tests |
|
|
24
|
+
| Anti-patterns | Section 8 — what NOT to do |
|
|
25
|
+
| Project structure | Section 9 — src/ module layout |
|
|
26
|
+
|
|
27
|
+
## DDD Layer Contract
|
|
28
|
+
|
|
29
|
+
| Layer | Purpose | Dependencies |
|
|
30
|
+
|-------|---------|-------------|
|
|
31
|
+
| `domain/` | Pure business logic | None (TS stdlib only) |
|
|
32
|
+
| `application/` | Use case orchestration | `domain/` |
|
|
33
|
+
| `infrastructure/` | External adapters | `domain/` + `application/` |
|
|
34
|
+
| `interfaces/` | API contracts | `application/` |
|
|
35
|
+
|
|
36
|
+
## Rules
|
|
37
|
+
- NEVER read full reference — read specific sections
|
|
38
|
+
- Use `grep` + `Read offset/limit` to target sections
|
|
39
|
+
- Follow the DDD layer structure — no `contracts/` wrapper
|
|
40
|
+
- Use readonly/mapped types for value objects (Omit, Partial, Readonly)
|