codeharness 0.6.1
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/bin/codeharness +9 -0
- package/dist/chunk-7ZD2ZNDU.js +540 -0
- package/dist/docker-CT57JGM7.js +33 -0
- package/dist/index.js +6104 -0
- package/package.json +39 -0
- package/ralph/AGENTS.md +38 -0
- package/ralph/bridge.sh +421 -0
- package/ralph/db_schema_gen.sh +109 -0
- package/ralph/doc_gardener.sh +352 -0
- package/ralph/drivers/claude-code.sh +160 -0
- package/ralph/exec_plans.sh +252 -0
- package/ralph/harness_status.sh +156 -0
- package/ralph/lib/circuit_breaker.sh +210 -0
- package/ralph/lib/date_utils.sh +60 -0
- package/ralph/lib/timeout_utils.sh +77 -0
- package/ralph/onboard.sh +83 -0
- package/ralph/ralph.sh +1006 -0
- package/ralph/retro.sh +298 -0
- package/ralph/validate_epic_docs.sh +129 -0
- package/ralph/verify_gates.sh +241 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# timeout_utils.sh - Cross-platform timeout utility functions for codeharness Ralph loop
|
|
3
|
+
# Vendored from snarktank/ralph
|
|
4
|
+
|
|
5
|
+
export _TIMEOUT_CMD=""
|
|
6
|
+
|
|
7
|
+
detect_timeout_command() {
|
|
8
|
+
if [[ -n "$_TIMEOUT_CMD" ]]; then
|
|
9
|
+
echo "$_TIMEOUT_CMD"
|
|
10
|
+
return 0
|
|
11
|
+
fi
|
|
12
|
+
|
|
13
|
+
local os_type
|
|
14
|
+
os_type=$(uname)
|
|
15
|
+
|
|
16
|
+
if [[ "$os_type" == "Darwin" ]]; then
|
|
17
|
+
if command -v gtimeout &> /dev/null; then
|
|
18
|
+
_TIMEOUT_CMD="gtimeout"
|
|
19
|
+
elif command -v timeout &> /dev/null; then
|
|
20
|
+
_TIMEOUT_CMD="timeout"
|
|
21
|
+
else
|
|
22
|
+
_TIMEOUT_CMD=""
|
|
23
|
+
return 1
|
|
24
|
+
fi
|
|
25
|
+
else
|
|
26
|
+
if command -v timeout &> /dev/null; then
|
|
27
|
+
_TIMEOUT_CMD="timeout"
|
|
28
|
+
else
|
|
29
|
+
_TIMEOUT_CMD=""
|
|
30
|
+
return 1
|
|
31
|
+
fi
|
|
32
|
+
fi
|
|
33
|
+
|
|
34
|
+
echo "$_TIMEOUT_CMD"
|
|
35
|
+
return 0
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
has_timeout_command() {
|
|
39
|
+
local cmd
|
|
40
|
+
cmd=$(detect_timeout_command 2>/dev/null)
|
|
41
|
+
[[ -n "$cmd" ]]
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
portable_timeout() {
|
|
45
|
+
local duration=$1
|
|
46
|
+
shift
|
|
47
|
+
|
|
48
|
+
if [[ -z "$duration" ]]; then
|
|
49
|
+
echo "Error: portable_timeout requires a duration argument" >&2
|
|
50
|
+
return 1
|
|
51
|
+
fi
|
|
52
|
+
|
|
53
|
+
if [[ $# -eq 0 ]]; then
|
|
54
|
+
echo "Error: portable_timeout requires a command to execute" >&2
|
|
55
|
+
return 1
|
|
56
|
+
fi
|
|
57
|
+
|
|
58
|
+
local timeout_cmd
|
|
59
|
+
timeout_cmd=$(detect_timeout_command 2>/dev/null)
|
|
60
|
+
|
|
61
|
+
if [[ -z "$timeout_cmd" ]]; then
|
|
62
|
+
echo "Warning: No timeout command available, running without timeout" >&2
|
|
63
|
+
"$@"
|
|
64
|
+
return $?
|
|
65
|
+
fi
|
|
66
|
+
|
|
67
|
+
"$timeout_cmd" "$duration" "$@"
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
reset_timeout_detection() {
|
|
71
|
+
_TIMEOUT_CMD=""
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export -f detect_timeout_command
|
|
75
|
+
export -f has_timeout_command
|
|
76
|
+
export -f portable_timeout
|
|
77
|
+
export -f reset_timeout_detection
|
package/ralph/onboard.sh
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# onboard.sh — Brownfield Onboarding Scanner (delegates to TypeScript CLI)
|
|
3
|
+
#
|
|
4
|
+
# DEPRECATED: This script is a thin wrapper around `codeharness onboard`.
|
|
5
|
+
# The TypeScript CLI provides comprehensive scanning including:
|
|
6
|
+
# - Per-file coverage analysis (not just file existence)
|
|
7
|
+
# - Verification gap detection (stories without proof documents)
|
|
8
|
+
# - Observability gap detection (OTLP config, Docker stack)
|
|
9
|
+
# - Sprint-status.yaml integration
|
|
10
|
+
# - Beads issue deduplication
|
|
11
|
+
#
|
|
12
|
+
# Usage:
|
|
13
|
+
# ralph/onboard.sh scan --project-dir DIR [--json]
|
|
14
|
+
# ralph/onboard.sh coverage --project-dir DIR
|
|
15
|
+
# ralph/onboard.sh audit --project-dir DIR
|
|
16
|
+
# ralph/onboard.sh epic --project-dir DIR --output PATH
|
|
17
|
+
|
|
18
|
+
set -e
|
|
19
|
+
|
|
20
|
+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
21
|
+
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
22
|
+
CLI="$PROJECT_ROOT/dist/index.js"
|
|
23
|
+
|
|
24
|
+
# Ensure CLI is built
|
|
25
|
+
if [[ ! -f "$CLI" ]]; then
|
|
26
|
+
echo "[WARN] CLI not built — running npm run build" >&2
|
|
27
|
+
(cd "$PROJECT_ROOT" && npm run build) >&2
|
|
28
|
+
fi
|
|
29
|
+
|
|
30
|
+
ACTION=""
|
|
31
|
+
PROJECT_DIR=""
|
|
32
|
+
JSON_OUTPUT=false
|
|
33
|
+
OUTPUT_FILE=""
|
|
34
|
+
|
|
35
|
+
if [[ $# -gt 0 && "$1" != -* ]]; then
|
|
36
|
+
ACTION="$1"
|
|
37
|
+
shift
|
|
38
|
+
fi
|
|
39
|
+
|
|
40
|
+
while [[ $# -gt 0 ]]; do
|
|
41
|
+
case $1 in
|
|
42
|
+
-h|--help) echo "Usage: onboard.sh {scan|coverage|audit|epic} --project-dir DIR"; exit 0 ;;
|
|
43
|
+
--project-dir) PROJECT_DIR="$2"; shift 2 ;;
|
|
44
|
+
--json) JSON_OUTPUT=true; shift ;;
|
|
45
|
+
--output) OUTPUT_FILE="$2"; shift 2 ;;
|
|
46
|
+
*) echo "Unknown option: $1" >&2; exit 1 ;;
|
|
47
|
+
esac
|
|
48
|
+
done
|
|
49
|
+
|
|
50
|
+
if [[ -z "$PROJECT_DIR" ]]; then
|
|
51
|
+
echo "Error: --project-dir is required" >&2
|
|
52
|
+
exit 1
|
|
53
|
+
fi
|
|
54
|
+
|
|
55
|
+
# Delegate to TypeScript CLI
|
|
56
|
+
cd "$PROJECT_DIR"
|
|
57
|
+
|
|
58
|
+
case "$ACTION" in
|
|
59
|
+
scan)
|
|
60
|
+
if [[ "$JSON_OUTPUT" == "true" ]]; then
|
|
61
|
+
node "$CLI" onboard scan --json
|
|
62
|
+
else
|
|
63
|
+
node "$CLI" onboard scan
|
|
64
|
+
fi
|
|
65
|
+
;;
|
|
66
|
+
coverage)
|
|
67
|
+
node "$CLI" onboard coverage
|
|
68
|
+
;;
|
|
69
|
+
audit)
|
|
70
|
+
node "$CLI" onboard audit
|
|
71
|
+
;;
|
|
72
|
+
epic)
|
|
73
|
+
node "$CLI" onboard epic --auto-approve
|
|
74
|
+
;;
|
|
75
|
+
"")
|
|
76
|
+
echo "Error: specify command: scan, coverage, audit, epic" >&2
|
|
77
|
+
exit 1
|
|
78
|
+
;;
|
|
79
|
+
*)
|
|
80
|
+
echo "Unknown command: $ACTION" >&2
|
|
81
|
+
exit 1
|
|
82
|
+
;;
|
|
83
|
+
esac
|