Skip to content

feat(cli): implement build --from <git-url> clone + stack detect#262

Merged
ralyodio merged 1 commit into
profullstack:masterfrom
pxivory-max:feat/build-from-git
May 18, 2026
Merged

feat(cli): implement build --from <git-url> clone + stack detect#262
ralyodio merged 1 commit into
profullstack:masterfrom
pxivory-max:feat/build-from-git

Conversation

@pxivory-max
Copy link
Copy Markdown
Contributor

Summary

  • Replace the build --from stub for git URLs with real behavior: shallow-clone → stack detect → structured summary → cleanup.
  • Add --keep-clone flag to retain the cloned repo directory after build.
  • Export a detectStack() helper that reads package.json, pyproject.toml, Cargo.toml, or go.mod at repo root and returns runtime + package manager + project name.
  • Add vitest unit tests covering Node (npm/pnpm/yarn/packageManager field), Python (pip/poetry), Rust, Go, empty dirs, and multi-manifest precedence.
  • Other --from input 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.ts

  • detectStack(dir) — reads manifest files, returns { runtime, packageManager, projectName }
  • cloneAndDetect(input) — shallow-clones a git repo into $TMPDIR/sh1pt-build-<name>-<rand>, runs detectStack, returns clone path + result
  • buildCmd action for kind === 'git': clone, detect, print summary, cleanup (or keep with --keep-clone)

packages/cli/src/commands/build.test.ts (new)

  • 10 unit tests for detectStack using temp directories with fixture manifest files

Test plan

  • pnpm test — all 1760 tests pass (632 files), including 10 new build tests
  • pnpm typecheck — no new errors (pre-existing scale.ts duplicate identifier issue unchanged)
  • pnpm lint — no lint scripts configured, clean pass
  • Manual: sh1pt build --from https://github.com/profullstack/sh1pt prints build summary
  • Manual: sh1pt build --from https://github.com/profullstack/sh1pt --keep-clone retains clone dir

🤖 Generated with Claude Code

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>
@ralyodio ralyodio merged commit a896efa into profullstack:master May 18, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants