@oodarun/cli 0.1.9 → 0.1.11
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.
- package/dist/cli.js +43 -30
- 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
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
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);
|
|
@@ -2358,7 +2358,16 @@ async function setupClaudeAuth(projectName, token, claudeToken, onProgress, clau
|
|
|
2358
2358
|
});
|
|
2359
2359
|
}
|
|
2360
2360
|
onProgress({ step: "Setting up Claude auth..." });
|
|
2361
|
-
await writeFile(
|
|
2361
|
+
await writeFile(
|
|
2362
|
+
"/home/user/.claude.json",
|
|
2363
|
+
JSON.stringify({
|
|
2364
|
+
hasCompletedOnboarding: true,
|
|
2365
|
+
theme: "dark",
|
|
2366
|
+
numStartups: 10,
|
|
2367
|
+
autoUpdates: false,
|
|
2368
|
+
bypassPermissions: true
|
|
2369
|
+
})
|
|
2370
|
+
);
|
|
2362
2371
|
await writeFile("/tmp/claude-token", claudeToken);
|
|
2363
2372
|
await exec("sed -i '/CLAUDE_CODE_OAUTH_TOKEN/d' /home/user/.bashrc");
|
|
2364
2373
|
await exec('echo "export CLAUDE_CODE_OAUTH_TOKEN=$(cat /tmp/claude-token)" >> /home/user/.bashrc');
|
|
@@ -4620,24 +4629,19 @@ function claudeCredentialTargets(vmHome) {
|
|
|
4620
4629
|
{ dir: `${vmHome}/.config/claude-code`, file: `${vmHome}/.config/claude-code/auth.json` }
|
|
4621
4630
|
];
|
|
4622
4631
|
}
|
|
4623
|
-
function
|
|
4624
|
-
|
|
4625
|
-
|
|
4626
|
-
|
|
4627
|
-
d =
|
|
4628
|
-
if
|
|
4629
|
-
|
|
4630
|
-
d
|
|
4631
|
-
d
|
|
4632
|
-
d.
|
|
4633
|
-
|
|
4634
|
-
d
|
|
4635
|
-
d
|
|
4636
|
-
d.setdefault('trustedDirectories', [])
|
|
4637
|
-
if '${projectRoot}' not in d['trustedDirectories']:
|
|
4638
|
-
d['trustedDirectories'].append('${projectRoot}')
|
|
4639
|
-
with open(p, 'w') as f: json.dump(d, f)
|
|
4640
|
-
" 2>/dev/null`;
|
|
4632
|
+
function mergeOnboardingConfig(existing, projectRoot) {
|
|
4633
|
+
const d = { ...existing };
|
|
4634
|
+
const startups = typeof d.numStartups === "number" ? d.numStartups : 0;
|
|
4635
|
+
d.numStartups = Math.max(startups, 10);
|
|
4636
|
+
d.hasCompletedOnboarding = true;
|
|
4637
|
+
if (d.theme === void 0) d.theme = "dark";
|
|
4638
|
+
if (d.installMethod === void 0) d.installMethod = "cli";
|
|
4639
|
+
d.autoUpdates = false;
|
|
4640
|
+
d.bypassPermissions = true;
|
|
4641
|
+
const trusted = Array.isArray(d.trustedDirectories) ? [...d.trustedDirectories] : [];
|
|
4642
|
+
if (!trusted.includes(projectRoot)) trusted.push(projectRoot);
|
|
4643
|
+
d.trustedDirectories = trusted;
|
|
4644
|
+
return d;
|
|
4641
4645
|
}
|
|
4642
4646
|
|
|
4643
4647
|
// src/cli/session.ts
|
|
@@ -4749,7 +4753,7 @@ async function connectAndRunClaude(projectName, apiToken, claudeToken, projectUr
|
|
|
4749
4753
|
const orgId = getOrgId();
|
|
4750
4754
|
const jwt = getAccessToken();
|
|
4751
4755
|
if (orgId && jwt) {
|
|
4752
|
-
await client.writeFile("/tmp/ooda-org.json", JSON.stringify({ orgId, jwt }));
|
|
4756
|
+
await client.writeFile("/tmp/ooda-org.json", JSON.stringify({ orgId, jwt, projectName }));
|
|
4753
4757
|
}
|
|
4754
4758
|
}
|
|
4755
4759
|
const tokenType = getClaudeTokenType(claudeToken);
|
|
@@ -4769,8 +4773,17 @@ async function connectAndRunClaude(projectName, apiToken, claudeToken, projectUr
|
|
|
4769
4773
|
console.log(` ${c.gray} Tip: Run ${c.cyan}claude login${c.gray} locally so ooda can use the refresh token.${c.reset}`);
|
|
4770
4774
|
}
|
|
4771
4775
|
}
|
|
4772
|
-
|
|
4773
|
-
|
|
4776
|
+
const claudeJsonPath = `${vmHome}/.claude.json`;
|
|
4777
|
+
const existingClaudeJson = await client.readFile(claudeJsonPath).catch(() => "{}");
|
|
4778
|
+
let claudeJson = {};
|
|
4779
|
+
try {
|
|
4780
|
+
const parsed = JSON.parse(existingClaudeJson);
|
|
4781
|
+
if (parsed && typeof parsed === "object") claudeJson = parsed;
|
|
4782
|
+
} catch {
|
|
4783
|
+
}
|
|
4784
|
+
await client.writeFile(
|
|
4785
|
+
claudeJsonPath,
|
|
4786
|
+
JSON.stringify(mergeOnboardingConfig(claudeJson, projectRoot))
|
|
4774
4787
|
);
|
|
4775
4788
|
await client.exec(`sudo chmod -R a+rX ${projectRoot} 2>/dev/null`);
|
|
4776
4789
|
await client.exec(`sudo mkdir -p ${projectRoot}/.claude/commands`);
|
|
@@ -5360,7 +5373,7 @@ async function deployFromGitHubFlow(target, apiToken, claudeToken) {
|
|
|
5360
5373
|
}
|
|
5361
5374
|
|
|
5362
5375
|
// src/cli/index.ts
|
|
5363
|
-
var CLI_VERSION = "0.1.
|
|
5376
|
+
var CLI_VERSION = "0.1.10";
|
|
5364
5377
|
function formatMutationError(result) {
|
|
5365
5378
|
const parts = [];
|
|
5366
5379
|
if (result.status !== void 0) parts.push(String(result.status));
|