@pho9ubenaa/siro 0.5.1 → 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.
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as vb from "valibot";
2
2
 
3
- //#region src/shared/paths.d.ts
3
+ //#region src/core/contracts/paths.d.ts
4
4
  declare const AbsPathBrand: unique symbol;
5
5
  declare const RelPathBrand: unique symbol;
6
6
  type AbsPath = string & {
@@ -11,7 +11,7 @@ type RelPath = string & {
11
11
  };
12
12
  declare const asRelPath: (value: string) => RelPath;
13
13
  //#endregion
14
- //#region src/domain/entities/config-value.d.ts
14
+ //#region src/core/contracts/config-value.d.ts
15
15
  declare const CODEC_KINDS: readonly ["json", "npmrc", "toml", "yaml"];
16
16
  type CodecKind = (typeof CODEC_KINDS)[number];
17
17
  /** Scalar value that can be written back to a config file. */
@@ -27,18 +27,19 @@ type ConfigReadValue = unknown;
27
27
  /** Read an own key path; absent or non-mapping parents yield undefined. */
28
28
  declare const getByPath: (config: ParsedConfig, keyPath: KeyPath) => ConfigReadValue;
29
29
  //#endregion
30
- //#region src/domain/entities/config-file-ref.d.ts
30
+ //#region src/core/contracts/config-file-ref.d.ts
31
31
  /** A repository-relative configuration location, independent of any rule. */
32
32
  interface ConfigFileRef {
33
33
  readonly kind: CodecKind;
34
34
  readonly path: RelPath;
35
35
  }
36
36
  //#endregion
37
- //#region src/domain/entities/pms.d.ts
37
+ //#region src/core/contracts/pms.d.ts
38
38
  /**
39
39
  * Single source of truth for package managers and severities.
40
- * Types, runtime sets, and ordering are all derived from these tuples — add a
41
- * package manager here and the rest of the codebase follows.
40
+ * Types, runtime sets, and ordering derive from these tuples. Adding a manager
41
+ * still requires local detection signals, applicable rule bindings and verified
42
+ * policy/availability evidence; the tuple alone does not implement support.
42
43
  */
43
44
  declare const PMS: readonly ["npm", "pnpm", "yarn", "bun", "deno", "aube"];
44
45
  type PM = (typeof PMS)[number];
@@ -47,7 +48,7 @@ type Severity = (typeof SEVERITIES)[number];
47
48
  declare const isPM: (value: string) => value is PM;
48
49
  declare const isSeverity: (value: string) => value is Severity;
49
50
  //#endregion
50
- //#region src/domain/schemas/package-json.d.ts
51
+ //#region src/core/contracts/package-json.d.ts
51
52
  declare const PackageJsonSchema: vb.LooseObjectSchema<{
52
53
  readonly files: vb.OptionalSchema<vb.ArraySchema<vb.StringSchema<undefined>, undefined>, undefined>;
53
54
  readonly name: vb.OptionalSchema<vb.StringSchema<undefined>, undefined>;
@@ -55,16 +56,17 @@ declare const PackageJsonSchema: vb.LooseObjectSchema<{
55
56
  readonly private: vb.OptionalSchema<vb.BooleanSchema<undefined>, undefined>;
56
57
  readonly publishConfig: vb.OptionalSchema<vb.LooseObjectSchema<{
57
58
  readonly access: vb.OptionalSchema<vb.PicklistSchema<["public", "restricted", "private"], undefined>, undefined>;
59
+ readonly provenance: vb.OptionalSchema<vb.BooleanSchema<undefined>, undefined>;
58
60
  }, undefined>, undefined>;
59
61
  readonly trustedDependencies: vb.OptionalSchema<vb.ArraySchema<vb.StringSchema<undefined>, undefined>, undefined>;
60
62
  }, undefined>;
61
63
  type PackageJson = vb.InferOutput<typeof PackageJsonSchema>;
62
64
  //#endregion
63
- //#region src/domain/entities/project-type.d.ts
65
+ //#region src/core/contracts/project-type.d.ts
64
66
  declare const PROJECT_TYPES: readonly ["application", "package"];
65
67
  type ProjectType = (typeof PROJECT_TYPES)[number];
66
68
  //#endregion
67
- //#region src/domain/ports/repo-context.d.ts
69
+ //#region src/core/contracts/repo-context.d.ts
68
70
  /** Read-only view of a repository, passed to every rule's `check`. */
69
71
  interface RepoContext {
70
72
  readonly root: AbsPath;
@@ -80,7 +82,7 @@ interface RuleContext extends RepoContext {
80
82
  readConfig: (file: ConfigFileRef) => ParsedConfig;
81
83
  }
82
84
  //#endregion
83
- //#region src/domain/entities/rule.d.ts
85
+ //#region src/core/contracts/rule.d.ts
84
86
  interface SetKeyOperation {
85
87
  readonly op: 'setKey';
86
88
  readonly file: ConfigFileRef;
@@ -116,7 +118,7 @@ type CheckStatus = {
116
118
  readonly state: 'violations'; /** Independent findings; a rule chooses its own grouping granularity. */
117
119
  readonly violations: readonly [ViolationStatus, ...ViolationStatus[]];
118
120
  };
119
- /** Display-only package-manager version metadata. */
121
+ /** Display-only annotations: presence and wording never change policy. */
120
122
  interface VersionNote {
121
123
  readonly configAvailableSince?: string;
122
124
  readonly defaultSafeSince?: string;
@@ -143,62 +145,105 @@ interface Rule<Id extends string = string> {
143
145
  }
144
146
  declare const defineRule: <const Id extends string>(rule: Rule<Id>) => Rule<Id>;
145
147
  //#endregion
146
- //#region src/domain/ports/file-system.d.ts
148
+ //#region src/core/contracts/file-system.d.ts
147
149
  /** IO boundary: swap in memfs (or any other backend) for tests. */
148
150
  interface FileSystem {
149
- /** Ordinary child directory names, excluding symlinks. Required only for workspace discovery. Errors must propagate. */
150
- readDirectories?: (path: AbsPath) => readonly string[];
151
- /** Resolve one ordinary child using this filesystem's native name semantics, returning its enumerated name. No symlinks. Undefined for absence; other errors propagate. Without this optional port, Deno literal prefixes use exact names from readDirectories. */
152
- resolveDirectory?: (parent: AbsPath, name: string) => string | undefined;
151
+ /** Ordinary native child directory names, excluding symlinks. Required for recursive discovery. Errors must propagate. */
152
+ readDirectories: (path: AbsPath) => readonly string[];
153
153
  /** Read a regular file (including a symlink to one); undefined only for ENOENT. Other errors and non-file entries must throw. */
154
154
  readText: (path: AbsPath) => string | undefined;
155
155
  /** True for a regular file (including a symlink to one); false only for ENOENT. Other errors and non-file entries must throw. */
156
156
  exists: (path: AbsPath) => boolean;
157
157
  }
158
158
  //#endregion
159
- //#region src/domain/ports/date-time.d.ts
160
- /** Host time and native date parsing, including the host timezone for offsetless input. */
161
- interface DateTime {
162
- now: () => number;
163
- parse: (value: string) => number;
164
- }
165
- //#endregion
166
- //#region src/domain/builtin-rules.d.ts
167
- declare const createBuiltinRules: (time: DateTime) => readonly [Rule<"advisory-check">, Rule<"approved-git-repos">, Rule<"audit-suppression">, Rule<"block-auto-install">, Rule<"block-exotic-subdeps">, Rule<"bun-security-scanner">, Rule<"checksum-verification">, Rule<"commit-lockfile">, Rule<"dependency-overrides">, Rule<"disable-lifecycle-scripts">, Rule<"enforce-strict-ssl">, Rule<"files-field">, Rule<"frozen-lockfile">, Rule<"frozen-store">, Rule<"hardened-mode">, Rule<"minimum-release-age">, Rule<"named-registries">, Rule<"paranoid-mode">, Rule<"patched-dependencies">, Rule<"pin-exact-versions">, Rule<"provenance">, Rule<"publish-access">, Rule<"store-server">, Rule<"strict-allow-scripts">, Rule<"strict-release-age">, Rule<"strict-store-integrity">, Rule<"trust-policy">, Rule<"unsupported-settings">];
168
- type BuiltinRuleId = ReturnType<typeof createBuiltinRules>[number]['id'];
169
- //#endregion
170
- //#region src/domain/ports/io.d.ts
171
- /** Output sink for commands; injectable so tests can drive a string buffer. */
159
+ //#region src/core/contracts/io.d.ts
160
+ /** Output sink. Synchronous return values are ignored; returned promises are awaited. */
172
161
  interface IO {
173
- stdout: (line: string) => void;
174
- stderr: (line: string) => void;
162
+ stdout: (line: string) => unknown;
163
+ stderr: (line: string) => unknown;
175
164
  }
176
165
  //#endregion
177
- //#region src/domain/entities/lint-result.d.ts
166
+ //#region src/core/contracts/lint-result.d.ts
178
167
  interface Finding {
179
168
  readonly ruleId: string;
180
- readonly pm: PM;
169
+ /** Absent for PM-neutral publication checks. */
170
+ readonly pm?: PM;
171
+ /** Evaluation directory relative to cwd; root is '.'. */
172
+ readonly directory: string;
181
173
  readonly severity: Severity;
182
174
  readonly message: string;
183
175
  readonly file?: string;
184
176
  readonly remediation?: Remediation;
185
177
  readonly expected?: ConfigValue;
186
178
  readonly actual?: ConfigReadValue;
187
- /** Official PM doc anchor for the setting this finding is about, if any. */
188
179
  readonly docs?: string;
189
180
  }
181
+ interface PolicyTarget {
182
+ readonly pm: PM;
183
+ /** Missing means unknown, not the installed binary's version. */
184
+ readonly version?: string;
185
+ }
186
+ interface Inspection {
187
+ readonly manifests: readonly {
188
+ readonly path: string;
189
+ readonly projectType: ProjectType; /** Empty means unknown: target-dependent availability is not evaluated. */
190
+ readonly targets: readonly PolicyTarget[];
191
+ }[];
192
+ readonly installationRoots: readonly {
193
+ readonly directory: string;
194
+ readonly targets: readonly PolicyTarget[];
195
+ }[];
196
+ }
190
197
  interface LintResult {
191
198
  readonly findings: readonly Finding[];
192
199
  readonly summary: Readonly<Record<Severity, number>>;
200
+ /** Selected inputs, not an attestation that all security controls passed. */
201
+ readonly inspection: Inspection;
202
+ }
203
+ //#endregion
204
+ //#region src/core/contracts/scan-limits.d.ts
205
+ /** Finite per-scan budgets, controlled by the caller, never repository config. */
206
+ interface ScanLimits {
207
+ readonly maxFileBytes: number;
208
+ readonly maxTotalBytes: number;
209
+ readonly maxEntries: number;
210
+ readonly maxDirectories: number;
211
+ readonly maxDirectoryDepth: number;
212
+ readonly maxConfigDepth: number;
213
+ readonly maxFindings: number;
214
+ readonly maxOutputBytes: number;
193
215
  }
216
+ declare const DEFAULT_SCAN_LIMITS: Readonly<ScanLimits>;
194
217
  //#endregion
195
- //#region src/domain/ports/reporter.d.ts
218
+ //#region src/core/contracts/reporter.d.ts
219
+ interface ReportContext {
220
+ readonly cwd: AbsPath;
221
+ readonly limits?: ScanLimits;
222
+ }
196
223
  interface Reporter<Name extends string = string> {
197
224
  readonly name: Name;
198
- format: (result: LintResult, io: IO) => void | Promise<void>;
225
+ format: (result: LintResult, io: IO, context: ReportContext) => void | Promise<void>;
226
+ }
227
+ //#endregion
228
+ //#region src/core/inspection-options.d.ts
229
+ type InstallationRootInput = string | {
230
+ readonly path: string;
231
+ readonly pm?: PM;
232
+ readonly pmVersion?: string;
233
+ };
234
+ //#endregion
235
+ //#region src/core/contracts/date-time.d.ts
236
+ /** Host time and native date parsing, including the host timezone for offsetless input. */
237
+ interface DateTime {
238
+ now: () => number;
239
+ parse: (value: string) => number;
199
240
  }
200
241
  //#endregion
201
- //#region src/domain/entities/siro-config.d.ts
242
+ //#region src/core/rules/builtin-rules.d.ts
243
+ declare const createBuiltinRules: (time: DateTime) => readonly [Rule<"advisory-check">, Rule<"approved-git-repos">, Rule<"audit-suppression">, Rule<"block-auto-install">, Rule<"block-exotic-subdeps">, Rule<"bun-security-scanner">, Rule<"checksum-verification">, Rule<"commit-lockfile">, Rule<"dependency-overrides">, Rule<"disable-lifecycle-scripts">, Rule<"enforce-strict-ssl">, Rule<"files-field">, Rule<"frozen-lockfile">, Rule<"frozen-store">, Rule<"hardened-mode">, Rule<"minimum-release-age">, Rule<"named-registries">, Rule<"paranoid-mode">, Rule<"patched-dependencies">, Rule<"pin-exact-versions">, Rule<"provenance">, Rule<"publish-access">, Rule<"store-server">, Rule<"strict-allow-scripts">, Rule<"strict-release-age">, Rule<"strict-store-integrity">, Rule<"trust-policy">, Rule<"unsupported-settings">];
244
+ type BuiltinRuleId = ReturnType<typeof createBuiltinRules>[number]['id'];
245
+ //#endregion
246
+ //#region src/core/siro-config.d.ts
202
247
  /** Per-rule setting. `'off'` disables; a Severity overrides the default level. */
203
248
  type RuleSetting = Severity | 'off';
204
249
  /**
@@ -212,6 +257,9 @@ type RuleSetting = Severity | 'off';
212
257
  * })
213
258
  */
214
259
  interface SiroConfig {
260
+ readonly exclude?: readonly string[];
261
+ /** Replaces the default ['.']; [] disables installation checks, not manifest checks. */
262
+ readonly installationRoots?: readonly InstallationRootInput[];
215
263
  readonly pms?: readonly PM[];
216
264
  /** Exact stable target versions; does not select managers or inspect installed binaries. */
217
265
  readonly pmVersions?: Readonly<Partial<Record<PM, string>>>;
@@ -223,32 +271,37 @@ interface SiroConfig {
223
271
  /** Identity helper for type-checked config files. */
224
272
  declare const defineConfig: (config: SiroConfig) => SiroConfig;
225
273
  //#endregion
226
- //#region src/application/lint.d.ts
274
+ //#region src/core/lint.d.ts
227
275
  interface LintOptions {
228
276
  readonly cwd: AbsPath;
229
277
  readonly fs?: FileSystem;
278
+ /** Caller-controlled finite budgets; omitted values use DEFAULT_SCAN_LIMITS. */
279
+ readonly limits?: Partial<ScanLimits>;
280
+ /** Reject file/path symlinks in the native adapter; not an atomic containment sandbox. */
281
+ readonly rejectSymlinks?: boolean;
282
+ /** Applies only to cwd, never to discovered children or additional installation roots. */
230
283
  readonly pm?: PM;
231
- /** Exact stable version for `pm`; overrides config.pmVersions and packageManager. */
232
284
  readonly pmVersion?: string;
233
- /** Also inspect declared workspace members' publication settings. */
234
- readonly workspaces?: boolean;
285
+ readonly exclude?: readonly string[];
286
+ /** Replaces config/default ['.']; [] disables installation checks. */
287
+ readonly installationRoots?: readonly InstallationRootInput[];
235
288
  readonly projectType?: ProjectType;
236
289
  /** Explicit configuration; the library never imports files from the target repository. */
237
290
  readonly config?: SiroConfig;
238
291
  }
239
292
  //#endregion
240
- //#region src/application/commands/lint.d.ts
293
+ //#region src/core/lint-command.d.ts
241
294
  interface LintCommandOptions extends LintOptions {
242
295
  readonly reporter?: string | Reporter;
243
296
  readonly severity?: Severity;
244
297
  }
245
298
  //#endregion
246
- //#region src/composition/lint.d.ts
299
+ //#region src/runtime.d.ts
247
300
  /** Public Node API: callers can replace the filesystem without assembling the application. */
248
301
  declare const lint: (options: LintOptions) => LintResult;
249
302
  declare const lintCommand: (options: LintCommandOptions, io: IO) => Promise<number>;
250
303
  //#endregion
251
- //#region src/adapters/config-loader.d.ts
304
+ //#region src/load-config.d.ts
252
305
  /** Load the first matching config; executable imports always use the real filesystem. */
253
306
  declare const loadConfig: (cwd: AbsPath, nodeVersion?: string) => Promise<SiroConfig | undefined>;
254
307
  //#endregion
@@ -269,13 +322,12 @@ declare const jsonReporter: Reporter<'json'>;
269
322
  declare const prettyReporter: Reporter<'pretty'>;
270
323
  //#endregion
271
324
  //#region src/adapters/reporters/registry.d.ts
272
- declare const BUILTINS: readonly [Reporter<"pretty">, Reporter<"json">, Reporter<"github">];
273
325
  /** Names of every built-in reporter, in stable display order. */
274
326
  declare const BUILTIN_REPORTER_NAMES: readonly BuiltinReporterName[];
275
327
  /** Literal union of every built-in reporter name. */
276
- type BuiltinReporterName = (typeof BUILTINS)[number]['name'];
328
+ type BuiltinReporterName = (typeof prettyReporter | typeof jsonReporter | typeof githubReporter)['name'];
277
329
  //#endregion
278
- //#region src/domain/entities/config-files.d.ts
330
+ //#region src/core/config-files.d.ts
279
331
  /** Known configuration locations and their parsers. */
280
332
  declare const CONFIG_FILES: {
281
333
  readonly aubeWorkspace: {
@@ -308,7 +360,8 @@ declare const CONFIG_FILES: {
308
360
  };
309
361
  };
310
362
  //#endregion
311
- //#region src/domain/rules/builders/require-config-key.d.ts
363
+ //#region src/core/rules/builders/require-config-key.d.ts
364
+ /** One public helper binding: setting requirement, safe-default policy and proposal. */
312
365
  interface RequireConfigKeySpec {
313
366
  readonly file: ConfigFileRef;
314
367
  readonly keyPath: KeyPath;
@@ -318,11 +371,10 @@ interface RequireConfigKeySpec {
318
371
  readonly docs?: string;
319
372
  readonly severity?: Severity;
320
373
  accept?: (actual: unknown) => boolean;
321
- /**
322
- * An omitted value that is safe across every supported version and target
323
- * environment emits info. Version-dependent defaults retain full severity.
324
- */
374
+ /** Recorded default value; does not establish safety without `defaultSafety`. */
325
375
  readonly documentedDefault?: ConfigValue;
376
+ /** Only unconditional defaults may reduce severity; omitted means conditional. */
377
+ readonly defaultSafety?: 'unconditional' | 'conditional';
326
378
  /**
327
379
  * Severity used when `documentedDefault` satisfies the requirement. Defaults
328
380
  * to `'info'` (advisory). Set `'off'` to silence the finding entirely.
@@ -346,7 +398,7 @@ declare const overrideBindings: <Id extends string>(rule: Rule<Id>, overrides: P
346
398
  /** Build a Rule from a per-PM table of {file, keyPath, value, message}. */
347
399
  declare const requireConfigKey: <const Id extends string>(options: RequireConfigKeyOptions<Id>) => Rule<Id>;
348
400
  //#endregion
349
- //#region src/shared/errors.d.ts
401
+ //#region src/core/contracts/errors.d.ts
350
402
  declare class SiroError extends Error {
351
403
  readonly exitCode: number;
352
404
  constructor(message: string, exitCode: number);
@@ -364,5 +416,5 @@ declare const version: string;
364
416
  //#region src/adapters/node-paths.d.ts
365
417
  declare const asAbsPath: (value: string) => AbsPath;
366
418
  //#endregion
367
- export { type AbsPath, BUILTIN_REPORTER_NAMES, type BuiltinReporterName, CONFIG_FILES, type CheckStatus, ConfigError, type ConfigFileRef, type ConfigReadValue, type ConfigValue, type FileSystem, type Finding, type IO, type KeyPath, type LintCommandOptions, type LintOptions, type LintResult, type PM, PMS, PROJECT_TYPES, type ParsedConfig, type ProjectType, type RelPath, type Remediation, type RepoContext, type Reporter, type RequireConfigKeyOptions, type Rule, type RuleBinding, type RuleContext, type RuleSetting, SEVERITIES, type SetKeyOperation, type Severity, type SiroConfig, SiroError, UsageError, type VersionNote, type ViolationStatus, asAbsPath, asRelPath, defineConfig, defineRule, getByPath, githubReporter, isPM, isSeverity, jsonReporter, lint, lintCommand, loadConfig, nodeFileSystem, nodeIO, overrideBindings, prettyReporter, requireConfigKey, version };
419
+ export { type AbsPath, BUILTIN_REPORTER_NAMES, type BuiltinReporterName, CONFIG_FILES, type CheckStatus, ConfigError, type ConfigFileRef, type ConfigReadValue, type ConfigValue, DEFAULT_SCAN_LIMITS, type FileSystem, type Finding, type IO, type Inspection, type InstallationRootInput, type KeyPath, type LintCommandOptions, type LintOptions, type LintResult, type PM, PMS, PROJECT_TYPES, type ParsedConfig, type PolicyTarget, type ProjectType, type RelPath, type Remediation, type RepoContext, type ReportContext, type Reporter, type RequireConfigKeyOptions, type RequireConfigKeySpec, type Rule, type RuleBinding, type RuleContext, type RuleSetting, SEVERITIES, type ScanLimits, type SetKeyOperation, type Severity, type SiroConfig, SiroError, UsageError, type VersionNote, type ViolationStatus, asAbsPath, asRelPath, defineConfig, defineRule, getByPath, githubReporter, isPM, isSeverity, jsonReporter, lint, lintCommand, loadConfig, nodeFileSystem, nodeIO, overrideBindings, prettyReporter, requireConfigKey, version };
368
420
  //# sourceMappingURL=index.d.mts.map
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
- import { A as ConfigError, E as nodeFileSystem, M as UsageError, O as asAbsPath, b as isPM, c as jsonReporter, d as requireConfigKey, f as CONFIG_FILES, g as PROJECT_TYPES, h as getByPath, i as BUILTIN_REPORTER_NAMES, j as SiroError, k as asRelPath, l as githubReporter, m as defineRule, n as lint, p as loadConfig, r as lintCommand, s as prettyReporter, t as nodeIO, u as overrideBindings, v as PMS, w as version, x as isSeverity, y as SEVERITIES } from "./node-io-BDHg4J2w.mjs";
2
- //#region src/domain/entities/siro-config.ts
1
+ import { A as nodeFileSystem, C as isSeverity, D as asAbsPath, E as version, F as SiroError, I as UsageError, M as DEFAULT_SCAN_LIMITS, O as asRelPath, P as ConfigError, S as isPM, _ as PROJECT_TYPES, b as PMS, c as jsonReporter, d as overrideBindings, f as requireConfigKey, g as getByPath, h as defineRule, i as BUILTIN_REPORTER_NAMES, m as loadConfig, n as lint, p as CONFIG_FILES, r as lintCommand, s as prettyReporter, t as nodeIO, u as githubReporter, x as SEVERITIES } from "./node-io-BpAHyeBG.mjs";
2
+ //#region src/core/siro-config.ts
3
3
  /** Identity helper for type-checked config files. */
4
4
  const defineConfig = (config) => config;
5
5
  //#endregion
6
- export { BUILTIN_REPORTER_NAMES, CONFIG_FILES, ConfigError, PMS, PROJECT_TYPES, SEVERITIES, SiroError, UsageError, asAbsPath, asRelPath, defineConfig, defineRule, getByPath, githubReporter, isPM, isSeverity, jsonReporter, lint, lintCommand, loadConfig, nodeFileSystem, nodeIO, overrideBindings, prettyReporter, requireConfigKey, version };
6
+ export { BUILTIN_REPORTER_NAMES, CONFIG_FILES, ConfigError, DEFAULT_SCAN_LIMITS, PMS, PROJECT_TYPES, SEVERITIES, SiroError, UsageError, asAbsPath, asRelPath, defineConfig, defineRule, getByPath, githubReporter, isPM, isSeverity, jsonReporter, lint, lintCommand, loadConfig, nodeFileSystem, nodeIO, overrideBindings, prettyReporter, requireConfigKey, version };
7
7
 
8
8
  //# sourceMappingURL=index.mjs.map