@ngocsangairvds/vsaf 5.4.4 → 5.4.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ngocsangairvds/vsaf",
3
- "version": "5.4.4",
3
+ "version": "5.4.5",
4
4
  "description": "logging step",
5
5
  "main": "packages/core/dist/index.js",
6
6
  "types": "packages/core/dist/index.d.ts",
@@ -1,10 +1,10 @@
1
1
  name: sdlc-build-headless
2
- description: 'Sub-flow: headless Implement Env Check DevOps agent provisions env (Docker, dynamic) Test Gate (verify only)'
2
+ description: 'Sub-flow (Archon-style): Implement in a single loop that runs the tests IN-LOOP and finishes only when green. Toolchain provisioned once (Docker when the host lacks it). Acyclic no on_fail back-edge.'
3
3
  provider: claude
4
4
  model: sonnet
5
5
  nodes:
6
6
  - id: impl-prereq
7
- description: Implement 1/5 — enumerate test cases into a progress checklist
7
+ description: Implement 1/4 — enumerate test cases into a progress checklist
8
8
  model: sonnet
9
9
  workspace: false
10
10
  timeout: 600000
@@ -22,118 +22,88 @@ nodes:
22
22
 
23
23
  This checklist is the single source of truth for the implementation loop that follows.
24
24
 
25
- - id: impl-loop
26
- description: Implement 2/5TDD one test case per iteration until all are checked
25
+ - id: env-setup
26
+ description: Implement 2/4provision the test toolchain ONCE; expose it as run-tests.sh
27
27
  model: sonnet
28
+ permission_mode: bypassPermissions
28
29
  workspace: false
29
- timeout: 2400000
30
+ timeout: 1800000
30
31
  depends_on:
31
32
  - impl-prereq
32
33
  prompt: |
33
- Implement the feature by test-driven development, ONE test case per turn.
34
+ You are a DevOps engineer. Make this project's test suite RUNNABLE, then write ONE reusable
35
+ script the implementation loop will call every iteration. You may run shell commands
36
+ (including docker). Do NOT install anything on the host.
34
37
 
35
- Source of truth: `$ARTIFACTS_DIR/impl-progress.md`.
36
- Steps for THIS turn:
37
- 1. Read `$ARTIFACTS_DIR/impl-progress.md`. Find the FIRST unchecked `- [ ]` case.
38
- 2. If every case is already checked `- [x]`, output exactly `<promise>IMPL_COMPLETE</promise>`
39
- and stop.
40
- 3. Otherwise, for that one case: write/adjust its test (RED), implement the minimal code
41
- to make it pass (GREEN), keep the change scoped to this case. If a prior test is now
42
- failing, fix it first.
43
- 4. Tick that line to `- [x]` in `$ARTIFACTS_DIR/impl-progress.md` and append a one-line
44
- note of what you did.
45
- 5. Report the case id you completed. Do NOT emit the completion signal unless ALL cases
46
- are checked.
47
-
48
- Work on the real project files. Match the project's existing structure, language, and
49
- test framework. Do only the current case the loop will call you again for the next.
50
- loop:
51
- until: IMPL_COMPLETE
52
- interactive: false
53
- max_iterations: 40
54
-
55
- - id: env-check
56
- description: Implement 3/5 scan the build/test toolchain and report EVERY missing item
57
- workspace: false
58
- depends_on:
59
- - impl-loop
60
- bash: |
61
- echo "[vsaf] env-check: scanning build/test toolchain…"
62
- MISS=$ARTIFACTS_DIR/env-missing.txt; : > "$MISS"
63
- note() { echo "$1" >> "$MISS"; echo " ✗ $1"; }
64
- if [ -f pom.xml ] || [ -f mvnw ]; then
65
- echo "project: Maven"
66
- jv=$(grep -oE '<(java.version|maven.compiler.(target|release))>[0-9]+' pom.xml 2>/dev/null | grep -oE '[0-9]+' | head -1); jv="${jv:-17}"
67
- echo "required-jdk: $jv"
68
- if command -v java >/dev/null 2>&1; then
69
- cur=$(java -version 2>&1 | head -1 | sed -E 's/.*version "([0-9]+).*/\1/')
70
- [ "$cur" -ge "$jv" ] 2>/dev/null || note "JDK>=${jv} (host has ${cur})"
71
- else note "JDK ${jv}"; fi
72
- { [ -f mvnw ] && [ -f .mvn/wrapper/maven-wrapper.jar ]; } || command -v mvn >/dev/null 2>&1 || note "Maven (mvnw wrapper jar or system mvn)"
73
- elif [ -f build.gradle ] || [ -f build.gradle.kts ] || [ -f gradlew ]; then
74
- echo "project: Gradle"
75
- command -v java >/dev/null 2>&1 || note "JDK"
76
- [ -f gradlew ] || command -v gradle >/dev/null 2>&1 || note "Gradle"
77
- elif [ -f package.json ]; then
78
- echo "project: Node"; command -v node >/dev/null 2>&1 || note "Node.js + npm"
79
- elif [ -f requirements.txt ] || [ -f pyproject.toml ]; then
80
- echo "project: Python"; command -v python3 >/dev/null 2>&1 || note "Python 3"
81
- else
82
- echo "project: unknown (no pom/gradle/package.json/requirements)"
83
- fi
84
- command -v docker >/dev/null 2>&1 && echo "docker: available" || echo "docker: MISSING"
85
- if [ -s "$MISS" ]; then echo "[vsaf] ── Missing environment ──"; cat "$MISS"; else echo "[vsaf] toolchain complete on host"; fi
38
+ 1. Detect the project + required toolchain:
39
+ - Maven: `pom.xml`/`mvnw` (read the required JDK from `<java.version>` or
40
+ `<maven.compiler.target|release>`, default 17). Gradle: `build.gradle*`/`gradlew`.
41
+ Node: `package.json`. Python: `requirements.txt`/`pyproject.toml`.
42
+ 2. Check what is missing on the HOST (e.g. `java -version`, `mvn -v`).
43
+ 3. Decide dynamically:
44
+ - If the toolchain is present on the host: `run-tests.sh` runs the tests directly
45
+ (Maven `./mvnw test` or `mvn test`; Gradle `./gradlew test`; Node `npm test`;
46
+ Python `pytest`).
47
+ - If a tool is MISSING: build a Docker image with the correct toolchain
48
+ (e.g. `maven:3.9-eclipse-temurin-<jdk>`, `gradle:8-jdk17`, `node:20`, `python:3.11`):
49
+ write `.vsaf/docker/Dockerfile`, run `docker build -t vsaf-build .vsaf/docker`, and make
50
+ `run-tests.sh` run the tests INSIDE the container with the project bind-mounted so the
51
+ code stays on the host, e.g.:
52
+ `docker run --rm -v "$PWD":/work -w /work -v "$HOME/.m2":/root/.m2 vsaf-build <test cmd>`
53
+ - If Docker itself is not installed AND the host lacks the toolchain, make `run-tests.sh`
54
+ print a clear message and `exit 1` (do NOT try to install Docker).
55
+ 4. Write the chosen command to `$ARTIFACTS_DIR/run-tests.sh` — a POSIX sh script that runs the
56
+ FULL test suite from the project root and exits with the test runner's exit code. Make it
57
+ self-contained and re-runnable, then `chmod +x` it.
58
+ 5. Verify once: `sh $ARTIFACTS_DIR/run-tests.sh`. It is FINE if tests fail now (the code isn't
59
+ written yet)you are only proving the toolchain runs. Report one line: host or docker,
60
+ and that run-tests.sh is ready.
86
61
 
87
- - id: env-devops
88
- description: Implement 4/5DevOps agent provisions the environment (Docker, dynamic) and runs the tests
62
+ - id: impl-loop
63
+ description: Implement 3/4 — TDD one case per turn; run tests IN-LOOP; finish only when GREEN
89
64
  model: sonnet
90
65
  permission_mode: bypassPermissions
91
66
  workspace: false
92
67
  timeout: 2400000
93
68
  depends_on:
94
- - env-check
69
+ - env-setup
95
70
  prompt: |
96
- You are a DevOps engineer. Your job: make this project's tests runnable and RUN them,
97
- then record the result. You may run shell commands (including docker).
98
-
99
- Toolchain scan (from env-check):
100
- $env-check.output
71
+ Implement the feature by test-driven development. Source of truth:
72
+ `$ARTIFACTS_DIR/impl-progress.md`. Run the tests with `sh $ARTIFACTS_DIR/run-tests.sh`
73
+ (already provisioned by env-setup — it uses Docker automatically if the host lacks the
74
+ toolchain).
101
75
 
102
- The full list of MISSING tools is in `$ARTIFACTS_DIR/env-missing.txt` (empty = nothing missing).
103
-
104
- Decide dynamically:
105
- - If `env-missing.txt` is EMPTY: just run the project's test suite on the host
106
- (Maven: `./mvnw test` if the wrapper works else `mvn test`; Gradle: `./gradlew test`;
107
- Node: `npm test`; Python: `pytest`). Fix a mis-set JAVA_HOME if that is all that's wrong.
108
- - If tools are MISSING: do NOT install anything on the host. Instead build a Docker
109
- environment with the correct toolchain and run the tests INSIDE the container with the
110
- project bind-mounted so the code stays on the host, e.g.:
111
- write `.vsaf/docker/Dockerfile` (FROM an image with the needed toolchain, e.g.
112
- `maven:3.9-eclipse-temurin-<jdk>`, `gradle:8-jdk17`, `node:20`, `python:3.11`),
113
- `docker build -t vsaf-build .vsaf/docker`, then
114
- `docker run --rm -v "$PWD":/work -w /work [-v "$HOME/.m2":/root/.m2] vsaf-build <test cmd>`.
115
- If Docker itself is not installed, do NOT try to install it — stop and clearly report
116
- that Docker Desktop/engine must be installed.
76
+ Steps for THIS turn:
77
+ 1. Read `$ARTIFACTS_DIR/impl-progress.md`. Find the FIRST unchecked `- [ ]` case.
78
+ 2. If every case is checked `- [x]` AND the full suite is green (step 4), output exactly
79
+ `<promise>IMPL_COMPLETE</promise>` and stop.
80
+ 3. For that one case: write/adjust its test (RED), implement the minimal code to make it pass
81
+ (GREEN). Keep the change scoped to this case.
82
+ 4. Run `sh $ARTIFACTS_DIR/run-tests.sh 2>&1 | tee $ARTIFACTS_DIR/test-output.log`. If ANY test
83
+ fails (this case OR a regression in a previously-passing test), FIX it now and re-run until
84
+ this case passes and nothing else is broken. Never move on with a failing suite.
85
+ 5. Tick the line to `- [x]` in `$ARTIFACTS_DIR/impl-progress.md` and append a one-line note.
117
86
 
118
- When done, you MUST write the test command's numeric exit code to
119
- `$ARTIFACTS_DIR/test-exit` and its full output to `$ARTIFACTS_DIR/test-output.log`.
120
- Report one line: how you ran the tests (host or docker) and the exit code.
87
+ Work on the real project files. Match the project's existing structure, language, and test
88
+ framework. Do only the current case — the loop calls you again for the next. CRITICAL: NEVER
89
+ emit `<promise>IMPL_COMPLETE</promise>` while any test is failing; the signal means the whole
90
+ suite is green.
91
+ loop:
92
+ until: IMPL_COMPLETE
93
+ interactive: false
94
+ max_iterations: 40
121
95
 
122
96
  - id: test-gate
123
- description: Implement 5/5 — verify the test result produced by env-devops
97
+ description: Implement 4/4final deterministic verify (runs the provisioned suite once)
124
98
  workspace: false
125
99
  depends_on:
126
- - env-devops
100
+ - impl-loop
127
101
  bash: |
128
- TEXIT=$ARTIFACTS_DIR/test-exit; TLOG=$ARTIFACTS_DIR/test-output.log
129
- if [ -f "$TEXIT" ]; then
130
- code=$(cat "$TEXIT" 2>/dev/null | tr -cd '0-9'); code="${code:-1}"
131
- echo "[vsaf] test-gate: verifying result (exit=$code)"
132
- tail -30 "$TLOG" 2>/dev/null || true
133
- exit "$code"
134
- fi
135
- echo "[vsaf] test-gate: no prepared test result (env-devops did not record test-exit)"; exit 1
136
- loop:
137
- on_fail: impl-loop
138
- max_retries: 3
139
- inject_error: true
102
+ RT=$ARTIFACTS_DIR/run-tests.sh
103
+ LOG=$ARTIFACTS_DIR/test-output.log
104
+ if [ ! -f "$RT" ]; then echo "[vsaf] test-gate: run-tests.sh missing (env-setup did not run)"; exit 1; fi
105
+ echo "[vsaf] test-gate: final verification via run-tests.sh"
106
+ sh "$RT" > "$LOG" 2>&1; code=$?
107
+ tail -40 "$LOG" 2>/dev/null || true
108
+ echo "[vsaf] test-gate exit=$code"
109
+ exit "$code"