knosky 0.6.3 → 0.7.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 +149 -93
- package/CREDITS.md +14 -14
- package/LICENSE.md +76 -76
- package/LIMITATIONS.md +33 -23
- package/PRIVACY.md +30 -30
- package/README.md +170 -117
- package/SECURITY.md +78 -46
- package/action/post-comment.mjs +94 -89
- package/action.yml +62 -62
- package/bin/knosky.mjs +279 -105
- package/core/CONTRACT.md +70 -70
- package/core/append-only-checkpoint.mjs +215 -0
- package/core/audit-writer.mjs +317 -0
- package/core/benchmark-results.mjs +225 -225
- package/core/bundle.mjs +178 -178
- package/core/churn.mjs +23 -23
- package/core/ci.mjs +268 -268
- package/core/comparison.mjs +189 -189
- package/core/config.mjs +189 -189
- package/core/constants.mjs +13 -13
- package/core/contract.mjs +123 -123
- package/core/cross-repo.mjs +111 -111
- package/core/decision-codes.mjs +92 -0
- package/core/destination.mjs +161 -161
- package/core/district-classification.mjs +111 -0
- package/core/doctor-scorecard.mjs +369 -0
- package/core/domain-store.mjs +347 -0
- package/core/edges.mjs +43 -43
- package/core/escalate.mjs +68 -68
- package/core/freshness.mjs +198 -194
- package/core/fs-indexer.mjs +218 -218
- package/core/key-store.mjs +348 -348
- package/core/layout.mjs +46 -46
- package/core/ledger.mjs +176 -141
- package/core/local-ipc-identity.mjs +500 -0
- package/core/lod.mjs +155 -155
- package/core/mode-b.mjs +410 -0
- package/core/multi-model-benchmark.mjs +405 -405
- package/core/net-lockdown.mjs +421 -0
- package/core/onboarding.mjs +223 -223
- package/core/operator-auth.mjs +317 -0
- package/core/overlays.mjs +45 -45
- package/core/policy-lattice.mjs +142 -0
- package/core/pr-comment.mjs +198 -198
- package/core/protocol-spec.mjs +460 -460
- package/core/provenance.mjs +320 -0
- package/core/retrieve.mjs +63 -63
- package/core/route.mjs +304 -304
- package/core/schema.mjs +275 -275
- package/core/signing-tiers.mjs +1265 -0
- package/core/swarm-bench.mjs +106 -0
- package/core/swarm-coordinator.mjs +867 -0
- package/core/trust-root-rekey.mjs +410 -0
- package/mcp/server.mjs +264 -108
- package/package.json +56 -46
- package/renderer/art/kenney/buildingTiles_sheet.xml +130 -130
- package/renderer/art/kenney/cityDetails_sheet.xml +12 -12
- package/renderer/art/kenney/landscapeTiles_sheet.xml +129 -129
- package/renderer/art/kenney/sheet_allCars.xml +545 -545
- package/renderer/build-rich.mjs +43 -43
- package/renderer/city.template.html +808 -808
- package/ssot/decision-codes.json +133 -0
- package/ssot/ladder-l0-l3.md +232 -0
- package/ssot/tool-menu.json +130 -0
package/renderer/build-rich.mjs
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
// Build a single-file, self-contained KnoSky city: inline the contract data AND the CC0 art
|
|
2
|
-
// sheets (base64) so the output .html opens anywhere - no server, no asset folder.
|
|
3
|
-
//
|
|
4
|
-
// node renderer/build-rich.mjs <city-data.json> <out.html> # Kenney CC0 art (default)
|
|
5
|
-
// node renderer/build-rich.mjs <city-data.json> <out.html> --vector # owned vector art, no sprites
|
|
6
|
-
import fs from 'node:fs';
|
|
7
|
-
import path from 'node:path';
|
|
8
|
-
import { fileURLToPath } from 'node:url';
|
|
9
|
-
|
|
10
|
-
const DIR = path.dirname(fileURLToPath(import.meta.url));
|
|
11
|
-
const args = process.argv.slice(2).filter(a => !a.startsWith('--'));
|
|
12
|
-
const [dataPath, outName] = args;
|
|
13
|
-
if (!dataPath || !outName) {
|
|
14
|
-
console.log('usage: node build-rich.mjs <city-data.json> <out.html> [--vector]');
|
|
15
|
-
process.exit(1);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
// Escape a string for safe embedding inside an HTML <script> block: neutralize </script> breakout
|
|
19
|
-
// and the U+2028/U+2029 JS line-terminator hazard. Output stays valid JSON. (No literal control chars in source.)
|
|
20
|
-
const U2028 = String.fromCharCode(0x2028), U2029 = String.fromCharCode(0x2029);
|
|
21
|
-
const htmlSafe = (s) => s.split('<').join('\\u003c').split(U2028).join('\\u2028').split(U2029).join('\\u2029');
|
|
22
|
-
|
|
23
|
-
const VECTOR = process.argv.includes('--vector'); // owned vector art; default = Kenney CC0 sprite art
|
|
24
|
-
let head = '<script>window.__KC_VECTOR__=true;</script>\n';
|
|
25
|
-
if (!VECTOR) {
|
|
26
|
-
const KDIR = path.join(DIR, 'art', 'kenney');
|
|
27
|
-
const SHEETS = ['buildingTiles_sheet', 'cityDetails_sheet', 'sheet_allCars', 'landscapeTiles_sheet'];
|
|
28
|
-
const ks = {};
|
|
29
|
-
for (const nm of SHEETS) ks[nm] = {
|
|
30
|
-
xml: fs.readFileSync(path.join(KDIR, nm + '.xml'), 'utf8'),
|
|
31
|
-
png: 'data:image/png;base64,' + fs.readFileSync(path.join(KDIR, nm + '.png')).toString('base64')
|
|
32
|
-
};
|
|
33
|
-
head = '<script>window.__KC_KENNEY__=true;window.__KC_KENNEY_SHEETS__=' + htmlSafe(JSON.stringify(ks)) + ';</script>\n';
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const tmpl = fs.readFileSync(path.join(DIR, 'city.template.html'), 'utf8');
|
|
37
|
-
const data = htmlSafe(fs.readFileSync(path.resolve(dataPath), 'utf8').trim());
|
|
38
|
-
let html = tmpl.replace('__CITY_DATA__', () => data);
|
|
39
|
-
html = html.replace('<script id="kc-data"', () => head + '<script id="kc-data"');
|
|
40
|
-
|
|
41
|
-
const out = path.resolve(outName);
|
|
42
|
-
fs.writeFileSync(out, html);
|
|
43
|
-
console.log('built', out, '->', (html.length / 1024 / 1024).toFixed(2), 'MB (single file)');
|
|
1
|
+
// Build a single-file, self-contained KnoSky city: inline the contract data AND the CC0 art
|
|
2
|
+
// sheets (base64) so the output .html opens anywhere - no server, no asset folder.
|
|
3
|
+
//
|
|
4
|
+
// node renderer/build-rich.mjs <city-data.json> <out.html> # Kenney CC0 art (default)
|
|
5
|
+
// node renderer/build-rich.mjs <city-data.json> <out.html> --vector # owned vector art, no sprites
|
|
6
|
+
import fs from 'node:fs';
|
|
7
|
+
import path from 'node:path';
|
|
8
|
+
import { fileURLToPath } from 'node:url';
|
|
9
|
+
|
|
10
|
+
const DIR = path.dirname(fileURLToPath(import.meta.url));
|
|
11
|
+
const args = process.argv.slice(2).filter(a => !a.startsWith('--'));
|
|
12
|
+
const [dataPath, outName] = args;
|
|
13
|
+
if (!dataPath || !outName) {
|
|
14
|
+
console.log('usage: node build-rich.mjs <city-data.json> <out.html> [--vector]');
|
|
15
|
+
process.exit(1);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Escape a string for safe embedding inside an HTML <script> block: neutralize </script> breakout
|
|
19
|
+
// and the U+2028/U+2029 JS line-terminator hazard. Output stays valid JSON. (No literal control chars in source.)
|
|
20
|
+
const U2028 = String.fromCharCode(0x2028), U2029 = String.fromCharCode(0x2029);
|
|
21
|
+
const htmlSafe = (s) => s.split('<').join('\\u003c').split(U2028).join('\\u2028').split(U2029).join('\\u2029');
|
|
22
|
+
|
|
23
|
+
const VECTOR = process.argv.includes('--vector'); // owned vector art; default = Kenney CC0 sprite art
|
|
24
|
+
let head = '<script>window.__KC_VECTOR__=true;</script>\n';
|
|
25
|
+
if (!VECTOR) {
|
|
26
|
+
const KDIR = path.join(DIR, 'art', 'kenney');
|
|
27
|
+
const SHEETS = ['buildingTiles_sheet', 'cityDetails_sheet', 'sheet_allCars', 'landscapeTiles_sheet'];
|
|
28
|
+
const ks = {};
|
|
29
|
+
for (const nm of SHEETS) ks[nm] = {
|
|
30
|
+
xml: fs.readFileSync(path.join(KDIR, nm + '.xml'), 'utf8'),
|
|
31
|
+
png: 'data:image/png;base64,' + fs.readFileSync(path.join(KDIR, nm + '.png')).toString('base64')
|
|
32
|
+
};
|
|
33
|
+
head = '<script>window.__KC_KENNEY__=true;window.__KC_KENNEY_SHEETS__=' + htmlSafe(JSON.stringify(ks)) + ';</script>\n';
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const tmpl = fs.readFileSync(path.join(DIR, 'city.template.html'), 'utf8');
|
|
37
|
+
const data = htmlSafe(fs.readFileSync(path.resolve(dataPath), 'utf8').trim());
|
|
38
|
+
let html = tmpl.replace('__CITY_DATA__', () => data);
|
|
39
|
+
html = html.replace('<script id="kc-data"', () => head + '<script id="kc-data"');
|
|
40
|
+
|
|
41
|
+
const out = path.resolve(outName);
|
|
42
|
+
fs.writeFileSync(out, html);
|
|
43
|
+
console.log('built', out, '->', (html.length / 1024 / 1024).toFixed(2), 'MB (single file)');
|