@reddb-io/red-skills 4.4.1 → 4.6.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 (78) hide show
  1. package/bin/build-info.mjs +87 -0
  2. package/bin/cli-frontdoor.mjs +14 -0
  3. package/bin/red-skills-brain.mjs +17 -22
  4. package/bin/red-skills-content.mjs +17 -0
  5. package/bin/red-skills-hook.mjs +45 -0
  6. package/bin/red-skills-memory.mjs +17 -22
  7. package/bin/red-skills-redskilled-mcp.mjs +2 -0
  8. package/bin/red-skills-resource.mjs +21 -0
  9. package/bin/runtime-compatibility.mjs +17 -0
  10. package/bin/runtime-paths.mjs +13 -0
  11. package/dist/code-nav.bundle.min.mjs +1 -1
  12. package/dist/opencode-host.bundle.min.mjs +1 -1
  13. package/dist/redskilled-mcp.bundle.min.mjs +36 -36
  14. package/dist/redskilled-web.bundle.min.mjs +311 -0
  15. package/dist/redskilled.bundle.min.mjs +306 -292
  16. package/dist/release.bundle.min.mjs +1 -1
  17. package/dist/rsp-core.bundle.min.mjs +1 -1
  18. package/dist/rsp.bundle.min.mjs +1 -1
  19. package/dist/statusline.bundle.min.mjs +1 -1
  20. package/package.json +12 -4
  21. package/runtime/hook-routes.json +125 -0
  22. package/runtime/plugins/brain/scripts/bootstrap.mjs +656 -0
  23. package/runtime/plugins/brain/scripts/structural-smoke.sh +7 -0
  24. package/runtime/plugins/dev/hooks/branch-lock-codex.sh +105 -0
  25. package/runtime/plugins/dev/hooks/code-nav-mcp.sh +63 -0
  26. package/runtime/plugins/dev/hooks/command-guard.sh +893 -0
  27. package/runtime/plugins/dev/hooks/ensure-codex-statusline.mjs +144 -0
  28. package/runtime/plugins/dev/hooks/red-fetch.mjs +38 -0
  29. package/runtime/plugins/dev/hooks/redskilled-mcp.sh +64 -0
  30. package/runtime/plugins/dev/hooks/rsp-hook.sh +343 -0
  31. package/runtime/plugins/dev/hooks/tests/command-guard.test.sh +378 -0
  32. package/runtime/plugins/dev/hooks/tests/rsp-hook.test.sh +229 -0
  33. package/runtime/plugins/dev/scripts/memory-bridge.sh +230 -0
  34. package/runtime/plugins/dev/scripts/structural-smoke.sh +7 -0
  35. package/runtime/plugins/dev/scripts/tests/memory-bridge.test.sh +555 -0
  36. package/runtime/plugins/dev/skills/engineering/afk/defaults/cargo-pre-worktree.sh +37 -0
  37. package/runtime/plugins/dev/skills/engineering/afk/defaults/envelope-post-attempt.sh +47 -0
  38. package/runtime/plugins/dev/skills/engineering/afk/defaults/gradle-pre-worktree.sh +45 -0
  39. package/runtime/plugins/dev/skills/engineering/afk/defaults/heartbeat-post-attempt.sh +43 -0
  40. package/runtime/plugins/dev/skills/engineering/afk/defaults/validation-post-merge.sh +77 -0
  41. package/runtime/plugins/dev/skills/engineering/afk/detectors/cargo.sh +27 -0
  42. package/runtime/plugins/dev/skills/engineering/afk/detectors/gradle.sh +38 -0
  43. package/runtime/plugins/dev/skills/engineering/afk/examples/only-mine.sh +32 -0
  44. package/runtime/plugins/dev/skills/engineering/afk/examples/red-afk-attempt-action.yml +53 -0
  45. package/runtime/plugins/dev/skills/engineering/afk/examples/rs-afk-attempt.yml +76 -0
  46. package/runtime/plugins/dev/skills/engineering/afk/hooks/red-cargo +38 -0
  47. package/runtime/plugins/dev/skills/engineering/afk/hooks/red-envelope +50 -0
  48. package/runtime/plugins/dev/skills/engineering/afk/hooks/red-gradle +42 -0
  49. package/runtime/plugins/dev/skills/engineering/afk/hooks/red-heartbeat +46 -0
  50. package/runtime/plugins/dev/skills/engineering/afk/hooks/red-validation +79 -0
  51. package/runtime/plugins/dev/skills/engineering/diagnose/scripts/hitl-loop.template.sh +41 -0
  52. package/runtime/plugins/dev/skills/engineering/red-setup/scripts/install-runtime-shim.sh +181 -0
  53. package/runtime/plugins/dev/skills/engineering/red-setup/workflows/red-issues-needs-triage.yml +36 -0
  54. package/runtime/plugins/dev/skills/engineering/wizard/template.sh +211 -0
  55. package/runtime/plugins/dev/skills/engineering/zoom-out/scripts/graph-mode-plumbing.sh +36 -0
  56. package/runtime/plugins/dev/skills/engineering/zoom-out/scripts/tests/contract.test.sh +168 -0
  57. package/runtime/plugins/dev/skills/misc/branch-lock/scripts/branch-lock-hook.sh +113 -0
  58. package/runtime/plugins/dev/skills/misc/branch-lock/scripts/branch-lock-session-start.sh +81 -0
  59. package/runtime/plugins/dev/skills/misc/branch-lock/scripts/branch-lock.sh +68 -0
  60. package/runtime/plugins/dev/skills/misc/branch-lock/scripts/lib/dev-config.sh +126 -0
  61. package/runtime/plugins/dev/skills/misc/branch-lock/scripts/lib/git-command-classifier.sh +198 -0
  62. package/runtime/plugins/dev/skills/misc/branch-lock/scripts/lib/lock-store.sh +67 -0
  63. package/runtime/plugins/dev/skills/misc/branch-lock/scripts/lib/scope-resolver.sh +43 -0
  64. package/runtime/plugins/dev/skills/misc/branch-lock/scripts/tests/branch-lock-cli.test.sh +114 -0
  65. package/runtime/plugins/dev/skills/misc/branch-lock/scripts/tests/claude-plugin-hook.test.sh +117 -0
  66. package/runtime/plugins/dev/skills/misc/branch-lock/scripts/tests/codex-hook.test.sh +230 -0
  67. package/runtime/plugins/dev/skills/misc/branch-lock/scripts/tests/dev-config.test.sh +99 -0
  68. package/runtime/plugins/dev/skills/misc/branch-lock/scripts/tests/git-command-classifier.test.sh +187 -0
  69. package/runtime/plugins/dev/skills/misc/branch-lock/scripts/tests/lock-store.test.sh +90 -0
  70. package/runtime/plugins/dev/skills/misc/branch-lock/scripts/tests/scope-resolver.test.sh +63 -0
  71. package/runtime/plugins/dev/skills/misc/branch-lock/scripts/tests/session-start.test.sh +123 -0
  72. package/runtime/plugins/dev/skills/misc/git-guardrails-claude-code/scripts/block-dangerous-git.sh +231 -0
  73. package/runtime/plugins/dev/skills/misc/git-guardrails-claude-code/scripts/tests/block-dangerous-git.test.sh +143 -0
  74. package/runtime/plugins/internal/scripts/structural-smoke.sh +7 -0
  75. package/runtime/plugins/internal/skills/maintainer/create-plugin/scripts/create-plugin.sh +308 -0
  76. package/runtime/plugins/memory/scripts/bootstrap.mjs +659 -0
  77. package/runtime/plugins/memory/scripts/structural-smoke.sh +7 -0
  78. package/scripts/check-skills-boundary.mjs +32 -0
@@ -0,0 +1,105 @@
1
+ #!/usr/bin/env bash
2
+ # Codex PreToolUse hook for branch-lock. Mirrors the Claude Code hook but reads
3
+ # Codex payloads and prints `{}` on allowed/no-op paths.
4
+
5
+ set -uo pipefail
6
+
7
+ PLUGIN_ROOT="${CODEX_PLUGIN_ROOT:-}"
8
+ if [[ -z "$PLUGIN_ROOT" ]]; then
9
+ PLUGIN_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
10
+ fi
11
+
12
+ INPUT="$(timeout "${RED_SKILLS_HOOK_STDIN_TIMEOUT_S:-5s}" cat 2>/dev/null || true)"
13
+
14
+ allow() {
15
+ printf '{}'
16
+ exit 0
17
+ }
18
+
19
+ deny() {
20
+ local reason="$1"
21
+ printf '%s\n' "$reason" >&2
22
+ jq -nc --arg reason "$reason" '{
23
+ decision: "block",
24
+ reason: $reason,
25
+ hookSpecificOutput: {
26
+ hookEventName: "PreToolUse",
27
+ permissionDecision: "deny",
28
+ permissionDecisionReason: $reason
29
+ }
30
+ }'
31
+ exit 0
32
+ }
33
+
34
+ BRANCH_LOCK_DIR="$PLUGIN_ROOT/skills/misc/branch-lock/scripts"
35
+ [[ -d "$BRANCH_LOCK_DIR/lib" ]] || allow
36
+
37
+ # shellcheck source=../skills/misc/branch-lock/scripts/lib/lock-store.sh
38
+ source "$BRANCH_LOCK_DIR/lib/lock-store.sh"
39
+ # shellcheck source=../skills/misc/branch-lock/scripts/lib/scope-resolver.sh
40
+ source "$BRANCH_LOCK_DIR/lib/scope-resolver.sh"
41
+ # shellcheck source=../skills/misc/branch-lock/scripts/lib/git-command-classifier.sh
42
+ source "$BRANCH_LOCK_DIR/lib/git-command-classifier.sh"
43
+ # shellcheck source=../skills/misc/branch-lock/scripts/lib/dev-config.sh
44
+ source "$BRANCH_LOCK_DIR/lib/dev-config.sh"
45
+
46
+ COMMAND="$(
47
+ jq -r '
48
+ .tool_input.command // .tool_input.cmd //
49
+ .input.command // .input.cmd //
50
+ .arguments.command // .arguments.cmd //
51
+ .command // .cmd // empty
52
+ ' <<<"$INPUT" 2>/dev/null
53
+ )"
54
+ [[ -z "$COMMAND" ]] && allow
55
+
56
+ ROOT="$(jq -r '.cwd // empty' <<<"$INPUT" 2>/dev/null)"
57
+ [[ -z "$ROOT" || "$ROOT" == "null" ]] && ROOT="${CODEX_PROJECT_DIR:-}"
58
+ [[ -z "$ROOT" || "$ROOT" == "null" ]] && ROOT="$(pwd)"
59
+ if [[ -n "$ROOT" && ! -d "$ROOT/.git" ]]; then
60
+ ROOT="$(git -C "$ROOT" rev-parse --show-toplevel 2>/dev/null || printf '%s' "$ROOT")"
61
+ fi
62
+ [[ -z "$ROOT" ]] && allow
63
+
64
+ # Per-directory plugin gate (ADR 0067): stay fully inert unless the dev plugin is
65
+ # enabled in this repo. Mirrors branch-lock-hook.sh.
66
+ dev_plugin_enabled "$ROOT/.red/config.yaml" || allow
67
+
68
+ scope_should_enforce "$ROOT" || allow
69
+
70
+ # Untouchable primary (ADR 0083 §2): an agent may never move the primary
71
+ # checkout's branch. Unconditional — no longer armed by the
72
+ # `dev.lock.primary-branch` toggle (kept readable for backward compatibility but
73
+ # unable to *enable* switching). Agent-only hook, so human terminals are
74
+ # unaffected (ADR 0006). Mirrors branch-lock-hook.sh.
75
+ if [[ "$(classify_primary_branch_switch_guard "$COMMAND")" == "block" ]]; then
76
+ deny "$(cat <<EOF
77
+ BLOCKED by the untouchable-primary rule (ADR 0083): an agent can never switch
78
+ the primary checkout's branch, regardless of configuration or lock state.
79
+ The command '$COMMAND' would move the agent's primary checkout to another branch.
80
+
81
+ Allowed in the primary checkout: git commit, git worktree add, read-only git,
82
+ and non-branch-changing commands. To work on another branch, create/use a
83
+ worktree under .red/tmp/work-*/ or ask the user to change the primary branch.
84
+ EOF
85
+ )"
86
+ fi
87
+
88
+ LOCKFILE="$ROOT/.red/tmp/branch-lock.yaml"
89
+ LOCK_BRANCH="$(lock_store_read "$LOCKFILE")" || allow
90
+
91
+ if [[ "$(classify_git_command "$LOCK_BRANCH" "$COMMAND")" == "block" ]]; then
92
+ deny "$(cat <<EOF
93
+ BLOCKED by branch lock: this session is locked to '$LOCK_BRANCH'.
94
+ The command '$COMMAND' would switch the agent away from the locked branch or
95
+ discard working-tree changes (stash, clean -f, reset --hard, whole-tree restore).
96
+
97
+ Allowed while locked: switching back to '$LOCK_BRANCH', targeted file restore
98
+ ('git checkout -- <path>', 'git restore <path>'), read-only stash, dry-run clean,
99
+ soft/mixed reset, and 'git worktree add'. To change or release the lock, ask the
100
+ user — they drive it with '/branch-lock <branch>' or '/branch-lock clear'.
101
+ EOF
102
+ )"
103
+ fi
104
+
105
+ allow
@@ -0,0 +1,63 @@
1
+ #!/usr/bin/env bash
2
+ set -u
3
+
4
+ root="${CODEX_PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-}}"
5
+
6
+ if [ -z "$root" ]; then
7
+ for candidate in \
8
+ "$PWD/plugins/dev" \
9
+ "$HOME/.codex/.tmp/marketplaces/red-skills/plugins/dev"; do
10
+ if [ -f "$candidate/.codex-plugin/plugin.json" ] || [ -f "$candidate/.claude-plugin/plugin.json" ]; then
11
+ root="$candidate"
12
+ break
13
+ fi
14
+ done
15
+ fi
16
+
17
+ if [ -z "$root" ] && [ -d "$HOME/.codex/plugins/cache/red-skills/dev" ]; then
18
+ for candidate in "$HOME/.codex/plugins/cache/red-skills/dev"/*; do
19
+ if [ -f "$candidate/.codex-plugin/plugin.json" ] || [ -f "$candidate/.claude-plugin/plugin.json" ]; then
20
+ root="$candidate"
21
+ fi
22
+ done
23
+ fi
24
+
25
+ plugin_json=""
26
+ if [ -n "$root" ] && [ -f "$root/.codex-plugin/plugin.json" ]; then
27
+ plugin_json="$root/.codex-plugin/plugin.json"
28
+ elif [ -n "$root" ] && [ -f "$root/.claude-plugin/plugin.json" ]; then
29
+ plugin_json="$root/.claude-plugin/plugin.json"
30
+ fi
31
+
32
+ ver=""
33
+ if [ -n "$plugin_json" ]; then
34
+ ver="$(node -e "process.stdout.write(require(process.argv[1]).version)" "$plugin_json" 2>/dev/null || true)"
35
+ fi
36
+
37
+ bundle=""
38
+
39
+ if [ -n "$ver" ]; then
40
+ npx -y -p "@reddb-io/red-skills@$ver" red-skills-code-nav
41
+ status=$?
42
+ if [ "$status" -eq 0 ]; then
43
+ exit 0
44
+ fi
45
+ printf 'code-nav: npm package launcher failed for %s (exit %s); trying local dist fallback\n' "$ver" "$status" >&2
46
+ fi
47
+
48
+ if [ -z "$bundle" ]; then
49
+ for repo in "$root/../.." "$PWD"; do
50
+ if [ -f "$repo/dist/code-nav-mcp.bundle.min.mjs" ]; then
51
+ bundle="$repo/dist/code-nav-mcp.bundle.min.mjs"
52
+ break
53
+ fi
54
+ done
55
+ fi
56
+
57
+ if [ -z "$bundle" ]; then
58
+ expected="${ver:-<unknown>}"
59
+ printf 'code-nav: could not launch red-skills-code-nav for %s and could not locate repo-root dist fallback\n' "$expected" >&2
60
+ exit 0
61
+ fi
62
+
63
+ exec node "$bundle"