@sayoriqwq/effect-harness 0.0.4 → 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 (105) 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 -0
  9. package/dist/src/index.js +3 -0
  10. package/dist/src/index.js.map +1 -0
  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 +25 -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/repos/effect.subtree.json +2 -2
  25. package/repos/tsgo.subtree.json +2 -2
  26. package/HARNESS.md +0 -66
  27. package/dist/bin/effect-harness.d.ts +0 -2
  28. package/dist/bin/effect-harness.js +0 -34
  29. package/dist/bin/effect-harness.js.map +0 -1
  30. package/dist/src/cli/Main.d.ts +0 -7
  31. package/dist/src/cli/Main.js +0 -45
  32. package/dist/src/cli/Main.js.map +0 -1
  33. package/dist/src/harness/Errors.d.ts +0 -24
  34. package/dist/src/harness/Errors.js +0 -26
  35. package/dist/src/harness/Errors.js.map +0 -1
  36. package/dist/src/harness/Guardrails.d.ts +0 -7
  37. package/dist/src/harness/Guardrails.js +0 -50
  38. package/dist/src/harness/Guardrails.js.map +0 -1
  39. package/dist/src/harness/Model.d.ts +0 -52
  40. package/dist/src/harness/Model.js +0 -170
  41. package/dist/src/harness/Model.js.map +0 -1
  42. package/dist/src/harness/ModuleSources.d.ts +0 -5
  43. package/dist/src/harness/ModuleSources.js +0 -47
  44. package/dist/src/harness/ModuleSources.js.map +0 -1
  45. package/dist/src/harness/ProviderDiscovery.d.ts +0 -172
  46. package/dist/src/harness/ProviderDiscovery.js +0 -157
  47. package/dist/src/harness/ProviderDiscovery.js.map +0 -1
  48. package/dist/src/harness/SourcePin.d.ts +0 -4
  49. package/dist/src/harness/SourcePin.js +0 -214
  50. package/dist/src/harness/SourcePin.js.map +0 -1
  51. package/dist/src/harness/verify/JsonFields.d.ts +0 -1
  52. package/dist/src/harness/verify/JsonFields.js +0 -4
  53. package/dist/src/harness/verify/JsonFields.js.map +0 -1
  54. package/dist/src/harness/verify/Pipeline.d.ts +0 -7
  55. package/dist/src/harness/verify/Pipeline.js +0 -55
  56. package/dist/src/harness/verify/Pipeline.js.map +0 -1
  57. package/dist/src/harness/verify/ProviderProfile.d.ts +0 -3
  58. package/dist/src/harness/verify/ProviderProfile.js +0 -726
  59. package/dist/src/harness/verify/ProviderProfile.js.map +0 -1
  60. package/dist/src/harness/verify/ProviderRepository.d.ts +0 -4
  61. package/dist/src/harness/verify/ProviderRepository.js +0 -127
  62. package/dist/src/harness/verify/ProviderRepository.js.map +0 -1
  63. package/dist/src/harness/verify/Tsgo.d.ts +0 -3
  64. package/dist/src/harness/verify/Tsgo.js +0 -166
  65. package/dist/src/harness/verify/Tsgo.js.map +0 -1
  66. package/dist/src/harness/verify/TsgoMetadata.d.ts +0 -4
  67. package/dist/src/harness/verify/TsgoMetadata.js +0 -50
  68. package/dist/src/harness/verify/TsgoMetadata.js.map +0 -1
  69. package/dist/src/harness/verify/TsgoPolicy.d.ts +0 -208
  70. package/dist/src/harness/verify/TsgoPolicy.js +0 -143
  71. package/dist/src/harness/verify/TsgoPolicy.js.map +0 -1
  72. package/dist/src/harness/verify/TsgoSuppressions.d.ts +0 -2
  73. package/dist/src/harness/verify/TsgoSuppressions.js +0 -24
  74. package/dist/src/harness/verify/TsgoSuppressions.js.map +0 -1
  75. package/dist/src/harness/verify/VerifyStage.d.ts +0 -62
  76. package/dist/src/harness/verify/VerifyStage.js +0 -85
  77. package/dist/src/harness/verify/VerifyStage.js.map +0 -1
  78. package/dist/src/platform/Json.d.ts +0 -4
  79. package/dist/src/platform/Json.js +0 -16
  80. package/dist/src/platform/Json.js.map +0 -1
  81. package/dist/src/platform/Process.d.ts +0 -6
  82. package/dist/src/platform/Process.js +0 -35
  83. package/dist/src/platform/Process.js.map +0 -1
  84. package/harness/code.md +0 -83
  85. package/harness/diagnostic-layers.md +0 -94
  86. package/harness/effect-routes.md +0 -50
  87. package/harness/feedback-loop.md +0 -156
  88. package/harness/index.md +0 -83
  89. package/harness/offcial-guide.md +0 -50
  90. package/harness/offcial-migrate.md +0 -220
  91. package/harness/source.md +0 -91
  92. package/harness/tsgo-routes.md +0 -58
  93. package/harness/tsgo.md +0 -241
  94. package/provider/docs/diagnostics.md +0 -48
  95. package/provider/docs/discovery.md +0 -104
  96. package/provider/docs/editor-policy.md +0 -55
  97. package/provider/docs/effect-code.md +0 -41
  98. package/provider/docs/index.md +0 -48
  99. package/provider/docs/managed-surfaces.md +0 -51
  100. package/provider/docs/package-config.md +0 -71
  101. package/provider/docs/quality-policy.md +0 -68
  102. package/provider/docs/source-identity.md +0 -48
  103. package/provider/effect-harness.provider.json +0 -1020
  104. package/provider/index.md +0 -189
  105. 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,CAA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Y,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC,UAAU,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,172 +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
- export interface ProviderDiscovery {
19
- readonly schemaVersion: 1;
20
- readonly artifactRoot: string;
21
- readonly providerProfilePath: string;
22
- readonly providerProfileRelativePath: 'provider/effect-harness.provider.json';
23
- readonly packageLocator: {
24
- readonly packageName: string;
25
- readonly packageVersion: string;
26
- readonly binName: 'effect-harness';
27
- readonly binPath: string;
28
- readonly discoveryCommand: string;
29
- readonly packageFiles: ReadonlyArray<string>;
30
- };
31
- readonly provider: {
32
- readonly id: string;
33
- readonly contractVersion: string;
34
- readonly providerVersion: string;
35
- readonly defaultProfile: string;
36
- };
37
- readonly selectedProfile: string;
38
- readonly discovery: {
39
- readonly mode: 'provider-discovery';
40
- readonly consumer: 'prelude';
41
- readonly profileSource: 'provider/effect-harness.provider.json';
42
- readonly targetLifecycleOwner: string;
43
- };
44
- readonly deliveryModes: {
45
- readonly internalHarness: JsonRecord;
46
- readonly providerArtifactReference: JsonRecord;
47
- readonly exportedHarness: JsonRecord;
48
- };
49
- readonly targetManagedSurfaces: {
50
- readonly targetReceives: ReadonlyArray<string>;
51
- readonly targetDoesNotReceive: ReadonlyArray<string>;
52
- readonly documentationBundle: ManagedFilesContribution;
53
- 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
- };
62
- };
63
- readonly artifactOnlyReferences: {
64
- readonly mode: string;
65
- readonly targetDelivery: string;
66
- readonly packageSurface: ReadonlyArray<string>;
67
- readonly references: JsonRecord;
68
- };
69
- readonly sourceIdentities: {
70
- readonly defaultSourceEntry: string;
71
- readonly sourceEntries: ReadonlyArray<string>;
72
- readonly sourceBoundary: {
73
- readonly providerRepoInternal: boolean;
74
- readonly targetDelivery: string;
75
- readonly targetMustNotReceive: ReadonlyArray<string>;
76
- readonly allowedTargetSourceIdentity: ReadonlyArray<string>;
77
- };
78
- readonly providerSourceEntries: JsonRecord;
79
- readonly artifactReferences: JsonRecord;
80
- };
81
- readonly internalHarnessSurfaces: JsonRecord;
82
- }
83
- export declare const discoverProvider: (harness: string) => Effect.Effect<{
84
- schemaVersion: 1;
85
- artifactRoot: string;
86
- providerProfilePath: string;
87
- providerProfileRelativePath: "provider/effect-harness.provider.json";
88
- packageLocator: {
89
- packageName: string;
90
- packageVersion: string;
91
- binName: "effect-harness";
92
- binPath: string;
93
- discoveryCommand: string;
94
- packageFiles: string[];
95
- };
96
- provider: {
97
- id: string;
98
- contractVersion: string;
99
- providerVersion: string;
100
- defaultProfile: string;
101
- };
102
- selectedProfile: string;
103
- discovery: {
104
- mode: "provider-discovery";
105
- consumer: "prelude";
106
- profileSource: "provider/effect-harness.provider.json";
107
- targetLifecycleOwner: string;
108
- };
109
- deliveryModes: {
110
- internalHarness: JsonRecord;
111
- providerArtifactReference: JsonRecord;
112
- exportedHarness: JsonRecord;
113
- };
114
- targetManagedSurfaces: {
115
- targetReceives: string[];
116
- targetDoesNotReceive: string[];
117
- documentationBundle: {
118
- mode: string;
119
- targetBasePath: string;
120
- files: {
121
- targetUsage?: string;
122
- id: string;
123
- sourcePath: string;
124
- targetPath: string;
125
- contentType: string;
126
- managed: boolean;
127
- content: string;
128
- }[];
129
- };
130
- snippets: {
131
- mode: string;
132
- targetBasePath: string;
133
- files: {
134
- targetUsage?: string;
135
- id: string;
136
- sourcePath: string;
137
- targetPath: string;
138
- contentType: string;
139
- managed: boolean;
140
- content: string;
141
- }[];
142
- };
143
- contributions: {
144
- packageJson: JsonRecord;
145
- tsconfig: JsonRecord;
146
- editorPolicy: JsonRecord;
147
- lintGuardrails: JsonRecord;
148
- testPolicy: JsonRecord;
149
- verificationPolicy: JsonRecord;
150
- };
151
- };
152
- artifactOnlyReferences: {
153
- mode: string;
154
- targetDelivery: string;
155
- packageSurface: string[];
156
- references: JsonRecord;
157
- };
158
- sourceIdentities: {
159
- defaultSourceEntry: string;
160
- sourceEntries: string[];
161
- sourceBoundary: {
162
- providerRepoInternal: boolean;
163
- targetDelivery: string;
164
- targetMustNotReceive: string[];
165
- allowedTargetSourceIdentity: string[];
166
- };
167
- providerSourceEntries: JsonRecord;
168
- artifactReferences: JsonRecord;
169
- };
170
- internalHarnessSurfaces: JsonRecord;
171
- }, HarnessError | import("effect/PlatformError").PlatformError, FileSystem.FileSystem | Path.Path>;
172
- export {};
@@ -1,157 +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
- function decodeJsonRecord(value, source) {
6
- return isRecord(value)
7
- ? Effect.succeed(value)
8
- : Effect.fail(new HarnessError({ message: `${source} must be a JSON object` }));
9
- }
10
- function expectRecord(value, source) {
11
- return isRecord(value)
12
- ? Effect.succeed(value)
13
- : Effect.fail(new HarnessError({ message: `${source} must be a JSON object` }));
14
- }
15
- function expectString(value, source) {
16
- return typeof value === 'string'
17
- ? Effect.succeed(value)
18
- : Effect.fail(new HarnessError({ message: `${source} must be a string` }));
19
- }
20
- function expectBoolean(value, source) {
21
- return typeof value === 'boolean'
22
- ? Effect.succeed(value)
23
- : Effect.fail(new HarnessError({ message: `${source} must be a boolean` }));
24
- }
25
- function expectArray(value, source) {
26
- return Array.isArray(value)
27
- ? Effect.succeed(value)
28
- : Effect.fail(new HarnessError({ message: `${source} must be an array` }));
29
- }
30
- const expectStringArray = Effect.fnUntraced(function* (value, source) {
31
- const array = yield* expectArray(value, source);
32
- return yield* Effect.forEach(array, (entry, index) => expectString(entry, `${source}[${index}]`));
33
- });
34
- const expectManagedFileDeclaration = Effect.fnUntraced(function* (value, source, artifactRoot) {
35
- const file = yield* expectRecord(value, source);
36
- const path = yield* Path.Path;
37
- const fs = yield* FileSystem.FileSystem;
38
- const sourcePath = yield* expectString(file.sourcePath, `${source}.sourcePath`);
39
- const targetUsage = file.targetUsage === undefined
40
- ? undefined
41
- : yield* expectString(file.targetUsage, `${source}.targetUsage`);
42
- return {
43
- id: yield* expectString(file.id, `${source}.id`),
44
- sourcePath,
45
- targetPath: yield* expectString(file.targetPath, `${source}.targetPath`),
46
- contentType: yield* expectString(file.contentType, `${source}.contentType`),
47
- managed: yield* expectBoolean(file.managed, `${source}.managed`),
48
- content: yield* fs.readFileString(path.join(artifactRoot, sourcePath)),
49
- ...(targetUsage === undefined ? {} : { targetUsage }),
50
- };
51
- });
52
- const expectManagedFilesContribution = Effect.fnUntraced(function* (value, source, artifactRoot) {
53
- const contribution = yield* expectRecord(value, source);
54
- const files = yield* expectArray(contribution.files, `${source}.files`);
55
- return {
56
- mode: yield* expectString(contribution.mode, `${source}.mode`),
57
- targetBasePath: yield* expectString(contribution.targetBasePath, `${source}.targetBasePath`),
58
- files: yield* Effect.forEach(files, (file, index) => expectManagedFileDeclaration(file, `${source}.files[${index}]`, artifactRoot)),
59
- };
60
- });
61
- function expectNamedRecord(record, field, source) {
62
- return expectRecord(record[field], `${source}.${field}`);
63
- }
64
- const expectDeliveryModes = Effect.fnUntraced(function* (providerProfile) {
65
- const deliveryModes = yield* expectNamedRecord(providerProfile, 'deliveryModes', 'provider profile');
66
- return {
67
- internalHarness: yield* expectNamedRecord(deliveryModes, 'internalHarness', 'provider profile.deliveryModes'),
68
- providerArtifactReference: yield* expectNamedRecord(deliveryModes, 'providerArtifactReference', 'provider profile.deliveryModes'),
69
- exportedHarness: yield* expectNamedRecord(deliveryModes, 'exportedHarness', 'provider profile.deliveryModes'),
70
- };
71
- });
72
- const expectArtifactReferences = Effect.fnUntraced(function* (providerProfile) {
73
- const artifactReferences = yield* expectNamedRecord(providerProfile, 'artifactReferences', 'provider profile');
74
- const references = yield* expectNamedRecord(artifactReferences, 'references', 'provider profile.artifactReferences');
75
- return {
76
- mode: yield* expectString(artifactReferences.mode, 'provider profile.artifactReferences.mode'),
77
- targetDelivery: yield* expectString(artifactReferences.targetDelivery, 'provider profile.artifactReferences.targetDelivery'),
78
- packageSurface: yield* expectStringArray(artifactReferences.packageSurface, 'provider profile.artifactReferences.packageSurface'),
79
- references,
80
- };
81
- });
82
- export const discoverProvider = Effect.fnUntraced(function* (harness) {
83
- const path = yield* Path.Path;
84
- const artifactRoot = path.resolve(harness);
85
- const providerProfileRelativePath = 'provider/effect-harness.provider.json';
86
- const providerProfilePath = path.join(artifactRoot, providerProfileRelativePath);
87
- const providerProfile = yield* readJson(providerProfilePath, decodeJsonRecord);
88
- const packageManifest = yield* readJson(path.join(artifactRoot, 'package.json'), decodeJsonRecord);
89
- const provider = yield* expectNamedRecord(providerProfile, 'provider', 'provider profile');
90
- const profiles = yield* expectNamedRecord(providerProfile, 'profiles', 'provider profile');
91
- const defaultProfile = yield* expectString(provider.defaultProfile, 'provider profile.provider.defaultProfile');
92
- const selectedProfile = yield* expectNamedRecord(profiles, defaultProfile, `provider profile.profiles.${defaultProfile}`);
93
- const contributions = yield* expectNamedRecord(selectedProfile, 'contributions', `provider profile.profiles.${defaultProfile}`);
94
- const managedSurfaces = yield* expectNamedRecord(selectedProfile, 'managedSurfaces', `provider profile.profiles.${defaultProfile}`);
95
- const sourceBoundary = yield* expectNamedRecord(selectedProfile, 'sourceBoundary', `provider profile.profiles.${defaultProfile}`);
96
- const selfConformance = yield* expectNamedRecord(providerProfile, 'selfConformance', 'provider profile');
97
- const packageBin = yield* expectNamedRecord(packageManifest, 'bin', 'package.json');
98
- const artifactOnlyReferences = yield* expectArtifactReferences(providerProfile);
99
- const deliveryModes = yield* expectDeliveryModes(providerProfile);
100
- return {
101
- schemaVersion: 1,
102
- artifactRoot,
103
- providerProfilePath,
104
- providerProfileRelativePath,
105
- packageLocator: {
106
- packageName: yield* expectString(packageManifest.name, 'package.json.name'),
107
- packageVersion: yield* expectString(packageManifest.version, 'package.json.version'),
108
- binName: 'effect-harness',
109
- binPath: yield* expectString(packageBin['effect-harness'], 'package.json.bin.effect-harness'),
110
- discoveryCommand: 'npx --yes @sayoriqwq/effect-harness provider-discover',
111
- packageFiles: yield* expectStringArray(packageManifest.files, 'package.json.files'),
112
- },
113
- provider: {
114
- id: yield* expectString(provider.id, 'provider profile.provider.id'),
115
- contractVersion: yield* expectString(provider.contractVersion, 'provider profile.provider.contractVersion'),
116
- providerVersion: yield* expectString(provider.providerVersion, 'provider profile.provider.providerVersion'),
117
- defaultProfile,
118
- },
119
- selectedProfile: defaultProfile,
120
- discovery: {
121
- mode: 'provider-discovery',
122
- consumer: 'prelude',
123
- profileSource: providerProfileRelativePath,
124
- targetLifecycleOwner: yield* expectString(selfConformance.lifecycleOwner, 'provider profile.selfConformance.lifecycleOwner'),
125
- },
126
- deliveryModes,
127
- targetManagedSurfaces: {
128
- targetReceives: yield* expectStringArray(managedSurfaces.targetReceives, `provider profile.profiles.${defaultProfile}.managedSurfaces.targetReceives`),
129
- targetDoesNotReceive: yield* expectStringArray(managedSurfaces.targetDoesNotReceive, `provider profile.profiles.${defaultProfile}.managedSurfaces.targetDoesNotReceive`),
130
- documentationBundle: yield* expectManagedFilesContribution(contributions.documentationBundle, `provider profile.profiles.${defaultProfile}.contributions.documentationBundle`, artifactRoot),
131
- 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
- },
140
- },
141
- artifactOnlyReferences,
142
- sourceIdentities: {
143
- defaultSourceEntry: yield* expectString(selectedProfile.sourceEntry, `provider profile.profiles.${defaultProfile}.sourceEntry`),
144
- sourceEntries: yield* expectStringArray(selectedProfile.sourceEntries, `provider profile.profiles.${defaultProfile}.sourceEntries`),
145
- sourceBoundary: {
146
- providerRepoInternal: yield* expectBoolean(sourceBoundary.providerRepoInternal, `provider profile.profiles.${defaultProfile}.sourceBoundary.providerRepoInternal`),
147
- targetDelivery: yield* expectString(sourceBoundary.targetDelivery, `provider profile.profiles.${defaultProfile}.sourceBoundary.targetDelivery`),
148
- targetMustNotReceive: yield* expectStringArray(sourceBoundary.targetMustNotReceive, `provider profile.profiles.${defaultProfile}.sourceBoundary.targetMustNotReceive`),
149
- allowedTargetSourceIdentity: yield* expectStringArray(sourceBoundary.allowedTargetSourceIdentity, `provider profile.profiles.${defaultProfile}.sourceBoundary.allowedTargetSourceIdentity`),
150
- },
151
- providerSourceEntries: yield* expectNamedRecord(providerProfile, 'sourceEntries', 'provider profile'),
152
- artifactReferences: artifactOnlyReferences.references,
153
- },
154
- internalHarnessSurfaces: deliveryModes.internalHarness,
155
- };
156
- });
157
- //# 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;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,EAAE,MAAc;IAClD,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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C;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,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>;