enigma-cli 1.1.0 → 1.1.1

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.
@@ -3,6 +3,6 @@
3
3
  "version": "1.0.0",
4
4
  "provider": "FJRG2007/enigma",
5
5
  "description": "Backend/API architecture: controller-service-repository layering, API and request optimization, server-side caching (Redis), and Zod boundary validation.",
6
- "cliVersion": "1.1.0",
6
+ "cliVersion": "1.1.1",
7
7
  "sha": "c442bc9e39a7710cb709ef2abb8d15ecd8aa16ed4f5c8af92b7af6877401cba4"
8
8
  }
@@ -3,6 +3,6 @@
3
3
  "version": "1.1.0",
4
4
  "provider": "FJRG2007/enigma",
5
5
  "description": "Ciphera code style conventions (formatting, naming, imports, comments, code-level anti-patterns; TypeScript-first, language-agnostic).",
6
- "cliVersion": "1.1.0",
6
+ "cliVersion": "1.1.1",
7
7
  "sha": "f8602bb79fbbe063ab39fbd59d0b7844a22c3a1583fcd11c1b4f98a2fe8ddc86"
8
8
  }
@@ -3,6 +3,6 @@
3
3
  "version": "1.0.0",
4
4
  "provider": "FJRG2007/enigma",
5
5
  "description": "Pre-delivery self-review gate, prioritized review dimensions, and change-quality criteria.",
6
- "cliVersion": "1.1.0",
6
+ "cliVersion": "1.1.1",
7
7
  "sha": "3d3bbe0602d5bbb4afe37648fe3c2fa39376b1bcbac5d8c441f01fad1e866ed0"
8
8
  }
@@ -3,6 +3,6 @@
3
3
  "version": "1.4.0",
4
4
  "provider": "FJRG2007/enigma",
5
5
  "description": "Core engineering execution policy and harness orchestration (highest-authority rules).",
6
- "cliVersion": "1.1.0",
6
+ "cliVersion": "1.1.1",
7
7
  "sha": "c9c69c59516794311cb7b306ed4d4ad971824de3689a39c2b86c7669c73f2e8b"
8
8
  }
@@ -3,6 +3,6 @@
3
3
  "version": "1.0.0",
4
4
  "provider": "FJRG2007/enigma",
5
5
  "description": "Senior database architecture policy: query optimization, anti-duplication/normalization, scalability, and RGPD/GDPR encryption.",
6
- "cliVersion": "1.1.0",
6
+ "cliVersion": "1.1.1",
7
7
  "sha": "c4617ee8d1a57d9621c81bef3093e94de91f79eec0cc0ead41f6d18dd443e623"
8
8
  }
@@ -3,6 +3,6 @@
3
3
  "version": "1.0.0",
4
4
  "provider": "FJRG2007/enigma",
5
5
  "description": "Reproduce-isolate-fix debugging methodology with root-cause discipline and regression verification.",
6
- "cliVersion": "1.1.0",
6
+ "cliVersion": "1.1.1",
7
7
  "sha": "14b0064c8b33a0dc85e51464b05005cf5801c756b1101789a6924b9548420f6b"
8
8
  }
@@ -3,6 +3,6 @@
3
3
  "version": "1.0.0",
4
4
  "provider": "FJRG2007/enigma",
5
5
  "description": "Dependency and supply-chain security: lockfiles and reproducible installs, version pinning, vulnerability auditing, vetting/minimizing packages, vendoring, and SBOM/provenance.",
6
- "cliVersion": "1.1.0",
6
+ "cliVersion": "1.1.1",
7
7
  "sha": "6375d835c2aef2c9bd31ce116444dc3d796f510f9970a213aa3ac4696d7e21b9"
8
8
  }
@@ -3,6 +3,6 @@
3
3
  "version": "1.0.0",
4
4
  "provider": "FJRG2007/enigma",
5
5
  "description": "Frontend architecture: reusable components, abstraction thresholds, state management, and optimistic UI with rollback.",
6
- "cliVersion": "1.1.0",
6
+ "cliVersion": "1.1.1",
7
7
  "sha": "b0355b0e15f9f528d32adf19f0722d2727cd64d6b3544307ecc7a3141338f023"
8
8
  }
@@ -3,6 +3,6 @@
3
3
  "version": "1.2.0",
4
4
  "provider": "FJRG2007/enigma",
5
5
  "description": "Git & contribution policy (senior engineering standards).",
6
- "cliVersion": "1.1.0",
6
+ "cliVersion": "1.1.1",
7
7
  "sha": "ada4b7eb5bb7e013429e23703c271c0f34b0d76327c059efa148ea2794f96178"
8
8
  }
@@ -3,6 +3,6 @@
3
3
  "version": "1.0.0",
4
4
  "provider": "FJRG2007/enigma",
5
5
  "description": "Application and AI-agent security: secrets, authn/authz (least privilege), OWASP Top 10, transport/crypto baseline, secure logging, and agent/MCP/tool-use safety.",
6
- "cliVersion": "1.1.0",
6
+ "cliVersion": "1.1.1",
7
7
  "sha": "9971e9d9127397d0152e89d24aad3191e2935e55a8483db7fd15f5d4d7a60e7a"
8
8
  }
@@ -3,6 +3,6 @@
3
3
  "version": "1.0.0",
4
4
  "provider": "FJRG2007/enigma",
5
5
  "description": "Test strategy, coverage gates, deterministic tests, mocking discipline, and regression-first bug fixing.",
6
- "cliVersion": "1.1.0",
6
+ "cliVersion": "1.1.1",
7
7
  "sha": "d19fa8ec7985ed231478be504d3c80360897f555d0bc0624bea19c091f459fb0"
8
8
  }
@@ -3,6 +3,6 @@
3
3
  "version": "1.0.0",
4
4
  "provider": "FJRG2007/enigma",
5
5
  "description": "Strict frontend + backend schema validation, schema consistency, and safe client-facing error handling.",
6
- "cliVersion": "1.1.0",
6
+ "cliVersion": "1.1.1",
7
7
  "sha": "a33622a2f810ee4cea39824cb1a7ca34b355a917d4224025df50d77dd74f0b3a"
8
8
  }
package/dist/enigma.js CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/cli.ts
4
- import { dirname as dirname4, join as join9 } from "path";
4
+ import { dirname as dirname4, join as join10 } from "path";
5
5
  import { fileURLToPath as fileURLToPath4 } from "url";
6
- import * as p4 from "@clack/prompts";
6
+ import * as p5 from "@clack/prompts";
7
7
 
8
8
  // src/util.ts
9
9
  import { existsSync, statSync, readFileSync } from "fs";
@@ -992,9 +992,105 @@ From: ${sources.join(", ")}` : "\nFrom: built-in defaults (no .enigma.json found
992
992
  return 0;
993
993
  }
994
994
 
995
+ // src/update.ts
996
+ import { homedir as homedir5 } from "os";
997
+ import { join as join9 } from "path";
998
+ import { writeFileSync as writeFileSync6 } from "fs";
999
+ import { spawn, spawnSync } from "child_process";
1000
+ import * as p4 from "@clack/prompts";
1001
+ var REGISTRY_URL = "https://registry.npmjs.org/enigma-cli/latest";
1002
+ var UPDATE_COMMAND = "npm i -g enigma-cli@latest";
1003
+ var CACHE_FILE = join9(homedir5(), ".enigma-update-check.json");
1004
+ var CHECK_INTERVAL_MS = 24 * 60 * 60 * 1e3;
1005
+ var CHILD_SCRIPT = [
1006
+ "const fs = require('fs');",
1007
+ "const ctrl = new AbortController();",
1008
+ "const t = setTimeout(() => ctrl.abort(), 5000);",
1009
+ "fetch(process.env.E_URL, { signal: ctrl.signal, headers: { 'user-agent': 'enigma-cli-update-check' } })",
1010
+ " .then((r) => (r.ok ? r.json() : null))",
1011
+ " .then((d) => { if (d && d.version) fs.writeFileSync(process.env.E_FILE, JSON.stringify({ latest: d.version, checkedAt: Date.now() })); })",
1012
+ " .catch(() => {})",
1013
+ " .finally(() => clearTimeout(t));"
1014
+ ].join("\n");
1015
+ function parseVersion(version) {
1016
+ const core = String(version).trim().replace(/^v/, "").split("-")[0];
1017
+ const [major, minor, patch] = core.split(".").map((n) => parseInt(n, 10) || 0);
1018
+ return [major || 0, minor || 0, patch || 0];
1019
+ }
1020
+ function isNewer(latest, current) {
1021
+ const a = parseVersion(latest);
1022
+ const b = parseVersion(current);
1023
+ for (let i = 0; i < 3; i++) {
1024
+ if (a[i] > b[i]) return true;
1025
+ if (a[i] < b[i]) return false;
1026
+ }
1027
+ return false;
1028
+ }
1029
+ function paint(text, code) {
1030
+ return process.stdout.isTTY && !process.env.NO_COLOR ? `\x1B[${code}m${text}\x1B[0m` : text;
1031
+ }
1032
+ function renderUpdateBox(current, latest) {
1033
+ const lines = [
1034
+ { text: `Update available ${current} -> ${latest}`, color: "1;33" },
1035
+ { text: `Run ${UPDATE_COMMAND} to update`, color: "36" }
1036
+ ];
1037
+ const width = Math.max(...lines.map((l) => l.text.length));
1038
+ const border = `+${"-".repeat(width + 4)}+`;
1039
+ const blank = `|${" ".repeat(width + 4)}|`;
1040
+ const rows = lines.map((l) => `|${paint(` ${l.text}${" ".repeat(width - l.text.length)} `, l.color)}|`);
1041
+ return [border, blank, ...rows, blank, border].join("\n");
1042
+ }
1043
+ function readCache() {
1044
+ return readJson(CACHE_FILE);
1045
+ }
1046
+ function scheduleUpdateCheck() {
1047
+ try {
1048
+ const cache = readCache();
1049
+ if (cache && Date.now() - cache.checkedAt < CHECK_INTERVAL_MS) return;
1050
+ writeFileSync6(CACHE_FILE, JSON.stringify({ latest: cache?.latest ?? null, checkedAt: Date.now() }));
1051
+ const child = spawn(process.execPath, ["-e", CHILD_SCRIPT], {
1052
+ detached: true,
1053
+ stdio: "ignore",
1054
+ windowsHide: true,
1055
+ env: { ...process.env, E_URL: REGISTRY_URL, E_FILE: CACHE_FILE }
1056
+ });
1057
+ child.unref();
1058
+ } catch {
1059
+ }
1060
+ }
1061
+ function runUpdate() {
1062
+ try {
1063
+ const result = spawnSync("npm", ["i", "-g", "enigma-cli@latest"], {
1064
+ stdio: "inherit",
1065
+ shell: process.platform === "win32"
1066
+ });
1067
+ if (result.status === 0) console.log("Updated. Re-run your command to use the new version.");
1068
+ else console.log(`Update did not complete. Run '${UPDATE_COMMAND}' manually.`);
1069
+ } catch {
1070
+ console.log(`Could not run the update. Run '${UPDATE_COMMAND}' manually.`);
1071
+ }
1072
+ }
1073
+ async function notifyUpdate(current, interactive) {
1074
+ if (!process.stdout.isTTY || process.env.CI) return;
1075
+ try {
1076
+ scheduleUpdateCheck();
1077
+ const cache = readCache();
1078
+ const latest = cache?.latest ? String(cache.latest).replace(/[^\w.+-]/g, "") : "";
1079
+ if (!latest || !isNewer(latest, current)) return;
1080
+ process.stdout.write(`
1081
+ ${renderUpdateBox(current, latest)}
1082
+ `);
1083
+ if (!interactive) return;
1084
+ const ok = await p4.confirm({ message: `Update now with ${UPDATE_COMMAND}?`, initialValue: true });
1085
+ if (p4.isCancel(ok) || !ok) return;
1086
+ runUpdate();
1087
+ } catch {
1088
+ }
1089
+ }
1090
+
995
1091
  // src/cli.ts
996
1092
  var __dirname3 = dirname4(fileURLToPath4(import.meta.url));
997
- var PKG = readJson(join9(__dirname3, "..", "package.json")) || {};
1093
+ var PKG = readJson(join10(__dirname3, "..", "package.json")) || {};
998
1094
  var COMMANDS = /* @__PURE__ */ new Set(["install", "security", "guard", "seal", "check", "config", "help", "version"]);
999
1095
  function parseArgs(argv) {
1000
1096
  const opts = {
@@ -1142,12 +1238,16 @@ Examples:
1142
1238
  }
1143
1239
  async function run(argv) {
1144
1240
  const opts = parseArgs(argv);
1241
+ const interactive = Boolean(process.stdout.isTTY) && !opts.yes;
1242
+ const version = PKG.version || "0.0.0";
1145
1243
  if (opts.help || opts.command === "help") {
1146
1244
  printHelp();
1245
+ await notifyUpdate(version, interactive);
1147
1246
  return;
1148
1247
  }
1149
1248
  if (opts.version || opts.command === "version") {
1150
- console.log(PKG.version || "0.0.0");
1249
+ console.log(version);
1250
+ await notifyUpdate(version, interactive);
1151
1251
  return;
1152
1252
  }
1153
1253
  if (opts.command === "seal") return sealSources();
@@ -1158,23 +1258,24 @@ async function run(argv) {
1158
1258
  if (opts.command === "config") {
1159
1259
  process.exit(runConfigCli(opts.positionals, opts.scope));
1160
1260
  }
1161
- const interactive = Boolean(process.stdout.isTTY) && !opts.yes;
1162
1261
  if (opts.command === "install") {
1163
- p4.intro("enigma - install agent skills");
1262
+ p5.intro("enigma - install agent skills");
1164
1263
  await installSkills(opts, interactive);
1165
- p4.outro("Done.");
1264
+ p5.outro("Done.");
1265
+ await notifyUpdate(version, interactive);
1166
1266
  return;
1167
1267
  }
1168
1268
  if (opts.command === "security") {
1169
- p4.intro("enigma - git security hooks");
1269
+ p5.intro("enigma - git security hooks");
1170
1270
  const done = await setupGitHooks(opts, interactive);
1171
- p4.outro(done ? "Git hooks configured." : "No changes made.");
1271
+ p5.outro(done ? "Git hooks configured." : "No changes made.");
1272
+ await notifyUpdate(version, interactive);
1172
1273
  return;
1173
1274
  }
1174
- p4.intro("enigma");
1275
+ p5.intro("enigma");
1175
1276
  let features;
1176
1277
  if (interactive) {
1177
- const r = await p4.multiselect({
1278
+ const r = await p5.multiselect({
1178
1279
  message: "What do you want to set up?",
1179
1280
  options: [
1180
1281
  { value: "skills", label: "Agent skills", hint: "Claude Code, Codex, opencode" },
@@ -1183,8 +1284,8 @@ async function run(argv) {
1183
1284
  initialValues: ["skills"],
1184
1285
  required: true
1185
1286
  });
1186
- if (p4.isCancel(r)) {
1187
- p4.cancel("Aborted.");
1287
+ if (p5.isCancel(r)) {
1288
+ p5.cancel("Aborted.");
1188
1289
  return;
1189
1290
  }
1190
1291
  features = r;
@@ -1193,7 +1294,8 @@ async function run(argv) {
1193
1294
  }
1194
1295
  if (features.includes("skills")) await installSkills(opts, interactive);
1195
1296
  if (features.includes("security")) await setupGitHooks(opts, interactive);
1196
- p4.outro("Done.");
1297
+ p5.outro("Done.");
1298
+ await notifyUpdate(version, interactive);
1197
1299
  }
1198
1300
 
1199
1301
  // src/bin/enigma.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "enigma-cli",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Everything you need to work with a coding agent: install shared policy skills for Claude Code, OpenAI Codex and opencode, and set up portable git security hooks.",
5
5
  "type": "module",
6
6
  "bin": {