sapper-ai 0.5.0 → 0.6.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.
Files changed (43) hide show
  1. package/dist/auth.d.ts +11 -0
  2. package/dist/auth.d.ts.map +1 -0
  3. package/dist/auth.js +102 -0
  4. package/dist/cli.d.ts.map +1 -1
  5. package/dist/cli.js +316 -32
  6. package/dist/harden.d.ts +28 -0
  7. package/dist/harden.d.ts.map +1 -0
  8. package/dist/harden.js +309 -0
  9. package/dist/mcp/jsonc.d.ts +3 -0
  10. package/dist/mcp/jsonc.d.ts.map +1 -0
  11. package/dist/mcp/jsonc.js +119 -0
  12. package/dist/mcp/wrapConfig.d.ts +22 -0
  13. package/dist/mcp/wrapConfig.d.ts.map +1 -0
  14. package/dist/mcp/wrapConfig.js +192 -0
  15. package/dist/policyYaml.d.ts +3 -0
  16. package/dist/policyYaml.d.ts.map +1 -0
  17. package/dist/policyYaml.js +27 -0
  18. package/dist/postinstall.d.ts.map +1 -1
  19. package/dist/postinstall.js +11 -2
  20. package/dist/quarantine.d.ts +13 -0
  21. package/dist/quarantine.d.ts.map +1 -0
  22. package/dist/quarantine.js +22 -0
  23. package/dist/report.d.ts.map +1 -1
  24. package/dist/report.js +1061 -59
  25. package/dist/scan.d.ts +15 -0
  26. package/dist/scan.d.ts.map +1 -1
  27. package/dist/scan.js +179 -178
  28. package/dist/utils/env.d.ts +3 -0
  29. package/dist/utils/env.d.ts.map +1 -0
  30. package/dist/utils/env.js +25 -0
  31. package/dist/utils/format.d.ts +22 -0
  32. package/dist/utils/format.d.ts.map +1 -0
  33. package/dist/utils/format.js +97 -0
  34. package/dist/utils/fs.d.ts +7 -0
  35. package/dist/utils/fs.d.ts.map +1 -0
  36. package/dist/utils/fs.js +47 -0
  37. package/dist/utils/repoRoot.d.ts +2 -0
  38. package/dist/utils/repoRoot.d.ts.map +1 -0
  39. package/dist/utils/repoRoot.js +20 -0
  40. package/dist/utils/semver.d.ts +2 -0
  41. package/dist/utils/semver.d.ts.map +1 -0
  42. package/dist/utils/semver.js +7 -0
  43. package/package.json +5 -7
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.renderPolicyYaml = renderPolicyYaml;
4
+ const presets_1 = require("./presets");
5
+ function renderPolicyYaml(preset, auditLogPath) {
6
+ const p = presets_1.presets[preset].policy;
7
+ const lines = [];
8
+ lines.push(`mode: ${p.mode}`);
9
+ lines.push(`defaultAction: ${p.defaultAction}`);
10
+ lines.push(`failOpen: ${p.failOpen}`);
11
+ lines.push('');
12
+ lines.push('detectors:');
13
+ const detectors = p.detectors ?? ['rules'];
14
+ for (const d of detectors) {
15
+ lines.push(` - ${d}`);
16
+ }
17
+ lines.push('');
18
+ lines.push('thresholds:');
19
+ const thresholds = p.thresholds ?? {};
20
+ lines.push(` riskThreshold: ${thresholds.riskThreshold ?? 0.7}`);
21
+ lines.push(` blockMinConfidence: ${thresholds.blockMinConfidence ?? 0.5}`);
22
+ if (auditLogPath) {
23
+ lines.push('');
24
+ lines.push(`auditLogPath: ${auditLogPath}`);
25
+ }
26
+ return `${lines.join('\n')}\n`;
27
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"postinstall.d.ts","sourceRoot":"","sources":["../src/postinstall.ts"],"names":[],"mappings":"AAEA,wBAAgB,cAAc,IAAI,IAAI,CAKrC"}
1
+ {"version":3,"file":"postinstall.d.ts","sourceRoot":"","sources":["../src/postinstall.ts"],"names":[],"mappings":"AAIA,wBAAgB,cAAc,IAAI,IAAI,CAYrC"}
@@ -1,10 +1,19 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.runPostinstall = runPostinstall;
4
- const MESSAGE = "SapperAI installed. Run 'npx sapper-ai scan' to check your environment.";
7
+ const package_json_1 = __importDefault(require("../package.json"));
8
+ const format_1 = require("./utils/format");
5
9
  function runPostinstall() {
6
10
  try {
7
- console.log(MESSAGE);
11
+ const colors = (0, format_1.createColors)();
12
+ const version = typeof package_json_1.default.version === 'string' ? package_json_1.default.version : '';
13
+ const name = colors.olive ? `${colors.olive}sapper-ai${colors.reset}` : 'sapper-ai';
14
+ const ver = version ? `${colors.dim}v${version}${colors.reset}` : '';
15
+ console.log(`\n ${name} ${ver}\n`);
16
+ console.log(' Run npx sapper-ai scan to get started.\n');
8
17
  }
9
18
  catch {
10
19
  }
@@ -0,0 +1,13 @@
1
+ export interface QuarantineListOptions {
2
+ quarantineDir?: string;
3
+ write?: (text: string) => void;
4
+ }
5
+ export interface QuarantineRestoreOptions {
6
+ id: string;
7
+ quarantineDir?: string;
8
+ force?: boolean;
9
+ write?: (text: string) => void;
10
+ }
11
+ export declare function runQuarantineList(options?: QuarantineListOptions): Promise<number>;
12
+ export declare function runQuarantineRestore(options: QuarantineRestoreOptions): Promise<number>;
13
+ //# sourceMappingURL=quarantine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quarantine.d.ts","sourceRoot":"","sources":["../src/quarantine.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,qBAAqB;IACpC,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;CAC/B;AAED,MAAM,WAAW,wBAAwB;IACvC,EAAE,EAAE,MAAM,CAAA;IACV,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;CAC/B;AAED,wBAAsB,iBAAiB,CAAC,OAAO,GAAE,qBAA0B,GAAG,OAAO,CAAC,MAAM,CAAC,CAiB5F;AAED,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,wBAAwB,GAAG,OAAO,CAAC,MAAM,CAAC,CAO7F"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runQuarantineList = runQuarantineList;
4
+ exports.runQuarantineRestore = runQuarantineRestore;
5
+ const core_1 = require("@sapper-ai/core");
6
+ async function runQuarantineList(options = {}) {
7
+ const manager = new core_1.QuarantineManager({ quarantineDir: options.quarantineDir });
8
+ const records = await manager.list();
9
+ const write = options.write ?? ((text) => process.stdout.write(text));
10
+ write(`${JSON.stringify({
11
+ count: records.length,
12
+ records,
13
+ }, null, 2)}\n`);
14
+ return 0;
15
+ }
16
+ async function runQuarantineRestore(options) {
17
+ const manager = new core_1.QuarantineManager({ quarantineDir: options.quarantineDir });
18
+ await manager.restore(options.id, { force: options.force === true });
19
+ const write = options.write ?? ((text) => process.stdout.write(text));
20
+ write(`Restored quarantine record: ${options.id}\n`);
21
+ return 0;
22
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../src/report.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AA2nBxC,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAoB7D"}
1
+ {"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../src/report.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AAsmDxC,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAoB7D"}