@clossys/writer 0.4.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/README.md +592 -2
- package/dist/approval-bypass.d.ts +120 -0
- package/dist/approval-bypass.d.ts.map +1 -0
- package/dist/approval-bypass.js +2318 -0
- package/dist/approval-bypass.js.map +1 -0
- package/dist/approval.d.ts +62 -0
- package/dist/approval.d.ts.map +1 -0
- package/dist/approval.js +421 -0
- package/dist/approval.js.map +1 -0
- package/dist/approve-cli.d.ts +82 -0
- package/dist/approve-cli.d.ts.map +1 -0
- package/dist/approve-cli.js +430 -0
- package/dist/approve-cli.js.map +1 -0
- package/dist/cli.d.ts +15 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +48 -13
- package/dist/cli.js.map +1 -1
- package/dist/field-options.d.ts +59 -0
- package/dist/field-options.d.ts.map +1 -0
- package/dist/field-options.js +109 -0
- package/dist/field-options.js.map +1 -0
- package/dist/front-door-browser.d.ts +5 -0
- package/dist/front-door-browser.d.ts.map +1 -0
- package/dist/front-door-browser.js +30 -0
- package/dist/front-door-browser.js.map +1 -0
- package/dist/front-door-core.d.ts +45 -0
- package/dist/front-door-core.d.ts.map +1 -0
- package/dist/front-door-core.js +224 -0
- package/dist/front-door-core.js.map +1 -0
- package/dist/front-door.check.d.ts +2 -0
- package/dist/front-door.check.d.ts.map +1 -0
- package/dist/front-door.check.js +8 -0
- package/dist/front-door.check.js.map +1 -0
- package/dist/front-door.d.ts +46 -0
- package/dist/front-door.d.ts.map +1 -0
- package/dist/front-door.js +61 -0
- package/dist/front-door.js.map +1 -0
- package/dist/generated/advisor-plan-contract.generated.d.ts +3 -0
- package/dist/generated/advisor-plan-contract.generated.d.ts.map +1 -0
- package/dist/generated/advisor-plan-contract.generated.js +430 -0
- package/dist/generated/advisor-plan-contract.generated.js.map +1 -0
- package/dist/generated/contract-schema.generated.d.ts +97 -0
- package/dist/generated/contract-schema.generated.d.ts.map +1 -0
- package/dist/generated/contract-schema.generated.js +496 -0
- package/dist/generated/contract-schema.generated.js.map +1 -0
- package/dist/index.d.ts +14 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -1
- package/dist/messaging-kit.d.ts +113 -0
- package/dist/messaging-kit.d.ts.map +1 -0
- package/dist/messaging-kit.js +121 -0
- package/dist/messaging-kit.js.map +1 -0
- package/dist/passage.d.ts +2 -1
- package/dist/passage.d.ts.map +1 -1
- package/dist/passage.js +2 -1
- package/dist/passage.js.map +1 -1
- package/dist/plan-authority.d.ts +73 -0
- package/dist/plan-authority.d.ts.map +1 -0
- package/dist/plan-authority.js +126 -0
- package/dist/plan-authority.js.map +1 -0
- package/dist/plan-contract.d.ts +16 -0
- package/dist/plan-contract.d.ts.map +1 -0
- package/dist/plan-contract.js +33 -0
- package/dist/plan-contract.js.map +1 -0
- package/dist/plan-digest.d.ts +23 -0
- package/dist/plan-digest.d.ts.map +1 -0
- package/dist/plan-digest.js +82 -0
- package/dist/plan-digest.js.map +1 -0
- package/dist/plan-rules.d.ts +54 -0
- package/dist/plan-rules.d.ts.map +1 -0
- package/dist/plan-rules.js +145 -0
- package/dist/plan-rules.js.map +1 -0
- package/dist/resolve.d.ts +40 -6
- package/dist/resolve.d.ts.map +1 -1
- package/dist/resolve.js +144 -18
- package/dist/resolve.js.map +1 -1
- package/dist/scan.d.ts +32 -0
- package/dist/scan.d.ts.map +1 -1
- package/dist/scan.js +67 -6
- package/dist/scan.js.map +1 -1
- package/dist/schema.d.ts +1 -0
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +209 -5
- package/dist/schema.js.map +1 -1
- package/dist/site-identity.d.ts +88 -0
- package/dist/site-identity.d.ts.map +1 -0
- package/dist/site-identity.js +82 -0
- package/dist/site-identity.js.map +1 -0
- package/dist/types.d.ts +65 -7
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +9 -7
- package/dist/types.js.map +1 -1
- package/package.json +11 -6
- package/skill/SKILL.md +2 -2
- package/src/approval-bypass.ts +2263 -0
- package/src/approval.ts +491 -0
- package/src/approve-cli.ts +474 -0
- package/src/cli.ts +46 -13
- package/src/field-options.ts +134 -0
- package/src/front-door-browser.ts +31 -0
- package/src/front-door-core.ts +265 -0
- package/src/front-door.check.ts +10 -0
- package/src/front-door.ts +65 -0
- package/src/generated/advisor-plan-contract.generated.ts +430 -0
- package/src/generated/contract-schema.generated.ts +520 -0
- package/src/index.ts +97 -1
- package/src/messaging-kit.ts +195 -0
- package/src/passage.ts +2 -1
- package/src/plan-authority.ts +160 -0
- package/src/plan-contract.ts +45 -0
- package/src/plan-digest.ts +81 -0
- package/src/plan-rules.ts +179 -0
- package/src/resolve.ts +185 -19
- package/src/scan.ts +97 -6
- package/src/schema.ts +223 -5
- package/src/site-identity.ts +125 -0
- package/src/types.ts +72 -7
- package/templates/front-door.en.json +423 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `scanApprovalBypass` and `checkApprovalBypass` — the APPROVAL-BYPASS gate:
|
|
3
|
+
* does consumer code route copy through the registry's approval lifecycle,
|
|
4
|
+
* or around it? Two patterns defeat that lifecycle while every other gate in
|
|
5
|
+
* this package stays green:
|
|
6
|
+
*
|
|
7
|
+
* 1. `approval-set-in-code` — the code itself declares approval: an object
|
|
8
|
+
* property or member assignment named `approvedBy` or
|
|
9
|
+
* `pendingOwnerReview`, or `status` set to the literal `"approved"`
|
|
10
|
+
* (`{ ...entry, status: "approved" }`, `entry.status = "approved"`). An
|
|
11
|
+
* approval typed into a component is an approval no owner ever gave.
|
|
12
|
+
* 2. `copy-read-without-resolver` — the code imports the registry file and
|
|
13
|
+
* reads its content directly (`registry.entries.map(...)`, a spread, any
|
|
14
|
+
* use other than the first argument of `createCopyResolver`,
|
|
15
|
+
* `resolveCopyRef`, or `validateCopyRegistryShape`, or of
|
|
16
|
+
* `parseCopyRegistry` only when its return value is passed to
|
|
17
|
+
* `createCopyResolver` or `resolveCopyRef`).
|
|
18
|
+
* A raw map built from the registry skips every lifecycle, staleness and
|
|
19
|
+
* delegate check the resolver performs.
|
|
20
|
+
*
|
|
21
|
+
* ONLY REGISTRY-COUPLED FILES ARE EXAMINED — a file that imports from
|
|
22
|
+
* `@clossys/writer` (any subpath) or imports the registry file. That keeps a
|
|
23
|
+
* domain model with its own unrelated `status: "approved"` out of scope. It
|
|
24
|
+
* is a STATED LIMIT, not an oversight: a file that copies registry data
|
|
25
|
+
* without importing either (pasted JSON, data fetched at runtime, a registry
|
|
26
|
+
* passed in from an uncoupled module) is never seen by this gate.
|
|
27
|
+
*
|
|
28
|
+
* NO PARSER LIBRARY and no second tokenizer: every comment, string, template,
|
|
29
|
+
* regex and JSX-text boundary comes from `scan.ts`'s `maskNonCode`. The
|
|
30
|
+
* patterns here are matched against its masked `code` (so a comment or a
|
|
31
|
+
* string can never match), and literal values are looked up through its
|
|
32
|
+
* `literals` list. The heuristics that remain are narrow and local; each
|
|
33
|
+
* known gap is listed beside the function that has it.
|
|
34
|
+
*
|
|
35
|
+
* ============================================================================
|
|
36
|
+
* THE TERNARY
|
|
37
|
+
* ============================================================================
|
|
38
|
+
*
|
|
39
|
+
* The same precedence `addressability.ts` uses (issue #407): a definite
|
|
40
|
+
* finding outranks an incomplete picture.
|
|
41
|
+
*
|
|
42
|
+
* - `"violated"` — at least one finding, regardless of unchecked positions.
|
|
43
|
+
* `reasons` still lists any coverage gap.
|
|
44
|
+
* - `"indeterminate"` — no finding, but an unchecked position (a dynamic or
|
|
45
|
+
* otherwise unresolvable registry load, a string naming the registry), a
|
|
46
|
+
* parse failure, or zero files scanned. Never a pass.
|
|
47
|
+
* - `"satisfied"` — at least one file scanned, nothing unchecked, no
|
|
48
|
+
* finding. Zero coupled files among ≥1 scanned file is satisfied.
|
|
49
|
+
*/
|
|
50
|
+
import type { ParseFailure, SkippedFile } from "./scan.js";
|
|
51
|
+
export type { ParseFailure, SkippedFile } from "./scan.js";
|
|
52
|
+
export interface ApprovalBypassScanOptions {
|
|
53
|
+
/** The copy registry file. Absolute, or relative to the scan `root`. Must exist. */
|
|
54
|
+
registryPath: string;
|
|
55
|
+
/** File extensions to read, each including the leading dot. Default: `.ts`, `.tsx`, `.js`, `.jsx`. */
|
|
56
|
+
extensions?: string[];
|
|
57
|
+
/** Directory names never descended into. Default: node_modules, .git, dist, build, coverage. */
|
|
58
|
+
skipDirs?: string[];
|
|
59
|
+
}
|
|
60
|
+
export type ApprovalBypassRule = "approval-set-in-code" | "copy-read-without-resolver";
|
|
61
|
+
export interface ApprovalBypassFinding {
|
|
62
|
+
rule: ApprovalBypassRule;
|
|
63
|
+
severity: "error";
|
|
64
|
+
file: string;
|
|
65
|
+
line: number;
|
|
66
|
+
detail: string;
|
|
67
|
+
}
|
|
68
|
+
export interface ApprovalBypassUncheckedItem {
|
|
69
|
+
file: string;
|
|
70
|
+
line: number;
|
|
71
|
+
/** `"registry-dynamic-import"`, `"dynamic-import-non-literal"`, `"registry-require-unbound"`, `"require-non-literal"`, `"registry-reexport"` or `"registry-path-string"`. */
|
|
72
|
+
kind: string;
|
|
73
|
+
detail: string;
|
|
74
|
+
}
|
|
75
|
+
export interface ApprovalBypassScanResult {
|
|
76
|
+
/** Files successfully tokenized, coupled or not. Required to be > 0 for a satisfied verdict. */
|
|
77
|
+
filesScanned: number;
|
|
78
|
+
/** Root-relative paths of the files that were examined. */
|
|
79
|
+
coupledFiles: string[];
|
|
80
|
+
findings: ApprovalBypassFinding[];
|
|
81
|
+
unchecked: ApprovalBypassUncheckedItem[];
|
|
82
|
+
skippedByDesign: SkippedFile[];
|
|
83
|
+
parseFailures: ParseFailure[];
|
|
84
|
+
}
|
|
85
|
+
export type ApprovalBypassVerdict = "violated" | "indeterminate" | "satisfied";
|
|
86
|
+
export interface ApprovalBypassGateResult {
|
|
87
|
+
verdict: ApprovalBypassVerdict;
|
|
88
|
+
findings: ApprovalBypassFinding[];
|
|
89
|
+
unchecked: ApprovalBypassUncheckedItem[];
|
|
90
|
+
/** Why coverage is incomplete. Empty for `"satisfied"`; may be non-empty for `"violated"`. */
|
|
91
|
+
reasons: string[];
|
|
92
|
+
}
|
|
93
|
+
export interface ApprovalBypassExtractResult {
|
|
94
|
+
coupled: boolean;
|
|
95
|
+
findings: ApprovalBypassFinding[];
|
|
96
|
+
unchecked: ApprovalBypassUncheckedItem[];
|
|
97
|
+
parseFailure?: string;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Walks `root`, examining every registry-coupled source file (see
|
|
101
|
+
* `extractApprovalBypass`). FAILS CLOSED — throws a plain `Error` — on an
|
|
102
|
+
* unreadable directory or file and on a missing registry file: either one
|
|
103
|
+
* means the scan cannot say what it did not see.
|
|
104
|
+
*/
|
|
105
|
+
export declare function scanApprovalBypass(root: string, options: ApprovalBypassScanOptions): ApprovalBypassScanResult;
|
|
106
|
+
/**
|
|
107
|
+
* Pure — no I/O beyond `existsSync`/`realpathSync` for relative-specifier
|
|
108
|
+
* resolution. Decides whether `content` is registry-coupled and, if so,
|
|
109
|
+
* reports every approval-bypass finding and unchecked position in it.
|
|
110
|
+
* `filePath` is the path reported in results (and picks JSX masking for a
|
|
111
|
+
* `.tsx`/`.jsx` name); `context.absoluteFilePath` is where relative
|
|
112
|
+
* specifiers resolve from.
|
|
113
|
+
*/
|
|
114
|
+
export declare function extractApprovalBypass(content: string, filePath: string, context: {
|
|
115
|
+
registryPath: string;
|
|
116
|
+
absoluteFilePath: string;
|
|
117
|
+
}): ApprovalBypassExtractResult;
|
|
118
|
+
/** Pure — decides the ternary verdict from an already-computed scan. Never throws. See "THE TERNARY" above. */
|
|
119
|
+
export declare function checkApprovalBypass(scan: ApprovalBypassScanResult): ApprovalBypassGateResult;
|
|
120
|
+
//# sourceMappingURL=approval-bypass.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"approval-bypass.d.ts","sourceRoot":"","sources":["../src/approval-bypass.ts"],"names":[],"mappings":"AAAA;;;;;;;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