@base44-preview/cli 0.2.2-pr.679.27ae567 → 0.2.2-pr.679.e8470cb
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/index.js +30 -13
- package/dist/cli/index.js.map +5 -5
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -246852,16 +246852,22 @@ var GIT_HASH_PATTERN = /^[a-fA-F0-9]{7,64}$/;
|
|
|
246852
246852
|
function isGitCommitHash(value) {
|
|
246853
246853
|
return GIT_HASH_PATTERN.test(value);
|
|
246854
246854
|
}
|
|
246855
|
-
async function
|
|
246855
|
+
async function readGitState(cwd) {
|
|
246856
246856
|
const status = await execa("git", ["status", "--porcelain", "--branch"], {
|
|
246857
246857
|
cwd,
|
|
246858
246858
|
reject: false
|
|
246859
246859
|
});
|
|
246860
246860
|
if (status.exitCode !== 0)
|
|
246861
|
-
return
|
|
246862
|
-
const [
|
|
246861
|
+
return;
|
|
246862
|
+
const [header = "", ...changes] = status.stdout.split(`
|
|
246863
246863
|
`).filter(Boolean);
|
|
246864
|
-
|
|
246864
|
+
const head = await execa("git", ["rev-parse", "--abbrev-ref", "HEAD"], {
|
|
246865
|
+
cwd,
|
|
246866
|
+
reject: false
|
|
246867
|
+
});
|
|
246868
|
+
const branch = head.exitCode === 0 && head.stdout !== "HEAD" ? head.stdout : undefined;
|
|
246869
|
+
const offRemote = branch !== undefined && (!header.includes("...") || /\[(ahead|gone)/.test(header));
|
|
246870
|
+
return { branch, unpushed: changes.length > 0 || offRemote };
|
|
246865
246871
|
}
|
|
246866
246872
|
|
|
246867
246873
|
// src/core/site/git-hash.ts
|
|
@@ -269860,9 +269866,11 @@ async function toImportError(error, viaToken) {
|
|
|
269860
269866
|
hints: known ? [] : fallback.hints
|
|
269861
269867
|
});
|
|
269862
269868
|
}
|
|
269863
|
-
async function uploadSession(appId, content, token) {
|
|
269869
|
+
async function uploadSession(appId, content, { token, sourceBranch } = {}) {
|
|
269864
269870
|
const form = new FormData;
|
|
269865
269871
|
form.append("file", new Blob([content]), "session.jsonl");
|
|
269872
|
+
if (sourceBranch)
|
|
269873
|
+
form.append("source_branch", sourceBranch);
|
|
269866
269874
|
let response;
|
|
269867
269875
|
try {
|
|
269868
269876
|
response = token ? await distribution_default.post(new URL(`/api/apps/${appId}/imported/session-imports`, getBase44ApiUrl()), {
|
|
@@ -270148,22 +270156,31 @@ async function importAction(ctx, link, options, command) {
|
|
|
270148
270156
|
if (content.length > MAX_SESSION_BYTES) {
|
|
270149
270157
|
throw new InvalidInputError("This session is over 25 MB and can't be imported.", { hints: [] });
|
|
270150
270158
|
}
|
|
270151
|
-
|
|
270152
|
-
|
|
270159
|
+
const git = link || options.file ? undefined : await readGitState(process.cwd());
|
|
270160
|
+
if (git?.unpushed && !options.skipPushCheck) {
|
|
270161
|
+
throw new InvalidInputError("Your changes aren't on GitHub yet. Ask the user whether to commit and push them (to a new branch if on main or master), then run this again. If they don't want to, run it again with --skip-push-check.", { hints: [] });
|
|
270153
270162
|
}
|
|
270163
|
+
const note = git?.unpushed ? "Base Code started from what's on GitHub; your local changes aren't included." : undefined;
|
|
270154
270164
|
if (!options.token)
|
|
270155
270165
|
await ensureAuth(ctx);
|
|
270156
270166
|
ctx.log.info("This uploads the full conversation to Base Code.");
|
|
270157
|
-
const imported = await ctx.runTask("Importing session", () => uploadSession(appId, content,
|
|
270167
|
+
const imported = await ctx.runTask("Importing session", () => uploadSession(appId, content, {
|
|
270168
|
+
token: options.token,
|
|
270169
|
+
sourceBranch: git?.branch
|
|
270170
|
+
}));
|
|
270158
270171
|
const url = `${getBase44ApiUrl()}${imported.branchUrl}`;
|
|
270159
270172
|
return {
|
|
270160
|
-
outroMessage:
|
|
270161
|
-
|
|
270162
|
-
|
|
270173
|
+
outroMessage: [
|
|
270174
|
+
`✓ Imported ${imported.turnCount} messages from ${TOOL_LABELS[imported.source]} into branch "${imported.branchName}".`,
|
|
270175
|
+
...note ? [note] : [],
|
|
270176
|
+
`Open it: ${url}`
|
|
270177
|
+
].join(`
|
|
270178
|
+
`),
|
|
270179
|
+
stdout: ctx.jsonMode ? toJsonStdout({ ...imported, url, ...note ? { note } : {} }) : undefined
|
|
270163
270180
|
};
|
|
270164
270181
|
}
|
|
270165
270182
|
function getImportCommand() {
|
|
270166
|
-
return new Base44Command("import", { requireAuth: false }).description("Continue a Claude Code or Codex session in a new Base Code branch").argument("[session-link]", "A claude.ai session address (https://claude.ai/code/session_…)").option("--current", "Import the session this command runs inside").option("--file <path>", "Import this session file as is").option("--token <key>", "One-time import key from Base Code (no login needed)").action(importAction);
|
|
270183
|
+
return new Base44Command("import", { requireAuth: false }).description("Continue a Claude Code or Codex session in a new Base Code branch").argument("[session-link]", "A claude.ai session address (https://claude.ai/code/session_…)").option("--current", "Import the session this command runs inside").option("--file <path>", "Import this session file as is").option("--skip-push-check", "Import even though local changes aren't on GitHub (they won't be included)").option("--token <key>", "One-time import key from Base Code (no login needed)").action(importAction);
|
|
270167
270184
|
}
|
|
270168
270185
|
|
|
270169
270186
|
// src/cli/commands/project/eject.ts
|
|
@@ -274377,4 +274394,4 @@ export {
|
|
|
274377
274394
|
runCLI
|
|
274378
274395
|
};
|
|
274379
274396
|
|
|
274380
|
-
//# debugId=
|
|
274397
|
+
//# debugId=4FCAB34773EFFFE064756E2164756E21
|