@m14i/sith 1.5.2 → 1.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +59953 -9
- package/docker/Dockerfile +70 -0
- package/docker/docker-compose.yml +52 -0
- package/docker/nix/nix-config/packages.json +67 -0
- package/docker/nix/nix-config/packages.nix +28 -0
- package/docker/nix/nix-scripts/01-banner.sh +14 -0
- package/docker/nix/nix-scripts/02-env-vars.sh +15 -0
- package/docker/nix/nix-scripts/03-directories.sh +6 -0
- package/docker/nix/nix-scripts/04-git-config.sh +7 -0
- package/docker/nix/nix-scripts/05-opencode-cli.sh +18 -0
- package/docker/nix/nix-scripts/06-skills-setup.sh +92 -0
- package/docker/nix/nix-scripts/07-ready.sh +6 -0
- package/docker/nix/nix-scripts/setup.sh +29 -0
- package/docker/nix/shell.nix +45 -0
- package/docker/skills/opencode-skills-config.json +62 -0
- package/docker/skills/rtk-config.toml +48 -0
- package/package.json +4 -3
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# OpenCode Docker - Nix-based Image with Token Optimization Skills
|
|
2
|
+
# Version 2.2.0 - Ajout RTK + Caveman ultra pour réduction massive de tokens
|
|
3
|
+
#
|
|
4
|
+
# Build: docker build -t opencode-ci:latest .
|
|
5
|
+
# Run: docker run -v $(pwd):/workspace -e GITHUB_TOKEN=$GITHUB_TOKEN opencode-ci:latest analyze
|
|
6
|
+
|
|
7
|
+
# Utilise l'image officielle Nix avec version pinnée pour reproductibilité
|
|
8
|
+
FROM nixos/nix:2.19.2
|
|
9
|
+
|
|
10
|
+
# Metadata
|
|
11
|
+
LABEL maintainer="OpenCode Automation"
|
|
12
|
+
LABEL description="OpenCode CI/CD avec Nix, GitHub Copilot et skills d'optimisation de tokens (RTK + Caveman ultra)"
|
|
13
|
+
LABEL version="2.2.0"
|
|
14
|
+
LABEL org.opencontainers.image.source="https://github.com/your-repo/opencode-docker"
|
|
15
|
+
|
|
16
|
+
# Configuration Nix pour permettre les builds
|
|
17
|
+
RUN echo "sandbox = false" >> /etc/nix/nix.conf && \
|
|
18
|
+
echo "filter-syscalls = false" >> /etc/nix/nix.conf
|
|
19
|
+
|
|
20
|
+
# Copier les fichiers de configuration des skills
|
|
21
|
+
COPY docker/skills/rtk-config.toml /opt/sith/skills/rtk-config.toml
|
|
22
|
+
COPY docker/skills/opencode-skills-config.json /opt/sith/skills/opencode-skills-config.json
|
|
23
|
+
|
|
24
|
+
# Copier les fichiers Nix (scripts, config, shell.nix)
|
|
25
|
+
COPY docker/nix/ /opt/sith/nix/
|
|
26
|
+
|
|
27
|
+
# Copier la configuration npm (force registry public)
|
|
28
|
+
COPY .npmrc /root/.npmrc
|
|
29
|
+
|
|
30
|
+
# Pré-charger l'environnement Nix (installe tous les packages)
|
|
31
|
+
# Cela cache les dépendances dans le layer Docker
|
|
32
|
+
RUN nix-shell /opt/sith/nix/shell.nix --run "echo '✅ Environment cached'"
|
|
33
|
+
|
|
34
|
+
# Installer OpenCode CLI via script officiel
|
|
35
|
+
RUN nix-shell /opt/sith/nix/shell.nix --run " \
|
|
36
|
+
curl -fsSL https://opencode.ai/install | bash && \
|
|
37
|
+
patchelf --set-interpreter \$(patchelf --print-interpreter \$(which bash)) /root/.opencode/bin/opencode && \
|
|
38
|
+
/root/.opencode/bin/opencode --version \
|
|
39
|
+
"
|
|
40
|
+
|
|
41
|
+
# Configuration de l'environnement
|
|
42
|
+
ENV OPENCODE_MODEL=github-copilot/claude-sonnet-4.5
|
|
43
|
+
ENV OPENCODE_LOG_LEVEL=INFO
|
|
44
|
+
ENV NODE_ENV=production
|
|
45
|
+
ENV PATH="/root/.local/bin:/root/.npm-global/bin:${PATH}"
|
|
46
|
+
ENV NPM_CONFIG_PREFIX=/root/.npm-global
|
|
47
|
+
|
|
48
|
+
# === Token Optimization Skills Configuration ===
|
|
49
|
+
# RTK (Rust Token Killer) - Désactivé par défaut (binaire non disponible publiquement)
|
|
50
|
+
# Activez avec: docker run -e RTK_ENABLED=true ... si vous avez le binaire
|
|
51
|
+
ENV RTK_ENABLED=false
|
|
52
|
+
|
|
53
|
+
# Caveman - Compression de langage en mode ultra (75%+ de réduction)
|
|
54
|
+
ENV CAVEMAN_MODE=ultra
|
|
55
|
+
ENV CAVEMAN_AUTO=true
|
|
56
|
+
|
|
57
|
+
# Réduction totale estimée: 85-95% de tokens par session CI/CD
|
|
58
|
+
|
|
59
|
+
# Healthcheck pour vérifier que l'environnement et skills sont prêts
|
|
60
|
+
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
|
61
|
+
CMD nix-shell /opt/sith/nix/shell.nix --run "opencode --version && command -v rtk" || exit 1
|
|
62
|
+
|
|
63
|
+
# Répertoire de travail pour les projets
|
|
64
|
+
WORKDIR /workspace
|
|
65
|
+
|
|
66
|
+
# Point d'entrée via nix-shell
|
|
67
|
+
ENTRYPOINT ["nix-shell", "/opt/sith/nix/shell.nix", "--run"]
|
|
68
|
+
|
|
69
|
+
# Commande par défaut
|
|
70
|
+
CMD ["opencode --help"]
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
version: '3.8'
|
|
2
|
+
|
|
3
|
+
services:
|
|
4
|
+
opencode-ci:
|
|
5
|
+
build:
|
|
6
|
+
context: ..
|
|
7
|
+
dockerfile: docker/Dockerfile
|
|
8
|
+
image: opencode-ci:latest
|
|
9
|
+
container_name: opencode-ci
|
|
10
|
+
environment:
|
|
11
|
+
- GITHUB_TOKEN=${GITHUB_TOKEN}
|
|
12
|
+
- OPENCODE_MODEL=${OPENCODE_MODEL:-github-copilot/claude-sonnet-4.5}
|
|
13
|
+
- PROJECT_PATH=/workspace
|
|
14
|
+
- OPENCODE_OUTPUT=/workspace/opencode-output
|
|
15
|
+
- OPENCODE_LOG_LEVEL=${OPENCODE_LOG_LEVEL:-INFO}
|
|
16
|
+
volumes:
|
|
17
|
+
- ./:/workspace
|
|
18
|
+
- opencode-output:/workspace/opencode-output
|
|
19
|
+
# Monte automatiquement votre auth.json local (si disponible)
|
|
20
|
+
- ${HOME}/.local/share/opencode/auth.json:/config/auth.json:ro
|
|
21
|
+
command: help
|
|
22
|
+
|
|
23
|
+
# Service pour analyse continue
|
|
24
|
+
opencode-analyzer:
|
|
25
|
+
extends: opencode-ci
|
|
26
|
+
container_name: opencode-analyzer
|
|
27
|
+
command: analyze
|
|
28
|
+
profiles:
|
|
29
|
+
- analyze
|
|
30
|
+
|
|
31
|
+
# Service pour génération de documentation
|
|
32
|
+
opencode-documenter:
|
|
33
|
+
extends: opencode-ci
|
|
34
|
+
container_name: opencode-documenter
|
|
35
|
+
command: document --output=docs
|
|
36
|
+
profiles:
|
|
37
|
+
- document
|
|
38
|
+
|
|
39
|
+
# Service pour revue de PR
|
|
40
|
+
opencode-reviewer:
|
|
41
|
+
extends: opencode-ci
|
|
42
|
+
container_name: opencode-reviewer
|
|
43
|
+
environment:
|
|
44
|
+
- GITHUB_TOKEN=${GITHUB_TOKEN}
|
|
45
|
+
- OPENCODE_MODEL=${OPENCODE_MODEL:-github-copilot/claude-sonnet-4.5}
|
|
46
|
+
- POST_TO_GITHUB=${POST_TO_GITHUB:-false}
|
|
47
|
+
command: review-pr --pr-number=${PR_NUMBER}
|
|
48
|
+
profiles:
|
|
49
|
+
- review
|
|
50
|
+
|
|
51
|
+
volumes:
|
|
52
|
+
opencode-output:
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "OpenCode CI/CD Environment Packages",
|
|
3
|
+
"version": "2.2.0",
|
|
4
|
+
"categories": {
|
|
5
|
+
"shell": {
|
|
6
|
+
"description": "Shell et outils de base",
|
|
7
|
+
"packages": [
|
|
8
|
+
"bash",
|
|
9
|
+
"coreutils",
|
|
10
|
+
"gnugrep",
|
|
11
|
+
"gnused",
|
|
12
|
+
"findutils",
|
|
13
|
+
"which"
|
|
14
|
+
]
|
|
15
|
+
},
|
|
16
|
+
"vcs": {
|
|
17
|
+
"description": "Version control systems",
|
|
18
|
+
"packages": [
|
|
19
|
+
"git"
|
|
20
|
+
]
|
|
21
|
+
},
|
|
22
|
+
"network": {
|
|
23
|
+
"description": "Outils réseau",
|
|
24
|
+
"packages": [
|
|
25
|
+
"curl",
|
|
26
|
+
"wget",
|
|
27
|
+
"cacert"
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
"data": {
|
|
31
|
+
"description": "Parsing et manipulation de données",
|
|
32
|
+
"packages": [
|
|
33
|
+
"jq",
|
|
34
|
+
"ripgrep"
|
|
35
|
+
]
|
|
36
|
+
},
|
|
37
|
+
"runtime": {
|
|
38
|
+
"description": "Runtimes et langages",
|
|
39
|
+
"packages": [
|
|
40
|
+
"nodejs_20",
|
|
41
|
+
"python3",
|
|
42
|
+
"python3Packages.pip"
|
|
43
|
+
]
|
|
44
|
+
},
|
|
45
|
+
"build": {
|
|
46
|
+
"description": "Build tools",
|
|
47
|
+
"packages": [
|
|
48
|
+
"gcc",
|
|
49
|
+
"gnumake"
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
"system": {
|
|
53
|
+
"description": "Outils système",
|
|
54
|
+
"packages": [
|
|
55
|
+
"procps",
|
|
56
|
+
"util-linux",
|
|
57
|
+
"glibcLocales"
|
|
58
|
+
]
|
|
59
|
+
},
|
|
60
|
+
"skills": {
|
|
61
|
+
"description": "Token optimization skills",
|
|
62
|
+
"packages": [
|
|
63
|
+
"unzip"
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Nix package list generator
|
|
2
|
+
# Reads packages.json and generates a list for buildInputs
|
|
3
|
+
|
|
4
|
+
{ pkgs, lib }:
|
|
5
|
+
|
|
6
|
+
let
|
|
7
|
+
# Load packages configuration
|
|
8
|
+
packagesConfig = builtins.fromJSON (builtins.readFile ./packages.json);
|
|
9
|
+
|
|
10
|
+
# Extract all packages from all categories
|
|
11
|
+
allPackages = lib.flatten (
|
|
12
|
+
lib.mapAttrsToList (category: config: config.packages) packagesConfig.categories
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
# Convert package strings to actual Nix packages
|
|
16
|
+
# Handle nested packages like "python3Packages.pip"
|
|
17
|
+
resolvePkg = pkgPath:
|
|
18
|
+
let
|
|
19
|
+
parts = lib.splitString "." pkgPath;
|
|
20
|
+
in
|
|
21
|
+
if lib.length parts == 1
|
|
22
|
+
then builtins.getAttr (lib.head parts) pkgs
|
|
23
|
+
else if lib.length parts == 2
|
|
24
|
+
then builtins.getAttr (lib.elemAt parts 1) (builtins.getAttr (lib.head parts) pkgs)
|
|
25
|
+
else throw "Package path too deep: ${pkgPath}";
|
|
26
|
+
|
|
27
|
+
in
|
|
28
|
+
map resolvePkg allPackages
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Banner and version display
|
|
3
|
+
|
|
4
|
+
echo "╔══════════════════════════════════════════════════════════╗"
|
|
5
|
+
echo "║ 🚀 OpenCode CI - Nix Environment (CI/CD Ready) ║"
|
|
6
|
+
echo "╚══════════════════════════════════════════════════════════╝"
|
|
7
|
+
echo ""
|
|
8
|
+
echo "📦 Versions installées:"
|
|
9
|
+
echo " • Bash: $(bash --version | head -n1)"
|
|
10
|
+
echo " • Node.js: $(node --version)"
|
|
11
|
+
echo " • Python: $(python3 --version)"
|
|
12
|
+
echo " • Git: $(git --version | cut -d' ' -f3)"
|
|
13
|
+
echo " • jq: $(jq --version)"
|
|
14
|
+
echo ""
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Environment variables setup
|
|
3
|
+
|
|
4
|
+
export OPENCODE_MODEL="${OPENCODE_MODEL:-github-copilot/claude-sonnet-4.5}"
|
|
5
|
+
export OPENCODE_LOG_LEVEL="${OPENCODE_LOG_LEVEL:-INFO}"
|
|
6
|
+
export NODE_ENV="${NODE_ENV:-production}"
|
|
7
|
+
|
|
8
|
+
# Chemins personnalisés
|
|
9
|
+
export PATH="/root/.opencode/bin:$PATH"
|
|
10
|
+
export PATH="/root/.local/bin:$PATH"
|
|
11
|
+
export PATH="/root/.agents/skills/rtk/bin:$PATH"
|
|
12
|
+
export PATH="/root/.npm-global/bin:$PATH"
|
|
13
|
+
|
|
14
|
+
# Configuration npm
|
|
15
|
+
export NPM_CONFIG_PREFIX="${NPM_CONFIG_PREFIX:-/root/.npm-global}"
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Git global configuration for CI/CD
|
|
3
|
+
|
|
4
|
+
git config --global user.name "OpenCode Bot" 2>/dev/null || true
|
|
5
|
+
git config --global user.email "opencode-bot@example.com" 2>/dev/null || true
|
|
6
|
+
git config --global init.defaultBranch main 2>/dev/null || true
|
|
7
|
+
git config --global --add safe.directory '*' 2>/dev/null || true
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# OpenCode CLI vérification
|
|
3
|
+
|
|
4
|
+
# Configurer le PATH pour OpenCode
|
|
5
|
+
export PATH="$HOME/.opencode/bin:$PATH"
|
|
6
|
+
|
|
7
|
+
if command -v opencode &> /dev/null; then
|
|
8
|
+
OPENCODE_VERSION=$(opencode --version 2>&1 | head -n1 || echo 'ok')
|
|
9
|
+
OPENCODE_PATH=$(command -v opencode)
|
|
10
|
+
echo "✅ OpenCode CLI disponible"
|
|
11
|
+
echo " Version: $OPENCODE_VERSION"
|
|
12
|
+
echo " Chemin: $OPENCODE_PATH"
|
|
13
|
+
else
|
|
14
|
+
echo "⚠️ OpenCode CLI non trouvé"
|
|
15
|
+
echo " Installer: curl -fsSL https://opencode.ai/install | bash"
|
|
16
|
+
fi
|
|
17
|
+
|
|
18
|
+
echo ""
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Token optimization skills installation (RTK + Caveman)
|
|
3
|
+
|
|
4
|
+
echo "=== Installation des Skills d'Optimisation de Tokens ==="
|
|
5
|
+
echo ""
|
|
6
|
+
|
|
7
|
+
mkdir -p /root/.agents/skills
|
|
8
|
+
|
|
9
|
+
# 1. RTK (Rust Token Killer)
|
|
10
|
+
# NOTE: RTK n'est actuellement pas disponible publiquement
|
|
11
|
+
# Désactivé par défaut - peut être activé si vous avez le binaire
|
|
12
|
+
if [ "${RTK_ENABLED:-false}" = "true" ]; then
|
|
13
|
+
echo "📦 Installation de RTK (Rust Token Killer)..."
|
|
14
|
+
|
|
15
|
+
mkdir -p /root/.agents/skills/rtk/bin
|
|
16
|
+
mkdir -p /root/.agents/skills/rtk/config
|
|
17
|
+
|
|
18
|
+
if [ ! -f /root/.agents/skills/rtk/bin/rtk ]; then
|
|
19
|
+
echo " ⚠️ RTK binaire non disponible publiquement"
|
|
20
|
+
echo " Pour utiliser RTK:"
|
|
21
|
+
echo " 1. Copier votre binaire RTK dans l'image"
|
|
22
|
+
echo " 2. Ou monter: -v /path/to/rtk:/root/.agents/skills/rtk/bin/rtk"
|
|
23
|
+
else
|
|
24
|
+
echo " ✅ RTK déjà installé: $(/root/.agents/skills/rtk/bin/rtk --version 2>&1)"
|
|
25
|
+
fi
|
|
26
|
+
|
|
27
|
+
# Copier la configuration RTK
|
|
28
|
+
if [ -f /opt/sith/skills/rtk-config.toml ]; then
|
|
29
|
+
cp /opt/sith/skills/rtk-config.toml /root/.agents/skills/rtk/config/config.toml
|
|
30
|
+
mkdir -p /root/.config/rtk
|
|
31
|
+
ln -sf /root/.agents/skills/rtk/config/config.toml /root/.config/rtk/config.toml
|
|
32
|
+
echo " ✅ Configuration RTK prête (binaire requis)"
|
|
33
|
+
fi
|
|
34
|
+
|
|
35
|
+
# Initialiser le hook bash pour RTK
|
|
36
|
+
if command -v rtk &> /dev/null; then
|
|
37
|
+
if [ -f /root/.bashrc ] && ! grep -q "rtk hook" /root/.bashrc; then
|
|
38
|
+
echo 'eval "$(rtk hook bash)"' >> /root/.bashrc
|
|
39
|
+
echo " ✅ RTK hook bash configuré"
|
|
40
|
+
fi
|
|
41
|
+
eval "$(rtk hook bash)" 2>/dev/null || true
|
|
42
|
+
fi
|
|
43
|
+
fi
|
|
44
|
+
|
|
45
|
+
# 2. Caveman (mode ultra)
|
|
46
|
+
if [ "${CAVEMAN_AUTO:-true}" = "true" ]; then
|
|
47
|
+
echo "📦 Installation de Caveman skill (mode ultra)..."
|
|
48
|
+
|
|
49
|
+
mkdir -p /root/.agents/skills
|
|
50
|
+
|
|
51
|
+
# Download Caveman if not present
|
|
52
|
+
if [ ! -d /opt/sith/skills/caveman ]; then
|
|
53
|
+
echo " 📥 Downloading Caveman from GitHub..."
|
|
54
|
+
mkdir -p /opt/sith/skills
|
|
55
|
+
cd /opt/sith/skills
|
|
56
|
+
curl -fsSL https://github.com/JuliusBrussee/caveman/archive/refs/heads/main.zip -o caveman.zip
|
|
57
|
+
unzip -q caveman.zip
|
|
58
|
+
mv caveman-main caveman
|
|
59
|
+
rm caveman.zip
|
|
60
|
+
echo " ✅ Caveman downloaded"
|
|
61
|
+
fi
|
|
62
|
+
|
|
63
|
+
if [ -d /opt/sith/skills/caveman ]; then
|
|
64
|
+
cp -r /opt/sith/skills/caveman /root/.agents/skills/caveman
|
|
65
|
+
|
|
66
|
+
cat > /root/.agents/skills/caveman/.config << 'EOF'
|
|
67
|
+
mode=ultra
|
|
68
|
+
auto_activate=true
|
|
69
|
+
EOF
|
|
70
|
+
|
|
71
|
+
echo " ✅ Caveman installé en mode ultra (compression maximale)"
|
|
72
|
+
else
|
|
73
|
+
echo " ⚠️ Caveman skill non trouvé - continuant sans Caveman"
|
|
74
|
+
fi
|
|
75
|
+
fi
|
|
76
|
+
|
|
77
|
+
# 3. Configuration OpenCode skills
|
|
78
|
+
if [ -f /opt/sith/skills/opencode-skills-config.json ]; then
|
|
79
|
+
mkdir -p /root/.local/share/opencode/skills
|
|
80
|
+
cp /opt/sith/skills/opencode-skills-config.json /root/.local/share/opencode/skills/config.json
|
|
81
|
+
fi
|
|
82
|
+
|
|
83
|
+
# Résumé
|
|
84
|
+
echo ""
|
|
85
|
+
echo "🎯 Skills d'optimisation de tokens:"
|
|
86
|
+
if command -v rtk &> /dev/null && [ "${RTK_ENABLED:-true}" = "true" ]; then
|
|
87
|
+
echo " ✅ RTK: Actif (60-90% réduction sur commandes CLI)"
|
|
88
|
+
fi
|
|
89
|
+
if [ -d /root/.agents/skills/caveman ] && [ "${CAVEMAN_AUTO:-true}" = "true" ]; then
|
|
90
|
+
echo " ✅ Caveman: Mode ultra (75%+ compression de langage)"
|
|
91
|
+
fi
|
|
92
|
+
echo ""
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Nix Shell Setup - Main entrypoint
|
|
3
|
+
# Called by shell.nix shellHook
|
|
4
|
+
|
|
5
|
+
set -e
|
|
6
|
+
|
|
7
|
+
# Source all setup scripts
|
|
8
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
9
|
+
|
|
10
|
+
# 1. Banner and versions
|
|
11
|
+
source "${SCRIPT_DIR}/01-banner.sh"
|
|
12
|
+
|
|
13
|
+
# 2. Environment variables
|
|
14
|
+
source "${SCRIPT_DIR}/02-env-vars.sh"
|
|
15
|
+
|
|
16
|
+
# 3. Directory setup
|
|
17
|
+
source "${SCRIPT_DIR}/03-directories.sh"
|
|
18
|
+
|
|
19
|
+
# 4. Git configuration
|
|
20
|
+
source "${SCRIPT_DIR}/04-git-config.sh"
|
|
21
|
+
|
|
22
|
+
# 5. OpenCode CLI installation
|
|
23
|
+
source "${SCRIPT_DIR}/05-opencode-cli.sh"
|
|
24
|
+
|
|
25
|
+
# 6. Skills installation (RTK + Caveman)
|
|
26
|
+
source "${SCRIPT_DIR}/06-skills-setup.sh"
|
|
27
|
+
|
|
28
|
+
# 7. Ready message
|
|
29
|
+
source "${SCRIPT_DIR}/07-ready.sh"
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# OpenCode Docker - Nix Shell Environment
|
|
2
|
+
# Environnement reproductible pour CI/CD
|
|
3
|
+
#
|
|
4
|
+
# Usage:
|
|
5
|
+
# - Dans Docker: automatiquement chargé par le Dockerfile
|
|
6
|
+
# - En local: nix-shell (si Nix est installé)
|
|
7
|
+
|
|
8
|
+
{ pkgs ? import (fetchTarball {
|
|
9
|
+
# Pin nixpkgs à une version stable spécifique pour reproductibilité
|
|
10
|
+
url = "https://github.com/NixOS/nixpkgs/archive/nixos-23.11.tar.gz";
|
|
11
|
+
sha256 = "1f5d2g1p6nfwycpmrnnmc2xmcszp804adp16knjvdkj8nz36y1fg";
|
|
12
|
+
}) {}
|
|
13
|
+
}:
|
|
14
|
+
|
|
15
|
+
let
|
|
16
|
+
# Load packages from external configuration
|
|
17
|
+
packages = import ./nix-config/packages.nix { inherit pkgs; lib = pkgs.lib; };
|
|
18
|
+
in
|
|
19
|
+
|
|
20
|
+
pkgs.mkShell {
|
|
21
|
+
name = "opencode-ci-environment";
|
|
22
|
+
|
|
23
|
+
# Packages loaded from nix-config/packages.json
|
|
24
|
+
buildInputs = packages;
|
|
25
|
+
|
|
26
|
+
# Variables d'environnement
|
|
27
|
+
shellHook = ''
|
|
28
|
+
# Source external setup script (not bash, so exports persist)
|
|
29
|
+
if [ -f /opt/sith/nix/nix-scripts/setup.sh ]; then
|
|
30
|
+
source /opt/sith/nix/nix-scripts/setup.sh
|
|
31
|
+
else
|
|
32
|
+
echo "⚠️ Setup scripts not found in /opt/sith/nix/nix-scripts/"
|
|
33
|
+
fi
|
|
34
|
+
'';
|
|
35
|
+
|
|
36
|
+
# Variables d'environnement persistantes
|
|
37
|
+
LOCALE_ARCHIVE = "${pkgs.glibcLocales}/lib/locale/locale-archive";
|
|
38
|
+
LANG = "en_US.UTF-8";
|
|
39
|
+
LC_ALL = "en_US.UTF-8";
|
|
40
|
+
LC_CTYPE = "en_US.UTF-8";
|
|
41
|
+
|
|
42
|
+
# SSL Certificates
|
|
43
|
+
SSL_CERT_FILE = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt";
|
|
44
|
+
NIX_SSL_CERT_FILE = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt";
|
|
45
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "2.2.0",
|
|
3
|
+
"description": "OpenCode Docker token optimization skills configuration",
|
|
4
|
+
"skills": [
|
|
5
|
+
{
|
|
6
|
+
"name": "caveman",
|
|
7
|
+
"enabled": true,
|
|
8
|
+
"mode": "ultra",
|
|
9
|
+
"auto_trigger": true,
|
|
10
|
+
"source": "https://github.com/JuliusBrussee/caveman",
|
|
11
|
+
"description": "Ultra-compressed communication mode - reduces response tokens by ~75%",
|
|
12
|
+
"features": [
|
|
13
|
+
"Caveman-style language compression",
|
|
14
|
+
"Maintains technical accuracy",
|
|
15
|
+
"Auto-activated for all responses",
|
|
16
|
+
"Mode: ultra (maximum compression)"
|
|
17
|
+
],
|
|
18
|
+
"estimated_reduction": "75%"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"name": "rtk",
|
|
22
|
+
"enabled": true,
|
|
23
|
+
"auto_hook": true,
|
|
24
|
+
"source": "https://github.com/rtk-ai/rtk",
|
|
25
|
+
"description": "CLI proxy for command output optimization - reduces command output by 60-90%",
|
|
26
|
+
"features": [
|
|
27
|
+
"Automatic command interception via bash hook",
|
|
28
|
+
"Filters: git, cargo, npm, docker, pytest, jest",
|
|
29
|
+
"Saves full output on failures",
|
|
30
|
+
"Configurable exclusions"
|
|
31
|
+
],
|
|
32
|
+
"estimated_reduction": "60-90%",
|
|
33
|
+
"supported_commands": [
|
|
34
|
+
"git status",
|
|
35
|
+
"git log",
|
|
36
|
+
"git diff",
|
|
37
|
+
"cargo build",
|
|
38
|
+
"cargo test",
|
|
39
|
+
"npm test",
|
|
40
|
+
"npm run",
|
|
41
|
+
"docker ps",
|
|
42
|
+
"docker logs",
|
|
43
|
+
"pytest",
|
|
44
|
+
"jest"
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
],
|
|
48
|
+
"combined_effect": {
|
|
49
|
+
"total_reduction": "85-95%",
|
|
50
|
+
"estimated_savings_per_session": "$6-8 (GPT-4 pricing)",
|
|
51
|
+
"best_for": "CI/CD environments with high command frequency"
|
|
52
|
+
},
|
|
53
|
+
"configuration": {
|
|
54
|
+
"rtk_config_path": "/root/.config/rtk/config.toml",
|
|
55
|
+
"caveman_path": "/root/.agents/skills/caveman",
|
|
56
|
+
"environment_variables": {
|
|
57
|
+
"CAVEMAN_MODE": "ultra",
|
|
58
|
+
"CAVEMAN_AUTO": "true",
|
|
59
|
+
"RTK_ENABLED": "true"
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# RTK (Rust Token Killer) Configuration
|
|
2
|
+
# Optimizes CLI output for LLM consumption - reduces tokens by 60-90%
|
|
3
|
+
# Used in OpenCode Docker for CI/CD token optimization
|
|
4
|
+
|
|
5
|
+
[hooks]
|
|
6
|
+
# Commands to exclude from RTK interception
|
|
7
|
+
# These commands shouldn't be filtered as they return critical raw data
|
|
8
|
+
exclude_commands = ["curl", "wget", "docker logs", "cat"]
|
|
9
|
+
|
|
10
|
+
[tee]
|
|
11
|
+
# Save full command output to disk when commands fail
|
|
12
|
+
# Useful for debugging while still getting compact output by default
|
|
13
|
+
enabled = true
|
|
14
|
+
mode = "failures" # Options: "failures", "always", "never"
|
|
15
|
+
|
|
16
|
+
[filters]
|
|
17
|
+
# Enable built-in filters for common dev tools
|
|
18
|
+
# Each filter reduces verbose output to essential information only
|
|
19
|
+
|
|
20
|
+
[filters.git]
|
|
21
|
+
enabled = true
|
|
22
|
+
level = "compact" # Options: "compact", "minimal", "full"
|
|
23
|
+
|
|
24
|
+
[filters.cargo]
|
|
25
|
+
enabled = true
|
|
26
|
+
level = "compact"
|
|
27
|
+
|
|
28
|
+
[filters.npm]
|
|
29
|
+
enabled = true
|
|
30
|
+
level = "compact"
|
|
31
|
+
|
|
32
|
+
[filters.docker]
|
|
33
|
+
enabled = true
|
|
34
|
+
level = "compact"
|
|
35
|
+
|
|
36
|
+
[filters.pytest]
|
|
37
|
+
enabled = true
|
|
38
|
+
level = "compact"
|
|
39
|
+
|
|
40
|
+
[filters.jest]
|
|
41
|
+
enabled = true
|
|
42
|
+
level = "compact"
|
|
43
|
+
|
|
44
|
+
# General output limits
|
|
45
|
+
[output]
|
|
46
|
+
max_lines = 500 # Maximum lines per command output
|
|
47
|
+
truncate_long_lines = true
|
|
48
|
+
max_line_length = 200 # Truncate lines longer than this
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@m14i/sith",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.3",
|
|
4
4
|
"description": "Turn your context to the dark side. Standardize and share your OpenCode setup with a fully dockerized environment, designed for seamless collaboration and CI integration.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"sith": "./dist/index.js"
|
|
12
12
|
},
|
|
13
13
|
"scripts": {
|
|
14
|
-
"build": "ncc build src/index.ts -o dist
|
|
14
|
+
"build": "ncc build src/index.ts -o dist && rm -rf dist/assets && cp -r assets dist/",
|
|
15
15
|
"dev": "tsx src/index.ts",
|
|
16
16
|
"dev:build": "pnpm build && node dist/index.js",
|
|
17
17
|
"dev:shell": "pnpm build && node dist/index.js shell",
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
},
|
|
22
22
|
"files": [
|
|
23
23
|
"dist",
|
|
24
|
-
"assets"
|
|
24
|
+
"assets",
|
|
25
|
+
"docker"
|
|
25
26
|
],
|
|
26
27
|
"keywords": [
|
|
27
28
|
"opencode",
|