@osfactory/har 1.0.0 → 1.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.
- package/dist/index.js +815 -820
- package/dist/templates/AGENTS.md.template +1 -1
- package/dist/templates/adaptation-prompt-init.md +18 -23
- package/dist/templates/adaptation-prompt-maintain.md +1 -1
- package/dist/templates/adaptation-prompt-plugin.md +1 -1
- package/dist/templates/agent-skills/factory-line.md +96 -0
- package/dist/templates/agent-skills/har-wt.md +1 -1
- package/dist/templates/agent-skills/setup-har.md +4 -4
- package/dist/templates/agent-skills/skills.manifest.json +13 -0
- package/dist/templates/har-boilerplate/harness.env +1 -1
- package/dist/templates/har-boilerplate/justfile +11 -12
- package/dist/templates/har-boilerplate/stages.json +3 -9
- package/dist/templates/har-boilerplate-cli/harness.env +1 -1
- package/dist/templates/har-boilerplate-cli/justfile +9 -10
- package/dist/templates/har-boilerplate-cli/stages.json +2 -7
- package/dist/templates/har-boilerplate-ios/harness.env +1 -1
- package/dist/templates/har-boilerplate-ios/justfile +9 -10
- package/dist/templates/har-boilerplate-ios/stages.json +3 -8
- package/dist/templates/migration-prompt.md +2 -2
- package/dist/templates/plugins/custom-stage-skeleton.sh +2 -2
- package/dist/templates/plugins/gitleaks/.har/stages/secrets-scan.sh +2 -2
- package/dist/templates/plugins/gitleaks/template.manifest.json +1 -1
- package/dist/templates/plugins/kerno/.github/workflows/kerno.yml +1 -1
- package/dist/templates/plugins/kerno/.har/stages/KERNO.md +2 -2
- package/dist/templates/plugins/kerno/.har/stages/backend-validation.sh +3 -3
- package/dist/templates/plugins/kerno/README.md +2 -2
- package/dist/templates/plugins/kerno/template.manifest.json +1 -1
- package/dist/templates/plugins/playwright/.har/stages/PLAYWRIGHT.md +2 -2
- package/dist/templates/plugins/playwright/.har/stages/browser-e2e.sh +3 -3
- package/dist/templates/plugins/playwright/README.md +1 -1
- package/dist/templates/plugins/playwright/playwright.config.js +2 -2
- package/dist/templates/plugins/playwright/template.manifest.json +1 -1
- package/dist/templates/plugins/rocketsim/.har/stages/ROCKETSIM.md +1 -1
- package/dist/templates/plugins/rocketsim/.har/stages/rocketsim-flows.sh +3 -3
- package/dist/templates/plugins/rocketsim/README.md +1 -1
- package/dist/templates/plugins/rocketsim/flows/example-smoke.sh +1 -1
- package/dist/templates/plugins/rocketsim/template.manifest.json +1 -1
- package/dist/templates/plugins/semgrep/.har/stages/SEMGREP.md +1 -1
- package/dist/templates/plugins/semgrep/.har/stages/sast.sh +3 -3
- package/dist/templates/plugins/semgrep/README.md +2 -2
- package/dist/templates/plugins/semgrep/template.manifest.json +1 -1
- package/dist/templates/plugins/trivy/.har/stages/TRIVY.md +1 -1
- package/dist/templates/plugins/trivy/.har/stages/vuln-scan.sh +3 -3
- package/dist/templates/plugins/trivy/template.manifest.json +1 -1
- package/dist/templates/profiles/cli/docs/readme/quick-start.md +2 -3
- package/dist/templates/profiles/cli/docs/readme/verification-contract.md +3 -3
- package/dist/templates/profiles/cli/docs/readme/what-s-in-here.md +1 -2
- package/dist/templates/profiles/default/docs/readme/quick-start.md +2 -3
- package/dist/templates/profiles/default/docs/readme/verification-contract.md +3 -3
- package/dist/templates/profiles/default/docs/readme/what-s-in-here.md +1 -2
- package/dist/templates/profiles/ios/docs/readme/quick-start.md +2 -3
- package/dist/templates/profiles/ios/docs/readme/what-s-in-here.md +1 -2
- package/dist/templates/runtime-bundles/shared-kernel/STAGES.md +1 -1
- package/dist/templates/runtime-bundles/shared-kernel/lib/verify-runner.mjs +1 -1
- package/dist/templates/shared-docs/readme/maintaining-this-harness.md +3 -3
- package/package.json +1 -1
- package/dist/templates/runtime-bundles/pm2-runtime/attach.sh +0 -53
- package/dist/templates/runtime-bundles/shared-kernel/agent-cli.sh +0 -52
- package/dist/templates/runtime-bundles/shared-kernel/launch.sh +0 -52
- package/dist/templates/runtime-bundles/shared-kernel/preflight.sh +0 -52
- package/dist/templates/runtime-bundles/shared-kernel/setup-infra.sh +0 -52
- package/dist/templates/runtime-bundles/shared-kernel/teardown.sh +0 -52
- package/dist/templates/runtime-bundles/shared-kernel/verify.sh +0 -52
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# Launch an isolated agent environment slot (fresh suffixed worktree; occupied slots block).
|
|
3
|
-
# The runtime lives in the HAR package (#234) — this file only forwards to it.
|
|
4
|
-
# Usage: ./.har/launch.sh <agent-id> [--no-worktree] [--resume]
|
|
5
|
-
set -euo pipefail
|
|
6
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
7
|
-
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
8
|
-
# Loop guard (#291): a pre-1.0 har does not own this runtime kind in the
|
|
9
|
-
# package — it executes this script as authoritative, which would exec back
|
|
10
|
-
# into har forever (one node process per cycle). Trip on re-entry for this
|
|
11
|
-
# harness root, and skip har binaries older than the pinned runtime (#298).
|
|
12
|
-
HAR_SHIM_GUARD="launch@${REPO_ROOT}"
|
|
13
|
-
case ":${HAR_SHIM_REENTRY:-}:" in *":${HAR_SHIM_GUARD}:"*)
|
|
14
|
-
echo "Error: runtime loop detected — the har CLI that ran this shim delegated back into it." >&2
|
|
15
|
-
echo " The har runtime handling this repo is older than the harness contract (pinned: @osfactory/har@__HAR_VERSION__)." >&2
|
|
16
|
-
echo " Fix: npm i -g @osfactory/har@latest # or in this repo: npm i -D @osfactory/har" >&2
|
|
17
|
-
exit 86
|
|
18
|
-
;;
|
|
19
|
-
esac
|
|
20
|
-
export HAR_SHIM_REENTRY="${HAR_SHIM_REENTRY:-}:${HAR_SHIM_GUARD}"
|
|
21
|
-
# True when $1 reports a version >= the pinned runtime. Comparing only the
|
|
22
|
-
# major (#298) made the floor inert for the whole 0.x line: every pre-1.0 har
|
|
23
|
-
# passed it and then bounced straight back into this shim. Compare the full
|
|
24
|
-
# release triple, and treat anything unparseable as unusable.
|
|
25
|
-
har_runtime_compatible() {
|
|
26
|
-
local v pinned="__HAR_VERSION__" i a b
|
|
27
|
-
v="$("$1" --version 2>/dev/null | head -n1)" || return 1
|
|
28
|
-
v="${v#v}"
|
|
29
|
-
v="${v%%[-+ ]*}"
|
|
30
|
-
local -a have pin
|
|
31
|
-
IFS=. read -r -a have <<<"$v"
|
|
32
|
-
IFS=. read -r -a pin <<<"${pinned%%[-+]*}"
|
|
33
|
-
for i in 0 1 2; do
|
|
34
|
-
a="${have[i]:-0}"
|
|
35
|
-
b="${pin[i]:-0}"
|
|
36
|
-
case "$a" in ''|*[!0-9]*) return 1 ;; esac
|
|
37
|
-
case "$b" in ''|*[!0-9]*) return 1 ;; esac
|
|
38
|
-
[ "$a" -gt "$b" ] && return 0
|
|
39
|
-
[ "$a" -lt "$b" ] && return 1
|
|
40
|
-
done
|
|
41
|
-
return 0
|
|
42
|
-
}
|
|
43
|
-
if command -v har >/dev/null 2>&1 && har_runtime_compatible har; then
|
|
44
|
-
exec har env launch "$@"
|
|
45
|
-
elif [ -x "$REPO_ROOT/node_modules/.bin/har" ] && har_runtime_compatible "$REPO_ROOT/node_modules/.bin/har"; then
|
|
46
|
-
exec "$REPO_ROOT/node_modules/.bin/har" env launch "$@"
|
|
47
|
-
elif command -v npx >/dev/null 2>&1; then
|
|
48
|
-
exec npx --yes @osfactory/har@__HAR_VERSION__ env launch "$@"
|
|
49
|
-
fi
|
|
50
|
-
echo "Error: cannot run the HAR runtime — 'har' is not on PATH and Node.js (npx) is unavailable." >&2
|
|
51
|
-
echo " Install Node.js, then: npm i -D @osfactory/har # or: npx @osfactory/har@__HAR_VERSION__ env launch" >&2
|
|
52
|
-
exit 127
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# Launch readiness gate — run before launch.sh or standalone.
|
|
3
|
-
# The runtime lives in the HAR package (#234) — this file only forwards to it.
|
|
4
|
-
# Usage: ./.har/preflight.sh <agent-id>
|
|
5
|
-
set -euo pipefail
|
|
6
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
7
|
-
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
8
|
-
# Loop guard (#291): a pre-1.0 har does not own this runtime kind in the
|
|
9
|
-
# package — it executes this script as authoritative, which would exec back
|
|
10
|
-
# into har forever (one node process per cycle). Trip on re-entry for this
|
|
11
|
-
# harness root, and skip har binaries older than the pinned runtime (#298).
|
|
12
|
-
HAR_SHIM_GUARD="preflight@${REPO_ROOT}"
|
|
13
|
-
case ":${HAR_SHIM_REENTRY:-}:" in *":${HAR_SHIM_GUARD}:"*)
|
|
14
|
-
echo "Error: runtime loop detected — the har CLI that ran this shim delegated back into it." >&2
|
|
15
|
-
echo " The har runtime handling this repo is older than the harness contract (pinned: @osfactory/har@__HAR_VERSION__)." >&2
|
|
16
|
-
echo " Fix: npm i -g @osfactory/har@latest # or in this repo: npm i -D @osfactory/har" >&2
|
|
17
|
-
exit 86
|
|
18
|
-
;;
|
|
19
|
-
esac
|
|
20
|
-
export HAR_SHIM_REENTRY="${HAR_SHIM_REENTRY:-}:${HAR_SHIM_GUARD}"
|
|
21
|
-
# True when $1 reports a version >= the pinned runtime. Comparing only the
|
|
22
|
-
# major (#298) made the floor inert for the whole 0.x line: every pre-1.0 har
|
|
23
|
-
# passed it and then bounced straight back into this shim. Compare the full
|
|
24
|
-
# release triple, and treat anything unparseable as unusable.
|
|
25
|
-
har_runtime_compatible() {
|
|
26
|
-
local v pinned="__HAR_VERSION__" i a b
|
|
27
|
-
v="$("$1" --version 2>/dev/null | head -n1)" || return 1
|
|
28
|
-
v="${v#v}"
|
|
29
|
-
v="${v%%[-+ ]*}"
|
|
30
|
-
local -a have pin
|
|
31
|
-
IFS=. read -r -a have <<<"$v"
|
|
32
|
-
IFS=. read -r -a pin <<<"${pinned%%[-+]*}"
|
|
33
|
-
for i in 0 1 2; do
|
|
34
|
-
a="${have[i]:-0}"
|
|
35
|
-
b="${pin[i]:-0}"
|
|
36
|
-
case "$a" in ''|*[!0-9]*) return 1 ;; esac
|
|
37
|
-
case "$b" in ''|*[!0-9]*) return 1 ;; esac
|
|
38
|
-
[ "$a" -gt "$b" ] && return 0
|
|
39
|
-
[ "$a" -lt "$b" ] && return 1
|
|
40
|
-
done
|
|
41
|
-
return 0
|
|
42
|
-
}
|
|
43
|
-
if command -v har >/dev/null 2>&1 && har_runtime_compatible har; then
|
|
44
|
-
exec har env preflight "$@"
|
|
45
|
-
elif [ -x "$REPO_ROOT/node_modules/.bin/har" ] && har_runtime_compatible "$REPO_ROOT/node_modules/.bin/har"; then
|
|
46
|
-
exec "$REPO_ROOT/node_modules/.bin/har" env preflight "$@"
|
|
47
|
-
elif command -v npx >/dev/null 2>&1; then
|
|
48
|
-
exec npx --yes @osfactory/har@__HAR_VERSION__ env preflight "$@"
|
|
49
|
-
fi
|
|
50
|
-
echo "Error: cannot run the HAR runtime — 'har' is not on PATH and Node.js (npx) is unavailable." >&2
|
|
51
|
-
echo " Install Node.js, then: npm i -D @osfactory/har # or: npx @osfactory/har@__HAR_VERSION__ env preflight" >&2
|
|
52
|
-
exit 127
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# Set up shared infrastructure for all agent slots. Idempotent.
|
|
3
|
-
# The runtime lives in the HAR package (#234) — this file only forwards to it.
|
|
4
|
-
# Usage: ./.har/setup-infra.sh
|
|
5
|
-
set -euo pipefail
|
|
6
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
7
|
-
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
8
|
-
# Loop guard (#291): a pre-1.0 har does not own this runtime kind in the
|
|
9
|
-
# package — it executes this script as authoritative, which would exec back
|
|
10
|
-
# into har forever (one node process per cycle). Trip on re-entry for this
|
|
11
|
-
# harness root, and skip har binaries older than the pinned runtime (#298).
|
|
12
|
-
HAR_SHIM_GUARD="setup-infra@${REPO_ROOT}"
|
|
13
|
-
case ":${HAR_SHIM_REENTRY:-}:" in *":${HAR_SHIM_GUARD}:"*)
|
|
14
|
-
echo "Error: runtime loop detected — the har CLI that ran this shim delegated back into it." >&2
|
|
15
|
-
echo " The har runtime handling this repo is older than the harness contract (pinned: @osfactory/har@__HAR_VERSION__)." >&2
|
|
16
|
-
echo " Fix: npm i -g @osfactory/har@latest # or in this repo: npm i -D @osfactory/har" >&2
|
|
17
|
-
exit 86
|
|
18
|
-
;;
|
|
19
|
-
esac
|
|
20
|
-
export HAR_SHIM_REENTRY="${HAR_SHIM_REENTRY:-}:${HAR_SHIM_GUARD}"
|
|
21
|
-
# True when $1 reports a version >= the pinned runtime. Comparing only the
|
|
22
|
-
# major (#298) made the floor inert for the whole 0.x line: every pre-1.0 har
|
|
23
|
-
# passed it and then bounced straight back into this shim. Compare the full
|
|
24
|
-
# release triple, and treat anything unparseable as unusable.
|
|
25
|
-
har_runtime_compatible() {
|
|
26
|
-
local v pinned="__HAR_VERSION__" i a b
|
|
27
|
-
v="$("$1" --version 2>/dev/null | head -n1)" || return 1
|
|
28
|
-
v="${v#v}"
|
|
29
|
-
v="${v%%[-+ ]*}"
|
|
30
|
-
local -a have pin
|
|
31
|
-
IFS=. read -r -a have <<<"$v"
|
|
32
|
-
IFS=. read -r -a pin <<<"${pinned%%[-+]*}"
|
|
33
|
-
for i in 0 1 2; do
|
|
34
|
-
a="${have[i]:-0}"
|
|
35
|
-
b="${pin[i]:-0}"
|
|
36
|
-
case "$a" in ''|*[!0-9]*) return 1 ;; esac
|
|
37
|
-
case "$b" in ''|*[!0-9]*) return 1 ;; esac
|
|
38
|
-
[ "$a" -gt "$b" ] && return 0
|
|
39
|
-
[ "$a" -lt "$b" ] && return 1
|
|
40
|
-
done
|
|
41
|
-
return 0
|
|
42
|
-
}
|
|
43
|
-
if command -v har >/dev/null 2>&1 && har_runtime_compatible har; then
|
|
44
|
-
exec har env setup-infra "$@"
|
|
45
|
-
elif [ -x "$REPO_ROOT/node_modules/.bin/har" ] && har_runtime_compatible "$REPO_ROOT/node_modules/.bin/har"; then
|
|
46
|
-
exec "$REPO_ROOT/node_modules/.bin/har" env setup-infra "$@"
|
|
47
|
-
elif command -v npx >/dev/null 2>&1; then
|
|
48
|
-
exec npx --yes @osfactory/har@__HAR_VERSION__ env setup-infra "$@"
|
|
49
|
-
fi
|
|
50
|
-
echo "Error: cannot run the HAR runtime — 'har' is not on PATH and Node.js (npx) is unavailable." >&2
|
|
51
|
-
echo " Install Node.js, then: npm i -D @osfactory/har # or: npx @osfactory/har@__HAR_VERSION__ env setup-infra" >&2
|
|
52
|
-
exit 127
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# Tear down one agent slot: stop processes, release resources, keep the session branch.
|
|
3
|
-
# The runtime lives in the HAR package (#234) — this file only forwards to it.
|
|
4
|
-
# Usage: ./.har/teardown.sh <agent-id> [--delete-branch]
|
|
5
|
-
set -euo pipefail
|
|
6
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
7
|
-
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
8
|
-
# Loop guard (#291): a pre-1.0 har does not own this runtime kind in the
|
|
9
|
-
# package — it executes this script as authoritative, which would exec back
|
|
10
|
-
# into har forever (one node process per cycle). Trip on re-entry for this
|
|
11
|
-
# harness root, and skip har binaries older than the pinned runtime (#298).
|
|
12
|
-
HAR_SHIM_GUARD="teardown@${REPO_ROOT}"
|
|
13
|
-
case ":${HAR_SHIM_REENTRY:-}:" in *":${HAR_SHIM_GUARD}:"*)
|
|
14
|
-
echo "Error: runtime loop detected — the har CLI that ran this shim delegated back into it." >&2
|
|
15
|
-
echo " The har runtime handling this repo is older than the harness contract (pinned: @osfactory/har@__HAR_VERSION__)." >&2
|
|
16
|
-
echo " Fix: npm i -g @osfactory/har@latest # or in this repo: npm i -D @osfactory/har" >&2
|
|
17
|
-
exit 86
|
|
18
|
-
;;
|
|
19
|
-
esac
|
|
20
|
-
export HAR_SHIM_REENTRY="${HAR_SHIM_REENTRY:-}:${HAR_SHIM_GUARD}"
|
|
21
|
-
# True when $1 reports a version >= the pinned runtime. Comparing only the
|
|
22
|
-
# major (#298) made the floor inert for the whole 0.x line: every pre-1.0 har
|
|
23
|
-
# passed it and then bounced straight back into this shim. Compare the full
|
|
24
|
-
# release triple, and treat anything unparseable as unusable.
|
|
25
|
-
har_runtime_compatible() {
|
|
26
|
-
local v pinned="__HAR_VERSION__" i a b
|
|
27
|
-
v="$("$1" --version 2>/dev/null | head -n1)" || return 1
|
|
28
|
-
v="${v#v}"
|
|
29
|
-
v="${v%%[-+ ]*}"
|
|
30
|
-
local -a have pin
|
|
31
|
-
IFS=. read -r -a have <<<"$v"
|
|
32
|
-
IFS=. read -r -a pin <<<"${pinned%%[-+]*}"
|
|
33
|
-
for i in 0 1 2; do
|
|
34
|
-
a="${have[i]:-0}"
|
|
35
|
-
b="${pin[i]:-0}"
|
|
36
|
-
case "$a" in ''|*[!0-9]*) return 1 ;; esac
|
|
37
|
-
case "$b" in ''|*[!0-9]*) return 1 ;; esac
|
|
38
|
-
[ "$a" -gt "$b" ] && return 0
|
|
39
|
-
[ "$a" -lt "$b" ] && return 1
|
|
40
|
-
done
|
|
41
|
-
return 0
|
|
42
|
-
}
|
|
43
|
-
if command -v har >/dev/null 2>&1 && har_runtime_compatible har; then
|
|
44
|
-
exec har env teardown "$@"
|
|
45
|
-
elif [ -x "$REPO_ROOT/node_modules/.bin/har" ] && har_runtime_compatible "$REPO_ROOT/node_modules/.bin/har"; then
|
|
46
|
-
exec "$REPO_ROOT/node_modules/.bin/har" env teardown "$@"
|
|
47
|
-
elif command -v npx >/dev/null 2>&1; then
|
|
48
|
-
exec npx --yes @osfactory/har@__HAR_VERSION__ env teardown "$@"
|
|
49
|
-
fi
|
|
50
|
-
echo "Error: cannot run the HAR runtime — 'har' is not on PATH and Node.js (npx) is unavailable." >&2
|
|
51
|
-
echo " Install Node.js, then: npm i -D @osfactory/har # or: npx @osfactory/har@__HAR_VERSION__ env teardown" >&2
|
|
52
|
-
exit 127
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# Verification pipeline (stages.json verificationStages; quick by default, --full for the whole list).
|
|
3
|
-
# The runtime lives in the HAR package (#234) — this file only forwards to it.
|
|
4
|
-
# Usage: ./.har/verify.sh <agent-id> [--full] [--json] (human output; pass --json for the structured result)
|
|
5
|
-
set -euo pipefail
|
|
6
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
7
|
-
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
8
|
-
# Loop guard (#291): a pre-1.0 har does not own this runtime kind in the
|
|
9
|
-
# package — it executes this script as authoritative, which would exec back
|
|
10
|
-
# into har forever (one node process per cycle). Trip on re-entry for this
|
|
11
|
-
# harness root, and skip har binaries older than the pinned runtime (#298).
|
|
12
|
-
HAR_SHIM_GUARD="verify@${REPO_ROOT}"
|
|
13
|
-
case ":${HAR_SHIM_REENTRY:-}:" in *":${HAR_SHIM_GUARD}:"*)
|
|
14
|
-
echo "Error: runtime loop detected — the har CLI that ran this shim delegated back into it." >&2
|
|
15
|
-
echo " The har runtime handling this repo is older than the harness contract (pinned: @osfactory/har@__HAR_VERSION__)." >&2
|
|
16
|
-
echo " Fix: npm i -g @osfactory/har@latest # or in this repo: npm i -D @osfactory/har" >&2
|
|
17
|
-
exit 86
|
|
18
|
-
;;
|
|
19
|
-
esac
|
|
20
|
-
export HAR_SHIM_REENTRY="${HAR_SHIM_REENTRY:-}:${HAR_SHIM_GUARD}"
|
|
21
|
-
# True when $1 reports a version >= the pinned runtime. Comparing only the
|
|
22
|
-
# major (#298) made the floor inert for the whole 0.x line: every pre-1.0 har
|
|
23
|
-
# passed it and then bounced straight back into this shim. Compare the full
|
|
24
|
-
# release triple, and treat anything unparseable as unusable.
|
|
25
|
-
har_runtime_compatible() {
|
|
26
|
-
local v pinned="__HAR_VERSION__" i a b
|
|
27
|
-
v="$("$1" --version 2>/dev/null | head -n1)" || return 1
|
|
28
|
-
v="${v#v}"
|
|
29
|
-
v="${v%%[-+ ]*}"
|
|
30
|
-
local -a have pin
|
|
31
|
-
IFS=. read -r -a have <<<"$v"
|
|
32
|
-
IFS=. read -r -a pin <<<"${pinned%%[-+]*}"
|
|
33
|
-
for i in 0 1 2; do
|
|
34
|
-
a="${have[i]:-0}"
|
|
35
|
-
b="${pin[i]:-0}"
|
|
36
|
-
case "$a" in ''|*[!0-9]*) return 1 ;; esac
|
|
37
|
-
case "$b" in ''|*[!0-9]*) return 1 ;; esac
|
|
38
|
-
[ "$a" -gt "$b" ] && return 0
|
|
39
|
-
[ "$a" -lt "$b" ] && return 1
|
|
40
|
-
done
|
|
41
|
-
return 0
|
|
42
|
-
}
|
|
43
|
-
if command -v har >/dev/null 2>&1 && har_runtime_compatible har; then
|
|
44
|
-
exec har env verify "$@"
|
|
45
|
-
elif [ -x "$REPO_ROOT/node_modules/.bin/har" ] && har_runtime_compatible "$REPO_ROOT/node_modules/.bin/har"; then
|
|
46
|
-
exec "$REPO_ROOT/node_modules/.bin/har" env verify "$@"
|
|
47
|
-
elif command -v npx >/dev/null 2>&1; then
|
|
48
|
-
exec npx --yes @osfactory/har@__HAR_VERSION__ env verify "$@"
|
|
49
|
-
fi
|
|
50
|
-
echo "Error: cannot run the HAR runtime — 'har' is not on PATH and Node.js (npx) is unavailable." >&2
|
|
51
|
-
echo " Install Node.js, then: npm i -D @osfactory/har # or: npx @osfactory/har@__HAR_VERSION__ env verify" >&2
|
|
52
|
-
exit 127
|