agentful 0.4.42 → 0.4.43

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 +13 -8
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -3044,7 +3044,7 @@ var VERSION, brand, useColor, wrap, paint, tuiDesign, sym, ui;
3044
3044
  var init_branding = __esm({
3045
3045
  "src/branding.ts"() {
3046
3046
  "use strict";
3047
- VERSION = "0.4.42" ? "0.4.42" : null.version;
3047
+ VERSION = "0.4.43" ? "0.4.43" : null.version;
3048
3048
  brand = {
3049
3049
  name: "agentful",
3050
3050
  // the command users type
@@ -6377,16 +6377,13 @@ async function linkProject(auth, projectId, title, cwd = process.cwd()) {
6377
6377
  }
6378
6378
  let record;
6379
6379
  try {
6380
- record = await request(
6381
- `${PB_URL}/api/collections/projects/records/${projectId}?fields=id,user_id,responsible_user`,
6382
- { token: auth.pb_token }
6383
- );
6380
+ record = await request(`${PB_URL}/api/projects/${projectId}/view`, { token: auth.pb_token });
6384
6381
  } catch (err2) {
6385
6382
  if (err2 instanceof ApiError && (err2.status === 404 || err2.status === 403)) {
6386
6383
  throw new ApiError(
6387
6384
  err2.status,
6388
6385
  "project_not_found",
6389
- `Project ${projectId} was not found, or you are not the person responsible for it.`
6386
+ `Project ${projectId} was not found, or it is neither yours nor shared with you.`
6390
6387
  );
6391
6388
  }
6392
6389
  throw err2;
@@ -6407,7 +6404,8 @@ async function linkProject(auth, projectId, title, cwd = process.cwd()) {
6407
6404
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
6408
6405
  };
6409
6406
  writeProjectConfig(config, cwd);
6410
- return config;
6407
+ const name2 = record.responsible && typeof record.responsible.name === "string" ? record.responsible.name.trim() : "";
6408
+ return { config, role: typeof record.role === "string" ? record.role : "", responsibleName: name2 };
6411
6409
  }
6412
6410
  async function createProject(auth, title, cwd = process.cwd()) {
6413
6411
  const name2 = (title || "").trim() || (0, import_node_path7.basename)(cwd);
@@ -8435,7 +8433,14 @@ async function initCommand(opts, directory) {
8435
8433
  const auth = await ensureAuth();
8436
8434
  if (opts.link) {
8437
8435
  ui.step(`Linking existing project ${opts.link}\u2026`);
8438
- await linkProject(auth, opts.link, opts.title);
8436
+ const linked = await linkProject(auth, opts.link, opts.title);
8437
+ if (linked.role === "view") {
8438
+ const who = linked.responsibleName || "the person responsible";
8439
+ ui.ok(`Linked. Project ${opts.link} is shared with you to view.`);
8440
+ ui.info("`agentful open` shows the preview, `agentful build-status` the last cloud build.");
8441
+ ui.info(`Push and the coding agent stay with ${who}.`);
8442
+ return;
8443
+ }
8439
8444
  ui.ok(`Linked. \`agentful push\` now deploys to project ${opts.link}.`);
8440
8445
  return;
8441
8446
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentful",
3
- "version": "0.4.42",
3
+ "version": "0.4.43",
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",