@pho9ubenaa/siro 0.5.1 → 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.
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,90 @@ 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;
193
202
  }
194
203
  //#endregion
195
- //#region src/domain/ports/reporter.d.ts
204
+ //#region src/core/contracts/reporter.d.ts
205
+ interface ReportContext {
206
+ readonly cwd: AbsPath;
207
+ }
196
208
  interface Reporter<Name extends string = string> {
197
209
  readonly name: Name;
198
- format: (result: LintResult, io: IO) => void | Promise<void>;
210
+ format: (result: LintResult, io: IO, context: ReportContext) => void | Promise<void>;
199
211
  }
200
212
  //#endregion
201
- //#region src/domain/entities/siro-config.d.ts
213
+ //#region src/core/inspection-options.d.ts
214
+ type InstallationRootInput = string | {
215
+ readonly path: string;
216
+ readonly pm?: PM;
217
+ readonly pmVersion?: string;
218
+ };
219
+ //#endregion
220
+ //#region src/core/contracts/date-time.d.ts
221
+ /** Host time and native date parsing, including the host timezone for offsetless input. */
222
+ interface DateTime {
223
+ now: () => number;
224
+ parse: (value: string) => number;
225
+ }
226
+ //#endregion
227
+ //#region src/core/rules/builtin-rules.d.ts
228
+ 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">];
229
+ type BuiltinRuleId = ReturnType<typeof createBuiltinRules>[number]['id'];
230
+ //#endregion
231
+ //#region src/core/siro-config.d.ts
202
232
  /** Per-rule setting. `'off'` disables; a Severity overrides the default level. */
203
233
  type RuleSetting = Severity | 'off';
204
234
  /**
@@ -212,6 +242,9 @@ type RuleSetting = Severity | 'off';
212
242
  * })
213
243
  */
214
244
  interface SiroConfig {
245
+ readonly exclude?: readonly string[];
246
+ /** Replaces the default ['.']; [] disables installation checks, not manifest checks. */
247
+ readonly installationRoots?: readonly InstallationRootInput[];
215
248
  readonly pms?: readonly PM[];
216
249
  /** Exact stable target versions; does not select managers or inspect installed binaries. */
217
250
  readonly pmVersions?: Readonly<Partial<Record<PM, string>>>;
@@ -223,32 +256,33 @@ interface SiroConfig {
223
256
  /** Identity helper for type-checked config files. */
224
257
  declare const defineConfig: (config: SiroConfig) => SiroConfig;
225
258
  //#endregion
226
- //#region src/application/lint.d.ts
259
+ //#region src/core/lint.d.ts
227
260
  interface LintOptions {
228
261
  readonly cwd: AbsPath;
229
262
  readonly fs?: FileSystem;
263
+ /** Applies only to cwd, never to discovered children or additional installation roots. */
230
264
  readonly pm?: PM;
231
- /** Exact stable version for `pm`; overrides config.pmVersions and packageManager. */
232
265
  readonly pmVersion?: string;
233
- /** Also inspect declared workspace members' publication settings. */
234
- readonly workspaces?: boolean;
266
+ readonly exclude?: readonly string[];
267
+ /** Replaces config/default ['.']; [] disables installation checks. */
268
+ readonly installationRoots?: readonly InstallationRootInput[];
235
269
  readonly projectType?: ProjectType;
236
270
  /** Explicit configuration; the library never imports files from the target repository. */
237
271
  readonly config?: SiroConfig;
238
272
  }
239
273
  //#endregion
240
- //#region src/application/commands/lint.d.ts
274
+ //#region src/core/lint-command.d.ts
241
275
  interface LintCommandOptions extends LintOptions {
242
276
  readonly reporter?: string | Reporter;
243
277
  readonly severity?: Severity;
244
278
  }
245
279
  //#endregion
246
- //#region src/composition/lint.d.ts
280
+ //#region src/runtime.d.ts
247
281
  /** Public Node API: callers can replace the filesystem without assembling the application. */
248
282
  declare const lint: (options: LintOptions) => LintResult;
249
283
  declare const lintCommand: (options: LintCommandOptions, io: IO) => Promise<number>;
250
284
  //#endregion
251
- //#region src/adapters/config-loader.d.ts
285
+ //#region src/load-config.d.ts
252
286
  /** Load the first matching config; executable imports always use the real filesystem. */
253
287
  declare const loadConfig: (cwd: AbsPath, nodeVersion?: string) => Promise<SiroConfig | undefined>;
254
288
  //#endregion
@@ -269,13 +303,12 @@ declare const jsonReporter: Reporter<'json'>;
269
303
  declare const prettyReporter: Reporter<'pretty'>;
270
304
  //#endregion
271
305
  //#region src/adapters/reporters/registry.d.ts
272
- declare const BUILTINS: readonly [Reporter<"pretty">, Reporter<"json">, Reporter<"github">];
273
306
  /** Names of every built-in reporter, in stable display order. */
274
307
  declare const BUILTIN_REPORTER_NAMES: readonly BuiltinReporterName[];
275
308
  /** Literal union of every built-in reporter name. */
276
- type BuiltinReporterName = (typeof BUILTINS)[number]['name'];
309
+ type BuiltinReporterName = (typeof prettyReporter | typeof jsonReporter | typeof githubReporter)['name'];
277
310
  //#endregion
278
- //#region src/domain/entities/config-files.d.ts
311
+ //#region src/core/config-files.d.ts
279
312
  /** Known configuration locations and their parsers. */
280
313
  declare const CONFIG_FILES: {
281
314
  readonly aubeWorkspace: {
@@ -308,7 +341,8 @@ declare const CONFIG_FILES: {
308
341
  };
309
342
  };
310
343
  //#endregion
311
- //#region src/domain/rules/builders/require-config-key.d.ts
344
+ //#region src/core/rules/builders/require-config-key.d.ts
345
+ /** One public helper binding: setting requirement, safe-default policy and proposal. */
312
346
  interface RequireConfigKeySpec {
313
347
  readonly file: ConfigFileRef;
314
348
  readonly keyPath: KeyPath;
@@ -318,11 +352,10 @@ interface RequireConfigKeySpec {
318
352
  readonly docs?: string;
319
353
  readonly severity?: Severity;
320
354
  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
- */
355
+ /** Recorded default value; does not establish safety without `defaultSafety`. */
325
356
  readonly documentedDefault?: ConfigValue;
357
+ /** Only unconditional defaults may reduce severity; omitted means conditional. */
358
+ readonly defaultSafety?: 'unconditional' | 'conditional';
326
359
  /**
327
360
  * Severity used when `documentedDefault` satisfies the requirement. Defaults
328
361
  * to `'info'` (advisory). Set `'off'` to silence the finding entirely.
@@ -346,7 +379,7 @@ declare const overrideBindings: <Id extends string>(rule: Rule<Id>, overrides: P
346
379
  /** Build a Rule from a per-PM table of {file, keyPath, value, message}. */
347
380
  declare const requireConfigKey: <const Id extends string>(options: RequireConfigKeyOptions<Id>) => Rule<Id>;
348
381
  //#endregion
349
- //#region src/shared/errors.d.ts
382
+ //#region src/core/contracts/errors.d.ts
350
383
  declare class SiroError extends Error {
351
384
  readonly exitCode: number;
352
385
  constructor(message: string, exitCode: number);
@@ -364,5 +397,5 @@ declare const version: string;
364
397
  //#region src/adapters/node-paths.d.ts
365
398
  declare const asAbsPath: (value: string) => AbsPath;
366
399
  //#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 };
400
+ 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 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 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
401
  //# sourceMappingURL=index.d.mts.map
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
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 asRelPath, D as nodeFileSystem, M as SiroError, N as UsageError, S as isSeverity, T as version, _ as PROJECT_TYPES, b as SEVERITIES, c as jsonReporter, d as overrideBindings, f as requireConfigKey, g as getByPath, h as defineRule, i as BUILTIN_REPORTER_NAMES, j as ConfigError, k as asAbsPath, m as loadConfig, n as lint, p as CONFIG_FILES, r as lintCommand, s as prettyReporter, t as nodeIO, u as githubReporter, x as isPM, y as PMS } from "./node-io-CAszdmko.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