@yolo-labs/yolo-cli 0.41.0 → 0.42.0

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.
@@ -44,6 +44,7 @@ export async function runDeployShip(options) {
44
44
  const runBuild = deps.runBuildImpl ?? defaultRunBuild;
45
45
  const readAssetFile = deps.readAssetFileImpl ?? defaultReadAssetFile;
46
46
  const resolveGitSha = deps.resolveGitShaImpl ?? defaultResolveGitSha;
47
+ const resolveRepoOrigin = deps.resolveRepoOriginImpl ?? defaultResolveRepoOrigin;
47
48
  // 1. Link — .yolo/deploy.json with a projectId is the durable bond.
48
49
  const readResult = readConfig(cwd);
49
50
  if (!readResult.ok) {
@@ -210,6 +211,17 @@ export async function runDeployShip(options) {
210
211
  const gitSha = resolveGitSha(cwd);
211
212
  if (gitSha)
212
213
  request.gitSha = gitSha;
214
+ // The source repo these exact bytes were built from. This is the only place
215
+ // in the system that can know it — the server sees a bundle, and the owning
216
+ // workspace may be gone by the time anyone asks. Best-effort in the same
217
+ // shape as gitSha: a non-git directory or a remote-less checkout just ships
218
+ // without it. The server re-normalizes and strips credentials; never assume
219
+ // this string is safe to store as sent.
220
+ const origin = resolveRepoOrigin(cwd);
221
+ if (origin.repoUrl)
222
+ request.repoUrl = origin.repoUrl;
223
+ if (origin.branch)
224
+ request.branch = origin.branch;
213
225
  const started = await startShipLeg(ctx, projectId, request);
214
226
  if (!started.ok)
215
227
  return clientFail(started);
@@ -655,6 +667,42 @@ export function defaultRunBuild(command, cwd, onOutput) {
655
667
  function defaultReadAssetFile(absolutePath) {
656
668
  return fs.readFileSync(absolutePath);
657
669
  }
670
+ /**
671
+ * `git remote get-url origin` + the checked-out branch, best-effort.
672
+ *
673
+ * `origin` specifically, not "any remote": a checkout can carry several, and
674
+ * picking one by guesswork would attribute a site to a fork or a mirror. No
675
+ * origin ⇒ no claim.
676
+ *
677
+ * Deliberately NOT credential-stripped here — normalizing is the server's job
678
+ * (`services/hosting/repo-ref.ts`), and doing it in two places would let the
679
+ * two definitions drift. The URL never leaves this process except over TLS to
680
+ * the deploy API.
681
+ */
682
+ function defaultResolveRepoOrigin(cwd) {
683
+ const git = (args) => {
684
+ try {
685
+ const out = execFileSync('git', args, {
686
+ cwd,
687
+ stdio: ['ignore', 'pipe', 'ignore'],
688
+ timeout: 5000,
689
+ })
690
+ .toString()
691
+ .trim();
692
+ return out.length > 0 ? out : undefined;
693
+ }
694
+ catch {
695
+ return undefined;
696
+ }
697
+ };
698
+ const repoUrl = git(['remote', 'get-url', 'origin']);
699
+ const branch = git(['rev-parse', '--abbrev-ref', 'HEAD']);
700
+ return {
701
+ ...(repoUrl ? { repoUrl } : {}),
702
+ // 'HEAD' is git's detached-HEAD answer, not a branch name.
703
+ ...(branch && branch !== 'HEAD' ? { branch } : {}),
704
+ };
705
+ }
658
706
  function defaultResolveGitSha(cwd) {
659
707
  try {
660
708
  const out = execFileSync('git', ['rev-parse', 'HEAD'], {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yolo-labs/yolo-cli",
3
- "version": "0.41.0",
3
+ "version": "0.42.0",
4
4
  "description": "YOLO Studio substrate CLI \u2014 owns yolo plan/workspace/artifact substrate-tooling commands. Distinct from yolo-code (the agent CLI) and yolo-router (the LLM gateway client).",
5
5
  "license": "MIT",
6
6
  "type": "module",