@contextforge/core 0.1.2 → 0.1.6

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 (3) hide show
  1. package/dist/index.d.ts +297 -131
  2. package/dist/index.js +931 -432
  3. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ import { z } from 'zod';
3
3
  type PackageManager = "pnpm" | "npm" | "yarn" | "bun" | "unknown";
4
4
  type ProjectFramework = "next-app-router" | "next-pages-router" | "vite-react" | "unknown";
5
5
  type ProjectLanguage = "typescript" | "javascript";
6
- type AITool = "codex" | "claude" | "cursor" | "copilot";
6
+ type AITool$1 = "codex" | "claude" | "cursor" | "copilot";
7
7
  type ProjectAnalysis = {
8
8
  root: string;
9
9
  packageManager: PackageManager;
@@ -17,6 +17,9 @@ type ProjectAnalysis = {
17
17
  prisma: boolean;
18
18
  drizzle: boolean;
19
19
  };
20
+ services: {
21
+ supabase: boolean;
22
+ };
20
23
  testing: {
21
24
  vitest: boolean;
22
25
  jest: boolean;
@@ -38,125 +41,189 @@ declare function detectProject(root: string): Promise<ProjectAnalysis>;
38
41
 
39
42
  declare function detectPackageManager(root: string): Promise<PackageManager>;
40
43
 
41
- declare const PackSchema: z.ZodObject<{
44
+ declare const PackFileTypeSchema: z.ZodEnum<{
45
+ claude: "claude";
46
+ cursor: "cursor";
47
+ copilot: "copilot";
48
+ rules: "rules";
49
+ agents: "agents";
50
+ skill: "skill";
51
+ }>;
52
+ type PackFileType = z.infer<typeof PackFileTypeSchema>;
53
+ declare const RegistryPackSourceSchema: z.ZodOptional<z.ZodObject<{
54
+ provider: z.ZodOptional<z.ZodString>;
55
+ license: z.ZodOptional<z.ZodString>;
56
+ }, z.core.$catchall<z.ZodUnknown>>>;
57
+ declare const RegistryPackSummarySchema: z.ZodObject<{
42
58
  name: z.ZodString;
43
- version: z.ZodOptional<z.ZodString>;
44
59
  title: z.ZodString;
45
- description: z.ZodString;
46
- category: z.ZodEnum<{
47
- framework: "framework";
48
- database: "database";
49
- testing: "testing";
50
- security: "security";
51
- ui: "ui";
52
- workflow: "workflow";
60
+ topic: z.ZodString;
61
+ description: z.ZodDefault<z.ZodString>;
62
+ path: z.ZodString;
63
+ source: z.ZodOptional<z.ZodObject<{
64
+ provider: z.ZodOptional<z.ZodString>;
65
+ license: z.ZodOptional<z.ZodString>;
66
+ }, z.core.$catchall<z.ZodUnknown>>>;
67
+ }, z.core.$strip>;
68
+ declare const RegistryIndexSchema: z.ZodObject<{
69
+ name: z.ZodOptional<z.ZodString>;
70
+ version: z.ZodOptional<z.ZodString>;
71
+ schemaVersion: z.ZodOptional<z.ZodString>;
72
+ description: z.ZodOptional<z.ZodString>;
73
+ topics: z.ZodDefault<z.ZodArray<z.ZodString>>;
74
+ packs: z.ZodArray<z.ZodObject<{
75
+ name: z.ZodString;
76
+ title: z.ZodString;
77
+ topic: z.ZodString;
78
+ description: z.ZodDefault<z.ZodString>;
79
+ path: z.ZodString;
80
+ source: z.ZodOptional<z.ZodObject<{
81
+ provider: z.ZodOptional<z.ZodString>;
82
+ license: z.ZodOptional<z.ZodString>;
83
+ }, z.core.$catchall<z.ZodUnknown>>>;
84
+ }, z.core.$strip>>;
85
+ }, z.core.$strip>;
86
+ declare const PackFileSchema: z.ZodObject<{
87
+ type: z.ZodEnum<{
88
+ claude: "claude";
89
+ cursor: "cursor";
90
+ copilot: "copilot";
91
+ rules: "rules";
92
+ agents: "agents";
93
+ skill: "skill";
53
94
  }>;
95
+ path: z.ZodString;
96
+ output: z.ZodOptional<z.ZodString>;
97
+ mode: z.ZodOptional<z.ZodString>;
98
+ }, z.core.$strip>;
99
+ declare const PackManifestSchema: z.ZodObject<{
100
+ name: z.ZodString;
101
+ title: z.ZodString;
102
+ version: z.ZodDefault<z.ZodString>;
103
+ topic: z.ZodString;
104
+ description: z.ZodDefault<z.ZodString>;
105
+ classification: z.ZodDefault<z.ZodEnum<{
106
+ "always-referenced": "always-referenced";
107
+ "task-triggered": "task-triggered";
108
+ "permission-gated": "permission-gated";
109
+ }>>;
110
+ source: z.ZodOptional<z.ZodObject<{
111
+ provider: z.ZodOptional<z.ZodString>;
112
+ license: z.ZodOptional<z.ZodString>;
113
+ }, z.core.$catchall<z.ZodUnknown>>>;
54
114
  detect: z.ZodOptional<z.ZodObject<{
55
115
  files: z.ZodOptional<z.ZodArray<z.ZodString>>;
56
116
  packages: z.ZodOptional<z.ZodArray<z.ZodString>>;
57
117
  }, z.core.$strip>>;
58
- outputs: z.ZodObject<{
59
- globalRules: z.ZodDefault<z.ZodBoolean>;
60
- skill: z.ZodDefault<z.ZodBoolean>;
61
- cursorRule: z.ZodDefault<z.ZodBoolean>;
62
- copilotInstruction: z.ZodDefault<z.ZodBoolean>;
63
- }, z.core.$strip>;
118
+ files: z.ZodDefault<z.ZodArray<z.ZodObject<{
119
+ type: z.ZodEnum<{
120
+ claude: "claude";
121
+ cursor: "cursor";
122
+ copilot: "copilot";
123
+ rules: "rules";
124
+ agents: "agents";
125
+ skill: "skill";
126
+ }>;
127
+ path: z.ZodString;
128
+ output: z.ZodOptional<z.ZodString>;
129
+ mode: z.ZodOptional<z.ZodString>;
130
+ }, z.core.$strip>>>;
131
+ outputs: z.ZodPipe<z.ZodDefault<z.ZodObject<{
132
+ globalRules: z.ZodOptional<z.ZodBoolean>;
133
+ agentsInstruction: z.ZodOptional<z.ZodBoolean>;
134
+ claudeInstruction: z.ZodOptional<z.ZodBoolean>;
135
+ skill: z.ZodOptional<z.ZodBoolean>;
136
+ cursorRule: z.ZodOptional<z.ZodBoolean>;
137
+ copilotInstruction: z.ZodOptional<z.ZodBoolean>;
138
+ }, z.core.$strip>>, z.ZodTransform<{
139
+ globalRules: boolean;
140
+ agentsInstruction: boolean;
141
+ claudeInstruction: boolean;
142
+ skill: boolean;
143
+ cursorRule: boolean;
144
+ copilotInstruction: boolean;
145
+ }, {
146
+ globalRules?: boolean | undefined;
147
+ agentsInstruction?: boolean | undefined;
148
+ claudeInstruction?: boolean | undefined;
149
+ skill?: boolean | undefined;
150
+ cursorRule?: boolean | undefined;
151
+ copilotInstruction?: boolean | undefined;
152
+ }>>;
64
153
  }, z.core.$strip>;
65
- type Pack = z.infer<typeof PackSchema>;
66
- type LoadedPack = Pack & {
67
- directory: string;
68
- source: "project-cache" | "remote" | "local";
69
- registryUrl?: string;
70
- files: {
71
- rules: string;
72
- skill?: string;
73
- cursor?: string;
74
- copilot?: string;
75
- };
154
+ type RegistryIndex = z.infer<typeof RegistryIndexSchema>;
155
+ type RegistryPackSummary = z.infer<typeof RegistryPackSummarySchema>;
156
+ type PackFile = z.infer<typeof PackFileSchema>;
157
+ type PackManifest = z.infer<typeof PackManifestSchema>;
158
+ type InstalledPack = {
159
+ manifest: PackManifest;
160
+ summary?: RegistryPackSummary;
161
+ packUrl?: string;
162
+ files: Partial<Record<PackFileType, string>>;
76
163
  };
77
- declare const RemotePackFilesSchema: z.ZodObject<{
78
- pack: z.ZodOptional<z.ZodString>;
79
- rules: z.ZodOptional<z.ZodString>;
80
- skill: z.ZodOptional<z.ZodString>;
81
- cursor: z.ZodOptional<z.ZodString>;
82
- copilot: z.ZodOptional<z.ZodString>;
83
- }, z.core.$strip>;
84
- declare const RemotePackEntrySchema: z.ZodObject<{
164
+ declare const PackSchema: z.ZodObject<{
85
165
  name: z.ZodString;
86
- version: z.ZodOptional<z.ZodString>;
87
- baseUrl: z.ZodOptional<z.ZodString>;
88
- pack: z.ZodOptional<z.ZodObject<{
89
- name: z.ZodString;
90
- version: z.ZodOptional<z.ZodString>;
91
- title: z.ZodString;
92
- description: z.ZodString;
93
- category: z.ZodEnum<{
94
- framework: "framework";
95
- database: "database";
96
- testing: "testing";
97
- security: "security";
98
- ui: "ui";
99
- workflow: "workflow";
100
- }>;
101
- detect: z.ZodOptional<z.ZodObject<{
102
- files: z.ZodOptional<z.ZodArray<z.ZodString>>;
103
- packages: z.ZodOptional<z.ZodArray<z.ZodString>>;
104
- }, z.core.$strip>>;
105
- outputs: z.ZodObject<{
106
- globalRules: z.ZodDefault<z.ZodBoolean>;
107
- skill: z.ZodDefault<z.ZodBoolean>;
108
- cursorRule: z.ZodDefault<z.ZodBoolean>;
109
- copilotInstruction: z.ZodDefault<z.ZodBoolean>;
110
- }, z.core.$strip>;
111
- }, z.core.$strip>>;
112
- files: z.ZodOptional<z.ZodObject<{
113
- pack: z.ZodOptional<z.ZodString>;
114
- rules: z.ZodOptional<z.ZodString>;
115
- skill: z.ZodOptional<z.ZodString>;
116
- cursor: z.ZodOptional<z.ZodString>;
117
- copilot: z.ZodOptional<z.ZodString>;
118
- }, z.core.$strip>>;
119
- }, z.core.$strip>;
120
- declare const RemoteRegistryIndexSchema: z.ZodObject<{
166
+ title: z.ZodString;
121
167
  version: z.ZodDefault<z.ZodString>;
122
- packs: z.ZodArray<z.ZodObject<{
123
- name: z.ZodString;
124
- version: z.ZodOptional<z.ZodString>;
125
- baseUrl: z.ZodOptional<z.ZodString>;
126
- pack: z.ZodOptional<z.ZodObject<{
127
- name: z.ZodString;
128
- version: z.ZodOptional<z.ZodString>;
129
- title: z.ZodString;
130
- description: z.ZodString;
131
- category: z.ZodEnum<{
132
- framework: "framework";
133
- database: "database";
134
- testing: "testing";
135
- security: "security";
136
- ui: "ui";
137
- workflow: "workflow";
138
- }>;
139
- detect: z.ZodOptional<z.ZodObject<{
140
- files: z.ZodOptional<z.ZodArray<z.ZodString>>;
141
- packages: z.ZodOptional<z.ZodArray<z.ZodString>>;
142
- }, z.core.$strip>>;
143
- outputs: z.ZodObject<{
144
- globalRules: z.ZodDefault<z.ZodBoolean>;
145
- skill: z.ZodDefault<z.ZodBoolean>;
146
- cursorRule: z.ZodDefault<z.ZodBoolean>;
147
- copilotInstruction: z.ZodDefault<z.ZodBoolean>;
148
- }, z.core.$strip>;
149
- }, z.core.$strip>>;
150
- files: z.ZodOptional<z.ZodObject<{
151
- pack: z.ZodOptional<z.ZodString>;
152
- rules: z.ZodOptional<z.ZodString>;
153
- skill: z.ZodOptional<z.ZodString>;
154
- cursor: z.ZodOptional<z.ZodString>;
155
- copilot: z.ZodOptional<z.ZodString>;
156
- }, z.core.$strip>>;
168
+ topic: z.ZodString;
169
+ description: z.ZodDefault<z.ZodString>;
170
+ classification: z.ZodDefault<z.ZodEnum<{
171
+ "always-referenced": "always-referenced";
172
+ "task-triggered": "task-triggered";
173
+ "permission-gated": "permission-gated";
174
+ }>>;
175
+ source: z.ZodOptional<z.ZodObject<{
176
+ provider: z.ZodOptional<z.ZodString>;
177
+ license: z.ZodOptional<z.ZodString>;
178
+ }, z.core.$catchall<z.ZodUnknown>>>;
179
+ detect: z.ZodOptional<z.ZodObject<{
180
+ files: z.ZodOptional<z.ZodArray<z.ZodString>>;
181
+ packages: z.ZodOptional<z.ZodArray<z.ZodString>>;
157
182
  }, z.core.$strip>>;
183
+ files: z.ZodDefault<z.ZodArray<z.ZodObject<{
184
+ type: z.ZodEnum<{
185
+ claude: "claude";
186
+ cursor: "cursor";
187
+ copilot: "copilot";
188
+ rules: "rules";
189
+ agents: "agents";
190
+ skill: "skill";
191
+ }>;
192
+ path: z.ZodString;
193
+ output: z.ZodOptional<z.ZodString>;
194
+ mode: z.ZodOptional<z.ZodString>;
195
+ }, z.core.$strip>>>;
196
+ outputs: z.ZodPipe<z.ZodDefault<z.ZodObject<{
197
+ globalRules: z.ZodOptional<z.ZodBoolean>;
198
+ agentsInstruction: z.ZodOptional<z.ZodBoolean>;
199
+ claudeInstruction: z.ZodOptional<z.ZodBoolean>;
200
+ skill: z.ZodOptional<z.ZodBoolean>;
201
+ cursorRule: z.ZodOptional<z.ZodBoolean>;
202
+ copilotInstruction: z.ZodOptional<z.ZodBoolean>;
203
+ }, z.core.$strip>>, z.ZodTransform<{
204
+ globalRules: boolean;
205
+ agentsInstruction: boolean;
206
+ claudeInstruction: boolean;
207
+ skill: boolean;
208
+ cursorRule: boolean;
209
+ copilotInstruction: boolean;
210
+ }, {
211
+ globalRules?: boolean | undefined;
212
+ agentsInstruction?: boolean | undefined;
213
+ claudeInstruction?: boolean | undefined;
214
+ skill?: boolean | undefined;
215
+ cursorRule?: boolean | undefined;
216
+ copilotInstruction?: boolean | undefined;
217
+ }>>;
158
218
  }, z.core.$strip>;
159
- type RemoteRegistryIndex = z.infer<typeof RemoteRegistryIndexSchema>;
219
+ type Pack = PackManifest;
220
+ type LoadedPack = InstalledPack & {
221
+ directory: string;
222
+ source: "project-cache" | "remote" | "local";
223
+ registryUrl?: string;
224
+ fileContents?: Partial<Record<PackFileType, string>>;
225
+ filesByType?: Partial<Record<PackFileType, string>>;
226
+ };
160
227
 
161
228
  declare const OFFICIAL_REGISTRY_SOURCE = "official";
162
229
  declare const OFFICIAL_REGISTRY_URL = "https://registry.contextforge.org/index.json";
@@ -167,7 +234,40 @@ type LoadRegistryOptions = {
167
234
  sources?: string[];
168
235
  timeoutMs?: number;
169
236
  };
170
- declare function loadRegistry(input?: string | LoadRegistryOptions): Promise<LoadedPack[]>;
237
+ declare function loadRegistry(input?: string | LoadRegistryOptions): Promise<{
238
+ topics: string[];
239
+ packs: {
240
+ name: string;
241
+ title: string;
242
+ topic: string;
243
+ description: string;
244
+ path: string;
245
+ source?: {
246
+ [x: string]: unknown;
247
+ provider?: string | undefined;
248
+ license?: string | undefined;
249
+ } | undefined;
250
+ }[];
251
+ name?: string | undefined;
252
+ version?: string | undefined;
253
+ schemaVersion?: string | undefined;
254
+ description?: string | undefined;
255
+ }>;
256
+ declare function registrySourceToUrl(source?: string): string;
257
+ declare function loadRemotePack(registryUrl: string, summary: RegistryPackSummary, timeoutMs?: number): Promise<InstalledPack>;
258
+ declare function loadProjectPacks(root: string): Promise<InstalledPack[]>;
259
+
260
+ declare function fetchText(url: string, timeoutMs?: number): Promise<string>;
261
+ declare function resolvePackUrl(registryUrl: string, packPath: string): string;
262
+ declare function resolvePackFileUrl(packUrl: string, filePath: string): string;
263
+ declare function fetchRegistry(registryUrl: string, timeoutMs?: number): Promise<RegistryIndex>;
264
+ declare function fetchPackManifest(packUrl: string, timeoutMs?: number): Promise<PackManifest>;
265
+ declare function findPackSummary(registry: RegistryIndex, packName: string): RegistryPackSummary | undefined;
266
+ declare function fetchPackFile(packUrl: string, file: PackFile, timeoutMs?: number): Promise<string>;
267
+ declare function listRegistryPacks(registry: RegistryIndex): RegistryPackSummary[];
268
+ declare function listRegistryPacks(registryUrl: string): Promise<RegistryPackSummary[]>;
269
+ declare function searchRegistryPacks(registry: RegistryIndex, query: string): RegistryPackSummary[];
270
+ declare function searchRegistryPacks(registryUrl: string, query: string): Promise<RegistryPackSummary[]>;
171
271
 
172
272
  type PackageJson = {
173
273
  dependencies?: Record<string, string>;
@@ -180,35 +280,66 @@ declare function readPackageJson(root: string): Promise<PackageJson | null>;
180
280
  declare function hasPackage(packageJson: PackageJson | null, packageName: string): boolean;
181
281
  declare function hasScript(packageJson: PackageJson | null, scriptName: string): boolean;
182
282
 
183
- declare function findPack(registry: LoadedPack[], packName: string): LoadedPack | undefined;
184
- declare function resolvePacks(packNames: string[], registry: LoadedPack[]): LoadedPack[];
185
- declare function recommendPacks(analysis: ProjectAnalysis, registry: LoadedPack[]): Promise<LoadedPack[]>;
186
- declare function packMatchesProject(pack: LoadedPack, root: string, packageJson: PackageJson | null): Promise<boolean>;
283
+ declare function findPack(registry: RegistryIndex, packName: string): RegistryPackSummary | undefined;
284
+ declare function mandatoryCorePacks(registry: RegistryIndex): RegistryPackSummary[];
285
+ declare function missingMandatoryCorePacks(registry: RegistryIndex): string[];
286
+ declare function manifestMatchesProject(manifest: Pick<PackManifest, "detect">, root: string, packageJson: PackageJson | null): Promise<boolean>;
287
+ declare function recommendPackNames(analysis: ProjectAnalysis): string[];
288
+ declare function recommendPacks(analysis: ProjectAnalysis, registry: RegistryIndex): Promise<RegistryPackSummary[]>;
187
289
  declare function packageManagerLabel(packageManager: PackageManager): string;
290
+ declare function packMatchesProject(pack: InstalledPack, root: string, packageJson?: PackageJson | null): Promise<boolean>;
291
+ declare function resolvePacks(packNames: string[], packs: InstalledPack[]): InstalledPack[];
188
292
 
189
- declare const ConfigSchema: z.ZodObject<{
293
+ declare const ToolSchema: z.ZodEnum<{
294
+ codex: "codex";
295
+ claude: "claude";
296
+ cursor: "cursor";
297
+ copilot: "copilot";
298
+ }>;
299
+ type AITool = z.infer<typeof ToolSchema>;
300
+ declare const DEFAULT_TOOLS: AITool[];
301
+ declare const DEFAULT_CORE_PACKS: readonly ["verification-before-completion", "systematic-debugging", "code-review", "git-workflow", "dependency-management", "diataxis-docs"];
302
+ declare const CurrentConfigSchema: z.ZodObject<{
190
303
  version: z.ZodDefault<z.ZodString>;
191
- registries: z.ZodDefault<z.ZodArray<z.ZodString>>;
304
+ registry: z.ZodDefault<z.ZodString>;
192
305
  tools: z.ZodDefault<z.ZodArray<z.ZodEnum<{
193
306
  codex: "codex";
194
307
  claude: "claude";
195
308
  cursor: "cursor";
196
309
  copilot: "copilot";
197
310
  }>>>;
198
- packs: z.ZodDefault<z.ZodArray<z.ZodString>>;
199
- packageManager: z.ZodDefault<z.ZodEnum<{
200
- pnpm: "pnpm";
201
- npm: "npm";
202
- yarn: "yarn";
203
- bun: "bun";
204
- unknown: "unknown";
205
- }>>;
311
+ installedPacks: z.ZodDefault<z.ZodArray<z.ZodString>>;
312
+ defaultCorePacks: z.ZodDefault<z.ZodArray<z.ZodString>>;
206
313
  generatedFiles: z.ZodDefault<z.ZodArray<z.ZodString>>;
207
314
  }, z.core.$strip>;
208
- type ContextForgeConfig = z.infer<typeof ConfigSchema>;
315
+ type ContextForgeConfig = z.infer<typeof CurrentConfigSchema>;
316
+ declare function normalizeConfig(raw: unknown): ContextForgeConfig;
317
+ declare const ConfigSchema: {
318
+ parse: typeof normalizeConfig;
319
+ };
209
320
 
210
- declare const DEFAULT_TOOLS: AITool[];
211
- declare function createConfig(analysis: ProjectAnalysis, packs: LoadedPack[], tools?: AITool[], registries?: string[]): ContextForgeConfig;
321
+ declare function createConfig(_analysis: ProjectAnalysis, packs: {
322
+ name: string;
323
+ }[], tools?: AITool[], registry?: string): ContextForgeConfig;
324
+
325
+ declare const LOCK_PATH = ".contextforge/lock.json";
326
+ declare const LockSchema: z.ZodObject<{
327
+ registry: z.ZodString;
328
+ resolvedAt: z.ZodString;
329
+ packs: z.ZodRecord<z.ZodString, z.ZodObject<{
330
+ version: z.ZodString;
331
+ path: z.ZodString;
332
+ source: z.ZodString;
333
+ }, z.core.$strip>>;
334
+ }, z.core.$strip>;
335
+ type ContextForgeLock = z.infer<typeof LockSchema>;
336
+ declare function loadLock(root: string): Promise<ContextForgeLock | null>;
337
+ declare function saveLock(root: string, lock: ContextForgeLock): Promise<void>;
338
+ declare function updateContextForgeLock(root: string, registry: string, installed: Array<{
339
+ manifest: PackManifest;
340
+ summary?: RegistryPackSummary;
341
+ packUrl?: string;
342
+ }>): Promise<ContextForgeLock>;
212
343
 
213
344
  declare const CONFIG_PATH = ".contextforge/config.json";
214
345
  declare function loadConfig(root: string): Promise<ContextForgeConfig>;
@@ -216,18 +347,38 @@ declare function loadConfig(root: string): Promise<ContextForgeConfig>;
216
347
  declare function saveConfig(root: string, config: ContextForgeConfig): Promise<void>;
217
348
  declare function addPackToConfig(config: ContextForgeConfig, packName: string): ContextForgeConfig;
218
349
 
219
- declare function cacheRemotePacks(root: string, packs: LoadedPack[]): Promise<void>;
220
- declare function saveInstalledPacks(root: string, packs: LoadedPack[]): Promise<void>;
350
+ declare function downloadPackToContextForge(projectRoot: string, packName: string, packManifest: PackManifest, packUrl: string, timeoutMs?: number): Promise<InstalledPack>;
351
+ type InstallPackOptions = {
352
+ force?: boolean;
353
+ dryRun?: boolean;
354
+ timeoutMs?: number;
355
+ };
356
+ type InstallPackResult = {
357
+ installed: boolean;
358
+ alreadyInstalled: boolean;
359
+ packName: string;
360
+ manifest?: PackManifest;
361
+ summary?: RegistryPackSummary;
362
+ packUrl?: string;
363
+ };
364
+ declare function installPack(projectRoot: string, registryUrl: string, packName: string, options?: InstallPackOptions): Promise<InstallPackResult>;
365
+
366
+ declare function compileOutputs(config: ContextForgeConfig, packs: InstalledPack[], analysis: ProjectAnalysis): GeneratedFile[];
367
+
368
+ declare function compileAgentsMd(): Promise<string>;
369
+
370
+ declare function compileClaudeMd(): Promise<string>;
221
371
 
222
- declare function compileOutputs(config: ContextForgeConfig, packs: LoadedPack[], analysis: ProjectAnalysis): GeneratedFile[];
372
+ declare function generateToolOutputs(root: string, packs: InstalledPack[], config: ContextForgeConfig, previousFiles?: string[]): Promise<string[]>;
223
373
 
224
- declare function writeGeneratedFiles(root: string, outputs: GeneratedFile[]): Promise<string[]>;
374
+ declare function writeGeneratedFiles(root: string, outputs: GeneratedFile[], previousFiles?: string[]): Promise<string[]>;
225
375
 
226
376
  declare function safeWriteFile(filePath: string, generatedContent: string): Promise<void>;
227
377
 
228
378
  declare const GENERATED_BLOCK_START = "<!-- contextforge:start -->";
229
379
  declare const GENERATED_BLOCK_END = "<!-- contextforge:end -->";
230
380
  declare function getGeneratedBlock(content: string): string | null;
381
+ declare function removeGeneratedBlock(content: string): string;
231
382
  declare function wrapGeneratedBlock(content: string): string;
232
383
  declare function updateGeneratedBlock(existingContent: string | null, generatedContent: string): string;
233
384
 
@@ -237,8 +388,20 @@ type SyncResult = {
237
388
  generatedFiles: string[];
238
389
  outputs: GeneratedFile[];
239
390
  config: ContextForgeConfig;
391
+ installedPacks: InstalledPack[];
240
392
  };
393
+ type InstallAndSyncOptions = InstallPackOptions & {
394
+ tools?: ContextForgeConfig["tools"];
395
+ };
396
+ declare function updateContextForgeConfig(projectRoot: string, packName: string, registryUrl: string, generatedFiles: string[]): Promise<ContextForgeConfig>;
397
+ declare function syncInstalledPacks(projectRoot: string, providedConfig?: ContextForgeConfig): Promise<SyncResult>;
241
398
  declare function syncProject(root: string, providedConfig?: ContextForgeConfig): Promise<SyncResult>;
399
+ declare function installPackAndSync(projectRoot: string, registryUrl: string, packName: string, options?: InstallAndSyncOptions): Promise<InstallPackResult & {
400
+ generatedFiles: string[];
401
+ config?: ContextForgeConfig;
402
+ }>;
403
+ declare function readInstalledPacks(projectRoot: string): Promise<InstalledPack[]>;
404
+ declare function pathExists(root: string, relativePath: string): Promise<boolean>;
242
405
 
243
406
  type DoctorIssue = {
244
407
  level: "error" | "warning";
@@ -248,6 +411,9 @@ type DoctorReport = {
248
411
  checks: string[];
249
412
  issues: DoctorIssue[];
250
413
  };
251
- declare function doctorProject(root: string): Promise<DoctorReport>;
414
+ type DoctorOptions = {
415
+ registry?: string;
416
+ };
417
+ declare function doctorProject(root: string, options?: DoctorOptions): Promise<DoctorReport>;
252
418
 
253
- export { type AITool, CONFIG_PATH, ConfigSchema, type ContextForgeConfig, DEFAULT_REGISTRY_SOURCES, DEFAULT_TOOLS, type DoctorIssue, type DoctorReport, GENERATED_BLOCK_END, GENERATED_BLOCK_START, type GeneratedFile, type LoadedPack, OFFICIAL_REGISTRY_SOURCE, OFFICIAL_REGISTRY_URL, PROJECT_PACK_CACHE, type Pack, PackSchema, type PackageJson, type PackageManager, type ProjectAnalysis, type ProjectFramework, type ProjectLanguage, RemotePackEntrySchema, RemotePackFilesSchema, type RemoteRegistryIndex, RemoteRegistryIndexSchema, type SyncResult, addPackToConfig, cacheRemotePacks, compileOutputs, createConfig, detectPackageManager, detectProject, doctorProject, findPack, getGeneratedBlock, hasPackage, hasScript, loadConfig, loadRegistry, packMatchesProject, packageManagerLabel, readPackageJson, recommendPacks, resolvePacks, safeWriteFile, saveConfig, saveInstalledPacks, syncProject, updateGeneratedBlock, wrapGeneratedBlock, writeGeneratedFiles };
419
+ export { type AITool$1 as AITool, CONFIG_PATH, ConfigSchema, type ContextForgeConfig, type ContextForgeLock, DEFAULT_CORE_PACKS, DEFAULT_REGISTRY_SOURCES, DEFAULT_TOOLS, type DoctorIssue, type DoctorReport, GENERATED_BLOCK_END, GENERATED_BLOCK_START, type GeneratedFile, type InstallAndSyncOptions, type InstallPackOptions, type InstallPackResult, type InstalledPack, LOCK_PATH, type LoadedPack, OFFICIAL_REGISTRY_SOURCE, OFFICIAL_REGISTRY_URL, PROJECT_PACK_CACHE, type Pack, type PackFile, PackFileSchema, type PackFileType, PackFileTypeSchema, type PackManifest, PackManifestSchema, PackSchema, type PackageJson, type PackageManager, type ProjectAnalysis, type ProjectFramework, type ProjectLanguage, type RegistryIndex, RegistryIndexSchema, RegistryPackSourceSchema, type RegistryPackSummary, RegistryPackSummarySchema, type SyncResult, ToolSchema, addPackToConfig, compileAgentsMd, compileClaudeMd, compileOutputs, createConfig, detectPackageManager, detectProject, doctorProject, downloadPackToContextForge, fetchPackFile, fetchPackManifest, fetchRegistry, fetchText, findPack, findPackSummary, generateToolOutputs, getGeneratedBlock, hasPackage, hasScript, installPack, installPackAndSync, listRegistryPacks, loadConfig, loadLock, loadProjectPacks, loadRegistry, loadRemotePack, mandatoryCorePacks, manifestMatchesProject, missingMandatoryCorePacks, normalizeConfig, packMatchesProject, packageManagerLabel, pathExists, readInstalledPacks, readPackageJson, recommendPackNames, recommendPacks, registrySourceToUrl, removeGeneratedBlock, resolvePackFileUrl, resolvePackUrl, resolvePacks, safeWriteFile, saveConfig, saveLock, searchRegistryPacks, syncInstalledPacks, syncProject, updateContextForgeConfig, updateContextForgeLock, updateGeneratedBlock, wrapGeneratedBlock, writeGeneratedFiles };