caelum0x 49b183818c Unify gitgram + aitimemachine into the monorepo (de-submodule) and merge vendored engines
Convert gitgram/ and aitimemachine/ from embedded git repos (which showed as
opaque submodule gitlinks on GitHub) into fully-tracked first-party content.

AITM now merges its 7 vendored repos as first-party engines:
- memory: beads (Go task DAG) + context7 (docs SDK), unified into saved_contexts
- git: vendored C git (bundled binary) + gitnexus (in-process code intelligence)
- agentic: a2a (@a2a-js/sdk) + pal (AITM-managed Python subprocess)

Includes the full session's product build: Gitgram web/mobile/backend features,
AITM website/CLI/MCP, the unified memory layer, engine build tooling
(scripts/build-engines.sh, Dockerfile, CI), docs (README, ENGINES.md, ARCHITECTURE.md),
and extensive test suites.

Build artifacts, node_modules, external/, and gemini-cli are gitignored.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 14:14:09 +03:00

73 lines
1.5 KiB
Bash
Executable File

#!/usr/bin/env bash
# npm package gate.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
NPM_DIR="$REPO_ROOT/npm-package"
NPM_BIN="$NPM_DIR/bin/bd"
# shellcheck source=../../.buildflags
source "$REPO_ROOT/.buildflags"
# shellcheck source=lib/timing.sh
source "$REPO_ROOT/scripts/ci/lib/timing.sh"
backup_bin=""
created_bin=0
cleanup() {
if [[ "$created_bin" -eq 1 ]]; then
rm -f "$NPM_BIN"
fi
if [[ -n "$backup_bin" && -f "$backup_bin" ]]; then
mv -f "$backup_bin" "$NPM_BIN"
fi
}
trap cleanup EXIT
prepare_bd_binary() {
mkdir -p "$NPM_DIR/bin"
if [[ -e "$NPM_BIN" ]]; then
backup_bin="$(mktemp)"
mv -f "$NPM_BIN" "$backup_bin"
fi
if [[ -n "${BEADS_TEST_BD_BINARY:-}" ]]; then
cp "$BEADS_TEST_BD_BINARY" "$NPM_BIN"
else
go build -o "$NPM_BIN" ./cmd/bd
fi
chmod +x "$NPM_BIN"
created_bin=1
"$NPM_BIN" version
}
npm_install() {
cd "$NPM_DIR"
npm install
}
npm_test_all() {
cd "$NPM_DIR"
npm run test:all
}
npm_pack_dry_run() {
cd "$NPM_DIR"
npm pack --dry-run
}
cd "$REPO_ROOT"
# The package postinstall script downloads the latest published release when
# CI is not set. Package gates validate the candidate binary prepared above.
export CI="${CI:-1}"
ci_time "prepare bd for npm package" -- prepare_bd_binary
ci_time "npm package install" -- npm_install
ci_time "npm package test:all" -- npm_test_all
ci_time "npm package pack dry-run" -- npm_pack_dry_run