@ai-hero/sandcastle 0.14.0 → 0.14.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.
Files changed (74) hide show
  1. package/dist/{SandboxProvider-Chsi-Zs6.d.ts → SandboxProvider-CwRLxIXZ.d.ts} +2 -39
  2. package/dist/{chunk-BVZWLFFT.js → chunk-4BB7DNPW.js} +3 -3
  3. package/dist/chunk-4BB7DNPW.js.map +1 -0
  4. package/dist/chunk-4GZMUHVO.js +60 -0
  5. package/dist/chunk-4GZMUHVO.js.map +1 -0
  6. package/dist/{chunk-S6UHPTRG.js → chunk-7JUTKCHL.js} +4 -4
  7. package/dist/{chunk-S6UHPTRG.js.map → chunk-7JUTKCHL.js.map} +1 -1
  8. package/dist/chunk-7PHPLDVS.js +284 -0
  9. package/dist/chunk-7PHPLDVS.js.map +1 -0
  10. package/dist/{chunk-HSXPRZKG.js → chunk-BXLS4HRY.js} +15 -6
  11. package/dist/chunk-BXLS4HRY.js.map +1 -0
  12. package/dist/{chunk-G2R53CVZ.js → chunk-EM4QNWKF.js} +695 -706
  13. package/dist/chunk-EM4QNWKF.js.map +1 -0
  14. package/dist/{chunk-STB2U7BB.js → chunk-JEQ4IVQM.js} +384 -264
  15. package/dist/chunk-JEQ4IVQM.js.map +1 -0
  16. package/dist/{chunk-VRXR2T3S.js → chunk-L3BU47F6.js} +3 -3
  17. package/dist/{chunk-VRXR2T3S.js.map → chunk-L3BU47F6.js.map} +1 -1
  18. package/dist/{chunk-7N7AMUYA.js → chunk-PTJEKJPQ.js} +7 -5
  19. package/dist/chunk-PTJEKJPQ.js.map +1 -0
  20. package/dist/{chunk-H2PEFS4W.js → chunk-SAQXFLO2.js} +30 -6
  21. package/dist/chunk-SAQXFLO2.js.map +1 -0
  22. package/dist/{chunk-ATA2V2TC.js → chunk-TBVRAXYF.js} +3 -3
  23. package/dist/{chunk-ATA2V2TC.js.map → chunk-TBVRAXYF.js.map} +1 -1
  24. package/dist/{chunk-IBK2XNSS.js → chunk-VUOXFCWO.js} +3 -3
  25. package/dist/{chunk-IBK2XNSS.js.map → chunk-VUOXFCWO.js.map} +1 -1
  26. package/dist/{chunk-GCLEXPXG.js → chunk-WYOGXC72.js} +46 -84
  27. package/dist/chunk-WYOGXC72.js.map +1 -0
  28. package/dist/{chunk-RDW7FNN6.js → chunk-YDQW5IOY.js} +11 -4
  29. package/dist/chunk-YDQW5IOY.js.map +1 -0
  30. package/dist/index.d.ts +47 -4
  31. package/dist/index.js +536 -445
  32. package/dist/index.js.map +1 -1
  33. package/dist/main.js +72 -16
  34. package/dist/main.js.map +1 -1
  35. package/dist/sandboxes/bwrap.d.ts +1 -1
  36. package/dist/sandboxes/bwrap.js +9 -17
  37. package/dist/sandboxes/bwrap.js.map +1 -1
  38. package/dist/sandboxes/daytona.d.ts +1 -1
  39. package/dist/sandboxes/daytona.js +82 -79
  40. package/dist/sandboxes/daytona.js.map +1 -1
  41. package/dist/sandboxes/docker.d.ts +23 -1
  42. package/dist/sandboxes/docker.js +6 -5
  43. package/dist/sandboxes/e2b.d.ts +1 -1
  44. package/dist/sandboxes/e2b.js +4 -4
  45. package/dist/sandboxes/modal.d.ts +1 -1
  46. package/dist/sandboxes/modal.js +1 -1
  47. package/dist/sandboxes/no-sandbox.d.ts +1 -1
  48. package/dist/sandboxes/no-sandbox.js +1 -1
  49. package/dist/sandboxes/podman.d.ts +27 -4
  50. package/dist/sandboxes/podman.js +18 -45
  51. package/dist/sandboxes/podman.js.map +1 -1
  52. package/dist/sandboxes/seatbelt.d.ts +2 -2
  53. package/dist/sandboxes/seatbelt.js +10 -10
  54. package/dist/sandboxes/seatbelt.js.map +1 -1
  55. package/dist/sandboxes/sprites.d.ts +1 -1
  56. package/dist/sandboxes/sprites.js +25 -4
  57. package/dist/sandboxes/sprites.js.map +1 -1
  58. package/dist/sandboxes/vercel.d.ts +10 -1
  59. package/dist/sandboxes/vercel.js +74 -46
  60. package/dist/sandboxes/vercel.js.map +1 -1
  61. package/dist/templates/parallel-planner/main.mts +43 -21
  62. package/dist/templates/parallel-planner-with-review/main.mts +55 -27
  63. package/dist/templates/sequential-reviewer/main.mts +1 -1
  64. package/package.json +7 -3
  65. package/dist/chunk-7N7AMUYA.js.map +0 -1
  66. package/dist/chunk-BIF2X6QB.js +0 -94
  67. package/dist/chunk-BIF2X6QB.js.map +0 -1
  68. package/dist/chunk-BVZWLFFT.js.map +0 -1
  69. package/dist/chunk-G2R53CVZ.js.map +0 -1
  70. package/dist/chunk-GCLEXPXG.js.map +0 -1
  71. package/dist/chunk-H2PEFS4W.js.map +0 -1
  72. package/dist/chunk-HSXPRZKG.js.map +0 -1
  73. package/dist/chunk-RDW7FNN6.js.map +0 -1
  74. package/dist/chunk-STB2U7BB.js.map +0 -1
package/dist/main.js CHANGED
@@ -1,15 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from 'node:module';
3
- import { assertBwrapUsable } from './chunk-ATA2V2TC.js';
4
- import { assertSeatbeltUsable } from './chunk-IBK2XNSS.js';
5
- import { withFriendlyErrors } from './chunk-BIF2X6QB.js';
6
- import { NodeContext_exports, NodeRuntime_exports } from './chunk-S6UHPTRG.js';
7
- import { buildImage, removeImage } from './chunk-GCLEXPXG.js';
8
- import { Display, ClackDisplay, defaultImageName, SANDBOX_REPO_DIR } from './chunk-G2R53CVZ.js';
3
+ import { assertBwrapUsable } from './chunk-TBVRAXYF.js';
4
+ import { assertSeatbeltUsable } from './chunk-VUOXFCWO.js';
5
+ import { Display, ClackDisplay, withFriendlyErrors } from './chunk-EM4QNWKF.js';
6
+ import { NodeContext_exports, NodeRuntime_exports } from './chunk-7JUTKCHL.js';
7
+ import { buildImage, removeImage } from './chunk-WYOGXC72.js';
8
+ import './chunk-4GZMUHVO.js';
9
+ import { defaultImageName, SANDBOX_REPO_DIR } from './chunk-7PHPLDVS.js';
9
10
  import './chunk-EXYXBRCX.js';
10
- import { InitError, FileSystem_exports, ConfigDirError, ImageNotFoundError, FileSystem, isQuitException, PodmanError, Terminal, QuitException, Path } from './chunk-RDW7FNN6.js';
11
- import { CommitPrototype, dual, GenericTag, fromIterable, failSync, map2, reduce, Schema_exports, Effect_exports, Option_exports, Layer_exports, decode, mapError, TreeFormatter, empty, none, flatMap3, catchAll, match, fail3, map4 as map4$1, merge, some, right, left, isNonEmptyReadonlyArray, headNonEmpty, tailNonEmpty, isArray, identity, fromIterable2, fromIterable3, globalValue, contextWithEffect, getOrElse, getOption, appendAll, matchEffect, unify, catchSome, zipRight, matchLeft, pipe, zipLeft, log, succeed2 as succeed2$1, isOption, make4, update, repeatN, get2, getSomes, map, zipWith, make3, as, prepend, make, isEmpty, empty2, isEmptyReadonlyArray, of, catchTag, isTagged, die, isConfigError, isMissingDataOnly, filterMap, get, every, mapBoth, zip, forEach, _void, orElse, match2, join as join$1, isConfig, isObject, toStringUnknown, isSome, getOrThrow, try_, flatMap2, unsafeGet, drop, splitAt, tap, take, reduceRight, withMinimumLogLevel, error, mapInput, boolean, sort, contains, append, fromNullable, catchTags, when, set, pipeArguments, head, make10 as make10$1, suspend, get4, allocate, gen, updateAndGet, span, some2, sync, orElse2, has2, filter2, Config_exports, is, decodeUnknown, String$, fromString, make7 as make7$1, orElseFail, orDie, compose, NumberFromString, Int, Date$, findFirst, allLevels, updateEffect, flatten, fnUntraced, scoped, isNone, Literal, unlessEffect, asVoid, catchIf, runSync, of3 as of3$1, match3, filterOrDieMessage, filter3, isEffect, taggedEnum, round, ensuring, cons, dieMessage, value, when2, orElse3, isNil, matchRight, symbol2, symbol, cached, findFirstIndex, flatMap, findLast, equals, combine, hash, string, string2, provide, provideServiceEffect, provideService, int } from './chunk-STB2U7BB.js';
12
- import './chunk-BVZWLFFT.js';
11
+ import { InitError, FileSystem_exports, ConfigDirError, ImageNotFoundError, FileSystem, isQuitException, PodmanError, Terminal, QuitException, Path } from './chunk-YDQW5IOY.js';
12
+ import { CommitPrototype, dual, GenericTag, fromIterable, failSync, map2, reduce, Schema_exports, Effect_exports, Option_exports, Layer_exports, decode, mapError, TreeFormatter, empty, none, flatMap3, catchAll, match, fail3, map4 as map4$1, merge, some, right, left, isNonEmptyReadonlyArray, headNonEmpty, tailNonEmpty, isArray, identity, fromIterable2, fromIterable3, globalValue, contextWithEffect, getOrElse, getOption, appendAll, matchEffect, unify, catchSome, zipRight, matchLeft, pipe, zipLeft, log, succeed2 as succeed2$1, isOption, make4, update, repeatN, get2, getSomes, map, zipWith, make3, as, prepend, make, isEmpty, empty2, isEmptyReadonlyArray, of, catchTag, isTagged, die, isConfigError, isMissingDataOnly, filterMap, get, every, mapBoth, zip, forEach, _void, orElse, match2, join as join$1, isConfig, isObject, toStringUnknown, isSome, getOrThrow, try_, flatMap2, unsafeGet, drop, splitAt, tap, take, reduceRight, withMinimumLogLevel, error, mapInput, boolean, sort, contains, append, fromNullable, catchTags, when, set, pipeArguments, head, make10 as make10$1, suspend, get4, allocate, gen, updateAndGet, span, some2, sync, orElse2, has2, filter2, Config_exports, is, decodeUnknown, String$, fromString, make7 as make7$1, orElseFail, orDie, compose, NumberFromString, Int, Date$, findFirst, allLevels, updateEffect, flatten, fnUntraced, scoped, isNone, Literal, unlessEffect, asVoid, catchIf, runSync, of3 as of3$1, match3, filterOrDieMessage, filter3, isEffect, taggedEnum, round, ensuring, cons, dieMessage, value, when2, orElse3, isNil, matchRight, symbol2, symbol, cached, findFirstIndex, flatMap, findLast, equals, combine, hash, string, string2, provide, provideServiceEffect, provideService, int } from './chunk-JEQ4IVQM.js';
13
+ import './chunk-4BB7DNPW.js';
13
14
  import { __commonJS, __require, __toESM, __export } from './chunk-6NQPCXSG.js';
14
15
  import * as clack from '@clack/prompts';
15
16
  import { execSync, execFile } from 'child_process';
@@ -18266,7 +18267,7 @@ ARG AGENT_GID=1000
18266
18267
  RUN groupmod -o -g $AGENT_GID node && usermod -o -u $AGENT_UID -g $AGENT_GID -d /home/agent -m -l agent node
18267
18268
 
18268
18269
  # Install pi coding agent (run as root before USER agent)
18269
- RUN npm install -g @mariozechner/pi-coding-agent
18270
+ RUN npm install -g @earendil-works/pi-coding-agent
18270
18271
 
18271
18272
  USER \${AGENT_UID}:\${AGENT_GID}
18272
18273
 
@@ -18436,7 +18437,7 @@ ANTHROPIC_API_KEY=`,
18436
18437
  setupCommand: `pi "$(cat ${SETUP_ISSUE_TRACKER_PATH})"`,
18437
18438
  hostCli: {
18438
18439
  command: "pi",
18439
- install: "npm install -g @mariozechner/pi-coding-agent"
18440
+ install: "npm install -g @earendil-works/pi-coding-agent"
18440
18441
  }
18441
18442
  },
18442
18443
  {
@@ -18621,7 +18622,13 @@ var ISSUE_TRACKER_REGISTRY = [
18621
18622
  envExample: `# GitHub personal access token \u2014 the agent uses it to read and manage GitHub Issues
18622
18623
  # Create a fine-grained token: https://github.com/settings/personal-access-tokens/new
18623
18624
  # Required repository permissions: Issues (Read and write) and Metadata (Read)
18624
- GH_TOKEN=`
18625
+ # If your prompts have the agent push branches or open pull requests, also grant
18626
+ # Contents (Read and write) and Pull requests (Read and write)
18627
+ GH_TOKEN=
18628
+ # GitHub Enterprise Server hostname, e.g. github.example.com. Leave blank for github.com.
18629
+ GH_HOST=
18630
+ # GitHub Enterprise Server only: uncomment and put the token here instead of GH_TOKEN
18631
+ # GH_ENTERPRISE_TOKEN=`
18625
18632
  },
18626
18633
  {
18627
18634
  name: "beads",
@@ -18736,7 +18743,20 @@ var blankTemplateNextSteps = ({
18736
18743
  `4. Add "sandcastle": "npx tsx .sandcastle/${mainFilename}" to your package.json scripts`,
18737
18744
  `5. ${runStep}`
18738
18745
  ];
18739
- var copyToWorktreeStep = (packageManager) => `Templates use \`copyToWorktree: ["node_modules"]\` to copy your host node_modules into the sandbox for fast startup \u2014 the \`npm install\` in the onSandboxReady hook is a safety net for platform-specific binaries. ${packageManager === "npm" ? "Adjust both if you use a different package manager" : `This project uses ${packageManager}, so change the hook to \`${installCommand(packageManager)}\` and check \`copyToWorktree\` suits it`}`;
18746
+ var imagePackageManagerNote = (packageManager, issueTracker, sandboxProvider) => {
18747
+ const { image } = sandboxProvider;
18748
+ if (image === void 0 || packageManager === "npm") {
18749
+ return "";
18750
+ }
18751
+ const file4 = `.sandcastle/${image.containerfileName}`;
18752
+ if (packageManager === "bun") {
18753
+ return `, then install bun in ${file4}, before its \`USER\` line (\`RUN npm install -g bun\`), and rebuild the image`;
18754
+ }
18755
+ return issueTracker.templateArgs.ISSUE_TRACKER_TOOLS.includes(
18756
+ "corepack enable"
18757
+ ) ? "" : `, then add \`RUN corepack enable\` to ${file4}, before its \`USER\` line, and rebuild the image`;
18758
+ };
18759
+ var copyToWorktreeStep = (packageManager, issueTracker, sandboxProvider) => `Templates use \`copyToWorktree: ["node_modules"]\` to copy your host node_modules into the sandbox for fast startup \u2014 the \`npm install\` in the onSandboxReady hook is a safety net for platform-specific binaries. ${packageManager === "npm" ? "Adjust both if you use a different package manager" : `This project uses ${packageManager}, so change the hook to \`${installCommand(packageManager)}\` and check \`copyToWorktree\` suits it${imagePackageManagerNote(packageManager, issueTracker, sandboxProvider)}`}`;
18740
18760
  var planSchemaStep = (packageManager) => `Install a schema validator for the planner's \`<plan>\` output \u2014 the template uses Zod (\`${addDependencyCommand(packageManager, "zod")}\`), but Valibot, ArkType, or any Standard Schema library works (https://standardschema.dev)`;
18741
18761
  var getNextStepsLines = (template, mainFilename, issueTracker, agent, packageManager, installedDependencies, sandboxProvider = SANDBOX_PROVIDER_REGISTRY[0]) => {
18742
18762
  const runStep = `Run \`${runScriptCommand(packageManager, "sandcastle")}\` to start the agent`;
@@ -18758,7 +18778,7 @@ var getNextStepsLines = (template, mainFilename, issueTracker, agent, packageMan
18758
18778
  `${step++}. Set the required env vars in .sandcastle/.env (see .sandcastle/.env.example)`,
18759
18779
  ...envNotes(issueTracker, agent, sandboxProvider),
18760
18780
  `${step++}. Add "sandcastle": "npx tsx .sandcastle/${mainFilename}" to your package.json scripts`,
18761
- `${step++}. ${copyToWorktreeStep(packageManager)}`
18781
+ `${step++}. ${copyToWorktreeStep(packageManager, issueTracker, sandboxProvider)}`
18762
18782
  ];
18763
18783
  if (needsPlanSchema) {
18764
18784
  lines2.push(`${step++}. ${planSchemaStep(packageManager)}`);
@@ -19094,7 +19114,7 @@ var scaffold = (repoDir, options3) => Effect_exports.gen(function* () {
19094
19114
  }
19095
19115
  return { mainFilename };
19096
19116
  });
19097
- var VERSION = "0.14.0";
19117
+ var VERSION = "0.14.1";
19098
19118
 
19099
19119
  // src/cli.ts
19100
19120
  var imageNameOption = Options_exports.text("image-name").pipe(
@@ -19126,6 +19146,25 @@ var requireConfigDir = (cwd) => FileSystem_exports.FileSystem.pipe(
19126
19146
  ),
19127
19147
  Effect_exports.asVoid
19128
19148
  );
19149
+ var NATIVE_SANDBOX_HINT = "Native sandboxes (bwrap(), seatbelt(), noSandbox()) run without an image, so you only need one for a container sandbox.";
19150
+ var requireBuildFile = (candidates, message) => FileSystem_exports.FileSystem.pipe(
19151
+ Effect_exports.flatMap(
19152
+ (fs) => Effect_exports.all(candidates.map((candidate) => fs.exists(candidate)))
19153
+ ),
19154
+ Effect_exports.catchAll(() => Effect_exports.succeed([false])),
19155
+ Effect_exports.filterOrFail(
19156
+ (found) => found.some(Boolean),
19157
+ () => new ConfigDirError({ message })
19158
+ ),
19159
+ Effect_exports.asVoid
19160
+ );
19161
+ var missingDockerfileMessage = (dockerfileDir) => FileSystem_exports.FileSystem.pipe(
19162
+ Effect_exports.flatMap((fs) => fs.exists(join(dockerfileDir, "Containerfile"))),
19163
+ Effect_exports.orElseSucceed(() => false),
19164
+ Effect_exports.map(
19165
+ (hasContainerfile) => hasContainerfile ? `No Dockerfile found at ${CONFIG_DIR}/Dockerfile, but found ${CONFIG_DIR}/Containerfile: this project was scaffolded for podman. Run \`sandcastle podman build-image\`, or pass --dockerfile ${CONFIG_DIR}/Containerfile.` : `No Dockerfile found at ${CONFIG_DIR}/Dockerfile. ${NATIVE_SANDBOX_HINT} To build one, add ${CONFIG_DIR}/Dockerfile or pass --dockerfile <path>.`
19166
+ )
19167
+ );
19129
19168
  var nonInteractiveMessage = (flags) => `${flags.join(", ")} ${flags.length === 1 ? "is" : "are"} required in non-interactive mode (no TTY detected).`;
19130
19169
  var failInitUnless = (ok, message) => ok ? Effect_exports.void : Effect_exports.fail(new InitError({ message }));
19131
19170
  var registryEntry = (entry, what) => entry === void 0 ? Effect_exports.fail(new InitError({ message: `Unknown ${what}` })) : Effect_exports.succeed(entry);
@@ -19394,7 +19433,7 @@ var offerSandcastleLabel = (selection, choice4, context) => Effect_exports.gen(f
19394
19433
  if (shouldCreateLabel) {
19395
19434
  yield* Effect_exports.try({
19396
19435
  try: () => execSync(
19397
- 'gh label create "Sandcastle" --description "Issues for Sandcastle to work on" --color "F9A825" 2>/dev/null',
19436
+ 'gh label create "Sandcastle" --description "Issues for Sandcastle to work on" --color "F9A825"',
19398
19437
  { cwd: context.cwd, stdio: "ignore" }
19399
19438
  ),
19400
19439
  catch: () => void 0
@@ -19628,6 +19667,13 @@ var buildImageCommand = Command_exports.make(
19628
19667
  const imageName = resolveImageName(imageNameFlag, cwd);
19629
19668
  const dockerfileDir = join(cwd, CONFIG_DIR);
19630
19669
  const dockerfilePath = dockerfile._tag === "Some" ? dockerfile.value : void 0;
19670
+ yield* dockerfilePath === void 0 ? requireBuildFile(
19671
+ [join(dockerfileDir, "Dockerfile")],
19672
+ yield* missingDockerfileMessage(dockerfileDir)
19673
+ ) : requireBuildFile(
19674
+ [resolve(dockerfilePath)],
19675
+ `Dockerfile not found: ${dockerfilePath}`
19676
+ );
19631
19677
  yield* d.spinner(
19632
19678
  `Building Docker image '${imageName}'...`,
19633
19679
  buildImage(imageName, dockerfileDir, {
@@ -19684,6 +19730,16 @@ var podmanBuildImageCommand = Command_exports.make(
19684
19730
  const imageName = resolveImageName(imageNameFlag, cwd);
19685
19731
  const containerfileDir = join(cwd, CONFIG_DIR);
19686
19732
  const containerfilePath = containerfile._tag === "Some" ? containerfile.value : void 0;
19733
+ yield* containerfilePath === void 0 ? requireBuildFile(
19734
+ [
19735
+ join(containerfileDir, "Containerfile"),
19736
+ join(containerfileDir, "Dockerfile")
19737
+ ],
19738
+ `No Containerfile or Dockerfile found in ${CONFIG_DIR}/. ${NATIVE_SANDBOX_HINT} To build one, add ${CONFIG_DIR}/Containerfile or pass --containerfile <path>.`
19739
+ ) : requireBuildFile(
19740
+ [resolve(containerfilePath)],
19741
+ `Containerfile not found: ${containerfilePath}`
19742
+ );
19687
19743
  yield* d.spinner(
19688
19744
  `Building Podman image '${imageName}'...`,
19689
19745
  buildImage2(imageName, containerfileDir, {