@kradle/cli 0.0.11 → 0.0.13

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.
@@ -5,7 +5,7 @@ import { Listr } from "listr2";
5
5
  import pc from "picocolors";
6
6
  import { ApiClient } from "../../lib/api-client.js";
7
7
  import { getChallengeSlugArgument } from "../../lib/arguments.js";
8
- import { Challenge } from "../../lib/challenge.js";
8
+ import { Challenge, SOURCE_FOLDER } from "../../lib/challenge.js";
9
9
  import { loadConfig } from "../../lib/config.js";
10
10
  import { clearScreen, debounced } from "../../lib/utils.js";
11
11
  export default class Watch extends Command {
@@ -91,7 +91,7 @@ export default class Watch extends Command {
91
91
  this.log(pc.dim("Watching for changes... (Ctrl+C to stop)\n"));
92
92
  const watcher = chokidar.watch([challenge.challengeDir], {
93
93
  // ⚠️ WE IGNORE THE DATAPACK FOLDER FOR NOW, BUT IT'S A SHORT TERM FIX.
94
- ignored: [/(^|[/\\])\../, (p) => p.includes("/datapack")], // ignore dotfiles and datapack folder
94
+ ignored: [/(^|[/\\])\../, (p) => p.includes("/datapack"), (p) => p.includes(`/${SOURCE_FOLDER}`)], // ignore dotfiles and datapack folder
95
95
  persistent: true,
96
96
  ignoreInitial: true,
97
97
  });
@@ -50,6 +50,7 @@ export default class Run extends Command {
50
50
  await evaluator.run({
51
51
  new: flags.new,
52
52
  maxConcurrent: flags["max-concurrent"],
53
+ openMetabase: true,
53
54
  });
54
55
  this.log(pc.green("\n✓ Evaluation complete!"));
55
56
  }
@@ -1,6 +1,7 @@
1
1
  import type { ApiClient } from "./api-client.js";
2
2
  import type { Config } from "./config.js";
3
3
  import { type ChallengeSchemaType } from "./schemas.js";
4
+ export declare const SOURCE_FOLDER = ".src";
4
5
  export declare class Challenge {
5
6
  readonly name: string;
6
7
  private readonly config;
@@ -6,6 +6,7 @@ import pc from "picocolors";
6
6
  import * as tar from "tar";
7
7
  import { ChallengeSchema } from "./schemas.js";
8
8
  import { executeNodeCommand, executeTypescriptFile, getStaticResourcePath, readDirSorted } from "./utils.js";
9
+ export const SOURCE_FOLDER = ".src";
9
10
  export class Challenge {
10
11
  name;
11
12
  config;
@@ -99,10 +100,9 @@ export class Challenge {
99
100
  throw new Error(`Failed to build datapack: ${error instanceof Error ? error.message : error}`);
100
101
  }
101
102
  // @TODO - re-enable once we have a proper build pipeline
102
- // Recursively copy the challenge dir to target directory, under src/
103
- // await fs.cp(this.challengeDir, path.join(this.config.KRADLE_CHALLENGES_PATH, this.shortSlug, "src"), {
104
- // recursive: true,
105
- // });
103
+ // Copy challenge.ts and config.ts to the src directory
104
+ await fs.cp(path.join(this.challengeDir, "challenge.ts"), path.join(this.config.KRADLE_CHALLENGES_PATH, this.shortSlug, SOURCE_FOLDER, "challenge.ts"));
105
+ await fs.cp(path.join(this.challengeDir, "config.ts"), path.join(this.config.KRADLE_CHALLENGES_PATH, this.shortSlug, SOURCE_FOLDER, "config.ts"));
106
106
  }
107
107
  /**
108
108
  * Load the challenge configuration from config.ts
@@ -133,7 +133,7 @@ export class Challenge {
133
133
  gzip: true,
134
134
  cwd: this.datapackPath, // Input directory
135
135
  strict: true,
136
- }, ["datapack"]);
136
+ }, ["datapack", SOURCE_FOLDER]);
137
137
  const uploadUrl = await apiClient.getChallengeUploadUrl(this);
138
138
  const fileBuffer = await fs.readFile(this.tarballPath);
139
139
  const response = await fetch(uploadUrl, {
@@ -229,13 +229,13 @@ export class Evaluator {
229
229
  this.tui.stop();
230
230
  console.log("");
231
231
  }
232
+ if (options.openMetabase ?? true) {
233
+ openInBrowser(`https://daunt-fair.metabaseapp.com/dashboard/10-runs-analysis?tags=${iterationTag}`);
234
+ }
232
235
  const errors = this.runner?.getAllStates().filter((state) => state.status === "error");
233
236
  if (errors?.length > 0) {
234
237
  throw new Error(`${errors.map((error) => error.error).join("\n\n")}`);
235
238
  }
236
- if (options.openMetabase ?? true) {
237
- openInBrowser(`https://daunt-fair.metabaseapp.com/dashboard/10-runs-analysis?tags=${iterationTag}`);
238
- }
239
239
  }
240
240
  /**
241
241
  * Handle state change from runner
@@ -401,5 +401,5 @@
401
401
  ]
402
402
  }
403
403
  },
404
- "version": "0.0.11"
404
+ "version": "0.0.13"
405
405
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kradle/cli",
3
- "version": "0.0.11",
3
+ "version": "0.0.13",
4
4
  "description": "Kradle's CLI. Manage challenges, evaluations, agents and more!",
5
5
  "keywords": [
6
6
  "cli"