Initial state: - ia_dev was historically referenced as ./ia_dev in docs and integrations, while the vendored module lives under services/ia_dev. - AnythingLLM sync and hook installation had error masking / weak exit signaling. - Proxy layers did not validate proxy path segments, allowing path normalization tricks. Motivation: - Make the IDE-oriented workflow usable (sync -> act -> deploy/preview) with explicit errors. - Reduce security footguns in proxying and script automation. Resolution: - Standardize IA_DEV_ROOT usage and documentation to services/ia_dev. - Add SSH remote data mirroring + optional AnythingLLM ingestion. - Extend AnythingLLM pull sync to support upload-all/prefix and fail on upload errors. - Harden smart-ide-sso-gateway and smart-ide-global-api proxying with safe-path checks and non-leaking error responses. - Improve ia-dev-gateway runner validation and reduce sensitive path leakage. - Add site scaffold tool (Vite/React) with OIDC + chat via sso-gateway -> orchestrator. Root cause: - Historical layout changes (submodule -> vendored tree) and missing central contracts for path resolution. - Missing validation for proxy path traversal patterns. - Overuse of silent fallbacks (|| true, exit 0 on partial failures) in automation scripts. Impacted features: - Project sync: git pull + AnythingLLM sync + remote data mirror ingestion. - Site frontends: SSO gateway proxy and orchestrator intents (rag.query, chat.local). - Agent execution: ia-dev-gateway script runner and SSE output. Code modified: - scripts/remote-data-ssh-sync.sh - scripts/anythingllm-pull-sync/sync.mjs - scripts/install-anythingllm-post-merge-hook.sh - cron/git-pull-project-clones.sh - services/smart-ide-sso-gateway/src/server.ts - services/smart-ide-global-api/src/server.ts - services/smart-ide-orchestrator/src/server.ts - services/ia-dev-gateway/src/server.ts - services/ia_dev/tools/site-generate.sh Documentation modified: - docs/** (architecture, API docs, ia_dev module + integration, scripts) Configurations modified: - config/services.local.env.example - services/*/.env.example Files in deploy modified: - services/ia_dev/deploy/* Files in logs impacted: - logs/ia_dev.log (runtime only) - .logs/* (runtime only) Databases and other sources modified: - None Off-project modifications: - None Files in .smartIde modified: - .smartIde/agents/*.md - services/ia_dev/.smartIde/** Files in .secrets modified: - None New patch version in VERSION: - 0.0.5 CHANGELOG.md updated: - yes
85 lines
1.8 KiB
Bash
Executable File
85 lines
1.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
usage() {
|
|
cat <<'EOF'
|
|
Usage:
|
|
./scripts/ensure-core-ide.sh [--fork-url <git_url>] [--upstream-url <git_url>]
|
|
|
|
What it does:
|
|
- Ensures the Lapce checkout exists at ./core_ide (ignored by the parent repo).
|
|
- Optionally configures remotes for a fork workflow:
|
|
- origin = fork (if --fork-url is provided)
|
|
- upstream = official Lapce upstream (default: https://github.com/lapce/lapce.git)
|
|
|
|
Notes:
|
|
- This script does not write any secrets.
|
|
- If you cloned with --depth 1 and need full history later:
|
|
(cd core_ide && git fetch --unshallow)
|
|
EOF
|
|
}
|
|
|
|
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
CORE_IDE_DIR="${ROOT}/core_ide"
|
|
|
|
FORK_URL=""
|
|
UPSTREAM_URL="https://github.com/lapce/lapce.git"
|
|
|
|
while [[ $# -gt 0 ]]; do
|
|
case "$1" in
|
|
-h|--help)
|
|
usage
|
|
exit 0
|
|
;;
|
|
--fork-url)
|
|
FORK_URL="${2:-}"
|
|
shift 2
|
|
;;
|
|
--upstream-url)
|
|
UPSTREAM_URL="${2:-}"
|
|
shift 2
|
|
;;
|
|
*)
|
|
echo "Unknown argument: $1" >&2
|
|
usage >&2
|
|
exit 2
|
|
;;
|
|
esac
|
|
done
|
|
|
|
if [[ -d "${CORE_IDE_DIR}/.git" ]]; then
|
|
echo "core_ide already exists: ${CORE_IDE_DIR}"
|
|
else
|
|
echo "core_ide missing; cloning..."
|
|
mkdir -p "${ROOT}"
|
|
if [[ -n "${FORK_URL}" ]]; then
|
|
git clone --depth 1 "${FORK_URL}" "${CORE_IDE_DIR}"
|
|
else
|
|
git clone --depth 1 "${UPSTREAM_URL}" "${CORE_IDE_DIR}"
|
|
fi
|
|
fi
|
|
|
|
if [[ ! -f "${CORE_IDE_DIR}/Cargo.toml" ]]; then
|
|
echo "core_ide does not look like a Lapce checkout (missing Cargo.toml): ${CORE_IDE_DIR}" >&2
|
|
exit 1
|
|
fi
|
|
|
|
(
|
|
cd "${CORE_IDE_DIR}"
|
|
|
|
# Ensure upstream remote exists (official Lapce).
|
|
if ! git remote get-url upstream >/dev/null 2>&1; then
|
|
git remote add upstream "${UPSTREAM_URL}"
|
|
fi
|
|
|
|
if [[ -n "${FORK_URL}" ]]; then
|
|
git remote set-url origin "${FORK_URL}"
|
|
fi
|
|
|
|
echo "Remotes:"
|
|
git remote -v
|
|
)
|
|
|
|
echo "OK"
|
|
|