@prestack/thread 0.1.3 → 0.1.5
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 +563 -0
- package/dist/core/actor.d.ts +1 -1
- package/dist/core/actor.js +5 -4
- package/dist/core/actor.ts +5 -4
- package/dist/core/attach.d.ts +0 -7
- package/dist/core/attach.js +38 -67
- package/dist/core/attach.ts +34 -80
- package/dist/core/chain.js +13 -17
- package/dist/core/chain.ts +11 -15
- package/dist/core/condition.d.ts +4 -4
- package/dist/core/condition.js +2 -2
- package/dist/core/descend.d.ts +4 -2
- package/dist/core/descend.js +91 -23
- package/dist/core/descend.ts +90 -21
- package/dist/core/errors/catalogue.d.ts +52 -0
- package/dist/{operations/errors/errors.js → core/errors/catalogue.js} +1 -1
- package/dist/{operations/errors/errors.ts → core/errors/catalogue.ts} +1 -1
- package/dist/{operations/errors/catalog.d.ts → core/errors/error.d.ts} +2 -3
- package/dist/{operations/errors/catalog.js → core/errors/error.js} +1 -16
- package/dist/{operations/errors/catalog.ts → core/errors/error.ts} +3 -19
- package/dist/core/errors/namespaces.d.ts +3 -0
- package/dist/core/errors/namespaces.js +15 -0
- package/dist/core/errors/namespaces.ts +19 -0
- package/dist/core/finding.js +2 -2
- package/dist/core/finding.ts +1 -2
- package/dist/core/init.d.ts +1 -1
- package/dist/core/init.js +51 -5
- package/dist/core/init.ts +58 -5
- package/dist/core/invoked.d.ts +1 -1
- package/dist/core/invoked.js +3 -1
- package/dist/core/invoked.ts +5 -2
- package/dist/core/round.js +36 -22
- package/dist/core/round.ts +26 -9
- package/dist/core/rows.d.ts +4 -0
- package/dist/core/rows.js +31 -2
- package/dist/core/rows.ts +33 -1
- package/dist/core/scope.d.ts +1 -0
- package/dist/core/scope.js +1 -0
- package/dist/core/scope.ts +2 -0
- package/dist/core/thread.d.ts +3 -3
- package/dist/core/tree.d.ts +4 -1
- package/dist/core/tree.js +26 -6
- package/dist/core/tree.ts +29 -6
- package/dist/core/types.d.ts +3 -3
- package/dist/core/types.js +3 -1
- package/dist/core/types.ts +2 -1
- package/dist/derivation/attach.js +3 -2
- package/dist/derivation/attach.ts +2 -1
- package/dist/derivation/generators/build.js +6 -6
- package/dist/derivation/generators/build.ts +1 -1
- package/dist/derivation/generators/check.js +1 -1
- package/dist/derivation/generators/determinism.js +1 -1
- package/dist/derivation/generators/release.js +60 -47
- package/dist/derivation/generators/release.ts +66 -43
- package/dist/derivation/release.d.ts +7 -3
- package/dist/derivation/release.js +14 -1
- package/dist/derivation/release.ts +22 -2
- package/dist/integrations/attach.d.ts +4 -0
- package/dist/integrations/attach.js +37 -56
- package/dist/integrations/attach.ts +54 -60
- package/dist/integrations/cli.d.ts +37 -0
- package/dist/integrations/cli.js +440 -0
- package/dist/integrations/cli.ts +543 -0
- package/dist/{core/files.d.ts → integrations/disk.d.ts} +16 -24
- package/dist/integrations/disk.js +435 -0
- package/dist/integrations/disk.ts +465 -0
- package/dist/integrations/generators/read.js +6 -6
- package/dist/integrations/generators/read.ts +4 -4
- package/dist/integrations/generators/vault.js +10 -11
- package/dist/integrations/generators/vault.ts +4 -5
- package/dist/{operations/http.d.ts → integrations/https.d.ts} +10 -6
- package/dist/integrations/https.js +170 -0
- package/dist/integrations/https.ts +216 -0
- package/dist/integrations/pglite.d.ts +26 -0
- package/dist/integrations/pglite.js +143 -0
- package/dist/integrations/pglite.ts +206 -0
- package/dist/integrations/secret.d.ts +8 -2
- package/dist/integrations/secret.js +3 -5
- package/dist/integrations/secret.ts +10 -6
- package/dist/integrations/target.d.ts +155 -14
- package/dist/integrations/target.js +171 -50
- package/dist/integrations/target.ts +377 -61
- package/dist/integrations/vault.d.ts +1 -0
- package/dist/integrations/vault.js +20 -5
- package/dist/integrations/vault.ts +17 -5
- package/dist/integrity/attach.js +8 -77
- package/dist/integrity/attach.ts +7 -76
- package/dist/integrity/check-threads.js +5 -5
- package/dist/integrity/check-threads.ts +2 -2
- package/dist/integrity/constraint.d.ts +0 -1
- package/dist/integrity/constraint.js +267 -366
- package/dist/integrity/constraint.ts +267 -375
- package/dist/integrity/generators/compiler.js +14 -17
- package/dist/integrity/generators/compiler.ts +10 -15
- package/dist/integrity/generators/gate.js +15 -15
- package/dist/integrity/generators/gate.ts +10 -10
- package/dist/integrity/generators/issues.js +7 -7
- package/dist/integrity/generators/publish.js +39 -57
- package/dist/integrity/generators/publish.ts +44 -55
- package/dist/integrity/generators/trial.d.ts +3 -3
- package/dist/integrity/generators/trial.js +133 -165
- package/dist/integrity/generators/trial.ts +145 -169
- package/dist/integrity/lint.js +9 -13
- package/dist/integrity/lint.ts +7 -10
- package/dist/integrity/lsp/bin.js +5 -4
- package/dist/integrity/lsp/bin.ts +3 -1
- package/dist/integrity/lsp/diagnostics.js +3 -3
- package/dist/integrity/lsp/diagnostics.ts +1 -1
- package/dist/integrity/lsp/lint.js +19 -30
- package/dist/integrity/lsp/lint.ts +16 -32
- package/dist/integrity/lsp/server.js +3 -3
- package/dist/integrity/slopnator.d.ts +3 -13
- package/dist/integrity/slopnator.js +59 -38
- package/dist/integrity/slopnator.ts +54 -38
- package/dist/integrity/slopnators/sl_broken_lineage.js +2 -2
- package/dist/integrity/slopnators/sl_declared_elsewhere.js +1 -1
- package/dist/integrity/slopnators/sl_derived_drift.js +4 -4
- package/dist/integrity/slopnators/sl_derived_drift.ts +1 -1
- package/dist/integrity/slopnators/sl_door_in_a_node.js +220 -0
- package/dist/integrity/slopnators/sl_door_in_a_node.ts +250 -0
- package/dist/integrity/slopnators/sl_inert_island.js +10 -8
- package/dist/integrity/slopnators/sl_inert_island.ts +8 -6
- package/dist/integrity/slopnators/sl_missing_row.js +6 -51
- package/dist/integrity/slopnators/sl_missing_row.ts +4 -50
- package/dist/integrity/slopnators/sl_no_barrel.js +1 -1
- package/dist/integrity/slopnators/sl_no_child_process.js +36 -18
- package/dist/integrity/slopnators/sl_no_child_process.ts +44 -18
- package/dist/integrity/slopnators/sl_no_dispatch_bypass.js +80 -149
- package/dist/integrity/slopnators/sl_no_dispatch_bypass.ts +95 -147
- package/dist/integrity/slopnators/sl_no_import_cycle.js +15 -4
- package/dist/integrity/slopnators/sl_no_import_cycle.ts +20 -4
- package/dist/integrity/slopnators/sl_no_such_command.js +2 -2
- package/dist/integrity/slopnators/sl_no_such_command.ts +1 -1
- package/dist/integrity/slopnators/sl_outside_an_operation.js +20 -0
- package/dist/integrity/slopnators/sl_outside_an_operation.ts +25 -0
- package/dist/integrity/slopnators/sl_screen_holds_only_declared.d.ts +2 -0
- package/dist/integrity/slopnators/sl_screen_holds_only_declared.js +61 -0
- package/dist/integrity/slopnators/sl_screen_holds_only_declared.ts +70 -0
- package/dist/integrity/slopnators/sl_secret_literal.js +1 -33
- package/dist/integrity/slopnators/sl_secret_literal.ts +1 -33
- package/dist/integrity/slopnators/sl_stale_path.js +5 -22
- package/dist/integrity/slopnators/sl_stale_path.ts +4 -20
- package/dist/integrity/slopnators/sl_twice_meant.js +1 -1
- package/dist/integrity/slopnators/sl_twice_parented.js +29 -5
- package/dist/integrity/slopnators/sl_twice_parented.ts +28 -4
- package/dist/integrity/slopnators/sl_undeclared_crossing.d.ts +4 -1
- package/dist/integrity/slopnators/sl_undeclared_crossing.js +426 -62
- package/dist/integrity/slopnators/sl_undeclared_crossing.ts +454 -70
- package/dist/integrity/slopnators/sl_undeclared_destination.js +59 -25
- package/dist/integrity/slopnators/sl_undeclared_destination.ts +69 -21
- package/dist/integrity/slopnators/sl_undeclared_list.d.ts +2 -0
- package/dist/integrity/slopnators/sl_undeclared_list.js +363 -0
- package/dist/integrity/slopnators/sl_undeclared_list.ts +358 -0
- package/dist/integrity/slopnators/sl_undeclared_node.js +1 -11
- package/dist/integrity/slopnators/sl_undeclared_node.ts +0 -10
- package/dist/integrity/slopnators/sl_undeclared_operation.js +111 -29
- package/dist/integrity/slopnators/sl_undeclared_operation.ts +134 -26
- package/dist/integrity/slopnators/sl_undeclared_variant.js +2 -2
- package/dist/integrity/slopnators/sl_undeclared_webhook.d.ts +2 -0
- package/dist/integrity/slopnators/sl_undeclared_webhook.js +90 -0
- package/dist/integrity/slopnators/sl_undeclared_webhook.ts +108 -0
- package/dist/integrity/slopnators/sl_underived_route.d.ts +2 -0
- package/dist/integrity/slopnators/sl_underived_route.js +61 -0
- package/dist/integrity/slopnators/sl_underived_route.ts +72 -0
- package/dist/integrity/slopnators/sl_ungoverned_island.js +3 -3
- package/dist/integrity/slopnators/sl_ungoverned_island.ts +1 -1
- package/dist/integrity/slopnators/sl_unlisted_program.d.ts +2 -0
- package/dist/integrity/slopnators/sl_unlisted_program.js +39 -0
- package/dist/integrity/slopnators/sl_unlisted_program.ts +40 -0
- package/dist/integrity/slopnators/sl_unnamed_island.js +1 -1
- package/dist/integrity/slopnators/sl_unpaired_member.js +3 -3
- package/dist/integrity/slopnators/sl_unpaired_member.ts +1 -1
- package/dist/integrity/slopnators/sl_unpaired_slopnator.js +4 -4
- package/dist/integrity/slopnators/sl_unpaired_slopnator.ts +1 -1
- package/dist/integrity/slopnators/sl_unprefixed_member.js +5 -31
- package/dist/integrity/slopnators/sl_unprefixed_member.ts +2 -28
- package/dist/integrity/slopnators/sl_unthreaded.js +11 -7
- package/dist/integrity/slopnators/sl_unthreaded.ts +6 -7
- package/dist/integrity/slopnators/sl_untranslated_key.js +2 -25
- package/dist/integrity/slopnators/sl_untranslated_key.ts +1 -25
- package/dist/integrity/slopnators/sl_unvaulted_secret.d.ts +2 -0
- package/dist/integrity/slopnators/sl_unvaulted_secret.js +107 -0
- package/dist/integrity/slopnators/sl_unvaulted_secret.ts +132 -0
- package/dist/integrity/slopnators/sl_unversioned.js +6 -4
- package/dist/integrity/slopnators/sl_unversioned.ts +5 -3
- package/dist/integrity/sweep.d.ts +1 -0
- package/dist/integrity/sweep.js +105 -42
- package/dist/integrity/sweep.ts +115 -42
- package/dist/knowledge/attach.js +4 -3
- package/dist/knowledge/attach.ts +3 -2
- package/dist/knowledge/generators/docsgen.js +8 -6
- package/dist/knowledge/generators/docsgen.ts +4 -2
- package/dist/knowledge/generators/glossary.js +4 -4
- package/dist/knowledge/generators/glossary.ts +1 -1
- package/dist/operations/access.d.ts +23 -0
- package/dist/operations/access.js +28 -1
- package/dist/operations/access.ts +43 -0
- package/dist/operations/attach.js +33 -113
- package/dist/operations/attach.ts +51 -117
- package/dist/operations/capabilities.d.ts +14 -5
- package/dist/operations/capabilities.js +13 -4
- package/dist/operations/capabilities.ts +27 -8
- package/dist/operations/dispatch.d.ts +8 -2
- package/dist/operations/dispatch.js +128 -185
- package/dist/operations/dispatch.ts +138 -191
- package/dist/operations/error-results.d.ts +1 -1
- package/dist/operations/error-results.js +2 -2
- package/dist/operations/error-results.ts +2 -2
- package/dist/operations/generators/capability.d.ts +11 -1
- package/dist/operations/generators/capability.js +481 -224
- package/dist/operations/generators/capability.ts +562 -233
- package/dist/operations/generators/compile.js +66 -39
- package/dist/operations/generators/compile.ts +78 -39
- package/dist/operations/generators/permits.js +11 -12
- package/dist/operations/generators/permits.ts +3 -4
- package/dist/operations/generators/seed.d.ts +1 -0
- package/dist/operations/generators/seed.js +19 -17
- package/dist/operations/generators/seed.ts +22 -14
- package/dist/operations/generators/trial.d.ts +6 -8
- package/dist/operations/generators/trial.js +200 -70
- package/dist/operations/generators/trial.ts +230 -93
- package/dist/operations/nodes.d.ts +15 -16
- package/dist/operations/nodes.ts +16 -17
- package/dist/operations/operations.d.ts +40 -4
- package/dist/operations/operations.js +1 -0
- package/dist/operations/operations.ts +61 -4
- package/dist/operations/result.d.ts +2 -2
- package/dist/operations/result.ts +2 -2
- package/package.json +1 -4
- package/dist/core/answers.d.ts +0 -171
- package/dist/core/answers.js +0 -789
- package/dist/core/answers.ts +0 -999
- package/dist/core/client.d.ts +0 -63
- package/dist/core/client.js +0 -249
- package/dist/core/client.ts +0 -289
- package/dist/core/files.js +0 -171
- package/dist/core/files.ts +0 -222
- package/dist/integrations/module.d.ts +0 -6
- package/dist/integrations/module.js +0 -153
- package/dist/integrations/module.ts +0 -191
- package/dist/integrity/slopnators/sl_unkept_rows.js +0 -104
- package/dist/integrity/slopnators/sl_unkept_rows.ts +0 -111
- package/dist/integrity/slopnators/sl_unseamed_reach.js +0 -73
- package/dist/integrity/slopnators/sl_unseamed_reach.ts +0 -79
- package/dist/operations/cost.d.ts +0 -14
- package/dist/operations/cost.js +0 -37
- package/dist/operations/cost.ts +0 -58
- package/dist/operations/errors/errors.d.ts +0 -52
- package/dist/operations/http.js +0 -124
- package/dist/operations/http.ts +0 -169
- package/dist/operations/memory.d.ts +0 -104
- package/dist/operations/memory.js +0 -365
- package/dist/operations/memory.ts +0 -470
- package/dist/operations/metering.d.ts +0 -55
- package/dist/operations/metering.js +0 -247
- package/dist/operations/metering.ts +0 -328
- package/dist/operations/queue-policy.d.ts +0 -3
- package/dist/operations/queue-policy.js +0 -8
- package/dist/operations/queue-policy.ts +0 -10
- package/dist/operations/seams.d.ts +0 -239
- package/dist/operations/seams.js +0 -45
- package/dist/operations/seams.ts +0 -364
- package/dist/operations/store.d.ts +0 -14
- package/dist/operations/store.js +0 -1
- package/dist/operations/store.ts +0 -29
- /package/dist/{operations → core}/errors/classes.d.ts +0 -0
- /package/dist/{operations → core}/errors/classes.js +0 -0
- /package/dist/{operations → core}/errors/classes.ts +0 -0
- /package/dist/integrity/slopnators/{sl_unkept_rows.d.ts → sl_door_in_a_node.d.ts} +0 -0
- /package/dist/integrity/slopnators/{sl_unseamed_reach.d.ts → sl_outside_an_operation.d.ts} +0 -0
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { createCipheriv, createDecipheriv, randomBytes } from 'node:crypto';
|
|
2
|
-
import * as disk from 'node:fs';
|
|
3
2
|
import { join } from 'node:path';
|
|
4
|
-
import { existsSync, readFileSync, writeFileSync } from
|
|
3
|
+
import { existsSync, readFileSync, writeFileSync } from './disk.js';
|
|
5
4
|
export const VAULT_DIR = '.thread';
|
|
6
5
|
export const SEALED_NAME = 'vault.sealed.json';
|
|
7
6
|
export const KEY_NAME = 'vault.key';
|
|
@@ -18,7 +17,7 @@ const unsealable = (named, why) => new Error(`"${named}" is in the sealed store
|
|
|
18
17
|
const undeclared = (named, known) => new Error(`nothing may ask for a secret this app does not declare, and "${named}" is not one of ` +
|
|
19
18
|
`${known.length === 0 ? '(this app declares none)' : known.join(', ')}. A value is asked for by something that ` +
|
|
20
19
|
'declared it needed it, or not at all.');
|
|
21
|
-
const unset = (named, env) => new Error(`"${named}" is declared and has no value sealed for \`${env}\`. Run \`thread create secret\` and give it one — a ` +
|
|
20
|
+
const unset = (named, env) => new Error(`"${named}" is declared and has no value sealed for \`${env}\`. Run \`thread create secret set ${named}\` and give it one — a ` +
|
|
22
21
|
'declared secret nothing was ever given is refused here rather than resolved to an empty string.');
|
|
23
22
|
const store = (root) => {
|
|
24
23
|
const at = join(root, SEALED_AT);
|
|
@@ -49,8 +48,7 @@ export function keyed(root) {
|
|
|
49
48
|
if (held !== undefined)
|
|
50
49
|
return held;
|
|
51
50
|
const made = randomBytes(KEY_BYTES);
|
|
52
|
-
|
|
53
|
-
disk.writeFileSync(join(root, KEY_AT), `${made.toString('base64')}\n`, { mode: 0o600 });
|
|
51
|
+
writeFileSync(join(root, KEY_AT), `${made.toString('base64')}\n`, { mode: 0o600 });
|
|
54
52
|
return made;
|
|
55
53
|
}
|
|
56
54
|
export function seal(root, named, env, value) {
|
|
@@ -103,4 +101,21 @@ export function opened(root, declared, env) {
|
|
|
103
101
|
return out;
|
|
104
102
|
};
|
|
105
103
|
}
|
|
104
|
+
export function unseal(root, named, envs) {
|
|
105
|
+
const held = store(root);
|
|
106
|
+
const kept = held[named];
|
|
107
|
+
if (kept === undefined)
|
|
108
|
+
return [];
|
|
109
|
+
const taken = envs.filter((env) => kept[env] !== undefined);
|
|
110
|
+
if (taken.length === 0)
|
|
111
|
+
return [];
|
|
112
|
+
const left = Object.fromEntries(Object.entries(kept).filter(([env]) => !envs.includes(env)));
|
|
113
|
+
if (Object.keys(left).length === 0)
|
|
114
|
+
delete held[named];
|
|
115
|
+
else
|
|
116
|
+
held[named] = left;
|
|
117
|
+
const sorted = Object.fromEntries(Object.keys(held).sort().map((each) => [each, held[each]]));
|
|
118
|
+
writeFileSync(join(root, SEALED_AT), `${JSON.stringify(sorted, null, 2)}\n`);
|
|
119
|
+
return taken;
|
|
120
|
+
}
|
|
106
121
|
export const IGNORES = [KEY_AT];
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { createCipheriv, createDecipheriv, randomBytes } from 'node:crypto'
|
|
2
|
-
import * as disk from 'node:fs'
|
|
3
2
|
import { join } from 'node:path'
|
|
4
3
|
|
|
5
4
|
import type { Env } from '../core/actor.ts'
|
|
6
|
-
import { existsSync, readFileSync, writeFileSync } from '
|
|
5
|
+
import { existsSync, readFileSync, writeFileSync } from './disk.ts'
|
|
7
6
|
|
|
8
7
|
export const VAULT_DIR = '.thread'
|
|
9
8
|
|
|
@@ -43,7 +42,7 @@ const undeclared = (named: string, known: readonly string[]): Error =>
|
|
|
43
42
|
|
|
44
43
|
const unset = (named: string, env: Env): Error =>
|
|
45
44
|
new Error(
|
|
46
|
-
`"${named}" is declared and has no value sealed for \`${env}\`. Run \`thread create secret\` and give it one — a ` +
|
|
45
|
+
`"${named}" is declared and has no value sealed for \`${env}\`. Run \`thread create secret set ${named}\` and give it one — a ` +
|
|
47
46
|
'declared secret nothing was ever given is refused here rather than resolved to an empty string.',
|
|
48
47
|
)
|
|
49
48
|
|
|
@@ -75,8 +74,7 @@ export function keyed(root: string): Buffer {
|
|
|
75
74
|
const held = keyOf(root)
|
|
76
75
|
if (held !== undefined) return held
|
|
77
76
|
const made = randomBytes(KEY_BYTES)
|
|
78
|
-
|
|
79
|
-
disk.writeFileSync(join(root, KEY_AT), `${made.toString('base64')}\n`, { mode: 0o600 })
|
|
77
|
+
writeFileSync(join(root, KEY_AT), `${made.toString('base64')}\n`, { mode: 0o600 })
|
|
80
78
|
return made
|
|
81
79
|
}
|
|
82
80
|
|
|
@@ -133,4 +131,18 @@ export function opened(
|
|
|
133
131
|
}
|
|
134
132
|
}
|
|
135
133
|
|
|
134
|
+
export function unseal(root: string, named: string, envs: readonly Env[]): readonly Env[] {
|
|
135
|
+
const held = store(root)
|
|
136
|
+
const kept = held[named]
|
|
137
|
+
if (kept === undefined) return []
|
|
138
|
+
const taken = envs.filter((env) => kept[env] !== undefined)
|
|
139
|
+
if (taken.length === 0) return []
|
|
140
|
+
const left = Object.fromEntries(Object.entries(kept).filter(([env]) => !envs.includes(env as Env)))
|
|
141
|
+
if (Object.keys(left).length === 0) delete held[named]
|
|
142
|
+
else held[named] = left as Partial<Record<Env, string>>
|
|
143
|
+
const sorted = Object.fromEntries(Object.keys(held).sort().map((each) => [each, held[each]]))
|
|
144
|
+
writeFileSync(join(root, SEALED_AT), `${JSON.stringify(sorted, null, 2)}\n`)
|
|
145
|
+
return taken
|
|
146
|
+
}
|
|
147
|
+
|
|
136
148
|
export const IGNORES: readonly string[] = [KEY_AT]
|
package/dist/integrity/attach.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { SHAPED } from '../core/init.js';
|
|
2
|
+
import { NAMED } from '../core/scope.js';
|
|
3
|
+
import { quoted } from '../core/rows.js';
|
|
3
4
|
const DESCRIBES = 'What this app refuses, and the checks that make each refusal actually happen. Every check has one owner, so none of them can be switched off somewhere nobody is looking.';
|
|
4
5
|
const CONSTRAINT = 'The rules the framework enforces on every app that installs it. They are read from the installed package rather than from this tree, so there is nothing here to weaken.';
|
|
5
6
|
const RULES = 'What this app refuses on top of what the framework already does. `thread create rule` asks what to ban, where it applies and what to do instead, then writes the row and the check beside it.';
|
|
6
|
-
const HOME = `node_modules/${
|
|
7
|
+
const HOME = `node_modules/${NAMED}/dist/integrity`;
|
|
7
8
|
const GATE = 'Every surface that can refuse, each naming where it lives and the command that runs it, so the gate is derived from what this system declares rather than kept as a string beside it.';
|
|
8
9
|
const COMPILER = 'The compiler run over the files this app declares and no others. A type error is the plainest kind of broken build, so it is refused here rather than found by whoever runs the app next.';
|
|
9
|
-
const INTEGRITY_SOURCE = `import type { Threaded } from '
|
|
10
|
+
const INTEGRITY_SOURCE = `import type { Threaded } from '${SHAPED}'
|
|
10
11
|
|
|
11
12
|
export const INTEGRITY: Threaded = {
|
|
12
13
|
id: 'integrity',
|
|
@@ -42,11 +43,11 @@ export const INTEGRITY: Threaded = {
|
|
|
42
43
|
],
|
|
43
44
|
}
|
|
44
45
|
`;
|
|
45
|
-
const RULES_SOURCE = `import type { Constraint } from '
|
|
46
|
+
const RULES_SOURCE = `import type { Constraint } from '${NAMED}/integrity/constraint'
|
|
46
47
|
|
|
47
48
|
export const RULES: readonly Constraint[] = []
|
|
48
49
|
`;
|
|
49
|
-
const GATE_SOURCE = `import type { Threaded } from '
|
|
50
|
+
const GATE_SOURCE = `import type { Threaded } from '${SHAPED}'
|
|
50
51
|
|
|
51
52
|
export const GATE: Threaded = {
|
|
52
53
|
id: 'gate',
|
|
@@ -103,7 +104,7 @@ const SHIPPED = [
|
|
|
103
104
|
into: 'derivation.ts',
|
|
104
105
|
list: 'GENERATORS',
|
|
105
106
|
id: 'publish-runner',
|
|
106
|
-
source: " {\n id: 'publish-runner',\n at: 'node_modules/@prestack/thread/dist/integrity/generators/publish.js',\n describes: 'Sends this repository\\'s packages to a registry. It derives what each package says about itself first, then builds, then refuses to send anything until the gate, the typecheck
|
|
107
|
+
source: " {\n id: 'publish-runner',\n at: 'node_modules/@prestack/thread/dist/integrity/generators/publish.js',\n describes: 'Sends this repository\\'s packages to a registry. It derives what each package says about itself first, then builds, then refuses to send anything until the gate, the typecheck and the seal have each passed, and commits what it derived once the packages are out. The seal is checked rather than regenerated, because a release that rewrites its own seal can never fail it.',\n version: 1,\n by: 'thread publish',\n },",
|
|
107
108
|
},
|
|
108
109
|
];
|
|
109
110
|
export const ATTACH = {
|
|
@@ -115,79 +116,9 @@ export const ATTACH = {
|
|
|
115
116
|
{ file: 'rules.ts', source: RULES_SOURCE },
|
|
116
117
|
{ file: 'gate.ts', source: GATE_SOURCE },
|
|
117
118
|
],
|
|
118
|
-
retires: [
|
|
119
|
-
{
|
|
120
|
-
into: 'gate.ts',
|
|
121
|
-
list: 'declares',
|
|
122
|
-
id: 'compiler',
|
|
123
|
-
why: 'moved into `GENERATORS` beside the generator that writes it, which is what makes `tsconfig.json` settle when declarations move. Left here it would be a second gate step running the same command, which the gate refuses.',
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
into: 'gate.ts',
|
|
127
|
-
list: 'declares',
|
|
128
|
-
id: 'descent',
|
|
129
|
-
why: 'its step now comes from the `descent-runner` row this package ships into `GENERATORS`, which states `runs` beside `by`. Left here it would be a second gate step running the same command, which the gate refuses.',
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
into: 'gate.ts',
|
|
133
|
-
list: 'declares',
|
|
134
|
-
id: 'sweep',
|
|
135
|
-
why: 'its step now comes from the `sweep-runner` row this package ships into `GENERATORS`, which states `runs` beside `by`. Left here it would be a second gate step running the same command, which the gate refuses.',
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
into: 'constraint.ts',
|
|
139
|
-
list: 'GENERATORS',
|
|
140
|
-
id: 'sql-duplicate-id',
|
|
141
|
-
why: 'its check imported a package this framework no longer ships and read a folder no app has, so it could never refuse anything. A rule that cannot fire reads as coverage while enforcing nothing.',
|
|
142
|
-
},
|
|
143
|
-
{
|
|
144
|
-
into: 'constraint.ts',
|
|
145
|
-
list: 'GENERATORS',
|
|
146
|
-
id: 'sql-name-collision',
|
|
147
|
-
why: 'its check imported a package this framework no longer ships and read a folder no app has, so it could never refuse anything. A rule that cannot fire reads as coverage while enforcing nothing.',
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
into: 'constraint.ts',
|
|
151
|
-
list: 'GENERATORS',
|
|
152
|
-
id: 'sql-duplicate-parameter',
|
|
153
|
-
why: 'its check imported a package this framework no longer ships and read a folder no app has, so it could never refuse anything. A rule that cannot fire reads as coverage while enforcing nothing.',
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
into: 'constraint.ts',
|
|
157
|
-
list: 'GENERATORS',
|
|
158
|
-
id: 'sql-unwritable-parameter-type',
|
|
159
|
-
why: 'its check imported a package this framework no longer ships and read a folder no app has, so it could never refuse anything. A rule that cannot fire reads as coverage while enforcing nothing.',
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
into: 'constraint.ts',
|
|
163
|
-
list: 'GENERATORS',
|
|
164
|
-
id: 'sql-duplicate-returned-column',
|
|
165
|
-
why: 'its check imported a package this framework no longer ships and read a folder no app has, so it could never refuse anything. A rule that cannot fire reads as coverage while enforcing nothing.',
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
into: 'constraint.ts',
|
|
169
|
-
list: 'GENERATORS',
|
|
170
|
-
id: 'sql-unwritable-return-type',
|
|
171
|
-
why: 'its check imported a package this framework no longer ships and read a folder no app has, so it could never refuse anything. A rule that cannot fire reads as coverage while enforcing nothing.',
|
|
172
|
-
},
|
|
173
|
-
{
|
|
174
|
-
into: 'constraint.ts',
|
|
175
|
-
list: 'GENERATORS',
|
|
176
|
-
id: 'sql-unknown-write-target',
|
|
177
|
-
why: 'its check imported a package this framework no longer ships and read a folder no app has, so it could never refuse anything. A rule that cannot fire reads as coverage while enforcing nothing.',
|
|
178
|
-
},
|
|
179
|
-
{
|
|
180
|
-
into: 'constraint.ts',
|
|
181
|
-
list: 'GENERATORS',
|
|
182
|
-
id: 'sql-multi-statement',
|
|
183
|
-
why: 'its check imported a package this framework no longer ships and read a folder no app has, so it could never refuse anything. A rule that cannot fire reads as coverage while enforcing nothing.',
|
|
184
|
-
},
|
|
185
|
-
],
|
|
186
119
|
ignores: ['.thread/', '.next/', 'node_modules/', 'tsconfig.tsbuildinfo'],
|
|
187
120
|
scripts: {
|
|
188
121
|
gate: 'thread gate',
|
|
189
|
-
predev: 'thread gate',
|
|
190
|
-
dev: 'next dev',
|
|
191
122
|
prebuild: 'thread gate',
|
|
192
123
|
build: 'next build',
|
|
193
124
|
prestart: 'thread gate',
|
package/dist/integrity/attach.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Attaching } from '../core/attach.ts'
|
|
2
|
-
import {
|
|
2
|
+
import { SHAPED } from '../core/init.ts'
|
|
3
|
+
import { NAMED } from '../core/scope.ts'
|
|
3
4
|
|
|
4
5
|
import { quoted } from '../core/rows.ts'
|
|
5
6
|
|
|
@@ -12,7 +13,7 @@ const CONSTRAINT =
|
|
|
12
13
|
const RULES =
|
|
13
14
|
'What this app refuses on top of what the framework already does. `thread create rule` asks what to ban, where it applies and what to do instead, then writes the row and the check beside it.'
|
|
14
15
|
|
|
15
|
-
const HOME = `node_modules/${
|
|
16
|
+
const HOME = `node_modules/${NAMED}/dist/integrity`
|
|
16
17
|
|
|
17
18
|
const GATE =
|
|
18
19
|
'Every surface that can refuse, each naming where it lives and the command that runs it, so the gate is derived from what this system declares rather than kept as a string beside it.'
|
|
@@ -20,7 +21,7 @@ const GATE =
|
|
|
20
21
|
const COMPILER =
|
|
21
22
|
'The compiler run over the files this app declares and no others. A type error is the plainest kind of broken build, so it is refused here rather than found by whoever runs the app next.'
|
|
22
23
|
|
|
23
|
-
const INTEGRITY_SOURCE = `import type { Threaded } from '
|
|
24
|
+
const INTEGRITY_SOURCE = `import type { Threaded } from '${SHAPED}'
|
|
24
25
|
|
|
25
26
|
export const INTEGRITY: Threaded = {
|
|
26
27
|
id: 'integrity',
|
|
@@ -57,12 +58,12 @@ export const INTEGRITY: Threaded = {
|
|
|
57
58
|
}
|
|
58
59
|
`
|
|
59
60
|
|
|
60
|
-
const RULES_SOURCE = `import type { Constraint } from '
|
|
61
|
+
const RULES_SOURCE = `import type { Constraint } from '${NAMED}/integrity/constraint'
|
|
61
62
|
|
|
62
63
|
export const RULES: readonly Constraint[] = []
|
|
63
64
|
`
|
|
64
65
|
|
|
65
|
-
const GATE_SOURCE = `import type { Threaded } from '
|
|
66
|
+
const GATE_SOURCE = `import type { Threaded } from '${SHAPED}'
|
|
66
67
|
|
|
67
68
|
export const GATE: Threaded = {
|
|
68
69
|
id: 'gate',
|
|
@@ -121,7 +122,7 @@ const SHIPPED: readonly { readonly into: string; readonly list: string; readonly
|
|
|
121
122
|
into: 'derivation.ts',
|
|
122
123
|
list: 'GENERATORS',
|
|
123
124
|
id: 'publish-runner',
|
|
124
|
-
source: " {\n id: 'publish-runner',\n at: 'node_modules/@prestack/thread/dist/integrity/generators/publish.js',\n describes: 'Sends this repository\\'s packages to a registry. It derives what each package says about itself first, then builds, then refuses to send anything until the gate, the typecheck
|
|
125
|
+
source: " {\n id: 'publish-runner',\n at: 'node_modules/@prestack/thread/dist/integrity/generators/publish.js',\n describes: 'Sends this repository\\'s packages to a registry. It derives what each package says about itself first, then builds, then refuses to send anything until the gate, the typecheck and the seal have each passed, and commits what it derived once the packages are out. The seal is checked rather than regenerated, because a release that rewrites its own seal can never fail it.',\n version: 1,\n by: 'thread publish',\n },",
|
|
125
126
|
},
|
|
126
127
|
]
|
|
127
128
|
export const ATTACH: Attaching = {
|
|
@@ -134,80 +135,10 @@ export const ATTACH: Attaching = {
|
|
|
134
135
|
{ file: 'gate.ts', source: GATE_SOURCE },
|
|
135
136
|
],
|
|
136
137
|
|
|
137
|
-
retires: [
|
|
138
|
-
{
|
|
139
|
-
into: 'gate.ts',
|
|
140
|
-
list: 'declares',
|
|
141
|
-
id: 'compiler',
|
|
142
|
-
why: 'moved into `GENERATORS` beside the generator that writes it, which is what makes `tsconfig.json` settle when declarations move. Left here it would be a second gate step running the same command, which the gate refuses.',
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
into: 'gate.ts',
|
|
146
|
-
list: 'declares',
|
|
147
|
-
id: 'descent',
|
|
148
|
-
why: 'its step now comes from the `descent-runner` row this package ships into `GENERATORS`, which states `runs` beside `by`. Left here it would be a second gate step running the same command, which the gate refuses.',
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
into: 'gate.ts',
|
|
152
|
-
list: 'declares',
|
|
153
|
-
id: 'sweep',
|
|
154
|
-
why: 'its step now comes from the `sweep-runner` row this package ships into `GENERATORS`, which states `runs` beside `by`. Left here it would be a second gate step running the same command, which the gate refuses.',
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
into: 'constraint.ts',
|
|
158
|
-
list: 'GENERATORS',
|
|
159
|
-
id: 'sql-duplicate-id',
|
|
160
|
-
why: 'its check imported a package this framework no longer ships and read a folder no app has, so it could never refuse anything. A rule that cannot fire reads as coverage while enforcing nothing.',
|
|
161
|
-
},
|
|
162
|
-
{
|
|
163
|
-
into: 'constraint.ts',
|
|
164
|
-
list: 'GENERATORS',
|
|
165
|
-
id: 'sql-name-collision',
|
|
166
|
-
why: 'its check imported a package this framework no longer ships and read a folder no app has, so it could never refuse anything. A rule that cannot fire reads as coverage while enforcing nothing.',
|
|
167
|
-
},
|
|
168
|
-
{
|
|
169
|
-
into: 'constraint.ts',
|
|
170
|
-
list: 'GENERATORS',
|
|
171
|
-
id: 'sql-duplicate-parameter',
|
|
172
|
-
why: 'its check imported a package this framework no longer ships and read a folder no app has, so it could never refuse anything. A rule that cannot fire reads as coverage while enforcing nothing.',
|
|
173
|
-
},
|
|
174
|
-
{
|
|
175
|
-
into: 'constraint.ts',
|
|
176
|
-
list: 'GENERATORS',
|
|
177
|
-
id: 'sql-unwritable-parameter-type',
|
|
178
|
-
why: 'its check imported a package this framework no longer ships and read a folder no app has, so it could never refuse anything. A rule that cannot fire reads as coverage while enforcing nothing.',
|
|
179
|
-
},
|
|
180
|
-
{
|
|
181
|
-
into: 'constraint.ts',
|
|
182
|
-
list: 'GENERATORS',
|
|
183
|
-
id: 'sql-duplicate-returned-column',
|
|
184
|
-
why: 'its check imported a package this framework no longer ships and read a folder no app has, so it could never refuse anything. A rule that cannot fire reads as coverage while enforcing nothing.',
|
|
185
|
-
},
|
|
186
|
-
{
|
|
187
|
-
into: 'constraint.ts',
|
|
188
|
-
list: 'GENERATORS',
|
|
189
|
-
id: 'sql-unwritable-return-type',
|
|
190
|
-
why: 'its check imported a package this framework no longer ships and read a folder no app has, so it could never refuse anything. A rule that cannot fire reads as coverage while enforcing nothing.',
|
|
191
|
-
},
|
|
192
|
-
{
|
|
193
|
-
into: 'constraint.ts',
|
|
194
|
-
list: 'GENERATORS',
|
|
195
|
-
id: 'sql-unknown-write-target',
|
|
196
|
-
why: 'its check imported a package this framework no longer ships and read a folder no app has, so it could never refuse anything. A rule that cannot fire reads as coverage while enforcing nothing.',
|
|
197
|
-
},
|
|
198
|
-
{
|
|
199
|
-
into: 'constraint.ts',
|
|
200
|
-
list: 'GENERATORS',
|
|
201
|
-
id: 'sql-multi-statement',
|
|
202
|
-
why: 'its check imported a package this framework no longer ships and read a folder no app has, so it could never refuse anything. A rule that cannot fire reads as coverage while enforcing nothing.',
|
|
203
|
-
},
|
|
204
|
-
],
|
|
205
138
|
|
|
206
139
|
ignores: ['.thread/', '.next/', 'node_modules/', 'tsconfig.tsbuildinfo'],
|
|
207
140
|
scripts: {
|
|
208
141
|
gate: 'thread gate',
|
|
209
|
-
predev: 'thread gate',
|
|
210
|
-
dev: 'next dev',
|
|
211
142
|
prebuild: 'thread gate',
|
|
212
143
|
build: 'next build',
|
|
213
144
|
prestart: 'thread gate',
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { readdirSync } from
|
|
1
|
+
import { readdirSync } from '../integrations/disk.js';
|
|
2
2
|
import { dirname, join } from 'node:path';
|
|
3
3
|
import { argv, stdout } from 'node:process';
|
|
4
|
-
import { exit, invoked } from
|
|
5
|
-
import { ROOT, THREAD_AT, TREE, configured, descend, unkept } from
|
|
6
|
-
import { runChecker } from
|
|
4
|
+
import { exit, invoked } from '../core/invoked.js';
|
|
5
|
+
import { ROOT, THREAD_AT, TREE, configured, descend, unkept } from '../core/descend.js';
|
|
6
|
+
import { runChecker } from '../core/finding.js';
|
|
7
7
|
export { ROOT, THREAD_AT, TREE, descend };
|
|
8
8
|
const ELSEWHERE = new Set(['node_modules', '.git']);
|
|
9
9
|
export function trackedFiles() {
|
|
@@ -121,7 +121,7 @@ if (invoked(import.meta.url)) {
|
|
|
121
121
|
stdout.write(`threads: ${String(warned.length)} of these is a derivation nothing has produced yet — the row states what a ` +
|
|
122
122
|
'generator would write and no file is there. A generator that refuses to write an empty file is doing its ' +
|
|
123
123
|
'job, so this is said rather than refused. A derived file that is there and differs from what its generator ' +
|
|
124
|
-
'writes is the other case, and
|
|
124
|
+
'writes is the other case, and the command its row names in `runs` refuses it at the gate.\n');
|
|
125
125
|
}
|
|
126
126
|
if (refused.length > 0)
|
|
127
127
|
exit(1);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { readdirSync } from '../
|
|
1
|
+
import { readdirSync } from '../integrations/disk.ts'
|
|
2
2
|
import { dirname, join } from 'node:path'
|
|
3
3
|
import { argv, stdout } from 'node:process'
|
|
4
4
|
|
|
@@ -157,7 +157,7 @@ if (invoked(import.meta.url)) {
|
|
|
157
157
|
`threads: ${String(warned.length)} of these is a derivation nothing has produced yet — the row states what a ` +
|
|
158
158
|
'generator would write and no file is there. A generator that refuses to write an empty file is doing its ' +
|
|
159
159
|
'job, so this is said rather than refused. A derived file that is there and differs from what its generator ' +
|
|
160
|
-
'writes is the other case, and
|
|
160
|
+
'writes is the other case, and the command its row names in `runs` refuses it at the gate.\n',
|
|
161
161
|
)
|
|
162
162
|
}
|
|
163
163
|
|