smart_ide/docs/repo/projects-directory.md
Nicolas Cantu 58cc2493e5 chore: consolidate ia_dev module, sync tooling, and harden gateways (0.0.5)
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
2026-04-04 18:36:43 +02:00

65 lines
5.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Configurations projet (`projects/<id>/`)
Ce répertoire, à la **racine du monorepo `smart_ide`**, ne contient que les **fichiers de configuration** attendus par **`ia_dev`** (`conf.json` par identifiant de projet). Ce nest **pas** le répertoire des **clones Git** des applications.
Les **sous-répertoires** `projects/<id>/` non listés dans le **`.gitignore`** à la racine (exceptions pour les ids versionnés) restent **ignorés par Git** : pour versionner un nouvel id, ajouter les lignes `!projects/<id>/` et `!projects/<id>/**` à côté des exceptions existantes.
## Clones applicatifs (docv, stacks métier, etc.)
Les dépôts sources des produits (ex. backend **docv** sous un chemin du type `…/enso/docv`, autres apps) doivent vivre **ailleurs**, selon la convention du poste — typiquement un répertoire **frère** du monorepo, par ex. **`../projects/<nom>/`** (relatif à la racine `smart_ide`), **distinct** de `./projects/` ici.
- **`./projects/`** → **un seul fichier de configuration par id** : `projects/<id>/conf.json` (y compris le gabarit [`projects/example/conf.json`](../../projects/example/conf.json)). Pas de fichier `.code-workspace` versionné à côté : léquivalent multi-root IDE est **`smart_ide.workspace`** dans ce même `conf.json`. `ia_dev` résout via le lien symbolique décrit dans [ia_dev-module.md](../ia_dev-module.md).
- **`../projects/`** (ou autre racine configurée) → arborescences Git complètes, builds, etc. ; dans chaque `conf.json`, **`project_path`** et les chemins **`deploy.*`** utiles sont **relatifs à la racine du monorepo smart_ide** (ex. `../enso`, `.`) ou **absolus** ; le script `cron/git-pull-project-clones.sh` et ia_dev les résolvent depuis cette racine (`IA_DEV_ROOT/lib/conf_path_resolve.sh`).
## `smart_ide`
- Fichier : `projects/smart_ide/conf.json`
- Après clone ou réorganisation des dossiers : `./scripts/ensure-ia-dev-project-link.sh smart_ide` (ou le wrapper `scripts/ensure-ia-dev-smart-ide-project-link.sh`) pour recréer le lien sous `IA_DEV_ROOT/projects/smart_ide` (ex. `services/ia_dev/projects/smart_ide`) → `../../projects/smart_ide` (chemin relatif variant selon `IA_DEV_ROOT`).
## `enso`
- Fichier : `projects/enso/conf.json` — clone **enso** frère du monorepo (`project_path` typique `../enso`), déploiement `deploy/scripts_v2`, forge **4nk/enso** (wiki / issues), mails ticketing `AI.ENSO.*@4nkweb.com`.
- Chemins **absolus sur les serveurs** sous **`smart_ide.remote_data_access`** : alignés sur **`ENSO_REMOTE_ROOT`**, **`ENSO_SSH_HOST`** et **`data/dossiers-permanents`** (dépôt enso, `enso-deploy.env`). Valeurs réelles : fichiers **`enso-deploy.env`** non versionnés.
- Cron fragment : `cron/fragments/enso.cron`
- Pour **`ia_dev`** : lien symbolique `IA_DEV_ROOT/projects/enso``../../projects/enso` (recréer avec `./scripts/ensure-ia-dev-project-link.sh enso` ; chemin relatif variant selon `IA_DEV_ROOT`).
## `builazoo`
- Fichier : `projects/builazoo/conf.json` — dépôt **frère du monorepo** (`project_path` typique `../builazoo`), forge **4nk/builazoo** (wiki / issues à ajuster si le dépôt diffère), mails ticketing `AI.BUILAZOO.*@4nkweb.com`.
- **`smart_ide.remote_data_access`** : alias SSH `builazoo-test` / `builazoo-pprod` / `builazoo-prod` (à déclarer dans `~/.ssh/config` comme pour les autres ids).
- Multi-root IDE : **`smart_ide.workspace`** dans `conf.json` (dossiers + `smartIde.activeProjectId`).
- Cron fragment : `cron/fragments/builazoo.cron`
- Pour **`ia_dev`** : `./scripts/ensure-ia-dev-project-link.sh builazoo`
- Le répertoire **`builazoo/`** à la racine du monorepo est partiellement ignoré par Git (sauf `builazoo/README.md`) : y placer le clone ou les sources.
## Synchronisation Git planifiée
Pour **chaque** `projects/<id>/conf.json`, le tirage automatique utilise **`cron/config.env`** (`PULL_SYNC_*`) et **`cron/git-pull-wrapper.sh`** → **`cron/git-pull-project-clones.sh`**.
- **Timer systemd utilisateur** (recommandé) : `scripts/install-git-pull-systemd-user.sh` — voir [cron-git-pull.md](./cron-git-pull.md)
- Désactiver pour un id : `"cron": { "git_pull": false }` dans le `conf.json`
- Désactiver tout : `PULL_SYNC_ENABLED=0` dans `config.env` ou `config.local.env`
`project_path` est résolu en chemin absolu à partir de la racine **smart_ide** lorsquil est relatif.
## Données déployées, SSH, AnythingLLM et IDE
Spécification : [features/remote-deployed-data-ssh.md](../features/remote-deployed-data-ssh.md).
### Bloc optionnel `smart_ide` dans `conf.json`
Clé **`smart_ide`** avec notamment **`remote_data_access`**, **`anythingllm_workspace_slug`**, **`workspace`** (équivalent `.code-workspace` : `folders` + `settings.smartIde.activeProjectId`), **`preview_urls`** (ex. **`test`** : URL du déploiement test pour [Carbonyl](../features/carbonyl-terminal-browser.md)). Exemple : `projects/enso/conf.json`.
### Projet actif pour léditeur / Cursor
1. Copier [`projects/active-project.json.example`](../../projects/active-project.json.example) vers **`projects/active-project.json`** (non versionné) ; renseigner **`id`**, optionnellement **`default_env`**, **`notes`**.
2. Pour ouvrir un workspace multi-dossiers dans VS Code / Cursor : lire **`smart_ide.workspace`** dans **`projects/<id>/conf.json`** (même schéma quun fichier `.code-workspace`) — copier ce bloc dans un fichier local `.code-workspace` si léditeur lexige, ou configurer les dossiers à la main.
Nouveau projet : partir de [`projects/example/conf.json`](../../projects/example/conf.json) → `projects/<nouvel_id>/conf.json`.
Convention agents : `.smartIde/rules/smart-ide-ia-dev-bridge.mdc`.
## Référence amont (schéma conf)
Schéma détaillé des champs `conf.json` : [ia-dev-project-conf-schema.md](./ia-dev-project-conf-schema.md) (aligné sur `IA_DEV_ROOT/projects/README.md` amont). Extensions **`cron`** et **`smart_ide`** : spécifiques smart_ide ; `ia_dev` peut ignorer les champs non lus.