@runcontext/cli 0.4.2 → 0.4.4
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 +78 -60
- package/dist/index.js.map +1 -1
- package/dist/server-MQUOYUAX.js +322 -0
- package/dist/server-MQUOYUAX.js.map +1 -0
- package/package.json +4 -4
- package/dist/server-DEKWPP3H.js +0 -192
- package/dist/server-DEKWPP3H.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -141,7 +141,7 @@ function formatSarif(diagnostics) {
|
|
|
141
141
|
tool: {
|
|
142
142
|
driver: {
|
|
143
143
|
name: "ContextKit",
|
|
144
|
-
version: "0.4.
|
|
144
|
+
version: "0.4.4",
|
|
145
145
|
informationUri: "https://github.com/erickittelson/ContextKit",
|
|
146
146
|
rules: Array.from(ruleMap.values())
|
|
147
147
|
}
|
|
@@ -1088,7 +1088,7 @@ var devCommand = new Command8("dev").description("Watch mode \u2014 re-run lint
|
|
|
1088
1088
|
await runLint(contextDir, fix);
|
|
1089
1089
|
let recompileAndBroadcast;
|
|
1090
1090
|
if (opts.studio) {
|
|
1091
|
-
const { startStudioServer } = await import("./server-
|
|
1091
|
+
const { startStudioServer } = await import("./server-MQUOYUAX.js");
|
|
1092
1092
|
const studioPort = parseInt(opts.port, 10);
|
|
1093
1093
|
const { server: _studioServer, recompileAndBroadcast: rab } = await startStudioServer({
|
|
1094
1094
|
contextDir,
|
|
@@ -1278,19 +1278,19 @@ import { Command as Command10 } from "commander";
|
|
|
1278
1278
|
import chalk11 from "chalk";
|
|
1279
1279
|
import path10 from "path";
|
|
1280
1280
|
import { compile as compile8, loadConfig as loadConfig8, emitManifest as emitManifest2 } from "@runcontext/core";
|
|
1281
|
-
var siteCommand = new Command10("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) => {
|
|
1281
|
+
var siteCommand = new Command10("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").option("--astro", "Use Astro-based site builder (default: EJS legacy)").action(async (opts) => {
|
|
1282
1282
|
try {
|
|
1283
1283
|
const config = loadConfig8(process.cwd());
|
|
1284
1284
|
const contextDir = opts.contextDir ? path10.resolve(opts.contextDir) : path10.resolve(config.context_dir);
|
|
1285
1285
|
const { graph } = await compile8({ contextDir, config, rootDir: process.cwd() });
|
|
1286
1286
|
const manifest = emitManifest2(graph, config);
|
|
1287
|
-
let
|
|
1287
|
+
let builder;
|
|
1288
1288
|
try {
|
|
1289
1289
|
const siteModule = await import("@runcontext/site");
|
|
1290
|
-
|
|
1290
|
+
builder = opts.astro ? siteModule.buildAstroSite : siteModule.buildSite;
|
|
1291
1291
|
} catch {
|
|
1292
1292
|
}
|
|
1293
|
-
if (!
|
|
1293
|
+
if (!builder) {
|
|
1294
1294
|
console.log(
|
|
1295
1295
|
chalk11.yellow(
|
|
1296
1296
|
"Site generator is not yet available. Install @runcontext/site to enable this command."
|
|
@@ -1299,8 +1299,8 @@ var siteCommand = new Command10("site").description("Build a static documentatio
|
|
|
1299
1299
|
process.exit(0);
|
|
1300
1300
|
}
|
|
1301
1301
|
const outputDir = opts.outputDir ? path10.resolve(opts.outputDir) : path10.resolve(config.site?.base_path ?? "site");
|
|
1302
|
-
await
|
|
1303
|
-
console.log(chalk11.green(`Site built to ${outputDir}`));
|
|
1302
|
+
await builder(manifest, config, outputDir);
|
|
1303
|
+
console.log(chalk11.green(`Site built to ${outputDir}${opts.astro ? " (Astro)" : ""}`));
|
|
1304
1304
|
} catch (err) {
|
|
1305
1305
|
console.error(formatError(err.message));
|
|
1306
1306
|
process.exit(1);
|
|
@@ -3324,59 +3324,68 @@ CREATE TABLE / CREATE VIEW / CREATE INDEX
|
|
|
3324
3324
|
|
|
3325
3325
|
If a query might be expensive and you're not sure, **ask the user first**. "This table looks large \u2014 is it OK if I run a COUNT(*)?" is always the right call.
|
|
3326
3326
|
|
|
3327
|
-
##
|
|
3327
|
+
## Mandatory Task Checklist
|
|
3328
3328
|
|
|
3329
|
-
|
|
3329
|
+
**You MUST complete every task in order. Do NOT skip any task. Do NOT proceed to the next task until the current one is done.**
|
|
3330
3330
|
|
|
3331
|
-
|
|
3331
|
+
This is the full workflow for building a semantic layer. Check off each task as you complete it.
|
|
3332
3332
|
|
|
3333
|
-
|
|
3333
|
+
### Phase 1: Discovery (BEFORE touching any YAML)
|
|
3334
3334
|
|
|
3335
|
-
1
|
|
3336
|
-
2. Run \`context tier\` to check the current metadata tier (Bronze/Silver/Gold)
|
|
3337
|
-
3. Report the current tier and summarize failing checks
|
|
3338
|
-
4. Ask the user what they'd like to focus on \u2014 don't start changing files unprompted
|
|
3339
|
-
5. If the user says "get me to Gold" or "build my semantic layer," follow the iterative workflow below
|
|
3335
|
+
- [ ] **Task 1: Ask about the project goal.** Ask the user: "What is this data for? What questions do you want to answer with it? Who will be using it?" Do NOT proceed until the user answers.
|
|
3340
3336
|
|
|
3341
|
-
|
|
3337
|
+
- [ ] **Task 2: Ask for reference documents.** Tell the user: "Do you have any existing documentation about this data? Data dictionaries, wiki pages, ERDs, spreadsheets, Confluence exports, dashboard screenshots? Drop them in \`context/reference/\` and I'll use them to write much better metadata." Check \`context/reference/\` for any files already there. Read them if present.
|
|
3342
3338
|
|
|
3343
|
-
|
|
3339
|
+
- [ ] **Task 3: Ask about ownership.** Ask: "Who owns this data? What team maintains it? What's the best contact email?" Do NOT invent owner info.
|
|
3344
3340
|
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3341
|
+
- [ ] **Task 4: Ask about data sources.** Ask: "Where does this data come from originally? What upstream systems feed into this database? (e.g., Salesforce, Stripe, internal APIs, CSV imports)"
|
|
3342
|
+
|
|
3343
|
+
- [ ] **Task 5: Run \`context tier\`.** Check the current tier score and report it to the user. Summarize which checks are failing.
|
|
3344
|
+
|
|
3345
|
+
### Phase 2: Guided Curation (the conversation)
|
|
3346
|
+
|
|
3347
|
+
- [ ] **Task 6: Walk through key fields WITH the user.** For each dataset, sample the data (with LIMIT), then ask the user about fields that are ambiguous:
|
|
3348
|
+
- "I see a column called \`stars\` with values 1.0-5.0 \u2014 is this a rating that should be averaged, or something else?"
|
|
3349
|
+
- "Should \`revenue\` be summed or averaged? Is it additive across dimensions?"
|
|
3350
|
+
- "What does \`status\` mean in your business? What are the valid values?"
|
|
3351
|
+
- Do NOT silently assign semantic roles without checking ambiguous cases.
|
|
3352
|
+
|
|
3353
|
+
- [ ] **Task 7: Ask about metrics the user cares about.** Ask: "What are the key metrics you track? What KPIs matter most to your team? (e.g., revenue, churn rate, conversion, average order value)" \u2014 then build metrics around their answers, not just what you find in the data.
|
|
3354
|
+
|
|
3355
|
+
- [ ] **Task 8: Ask about business rules and filters.** Ask: "Are there any filters that should always be applied? For example: only active records, exclude test data, only completed orders?"
|
|
3356
|
+
|
|
3357
|
+
- [ ] **Task 9: Ask about glossary terms.** Ask: "What business terms do people in your org use that a new analyst might not understand? (e.g., 'MRR', 'churn', 'qualified lead')"
|
|
3358
|
+
|
|
3359
|
+
- [ ] **Task 10: Curate to Gold.** Now iterate through failing checks:
|
|
3360
|
+
1. Run \`context tier\` to see what's failing
|
|
3361
|
+
2. Fix the highest-impact failing check
|
|
3362
|
+
3. If you need user input to fix a check, ASK \u2014 don't guess
|
|
3363
|
+
4. Run \`context tier\` again
|
|
3364
|
+
5. Repeat until Gold or until you hit something that genuinely requires human input
|
|
3365
|
+
|
|
3366
|
+
### Phase 3: Deliver
|
|
3367
|
+
|
|
3368
|
+
- [ ] **Task 11: Build the AI Blueprint.** Run \`context blueprint ${modelName}\` to export the Gold-tier data product as a portable YAML file. Show the user where it was saved.
|
|
3369
|
+
|
|
3370
|
+
- [ ] **Task 12: Serve the metadata site.** Run \`context dev --studio\` to start the interactive metadata browser. Tell the user: "Your metadata catalog is now live \u2014 open the link above to browse your semantic layer in the browser."
|
|
3371
|
+
|
|
3372
|
+
- [ ] **Task 13: Summary.** Give the user a final summary:
|
|
3373
|
+
- Current tier score
|
|
3374
|
+
- Number of datasets, fields, metrics, glossary terms, golden queries
|
|
3375
|
+
- What's complete and what still needs human input
|
|
3376
|
+
- Next steps they can take
|
|
3377
|
+
|
|
3378
|
+
## Key Principles
|
|
3379
|
+
|
|
3380
|
+
### This is a CONVERSATION, not a batch job
|
|
3381
|
+
|
|
3382
|
+
The single most important thing: **ask questions and wait for answers.** The user knows the business. You know the data. Together you build the semantic layer. If you silently curate everything without asking, the metadata will be plausible-looking but wrong.
|
|
3383
|
+
|
|
3384
|
+
**Ask one question at a time.** Don't batch 10 questions into one message. Ask, wait, incorporate the answer, then ask the next question.
|
|
3385
|
+
|
|
3386
|
+
### Reference Documents
|
|
3387
|
+
|
|
3388
|
+
Check \`context/reference/\` for any files the user has provided \u2014 data dictionaries, Confluence exports, ERDs, business glossaries, dashboard docs, etc. **Read these first** before querying the database. They contain domain knowledge that will dramatically improve your metadata quality.
|
|
3380
3389
|
|
|
3381
3390
|
### What to Ask the User About
|
|
3382
3391
|
|
|
@@ -3410,17 +3419,26 @@ context serve --stdio # Start MCP server (for Claude, Cursor, etc.)
|
|
|
3410
3419
|
context dev --studio # Open visual editor in browser
|
|
3411
3420
|
\`\`\`
|
|
3412
3421
|
|
|
3413
|
-
### Do NOT Stop Until Gold
|
|
3422
|
+
### Do NOT Stop Until Gold (Task 10)
|
|
3414
3423
|
|
|
3415
3424
|
1. Run \`context tier\` and collect every failing check
|
|
3416
3425
|
2. For each failing check, query the database to gather evidence, then fix the metadata
|
|
3417
|
-
3.
|
|
3418
|
-
4.
|
|
3419
|
-
5.
|
|
3420
|
-
6.
|
|
3426
|
+
3. **If you need user input to fix a check \u2014 ASK.** Do not guess.
|
|
3427
|
+
4. Run \`context tier\` again
|
|
3428
|
+
5. If checks still fail, go back to step 2
|
|
3429
|
+
6. **Do NOT stop until every Gold check passes** or you hit something that genuinely requires human input
|
|
3430
|
+
7. For checks you cannot fix, ask the user or leave a clear TODO explaining what's needed
|
|
3421
3431
|
|
|
3422
3432
|
You must iterate \u2014 a single pass is never enough. Each \`context tier\` run may reveal new failures after earlier ones are fixed.
|
|
3423
3433
|
|
|
3434
|
+
### After Gold: Deliver (Tasks 11-13)
|
|
3435
|
+
|
|
3436
|
+
**Do NOT skip these.** Once you reach Gold (or as close as possible):
|
|
3437
|
+
|
|
3438
|
+
1. Run \`context blueprint ${modelName}\` \u2014 export the AI Blueprint
|
|
3439
|
+
2. Run \`context dev --studio\` \u2014 start the metadata browser for the user
|
|
3440
|
+
3. Give the user a summary of what was built and what needs human input
|
|
3441
|
+
|
|
3424
3442
|
## How to Curate Metadata (the right way)
|
|
3425
3443
|
|
|
3426
3444
|
### Before writing ANY metadata, query the database first
|
|
@@ -4238,7 +4256,7 @@ var newCommand = new Command17("new").description("Scaffold a new data product i
|
|
|
4238
4256
|
|
|
4239
4257
|
// src/index.ts
|
|
4240
4258
|
var program = new Command18();
|
|
4241
|
-
program.name("context").description("ContextKit \u2014 AI-ready metadata governance over OSI").version("0.4.
|
|
4259
|
+
program.name("context").description("ContextKit \u2014 AI-ready metadata governance over OSI").version("0.4.4");
|
|
4242
4260
|
program.addCommand(lintCommand);
|
|
4243
4261
|
program.addCommand(buildCommand);
|
|
4244
4262
|
program.addCommand(tierCommand);
|