@osfactory/har 0.64.2 → 1.0.0-rc.2
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 +15751 -6548
- package/dist/prompts/system-authoring.md +155 -0
- package/dist/templates/adaptation-prompt-init.md +67 -43
- package/dist/templates/adaptation-prompt-maintain.md +38 -38
- package/dist/templates/adaptation-prompt-plugin.md +40 -0
- package/dist/templates/agent-skills/har-maintain.md +2 -2
- package/dist/templates/agent-skills/setup-har.md +6 -4
- package/dist/templates/cursor-rule.mdc.template +3 -3
- package/dist/templates/har-boilerplate/docker-compose.agent.yml +1 -1
- package/dist/templates/har-boilerplate/harness.env +11 -155
- package/dist/templates/har-boilerplate/stages.json +51 -2
- package/dist/templates/har-boilerplate-cli/docker-compose.agent.yml +1 -1
- package/dist/templates/har-boilerplate-cli/harness.env +12 -138
- package/dist/templates/har-boilerplate-cli/stages.json +42 -2
- package/dist/templates/har-boilerplate-ios/harness.env +10 -126
- package/dist/templates/har-boilerplate-ios/stages.json +42 -2
- package/dist/templates/migration-prompt.md +54 -0
- package/dist/templates/plugins/custom-stage-skeleton.sh +11 -20
- package/dist/templates/plugins/gitleaks/.github/workflows/gitleaks.yml +1 -1
- package/dist/templates/plugins/gitleaks/.har/stages/GITLEAKS.md +1 -1
- package/dist/templates/plugins/gitleaks/.har/stages/secrets-scan.sh +8 -23
- package/dist/templates/plugins/gitleaks/README.md +1 -1
- package/dist/templates/plugins/gitleaks/template.manifest.json +20 -5
- package/dist/templates/plugins/kerno/.github/workflows/kerno.yml +1 -1
- package/dist/templates/plugins/kerno/.har/stages/backend-validation.sh +8 -23
- package/dist/templates/plugins/kerno/README.md +1 -1
- package/dist/templates/plugins/kerno/template.manifest.json +20 -9
- package/dist/templates/plugins/local-plugin-skeleton/README.md +46 -0
- package/dist/templates/plugins/playwright/.har/stages/browser-e2e.sh +8 -23
- package/dist/templates/plugins/playwright/template.manifest.json +36 -13
- package/dist/templates/plugins/rocketsim/.har/stages/rocketsim-flows.sh +8 -23
- package/dist/templates/plugins/rocketsim/template.manifest.json +20 -8
- package/dist/templates/plugins/semgrep/.har/stages/sast.sh +10 -26
- package/dist/templates/plugins/semgrep/README.md +1 -1
- package/dist/templates/plugins/semgrep/template.manifest.json +16 -7
- package/dist/templates/plugins/trivy/.har/stages/vuln-scan.sh +8 -23
- package/dist/templates/plugins/trivy/README.md +1 -1
- package/dist/templates/plugins/trivy/template.manifest.json +20 -8
- package/dist/templates/{har-boilerplate-cli/CLAUDE.agent.md → profiles/cli/docs/claude-agent/definition-of-done.md} +0 -42
- package/dist/templates/profiles/cli/docs/claude-agent/do-not.md +6 -0
- package/dist/templates/profiles/cli/docs/claude-agent/environment.md +12 -0
- package/dist/templates/profiles/cli/docs/claude-agent/project-commands.md +10 -0
- package/dist/templates/profiles/cli/docs/claude-agent/readiness.md +6 -0
- package/dist/templates/profiles/cli/docs/readme/for-coding-agents.md +9 -0
- package/dist/templates/profiles/cli/docs/readme/intro.md +7 -0
- package/dist/templates/profiles/cli/docs/readme/port-shared-services-cli-profile.md +25 -0
- package/dist/templates/profiles/cli/docs/readme/quick-start.md +24 -0
- package/dist/templates/profiles/cli/docs/readme/verification-contract.md +22 -0
- package/dist/templates/profiles/cli/docs/readme/what-s-in-here.md +27 -0
- package/dist/templates/profiles/cli/profile.manifest.json +56 -1
- package/dist/templates/profiles/default/docs/claude-agent/definition-of-done.md +24 -0
- package/dist/templates/profiles/default/docs/claude-agent/do-not.md +10 -0
- package/dist/templates/profiles/default/docs/claude-agent/environment.md +19 -0
- package/dist/templates/profiles/default/docs/claude-agent/project-commands.md +10 -0
- package/dist/templates/profiles/default/docs/claude-agent/readiness.md +12 -0
- package/dist/templates/profiles/default/docs/readme/architecture.md +11 -0
- package/dist/templates/profiles/default/docs/readme/for-coding-agents.md +9 -0
- package/dist/templates/profiles/default/docs/readme/intro.md +7 -0
- package/dist/templates/profiles/default/docs/readme/port-shared-services.md +41 -0
- package/dist/templates/profiles/default/docs/readme/quick-start.md +24 -0
- package/dist/templates/profiles/default/docs/readme/readiness-layers.md +16 -0
- package/dist/templates/profiles/default/docs/readme/verification-contract.md +17 -0
- package/dist/templates/profiles/default/docs/readme/what-s-in-here.md +28 -0
- package/dist/templates/profiles/default/profile.manifest.json +62 -1
- package/dist/templates/profiles/ios/docs/claude-agent/definition-of-done.md +23 -0
- package/dist/templates/profiles/ios/docs/claude-agent/do-not.md +6 -0
- package/dist/templates/profiles/ios/docs/claude-agent/environment.md +14 -0
- package/dist/templates/profiles/ios/docs/claude-agent/intro.md +3 -0
- package/dist/templates/profiles/ios/docs/claude-agent/project-commands.md +21 -0
- package/dist/templates/profiles/ios/docs/claude-agent/readiness.md +6 -0
- package/dist/templates/profiles/ios/docs/claude-agent/user-flow-validation-rocketsim.md +11 -0
- package/dist/templates/profiles/ios/docs/readme/configuration.md +7 -0
- package/dist/templates/profiles/ios/docs/readme/intro.md +7 -0
- package/dist/templates/profiles/ios/docs/readme/port-shared-services-ios-profile.md +25 -0
- package/dist/templates/profiles/ios/docs/readme/quick-start.md +22 -0
- package/dist/templates/profiles/ios/docs/readme/simulators.md +45 -0
- package/dist/templates/profiles/ios/docs/readme/user-flow-validation.md +9 -0
- package/dist/templates/profiles/ios/docs/readme/verification-contract.md +13 -0
- package/dist/templates/profiles/ios/docs/readme/what-s-in-here.md +27 -0
- package/dist/templates/profiles/ios/profile.manifest.json +59 -3
- package/dist/templates/runtime-bundles/pm2-runtime/attach.sh +8 -15
- package/dist/templates/runtime-bundles/pm2-runtime/env.template +1 -1
- package/dist/templates/runtime-bundles/pm2-runtime/stages/api-health.sh +9 -0
- package/dist/templates/runtime-bundles/shared-kernel/STAGES.md +32 -18
- package/dist/templates/runtime-bundles/shared-kernel/agent-cli.sh +35 -0
- package/dist/templates/runtime-bundles/shared-kernel/launch.sh +35 -0
- package/dist/templates/runtime-bundles/shared-kernel/lib/verify-runner.mjs +129 -0
- package/dist/templates/runtime-bundles/shared-kernel/preflight.sh +35 -0
- package/dist/templates/runtime-bundles/shared-kernel/setup-infra.sh +35 -0
- package/dist/templates/runtime-bundles/shared-kernel/stages/README.sh +1 -1
- package/dist/templates/runtime-bundles/shared-kernel/stages/readiness.sh +14 -0
- package/dist/templates/runtime-bundles/shared-kernel/teardown.sh +35 -0
- package/dist/templates/runtime-bundles/shared-kernel/verify.sh +35 -0
- package/dist/templates/shared-docs/claude-agent/intro.md +3 -0
- package/dist/templates/shared-docs/readme/maintaining-this-harness.md +14 -0
- package/dist/templates/shared-docs/readme/run-history.md +5 -0
- package/dist/templates/shared-docs/readme/session-lifecycle.md +20 -0
- package/package.json +1 -1
- package/dist/templates/har-boilerplate/CLAUDE.agent.md +0 -83
- package/dist/templates/har-boilerplate/README.md +0 -199
- package/dist/templates/har-boilerplate/STAGES.md +0 -99
- package/dist/templates/har-boilerplate/agent-cli.sh +0 -225
- package/dist/templates/har-boilerplate/agent-slot.sh +0 -850
- package/dist/templates/har-boilerplate/attach.sh +0 -22
- package/dist/templates/har-boilerplate/ecosystem.agent.template.cjs +0 -52
- package/dist/templates/har-boilerplate/env.template +0 -40
- package/dist/templates/har-boilerplate/launch.sh +0 -323
- package/dist/templates/har-boilerplate/preflight.sh +0 -32
- package/dist/templates/har-boilerplate/provision-toolchain.sh +0 -766
- package/dist/templates/har-boilerplate/setup-infra.sh +0 -178
- package/dist/templates/har-boilerplate/stages/README.sh +0 -11
- package/dist/templates/har-boilerplate/teardown.sh +0 -87
- package/dist/templates/har-boilerplate/verify.sh +0 -249
- package/dist/templates/har-boilerplate-cli/README.md +0 -157
- package/dist/templates/har-boilerplate-cli/STAGES.md +0 -99
- package/dist/templates/har-boilerplate-cli/agent-cli.sh +0 -160
- package/dist/templates/har-boilerplate-cli/agent-slot.sh +0 -832
- package/dist/templates/har-boilerplate-cli/launch.sh +0 -216
- package/dist/templates/har-boilerplate-cli/preflight.sh +0 -28
- package/dist/templates/har-boilerplate-cli/provision-toolchain.sh +0 -766
- package/dist/templates/har-boilerplate-cli/setup-infra.sh +0 -178
- package/dist/templates/har-boilerplate-cli/stages/README.sh +0 -11
- package/dist/templates/har-boilerplate-cli/teardown.sh +0 -66
- package/dist/templates/har-boilerplate-cli/verify.sh +0 -210
- package/dist/templates/har-boilerplate-ios/ADAPT-PROMPT.md +0 -63
- package/dist/templates/har-boilerplate-ios/CLAUDE.agent.md +0 -90
- package/dist/templates/har-boilerplate-ios/README.md +0 -173
- package/dist/templates/har-boilerplate-ios/STAGES.md +0 -99
- package/dist/templates/har-boilerplate-ios/agent-cli.sh +0 -149
- package/dist/templates/har-boilerplate-ios/agent-slot.sh +0 -479
- package/dist/templates/har-boilerplate-ios/launch.sh +0 -206
- package/dist/templates/har-boilerplate-ios/provision-toolchain.sh +0 -766
- package/dist/templates/har-boilerplate-ios/setup-infra.sh +0 -112
- package/dist/templates/har-boilerplate-ios/simulator.sh +0 -492
- package/dist/templates/har-boilerplate-ios/stages/README.sh +0 -11
- package/dist/templates/har-boilerplate-ios/teardown.sh +0 -68
- package/dist/templates/har-boilerplate-ios/verify.sh +0 -185
- package/dist/templates/runtime-bundles/pm2-runtime/README.md +0 -4
- package/dist/templates/runtime-bundles/shared-kernel/README.md +0 -3
- package/dist/templates/runtime-bundles/shared-kernel/provision-toolchain.sh +0 -766
- package/dist/templates/runtime-bundles/xcode-sim/README.md +0 -4
- package/dist/templates/runtime-bundles/xcode-sim/simulator.sh +0 -492
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# Launch an agent slot for CLI/library repos (git worktree by default, optional Docker infra).
|
|
3
|
-
# Every launch starts a FRESH session: any previous session for the slot is torn
|
|
4
|
-
# down (its branch is kept) and a new suffixed worktree is created from HEAD.
|
|
5
|
-
# Occupied slots always block: run ./.har/teardown.sh (or complete it) first, then relaunch.
|
|
6
|
-
#
|
|
7
|
-
# Usage: ./.har/launch.sh <agent-id> [--no-worktree] [--resume]
|
|
8
|
-
set -euo pipefail
|
|
9
|
-
|
|
10
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
11
|
-
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
12
|
-
|
|
13
|
-
# shellcheck source=/dev/null
|
|
14
|
-
source "$SCRIPT_DIR/harness.env"
|
|
15
|
-
# shellcheck source=/dev/null
|
|
16
|
-
source "$SCRIPT_DIR/agent-slot.sh"
|
|
17
|
-
|
|
18
|
-
AGENT_ID="${1:-}"
|
|
19
|
-
USE_WORKTREE="${HARNESS_USE_WORKTREE:-true}"
|
|
20
|
-
RESUME=false
|
|
21
|
-
WORK_UNIT_ID="${HAR_WORK_UNIT_ID:-}"
|
|
22
|
-
ATTEMPT_ID="${HAR_ATTEMPT_ID:-}"
|
|
23
|
-
|
|
24
|
-
for arg in "$@"; do
|
|
25
|
-
case "$arg" in
|
|
26
|
-
--no-worktree) USE_WORKTREE=false ;;
|
|
27
|
-
--worktree) USE_WORKTREE=true ;;
|
|
28
|
-
--resume) RESUME=true ;;
|
|
29
|
-
--work-id=*) WORK_UNIT_ID="${arg#*=}" ;;
|
|
30
|
-
--attempt-id=*) ATTEMPT_ID="${arg#*=}" ;;
|
|
31
|
-
esac
|
|
32
|
-
done
|
|
33
|
-
|
|
34
|
-
if [[ -n "$WORK_UNIT_ID" && -z "$ATTEMPT_ID" ]]; then
|
|
35
|
-
ATTEMPT_ID="$(node -e 'process.stdout.write(require("crypto").randomUUID())')"
|
|
36
|
-
fi
|
|
37
|
-
export SLOT_WORK_UNIT_ID="$WORK_UNIT_ID"
|
|
38
|
-
export SLOT_ATTEMPT_ID="$ATTEMPT_ID"
|
|
39
|
-
|
|
40
|
-
if [[ -z "$AGENT_ID" ]]; then
|
|
41
|
-
har_load_agent_slot_limits
|
|
42
|
-
echo "Usage: $0 <agent-id> [--no-worktree] [--resume]" >&2
|
|
43
|
-
echo " agent-id must be between ${HARNESS_AGENT_SLOT_MIN} and ${HARNESS_AGENT_SLOT_MAX}" >&2
|
|
44
|
-
exit 1
|
|
45
|
-
fi
|
|
46
|
-
|
|
47
|
-
validate_agent_id "$AGENT_ID"
|
|
48
|
-
|
|
49
|
-
log() { echo "==> [agent-$AGENT_ID] $*" >&2; }
|
|
50
|
-
|
|
51
|
-
WORK_DIR="$REPO_ROOT"
|
|
52
|
-
WORKTREE_DIR=""
|
|
53
|
-
BRANCH=""
|
|
54
|
-
SUFFIX=""
|
|
55
|
-
BASE_BRANCH=""
|
|
56
|
-
BASE_COMMIT=""
|
|
57
|
-
ENV_FILE=""
|
|
58
|
-
REGISTRY_WRITTEN=false
|
|
59
|
-
|
|
60
|
-
if [ "$RESUME" = true ]; then
|
|
61
|
-
har_launch_preflight "$AGENT_ID" true || exit $?
|
|
62
|
-
eval "$(har_resume_session_assignments "$AGENT_ID")"
|
|
63
|
-
REGISTRY_WRITTEN=true
|
|
64
|
-
mark_slot_failed() {
|
|
65
|
-
local exit_code="$?"
|
|
66
|
-
if [ "$exit_code" != "0" ] && [ "$REGISTRY_WRITTEN" = true ]; then
|
|
67
|
-
log "Resume failed. Recording failed slot state..."
|
|
68
|
-
set +e
|
|
69
|
-
SLOT_AGENT_ID="$AGENT_ID" \
|
|
70
|
-
SLOT_MODE="$([ "$USE_WORKTREE" = true ] && echo worktree || echo root)" \
|
|
71
|
-
SLOT_WORK_DIR="$WORK_DIR" \
|
|
72
|
-
SLOT_SUFFIX="${SUFFIX:-}" \
|
|
73
|
-
SLOT_WORKTREE_PATH="${WORKTREE_DIR:-}" \
|
|
74
|
-
SLOT_BRANCH="${BRANCH:-}" \
|
|
75
|
-
SLOT_BASE_BRANCH="${BASE_BRANCH:-}" \
|
|
76
|
-
SLOT_BASE_COMMIT="${BASE_COMMIT:-}" \
|
|
77
|
-
SLOT_STATUS="failed" \
|
|
78
|
-
SLOT_LAST_ERROR="launch.sh --resume exited with code ${exit_code}" \
|
|
79
|
-
write_slot_registry
|
|
80
|
-
log " Work dir: ${WORK_DIR}"
|
|
81
|
-
log " Env file: ${ENV_FILE}"
|
|
82
|
-
log " Recovery: har env launch ${AGENT_ID} --resume # or ./.har/launch.sh ${AGENT_ID} --resume"
|
|
83
|
-
fi
|
|
84
|
-
}
|
|
85
|
-
trap mark_slot_failed EXIT
|
|
86
|
-
else
|
|
87
|
-
# Occupied slots always block here: teardown/complete first, then relaunch.
|
|
88
|
-
har_launch_preflight "$AGENT_ID" || exit $?
|
|
89
|
-
fi
|
|
90
|
-
|
|
91
|
-
"$SCRIPT_DIR/setup-infra.sh"
|
|
92
|
-
har_load_infra_state
|
|
93
|
-
|
|
94
|
-
if [ "$RESUME" != true ]; then
|
|
95
|
-
WORK_DIR="$REPO_ROOT"
|
|
96
|
-
WORKTREE_DIR=""
|
|
97
|
-
BRANCH=""
|
|
98
|
-
SUFFIX=""
|
|
99
|
-
BASE_BRANCH="$(git -C "$REPO_ROOT" rev-parse --abbrev-ref HEAD 2>/dev/null || echo "detached")"
|
|
100
|
-
BASE_COMMIT="$(git -C "$REPO_ROOT" rev-parse HEAD 2>/dev/null || true)"
|
|
101
|
-
if [ "$USE_WORKTREE" = true ]; then
|
|
102
|
-
SHORT_SHA="$(git -C "$REPO_ROOT" rev-parse --short=4 HEAD)"
|
|
103
|
-
SUFFIX="$(LC_ALL=C tr -dc 'a-z0-9' </dev/urandom 2>/dev/null | head -c 4 || true)"
|
|
104
|
-
[ -n "$SUFFIX" ] || SUFFIX="$(printf '%04d' $(( RANDOM % 10000 )))"
|
|
105
|
-
SESSION_NAME="${BASE_BRANCH//\//-}-${SHORT_SHA}-har-agent-${AGENT_ID}-${SUFFIX}"
|
|
106
|
-
BRANCH="$SESSION_NAME"
|
|
107
|
-
WORKTREE_DIR="$HOME/worktrees/${SESSION_NAME}"
|
|
108
|
-
log "Creating session worktree at $WORKTREE_DIR (branch $BRANCH)..."
|
|
109
|
-
git -C "$REPO_ROOT" worktree add "$WORKTREE_DIR" -b "$BRANCH"
|
|
110
|
-
REL_PREFIX="$(git -C "$REPO_ROOT" rev-parse --show-prefix 2>/dev/null || true)"
|
|
111
|
-
WORK_DIR="${WORKTREE_DIR%/}/${REL_PREFIX}"
|
|
112
|
-
WORK_DIR="${WORK_DIR%/}"
|
|
113
|
-
else
|
|
114
|
-
log "Using repo root (worktree disabled)"
|
|
115
|
-
REL_PREFIX="$(git -C "$REPO_ROOT" rev-parse --show-prefix 2>/dev/null || true)"
|
|
116
|
-
fi
|
|
117
|
-
|
|
118
|
-
GIT_EXCLUDE="$(git -C "$REPO_ROOT" rev-parse --git-common-dir 2>/dev/null)/info/exclude"
|
|
119
|
-
if [ -n "$GIT_EXCLUDE" ] && [ -d "$(dirname "$GIT_EXCLUDE")" ]; then
|
|
120
|
-
for pattern in '.env.agent.*' 'ecosystem.agent.*.config.cjs' '.har/venv'; do
|
|
121
|
-
grep -qxF "$pattern" "$GIT_EXCLUDE" 2>/dev/null || echo "$pattern" >> "$GIT_EXCLUDE"
|
|
122
|
-
done
|
|
123
|
-
fi
|
|
124
|
-
|
|
125
|
-
ENV_FILE="$WORK_DIR/.env.agent.${AGENT_ID}"
|
|
126
|
-
log "Generating $ENV_FILE..."
|
|
127
|
-
har_regenerate_agent_env_file "$AGENT_ID" "$WORK_DIR" "$ENV_FILE" "${WORKTREE_DIR:-}"
|
|
128
|
-
|
|
129
|
-
REGISTRY_WRITTEN=false
|
|
130
|
-
mark_slot_failed() {
|
|
131
|
-
local exit_code="$?"
|
|
132
|
-
if [ "$exit_code" != "0" ] && [ "$REGISTRY_WRITTEN" = true ]; then
|
|
133
|
-
log "Launch failed after creating the session. Recording failed slot state..."
|
|
134
|
-
set +e
|
|
135
|
-
SLOT_AGENT_ID="$AGENT_ID" \
|
|
136
|
-
SLOT_MODE="$([ "$USE_WORKTREE" = true ] && echo worktree || echo root)" \
|
|
137
|
-
SLOT_WORK_DIR="$WORK_DIR" \
|
|
138
|
-
SLOT_SUFFIX="${SUFFIX:-}" \
|
|
139
|
-
SLOT_WORKTREE_PATH="${WORKTREE_DIR:-}" \
|
|
140
|
-
SLOT_BRANCH="${BRANCH:-}" \
|
|
141
|
-
SLOT_BASE_BRANCH="${BASE_BRANCH:-}" \
|
|
142
|
-
SLOT_BASE_COMMIT="${BASE_COMMIT:-}" \
|
|
143
|
-
SLOT_STATUS="failed" \
|
|
144
|
-
SLOT_LAST_ERROR="launch.sh exited with code ${exit_code}" \
|
|
145
|
-
write_slot_registry
|
|
146
|
-
log " Work dir: ${WORK_DIR}"
|
|
147
|
-
log " Env file: ${ENV_FILE}"
|
|
148
|
-
log " Recovery: har env launch ${AGENT_ID} --resume # or ./.har/launch.sh ${AGENT_ID} --resume"
|
|
149
|
-
fi
|
|
150
|
-
}
|
|
151
|
-
trap mark_slot_failed EXIT
|
|
152
|
-
|
|
153
|
-
SLOT_AGENT_ID="$AGENT_ID" \
|
|
154
|
-
SLOT_MODE="$([ "$USE_WORKTREE" = true ] && echo worktree || echo root)" \
|
|
155
|
-
SLOT_WORK_DIR="$WORK_DIR" \
|
|
156
|
-
SLOT_SUFFIX="${SUFFIX:-}" \
|
|
157
|
-
SLOT_WORKTREE_PATH="${WORKTREE_DIR:-}" \
|
|
158
|
-
SLOT_BRANCH="${BRANCH:-}" \
|
|
159
|
-
SLOT_BASE_BRANCH="${BASE_BRANCH:-}" \
|
|
160
|
-
SLOT_BASE_COMMIT="${BASE_COMMIT:-}" \
|
|
161
|
-
SLOT_STATUS="starting" \
|
|
162
|
-
write_slot_registry
|
|
163
|
-
REGISTRY_WRITTEN=true
|
|
164
|
-
else
|
|
165
|
-
REL_PREFIX="$(git -C "$REPO_ROOT" rev-parse --show-prefix 2>/dev/null || true)"
|
|
166
|
-
log "Resuming session at ${WORK_DIR}"
|
|
167
|
-
har_regenerate_agent_env_file "$AGENT_ID" "$WORK_DIR" "$ENV_FILE" "${WORKTREE_DIR:-}"
|
|
168
|
-
SLOT_AGENT_ID="$AGENT_ID" \
|
|
169
|
-
SLOT_MODE="$([ "$USE_WORKTREE" = true ] && echo worktree || echo root)" \
|
|
170
|
-
SLOT_WORK_DIR="$WORK_DIR" \
|
|
171
|
-
SLOT_SUFFIX="${SUFFIX:-}" \
|
|
172
|
-
SLOT_WORKTREE_PATH="${WORKTREE_DIR:-}" \
|
|
173
|
-
SLOT_BRANCH="${BRANCH:-}" \
|
|
174
|
-
SLOT_BASE_BRANCH="${BASE_BRANCH:-}" \
|
|
175
|
-
SLOT_BASE_COMMIT="${BASE_COMMIT:-}" \
|
|
176
|
-
SLOT_STATUS="starting" \
|
|
177
|
-
write_slot_registry
|
|
178
|
-
fi
|
|
179
|
-
|
|
180
|
-
if [ "$RESUME" = true ] && har_toolchain_ready "$WORK_DIR"; then
|
|
181
|
-
log "Toolchain already provisioned — skipping install."
|
|
182
|
-
elif [ -f "$SCRIPT_DIR/provision-toolchain.sh" ]; then
|
|
183
|
-
log "Provisioning toolchain (see harness.env: HARNESS_ECOSYSTEM, HARNESS_INSTALL_CMD)..."
|
|
184
|
-
HAR_WORK_DIR="$WORK_DIR" \
|
|
185
|
-
HAR_ENV_FILE="$ENV_FILE" \
|
|
186
|
-
HAR_WORKTREE_DIR="${WORKTREE_DIR:-}" \
|
|
187
|
-
HAR_REL_PREFIX="${REL_PREFIX:-}" \
|
|
188
|
-
HAR_AGENT_ID="$AGENT_ID" \
|
|
189
|
-
"$SCRIPT_DIR/provision-toolchain.sh"
|
|
190
|
-
elif [ -f "$WORK_DIR/package.json" ] && [ ! -d "$WORK_DIR/node_modules" ]; then
|
|
191
|
-
PKG_MANAGER="$(har_node_package_manager "$WORK_DIR")"
|
|
192
|
-
log "Installing dependencies in $WORK_DIR with ${PKG_MANAGER}..."
|
|
193
|
-
har_node_install "$WORK_DIR" "$PKG_MANAGER" "$(har_node_declared_package_manager "$WORK_DIR")"
|
|
194
|
-
fi
|
|
195
|
-
|
|
196
|
-
SLOT_AGENT_ID="$AGENT_ID" \
|
|
197
|
-
SLOT_MODE="$([ "$USE_WORKTREE" = true ] && echo worktree || echo root)" \
|
|
198
|
-
SLOT_WORK_DIR="$WORK_DIR" \
|
|
199
|
-
SLOT_SUFFIX="${SUFFIX:-}" \
|
|
200
|
-
SLOT_WORKTREE_PATH="${WORKTREE_DIR:-}" \
|
|
201
|
-
SLOT_BRANCH="${BRANCH:-}" \
|
|
202
|
-
SLOT_BASE_BRANCH="${BASE_BRANCH:-}" \
|
|
203
|
-
SLOT_BASE_COMMIT="${BASE_COMMIT:-}" \
|
|
204
|
-
SLOT_STATUS="active" \
|
|
205
|
-
write_slot_registry
|
|
206
|
-
|
|
207
|
-
log "Agent $AGENT_ID is ready."
|
|
208
|
-
log ""
|
|
209
|
-
log " WORK DIR (make ALL file edits under this path — never the main checkout):"
|
|
210
|
-
log " ${WORK_DIR}"
|
|
211
|
-
if [ "$USE_WORKTREE" = true ]; then
|
|
212
|
-
log " Branch: ${BRANCH} (based on ${BASE_BRANCH} @ ${BASE_COMMIT})"
|
|
213
|
-
fi
|
|
214
|
-
log ""
|
|
215
|
-
log " Verify: ./.har/verify.sh $AGENT_ID"
|
|
216
|
-
log " Teardown: ./.har/teardown.sh $AGENT_ID (keeps the branch)"
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# Launch readiness gate for CLI/library harnesses (occupied slot only).
|
|
3
|
-
# Usage: ./.har/preflight.sh <agent-id>
|
|
4
|
-
set -euo pipefail
|
|
5
|
-
|
|
6
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
7
|
-
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
8
|
-
|
|
9
|
-
# shellcheck source=/dev/null
|
|
10
|
-
source "$SCRIPT_DIR/harness.env"
|
|
11
|
-
# shellcheck source=/dev/null
|
|
12
|
-
source "$SCRIPT_DIR/agent-slot.sh"
|
|
13
|
-
|
|
14
|
-
AGENT_ID="${1:-}"
|
|
15
|
-
|
|
16
|
-
if [[ -z "$AGENT_ID" ]]; then
|
|
17
|
-
echo "Usage: $0 <agent-id>" >&2
|
|
18
|
-
exit 1
|
|
19
|
-
fi
|
|
20
|
-
|
|
21
|
-
validate_agent_id "$AGENT_ID"
|
|
22
|
-
|
|
23
|
-
if har_launch_preflight "$AGENT_ID"; then
|
|
24
|
-
echo "Slot ${AGENT_ID}: ready to launch."
|
|
25
|
-
exit 0
|
|
26
|
-
fi
|
|
27
|
-
|
|
28
|
-
exit $?
|