@runcontext/cli 0.1.0 → 0.2.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 +537 -381
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
|
-
import { Command as
|
|
4
|
+
import { Command as Command11 } from "commander";
|
|
5
5
|
|
|
6
|
-
// src/commands/
|
|
6
|
+
// src/commands/lint.ts
|
|
7
7
|
import { Command } from "commander";
|
|
8
|
+
import chalk2 from "chalk";
|
|
8
9
|
import path from "path";
|
|
9
|
-
import fs from "fs";
|
|
10
10
|
import {
|
|
11
|
-
loadConfig,
|
|
12
11
|
compile,
|
|
13
|
-
|
|
12
|
+
loadConfig,
|
|
14
13
|
LintEngine,
|
|
15
14
|
ALL_RULES
|
|
16
15
|
} from "@runcontext/core";
|
|
@@ -22,502 +21,659 @@ function formatDiagnostics(diagnostics) {
|
|
|
22
21
|
return chalk.green("No issues found.");
|
|
23
22
|
}
|
|
24
23
|
const lines = [];
|
|
25
|
-
let errorCount = 0;
|
|
26
|
-
let warningCount = 0;
|
|
27
24
|
for (const d of diagnostics) {
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
lines.push(`
|
|
25
|
+
const icon = d.severity === "error" ? chalk.red("error") : chalk.yellow("warning");
|
|
26
|
+
const loc = chalk.gray(
|
|
27
|
+
`${d.location.file}:${d.location.line}:${d.location.column}`
|
|
28
|
+
);
|
|
29
|
+
const rule = chalk.gray(`[${d.ruleId}]`);
|
|
30
|
+
const fixTag = d.fixable ? chalk.blue(" (fixable)") : "";
|
|
31
|
+
lines.push(` ${icon} ${d.message} ${rule}${fixTag}`);
|
|
32
|
+
lines.push(` ${loc}`);
|
|
36
33
|
}
|
|
34
|
+
const errorCount = diagnostics.filter((d) => d.severity === "error").length;
|
|
35
|
+
const warnCount = diagnostics.filter((d) => d.severity === "warning").length;
|
|
37
36
|
lines.push("");
|
|
38
37
|
const parts = [];
|
|
39
|
-
if (errorCount > 0) {
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
if (warningCount > 0) {
|
|
43
|
-
parts.push(chalk.yellow(`${warningCount} warning${warningCount !== 1 ? "s" : ""}`));
|
|
44
|
-
}
|
|
38
|
+
if (errorCount > 0) parts.push(chalk.red(`${errorCount} error(s)`));
|
|
39
|
+
if (warnCount > 0) parts.push(chalk.yellow(`${warnCount} warning(s)`));
|
|
45
40
|
lines.push(parts.join(", "));
|
|
46
41
|
return lines.join("\n");
|
|
47
42
|
}
|
|
43
|
+
function formatTierScore(score) {
|
|
44
|
+
const lines = [];
|
|
45
|
+
const tierColor = getTierColor(score.tier);
|
|
46
|
+
lines.push(
|
|
47
|
+
`${chalk.bold(score.model)}: ${tierColor(score.tier.toUpperCase())}`
|
|
48
|
+
);
|
|
49
|
+
lines.push("");
|
|
50
|
+
lines.push(formatTierSection("Bronze", score.bronze.passed, score.bronze.checks));
|
|
51
|
+
lines.push(formatTierSection("Silver", score.silver.passed, score.silver.checks));
|
|
52
|
+
lines.push(formatTierSection("Gold", score.gold.passed, score.gold.checks));
|
|
53
|
+
return lines.join("\n");
|
|
54
|
+
}
|
|
55
|
+
function formatTierSection(label, passed, checks) {
|
|
56
|
+
const lines = [];
|
|
57
|
+
const status = passed ? chalk.green("PASS") : chalk.red("FAIL");
|
|
58
|
+
lines.push(` ${label}: ${status}`);
|
|
59
|
+
for (const check of checks) {
|
|
60
|
+
const icon = check.passed ? chalk.green(" +") : chalk.red(" -");
|
|
61
|
+
lines.push(` ${icon} ${check.label}`);
|
|
62
|
+
if (check.detail && !check.passed) {
|
|
63
|
+
lines.push(chalk.gray(` ${check.detail}`));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return lines.join("\n");
|
|
67
|
+
}
|
|
68
|
+
function getTierColor(tier) {
|
|
69
|
+
switch (tier) {
|
|
70
|
+
case "gold":
|
|
71
|
+
return chalk.yellow;
|
|
72
|
+
case "silver":
|
|
73
|
+
return chalk.white;
|
|
74
|
+
case "bronze":
|
|
75
|
+
return chalk.hex("#CD7F32");
|
|
76
|
+
default:
|
|
77
|
+
return chalk.gray;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
function formatError(message) {
|
|
81
|
+
return chalk.red(`Error: ${message}`);
|
|
82
|
+
}
|
|
83
|
+
function formatSuccess(message) {
|
|
84
|
+
return chalk.green(message);
|
|
85
|
+
}
|
|
48
86
|
|
|
49
87
|
// src/formatters/json.ts
|
|
50
|
-
function
|
|
51
|
-
return JSON.stringify(
|
|
88
|
+
function formatJson(data) {
|
|
89
|
+
return JSON.stringify(data, null, 2);
|
|
52
90
|
}
|
|
53
91
|
|
|
54
|
-
// src/commands/
|
|
55
|
-
var
|
|
92
|
+
// src/commands/lint.ts
|
|
93
|
+
var lintCommand = new Command("lint").description("Run all lint rules against context files").option("--context-dir <path>", "Path to context directory").option("--format <type>", "Output format: pretty or json", "pretty").action(async (opts) => {
|
|
56
94
|
try {
|
|
57
|
-
const config =
|
|
58
|
-
const
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
95
|
+
const config = loadConfig(process.cwd());
|
|
96
|
+
const contextDir = opts.contextDir ? path.resolve(opts.contextDir) : path.resolve(config.context_dir);
|
|
97
|
+
const { graph, diagnostics: compileDiags } = await compile({
|
|
98
|
+
contextDir,
|
|
99
|
+
config
|
|
100
|
+
});
|
|
101
|
+
const overrides = config.lint?.severity_overrides;
|
|
102
|
+
const engine = new LintEngine(overrides);
|
|
63
103
|
for (const rule of ALL_RULES) {
|
|
64
104
|
engine.register(rule);
|
|
65
105
|
}
|
|
66
106
|
const lintDiags = engine.run(graph);
|
|
67
107
|
const allDiags = [...compileDiags, ...lintDiags];
|
|
68
|
-
if (
|
|
69
|
-
const
|
|
70
|
-
|
|
108
|
+
if (config.minimum_tier) {
|
|
109
|
+
const tierOrder = ["none", "bronze", "silver", "gold"];
|
|
110
|
+
const minIdx = tierOrder.indexOf(config.minimum_tier);
|
|
111
|
+
for (const [modelName, score] of graph.tiers) {
|
|
112
|
+
const actualIdx = tierOrder.indexOf(score.tier);
|
|
113
|
+
if (actualIdx < minIdx) {
|
|
114
|
+
allDiags.push({
|
|
115
|
+
ruleId: "tier/minimum-tier",
|
|
116
|
+
severity: "error",
|
|
117
|
+
message: `Model "${modelName}" is tier "${score.tier}" but minimum_tier is "${config.minimum_tier}"`,
|
|
118
|
+
location: { file: `model:${modelName}`, line: 1, column: 1 },
|
|
119
|
+
fixable: false
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if (opts.format === "json") {
|
|
125
|
+
console.log(formatJson(allDiags));
|
|
126
|
+
} else {
|
|
127
|
+
console.log(formatDiagnostics(allDiags));
|
|
71
128
|
}
|
|
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
129
|
const hasErrors = allDiags.some((d) => d.severity === "error");
|
|
87
130
|
if (hasErrors) {
|
|
88
131
|
process.exit(1);
|
|
89
132
|
}
|
|
90
133
|
} catch (err) {
|
|
91
|
-
console.error(
|
|
134
|
+
console.error(chalk2.red(`Lint failed: ${err.message}`));
|
|
92
135
|
process.exit(1);
|
|
93
136
|
}
|
|
94
137
|
});
|
|
95
138
|
|
|
96
|
-
// src/commands/
|
|
139
|
+
// src/commands/build.ts
|
|
97
140
|
import { Command as Command2 } from "commander";
|
|
141
|
+
import chalk3 from "chalk";
|
|
98
142
|
import path2 from "path";
|
|
99
|
-
import
|
|
100
|
-
|
|
101
|
-
|
|
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
|
-
}
|
|
143
|
+
import fs from "fs";
|
|
144
|
+
import { compile as compile2, loadConfig as loadConfig2, emitManifest } from "@runcontext/core";
|
|
145
|
+
var buildCommand = new Command2("build").description("Compile context files and emit manifest JSON").option("--context-dir <path>", "Path to context directory").option("--output-dir <path>", "Path to output directory").option("--format <type>", "Output format: pretty or json", "pretty").action(async (opts) => {
|
|
110
146
|
try {
|
|
111
|
-
const config =
|
|
112
|
-
const
|
|
113
|
-
const
|
|
114
|
-
const { graph, diagnostics
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
147
|
+
const config = loadConfig2(process.cwd());
|
|
148
|
+
const contextDir = opts.contextDir ? path2.resolve(opts.contextDir) : path2.resolve(config.context_dir);
|
|
149
|
+
const outputDir = opts.outputDir ? path2.resolve(opts.outputDir) : path2.resolve(config.output_dir);
|
|
150
|
+
const { graph, diagnostics } = await compile2({ contextDir, config });
|
|
151
|
+
const errors = diagnostics.filter((d) => d.severity === "error");
|
|
152
|
+
if (errors.length > 0) {
|
|
153
|
+
if (opts.format === "json") {
|
|
154
|
+
console.log(formatJson({ success: false, errors }));
|
|
155
|
+
} else {
|
|
156
|
+
console.error(
|
|
157
|
+
chalk3.red(`Build failed with ${errors.length} error(s):`)
|
|
158
|
+
);
|
|
159
|
+
for (const e of errors) {
|
|
160
|
+
console.error(chalk3.red(` - ${e.message} [${e.ruleId}]`));
|
|
161
|
+
}
|
|
162
|
+
}
|
|
125
163
|
process.exit(1);
|
|
126
164
|
}
|
|
165
|
+
const manifest = emitManifest(graph, config);
|
|
166
|
+
fs.mkdirSync(outputDir, { recursive: true });
|
|
167
|
+
const outputPath = path2.join(outputDir, "contextkit-manifest.json");
|
|
168
|
+
fs.writeFileSync(outputPath, JSON.stringify(manifest, null, 2), "utf-8");
|
|
169
|
+
if (opts.format === "json") {
|
|
170
|
+
console.log(formatJson({ success: true, outputPath, manifest }));
|
|
171
|
+
} else {
|
|
172
|
+
console.log(formatSuccess(`Manifest written to ${outputPath}`));
|
|
173
|
+
}
|
|
127
174
|
} catch (err) {
|
|
128
|
-
console.error(
|
|
175
|
+
console.error(formatError(err.message));
|
|
129
176
|
process.exit(1);
|
|
130
177
|
}
|
|
131
178
|
});
|
|
132
179
|
|
|
133
|
-
// src/commands/
|
|
180
|
+
// src/commands/tier.ts
|
|
134
181
|
import { Command as Command3 } from "commander";
|
|
135
|
-
import
|
|
182
|
+
import chalk4 from "chalk";
|
|
136
183
|
import path3 from "path";
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
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);
|
|
184
|
+
import { compile as compile3, loadConfig as loadConfig3, computeTier } from "@runcontext/core";
|
|
185
|
+
var tierCommand = new Command3("tier").description("Show tier scorecard for one or all models").argument("[model-name]", "Specific model name to check").option("--context-dir <path>", "Path to context directory").option("--format <type>", "Output format: pretty or json", "pretty").action(async (modelName, opts) => {
|
|
186
|
+
try {
|
|
187
|
+
const config = loadConfig3(process.cwd());
|
|
188
|
+
const contextDir = opts.contextDir ? path3.resolve(opts.contextDir) : path3.resolve(config.context_dir);
|
|
189
|
+
const { graph } = await compile3({ contextDir, config });
|
|
190
|
+
let scores;
|
|
191
|
+
if (modelName) {
|
|
192
|
+
if (!graph.models.has(modelName)) {
|
|
193
|
+
console.error(formatError(`Model '${modelName}' not found.`));
|
|
194
|
+
const available = [...graph.models.keys()].join(", ");
|
|
195
|
+
if (available) {
|
|
196
|
+
console.error(chalk4.gray(`Available models: ${available}`));
|
|
197
|
+
}
|
|
198
|
+
process.exit(1);
|
|
199
|
+
}
|
|
200
|
+
scores = [computeTier(modelName, graph)];
|
|
191
201
|
} else {
|
|
192
|
-
|
|
202
|
+
scores = [...graph.models.keys()].map(
|
|
203
|
+
(name) => computeTier(name, graph)
|
|
204
|
+
);
|
|
193
205
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
206
|
+
if (scores.length === 0) {
|
|
207
|
+
console.log(
|
|
208
|
+
opts.format === "json" ? formatJson([]) : chalk4.yellow("No models found.")
|
|
209
|
+
);
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
if (opts.format === "json") {
|
|
213
|
+
console.log(formatJson(scores));
|
|
214
|
+
} else {
|
|
215
|
+
for (const score of scores) {
|
|
216
|
+
console.log(formatTierScore(score));
|
|
217
|
+
console.log("");
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
} catch (err) {
|
|
221
|
+
console.error(formatError(err.message));
|
|
222
|
+
process.exit(1);
|
|
198
223
|
}
|
|
199
224
|
});
|
|
200
225
|
|
|
201
226
|
// src/commands/explain.ts
|
|
202
227
|
import { Command as Command4 } from "commander";
|
|
203
|
-
import
|
|
228
|
+
import chalk5 from "chalk";
|
|
204
229
|
import path4 from "path";
|
|
205
|
-
import
|
|
206
|
-
var explainCommand = new Command4("explain").description("Look up
|
|
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;
|
|
230
|
+
import { compile as compile4, loadConfig as loadConfig4 } from "@runcontext/core";
|
|
231
|
+
var explainCommand = new Command4("explain").description("Look up models, terms, or owners by name and show details").argument("<name>", "Name of a model, term, or owner to look up").option("--context-dir <path>", "Path to context directory").option("--format <type>", "Output format: pretty or json", "pretty").action(async (name, opts) => {
|
|
213
232
|
try {
|
|
214
|
-
const
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
233
|
+
const config = loadConfig4(process.cwd());
|
|
234
|
+
const contextDir = opts.contextDir ? path4.resolve(opts.contextDir) : path4.resolve(config.context_dir);
|
|
235
|
+
const { graph } = await compile4({ contextDir, config });
|
|
236
|
+
const results = [];
|
|
237
|
+
if (graph.models.has(name)) {
|
|
238
|
+
results.push({ type: "model", name, data: graph.models.get(name) });
|
|
239
|
+
}
|
|
240
|
+
if (graph.terms.has(name)) {
|
|
241
|
+
results.push({ type: "term", name, data: graph.terms.get(name) });
|
|
242
|
+
}
|
|
243
|
+
if (graph.owners.has(name)) {
|
|
244
|
+
results.push({ type: "owner", name, data: graph.owners.get(name) });
|
|
245
|
+
}
|
|
246
|
+
if (graph.governance.has(name)) {
|
|
247
|
+
results.push({
|
|
248
|
+
type: "governance",
|
|
249
|
+
name,
|
|
250
|
+
data: graph.governance.get(name)
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
if (graph.rules.has(name)) {
|
|
254
|
+
results.push({ type: "rules", name, data: graph.rules.get(name) });
|
|
255
|
+
}
|
|
256
|
+
if (graph.lineage.has(name)) {
|
|
257
|
+
results.push({ type: "lineage", name, data: graph.lineage.get(name) });
|
|
258
|
+
}
|
|
259
|
+
if (results.length === 0) {
|
|
260
|
+
console.error(formatError(`No matching entity found for '${name}'.`));
|
|
261
|
+
process.exit(1);
|
|
262
|
+
}
|
|
263
|
+
if (opts.format === "json") {
|
|
264
|
+
console.log(formatJson(results));
|
|
243
265
|
} else {
|
|
244
|
-
|
|
266
|
+
for (const result of results) {
|
|
267
|
+
console.log(chalk5.bold(`${result.type}: ${result.name}`));
|
|
268
|
+
console.log(chalk5.gray("---"));
|
|
269
|
+
console.log(JSON.stringify(result.data, null, 2));
|
|
270
|
+
console.log("");
|
|
271
|
+
}
|
|
245
272
|
}
|
|
273
|
+
} catch (err) {
|
|
274
|
+
console.error(formatError(err.message));
|
|
275
|
+
process.exit(1);
|
|
246
276
|
}
|
|
247
277
|
});
|
|
248
278
|
|
|
249
279
|
// src/commands/fix.ts
|
|
250
280
|
import { Command as Command5 } from "commander";
|
|
281
|
+
import chalk6 from "chalk";
|
|
251
282
|
import path5 from "path";
|
|
252
|
-
import
|
|
253
|
-
import chalk3 from "chalk";
|
|
283
|
+
import fs2 from "fs";
|
|
254
284
|
import {
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
LintEngine as
|
|
258
|
-
ALL_RULES as
|
|
285
|
+
compile as compile5,
|
|
286
|
+
loadConfig as loadConfig5,
|
|
287
|
+
LintEngine as LintEngine2,
|
|
288
|
+
ALL_RULES as ALL_RULES2,
|
|
259
289
|
applyFixes
|
|
260
290
|
} from "@runcontext/core";
|
|
261
|
-
var fixCommand = new Command5("fix").description("
|
|
291
|
+
var fixCommand = new Command5("fix").description("Auto-fix lint issues").option("--context-dir <path>", "Path to context directory").option("--format <type>", "Output format: pretty or json", "pretty").option("--dry-run", "Show what would be fixed without writing files").action(async (opts) => {
|
|
262
292
|
try {
|
|
263
|
-
const config =
|
|
264
|
-
const
|
|
265
|
-
const
|
|
266
|
-
const
|
|
267
|
-
const engine = new
|
|
268
|
-
for (const rule of
|
|
293
|
+
const config = loadConfig5(process.cwd());
|
|
294
|
+
const contextDir = opts.contextDir ? path5.resolve(opts.contextDir) : path5.resolve(config.context_dir);
|
|
295
|
+
const { graph } = await compile5({ contextDir, config });
|
|
296
|
+
const overrides = config.lint?.severity_overrides;
|
|
297
|
+
const engine = new LintEngine2(overrides);
|
|
298
|
+
for (const rule of ALL_RULES2) {
|
|
269
299
|
engine.register(rule);
|
|
270
300
|
}
|
|
271
|
-
const
|
|
272
|
-
const
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
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
|
-
}
|
|
301
|
+
const diagnostics = engine.run(graph);
|
|
302
|
+
const fixable = diagnostics.filter((d) => d.fixable);
|
|
303
|
+
if (fixable.length === 0) {
|
|
304
|
+
if (opts.format === "json") {
|
|
305
|
+
console.log(formatJson({ fixedFiles: [], fixCount: 0 }));
|
|
306
|
+
} else {
|
|
307
|
+
console.log(chalk6.green("No fixable issues found."));
|
|
286
308
|
}
|
|
287
309
|
return;
|
|
288
310
|
}
|
|
289
|
-
const
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
311
|
+
const readFile = (filePath) => fs2.readFileSync(filePath, "utf-8");
|
|
312
|
+
const fixedFiles = applyFixes(fixable, readFile);
|
|
313
|
+
if (opts.dryRun) {
|
|
314
|
+
if (opts.format === "json") {
|
|
315
|
+
const entries = [...fixedFiles.entries()].map(([file, content]) => ({
|
|
316
|
+
file,
|
|
317
|
+
content
|
|
318
|
+
}));
|
|
319
|
+
console.log(
|
|
320
|
+
formatJson({ dryRun: true, fixCount: fixable.length, entries })
|
|
321
|
+
);
|
|
322
|
+
} else {
|
|
323
|
+
console.log(
|
|
324
|
+
chalk6.yellow(`Dry run: ${fixable.length} issue(s) would be fixed in ${fixedFiles.size} file(s):`)
|
|
325
|
+
);
|
|
326
|
+
for (const file of fixedFiles.keys()) {
|
|
327
|
+
console.log(chalk6.gray(` ${file}`));
|
|
328
|
+
}
|
|
293
329
|
}
|
|
294
|
-
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
for (const [file, content] of fixedFiles) {
|
|
333
|
+
fs2.writeFileSync(file, content, "utf-8");
|
|
334
|
+
}
|
|
335
|
+
if (opts.format === "json") {
|
|
295
336
|
console.log(
|
|
296
|
-
|
|
337
|
+
formatJson({
|
|
338
|
+
fixedFiles: [...fixedFiles.keys()],
|
|
339
|
+
fixCount: fixable.length
|
|
340
|
+
})
|
|
297
341
|
);
|
|
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
342
|
} 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
343
|
console.log(
|
|
318
|
-
|
|
344
|
+
formatSuccess(
|
|
345
|
+
`Fixed ${fixable.length} issue(s) in ${fixedFiles.size} file(s).`
|
|
346
|
+
)
|
|
319
347
|
);
|
|
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
348
|
}
|
|
329
349
|
} catch (err) {
|
|
330
|
-
console.error(
|
|
350
|
+
console.error(formatError(err.message));
|
|
331
351
|
process.exit(1);
|
|
332
352
|
}
|
|
333
353
|
});
|
|
334
354
|
|
|
335
355
|
// src/commands/dev.ts
|
|
336
356
|
import { Command as Command6 } from "commander";
|
|
357
|
+
import chalk7 from "chalk";
|
|
337
358
|
import path6 from "path";
|
|
338
|
-
import chalk4 from "chalk";
|
|
339
|
-
import { watch } from "chokidar";
|
|
340
359
|
import {
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
LintEngine as
|
|
344
|
-
ALL_RULES as
|
|
360
|
+
compile as compile6,
|
|
361
|
+
loadConfig as loadConfig6,
|
|
362
|
+
LintEngine as LintEngine3,
|
|
363
|
+
ALL_RULES as ALL_RULES3
|
|
345
364
|
} from "@runcontext/core";
|
|
346
|
-
|
|
365
|
+
async function runLint(contextDir) {
|
|
366
|
+
const config = loadConfig6(process.cwd());
|
|
367
|
+
const { graph, diagnostics: compileDiags } = await compile6({
|
|
368
|
+
contextDir,
|
|
369
|
+
config
|
|
370
|
+
});
|
|
371
|
+
const overrides = config.lint?.severity_overrides;
|
|
372
|
+
const engine = new LintEngine3(overrides);
|
|
373
|
+
for (const rule of ALL_RULES3) {
|
|
374
|
+
engine.register(rule);
|
|
375
|
+
}
|
|
376
|
+
const lintDiags = engine.run(graph);
|
|
377
|
+
const allDiags = [...compileDiags, ...lintDiags];
|
|
378
|
+
console.clear();
|
|
379
|
+
console.log(chalk7.gray(`[${(/* @__PURE__ */ new Date()).toLocaleTimeString()}] Linting...`));
|
|
380
|
+
console.log(formatDiagnostics(allDiags));
|
|
381
|
+
console.log("");
|
|
382
|
+
}
|
|
383
|
+
var devCommand = new Command6("dev").description("Watch mode \u2014 re-run lint on file changes").option("--context-dir <path>", "Path to context directory").action(async (opts) => {
|
|
347
384
|
try {
|
|
348
|
-
const config =
|
|
349
|
-
const
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
await runBuild(contextDir, config);
|
|
385
|
+
const config = loadConfig6(process.cwd());
|
|
386
|
+
const contextDir = opts.contextDir ? path6.resolve(opts.contextDir) : path6.resolve(config.context_dir);
|
|
387
|
+
console.log(chalk7.blue(`Watching ${contextDir} for changes...`));
|
|
388
|
+
console.log(chalk7.gray("Press Ctrl+C to stop.\n"));
|
|
389
|
+
await runLint(contextDir);
|
|
390
|
+
const { watch } = await import("chokidar");
|
|
355
391
|
let debounceTimer = null;
|
|
356
|
-
const watcher = watch(
|
|
357
|
-
|
|
358
|
-
|
|
392
|
+
const watcher = watch(contextDir, {
|
|
393
|
+
ignored: /(^|[/\\])\../,
|
|
394
|
+
// ignore dotfiles
|
|
395
|
+
persistent: true,
|
|
396
|
+
ignoreInitial: true
|
|
359
397
|
});
|
|
360
398
|
watcher.on("all", (_event, _filePath) => {
|
|
361
|
-
if (debounceTimer)
|
|
362
|
-
clearTimeout(debounceTimer);
|
|
363
|
-
}
|
|
399
|
+
if (debounceTimer) clearTimeout(debounceTimer);
|
|
364
400
|
debounceTimer = setTimeout(async () => {
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
401
|
+
try {
|
|
402
|
+
await runLint(contextDir);
|
|
403
|
+
} catch (err) {
|
|
404
|
+
console.error(
|
|
405
|
+
chalk7.red(`Lint error: ${err.message}`)
|
|
406
|
+
);
|
|
407
|
+
}
|
|
408
|
+
}, 300);
|
|
371
409
|
});
|
|
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
410
|
} catch (err) {
|
|
381
|
-
console.error(
|
|
411
|
+
console.error(chalk7.red(`Dev mode failed: ${err.message}`));
|
|
382
412
|
process.exit(1);
|
|
383
413
|
}
|
|
384
414
|
});
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
415
|
+
|
|
416
|
+
// src/commands/init.ts
|
|
417
|
+
import { Command as Command7 } from "commander";
|
|
418
|
+
import chalk8 from "chalk";
|
|
419
|
+
import path7 from "path";
|
|
420
|
+
import fs3 from "fs";
|
|
421
|
+
var EXAMPLE_OSI = `version: "1.0"
|
|
422
|
+
|
|
423
|
+
semantic_model:
|
|
424
|
+
- name: example-model
|
|
425
|
+
description: An example semantic model
|
|
426
|
+
ai_context:
|
|
427
|
+
instructions: "Use this model for general analytics queries"
|
|
428
|
+
synonyms: ["example", "sample model"]
|
|
429
|
+
|
|
430
|
+
datasets:
|
|
431
|
+
- name: example_table
|
|
432
|
+
source: warehouse.public.example_table
|
|
433
|
+
primary_key: [id]
|
|
434
|
+
description: "Example table"
|
|
435
|
+
fields:
|
|
436
|
+
- name: id
|
|
437
|
+
expression:
|
|
438
|
+
dialects:
|
|
439
|
+
- dialect: ANSI_SQL
|
|
440
|
+
expression: id
|
|
441
|
+
description: "Primary key"
|
|
442
|
+
type: number
|
|
443
|
+
- name: name
|
|
444
|
+
expression:
|
|
445
|
+
dialects:
|
|
446
|
+
- dialect: ANSI_SQL
|
|
447
|
+
expression: name
|
|
448
|
+
description: "Name field"
|
|
449
|
+
type: string
|
|
450
|
+
`;
|
|
451
|
+
var EXAMPLE_GOVERNANCE = `model: example-model
|
|
452
|
+
owner: data-team
|
|
453
|
+
classification: internal
|
|
454
|
+
security:
|
|
455
|
+
pii: false
|
|
456
|
+
access_level: internal
|
|
457
|
+
datasets:
|
|
458
|
+
example_table:
|
|
459
|
+
grain: one row per example entity
|
|
460
|
+
fields:
|
|
461
|
+
id:
|
|
462
|
+
description: "Primary key"
|
|
463
|
+
name:
|
|
464
|
+
description: "Name field"
|
|
465
|
+
`;
|
|
466
|
+
var EXAMPLE_TERM = `glossary:
|
|
467
|
+
- term: Example Term
|
|
468
|
+
definition: A sample glossary term to demonstrate the format
|
|
469
|
+
aliases: ["sample term"]
|
|
470
|
+
owner: data-team
|
|
471
|
+
`;
|
|
472
|
+
var EXAMPLE_OWNER = `team: data-team
|
|
473
|
+
name: Data Team
|
|
474
|
+
email: data-team@example.com
|
|
475
|
+
slack: "#data-team"
|
|
476
|
+
members:
|
|
477
|
+
- name: Jane Doe
|
|
478
|
+
role: lead
|
|
479
|
+
`;
|
|
480
|
+
var EXAMPLE_CONFIG = `context_dir: context
|
|
481
|
+
output_dir: dist
|
|
482
|
+
minimum_tier: bronze
|
|
483
|
+
`;
|
|
484
|
+
var initCommand = new Command7("init").description("Scaffold a v0.2 ContextKit project structure").option("--dir <path>", "Root directory for the project", ".").action(async (opts) => {
|
|
391
485
|
try {
|
|
392
|
-
const
|
|
393
|
-
const
|
|
394
|
-
|
|
395
|
-
|
|
486
|
+
const rootDir = path7.resolve(opts.dir);
|
|
487
|
+
const contextDir = path7.join(rootDir, "context");
|
|
488
|
+
const dirs = [
|
|
489
|
+
path7.join(contextDir, "models"),
|
|
490
|
+
path7.join(contextDir, "governance"),
|
|
491
|
+
path7.join(contextDir, "glossary"),
|
|
492
|
+
path7.join(contextDir, "owners")
|
|
493
|
+
];
|
|
494
|
+
for (const dir of dirs) {
|
|
495
|
+
fs3.mkdirSync(dir, { recursive: true });
|
|
396
496
|
}
|
|
397
|
-
const
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
497
|
+
const files = [
|
|
498
|
+
{
|
|
499
|
+
path: path7.join(contextDir, "models", "example-model.osi.yaml"),
|
|
500
|
+
content: EXAMPLE_OSI
|
|
501
|
+
},
|
|
502
|
+
{
|
|
503
|
+
path: path7.join(
|
|
504
|
+
contextDir,
|
|
505
|
+
"governance",
|
|
506
|
+
"example-model.governance.yaml"
|
|
507
|
+
),
|
|
508
|
+
content: EXAMPLE_GOVERNANCE
|
|
509
|
+
},
|
|
510
|
+
{
|
|
511
|
+
path: path7.join(contextDir, "glossary", "glossary.term.yaml"),
|
|
512
|
+
content: EXAMPLE_TERM
|
|
513
|
+
},
|
|
514
|
+
{
|
|
515
|
+
path: path7.join(contextDir, "owners", "data-team.owner.yaml"),
|
|
516
|
+
content: EXAMPLE_OWNER
|
|
517
|
+
},
|
|
518
|
+
{
|
|
519
|
+
path: path7.join(rootDir, "contextkit.config.yaml"),
|
|
520
|
+
content: EXAMPLE_CONFIG
|
|
521
|
+
}
|
|
522
|
+
];
|
|
523
|
+
let created = 0;
|
|
524
|
+
let skipped = 0;
|
|
525
|
+
for (const file of files) {
|
|
526
|
+
if (fs3.existsSync(file.path)) {
|
|
527
|
+
console.log(chalk8.gray(` skip ${path7.relative(rootDir, file.path)} (exists)`));
|
|
528
|
+
skipped++;
|
|
529
|
+
} else {
|
|
530
|
+
fs3.writeFileSync(file.path, file.content, "utf-8");
|
|
531
|
+
console.log(chalk8.green(` create ${path7.relative(rootDir, file.path)}`));
|
|
532
|
+
created++;
|
|
533
|
+
}
|
|
413
534
|
}
|
|
414
535
|
console.log("");
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
console.log(parts.join(", ") + "\n");
|
|
536
|
+
console.log(
|
|
537
|
+
formatSuccess(
|
|
538
|
+
`Initialized ContextKit project: ${created} file(s) created, ${skipped} skipped.`
|
|
539
|
+
)
|
|
540
|
+
);
|
|
541
|
+
console.log("");
|
|
542
|
+
console.log(chalk8.gray("Next steps:"));
|
|
543
|
+
console.log(chalk8.gray(" 1. Edit the example files in context/"));
|
|
544
|
+
console.log(chalk8.gray(" 2. Run: context lint"));
|
|
545
|
+
console.log(chalk8.gray(" 3. Run: context build"));
|
|
426
546
|
} catch (err) {
|
|
427
|
-
console.error(
|
|
428
|
-
|
|
547
|
+
console.error(formatError(err.message));
|
|
548
|
+
process.exit(1);
|
|
429
549
|
}
|
|
430
|
-
}
|
|
550
|
+
});
|
|
431
551
|
|
|
432
552
|
// src/commands/site.ts
|
|
433
|
-
import {
|
|
434
|
-
import
|
|
435
|
-
import
|
|
436
|
-
import {
|
|
437
|
-
var siteCommand = new
|
|
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;
|
|
553
|
+
import { Command as Command8 } from "commander";
|
|
554
|
+
import chalk9 from "chalk";
|
|
555
|
+
import path8 from "path";
|
|
556
|
+
import { compile as compile7, loadConfig as loadConfig7, emitManifest as emitManifest2 } from "@runcontext/core";
|
|
557
|
+
var siteCommand = new Command8("site").description("Build a static documentation site from compiled context").option("--context-dir <path>", "Path to context directory").option("--output-dir <path>", "Path to site output directory").action(async (opts) => {
|
|
450
558
|
try {
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
559
|
+
const config = loadConfig7(process.cwd());
|
|
560
|
+
const contextDir = opts.contextDir ? path8.resolve(opts.contextDir) : path8.resolve(config.context_dir);
|
|
561
|
+
const { graph } = await compile7({ contextDir, config });
|
|
562
|
+
const manifest = emitManifest2(graph, config);
|
|
563
|
+
let buildSite;
|
|
564
|
+
try {
|
|
565
|
+
const siteModule = await import("@runcontext/site");
|
|
566
|
+
buildSite = siteModule.buildSite;
|
|
567
|
+
} catch {
|
|
568
|
+
}
|
|
569
|
+
if (!buildSite) {
|
|
570
|
+
console.log(
|
|
571
|
+
chalk9.yellow(
|
|
572
|
+
"Site generator is not yet available. Install @runcontext/site to enable this command."
|
|
573
|
+
)
|
|
574
|
+
);
|
|
575
|
+
process.exit(0);
|
|
576
|
+
}
|
|
577
|
+
const outputDir = opts.outputDir ? path8.resolve(opts.outputDir) : path8.resolve(config.site?.base_path ?? "site");
|
|
578
|
+
await buildSite(manifest, config, outputDir);
|
|
579
|
+
console.log(chalk9.green(`Site built to ${outputDir}`));
|
|
580
|
+
} catch (err) {
|
|
581
|
+
console.error(formatError(err.message));
|
|
582
|
+
process.exit(1);
|
|
456
583
|
}
|
|
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
584
|
});
|
|
467
585
|
|
|
468
586
|
// src/commands/serve.ts
|
|
469
|
-
import { Command as
|
|
470
|
-
import
|
|
471
|
-
|
|
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) => {
|
|
587
|
+
import { Command as Command9 } from "commander";
|
|
588
|
+
import chalk10 from "chalk";
|
|
589
|
+
var serveCommand = new Command9("serve").description("Start the MCP server (stdio transport)").option("--context-dir <path>", "Path to context directory").action(async (opts) => {
|
|
473
590
|
try {
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
591
|
+
let startServer;
|
|
592
|
+
try {
|
|
593
|
+
const mcpModule = await import("@runcontext/mcp");
|
|
594
|
+
startServer = mcpModule.startServer;
|
|
595
|
+
} catch {
|
|
596
|
+
}
|
|
597
|
+
if (!startServer) {
|
|
598
|
+
console.log(
|
|
599
|
+
chalk10.yellow(
|
|
600
|
+
"MCP server is not available. Install @runcontext/mcp to enable this command."
|
|
601
|
+
)
|
|
602
|
+
);
|
|
478
603
|
process.exit(1);
|
|
479
604
|
}
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
605
|
+
console.log(chalk10.blue("Starting MCP server (stdio transport)..."));
|
|
606
|
+
await startServer({
|
|
607
|
+
contextDir: opts.contextDir,
|
|
608
|
+
rootDir: process.cwd()
|
|
609
|
+
});
|
|
610
|
+
} catch (err) {
|
|
611
|
+
console.error(formatError(err.message));
|
|
612
|
+
process.exit(1);
|
|
613
|
+
}
|
|
614
|
+
});
|
|
615
|
+
|
|
616
|
+
// src/commands/validate-osi.ts
|
|
617
|
+
import { Command as Command10 } from "commander";
|
|
618
|
+
import chalk11 from "chalk";
|
|
619
|
+
import path9 from "path";
|
|
620
|
+
import { parseFile, osiDocumentSchema } from "@runcontext/core";
|
|
621
|
+
var validateOsiCommand = new Command10("validate-osi").description("Validate a single OSI file against the schema").argument("<file>", "Path to the OSI YAML file").option("--format <type>", "Output format: pretty or json", "pretty").action(async (file, opts) => {
|
|
622
|
+
try {
|
|
623
|
+
const filePath = path9.resolve(file);
|
|
624
|
+
const parsed = await parseFile(filePath, "model");
|
|
625
|
+
const result = osiDocumentSchema.safeParse(parsed.data);
|
|
626
|
+
if (result.success) {
|
|
627
|
+
if (opts.format === "json") {
|
|
628
|
+
console.log(
|
|
629
|
+
formatJson({
|
|
630
|
+
valid: true,
|
|
631
|
+
file: filePath,
|
|
632
|
+
data: result.data
|
|
633
|
+
})
|
|
634
|
+
);
|
|
635
|
+
} else {
|
|
636
|
+
console.log(formatSuccess(`${filePath} is valid.`));
|
|
637
|
+
}
|
|
499
638
|
} else {
|
|
500
|
-
const
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
639
|
+
const issues = result.error.issues.map((issue) => ({
|
|
640
|
+
path: issue.path.join("."),
|
|
641
|
+
message: issue.message
|
|
642
|
+
}));
|
|
643
|
+
if (opts.format === "json") {
|
|
644
|
+
console.log(
|
|
645
|
+
formatJson({
|
|
646
|
+
valid: false,
|
|
647
|
+
file: filePath,
|
|
648
|
+
issues
|
|
649
|
+
})
|
|
650
|
+
);
|
|
651
|
+
} else {
|
|
652
|
+
console.error(chalk11.red(`Validation failed for ${filePath}:`));
|
|
653
|
+
for (const issue of issues) {
|
|
654
|
+
console.error(chalk11.red(` ${issue.path}: ${issue.message}`));
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
process.exit(1);
|
|
504
658
|
}
|
|
505
659
|
} catch (err) {
|
|
506
|
-
console.error(
|
|
660
|
+
console.error(formatError(err.message));
|
|
507
661
|
process.exit(1);
|
|
508
662
|
}
|
|
509
663
|
});
|
|
510
664
|
|
|
511
665
|
// src/index.ts
|
|
512
|
-
var program = new
|
|
513
|
-
program.name("context").
|
|
514
|
-
program.addCommand(buildCommand);
|
|
666
|
+
var program = new Command11();
|
|
667
|
+
program.name("context").description("ContextKit \u2014 AI-ready metadata governance over OSI").version("0.2.0");
|
|
515
668
|
program.addCommand(lintCommand);
|
|
516
|
-
program.addCommand(
|
|
669
|
+
program.addCommand(buildCommand);
|
|
670
|
+
program.addCommand(tierCommand);
|
|
517
671
|
program.addCommand(explainCommand);
|
|
518
672
|
program.addCommand(fixCommand);
|
|
519
673
|
program.addCommand(devCommand);
|
|
674
|
+
program.addCommand(initCommand);
|
|
520
675
|
program.addCommand(siteCommand);
|
|
521
676
|
program.addCommand(serveCommand);
|
|
522
|
-
|
|
677
|
+
program.addCommand(validateOsiCommand);
|
|
678
|
+
program.parse();
|
|
523
679
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +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,GA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,YAAY;AAE/B,MAAM,QAAQ,WAAW,QAAQ,IAAI;","names":["Command","Command","path","loadConfig","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"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/commands/lint.ts","../src/formatters/pretty.ts","../src/formatters/json.ts","../src/commands/build.ts","../src/commands/tier.ts","../src/commands/explain.ts","../src/commands/fix.ts","../src/commands/dev.ts","../src/commands/init.ts","../src/commands/site.ts","../src/commands/serve.ts","../src/commands/validate-osi.ts"],"sourcesContent":["// ContextKit CLI v0.2\n\nimport { Command } from 'commander';\nimport { lintCommand } from './commands/lint.js';\nimport { buildCommand } from './commands/build.js';\nimport { tierCommand } from './commands/tier.js';\nimport { explainCommand } from './commands/explain.js';\nimport { fixCommand } from './commands/fix.js';\nimport { devCommand } from './commands/dev.js';\nimport { initCommand } from './commands/init.js';\nimport { siteCommand } from './commands/site.js';\nimport { serveCommand } from './commands/serve.js';\nimport { validateOsiCommand } from './commands/validate-osi.js';\n\nconst program = new Command();\n\nprogram\n .name('context')\n .description('ContextKit — AI-ready metadata governance over OSI')\n .version('0.2.0');\n\n// Register all commands\nprogram.addCommand(lintCommand);\nprogram.addCommand(buildCommand);\nprogram.addCommand(tierCommand);\nprogram.addCommand(explainCommand);\nprogram.addCommand(fixCommand);\nprogram.addCommand(devCommand);\nprogram.addCommand(initCommand);\nprogram.addCommand(siteCommand);\nprogram.addCommand(serveCommand);\nprogram.addCommand(validateOsiCommand);\n\nprogram.parse();\n","import { Command } from 'commander';\nimport chalk from 'chalk';\nimport path from 'node:path';\nimport {\n compile,\n loadConfig,\n LintEngine,\n ALL_RULES,\n type Diagnostic,\n type Severity,\n type MetadataTier,\n} from '@runcontext/core';\nimport { formatDiagnostics } from '../formatters/pretty.js';\nimport { formatJson } from '../formatters/json.js';\n\nexport const lintCommand = new Command('lint')\n .description('Run all lint rules against context files')\n .option('--context-dir <path>', 'Path to context directory')\n .option('--format <type>', 'Output format: pretty or json', 'pretty')\n .action(async (opts) => {\n try {\n const config = loadConfig(process.cwd());\n const contextDir = opts.contextDir\n ? path.resolve(opts.contextDir)\n : path.resolve(config.context_dir);\n\n // Compile the context graph\n const { graph, diagnostics: compileDiags } = await compile({\n contextDir,\n config,\n });\n\n // Run lint engine\n const overrides = config.lint?.severity_overrides as\n | Record<string, Severity | 'off'>\n | undefined;\n const engine = new LintEngine(overrides);\n for (const rule of ALL_RULES) {\n engine.register(rule);\n }\n const lintDiags = engine.run(graph);\n\n // Merge compile diagnostics with lint diagnostics\n const allDiags: Diagnostic[] = [...compileDiags, ...lintDiags];\n\n // Enforce minimum_tier policy\n if (config.minimum_tier) {\n const tierOrder: MetadataTier[] = ['none', 'bronze', 'silver', 'gold'];\n const minIdx = tierOrder.indexOf(config.minimum_tier);\n for (const [modelName, score] of graph.tiers) {\n const actualIdx = tierOrder.indexOf(score.tier);\n if (actualIdx < minIdx) {\n allDiags.push({\n ruleId: 'tier/minimum-tier',\n severity: 'error',\n message: `Model \"${modelName}\" is tier \"${score.tier}\" but minimum_tier is \"${config.minimum_tier}\"`,\n location: { file: `model:${modelName}`, line: 1, column: 1 },\n fixable: false,\n });\n }\n }\n }\n\n // Output results\n if (opts.format === 'json') {\n console.log(formatJson(allDiags));\n } else {\n console.log(formatDiagnostics(allDiags));\n }\n\n // Exit with code 1 if there are errors\n const hasErrors = allDiags.some((d) => d.severity === 'error');\n if (hasErrors) {\n process.exit(1);\n }\n } catch (err) {\n console.error(chalk.red(`Lint failed: ${(err as Error).message}`));\n process.exit(1);\n }\n });\n","import chalk from 'chalk';\nimport type { Diagnostic, TierScore, TierCheckResult } from '@runcontext/core';\n\n/**\n * Format an array of diagnostics as colorized, human-readable text.\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\n for (const d of diagnostics) {\n const icon =\n d.severity === 'error' ? chalk.red('error') : chalk.yellow('warning');\n const loc = chalk.gray(\n `${d.location.file}:${d.location.line}:${d.location.column}`,\n );\n const rule = chalk.gray(`[${d.ruleId}]`);\n const fixTag = d.fixable ? chalk.blue(' (fixable)') : '';\n\n lines.push(` ${icon} ${d.message} ${rule}${fixTag}`);\n lines.push(` ${loc}`);\n }\n\n const errorCount = diagnostics.filter((d) => d.severity === 'error').length;\n const warnCount = diagnostics.filter((d) => d.severity === 'warning').length;\n\n lines.push('');\n const parts: string[] = [];\n if (errorCount > 0) parts.push(chalk.red(`${errorCount} error(s)`));\n if (warnCount > 0) parts.push(chalk.yellow(`${warnCount} warning(s)`));\n lines.push(parts.join(', '));\n\n return lines.join('\\n');\n}\n\n/**\n * Format a tier score as colorized, human-readable text.\n */\nexport function formatTierScore(score: TierScore): string {\n const lines: string[] = [];\n\n const tierColor = getTierColor(score.tier);\n lines.push(\n `${chalk.bold(score.model)}: ${tierColor(score.tier.toUpperCase())}`,\n );\n lines.push('');\n\n lines.push(formatTierSection('Bronze', score.bronze.passed, score.bronze.checks));\n lines.push(formatTierSection('Silver', score.silver.passed, score.silver.checks));\n lines.push(formatTierSection('Gold', score.gold.passed, score.gold.checks));\n\n return lines.join('\\n');\n}\n\nfunction formatTierSection(\n label: string,\n passed: boolean,\n checks: TierCheckResult[],\n): string {\n const lines: string[] = [];\n const status = passed ? chalk.green('PASS') : chalk.red('FAIL');\n lines.push(` ${label}: ${status}`);\n\n for (const check of checks) {\n const icon = check.passed ? chalk.green(' +') : chalk.red(' -');\n lines.push(` ${icon} ${check.label}`);\n if (check.detail && !check.passed) {\n lines.push(chalk.gray(` ${check.detail}`));\n }\n }\n\n return lines.join('\\n');\n}\n\nfunction getTierColor(tier: string): (text: string) => string {\n switch (tier) {\n case 'gold':\n return chalk.yellow;\n case 'silver':\n return chalk.white;\n case 'bronze':\n return chalk.hex('#CD7F32');\n default:\n return chalk.gray;\n }\n}\n\n/**\n * Format a generic info message.\n */\nexport function formatInfo(message: string): string {\n return chalk.blue(message);\n}\n\n/**\n * Format an error message.\n */\nexport function formatError(message: string): string {\n return chalk.red(`Error: ${message}`);\n}\n\n/**\n * Format a success message.\n */\nexport function formatSuccess(message: string): string {\n return chalk.green(message);\n}\n","/**\n * Format any value as pretty-printed JSON.\n */\nexport function formatJson(data: unknown): string {\n return JSON.stringify(data, null, 2);\n}\n","import { Command } from 'commander';\nimport chalk from 'chalk';\nimport path from 'node:path';\nimport fs from 'node:fs';\nimport { compile, loadConfig, emitManifest } from '@runcontext/core';\nimport { formatJson } from '../formatters/json.js';\nimport { formatSuccess, formatError } from '../formatters/pretty.js';\n\nexport const buildCommand = new Command('build')\n .description('Compile context files and emit manifest JSON')\n .option('--context-dir <path>', 'Path to context directory')\n .option('--output-dir <path>', 'Path to output directory')\n .option('--format <type>', 'Output format: pretty or json', 'pretty')\n .action(async (opts) => {\n try {\n const config = loadConfig(process.cwd());\n const contextDir = opts.contextDir\n ? path.resolve(opts.contextDir)\n : path.resolve(config.context_dir);\n const outputDir = opts.outputDir\n ? path.resolve(opts.outputDir)\n : path.resolve(config.output_dir);\n\n // Compile the context graph\n const { graph, diagnostics } = await compile({ contextDir, config });\n\n // Check for compile errors\n const errors = diagnostics.filter((d) => d.severity === 'error');\n if (errors.length > 0) {\n if (opts.format === 'json') {\n console.log(formatJson({ success: false, errors }));\n } else {\n console.error(\n chalk.red(`Build failed with ${errors.length} error(s):`),\n );\n for (const e of errors) {\n console.error(chalk.red(` - ${e.message} [${e.ruleId}]`));\n }\n }\n process.exit(1);\n }\n\n // Emit manifest\n const manifest = emitManifest(graph, config);\n\n // Write to output directory\n fs.mkdirSync(outputDir, { recursive: true });\n const outputPath = path.join(outputDir, 'contextkit-manifest.json');\n fs.writeFileSync(outputPath, JSON.stringify(manifest, null, 2), 'utf-8');\n\n if (opts.format === 'json') {\n console.log(formatJson({ success: true, outputPath, manifest }));\n } else {\n console.log(formatSuccess(`Manifest written to ${outputPath}`));\n }\n } catch (err) {\n console.error(formatError((err as Error).message));\n process.exit(1);\n }\n });\n","import { Command } from 'commander';\nimport chalk from 'chalk';\nimport path from 'node:path';\nimport { compile, loadConfig, computeTier, type TierScore } from '@runcontext/core';\nimport { formatTierScore, formatError } from '../formatters/pretty.js';\nimport { formatJson } from '../formatters/json.js';\n\nexport const tierCommand = new Command('tier')\n .description('Show tier scorecard for one or all models')\n .argument('[model-name]', 'Specific model name to check')\n .option('--context-dir <path>', 'Path to context directory')\n .option('--format <type>', 'Output format: pretty or json', 'pretty')\n .action(async (modelName: string | undefined, opts) => {\n try {\n const config = loadConfig(process.cwd());\n const contextDir = opts.contextDir\n ? path.resolve(opts.contextDir)\n : path.resolve(config.context_dir);\n\n const { graph } = await compile({ contextDir, config });\n\n let scores: TierScore[];\n\n if (modelName) {\n // Single model\n if (!graph.models.has(modelName)) {\n console.error(formatError(`Model '${modelName}' not found.`));\n const available = [...graph.models.keys()].join(', ');\n if (available) {\n console.error(chalk.gray(`Available models: ${available}`));\n }\n process.exit(1);\n }\n scores = [computeTier(modelName, graph)];\n } else {\n // All models\n scores = [...graph.models.keys()].map((name) =>\n computeTier(name, graph),\n );\n }\n\n if (scores.length === 0) {\n console.log(\n opts.format === 'json'\n ? formatJson([])\n : chalk.yellow('No models found.'),\n );\n return;\n }\n\n if (opts.format === 'json') {\n console.log(formatJson(scores));\n } else {\n for (const score of scores) {\n console.log(formatTierScore(score));\n console.log('');\n }\n }\n } catch (err) {\n console.error(formatError((err as Error).message));\n process.exit(1);\n }\n });\n","import { Command } from 'commander';\nimport chalk from 'chalk';\nimport path from 'node:path';\nimport { compile, loadConfig } from '@runcontext/core';\nimport { formatJson } from '../formatters/json.js';\nimport { formatError } from '../formatters/pretty.js';\n\nexport const explainCommand = new Command('explain')\n .description('Look up models, terms, or owners by name and show details')\n .argument('<name>', 'Name of a model, term, or owner to look up')\n .option('--context-dir <path>', 'Path to context directory')\n .option('--format <type>', 'Output format: pretty or json', 'pretty')\n .action(async (name: string, opts) => {\n try {\n const config = loadConfig(process.cwd());\n const contextDir = opts.contextDir\n ? path.resolve(opts.contextDir)\n : path.resolve(config.context_dir);\n\n const { graph } = await compile({ contextDir, config });\n\n const results: Array<{ type: string; name: string; data: unknown }> = [];\n\n // Search models\n if (graph.models.has(name)) {\n results.push({ type: 'model', name, data: graph.models.get(name) });\n }\n\n // Search terms\n if (graph.terms.has(name)) {\n results.push({ type: 'term', name, data: graph.terms.get(name) });\n }\n\n // Search owners\n if (graph.owners.has(name)) {\n results.push({ type: 'owner', name, data: graph.owners.get(name) });\n }\n\n // Search governance\n if (graph.governance.has(name)) {\n results.push({\n type: 'governance',\n name,\n data: graph.governance.get(name),\n });\n }\n\n // Search rules\n if (graph.rules.has(name)) {\n results.push({ type: 'rules', name, data: graph.rules.get(name) });\n }\n\n // Search lineage\n if (graph.lineage.has(name)) {\n results.push({ type: 'lineage', name, data: graph.lineage.get(name) });\n }\n\n if (results.length === 0) {\n console.error(formatError(`No matching entity found for '${name}'.`));\n process.exit(1);\n }\n\n if (opts.format === 'json') {\n console.log(formatJson(results));\n } else {\n for (const result of results) {\n console.log(chalk.bold(`${result.type}: ${result.name}`));\n console.log(chalk.gray('---'));\n console.log(JSON.stringify(result.data, null, 2));\n console.log('');\n }\n }\n } catch (err) {\n console.error(formatError((err as Error).message));\n process.exit(1);\n }\n });\n","import { Command } from 'commander';\nimport chalk from 'chalk';\nimport path from 'node:path';\nimport fs from 'node:fs';\nimport {\n compile,\n loadConfig,\n LintEngine,\n ALL_RULES,\n applyFixes,\n type Severity,\n} from '@runcontext/core';\nimport { formatSuccess, formatError } from '../formatters/pretty.js';\nimport { formatJson } from '../formatters/json.js';\n\nexport const fixCommand = new Command('fix')\n .description('Auto-fix lint issues')\n .option('--context-dir <path>', 'Path to context directory')\n .option('--format <type>', 'Output format: pretty or json', 'pretty')\n .option('--dry-run', 'Show what would be fixed without writing files')\n .action(async (opts) => {\n try {\n const config = loadConfig(process.cwd());\n const contextDir = opts.contextDir\n ? path.resolve(opts.contextDir)\n : path.resolve(config.context_dir);\n\n // Compile and lint\n const { graph } = await compile({ contextDir, config });\n\n const overrides = config.lint?.severity_overrides as\n | Record<string, Severity | 'off'>\n | undefined;\n const engine = new LintEngine(overrides);\n for (const rule of ALL_RULES) {\n engine.register(rule);\n }\n const diagnostics = engine.run(graph);\n\n const fixable = diagnostics.filter((d) => d.fixable);\n\n if (fixable.length === 0) {\n if (opts.format === 'json') {\n console.log(formatJson({ fixedFiles: [], fixCount: 0 }));\n } else {\n console.log(chalk.green('No fixable issues found.'));\n }\n return;\n }\n\n // Apply fixes\n const readFile = (filePath: string) =>\n fs.readFileSync(filePath, 'utf-8');\n const fixedFiles = applyFixes(fixable, readFile);\n\n if (opts.dryRun) {\n if (opts.format === 'json') {\n const entries = [...fixedFiles.entries()].map(([file, content]) => ({\n file,\n content,\n }));\n console.log(\n formatJson({ dryRun: true, fixCount: fixable.length, entries }),\n );\n } else {\n console.log(\n chalk.yellow(`Dry run: ${fixable.length} issue(s) would be fixed in ${fixedFiles.size} file(s):`),\n );\n for (const file of fixedFiles.keys()) {\n console.log(chalk.gray(` ${file}`));\n }\n }\n return;\n }\n\n // Write fixed files\n for (const [file, content] of fixedFiles) {\n fs.writeFileSync(file, content, 'utf-8');\n }\n\n if (opts.format === 'json') {\n console.log(\n formatJson({\n fixedFiles: [...fixedFiles.keys()],\n fixCount: fixable.length,\n }),\n );\n } else {\n console.log(\n formatSuccess(\n `Fixed ${fixable.length} issue(s) in ${fixedFiles.size} file(s).`,\n ),\n );\n }\n } catch (err) {\n console.error(formatError((err as Error).message));\n process.exit(1);\n }\n });\n","import { Command } from 'commander';\nimport chalk from 'chalk';\nimport path from 'node:path';\nimport {\n compile,\n loadConfig,\n LintEngine,\n ALL_RULES,\n type Severity,\n} from '@runcontext/core';\nimport { formatDiagnostics } from '../formatters/pretty.js';\n\nasync function runLint(contextDir: string): Promise<void> {\n const config = loadConfig(process.cwd());\n\n const { graph, diagnostics: compileDiags } = await compile({\n contextDir,\n config,\n });\n\n const overrides = config.lint?.severity_overrides as\n | Record<string, Severity | 'off'>\n | undefined;\n const engine = new LintEngine(overrides);\n for (const rule of ALL_RULES) {\n engine.register(rule);\n }\n const lintDiags = engine.run(graph);\n const allDiags = [...compileDiags, ...lintDiags];\n\n console.clear();\n console.log(chalk.gray(`[${new Date().toLocaleTimeString()}] Linting...`));\n console.log(formatDiagnostics(allDiags));\n console.log('');\n}\n\nexport const devCommand = new Command('dev')\n .description('Watch mode — re-run lint on file changes')\n .option('--context-dir <path>', 'Path to context directory')\n .action(async (opts) => {\n try {\n const config = loadConfig(process.cwd());\n const contextDir = opts.contextDir\n ? path.resolve(opts.contextDir)\n : path.resolve(config.context_dir);\n\n console.log(chalk.blue(`Watching ${contextDir} for changes...`));\n console.log(chalk.gray('Press Ctrl+C to stop.\\n'));\n\n // Initial lint run\n await runLint(contextDir);\n\n // Dynamic import of chokidar for watch mode\n const { watch } = await import('chokidar');\n\n let debounceTimer: ReturnType<typeof setTimeout> | null = null;\n\n const watcher = watch(contextDir, {\n ignored: /(^|[/\\\\])\\../, // ignore dotfiles\n persistent: true,\n ignoreInitial: true,\n });\n\n watcher.on('all', (_event, _filePath) => {\n if (debounceTimer) clearTimeout(debounceTimer);\n debounceTimer = setTimeout(async () => {\n try {\n await runLint(contextDir);\n } catch (err) {\n console.error(\n chalk.red(`Lint error: ${(err as Error).message}`),\n );\n }\n }, 300);\n });\n } catch (err) {\n console.error(chalk.red(`Dev mode failed: ${(err as Error).message}`));\n process.exit(1);\n }\n });\n","import { Command } from 'commander';\nimport chalk from 'chalk';\nimport path from 'node:path';\nimport fs from 'node:fs';\nimport { formatSuccess, formatError } from '../formatters/pretty.js';\n\nconst EXAMPLE_OSI = `version: \"1.0\"\n\nsemantic_model:\n - name: example-model\n description: An example semantic model\n ai_context:\n instructions: \"Use this model for general analytics queries\"\n synonyms: [\"example\", \"sample model\"]\n\n datasets:\n - name: example_table\n source: warehouse.public.example_table\n primary_key: [id]\n description: \"Example table\"\n fields:\n - name: id\n expression:\n dialects:\n - dialect: ANSI_SQL\n expression: id\n description: \"Primary key\"\n type: number\n - name: name\n expression:\n dialects:\n - dialect: ANSI_SQL\n expression: name\n description: \"Name field\"\n type: string\n`;\n\nconst EXAMPLE_GOVERNANCE = `model: example-model\nowner: data-team\nclassification: internal\nsecurity:\n pii: false\n access_level: internal\ndatasets:\n example_table:\n grain: one row per example entity\n fields:\n id:\n description: \"Primary key\"\n name:\n description: \"Name field\"\n`;\n\nconst EXAMPLE_TERM = `glossary:\n - term: Example Term\n definition: A sample glossary term to demonstrate the format\n aliases: [\"sample term\"]\n owner: data-team\n`;\n\nconst EXAMPLE_OWNER = `team: data-team\nname: Data Team\nemail: data-team@example.com\nslack: \"#data-team\"\nmembers:\n - name: Jane Doe\n role: lead\n`;\n\nconst EXAMPLE_CONFIG = `context_dir: context\noutput_dir: dist\nminimum_tier: bronze\n`;\n\nexport const initCommand = new Command('init')\n .description('Scaffold a v0.2 ContextKit project structure')\n .option('--dir <path>', 'Root directory for the project', '.')\n .action(async (opts) => {\n try {\n const rootDir = path.resolve(opts.dir);\n const contextDir = path.join(rootDir, 'context');\n\n // Create directory structure\n const dirs = [\n path.join(contextDir, 'models'),\n path.join(contextDir, 'governance'),\n path.join(contextDir, 'glossary'),\n path.join(contextDir, 'owners'),\n ];\n\n for (const dir of dirs) {\n fs.mkdirSync(dir, { recursive: true });\n }\n\n // Write example files (only if they don't already exist)\n const files: Array<{ path: string; content: string }> = [\n {\n path: path.join(contextDir, 'models', 'example-model.osi.yaml'),\n content: EXAMPLE_OSI,\n },\n {\n path: path.join(\n contextDir,\n 'governance',\n 'example-model.governance.yaml',\n ),\n content: EXAMPLE_GOVERNANCE,\n },\n {\n path: path.join(contextDir, 'glossary', 'glossary.term.yaml'),\n content: EXAMPLE_TERM,\n },\n {\n path: path.join(contextDir, 'owners', 'data-team.owner.yaml'),\n content: EXAMPLE_OWNER,\n },\n {\n path: path.join(rootDir, 'contextkit.config.yaml'),\n content: EXAMPLE_CONFIG,\n },\n ];\n\n let created = 0;\n let skipped = 0;\n\n for (const file of files) {\n if (fs.existsSync(file.path)) {\n console.log(chalk.gray(` skip ${path.relative(rootDir, file.path)} (exists)`));\n skipped++;\n } else {\n fs.writeFileSync(file.path, file.content, 'utf-8');\n console.log(chalk.green(` create ${path.relative(rootDir, file.path)}`));\n created++;\n }\n }\n\n console.log('');\n console.log(\n formatSuccess(\n `Initialized ContextKit project: ${created} file(s) created, ${skipped} skipped.`,\n ),\n );\n console.log('');\n console.log(chalk.gray('Next steps:'));\n console.log(chalk.gray(' 1. Edit the example files in context/'));\n console.log(chalk.gray(' 2. Run: context lint'));\n console.log(chalk.gray(' 3. Run: context build'));\n } catch (err) {\n console.error(formatError((err as Error).message));\n process.exit(1);\n }\n });\n","import { Command } from 'commander';\nimport chalk from 'chalk';\nimport path from 'node:path';\nimport { compile, loadConfig, emitManifest } from '@runcontext/core';\nimport { formatError } from '../formatters/pretty.js';\n\nexport const siteCommand = new Command('site')\n .description('Build a static documentation site from compiled context')\n .option('--context-dir <path>', 'Path to context directory')\n .option('--output-dir <path>', 'Path to site output directory')\n .action(async (opts) => {\n try {\n const config = loadConfig(process.cwd());\n const contextDir = opts.contextDir\n ? path.resolve(opts.contextDir)\n : path.resolve(config.context_dir);\n\n // Compile the context graph\n const { graph } = await compile({ contextDir, config });\n const manifest = emitManifest(graph, config);\n\n // Try to import the site generator\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- dynamic import\n let buildSite: ((...args: any[]) => Promise<void>) | undefined;\n try {\n const siteModule = await import('@runcontext/site');\n buildSite = siteModule.buildSite;\n } catch {\n // @runcontext/site not yet implemented\n }\n\n if (!buildSite) {\n console.log(\n chalk.yellow(\n 'Site generator is not yet available. Install @runcontext/site to enable this command.',\n ),\n );\n process.exit(0);\n }\n\n const outputDir = opts.outputDir\n ? path.resolve(opts.outputDir)\n : path.resolve(config.site?.base_path ?? 'site');\n\n await buildSite(manifest, config, outputDir);\n console.log(chalk.green(`Site built to ${outputDir}`));\n } catch (err) {\n console.error(formatError((err as Error).message));\n process.exit(1);\n }\n });\n","import { Command } from 'commander';\nimport chalk from 'chalk';\nimport { formatError } from '../formatters/pretty.js';\n\nexport const serveCommand = new Command('serve')\n .description('Start the MCP server (stdio transport)')\n .option('--context-dir <path>', 'Path to context directory')\n .action(async (opts) => {\n try {\n // Dynamic import — @runcontext/mcp is an optional peer\n let startServer: ((options?: { contextDir?: string; rootDir?: string }) => Promise<unknown>) | undefined;\n try {\n const mcpModule = await import('@runcontext/mcp');\n startServer = mcpModule.startServer;\n } catch {\n // @runcontext/mcp not installed\n }\n\n if (!startServer) {\n console.log(\n chalk.yellow(\n 'MCP server is not available. Install @runcontext/mcp to enable this command.',\n ),\n );\n process.exit(1);\n }\n\n console.log(chalk.blue('Starting MCP server (stdio transport)...'));\n await startServer({\n contextDir: opts.contextDir,\n rootDir: process.cwd(),\n });\n } catch (err) {\n console.error(formatError((err as Error).message));\n process.exit(1);\n }\n });\n","import { Command } from 'commander';\nimport chalk from 'chalk';\nimport path from 'node:path';\nimport { parseFile, osiDocumentSchema } from '@runcontext/core';\nimport { formatJson } from '../formatters/json.js';\nimport { formatError, formatSuccess } from '../formatters/pretty.js';\n\nexport const validateOsiCommand = new Command('validate-osi')\n .description('Validate a single OSI file against the schema')\n .argument('<file>', 'Path to the OSI YAML file')\n .option('--format <type>', 'Output format: pretty or json', 'pretty')\n .action(async (file: string, opts) => {\n try {\n const filePath = path.resolve(file);\n\n // Parse the file\n const parsed = await parseFile(filePath, 'model');\n\n // Validate against the schema\n const result = osiDocumentSchema.safeParse(parsed.data);\n\n if (result.success) {\n if (opts.format === 'json') {\n console.log(\n formatJson({\n valid: true,\n file: filePath,\n data: result.data,\n }),\n );\n } else {\n console.log(formatSuccess(`${filePath} is valid.`));\n }\n } else {\n const issues = result.error.issues.map((issue) => ({\n path: issue.path.join('.'),\n message: issue.message,\n }));\n\n if (opts.format === 'json') {\n console.log(\n formatJson({\n valid: false,\n file: filePath,\n issues,\n }),\n );\n } else {\n console.error(chalk.red(`Validation failed for ${filePath}:`));\n for (const issue of issues) {\n console.error(chalk.red(` ${issue.path}: ${issue.message}`));\n }\n }\n process.exit(1);\n }\n } catch (err) {\n console.error(formatError((err as Error).message));\n process.exit(1);\n }\n });\n"],"mappings":";;;AAEA,SAAS,WAAAA,iBAAe;;;ACFxB,SAAS,eAAe;AACxB,OAAOC,YAAW;AAClB,OAAO,UAAU;AACjB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;;;ACXP,OAAO,WAAW;AAMX,SAAS,kBAAkB,aAAmC;AACnE,MAAI,YAAY,WAAW,GAAG;AAC5B,WAAO,MAAM,MAAM,kBAAkB;AAAA,EACvC;AAEA,QAAM,QAAkB,CAAC;AAEzB,aAAW,KAAK,aAAa;AAC3B,UAAM,OACJ,EAAE,aAAa,UAAU,MAAM,IAAI,OAAO,IAAI,MAAM,OAAO,SAAS;AACtE,UAAM,MAAM,MAAM;AAAA,MAChB,GAAG,EAAE,SAAS,IAAI,IAAI,EAAE,SAAS,IAAI,IAAI,EAAE,SAAS,MAAM;AAAA,IAC5D;AACA,UAAM,OAAO,MAAM,KAAK,IAAI,EAAE,MAAM,GAAG;AACvC,UAAM,SAAS,EAAE,UAAU,MAAM,KAAK,YAAY,IAAI;AAEtD,UAAM,KAAK,KAAK,IAAI,IAAI,EAAE,OAAO,IAAI,IAAI,GAAG,MAAM,EAAE;AACpD,UAAM,KAAK,OAAO,GAAG,EAAE;AAAA,EACzB;AAEA,QAAM,aAAa,YAAY,OAAO,CAAC,MAAM,EAAE,aAAa,OAAO,EAAE;AACrE,QAAM,YAAY,YAAY,OAAO,CAAC,MAAM,EAAE,aAAa,SAAS,EAAE;AAEtE,Q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,KAAK,MAAM,IAAI,KAAK,MAAM,OAAO,EAAE,CAAC;AAAA,QAC9D;AAAA,MACF;AACA,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF,SAAS,KAAK;AACZ,YAAQ,MAAM,YAAa,IAAc,OAAO,CAAC;AACjD,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF,CAAC;;;AZ7CH,IAAM,UAAU,IAAIC,UAAQ;AAE5B,QACG,KAAK,SAAS,EACd,YAAY,yDAAoD,EAChE,QAAQ,OAAO;AAGlB,QAAQ,WAAW,WAAW;AAC9B,QAAQ,WAAW,YAAY;AAC/B,QAAQ,WAAW,WAAW;AAC9B,QAAQ,WAAW,cAAc;AACjC,QAAQ,WAAW,UAAU;AAC7B,QAAQ,WAAW,UAAU;AAC7B,QAAQ,WAAW,WAAW;AAC9B,QAAQ,WAAW,WAAW;AAC9B,QAAQ,WAAW,YAAY;AAC/B,QAAQ,WAAW,kBAAkB;AAErC,QAAQ,MAAM;","names":["Command","chalk","chalk","Command","chalk","path","compile","loadConfig","Command","loadConfig","path","compile","chalk","Command","chalk","path","compile","loadConfig","Command","loadConfig","path","compile","chalk","Command","chalk","path","compile","loadConfig","Command","loadConfig","path","compile","chalk","Command","chalk","path","fs","compile","loadConfig","LintEngine","ALL_RULES","Command","loadConfig","path","compile","LintEngine","ALL_RULES","chalk","fs","Command","chalk","path","compile","loadConfig","LintEngine","ALL_RULES","loadConfig","compile","LintEngine","ALL_RULES","chalk","Command","path","Command","chalk","path","fs","Command","path","fs","chalk","Command","chalk","path","compile","loadConfig","emitManifest","Command","loadConfig","path","compile","emitManifest","chalk","Command","chalk","Command","chalk","Command","chalk","path","Command","path","chalk","Command"]}
|