Stage 0: Source Acquisition#
Objective#
Acquire the target software source code for analysis.
Inputs#
repoOrPath: Git URL or local filesystem path
Steps#
- If
repoOrPathis a URL (starts withhttp://,https://,git@):- Clone to
~/.khy/cli-anything/generated/<SOFTWARE>/source/ - Use
git clone --depth 1for efficiency - Extract
<SOFTWARE>name from the URL (last path segment, strip.git)
- Clone to
- If
repoOrPathis a local path:- Verify the path exists and contains source files
- Create a symlink or copy to the working directory
- Infer
<SOFTWARE>name from the directory name
- Detect the software's primary language and build system:
- Python:
setup.py,pyproject.toml,requirements.txt - Node.js:
package.json - C/C++:
CMakeLists.txt,Makefile,configure - Rust:
Cargo.toml - Go:
go.mod - Other: README, docs
- Python:
- Verify the software can be invoked (has a CLI entry point or library API)
Output#
stage0_result.json:
{
"software": "<name>",
"sourcePath": "<path>",
"language": "<primary language>",
"buildSystem": "<build tool>",
"entryPoints": ["<detected CLI commands or main modules>"],
"hasTests": true/false,
"hasDocs": true/false
}