@cullit/config 0.5.0 → 1.4.0
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/dist/index.d.ts +30 -1
- package/dist/index.js +48 -8
- package/package.json +3 -2
package/dist/index.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ interface SourceConfig {
|
|
|
17
17
|
type: string;
|
|
18
18
|
owner?: string;
|
|
19
19
|
repo?: string;
|
|
20
|
+
repoPath?: string;
|
|
20
21
|
enrichment?: EnrichmentType[];
|
|
21
22
|
}
|
|
22
23
|
interface PublishTarget {
|
|
@@ -38,13 +39,41 @@ interface OpenClawConfig {
|
|
|
38
39
|
baseUrl?: string;
|
|
39
40
|
token?: string;
|
|
40
41
|
}
|
|
42
|
+
interface GitLabConfig {
|
|
43
|
+
domain?: string;
|
|
44
|
+
projectId: string;
|
|
45
|
+
}
|
|
46
|
+
interface BitbucketConfig {
|
|
47
|
+
workspace: string;
|
|
48
|
+
repoSlug: string;
|
|
49
|
+
}
|
|
50
|
+
interface ConfluenceConfig {
|
|
51
|
+
domain: string;
|
|
52
|
+
spaceKey: string;
|
|
53
|
+
parentPageId?: string;
|
|
54
|
+
}
|
|
55
|
+
interface NotionConfig {
|
|
56
|
+
databaseId: string;
|
|
57
|
+
}
|
|
58
|
+
interface RepoSource {
|
|
59
|
+
url?: string;
|
|
60
|
+
path?: string;
|
|
61
|
+
name?: string;
|
|
62
|
+
from?: string;
|
|
63
|
+
to?: string;
|
|
64
|
+
}
|
|
41
65
|
interface CullConfig {
|
|
42
66
|
ai: AIConfig;
|
|
43
67
|
source: SourceConfig;
|
|
44
68
|
publish: PublishTarget[];
|
|
69
|
+
repos?: RepoSource[];
|
|
45
70
|
jira?: JiraConfig;
|
|
46
71
|
linear?: LinearConfig;
|
|
47
72
|
openclaw?: OpenClawConfig;
|
|
73
|
+
gitlab?: GitLabConfig;
|
|
74
|
+
bitbucket?: BitbucketConfig;
|
|
75
|
+
confluence?: ConfluenceConfig;
|
|
76
|
+
notion?: NotionConfig;
|
|
48
77
|
}
|
|
49
78
|
|
|
50
79
|
/**
|
|
@@ -54,4 +83,4 @@ interface CullConfig {
|
|
|
54
83
|
*/
|
|
55
84
|
declare function loadConfig(cwdOrPath?: string): CullConfig;
|
|
56
85
|
|
|
57
|
-
export { type AIConfig, type AIProvider, type Audience, type CullConfig, type EnrichmentType, type JiraConfig, type LinearConfig, type OpenClawConfig, type OutputFormat, type PublishTarget, type PublisherType, type SourceConfig, type Tone, loadConfig };
|
|
86
|
+
export { type AIConfig, type AIProvider, type Audience, type BitbucketConfig, type ConfluenceConfig, type CullConfig, type EnrichmentType, type GitLabConfig, type JiraConfig, type LinearConfig, type NotionConfig, type OpenClawConfig, type OutputFormat, type PublishTarget, type PublisherType, type RepoSource, type SourceConfig, type Tone, loadConfig };
|
package/dist/index.js
CHANGED
|
@@ -118,9 +118,11 @@ function parseValue(val) {
|
|
|
118
118
|
return val;
|
|
119
119
|
}
|
|
120
120
|
function resolveEnvVars(obj) {
|
|
121
|
-
if (typeof obj === "string"
|
|
122
|
-
|
|
123
|
-
|
|
121
|
+
if (typeof obj === "string") {
|
|
122
|
+
if (obj.startsWith("$")) {
|
|
123
|
+
const envKey = obj.startsWith("${") && obj.endsWith("}") ? obj.slice(2, -1) : obj.substring(1);
|
|
124
|
+
return process.env[envKey] || obj;
|
|
125
|
+
}
|
|
124
126
|
}
|
|
125
127
|
if (Array.isArray(obj)) return obj.map(resolveEnvVars);
|
|
126
128
|
if (obj && typeof obj === "object") {
|
|
@@ -145,15 +147,53 @@ function mergeWithDefaults(parsed) {
|
|
|
145
147
|
publish: normalizePublishTargets(parsed.publish || DEFAULT_CONFIG.publish),
|
|
146
148
|
jira: parsed.jira,
|
|
147
149
|
linear: parsed.linear,
|
|
148
|
-
openclaw: parsed.openclaw
|
|
150
|
+
openclaw: parsed.openclaw,
|
|
151
|
+
gitlab: parsed.gitlab,
|
|
152
|
+
bitbucket: parsed.bitbucket,
|
|
153
|
+
confluence: parsed.confluence,
|
|
154
|
+
notion: parsed.notion,
|
|
155
|
+
...parsed.repos ? { repos: validateRepos(parsed.repos) } : {}
|
|
149
156
|
};
|
|
150
157
|
}
|
|
158
|
+
function validateRepos(repos) {
|
|
159
|
+
if (!Array.isArray(repos)) {
|
|
160
|
+
throw new Error('Config error: "repos" must be an array');
|
|
161
|
+
}
|
|
162
|
+
return repos.map((repo, i) => {
|
|
163
|
+
if (!repo || typeof repo !== "object") {
|
|
164
|
+
throw new Error(`Config error: repos[${i}] must be an object`);
|
|
165
|
+
}
|
|
166
|
+
if (!repo.url && !repo.path) {
|
|
167
|
+
throw new Error(`Config error: repos[${i}] must have either "url" or "path"`);
|
|
168
|
+
}
|
|
169
|
+
if (repo.url && typeof repo.url !== "string") {
|
|
170
|
+
throw new Error(`Config error: repos[${i}].url must be a string`);
|
|
171
|
+
}
|
|
172
|
+
if (repo.path && typeof repo.path !== "string") {
|
|
173
|
+
throw new Error(`Config error: repos[${i}].path must be a string`);
|
|
174
|
+
}
|
|
175
|
+
return repo;
|
|
176
|
+
});
|
|
177
|
+
}
|
|
151
178
|
function normalizePublishTargets(targets) {
|
|
152
179
|
return targets.map((t) => {
|
|
153
|
-
const normalized = {
|
|
154
|
-
if (t.
|
|
155
|
-
|
|
156
|
-
|
|
180
|
+
const normalized = { ...t };
|
|
181
|
+
if (t.webhook_url && !t.webhookUrl) {
|
|
182
|
+
normalized.webhookUrl = t.webhook_url;
|
|
183
|
+
delete normalized["webhook_url"];
|
|
184
|
+
}
|
|
185
|
+
if (t.parent_page_id && !t.parentPageId) {
|
|
186
|
+
normalized.parentPageId = t.parent_page_id;
|
|
187
|
+
delete normalized["parent_page_id"];
|
|
188
|
+
}
|
|
189
|
+
if (t.space_key && !t.spaceKey) {
|
|
190
|
+
normalized.spaceKey = t.space_key;
|
|
191
|
+
delete normalized["space_key"];
|
|
192
|
+
}
|
|
193
|
+
if (t.database_id && !t.databaseId) {
|
|
194
|
+
normalized.databaseId = t.database_id;
|
|
195
|
+
delete normalized["database_id"];
|
|
196
|
+
}
|
|
157
197
|
return normalized;
|
|
158
198
|
});
|
|
159
199
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cullit/config",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Config loader for Cullit — YAML config parsing with env var resolution.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
|
28
28
|
"build": "tsup src/index.ts --format esm --dts --clean",
|
|
29
|
-
"dev": "tsup src/index.ts --format esm --watch"
|
|
29
|
+
"dev": "tsup src/index.ts --format esm --watch",
|
|
30
|
+
"test": "vitest run"
|
|
30
31
|
}
|
|
31
32
|
}
|