@sayoriqwq/effect-harness 0.0.4 → 0.0.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.
@@ -6,23 +6,12 @@ import * as NodeServices from '@effect/platform-node/NodeServices';
6
6
  import { Effect, Layer } from 'effect';
7
7
  import { runCli } from "../src/cli/Main.js";
8
8
  import { errorMessage } from "../src/harness/Errors.js";
9
- const harnessRoot = resolveHarnessRoot(fileURLToPath(import.meta.url));
9
+ import { resolvePackageArtifactRoot } from "../src/harness/ProviderDiscovery.js";
10
+ const harnessRoot = resolvePackageArtifactRoot(fileURLToPath(import.meta.url));
10
11
  NodeRuntime.runMain(runCli({
11
12
  harnessRoot,
12
13
  version: '0.0.0',
13
14
  }).pipe(withNodeServices));
14
- function resolveHarnessRoot(entrypoint) {
15
- const marker = '/dist/bin/';
16
- const index = entrypoint.indexOf(marker);
17
- if (index >= 0) {
18
- return entrypoint.slice(0, index);
19
- }
20
- const sourceBinIndex = entrypoint.lastIndexOf('/bin/');
21
- if (sourceBinIndex >= 0) {
22
- return entrypoint.slice(0, sourceBinIndex);
23
- }
24
- return process.cwd();
25
- }
26
15
  function withNodeServices(effect) {
27
16
  return Effect.scoped(Effect.gen(function* () {
28
17
  const context = yield* Layer.build(NodeServices.layer);
@@ -1 +1 @@
1
- {"version":3,"file":"effect-harness.js","sourceRoot":"","sources":["../../bin/effect-harness.ts"],"names":[],"mappings":";AAEA,OAAO,OAAO,MAAM,cAAc,CAAA;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,KAAK,WAAW,MAAM,mCAAmC,CAAA;AAChE,OAAO,KAAK,YAAY,MAAM,oCAAoC,CAAA;AAClE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;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I,CAAC,GAAG,EAAE;YACf,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAA;QACtB,CAAC,CAAC,CACH,CAAC,CACL,CAAC,CAAC,CAAA;IACL,CAAC,CAAC,CAAC,CAAA;AACL,CAAC","sourcesContent":["#!/usr/bin/env node\n\nimport process from 'node:process'\nimport { fileURLToPath } from 'node:url'\nimport * as NodeRuntime from '@effect/platform-node/NodeRuntime'\nimport * as NodeServices from '@effect/platform-node/NodeServices'\nimport { Effect, Layer } from 'effect'\nimport { runCli } from '../src/cli/Main.ts'\nimport { errorMessage } from '../src/harness/Errors.ts'\n\nconst harnessRoot = resolveHarnessRoot(fileURLToPath(import.meta.url))\n\nNodeRuntime.runMain(runCli({\n harnessRoot,\n version: '0.0.0',\n}).pipe(withNodeServices))\n\nfunction resolveHarnessRoot(entrypoint: string) {\n const marker = '/dist/bin/'\n const index = entrypoint.indexOf(marker)\n if (index >= 0) {\n return entrypoint.slice(0, index)\n }\n const sourceBinIndex = entrypoint.lastIndexOf('/bin/')\n if (sourceBinIndex >= 0) {\n return entrypoint.slice(0, sourceBinIndex)\n }\n return process.cwd()\n}\n\nfunction withNodeServices<E>(\n effect: Effect.Effect<void, E, NodeServices.NodeServices>,\n): Effect.Effect<void, never> {\n return Effect.scoped(Effect.gen(function* () {\n const context = yield* Layer.build(NodeServices.layer)\n return yield* Effect.promise(() => Effect.runPromiseWith(context)(effect.pipe(\n Effect.catch((error: unknown) =>\n Effect.andThen(\n Effect.logError(errorMessage(error)),\n Effect.sync(() => {\n process.exitCode = 1\n }),\n )),\n )))\n }))\n}\n"]}
1
+ {"version":3,"file":"effect-harness.js","sourceRoot":"","sources":["../../bin/effect-harness.ts"],"names":[],"mappings":";AAEA,OAAO,OAAO,MAAM,cAAc,CAAA;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,KAAK,WAAW,MAAM,mCAAmC,CAAA;AAChE,OAAO,KAAK,YAAY,MAAM,oCAAoC,CAAA;AAClE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACvD,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAA;AAEhF,MAAM,WAAW,GAAG,0BAA0B,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;AAE9E,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC;IACzB,WAAW;IACX,OAAO,EAAE,OAAO;CACjB,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAA;AAE1B,SAAS,gBAAgB,CACvB,MAAyD;IAEzD,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;QACvC,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,CAAA;QACtD,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,IAAI,CAC3E,MAAM,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE,CAC9B,MAAM,CAAC,OAAO,CACZ,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,EACpC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE;YACf,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAA;QACtB,CAAC,CAAC,CACH,CAAC,CACL,CAAC,CAAC,CAAA;IACL,CAAC,CAAC,CAAC,CAAA;AACL,CAAC","sourcesContent":["#!/usr/bin/env node\n\nimport process from 'node:process'\nimport { fileURLToPath } from 'node:url'\nimport * as NodeRuntime from '@effect/platform-node/NodeRuntime'\nimport * as NodeServices from '@effect/platform-node/NodeServices'\nimport { Effect, Layer } from 'effect'\nimport { runCli } from '../src/cli/Main.ts'\nimport { errorMessage } from '../src/harness/Errors.ts'\nimport { resolvePackageArtifactRoot } from '../src/harness/ProviderDiscovery.ts'\n\nconst harnessRoot = resolvePackageArtifactRoot(fileURLToPath(import.meta.url))\n\nNodeRuntime.runMain(runCli({\n harnessRoot,\n version: '0.0.0',\n}).pipe(withNodeServices))\n\nfunction withNodeServices<E>(\n effect: Effect.Effect<void, E, NodeServices.NodeServices>,\n): Effect.Effect<void, never> {\n return Effect.scoped(Effect.gen(function* () {\n const context = yield* Layer.build(NodeServices.layer)\n return yield* Effect.promise(() => Effect.runPromiseWith(context)(effect.pipe(\n Effect.catch((error: unknown) =>\n Effect.andThen(\n Effect.logError(errorMessage(error)),\n Effect.sync(() => {\n process.exitCode = 1\n }),\n )),\n )))\n }))\n}\n"]}
@@ -15,11 +15,62 @@ interface ManagedFilesContribution {
15
15
  readonly targetBasePath: string;
16
16
  readonly files: ReadonlyArray<ManagedFileDeclaration>;
17
17
  }
18
+ interface SemanticContributions {
19
+ readonly packageJson: JsonRecord;
20
+ readonly tsconfig: JsonRecord;
21
+ readonly editorPolicy: JsonRecord;
22
+ readonly lintGuardrails: JsonRecord;
23
+ readonly testPolicy: JsonRecord;
24
+ readonly verificationPolicy: JsonRecord;
25
+ }
26
+ interface ArtifactOnlyReferenceAuditEntry {
27
+ readonly id: string;
28
+ readonly path: string;
29
+ readonly sourceEntry: string;
30
+ readonly targetDelivery: string;
31
+ readonly available: true;
32
+ }
33
+ interface ArtifactOnlyReferenceAudit {
34
+ readonly mode: 'artifact-only-reference-audit';
35
+ readonly references: ReadonlyArray<ArtifactOnlyReferenceAuditEntry>;
36
+ }
37
+ interface NpmInvocationFailureClassification {
38
+ readonly classification: 'npm-invocation-failure';
39
+ readonly code: 'npm-command-failed' | 'npm-same-name-cwd-short-circuit';
40
+ readonly providerDiscoveryStarted: false;
41
+ }
42
+ interface ProviderDiscoveryFailureClassification {
43
+ readonly classification: 'provider-discovery-failure';
44
+ readonly code: 'provider-discovery-error';
45
+ readonly providerDiscoveryStarted: true;
46
+ }
47
+ export interface ProviderDiscoveryFailureInput {
48
+ readonly stderr: string;
49
+ readonly stdout?: string;
50
+ readonly cwdPackageName?: string;
51
+ readonly cwdPackageVersion?: string;
52
+ readonly requestedPackageName?: string;
53
+ readonly requestedPackageVersion?: string;
54
+ }
55
+ export type ProviderDiscoveryFailure = NpmInvocationFailureClassification | ProviderDiscoveryFailureClassification;
18
56
  export interface ProviderDiscovery {
19
57
  readonly schemaVersion: 1;
20
58
  readonly artifactRoot: string;
21
59
  readonly providerProfilePath: string;
22
60
  readonly providerProfileRelativePath: 'provider/effect-harness.provider.json';
61
+ readonly packageArtifactIdentity: {
62
+ readonly packageName: string;
63
+ readonly packageVersion: string;
64
+ readonly packageManager: string;
65
+ readonly artifactRoot: string;
66
+ readonly packageJsonPath: string;
67
+ readonly providerProfilePath: string;
68
+ readonly npmSelector: string;
69
+ readonly neutralDiscoveryCommand: string;
70
+ readonly invocationFailureClassification: {
71
+ readonly sameNameCwdShortCircuit: NpmInvocationFailureClassification;
72
+ };
73
+ };
23
74
  readonly packageLocator: {
24
75
  readonly packageName: string;
25
76
  readonly packageVersion: string;
@@ -46,19 +97,13 @@ export interface ProviderDiscovery {
46
97
  readonly providerArtifactReference: JsonRecord;
47
98
  readonly exportedHarness: JsonRecord;
48
99
  };
100
+ readonly semanticContributions: SemanticContributions;
49
101
  readonly targetManagedSurfaces: {
50
102
  readonly targetReceives: ReadonlyArray<string>;
51
103
  readonly targetDoesNotReceive: ReadonlyArray<string>;
52
104
  readonly documentationBundle: ManagedFilesContribution;
53
105
  readonly snippets: ManagedFilesContribution;
54
- readonly contributions: {
55
- readonly packageJson: JsonRecord;
56
- readonly tsconfig: JsonRecord;
57
- readonly editorPolicy: JsonRecord;
58
- readonly lintGuardrails: JsonRecord;
59
- readonly testPolicy: JsonRecord;
60
- readonly verificationPolicy: JsonRecord;
61
- };
106
+ readonly contributions: SemanticContributions;
62
107
  };
63
108
  readonly artifactOnlyReferences: {
64
109
  readonly mode: string;
@@ -66,6 +111,7 @@ export interface ProviderDiscovery {
66
111
  readonly packageSurface: ReadonlyArray<string>;
67
112
  readonly references: JsonRecord;
68
113
  };
114
+ readonly artifactOnlyReferenceAudit: ArtifactOnlyReferenceAudit;
69
115
  readonly sourceIdentities: {
70
116
  readonly defaultSourceEntry: string;
71
117
  readonly sourceEntries: ReadonlyArray<string>;
@@ -80,11 +126,30 @@ export interface ProviderDiscovery {
80
126
  };
81
127
  readonly internalHarnessSurfaces: JsonRecord;
82
128
  }
129
+ export declare function resolvePackageArtifactRoot(entrypoint: string): string;
130
+ export declare function classifyProviderDiscoveryFailure(input: ProviderDiscoveryFailureInput): ProviderDiscoveryFailure;
83
131
  export declare const discoverProvider: (harness: string) => Effect.Effect<{
84
132
  schemaVersion: 1;
85
133
  artifactRoot: string;
86
134
  providerProfilePath: string;
87
135
  providerProfileRelativePath: "provider/effect-harness.provider.json";
136
+ packageArtifactIdentity: {
137
+ packageName: string;
138
+ packageVersion: string;
139
+ packageManager: string;
140
+ artifactRoot: string;
141
+ packageJsonPath: string;
142
+ providerProfilePath: string;
143
+ npmSelector: string;
144
+ neutralDiscoveryCommand: string;
145
+ invocationFailureClassification: {
146
+ sameNameCwdShortCircuit: {
147
+ classification: "npm-invocation-failure";
148
+ code: "npm-same-name-cwd-short-circuit";
149
+ providerDiscoveryStarted: false;
150
+ };
151
+ };
152
+ };
88
153
  packageLocator: {
89
154
  packageName: string;
90
155
  packageVersion: string;
@@ -111,6 +176,14 @@ export declare const discoverProvider: (harness: string) => Effect.Effect<{
111
176
  providerArtifactReference: JsonRecord;
112
177
  exportedHarness: JsonRecord;
113
178
  };
179
+ semanticContributions: {
180
+ packageJson: JsonRecord;
181
+ tsconfig: JsonRecord;
182
+ editorPolicy: JsonRecord;
183
+ lintGuardrails: JsonRecord;
184
+ testPolicy: JsonRecord;
185
+ verificationPolicy: JsonRecord;
186
+ };
114
187
  targetManagedSurfaces: {
115
188
  targetReceives: string[];
116
189
  targetDoesNotReceive: string[];
@@ -155,6 +228,16 @@ export declare const discoverProvider: (harness: string) => Effect.Effect<{
155
228
  packageSurface: string[];
156
229
  references: JsonRecord;
157
230
  };
231
+ artifactOnlyReferenceAudit: {
232
+ mode: "artifact-only-reference-audit";
233
+ references: {
234
+ available: true;
235
+ id: string;
236
+ path: string;
237
+ sourceEntry: string;
238
+ targetDelivery: string;
239
+ }[];
240
+ };
158
241
  sourceIdentities: {
159
242
  defaultSourceEntry: string;
160
243
  sourceEntries: string[];
@@ -2,6 +2,39 @@ import { Effect, FileSystem, Path } from 'effect';
2
2
  import { readJson } from "../platform/Json.js";
3
3
  import { HarnessError } from "./Errors.js";
4
4
  import { isRecord } from "./verify/JsonFields.js";
5
+ export function resolvePackageArtifactRoot(entrypoint) {
6
+ for (const marker of ['/dist/bin/', '/dist/src/', '/bin/', '/src/']) {
7
+ const index = entrypoint.indexOf(marker);
8
+ if (index >= 0) {
9
+ return entrypoint.slice(0, index);
10
+ }
11
+ }
12
+ return entrypoint;
13
+ }
14
+ export function classifyProviderDiscoveryFailure(input) {
15
+ const sameRequestedPackage = input.cwdPackageName === input.requestedPackageName
16
+ && input.cwdPackageVersion === input.requestedPackageVersion;
17
+ const commandNotFound = /(?:^|\n)(?:sh: )?effect-harness: command not found(?:\n|$)/u.test(input.stderr);
18
+ if (sameRequestedPackage && commandNotFound) {
19
+ return {
20
+ classification: 'npm-invocation-failure',
21
+ code: 'npm-same-name-cwd-short-circuit',
22
+ providerDiscoveryStarted: false,
23
+ };
24
+ }
25
+ if (commandNotFound || input.stderr.includes('Cannot find package') || input.stderr.includes('npm ERR!')) {
26
+ return {
27
+ classification: 'npm-invocation-failure',
28
+ code: 'npm-command-failed',
29
+ providerDiscoveryStarted: false,
30
+ };
31
+ }
32
+ return {
33
+ classification: 'provider-discovery-failure',
34
+ code: 'provider-discovery-error',
35
+ providerDiscoveryStarted: true,
36
+ };
37
+ }
5
38
  function decodeJsonRecord(value, source) {
6
39
  return isRecord(value)
7
40
  ? Effect.succeed(value)
@@ -17,6 +50,9 @@ function expectString(value, source) {
17
50
  ? Effect.succeed(value)
18
51
  : Effect.fail(new HarnessError({ message: `${source} must be a string` }));
19
52
  }
53
+ function optionalString(value, fallback) {
54
+ return typeof value === 'string' ? value : fallback;
55
+ }
20
56
  function expectBoolean(value, source) {
21
57
  return typeof value === 'boolean'
22
58
  ? Effect.succeed(value)
@@ -79,13 +115,38 @@ const expectArtifactReferences = Effect.fnUntraced(function* (providerProfile) {
79
115
  references,
80
116
  };
81
117
  });
118
+ const expectArtifactOnlyReferenceAudit = Effect.fnUntraced(function* (references, artifactRoot) {
119
+ const fs = yield* FileSystem.FileSystem;
120
+ const path = yield* Path.Path;
121
+ const entries = yield* Effect.forEach(Object.entries(references), ([id, value]) => Effect.gen(function* () {
122
+ const reference = yield* expectRecord(value, `provider profile.artifactReferences.references.${id}`);
123
+ const referencePath = yield* expectString(reference.path, `provider profile.artifactReferences.references.${id}.path`);
124
+ const absolutePath = path.join(artifactRoot, referencePath);
125
+ const available = yield* fs.exists(absolutePath);
126
+ if (!available) {
127
+ return yield* new HarnessError({ message: `artifact-only reference ${id} is missing from package artifact at ${referencePath}` });
128
+ }
129
+ return {
130
+ available: true,
131
+ id,
132
+ path: referencePath,
133
+ sourceEntry: yield* expectString(reference.sourceEntry, `provider profile.artifactReferences.references.${id}.sourceEntry`),
134
+ targetDelivery: yield* expectString(reference.targetDelivery, `provider profile.artifactReferences.references.${id}.targetDelivery`),
135
+ };
136
+ }));
137
+ return {
138
+ mode: 'artifact-only-reference-audit',
139
+ references: entries,
140
+ };
141
+ });
82
142
  export const discoverProvider = Effect.fnUntraced(function* (harness) {
83
143
  const path = yield* Path.Path;
84
144
  const artifactRoot = path.resolve(harness);
85
145
  const providerProfileRelativePath = 'provider/effect-harness.provider.json';
86
146
  const providerProfilePath = path.join(artifactRoot, providerProfileRelativePath);
147
+ const packageJsonPath = path.join(artifactRoot, 'package.json');
87
148
  const providerProfile = yield* readJson(providerProfilePath, decodeJsonRecord);
88
- const packageManifest = yield* readJson(path.join(artifactRoot, 'package.json'), decodeJsonRecord);
149
+ const packageManifest = yield* readJson(packageJsonPath, decodeJsonRecord);
89
150
  const provider = yield* expectNamedRecord(providerProfile, 'provider', 'provider profile');
90
151
  const profiles = yield* expectNamedRecord(providerProfile, 'profiles', 'provider profile');
91
152
  const defaultProfile = yield* expectString(provider.defaultProfile, 'provider profile.provider.defaultProfile');
@@ -97,14 +158,43 @@ export const discoverProvider = Effect.fnUntraced(function* (harness) {
97
158
  const packageBin = yield* expectNamedRecord(packageManifest, 'bin', 'package.json');
98
159
  const artifactOnlyReferences = yield* expectArtifactReferences(providerProfile);
99
160
  const deliveryModes = yield* expectDeliveryModes(providerProfile);
161
+ const packageName = yield* expectString(packageManifest.name, 'package.json.name');
162
+ const packageVersion = yield* expectString(packageManifest.version, 'package.json.version');
163
+ const packageManager = optionalString(packageManifest.packageManager, 'unknown');
164
+ const npmSelector = `${packageName}@${packageVersion}`;
165
+ const semanticContributions = {
166
+ packageJson: yield* expectNamedRecord(contributions, 'packageJson', `provider profile.profiles.${defaultProfile}.contributions`),
167
+ tsconfig: yield* expectNamedRecord(contributions, 'tsconfig', `provider profile.profiles.${defaultProfile}.contributions`),
168
+ editorPolicy: yield* expectNamedRecord(contributions, 'editorPolicy', `provider profile.profiles.${defaultProfile}.contributions`),
169
+ lintGuardrails: yield* expectNamedRecord(contributions, 'lintGuardrails', `provider profile.profiles.${defaultProfile}.contributions`),
170
+ testPolicy: yield* expectNamedRecord(contributions, 'testPolicy', `provider profile.profiles.${defaultProfile}.contributions`),
171
+ verificationPolicy: yield* expectNamedRecord(contributions, 'verificationPolicy', `provider profile.profiles.${defaultProfile}.contributions`),
172
+ };
100
173
  return {
101
174
  schemaVersion: 1,
102
175
  artifactRoot,
103
176
  providerProfilePath,
104
177
  providerProfileRelativePath,
178
+ packageArtifactIdentity: {
179
+ packageName,
180
+ packageVersion,
181
+ packageManager,
182
+ artifactRoot,
183
+ packageJsonPath,
184
+ providerProfilePath,
185
+ npmSelector,
186
+ neutralDiscoveryCommand: `npx --yes --package ${npmSelector} effect-harness provider-discover`,
187
+ invocationFailureClassification: {
188
+ sameNameCwdShortCircuit: {
189
+ classification: 'npm-invocation-failure',
190
+ code: 'npm-same-name-cwd-short-circuit',
191
+ providerDiscoveryStarted: false,
192
+ },
193
+ },
194
+ },
105
195
  packageLocator: {
106
- packageName: yield* expectString(packageManifest.name, 'package.json.name'),
107
- packageVersion: yield* expectString(packageManifest.version, 'package.json.version'),
196
+ packageName,
197
+ packageVersion,
108
198
  binName: 'effect-harness',
109
199
  binPath: yield* expectString(packageBin['effect-harness'], 'package.json.bin.effect-harness'),
110
200
  discoveryCommand: 'npx --yes @sayoriqwq/effect-harness provider-discover',
@@ -124,21 +214,16 @@ export const discoverProvider = Effect.fnUntraced(function* (harness) {
124
214
  targetLifecycleOwner: yield* expectString(selfConformance.lifecycleOwner, 'provider profile.selfConformance.lifecycleOwner'),
125
215
  },
126
216
  deliveryModes,
217
+ semanticContributions,
127
218
  targetManagedSurfaces: {
128
219
  targetReceives: yield* expectStringArray(managedSurfaces.targetReceives, `provider profile.profiles.${defaultProfile}.managedSurfaces.targetReceives`),
129
220
  targetDoesNotReceive: yield* expectStringArray(managedSurfaces.targetDoesNotReceive, `provider profile.profiles.${defaultProfile}.managedSurfaces.targetDoesNotReceive`),
130
221
  documentationBundle: yield* expectManagedFilesContribution(contributions.documentationBundle, `provider profile.profiles.${defaultProfile}.contributions.documentationBundle`, artifactRoot),
131
222
  snippets: yield* expectManagedFilesContribution(contributions.snippets, `provider profile.profiles.${defaultProfile}.contributions.snippets`, artifactRoot),
132
- contributions: {
133
- packageJson: yield* expectNamedRecord(contributions, 'packageJson', `provider profile.profiles.${defaultProfile}.contributions`),
134
- tsconfig: yield* expectNamedRecord(contributions, 'tsconfig', `provider profile.profiles.${defaultProfile}.contributions`),
135
- editorPolicy: yield* expectNamedRecord(contributions, 'editorPolicy', `provider profile.profiles.${defaultProfile}.contributions`),
136
- lintGuardrails: yield* expectNamedRecord(contributions, 'lintGuardrails', `provider profile.profiles.${defaultProfile}.contributions`),
137
- testPolicy: yield* expectNamedRecord(contributions, 'testPolicy', `provider profile.profiles.${defaultProfile}.contributions`),
138
- verificationPolicy: yield* expectNamedRecord(contributions, 'verificationPolicy', `provider profile.profiles.${defaultProfile}.contributions`),
139
- },
223
+ contributions: semanticContributions,
140
224
  },
141
225
  artifactOnlyReferences,
226
+ artifactOnlyReferenceAudit: yield* expectArtifactOnlyReferenceAudit(artifactOnlyReferences.references, artifactRoot),
142
227
  sourceIdentities: {
143
228
  defaultSourceEntry: yield* expectString(selectedProfile.sourceEntry, `provider profile.profiles.${defaultProfile}.sourceEntry`),
144
229
  sourceEntries: yield* expectStringArray(selectedProfile.sourceEntries, `provider profile.profiles.${defaultProfile}.sourceEntries`),
@@ -1 +1 @@
1
- {"version":3,"file":"ProviderDiscovery.js","sourceRoot":"","sources":["../../../src/harness/ProviderDiscovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AAsFjD,SAAS,gBAAgB,CAAC,KAAc,EAAE,MAAc;IACtD,OAAO,QAAQ,CAAC,KAAK,CAAC;QACpB,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;QACvB,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,YAAY,CAAC,EAAE,OAAO,EAAE,GAAG,MAAM,wBAAwB,EAAE,CAAC,CAAC,CAAA;AACnF,CAAC;AAED,SAAS,YAAY,CAAC,KAAc,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gB,EAAE;YAChB,kBAAkB,EAAE,KAAK,CAAC,CAAC,YAAY,CAAC,eAAe,CAAC,WAAW,EAAE,6BAA6B,cAAc,cAAc,CAAC;YAC/H,aAAa,EAAE,KAAK,CAAC,CAAC,iBAAiB,CAAC,eAAe,CAAC,aAAa,EAAE,6BAA6B,cAAc,gBAAgB,CAAC;YACnI,cAAc,EAAE;gBACd,oBAAoB,EAAE,KAAK,CAAC,CAAC,aAAa,CAAC,cAAc,CAAC,oBAAoB,EAAE,6BAA6B,cAAc,sCAAsC,CAAC;gBAClK,cAAc,EAAE,KAAK,CAAC,CAAC,YAAY,CAAC,cAAc,CAAC,cAAc,EAAE,6BAA6B,cAAc,gCAAgC,CAAC;gBAC/I,oBAAoB,EAAE,KAAK,CAAC,CAAC,iBAAiB,CAAC,cAAc,CAAC,oBAAoB,EAAE,6BAA6B,cAAc,sCAAsC,CAAC;gBACtK,2BAA2B,EAAE,KAAK,CAAC,CAAC,iBAAiB,CAAC,cAAc,CAAC,2BAA2B,EAAE,6BAA6B,cAAc,6CAA6C,CAAC;aAC5L;YACD,qBAAqB,EAAE,KAAK,CAAC,CAAC,iBAAiB,CAAC,eAAe,EAAE,eAAe,EAAE,kBAAkB,CAAC;YACrG,kBAAkB,EAAE,sBAAsB,CAAC,UAAU;SACtD;QACD,uBAAuB,EAAE,aAAa,CAAC,eAAe;KAC3B,CAAA;AAC/B,CAAC,CAAC,CAAA","sourcesContent":["import { Effect, FileSystem, Path } from 'effect'\nimport { readJson } from '../platform/Json.ts'\nimport { HarnessError } from './Errors.ts'\nimport { isRecord } from './verify/JsonFields.ts'\n\ntype JsonRecord = Record<string, unknown>\n\ninterface ManagedFileDeclaration {\n readonly id: string\n readonly sourcePath: string\n readonly targetPath: string\n readonly contentType: string\n readonly managed: boolean\n readonly content: string\n readonly targetUsage?: string\n}\n\ninterface ManagedFilesContribution {\n readonly mode: string\n readonly targetBasePath: string\n readonly files: ReadonlyArray<ManagedFileDeclaration>\n}\n\nexport interface ProviderDiscovery {\n readonly schemaVersion: 1\n readonly artifactRoot: string\n readonly providerProfilePath: string\n readonly providerProfileRelativePath: 'provider/effect-harness.provider.json'\n readonly packageLocator: {\n readonly packageName: string\n readonly packageVersion: string\n readonly binName: 'effect-harness'\n readonly binPath: string\n readonly discoveryCommand: string\n readonly packageFiles: ReadonlyArray<string>\n }\n readonly provider: {\n readonly id: string\n readonly contractVersion: string\n readonly providerVersion: string\n readonly defaultProfile: string\n }\n readonly selectedProfile: string\n readonly discovery: {\n readonly mode: 'provider-discovery'\n readonly consumer: 'prelude'\n readonly profileSource: 'provider/effect-harness.provider.json'\n readonly targetLifecycleOwner: string\n }\n readonly deliveryModes: {\n readonly internalHarness: JsonRecord\n readonly providerArtifactReference: JsonRecord\n readonly exportedHarness: JsonRecord\n }\n readonly targetManagedSurfaces: {\n readonly targetReceives: ReadonlyArray<string>\n readonly targetDoesNotReceive: ReadonlyArray<string>\n readonly documentationBundle: ManagedFilesContribution\n readonly snippets: ManagedFilesContribution\n readonly contributions: {\n readonly packageJson: JsonRecord\n readonly tsconfig: JsonRecord\n readonly editorPolicy: JsonRecord\n readonly lintGuardrails: JsonRecord\n readonly testPolicy: JsonRecord\n readonly verificationPolicy: JsonRecord\n }\n }\n readonly artifactOnlyReferences: {\n readonly mode: string\n readonly targetDelivery: string\n readonly packageSurface: ReadonlyArray<string>\n readonly references: JsonRecord\n }\n readonly sourceIdentities: {\n readonly defaultSourceEntry: string\n readonly sourceEntries: ReadonlyArray<string>\n readonly sourceBoundary: {\n readonly providerRepoInternal: boolean\n readonly targetDelivery: string\n readonly targetMustNotReceive: ReadonlyArray<string>\n readonly allowedTargetSourceIdentity: ReadonlyArray<string>\n }\n readonly providerSourceEntries: JsonRecord\n readonly artifactReferences: JsonRecord\n }\n readonly internalHarnessSurfaces: JsonRecord\n}\n\nfunction decodeJsonRecord(value: unknown, source: string): Effect.Effect<JsonRecord, HarnessError> {\n return isRecord(value)\n ? Effect.succeed(value)\n : Effect.fail(new HarnessError({ message: `${source} must be a JSON object` }))\n}\n\nfunction expectRecord(value: unknown, source: string): Effect.Effect<JsonRecord, HarnessError> {\n return isRecord(value)\n ? Effect.succeed(value)\n : Effect.fail(new HarnessError({ message: `${source} must be a JSON object` }))\n}\n\nfunction expectString(value: unknown, source: string): Effect.Effect<string, HarnessError> {\n return typeof value === 'string'\n ? Effect.succeed(value)\n : Effect.fail(new HarnessError({ message: `${source} must be a string` }))\n}\n\nfunction expectBoolean(value: unknown, source: string): Effect.Effect<boolean, HarnessError> {\n return typeof value === 'boolean'\n ? Effect.succeed(value)\n : Effect.fail(new HarnessError({ message: `${source} must be a boolean` }))\n}\n\nfunction expectArray(value: unknown, source: string): Effect.Effect<ReadonlyArray<unknown>, HarnessError> {\n return Array.isArray(value)\n ? Effect.succeed(value)\n : Effect.fail(new HarnessError({ message: `${source} must be an array` }))\n}\n\nconst expectStringArray = Effect.fnUntraced(function* (value: unknown, source: string) {\n const array = yield* expectArray(value, source)\n return yield* Effect.forEach(array, (entry, index) => expectString(entry, `${source}[${index}]`))\n})\n\nconst expectManagedFileDeclaration = Effect.fnUntraced(function* (value: unknown, source: string, artifactRoot: string) {\n const file = yield* expectRecord(value, source)\n const path = yield* Path.Path\n const fs = yield* FileSystem.FileSystem\n const sourcePath = yield* expectString(file.sourcePath, `${source}.sourcePath`)\n const targetUsage = file.targetUsage === undefined\n ? undefined\n : yield* expectString(file.targetUsage, `${source}.targetUsage`)\n\n return {\n id: yield* expectString(file.id, `${source}.id`),\n sourcePath,\n targetPath: yield* expectString(file.targetPath, `${source}.targetPath`),\n contentType: yield* expectString(file.contentType, `${source}.contentType`),\n managed: yield* expectBoolean(file.managed, `${source}.managed`),\n content: yield* fs.readFileString(path.join(artifactRoot, sourcePath)),\n ...(targetUsage === undefined ? {} : { targetUsage }),\n } satisfies ManagedFileDeclaration\n})\n\nconst expectManagedFilesContribution = Effect.fnUntraced(function* (value: unknown, source: string, artifactRoot: string) {\n const contribution = yield* expectRecord(value, source)\n const files = yield* expectArray(contribution.files, `${source}.files`)\n return {\n mode: yield* expectString(contribution.mode, `${source}.mode`),\n targetBasePath: yield* expectString(contribution.targetBasePath, `${source}.targetBasePath`),\n files: yield* Effect.forEach(files, (file, index) => expectManagedFileDeclaration(file, `${source}.files[${index}]`, artifactRoot)),\n } satisfies ManagedFilesContribution\n})\n\nfunction expectNamedRecord(record: JsonRecord, field: string, source: string): Effect.Effect<JsonRecord, HarnessError> {\n return expectRecord(record[field], `${source}.${field}`)\n}\n\nconst expectDeliveryModes = Effect.fnUntraced(function* (providerProfile: JsonRecord) {\n const deliveryModes = yield* expectNamedRecord(providerProfile, 'deliveryModes', 'provider profile')\n return {\n internalHarness: yield* expectNamedRecord(deliveryModes, 'internalHarness', 'provider profile.deliveryModes'),\n providerArtifactReference: yield* expectNamedRecord(deliveryModes, 'providerArtifactReference', 'provider profile.deliveryModes'),\n exportedHarness: yield* expectNamedRecord(deliveryModes, 'exportedHarness', 'provider profile.deliveryModes'),\n }\n})\n\nconst expectArtifactReferences = Effect.fnUntraced(function* (providerProfile: JsonRecord) {\n const artifactReferences = yield* expectNamedRecord(providerProfile, 'artifactReferences', 'provider profile')\n const references = yield* expectNamedRecord(artifactReferences, 'references', 'provider profile.artifactReferences')\n return {\n mode: yield* expectString(artifactReferences.mode, 'provider profile.artifactReferences.mode'),\n targetDelivery: yield* expectString(artifactReferences.targetDelivery, 'provider profile.artifactReferences.targetDelivery'),\n packageSurface: yield* expectStringArray(artifactReferences.packageSurface, 'provider profile.artifactReferences.packageSurface'),\n references,\n }\n})\n\nexport const discoverProvider = Effect.fnUntraced(function* (harness: string) {\n const path = yield* Path.Path\n const artifactRoot = path.resolve(harness)\n const providerProfileRelativePath = 'provider/effect-harness.provider.json'\n const providerProfilePath = path.join(artifactRoot, providerProfileRelativePath)\n\n const providerProfile = yield* readJson(providerProfilePath, decodeJsonRecord)\n const packageManifest = yield* readJson(path.join(artifactRoot, 'package.json'), decodeJsonRecord)\n const provider = yield* expectNamedRecord(providerProfile, 'provider', 'provider profile')\n const profiles = yield* expectNamedRecord(providerProfile, 'profiles', 'provider profile')\n const defaultProfile = yield* expectString(provider.defaultProfile, 'provider profile.provider.defaultProfile')\n const selectedProfile = yield* expectNamedRecord(profiles, defaultProfile, `provider profile.profiles.${defaultProfile}`)\n const contributions = yield* expectNamedRecord(selectedProfile, 'contributions', `provider profile.profiles.${defaultProfile}`)\n const managedSurfaces = yield* expectNamedRecord(selectedProfile, 'managedSurfaces', `provider profile.profiles.${defaultProfile}`)\n const sourceBoundary = yield* expectNamedRecord(selectedProfile, 'sourceBoundary', `provider profile.profiles.${defaultProfile}`)\n const selfConformance = yield* expectNamedRecord(providerProfile, 'selfConformance', 'provider profile')\n const packageBin = yield* expectNamedRecord(packageManifest, 'bin', 'package.json')\n const artifactOnlyReferences = yield* expectArtifactReferences(providerProfile)\n const deliveryModes = yield* expectDeliveryModes(providerProfile)\n\n return {\n schemaVersion: 1,\n artifactRoot,\n providerProfilePath,\n providerProfileRelativePath,\n packageLocator: {\n packageName: yield* expectString(packageManifest.name, 'package.json.name'),\n packageVersion: yield* expectString(packageManifest.version, 'package.json.version'),\n binName: 'effect-harness',\n binPath: yield* expectString(packageBin['effect-harness'], 'package.json.bin.effect-harness'),\n discoveryCommand: 'npx --yes @sayoriqwq/effect-harness provider-discover',\n packageFiles: yield* expectStringArray(packageManifest.files, 'package.json.files'),\n },\n provider: {\n id: yield* expectString(provider.id, 'provider profile.provider.id'),\n contractVersion: yield* expectString(provider.contractVersion, 'provider profile.provider.contractVersion'),\n providerVersion: yield* expectString(provider.providerVersion, 'provider profile.provider.providerVersion'),\n defaultProfile,\n },\n selectedProfile: defaultProfile,\n discovery: {\n mode: 'provider-discovery',\n consumer: 'prelude',\n profileSource: providerProfileRelativePath,\n targetLifecycleOwner: yield* expectString(selfConformance.lifecycleOwner, 'provider profile.selfConformance.lifecycleOwner'),\n },\n deliveryModes,\n targetManagedSurfaces: {\n targetReceives: yield* expectStringArray(managedSurfaces.targetReceives, `provider profile.profiles.${defaultProfile}.managedSurfaces.targetReceives`),\n targetDoesNotReceive: yield* expectStringArray(managedSurfaces.targetDoesNotReceive, `provider profile.profiles.${defaultProfile}.managedSurfaces.targetDoesNotReceive`),\n documentationBundle: yield* expectManagedFilesContribution(contributions.documentationBundle, `provider profile.profiles.${defaultProfile}.contributions.documentationBundle`, artifactRoot),\n snippets: yield* expectManagedFilesContribution(contributions.snippets, `provider profile.profiles.${defaultProfile}.contributions.snippets`, artifactRoot),\n contributions: {\n packageJson: yield* expectNamedRecord(contributions, 'packageJson', `provider profile.profiles.${defaultProfile}.contributions`),\n tsconfig: yield* expectNamedRecord(contributions, 'tsconfig', `provider profile.profiles.${defaultProfile}.contributions`),\n editorPolicy: yield* expectNamedRecord(contributions, 'editorPolicy', `provider profile.profiles.${defaultProfile}.contributions`),\n lintGuardrails: yield* expectNamedRecord(contributions, 'lintGuardrails', `provider profile.profiles.${defaultProfile}.contributions`),\n testPolicy: yield* expectNamedRecord(contributions, 'testPolicy', `provider profile.profiles.${defaultProfile}.contributions`),\n verificationPolicy: yield* expectNamedRecord(contributions, 'verificationPolicy', `provider profile.profiles.${defaultProfile}.contributions`),\n },\n },\n artifactOnlyReferences,\n sourceIdentities: {\n defaultSourceEntry: yield* expectString(selectedProfile.sourceEntry, `provider profile.profiles.${defaultProfile}.sourceEntry`),\n sourceEntries: yield* expectStringArray(selectedProfile.sourceEntries, `provider profile.profiles.${defaultProfile}.sourceEntries`),\n sourceBoundary: {\n providerRepoInternal: yield* expectBoolean(sourceBoundary.providerRepoInternal, `provider profile.profiles.${defaultProfile}.sourceBoundary.providerRepoInternal`),\n targetDelivery: yield* expectString(sourceBoundary.targetDelivery, `provider profile.profiles.${defaultProfile}.sourceBoundary.targetDelivery`),\n targetMustNotReceive: yield* expectStringArray(sourceBoundary.targetMustNotReceive, `provider profile.profiles.${defaultProfile}.sourceBoundary.targetMustNotReceive`),\n allowedTargetSourceIdentity: yield* expectStringArray(sourceBoundary.allowedTargetSourceIdentity, `provider profile.profiles.${defaultProfile}.sourceBoundary.allowedTargetSourceIdentity`),\n },\n providerSourceEntries: yield* expectNamedRecord(providerProfile, 'sourceEntries', 'provider profile'),\n artifactReferences: artifactOnlyReferences.references,\n },\n internalHarnessSurfaces: deliveryModes.internalHarness,\n } satisfies ProviderDiscovery\n})\n"]}
1
+ {"version":3,"file":"ProviderDiscovery.js","sourceRoot":"","sources":["../../../src/harness/ProviderDiscovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AA6IjD,MAAM,UAAU,0BAA0B,CAAC,UAAkB;IAC3D,KAAK,MAAM,MAAM,IAAI,CAAC,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC;QACpE,MAAM,KAAK,GAAG,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QACxC,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;YACf,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;QACnC,CAAC;IACH,CAAC;IACD,OAAO,UAAU,CAAA;AACnB,CAAC;AAED,MAAM,UAAU,gCAAgC,CAAC,KAAoC;IACnF,MAAM,oBAAoB,GAAG,KAAK,CAAC,cAAc,KAAK,KAAK,CAAC,oBAAoB;WAC3E,KAAK,CAAC,iBAAiB,KAAK,KAAK,CAAC,uBAAuB,CAAA;IAC9D,MAAM,eAAe,GAAG,6DAA6D,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IAExG,IAAI,oBAAoB,IAAI,eAAe,EAAE,CAAC;QAC5C,OAAO;YACL,cAAc,EAAE,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B,EAAE,sBAAsB,CAAC,UAAU;SACtD;QACD,uBAAuB,EAAE,aAAa,CAAC,eAAe;KAC3B,CAAA;AAC/B,CAAC,CAAC,CAAA","sourcesContent":["import { Effect, FileSystem, Path } from 'effect'\nimport { readJson } from '../platform/Json.ts'\nimport { HarnessError } from './Errors.ts'\nimport { isRecord } from './verify/JsonFields.ts'\n\ntype JsonRecord = Record<string, unknown>\n\ninterface ManagedFileDeclaration {\n readonly id: string\n readonly sourcePath: string\n readonly targetPath: string\n readonly contentType: string\n readonly managed: boolean\n readonly content: string\n readonly targetUsage?: string\n}\n\ninterface ManagedFilesContribution {\n readonly mode: string\n readonly targetBasePath: string\n readonly files: ReadonlyArray<ManagedFileDeclaration>\n}\n\ninterface SemanticContributions {\n readonly packageJson: JsonRecord\n readonly tsconfig: JsonRecord\n readonly editorPolicy: JsonRecord\n readonly lintGuardrails: JsonRecord\n readonly testPolicy: JsonRecord\n readonly verificationPolicy: JsonRecord\n}\n\ninterface ArtifactOnlyReferenceAuditEntry {\n readonly id: string\n readonly path: string\n readonly sourceEntry: string\n readonly targetDelivery: string\n readonly available: true\n}\n\ninterface ArtifactOnlyReferenceAudit {\n readonly mode: 'artifact-only-reference-audit'\n readonly references: ReadonlyArray<ArtifactOnlyReferenceAuditEntry>\n}\n\ninterface NpmInvocationFailureClassification {\n readonly classification: 'npm-invocation-failure'\n readonly code: 'npm-command-failed' | 'npm-same-name-cwd-short-circuit'\n readonly providerDiscoveryStarted: false\n}\n\ninterface ProviderDiscoveryFailureClassification {\n readonly classification: 'provider-discovery-failure'\n readonly code: 'provider-discovery-error'\n readonly providerDiscoveryStarted: true\n}\n\nexport interface ProviderDiscoveryFailureInput {\n readonly stderr: string\n readonly stdout?: string\n readonly cwdPackageName?: string\n readonly cwdPackageVersion?: string\n readonly requestedPackageName?: string\n readonly requestedPackageVersion?: string\n}\n\nexport type ProviderDiscoveryFailure\n = | NpmInvocationFailureClassification\n | ProviderDiscoveryFailureClassification\n\nexport interface ProviderDiscovery {\n readonly schemaVersion: 1\n readonly artifactRoot: string\n readonly providerProfilePath: string\n readonly providerProfileRelativePath: 'provider/effect-harness.provider.json'\n readonly packageArtifactIdentity: {\n readonly packageName: string\n readonly packageVersion: string\n readonly packageManager: string\n readonly artifactRoot: string\n readonly packageJsonPath: string\n readonly providerProfilePath: string\n readonly npmSelector: string\n readonly neutralDiscoveryCommand: string\n readonly invocationFailureClassification: {\n readonly sameNameCwdShortCircuit: NpmInvocationFailureClassification\n }\n }\n readonly packageLocator: {\n readonly packageName: string\n readonly packageVersion: string\n readonly binName: 'effect-harness'\n readonly binPath: string\n readonly discoveryCommand: string\n readonly packageFiles: ReadonlyArray<string>\n }\n readonly provider: {\n readonly id: string\n readonly contractVersion: string\n readonly providerVersion: string\n readonly defaultProfile: string\n }\n readonly selectedProfile: string\n readonly discovery: {\n readonly mode: 'provider-discovery'\n readonly consumer: 'prelude'\n readonly profileSource: 'provider/effect-harness.provider.json'\n readonly targetLifecycleOwner: string\n }\n readonly deliveryModes: {\n readonly internalHarness: JsonRecord\n readonly providerArtifactReference: JsonRecord\n readonly exportedHarness: JsonRecord\n }\n readonly semanticContributions: SemanticContributions\n readonly targetManagedSurfaces: {\n readonly targetReceives: ReadonlyArray<string>\n readonly targetDoesNotReceive: ReadonlyArray<string>\n readonly documentationBundle: ManagedFilesContribution\n readonly snippets: ManagedFilesContribution\n readonly contributions: SemanticContributions\n }\n readonly artifactOnlyReferences: {\n readonly mode: string\n readonly targetDelivery: string\n readonly packageSurface: ReadonlyArray<string>\n readonly references: JsonRecord\n }\n readonly artifactOnlyReferenceAudit: ArtifactOnlyReferenceAudit\n readonly sourceIdentities: {\n readonly defaultSourceEntry: string\n readonly sourceEntries: ReadonlyArray<string>\n readonly sourceBoundary: {\n readonly providerRepoInternal: boolean\n readonly targetDelivery: string\n readonly targetMustNotReceive: ReadonlyArray<string>\n readonly allowedTargetSourceIdentity: ReadonlyArray<string>\n }\n readonly providerSourceEntries: JsonRecord\n readonly artifactReferences: JsonRecord\n }\n readonly internalHarnessSurfaces: JsonRecord\n}\n\nexport function resolvePackageArtifactRoot(entrypoint: string): string {\n for (const marker of ['/dist/bin/', '/dist/src/', '/bin/', '/src/']) {\n const index = entrypoint.indexOf(marker)\n if (index >= 0) {\n return entrypoint.slice(0, index)\n }\n }\n return entrypoint\n}\n\nexport function classifyProviderDiscoveryFailure(input: ProviderDiscoveryFailureInput): ProviderDiscoveryFailure {\n const sameRequestedPackage = input.cwdPackageName === input.requestedPackageName\n && input.cwdPackageVersion === input.requestedPackageVersion\n const commandNotFound = /(?:^|\\n)(?:sh: )?effect-harness: command not found(?:\\n|$)/u.test(input.stderr)\n\n if (sameRequestedPackage && commandNotFound) {\n return {\n classification: 'npm-invocation-failure',\n code: 'npm-same-name-cwd-short-circuit',\n providerDiscoveryStarted: false,\n }\n }\n\n if (commandNotFound || input.stderr.includes('Cannot find package') || input.stderr.includes('npm ERR!')) {\n return {\n classification: 'npm-invocation-failure',\n code: 'npm-command-failed',\n providerDiscoveryStarted: false,\n }\n }\n\n return {\n classification: 'provider-discovery-failure',\n code: 'provider-discovery-error',\n providerDiscoveryStarted: true,\n }\n}\n\nfunction decodeJsonRecord(value: unknown, source: string): Effect.Effect<JsonRecord, HarnessError> {\n return isRecord(value)\n ? Effect.succeed(value)\n : Effect.fail(new HarnessError({ message: `${source} must be a JSON object` }))\n}\n\nfunction expectRecord(value: unknown, source: string): Effect.Effect<JsonRecord, HarnessError> {\n return isRecord(value)\n ? Effect.succeed(value)\n : Effect.fail(new HarnessError({ message: `${source} must be a JSON object` }))\n}\n\nfunction expectString(value: unknown, source: string): Effect.Effect<string, HarnessError> {\n return typeof value === 'string'\n ? Effect.succeed(value)\n : Effect.fail(new HarnessError({ message: `${source} must be a string` }))\n}\n\nfunction optionalString(value: unknown, fallback: string): string {\n return typeof value === 'string' ? value : fallback\n}\n\nfunction expectBoolean(value: unknown, source: string): Effect.Effect<boolean, HarnessError> {\n return typeof value === 'boolean'\n ? Effect.succeed(value)\n : Effect.fail(new HarnessError({ message: `${source} must be a boolean` }))\n}\n\nfunction expectArray(value: unknown, source: string): Effect.Effect<ReadonlyArray<unknown>, HarnessError> {\n return Array.isArray(value)\n ? Effect.succeed(value)\n : Effect.fail(new HarnessError({ message: `${source} must be an array` }))\n}\n\nconst expectStringArray = Effect.fnUntraced(function* (value: unknown, source: string) {\n const array = yield* expectArray(value, source)\n return yield* Effect.forEach(array, (entry, index) => expectString(entry, `${source}[${index}]`))\n})\n\nconst expectManagedFileDeclaration = Effect.fnUntraced(function* (value: unknown, source: string, artifactRoot: string) {\n const file = yield* expectRecord(value, source)\n const path = yield* Path.Path\n const fs = yield* FileSystem.FileSystem\n const sourcePath = yield* expectString(file.sourcePath, `${source}.sourcePath`)\n const targetUsage = file.targetUsage === undefined\n ? undefined\n : yield* expectString(file.targetUsage, `${source}.targetUsage`)\n\n return {\n id: yield* expectString(file.id, `${source}.id`),\n sourcePath,\n targetPath: yield* expectString(file.targetPath, `${source}.targetPath`),\n contentType: yield* expectString(file.contentType, `${source}.contentType`),\n managed: yield* expectBoolean(file.managed, `${source}.managed`),\n content: yield* fs.readFileString(path.join(artifactRoot, sourcePath)),\n ...(targetUsage === undefined ? {} : { targetUsage }),\n } satisfies ManagedFileDeclaration\n})\n\nconst expectManagedFilesContribution = Effect.fnUntraced(function* (value: unknown, source: string, artifactRoot: string) {\n const contribution = yield* expectRecord(value, source)\n const files = yield* expectArray(contribution.files, `${source}.files`)\n return {\n mode: yield* expectString(contribution.mode, `${source}.mode`),\n targetBasePath: yield* expectString(contribution.targetBasePath, `${source}.targetBasePath`),\n files: yield* Effect.forEach(files, (file, index) => expectManagedFileDeclaration(file, `${source}.files[${index}]`, artifactRoot)),\n } satisfies ManagedFilesContribution\n})\n\nfunction expectNamedRecord(record: JsonRecord, field: string, source: string): Effect.Effect<JsonRecord, HarnessError> {\n return expectRecord(record[field], `${source}.${field}`)\n}\n\nconst expectDeliveryModes = Effect.fnUntraced(function* (providerProfile: JsonRecord) {\n const deliveryModes = yield* expectNamedRecord(providerProfile, 'deliveryModes', 'provider profile')\n return {\n internalHarness: yield* expectNamedRecord(deliveryModes, 'internalHarness', 'provider profile.deliveryModes'),\n providerArtifactReference: yield* expectNamedRecord(deliveryModes, 'providerArtifactReference', 'provider profile.deliveryModes'),\n exportedHarness: yield* expectNamedRecord(deliveryModes, 'exportedHarness', 'provider profile.deliveryModes'),\n }\n})\n\nconst expectArtifactReferences = Effect.fnUntraced(function* (providerProfile: JsonRecord) {\n const artifactReferences = yield* expectNamedRecord(providerProfile, 'artifactReferences', 'provider profile')\n const references = yield* expectNamedRecord(artifactReferences, 'references', 'provider profile.artifactReferences')\n return {\n mode: yield* expectString(artifactReferences.mode, 'provider profile.artifactReferences.mode'),\n targetDelivery: yield* expectString(artifactReferences.targetDelivery, 'provider profile.artifactReferences.targetDelivery'),\n packageSurface: yield* expectStringArray(artifactReferences.packageSurface, 'provider profile.artifactReferences.packageSurface'),\n references,\n }\n})\n\nconst expectArtifactOnlyReferenceAudit = Effect.fnUntraced(function* (references: JsonRecord, artifactRoot: string) {\n const fs = yield* FileSystem.FileSystem\n const path = yield* Path.Path\n const entries = yield* Effect.forEach(Object.entries(references), ([id, value]) => Effect.gen(function* () {\n const reference = yield* expectRecord(value, `provider profile.artifactReferences.references.${id}`)\n const referencePath = yield* expectString(reference.path, `provider profile.artifactReferences.references.${id}.path`)\n const absolutePath = path.join(artifactRoot, referencePath)\n const available = yield* fs.exists(absolutePath)\n if (!available) {\n return yield* new HarnessError({ message: `artifact-only reference ${id} is missing from package artifact at ${referencePath}` })\n }\n return {\n available: true,\n id,\n path: referencePath,\n sourceEntry: yield* expectString(reference.sourceEntry, `provider profile.artifactReferences.references.${id}.sourceEntry`),\n targetDelivery: yield* expectString(reference.targetDelivery, `provider profile.artifactReferences.references.${id}.targetDelivery`),\n } satisfies ArtifactOnlyReferenceAuditEntry\n }))\n\n return {\n mode: 'artifact-only-reference-audit',\n references: entries,\n } satisfies ArtifactOnlyReferenceAudit\n})\n\nexport const discoverProvider = Effect.fnUntraced(function* (harness: string) {\n const path = yield* Path.Path\n const artifactRoot = path.resolve(harness)\n const providerProfileRelativePath = 'provider/effect-harness.provider.json'\n const providerProfilePath = path.join(artifactRoot, providerProfileRelativePath)\n const packageJsonPath = path.join(artifactRoot, 'package.json')\n\n const providerProfile = yield* readJson(providerProfilePath, decodeJsonRecord)\n const packageManifest = yield* readJson(packageJsonPath, decodeJsonRecord)\n const provider = yield* expectNamedRecord(providerProfile, 'provider', 'provider profile')\n const profiles = yield* expectNamedRecord(providerProfile, 'profiles', 'provider profile')\n const defaultProfile = yield* expectString(provider.defaultProfile, 'provider profile.provider.defaultProfile')\n const selectedProfile = yield* expectNamedRecord(profiles, defaultProfile, `provider profile.profiles.${defaultProfile}`)\n const contributions = yield* expectNamedRecord(selectedProfile, 'contributions', `provider profile.profiles.${defaultProfile}`)\n const managedSurfaces = yield* expectNamedRecord(selectedProfile, 'managedSurfaces', `provider profile.profiles.${defaultProfile}`)\n const sourceBoundary = yield* expectNamedRecord(selectedProfile, 'sourceBoundary', `provider profile.profiles.${defaultProfile}`)\n const selfConformance = yield* expectNamedRecord(providerProfile, 'selfConformance', 'provider profile')\n const packageBin = yield* expectNamedRecord(packageManifest, 'bin', 'package.json')\n const artifactOnlyReferences = yield* expectArtifactReferences(providerProfile)\n const deliveryModes = yield* expectDeliveryModes(providerProfile)\n const packageName = yield* expectString(packageManifest.name, 'package.json.name')\n const packageVersion = yield* expectString(packageManifest.version, 'package.json.version')\n const packageManager = optionalString(packageManifest.packageManager, 'unknown')\n const npmSelector = `${packageName}@${packageVersion}`\n const semanticContributions = {\n packageJson: yield* expectNamedRecord(contributions, 'packageJson', `provider profile.profiles.${defaultProfile}.contributions`),\n tsconfig: yield* expectNamedRecord(contributions, 'tsconfig', `provider profile.profiles.${defaultProfile}.contributions`),\n editorPolicy: yield* expectNamedRecord(contributions, 'editorPolicy', `provider profile.profiles.${defaultProfile}.contributions`),\n lintGuardrails: yield* expectNamedRecord(contributions, 'lintGuardrails', `provider profile.profiles.${defaultProfile}.contributions`),\n testPolicy: yield* expectNamedRecord(contributions, 'testPolicy', `provider profile.profiles.${defaultProfile}.contributions`),\n verificationPolicy: yield* expectNamedRecord(contributions, 'verificationPolicy', `provider profile.profiles.${defaultProfile}.contributions`),\n } satisfies SemanticContributions\n\n return {\n schemaVersion: 1,\n artifactRoot,\n providerProfilePath,\n providerProfileRelativePath,\n packageArtifactIdentity: {\n packageName,\n packageVersion,\n packageManager,\n artifactRoot,\n packageJsonPath,\n providerProfilePath,\n npmSelector,\n neutralDiscoveryCommand: `npx --yes --package ${npmSelector} effect-harness provider-discover`,\n invocationFailureClassification: {\n sameNameCwdShortCircuit: {\n classification: 'npm-invocation-failure',\n code: 'npm-same-name-cwd-short-circuit',\n providerDiscoveryStarted: false,\n },\n },\n },\n packageLocator: {\n packageName,\n packageVersion,\n binName: 'effect-harness',\n binPath: yield* expectString(packageBin['effect-harness'], 'package.json.bin.effect-harness'),\n discoveryCommand: 'npx --yes @sayoriqwq/effect-harness provider-discover',\n packageFiles: yield* expectStringArray(packageManifest.files, 'package.json.files'),\n },\n provider: {\n id: yield* expectString(provider.id, 'provider profile.provider.id'),\n contractVersion: yield* expectString(provider.contractVersion, 'provider profile.provider.contractVersion'),\n providerVersion: yield* expectString(provider.providerVersion, 'provider profile.provider.providerVersion'),\n defaultProfile,\n },\n selectedProfile: defaultProfile,\n discovery: {\n mode: 'provider-discovery',\n consumer: 'prelude',\n profileSource: providerProfileRelativePath,\n targetLifecycleOwner: yield* expectString(selfConformance.lifecycleOwner, 'provider profile.selfConformance.lifecycleOwner'),\n },\n deliveryModes,\n semanticContributions,\n targetManagedSurfaces: {\n targetReceives: yield* expectStringArray(managedSurfaces.targetReceives, `provider profile.profiles.${defaultProfile}.managedSurfaces.targetReceives`),\n targetDoesNotReceive: yield* expectStringArray(managedSurfaces.targetDoesNotReceive, `provider profile.profiles.${defaultProfile}.managedSurfaces.targetDoesNotReceive`),\n documentationBundle: yield* expectManagedFilesContribution(contributions.documentationBundle, `provider profile.profiles.${defaultProfile}.contributions.documentationBundle`, artifactRoot),\n snippets: yield* expectManagedFilesContribution(contributions.snippets, `provider profile.profiles.${defaultProfile}.contributions.snippets`, artifactRoot),\n contributions: semanticContributions,\n },\n artifactOnlyReferences,\n artifactOnlyReferenceAudit: yield* expectArtifactOnlyReferenceAudit(artifactOnlyReferences.references, artifactRoot),\n sourceIdentities: {\n defaultSourceEntry: yield* expectString(selectedProfile.sourceEntry, `provider profile.profiles.${defaultProfile}.sourceEntry`),\n sourceEntries: yield* expectStringArray(selectedProfile.sourceEntries, `provider profile.profiles.${defaultProfile}.sourceEntries`),\n sourceBoundary: {\n providerRepoInternal: yield* expectBoolean(sourceBoundary.providerRepoInternal, `provider profile.profiles.${defaultProfile}.sourceBoundary.providerRepoInternal`),\n targetDelivery: yield* expectString(sourceBoundary.targetDelivery, `provider profile.profiles.${defaultProfile}.sourceBoundary.targetDelivery`),\n targetMustNotReceive: yield* expectStringArray(sourceBoundary.targetMustNotReceive, `provider profile.profiles.${defaultProfile}.sourceBoundary.targetMustNotReceive`),\n allowedTargetSourceIdentity: yield* expectStringArray(sourceBoundary.allowedTargetSourceIdentity, `provider profile.profiles.${defaultProfile}.sourceBoundary.allowedTargetSourceIdentity`),\n },\n providerSourceEntries: yield* expectNamedRecord(providerProfile, 'sourceEntries', 'provider profile'),\n artifactReferences: artifactOnlyReferences.references,\n },\n internalHarnessSurfaces: deliveryModes.internalHarness,\n } satisfies ProviderDiscovery\n})\n"]}
@@ -465,12 +465,18 @@ function assertArtifactReference(errors, references, expected) {
465
465
  assertStringValue(errors, stringField(errors, reference, 'targetDelivery', `provider profile.artifactReferences.references.${expected.id}`), 'artifact-only', `provider profile.artifactReferences.references.${expected.id}.targetDelivery`);
466
466
  }
467
467
  function assertArtifactReferencesContract(errors, providerProfile, packageManifest) {
468
+ assertStringValue(errors, stringField(errors, packageManifest, 'main', 'package.json'), 'dist/src/index.js', 'package.json.main');
469
+ assertStringValue(errors, stringField(errors, packageManifest, 'types', 'package.json'), 'dist/src/index.d.ts', 'package.json.types');
470
+ const packageExports = recordField(errors, packageManifest, 'exports', 'package.json');
471
+ const rootExport = recordField(errors, packageExports, '.', 'package.json.exports');
472
+ assertStringValue(errors, stringField(errors, rootExport, 'import', 'package.json.exports["."]'), './dist/src/index.js', 'package.json.exports["."].import');
473
+ assertStringValue(errors, stringField(errors, rootExport, 'types', 'package.json.exports["."]'), './dist/src/index.d.ts', 'package.json.exports["."].types');
468
474
  const artifactReferences = recordField(errors, providerProfile, 'artifactReferences', 'provider profile');
469
475
  assertStringValue(errors, stringField(errors, artifactReferences, 'mode', 'provider profile.artifactReferences'), 'provider-artifact-reference', 'provider profile.artifactReferences.mode');
470
476
  assertStringValue(errors, stringField(errors, artifactReferences, 'targetDelivery', 'provider profile.artifactReferences'), 'identity-only', 'provider profile.artifactReferences.targetDelivery');
471
477
  const packageFiles = arrayField(errors, packageManifest, 'files', 'package.json');
472
478
  const packageSurface = arrayField(errors, artifactReferences, 'packageSurface', 'provider profile.artifactReferences');
473
- for (const path of ['provider', 'harness', 'repos', 'repos/effect.subtree.json', 'repos/tsgo.subtree.json']) {
479
+ for (const path of ['dist', 'provider', 'harness', 'repos', 'repos/effect.subtree.json', 'repos/tsgo.subtree.json']) {
474
480
  assertArrayContainsString(errors, packageFiles, path, 'package.json.files');
475
481
  assertArrayContainsString(errors, packageSurface, path, 'provider profile.artifactReferences.packageSurface');
476
482
  }
@@ -539,14 +545,14 @@ export const verifyProviderProfileContract = Effect.fnUntraced(function* (errors
539
545
  assertProviderSourceEntry(errors, sourceEntries, {
540
546
  contractPath: 'repos/effect.subtree.json',
541
547
  id: 'effect-official-source',
542
- updateCommand: 'partita pin update --contract repos/effect.subtree.json --name effect --prefix repos/effect --dry-run',
543
- verifyCommand: 'partita pin verify --contract repos/effect.subtree.json --name effect --prefix repos/effect',
548
+ updateCommand: 'npx --yes @sayoriqwq/partita pin update --contract repos/effect.subtree.json --name effect --prefix repos/effect --dry-run',
549
+ verifyCommand: 'npx --yes @sayoriqwq/partita pin verify --contract repos/effect.subtree.json --name effect --prefix repos/effect',
544
550
  });
545
551
  assertProviderSourceEntry(errors, sourceEntries, {
546
552
  contractPath: 'repos/tsgo.subtree.json',
547
553
  id: 'tsgo-official-source',
548
- updateCommand: 'partita pin update --contract repos/tsgo.subtree.json --name tsgo --prefix repos/tsgo --dry-run',
549
- verifyCommand: 'partita pin verify --contract repos/tsgo.subtree.json --name tsgo --prefix repos/tsgo',
554
+ updateCommand: 'npx --yes @sayoriqwq/partita pin update --contract repos/tsgo.subtree.json --name tsgo --prefix repos/tsgo --dry-run',
555
+ verifyCommand: 'npx --yes @sayoriqwq/partita pin verify --contract repos/tsgo.subtree.json --name tsgo --prefix repos/tsgo',
550
556
  });
551
557
  assertPartitaSubtreeContract(errors, effectContract, {
552
558
  anchor: 'repos/effect/LLMS.md',
@@ -556,8 +562,8 @@ export const verifyProviderProfileContract = Effect.fnUntraced(function* (errors
556
562
  prefix: 'repos/effect',
557
563
  repository: 'https://github.com/Effect-TS/effect-smol',
558
564
  route: 'harness/effect-routes.md',
559
- updateCommand: 'partita pin update --contract repos/effect.subtree.json --name effect --prefix repos/effect --dry-run',
560
- verifyCommand: 'partita pin verify --contract repos/effect.subtree.json --name effect --prefix repos/effect',
565
+ updateCommand: 'npx --yes @sayoriqwq/partita pin update --contract repos/effect.subtree.json --name effect --prefix repos/effect --dry-run',
566
+ verifyCommand: 'npx --yes @sayoriqwq/partita pin verify --contract repos/effect.subtree.json --name effect --prefix repos/effect',
561
567
  });
562
568
  assertPartitaSubtreeContract(errors, tsgoContract, {
563
569
  anchor: 'repos/tsgo/README.md',
@@ -567,8 +573,8 @@ export const verifyProviderProfileContract = Effect.fnUntraced(function* (errors
567
573
  prefix: 'repos/tsgo',
568
574
  repository: 'https://github.com/Effect-TS/tsgo',
569
575
  route: 'harness/tsgo-routes.md',
570
- updateCommand: 'partita pin update --contract repos/tsgo.subtree.json --name tsgo --prefix repos/tsgo --dry-run',
571
- verifyCommand: 'partita pin verify --contract repos/tsgo.subtree.json --name tsgo --prefix repos/tsgo',
576
+ updateCommand: 'npx --yes @sayoriqwq/partita pin update --contract repos/tsgo.subtree.json --name tsgo --prefix repos/tsgo --dry-run',
577
+ verifyCommand: 'npx --yes @sayoriqwq/partita pin verify --contract repos/tsgo.subtree.json --name tsgo --prefix repos/tsgo',
572
578
  });
573
579
  const providerRecord = recordField(errors, providerProfile, 'providerRecord', 'provider profile');
574
580
  const sourceDelivery = recordField(errors, providerRecord, 'sourceDelivery', 'provider profile.providerRecord');
@@ -641,7 +647,7 @@ export const verifyProviderProfileContract = Effect.fnUntraced(function* (errors
641
647
  },
642
648
  {
643
649
  id: 'discovery',
644
- requiredKeywords: ['Provider Discovery', 'provider-discover', 'Prelude', 'target-managed surfaces', 'artifact-only', 'internal harness'],
650
+ requiredKeywords: ['Provider Discovery', 'provider-discover', 'Prelude', 'target-managed surfaces', 'artifact-only', 'internal harness', 'npm selects the artifact', 'effect-harness owns desired semantics', 'Prelude projects the artifact', 'Prelude lifecycle commands', 'npm same-name cwd short-circuit'],
645
651
  sourcePath: 'provider/docs/discovery.md',
646
652
  targetPath: 'discovery.md',
647
653
  },