okf-kit 0.9.0 → 0.11.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/CHANGELOG.md +256 -0
- package/README.md +102 -8
- package/dist/bundle.d.ts +18 -1
- package/dist/bundle.js +8 -1
- package/dist/bundle.js.map +1 -1
- package/dist/cli.d.ts +19 -0
- package/dist/cli.js +25 -0
- package/dist/cli.js.map +1 -1
- package/dist/git.d.ts +2 -2
- package/dist/git.js +16 -2
- package/dist/git.js.map +1 -1
- package/dist/rules/index.d.ts +2 -2
- package/dist/rules/index.js +8 -2
- package/dist/rules/index.js.map +1 -1
- package/dist/rules/sources-fresh.d.ts +42 -0
- package/dist/rules/sources-fresh.js +797 -20
- package/dist/rules/sources-fresh.js.map +1 -1
- package/dist/types.d.ts +26 -0
- package/dist/util.d.ts +52 -0
- package/dist/util.js +72 -0
- package/dist/util.js.map +1 -1
- package/package.json +2 -2
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAA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,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CACjE,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,WAAW;IAClB,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,iBAAiB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACxD,MAAM,IAAI,GAAG,EAAE,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QAC1C,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAyB,CAAC;QACrD,OAAO,GAAG,CAAC,OAAO,IAAI,OAAO,CAAC;IAChC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,OAAO,CAAC;IACjB,CAAC;AACH,CAAC"}
|
package/dist/git.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ import type { RunGit } from "./types.js";
|
|
|
3
3
|
* Default RunGit implementation: shells out to the real `git` binary.
|
|
4
4
|
* stderr is discarded (git's own "fatal: not a git repository" etc. text is
|
|
5
5
|
* an expected, silent signal here, not something to surface), and any
|
|
6
|
-
* failure (non-zero exit, git missing
|
|
7
|
-
* throwing.
|
|
6
|
+
* failure (non-zero exit, git missing, output past MAX_GIT_OUTPUT_BYTES)
|
|
7
|
+
* resolves to null instead of throwing.
|
|
8
8
|
*/
|
|
9
9
|
export declare const runGit: RunGit;
|
|
10
10
|
/**
|
package/dist/git.js
CHANGED
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
import { execFileSync } from "node:child_process";
|
|
2
|
+
/**
|
|
3
|
+
* Output cap (bytes) for a single git invocation. Node's own default for
|
|
4
|
+
* `execFileSync` is 1 MiB, and exceeding it does not throw a distinguishable
|
|
5
|
+
* error here -- it lands in the catch below and resolves to null, i.e. the
|
|
6
|
+
* caller sees "git failed" for a perfectly healthy repository. `sources-fresh`
|
|
7
|
+
* reads whole doc blobs (`git show <sha>:<path>`) to compare frontmatter
|
|
8
|
+
* timestamps, and an OKF doc larger than 1 MiB is unusual but entirely legal,
|
|
9
|
+
* so the cap is raised well past any plausible doc size. It is deliberately
|
|
10
|
+
* still a cap and not `Infinity`: a runaway git invocation should fail loudly
|
|
11
|
+
* (as null, which every caller treats as "not assessable") rather than grow
|
|
12
|
+
* the process heap without bound.
|
|
13
|
+
*/
|
|
14
|
+
const MAX_GIT_OUTPUT_BYTES = 16 * 1024 * 1024;
|
|
2
15
|
/**
|
|
3
16
|
* Default RunGit implementation: shells out to the real `git` binary.
|
|
4
17
|
* stderr is discarded (git's own "fatal: not a git repository" etc. text is
|
|
5
18
|
* an expected, silent signal here, not something to surface), and any
|
|
6
|
-
* failure (non-zero exit, git missing
|
|
7
|
-
* throwing.
|
|
19
|
+
* failure (non-zero exit, git missing, output past MAX_GIT_OUTPUT_BYTES)
|
|
20
|
+
* resolves to null instead of throwing.
|
|
8
21
|
*/
|
|
9
22
|
export const runGit = (args, cwd) => {
|
|
10
23
|
try {
|
|
@@ -12,6 +25,7 @@ export const runGit = (args, cwd) => {
|
|
|
12
25
|
cwd,
|
|
13
26
|
encoding: "utf8",
|
|
14
27
|
stdio: ["ignore", "pipe", "ignore"],
|
|
28
|
+
maxBuffer: MAX_GIT_OUTPUT_BYTES,
|
|
15
29
|
}).trim();
|
|
16
30
|
}
|
|
17
31
|
catch {
|
package/dist/git.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git.js","sourceRoot":"","sources":["../src/git.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,MAAM,GAAW,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE;IAC1C,IAAI,CAAC;QACH,OAAO,YAAY,CAAC,KAAK,EAAE,IAAI,EAAE;YAC/B,GAAG;YACH,QAAQ,EAAE,MAAM;YAChB,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"git.js","sourceRoot":"","sources":["../src/git.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD;;;;;;;;;;;GAWG;AACH,MAAM,oBAAoB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAE9C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,MAAM,GAAW,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE;IAC1C,IAAI,CAAC;QACH,OAAO,YAAY,CAAC,KAAK,EAAE,IAAI,EAAE;YAC/B,GAAG;YACH,QAAQ,EAAE,MAAM;YAChB,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC;YACnC,SAAS,EAAE,oBAAoB;SAChC,CAAC,CAAC,IAAI,EAAE,CAAC;IACZ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAC5B,QAAgB,EAChB,MAAc,MAAM;IAEpB,MAAM,MAAM,GAAG,GAAG,CAAC,CAAC,WAAW,EAAE,iBAAiB,CAAC,EAAE,QAAQ,CAAC,CAAC;IAC/D,OAAO,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AACrC,CAAC"}
|
package/dist/rules/index.d.ts
CHANGED
|
@@ -4,8 +4,8 @@ import { reservedFilesBareRule } from "./reserved-files-bare.js";
|
|
|
4
4
|
import { linksResolveRule } from "./links-resolve.js";
|
|
5
5
|
import { noAbsoluteLinksRule } from "./no-absolute-links.js";
|
|
6
6
|
import { sourcesShapeRule } from "./sources-shape.js";
|
|
7
|
-
import { sourcesFreshRule } from "./sources-fresh.js";
|
|
7
|
+
import { sourcesFreshRule, sourcesFreshFutureRule } from "./sources-fresh.js";
|
|
8
8
|
import { citationsResolveRule } from "./citations-resolve.js";
|
|
9
9
|
import { proseLineReferencesRule } from "./prose-line-references.js";
|
|
10
10
|
export declare const allRules: Rule[];
|
|
11
|
-
export { frontmatterRequiredRule, reservedFilesBareRule, linksResolveRule, noAbsoluteLinksRule, sourcesShapeRule, sourcesFreshRule, citationsResolveRule, proseLineReferencesRule, };
|
|
11
|
+
export { frontmatterRequiredRule, reservedFilesBareRule, linksResolveRule, noAbsoluteLinksRule, sourcesShapeRule, sourcesFreshRule, sourcesFreshFutureRule, citationsResolveRule, proseLineReferencesRule, };
|
package/dist/rules/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { reservedFilesBareRule } from "./reserved-files-bare.js";
|
|
|
3
3
|
import { linksResolveRule } from "./links-resolve.js";
|
|
4
4
|
import { noAbsoluteLinksRule } from "./no-absolute-links.js";
|
|
5
5
|
import { sourcesShapeRule } from "./sources-shape.js";
|
|
6
|
-
import { sourcesFreshRule } from "./sources-fresh.js";
|
|
6
|
+
import { sourcesFreshRule, sourcesFreshFutureRule } from "./sources-fresh.js";
|
|
7
7
|
import { citationsResolveRule } from "./citations-resolve.js";
|
|
8
8
|
import { proseLineReferencesRule } from "./prose-line-references.js";
|
|
9
9
|
// proseLineReferencesRule is always registered here, same as
|
|
@@ -11,6 +11,11 @@ import { proseLineReferencesRule } from "./prose-line-references.js";
|
|
|
11
11
|
// ctx.proseLineReferences is set (see src/rules/prose-line-references.ts),
|
|
12
12
|
// so a consumer that never passes --prose-line-references sees
|
|
13
13
|
// byte-identical `check` output to before this rule existed.
|
|
14
|
+
//
|
|
15
|
+
// sourcesFreshFutureRule, unlike those two, is always active (no opt-in
|
|
16
|
+
// flag gates it, only `--future-skew-minutes` tunes its threshold): it
|
|
17
|
+
// assesses the same doc population as sourcesFreshRule, just the opposite
|
|
18
|
+
// time direction, so it is always registered alongside it.
|
|
14
19
|
export const allRules = [
|
|
15
20
|
frontmatterRequiredRule,
|
|
16
21
|
reservedFilesBareRule,
|
|
@@ -18,8 +23,9 @@ export const allRules = [
|
|
|
18
23
|
noAbsoluteLinksRule,
|
|
19
24
|
sourcesShapeRule,
|
|
20
25
|
sourcesFreshRule,
|
|
26
|
+
sourcesFreshFutureRule,
|
|
21
27
|
citationsResolveRule,
|
|
22
28
|
proseLineReferencesRule,
|
|
23
29
|
];
|
|
24
|
-
export { frontmatterRequiredRule, reservedFilesBareRule, linksResolveRule, noAbsoluteLinksRule, sourcesShapeRule, sourcesFreshRule, citationsResolveRule, proseLineReferencesRule, };
|
|
30
|
+
export { frontmatterRequiredRule, reservedFilesBareRule, linksResolveRule, noAbsoluteLinksRule, sourcesShapeRule, sourcesFreshRule, sourcesFreshFutureRule, citationsResolveRule, proseLineReferencesRule, };
|
|
25
31
|
//# sourceMappingURL=index.js.map
|
package/dist/rules/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/rules/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/rules/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAErE,6DAA6D;AAC7D,sEAAsE;AACtE,2EAA2E;AAC3E,+DAA+D;AAC/D,6DAA6D;AAC7D,EAAE;AACF,wEAAwE;AACxE,uEAAuE;AACvE,0EAA0E;AAC1E,2DAA2D;AAC3D,MAAM,CAAC,MAAM,QAAQ,GAAW;IAC9B,uBAAuB;IACvB,qBAAqB;IACrB,gBAAgB;IAChB,mBAAmB;IACnB,gBAAgB;IAChB,gBAAgB;IAChB,sBAAsB;IACtB,oBAAoB;IACpB,uBAAuB;CACxB,CAAC;AAEF,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,sBAAsB,EACtB,oBAAoB,EACpB,uBAAuB,GACxB,CAAC"}
|
|
@@ -1,2 +1,44 @@
|
|
|
1
1
|
import type { Rule } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Default clock-skew allowance (seconds) for `sources-fresh-future`: a doc
|
|
4
|
+
* timestamp up to this far after the doc's own last commit is still treated
|
|
5
|
+
* as fresh, absorbing the ordinary gap between "author wrote the timestamp"
|
|
6
|
+
* and "the commit that carries it landed". Override via
|
|
7
|
+
* `ctx.freshnessFutureSkewSeconds` (CLI: `--future-skew-minutes`).
|
|
8
|
+
*/
|
|
9
|
+
export declare const DEFAULT_FUTURE_SKEW_SECONDS = 600;
|
|
2
10
|
export declare const sourcesFreshRule: Rule;
|
|
11
|
+
/**
|
|
12
|
+
* Complements `sources-fresh`'s "too old" check with the opposite direction:
|
|
13
|
+
* a doc `timestamp` that is later than the doc file's OWN last commit (past
|
|
14
|
+
* a small clock-skew allowance) is almost always a mistake, not a real
|
|
15
|
+
* future date -- typically a local wall-clock time hand-written with a
|
|
16
|
+
* trailing `Z`/UTC suffix it does not actually have. Unlike `sources-fresh`,
|
|
17
|
+
* this check never looks at `sources` commit times at all: it only compares
|
|
18
|
+
* the doc's own `timestamp` against the doc file's own git history, so it
|
|
19
|
+
* has nothing to say about whether any source is stale.
|
|
20
|
+
*
|
|
21
|
+
* Deliberately assessed for the SAME population as `sources-fresh` (docs
|
|
22
|
+
* with a validly-shaped `sources` list and a repo root available): a
|
|
23
|
+
* `timestamp` only has "last verified against sources" semantics for a doc
|
|
24
|
+
* that declares `sources` (see the package README's authoring guidance), so
|
|
25
|
+
* a sourceless doc is out of scope for both freshness rules, not just this
|
|
26
|
+
* one. It shares `sources-fresh`'s "staleness unknown" posture for the two
|
|
27
|
+
* cases that make a real answer impossible: no repo root (silently defers
|
|
28
|
+
* to the single bundle-level notice `sources-fresh` already emits above,
|
|
29
|
+
* rather than duplicating it) and no valid `timestamp` (`sources-fresh`
|
|
30
|
+
* already reports that per-doc notice, so this rule silently skips such a
|
|
31
|
+
* doc rather than reporting it twice). An uncommitted doc (no own commit
|
|
32
|
+
* yet) is likewise "unknown, not flagged" by DEFAULT: there is no real
|
|
33
|
+
* commit time to compare the timestamp against, and flagging every
|
|
34
|
+
* hand-authored, not-yet-committed doc as "future-dated" would be a false
|
|
35
|
+
* positive on every fresh draft. Under `--dirty-as-now` (`ctx.dirtyAsNow`),
|
|
36
|
+
* this changes: `getDocCommitEpochShared` below substitutes the shared
|
|
37
|
+
* virtual-commit "now" instant for ANY dirty doc's epoch (untracked
|
|
38
|
+
* included -- see `commitEpochWithDirtyAsNow`), so a dirty doc DOES get a
|
|
39
|
+
* real comparison here, exactly the working-tree parity `--dirty-as-now`
|
|
40
|
+
* exists for: a `timestamp` re-stamped to "now" reads fresh (within the
|
|
41
|
+
* skew allowance), while one still carrying an implausible future value
|
|
42
|
+
* gets caught before the commit that would otherwise make it so in CI.
|
|
43
|
+
*/
|
|
44
|
+
export declare const sourcesFreshFutureRule: Rule;
|