agentful 0.2.0 → 0.2.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 (2) hide show
  1. package/dist/index.cjs +33 -16
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -3044,7 +3044,7 @@ var VERSION, brand, useColor, wrap, paint, sym, ui;
3044
3044
  var init_branding = __esm({
3045
3045
  "src/branding.ts"() {
3046
3046
  "use strict";
3047
- VERSION = "0.2.0" ? "0.2.0" : null.version;
3047
+ VERSION = "0.2.1" ? "0.2.1" : null.version;
3048
3048
  brand = {
3049
3049
  name: "agentful",
3050
3050
  // the command users type
@@ -4395,7 +4395,8 @@ function materializeStarter(name, targetDir, projectName) {
4395
4395
  throw new ApiError(
4396
4396
  0,
4397
4397
  "directory_not_empty",
4398
- `This directory is not empty (found ${blockers.slice(0, 3).join(", ")}${blockers.length > 3 ? ", \u2026" : ""}). \`init --template\` scaffolds into an empty directory only \u2014 it never overwrites your files.`
4398
+ `This directory is not empty (found ${blockers.slice(0, 3).join(", ")}${blockers.length > 3 ? ", \u2026" : ""}). \`init --template\` scaffolds into an empty directory only \u2014 it never overwrites your files.
4399
+ Pass a new folder name instead: \`agentful init --template ${name} my-app\` (creates it for you).`
4399
4400
  );
4400
4401
  }
4401
4402
  let written = 0;
@@ -4419,16 +4420,15 @@ function materializeStarter(name, targetDir, projectName) {
4419
4420
  function slugify(value) {
4420
4421
  return value.toLowerCase().replace(/[^a-z0-9-]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 80);
4421
4422
  }
4423
+ function prepareScaffoldDirectory(baseDir, directory) {
4424
+ const target = (0, import_node_path4.resolve)(baseDir, directory);
4425
+ (0, import_node_fs3.mkdirSync)(target, { recursive: true });
4426
+ return target;
4427
+ }
4422
4428
 
4423
4429
  // src/commands/init.ts
4424
- async function initCommand(opts) {
4430
+ async function initCommand(opts, directory) {
4425
4431
  console.log(banner());
4426
- const existing = readProjectConfig();
4427
- if (existing) {
4428
- ui.info(`Already initialized (project ${existing.projectId} \u2014 "${existing.title}").`);
4429
- ui.info("Delete .agentful/project.json to re-initialize.");
4430
- return;
4431
- }
4432
4432
  if (opts.template && opts.link) {
4433
4433
  throw new ApiError(
4434
4434
  0,
@@ -4436,6 +4436,22 @@ async function initCommand(opts) {
4436
4436
  "--template scaffolds a new project and cannot be combined with --link."
4437
4437
  );
4438
4438
  }
4439
+ if (directory && !opts.template) {
4440
+ throw new ApiError(
4441
+ 0,
4442
+ "invalid_options",
4443
+ "A target directory only makes sense with --template \u2014 plain `init` links the directory you are in."
4444
+ );
4445
+ }
4446
+ if (opts.template && directory) {
4447
+ process.chdir(prepareScaffoldDirectory(process.cwd(), directory));
4448
+ }
4449
+ const existing = readProjectConfig();
4450
+ if (existing) {
4451
+ ui.info(`Already initialized (project ${existing.projectId} \u2014 "${existing.title}").`);
4452
+ ui.info("Delete .agentful/project.json to re-initialize.");
4453
+ return;
4454
+ }
4439
4455
  if (opts.template) {
4440
4456
  const title2 = opts.title?.trim() || (0, import_node_path5.basename)(process.cwd());
4441
4457
  ui.step(`Scaffolding from the ${opts.template} starter\u2026`);
@@ -4465,6 +4481,7 @@ async function initCommand(opts) {
4465
4481
  const config = await createProject(auth, title);
4466
4482
  ui.ok(`Project created (${config.projectId}). Next: \`agentful push\``);
4467
4483
  if (opts.template) {
4484
+ if (directory) ui.info(`Next: \`cd ${directory}\` \u2014 the project lives there now.`);
4468
4485
  ui.info("Run `npm install` before local dev; `agentful push` builds in the cloud either way.");
4469
4486
  ui.info(`Or start the coding agent right away: \`agentful\` (templates: ${STARTER_NAMES.join(", ")}).`);
4470
4487
  }
@@ -5404,9 +5421,9 @@ var contract_default = {
5404
5421
  details: "raw build output excerpt"
5405
5422
  },
5406
5423
  adopted_by: {
5407
- build_engine: ["status", "timestamp", "error", "details", "framework"],
5408
- executor: ["status", "timestamp", "phase", "error"],
5409
- $comment: "Current state, not the target: the engine writes no phase codes and neither builder writes build_id/started_at/status:running yet. Full adoption is AP4 (engine) + AP5 (executor); until then the CLI must not poll against build identity \u2014 it uses the timestamp freshness guard instead."
5424
+ build_engine: ["schema_version", "build_id", "started_at", "status", "timestamp", "phase", "error", "details", "framework"],
5425
+ executor: ["schema_version", "build_id", "started_at", "status", "timestamp", "phase", "error"],
5426
+ $comment: "Both builders write the attempt identity since AP4/AP5 (2026-08-18); failures carry phase codes and \u2014 for contract violations \u2014 code/reason/hints. The engine additionally writes a running record at start; the executor has no separate build-start moment (started_at is the turn start) and writes no running record. The CLI may graduate from timestamp freshness to identity-based polling for the ENGINE path."
5410
5427
  }
5411
5428
  }
5412
5429
  };
@@ -6688,7 +6705,7 @@ async function tuiCommand(opts = {}) {
6688
6705
  }
6689
6706
  console.log("");
6690
6707
  if (process.stdout.isTTY) process.stdout.write(`\x1B]0;${brand.displayName}\x07`);
6691
- const code = await new Promise((resolve) => {
6708
+ const code = await new Promise((resolve2) => {
6692
6709
  const engineArgs = opts.session ? ["--session", opts.session] : [];
6693
6710
  const child = (0, import_node_child_process5.spawn)(binPath, engineArgs, {
6694
6711
  stdio: "inherit",
@@ -6715,10 +6732,10 @@ async function tuiCommand(opts = {}) {
6715
6732
  ...session.image_model ? { IMAGE_MODEL: session.image_model } : {}
6716
6733
  }
6717
6734
  });
6718
- child.on("exit", (c) => resolve(c ?? 0));
6735
+ child.on("exit", (c) => resolve2(c ?? 0));
6719
6736
  child.on("error", (err2) => {
6720
6737
  ui.fail(`Could not start the engine: ${err2.message}`);
6721
- resolve(1);
6738
+ resolve2(1);
6722
6739
  });
6723
6740
  });
6724
6741
  try {
@@ -6992,7 +7009,7 @@ program2.name("agentful").description("Agentful in your terminal \u2014 local de
6992
7009
  program2.command("login").description("Sign in to your Agentful account (device flow)").option("--no-browser", "do not open the browser automatically").action(run((opts) => loginCommand({ browser: opts.browser !== false })));
6993
7010
  program2.command("logout").description("Remove the stored credentials").action(run(logoutCommand));
6994
7011
  program2.command("whoami").description("Show the signed-in account").action(run(whoamiCommand));
6995
- program2.command("init").description("Create (or link) the Agentful cloud project for this directory").option("--link <projectId>", "link an existing project instead of creating one").option("--title <title>", "project title (skips the prompt)").option("--template <framework>", "scaffold this empty directory from a platform starter (nextjs, react, vue, vanilla)").action(run((opts) => initCommand(opts)));
7012
+ program2.command("init").description("Create (or link) the Agentful cloud project for this directory").argument("[directory]", "with --template: new folder to scaffold into (created for you)").option("--link <projectId>", "link an existing project instead of creating one").option("--title <title>", "project title (skips the prompt)").option("--template <framework>", "scaffold from a platform starter (nextjs, react, vue, vanilla)").action(run((directory, opts) => initCommand(opts, directory)));
6996
7013
  program2.command("push").description("Upload this project and get a live preview URL").option("--prebuilt", "upload a locally built output instead of building in the cloud").option("--dir <path>", "built-output directory for --prebuilt (default: auto-detect)").option("--force", "push even when the pre-upload compatibility check finds blocking issues").action(run((opts) => pushCommand(opts)));
6997
7014
  program2.command("build-status").description("Show the cloud's record of the last build (the real error on failures)").action(run(buildStatusCommand));
6998
7015
  program2.command("open").description("Open the live preview in the browser").action(run(openCommand));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentful",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Agentful in your terminal — local development with push-to-cloud previews",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://agentful.dev",