@esoteric-logic/praxis-harness 2.3.0 → 2.4.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 (36) hide show
  1. package/README.md +13 -1
  2. package/base/CLAUDE.md +4 -0
  3. package/base/configs/linters/.editorconfig +29 -0
  4. package/base/configs/linters/.golangci.yml +63 -0
  5. package/base/configs/linters/.hadolint.yaml +7 -0
  6. package/base/configs/linters/.shellcheckrc +4 -0
  7. package/base/configs/linters/.tflint.hcl +30 -0
  8. package/base/configs/linters/commitlint.config.js +10 -0
  9. package/base/configs/vale/.vale.ini +16 -0
  10. package/base/configs/vale/Praxis/AISlop.yml +90 -0
  11. package/base/configs/vale/Praxis/CopulaAvoidance.yml +22 -0
  12. package/base/configs/vale/Praxis/ElegantVariation.yml +14 -0
  13. package/base/configs/vale/Praxis/Hedging.yml +22 -0
  14. package/base/configs/vale/Praxis/NaturalVoice.yml +85 -0
  15. package/base/configs/vale/Praxis/Precision.yml +60 -0
  16. package/base/hooks/file-guard.sh +53 -0
  17. package/base/hooks/post-session-lint.sh +5 -0
  18. package/base/hooks/quality-check.sh +165 -0
  19. package/base/hooks/settings-hooks.json +14 -1
  20. package/base/hooks/vault-checkpoint.sh +25 -0
  21. package/base/rules/coding.md +23 -0
  22. package/base/rules/context-management.md +2 -0
  23. package/base/rules/terraform.md +10 -0
  24. package/base/skills/execute/SKILL.md +15 -0
  25. package/base/skills/plan/SKILL.md +16 -0
  26. package/base/skills/pre-commit-lint/SKILL.md +21 -1
  27. package/base/skills/repair/SKILL.md +7 -0
  28. package/base/skills/scaffold-new/SKILL.md +40 -0
  29. package/base/skills/scaffold-new/references/repo-CLAUDE-md-template.md +35 -0
  30. package/base/skills/ship/SKILL.md +6 -0
  31. package/base/skills/verify/SKILL.md +16 -5
  32. package/bin/praxis.js +19 -0
  33. package/package.json +1 -1
  34. package/scripts/install-tools.sh +137 -0
  35. package/scripts/lint-harness.sh +2 -1
  36. package/scripts/test-harness.sh +87 -0
@@ -0,0 +1,137 @@
1
+ #!/usr/bin/env bash
2
+ # install-tools.sh — Install Phase 1 quality tools
3
+ # Usage: bash scripts/install-tools.sh [--all | --go | --terraform | --core]
4
+ set -euo pipefail
5
+
6
+ INSTALL_GO=false
7
+ INSTALL_TF=false
8
+ INSTALL_CORE=true
9
+
10
+ for arg in "$@"; do
11
+ case "$arg" in
12
+ --all) INSTALL_GO=true; INSTALL_TF=true ;;
13
+ --go) INSTALL_GO=true ;;
14
+ --terraform) INSTALL_TF=true ;;
15
+ --core) ;;
16
+ esac
17
+ done
18
+
19
+ # Auto-detect if no flags
20
+ if [ $# -eq 0 ]; then
21
+ command -v go &>/dev/null && INSTALL_GO=true
22
+ command -v terraform &>/dev/null && INSTALL_TF=true
23
+ fi
24
+
25
+ echo "=== Praxis Quality Tools — Phase 1 ==="
26
+ echo "Core: always | Go: $INSTALL_GO | Terraform: $INSTALL_TF"
27
+ echo ""
28
+
29
+ # ── Detect package manager ──
30
+ if command -v brew &>/dev/null; then
31
+ PKG="brew"
32
+ elif command -v apt-get &>/dev/null; then
33
+ PKG="apt"
34
+ else
35
+ echo "ERROR: Neither brew nor apt found. Install tools manually."
36
+ exit 1
37
+ fi
38
+
39
+ install_brew() { brew install "$@" 2>/dev/null || true; }
40
+ install_npm() { npm install -g "$@" 2>/dev/null || true; }
41
+ install_pip() { pip install "$@" 2>/dev/null || pip install --break-system-packages "$@" 2>/dev/null || true; }
42
+ install_go() { go install "$@" 2>/dev/null || true; }
43
+
44
+ # ── Core (always) ──
45
+ echo "── Installing core tools ──"
46
+ if [ "$PKG" = "brew" ]; then
47
+ install_brew shellcheck shfmt jq vale gitleaks
48
+ else
49
+ sudo apt-get update -qq
50
+ sudo apt-get install -y -qq shellcheck jq
51
+ install_go mvdan.cc/sh/v3/cmd/shfmt@latest
52
+ echo "NOTE: Install vale and gitleaks manually (see https://vale.sh/docs/install)"
53
+ fi
54
+ install_npm markdownlint-cli @commitlint/cli @commitlint/config-conventional
55
+ install_pip semgrep yamllint
56
+
57
+ # ── Go stack ──
58
+ if $INSTALL_GO; then
59
+ echo ""
60
+ echo "── Installing Go quality tools ──"
61
+ install_go golang.org/x/tools/cmd/goimports@latest
62
+ install_go golang.org/x/vuln/cmd/govulncheck@latest
63
+ if [ "$PKG" = "brew" ]; then
64
+ install_brew golangci-lint
65
+ else
66
+ curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "$(go env GOPATH)/bin" 2>/dev/null || true
67
+ fi
68
+ fi
69
+
70
+ # ── Terraform/Azure stack ──
71
+ if $INSTALL_TF; then
72
+ echo ""
73
+ echo "── Installing Terraform quality tools ──"
74
+ if [ "$PKG" = "brew" ]; then
75
+ install_brew tflint trivy infracost
76
+ else
77
+ echo "NOTE: Install tflint, trivy, infracost manually for Linux"
78
+ fi
79
+ fi
80
+
81
+ # ── Docker (lightweight — always if docker present) ──
82
+ if command -v docker &>/dev/null; then
83
+ echo ""
84
+ echo "── Installing container tools ──"
85
+ if [ "$PKG" = "brew" ]; then
86
+ install_brew hadolint
87
+ fi
88
+ fi
89
+
90
+ # ── Vale setup (sync packages + copy Praxis rules) ──
91
+ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
92
+ VALE_CONFIG_DIR="$SCRIPT_DIR/../base/configs/vale"
93
+ if command -v vale &>/dev/null && [ -f "$VALE_CONFIG_DIR/.vale.ini" ]; then
94
+ echo ""
95
+ echo "── Setting up Vale prose linter ──"
96
+ (cd "$VALE_CONFIG_DIR" && vale sync 2>/dev/null || true)
97
+ if [ -d "$VALE_CONFIG_DIR/Praxis" ] && [ -d "$VALE_CONFIG_DIR/.vale-styles" ]; then
98
+ cp -R "$VALE_CONFIG_DIR/Praxis" "$VALE_CONFIG_DIR/.vale-styles/Praxis"
99
+ echo " Praxis rules copied to .vale-styles/"
100
+ fi
101
+ fi
102
+
103
+ # ── VS Code extensions ──
104
+ if command -v code &>/dev/null; then
105
+ echo ""
106
+ echo "── Installing VS Code extensions ──"
107
+ CORE_EXTENSIONS=(
108
+ chrischinchilla.vale-vscode
109
+ timonwong.shellcheck
110
+ editorconfig.editorconfig
111
+ davidanson.vscode-markdownlint
112
+ )
113
+ for ext in "${CORE_EXTENSIONS[@]}"; do
114
+ code --install-extension "$ext" --force 2>/dev/null && printf " ✓ %s\n" "$ext" || printf " ✗ %s\n" "$ext"
115
+ done
116
+
117
+ # Stack-conditional extensions
118
+ $INSTALL_GO && code --install-extension golang.go --force 2>/dev/null && echo " ✓ golang.go" || true
119
+ $INSTALL_TF && code --install-extension hashicorp.terraform --force 2>/dev/null && echo " ✓ hashicorp.terraform" || true
120
+ command -v docker &>/dev/null && code --install-extension exiasr.hadolint --force 2>/dev/null && echo " ✓ exiasr.hadolint" || true
121
+ else
122
+ echo ""
123
+ echo " ⚠ VS Code 'code' CLI not on PATH — skipping extension install"
124
+ echo " Fix: In VS Code, Cmd+Shift+P → 'Shell Command: Install code command in PATH'"
125
+ fi
126
+
127
+ echo ""
128
+ echo "=== Done. Run 'bash scripts/install-tools.sh --all' to install all stacks. ==="
129
+ echo ""
130
+ echo "Installed tools:"
131
+ for tool in shellcheck shfmt jq vale gitleaks goimports golangci-lint govulncheck tflint trivy infracost hadolint semgrep yamllint markdownlint commitlint; do
132
+ if command -v "$tool" &>/dev/null; then
133
+ printf " ✓ %s\n" "$tool"
134
+ else
135
+ printf " ✗ %s (not found)\n" "$tool"
136
+ fi
137
+ done
@@ -109,9 +109,10 @@ PLACEHOLDER_FOUND=0
109
109
  # Also exclude HTML comments and fenced code blocks
110
110
  while IFS= read -r file; do
111
111
  [[ -f "$file" ]] || continue
112
- # Skip templates directory and references directories
112
+ # Skip templates, references, and configs directories
113
113
  [[ "$file" == *"/templates/"* ]] && continue
114
114
  [[ "$file" == *"/references/"* ]] && continue
115
+ [[ "$file" == *"/configs/"* ]] && continue
115
116
 
116
117
  # Strip fenced code blocks (including indented), HTML comments,
117
118
  # lines with inline backticks, and shell comments/echo lines
@@ -153,6 +153,93 @@ else
153
153
  error "bin/praxis.js has syntax errors"
154
154
  fi
155
155
 
156
+ # ── 8. Quality Hooks ─────────────────────────────────────────
157
+ echo ""
158
+ echo "Quality hooks:"
159
+
160
+ for hook in file-guard.sh quality-check.sh; do
161
+ if [[ -f "$REPO_PATH/base/hooks/$hook" ]]; then
162
+ ok "hooks/$hook exists"
163
+ if [[ -x "$REPO_PATH/base/hooks/$hook" ]]; then
164
+ ok "hooks/$hook is executable"
165
+ else
166
+ error "hooks/$hook is not executable"
167
+ fi
168
+ else
169
+ error "hooks/$hook missing"
170
+ fi
171
+ done
172
+
173
+ # ── 9. Hook Chain Wiring ─────────────────────────────────────
174
+ echo ""
175
+ echo "Hook chain wiring:"
176
+
177
+ # Verify quality-check.sh wired in PostToolUse
178
+ if jq -e '.hooks.PostToolUse[].hooks[].command | select(contains("quality-check.sh"))' \
179
+ "$REPO_PATH/base/hooks/settings-hooks.json" >/dev/null 2>&1; then
180
+ ok "quality-check.sh wired in PostToolUse"
181
+ else
182
+ error "quality-check.sh not found in PostToolUse hooks"
183
+ fi
184
+
185
+ # Verify auto-format.sh NOT in settings-hooks.json
186
+ if jq -e '.hooks.PostToolUse[].hooks[].command | select(contains("auto-format.sh"))' \
187
+ "$REPO_PATH/base/hooks/settings-hooks.json" >/dev/null 2>&1; then
188
+ error "auto-format.sh still in PostToolUse (should be replaced by quality-check.sh)"
189
+ else
190
+ ok "auto-format.sh removed from PostToolUse"
191
+ fi
192
+
193
+ # Verify file-guard.sh wired in PreToolUse
194
+ if jq -e '.hooks.PreToolUse[].hooks[].command | select(contains("file-guard.sh"))' \
195
+ "$REPO_PATH/base/hooks/settings-hooks.json" >/dev/null 2>&1; then
196
+ ok "file-guard.sh wired in PreToolUse"
197
+ else
198
+ error "file-guard.sh not found in PreToolUse hooks"
199
+ fi
200
+
201
+ # ── 10. Config Directory ─────────────────────────────────────
202
+ echo ""
203
+ echo "Config directory:"
204
+
205
+ if [[ -d "$REPO_PATH/base/configs" ]]; then
206
+ ok "base/configs/ exists"
207
+ for config_dir in vale linters; do
208
+ if [[ -d "$REPO_PATH/base/configs/$config_dir" ]]; then
209
+ ok "base/configs/$config_dir/ exists"
210
+ else
211
+ error "base/configs/$config_dir/ missing"
212
+ fi
213
+ done
214
+
215
+ # Vale config check
216
+ if [[ -f "$REPO_PATH/base/configs/vale/.vale.ini" ]]; then
217
+ ok "vale config exists"
218
+ else
219
+ error "vale config missing"
220
+ fi
221
+
222
+ # Vale rule files
223
+ VALE_COUNT=$(find "$REPO_PATH/base/configs/vale/Praxis" -name "*.yml" 2>/dev/null | wc -l | tr -d ' ')
224
+ if [[ "$VALE_COUNT" -ge 6 ]]; then
225
+ ok "vale Praxis rules: $VALE_COUNT files"
226
+ else
227
+ error "vale Praxis rules: expected >=6, found $VALE_COUNT"
228
+ fi
229
+
230
+ # YAML validation on vale rules
231
+ for f in "$REPO_PATH"/base/configs/vale/Praxis/*.yml; do
232
+ name=$(basename "$f")
233
+ if python3 -c "import yaml; yaml.safe_load(open('$f'))" 2>/dev/null; then
234
+ ok "vale/$name valid YAML"
235
+ else
236
+ error "vale/$name invalid YAML"
237
+ fi
238
+ done
239
+ else
240
+ error "base/configs/ directory missing"
241
+ fi
242
+
156
243
  # ── Summary ───────────────────────────────────────────────────
157
244
  echo ""
158
245
  echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"