fix clone: use sl init+pull instead of sl clone

sl clone uses the getbundle protocol which does not work with Mononoke.
Use the same init+config+pull pattern that already works in grove init.
Anton Kaminsky22d agobf25d29850a3parent 7010ba9
1 file changed+17-12
cli/src/commands/clone.ts
@@ -1,6 +1,6 @@
11import { spinner, log } from "@clack/prompts";
22import { execSync } from "node:child_process";
3import { writeFileSync, existsSync } from "node:fs";
3import { writeFileSync, existsSync, mkdirSync } from "node:fs";
44import { join, resolve } from "node:path";
55import { hubRequest } from "../api.js";
66import { getHub } from "../config.js";
@@ -52,20 +52,25 @@
5252 const dest = args.find((a, i) => i > args.indexOf(slug) && !a.startsWith("--")) ?? repoName;
5353 const destPath = resolve(dest);
5454
55 // Run sl clone
56 log.step(`Cloning into ${dest}`);
55 // Use sl init + pull (not sl clone, which uses getbundle protocol that doesn't work with Mononoke)
56 const hub = await getHub();
57
58 const s2 = spinner();
59 s2.start(`Cloning into ${dest}`);
60 mkdirSync(destPath, { recursive: true });
61 execSync(`sl init --config init.prefer-git=false --config format.use-remotefilelog=true "${destPath}"`, { stdio: "pipe" });
62
63 // Write config with remote and auth settings before pulling
64 writeFileSync(join(destPath, ".sl", "config"), buildSlConfig({ name: repoName, owner_name: owner, default_branch: repo.default_branch }, hub));
65
66 // Pull and checkout
5767 try {
58 execSync(`sl clone slapi:${repoName} ${dest}`, { stdio: "inherit" });
68 execSync(`sl pull`, { cwd: destPath, stdio: "pipe" });
69 execSync(`sl goto ${repo.default_branch}`, { cwd: destPath, stdio: "pipe" });
70 s2.stop(`Cloned ${owner}/${repoName}`);
5971 } catch {
60 // sl clone of empty repos exits non-zero — check if .sl was created
61 if (!existsSync(join(destPath, ".sl"))) {
62 // Clone truly failed
63 process.exit(1);
64 }
72 s2.stop(`Cloned ${owner}/${repoName} (empty repository)`);
6573 }
6674
67 // Write proper .sl/config
68 const hub = await getHub();
69 writeFileSync(join(destPath, ".sl", "config"), buildSlConfig({ name: repoName, owner_name: owner, default_branch: repo.default_branch }, hub));
7075 log.success(`Cloned ${owner}/${repoName} into ${dest}`);
7176}
7277