sapper-ai 0.4.0 → 0.6.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.
@@ -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,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.runPostinstall = runPostinstall;
4
- const MESSAGE = "SapperAI installed. Run 'npx sapper-ai scan' to check your environment.";
4
+ const MESSAGE = "SapperAI installed. Run 'npx sapper-ai scan' and follow the prompts to harden your setup.";
5
5
  function runPostinstall() {
6
6
  try {
7
7
  console.log(MESSAGE);
@@ -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"}