feat(settings): add shared project defaults and scoped overrides (#9754)
Co-authored-by: maria-rcks <[email protected]>
This commit is contained in:
1 parent
b972f1c1df
commit
9f40b2f563
38 files changed
+2237
-647
No files matched your search
@@ -1,5 +1,9 @@
|
||||
import { ProjectId } from "@t3tools/contracts";
|
||||
import { projectScriptRuntimeEnv, setupProjectScript } from "@t3tools/shared/projectScripts";
|
||||
import {
|
||||
projectScriptRuntimeEnv,
|
||||
resolveProjectScripts,
|
||||
setupProjectScript,
|
||||
} from "@t3tools/shared/projectScripts";
|
||||
import * as Context from "effect/Context";
|
||||
import * as Effect from "effect/Effect";
|
||||
import * as Layer from "effect/Layer";
|
||||
@@ -7,6 +11,7 @@ import * as Option from "effect/Option";
|
||||
import * as Schema from "effect/Schema";
|
||||
|
||||
import * as ProjectionSnapshotQuery from "../orchestration/Services/ProjectionSnapshotQuery.ts";
|
||||
import * as ServerSettings from "../serverSettings.ts";
|
||||
import * as TerminalManager from "../terminal/Manager.ts";
|
||||
|
||||
export interface ProjectSetupScriptRunnerResultNoScript {
|
||||
@@ -40,7 +45,7 @@ export class ProjectSetupScriptOperationError extends Schema.TaggedErrorClass<Pr
|
||||
projectId: Schema.optional(Schema.String),
|
||||
projectCwd: Schema.optional(Schema.String),
|
||||
worktreePath: Schema.String,
|
||||
operation: Schema.Literals(["resolveProject", "openTerminal", "writeCommand"]),
|
||||
operation: Schema.Literals(["resolveProject", "readSettings", "openTerminal", "writeCommand"]),
|
||||
cause: Schema.Defect(),
|
||||
},
|
||||
) {
|
||||
@@ -81,6 +86,7 @@ export class ProjectSetupScriptRunner extends Context.Service<
|
||||
export const make = Effect.gen(function* () {
|
||||
const projectionSnapshotQuery = yield* ProjectionSnapshotQuery.ProjectionSnapshotQuery;
|
||||
const terminalManager = yield* TerminalManager.TerminalManager;
|
||||
const serverSettings = yield* ServerSettings.ServerSettingsService;
|
||||
|
||||
const runForThread: ProjectSetupScriptRunner["Service"]["runForThread"] = Effect.fn(
|
||||
"ProjectSetupScriptRunner.runForThread",
|
||||
@@ -124,7 +130,17 @@ export const make = Effect.gen(function* () {
|
||||
return yield* new ProjectSetupScriptProjectNotFoundError(errorContext);
|
||||
}
|
||||
|
||||
const script = setupProjectScript(project.scripts);
|
||||
const settings = yield* serverSettings.getSettings.pipe(
|
||||
Effect.mapError(
|
||||
(cause) =>
|
||||
new ProjectSetupScriptOperationError({
|
||||
...errorContext,
|
||||
operation: "readSettings",
|
||||
cause,
|
||||
}),
|
||||
),
|
||||
);
|
||||
const script = setupProjectScript(resolveProjectScripts(settings, project));
|
||||
if (!script) {
|
||||
return {
|
||||
status: "no-script",
|
||||
|
||||
Reference in new issue
Block a user