@oodarun/cli 0.1.10 → 0.1.12

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/cli.js +10 -10
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1943,19 +1943,20 @@ curl -s https://ooda.run/api/publish/script > /home/user/.ooda/publish.mjs
1943
1943
  var PUBLISH_SCRIPT = `
1944
1944
  import fs from 'fs';
1945
1945
  import path from 'path';
1946
- import { execSync } from 'child_process';
1947
1946
 
1948
1947
  const MAX_FILE_SIZE = 10 * 1024 * 1024;
1949
1948
 
1950
1949
  // Resolve publish URL and auth \u2014 org mode uses JWT via org proxy
1951
1950
  let PUBLISH_URL = 'https://ooda.run/api/publish';
1952
1951
  let publishToken = process.env.PUBLISH_TOKEN || '';
1952
+ let orgProjectName = '';
1953
1953
  try {
1954
1954
  const orgCreds = JSON.parse(fs.readFileSync('/tmp/ooda-org.json', 'utf-8'));
1955
1955
  if (orgCreds.orgId && orgCreds.jwt) {
1956
1956
  PUBLISH_URL = 'https://api.ooda.run/org/' + orgCreds.orgId + '/publish';
1957
1957
  publishToken = orgCreds.jwt;
1958
1958
  }
1959
+ if (orgCreds.projectName) orgProjectName = orgCreds.projectName;
1959
1960
  } catch {
1960
1961
  // No org credentials \u2014 use default publish endpoint
1961
1962
  }
@@ -1981,12 +1982,11 @@ if (!outputDir) {
1981
1982
 
1982
1983
  console.log('Found build output: ' + outputDir);
1983
1984
 
1984
- let slug;
1985
- try {
1986
- slug = execSync('hostname', { encoding: 'utf-8' }).trim();
1987
- } catch {
1988
- slug = path.basename(projectDir);
1989
- }
1985
+ // Slug = the unique ooda project name (threaded in via /tmp/ooda-org.json),
1986
+ // falling back to the project directory name. NEVER hostname: Cloudflare
1987
+ // Sandbox names every container "cloudchamber", so a hostname-based slug made
1988
+ // every project publish to the same site and overwrite each other.
1989
+ let slug = orgProjectName || path.basename(projectDir);
1990
1990
  slug = slug.toLowerCase().replace(/[^a-z0-9-]/g, '-').replace(/-+/g, '-').replace(/^-|-$/g, '');
1991
1991
  if (slug.length < 3) slug = slug + '-site';
1992
1992
  if (slug.length > 64) slug = slug.slice(0, 64);
@@ -2026,7 +2026,7 @@ if (files.length === 0) {
2026
2026
  process.exit(1);
2027
2027
  }
2028
2028
 
2029
- const body = JSON.stringify({ slug, files });
2029
+ const body = JSON.stringify({ slug, projectName: orgProjectName || undefined, files });
2030
2030
  console.log('Uploading (' + (body.length / 1024 / 1024).toFixed(1) + 'MB)...');
2031
2031
 
2032
2032
  const res = await fetch(PUBLISH_URL, {
@@ -4753,7 +4753,7 @@ async function connectAndRunClaude(projectName, apiToken, claudeToken, projectUr
4753
4753
  const orgId = getOrgId();
4754
4754
  const jwt = getAccessToken();
4755
4755
  if (orgId && jwt) {
4756
- await client.writeFile("/tmp/ooda-org.json", JSON.stringify({ orgId, jwt }));
4756
+ await client.writeFile("/tmp/ooda-org.json", JSON.stringify({ orgId, jwt, projectName }));
4757
4757
  }
4758
4758
  }
4759
4759
  const tokenType = getClaudeTokenType(claudeToken);
@@ -5373,7 +5373,7 @@ async function deployFromGitHubFlow(target, apiToken, claudeToken) {
5373
5373
  }
5374
5374
 
5375
5375
  // src/cli/index.ts
5376
- var CLI_VERSION = "0.1.9";
5376
+ var CLI_VERSION = "0.1.11";
5377
5377
  function formatMutationError(result) {
5378
5378
  const parts = [];
5379
5379
  if (result.status !== void 0) parts.push(String(result.status));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oodarun/cli",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "description": "Launch Claude Code on cloud dev environments",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",