@pho9ubenaa/siro 0.5.0 → 0.5.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/CHANGELOG.md +19 -0
- package/README.md +5 -0
- package/dist/cli.mjs +1 -1
- package/dist/index.d.mts +44 -30
- package/dist/index.mjs +1 -1
- package/dist/{node-io-CaqobxYp.mjs → node-io-BDHg4J2w.mjs} +1602 -1530
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.5.1]
|
|
4
|
+
|
|
5
|
+
### Refactoring
|
|
6
|
+
|
|
7
|
+
- Reorganize runtime code around explicit domain and application ports, concrete adapters, and outer composition while preserving the public API, CLI, JSON schema, package-manager policy, and error behavior.
|
|
8
|
+
- Make the source dependency graph acyclic and enforce inward dependencies with TypeScript module resolution, including type imports, re-exports, host globals, and unresolved local modules.
|
|
9
|
+
- Move filesystem, path, glob, configuration loading, reporting, and clock behavior behind focused boundaries. Keep JavaScript date parsing in the adapter and inject the current time into release-age policy.
|
|
10
|
+
- Centralize workspace pattern classification and Deno release-age parsing, replacing incidental regular expressions and string rewrites where direct string operations are clearer.
|
|
11
|
+
|
|
12
|
+
### Maintenance
|
|
13
|
+
|
|
14
|
+
- Consolidate tests around observable decisions, failures, public wiring, CLI behavior, and installed-package contracts. Remove duplicate, implementation-coupled, mock-self-verifying, and library-guarantee cases.
|
|
15
|
+
- Add architecture and maintainer documentation for dependency direction, composition, ports, adapters, and behavioral contracts.
|
|
16
|
+
- Invite real-world feedback through GitHub Issues and explain how GitHub Stars inform time spent on future features and maintenance.
|
|
17
|
+
|
|
18
|
+
### Compatibility
|
|
19
|
+
|
|
20
|
+
- This release changes internal structure and test coverage only. Existing public exports, synchronous `lint`, asynchronous `lintCommand`, CLI flags and exit codes, JSON schema 2, supported package-manager behavior, and Node.js range remain unchanged.
|
|
21
|
+
|
|
3
22
|
## [0.5.0]
|
|
4
23
|
|
|
5
24
|
### Features
|
package/README.md
CHANGED
|
@@ -109,6 +109,11 @@ Different layer of the supply-chain pipeline; you want both.
|
|
|
109
109
|
Adding a rule or a package manager is a localized change — see
|
|
110
110
|
[docs/contributing.md](docs/contributing.md).
|
|
111
111
|
|
|
112
|
+
If siro is useful to you, a [GitHub Star](https://github.com/pHo9UBenaA/siro) would be appreciated.
|
|
113
|
+
Stars help me decide how much time to devote to future features and maintenance.
|
|
114
|
+
Please share feedback from real-world use and feature requests in
|
|
115
|
+
[GitHub Issues](https://github.com/pHo9UBenaA/siro/issues).
|
|
116
|
+
|
|
112
117
|
## License
|
|
113
118
|
|
|
114
119
|
MIT
|
package/dist/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { C as SUPPORTED_NODE_RANGE, D as isNodeError, M as UsageError, O as asAbsPath, S as
|
|
2
|
+
import { C as SUPPORTED_NODE_RANGE, D as isNodeError, M as UsageError, O as asAbsPath, S as isSupportedNodeVersion, T as assertDirectory, _ as isProjectType, a as DEFAULT_REPORTER_NAME, b as isPM, g as PROJECT_TYPES, i as BUILTIN_REPORTER_NAMES, j as SiroError, o as JSON_REPORTER_NAME, p as loadConfig, r as lintCommand, t as nodeIO, v as PMS, w as version, x as isSeverity, y as SEVERITIES } from "./node-io-BDHg4J2w.mjs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { pathToFileURL } from "node:url";
|
|
5
5
|
import { parseArgs } from "node:util";
|
package/dist/index.d.mts
CHANGED
|
@@ -9,7 +9,6 @@ type AbsPath = string & {
|
|
|
9
9
|
type RelPath = string & {
|
|
10
10
|
readonly [RelPathBrand]: true;
|
|
11
11
|
};
|
|
12
|
-
declare const asAbsPath: (value: string) => AbsPath;
|
|
13
12
|
declare const asRelPath: (value: string) => RelPath;
|
|
14
13
|
//#endregion
|
|
15
14
|
//#region src/domain/entities/config-value.d.ts
|
|
@@ -28,17 +27,11 @@ type ConfigReadValue = unknown;
|
|
|
28
27
|
/** Read an own key path; absent or non-mapping parents yield undefined. */
|
|
29
28
|
declare const getByPath: (config: ParsedConfig, keyPath: KeyPath) => ConfigReadValue;
|
|
30
29
|
//#endregion
|
|
31
|
-
//#region src/domain/
|
|
32
|
-
/**
|
|
33
|
-
interface
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
/** 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. */
|
|
37
|
-
resolveDirectory?: (parent: AbsPath, name: string) => string | undefined;
|
|
38
|
-
/** Read a regular file (including a symlink to one); undefined only for ENOENT. Other errors and non-file entries must throw. */
|
|
39
|
-
readText: (path: AbsPath) => string | undefined;
|
|
40
|
-
/** True for a regular file (including a symlink to one); false only for ENOENT. Other errors and non-file entries must throw. */
|
|
41
|
-
exists: (path: AbsPath) => boolean;
|
|
30
|
+
//#region src/domain/entities/config-file-ref.d.ts
|
|
31
|
+
/** A repository-relative configuration location, independent of any rule. */
|
|
32
|
+
interface ConfigFileRef {
|
|
33
|
+
readonly kind: CodecKind;
|
|
34
|
+
readonly path: RelPath;
|
|
42
35
|
}
|
|
43
36
|
//#endregion
|
|
44
37
|
//#region src/domain/entities/pms.d.ts
|
|
@@ -54,10 +47,6 @@ type Severity = (typeof SEVERITIES)[number];
|
|
|
54
47
|
declare const isPM: (value: string) => value is PM;
|
|
55
48
|
declare const isSeverity: (value: string) => value is Severity;
|
|
56
49
|
//#endregion
|
|
57
|
-
//#region src/domain/entities/project-type.d.ts
|
|
58
|
-
declare const PROJECT_TYPES: readonly ["application", "package"];
|
|
59
|
-
type ProjectType = (typeof PROJECT_TYPES)[number];
|
|
60
|
-
//#endregion
|
|
61
50
|
//#region src/domain/schemas/package-json.d.ts
|
|
62
51
|
declare const PackageJsonSchema: vb.LooseObjectSchema<{
|
|
63
52
|
readonly files: vb.OptionalSchema<vb.ArraySchema<vb.StringSchema<undefined>, undefined>, undefined>;
|
|
@@ -71,6 +60,10 @@ declare const PackageJsonSchema: vb.LooseObjectSchema<{
|
|
|
71
60
|
}, undefined>;
|
|
72
61
|
type PackageJson = vb.InferOutput<typeof PackageJsonSchema>;
|
|
73
62
|
//#endregion
|
|
63
|
+
//#region src/domain/entities/project-type.d.ts
|
|
64
|
+
declare const PROJECT_TYPES: readonly ["application", "package"];
|
|
65
|
+
type ProjectType = (typeof PROJECT_TYPES)[number];
|
|
66
|
+
//#endregion
|
|
74
67
|
//#region src/domain/ports/repo-context.d.ts
|
|
75
68
|
/** Read-only view of a repository, passed to every rule's `check`. */
|
|
76
69
|
interface RepoContext {
|
|
@@ -88,10 +81,6 @@ interface RuleContext extends RepoContext {
|
|
|
88
81
|
}
|
|
89
82
|
//#endregion
|
|
90
83
|
//#region src/domain/entities/rule.d.ts
|
|
91
|
-
interface ConfigFileRef {
|
|
92
|
-
readonly kind: CodecKind;
|
|
93
|
-
readonly path: RelPath;
|
|
94
|
-
}
|
|
95
84
|
interface SetKeyOperation {
|
|
96
85
|
readonly op: 'setKey';
|
|
97
86
|
readonly file: ConfigFileRef;
|
|
@@ -154,9 +143,29 @@ interface Rule<Id extends string = string> {
|
|
|
154
143
|
}
|
|
155
144
|
declare const defineRule: <const Id extends string>(rule: Rule<Id>) => Rule<Id>;
|
|
156
145
|
//#endregion
|
|
146
|
+
//#region src/domain/ports/file-system.d.ts
|
|
147
|
+
/** IO boundary: swap in memfs (or any other backend) for tests. */
|
|
148
|
+
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;
|
|
153
|
+
/** Read a regular file (including a symlink to one); undefined only for ENOENT. Other errors and non-file entries must throw. */
|
|
154
|
+
readText: (path: AbsPath) => string | undefined;
|
|
155
|
+
/** True for a regular file (including a symlink to one); false only for ENOENT. Other errors and non-file entries must throw. */
|
|
156
|
+
exists: (path: AbsPath) => boolean;
|
|
157
|
+
}
|
|
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
|
|
157
166
|
//#region src/domain/builtin-rules.d.ts
|
|
158
|
-
declare const
|
|
159
|
-
type BuiltinRuleId =
|
|
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'];
|
|
160
169
|
//#endregion
|
|
161
170
|
//#region src/domain/ports/io.d.ts
|
|
162
171
|
/** Output sink for commands; injectable so tests can drive a string buffer. */
|
|
@@ -227,7 +236,17 @@ interface LintOptions {
|
|
|
227
236
|
/** Explicit configuration; the library never imports files from the target repository. */
|
|
228
237
|
readonly config?: SiroConfig;
|
|
229
238
|
}
|
|
239
|
+
//#endregion
|
|
240
|
+
//#region src/application/commands/lint.d.ts
|
|
241
|
+
interface LintCommandOptions extends LintOptions {
|
|
242
|
+
readonly reporter?: string | Reporter;
|
|
243
|
+
readonly severity?: Severity;
|
|
244
|
+
}
|
|
245
|
+
//#endregion
|
|
246
|
+
//#region src/composition/lint.d.ts
|
|
247
|
+
/** Public Node API: callers can replace the filesystem without assembling the application. */
|
|
230
248
|
declare const lint: (options: LintOptions) => LintResult;
|
|
249
|
+
declare const lintCommand: (options: LintCommandOptions, io: IO) => Promise<number>;
|
|
231
250
|
//#endregion
|
|
232
251
|
//#region src/adapters/config-loader.d.ts
|
|
233
252
|
/** Load the first matching config; executable imports always use the real filesystem. */
|
|
@@ -256,14 +275,6 @@ declare const BUILTIN_REPORTER_NAMES: readonly BuiltinReporterName[];
|
|
|
256
275
|
/** Literal union of every built-in reporter name. */
|
|
257
276
|
type BuiltinReporterName = (typeof BUILTINS)[number]['name'];
|
|
258
277
|
//#endregion
|
|
259
|
-
//#region src/application/commands/lint.d.ts
|
|
260
|
-
interface LintCommandOptions extends LintOptions {
|
|
261
|
-
readonly reporter?: string | Reporter;
|
|
262
|
-
readonly severity?: Severity;
|
|
263
|
-
}
|
|
264
|
-
/** Evaluate and report. Executable config loading belongs to the CLI adapter. */
|
|
265
|
-
declare const lintCommand: (options: LintCommandOptions, io: IO) => Promise<number>;
|
|
266
|
-
//#endregion
|
|
267
278
|
//#region src/domain/entities/config-files.d.ts
|
|
268
279
|
/** Known configuration locations and their parsers. */
|
|
269
280
|
declare const CONFIG_FILES: {
|
|
@@ -350,5 +361,8 @@ declare class UsageError extends SiroError {
|
|
|
350
361
|
//#region src/version.d.ts
|
|
351
362
|
declare const version: string;
|
|
352
363
|
//#endregion
|
|
364
|
+
//#region src/adapters/node-paths.d.ts
|
|
365
|
+
declare const asAbsPath: (value: string) => AbsPath;
|
|
366
|
+
//#endregion
|
|
353
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 };
|
|
354
368
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as ConfigError, E as nodeFileSystem, M as UsageError, O as asAbsPath,
|
|
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
2
|
//#region src/domain/entities/siro-config.ts
|
|
3
3
|
/** Identity helper for type-checked config files. */
|
|
4
4
|
const defineConfig = (config) => config;
|