pnpmcheker 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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Omar Del Rio
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,125 @@
1
+ # Bestprac
2
+
3
+ Bestprac checks NPM-based projects for practical best-practice signals without relying on AI for the critical findings.
4
+
5
+ The primary analyzer is deterministic. It reads local project files and reports on:
6
+
7
+ - `package.json` presence and package manager pinning
8
+ - lockfile presence, lockfile conflicts, and lockfile/package-manager mismatch
9
+ - Node runtime support windows and upcoming expiration risk
10
+ - committed npm token risk in `.npmrc`
11
+ - pnpm adoption opportunities and pnpm security settings
12
+ - test, lint, typecheck, CI, and dependency-update automation
13
+ - developer tooling opportunities such as TypeScript, ESLint, Prettier, Vitest/Jest, lockfile-lint, and commit hooks
14
+
15
+ Optional npm registry metadata checks enrich the report with package deprecation and stale package activity. These use the npm registry directly and do not use AI.
16
+
17
+ For projects using pnpm, Bestprac also checks for supply-chain hardening in `pnpm-workspace.yaml`:
18
+
19
+ - `minimumReleaseAge: 1440` or higher
20
+ - `minimumReleaseAgeStrict: true`
21
+ - `trustPolicy: no-downgrade`
22
+ - `blockExoticSubdeps: true` or the modern pnpm default
23
+ - build-script approvals from `pnpm approve-builds`
24
+
25
+ ## Run the App
26
+
27
+ ```bash
28
+ pnpm install
29
+ pnpm build
30
+ pnpm start
31
+ ```
32
+
33
+ Open `http://localhost:4174` and enter the absolute path to an npm project.
34
+
35
+ For live development:
36
+
37
+ ```bash
38
+ pnpm dev
39
+ ```
40
+
41
+ ## CLI
42
+
43
+ ```bash
44
+ pnpm cli /path/to/project
45
+ pnpm cli /path/to/project --no-registry
46
+ pnpm cli /path/to/project --json
47
+ pnpm cli /path/to/project --json --output /tmp/bestprac-report.json --fail-on never
48
+ ```
49
+
50
+ The CLI exits with code `1` when any failing check is present, which makes it usable in CI.
51
+
52
+ Use `--fail-on warn` to fail on warnings and failures, or `--fail-on never` when an agent should always receive a parseable report.
53
+
54
+ ## Single Executable
55
+
56
+ Build a native executable for the current platform:
57
+
58
+ ```bash
59
+ pnpm build:exe
60
+ ```
61
+
62
+ The output is written to `dist/bin/bestprac` on macOS/Linux or `dist/bin/bestprac.exe` on Windows.
63
+
64
+ The builder creates a bundled CLI first, then produces a single executable. It auto-selects the best local builder:
65
+
66
+ - Node SEA when the local Node binary supports `--build-sea` and contains the SEA fuse marker
67
+ - Bun `build --compile` when Bun is available
68
+
69
+ Force a builder with:
70
+
71
+ ```bash
72
+ BESTPRAC_EXECUTABLE_BUILDER=bun pnpm build:exe
73
+ BESTPRAC_EXECUTABLE_BUILDER=node-sea pnpm build:exe
74
+ ```
75
+
76
+ ## Codex Skill
77
+
78
+ A local Codex skill was installed at:
79
+
80
+ ```text
81
+ /Users/omardelrio/.codex/skills/bestprac-check
82
+ ```
83
+
84
+ Agents can invoke it with `$bestprac-check`. Its wrapper script prefers the compiled executable and falls back to the development CLI:
85
+
86
+ ```bash
87
+ node /Users/omardelrio/.codex/skills/bestprac-check/scripts/run-bestprac.mjs /path/to/project --no-registry
88
+ ```
89
+
90
+ ## Secure npm Publishing
91
+
92
+ The publish workflow lives at `.github/workflows/publish-npm.yml` and runs when a GitHub Release is published. It uses npm Trusted Publishing through GitHub Actions OIDC instead of a long-lived `NPM_TOKEN`.
93
+
94
+ Required npm setup:
95
+
96
+ 1. On npmjs.com, open the `bestprac` package settings.
97
+ 2. Add a Trusted Publisher:
98
+ - Provider: GitHub Actions
99
+ - Owner: `omardelrio`
100
+ - Repository: `npmrepocheck`
101
+ - Workflow filename: `publish-npm.yml`
102
+ - Environment name: `npm-publish`
103
+ - Allowed action: `npm publish`
104
+ 3. After the first trusted publish works, set Publishing access to require 2FA and disallow tokens.
105
+ 4. Revoke any old npm automation tokens.
106
+
107
+ Required GitHub setup:
108
+
109
+ 1. Create the `npm-publish` environment.
110
+ 2. Add required reviewers for that environment.
111
+ 3. Restrict who can publish releases or create release tags.
112
+
113
+ Release flow:
114
+
115
+ ```bash
116
+ pnpm version patch
117
+ git push origin main --follow-tags
118
+ gh release create "v$(node -p 'require("./package.json").version')" --generate-notes
119
+ ```
120
+
121
+ The workflow validates lint, formatting, typecheck, tests, build, lockfile policy, and Bestprac before running `npm pack --dry-run` and `npm publish --access public`.
122
+
123
+ ## Notes
124
+
125
+ Node release-line dates are embedded from the Node.js Release Working Group schedule and should be refreshed as upstream dates change.
@@ -0,0 +1,3 @@
1
+ import type { AnalyzeOptions, BestPracticeReport } from "./types.js";
2
+ export declare function analyzeProject(projectPath: string, options?: AnalyzeOptions): Promise<BestPracticeReport>;
3
+ export declare function isDirectory(filePath: string): Promise<boolean>;