@sayoriqwq/effect-harness 0.0.5 → 0.1.1

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 (103) hide show
  1. package/README.md +9 -77
  2. package/diagnostics/effect-routes.md +6 -0
  3. package/diagnostics/index.md +10 -0
  4. package/diagnostics/tsgo-routes.md +5 -0
  5. package/dist/src/eslint.d.ts +57 -0
  6. package/dist/src/eslint.js +42 -0
  7. package/dist/src/eslint.js.map +1 -0
  8. package/dist/src/index.d.ts +2 -8
  9. package/dist/src/index.js +2 -15
  10. package/dist/src/index.js.map +1 -1
  11. package/dist/src/prelude.d.ts +6 -0
  12. package/dist/src/prelude.js +161 -0
  13. package/dist/src/prelude.js.map +1 -0
  14. package/package.json +18 -17
  15. package/prelude-assets/effect/managed/docs/diagnostics.md +6 -0
  16. package/prelude-assets/effect/managed/docs/editor-policy.md +5 -0
  17. package/prelude-assets/effect/managed/docs/effect-code.md +5 -0
  18. package/prelude-assets/effect/managed/docs/index.md +14 -0
  19. package/prelude-assets/effect/managed/docs/managed-surfaces.md +5 -0
  20. package/prelude-assets/effect/managed/docs/package-config.md +20 -0
  21. package/prelude-assets/effect/managed/docs/quality-policy.md +5 -0
  22. package/prelude-assets/effect/managed/docs/source-identity.md +5 -0
  23. package/prelude-assets/guidance/eslint.md +15 -0
  24. package/HARNESS.md +0 -66
  25. package/dist/bin/effect-harness.d.ts +0 -2
  26. package/dist/bin/effect-harness.js +0 -23
  27. package/dist/bin/effect-harness.js.map +0 -1
  28. package/dist/src/cli/Main.d.ts +0 -7
  29. package/dist/src/cli/Main.js +0 -45
  30. package/dist/src/cli/Main.js.map +0 -1
  31. package/dist/src/harness/Errors.d.ts +0 -24
  32. package/dist/src/harness/Errors.js +0 -26
  33. package/dist/src/harness/Errors.js.map +0 -1
  34. package/dist/src/harness/Guardrails.d.ts +0 -7
  35. package/dist/src/harness/Guardrails.js +0 -50
  36. package/dist/src/harness/Guardrails.js.map +0 -1
  37. package/dist/src/harness/Model.d.ts +0 -52
  38. package/dist/src/harness/Model.js +0 -170
  39. package/dist/src/harness/Model.js.map +0 -1
  40. package/dist/src/harness/ModuleSources.d.ts +0 -5
  41. package/dist/src/harness/ModuleSources.js +0 -47
  42. package/dist/src/harness/ModuleSources.js.map +0 -1
  43. package/dist/src/harness/ProviderDiscovery.d.ts +0 -255
  44. package/dist/src/harness/ProviderDiscovery.js +0 -242
  45. package/dist/src/harness/ProviderDiscovery.js.map +0 -1
  46. package/dist/src/harness/SourcePin.d.ts +0 -4
  47. package/dist/src/harness/SourcePin.js +0 -214
  48. package/dist/src/harness/SourcePin.js.map +0 -1
  49. package/dist/src/harness/verify/JsonFields.d.ts +0 -1
  50. package/dist/src/harness/verify/JsonFields.js +0 -4
  51. package/dist/src/harness/verify/JsonFields.js.map +0 -1
  52. package/dist/src/harness/verify/Pipeline.d.ts +0 -7
  53. package/dist/src/harness/verify/Pipeline.js +0 -55
  54. package/dist/src/harness/verify/Pipeline.js.map +0 -1
  55. package/dist/src/harness/verify/ProviderProfile.d.ts +0 -3
  56. package/dist/src/harness/verify/ProviderProfile.js +0 -732
  57. package/dist/src/harness/verify/ProviderProfile.js.map +0 -1
  58. package/dist/src/harness/verify/ProviderRepository.d.ts +0 -4
  59. package/dist/src/harness/verify/ProviderRepository.js +0 -127
  60. package/dist/src/harness/verify/ProviderRepository.js.map +0 -1
  61. package/dist/src/harness/verify/Tsgo.d.ts +0 -3
  62. package/dist/src/harness/verify/Tsgo.js +0 -166
  63. package/dist/src/harness/verify/Tsgo.js.map +0 -1
  64. package/dist/src/harness/verify/TsgoMetadata.d.ts +0 -4
  65. package/dist/src/harness/verify/TsgoMetadata.js +0 -50
  66. package/dist/src/harness/verify/TsgoMetadata.js.map +0 -1
  67. package/dist/src/harness/verify/TsgoPolicy.d.ts +0 -208
  68. package/dist/src/harness/verify/TsgoPolicy.js +0 -143
  69. package/dist/src/harness/verify/TsgoPolicy.js.map +0 -1
  70. package/dist/src/harness/verify/TsgoSuppressions.d.ts +0 -2
  71. package/dist/src/harness/verify/TsgoSuppressions.js +0 -24
  72. package/dist/src/harness/verify/TsgoSuppressions.js.map +0 -1
  73. package/dist/src/harness/verify/VerifyStage.d.ts +0 -62
  74. package/dist/src/harness/verify/VerifyStage.js +0 -85
  75. package/dist/src/harness/verify/VerifyStage.js.map +0 -1
  76. package/dist/src/platform/Json.d.ts +0 -4
  77. package/dist/src/platform/Json.js +0 -16
  78. package/dist/src/platform/Json.js.map +0 -1
  79. package/dist/src/platform/Process.d.ts +0 -6
  80. package/dist/src/platform/Process.js +0 -35
  81. package/dist/src/platform/Process.js.map +0 -1
  82. package/harness/code.md +0 -83
  83. package/harness/diagnostic-layers.md +0 -94
  84. package/harness/effect-routes.md +0 -50
  85. package/harness/feedback-loop.md +0 -156
  86. package/harness/index.md +0 -83
  87. package/harness/offcial-guide.md +0 -50
  88. package/harness/offcial-migrate.md +0 -220
  89. package/harness/source.md +0 -91
  90. package/harness/tsgo-routes.md +0 -58
  91. package/harness/tsgo.md +0 -241
  92. package/provider/docs/diagnostics.md +0 -48
  93. package/provider/docs/discovery.md +0 -130
  94. package/provider/docs/editor-policy.md +0 -55
  95. package/provider/docs/effect-code.md +0 -41
  96. package/provider/docs/index.md +0 -48
  97. package/provider/docs/managed-surfaces.md +0 -51
  98. package/provider/docs/package-config.md +0 -71
  99. package/provider/docs/quality-policy.md +0 -68
  100. package/provider/docs/source-identity.md +0 -48
  101. package/provider/effect-harness.provider.json +0 -1021
  102. package/provider/index.md +0 -193
  103. package/provider/snippets/agents.md +0 -34
@@ -1,47 +0,0 @@
1
- import * as ts from 'typescript';
2
- function scriptKind(file) {
3
- if (file.endsWith('.tsx')) {
4
- return ts.ScriptKind.TSX;
5
- }
6
- if (file.endsWith('.jsx')) {
7
- return ts.ScriptKind.JSX;
8
- }
9
- return ts.ScriptKind.TS;
10
- }
11
- function lineOf(sourceFile, node) {
12
- return sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).line + 1;
13
- }
14
- function stringLiteralValue(node) {
15
- return node !== undefined && ts.isStringLiteral(node) ? node.text : undefined;
16
- }
17
- function addSource(sourceFile, node, sources) {
18
- const source = stringLiteralValue(node);
19
- if (source === undefined || node === undefined) {
20
- return;
21
- }
22
- sources.push({
23
- line: lineOf(sourceFile, node),
24
- source,
25
- });
26
- }
27
- function walk(sourceFile, node, sources) {
28
- if (ts.isImportDeclaration(node) || ts.isExportDeclaration(node)) {
29
- addSource(sourceFile, node.moduleSpecifier, sources);
30
- }
31
- else if (ts.isCallExpression(node)) {
32
- if (node.expression.kind === ts.SyntaxKind.ImportKeyword) {
33
- addSource(sourceFile, node.arguments[0], sources);
34
- }
35
- else if (ts.isIdentifier(node.expression) && node.expression.text === 'require') {
36
- addSource(sourceFile, node.arguments[0], sources);
37
- }
38
- }
39
- ts.forEachChild(node, child => walk(sourceFile, child, sources));
40
- }
41
- export function moduleSources(file, text) {
42
- const sourceFile = ts.createSourceFile(file, text, ts.ScriptTarget.Latest, true, scriptKind(file));
43
- const sources = [];
44
- walk(sourceFile, sourceFile, sources);
45
- return sources;
46
- }
47
- //# sourceMappingURL=ModuleSources.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ModuleSources.js","sourceRoot":"","sources":["../../../src/harness/ModuleSources.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAA;AAOhC,SAAS,UAAU,CAAC,IAAY;IAC9B,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAC1B,OAAO,EAAE,CAAC,UAAU,CAAC,GAAG,CAAA;IAC1B,CAAC;IACD,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAC1B,OAAO,EAAE,CAAC,UAAU,CAAC,GAAG,CAAA;IAC1B,CAAC;IACD,OAAO,EAAE,CAAC,UAAU,CAAC,EAAE,CAAA;AACzB,CAAC;AAED,SAAS,MAAM,CAAC,UAAyB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,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YAChF,SAAS,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAA;QACnD,CAAC;IACH,CAAC;IAED,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAA;AAClE,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,IAAY,EAAE,IAAY;IACtD,MAAM,UAAU,GAAG,EAAE,CAAC,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC,CAAA;IAClG,MAAM,OAAO,GAAwB,EAAE,CAAA;IACvC,IAAI,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;IACrC,OAAO,OAAO,CAAA;AAChB,CAAC","sourcesContent":["import * as ts from 'typescript'\n\nexport interface ModuleSource {\n readonly line: number\n readonly source: string\n}\n\nfunction scriptKind(file: string): ts.ScriptKind {\n if (file.endsWith('.tsx')) {\n return ts.ScriptKind.TSX\n }\n if (file.endsWith('.jsx')) {\n return ts.ScriptKind.JSX\n }\n return ts.ScriptKind.TS\n}\n\nfunction lineOf(sourceFile: ts.SourceFile, node: ts.Node): number {\n return sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).line + 1\n}\n\nfunction stringLiteralValue(node: ts.Node | undefined): string | undefined {\n return node !== undefined && ts.isStringLiteral(node) ? node.text : undefined\n}\n\nfunction addSource(\n sourceFile: ts.SourceFile,\n node: ts.Node | undefined,\n sources: Array<ModuleSource>,\n): void {\n const source = stringLiteralValue(node)\n if (source === undefined || node === undefined) {\n return\n }\n\n sources.push({\n line: lineOf(sourceFile, node),\n source,\n })\n}\n\nfunction walk(sourceFile: ts.SourceFile, node: ts.Node, sources: Array<ModuleSource>): void {\n if (ts.isImportDeclaration(node) || ts.isExportDeclaration(node)) {\n addSource(sourceFile, node.moduleSpecifier, sources)\n }\n else if (ts.isCallExpression(node)) {\n if (node.expression.kind === ts.SyntaxKind.ImportKeyword) {\n addSource(sourceFile, node.arguments[0], sources)\n }\n else if (ts.isIdentifier(node.expression) && node.expression.text === 'require') {\n addSource(sourceFile, node.arguments[0], sources)\n }\n }\n\n ts.forEachChild(node, child => walk(sourceFile, child, sources))\n}\n\nexport function moduleSources(file: string, text: string): ReadonlyArray<ModuleSource> {\n const sourceFile = ts.createSourceFile(file, text, ts.ScriptTarget.Latest, true, scriptKind(file))\n const sources: Array<ModuleSource> = []\n walk(sourceFile, sourceFile, sources)\n return sources\n}\n"]}
@@ -1,255 +0,0 @@
1
- import { Effect, FileSystem, Path } from 'effect';
2
- import { HarnessError } from './Errors.ts';
3
- type JsonRecord = Record<string, unknown>;
4
- interface ManagedFileDeclaration {
5
- readonly id: string;
6
- readonly sourcePath: string;
7
- readonly targetPath: string;
8
- readonly contentType: string;
9
- readonly managed: boolean;
10
- readonly content: string;
11
- readonly targetUsage?: string;
12
- }
13
- interface ManagedFilesContribution {
14
- readonly mode: string;
15
- readonly targetBasePath: string;
16
- readonly files: ReadonlyArray<ManagedFileDeclaration>;
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;
56
- export interface ProviderDiscovery {
57
- readonly schemaVersion: 1;
58
- readonly artifactRoot: string;
59
- readonly providerProfilePath: string;
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
- };
74
- readonly packageLocator: {
75
- readonly packageName: string;
76
- readonly packageVersion: string;
77
- readonly binName: 'effect-harness';
78
- readonly binPath: string;
79
- readonly discoveryCommand: string;
80
- readonly packageFiles: ReadonlyArray<string>;
81
- };
82
- readonly provider: {
83
- readonly id: string;
84
- readonly contractVersion: string;
85
- readonly providerVersion: string;
86
- readonly defaultProfile: string;
87
- };
88
- readonly selectedProfile: string;
89
- readonly discovery: {
90
- readonly mode: 'provider-discovery';
91
- readonly consumer: 'prelude';
92
- readonly profileSource: 'provider/effect-harness.provider.json';
93
- readonly targetLifecycleOwner: string;
94
- };
95
- readonly deliveryModes: {
96
- readonly internalHarness: JsonRecord;
97
- readonly providerArtifactReference: JsonRecord;
98
- readonly exportedHarness: JsonRecord;
99
- };
100
- readonly semanticContributions: SemanticContributions;
101
- readonly targetManagedSurfaces: {
102
- readonly targetReceives: ReadonlyArray<string>;
103
- readonly targetDoesNotReceive: ReadonlyArray<string>;
104
- readonly documentationBundle: ManagedFilesContribution;
105
- readonly snippets: ManagedFilesContribution;
106
- readonly contributions: SemanticContributions;
107
- };
108
- readonly artifactOnlyReferences: {
109
- readonly mode: string;
110
- readonly targetDelivery: string;
111
- readonly packageSurface: ReadonlyArray<string>;
112
- readonly references: JsonRecord;
113
- };
114
- readonly artifactOnlyReferenceAudit: ArtifactOnlyReferenceAudit;
115
- readonly sourceIdentities: {
116
- readonly defaultSourceEntry: string;
117
- readonly sourceEntries: ReadonlyArray<string>;
118
- readonly sourceBoundary: {
119
- readonly providerRepoInternal: boolean;
120
- readonly targetDelivery: string;
121
- readonly targetMustNotReceive: ReadonlyArray<string>;
122
- readonly allowedTargetSourceIdentity: ReadonlyArray<string>;
123
- };
124
- readonly providerSourceEntries: JsonRecord;
125
- readonly artifactReferences: JsonRecord;
126
- };
127
- readonly internalHarnessSurfaces: JsonRecord;
128
- }
129
- export declare function resolvePackageArtifactRoot(entrypoint: string): string;
130
- export declare function classifyProviderDiscoveryFailure(input: ProviderDiscoveryFailureInput): ProviderDiscoveryFailure;
131
- export declare const discoverProvider: (harness: string) => Effect.Effect<{
132
- schemaVersion: 1;
133
- artifactRoot: string;
134
- providerProfilePath: string;
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
- };
153
- packageLocator: {
154
- packageName: string;
155
- packageVersion: string;
156
- binName: "effect-harness";
157
- binPath: string;
158
- discoveryCommand: string;
159
- packageFiles: string[];
160
- };
161
- provider: {
162
- id: string;
163
- contractVersion: string;
164
- providerVersion: string;
165
- defaultProfile: string;
166
- };
167
- selectedProfile: string;
168
- discovery: {
169
- mode: "provider-discovery";
170
- consumer: "prelude";
171
- profileSource: "provider/effect-harness.provider.json";
172
- targetLifecycleOwner: string;
173
- };
174
- deliveryModes: {
175
- internalHarness: JsonRecord;
176
- providerArtifactReference: JsonRecord;
177
- exportedHarness: JsonRecord;
178
- };
179
- semanticContributions: {
180
- packageJson: JsonRecord;
181
- tsconfig: JsonRecord;
182
- editorPolicy: JsonRecord;
183
- lintGuardrails: JsonRecord;
184
- testPolicy: JsonRecord;
185
- verificationPolicy: JsonRecord;
186
- };
187
- targetManagedSurfaces: {
188
- targetReceives: string[];
189
- targetDoesNotReceive: string[];
190
- documentationBundle: {
191
- mode: string;
192
- targetBasePath: string;
193
- files: {
194
- targetUsage?: string;
195
- id: string;
196
- sourcePath: string;
197
- targetPath: string;
198
- contentType: string;
199
- managed: boolean;
200
- content: string;
201
- }[];
202
- };
203
- snippets: {
204
- mode: string;
205
- targetBasePath: string;
206
- files: {
207
- targetUsage?: string;
208
- id: string;
209
- sourcePath: string;
210
- targetPath: string;
211
- contentType: string;
212
- managed: boolean;
213
- content: string;
214
- }[];
215
- };
216
- contributions: {
217
- packageJson: JsonRecord;
218
- tsconfig: JsonRecord;
219
- editorPolicy: JsonRecord;
220
- lintGuardrails: JsonRecord;
221
- testPolicy: JsonRecord;
222
- verificationPolicy: JsonRecord;
223
- };
224
- };
225
- artifactOnlyReferences: {
226
- mode: string;
227
- targetDelivery: string;
228
- packageSurface: string[];
229
- references: JsonRecord;
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
- };
241
- sourceIdentities: {
242
- defaultSourceEntry: string;
243
- sourceEntries: string[];
244
- sourceBoundary: {
245
- providerRepoInternal: boolean;
246
- targetDelivery: string;
247
- targetMustNotReceive: string[];
248
- allowedTargetSourceIdentity: string[];
249
- };
250
- providerSourceEntries: JsonRecord;
251
- artifactReferences: JsonRecord;
252
- };
253
- internalHarnessSurfaces: JsonRecord;
254
- }, HarnessError | import("effect/PlatformError").PlatformError, FileSystem.FileSystem | Path.Path>;
255
- export {};
@@ -1,242 +0,0 @@
1
- import { Effect, FileSystem, Path } from 'effect';
2
- import { readJson } from "../platform/Json.js";
3
- import { HarnessError } from "./Errors.js";
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
- }
38
- function decodeJsonRecord(value, source) {
39
- return isRecord(value)
40
- ? Effect.succeed(value)
41
- : Effect.fail(new HarnessError({ message: `${source} must be a JSON object` }));
42
- }
43
- function expectRecord(value, source) {
44
- return isRecord(value)
45
- ? Effect.succeed(value)
46
- : Effect.fail(new HarnessError({ message: `${source} must be a JSON object` }));
47
- }
48
- function expectString(value, source) {
49
- return typeof value === 'string'
50
- ? Effect.succeed(value)
51
- : Effect.fail(new HarnessError({ message: `${source} must be a string` }));
52
- }
53
- function optionalString(value, fallback) {
54
- return typeof value === 'string' ? value : fallback;
55
- }
56
- function expectBoolean(value, source) {
57
- return typeof value === 'boolean'
58
- ? Effect.succeed(value)
59
- : Effect.fail(new HarnessError({ message: `${source} must be a boolean` }));
60
- }
61
- function expectArray(value, source) {
62
- return Array.isArray(value)
63
- ? Effect.succeed(value)
64
- : Effect.fail(new HarnessError({ message: `${source} must be an array` }));
65
- }
66
- const expectStringArray = Effect.fnUntraced(function* (value, source) {
67
- const array = yield* expectArray(value, source);
68
- return yield* Effect.forEach(array, (entry, index) => expectString(entry, `${source}[${index}]`));
69
- });
70
- const expectManagedFileDeclaration = Effect.fnUntraced(function* (value, source, artifactRoot) {
71
- const file = yield* expectRecord(value, source);
72
- const path = yield* Path.Path;
73
- const fs = yield* FileSystem.FileSystem;
74
- const sourcePath = yield* expectString(file.sourcePath, `${source}.sourcePath`);
75
- const targetUsage = file.targetUsage === undefined
76
- ? undefined
77
- : yield* expectString(file.targetUsage, `${source}.targetUsage`);
78
- return {
79
- id: yield* expectString(file.id, `${source}.id`),
80
- sourcePath,
81
- targetPath: yield* expectString(file.targetPath, `${source}.targetPath`),
82
- contentType: yield* expectString(file.contentType, `${source}.contentType`),
83
- managed: yield* expectBoolean(file.managed, `${source}.managed`),
84
- content: yield* fs.readFileString(path.join(artifactRoot, sourcePath)),
85
- ...(targetUsage === undefined ? {} : { targetUsage }),
86
- };
87
- });
88
- const expectManagedFilesContribution = Effect.fnUntraced(function* (value, source, artifactRoot) {
89
- const contribution = yield* expectRecord(value, source);
90
- const files = yield* expectArray(contribution.files, `${source}.files`);
91
- return {
92
- mode: yield* expectString(contribution.mode, `${source}.mode`),
93
- targetBasePath: yield* expectString(contribution.targetBasePath, `${source}.targetBasePath`),
94
- files: yield* Effect.forEach(files, (file, index) => expectManagedFileDeclaration(file, `${source}.files[${index}]`, artifactRoot)),
95
- };
96
- });
97
- function expectNamedRecord(record, field, source) {
98
- return expectRecord(record[field], `${source}.${field}`);
99
- }
100
- const expectDeliveryModes = Effect.fnUntraced(function* (providerProfile) {
101
- const deliveryModes = yield* expectNamedRecord(providerProfile, 'deliveryModes', 'provider profile');
102
- return {
103
- internalHarness: yield* expectNamedRecord(deliveryModes, 'internalHarness', 'provider profile.deliveryModes'),
104
- providerArtifactReference: yield* expectNamedRecord(deliveryModes, 'providerArtifactReference', 'provider profile.deliveryModes'),
105
- exportedHarness: yield* expectNamedRecord(deliveryModes, 'exportedHarness', 'provider profile.deliveryModes'),
106
- };
107
- });
108
- const expectArtifactReferences = Effect.fnUntraced(function* (providerProfile) {
109
- const artifactReferences = yield* expectNamedRecord(providerProfile, 'artifactReferences', 'provider profile');
110
- const references = yield* expectNamedRecord(artifactReferences, 'references', 'provider profile.artifactReferences');
111
- return {
112
- mode: yield* expectString(artifactReferences.mode, 'provider profile.artifactReferences.mode'),
113
- targetDelivery: yield* expectString(artifactReferences.targetDelivery, 'provider profile.artifactReferences.targetDelivery'),
114
- packageSurface: yield* expectStringArray(artifactReferences.packageSurface, 'provider profile.artifactReferences.packageSurface'),
115
- references,
116
- };
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
- });
142
- export const discoverProvider = Effect.fnUntraced(function* (harness) {
143
- const path = yield* Path.Path;
144
- const artifactRoot = path.resolve(harness);
145
- const providerProfileRelativePath = 'provider/effect-harness.provider.json';
146
- const providerProfilePath = path.join(artifactRoot, providerProfileRelativePath);
147
- const packageJsonPath = path.join(artifactRoot, 'package.json');
148
- const providerProfile = yield* readJson(providerProfilePath, decodeJsonRecord);
149
- const packageManifest = yield* readJson(packageJsonPath, decodeJsonRecord);
150
- const provider = yield* expectNamedRecord(providerProfile, 'provider', 'provider profile');
151
- const profiles = yield* expectNamedRecord(providerProfile, 'profiles', 'provider profile');
152
- const defaultProfile = yield* expectString(provider.defaultProfile, 'provider profile.provider.defaultProfile');
153
- const selectedProfile = yield* expectNamedRecord(profiles, defaultProfile, `provider profile.profiles.${defaultProfile}`);
154
- const contributions = yield* expectNamedRecord(selectedProfile, 'contributions', `provider profile.profiles.${defaultProfile}`);
155
- const managedSurfaces = yield* expectNamedRecord(selectedProfile, 'managedSurfaces', `provider profile.profiles.${defaultProfile}`);
156
- const sourceBoundary = yield* expectNamedRecord(selectedProfile, 'sourceBoundary', `provider profile.profiles.${defaultProfile}`);
157
- const selfConformance = yield* expectNamedRecord(providerProfile, 'selfConformance', 'provider profile');
158
- const packageBin = yield* expectNamedRecord(packageManifest, 'bin', 'package.json');
159
- const artifactOnlyReferences = yield* expectArtifactReferences(providerProfile);
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
- };
173
- return {
174
- schemaVersion: 1,
175
- artifactRoot,
176
- providerProfilePath,
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
- },
195
- packageLocator: {
196
- packageName,
197
- packageVersion,
198
- binName: 'effect-harness',
199
- binPath: yield* expectString(packageBin['effect-harness'], 'package.json.bin.effect-harness'),
200
- discoveryCommand: 'npx --yes @sayoriqwq/effect-harness provider-discover',
201
- packageFiles: yield* expectStringArray(packageManifest.files, 'package.json.files'),
202
- },
203
- provider: {
204
- id: yield* expectString(provider.id, 'provider profile.provider.id'),
205
- contractVersion: yield* expectString(provider.contractVersion, 'provider profile.provider.contractVersion'),
206
- providerVersion: yield* expectString(provider.providerVersion, 'provider profile.provider.providerVersion'),
207
- defaultProfile,
208
- },
209
- selectedProfile: defaultProfile,
210
- discovery: {
211
- mode: 'provider-discovery',
212
- consumer: 'prelude',
213
- profileSource: providerProfileRelativePath,
214
- targetLifecycleOwner: yield* expectString(selfConformance.lifecycleOwner, 'provider profile.selfConformance.lifecycleOwner'),
215
- },
216
- deliveryModes,
217
- semanticContributions,
218
- targetManagedSurfaces: {
219
- targetReceives: yield* expectStringArray(managedSurfaces.targetReceives, `provider profile.profiles.${defaultProfile}.managedSurfaces.targetReceives`),
220
- targetDoesNotReceive: yield* expectStringArray(managedSurfaces.targetDoesNotReceive, `provider profile.profiles.${defaultProfile}.managedSurfaces.targetDoesNotReceive`),
221
- documentationBundle: yield* expectManagedFilesContribution(contributions.documentationBundle, `provider profile.profiles.${defaultProfile}.contributions.documentationBundle`, artifactRoot),
222
- snippets: yield* expectManagedFilesContribution(contributions.snippets, `provider profile.profiles.${defaultProfile}.contributions.snippets`, artifactRoot),
223
- contributions: semanticContributions,
224
- },
225
- artifactOnlyReferences,
226
- artifactOnlyReferenceAudit: yield* expectArtifactOnlyReferenceAudit(artifactOnlyReferences.references, artifactRoot),
227
- sourceIdentities: {
228
- defaultSourceEntry: yield* expectString(selectedProfile.sourceEntry, `provider profile.profiles.${defaultProfile}.sourceEntry`),
229
- sourceEntries: yield* expectStringArray(selectedProfile.sourceEntries, `provider profile.profiles.${defaultProfile}.sourceEntries`),
230
- sourceBoundary: {
231
- providerRepoInternal: yield* expectBoolean(sourceBoundary.providerRepoInternal, `provider profile.profiles.${defaultProfile}.sourceBoundary.providerRepoInternal`),
232
- targetDelivery: yield* expectString(sourceBoundary.targetDelivery, `provider profile.profiles.${defaultProfile}.sourceBoundary.targetDelivery`),
233
- targetMustNotReceive: yield* expectStringArray(sourceBoundary.targetMustNotReceive, `provider profile.profiles.${defaultProfile}.sourceBoundary.targetMustNotReceive`),
234
- allowedTargetSourceIdentity: yield* expectStringArray(sourceBoundary.allowedTargetSourceIdentity, `provider profile.profiles.${defaultProfile}.sourceBoundary.allowedTargetSourceIdentity`),
235
- },
236
- providerSourceEntries: yield* expectNamedRecord(providerProfile, 'sourceEntries', 'provider profile'),
237
- artifactReferences: artifactOnlyReferences.references,
238
- },
239
- internalHarnessSurfaces: deliveryModes.internalHarness,
240
- };
241
- });
242
- //# sourceMappingURL=ProviderDiscovery.js.map
@@ -1 +0,0 @@
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;QA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,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\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"]}
@@ -1,4 +0,0 @@
1
- import { Effect, FileSystem } from 'effect';
2
- import { ChildProcessSpawner } from 'effect/unstable/process';
3
- import { HarnessError } from './Errors.ts';
4
- export declare const verifySourcePin: (root: string) => Effect.Effect<undefined, HarnessError | import("./Errors.ts").ProcessError | import("effect/PlatformError").PlatformError, FileSystem.FileSystem | ChildProcessSpawner.ChildProcessSpawner>;