{"_rev":"3-9a02139d805ef6070dbb0c3dc0a97853","time":{"created":"2025-07-10T14:22:57.038Z","modified":"2025-07-10T14:22:57.596Z","1.0.0-beta.0":"2025-07-10T14:13:02.717Z","1.0.0-beta.1":"2025-07-10T14:22:57.283Z"},"_id":"@6l20/check-config-usage","name":"@6l20/check-config-usage","dist-tags":{"beta":"1.0.0-beta.1","latest":"1.0.0-beta.1"},"versions":{"1.0.0-beta.1":{"name":"@6l20/check-config-usage","version":"1.0.0-beta.1","description":"CLI tool to audit usage of config.server.js variables","main":"index.js","directories":{"lib":"lib"},"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"keywords":[],"author":{"name":"6L20"},"license":"MIT","private":false,"type":"module","publishConfig":{"access":"public"},"bin":{"ccu":"bin/index.js","check-config-usage":"bin/index.js"},"_id":"@6l20/check-config-usage@1.0.0-beta.1","_nodeVersion":"20.18.3","_npmVersion":"11.4.1","dist":{"integrity":"sha512-dElpNsrkxsAUemCw9mjHZnO9Zb/6e+qMuHTytlSEsnjAtsrZDka5ag4aGpaSezO5574VsUrnUhQOfq1/7/+kDA==","shasum":"4cb103203fadb3f576053e9f7a09f6403ec54c18","tarball":"https://registry.npmjs.org/@6l20/check-config-usage/-/check-config-usage-1.0.0-beta.1.tgz","fileCount":19,"unpackedSize":28448,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCgl7vQryg1YVm6joSCt/ST71Qq3JaMbydT7FD/mlFpqgIgdjHNjq2s+wSjNviKWs/fqFo4yv7eWHgylEOtLAqafEk="}]},"_npmUser":{"name":"sylrom","email":"sylvainromestant@hessautomobile.com","actor":{"name":"sylrom","email":"sylvainromestant@hessautomobile.com","type":"user"}},"maintainers":[{"name":"sylrom","email":"sylvainromestant@hessautomobile.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/check-config-usage_1.0.0-beta.1_1752157377114_0.6439089576254198"},"_hasShrinkwrap":false}},"maintainers":[{"name":"sylrom","email":"sylvainromestant@hessautomobile.com"}],"description":"CLI tool to audit usage of config.server.js variables","keywords":[],"author":{"name":"6L20"},"license":"MIT","readme":"# 🔍 check-config-usage (alias `ccu`)\n\n![npm version](https://img.shields.io/badge/npm-v1.0.0-blue)\n![license](https://img.shields.io/badge/license-MIT-green)\n![stability](https://img.shields.io/badge/stability-stable-brightgreen)\n![last commit](https://img.shields.io/github/last-commit/6L20/check-config-usage?color=purple)\n![made with ❤️](https://img.shields.io/badge/made%20with-%E2%9D%A4-red)\n\n> Outil CLI pour auditer les variables **déclarées mais non utilisées** dans un projet Node.js, en se basant sur un fichier `config.server.js`.\n\n---\n\n## 🚀 Utilisation rapide\n\n```bash\nnpx check-config-usage\n# ou (si lié en local)\nccu\n```\n\nPar défaut, l’outil cherche un fichier `config.server.js` à la racine du projet et analyse tous les fichiers `.js`.\n\n---\n\n## 📦 Fonctionnalités\n\n- ✅ Extraction de toutes les **clés terminales** de `config.server.js` (notation en point : `a.b.c`)\n- 🔍 Scan des fichiers JS pour repérer les clés **utilisées** (via destructuration, alias, accès profonds…)\n- 📄 Génération de rapports :\n  - `config-usage-report.json` → clés non utilisées\n  - `config-unused-debug.json` → usages ambigus ou non résolus\n\n---\n\n## 🛠️ Syntaxe CLI\n\n```bash\nccu [options]\n```\n\n### Options disponibles\n\n| Option                  | Description                                                                 |\n|-------------------------|-----------------------------------------------------------------------------|\n| `--filename=FICHIER`     | Fichier de configuration à utiliser (par défaut : `config.server.js`)       |\n| `--out-dir=DIR`          | Répertoire de sortie pour les rapports JSON                                 |\n| `--debug` ou `-d`        | Active les logs de debug globaux                                            |\n| `--debug=FICHIER` ou `-d=FICHIER` | Active le debug ciblé pour un fichier spécifique             |\n| `--alias=ALIAS` ou `-a=ALIAS`     | Log uniquement les vérifications liées à un alias spécifique |\n| `--help` ou `-h`         | Affiche l’aide CLI                                                          |\n\n---\n\n## 🧪 Exemple\n\n```bash\nccu --filename=conf.js --out-dir=tmp/rapport --debug=TalendAWSQueue --alias=n8n\n```\n\n---\n\n## 📁 Structure du projet\n\n```\ncheck-config-usage/\n├── bin/\n│   └── index.js              # Entrée CLI principale\n├── lib/\n│   ├── extractMappings.js    # Extraction des alias et usages\n│   ├── matchUsages.js        # Analyse des utilisations\n│   ├── extractKeys.js        # Parcours de l’objet de config\n│   ├── walkJsFiles.js        # Recherche des fichiers à analyser\n│   ├── writeReport.js        # Sauvegarde du rapport principal\n│   ├── unresolved.js         # Sauvegarde des clés ambigües\n│   ├── parseArgs.js          # Parsing CLI\n│   ├── debug.js              # Flags de debug\n├── package.json\n├── jsconfig.json\n└── README.md\n```\n\n---\n\n## 🧠 Astuces\n\n- Pour debugger un seul fichier : `--debug=MonFichier`\n- Pour cibler un alias : `--alias=monAlias`\n- L’option `--out-dir` permet d’isoler les rapports dans un sous-dossier.\n\n---\n\n## 🚀 Installation & Utilisation\n### 🔧 Option 1 — Utilisation ponctuelle sans installation\nDepuis n’importe quel projet Node.js :\n\n```bash\nnpx /chemin/vers/check-config-usage/bin/index.js\n\nExemple :\nnpx ~/Dev/check-config-usage/bin/index.js\n```\n\n### 🌍 Option 2 — Installation globale via npm link\nDans le dossier du projet CLI :\n\n```bash\ncd ~/Dev/check-config-usage\nnpm link\n```\n\n>Ensuite, tu peux l'utiliser depuis n’importe quel projet avec :\n\n```bash\ncheck-config-usage\n# ou\nccu\n```\n\n## 🧪 Désinstallation globale\n```bash\nnpm unlink -g check-config-usage\n```\n\n---\n\n## ⚙️ Pré-requis\n\n- Node.js ≥ 16 recommandé\n- Aucun build ou transpilation requis\n- Fonctionne sans dépendances externes\n\n---\n\n## 📜 Licence\n\nLicence **MIT**  \nDéveloppé par **Hess-Digital**  \n\n*Conçu pour les équipes Node.js backend.*\n","readmeFilename":"README.md"}