guardian-framework 0.1.104 → 0.1.105
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 +5 -5
- package/templates/pi/extensions/architect-lib/tdd-generator.ts +1 -1
- package/templates/pi/extensions/architect.ts +5 -1
- package/templates/pi/preflight_report.json +1 -1
- package/templates/pi/skills/tdd-practice.md +17 -9
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.105", 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.105", 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
|
@@ -122,10 +122,10 @@ function buildInScope(comp: ModuleComponent, primaryAcRows: AcRow[], implSteps:
|
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
/** Supported project languages. */
|
|
125
|
-
type ProjectLanguage = "typescript" | "java" | "python" | "go" | "rust";
|
|
125
|
+
export type ProjectLanguage = "typescript" | "java" | "python" | "go" | "rust";
|
|
126
126
|
|
|
127
127
|
/** Detect project language at `cwd` by checking for build files. */
|
|
128
|
-
function detectLanguage(cwd?: string): ProjectLanguage {
|
|
128
|
+
export function detectLanguage(cwd?: string): ProjectLanguage {
|
|
129
129
|
if (!cwd) return "typescript";
|
|
130
130
|
try {
|
|
131
131
|
if (existsSync(join(cwd, "pom.xml")) || existsSync(join(cwd, "build.gradle")) || existsSync(join(cwd, "build.gradle.kts")))
|
|
@@ -143,7 +143,7 @@ function detectLanguage(cwd?: string): ProjectLanguage {
|
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
/** Language-specific file extension for implementation files. */
|
|
146
|
-
function implExtension(lang: ProjectLanguage): string {
|
|
146
|
+
export function implExtension(lang: ProjectLanguage): string {
|
|
147
147
|
switch (lang) {
|
|
148
148
|
case "java": return "java";
|
|
149
149
|
case "python": return "py";
|
|
@@ -154,7 +154,7 @@ function implExtension(lang: ProjectLanguage): string {
|
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
/** Language-specific test directory base. */
|
|
157
|
-
function testBaseDirFromLang(lang: ProjectLanguage): string {
|
|
157
|
+
export function testBaseDirFromLang(lang: ProjectLanguage): string {
|
|
158
158
|
switch (lang) {
|
|
159
159
|
case "java": return "src/test/java";
|
|
160
160
|
case "python": return "tests";
|
|
@@ -165,7 +165,7 @@ function testBaseDirFromLang(lang: ProjectLanguage): string {
|
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
/** Language-specific test runner command hint. */
|
|
168
|
-
function testRunnerHintFromLang(lang: ProjectLanguage): string {
|
|
168
|
+
export function testRunnerHintFromLang(lang: ProjectLanguage): string {
|
|
169
169
|
switch (lang) {
|
|
170
170
|
case "java": return "mvn test";
|
|
171
171
|
case "python": return "pytest";
|
|
@@ -81,7 +81,7 @@ export interface TddGenerateOptions {
|
|
|
81
81
|
cwd: string;
|
|
82
82
|
/** Language from manifest (default: "typescript") */
|
|
83
83
|
language: string;
|
|
84
|
-
/** Base test directory (
|
|
84
|
+
/** Base test directory (auto-detected from project language if not set) */
|
|
85
85
|
testBaseDir?: string;
|
|
86
86
|
/** Module name for path construction */
|
|
87
87
|
moduleName?: string;
|
|
@@ -34,6 +34,10 @@ import {
|
|
|
34
34
|
generateContractFreezeMarkdown,
|
|
35
35
|
generateIssueMarkdown,
|
|
36
36
|
generateProofingMarkdown,
|
|
37
|
+
detectLanguage,
|
|
38
|
+
testBaseDirFromLang,
|
|
39
|
+
testRunnerHintFromLang,
|
|
40
|
+
implExtension,
|
|
37
41
|
} from "./architect-lib/generators";
|
|
38
42
|
import {
|
|
39
43
|
generateEpicTestFiles,
|
|
@@ -870,7 +874,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
870
874
|
"",
|
|
871
875
|
"**TDD Mode: ON**",
|
|
872
876
|
"- Failing test files were generated from architecture contracts before issues were created.",
|
|
873
|
-
"- Start each component by examining its test file in the `
|
|
877
|
+
"- Start each component by examining its test file in the `" + testBaseDirFromLang(detectLanguage(ctx.cwd)) + "/` directory.",
|
|
874
878
|
"- Run tests first to see them fail, then implement to make them pass (Red→Green→Refactor).",
|
|
875
879
|
"- Tests are living artifacts — evolve them as the component grows.",
|
|
876
880
|
"- Reference `.pi/skills/tdd-practice.md` for TDD guidance.",
|
|
@@ -6,7 +6,9 @@ description: TDD practice guide for Guardian implementation agents. Use when TDD
|
|
|
6
6
|
# TDD Practice — Red → Green → Refactor
|
|
7
7
|
|
|
8
8
|
> This skill applies when TDD mode is enabled on the current epic (`--tdd`).
|
|
9
|
-
> Pre-generated failing test files exist in
|
|
9
|
+
> Pre-generated failing test files exist in the project's test directory
|
|
10
|
+
> (language-specific: `tests/unit/` for TypeScript, `src/test/java/` for Java,
|
|
11
|
+
> `tests/` for Python/Go/Rust).
|
|
10
12
|
> These tests were generated deterministically from architecture contracts — no LLM involvement.
|
|
11
13
|
|
|
12
14
|
## Core Principle
|
|
@@ -24,8 +26,14 @@ Do NOT treat the generated tests as rigid specs you must match exactly. Treat th
|
|
|
24
26
|
|
|
25
27
|
### 1. Red — See the test fail
|
|
26
28
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
Run the project's test runner on the generated test file:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# TypeScript: bun test tests/unit/<module>/<component>/<component>.test.ts
|
|
33
|
+
# Java: mvn test -Dtest=<Component>Test
|
|
34
|
+
# Python: pytest tests/<module>/<component>/test_<component>.py
|
|
35
|
+
# Go: go test ./tests/<module>/<component>/
|
|
36
|
+
# Rust: cargo test --test <component>
|
|
29
37
|
```
|
|
30
38
|
|
|
31
39
|
Confirm the test fails before writing any implementation code. This validates that:
|
|
@@ -41,7 +49,7 @@ Write the minimal implementation to make the failing test pass.
|
|
|
41
49
|
- Write only enough code to pass the test
|
|
42
50
|
- Do not over-engineer — YAGNI
|
|
43
51
|
- Use the test's TODO comments as a guide for what the API should look like
|
|
44
|
-
- The test file is in `tests/unit/`, implementation files go in `src/`
|
|
52
|
+
- The test file is in the project's test directory (`tests/unit/`, `src/test/java/`, or `tests/`), implementation files go in `src/`
|
|
45
53
|
- Import the implementation module into the test file
|
|
46
54
|
|
|
47
55
|
If the generated test assumes an API shape that doesn't fit, **update the test first**, then implement.
|
|
@@ -107,11 +115,11 @@ The generated tests are **suggestions, not constraints**. You should modify them
|
|
|
107
115
|
|
|
108
116
|
## File Locations
|
|
109
117
|
|
|
110
|
-
| Artifact |
|
|
111
|
-
|
|
112
|
-
| Tests | `tests/unit
|
|
113
|
-
| Implementation | `src/<module
|
|
114
|
-
| TDD guide | `.pi/skills/tdd-practice.md` |
|
|
118
|
+
| Artifact | TypeScript | Java | Python | Go | Rust |
|
|
119
|
+
|----------|------------|------|--------|-----|------|
|
|
120
|
+
| Tests | `tests/unit/.../component.test.ts` | `src/test/java/.../ComponentTest.java` | `tests/.../test_component.py` | `tests/.../component_test.go` | `tests/.../mod.rs` |
|
|
121
|
+
| Implementation | `src/<module>/` | `src/main/java/.../` | `src/<module>/` | `src/<module>/` | `src/<module>/` |
|
|
122
|
+
| TDD guide | `.pi/skills/tdd-practice.md` | same | same | same | same |
|
|
115
123
|
|
|
116
124
|
## Anti-Patterns
|
|
117
125
|
|