unknown-knowledge 2.1.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/LICENSE +202 -0
- package/NOTICE +5 -0
- package/README.md +167 -0
- package/cli/.gitkeep +0 -0
- package/cli/commands/init-copy.js +90 -0
- package/cli/commands/init.js +386 -0
- package/cli/init-copy.js +24 -0
- package/cli/init.js +24 -0
- package/cli/kit.manifest.yaml +256 -0
- package/cli/lib/copy-payload.js +334 -0
- package/cli/lib/generate-wrappers.js +162 -0
- package/package.json +36 -0
- package/payload/adapter-fixtures/README.md +53 -0
- package/payload/adapter-fixtures/html/EXPECTED.yaml +50 -0
- package/payload/adapter-fixtures/html/sample.html +38 -0
- package/payload/adapter-fixtures/md/EXPECTED.yaml +65 -0
- package/payload/adapter-fixtures/md/sample.md +32 -0
- package/payload/adapter-fixtures/pdf/EXPECTED.yaml +45 -0
- package/payload/adapter-fixtures/pdf/sample.pdf +0 -0
- package/payload/adapter-fixtures/txt/EXPECTED.yaml +31 -0
- package/payload/adapter-fixtures/txt/sample.txt +18 -0
- package/payload/docs/README.md +102 -0
- package/payload/docs/boundaries.md +60 -0
- package/payload/docs/ci-wiring.md +109 -0
- package/payload/docs/steward-guide.md +238 -0
- package/payload/engine/audit.js +34 -0
- package/payload/engine/commands/audit.js +289 -0
- package/payload/engine/commands/derive.js +334 -0
- package/payload/engine/commands/ingest.js +124 -0
- package/payload/engine/commands/log-entry.js +85 -0
- package/payload/engine/commands/phoenix.js +206 -0
- package/payload/engine/commands/preflight.js +530 -0
- package/payload/engine/commands/resolve.js +1678 -0
- package/payload/engine/commands/survey-map.js +351 -0
- package/payload/engine/commands/validate-values.js +315 -0
- package/payload/engine/commands/validate.js +1426 -0
- package/payload/engine/derive.js +34 -0
- package/payload/engine/ingest.js +34 -0
- package/payload/engine/lib/anchor-signatures.js +126 -0
- package/payload/engine/lib/boot.js +39 -0
- package/payload/engine/lib/call-numbers.js +133 -0
- package/payload/engine/lib/cli.js +147 -0
- package/payload/engine/lib/coverage.js +849 -0
- package/payload/engine/lib/decomposition.js +225 -0
- package/payload/engine/lib/derived.js +494 -0
- package/payload/engine/lib/engine-refusal.js +40 -0
- package/payload/engine/lib/exit-codes.js +14 -0
- package/payload/engine/lib/extractor-kinds.js +955 -0
- package/payload/engine/lib/format-adapters.js +802 -0
- package/payload/engine/lib/id-grammars.js +178 -0
- package/payload/engine/lib/iso-date.js +55 -0
- package/payload/engine/lib/kit-root.js +101 -0
- package/payload/engine/lib/load-stores.js +1624 -0
- package/payload/engine/lib/log-entry.js +196 -0
- package/payload/engine/lib/phoenix.js +628 -0
- package/payload/engine/lib/scoring.js +150 -0
- package/payload/engine/lib/suppressions.js +172 -0
- package/payload/engine/lib/time-verdicts.js +282 -0
- package/payload/engine/lib/usage-error.js +14 -0
- package/payload/engine/lib/validate-record.js +504 -0
- package/payload/engine/log-entry.js +34 -0
- package/payload/engine/phoenix.js +39 -0
- package/payload/engine/preflight.js +34 -0
- package/payload/engine/resolve.js +34 -0
- package/payload/engine/survey-map.js +34 -0
- package/payload/engine/validate-values.js +34 -0
- package/payload/engine/validate.js +34 -0
- package/payload/extractor-fixtures/.gitkeep +0 -0
- package/payload/extractor-fixtures/README.md +29 -0
- package/payload/extractor-fixtures/swift/strings-keys/EXPECTED.yaml +8 -0
- package/payload/extractor-fixtures/swift/strings-keys/sample.strings +15 -0
- package/payload/extractor-fixtures/swift/swift-const-array/EXPECTED.yaml +7 -0
- package/payload/extractor-fixtures/swift/swift-const-array/sample.swift +21 -0
- package/payload/extractor-fixtures/swift/swift-enum/EXPECTED.yaml +8 -0
- package/payload/extractor-fixtures/swift/swift-enum/sample.swift +30 -0
- package/payload/extractor-fixtures/swift/yaml-keys/EXPECTED.yaml +6 -0
- package/payload/extractor-fixtures/swift/yaml-keys/sample.yaml +23 -0
- package/payload/extractor-fixtures/swift/yaml-map-keys/EXPECTED.yaml +7 -0
- package/payload/extractor-fixtures/swift/yaml-map-keys/sample.yaml +15 -0
- package/payload/extractor-fixtures/ts/dir-modules/EXPECTED.yaml +12 -0
- package/payload/extractor-fixtures/ts/dir-modules/sample-modules/alpha.widget.ts +1 -0
- package/payload/extractor-fixtures/ts/dir-modules/sample-modules/beta.widget.ts +1 -0
- package/payload/extractor-fixtures/ts/dir-modules/sample-modules/gamma.widget.ts +1 -0
- package/payload/extractor-fixtures/ts/dir-modules/sample-modules/helpers/format.ts +3 -0
- package/payload/extractor-fixtures/ts/dir-modules/sample-modules/widgets.test.ts +2 -0
- package/payload/extractor-fixtures/ts/json-keys/EXPECTED.yaml +7 -0
- package/payload/extractor-fixtures/ts/json-keys/sample.json +5 -0
- package/payload/extractor-fixtures/ts/json-map-keys/EXPECTED.yaml +7 -0
- package/payload/extractor-fixtures/ts/json-map-keys/sample.json +13 -0
- package/payload/extractor-fixtures/ts/ts-const-array/EXPECTED.yaml +6 -0
- package/payload/extractor-fixtures/ts/ts-const-array/sample.ts +13 -0
- package/payload/extractor-fixtures/ts/ts-enum/EXPECTED.yaml +7 -0
- package/payload/extractor-fixtures/ts/ts-enum/sample.ts +11 -0
- package/payload/extractor-fixtures/ts/ts-object-keys/EXPECTED.yaml +6 -0
- package/payload/extractor-fixtures/ts/ts-object-keys/sample.tsx +23 -0
- package/payload/extractor-fixtures/ts/ts-union/EXPECTED.yaml +5 -0
- package/payload/extractor-fixtures/ts/ts-union/sample.ts +9 -0
- package/payload/hooks/pre-commit +37 -0
- package/payload/hooks/reverse-lookup +66 -0
- package/payload/package.json +3 -0
- package/payload/protocol/.gitkeep +0 -0
- package/payload/protocol/AGENTS.md +239 -0
- package/payload/protocol/derived-layer.md +174 -0
- package/payload/protocol/new-kind-pipeline.md +179 -0
- package/payload/protocol/registry-warrant.md +162 -0
- package/payload/protocol/skills/kb-build.md +303 -0
- package/payload/protocol/skills/knowledge-audit.md +183 -0
- package/payload/protocol/skills/knowledge-bootstrap.md +229 -0
- package/payload/protocol/skills/knowledge-reflect.md +397 -0
- package/payload/schemas/catalog.schema.json +32 -0
- package/payload/schemas/decision-entry.schema.json +122 -0
- package/payload/schemas/finding.schema.json +77 -0
- package/payload/schemas/gap.schema.json +52 -0
- package/payload/schemas/graduation-categories.schema.json +64 -0
- package/payload/schemas/knowledge-leaf.schema.json +194 -0
- package/payload/schemas/miss.schema.json +45 -0
- package/payload/schemas/ontology-concept.schema.json +115 -0
- package/payload/schemas/phoenix-event.schema.json +76 -0
- package/payload/schemas/registry.schema.json +57 -0
- package/payload/schemas/rules.schema.json +14 -0
- package/payload/schemas/survey-scope.schema.json +23 -0
- package/payload/templates/decisions/_catalog.yaml +7 -0
- package/payload/templates/decisions/_registries/graduation-categories.yaml +42 -0
- package/payload/templates/decisions/phoenix-event.yaml +74 -0
- package/payload/templates/decisions/reflect-mint-proposal.yaml +100 -0
- package/payload/templates/decisions/registry-minting.yaml +58 -0
- package/payload/templates/decisions/trust-graduation.yaml +120 -0
- package/payload/templates/decisions/trust-revocation.yaml +106 -0
- package/payload/templates/knowledge/_catalog.yaml +9 -0
- package/payload/templates/knowledge/_registries/anchor.yaml +42 -0
- package/payload/templates/knowledge/_registries/authority-tiers.yaml +32 -0
- package/payload/templates/knowledge/_registries/domains.yaml +43 -0
- package/payload/templates/knowledge/_registries/form.yaml +38 -0
- package/payload/templates/knowledge/_registries/jurisdictions.yaml +20 -0
- package/payload/templates/knowledge/_registries/operations.yaml +18 -0
- package/payload/templates/knowledge/_registries/stage.yaml +53 -0
- package/payload/templates/knowledge/_rules.yaml +6 -0
- package/payload/templates/new-kind/README.md +107 -0
- package/payload/templates/new-kind/descriptor.example.yaml +18 -0
- package/payload/templates/new-kind/fixture/EXPECTED.yaml +6 -0
- package/payload/templates/new-kind/fixture/demo-anchor.list +2 -0
- package/payload/templates/new-kind/fixture/sample.list +7 -0
- package/payload/templates/new-kind/parser.example.js +98 -0
- package/payload/templates/ontology/_catalog.yaml +6 -0
- package/payload/templates/ontology/_rules.yaml +6 -0
- package/payload/wrappers/cursor.mdc +15 -0
- package/payload/wrappers/pointer.md +10 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* new-kind drafting template — parser skeleton (PRD §5.2 DRAFT step).
|
|
4
|
+
*
|
|
5
|
+
* This file demonstrates the SHAPE of an extractor-kind parser using a
|
|
6
|
+
* deliberately trivial demo kind, `line-list`: a plain-text file whose value
|
|
7
|
+
* set is one `- value` line per value. Copy it, rename the kind, and replace
|
|
8
|
+
* the extraction logic — keep the contract:
|
|
9
|
+
*
|
|
10
|
+
* 1. PURE + DETERMINISTIC: source text in, value set out. No imports of
|
|
11
|
+
* repo content, no eval, no spawn, no network, no wall clock (D-014 —
|
|
12
|
+
* the engine only ever *reads* the anchor lexically).
|
|
13
|
+
* 2. HARD-ERROR, NEVER GUESS: anything the recipe can't parse is a thrown
|
|
14
|
+
* error, not a skipped line. A recipe that can't parse errors loudly
|
|
15
|
+
* instead of hiding (PRD §5).
|
|
16
|
+
* 3. DECLARE A SYNTACTIC ENVELOPE: hard-error when out-of-envelope
|
|
17
|
+
* sentinels appear in the matched span. A confident wrong parse is a
|
|
18
|
+
* false all-clear — the D-005/D-012 failure class.
|
|
19
|
+
* 4. VALUES ARE STRINGS, compared byte-exact and case-sensitive, as sets
|
|
20
|
+
* (§3.5): emit strings; order is irrelevant; duplicates in source are
|
|
21
|
+
* the caller's finding, so emit them as read.
|
|
22
|
+
*
|
|
23
|
+
* D-005 applies to this file's whole lifecycle: drafted in a session, it is
|
|
24
|
+
* NEVER wired into the validator in that session. It enters through GATE —
|
|
25
|
+
* a PR carrying this parser, its fixture (fixture/sample.list →
|
|
26
|
+
* fixture/EXPECTED.yaml), and a demo run against the live anchor the miss
|
|
27
|
+
* recorded. See protocol/new-kind-pipeline.md (client-relative; under
|
|
28
|
+
* payload/ in the kit repo).
|
|
29
|
+
*/
|
|
30
|
+
import { readFileSync } from 'node:fs';
|
|
31
|
+
import { pathToFileURL } from 'node:url';
|
|
32
|
+
import process from 'node:process';
|
|
33
|
+
|
|
34
|
+
/** Rename per kind: lowercase, digits, hyphens (enumerates `kind` pattern). */
|
|
35
|
+
export const KIND = 'line-list';
|
|
36
|
+
|
|
37
|
+
// The envelope, stated as data so the fixture and the review can see it:
|
|
38
|
+
// lines are split on \n or \r\n (CRLF anchors are the same document); blank
|
|
39
|
+
// lines and `#` comments are ignored; `- value` lines emit a value, where the
|
|
40
|
+
// value starts AND ends with non-whitespace — a value line carrying trailing
|
|
41
|
+
// whitespace is an out-of-envelope sentinel (it would capture a value that
|
|
42
|
+
// can never byte-match its visually identical claim); ANY other line is an
|
|
43
|
+
// out-of-envelope sentinel and hard-errors.
|
|
44
|
+
const VALUE_LINE = /^- (\S(?:.*\S)?)$/;
|
|
45
|
+
const TRAILING_WHITESPACE_VALUE_LINE = /^- \S.*\s$/;
|
|
46
|
+
const IGNORED_LINE = /^(\s*|#.*)$/;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Extract the value set from one anchor's source text.
|
|
50
|
+
*
|
|
51
|
+
* @param {string} text the anchor file's content (read lexically, never imported)
|
|
52
|
+
* @param {string} [file] anchor path, for error messages only
|
|
53
|
+
* @returns {string[]} values as read (strings; caller compares as a set)
|
|
54
|
+
*/
|
|
55
|
+
export function extractValues(text, file = '<anchor>') {
|
|
56
|
+
const values = [];
|
|
57
|
+
const lines = text.split(/\r?\n/);
|
|
58
|
+
for (let i = 0; i < lines.length; i += 1) {
|
|
59
|
+
const line = lines[i];
|
|
60
|
+
const match = VALUE_LINE.exec(line);
|
|
61
|
+
if (match) {
|
|
62
|
+
values.push(match[1]);
|
|
63
|
+
} else if (TRAILING_WHITESPACE_VALUE_LINE.test(line)) {
|
|
64
|
+
// Trailing whitespace would emit a value that can never byte-match the
|
|
65
|
+
// visually identical claim (§3.5) — name the invisible byte, never guess.
|
|
66
|
+
throw new Error(`${file}:${i + 1}: value line carries trailing whitespace — the captured value could never byte-match its visually identical claim (§3.5), so the line is outside the ${KIND} envelope: ${JSON.stringify(line)}`);
|
|
67
|
+
} else if (!IGNORED_LINE.test(line)) {
|
|
68
|
+
// Out-of-envelope sentinel: hard-error loudly, never skip (PRD §5).
|
|
69
|
+
throw new Error(`${file}:${i + 1}: line is outside the ${KIND} envelope (expected blank, "#" comment, or "- value"): ${JSON.stringify(line)}`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (values.length === 0) {
|
|
73
|
+
// A pointer at a file with no values is the wrong-pointer signature —
|
|
74
|
+
// an empty claim silently passing would be a false all-clear.
|
|
75
|
+
throw new Error(`${file}: no ${KIND} values found — wrong pointer, or the anchor is no longer reified`);
|
|
76
|
+
}
|
|
77
|
+
return values;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Demo-run CLI (it produces the third DRAFT artifact, the demo run): run the
|
|
81
|
+
// draft against the live anchor the miss recorded and attach the output to
|
|
82
|
+
// the GATE PR.
|
|
83
|
+
// node parser.example.js <anchor-path>
|
|
84
|
+
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
|
|
85
|
+
const file = process.argv[2];
|
|
86
|
+
if (!file) {
|
|
87
|
+
process.stderr.write(`usage: node parser.example.js <anchor-path>\n`);
|
|
88
|
+
process.exitCode = 2;
|
|
89
|
+
} else {
|
|
90
|
+
try {
|
|
91
|
+
const values = extractValues(readFileSync(file, 'utf8'), file);
|
|
92
|
+
console.log(JSON.stringify({ kind: KIND, file, values }, null, 2));
|
|
93
|
+
} catch (error) {
|
|
94
|
+
process.stderr.write(`${KIND}: ${error.message}\n`);
|
|
95
|
+
process.exitCode = 2; // a check that never ran is a blocking defect
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# ontology/_catalog.yaml — navigational entry point (catalog -> rules -> class files).
|
|
2
|
+
# Empty seed: init copies it; /knowledge-bootstrap (D-019) fills entries after the taxonomy gate.
|
|
3
|
+
# Shape: payload/schemas/catalog.schema.json. schema-version evolves additively (§3.5).
|
|
4
|
+
schema-version: 1
|
|
5
|
+
store: ontology
|
|
6
|
+
entries: []
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# ontology/_rules.yaml — per-store governance rules (id ranges per class, write gates).
|
|
2
|
+
# Empty seed: rule items are bootstrap-generated per project; the shape is formalized
|
|
3
|
+
# additively by the taxonomy issues. Shape: payload/schemas/rules.schema.json.
|
|
4
|
+
schema-version: 1
|
|
5
|
+
store: ontology
|
|
6
|
+
rules: []
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: unknown-knowledge store — read {{root}}/protocol/AGENTS.md before working
|
|
3
|
+
alwaysApply: true
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## unknown-knowledge
|
|
7
|
+
|
|
8
|
+
This repository carries an unknown-knowledge store at `{{root}}/` — three
|
|
9
|
+
governed YAML stores that map the system and a deterministic engine that
|
|
10
|
+
checks the map.
|
|
11
|
+
|
|
12
|
+
Before working in this repository, read `{{root}}/protocol/AGENTS.md` — the
|
|
13
|
+
platform-agnostic navigation contract — and follow its five-step runtime loop
|
|
14
|
+
on every request. That file is the single source of truth for the protocol;
|
|
15
|
+
this wrapper is a thin pointer and intentionally repeats none of it.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
## unknown-knowledge
|
|
2
|
+
|
|
3
|
+
This repository carries an unknown-knowledge store at `{{root}}/` — three
|
|
4
|
+
governed YAML stores that map the system and a deterministic engine that
|
|
5
|
+
checks the map.
|
|
6
|
+
|
|
7
|
+
Before working in this repository, read `{{root}}/protocol/AGENTS.md` — the
|
|
8
|
+
platform-agnostic navigation contract — and follow its five-step runtime loop
|
|
9
|
+
on every request. That file is the single source of truth for the protocol;
|
|
10
|
+
this wrapper is a thin pointer and intentionally repeats none of it.
|