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
112 lines
4.1 KiB
Bash
112 lines
4.1 KiB
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# Bump version and optional package.json files from project config (projects/<id>/conf.json).
|
|
# Usage: ./bump-version.sh [project_id] <version> [message_court]
|
|
# Requires: run from repo root; project id from param, or MAIL_TO or AI_AGENT_TOKEN; jq if using version.package_json_paths.
|
|
SCRIPT_REAL="$(readlink -f "${BASH_SOURCE[0]:-$0}" 2>/dev/null || realpath "${BASH_SOURCE[0]:-$0}" 2>/dev/null || echo "${BASH_SOURCE[0]:-$0}")"
|
|
DEPLOY_DIR="$(cd "$(dirname "$SCRIPT_REAL")" && pwd)"
|
|
IA_DEV_ROOT="$(cd "$DEPLOY_DIR/.." && pwd)"
|
|
|
|
# shellcheck source=../lib/smart_ide_logs.sh
|
|
source "${IA_DEV_ROOT}/lib/smart_ide_logs.sh"
|
|
smart_ide_logs_begin "$IA_DEV_ROOT" "$0" "$*"
|
|
smart_ide_logs_register_exit_trap
|
|
|
|
# Optional first arg: project id (must exist as projects/<id>/conf.json)
|
|
if [[ -n "${1:-}" && -f "${IA_DEV_ROOT}/projects/${1}/conf.json" && "$1" != *.* ]]; then
|
|
export IA_PROJECT_ID="$1"
|
|
shift
|
|
fi
|
|
|
|
VERSION="${1:-}"
|
|
SHORT_MSG="${2:-Nouvelles fonctionnalités et améliorations}"
|
|
|
|
if [[ -z "$VERSION" ]]; then
|
|
echo "❌ Usage: ./bump-version.sh [project_id] <version> [message_court]"
|
|
echo " Exemple: ./bump-version.sh lecoffreio 2.1.0 'Nouveaux filtres'"
|
|
exit 1
|
|
fi
|
|
|
|
if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
|
echo "❌ Version invalide. Format attendu: X.Y.Z (ex: 2.1.0)"
|
|
exit 1
|
|
fi
|
|
|
|
if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
|
echo "❌ Not in a git repository" >&2
|
|
exit 1
|
|
fi
|
|
|
|
PROJECT_ROOT="$(git rev-parse --show-toplevel)"
|
|
SCRIPT_REAL="$(readlink -f "${BASH_SOURCE[0]:-$0}" 2>/dev/null || realpath "${BASH_SOURCE[0]:-$0}" 2>/dev/null || echo "${BASH_SOURCE[0]:-$0}")"
|
|
DEPLOY_DIR="$(cd "$(dirname "$SCRIPT_REAL")" && pwd)"
|
|
IA_DEV_ROOT="$(cd "$DEPLOY_DIR/.." && pwd)"
|
|
if [[ "$(pwd)" != "$PROJECT_ROOT" ]]; then
|
|
SCRIPT_ABS="${DEPLOY_DIR}/$(basename "${BASH_SOURCE[0]:-$0}")"
|
|
[[ -n "${IA_PROJECT_ID:-}" ]] && export IA_PROJECT_ID
|
|
cd "$PROJECT_ROOT" && exec "$SCRIPT_ABS" "$@"
|
|
fi
|
|
|
|
# shellcheck source=../lib/project_config.sh
|
|
source "${IA_DEV_ROOT}/lib/project_config.sh"
|
|
|
|
echo "🔄 Mise à jour vers v${VERSION}..."
|
|
|
|
echo "$VERSION" > "$PROJECT_ROOT/VERSION"
|
|
echo "✅ VERSION → ${VERSION}"
|
|
|
|
package_paths=()
|
|
splash_name="Application"
|
|
if [[ -n "${PROJECT_CONFIG_PATH:-}" && -f "$PROJECT_CONFIG_PATH" ]] && command -v jq >/dev/null 2>&1; then
|
|
while IFS= read -r p; do
|
|
[[ -n "$p" ]] && package_paths+=( "$p" )
|
|
done < <(jq -r '.version.package_json_paths[]? // empty' "$PROJECT_CONFIG_PATH" 2>/dev/null)
|
|
splash_name="$(jq -r '.version.splash_app_name // "Application"' "$PROJECT_CONFIG_PATH" 2>/dev/null)"
|
|
fi
|
|
|
|
for p in "${package_paths[@]}"; do
|
|
if [[ "$p" = /* ]]; then
|
|
abs_p="$p"
|
|
else
|
|
abs_p="$PROJECT_ROOT/$p"
|
|
fi
|
|
if [[ -f "$abs_p" ]]; then
|
|
sed -i "s/\"version\": \".*\"/\"version\": \"${VERSION}\"/" "$abs_p"
|
|
echo "✅ $p → ${VERSION}"
|
|
else
|
|
echo "⚠️ $p not found, skipped"
|
|
fi
|
|
done
|
|
|
|
if [[ ! -f "$PROJECT_ROOT/CHANGELOG.md" ]]; then
|
|
echo "⚠️ CHANGELOG.md non trouvé. Créez-le manuellement avec les détails de cette version."
|
|
fi
|
|
|
|
echo ""
|
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
echo "📋 PROCHAINES ÉTAPES"
|
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
echo ""
|
|
echo "1. Éditer CHANGELOG.md pour documenter les changements de v${VERSION}"
|
|
echo ""
|
|
echo "2. Mettre à jour le .env distant avec le message splash (si applicable) :"
|
|
echo ""
|
|
cat << EOF
|
|
NEXT_PUBLIC_SPLASH_MESSAGE="🎉 ${splash_name} v${VERSION} est disponible !
|
|
|
|
✨ ${SHORT_MSG}
|
|
|
|
📖 Consultez CHANGELOG.md pour tous les détails"
|
|
|
|
NEXT_PUBLIC_SPLASH_MAX_DISPLAYS=10
|
|
NEXT_PUBLIC_SPLASH_ID="splash_v${VERSION}"
|
|
EOF
|
|
echo ""
|
|
echo "3. Rebuild, redémarrer et déployer selon le workflow du projet."
|
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
echo ""
|
|
echo "✅ Bump terminé. Éditer CHANGELOG.md puis lancer le déploiement selon le projet."
|
|
|
|
exit 0
|