guardian-framework 0.1.10 → 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 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.10", 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;
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.10", 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;
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "guardian-framework",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "description": "Token-optimized agentic framework scaffolder with pi-first architecture",
5
5
  "type": "module",
6
6
  "main": "dist/exports.js",
@@ -85,6 +85,7 @@ DO NOT EDIT DIRECTLY - Modify source in .pi/
85
85
  │ └── output-formats.md # Report templates
86
86
 
87
87
  ├── skills/
88
+ │ ├── rust-enterprise-codegen.md
88
89
  │ ├── agents/
89
90
  │ │ ├── architecture-coordinator.md
90
91
  │ │ ├── architecture-validator.md
@@ -415,6 +416,7 @@ When running `guardian-framework generate`, `.pi/` files are transformed:
415
416
  | `AGENTS.md` | `.github/copilot-instructions.md` | YAML frontmatter + canonical header |
416
417
  | `architecture/modules/*.md` | `.claude/architecture/*.md` | Direct copy + canonical header |
417
418
  | `architecture/CHANGELOG.md` | `.claude/architecture/CHANGELOG.md` | Direct copy |
419
+ | `skills/rust-enterprise-codegen.md` | `.pi/skills/rust-enterprise-codegen.md` | Direct copy — full reference patterns |
418
420
  | `skills/agents/*.md` | `.claude/agents/*.md`, `.github/agents/*.agent.md` | Direct copy + YAML frontmatter |
419
421
  | `skills/validators/*.md` | `.opencode/prompts/*.txt` | Convert to .txt, compress |
420
422
  | `context/*.md` | `.claude/context/*.md`, `.opencode/context/*.md` | Direct copy + canonical header |
@@ -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-03T04:04:20Z",
2
+ "timestamp": "2026-07-03T05:15:47Z",
3
3
  "mode": "all",
4
4
  "stages_run": [],
5
5
  "summary": {
@@ -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,70 @@
1
+ ---
2
+ name: rust-codegen
3
+ description: Minimal skill for Rust code generation with DDD + Clean Architecture. References full patterns on demand — never loads inline. Use when implementing Rust modules following enterprise patterns.
4
+ model: inherit
5
+ tools: [Read, Grep]
6
+ ---
7
+
8
+ # Rust Code Generation — DDD + Clean Architecture Patterns
9
+
10
+ > Do NOT load the full reference document. Read specific sections below when needed.
11
+ > Full reference: `.pi/skills/rust-enterprise-codegen.md`
12
+
13
+ ## Quick Reference
14
+
15
+ When implementing, read ONLY the section you need:
16
+
17
+ | When you need... | Read this section from the reference |
18
+ |-----------------|--------------------------------------|
19
+ | Module structure | Section 1 — Clean Architecture 4-layer layout + header template + dependency direction |
20
+ | Aggregate root | Section 2 — DDD aggregate root with command methods, entity encapsulation |
21
+ | Value objects | Section 2 — Immutable value objects with self-validation |
22
+ | Repository pattern | Section 2 — Interface + implementation separation, collection semantics |
23
+ | Domain events | Section 2 (tactical) + Section 8 — Tagged union, serde, correlation IDs |
24
+ | Error types | Section 3 — thiserror enums, root error aggregation, is_retriable(), #[source] |
25
+ | Secret handling | Section 4 — Secret value object with redacted Display |
26
+ | State machines | Section 5 — Typed enum with is_terminal(), transition methods, tracking entity |
27
+ | RAII guards | Section 6 — Budget reservation with Drop auto-release |
28
+ | Async patterns | Section 7 — JoinSet, CancellationToken, select!, bounded channels |
29
+ | Configuration | Section 9 — Multi-source merging (flags > env > file > defaults) |
30
+ | Atomic file ops | Section 10 — write-tmp → fsync → rename pattern |
31
+ | Complex builders | Section 11 — Builder pattern + named constructors |
32
+ | Retry/backoff | Section 12 — BackoffStrategy enum |
33
+ | EventBus | Section 13 — broadcast channel, in-memory log, drain() |
34
+ | Tests | Section 14 — AAA pattern, serde round-trip, proptest, concurrency |
35
+ | Documentation | Section 15 — Module header template, @canonical refs, public API docs |
36
+ | Anti-patterns | Section 16 — what NOT to do (anyhow, unwrap, sync Mutex across await, etc.) |
37
+ | Dependencies | Section 17 — Cargo.toml conventions |
38
+
39
+ ## Command
40
+
41
+ ```
42
+ # Read the section you need (use the Read tool with limit parameter):
43
+ Read file_path=".pi/skills/rust-enterprise-codegen.md" limit=60
44
+ # Or grep for a specific section header:
45
+ Grep pattern="## 7\. Async" path=".pi/skills/rust-enterprise-codegen.md"
46
+ # Then Read with offset/limit targeting the lines you need
47
+ ```
48
+
49
+ ## DDD Layer Contract
50
+
51
+ Each module follows this strict 4-layer structure:
52
+
53
+ | Layer | Purpose | Dependencies | Contains |
54
+ |-------|---------|-------------|----------|
55
+ | `domain/` | Pure business logic | None (serde, chrono, uuid only) | Entities, value objects, aggregates, domain events, repository traits |
56
+ | `application/` | Use case orchestration | `domain/` | Service traits, DTOs, factory interfaces |
57
+ | `infrastructure/` | External adapters | `application/` + `domain/` | Repository implementations, DB clients, HTTP clients |
58
+ | `interfaces/` | API contracts | `application/` | HTTP routes, request/response DTOs, event consumers |
59
+
60
+ **Dependency Rule:** Inner layers never depend on outer layers. `domain/` depends on nothing. `application/` depends on `domain/`. `infrastructure/` depends on `application/`. `interfaces/` depends on `application/`.
61
+
62
+ ## Rules
63
+
64
+ - NEVER read the full reference document into context — read specific sections
65
+ - Target reads with `grep` + line numbers instead
66
+ - Each agent loads only the patterns it needs for its current task
67
+ - ALWAYS follow the 4-layer DDD structure — no `contracts/` wrapper
68
+ - ALWAYS define repository traits in `domain/`, implement in `infrastructure/`
69
+ - ALWAYS use typed error enums (thiserror), never String errors
70
+ - ALWAYS encapsulate aggregate state behind methods
@@ -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)