komplian 0.7.0 → 0.7.2
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/README.md +1 -1
- package/komplian-db-all-dev.mjs +32 -29
- package/komplian-localhost.mjs +73 -48
- package/komplian-mcp-tools.mjs +46 -41
- package/komplian-onboard.mjs +237 -116
- package/komplian-postman.mjs +35 -27
- package/komplian-setup.mjs +359 -168
- package/package.json +2 -2
package/komplian-postman.mjs
CHANGED
|
@@ -35,6 +35,7 @@ const c = {
|
|
|
35
35
|
};
|
|
36
36
|
|
|
37
37
|
function log(s = "") {
|
|
38
|
+
if (process.env.KOMPLIAN_CLI_QUIET === "1") return;
|
|
38
39
|
console.log(s);
|
|
39
40
|
}
|
|
40
41
|
|
|
@@ -45,6 +46,11 @@ function formatHomePath(absPath) {
|
|
|
45
46
|
return absPath;
|
|
46
47
|
}
|
|
47
48
|
|
|
49
|
+
/** JSON exports never go into the monorepo root (avoids accidental commits). */
|
|
50
|
+
function defaultPostmanExportDir() {
|
|
51
|
+
return join(homedir(), ".komplian", "postman-export");
|
|
52
|
+
}
|
|
53
|
+
|
|
48
54
|
function maskEmail(email) {
|
|
49
55
|
if (!email || typeof email !== "string" || !email.includes("@")) {
|
|
50
56
|
return "[sin email]";
|
|
@@ -126,9 +132,8 @@ function logApiFailure(context, status, body) {
|
|
|
126
132
|
extra = " [debug: no serializable]";
|
|
127
133
|
}
|
|
128
134
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
);
|
|
135
|
+
const line = `${c.yellow}○${c.reset} ${context}: HTTP ${status}${hint ? ` — ${hint}` : ""}${extra}`;
|
|
136
|
+
console.error(line);
|
|
132
137
|
}
|
|
133
138
|
|
|
134
139
|
function ensureSecureKomplianDir() {
|
|
@@ -243,21 +248,15 @@ export function savePostmanApiKeyToKomplianHome(apiKey) {
|
|
|
243
248
|
}
|
|
244
249
|
|
|
245
250
|
function printMissingKeyHelp() {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
);
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
);
|
|
255
|
-
log(``);
|
|
256
|
-
log(` ${c.bold}Sin TTY (CI, pipes):${c.reset}`);
|
|
257
|
-
log(` ${c.dim}export POSTMAN_API_KEY=…${c.reset}`);
|
|
258
|
-
log(
|
|
259
|
-
`${c.dim} Archivo: ${formatHomePath(defaultKeyPath())} (permiso 600)${c.reset}`
|
|
260
|
-
);
|
|
251
|
+
const w = (s) => console.error(s);
|
|
252
|
+
w(`${c.red}✗${c.reset} No Postman API key.`);
|
|
253
|
+
w(``);
|
|
254
|
+
w(` ${c.bold}Interactive terminal:${c.reset}`);
|
|
255
|
+
w(` ${c.cyan}npx komplian postman --yes${c.reset}`);
|
|
256
|
+
w(` ${c.cyan}npx komplian postman login${c.reset}`);
|
|
257
|
+
w(``);
|
|
258
|
+
w(` ${c.bold}CI / no TTY:${c.reset} ${c.dim}POSTMAN_API_KEY${c.reset}`);
|
|
259
|
+
w(`${c.dim} ${formatHomePath(defaultKeyPath())}${c.reset}`);
|
|
261
260
|
process.exit(1);
|
|
262
261
|
}
|
|
263
262
|
|
|
@@ -861,7 +860,7 @@ function usage() {
|
|
|
861
860
|
log(``);
|
|
862
861
|
log(` -y, --yes Sin prompts extra (si falta API key y hay TTY, pide la clave una vez y guarda)`);
|
|
863
862
|
log(` --export-only Solo escribe JSON en disco (no llama a la API de Postman)`);
|
|
864
|
-
log(` --out <dir>
|
|
863
|
+
log(` --out <dir> Export folder (default: ~/.komplian/postman-export)`);
|
|
865
864
|
log(` --dotenv <ruta> .env extra (además de api/.env, .env, KOMPLIAN_DOTENV)`);
|
|
866
865
|
log(` -h, --help`);
|
|
867
866
|
log(``);
|
|
@@ -971,23 +970,29 @@ export async function runPostman(argv) {
|
|
|
971
970
|
apiKey,
|
|
972
971
|
process.env.POSTMAN_WORKSPACE_ID
|
|
973
972
|
);
|
|
974
|
-
|
|
975
|
-
`${c.green}✓${c.reset}
|
|
976
|
-
|
|
973
|
+
if (!process.env.KOMPLIAN_CLI_QUIET) {
|
|
974
|
+
log(`${c.green}✓${c.reset} Postman workspace: ${c.bold}${workspaceId}${c.reset}`);
|
|
975
|
+
}
|
|
977
976
|
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
: resolve(process.cwd(), "komplian-postman");
|
|
977
|
+
ensureSecureKomplianDir();
|
|
978
|
+
const outBase = args.outDir ? resolve(args.outDir) : defaultPostmanExportDir();
|
|
981
979
|
mkdirSync(outBase, { recursive: true });
|
|
982
980
|
|
|
983
981
|
const collPath = join(outBase, "Komplian-API.postman_collection.json");
|
|
984
982
|
writeFileSync(collPath, JSON.stringify(collection, null, 2), "utf8");
|
|
985
|
-
|
|
983
|
+
const quiet = process.env.KOMPLIAN_CLI_QUIET === "1";
|
|
984
|
+
if (!quiet) {
|
|
985
|
+
log(`${c.green}✓${c.reset} Export: ${c.dim}${collPath}${c.reset}`);
|
|
986
|
+
}
|
|
986
987
|
|
|
987
988
|
for (const env of envsForExport) {
|
|
988
989
|
const safe = env.name.replace(/[\\/]/g, "-") + ".postman_environment.json";
|
|
989
990
|
writeFileSync(join(outBase, safe), JSON.stringify({ ...env }, null, 2), "utf8");
|
|
990
|
-
|
|
991
|
+
if (!quiet) {
|
|
992
|
+
log(
|
|
993
|
+
`${c.green}✓${c.reset} Export: ${c.dim}${join(outBase, safe)}${c.reset} ${c.dim}(no secrets)${c.reset}`
|
|
994
|
+
);
|
|
995
|
+
}
|
|
991
996
|
}
|
|
992
997
|
|
|
993
998
|
if (args.exportOnly) {
|
|
@@ -1035,6 +1040,9 @@ export async function runPostman(argv) {
|
|
|
1035
1040
|
`${c.dim} Para rellenar apiKey: exporta API_KEY o pon api/.env y vuelve a ejecutar este comando.${c.reset}`
|
|
1036
1041
|
);
|
|
1037
1042
|
}
|
|
1043
|
+
if (process.env.KOMPLIAN_CLI_QUIET === "1") {
|
|
1044
|
+
console.log(`${c.green}✓${c.reset} postman`);
|
|
1045
|
+
}
|
|
1038
1046
|
}
|
|
1039
1047
|
|
|
1040
1048
|
/**
|