@esoteric-logic/praxis-harness 2.13.0 → 2.14.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/base/CLAUDE.md CHANGED
@@ -101,8 +101,14 @@ Registered via `claude mcp add`. Persist globally across sessions.
101
101
  Check: `claude mcp list` | Manage: `bash scripts/onboard-mcp.sh [server|all]`
102
102
  Missing servers are non-blocking — features degrade gracefully.
103
103
 
104
+ **CLI companions** — invoked via npx, not MCP:
105
+
106
+ | Tool | Purpose | Invoke | Degrades without |
107
+ |------|---------|--------|-----------------|
108
+ | opensrc | Fetch library source for deep inspection | `npx opensrc <package>` | No source-level investigation; Context7 docs only |
109
+
104
110
  ## After Compaction — Bootstrap
105
- 1. Read project CLAUDE.md (always first)
111
+ 1. Read project CLAUDE.md (always first). If `AGENTS.md` exists in project root, read it too — it contains opensrc source manifests.
106
112
  2. Active task? → read active plan current milestone only
107
113
  No active task? → read `status.md`
108
114
  4. Load rules only for what the current task touches:
@@ -35,7 +35,8 @@
35
35
  {"name": "markdownlint", "feature": "lint-markdown", "install": "npm install -g markdownlint-cli"},
36
36
  {"name": "golangci-lint", "feature": "lint-go", "install": "brew install golangci-lint"},
37
37
  {"name": "rustfmt", "feature": "format-rust", "install": "rustup component add rustfmt"},
38
- {"name": "clippy", "feature": "lint-rust", "install": "rustup component add clippy"}
38
+ {"name": "clippy", "feature": "lint-rust", "install": "rustup component add clippy"},
39
+ {"name": "opensrc", "feature": "source-inspection", "install": "npx opensrc@latest --help"}
39
40
  ]
40
41
  },
41
42
  "env_vars": {
@@ -106,7 +107,8 @@
106
107
  ],
107
108
  "optional": [
108
109
  {"path": "base/hooks/recursion-guard.sh", "event": "PreToolUse", "matcher": "", "feature": "recursion-detection"},
109
- {"path": "base/hooks/dep-audit.sh", "event": "PostToolUse", "matcher": "Write|Edit|MultiEdit", "feature": "dep-audit"}
110
+ {"path": "base/hooks/dep-audit.sh", "event": "PostToolUse", "matcher": "Write|Edit|MultiEdit", "feature": "dep-audit"},
111
+ {"path": "base/hooks/context7-remind.sh", "event": "PostToolUse", "matcher": "Write|Edit|MultiEdit", "feature": "context7-enforcement"}
110
112
  ]
111
113
  },
112
114
  "claude_settings": {
@@ -0,0 +1,81 @@
1
+ #!/usr/bin/env bash
2
+ # context7-remind.sh — PostToolUse hook
3
+ # Scans written/edited files for external import statements.
4
+ # Reminds Claude to verify via Context7 if new imports are detected.
5
+ # PostToolUse hooks always exit 0 — this is a reminder, not a gate.
6
+ set -euo pipefail
7
+
8
+ trap 'exit 0' ERR
9
+
10
+ INPUT=$(cat)
11
+ FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // .tool_input.path // empty' 2>/dev/null)
12
+
13
+ if [[ -z "$FILE_PATH" || ! -f "$FILE_PATH" ]]; then
14
+ exit 0
15
+ fi
16
+
17
+ # Only scan code files where imports are meaningful
18
+ case "$FILE_PATH" in
19
+ *.ts|*.tsx|*.js|*.jsx|*.mjs|*.cjs) LANG="js" ;;
20
+ *.py) LANG="py" ;;
21
+ *.go) LANG="go" ;;
22
+ *.rs) LANG="rs" ;;
23
+ *.java) LANG="java" ;;
24
+ *.cs) LANG="cs" ;;
25
+ *) exit 0 ;;
26
+ esac
27
+
28
+ # Build import pattern per language
29
+ case "$LANG" in
30
+ js) PATTERN="^import .+ from ['\"]|require\(['\"]" ;;
31
+ py) PATTERN="^import |^from .+ import " ;;
32
+ go) PATTERN="^import |^\t\"" ;;
33
+ rs) PATTERN="^use [a-z]" ;;
34
+ java) PATTERN="^import " ;;
35
+ cs) PATTERN="^using " ;;
36
+ esac
37
+
38
+ # Extract external imports (skip relative/internal)
39
+ IMPORTS=$(grep -E "$PATTERN" "$FILE_PATH" 2>/dev/null || true)
40
+
41
+ if [[ -z "$IMPORTS" ]]; then
42
+ exit 0
43
+ fi
44
+
45
+ # Filter out internal/relative imports
46
+ EXTERNAL=""
47
+ while IFS= read -r line; do
48
+ case "$LANG" in
49
+ js)
50
+ # Skip relative imports (./ ../)
51
+ if echo "$line" | grep -qE "from ['\"]\."; then continue; fi
52
+ ;;
53
+ py)
54
+ # Skip relative imports (from . import, from .. import)
55
+ if echo "$line" | grep -qE "^from \."; then continue; fi
56
+ ;;
57
+ go)
58
+ # Skip stdlib (no dots in path) — external modules have dots (github.com, etc.)
59
+ if ! echo "$line" | grep -qE '\"[a-z]+\.[a-z]'; then continue; fi
60
+ ;;
61
+ rs)
62
+ # Skip std/crate/self/super
63
+ if echo "$line" | grep -qE "^use (std|crate|self|super)::"; then continue; fi
64
+ ;;
65
+ java|cs)
66
+ # Skip java.*/javax.*/System.*
67
+ if echo "$line" | grep -qE "^(import|using) (java\.|javax\.|System\.)"; then continue; fi
68
+ ;;
69
+ esac
70
+ EXTERNAL="${EXTERNAL}${line}\n"
71
+ done <<< "$IMPORTS"
72
+
73
+ if [[ -z "$EXTERNAL" ]]; then
74
+ exit 0
75
+ fi
76
+
77
+ # Count unique external packages
78
+ PKG_COUNT=$(echo -e "$EXTERNAL" | grep -c '.' 2>/dev/null || echo "0")
79
+
80
+ echo "CONTEXT7-REMIND: $FILE_PATH contains $PKG_COUNT external import(s). Verify each was looked up via Context7 (resolve-library-id → get-library-docs) this session. If not: do it now before proceeding." >&2
81
+ exit 0
@@ -47,6 +47,15 @@
47
47
  "command": "bash ~/.claude/hooks/dep-audit.sh"
48
48
  }
49
49
  ]
50
+ },
51
+ {
52
+ "matcher": "Write|Edit|MultiEdit",
53
+ "hooks": [
54
+ {
55
+ "type": "command",
56
+ "command": "bash ~/.claude/hooks/context7-remind.sh"
57
+ }
58
+ ]
50
59
  }
51
60
  ],
52
61
  "Stop": [
@@ -29,6 +29,13 @@ Language-specific patterns matched:
29
29
  Every new external import requires a Context7 verification before the gate clears.
30
30
  Internal packages (same repo, same module) are excluded.
31
31
 
32
+ ### Source-level investigation (opensrc)
33
+ - When Context7 docs are insufficient to understand library behavior (bugs, edge cases,
34
+ undocumented internals), run `npx opensrc <package>` to fetch source into `opensrc/<pkg>/`.
35
+ - Before fetching: check `opensrc/sources.json` for already-fetched packages.
36
+ - After fetching: read `AGENTS.md` in project root for the source manifest.
37
+ - This is an escalation path, not a default — Context7 docs are the first stop.
38
+
32
39
  ### Tool preferences
33
40
  - Use Read/Edit/Write tools instead of cat/sed/echo.
34
41
  - Use `rg` (ripgrep) for searching code, not grep.
@@ -62,6 +62,16 @@ Use `perplexity_search` (model: `sonar` for speed):
62
62
  - Query: `"[package] last commit release 2025 2026 archived"`
63
63
  - Extract: last commit date, last release date, repository status, contributor count
64
64
 
65
+ ## Step 5.5 — Source Fetch (optional, on `--deep` flag or when investigating internals)
66
+
67
+ If the research is for understanding implementation behavior (not just API surface):
68
+ 1. Check `opensrc/sources.json` — skip if package already fetched
69
+ 2. Run `npx opensrc <package>` to fetch source into `opensrc/<pkg>/`
70
+ 3. Read `AGENTS.md` for the source manifest
71
+ 4. Note key implementation details in the report under a new "### Implementation Notes" section
72
+
73
+ Skip this step for standard dependency evaluation (version/CVE/maintenance checks).
74
+
65
75
  ## Step 6 — Produce Report
66
76
 
67
77
  Output in this exact format:
@@ -81,6 +91,9 @@ Output in this exact format:
81
91
  ### API Notes (from live docs)
82
92
  [Relevant API surface, configuration, or usage patterns from Context7/Sonar docs]
83
93
 
94
+ ### Implementation Notes (when source was fetched)
95
+ [Key internals, edge cases, or undocumented behavior discovered from source]
96
+
84
97
  ### Sources
85
98
  - [Citation URL 1]
86
99
  - [Citation URL 2]
@@ -9,25 +9,30 @@ paths:
9
9
  - "design-system/**"
10
10
  - "styles/**"
11
11
  ---
12
+
12
13
  # Web Design — Rules
13
- # Scope: Frontend component and design system files
14
- # Part of: web-designer AI-Kit
14
+
15
+ Scope: Frontend component and design system files.
16
+ Part of: web-designer AI-Kit.
15
17
 
16
18
  ## Invariants (BLOCK on violation)
17
19
 
18
20
  ### Design Tokens
21
+
19
22
  - No inline styles in component files — use design tokens or Tailwind utilities.
20
23
  - No hardcoded color values (`#fff`, `rgb(...)`) — must reference token variables
21
24
  (`var(--color-primary)`, Tailwind classes, or theme values).
22
25
  - Check: `grep -rn "color:" src/components/ | grep -v "var(--" | grep -v "tailwind"`
23
26
 
24
27
  ### Semantic HTML
28
+
25
29
  - No `<div>` click handlers — use `<button>` for actions, `<a>` for navigation.
26
30
  - Check: `grep -rn 'onClick.*<div' src/components/`
27
31
  - Every interactive element must have explicit keyboard handling (`onKeyDown` or
28
32
  native keyboard support via semantic elements).
29
33
 
30
34
  ### Accessibility
35
+
31
36
  - Every `<img>` must have an `alt` attribute (empty `alt=""` for decorative images).
32
37
  - Form inputs must have associated `<label>` elements or `aria-label`.
33
38
  - Color contrast must meet WCAG AA minimum (4.5:1 for text, 3:1 for large text).
@@ -35,6 +40,7 @@ paths:
35
40
  ## Conventions (WARN on violation)
36
41
 
37
42
  ### Component Structure
43
+
38
44
  - Component files follow `ComponentName/index.tsx` + `ComponentName.module.css`
39
45
  (or `ComponentName.tsx` with Tailwind — pick one pattern per project, don't mix).
40
46
  - Design tokens live in `design-system/tokens/` or equivalent.
@@ -42,21 +48,25 @@ paths:
42
48
  live in `src/components/[page-name]/`.
43
49
 
44
50
  ### Animation and Motion
51
+
45
52
  - Animation durations use token values, not magic numbers.
46
53
  - Respect `prefers-reduced-motion` — wrap animations in media query.
47
54
  - CSS transitions preferred over JS animation libraries for simple effects.
48
55
 
49
56
  ### Performance
57
+
50
58
  - Images have explicit `width` and `height` to prevent CLS (Cumulative Layout Shift).
51
59
  - Lazy-load images below the fold (`loading="lazy"`).
52
60
  - No layout-triggering CSS in animation loops (`top`, `left`, `width`, `height` — use `transform` and `opacity`).
53
61
 
54
62
  ### Design System Hygiene
63
+
55
64
  - New components must use existing tokens before creating new ones.
56
65
  - If a new token is needed: add to the token file, not inline.
57
66
  - Component variants use a consistent API pattern (props, not className overrides).
58
67
 
59
68
  ## Verification Commands
69
+
60
70
  ```bash
61
71
  # Token compliance — find hardcoded colors
62
72
  grep -rn "color:" src/components/ | grep -v "var(--" | grep -v "token" | grep -v "tailwind"
@@ -75,5 +85,6 @@ npx axe-core src/ --exit
75
85
  ```
76
86
 
77
87
  ## Removal Condition
88
+
78
89
  Remove when the project's design system is mature with >90% component coverage
79
90
  and design review is handled by a dedicated design tool or CI pipeline.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esoteric-logic/praxis-harness",
3
- "version": "2.13.0",
3
+ "version": "2.14.0",
4
4
  "description": "Layered Claude Code harness — workflow discipline, AI-Kits, persistent vault integration",
5
5
  "bin": {
6
6
  "praxis-harness": "./bin/praxis.js"