@whittlelabs/sifter 0.30.13 → 0.30.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/bin.js +63 -8
  2. package/bin.js.map +2 -2
  3. package/package.json +1 -1
package/bin.js CHANGED
@@ -10030,6 +10030,7 @@ var require_claude_code = __commonJS({
10030
10030
  Object.defineProperty(exports2, "__esModule", { value: true });
10031
10031
  exports2.classifyEnvironmentFault = classifyEnvironmentFault;
10032
10032
  exports2.createClaudeCodeExecutor = createClaudeCodeExecutor;
10033
+ exports2.checkoutScopedTools = checkoutScopedTools;
10033
10034
  exports2.parseStreamJson = parseStreamJson;
10034
10035
  exports2.relativeWorkspaceReads = relativeWorkspaceReads;
10035
10036
  exports2.globToRegExp = globToRegExp;
@@ -10046,6 +10047,37 @@ var require_claude_code = __commonJS({
10046
10047
  var progress_1 = require_progress();
10047
10048
  var apply_1 = require_apply();
10048
10049
  var DEFAULT_TIMEOUT = 6e5;
10050
+ var REVIEW_TOOLS = ["Read", "Grep", "Glob"];
10051
+ var REVIEW_RUN_ARGS = [
10052
+ "--setting-sources",
10053
+ "user",
10054
+ "--strict-mcp-config",
10055
+ "--tools",
10056
+ REVIEW_TOOLS.join(","),
10057
+ "--permission-mode",
10058
+ "default",
10059
+ "--settings",
10060
+ JSON.stringify({ disableAllHooks: true })
10061
+ ];
10062
+ var RETIRED_READ_TOOLS = ["LS"];
10063
+ var HOSTED_ENV_PASSTHROUGH = [
10064
+ "PATH",
10065
+ "HOME",
10066
+ "TMPDIR",
10067
+ "LANG",
10068
+ "LC_ALL",
10069
+ "LC_CTYPE",
10070
+ "TZ",
10071
+ "NODE_EXTRA_CA_CERTS",
10072
+ "SSL_CERT_FILE",
10073
+ "SSL_CERT_DIR",
10074
+ "HTTPS_PROXY",
10075
+ "HTTP_PROXY",
10076
+ "NO_PROXY",
10077
+ "https_proxy",
10078
+ "http_proxy",
10079
+ "no_proxy"
10080
+ ];
10049
10081
  function describeClaudeFailure(meta, fallback) {
10050
10082
  if (!meta)
10051
10083
  return fallback;
@@ -10308,8 +10340,9 @@ var require_claude_code = __commonJS({
10308
10340
  runClaude(prompt, spec, cwd, childEnv, signal, modelOverride, reporter, resumeSessionId, transcriptName, local = false) {
10309
10341
  const outputLabel = spec.outputLabel;
10310
10342
  const model = modelOverride ?? this.config.model;
10343
+ const allowedTools = local ? this.config.allowedTools : checkoutScopedTools(this.config.allowedTools);
10311
10344
  return new Promise((resolve, reject) => {
10312
- const args = ["--print", "--output-format", "stream-json", "--verbose"];
10345
+ const args = ["--print", "--output-format", "stream-json", "--verbose", ...REVIEW_RUN_ARGS];
10313
10346
  if (resumeSessionId)
10314
10347
  args.push("--resume", resumeSessionId);
10315
10348
  if (spec.outputSchema && typeof spec.outputSchema === "object" && Object.keys(spec.outputSchema).length > 0) {
@@ -10319,8 +10352,8 @@ var require_claude_code = __commonJS({
10319
10352
  args.push("--model", model);
10320
10353
  if (this.config.maxTurns !== void 0)
10321
10354
  args.push("--max-turns", String(this.config.maxTurns));
10322
- if (this.config.allowedTools && this.config.allowedTools.length > 0) {
10323
- args.push("--allowedTools", this.config.allowedTools.join(","));
10355
+ if (allowedTools && allowedTools.length > 0) {
10356
+ args.push("--allowedTools", allowedTools.join(","));
10324
10357
  }
10325
10358
  let child;
10326
10359
  try {
@@ -10517,11 +10550,31 @@ var require_claude_code = __commonJS({
10517
10550
  }
10518
10551
  return new ClaudeCodeExecutor(validated);
10519
10552
  }
10553
+ function checkoutScopedTools(tools) {
10554
+ if (!tools)
10555
+ return void 0;
10556
+ const scoped = [];
10557
+ for (const tool of tools) {
10558
+ if (RETIRED_READ_TOOLS.some((t) => tool === t || tool === `${t}(./**)`))
10559
+ continue;
10560
+ const name = REVIEW_TOOLS.find((t) => tool === t || tool === `${t}(./**)`);
10561
+ if (!name) {
10562
+ throw new Error(`claude-code: a hosted run may use only ${REVIEW_TOOLS.join(", ")} inside the checkout; "${tool}" is not allowed`);
10563
+ }
10564
+ scoped.push(`${name}(./**)`);
10565
+ }
10566
+ return scoped;
10567
+ }
10520
10568
  function buildChildEnv(modelKey, configDir) {
10521
10569
  if (!modelKey && !configDir)
10522
10570
  return void 0;
10571
+ const env = {};
10572
+ for (const name of HOSTED_ENV_PASSTHROUGH) {
10573
+ if (process.env[name] !== void 0)
10574
+ env[name] = process.env[name];
10575
+ }
10523
10576
  return {
10524
- ...process.env,
10577
+ ...env,
10525
10578
  ...modelKey ? { ANTHROPIC_API_KEY: modelKey } : {},
10526
10579
  ...configDir ? { CLAUDE_CONFIG_DIR: configDir } : {}
10527
10580
  };
@@ -26869,7 +26922,7 @@ var import_path = require("path");
26869
26922
  var import_promises = require("fs/promises");
26870
26923
  var import_yaml = __toESM(require_dist3());
26871
26924
  var import_shuttle = __toESM(require_dist5());
26872
- var buildVersion = true ? "0.30.13" : pkg.version;
26925
+ var buildVersion = true ? "0.30.15" : pkg.version;
26873
26926
  var sifterBrand = {
26874
26927
  product: {
26875
26928
  id: "sifter",
@@ -26902,11 +26955,13 @@ var sifterBrand = {
26902
26955
  // number chosen for tidiness rather than necessity would refuse a working
26903
26956
  // install. `git` 2.20 (Dec 2018) is older than any supported distro and is
26904
26957
  // where the `--no-tags --depth=1` fetch-by-ref path the materializer uses
26905
- // settled; `claude` 2.0 is where `--json-schema` and the stream-json shape
26906
- // the executor parses arrived, and the hosted image pins 2.1.x.
26958
+ // settled; `claude` 2.0.45 is the first release with `--json-schema`, the
26959
+ // newest of the flags every review passes (`--tools` arrived in 2.0.31;
26960
+ // the executor's REVIEW_RUN_ARGS names them all), and the hosted image pins
26961
+ // 2.1.x. Below it a review fails on an unknown option.
26907
26962
  minimumToolVersions: {
26908
26963
  git: "2.20.0",
26909
- claude: "2.0.0"
26964
+ claude: "2.0.45"
26910
26965
  },
26911
26966
  // Overlay-fetch origins for the signed standards-content URLs each Sift
26912
26967
  // tier signs (SIFT_PUBLIC_API_URL). Without these, the executor's SSRF