@generacy-ai/generacy 0.0.0-preview-20260304013206
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +191 -0
- package/README.md +207 -0
- package/bin/generacy.js +11 -0
- package/dist/agency/index.d.ts +68 -0
- package/dist/agency/index.d.ts.map +1 -0
- package/dist/agency/index.js +28 -0
- package/dist/agency/index.js.map +1 -0
- package/dist/agency/network.d.ts +41 -0
- package/dist/agency/network.d.ts.map +1 -0
- package/dist/agency/network.js +133 -0
- package/dist/agency/network.js.map +1 -0
- package/dist/agency/subprocess.d.ts +58 -0
- package/dist/agency/subprocess.d.ts.map +1 -0
- package/dist/agency/subprocess.js +216 -0
- package/dist/agency/subprocess.js.map +1 -0
- package/dist/cli/commands/agent.d.ts +10 -0
- package/dist/cli/commands/agent.d.ts.map +1 -0
- package/dist/cli/commands/agent.js +216 -0
- package/dist/cli/commands/agent.js.map +1 -0
- package/dist/cli/commands/doctor/checks/agency-mcp.d.ts +3 -0
- package/dist/cli/commands/doctor/checks/agency-mcp.d.ts.map +1 -0
- package/dist/cli/commands/doctor/checks/agency-mcp.js +51 -0
- package/dist/cli/commands/doctor/checks/agency-mcp.js.map +1 -0
- package/dist/cli/commands/doctor/checks/anthropic-key.d.ts +3 -0
- package/dist/cli/commands/doctor/checks/anthropic-key.d.ts.map +1 -0
- package/dist/cli/commands/doctor/checks/anthropic-key.js +68 -0
- package/dist/cli/commands/doctor/checks/anthropic-key.js.map +1 -0
- package/dist/cli/commands/doctor/checks/config.d.ts +3 -0
- package/dist/cli/commands/doctor/checks/config.d.ts.map +1 -0
- package/dist/cli/commands/doctor/checks/config.js +81 -0
- package/dist/cli/commands/doctor/checks/config.js.map +1 -0
- package/dist/cli/commands/doctor/checks/devcontainer.d.ts +3 -0
- package/dist/cli/commands/doctor/checks/devcontainer.d.ts.map +1 -0
- package/dist/cli/commands/doctor/checks/devcontainer.js +58 -0
- package/dist/cli/commands/doctor/checks/devcontainer.js.map +1 -0
- package/dist/cli/commands/doctor/checks/docker.d.ts +3 -0
- package/dist/cli/commands/doctor/checks/docker.d.ts.map +1 -0
- package/dist/cli/commands/doctor/checks/docker.js +71 -0
- package/dist/cli/commands/doctor/checks/docker.js.map +1 -0
- package/dist/cli/commands/doctor/checks/env-file.d.ts +3 -0
- package/dist/cli/commands/doctor/checks/env-file.d.ts.map +1 -0
- package/dist/cli/commands/doctor/checks/env-file.js +56 -0
- package/dist/cli/commands/doctor/checks/env-file.js.map +1 -0
- package/dist/cli/commands/doctor/checks/github-token.d.ts +3 -0
- package/dist/cli/commands/doctor/checks/github-token.d.ts.map +1 -0
- package/dist/cli/commands/doctor/checks/github-token.js +99 -0
- package/dist/cli/commands/doctor/checks/github-token.js.map +1 -0
- package/dist/cli/commands/doctor/checks/npm-packages.d.ts +3 -0
- package/dist/cli/commands/doctor/checks/npm-packages.d.ts.map +1 -0
- package/dist/cli/commands/doctor/checks/npm-packages.js +117 -0
- package/dist/cli/commands/doctor/checks/npm-packages.js.map +1 -0
- package/dist/cli/commands/doctor/formatter.d.ts +27 -0
- package/dist/cli/commands/doctor/formatter.d.ts.map +1 -0
- package/dist/cli/commands/doctor/formatter.js +162 -0
- package/dist/cli/commands/doctor/formatter.js.map +1 -0
- package/dist/cli/commands/doctor/index.d.ts +5 -0
- package/dist/cli/commands/doctor/index.d.ts.map +1 -0
- package/dist/cli/commands/doctor/index.js +8 -0
- package/dist/cli/commands/doctor/index.js.map +1 -0
- package/dist/cli/commands/doctor/registry.d.ts +48 -0
- package/dist/cli/commands/doctor/registry.d.ts.map +1 -0
- package/dist/cli/commands/doctor/registry.js +166 -0
- package/dist/cli/commands/doctor/registry.js.map +1 -0
- package/dist/cli/commands/doctor/runner.d.ts +14 -0
- package/dist/cli/commands/doctor/runner.d.ts.map +1 -0
- package/dist/cli/commands/doctor/runner.js +257 -0
- package/dist/cli/commands/doctor/runner.js.map +1 -0
- package/dist/cli/commands/doctor/types.d.ts +87 -0
- package/dist/cli/commands/doctor/types.d.ts.map +1 -0
- package/dist/cli/commands/doctor/types.js +2 -0
- package/dist/cli/commands/doctor/types.js.map +1 -0
- package/dist/cli/commands/doctor.d.ts +12 -0
- package/dist/cli/commands/doctor.d.ts.map +1 -0
- package/dist/cli/commands/doctor.js +97 -0
- package/dist/cli/commands/doctor.js.map +1 -0
- package/dist/cli/commands/init/conflicts.d.ts +36 -0
- package/dist/cli/commands/init/conflicts.d.ts.map +1 -0
- package/dist/cli/commands/init/conflicts.js +165 -0
- package/dist/cli/commands/init/conflicts.js.map +1 -0
- package/dist/cli/commands/init/github.d.ts +32 -0
- package/dist/cli/commands/init/github.d.ts.map +1 -0
- package/dist/cli/commands/init/github.js +161 -0
- package/dist/cli/commands/init/github.js.map +1 -0
- package/dist/cli/commands/init/index.d.ts +21 -0
- package/dist/cli/commands/init/index.d.ts.map +1 -0
- package/dist/cli/commands/init/index.js +175 -0
- package/dist/cli/commands/init/index.js.map +1 -0
- package/dist/cli/commands/init/prompts.d.ts +15 -0
- package/dist/cli/commands/init/prompts.d.ts.map +1 -0
- package/dist/cli/commands/init/prompts.js +281 -0
- package/dist/cli/commands/init/prompts.js.map +1 -0
- package/dist/cli/commands/init/repo-utils.d.ts +32 -0
- package/dist/cli/commands/init/repo-utils.d.ts.map +1 -0
- package/dist/cli/commands/init/repo-utils.js +112 -0
- package/dist/cli/commands/init/repo-utils.js.map +1 -0
- package/dist/cli/commands/init/resolver.d.ts +20 -0
- package/dist/cli/commands/init/resolver.d.ts.map +1 -0
- package/dist/cli/commands/init/resolver.js +273 -0
- package/dist/cli/commands/init/resolver.js.map +1 -0
- package/dist/cli/commands/init/summary.d.ts +21 -0
- package/dist/cli/commands/init/summary.d.ts.map +1 -0
- package/dist/cli/commands/init/summary.js +100 -0
- package/dist/cli/commands/init/summary.js.map +1 -0
- package/dist/cli/commands/init/types.d.ts +53 -0
- package/dist/cli/commands/init/types.d.ts.map +1 -0
- package/dist/cli/commands/init/types.js +2 -0
- package/dist/cli/commands/init/types.js.map +1 -0
- package/dist/cli/commands/init/writer.d.ts +22 -0
- package/dist/cli/commands/init/writer.d.ts.map +1 -0
- package/dist/cli/commands/init/writer.js +96 -0
- package/dist/cli/commands/init/writer.js.map +1 -0
- package/dist/cli/commands/orchestrator.d.ts +11 -0
- package/dist/cli/commands/orchestrator.d.ts.map +1 -0
- package/dist/cli/commands/orchestrator.js +291 -0
- package/dist/cli/commands/orchestrator.js.map +1 -0
- package/dist/cli/commands/run.d.ts +10 -0
- package/dist/cli/commands/run.d.ts.map +1 -0
- package/dist/cli/commands/run.js +167 -0
- package/dist/cli/commands/run.js.map +1 -0
- package/dist/cli/commands/setup/auth.d.ts +11 -0
- package/dist/cli/commands/setup/auth.d.ts.map +1 -0
- package/dist/cli/commands/setup/auth.js +108 -0
- package/dist/cli/commands/setup/auth.js.map +1 -0
- package/dist/cli/commands/setup/build.d.ts +11 -0
- package/dist/cli/commands/setup/build.d.ts.map +1 -0
- package/dist/cli/commands/setup/build.js +212 -0
- package/dist/cli/commands/setup/build.js.map +1 -0
- package/dist/cli/commands/setup/services.d.ts +11 -0
- package/dist/cli/commands/setup/services.d.ts.map +1 -0
- package/dist/cli/commands/setup/services.js +294 -0
- package/dist/cli/commands/setup/services.js.map +1 -0
- package/dist/cli/commands/setup/workspace.d.ts +11 -0
- package/dist/cli/commands/setup/workspace.d.ts.map +1 -0
- package/dist/cli/commands/setup/workspace.js +215 -0
- package/dist/cli/commands/setup/workspace.js.map +1 -0
- package/dist/cli/commands/setup.d.ts +7 -0
- package/dist/cli/commands/setup.d.ts.map +1 -0
- package/dist/cli/commands/setup.js +19 -0
- package/dist/cli/commands/setup.js.map +1 -0
- package/dist/cli/commands/validate.d.ts +10 -0
- package/dist/cli/commands/validate.d.ts.map +1 -0
- package/dist/cli/commands/validate.js +164 -0
- package/dist/cli/commands/validate.js.map +1 -0
- package/dist/cli/commands/worker.d.ts +10 -0
- package/dist/cli/commands/worker.d.ts.map +1 -0
- package/dist/cli/commands/worker.js +224 -0
- package/dist/cli/commands/worker.js.map +1 -0
- package/dist/cli/index.d.ts +14 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +68 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/utils/config.d.ts +49 -0
- package/dist/cli/utils/config.d.ts.map +1 -0
- package/dist/cli/utils/config.js +110 -0
- package/dist/cli/utils/config.js.map +1 -0
- package/dist/cli/utils/exec.d.ts +39 -0
- package/dist/cli/utils/exec.d.ts.map +1 -0
- package/dist/cli/utils/exec.js +68 -0
- package/dist/cli/utils/exec.js.map +1 -0
- package/dist/cli/utils/logger.d.ts +47 -0
- package/dist/cli/utils/logger.d.ts.map +1 -0
- package/dist/cli/utils/logger.js +97 -0
- package/dist/cli/utils/logger.js.map +1 -0
- package/dist/config/index.d.ts +10 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +13 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/loader.d.ts +104 -0
- package/dist/config/loader.d.ts.map +1 -0
- package/dist/config/loader.js +266 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/config/schema.d.ts +304 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +160 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/config/validator.d.ts +60 -0
- package/dist/config/validator.d.ts.map +1 -0
- package/dist/config/validator.js +112 -0
- package/dist/config/validator.js.map +1 -0
- package/dist/health/server.d.ts +47 -0
- package/dist/health/server.d.ts.map +1 -0
- package/dist/health/server.js +92 -0
- package/dist/health/server.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/orchestrator/async-event-queue.d.ts +28 -0
- package/dist/orchestrator/async-event-queue.d.ts.map +1 -0
- package/dist/orchestrator/async-event-queue.js +57 -0
- package/dist/orchestrator/async-event-queue.js.map +1 -0
- package/dist/orchestrator/client.d.ts +110 -0
- package/dist/orchestrator/client.d.ts.map +1 -0
- package/dist/orchestrator/client.js +288 -0
- package/dist/orchestrator/client.js.map +1 -0
- package/dist/orchestrator/event-bus.d.ts +195 -0
- package/dist/orchestrator/event-bus.d.ts.map +1 -0
- package/dist/orchestrator/event-bus.js +557 -0
- package/dist/orchestrator/event-bus.js.map +1 -0
- package/dist/orchestrator/heartbeat.d.ts +71 -0
- package/dist/orchestrator/heartbeat.d.ts.map +1 -0
- package/dist/orchestrator/heartbeat.js +116 -0
- package/dist/orchestrator/heartbeat.js.map +1 -0
- package/dist/orchestrator/index.d.ts +25 -0
- package/dist/orchestrator/index.d.ts.map +1 -0
- package/dist/orchestrator/index.js +15 -0
- package/dist/orchestrator/index.js.map +1 -0
- package/dist/orchestrator/job-handler.d.ts +109 -0
- package/dist/orchestrator/job-handler.d.ts.map +1 -0
- package/dist/orchestrator/job-handler.js +612 -0
- package/dist/orchestrator/job-handler.js.map +1 -0
- package/dist/orchestrator/job-queue.d.ts +81 -0
- package/dist/orchestrator/job-queue.d.ts.map +1 -0
- package/dist/orchestrator/job-queue.js +206 -0
- package/dist/orchestrator/job-queue.js.map +1 -0
- package/dist/orchestrator/label-monitor-bridge.d.ts +25 -0
- package/dist/orchestrator/label-monitor-bridge.d.ts.map +1 -0
- package/dist/orchestrator/label-monitor-bridge.js +57 -0
- package/dist/orchestrator/label-monitor-bridge.js.map +1 -0
- package/dist/orchestrator/log-buffer.d.ts +74 -0
- package/dist/orchestrator/log-buffer.d.ts.map +1 -0
- package/dist/orchestrator/log-buffer.js +104 -0
- package/dist/orchestrator/log-buffer.js.map +1 -0
- package/dist/orchestrator/redis-job-queue.d.ts +44 -0
- package/dist/orchestrator/redis-job-queue.d.ts.map +1 -0
- package/dist/orchestrator/redis-job-queue.js +300 -0
- package/dist/orchestrator/redis-job-queue.js.map +1 -0
- package/dist/orchestrator/router.d.ts +125 -0
- package/dist/orchestrator/router.d.ts.map +1 -0
- package/dist/orchestrator/router.js +143 -0
- package/dist/orchestrator/router.js.map +1 -0
- package/dist/orchestrator/server.d.ts +62 -0
- package/dist/orchestrator/server.d.ts.map +1 -0
- package/dist/orchestrator/server.js +711 -0
- package/dist/orchestrator/server.js.map +1 -0
- package/dist/orchestrator/types.d.ts +184 -0
- package/dist/orchestrator/types.d.ts.map +1 -0
- package/dist/orchestrator/types.js +6 -0
- package/dist/orchestrator/types.js.map +1 -0
- package/dist/orchestrator/worker-registry.d.ts +110 -0
- package/dist/orchestrator/worker-registry.d.ts.map +1 -0
- package/dist/orchestrator/worker-registry.js +191 -0
- package/dist/orchestrator/worker-registry.js.map +1 -0
- package/package.json +80 -0
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Project configuration schema
|
|
4
|
+
* Defines project metadata and link to generacy.ai
|
|
5
|
+
*/
|
|
6
|
+
export declare const ProjectConfigSchema: z.ZodObject<{
|
|
7
|
+
/**
|
|
8
|
+
* Unique project ID from generacy.ai
|
|
9
|
+
* Format: proj_{alphanumeric}, minimum 12 characters total
|
|
10
|
+
* Example: "proj_abc123"
|
|
11
|
+
*/
|
|
12
|
+
id: z.ZodString;
|
|
13
|
+
/**
|
|
14
|
+
* Human-readable project name
|
|
15
|
+
* Maximum 255 characters
|
|
16
|
+
*/
|
|
17
|
+
name: z.ZodString;
|
|
18
|
+
}, "strip", z.ZodTypeAny, {
|
|
19
|
+
id: string;
|
|
20
|
+
name: string;
|
|
21
|
+
}, {
|
|
22
|
+
id: string;
|
|
23
|
+
name: string;
|
|
24
|
+
}>;
|
|
25
|
+
export type ProjectConfig = z.infer<typeof ProjectConfigSchema>;
|
|
26
|
+
/**
|
|
27
|
+
* Repository configuration schema
|
|
28
|
+
* Defines repository relationships for the project
|
|
29
|
+
*/
|
|
30
|
+
export declare const ReposConfigSchema: z.ZodObject<{
|
|
31
|
+
/**
|
|
32
|
+
* Primary repository (the "main" repo for the project)
|
|
33
|
+
* This is the repository where the onboarding PR will be created
|
|
34
|
+
*/
|
|
35
|
+
primary: z.ZodEffects<z.ZodString, string, string>;
|
|
36
|
+
/**
|
|
37
|
+
* Development repositories (optional)
|
|
38
|
+
* These repos are cloned for active development and can receive PRs
|
|
39
|
+
* Default: empty array
|
|
40
|
+
*/
|
|
41
|
+
dev: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>>;
|
|
42
|
+
/**
|
|
43
|
+
* Clone-only repositories (optional)
|
|
44
|
+
* These repos are cloned for reference/reading only (no PRs created)
|
|
45
|
+
* Default: empty array
|
|
46
|
+
*/
|
|
47
|
+
clone: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>>;
|
|
48
|
+
}, "strip", z.ZodTypeAny, {
|
|
49
|
+
primary: string;
|
|
50
|
+
dev: string[];
|
|
51
|
+
clone: string[];
|
|
52
|
+
}, {
|
|
53
|
+
primary: string;
|
|
54
|
+
dev?: string[] | undefined;
|
|
55
|
+
clone?: string[] | undefined;
|
|
56
|
+
}>;
|
|
57
|
+
export type ReposConfig = z.infer<typeof ReposConfigSchema>;
|
|
58
|
+
/**
|
|
59
|
+
* Workflow defaults schema
|
|
60
|
+
* Defines default settings for workflow execution
|
|
61
|
+
*/
|
|
62
|
+
export declare const DefaultsConfigSchema: z.ZodObject<{
|
|
63
|
+
/**
|
|
64
|
+
* Default agent to use for workflow execution
|
|
65
|
+
* Format: kebab-case (e.g., "claude-code", "cursor-agent")
|
|
66
|
+
*/
|
|
67
|
+
agent: z.ZodOptional<z.ZodString>;
|
|
68
|
+
/**
|
|
69
|
+
* Default base branch for creating feature branches
|
|
70
|
+
* No validation of branch existence (checked at runtime)
|
|
71
|
+
*/
|
|
72
|
+
baseBranch: z.ZodOptional<z.ZodString>;
|
|
73
|
+
}, "strip", z.ZodTypeAny, {
|
|
74
|
+
agent?: string | undefined;
|
|
75
|
+
baseBranch?: string | undefined;
|
|
76
|
+
}, {
|
|
77
|
+
agent?: string | undefined;
|
|
78
|
+
baseBranch?: string | undefined;
|
|
79
|
+
}>;
|
|
80
|
+
export type DefaultsConfig = z.infer<typeof DefaultsConfigSchema>;
|
|
81
|
+
/**
|
|
82
|
+
* Orchestrator settings schema
|
|
83
|
+
* Defines runtime settings for the orchestrator
|
|
84
|
+
*/
|
|
85
|
+
export declare const OrchestratorSettingsSchema: z.ZodObject<{
|
|
86
|
+
/**
|
|
87
|
+
* Polling interval in milliseconds
|
|
88
|
+
* Minimum 5000ms (5 seconds)
|
|
89
|
+
*/
|
|
90
|
+
pollIntervalMs: z.ZodOptional<z.ZodNumber>;
|
|
91
|
+
/**
|
|
92
|
+
* Maximum number of concurrent workers
|
|
93
|
+
* Range: 1-20
|
|
94
|
+
*/
|
|
95
|
+
workerCount: z.ZodOptional<z.ZodNumber>;
|
|
96
|
+
}, "strip", z.ZodTypeAny, {
|
|
97
|
+
pollIntervalMs?: number | undefined;
|
|
98
|
+
workerCount?: number | undefined;
|
|
99
|
+
}, {
|
|
100
|
+
pollIntervalMs?: number | undefined;
|
|
101
|
+
workerCount?: number | undefined;
|
|
102
|
+
}>;
|
|
103
|
+
export type OrchestratorSettings = z.infer<typeof OrchestratorSettingsSchema>;
|
|
104
|
+
/**
|
|
105
|
+
* Cluster configuration schema
|
|
106
|
+
* Defines the development cluster topology
|
|
107
|
+
*/
|
|
108
|
+
export declare const ClusterConfigSchema: z.ZodObject<{
|
|
109
|
+
/**
|
|
110
|
+
* Cluster variant determines the Docker topology
|
|
111
|
+
* - standard: Docker-outside-of-Docker (DooD) — for apps that don't run containers
|
|
112
|
+
* - microservices: Docker-in-Docker (DinD) — each worker can run isolated container stacks
|
|
113
|
+
*/
|
|
114
|
+
variant: z.ZodDefault<z.ZodEnum<["standard", "microservices"]>>;
|
|
115
|
+
}, "strip", z.ZodTypeAny, {
|
|
116
|
+
variant: "standard" | "microservices";
|
|
117
|
+
}, {
|
|
118
|
+
variant?: "standard" | "microservices" | undefined;
|
|
119
|
+
}>;
|
|
120
|
+
export type ClusterConfig = z.infer<typeof ClusterConfigSchema>;
|
|
121
|
+
/**
|
|
122
|
+
* Complete Generacy configuration schema
|
|
123
|
+
* Root configuration object for .generacy/config.yaml
|
|
124
|
+
*/
|
|
125
|
+
export declare const GeneracyConfigSchema: z.ZodObject<{
|
|
126
|
+
/**
|
|
127
|
+
* Schema version (optional)
|
|
128
|
+
* Defaults to "1" if omitted
|
|
129
|
+
* Used for future migration support
|
|
130
|
+
*/
|
|
131
|
+
schemaVersion: z.ZodDefault<z.ZodString>;
|
|
132
|
+
/**
|
|
133
|
+
* Project configuration (required)
|
|
134
|
+
*/
|
|
135
|
+
project: z.ZodObject<{
|
|
136
|
+
/**
|
|
137
|
+
* Unique project ID from generacy.ai
|
|
138
|
+
* Format: proj_{alphanumeric}, minimum 12 characters total
|
|
139
|
+
* Example: "proj_abc123"
|
|
140
|
+
*/
|
|
141
|
+
id: z.ZodString;
|
|
142
|
+
/**
|
|
143
|
+
* Human-readable project name
|
|
144
|
+
* Maximum 255 characters
|
|
145
|
+
*/
|
|
146
|
+
name: z.ZodString;
|
|
147
|
+
}, "strip", z.ZodTypeAny, {
|
|
148
|
+
id: string;
|
|
149
|
+
name: string;
|
|
150
|
+
}, {
|
|
151
|
+
id: string;
|
|
152
|
+
name: string;
|
|
153
|
+
}>;
|
|
154
|
+
/**
|
|
155
|
+
* Repository configuration (required)
|
|
156
|
+
*/
|
|
157
|
+
repos: z.ZodObject<{
|
|
158
|
+
/**
|
|
159
|
+
* Primary repository (the "main" repo for the project)
|
|
160
|
+
* This is the repository where the onboarding PR will be created
|
|
161
|
+
*/
|
|
162
|
+
primary: z.ZodEffects<z.ZodString, string, string>;
|
|
163
|
+
/**
|
|
164
|
+
* Development repositories (optional)
|
|
165
|
+
* These repos are cloned for active development and can receive PRs
|
|
166
|
+
* Default: empty array
|
|
167
|
+
*/
|
|
168
|
+
dev: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>>;
|
|
169
|
+
/**
|
|
170
|
+
* Clone-only repositories (optional)
|
|
171
|
+
* These repos are cloned for reference/reading only (no PRs created)
|
|
172
|
+
* Default: empty array
|
|
173
|
+
*/
|
|
174
|
+
clone: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>>;
|
|
175
|
+
}, "strip", z.ZodTypeAny, {
|
|
176
|
+
primary: string;
|
|
177
|
+
dev: string[];
|
|
178
|
+
clone: string[];
|
|
179
|
+
}, {
|
|
180
|
+
primary: string;
|
|
181
|
+
dev?: string[] | undefined;
|
|
182
|
+
clone?: string[] | undefined;
|
|
183
|
+
}>;
|
|
184
|
+
/**
|
|
185
|
+
* Workflow defaults (optional)
|
|
186
|
+
*/
|
|
187
|
+
defaults: z.ZodOptional<z.ZodObject<{
|
|
188
|
+
/**
|
|
189
|
+
* Default agent to use for workflow execution
|
|
190
|
+
* Format: kebab-case (e.g., "claude-code", "cursor-agent")
|
|
191
|
+
*/
|
|
192
|
+
agent: z.ZodOptional<z.ZodString>;
|
|
193
|
+
/**
|
|
194
|
+
* Default base branch for creating feature branches
|
|
195
|
+
* No validation of branch existence (checked at runtime)
|
|
196
|
+
*/
|
|
197
|
+
baseBranch: z.ZodOptional<z.ZodString>;
|
|
198
|
+
}, "strip", z.ZodTypeAny, {
|
|
199
|
+
agent?: string | undefined;
|
|
200
|
+
baseBranch?: string | undefined;
|
|
201
|
+
}, {
|
|
202
|
+
agent?: string | undefined;
|
|
203
|
+
baseBranch?: string | undefined;
|
|
204
|
+
}>>;
|
|
205
|
+
/**
|
|
206
|
+
* Orchestrator settings (optional)
|
|
207
|
+
*/
|
|
208
|
+
orchestrator: z.ZodOptional<z.ZodObject<{
|
|
209
|
+
/**
|
|
210
|
+
* Polling interval in milliseconds
|
|
211
|
+
* Minimum 5000ms (5 seconds)
|
|
212
|
+
*/
|
|
213
|
+
pollIntervalMs: z.ZodOptional<z.ZodNumber>;
|
|
214
|
+
/**
|
|
215
|
+
* Maximum number of concurrent workers
|
|
216
|
+
* Range: 1-20
|
|
217
|
+
*/
|
|
218
|
+
workerCount: z.ZodOptional<z.ZodNumber>;
|
|
219
|
+
}, "strip", z.ZodTypeAny, {
|
|
220
|
+
pollIntervalMs?: number | undefined;
|
|
221
|
+
workerCount?: number | undefined;
|
|
222
|
+
}, {
|
|
223
|
+
pollIntervalMs?: number | undefined;
|
|
224
|
+
workerCount?: number | undefined;
|
|
225
|
+
}>>;
|
|
226
|
+
/**
|
|
227
|
+
* Cluster configuration (optional)
|
|
228
|
+
* Defines the development cluster Docker topology
|
|
229
|
+
*/
|
|
230
|
+
cluster: z.ZodOptional<z.ZodObject<{
|
|
231
|
+
/**
|
|
232
|
+
* Cluster variant determines the Docker topology
|
|
233
|
+
* - standard: Docker-outside-of-Docker (DooD) — for apps that don't run containers
|
|
234
|
+
* - microservices: Docker-in-Docker (DinD) — each worker can run isolated container stacks
|
|
235
|
+
*/
|
|
236
|
+
variant: z.ZodDefault<z.ZodEnum<["standard", "microservices"]>>;
|
|
237
|
+
}, "strip", z.ZodTypeAny, {
|
|
238
|
+
variant: "standard" | "microservices";
|
|
239
|
+
}, {
|
|
240
|
+
variant?: "standard" | "microservices" | undefined;
|
|
241
|
+
}>>;
|
|
242
|
+
}, "strip", z.ZodTypeAny, {
|
|
243
|
+
repos: {
|
|
244
|
+
primary: string;
|
|
245
|
+
dev: string[];
|
|
246
|
+
clone: string[];
|
|
247
|
+
};
|
|
248
|
+
schemaVersion: string;
|
|
249
|
+
project: {
|
|
250
|
+
id: string;
|
|
251
|
+
name: string;
|
|
252
|
+
};
|
|
253
|
+
orchestrator?: {
|
|
254
|
+
pollIntervalMs?: number | undefined;
|
|
255
|
+
workerCount?: number | undefined;
|
|
256
|
+
} | undefined;
|
|
257
|
+
defaults?: {
|
|
258
|
+
agent?: string | undefined;
|
|
259
|
+
baseBranch?: string | undefined;
|
|
260
|
+
} | undefined;
|
|
261
|
+
cluster?: {
|
|
262
|
+
variant: "standard" | "microservices";
|
|
263
|
+
} | undefined;
|
|
264
|
+
}, {
|
|
265
|
+
repos: {
|
|
266
|
+
primary: string;
|
|
267
|
+
dev?: string[] | undefined;
|
|
268
|
+
clone?: string[] | undefined;
|
|
269
|
+
};
|
|
270
|
+
project: {
|
|
271
|
+
id: string;
|
|
272
|
+
name: string;
|
|
273
|
+
};
|
|
274
|
+
orchestrator?: {
|
|
275
|
+
pollIntervalMs?: number | undefined;
|
|
276
|
+
workerCount?: number | undefined;
|
|
277
|
+
} | undefined;
|
|
278
|
+
schemaVersion?: string | undefined;
|
|
279
|
+
defaults?: {
|
|
280
|
+
agent?: string | undefined;
|
|
281
|
+
baseBranch?: string | undefined;
|
|
282
|
+
} | undefined;
|
|
283
|
+
cluster?: {
|
|
284
|
+
variant?: "standard" | "microservices" | undefined;
|
|
285
|
+
} | undefined;
|
|
286
|
+
}>;
|
|
287
|
+
export type GeneracyConfig = z.infer<typeof GeneracyConfigSchema>;
|
|
288
|
+
/**
|
|
289
|
+
* Validate a configuration object against the schema
|
|
290
|
+
*
|
|
291
|
+
* @param config - Unknown configuration object to validate
|
|
292
|
+
* @returns Validated and typed configuration
|
|
293
|
+
* @throws ZodError if validation fails
|
|
294
|
+
*
|
|
295
|
+
* @example
|
|
296
|
+
* ```typescript
|
|
297
|
+
* const config = validateConfig({
|
|
298
|
+
* project: { id: 'proj_abc123', name: 'My Project' },
|
|
299
|
+
* repos: { primary: 'github.com/acme/main' }
|
|
300
|
+
* });
|
|
301
|
+
* ```
|
|
302
|
+
*/
|
|
303
|
+
export declare function validateConfig(config: unknown): GeneracyConfig;
|
|
304
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/config/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,eAAO,MAAM,mBAAmB;IAC9B;;;;OAIG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H,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,OAAO,GAAG,cAAc,CAE9D"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Project configuration schema
|
|
4
|
+
* Defines project metadata and link to generacy.ai
|
|
5
|
+
*/
|
|
6
|
+
export const ProjectConfigSchema = z.object({
|
|
7
|
+
/**
|
|
8
|
+
* Unique project ID from generacy.ai
|
|
9
|
+
* Format: proj_{alphanumeric}, minimum 12 characters total
|
|
10
|
+
* Example: "proj_abc123"
|
|
11
|
+
*/
|
|
12
|
+
id: z.string()
|
|
13
|
+
.regex(/^proj_[a-z0-9]+$/, 'Project ID must match format: proj_{alphanumeric}')
|
|
14
|
+
.min(12, 'Project ID must be at least 12 characters'),
|
|
15
|
+
/**
|
|
16
|
+
* Human-readable project name
|
|
17
|
+
* Maximum 255 characters
|
|
18
|
+
*/
|
|
19
|
+
name: z.string()
|
|
20
|
+
.min(1, 'Project name cannot be empty')
|
|
21
|
+
.max(255, 'Project name cannot exceed 255 characters'),
|
|
22
|
+
});
|
|
23
|
+
/**
|
|
24
|
+
* Repository URL schema
|
|
25
|
+
* Format: github.com/{owner}/{repo}
|
|
26
|
+
* Protocol-agnostic (no https:// or ssh://, no .git suffix)
|
|
27
|
+
*/
|
|
28
|
+
const RepositoryUrlSchema = z.string()
|
|
29
|
+
.regex(/^github\.com\/[a-zA-Z0-9_-]+\/[a-zA-Z0-9._-]+$/, 'Repository URL must match format: github.com/{owner}/{repo}')
|
|
30
|
+
.refine((url) => !url.endsWith('.git'), 'Repository URL must not end with .git suffix');
|
|
31
|
+
/**
|
|
32
|
+
* Repository configuration schema
|
|
33
|
+
* Defines repository relationships for the project
|
|
34
|
+
*/
|
|
35
|
+
export const ReposConfigSchema = z.object({
|
|
36
|
+
/**
|
|
37
|
+
* Primary repository (the "main" repo for the project)
|
|
38
|
+
* This is the repository where the onboarding PR will be created
|
|
39
|
+
*/
|
|
40
|
+
primary: RepositoryUrlSchema,
|
|
41
|
+
/**
|
|
42
|
+
* Development repositories (optional)
|
|
43
|
+
* These repos are cloned for active development and can receive PRs
|
|
44
|
+
* Default: empty array
|
|
45
|
+
*/
|
|
46
|
+
dev: z.array(RepositoryUrlSchema).optional().default([]),
|
|
47
|
+
/**
|
|
48
|
+
* Clone-only repositories (optional)
|
|
49
|
+
* These repos are cloned for reference/reading only (no PRs created)
|
|
50
|
+
* Default: empty array
|
|
51
|
+
*/
|
|
52
|
+
clone: z.array(RepositoryUrlSchema).optional().default([]),
|
|
53
|
+
});
|
|
54
|
+
/**
|
|
55
|
+
* Workflow defaults schema
|
|
56
|
+
* Defines default settings for workflow execution
|
|
57
|
+
*/
|
|
58
|
+
export const DefaultsConfigSchema = z.object({
|
|
59
|
+
/**
|
|
60
|
+
* Default agent to use for workflow execution
|
|
61
|
+
* Format: kebab-case (e.g., "claude-code", "cursor-agent")
|
|
62
|
+
*/
|
|
63
|
+
agent: z.string()
|
|
64
|
+
.regex(/^[a-z0-9]+(-[a-z0-9]+)*$/, 'Agent name must be kebab-case format (lowercase alphanumeric with hyphens)')
|
|
65
|
+
.optional(),
|
|
66
|
+
/**
|
|
67
|
+
* Default base branch for creating feature branches
|
|
68
|
+
* No validation of branch existence (checked at runtime)
|
|
69
|
+
*/
|
|
70
|
+
baseBranch: z.string()
|
|
71
|
+
.min(1, 'Base branch cannot be empty')
|
|
72
|
+
.optional(),
|
|
73
|
+
});
|
|
74
|
+
/**
|
|
75
|
+
* Orchestrator settings schema
|
|
76
|
+
* Defines runtime settings for the orchestrator
|
|
77
|
+
*/
|
|
78
|
+
export const OrchestratorSettingsSchema = z.object({
|
|
79
|
+
/**
|
|
80
|
+
* Polling interval in milliseconds
|
|
81
|
+
* Minimum 5000ms (5 seconds)
|
|
82
|
+
*/
|
|
83
|
+
pollIntervalMs: z.number()
|
|
84
|
+
.int('Poll interval must be an integer')
|
|
85
|
+
.min(5000, 'Poll interval must be at least 5000ms (5 seconds)')
|
|
86
|
+
.optional(),
|
|
87
|
+
/**
|
|
88
|
+
* Maximum number of concurrent workers
|
|
89
|
+
* Range: 1-20
|
|
90
|
+
*/
|
|
91
|
+
workerCount: z.number()
|
|
92
|
+
.int('Worker count must be an integer')
|
|
93
|
+
.min(1, 'Worker count must be at least 1')
|
|
94
|
+
.max(20, 'Worker count cannot exceed 20')
|
|
95
|
+
.optional(),
|
|
96
|
+
});
|
|
97
|
+
/**
|
|
98
|
+
* Cluster configuration schema
|
|
99
|
+
* Defines the development cluster topology
|
|
100
|
+
*/
|
|
101
|
+
export const ClusterConfigSchema = z.object({
|
|
102
|
+
/**
|
|
103
|
+
* Cluster variant determines the Docker topology
|
|
104
|
+
* - standard: Docker-outside-of-Docker (DooD) — for apps that don't run containers
|
|
105
|
+
* - microservices: Docker-in-Docker (DinD) — each worker can run isolated container stacks
|
|
106
|
+
*/
|
|
107
|
+
variant: z.enum(['standard', 'microservices']).default('standard'),
|
|
108
|
+
});
|
|
109
|
+
/**
|
|
110
|
+
* Complete Generacy configuration schema
|
|
111
|
+
* Root configuration object for .generacy/config.yaml
|
|
112
|
+
*/
|
|
113
|
+
export const GeneracyConfigSchema = z.object({
|
|
114
|
+
/**
|
|
115
|
+
* Schema version (optional)
|
|
116
|
+
* Defaults to "1" if omitted
|
|
117
|
+
* Used for future migration support
|
|
118
|
+
*/
|
|
119
|
+
schemaVersion: z.string().default('1'),
|
|
120
|
+
/**
|
|
121
|
+
* Project configuration (required)
|
|
122
|
+
*/
|
|
123
|
+
project: ProjectConfigSchema,
|
|
124
|
+
/**
|
|
125
|
+
* Repository configuration (required)
|
|
126
|
+
*/
|
|
127
|
+
repos: ReposConfigSchema,
|
|
128
|
+
/**
|
|
129
|
+
* Workflow defaults (optional)
|
|
130
|
+
*/
|
|
131
|
+
defaults: DefaultsConfigSchema.optional(),
|
|
132
|
+
/**
|
|
133
|
+
* Orchestrator settings (optional)
|
|
134
|
+
*/
|
|
135
|
+
orchestrator: OrchestratorSettingsSchema.optional(),
|
|
136
|
+
/**
|
|
137
|
+
* Cluster configuration (optional)
|
|
138
|
+
* Defines the development cluster Docker topology
|
|
139
|
+
*/
|
|
140
|
+
cluster: ClusterConfigSchema.optional(),
|
|
141
|
+
});
|
|
142
|
+
/**
|
|
143
|
+
* Validate a configuration object against the schema
|
|
144
|
+
*
|
|
145
|
+
* @param config - Unknown configuration object to validate
|
|
146
|
+
* @returns Validated and typed configuration
|
|
147
|
+
* @throws ZodError if validation fails
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* ```typescript
|
|
151
|
+
* const config = validateConfig({
|
|
152
|
+
* project: { id: 'proj_abc123', name: 'My Project' },
|
|
153
|
+
* repos: { primary: 'github.com/acme/main' }
|
|
154
|
+
* });
|
|
155
|
+
* ```
|
|
156
|
+
*/
|
|
157
|
+
export function validateConfig(config) {
|
|
158
|
+
return GeneracyConfigSchema.parse(config);
|
|
159
|
+
}
|
|
160
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/config/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C;;;;OAIG;IACH,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;SACX,KAAK,CAAC,kBAAkB,EAAE,mDAAmD,CAAC;SAC9E,GAAG,CAAC,EAAE,EAAE,2CAA2C,CAAC;IAEvD;;;OAGG;IACH,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;SACb,GAAG,CAAC,CAAC,EAAE,8BAA8B,CAAC;SACtC,GAAG,CAAC,GAAG,EAAE,2CAA2C,CAA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AC,MAAM,EAAE;SACpB,GAAG,CAAC,iCAAiC,CAAC;SACtC,GAAG,CAAC,CAAC,EAAE,iCAAiC,CAAC;SACzC,GAAG,CAAC,EAAE,EAAE,+BAA+B,CAAC;SACxC,QAAQ,EAAE;CACd,CAAC,CAAC;AAIH;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C;;;;OAIG;IACH,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC;CACnE,CAAC,CAAC;AAIH;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C;;;;OAIG;IACH,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC;IAEtC;;OAEG;IACH,OAAO,EAAE,mBAAmB;IAE5B;;OAEG;IACH,KAAK,EAAE,iBAAiB;IAExB;;OAEG;IACH,QAAQ,EAAE,oBAAoB,CAAC,QAAQ,EAAE;IAEzC;;OAEG;IACH,YAAY,EAAE,0BAA0B,CAAC,QAAQ,EAAE;IAEnD;;;OAGG;IACH,OAAO,EAAE,mBAAmB,CAAC,QAAQ,EAAE;CACxC,CAAC,CAAC;AAIH;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,cAAc,CAAC,MAAe;IAC5C,OAAO,oBAAoB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { GeneracyConfig } from './schema.js';
|
|
2
|
+
/**
|
|
3
|
+
* Validation error class for semantic validation failures
|
|
4
|
+
*/
|
|
5
|
+
export declare class ConfigValidationError extends Error {
|
|
6
|
+
readonly conflictingRepos?: string[] | undefined;
|
|
7
|
+
readonly locations?: string[] | undefined;
|
|
8
|
+
constructor(message: string, conflictingRepos?: string[] | undefined, locations?: string[] | undefined);
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Check for duplicate repositories across primary, dev, and clone lists
|
|
12
|
+
*
|
|
13
|
+
* This function implements detailed duplicate detection with clear error messages
|
|
14
|
+
* indicating exactly which repositories conflict and in which lists they appear.
|
|
15
|
+
*
|
|
16
|
+
* Validation rules:
|
|
17
|
+
* - Primary repo cannot appear in dev list
|
|
18
|
+
* - Primary repo cannot appear in clone list
|
|
19
|
+
* - No repository can appear in both dev and clone lists
|
|
20
|
+
* - No repository can appear twice within the same list (dev or clone)
|
|
21
|
+
*
|
|
22
|
+
* @param config - Validated Generacy configuration
|
|
23
|
+
* @throws ConfigValidationError if duplicates are found, with details about the conflict
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* // Valid configuration - no duplicates
|
|
28
|
+
* validateNoDuplicateRepos({
|
|
29
|
+
* repos: {
|
|
30
|
+
* primary: 'github.com/acme/main',
|
|
31
|
+
* dev: ['github.com/acme/lib'],
|
|
32
|
+
* clone: ['github.com/acme/docs']
|
|
33
|
+
* }
|
|
34
|
+
* });
|
|
35
|
+
*
|
|
36
|
+
* // Invalid - throws with details about which lists conflict
|
|
37
|
+
* validateNoDuplicateRepos({
|
|
38
|
+
* repos: {
|
|
39
|
+
* primary: 'github.com/acme/main',
|
|
40
|
+
* dev: ['github.com/acme/main'], // Conflict!
|
|
41
|
+
* clone: []
|
|
42
|
+
* }
|
|
43
|
+
* });
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export declare function validateNoDuplicateRepos(config: GeneracyConfig): void;
|
|
47
|
+
/**
|
|
48
|
+
* Perform all semantic validations on a configuration
|
|
49
|
+
*
|
|
50
|
+
* @param config - Validated Generacy configuration
|
|
51
|
+
* @throws ConfigValidationError if any semantic validation fails
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* const config = validateConfig(rawConfig);
|
|
56
|
+
* validateSemantics(config); // Throws if semantic rules violated
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export declare function validateSemantics(config: GeneracyConfig): void;
|
|
60
|
+
//# sourceMappingURL=validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../src/config/validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;aAG5B,gBAAgB,CAAC,EAAE,MAAM,EAAE;aAC3B,SAAS,CAAC,EAAE,MAAM,EAAE;gBAFpC,OAAO,EAAE,MAAM,EACC,gBAAgB,CAAC,EAAE,MAAM,EAAE,YAAA,EAC3B,SAAS,CAAC,EAAE,MAAM,EAAE,YAAA;CAKvC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,CAwDrE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,CAE9D"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validation error class for semantic validation failures
|
|
3
|
+
*/
|
|
4
|
+
export class ConfigValidationError extends Error {
|
|
5
|
+
conflictingRepos;
|
|
6
|
+
locations;
|
|
7
|
+
constructor(message, conflictingRepos, locations) {
|
|
8
|
+
super(message);
|
|
9
|
+
this.conflictingRepos = conflictingRepos;
|
|
10
|
+
this.locations = locations;
|
|
11
|
+
this.name = 'ConfigValidationError';
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Check for duplicate repositories across primary, dev, and clone lists
|
|
16
|
+
*
|
|
17
|
+
* This function implements detailed duplicate detection with clear error messages
|
|
18
|
+
* indicating exactly which repositories conflict and in which lists they appear.
|
|
19
|
+
*
|
|
20
|
+
* Validation rules:
|
|
21
|
+
* - Primary repo cannot appear in dev list
|
|
22
|
+
* - Primary repo cannot appear in clone list
|
|
23
|
+
* - No repository can appear in both dev and clone lists
|
|
24
|
+
* - No repository can appear twice within the same list (dev or clone)
|
|
25
|
+
*
|
|
26
|
+
* @param config - Validated Generacy configuration
|
|
27
|
+
* @throws ConfigValidationError if duplicates are found, with details about the conflict
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* // Valid configuration - no duplicates
|
|
32
|
+
* validateNoDuplicateRepos({
|
|
33
|
+
* repos: {
|
|
34
|
+
* primary: 'github.com/acme/main',
|
|
35
|
+
* dev: ['github.com/acme/lib'],
|
|
36
|
+
* clone: ['github.com/acme/docs']
|
|
37
|
+
* }
|
|
38
|
+
* });
|
|
39
|
+
*
|
|
40
|
+
* // Invalid - throws with details about which lists conflict
|
|
41
|
+
* validateNoDuplicateRepos({
|
|
42
|
+
* repos: {
|
|
43
|
+
* primary: 'github.com/acme/main',
|
|
44
|
+
* dev: ['github.com/acme/main'], // Conflict!
|
|
45
|
+
* clone: []
|
|
46
|
+
* }
|
|
47
|
+
* });
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
export function validateNoDuplicateRepos(config) {
|
|
51
|
+
const { primary, dev = [], clone = [] } = config.repos;
|
|
52
|
+
const allDuplicates = new Set();
|
|
53
|
+
const locations = new Set();
|
|
54
|
+
// Check if primary is in dev list
|
|
55
|
+
if (dev.includes(primary)) {
|
|
56
|
+
allDuplicates.add(primary);
|
|
57
|
+
locations.add('primary').add('dev');
|
|
58
|
+
}
|
|
59
|
+
// Check if primary is in clone list
|
|
60
|
+
if (clone.includes(primary)) {
|
|
61
|
+
allDuplicates.add(primary);
|
|
62
|
+
locations.add('primary').add('clone');
|
|
63
|
+
}
|
|
64
|
+
// Check for duplicates within dev list
|
|
65
|
+
const devSeen = new Set();
|
|
66
|
+
for (const repo of dev) {
|
|
67
|
+
if (devSeen.has(repo)) {
|
|
68
|
+
allDuplicates.add(repo);
|
|
69
|
+
locations.add('dev');
|
|
70
|
+
}
|
|
71
|
+
devSeen.add(repo);
|
|
72
|
+
}
|
|
73
|
+
// Check for duplicates within clone list
|
|
74
|
+
const cloneSeen = new Set();
|
|
75
|
+
for (const repo of clone) {
|
|
76
|
+
if (cloneSeen.has(repo)) {
|
|
77
|
+
allDuplicates.add(repo);
|
|
78
|
+
locations.add('clone');
|
|
79
|
+
}
|
|
80
|
+
cloneSeen.add(repo);
|
|
81
|
+
}
|
|
82
|
+
// Check for overlaps between dev and clone lists
|
|
83
|
+
for (const repo of clone) {
|
|
84
|
+
if (devSeen.has(repo)) {
|
|
85
|
+
allDuplicates.add(repo);
|
|
86
|
+
locations.add('dev').add('clone');
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
// Report duplicates if found
|
|
90
|
+
if (allDuplicates.size > 0) {
|
|
91
|
+
const dupeList = Array.from(allDuplicates).join(', ');
|
|
92
|
+
const locationList = Array.from(locations);
|
|
93
|
+
throw new ConfigValidationError(`Duplicate repositories found: ${dupeList}. ` +
|
|
94
|
+
'Each repository can only appear once across primary, dev, and clone lists.', Array.from(allDuplicates), locationList);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Perform all semantic validations on a configuration
|
|
99
|
+
*
|
|
100
|
+
* @param config - Validated Generacy configuration
|
|
101
|
+
* @throws ConfigValidationError if any semantic validation fails
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```typescript
|
|
105
|
+
* const config = validateConfig(rawConfig);
|
|
106
|
+
* validateSemantics(config); // Throws if semantic rules violated
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
109
|
+
export function validateSemantics(config) {
|
|
110
|
+
validateNoDuplicateRepos(config);
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=validator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"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