@volter/twin-standard 1.0.156 → 1.0.157

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/dist/src/cli.js CHANGED
@@ -113,7 +113,7 @@ else if (command === 'grade') {
113
113
  else if (command === 'create') {
114
114
  if (args.includes('--init') && !args.includes('--package'))
115
115
  throw new Error('Name your scoped package with --package');
116
- await (await import("./create-pack.js")).createPack(args);
116
+ await (await import('./create-pack.js')).createPack(args);
117
117
  }
118
118
  else if (command === 'prepare-consumer') {
119
119
  if (!args[0])
@@ -128,7 +128,7 @@ else if (command === 'prepare-consumer') {
128
128
  const out = resolve(value('--out'));
129
129
  if (existsSync(out))
130
130
  throw new Error('Prepared consumer output already exists');
131
- const { prepareConsumerApp } = await import("./consumer.js");
131
+ const { prepareConsumerApp } = await import('./consumer.js');
132
132
  const candidateAt = args.indexOf('--candidate');
133
133
  const artifact = candidateAt >= 0 ? resolve(value('--candidate')) : undefined;
134
134
  const fixture = prepareConsumerApp(resolve(args[0]), appDir, { cli, artifact });
@@ -146,7 +146,7 @@ else if (command === 'walk-consumer') {
146
146
  if (outputAt >= 0 && !args[outputAt + 1])
147
147
  usage();
148
148
  const consumer = JSON.parse(readFileSync(resolve(args[at + 1]), 'utf8'));
149
- const { runConsumerWorkflow } = await import("./consumer.js");
149
+ const { runConsumerWorkflow } = await import('./consumer.js');
150
150
  const report = await runConsumerWorkflow(resolve(args[0]), consumer);
151
151
  const text = `${JSON.stringify(report, null, 2)}\n`;
152
152
  if (outputAt >= 0) {
@@ -160,7 +160,7 @@ else if (command === 'walk-consumer') {
160
160
  else if (command === 'assess') {
161
161
  if (!args[0])
162
162
  usage();
163
- const { assessPack } = await import("./assessment.js");
163
+ const { assessPack } = await import('./assessment.js');
164
164
  const consumerAt = args.indexOf('--prepared-consumer');
165
165
  if (consumerAt >= 0 && !args[consumerAt + 1])
166
166
  usage();
@@ -180,7 +180,7 @@ else if (command === 'assess') {
180
180
  else if (command === 'facts') {
181
181
  if (!args[0])
182
182
  usage();
183
- const { compilePackFacts, renderPackFacts } = await import("./pack-facts.js");
183
+ const { compilePackFacts, renderPackFacts } = await import('./pack-facts.js');
184
184
  const { mkdirSync, writeFileSync } = await import('node:fs');
185
185
  const { join, dirname } = await import('node:path');
186
186
  const dir = resolve(args[0]);
@@ -203,25 +203,25 @@ else if (command === 'walk' || command === 'examples' || command === 'coverage'
203
203
  usage();
204
204
  const tool = { walk: 'score-pack', examples: 'vendor-examples', coverage: 'life-coverage', 'judge-brief': 'judge-brief' }[command];
205
205
  process.argv = [process.argv[0], process.argv[1], ...args];
206
- await import(__rewriteRelativeImportExtension((await import('./tools/packs-root.ts')).toolPath(tool)));
206
+ await import(__rewriteRelativeImportExtension((await import('./tools/packs-root.js')).toolPath(tool)));
207
207
  }
208
208
  else if (command === 'derive') {
209
209
  if (!args[0])
210
210
  usage();
211
211
  // the derivation is a script over process.argv: it reads the unit from its first argument
212
212
  process.argv = [process.argv[0], process.argv[1], ...args];
213
- await import('./derive.ts');
213
+ await import('./derive.js');
214
214
  }
215
215
  else if (command === 'check-sources') {
216
216
  if (!args[0])
217
217
  usage();
218
- await (await import('./check-sources.ts')).checkSources(args);
218
+ await (await import('./check-sources.js')).checkSources(args);
219
219
  }
220
220
  else if (command === 'read-page') {
221
221
  // a documentation page's text, read as the citation check reads it: where an author finds the vendor's examples and words
222
222
  if (!args[0])
223
223
  usage();
224
- const { status, readable, raw, error } = await (await import('./check-sources.ts')).readPage(args[0]);
224
+ const { status, readable, raw, error } = await (await import('./check-sources.js')).readPage(args[0]);
225
225
  if (status !== 200) {
226
226
  console.error(`read-page: ${args[0]} answered ${status || 'nothing'}${error ? `: ${error}` : ''}`);
227
227
  process.exit(1);
@@ -241,8 +241,8 @@ else if (command === 'conform') {
241
241
  // `.tgz` the tarball `npm pack` makes of one, the bytes a publish would send
242
242
  const published = target.endsWith('.tgz') || (!existsSync(target) && /^@?[^@]+@[^@]+$/.test(target));
243
243
  const results = published
244
- ? await (await import('./published.ts')).conformPublished(target, at >= 0 ? { registry: args[at + 1] } : {})
245
- : await (await import('./conformance.ts')).conformance(target, { onCheck: (id) => console.error(` … ${id} (${new Date().toISOString().slice(11, 19)})`) });
244
+ ? await (await import('./published.js')).conformPublished(target, at >= 0 ? { registry: args[at + 1] } : {})
245
+ : await (await import('./conformance.js')).conformance(target, { onCheck: (id) => console.error(` … ${id} (${new Date().toISOString().slice(11, 19)})`) });
246
246
  for (const r of results) {
247
247
  console.log(`${r.failures.length ? '✗' : '✓'} ${r.id.padEnd(15)} ${r.asks}${r.note ? ` (${r.note})` : ''}`);
248
248
  for (const f of r.failures)
@@ -611,8 +611,8 @@ async function lifeServed(pack) {
611
611
  }, server.managedDatabaseUrl ? { managedDatabaseUrl: server.managedDatabaseUrl } : {}),
612
612
  // a socket opened as an application opens it: a WebSocket to the served port, the vendor's host in its Host header
613
613
  socket: (url, headers) => new WebSocket(`ws://127.0.0.1:${port}${url}`, { headers }),
614
- // a line connection opened as an application's client opens it: TCP to the protocol listener (the primary port)
615
- stream: lineConnection(server.port),
614
+ // TCP to the native wire: a separate listener beside HTTP, or the primary protocol port.
615
+ stream: lineConnection(server.wirePort ?? server.port),
616
616
  // bounded: Bun's server.stop(true) never settles once a WebSocket peer has closed under it (discord's life, Bun
617
617
  // 1.3.11: the walk ended and the stop spun at full CPU for 45 minutes), so the check waits 5 s and goes on
618
618
  stop: async () => { await within(5000, Promise.resolve(server.stop())); },
@@ -1,6 +1,7 @@
1
1
  export type ServedPack = {
2
2
  port: number;
3
3
  inspectPort?: number;
4
+ wirePort?: number;
4
5
  stop: () => void | Promise<void>;
5
6
  managedDatabaseUrl?: () => Promise<string>;
6
7
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volter/twin-standard",
3
- "version": "1.0.156",
3
+ "version": "1.0.157",
4
4
  "description": "The Protocol 3 standard for Volter twin packs: the criteria a pack is graded by, the grader, the gate a pack repository and the twin catalog run on every change and submission, and the spec derivation the grade checks against. Pin a version: every place a pack is judged judges by that standard.",
5
5
  "keywords": [
6
6
  "twin",
package/src/cli.ts CHANGED
@@ -78,7 +78,7 @@ if (command === '--version') {
78
78
  });
79
79
  } else if (command === 'create') {
80
80
  if (args.includes('--init') && !args.includes('--package')) throw new Error('Name your scoped package with --package');
81
- await (await import('./create-pack.ts')).createPack(args);
81
+ await (await import('./create-pack.js')).createPack(args);
82
82
  } else if (command === 'prepare-consumer') {
83
83
  if (!args[0]) usage();
84
84
  const value = (name: string) => { const at = args.indexOf(name); if (at < 0 || !args[at + 1]) usage(); return args[at + 1]!; };
@@ -88,7 +88,7 @@ if (command === '--version') {
88
88
  if (!/^sha512-[A-Za-z0-9+/]{86}==$/.test(artifactIntegrity)) throw new Error('Consumer preparation requires candidate SHA-512 integrity');
89
89
  const out = resolve(value('--out'));
90
90
  if (existsSync(out)) throw new Error('Prepared consumer output already exists');
91
- const { prepareConsumerApp } = await import('./consumer.ts');
91
+ const { prepareConsumerApp } = await import('./consumer.js');
92
92
  const candidateAt = args.indexOf('--candidate');
93
93
  const artifact = candidateAt >= 0 ? resolve(value('--candidate')) : undefined;
94
94
  const fixture = prepareConsumerApp(resolve(args[0]!), appDir, { cli, artifact });
@@ -102,7 +102,7 @@ if (command === '--version') {
102
102
  const outputAt = args.indexOf('--out');
103
103
  if (outputAt >= 0 && !args[outputAt + 1]) usage();
104
104
  const consumer = JSON.parse(readFileSync(resolve(args[at + 1]!), 'utf8'));
105
- const { runConsumerWorkflow } = await import('./consumer.ts');
105
+ const { runConsumerWorkflow } = await import('./consumer.js');
106
106
  const report = await runConsumerWorkflow(resolve(args[0]!), consumer);
107
107
  const text = `${JSON.stringify(report, null, 2)}\n`;
108
108
  if (outputAt >= 0) {
@@ -112,7 +112,7 @@ if (command === '--version') {
112
112
  process.exit(report.passed ? 0 : 1);
113
113
  } else if (command === 'assess') {
114
114
  if (!args[0]) usage();
115
- const { assessPack } = await import('./assessment.ts');
115
+ const { assessPack } = await import('./assessment.js');
116
116
  const consumerAt = args.indexOf('--prepared-consumer');
117
117
  if (consumerAt >= 0 && !args[consumerAt + 1]) usage();
118
118
  const consumer = consumerAt >= 0 ? JSON.parse(readFileSync(resolve(args[consumerAt + 1]!), 'utf8')) : undefined;
@@ -126,7 +126,7 @@ if (command === '--version') {
126
126
  process.exit(report.ready ? 0 : 1);
127
127
  } else if (command === 'facts') {
128
128
  if (!args[0]) usage();
129
- const { compilePackFacts, renderPackFacts } = await import('./pack-facts.ts');
129
+ const { compilePackFacts, renderPackFacts } = await import('./pack-facts.js');
130
130
  const { mkdirSync, writeFileSync } = await import('node:fs');
131
131
  const { join, dirname } = await import('node:path');
132
132
  const dir = resolve(args[0]!);
@@ -145,19 +145,19 @@ if (command === '--version') {
145
145
  if (!args[0] || args[0].startsWith('-')) usage();
146
146
  const tool = { walk: 'score-pack', examples: 'vendor-examples', coverage: 'life-coverage', 'judge-brief': 'judge-brief' }[command];
147
147
  process.argv = [process.argv[0]!, process.argv[1]!, ...args];
148
- await import((await import('./tools/packs-root.ts')).toolPath(tool));
148
+ await import((await import('./tools/packs-root.js')).toolPath(tool));
149
149
  } else if (command === 'derive') {
150
150
  if (!args[0]) usage();
151
151
  // the derivation is a script over process.argv: it reads the unit from its first argument
152
152
  process.argv = [process.argv[0]!, process.argv[1]!, ...args];
153
- await import('./derive.ts');
153
+ await import('./derive.js');
154
154
  } else if (command === 'check-sources') {
155
155
  if (!args[0]) usage();
156
- await (await import('./check-sources.ts')).checkSources(args);
156
+ await (await import('./check-sources.js')).checkSources(args);
157
157
  } else if (command === 'read-page') {
158
158
  // a documentation page's text, read as the citation check reads it: where an author finds the vendor's examples and words
159
159
  if (!args[0]) usage();
160
- const { status, readable, raw, error } = await (await import('./check-sources.ts')).readPage(args[0]);
160
+ const { status, readable, raw, error } = await (await import('./check-sources.js')).readPage(args[0]);
161
161
  if (status !== 200) { console.error(`read-page: ${args[0]} answered ${status || 'nothing'}${error ? `: ${error}` : ''}`); process.exit(1); }
162
162
  // --raw: the page's own bytes, as fetched (a spec writer reads its tables, which the readable text drops)
163
163
  if (args.includes('--raw')) process.stdout.write(raw); else console.log(readable);
@@ -169,8 +169,8 @@ if (command === '--version') {
169
169
  // `.tgz` the tarball `npm pack` makes of one, the bytes a publish would send
170
170
  const published = target.endsWith('.tgz') || (!existsSync(target) && /^@?[^@]+@[^@]+$/.test(target));
171
171
  const results = published
172
- ? await (await import('./published.ts')).conformPublished(target, at >= 0 ? { registry: args[at + 1]! } : {})
173
- : await (await import('./conformance.ts')).conformance(target, { onCheck: (id) => console.error(` … ${id} (${new Date().toISOString().slice(11, 19)})`) });
172
+ ? await (await import('./published.js')).conformPublished(target, at >= 0 ? { registry: args[at + 1]! } : {})
173
+ : await (await import('./conformance.js')).conformance(target, { onCheck: (id) => console.error(` … ${id} (${new Date().toISOString().slice(11, 19)})`) });
174
174
  for (const r of results) {
175
175
  console.log(`${r.failures.length ? '✗' : '✓'} ${r.id.padEnd(15)} ${r.asks}${r.note ? ` (${r.note})` : ''}`);
176
176
  for (const f of r.failures) console.log(` ${f}`);
@@ -499,8 +499,8 @@ async function lifeServed(pack: string): Promise<string[]> {
499
499
  }, server.managedDatabaseUrl ? { managedDatabaseUrl: server.managedDatabaseUrl } : {}),
500
500
  // a socket opened as an application opens it: a WebSocket to the served port, the vendor's host in its Host header
501
501
  socket: (url: string, headers: Record<string, string>) => new WebSocket(`ws://127.0.0.1:${port}${url}`, { headers } as unknown as string[]),
502
- // a line connection opened as an application's client opens it: TCP to the protocol listener (the primary port)
503
- stream: lineConnection(server.port),
502
+ // TCP to the native wire: a separate listener beside HTTP, or the primary protocol port.
503
+ stream: lineConnection(server.wirePort ?? server.port),
504
504
  // bounded: Bun's server.stop(true) never settles once a WebSocket peer has closed under it (discord's life, Bun
505
505
  // 1.3.11: the walk ended and the stop spun at full CPU for 45 minutes), so the check waits 5 s and goes on
506
506
  stop: async () => { await within(5000, Promise.resolve(server.stop())); },
@@ -6,6 +6,7 @@ import { startTwinDatabase, type TwinDatabase } from './walk-database.ts';
6
6
  export type ServedPack = {
7
7
  port: number;
8
8
  inspectPort?: number;
9
+ wirePort?: number;
9
10
  stop: () => void | Promise<void>;
10
11
  managedDatabaseUrl?: () => Promise<string>;
11
12
  };