spacecode 2.4.2 → 2.5.1

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/repl.mjs CHANGED
@@ -5320,7 +5320,7 @@ function applyPlan(input, decisions, maxCoreChars = MAX_CORE_CHARS) {
5320
5320
  if (!bySlug.has(d.slug)) throw new AdaptPlanError(`plan names unknown section "${d.slug}"`);
5321
5321
  if (seen.has(d.slug)) throw new AdaptPlanError(`plan decides section "${d.slug}" twice`);
5322
5322
  seen.add(d.slug);
5323
- if (d.decision === "drop" && !(d.reason && d.reason.trim())) throw new AdaptPlanError(`dropped section "${d.slug}" has no reason`);
5323
+ if (d.decision === "drop" && !(d.reason && d.reason.trim())) throw new AdaptPlanError(`flagged section "${d.slug}" has no reason`);
5324
5324
  if (d.decision === "on_demand" && !(d.summary && d.summary.trim())) throw new AdaptPlanError(`on-demand section "${d.slug}" has no summary`);
5325
5325
  }
5326
5326
  const missing = input.sections.filter((s) => !seen.has(s.slug)).map((s) => s.slug);
@@ -5331,13 +5331,17 @@ function applyPlan(input, decisions, maxCoreChars = MAX_CORE_CHARS) {
5331
5331
  const assemble = () => {
5332
5332
  const kept = [];
5333
5333
  const onDemand2 = [];
5334
- const dropped2 = [];
5334
+ const flagged2 = [];
5335
5335
  const index = [];
5336
5336
  for (const d of decisions) {
5337
5337
  const s = bySlug.get(d.slug);
5338
5338
  if (keptSlugs.has(d.slug)) kept.push(s.text);
5339
- else if (d.decision === "drop") dropped2.push({ slug: s.slug, title: s.title, reason: d.reason.trim(), unsupported: s.unsupported });
5340
- else {
5339
+ else if (d.decision === "drop") {
5340
+ const reason = d.reason.trim().replace(/\s+/g, " ");
5341
+ flagged2.push({ slug: s.slug, title: s.title, reason, unsupported: s.unsupported });
5342
+ onDemand2.push({ slug: s.slug, title: s.title, text: s.text });
5343
+ index.push(`- ${s.slug}: ${s.title} \u2014 written for Claude Code, may not apply here (${reason})`);
5344
+ } else {
5341
5345
  onDemand2.push({ slug: s.slug, title: s.title, text: s.text });
5342
5346
  index.push(`- ${s.slug}: ${s.title} \u2014 ${summaries.get(s.slug) || `read when working on: ${s.title}`}`);
5343
5347
  }
@@ -5347,19 +5351,19 @@ function applyPlan(input, decisions, maxCoreChars = MAX_CORE_CHARS) {
5347
5351
  Use the instructions_read tool with a section name to read one before acting in that area:
5348
5352
  ${index.join("\n")}
5349
5353
  ` : "";
5350
- return { core: input.preamble + kept.join("") + indexBlock, onDemand: onDemand2, dropped: dropped2 };
5354
+ return { core: input.preamble + kept.join("") + indexBlock, onDemand: onDemand2, flagged: flagged2 };
5351
5355
  };
5352
- let { core, onDemand, dropped } = assemble();
5356
+ let { core, onDemand, flagged } = assemble();
5353
5357
  while (core.length > maxCoreChars && keptSlugs.size > 0) {
5354
5358
  const largest = [...keptSlugs].map((slug) => bySlug.get(slug)).sort((a, b2) => b2.chars - a.chars)[0];
5355
5359
  keptSlugs.delete(largest.slug);
5356
5360
  demoted.push({ slug: largest.slug, title: largest.title });
5357
- ({ core, onDemand, dropped } = assemble());
5361
+ ({ core, onDemand, flagged } = assemble());
5358
5362
  }
5359
5363
  if (core.length > maxCoreChars) throw new AdaptPlanError(`core is ${core.length} chars, over the ${maxCoreChars} budget even with every section on demand`);
5360
5364
  const translated = input.preamble + input.sections.map((s) => s.text).join("");
5361
- const coverage = checkCoverage(translated, [core, ...onDemand.map((o) => o.text)], dropped.map((d) => bySlug.get(d.slug).text));
5362
- return { core, onDemand, dropped, coverage, coreChars: core.length, demoted };
5365
+ const coverage = checkCoverage(translated, [core, ...onDemand.map((o) => o.text)], []);
5366
+ return { core, onDemand, flagged, coverage, coreChars: core.length, demoted };
5363
5367
  }
5364
5368
  var AdaptPlanError, MAX_CORE_CHARS;
5365
5369
  var init_adapt_plan = __esm({
@@ -5569,16 +5573,11 @@ async function sha12(text) {
5569
5573
  return [...new Uint8Array(d)].slice(0, 6).map((b2) => b2.toString(16).padStart(2, "0")).join("");
5570
5574
  }
5571
5575
  function formatAdaptReport(r, before, replaced) {
5572
- const lines2 = [`Adapted instructions: ${before} chars -> core ${r.coreChars} chars + ${r.onDemand.length} on-demand section(s), ${r.dropped.length} dropped.`];
5576
+ const lines2 = [`Adapted instructions: ${before} chars -> core ${r.coreChars} chars + ${r.onDemand.length} on-demand section(s), ${r.flagged.length} of them flagged as Claude Code-specific. Nothing is removed.`];
5573
5577
  for (const x2 of replaced) lines2.push(` tool name ${x2.from} -> ${x2.to} (${x2.count}x)`);
5574
5578
  for (const d of r.demoted) lines2.push(` demoted ${d.slug}: kept by the model but moved on demand to fit the core budget`);
5575
5579
  for (const o of r.onDemand) lines2.push(` on demand ${o.slug} (${o.text.length} chars)`);
5576
- for (const d of r.dropped) lines2.push(` DROPPED ${d.slug}: ${d.reason}${d.unsupported.length ? ` [${d.unsupported.join("; ")}]` : ""}`);
5577
- if (r.coverage.droppedRules.length > 0) {
5578
- lines2.push(` ${r.coverage.droppedRules.length} rule line(s) exist only in dropped sections:`);
5579
- for (const rule of r.coverage.droppedRules.slice(0, 12)) lines2.push(` - ${rule.slice(0, 140)}`);
5580
- if (r.coverage.droppedRules.length > 12) lines2.push(` ... and ${r.coverage.droppedRules.length - 12} more`);
5581
- }
5580
+ for (const d of r.flagged) lines2.push(` flagged ${d.slug}: ${d.reason}${d.unsupported.length ? ` [${d.unsupported.join("; ")}]` : ""}`);
5582
5581
  return lines2;
5583
5582
  }
5584
5583
  async function adaptInstructions(deps, original) {
@@ -5663,7 +5662,7 @@ __export(import_claude_exports, {
5663
5662
  });
5664
5663
  async function runImportClaude(deps) {
5665
5664
  const flags = deps.argv.filter((a) => a !== "import-claude");
5666
- const unknown = flags.filter((f) => !["--dry-run", "--overwrite", "--adapt", "--yes", "--restore-original"].includes(f));
5665
+ const unknown = flags.filter((f) => !["--dry-run", "--overwrite", "--adapt", "--no-adapt", "--yes", "--restore-original"].includes(f));
5667
5666
  if (unknown.length > 0) {
5668
5667
  deps.log(`Unknown option: ${unknown.join(" ")}
5669
5668
  ${USAGE}`);
@@ -5671,9 +5670,9 @@ ${USAGE}`);
5671
5670
  }
5672
5671
  const dryRun = flags.includes("--dry-run");
5673
5672
  const overwrite = flags.includes("--overwrite");
5674
- const adapt = flags.includes("--adapt");
5673
+ const adapt = !flags.includes("--no-adapt");
5675
5674
  const restore = flags.includes("--restore-original");
5676
- if (restore && (adapt || dryRun)) {
5675
+ if (restore && (flags.includes("--adapt") || dryRun)) {
5677
5676
  deps.log(`--restore-original cannot be combined with --adapt or --dry-run
5678
5677
  ${USAGE}`);
5679
5678
  return 2;
@@ -5759,7 +5758,7 @@ var init_import_claude = __esm({
5759
5758
  init_api_key();
5760
5759
  init_profile_runtime();
5761
5760
  init_import_adapt();
5762
- USAGE = "Usage: spacecode import-claude [--dry-run] [--overwrite] [--adapt [--yes]] [--restore-original]";
5761
+ USAGE = "Usage: spacecode import-claude [--dry-run] [--overwrite] [--no-adapt] [--yes] [--restore-original]";
5763
5762
  }
5764
5763
  });
5765
5764
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spacecode",
3
- "version": "2.4.2",
3
+ "version": "2.5.1",
4
4
  "description": "SpaceCode - launch cloud dev environments with AI coding agents",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",