@runcontext/cli 0.1.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.js ADDED
@@ -0,0 +1,523 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/index.ts
4
+ import { Command as Command9 } from "commander";
5
+
6
+ // src/commands/build.ts
7
+ import { Command } from "commander";
8
+ import path from "path";
9
+ import fs from "fs";
10
+ import {
11
+ loadConfig,
12
+ compile,
13
+ emitManifest,
14
+ LintEngine,
15
+ ALL_RULES
16
+ } from "@runcontext/core";
17
+
18
+ // src/formatters/pretty.ts
19
+ import chalk from "chalk";
20
+ function formatDiagnostics(diagnostics) {
21
+ if (diagnostics.length === 0) {
22
+ return chalk.green("No issues found.");
23
+ }
24
+ const lines = [];
25
+ let errorCount = 0;
26
+ let warningCount = 0;
27
+ for (const d of diagnostics) {
28
+ const location = `${d.source.file}:${d.source.line}:${d.source.col}`;
29
+ const severityLabel = d.severity === "error" ? chalk.red("error") : chalk.yellow("warning");
30
+ if (d.severity === "error") {
31
+ errorCount++;
32
+ } else {
33
+ warningCount++;
34
+ }
35
+ lines.push(` ${location} ${severityLabel} ${chalk.dim(d.ruleId)} ${d.message}`);
36
+ }
37
+ lines.push("");
38
+ const parts = [];
39
+ if (errorCount > 0) {
40
+ parts.push(chalk.red(`${errorCount} error${errorCount !== 1 ? "s" : ""}`));
41
+ }
42
+ if (warningCount > 0) {
43
+ parts.push(chalk.yellow(`${warningCount} warning${warningCount !== 1 ? "s" : ""}`));
44
+ }
45
+ lines.push(parts.join(", "));
46
+ return lines.join("\n");
47
+ }
48
+
49
+ // src/formatters/json.ts
50
+ function formatDiagnosticsJson(diagnostics) {
51
+ return JSON.stringify(diagnostics, null, 2);
52
+ }
53
+
54
+ // src/commands/build.ts
55
+ var buildCommand = new Command("build").description("Compile context files and emit manifest").option("--format <format>", "output format for diagnostics (pretty|json)", "pretty").action(async (opts) => {
56
+ try {
57
+ const config = await loadConfig(process.cwd());
58
+ const rootDir = config.paths?.rootDir || process.cwd();
59
+ const contextDir = path.resolve(rootDir, config.paths?.contextDir || "context");
60
+ const distDir = path.resolve(rootDir, config.paths?.distDir || "dist");
61
+ const { graph, diagnostics: compileDiags } = await compile({ contextDir, config });
62
+ const engine = new LintEngine(config.lint?.rules);
63
+ for (const rule of ALL_RULES) {
64
+ engine.register(rule);
65
+ }
66
+ const lintDiags = engine.run(graph);
67
+ const allDiags = [...compileDiags, ...lintDiags];
68
+ if (allDiags.length > 0) {
69
+ const output = opts.format === "json" ? formatDiagnosticsJson(allDiags) : formatDiagnostics(allDiags);
70
+ console.error(output);
71
+ }
72
+ const manifest = emitManifest(graph, config);
73
+ fs.mkdirSync(distDir, { recursive: true });
74
+ const manifestPath = path.join(distDir, "context.manifest.json");
75
+ fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2), "utf-8");
76
+ const summary = [
77
+ `Built manifest: ${manifest.concepts.length} concepts`,
78
+ `${manifest.products.length} products`,
79
+ `${manifest.policies.length} policies`,
80
+ `${manifest.entities.length} entities`,
81
+ `${manifest.terms.length} terms`,
82
+ `${manifest.owners.length} owners`
83
+ ].join(", ");
84
+ console.log(summary);
85
+ console.log(`Manifest written to ${manifestPath}`);
86
+ const hasErrors = allDiags.some((d) => d.severity === "error");
87
+ if (hasErrors) {
88
+ process.exit(1);
89
+ }
90
+ } catch (err) {
91
+ console.error("Build failed:", err.message);
92
+ process.exit(1);
93
+ }
94
+ });
95
+
96
+ // src/commands/lint.ts
97
+ import { Command as Command2 } from "commander";
98
+ import path2 from "path";
99
+ import {
100
+ loadConfig as loadConfig2,
101
+ compile as compile2,
102
+ LintEngine as LintEngine2,
103
+ ALL_RULES as ALL_RULES2
104
+ } from "@runcontext/core";
105
+ var lintCommand = new Command2("lint").description("Lint context files and report diagnostics").option("--format <format>", "output format (pretty|json)", "pretty").option("--fix", "apply autofixes (placeholder)").action(async (opts) => {
106
+ if (opts.fix) {
107
+ console.log("Use 'context fix' for autofixes.");
108
+ return;
109
+ }
110
+ try {
111
+ const config = await loadConfig2(process.cwd());
112
+ const rootDir = config.paths?.rootDir || process.cwd();
113
+ const contextDir = path2.resolve(rootDir, config.paths?.contextDir || "context");
114
+ const { graph, diagnostics: compileDiags } = await compile2({ contextDir, config });
115
+ const engine = new LintEngine2(config.lint?.rules);
116
+ for (const rule of ALL_RULES2) {
117
+ engine.register(rule);
118
+ }
119
+ const lintDiags = engine.run(graph);
120
+ const allDiags = [...compileDiags, ...lintDiags];
121
+ const output = opts.format === "json" ? formatDiagnosticsJson(allDiags) : formatDiagnostics(allDiags);
122
+ console.log(output);
123
+ const hasErrors = allDiags.some((d) => d.severity === "error");
124
+ if (hasErrors) {
125
+ process.exit(1);
126
+ }
127
+ } catch (err) {
128
+ console.error("Lint failed:", err.message);
129
+ process.exit(1);
130
+ }
131
+ });
132
+
133
+ // src/commands/init.ts
134
+ import { Command as Command3 } from "commander";
135
+ import fs2 from "fs";
136
+ import path3 from "path";
137
+ var SAMPLE_CONCEPT = `kind: concept
138
+ id: example-concept
139
+ definition: An example concept to get you started.
140
+ owner: example-team
141
+ tags:
142
+ - example
143
+ status: draft
144
+ `;
145
+ var SAMPLE_OWNER = `kind: owner
146
+ id: example-team
147
+ displayName: Example Team
148
+ email: team@example.com
149
+ `;
150
+ function generateConfig(projectName) {
151
+ return `project:
152
+ id: ${projectName}
153
+ displayName: "${projectName}"
154
+ version: "0.1.0"
155
+
156
+ paths:
157
+ contextDir: context
158
+ distDir: dist
159
+
160
+ lint:
161
+ defaultSeverity: warning
162
+ `;
163
+ }
164
+ var initCommand = new Command3("init").description("Create a new ContextKit project").option("--name <name>", "project name (defaults to directory basename)").action((opts) => {
165
+ const cwd = process.cwd();
166
+ const projectName = opts.name || path3.basename(cwd);
167
+ const dirs = [
168
+ "context/concepts",
169
+ "context/products",
170
+ "context/policies",
171
+ "context/entities",
172
+ "context/owners",
173
+ "context/terms"
174
+ ];
175
+ const files = [
176
+ { path: "context/concepts/example-concept.ctx.yaml", content: SAMPLE_CONCEPT },
177
+ { path: "context/owners/example-team.owner.yaml", content: SAMPLE_OWNER },
178
+ { path: "contextkit.config.yaml", content: generateConfig(projectName) }
179
+ ];
180
+ const created = [];
181
+ for (const dir of dirs) {
182
+ const fullPath = path3.join(cwd, dir);
183
+ fs2.mkdirSync(fullPath, { recursive: true });
184
+ created.push(dir + "/");
185
+ }
186
+ for (const file of files) {
187
+ const fullPath = path3.join(cwd, file.path);
188
+ if (!fs2.existsSync(fullPath)) {
189
+ fs2.writeFileSync(fullPath, file.content, "utf-8");
190
+ created.push(file.path);
191
+ } else {
192
+ console.log(` Skipped (already exists): ${file.path}`);
193
+ }
194
+ }
195
+ console.log(`Initialized ContextKit project "${projectName}":`);
196
+ for (const item of created) {
197
+ console.log(` created ${item}`);
198
+ }
199
+ });
200
+
201
+ // src/commands/explain.ts
202
+ import { Command as Command4 } from "commander";
203
+ import fs3 from "fs";
204
+ import path4 from "path";
205
+ import chalk2 from "chalk";
206
+ var explainCommand = new Command4("explain").description("Look up a node by ID in the manifest").argument("<id>", "node ID to look up").option("--manifest <path>", "path to manifest file", "dist/context.manifest.json").action((id, opts) => {
207
+ const manifestPath = path4.resolve(process.cwd(), opts.manifest);
208
+ if (!fs3.existsSync(manifestPath)) {
209
+ console.error(`Manifest not found at ${manifestPath}. Run 'context build' first.`);
210
+ process.exit(1);
211
+ }
212
+ let manifest;
213
+ try {
214
+ const raw = fs3.readFileSync(manifestPath, "utf-8");
215
+ manifest = JSON.parse(raw);
216
+ } catch {
217
+ console.error(`Failed to read manifest at ${manifestPath}`);
218
+ process.exit(1);
219
+ }
220
+ const entry = manifest.indexes?.byId?.[id];
221
+ if (!entry) {
222
+ console.error(`Node "${id}" not found in manifest.`);
223
+ process.exit(1);
224
+ }
225
+ const { kind, index } = entry;
226
+ const collection = manifest[kind + "s"];
227
+ if (!collection || !collection[index]) {
228
+ console.error(`Node "${id}" not found in "${kind}s" collection.`);
229
+ process.exit(1);
230
+ }
231
+ const node = collection[index];
232
+ console.log(chalk2.bold(`${kind}: ${id}`));
233
+ console.log("");
234
+ const fields = Object.entries(node).filter(
235
+ ([key]) => key !== "id"
236
+ );
237
+ for (const [key, value] of fields) {
238
+ if (value === void 0 || value === null) continue;
239
+ if (Array.isArray(value)) {
240
+ console.log(` ${chalk2.dim(key + ":")} ${value.join(", ")}`);
241
+ } else if (typeof value === "object") {
242
+ console.log(` ${chalk2.dim(key + ":")} ${JSON.stringify(value)}`);
243
+ } else {
244
+ console.log(` ${chalk2.dim(key + ":")} ${String(value)}`);
245
+ }
246
+ }
247
+ });
248
+
249
+ // src/commands/fix.ts
250
+ import { Command as Command5 } from "commander";
251
+ import path5 from "path";
252
+ import fs4 from "fs";
253
+ import chalk3 from "chalk";
254
+ import {
255
+ loadConfig as loadConfig3,
256
+ compile as compile3,
257
+ LintEngine as LintEngine3,
258
+ ALL_RULES as ALL_RULES3,
259
+ applyFixes
260
+ } from "@runcontext/core";
261
+ var fixCommand = new Command5("fix").description("Apply autofixes to context files").option("--write", "write fixes to disk (default: dry-run)").option("--format <format>", "output format for diagnostics (pretty|json)", "pretty").action(async (opts) => {
262
+ try {
263
+ const config = await loadConfig3(process.cwd());
264
+ const rootDir = config.paths?.rootDir || process.cwd();
265
+ const contextDir = path5.resolve(rootDir, config.paths?.contextDir || "context");
266
+ const { graph, diagnostics: compileDiags } = await compile3({ contextDir, config });
267
+ const engine = new LintEngine3(config.lint?.rules);
268
+ for (const rule of ALL_RULES3) {
269
+ engine.register(rule);
270
+ }
271
+ const lintDiags = engine.run(graph);
272
+ const allDiags = [...compileDiags, ...lintDiags];
273
+ const fixableDiags = allDiags.filter((d) => d.fixable && d.fix);
274
+ const unfixableDiags = allDiags.filter((d) => !d.fixable || !d.fix);
275
+ if (fixableDiags.length === 0) {
276
+ console.log(chalk3.green("No fixable issues found."));
277
+ if (unfixableDiags.length > 0) {
278
+ console.log("");
279
+ console.log(chalk3.yellow(`${unfixableDiags.length} unfixable issue(s) remain:`));
280
+ const output = opts.format === "json" ? formatDiagnosticsJson(unfixableDiags) : formatDiagnostics(unfixableDiags);
281
+ console.log(output);
282
+ const hasErrors = unfixableDiags.some((d) => d.severity === "error");
283
+ if (hasErrors) {
284
+ process.exit(1);
285
+ }
286
+ }
287
+ return;
288
+ }
289
+ const results = applyFixes(fixableDiags);
290
+ if (opts.write) {
291
+ for (const result of results) {
292
+ fs4.writeFileSync(result.file, result.newContent, "utf-8");
293
+ }
294
+ const totalEdits = results.reduce((sum, r) => sum + r.editsApplied, 0);
295
+ console.log(
296
+ chalk3.green(`Fixed ${totalEdits} issue(s) in ${results.length} file(s).`)
297
+ );
298
+ if (unfixableDiags.length > 0) {
299
+ console.log("");
300
+ console.log(chalk3.yellow(`${unfixableDiags.length} unfixable issue(s) remain:`));
301
+ const output = opts.format === "json" ? formatDiagnosticsJson(unfixableDiags) : formatDiagnostics(unfixableDiags);
302
+ console.log(output);
303
+ }
304
+ } else {
305
+ console.log(chalk3.cyan("Dry run \u2014 no files changed. Use --write to apply fixes.\n"));
306
+ console.log(chalk3.bold(`${fixableDiags.length} fixable issue(s) found:
307
+ `));
308
+ for (const diag of fixableDiags) {
309
+ const location = `${diag.source.file}:${diag.source.line}:${diag.source.col}`;
310
+ const severityLabel = diag.severity === "error" ? chalk3.red("error") : chalk3.yellow("warning");
311
+ console.log(` ${location} ${severityLabel} ${chalk3.dim(diag.ruleId)} ${diag.message}`);
312
+ if (diag.fix) {
313
+ console.log(` ${chalk3.green("fix:")} ${diag.fix.description}`);
314
+ }
315
+ }
316
+ console.log("");
317
+ console.log(
318
+ `Would fix ${results.reduce((s, r) => s + r.editsApplied, 0)} issue(s) in ${results.length} file(s).`
319
+ );
320
+ if (unfixableDiags.length > 0) {
321
+ console.log("");
322
+ console.log(chalk3.yellow(`${unfixableDiags.length} unfixable issue(s) would remain.`));
323
+ }
324
+ }
325
+ const hasUnfixableErrors = unfixableDiags.some((d) => d.severity === "error");
326
+ if (hasUnfixableErrors) {
327
+ process.exit(1);
328
+ }
329
+ } catch (err) {
330
+ console.error("Fix failed:", err.message);
331
+ process.exit(1);
332
+ }
333
+ });
334
+
335
+ // src/commands/dev.ts
336
+ import { Command as Command6 } from "commander";
337
+ import path6 from "path";
338
+ import chalk4 from "chalk";
339
+ import { watch } from "chokidar";
340
+ import {
341
+ loadConfig as loadConfig4,
342
+ compile as compile4,
343
+ LintEngine as LintEngine4,
344
+ ALL_RULES as ALL_RULES4
345
+ } from "@runcontext/core";
346
+ var devCommand = new Command6("dev").description("Watch context files and rebuild on change").action(async () => {
347
+ try {
348
+ const config = await loadConfig4(process.cwd());
349
+ const rootDir = config.paths?.rootDir || process.cwd();
350
+ const contextDir = path6.resolve(rootDir, config.paths?.contextDir || "context");
351
+ const watchPattern = path6.join(contextDir, "**/*.{yaml,yml}");
352
+ console.log(chalk4.cyan(`Watching ${watchPattern} for changes...
353
+ `));
354
+ await runBuild(contextDir, config);
355
+ let debounceTimer = null;
356
+ const watcher = watch(watchPattern, {
357
+ ignoreInitial: true,
358
+ persistent: true
359
+ });
360
+ watcher.on("all", (_event, _filePath) => {
361
+ if (debounceTimer) {
362
+ clearTimeout(debounceTimer);
363
+ }
364
+ debounceTimer = setTimeout(async () => {
365
+ debounceTimer = null;
366
+ await runBuild(contextDir, config);
367
+ }, 100);
368
+ });
369
+ watcher.on("error", (error) => {
370
+ console.error(chalk4.red(`Watcher error: ${error.message}`));
371
+ });
372
+ const cleanup = () => {
373
+ console.log(chalk4.dim("\nStopping watch mode..."));
374
+ watcher.close().then(() => {
375
+ process.exit(0);
376
+ });
377
+ };
378
+ process.on("SIGINT", cleanup);
379
+ process.on("SIGTERM", cleanup);
380
+ } catch (err) {
381
+ console.error("Dev mode failed:", err.message);
382
+ process.exit(1);
383
+ }
384
+ });
385
+ async function runBuild(contextDir, config) {
386
+ const separator = chalk4.dim("\u2500".repeat(60));
387
+ const timestamp = (/* @__PURE__ */ new Date()).toLocaleTimeString();
388
+ console.log(separator);
389
+ console.log(chalk4.bold(`[${timestamp}] Rebuilding...
390
+ `));
391
+ try {
392
+ const { graph, diagnostics: compileDiags } = await compile4({ contextDir, config });
393
+ const engine = new LintEngine4(config.lint?.rules);
394
+ for (const rule of ALL_RULES4) {
395
+ engine.register(rule);
396
+ }
397
+ const lintDiags = engine.run(graph);
398
+ const allDiags = [...compileDiags, ...lintDiags];
399
+ if (allDiags.length === 0) {
400
+ console.log(chalk4.green("No issues found.\n"));
401
+ return;
402
+ }
403
+ let errorCount = 0;
404
+ let warningCount = 0;
405
+ let fixableCount = 0;
406
+ for (const d of allDiags) {
407
+ if (d.severity === "error") errorCount++;
408
+ else warningCount++;
409
+ if (d.fixable) fixableCount++;
410
+ const location = `${d.source.file}:${d.source.line}:${d.source.col}`;
411
+ const severityLabel = d.severity === "error" ? chalk4.red("error") : chalk4.yellow("warning");
412
+ console.log(` ${location} ${severityLabel} ${chalk4.dim(d.ruleId)} ${d.message}`);
413
+ }
414
+ console.log("");
415
+ const parts = [];
416
+ if (errorCount > 0) {
417
+ parts.push(chalk4.red(`${errorCount} error${errorCount !== 1 ? "s" : ""}`));
418
+ }
419
+ if (warningCount > 0) {
420
+ parts.push(chalk4.yellow(`${warningCount} warning${warningCount !== 1 ? "s" : ""}`));
421
+ }
422
+ if (fixableCount > 0) {
423
+ parts.push(chalk4.cyan(`${fixableCount} fixable`));
424
+ }
425
+ console.log(parts.join(", ") + "\n");
426
+ } catch (err) {
427
+ console.error(chalk4.red(`Build error: ${err.message}
428
+ `));
429
+ }
430
+ }
431
+
432
+ // src/commands/site.ts
433
+ import { readFile } from "fs/promises";
434
+ import { resolve } from "path";
435
+ import { Command as Command7 } from "commander";
436
+ import { generateSite } from "@runcontext/site";
437
+ var siteCommand = new Command7("site").description("Site generator commands");
438
+ siteCommand.command("build").description("Build the context documentation site").option("--manifest <path>", "Path to manifest file", "dist/context.manifest.json").option("--output <dir>", "Output directory", "dist/site").option("--title <title>", "Site title").option("--base-path <path>", "Base path for links (e.g., /docs)").action(async (opts) => {
439
+ const manifestPath = resolve(opts.manifest);
440
+ let manifestJson;
441
+ try {
442
+ manifestJson = await readFile(manifestPath, "utf-8");
443
+ } catch {
444
+ console.error(`Error: Could not read manifest file at ${manifestPath}`);
445
+ console.error('Run "context build" first to generate the manifest.');
446
+ process.exitCode = 1;
447
+ return;
448
+ }
449
+ let manifest;
450
+ try {
451
+ manifest = JSON.parse(manifestJson);
452
+ } catch {
453
+ console.error(`Error: Invalid JSON in manifest file at ${manifestPath}`);
454
+ process.exitCode = 1;
455
+ return;
456
+ }
457
+ const outputDir = resolve(opts.output);
458
+ console.log(`Building site from ${manifestPath}...`);
459
+ await generateSite({
460
+ manifest,
461
+ outputDir,
462
+ title: opts.title,
463
+ basePath: opts.basePath
464
+ });
465
+ console.log(`Site generated at ${outputDir}`);
466
+ });
467
+
468
+ // src/commands/serve.ts
469
+ import { Command as Command8 } from "commander";
470
+ import fs5 from "fs";
471
+ import path7 from "path";
472
+ var serveCommand = new Command8("serve").description("Start the MCP server").option("--stdio", "Use stdio transport (default)").option("--http <port>", "Use HTTP/SSE transport on the given port", parseInt).option("--manifest <path>", "Path to manifest file", "dist/context.manifest.json").action(async (opts) => {
473
+ try {
474
+ const manifestPath = path7.resolve(process.cwd(), opts.manifest);
475
+ if (!fs5.existsSync(manifestPath)) {
476
+ console.error(`Manifest not found: ${manifestPath}`);
477
+ console.error('Run "context build" first to generate the manifest.');
478
+ process.exit(1);
479
+ }
480
+ const manifestData = JSON.parse(fs5.readFileSync(manifestPath, "utf-8"));
481
+ const { createContextMcpServer } = await import("@runcontext/mcp");
482
+ const server = createContextMcpServer(manifestData);
483
+ if (opts.http) {
484
+ const { StreamableHTTPServerTransport } = await import("@modelcontextprotocol/sdk/server/streamableHttp.js");
485
+ const { createMcpExpressApp } = await import("@modelcontextprotocol/sdk/server/express.js");
486
+ const { randomUUID } = await import("crypto");
487
+ const app = createMcpExpressApp();
488
+ const transport = new StreamableHTTPServerTransport({
489
+ sessionIdGenerator: () => randomUUID()
490
+ });
491
+ app.all("/mcp", (req, res) => {
492
+ transport.handleRequest(req, res);
493
+ });
494
+ await server.connect(transport);
495
+ const port = opts.http;
496
+ app.listen(port, () => {
497
+ console.log(`ContextKit MCP server listening on http://127.0.0.1:${port}/mcp`);
498
+ });
499
+ } else {
500
+ const { StdioServerTransport } = await import("@modelcontextprotocol/sdk/server/stdio.js");
501
+ const transport = new StdioServerTransport();
502
+ await server.connect(transport);
503
+ console.error("ContextKit MCP server running on stdio");
504
+ }
505
+ } catch (err) {
506
+ console.error("Failed to start MCP server:", err.message);
507
+ process.exit(1);
508
+ }
509
+ });
510
+
511
+ // src/index.ts
512
+ var program = new Command9();
513
+ program.name("context").version("0.1.0").description("ContextKit \u2014 Git-native institutional context compiler");
514
+ program.addCommand(buildCommand);
515
+ program.addCommand(lintCommand);
516
+ program.addCommand(initCommand);
517
+ program.addCommand(explainCommand);
518
+ program.addCommand(fixCommand);
519
+ program.addCommand(devCommand);
520
+ program.addCommand(siteCommand);
521
+ program.addCommand(serveCommand);
522
+ await program.parseAsync(process.argv);
523
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/commands/build.ts","../src/formatters/pretty.ts","../src/formatters/json.ts","../src/commands/lint.ts","../src/commands/init.ts","../src/commands/explain.ts","../src/commands/fix.ts","../src/commands/dev.ts","../src/commands/site.ts","../src/commands/serve.ts"],"sourcesContent":["import { Command } from 'commander';\nimport { buildCommand } from './commands/build.js';\nimport { lintCommand } from './commands/lint.js';\nimport { initCommand } from './commands/init.js';\nimport { explainCommand } from './commands/explain.js';\nimport { fixCommand } from './commands/fix.js';\nimport { devCommand } from './commands/dev.js';\nimport { siteCommand } from './commands/site.js';\nimport { serveCommand } from './commands/serve.js';\n\nconst program = new Command();\n\nprogram\n .name('context')\n .version('0.1.0')\n .description('ContextKit — Git-native institutional context compiler');\n\nprogram.addCommand(buildCommand);\nprogram.addCommand(lintCommand);\nprogram.addCommand(initCommand);\nprogram.addCommand(explainCommand);\nprogram.addCommand(fixCommand);\nprogram.addCommand(devCommand);\nprogram.addCommand(siteCommand);\nprogram.addCommand(serveCommand);\n\nawait program.parseAsync(process.argv);\n","import { Command } from 'commander';\nimport path from 'node:path';\nimport fs from 'node:fs';\nimport {\n loadConfig,\n compile,\n emitManifest,\n LintEngine,\n ALL_RULES,\n} from '@runcontext/core';\nimport type { Diagnostic, Severity } from '@runcontext/core';\nimport { formatDiagnostics } from '../formatters/pretty.js';\nimport { formatDiagnosticsJson } from '../formatters/json.js';\n\nexport const buildCommand = new Command('build')\n .description('Compile context files and emit manifest')\n .option('--format <format>', 'output format for diagnostics (pretty|json)', 'pretty')\n .action(async (opts: { format: string }) => {\n try {\n const config = await loadConfig(process.cwd());\n\n const rootDir = config.paths?.rootDir || process.cwd();\n const contextDir = path.resolve(rootDir, config.paths?.contextDir || 'context');\n const distDir = path.resolve(rootDir, config.paths?.distDir || 'dist');\n\n // Compile context files\n const { graph, diagnostics: compileDiags } = await compile({ contextDir, config });\n\n // Run lint engine\n const engine = new LintEngine(config.lint?.rules as Record<string, Severity | 'off'> | undefined);\n for (const rule of ALL_RULES) {\n engine.register(rule);\n }\n const lintDiags = engine.run(graph);\n\n // Merge diagnostics\n const allDiags: Diagnostic[] = [...compileDiags, ...lintDiags];\n\n // Display diagnostics\n if (allDiags.length > 0) {\n const output =\n opts.format === 'json'\n ? formatDiagnosticsJson(allDiags)\n : formatDiagnostics(allDiags);\n console.error(output);\n }\n\n // Emit manifest\n const manifest = emitManifest(graph, config);\n\n // Ensure dist directory exists\n fs.mkdirSync(distDir, { recursive: true });\n\n const manifestPath = path.join(distDir, 'context.manifest.json');\n fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2), 'utf-8');\n\n // Print summary\n const summary = [\n `Built manifest: ${manifest.concepts.length} concepts`,\n `${manifest.products.length} products`,\n `${manifest.policies.length} policies`,\n `${manifest.entities.length} entities`,\n `${manifest.terms.length} terms`,\n `${manifest.owners.length} owners`,\n ].join(', ');\n console.log(summary);\n console.log(`Manifest written to ${manifestPath}`);\n\n // Exit with error if any errors found\n const hasErrors = allDiags.some((d) => d.severity === 'error');\n if (hasErrors) {\n process.exit(1);\n }\n } catch (err) {\n console.error('Build failed:', (err as Error).message);\n process.exit(1);\n }\n });\n","import chalk from 'chalk';\nimport type { Diagnostic } from '@runcontext/core';\n\n/**\n * Format diagnostics as human-readable colored terminal output.\n *\n * Each diagnostic is rendered as:\n * file:line:col severity ruleId message\n *\n * A summary line is appended at the end.\n */\nexport function formatDiagnostics(diagnostics: Diagnostic[]): string {\n if (diagnostics.length === 0) {\n return chalk.green('No issues found.');\n }\n\n const lines: string[] = [];\n let errorCount = 0;\n let warningCount = 0;\n\n for (const d of diagnostics) {\n const location = `${d.source.file}:${d.source.line}:${d.source.col}`;\n const severityLabel =\n d.severity === 'error'\n ? chalk.red('error')\n : chalk.yellow('warning');\n\n if (d.severity === 'error') {\n errorCount++;\n } else {\n warningCount++;\n }\n\n lines.push(` ${location} ${severityLabel} ${chalk.dim(d.ruleId)} ${d.message}`);\n }\n\n lines.push('');\n\n const parts: string[] = [];\n if (errorCount > 0) {\n parts.push(chalk.red(`${errorCount} error${errorCount !== 1 ? 's' : ''}`));\n }\n if (warningCount > 0) {\n parts.push(chalk.yellow(`${warningCount} warning${warningCount !== 1 ? 's' : ''}`));\n }\n lines.push(parts.join(', '));\n\n return lines.join('\\n');\n}\n","import type { Diagnostic } from '@runcontext/core';\n\n/**\n * Format diagnostics as a JSON string with 2-space indentation.\n */\nexport function formatDiagnosticsJson(diagnostics: Diagnostic[]): string {\n return JSON.stringify(diagnostics, null, 2);\n}\n","import { Command } from 'commander';\nimport path from 'node:path';\nimport {\n loadConfig,\n compile,\n LintEngine,\n ALL_RULES,\n} from '@runcontext/core';\nimport type { Diagnostic, Severity } from '@runcontext/core';\nimport { formatDiagnostics } from '../formatters/pretty.js';\nimport { formatDiagnosticsJson } from '../formatters/json.js';\n\nexport const lintCommand = new Command('lint')\n .description('Lint context files and report diagnostics')\n .option('--format <format>', 'output format (pretty|json)', 'pretty')\n .option('--fix', 'apply autofixes (placeholder)')\n .action(async (opts: { format: string; fix?: boolean }) => {\n if (opts.fix) {\n console.log(\"Use 'context fix' for autofixes.\");\n return;\n }\n\n try {\n const config = await loadConfig(process.cwd());\n\n const rootDir = config.paths?.rootDir || process.cwd();\n const contextDir = path.resolve(rootDir, config.paths?.contextDir || 'context');\n\n // Compile context files\n const { graph, diagnostics: compileDiags } = await compile({ contextDir, config });\n\n // Run lint engine\n const engine = new LintEngine(config.lint?.rules as Record<string, Severity | 'off'> | undefined);\n for (const rule of ALL_RULES) {\n engine.register(rule);\n }\n const lintDiags = engine.run(graph);\n\n // Merge diagnostics\n const allDiags: Diagnostic[] = [...compileDiags, ...lintDiags];\n\n // Format output\n const output =\n opts.format === 'json'\n ? formatDiagnosticsJson(allDiags)\n : formatDiagnostics(allDiags);\n console.log(output);\n\n // Exit with error if any errors found\n const hasErrors = allDiags.some((d) => d.severity === 'error');\n if (hasErrors) {\n process.exit(1);\n }\n } catch (err) {\n console.error('Lint failed:', (err as Error).message);\n process.exit(1);\n }\n });\n","import { Command } from 'commander';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nconst SAMPLE_CONCEPT = `kind: concept\nid: example-concept\ndefinition: An example concept to get you started.\nowner: example-team\ntags:\n - example\nstatus: draft\n`;\n\nconst SAMPLE_OWNER = `kind: owner\nid: example-team\ndisplayName: Example Team\nemail: team@example.com\n`;\n\nfunction generateConfig(projectName: string): string {\n return `project:\n id: ${projectName}\n displayName: \"${projectName}\"\n version: \"0.1.0\"\n\npaths:\n contextDir: context\n distDir: dist\n\nlint:\n defaultSeverity: warning\n`;\n}\n\nexport const initCommand = new Command('init')\n .description('Create a new ContextKit project')\n .option('--name <name>', 'project name (defaults to directory basename)')\n .action((opts: { name?: string }) => {\n const cwd = process.cwd();\n const projectName = opts.name || path.basename(cwd);\n\n const dirs = [\n 'context/concepts',\n 'context/products',\n 'context/policies',\n 'context/entities',\n 'context/owners',\n 'context/terms',\n ];\n\n const files: Array<{ path: string; content: string }> = [\n { path: 'context/concepts/example-concept.ctx.yaml', content: SAMPLE_CONCEPT },\n { path: 'context/owners/example-team.owner.yaml', content: SAMPLE_OWNER },\n { path: 'contextkit.config.yaml', content: generateConfig(projectName) },\n ];\n\n // Create directories\n const created: string[] = [];\n for (const dir of dirs) {\n const fullPath = path.join(cwd, dir);\n fs.mkdirSync(fullPath, { recursive: true });\n created.push(dir + '/');\n }\n\n // Create files\n for (const file of files) {\n const fullPath = path.join(cwd, file.path);\n if (!fs.existsSync(fullPath)) {\n fs.writeFileSync(fullPath, file.content, 'utf-8');\n created.push(file.path);\n } else {\n console.log(` Skipped (already exists): ${file.path}`);\n }\n }\n\n console.log(`Initialized ContextKit project \"${projectName}\":`);\n for (const item of created) {\n console.log(` created ${item}`);\n }\n });\n","import { Command } from 'commander';\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport chalk from 'chalk';\nimport type { Manifest } from '@runcontext/core';\n\nexport const explainCommand = new Command('explain')\n .description('Look up a node by ID in the manifest')\n .argument('<id>', 'node ID to look up')\n .option('--manifest <path>', 'path to manifest file', 'dist/context.manifest.json')\n .action((id: string, opts: { manifest: string }) => {\n const manifestPath = path.resolve(process.cwd(), opts.manifest);\n\n if (!fs.existsSync(manifestPath)) {\n console.error(`Manifest not found at ${manifestPath}. Run 'context build' first.`);\n process.exit(1);\n }\n\n let manifest: Manifest;\n try {\n const raw = fs.readFileSync(manifestPath, 'utf-8');\n manifest = JSON.parse(raw) as Manifest;\n } catch {\n console.error(`Failed to read manifest at ${manifestPath}`);\n process.exit(1);\n }\n\n // Look up by index\n const entry = manifest.indexes?.byId?.[id];\n if (!entry) {\n console.error(`Node \"${id}\" not found in manifest.`);\n process.exit(1);\n }\n\n const { kind, index } = entry;\n const collection = (manifest as Record<string, unknown>)[kind + 's'] as Record<string, unknown>[];\n if (!collection || !collection[index]) {\n console.error(`Node \"${id}\" not found in \"${kind}s\" collection.`);\n process.exit(1);\n }\n\n const node = collection[index];\n\n // Display formatted info\n console.log(chalk.bold(`${kind}: ${id}`));\n console.log('');\n\n const fields: Array<[string, unknown]> = Object.entries(node).filter(\n ([key]) => key !== 'id',\n );\n\n for (const [key, value] of fields) {\n if (value === undefined || value === null) continue;\n\n if (Array.isArray(value)) {\n console.log(` ${chalk.dim(key + ':')} ${value.join(', ')}`);\n } else if (typeof value === 'object') {\n console.log(` ${chalk.dim(key + ':')} ${JSON.stringify(value)}`);\n } else {\n console.log(` ${chalk.dim(key + ':')} ${String(value)}`);\n }\n }\n });\n","import { Command } from 'commander';\nimport path from 'node:path';\nimport fs from 'node:fs';\nimport chalk from 'chalk';\nimport {\n loadConfig,\n compile,\n LintEngine,\n ALL_RULES,\n applyFixes,\n} from '@runcontext/core';\nimport type { Diagnostic, Severity } from '@runcontext/core';\nimport { formatDiagnostics } from '../formatters/pretty.js';\nimport { formatDiagnosticsJson } from '../formatters/json.js';\n\nexport const fixCommand = new Command('fix')\n .description('Apply autofixes to context files')\n .option('--write', 'write fixes to disk (default: dry-run)')\n .option('--format <format>', 'output format for diagnostics (pretty|json)', 'pretty')\n .action(async (opts: { write?: boolean; format: string }) => {\n try {\n const config = await loadConfig(process.cwd());\n\n const rootDir = config.paths?.rootDir || process.cwd();\n const contextDir = path.resolve(rootDir, config.paths?.contextDir || 'context');\n\n // Compile context files\n const { graph, diagnostics: compileDiags } = await compile({ contextDir, config });\n\n // Run lint engine\n const engine = new LintEngine(config.lint?.rules as Record<string, Severity | 'off'> | undefined);\n for (const rule of ALL_RULES) {\n engine.register(rule);\n }\n const lintDiags = engine.run(graph);\n\n // Merge diagnostics\n const allDiags: Diagnostic[] = [...compileDiags, ...lintDiags];\n\n // Separate fixable from unfixable\n const fixableDiags = allDiags.filter((d) => d.fixable && d.fix);\n const unfixableDiags = allDiags.filter((d) => !d.fixable || !d.fix);\n\n if (fixableDiags.length === 0) {\n console.log(chalk.green('No fixable issues found.'));\n if (unfixableDiags.length > 0) {\n console.log('');\n console.log(chalk.yellow(`${unfixableDiags.length} unfixable issue(s) remain:`));\n const output =\n opts.format === 'json'\n ? formatDiagnosticsJson(unfixableDiags)\n : formatDiagnostics(unfixableDiags);\n console.log(output);\n const hasErrors = unfixableDiags.some((d) => d.severity === 'error');\n if (hasErrors) {\n process.exit(1);\n }\n }\n return;\n }\n\n // Apply fixes\n const results = applyFixes(fixableDiags);\n\n if (opts.write) {\n // Write fixes to disk\n for (const result of results) {\n fs.writeFileSync(result.file, result.newContent, 'utf-8');\n }\n\n const totalEdits = results.reduce((sum, r) => sum + r.editsApplied, 0);\n console.log(\n chalk.green(`Fixed ${totalEdits} issue(s) in ${results.length} file(s).`)\n );\n\n // Report remaining unfixable issues\n if (unfixableDiags.length > 0) {\n console.log('');\n console.log(chalk.yellow(`${unfixableDiags.length} unfixable issue(s) remain:`));\n const output =\n opts.format === 'json'\n ? formatDiagnosticsJson(unfixableDiags)\n : formatDiagnostics(unfixableDiags);\n console.log(output);\n }\n } else {\n // Dry-run mode: show what would be fixed\n console.log(chalk.cyan('Dry run — no files changed. Use --write to apply fixes.\\n'));\n\n console.log(chalk.bold(`${fixableDiags.length} fixable issue(s) found:\\n`));\n\n for (const diag of fixableDiags) {\n const location = `${diag.source.file}:${diag.source.line}:${diag.source.col}`;\n const severityLabel =\n diag.severity === 'error'\n ? chalk.red('error')\n : chalk.yellow('warning');\n console.log(` ${location} ${severityLabel} ${chalk.dim(diag.ruleId)} ${diag.message}`);\n if (diag.fix) {\n console.log(` ${chalk.green('fix:')} ${diag.fix.description}`);\n }\n }\n\n console.log('');\n console.log(\n `Would fix ${results.reduce((s, r) => s + r.editsApplied, 0)} issue(s) in ${results.length} file(s).`\n );\n\n if (unfixableDiags.length > 0) {\n console.log('');\n console.log(chalk.yellow(`${unfixableDiags.length} unfixable issue(s) would remain.`));\n }\n }\n\n // Exit with error if unfixable errors remain\n const hasUnfixableErrors = unfixableDiags.some((d) => d.severity === 'error');\n if (hasUnfixableErrors) {\n process.exit(1);\n }\n } catch (err) {\n console.error('Fix failed:', (err as Error).message);\n process.exit(1);\n }\n });\n","import { Command } from 'commander';\nimport path from 'node:path';\nimport chalk from 'chalk';\nimport { watch } from 'chokidar';\nimport {\n loadConfig,\n compile,\n LintEngine,\n ALL_RULES,\n} from '@runcontext/core';\nimport type { Diagnostic, Severity } from '@runcontext/core';\n\nexport const devCommand = new Command('dev')\n .description('Watch context files and rebuild on change')\n .action(async () => {\n try {\n const config = await loadConfig(process.cwd());\n\n const rootDir = config.paths?.rootDir || process.cwd();\n const contextDir = path.resolve(rootDir, config.paths?.contextDir || 'context');\n\n const watchPattern = path.join(contextDir, '**/*.{yaml,yml}');\n\n console.log(chalk.cyan(`Watching ${watchPattern} for changes...\\n`));\n\n // Run an initial compile + lint\n await runBuild(contextDir, config);\n\n // Set up debounced watcher\n let debounceTimer: ReturnType<typeof setTimeout> | null = null;\n\n const watcher = watch(watchPattern, {\n ignoreInitial: true,\n persistent: true,\n });\n\n watcher.on('all', (_event: string, _filePath: string) => {\n if (debounceTimer) {\n clearTimeout(debounceTimer);\n }\n debounceTimer = setTimeout(async () => {\n debounceTimer = null;\n await runBuild(contextDir, config);\n }, 100);\n });\n\n watcher.on('error', (error: Error) => {\n console.error(chalk.red(`Watcher error: ${error.message}`));\n });\n\n // Handle clean exit\n const cleanup = () => {\n console.log(chalk.dim('\\nStopping watch mode...'));\n watcher.close().then(() => {\n process.exit(0);\n });\n };\n\n process.on('SIGINT', cleanup);\n process.on('SIGTERM', cleanup);\n } catch (err) {\n console.error('Dev mode failed:', (err as Error).message);\n process.exit(1);\n }\n });\n\nasync function runBuild(\n contextDir: string,\n config: Awaited<ReturnType<typeof loadConfig>>,\n): Promise<void> {\n const separator = chalk.dim('─'.repeat(60));\n const timestamp = new Date().toLocaleTimeString();\n\n console.log(separator);\n console.log(chalk.bold(`[${timestamp}] Rebuilding...\\n`));\n\n try {\n // Compile context files\n const { graph, diagnostics: compileDiags } = await compile({ contextDir, config });\n\n // Run lint engine\n const engine = new LintEngine(config.lint?.rules as Record<string, Severity | 'off'> | undefined);\n for (const rule of ALL_RULES) {\n engine.register(rule);\n }\n const lintDiags = engine.run(graph);\n\n // Merge diagnostics\n const allDiags: Diagnostic[] = [...compileDiags, ...lintDiags];\n\n if (allDiags.length === 0) {\n console.log(chalk.green('No issues found.\\n'));\n return;\n }\n\n // Print diagnostics summary\n let errorCount = 0;\n let warningCount = 0;\n let fixableCount = 0;\n\n for (const d of allDiags) {\n if (d.severity === 'error') errorCount++;\n else warningCount++;\n if (d.fixable) fixableCount++;\n\n const location = `${d.source.file}:${d.source.line}:${d.source.col}`;\n const severityLabel =\n d.severity === 'error'\n ? chalk.red('error')\n : chalk.yellow('warning');\n console.log(` ${location} ${severityLabel} ${chalk.dim(d.ruleId)} ${d.message}`);\n }\n\n console.log('');\n const parts: string[] = [];\n if (errorCount > 0) {\n parts.push(chalk.red(`${errorCount} error${errorCount !== 1 ? 's' : ''}`));\n }\n if (warningCount > 0) {\n parts.push(chalk.yellow(`${warningCount} warning${warningCount !== 1 ? 's' : ''}`));\n }\n if (fixableCount > 0) {\n parts.push(chalk.cyan(`${fixableCount} fixable`));\n }\n console.log(parts.join(', ') + '\\n');\n } catch (err) {\n console.error(chalk.red(`Build error: ${(err as Error).message}\\n`));\n }\n}\n","import { readFile } from 'node:fs/promises';\nimport { resolve } from 'node:path';\nimport { Command } from 'commander';\nimport { generateSite } from '@runcontext/site';\nimport type { Manifest } from '@runcontext/core';\n\nexport const siteCommand = new Command('site')\n .description('Site generator commands');\n\nsiteCommand\n .command('build')\n .description('Build the context documentation site')\n .option('--manifest <path>', 'Path to manifest file', 'dist/context.manifest.json')\n .option('--output <dir>', 'Output directory', 'dist/site')\n .option('--title <title>', 'Site title')\n .option('--base-path <path>', 'Base path for links (e.g., /docs)')\n .action(async (opts: { manifest: string; output: string; title?: string; basePath?: string }) => {\n const manifestPath = resolve(opts.manifest);\n\n let manifestJson: string;\n try {\n manifestJson = await readFile(manifestPath, 'utf-8');\n } catch {\n console.error(`Error: Could not read manifest file at ${manifestPath}`);\n console.error('Run \"context build\" first to generate the manifest.');\n process.exitCode = 1;\n return;\n }\n\n let manifest: Manifest;\n try {\n manifest = JSON.parse(manifestJson) as Manifest;\n } catch {\n console.error(`Error: Invalid JSON in manifest file at ${manifestPath}`);\n process.exitCode = 1;\n return;\n }\n\n const outputDir = resolve(opts.output);\n\n console.log(`Building site from ${manifestPath}...`);\n\n await generateSite({\n manifest,\n outputDir,\n title: opts.title,\n basePath: opts.basePath,\n });\n\n console.log(`Site generated at ${outputDir}`);\n });\n","import { Command } from 'commander';\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport type { Manifest } from '@runcontext/core';\n\nexport const serveCommand = new Command('serve')\n .description('Start the MCP server')\n .option('--stdio', 'Use stdio transport (default)')\n .option('--http <port>', 'Use HTTP/SSE transport on the given port', parseInt)\n .option('--manifest <path>', 'Path to manifest file', 'dist/context.manifest.json')\n .action(async (opts: { stdio?: boolean; http?: number; manifest: string }) => {\n try {\n // Resolve manifest path\n const manifestPath = path.resolve(process.cwd(), opts.manifest);\n if (!fs.existsSync(manifestPath)) {\n console.error(`Manifest not found: ${manifestPath}`);\n console.error('Run \"context build\" first to generate the manifest.');\n process.exit(1);\n }\n\n const manifestData = JSON.parse(fs.readFileSync(manifestPath, 'utf-8')) as Manifest;\n\n // Dynamic import to avoid loading MCP deps when not needed\n const { createContextMcpServer } = await import('@runcontext/mcp');\n\n const server = createContextMcpServer(manifestData);\n\n if (opts.http) {\n // HTTP/SSE transport via express + StreamableHTTPServerTransport\n const { StreamableHTTPServerTransport } = await import(\n '@modelcontextprotocol/sdk/server/streamableHttp.js'\n );\n const { createMcpExpressApp } = await import(\n '@modelcontextprotocol/sdk/server/express.js'\n );\n const { randomUUID } = await import('node:crypto');\n\n const app = createMcpExpressApp();\n const transport = new StreamableHTTPServerTransport({\n sessionIdGenerator: () => randomUUID(),\n });\n\n app.all('/mcp', (req, res) => {\n transport.handleRequest(req, res);\n });\n\n await server.connect(transport);\n\n const port = opts.http;\n app.listen(port, () => {\n console.log(`ContextKit MCP server listening on http://127.0.0.1:${port}/mcp`);\n });\n } else {\n // Default: stdio transport\n const { StdioServerTransport } = await import(\n '@modelcontextprotocol/sdk/server/stdio.js'\n );\n\n const transport = new StdioServerTransport();\n await server.connect(transport);\n\n // In stdio mode, log to stderr so stdout stays clean for MCP protocol\n console.error('ContextKit MCP server running on stdio');\n }\n } catch (err) {\n console.error('Failed to start MCP server:', (err as Error).message);\n process.exit(1);\n }\n });\n"],"mappings":";;;AAAA,SAAS,WAAAA,gBAAe;;;ACAxB,SAAS,eAAe;AACxB,OAAO,UAAU;AACjB,OAAO,QAAQ;AACf;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;ACTP,OAAO,WAAW;AAWX,SAAS,kBAAkB,aAAmC;AACnE,MAAI,YAAY,WAAW,GAAG;AAC5B,WAAO,MAAM,MAAM,kBAAkB;AAAA,EACvC;AAEA,QAAM,QAAkB,CAAC;AACzB,MAAI,aAAa;AACjB,MAAI,eAAe;AAEnB,aAAW,KAAK,aAAa;AAC3B,UAAM,WAAW,GAAG,EAAE,OAAO,IAAI,IAAI,EAAE,OAAO,IAAI,IAAI,EAAE,OAAO,GAAG;AAClE,UAAM,gBACJ,EAAE,aAAa,UACX,MAAM,IAAI,OAAO,IACjB,MAAM,OAAO,SAAS;AAE5B,QAAI,EAAE,aAAa,SAAS;AAC1B;AAAA,IACF,OAAO;AACL;AAAA,IACF;AAEA,UAAM,KAAK,KAAK,QAAQ,KAAK,aAAa,KAAK,MAAM,IAAI,EAAE,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE;AAAA,EACpF;AAEA,QAAM,KAAK,EAAE;AAEb,QAAM,QAAkB,CAAC;AACzB,MAAI,aAAa,GAAG;AAClB,UAAM,KAAK,MAAM,IAAI,GAAG,UAAU,SAAS,eAAe,IAAI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adConfig","compile","LintEngine","ALL_RULES","Command","loadConfig","path","compile","LintEngine","ALL_RULES","Command","fs","path","Command","fs","path","chalk","Command","path","fs","chalk","loadConfig","compile","LintEngine","ALL_RULES","Command","loadConfig","path","compile","LintEngine","ALL_RULES","chalk","fs","Command","path","chalk","loadConfig","compile","LintEngine","ALL_RULES","Command","Command","fs","path","Command"]}
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "@runcontext/cli",
3
+ "version": "0.1.0",
4
+ "description": "CLI for ContextKit — lint, build, fix, and serve institutional context",
5
+ "license": "MIT",
6
+ "author": "Eric Kittelson",
7
+ "homepage": "https://github.com/erickittelson/ContextKit",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/erickittelson/ContextKit.git",
11
+ "directory": "packages/cli"
12
+ },
13
+ "keywords": ["contextkit", "cli", "lint", "build", "yaml", "mcp"],
14
+ "type": "module",
15
+ "bin": {
16
+ "context": "./dist/index.js"
17
+ },
18
+ "files": ["dist"],
19
+ "scripts": {
20
+ "build": "tsup",
21
+ "clean": "rm -rf dist"
22
+ },
23
+ "dependencies": {
24
+ "@runcontext/core": "workspace:^",
25
+ "@runcontext/mcp": "workspace:^",
26
+ "@runcontext/site": "workspace:^",
27
+ "chalk": "^5.4.0",
28
+ "chokidar": "^4.0.0",
29
+ "commander": "^14.0.0"
30
+ },
31
+ "devDependencies": {
32
+ "@types/node": "^25.3.3",
33
+ "tsup": "^8.4.0",
34
+ "typescript": "^5.7.0",
35
+ "vitest": "^3.2.0"
36
+ }
37
+ }