@iacmp/cli 1.1.0
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/LICENSE +21 -0
- package/bin/run.js +73 -0
- package/dist/chat.js +4068 -0
- package/dist/commands/ai.js +3985 -0
- package/dist/commands/audit-all.js +1039 -0
- package/dist/commands/audit-dr.js +351 -0
- package/dist/commands/audit-ha.js +375 -0
- package/dist/commands/audit-improvements.js +373 -0
- package/dist/commands/audit-security.js +351 -0
- package/dist/commands/dashboard.js +417 -0
- package/dist/commands/deploy.js +188 -0
- package/dist/commands/destroy.js +194 -0
- package/dist/commands/diagram.js +896 -0
- package/dist/commands/diff.js +4420 -0
- package/dist/commands/doctor.js +191 -0
- package/dist/commands/init.js +507 -0
- package/dist/commands/ls.js +75 -0
- package/dist/commands/registry.js +170 -0
- package/dist/commands/registry.json +29 -0
- package/dist/commands/synth.js +4458 -0
- package/dist/commands/watch.js +133 -0
- package/dist/index.js +30 -0
- package/oclif.manifest.json +727 -0
- package/package.json +95 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Caio Melo / melocalex
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/bin/run.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// Carrega .env do projeto do usuário sem depender de dotenvx
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
(function loadEnv() {
|
|
7
|
+
const envPath = path.resolve(process.cwd(), '.env');
|
|
8
|
+
if (!fs.existsSync(envPath)) return;
|
|
9
|
+
const lines = fs.readFileSync(envPath, 'utf8').split('\n');
|
|
10
|
+
for (const line of lines) {
|
|
11
|
+
const trimmed = line.trim();
|
|
12
|
+
if (!trimmed || trimmed.startsWith('#')) continue;
|
|
13
|
+
const eq = trimmed.indexOf('=');
|
|
14
|
+
if (eq === -1) continue;
|
|
15
|
+
const key = trimmed.slice(0, eq).trim();
|
|
16
|
+
const val = trimmed.slice(eq + 1).trim();
|
|
17
|
+
if (key) process.env[key] = val;
|
|
18
|
+
}
|
|
19
|
+
})();
|
|
20
|
+
|
|
21
|
+
// Intercepta `iacmp ai --chat` ANTES do oclif — executa chat.js diretamente
|
|
22
|
+
// evitando que o oclif destrua o stdin antes do processo filho iniciar
|
|
23
|
+
const argv = process.argv.slice(2);
|
|
24
|
+
const isChat = argv.includes('ai') && (argv.includes('--chat') || argv.includes('-chat'));
|
|
25
|
+
|
|
26
|
+
if (isChat) {
|
|
27
|
+
const cp = require('child_process');
|
|
28
|
+
// chat é bundlado (com @iacmp/ai inlinado) para dist/chat.js pelo tsup
|
|
29
|
+
const chatScript = path.resolve(__dirname, '..', 'dist', 'chat.js');
|
|
30
|
+
|
|
31
|
+
// Detecta --provider / -p
|
|
32
|
+
let provider = 'aws';
|
|
33
|
+
const pIdx = argv.findIndex(a => a === '--provider' || a === '-p');
|
|
34
|
+
if (pIdx !== -1 && argv[pIdx + 1]) provider = argv[pIdx + 1];
|
|
35
|
+
|
|
36
|
+
// Detecta --dry-run
|
|
37
|
+
const dryRun = argv.includes('--dry-run') ? '1' : '0';
|
|
38
|
+
|
|
39
|
+
// Carrega iacmp.json do projeto para provider padrão
|
|
40
|
+
try {
|
|
41
|
+
const cfgPath = path.resolve(process.cwd(), 'iacmp.json');
|
|
42
|
+
if (fs.existsSync(cfgPath)) {
|
|
43
|
+
const cfg = JSON.parse(fs.readFileSync(cfgPath, 'utf8'));
|
|
44
|
+
if (cfg.provider && provider === 'aws') provider = cfg.provider;
|
|
45
|
+
}
|
|
46
|
+
} catch {}
|
|
47
|
+
|
|
48
|
+
const child = cp.spawn(process.execPath, [chatScript], {
|
|
49
|
+
stdio: 'inherit',
|
|
50
|
+
env: {
|
|
51
|
+
...process.env,
|
|
52
|
+
IACMP_CWD: process.cwd(),
|
|
53
|
+
IACMP_PROVIDER: provider,
|
|
54
|
+
IACMP_DRYRUN: dryRun,
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
child.on('close', code => process.exit(code || 0));
|
|
59
|
+
} else {
|
|
60
|
+
// Garante que @iacmp/* seja sempre resolvido a partir do node_modules do CLI
|
|
61
|
+
const Module = require('module');
|
|
62
|
+
const _orig = Module._resolveFilename.bind(Module);
|
|
63
|
+
Module._resolveFilename = function (req, parent, isMain, opts) {
|
|
64
|
+
if (req.startsWith('@iacmp/')) {
|
|
65
|
+
try { return _orig(req, parent, isMain, opts); } catch {}
|
|
66
|
+
return _orig(req, module, isMain, opts);
|
|
67
|
+
}
|
|
68
|
+
return _orig(req, parent, isMain, opts);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const { run, handle, flush } = require('@oclif/core');
|
|
72
|
+
run(argv, __dirname).then(flush).catch(handle);
|
|
73
|
+
}
|