feat(cli): implement build --from <git-url> clone + stack detect#262
Merged
Merged
Conversation
Replace the stub for `kind === 'git'` in `buildCmd` with real behavior: - Shallow-clone the repo into a temp directory - Auto-detect stack from package.json / pyproject.toml / Cargo.toml / go.mod - Print structured build summary (project, stack, channel, target) - Add `--keep-clone` flag to retain the cloned repo after build - Clean up temp dir by default on success Other input kinds (url/path/doc) remain stubs — separate PRs. Includes vitest unit tests for the `detectStack` helper covering Node (npm/pnpm/yarn), Python (pip/poetry), Rust, Go, and edge cases. Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
build --fromstub for git URLs with real behavior: shallow-clone → stack detect → structured summary → cleanup.--keep-cloneflag to retain the cloned repo directory after build.detectStack()helper that readspackage.json,pyproject.toml,Cargo.toml, orgo.modat repo root and returns runtime + package manager + project name.--frominput kinds (url/path/doc) remain stubs — handled in follow-up PRs.Relates to: #133
This is PR #1 in a series of small, focused PRs implementing the TODO stubs across the CLI.
Changes
packages/cli/src/commands/build.tsdetectStack(dir)— reads manifest files, returns{ runtime, packageManager, projectName }cloneAndDetect(input)— shallow-clones a git repo into$TMPDIR/sh1pt-build-<name>-<rand>, runsdetectStack, returns clone path + resultbuildCmdaction forkind === 'git': clone, detect, print summary, cleanup (or keep with--keep-clone)packages/cli/src/commands/build.test.ts(new)detectStackusing temp directories with fixture manifest filesTest plan
pnpm test— all 1760 tests pass (632 files), including 10 new build testspnpm typecheck— no new errors (pre-existingscale.tsduplicate identifier issue unchanged)pnpm lint— no lint scripts configured, clean passsh1pt build --from https://github.com/profullstack/sh1ptprints build summarysh1pt build --from https://github.com/profullstack/sh1pt --keep-cloneretains clone dir🤖 Generated with Claude Code