mirror of
https://github.com/MaksTinyWorkshop/_Assistant_Lead_Tech
synced 2026-04-06 13:31:43 +02:00
move scripts + create mkproj
This commit is contained in:
22
00_INDEX.md
22
00_INDEX.md
@@ -106,6 +106,28 @@ Dossier :
|
||||
|
||||
---
|
||||
|
||||
## Scripts
|
||||
|
||||
Scripts utilitaires permettant d'automatiser certaines opérations récurrentes liées aux projets et aux agents.
|
||||
|
||||
Exemples :
|
||||
|
||||
- génération automatique du `CLAUDE.md` d’un projet
|
||||
- création du symlink `AGENTS.md -> CLAUDE.md`
|
||||
- bootstrap de la mémoire projet
|
||||
|
||||
Dossier :
|
||||
|
||||
```
|
||||
scripts/
|
||||
```
|
||||
|
||||
Script principal :
|
||||
|
||||
- `scripts/generate_project_claude.sh` — génère le `CLAUDE.md` d’un projet et crée `AGENTS.md -> CLAUDE.md`
|
||||
|
||||
---
|
||||
|
||||
## BMAD
|
||||
|
||||
Documentation sur l’articulation entre la méthode BMAD et cette base de connaissance.
|
||||
|
||||
@@ -112,22 +112,22 @@ CREATE DATABASE <db> OWNER <user>;
|
||||
|
||||
Dans le repo :
|
||||
|
||||
1. copier le template :
|
||||
Depuis la racine du projet :
|
||||
|
||||
```
|
||||
70_templates/projet_CLAUDE.md
|
||||
gen-claude
|
||||
```
|
||||
|
||||
2. créer le fichier :
|
||||
Cette commande :
|
||||
|
||||
- génère `CLAUDE.md` depuis le template projet
|
||||
- crée `AGENTS.md -> CLAUDE.md`
|
||||
- utilise le nom du dossier courant comme nom de projet par défaut
|
||||
|
||||
Mode explicite possible :
|
||||
|
||||
```
|
||||
CLAUDE.md
|
||||
```
|
||||
|
||||
3. créer le symlink pour Codex :
|
||||
|
||||
```
|
||||
ln -s CLAUDE.md AGENTS.md
|
||||
gen-claude <nom_du_projet>
|
||||
```
|
||||
|
||||
Ce fichier servira de **mémoire active du projet**.
|
||||
@@ -182,3 +182,9 @@ Ce playbook doit être utilisé lorsque :
|
||||
- un **nouveau projet Docker** est créé
|
||||
- un projet est **installé pour la première fois sur le NUC**
|
||||
- un environnement doit être **reproduit sur une nouvelle machine**
|
||||
|
||||
---
|
||||
|
||||
# Outils associés
|
||||
|
||||
- `scripts/generate_project_claude.sh` — bootstrap de la mémoire projet
|
||||
|
||||
@@ -52,6 +52,23 @@ git clone git@github.com:xxx/portfolio.git
|
||||
|
||||
---
|
||||
|
||||
# Étape 1b — Initialiser la mémoire projet
|
||||
|
||||
Depuis la racine du projet cloné :
|
||||
|
||||
```
|
||||
cd /srv/projects/<repo>
|
||||
gen-claude
|
||||
```
|
||||
|
||||
Cette commande :
|
||||
|
||||
- génère `CLAUDE.md` depuis le template projet
|
||||
- crée `AGENTS.md -> CLAUDE.md`
|
||||
- initialise la mémoire active du projet pour Claude / Codex
|
||||
|
||||
---
|
||||
|
||||
# Étape 2 — Adapter docker-compose
|
||||
|
||||
Les projets ne doivent pas dépendre de Docker Desktop.
|
||||
@@ -157,3 +174,9 @@ Ce playbook doit être utilisé lorsque :
|
||||
- un projet Docker Desktop est migré vers le NUC
|
||||
- un nouveau projet est installé sur le NUC
|
||||
- un projet doit être reproduit sur un nouvel environnement
|
||||
|
||||
---
|
||||
|
||||
# Outils associés
|
||||
|
||||
- `scripts/generate_project_claude.sh` — initialisation de la mémoire projet (`CLAUDE.md` + `AGENTS.md`)
|
||||
|
||||
@@ -58,6 +58,25 @@ git clone <repo>
|
||||
|
||||
---
|
||||
|
||||
# Étape 1b — Initialiser la mémoire projet
|
||||
|
||||
Depuis la racine du projet :
|
||||
|
||||
```
|
||||
cd /srv/projects/<nom-projet>
|
||||
gen-claude
|
||||
```
|
||||
|
||||
Cette commande :
|
||||
|
||||
- génère `CLAUDE.md` depuis le template projet
|
||||
- crée `AGENTS.md -> CLAUDE.md`
|
||||
- initialise la mémoire active du projet pour Claude / Codex
|
||||
|
||||
---
|
||||
|
||||
---
|
||||
|
||||
# Étape 2 — Arrêter la stack
|
||||
|
||||
Avant toute restauration, arrêter les conteneurs :
|
||||
@@ -199,3 +218,9 @@ Ce playbook complète :
|
||||
|
||||
- `bootstrap_projet_docker.md`
|
||||
- `migration_projet_vers_nuc.md`
|
||||
|
||||
---
|
||||
|
||||
# Outils associés
|
||||
|
||||
- `scripts/generate_project_claude.sh` — permet de réinitialiser la mémoire projet si nécessaire après restauration
|
||||
|
||||
148
scripts/mkproj.sh
Executable file
148
scripts/mkproj.sh
Executable file
@@ -0,0 +1,148 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
PROJECT_NAME="${1:-}"
|
||||
OS="$(uname -s)"
|
||||
TARGET_BASE=""
|
||||
PROJECT_PATH=""
|
||||
|
||||
if [ -z "$PROJECT_NAME" ]; then
|
||||
echo "Usage: mkproj <nom_du_projet>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
choose_mac_target_base() {
|
||||
echo "Environnement détecté : Mac"
|
||||
echo "Choisir le type de projet :"
|
||||
echo " 1) Projet perso -> /Volumes/TeraSSD/Projets_Dev"
|
||||
echo " 2) Projet Mindleaf -> /Volumes/TeraSSD/Projets_Dev/__Mindleaf"
|
||||
printf "Votre choix [1/2] : "
|
||||
read -r choice
|
||||
|
||||
case "$choice" in
|
||||
1)
|
||||
TARGET_BASE="/Volumes/TeraSSD/Projets_Dev"
|
||||
;;
|
||||
2)
|
||||
TARGET_BASE="/Volumes/TeraSSD/Projets_Dev/__Mindleaf"
|
||||
;;
|
||||
*)
|
||||
echo "Choix invalide."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
choose_target_base() {
|
||||
case "$OS" in
|
||||
Linux)
|
||||
echo "Environnement détecté : NUC/Linux"
|
||||
TARGET_BASE="/srv/projects"
|
||||
;;
|
||||
Darwin)
|
||||
choose_mac_target_base
|
||||
;;
|
||||
*)
|
||||
echo "Système non supporté : $OS"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
create_readme() {
|
||||
cat <<EOF > "$PROJECT_PATH/README.md"
|
||||
# $PROJECT_NAME
|
||||
|
||||
Projet initialisé avec l'environnement Lead_tech.
|
||||
|
||||
## Structure attendue
|
||||
|
||||
- \`CLAUDE.md\` : mémoire active du projet
|
||||
- \`AGENTS.md\` : symlink vers \`CLAUDE.md\`
|
||||
- \`README.md\` : documentation projet
|
||||
- \`.gitignore\` : exclusions Git de base
|
||||
|
||||
## Commandes utiles
|
||||
|
||||
\`\`\`bash
|
||||
# Initialiser la mémoire projet
|
||||
gen-claude
|
||||
|
||||
# Démarrer la stack Docker
|
||||
docker compose up -d
|
||||
\`\`\`
|
||||
EOF
|
||||
}
|
||||
|
||||
create_gitignore() {
|
||||
cat <<'EOF' > "$PROJECT_PATH/.gitignore"
|
||||
# dependencies
|
||||
node_modules/
|
||||
|
||||
# logs
|
||||
logs/
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
|
||||
# env
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
|
||||
# build outputs
|
||||
dist/
|
||||
build/
|
||||
coverage/
|
||||
.next/
|
||||
out/
|
||||
|
||||
# editors / OS
|
||||
.DS_Store
|
||||
.vscode/
|
||||
.idea/
|
||||
|
||||
# local runtime data
|
||||
.tmp/
|
||||
tmp/
|
||||
|
||||
# AI tools
|
||||
.claude/
|
||||
.codex/
|
||||
EOF
|
||||
}
|
||||
|
||||
choose_target_base
|
||||
|
||||
if [ ! -d "$TARGET_BASE" ]; then
|
||||
echo "Le dossier cible n'existe pas : $TARGET_BASE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PROJECT_PATH="$TARGET_BASE/$PROJECT_NAME"
|
||||
|
||||
if [ -e "$PROJECT_PATH" ]; then
|
||||
echo "Le dossier existe déjà : $PROJECT_PATH"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p "$PROJECT_PATH"
|
||||
cd "$PROJECT_PATH"
|
||||
|
||||
git init
|
||||
|
||||
# mémoire agents
|
||||
gen-claude "$PROJECT_NAME"
|
||||
|
||||
create_readme
|
||||
create_gitignore
|
||||
|
||||
echo ""
|
||||
echo "Projet créé : $PROJECT_PATH"
|
||||
echo ""
|
||||
echo "Prochaines étapes :"
|
||||
echo " cd $PROJECT_PATH"
|
||||
echo " git remote add origin <repo>"
|
||||
echo " docker compose up -d"
|
||||
@@ -7,8 +7,9 @@
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
SOURCE="$SCRIPT_DIR/_AI_INSTRUCTIONS.md"
|
||||
PROJECTS_CONF="$SCRIPT_DIR/_projects.conf"
|
||||
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
SOURCE="$REPO_ROOT/_AI_INSTRUCTIONS.md"
|
||||
PROJECTS_CONF="$REPO_ROOT/_projects.conf"
|
||||
|
||||
# --- Détection machine ---
|
||||
OS="$(uname -s)"
|
||||
@@ -92,11 +93,11 @@ CLAUDE_HEADER="# Instructions globales — Lead Tech Copilote
|
||||
Ce fichier est chargé automatiquement par Claude Code ou Codex à chaque session.
|
||||
Il constitue la porte d'entrée principale de la base de connaissance Lead_tech et oriente vers les fichiers spécialisés utilisés par tous les projets."
|
||||
|
||||
generate_repo_claude "$CLAUDE_HEADER" "$SCRIPT_DIR/CLAUDE.md"
|
||||
generate_repo_claude "$CLAUDE_HEADER" "$REPO_ROOT/CLAUDE.md"
|
||||
|
||||
ensure_symlink "$SCRIPT_DIR/CLAUDE.md" "$HOME/.claude/CLAUDE.md"
|
||||
ensure_symlink "$REPO_ROOT/CLAUDE.md" "$HOME/.claude/CLAUDE.md"
|
||||
ensure_symlink "$HOME/.claude/CLAUDE.md" "$HOME/.codex/AGENTS.md"
|
||||
ensure_symlink "$SCRIPT_DIR/CLAUDE.md" "$SCRIPT_DIR/AGENTS.md"
|
||||
ensure_symlink "$REPO_ROOT/CLAUDE.md" "$REPO_ROOT/AGENTS.md"
|
||||
|
||||
if [ "$CHANGED" -eq 1 ]; then
|
||||
echo "Sync AI instructions (OS: $OS)"
|
||||
Reference in New Issue
Block a user