cloneproof 0.1.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.
- package/CHANGELOG.md +25 -0
- package/LICENSE +21 -0
- package/README.md +173 -0
- package/action.yml +108 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +1052 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +132 -0
- package/dist/index.js +1066 -0
- package/dist/index.js.map +1 -0
- package/package.json +65 -0
- package/schemas/cloneproof-report.schema.json +132 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to Cloneproof will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project follows semantic versioning while it matures toward a stable API.
|
|
6
|
+
|
|
7
|
+
## [0.1.0] - 2026-05-11
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- Initial TypeScript CLI package with the `cloneproof` binary.
|
|
12
|
+
- `cloneproof run [target]` command for local paths, GitHub HTTPS URLs, and `org/repo` shorthand.
|
|
13
|
+
- Fresh temporary workspace creation for first-time setup checks.
|
|
14
|
+
- Local repository copy flow that excludes `.git`, dependency folders, build output, and real `.env` files.
|
|
15
|
+
- Remote repository clone flow using `git clone --depth 1`.
|
|
16
|
+
- Node.js detection with npm, pnpm, and Yarn package manager detection.
|
|
17
|
+
- Node install, build, and test command execution.
|
|
18
|
+
- Python, Go, Rust, and generic repository diagnosis.
|
|
19
|
+
- README, env example, runtime pin, and Docker file setup checks.
|
|
20
|
+
- Structured JSON report with scoring, warnings, suggestions, and step details.
|
|
21
|
+
- Human-readable terminal output and Markdown rendering for GitHub job summaries.
|
|
22
|
+
- GitHub composite action.
|
|
23
|
+
- Unit and integration tests.
|
|
24
|
+
- JSON schema for Cloneproof reports.
|
|
25
|
+
- CI workflow for typecheck, tests, build, CLI help, and Cloneproof self-check.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 NMSOfficial
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
# cloneproof
|
|
2
|
+
|
|
3
|
+
**Test your repo like a first-time contributor.**
|
|
4
|
+
|
|
5
|
+
Cloneproof is CI for first-time setup. It creates a fresh temporary workspace, clones or copies your repository into it, detects the project type, installs dependencies, runs the checks a new contributor would naturally try, and reports whether the repo can go from clone to green.
|
|
6
|
+
|
|
7
|
+
## Why Cloneproof?
|
|
8
|
+
|
|
9
|
+
A passing build is not the same thing as a passing fresh clone.
|
|
10
|
+
|
|
11
|
+
Most CI jobs run inside a repository that already has the right checkout path, cached dependencies, configured secrets, and contributor knowledge baked into scripts or docs. A new contributor starts from a colder place: they clone the repo, install dependencies, discover missing environment variables, wonder which runtime version to use, and try to run tests.
|
|
12
|
+
|
|
13
|
+
Cloneproof tests that first-time path directly so setup drift becomes visible before someone loses an afternoon to it.
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
Cloneproof is designed to be published to npm later:
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
npm install --save-dev cloneproof
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
For local development in this repository:
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
npm install
|
|
27
|
+
npm run build
|
|
28
|
+
node dist/cli.js --help
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## CLI Usage
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
cloneproof run [target]
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
`target` can be:
|
|
38
|
+
|
|
39
|
+
- `.` or another local path
|
|
40
|
+
- a GitHub HTTPS URL such as `https://github.com/org/repo`
|
|
41
|
+
- a GitHub shorthand such as `org/repo`
|
|
42
|
+
|
|
43
|
+
Examples:
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
cloneproof run .
|
|
47
|
+
cloneproof run NMSOfficial/cloneproof
|
|
48
|
+
cloneproof run https://github.com/NMSOfficial/cloneproof --json
|
|
49
|
+
cloneproof run . --write-report cloneproof-report.json --soft-fail
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Options:
|
|
53
|
+
|
|
54
|
+
```text
|
|
55
|
+
--json Print the structured JSON report
|
|
56
|
+
--write-report <path> Write the JSON report to a file
|
|
57
|
+
--timeout <seconds> Per-command timeout, default 600
|
|
58
|
+
--soft-fail Always exit 0 while still reporting failures
|
|
59
|
+
--skip-tests Do not run detected test commands
|
|
60
|
+
--skip-build Do not run detected build commands
|
|
61
|
+
--verbose Print command progress to stderr
|
|
62
|
+
--no-color Disable colored terminal output
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## GitHub Action Usage
|
|
66
|
+
|
|
67
|
+
Add a workflow such as:
|
|
68
|
+
|
|
69
|
+
```yaml
|
|
70
|
+
name: Cloneproof
|
|
71
|
+
|
|
72
|
+
on:
|
|
73
|
+
pull_request:
|
|
74
|
+
push:
|
|
75
|
+
branches: [main]
|
|
76
|
+
|
|
77
|
+
jobs:
|
|
78
|
+
cloneproof:
|
|
79
|
+
runs-on: ubuntu-latest
|
|
80
|
+
steps:
|
|
81
|
+
- uses: actions/checkout@v4
|
|
82
|
+
- uses: NMSOfficial/cloneproof@v0.1.0
|
|
83
|
+
with:
|
|
84
|
+
target: .
|
|
85
|
+
write_report: cloneproof-report.json
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
The action writes a Markdown report to the GitHub job summary and stores the JSON report at the configured path. It intentionally does not post PR comments in v0.1.0.
|
|
89
|
+
|
|
90
|
+
## Example Report
|
|
91
|
+
|
|
92
|
+
```text
|
|
93
|
+
Cloneproof report
|
|
94
|
+
|
|
95
|
+
Target: NMSOfficial/cloneproof
|
|
96
|
+
Fresh clone: failed
|
|
97
|
+
Score: 43/100
|
|
98
|
+
|
|
99
|
+
Passed:
|
|
100
|
+
- clone
|
|
101
|
+
- detect project
|
|
102
|
+
|
|
103
|
+
Failed:
|
|
104
|
+
- install: pnpm install --frozen-lockfile failed
|
|
105
|
+
|
|
106
|
+
Warnings:
|
|
107
|
+
- DATABASE_URL is used but missing from .env.example
|
|
108
|
+
- Node version is not pinned
|
|
109
|
+
|
|
110
|
+
Suggested fixes:
|
|
111
|
+
1. Add DATABASE_URL to .env.example
|
|
112
|
+
2. Add packageManager to package.json
|
|
113
|
+
3. Pin Node version with .nvmrc or engines.node
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
The JSON report includes timestamps, duration, detected project types, package manager, steps, warnings, and suggestions.
|
|
117
|
+
|
|
118
|
+
## JSON Schema
|
|
119
|
+
|
|
120
|
+
The report format is documented in [`schemas/cloneproof-report.schema.json`](schemas/cloneproof-report.schema.json). Use it to validate reports written by:
|
|
121
|
+
|
|
122
|
+
```sh
|
|
123
|
+
cloneproof run . --write-report cloneproof-report.json
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Supported Ecosystems
|
|
127
|
+
|
|
128
|
+
Cloneproof v0.1.0 supports:
|
|
129
|
+
|
|
130
|
+
- **Node.js**: detects `package.json`, npm, pnpm, and Yarn; installs dependencies; runs `build` and `test` scripts when present.
|
|
131
|
+
- **Python**: detects `pyproject.toml`, `requirements.txt`, and `Pipfile`; installs simple projects; runs `pytest` when tests are present and pytest is installed.
|
|
132
|
+
- **Go**: detects `go.mod`; runs `go mod download` and `go test ./...`.
|
|
133
|
+
- **Rust**: detects `Cargo.toml`; runs `cargo test`.
|
|
134
|
+
- **Generic repositories**: reports that no supported project type was found and suggests adding package metadata or setup instructions.
|
|
135
|
+
|
|
136
|
+
It also checks for README files, missing `.env.example` entries for Node `process.env.X` usage, runtime version pins, and Docker-related files. Docker services are detected but not started in v0.1.0.
|
|
137
|
+
|
|
138
|
+
## Roadmap
|
|
139
|
+
|
|
140
|
+
- Optional service orchestration for Docker Compose.
|
|
141
|
+
- Repository-specific configuration file.
|
|
142
|
+
- Richer framework detection.
|
|
143
|
+
- Dependency cache controls for CI.
|
|
144
|
+
- Pull request annotations and comments.
|
|
145
|
+
- More ecosystems and package managers.
|
|
146
|
+
|
|
147
|
+
## Launch Kit
|
|
148
|
+
|
|
149
|
+
Planning to share Cloneproof? See [docs/launch.md](docs/launch.md) for positioning, launch copy, and suggested GitHub repository metadata.
|
|
150
|
+
|
|
151
|
+
## Contributing
|
|
152
|
+
|
|
153
|
+
Contributions are welcome. Start by running:
|
|
154
|
+
|
|
155
|
+
```sh
|
|
156
|
+
npm install
|
|
157
|
+
npm run typecheck
|
|
158
|
+
npm test
|
|
159
|
+
npm run build
|
|
160
|
+
node dist/cli.js run . --soft-fail --verbose
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Keep changes focused on helping repositories become easier to clone, install, and verify.
|
|
164
|
+
|
|
165
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for local development and pull request guidance.
|
|
166
|
+
|
|
167
|
+
## Security
|
|
168
|
+
|
|
169
|
+
Cloneproof executes install, build, and test commands in a temporary workspace. Review [SECURITY.md](SECURITY.md) before running it on untrusted repositories.
|
|
170
|
+
|
|
171
|
+
## License
|
|
172
|
+
|
|
173
|
+
MIT. See [LICENSE](LICENSE).
|
package/action.yml
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
name: Cloneproof
|
|
2
|
+
description: Test a repository like a first-time contributor from fresh clone to green.
|
|
3
|
+
author: NMSOfficial
|
|
4
|
+
branding:
|
|
5
|
+
icon: check-circle
|
|
6
|
+
color: green
|
|
7
|
+
inputs:
|
|
8
|
+
target:
|
|
9
|
+
description: Local path, GitHub HTTPS URL, or org/repo shorthand to test.
|
|
10
|
+
required: false
|
|
11
|
+
default: "."
|
|
12
|
+
soft_fail:
|
|
13
|
+
description: Always exit successfully while still reporting cloneproof failures.
|
|
14
|
+
required: false
|
|
15
|
+
default: "false"
|
|
16
|
+
skip_tests:
|
|
17
|
+
description: Skip detected test commands.
|
|
18
|
+
required: false
|
|
19
|
+
default: "false"
|
|
20
|
+
skip_build:
|
|
21
|
+
description: Skip detected build commands.
|
|
22
|
+
required: false
|
|
23
|
+
default: "false"
|
|
24
|
+
timeout:
|
|
25
|
+
description: Per-command timeout in seconds.
|
|
26
|
+
required: false
|
|
27
|
+
default: "600"
|
|
28
|
+
write_report:
|
|
29
|
+
description: Path for the JSON report, relative to the workflow workspace unless absolute.
|
|
30
|
+
required: false
|
|
31
|
+
default: cloneproof-report.json
|
|
32
|
+
runs:
|
|
33
|
+
using: composite
|
|
34
|
+
steps:
|
|
35
|
+
- name: Set up Node.js
|
|
36
|
+
uses: actions/setup-node@v4
|
|
37
|
+
with:
|
|
38
|
+
node-version: 20
|
|
39
|
+
- name: Install action dependencies
|
|
40
|
+
shell: bash
|
|
41
|
+
working-directory: ${{ github.action_path }}
|
|
42
|
+
run: npm ci
|
|
43
|
+
- name: Build action CLI
|
|
44
|
+
shell: bash
|
|
45
|
+
working-directory: ${{ github.action_path }}
|
|
46
|
+
run: npm run build
|
|
47
|
+
- name: Run Cloneproof
|
|
48
|
+
shell: bash
|
|
49
|
+
working-directory: ${{ github.workspace }}
|
|
50
|
+
env:
|
|
51
|
+
INPUT_TARGET: ${{ inputs.target }}
|
|
52
|
+
INPUT_SOFT_FAIL: ${{ inputs.soft_fail }}
|
|
53
|
+
INPUT_SKIP_TESTS: ${{ inputs.skip_tests }}
|
|
54
|
+
INPUT_SKIP_BUILD: ${{ inputs.skip_build }}
|
|
55
|
+
INPUT_TIMEOUT: ${{ inputs.timeout }}
|
|
56
|
+
INPUT_WRITE_REPORT: ${{ inputs.write_report }}
|
|
57
|
+
run: |
|
|
58
|
+
set +e
|
|
59
|
+
args=("run" "$INPUT_TARGET" "--write-report" "$INPUT_WRITE_REPORT" "--timeout" "$INPUT_TIMEOUT" "--no-color")
|
|
60
|
+
if [ "$INPUT_SOFT_FAIL" = "true" ]; then
|
|
61
|
+
args+=("--soft-fail")
|
|
62
|
+
fi
|
|
63
|
+
if [ "$INPUT_SKIP_TESTS" = "true" ]; then
|
|
64
|
+
args+=("--skip-tests")
|
|
65
|
+
fi
|
|
66
|
+
if [ "$INPUT_SKIP_BUILD" = "true" ]; then
|
|
67
|
+
args+=("--skip-build")
|
|
68
|
+
fi
|
|
69
|
+
node "$GITHUB_ACTION_PATH/dist/cli.js" "${args[@]}"
|
|
70
|
+
status=$?
|
|
71
|
+
echo "CLONEPROOF_EXIT_CODE=$status" >> "$GITHUB_ENV"
|
|
72
|
+
exit 0
|
|
73
|
+
- name: Write job summary
|
|
74
|
+
if: always()
|
|
75
|
+
shell: bash
|
|
76
|
+
working-directory: ${{ github.workspace }}
|
|
77
|
+
env:
|
|
78
|
+
INPUT_WRITE_REPORT: ${{ inputs.write_report }}
|
|
79
|
+
run: |
|
|
80
|
+
node --input-type=module <<'NODE'
|
|
81
|
+
import { appendFileSync, existsSync, readFileSync } from "node:fs";
|
|
82
|
+
import { isAbsolute, resolve } from "node:path";
|
|
83
|
+
import { pathToFileURL } from "node:url";
|
|
84
|
+
|
|
85
|
+
const reportPath = isAbsolute(process.env.INPUT_WRITE_REPORT)
|
|
86
|
+
? process.env.INPUT_WRITE_REPORT
|
|
87
|
+
: resolve(process.env.GITHUB_WORKSPACE, process.env.INPUT_WRITE_REPORT);
|
|
88
|
+
|
|
89
|
+
if (!existsSync(reportPath)) {
|
|
90
|
+
appendFileSync(process.env.GITHUB_STEP_SUMMARY, "## Cloneproof report\n\nNo report file was produced.\n");
|
|
91
|
+
process.exit(0);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const report = JSON.parse(readFileSync(reportPath, "utf8"));
|
|
95
|
+
const moduleUrl = pathToFileURL(`${process.env.GITHUB_ACTION_PATH}/dist/index.js`).href;
|
|
96
|
+
const { renderMarkdownReport } = await import(moduleUrl);
|
|
97
|
+
appendFileSync(process.env.GITHUB_STEP_SUMMARY, renderMarkdownReport(report));
|
|
98
|
+
NODE
|
|
99
|
+
- name: Enforce Cloneproof result
|
|
100
|
+
if: always()
|
|
101
|
+
shell: bash
|
|
102
|
+
env:
|
|
103
|
+
INPUT_SOFT_FAIL: ${{ inputs.soft_fail }}
|
|
104
|
+
run: |
|
|
105
|
+
if [ "$INPUT_SOFT_FAIL" = "true" ]; then
|
|
106
|
+
exit 0
|
|
107
|
+
fi
|
|
108
|
+
exit "${CLONEPROOF_EXIT_CODE:-1}"
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|