ia_dev/projects
Nicolas Cantu 61cec6f430 Sync ia_dev: token resolution via .secrets/<env>/ia_token, doc updates
**Motivations:**
- Align master with current codebase (token from projects/<id>/.secrets/<env>/ia_token)
- Id resolution by mail To or by API token; no slug

**Root causes:**
- Token moved from conf.json to .secrets/<env>/ia_token; env from directory name

**Correctifs:**
- Server and scripts resolve project+env by scanning all projects and envs

**Evolutions:**
- tickets-fetch-inbox routes by To address; notary-ai agents and API doc updated

**Pages affectées:**
- ai_working_help/server.js, docs, project_config.py, lib/project_config.sh
- projects/README.md, lecoffreio/docs/API.md, gitea-issues/tickets-fetch-inbox.py
2026-03-16 15:00:23 +01:00
..

Project-specific configuration

This repo (ia_dev) is intended to be used as a git submodule inside each project. Project-specific parameters are stored in projects/<id>/conf.json (e.g. projects/lecoffreio/conf.json). The <id> is the project identifier and the name of the directory under projects/.

Current project selection

There is no longer a "slug" in the URL or path; the project id (directory name under projects/) is resolved by:

1. Mail ticketing
From the To address of an email: search all projects/*/conf.json for tickets.authorized_emails.to equal to that address (case-insensitive). The matching project directory name is the id.

2. API ai_working_help
The token is found by scanning as described above: traverse all projects and all envs, reading each projects/<id>/.secrets/<env>/ia_token and comparing its content (or content + env) to the Bearer token. The first match yields the project id and the env (e.g. test, pprod, prod).

3. Scripts / fallback (when no request context)

  • MAIL_TO (env): same as (1), resolve id by email "to".
  • AI_AGENT_TOKEN (env): same as (2), resolve id (and env) by token; sets PROJECT_SLUG and PROJECT_ENV.
  • IA_PROJECT (env)
  • .ia_project at repository root (one line)
  • ai_project_id at repository root (one line). When ia_dev is a submodule, this file lives at the host repo root (parent of ia_dev).

When running from a repo that has ia_dev as a submodule, the root is the parent repo; the script resolves ia_dev either as ./ia_dev or ./deploy (symlink to ia_dev/deploy).

Schema

One JSON file per project: projects/<id>/conf.json (e.g. projects/lecoffreio/conf.json). The <id> is the directory name; the config file is always named conf.json.

Field Required Description
name yes Human-readable project name
project_path no Relative path to project from ia_dev (e.g. ../lecoffre_ng_test); used when running from ia_dev standalone
build_dirs no List of directories (relative to repo root) where npm run build is run before push. If missing or empty, build check is skipped
version no Version/bump configuration
version.package_json_paths no List of paths (relative to repo root) to package.json files to update on bump
version.splash_app_name no App name used in splash message template
mail no Mail/imap bridge config
git no Git hosting: wiki_url, token_file (path relative to repo root for token file). Ticketing URL is under tickets, not git.
tickets no Ticketing: ticketing_url (Gitea issues URL), authorized_emails (to: alias, from: list of allowed sender addresses for mail-based ticketing). The to address is used to resolve the project id when processing mails. See projects/ia_dev/docs/TICKETS_SPOOL_FORMAT.md.

The API token for ai_working_help is not in conf.json. It is found by scanning all projects and all envs (as described above): each file projects/<id>/.secrets/<env>/ia_token is read and the Bearer is compared to the file content or to (file content + env). Token value is base + env; env is the environment name (test, pprod, prod), to be adapted per environment. The first match gives project id and env.

Example (minimal)

{
  "name": "My App",
  "build_dirs": ["backend", "frontend"]
}

Example (full)

See projects/lecoffreio/conf.json.