smart_ide/docs/repo/service-ia-dev-gateway.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

56 lines
1.9 KiB
Markdown

# ia-dev-gateway (`services/ia-dev-gateway/`)
HTTP API for the **ia_dev** checkout: agent registry (`.smartIde/agents/*.md`), `POST /v1/runs` (script-backed runner), and SSE streaming on `/v1/runs/:id/events`.
## Build / run
```bash
cd services/ia-dev-gateway
npm install
npm run build
export IA_DEV_GATEWAY_TOKEN='your-secret'
# optional: IA_DEV_ROOT=/absolute/path/to/ia_dev
npm start
```
Écoute par défaut : **`127.0.0.1:37144`**.
## IA_DEV_ROOT resolution
If `IA_DEV_ROOT` is not set, the gateway resolves it in this order:
- `./ia_dev`
- `./services/ia_dev`
When using `./services/ia_dev`, you typically need to create project links so scripts can resolve `projects/<id>/conf.json`:
```bash
./scripts/ensure-ia-dev-project-link.sh smart_ide
./scripts/ensure-ia-dev-project-link.sh enso
./scripts/ensure-ia-dev-project-link.sh builazoo
```
## Script-backed runner (current)
The v1 runner executes a subset of agent IDs by spawning `bash` scripts under `IA_DEV_ROOT/deploy/` and streaming stdout/stderr as SSE events.
Supported agent IDs:
- `change-to-all-branches``deploy/change-to-all-branches.sh`
- `branch-align-by-script-from-test``deploy/branch-align.sh` (defaults to `env=test` if omitted)
- `deploy-by-script``deploy/deploy.sh` (env `test`) or `deploy/deploy-by-script-to.sh` (env `pprod|prod`)
- `push-by-script``deploy/pousse.sh`
- `site-generate``tools/site-generate.sh`
### `payload` conventions
- **`payload.args`**: `string[]` appended to the script arguments.
- **`payload.stdin`**: `string` written to the script stdin.
- **`payload.commitMessage`**: `string` alias for stdin for `push-by-script`.
- **`payload.remote`**: `string` passed as `--remote <remote>` for `push-by-script`.
- **`payload.bumpVersion`**: `boolean` adds `--bump-version` for `push-by-script`.
## Contrats
[API/ia-dev-gateway.md](../API/ia-dev-gateway.md), [features/ia-dev-service.md](../features/ia-dev-service.md).