@prestack/thread 0.1.21 → 0.1.22

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.
Files changed (137) hide show
  1. package/CHANGELOG.md +109 -0
  2. package/dist/core/attach.js +21 -0
  3. package/dist/core/descend.js +6 -3
  4. package/dist/core/generators/commit.js +55 -3
  5. package/dist/core/generators/dev.d.ts +1 -0
  6. package/dist/core/generators/dev.js +68 -0
  7. package/dist/core/tree.d.ts +1 -0
  8. package/dist/core/tree.js +7 -1
  9. package/dist/derivation/generators/build.d.ts +3 -1
  10. package/dist/derivation/generators/build.js +103 -22
  11. package/dist/derivation/generators/release.js +74 -26
  12. package/dist/derivation/release.js +3 -3
  13. package/dist/integrations/cli.js +69 -10
  14. package/dist/integrations/pglite.js +13 -3
  15. package/dist/integrations/target.d.ts +3 -0
  16. package/dist/integrity/attach.js +1 -5
  17. package/dist/integrity/slopnators/sl_stale_path.js +10 -0
  18. package/dist/operations/access.js +3 -2
  19. package/dist/operations/capabilities.d.ts +2 -0
  20. package/dist/operations/capabilities.js +2 -0
  21. package/dist/operations/generators/capability.js +234 -24
  22. package/dist/operations/generators/compile.js +150 -50
  23. package/dist/operations/generators/seed.d.ts +3 -0
  24. package/dist/operations/generators/seed.js +25 -3
  25. package/dist/operations/nodes.d.ts +2 -2
  26. package/package.json +1 -1
  27. package/dist/core/actor.ts +0 -21
  28. package/dist/core/attach.ts +0 -613
  29. package/dist/core/chain.ts +0 -145
  30. package/dist/core/condition.ts +0 -227
  31. package/dist/core/descend.ts +0 -1185
  32. package/dist/core/errors/catalogue.ts +0 -314
  33. package/dist/core/errors/classes.ts +0 -51
  34. package/dist/core/errors/error.ts +0 -152
  35. package/dist/core/errors/namespaces.ts +0 -19
  36. package/dist/core/finding.ts +0 -37
  37. package/dist/core/generators/commit.ts +0 -157
  38. package/dist/core/init.ts +0 -222
  39. package/dist/core/invoked.ts +0 -52
  40. package/dist/core/round.ts +0 -74
  41. package/dist/core/rows.ts +0 -506
  42. package/dist/core/scope.ts +0 -20
  43. package/dist/core/thread.ts +0 -29
  44. package/dist/core/tree.ts +0 -90
  45. package/dist/core/types.ts +0 -351
  46. package/dist/derivation/attach.ts +0 -57
  47. package/dist/derivation/generators/build.ts +0 -371
  48. package/dist/derivation/generators/check.ts +0 -118
  49. package/dist/derivation/generators/determinism.ts +0 -145
  50. package/dist/derivation/generators/release.ts +0 -236
  51. package/dist/derivation/release.ts +0 -43
  52. package/dist/integrations/attach.ts +0 -187
  53. package/dist/integrations/cli.ts +0 -606
  54. package/dist/integrations/declared.ts +0 -34
  55. package/dist/integrations/disk.ts +0 -466
  56. package/dist/integrations/generators/read.ts +0 -127
  57. package/dist/integrations/generators/vault.ts +0 -210
  58. package/dist/integrations/https.ts +0 -216
  59. package/dist/integrations/pglite.ts +0 -206
  60. package/dist/integrations/secret.ts +0 -54
  61. package/dist/integrations/target.ts +0 -672
  62. package/dist/integrations/vault.ts +0 -148
  63. package/dist/integrity/attach.ts +0 -150
  64. package/dist/integrity/check-threads.ts +0 -166
  65. package/dist/integrity/constraint.ts +0 -1246
  66. package/dist/integrity/generators/compiler.ts +0 -138
  67. package/dist/integrity/generators/gate.ts +0 -227
  68. package/dist/integrity/generators/issues.ts +0 -160
  69. package/dist/integrity/generators/publish.ts +0 -233
  70. package/dist/integrity/generators/trial.ts +0 -359
  71. package/dist/integrity/lint.ts +0 -214
  72. package/dist/integrity/lsp/bin.ts +0 -44
  73. package/dist/integrity/lsp/diagnostics.ts +0 -92
  74. package/dist/integrity/lsp/findings.ts +0 -63
  75. package/dist/integrity/lsp/lint.ts +0 -124
  76. package/dist/integrity/lsp/protocol.ts +0 -78
  77. package/dist/integrity/lsp/server.ts +0 -224
  78. package/dist/integrity/slopnator.ts +0 -324
  79. package/dist/integrity/slopnators/sl_broken_lineage.ts +0 -38
  80. package/dist/integrity/slopnators/sl_declared_elsewhere.ts +0 -60
  81. package/dist/integrity/slopnators/sl_derived_drift.ts +0 -101
  82. package/dist/integrity/slopnators/sl_door_in_a_node.ts +0 -250
  83. package/dist/integrity/slopnators/sl_hardcoded_style.ts +0 -55
  84. package/dist/integrity/slopnators/sl_inert_island.ts +0 -84
  85. package/dist/integrity/slopnators/sl_inert_slopnator.ts +0 -93
  86. package/dist/integrity/slopnators/sl_missing_row.ts +0 -140
  87. package/dist/integrity/slopnators/sl_no_barrel.ts +0 -48
  88. package/dist/integrity/slopnators/sl_no_child_process.ts +0 -100
  89. package/dist/integrity/slopnators/sl_no_comment.ts +0 -43
  90. package/dist/integrity/slopnators/sl_no_dispatch_bypass.ts +0 -276
  91. package/dist/integrity/slopnators/sl_no_import_cycle.ts +0 -66
  92. package/dist/integrity/slopnators/sl_no_such_command.ts +0 -81
  93. package/dist/integrity/slopnators/sl_only_takes_a_literal.ts +0 -63
  94. package/dist/integrity/slopnators/sl_outside_an_operation.ts +0 -25
  95. package/dist/integrity/slopnators/sl_screen_holds_only_declared.ts +0 -70
  96. package/dist/integrity/slopnators/sl_secret_literal.ts +0 -68
  97. package/dist/integrity/slopnators/sl_stale_path.ts +0 -178
  98. package/dist/integrity/slopnators/sl_twice_meant.ts +0 -57
  99. package/dist/integrity/slopnators/sl_twice_parented.ts +0 -82
  100. package/dist/integrity/slopnators/sl_undeclared_crossing.ts +0 -481
  101. package/dist/integrity/slopnators/sl_undeclared_destination.ts +0 -113
  102. package/dist/integrity/slopnators/sl_undeclared_element.ts +0 -44
  103. package/dist/integrity/slopnators/sl_undeclared_list.ts +0 -358
  104. package/dist/integrity/slopnators/sl_undeclared_node.ts +0 -75
  105. package/dist/integrity/slopnators/sl_undeclared_operation.ts +0 -257
  106. package/dist/integrity/slopnators/sl_undeclared_variant.ts +0 -152
  107. package/dist/integrity/slopnators/sl_undeclared_webhook.ts +0 -108
  108. package/dist/integrity/slopnators/sl_underived_route.ts +0 -72
  109. package/dist/integrity/slopnators/sl_undescribed.ts +0 -65
  110. package/dist/integrity/slopnators/sl_ungoverned_island.ts +0 -60
  111. package/dist/integrity/slopnators/sl_unlisted_program.ts +0 -46
  112. package/dist/integrity/slopnators/sl_unnamed_island.ts +0 -41
  113. package/dist/integrity/slopnators/sl_unpaired_member.ts +0 -139
  114. package/dist/integrity/slopnators/sl_unpaired_slopnator.ts +0 -71
  115. package/dist/integrity/slopnators/sl_unprefixed_member.ts +0 -110
  116. package/dist/integrity/slopnators/sl_unthreaded.ts +0 -421
  117. package/dist/integrity/slopnators/sl_untranslated_key.ts +0 -140
  118. package/dist/integrity/slopnators/sl_unvaulted_secret.ts +0 -132
  119. package/dist/integrity/slopnators/sl_unversioned.ts +0 -52
  120. package/dist/integrity/sweep.ts +0 -395
  121. package/dist/knowledge/attach.ts +0 -327
  122. package/dist/knowledge/generators/docsgen.ts +0 -186
  123. package/dist/knowledge/generators/glossary.ts +0 -73
  124. package/dist/knowledge/glossary.ts +0 -6
  125. package/dist/operations/access.ts +0 -131
  126. package/dist/operations/attach.ts +0 -408
  127. package/dist/operations/capabilities.ts +0 -88
  128. package/dist/operations/dispatch.ts +0 -294
  129. package/dist/operations/error-results.ts +0 -31
  130. package/dist/operations/generators/capability.ts +0 -1054
  131. package/dist/operations/generators/compile.ts +0 -701
  132. package/dist/operations/generators/permits.ts +0 -229
  133. package/dist/operations/generators/seed.ts +0 -359
  134. package/dist/operations/generators/trial.ts +0 -666
  135. package/dist/operations/nodes.ts +0 -53
  136. package/dist/operations/operations.ts +0 -91
  137. package/dist/operations/result.ts +0 -28
@@ -1,139 +0,0 @@
1
- import { existsSync, readFileSync, readdirSync } from '../../integrations/disk.ts'
2
- import { resolve } from 'node:path'
3
-
4
- import type { Sourced } from '../constraint.ts'
5
- import type { Slopnator } from '../slopnator.ts'
6
- import { foldersGoverned, here, islandsDeclared, rowsIn, type Declared } from './sl_unthreaded.ts'
7
- import { findTree } from '../../core/tree.ts'
8
-
9
- const ROOT = findTree().at
10
- const TREE = `${findTree().name}/`
11
-
12
- interface Seeding {
13
- readonly island: string
14
- readonly folder: string
15
- readonly tree: string
16
- readonly member: string
17
- }
18
-
19
- const seeding = (one: Declared): Seeding | undefined => {
20
- const folder = foldersGoverned(one.governs)[0]
21
- if (folder === undefined || one.tree === undefined || one.member === undefined) return undefined
22
- return { island: one.id, folder, tree: one.tree, member: one.member }
23
- }
24
-
25
- const islandsSeeding = (): readonly Seeding[] =>
26
- islandsDeclared().flatMap((one) => {
27
- const held = seeding(one)
28
- return held === undefined ? [] : [held]
29
- })
30
-
31
- const declares = (island: string): RegExp => new RegExp(`^export const ${island.toUpperCase()}\\b`, 'm')
32
-
33
- const exports = (member: string): RegExp => new RegExp(`^export const ${member}\\b`, 'm')
34
-
35
- function seededNames(text: string): readonly string[] {
36
- const found: string[] = []
37
- for (const row of rowsIn(text)) {
38
- if (row.list !== undefined || row.id === undefined) continue
39
- found.push(`${row.id}.ts`)
40
- }
41
- return found
42
- }
43
-
44
- function onDisk(folder: string): readonly string[] {
45
- const dir = resolve(ROOT, folder)
46
- if (!existsSync(dir)) return []
47
- try {
48
- return readdirSync(dir).filter((name) => name.endsWith('.ts'))
49
- } catch {
50
- return []
51
- }
52
- }
53
-
54
- function declaredNames(one: Seeding): readonly string[] {
55
- const path = resolve(ROOT, one.tree)
56
- if (!existsSync(path)) return []
57
- try {
58
- return seededNames(readFileSync(path, 'utf8'))
59
- } catch {
60
- return []
61
- }
62
- }
63
-
64
- const ISLAND: readonly Sourced[] = [
65
- {
66
- at: 'threads/thread.ts',
67
- source:
68
- "export const THREAD: Threaded = {\n declares: [\n { id: 'operations', at: 'src/islands/operations.ts', governs: ['operations/'] },\n { id: 'operation', at: 'threads/operations.ts' },\n ],\n}\n",
69
- },
70
- { at: 'src/islands/operations.ts', source: 'export const OperationsIslandSchema = {}\n' },
71
- ]
72
-
73
- export const slopnator: Slopnator = {
74
- holds: (_node, at) => {
75
- const path = here(at.filename)
76
-
77
- for (const one of islandsSeeding()) {
78
- if (path.startsWith(TREE)) {
79
- if (!declares(one.island).test(at.text)) continue
80
-
81
- let wanted: readonly string[]
82
- try {
83
- wanted = seededNames(at.text)
84
- } catch {
85
- return 'this file cannot be parsed, so the members it declares were never read and no file was measured against them'
86
- }
87
-
88
- const found = onDisk(one.folder)
89
- for (const name of wanted) {
90
- if (found.includes(name)) continue
91
- return `a row here declares ${one.member} \`${name.replace(/\.ts$/, '')}\` and ${one.folder}${name} is not on disk, so the row brings nothing into existence — run \`pnpm member:seed\``
92
- }
93
-
94
- return false
95
- }
96
-
97
- if (!path.startsWith(one.folder)) continue
98
- const name = path.slice(one.folder.length)
99
- if (!name.endsWith('.ts') || name.includes('/')) continue
100
-
101
- if (!declaredNames(one).includes(name)) {
102
- return `${one.folder} holds ${one.member} \`${name.replace(/\.ts$/, '')}\` and no row in ${one.tree} declares it, so it can act while nothing brought it into existence — declare the row first and let \`pnpm member:seed\` write the file, or delete it`
103
- }
104
-
105
- if (!exports(one.member).test(at.text)) {
106
- return `${name} is declared and exports no \`${one.member}\`, so the row and the file both exist and the ${one.member} still loads as nothing — write it into the template the seeder left`
107
- }
108
-
109
- return false
110
- }
111
-
112
- return false
113
- },
114
- proves: {
115
- wrong: [
116
- {
117
- files: [
118
- ...ISLAND,
119
- { at: 'threads/_member_probe.ts', source: "export const OPERATIONS: readonly Threaded[] = [\n {\n id: 'wf_unseeded_probe',\n },\n]\n" },
120
- ],
121
- at: 'threads/_member_probe.ts',
122
- },
123
- {
124
- files: [...ISLAND, { at: 'operations/wf_undeclared_probe.ts', source: 'export const operation = { id: 1 }\n' }],
125
- at: 'operations/wf_undeclared_probe.ts',
126
- },
127
- ],
128
- right: [
129
- {
130
- files: [...ISLAND, { at: 'threads/_member_probe.ts', source: 'export const OPERATIONS: readonly Threaded[] = []\n' }],
131
- at: 'threads/_member_probe.ts',
132
- },
133
- {
134
- files: [...ISLAND, { at: 'threads/_member_quiet.ts', source: 'export const NOTHING = []\n' }],
135
- at: 'threads/_member_quiet.ts',
136
- },
137
- ],
138
- },
139
- }
@@ -1,71 +0,0 @@
1
- import { existsSync, readFileSync } from '../../integrations/disk.ts'
2
- import { join, resolve } from 'node:path'
3
-
4
- import { SEEDED, SHIPPED, slopnatorName, type Slopnator } from '../slopnator.ts'
5
- import { here } from './sl_unthreaded.ts'
6
- import { findTree } from '../../core/tree.ts'
7
-
8
- const ROOT = findTree().at
9
- const TREE = `${findTree().name}/`
10
- const ID = /^ {4}id:\s*'([^']+)'/gm
11
- const DECLARES = /^(?:export )?const (CONSTRAINTS|RULES)\b/m
12
-
13
- const idsIn = (text: string): readonly string[] => [...text.matchAll(ID)].map((one) => one[1] ?? '')
14
-
15
- export const slopnator: Slopnator = {
16
- holds: (_node, at) => {
17
- const path = here(at.filename)
18
-
19
- if (path.startsWith(TREE) && DECLARES.test(at.text)) {
20
- for (const id of idsIn(at.text)) {
21
- const name = `${slopnatorName(id)}.ts`
22
- if ([SHIPPED, resolve(ROOT, SEEDED)].some((dir) => existsSync(join(dir, name)))) continue
23
- return `"${id}" names "${slopnatorName(id)}", and no such file is in ${SEEDED}/ or shipped with the package — one that cannot run registers, reports nothing, and is indistinguishable from one being obeyed. Seed it`
24
- }
25
- return false
26
- }
27
-
28
- const home = [SEEDED].find((dir) => path.startsWith(`${dir}/`))
29
- if (home === undefined) return false
30
- const file = path.slice(home.length + 1)
31
- if (!file.startsWith('sl_') || !file.endsWith('.ts')) return false
32
-
33
- const declared = [join(SHIPPED, '..', 'constraint.ts'), resolve(ROOT, `${TREE}rules.ts`)]
34
- .map((one) => { try { return readFileSync(one, 'utf8') } catch { return '' } })
35
- .join('\n')
36
- const named = new Set(idsIn(declared).map((id) => slopnatorName(id)))
37
- if (named.has(file.replace(/\.ts$/, ''))) return false
38
- return `${path} is named by no law, so it governs nothing while looking like enforcement to anybody reading the directory — delete it, or declare the law that needs it. A law renamed makes this a \`git mv\`, not a second file`
39
- },
40
- proves: {
41
- wrong: [
42
- "const CONSTRAINTS = [\n {\n id: 'nothing-names-this-slopnator',\n },\n]",
43
- {
44
- files: [{ at: 'threads/slopnators/sl_no_law_names_this.ts', source: "export const slopnator = { on: [], holds: () => false }\n" }],
45
- at: 'threads/slopnators/sl_no_law_names_this.ts',
46
- },
47
- ],
48
- right: [
49
- {
50
- files: [
51
- { at: 'threads/_probe_paired.ts', source: "const CONSTRAINTS = [\n {\n id: 'no-comment',\n },\n]\n" },
52
- { at: 'threads/slopnators/sl_no_comment.ts', source: 'export const slopnator = { on: [], holds: () => false }\n' },
53
- ],
54
- at: 'threads/_probe_paired.ts',
55
- },
56
- {
57
- files: [
58
- { at: 'threads/_probe_paired.ts', source: "const CONSTRAINTS = [\n {\n id: 'no-comment',\n },\n {\n id: 'unthreaded',\n },\n]\n" },
59
- { at: 'threads/slopnators/sl_no_comment.ts', source: 'export const slopnator = { on: [], holds: () => false }\n' },
60
- { at: 'threads/slopnators/sl_unthreaded.ts', source: 'export const slopnator = { on: [], holds: () => false }\n' },
61
- ],
62
- at: 'threads/_probe_paired.ts',
63
- },
64
- 'export const PLAIN = 1',
65
- {
66
- files: [{ at: 'threads/slopnators/not_a_walk.ts', source: 'export const HELPER = 1\n' }],
67
- at: 'threads/slopnators/not_a_walk.ts',
68
- },
69
- ],
70
- },
71
- }
@@ -1,110 +0,0 @@
1
- import { inCode, listBounds, matched } from '../../core/rows.ts'
2
- import { PREFIXES } from '../../core/thread.ts'
3
-
4
- import type { Slopnator } from '../slopnator.ts'
5
- import { here, parses, unreadable } from './sl_unthreaded.ts'
6
-
7
- const MEMBERS = 'MEMBERS'
8
-
9
- const TAKES: Readonly<Record<string, readonly string[]>> = {
10
- 'operations.ts': Object.values(PREFIXES),
11
- 'nodes.ts': ['nd_'],
12
- }
13
-
14
- const ID = /\bid:\s*'((?:[^'\\]|\\.)*)'/
15
-
16
- function directly(text: string, open: number, close: number): readonly string[] {
17
- const code = inCode(text)
18
- const found: string[] = []
19
- for (let at = open; at < close; at += 1) {
20
- if (code[at] !== true || text[at] !== '{') continue
21
- const ends = matched(text, code, at, '{', '}')
22
- if (ends === -1 || ends > close) break
23
- const said = ID.exec(text.slice(at, ends))?.[1]
24
- if (said !== undefined) found.push(said)
25
- at = ends
26
- }
27
- return found
28
- }
29
-
30
- export const slopnator: Slopnator = {
31
- holds: (_node, at) => {
32
- const path = here(at.filename)
33
- if (unreadable(path, at.text) !== undefined) return false
34
- if (!parses(path)) return false
35
-
36
- const takes = TAKES[path.slice(path.lastIndexOf('/') + 1)]
37
- if (takes === undefined) return false
38
-
39
- const text = String(at.text)
40
- const where = listBounds(text, MEMBERS)
41
- if (where === undefined) return false
42
-
43
- for (const said of directly(text, where.open, where.close)) {
44
- if (takes.some((one) => said.startsWith(one))) continue
45
- return (
46
- `\`${said}\` sits in \`${MEMBERS}\` here, and this list takes ${takes.map((one) => `\`${one}\``).join(', ')}. ` +
47
- 'A prefix is what says which of the two a row is, and a row wearing the wrong one is declared as ' +
48
- 'something it is not, seeds a body of the wrong shape, and is read as agreed by everything downstream'
49
- )
50
- }
51
-
52
- return false
53
- },
54
- proves: {
55
- wrong: [
56
- {
57
- files: [
58
- {
59
- at: '_threads/operations.ts',
60
- source:
61
- "import type { Member, Threaded } from '../../core/thread.ts'\n\nexport const OPERATIONS: Threaded = {\n id: 'operations',\n at: '_threads/operations.ts',\n describes: 'what an app can be asked to do',\n version: 1,\n}\n\nexport const MEMBERS: readonly Member[] = [\n {\n id: 'nd_teleport',\n at: '_threads/operations.ts',\n describes: 'a node wearing an operation list',\n version: 1,\n },\n]\n",
62
- },
63
- ],
64
- at: '_threads/operations.ts',
65
- },
66
- {
67
- files: [
68
- {
69
- at: '_threads/nodes.ts',
70
- source:
71
- "import type { Member, Threaded } from '../../core/thread.ts'\n\nexport const NODES: Threaded = {\n id: 'nodes',\n at: '_threads/nodes.ts',\n describes: 'the spans an operation is built from',\n version: 1,\n}\n\nexport const MEMBERS: readonly Member[] = [\n {\n id: 'wf_send_invoice',\n at: '_threads/nodes.ts',\n describes: 'an operation wearing a node list',\n version: 1,\n },\n]\n",
72
- },
73
- ],
74
- at: '_threads/nodes.ts',
75
- },
76
- {
77
- files: [
78
- {
79
- at: '_threads/operations.ts',
80
- source:
81
- "import type { Member, Threaded } from '../../core/thread.ts'\n\nexport const OPERATIONS: Threaded = {\n id: 'operations',\n at: '_threads/operations.ts',\n describes: 'what an app can be asked to do',\n version: 1,\n}\n\nexport const MEMBERS: readonly Member[] = [\n {\n id: 'sendInvoice',\n at: '_threads/operations.ts',\n describes: 'no prefix at all',\n version: 1,\n },\n]\n",
82
- },
83
- ],
84
- at: '_threads/operations.ts',
85
- },
86
- ],
87
- right: [
88
- {
89
- files: [
90
- {
91
- at: '_threads/operations.ts',
92
- source:
93
- "import type { Member, Threaded } from '../../core/thread.ts'\n\nexport const OPERATIONS: Threaded = {\n id: 'operations',\n at: '_threads/operations.ts',\n describes: 'what an app can be asked to do',\n version: 1,\n}\n\nexport const MEMBERS: readonly Member[] = [\n {\n id: 'wf_prestack_client',\n at: '_threads/operations.ts',\n describes: 'sends what you typed to the agent',\n version: 1,\n seeds: [\n {\n id: 'wf_prestack_client_body',\n at: 'operations/wf_prestack_client.ts',\n describes: 'the operation itself',\n },\n ],\n },\n]\n",
94
- },
95
- ],
96
- at: '_threads/operations.ts',
97
- },
98
- {
99
- files: [
100
- {
101
- at: '_threads/nodes.ts',
102
- source:
103
- "import type { Member, Threaded } from '../../core/thread.ts'\n\nexport const NODES: Threaded = {\n id: 'nodes',\n at: '_threads/nodes.ts',\n describes: 'the spans an operation is built from',\n version: 1,\n}\n\nexport const MEMBERS: readonly Member[] = [\n {\n id: 'nd_teleport',\n at: '_threads/nodes.ts',\n describes: 'a step this app added',\n version: 1,\n },\n]\n",
104
- },
105
- ],
106
- at: '_threads/nodes.ts',
107
- },
108
- ],
109
- },
110
- }