@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.
Files changed (60) hide show
  1. package/LICENSE +21 -0
  2. package/LICENSE.md +57 -0
  3. package/README.md +404 -2
  4. package/bin/agent.mjs +1260 -0
  5. package/bin/nehanda-ui.mjs +824 -0
  6. package/lib/anthropicHeaders.mjs +8 -0
  7. package/lib/app.mjs +313 -0
  8. package/lib/auth.mjs +255 -0
  9. package/lib/bashguard.mjs +159 -0
  10. package/lib/compact.mjs +306 -0
  11. package/lib/energy-middleware.mjs +318 -0
  12. package/lib/hookShapeOrder.mjs +30 -0
  13. package/lib/hookplane.mjs +228 -0
  14. package/lib/instructions.mjs +23 -0
  15. package/lib/jev_read.mjs +216 -0
  16. package/lib/jev_write.mjs +253 -0
  17. package/lib/laya.mjs +296 -0
  18. package/lib/laya_sidecar.mjs +198 -0
  19. package/lib/mcp-config.mjs +189 -0
  20. package/lib/mcp.mjs +169 -0
  21. package/lib/modelConfig.mjs +152 -0
  22. package/lib/modelDiscovery.mjs +205 -0
  23. package/lib/openaiCompat.mjs +147 -0
  24. package/lib/orchestrate.mjs +1163 -0
  25. package/lib/paths.mjs +20 -0
  26. package/lib/permissions.mjs +44 -0
  27. package/lib/scripts/__pycache__/laya_worker.cpython-314.pyc +0 -0
  28. package/lib/scripts/audit-code-integrity.py +437 -0
  29. package/lib/scripts/ensure-laya-env.sh +55 -0
  30. package/lib/scripts/js-safety-checker.cjs +308 -0
  31. package/lib/scripts/laya_worker.py +171 -0
  32. package/lib/scripts/odse-transform.py +97 -0
  33. package/lib/scripts/python-safety-checker.py +197 -0
  34. package/lib/scripts/shell-safety-checker.sh +306 -0
  35. package/lib/settings.mjs +147 -0
  36. package/lib/store.mjs +278 -0
  37. package/lib/team.mjs +69 -0
  38. package/lib/testgen.mjs +146 -0
  39. package/lib/tools/AuditCodeIntegrity.json +30 -0
  40. package/lib/tools/JsSafetyChecker.json +29 -0
  41. package/lib/tools/PythonSafetyChecker.json +29 -0
  42. package/lib/tools/ShellSafetyChecker.json +29 -0
  43. package/lib/tools.mjs +907 -0
  44. package/lib/transcript.mjs +223 -0
  45. package/lib/ui.mjs +286 -0
  46. package/lib/workflow.mjs +91 -0
  47. package/lib/worktree.mjs +56 -0
  48. package/package.json +50 -4
  49. package/schema.sql +181 -0
  50. package/scripts/postinstall.mjs +62 -0
  51. package/scripts/sdlc-acceptance.sh +477 -0
  52. package/scripts/verify-sdlc-hook-order.mjs +26 -0
  53. package/templates/test_e2e.sh +32 -0
  54. package/templates/test_file.sh +14 -0
  55. package/templates/test_hook.sh +27 -0
  56. package/templates/test_http.sh +17 -0
  57. package/templates/test_phase.sh +23 -0
  58. package/templates/test_process.sh +14 -0
  59. package/templates/test_tool.sh +24 -0
  60. 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: //')"