@asobacloud/nehanda 0.0.0-stage → 0.2.0
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/LICENSE +21 -0
- package/LICENSE.md +57 -0
- package/README.md +404 -2
- package/bin/agent.mjs +1260 -0
- package/bin/nehanda-ui.mjs +824 -0
- package/lib/anthropicHeaders.mjs +8 -0
- package/lib/app.mjs +313 -0
- package/lib/auth.mjs +255 -0
- package/lib/bashguard.mjs +159 -0
- package/lib/compact.mjs +306 -0
- package/lib/energy-middleware.mjs +318 -0
- package/lib/hookShapeOrder.mjs +30 -0
- package/lib/hookplane.mjs +228 -0
- package/lib/instructions.mjs +23 -0
- package/lib/jev_read.mjs +216 -0
- package/lib/jev_write.mjs +253 -0
- package/lib/laya.mjs +296 -0
- package/lib/laya_sidecar.mjs +198 -0
- package/lib/mcp-config.mjs +189 -0
- package/lib/mcp.mjs +169 -0
- package/lib/modelConfig.mjs +152 -0
- package/lib/modelDiscovery.mjs +205 -0
- package/lib/openaiCompat.mjs +147 -0
- package/lib/orchestrate.mjs +1163 -0
- package/lib/paths.mjs +20 -0
- package/lib/permissions.mjs +44 -0
- package/lib/scripts/__pycache__/laya_worker.cpython-314.pyc +0 -0
- package/lib/scripts/audit-code-integrity.py +437 -0
- package/lib/scripts/ensure-laya-env.sh +55 -0
- package/lib/scripts/js-safety-checker.cjs +308 -0
- package/lib/scripts/laya_worker.py +171 -0
- package/lib/scripts/odse-transform.py +97 -0
- package/lib/scripts/python-safety-checker.py +197 -0
- package/lib/scripts/shell-safety-checker.sh +306 -0
- package/lib/settings.mjs +147 -0
- package/lib/store.mjs +278 -0
- package/lib/team.mjs +69 -0
- package/lib/testgen.mjs +146 -0
- package/lib/tools/AuditCodeIntegrity.json +30 -0
- package/lib/tools/JsSafetyChecker.json +29 -0
- package/lib/tools/PythonSafetyChecker.json +29 -0
- package/lib/tools/ShellSafetyChecker.json +29 -0
- package/lib/tools.mjs +907 -0
- package/lib/transcript.mjs +223 -0
- package/lib/ui.mjs +286 -0
- package/lib/workflow.mjs +91 -0
- package/lib/worktree.mjs +56 -0
- package/package.json +50 -4
- package/schema.sql +181 -0
- package/scripts/postinstall.mjs +62 -0
- package/scripts/sdlc-acceptance.sh +477 -0
- package/scripts/verify-sdlc-hook-order.mjs +26 -0
- package/templates/test_e2e.sh +32 -0
- package/templates/test_file.sh +14 -0
- package/templates/test_hook.sh +27 -0
- package/templates/test_http.sh +17 -0
- package/templates/test_phase.sh +23 -0
- package/templates/test_process.sh +14 -0
- package/templates/test_tool.sh +24 -0
- package/templates/validate_test.sh +55 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
# Validates that a generated test file conforms to a shipped template.
|
|
4
|
+
# Usage: templates/validate_test.sh <test_file>
|
|
5
|
+
# Exits 0 if valid, 1 with descriptive error if not.
|
|
6
|
+
|
|
7
|
+
FILE="${1:?Usage: validate_test.sh <test_file>}"
|
|
8
|
+
|
|
9
|
+
if [ ! -f "$FILE" ]; then
|
|
10
|
+
echo "FAIL: file not found: $FILE" >&2; exit 1
|
|
11
|
+
fi
|
|
12
|
+
|
|
13
|
+
CONTENT=$(cat "$FILE")
|
|
14
|
+
|
|
15
|
+
# 1. Template header present
|
|
16
|
+
if ! echo "$CONTENT" | grep -qE '^# TEMPLATE: (tool_contract|phase_transition|hook_contract|e2e_workflow|process_output|file_state|http_response)$'; then
|
|
17
|
+
echo "FAIL: missing or invalid # TEMPLATE: header" >&2
|
|
18
|
+
echo " Must be one of: tool_contract, phase_transition, hook_contract, e2e_workflow, process_output, file_state, http_response" >&2
|
|
19
|
+
exit 1
|
|
20
|
+
fi
|
|
21
|
+
|
|
22
|
+
# 2. Plan traceability — PLAN_REQ is non-empty
|
|
23
|
+
PLAN_REQ=$(echo "$CONTENT" | grep '^# PLAN_REQ:' | sed 's/^# PLAN_REQ: *//')
|
|
24
|
+
if [ -z "$PLAN_REQ" ] || echo "$PLAN_REQ" | grep -qE '^<|^$'; then
|
|
25
|
+
echo "FAIL: PLAN_REQ is empty or still has placeholder <...>" >&2
|
|
26
|
+
exit 1
|
|
27
|
+
fi
|
|
28
|
+
|
|
29
|
+
# 3. EXERCISE section contains ona CLI invocation
|
|
30
|
+
EXERCISE=$(echo "$CONTENT" | sed -n '/^# ══ EXERCISE ══/,/^# ══ ASSERT ══/p')
|
|
31
|
+
if ! echo "$EXERCISE" | grep -q 'ona '; then
|
|
32
|
+
echo "FAIL: EXERCISE section must contain an 'ona' CLI invocation" >&2
|
|
33
|
+
exit 1
|
|
34
|
+
fi
|
|
35
|
+
|
|
36
|
+
# 4. No internal imports or test frameworks
|
|
37
|
+
if echo "$CONTENT" | grep -qE '^\s*(import |require\(|from '\''|from ")'; then
|
|
38
|
+
echo "FAIL: file contains import/require — tests must not import implementation modules" >&2
|
|
39
|
+
exit 1
|
|
40
|
+
fi
|
|
41
|
+
|
|
42
|
+
if echo "$CONTENT" | grep -qiE '\b(jest|vitest|mocha|describe\(|it\(|expect\()\b'; then
|
|
43
|
+
echo "FAIL: file contains test framework keywords — use bash assertions only" >&2
|
|
44
|
+
exit 1
|
|
45
|
+
fi
|
|
46
|
+
|
|
47
|
+
# 5. Has all three sections
|
|
48
|
+
for section in "SETUP" "EXERCISE" "ASSERT"; do
|
|
49
|
+
if ! echo "$CONTENT" | grep -q "^# ══ ${section} ══"; then
|
|
50
|
+
echo "FAIL: missing section: # ══ ${section} ══" >&2
|
|
51
|
+
exit 1
|
|
52
|
+
fi
|
|
53
|
+
done
|
|
54
|
+
|
|
55
|
+
echo "PASS: $FILE conforms to template $(echo "$CONTENT" | grep '^# TEMPLATE:' | sed 's/^# TEMPLATE: //')"
|