@genex-ai/cli-demo 1.10.0-dev.525 → 1.10.2-dev.527

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.js +61 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -5306,6 +5306,7 @@ async function pushSource(cwd, ctx, log, branch = "main", expectStagingCommit, o
5306
5306
  if (!fresh) return false;
5307
5307
  return pushWorktree(cwd, fresh.pushUrl, fresh.managed, log, ref, onCommit);
5308
5308
  }
5309
+ var WORKSPACE_SOURCE_REF = "workspace";
5309
5310
  async function pushWorktree(cwd, pushUrl, managed, log, branch = "main", onCommit) {
5310
5311
  const EMPTY_TREE = "4b825dc642cb6eb9a060e54bf8d69288fbee4904";
5311
5312
  const failed = () => {
@@ -6658,6 +6659,61 @@ async function runAcceptCommand(opts) {
6658
6659
  if (!ok) process.exitCode = 1;
6659
6660
  }
6660
6661
 
6662
+ // src/commands/save.ts
6663
+ async function runSave(opts) {
6664
+ const log = createLogger({ quiet: opts.quiet });
6665
+ const meta = await readProject();
6666
+ if (!meta?.id) {
6667
+ log.error("This folder isn't linked to a game.");
6668
+ process.exitCode = 1;
6669
+ return;
6670
+ }
6671
+ const token = await readUserToken(opts.envPath);
6672
+ if (!token) {
6673
+ log.error("Not signed in.");
6674
+ process.exitCode = 1;
6675
+ return;
6676
+ }
6677
+ const apiUrl = meta.apiUrl ?? getApiUrl();
6678
+ let res;
6679
+ try {
6680
+ res = await apiFetch(`${apiUrl}/api/projects/${meta.id}/push-token`, {
6681
+ method: "POST",
6682
+ headers: {
6683
+ Authorization: `Bearer ${token}`,
6684
+ // Says which ref the bytes are headed for, which is what makes this
6685
+ // exempt from the staging-pointer precondition: that guard exists so a
6686
+ // hosted session cannot replace a build pushed from someone's other
6687
+ // machine, and nothing but this session ever writes `workspace`.
6688
+ // Advisory like the `read` intent beside it — the minted token is
6689
+ // read+write either way — so it steers the honest path rather than
6690
+ // enforcing one.
6691
+ "X-Genex-Source-Intent": "workspace"
6692
+ }
6693
+ });
6694
+ } catch (err) {
6695
+ log.error(`Couldn't reach the API to authorize the save: ${String(err)}`);
6696
+ process.exitCode = 1;
6697
+ return;
6698
+ }
6699
+ if (!res.ok) {
6700
+ log.error(`Couldn't authorize the save (HTTP ${res.status}).`);
6701
+ process.exitCode = 1;
6702
+ return;
6703
+ }
6704
+ const data = await res.json().catch(() => null);
6705
+ if (!data?.pushUrl) {
6706
+ log.error("The API didn't return a push URL.");
6707
+ process.exitCode = 1;
6708
+ return;
6709
+ }
6710
+ if (!await pushWorktree(process.cwd(), data.pushUrl, true, log, WORKSPACE_SOURCE_REF)) {
6711
+ process.exitCode = 1;
6712
+ return;
6713
+ }
6714
+ log.success("Workspace saved.");
6715
+ }
6716
+
6661
6717
  // src/lib/rollback.ts
6662
6718
  async function readPreviousVersion(apiUrl, projectId, token, log) {
6663
6719
  let res;
@@ -22608,6 +22664,11 @@ async function main() {
22608
22664
  case "accept":
22609
22665
  await runAcceptCommand(parsed.options);
22610
22666
  break;
22667
+ // Hidden from --help on purpose: plumbing the hosted runner calls on its
22668
+ // way out, not a verb a person needs.
22669
+ case "save":
22670
+ await runSave(parsed.options);
22671
+ break;
22611
22672
  case "rollback":
22612
22673
  await runRollback(parsed.options);
22613
22674
  break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@genex-ai/cli-demo",
3
- "version": "1.10.0-dev.525",
3
+ "version": "1.10.2-dev.527",
4
4
  "description": "Set up your project's agent workspace (.claude/.codex/.cursor in the game folder), authorize, create a game project, generate AI assets, and publish (genex CLI).",
5
5
  "type": "module",
6
6
  "bin": {