pkgref 0.0.1 → 0.0.2

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # pkgref
2
2
 
3
+ ## 0.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix npx execution and improve package documentation
8
+
3
9
  ## 0.0.1
4
10
 
5
11
  ### Patch Changes
package/README.md CHANGED
@@ -1,40 +1,54 @@
1
1
  # pkgref
2
2
 
3
- [GitHub repository](https://github.com/yue4u/pkgref)
3
+ Clone dependency source repositories and generate a local index of their docs
4
+ and examples for coding agents and humans.
5
+
6
+ Requires Node.js 24+ and Git.
7
+
8
+ ## Usage
9
+
10
+ Run from a project containing `package.json`:
4
11
 
5
12
  ```sh
6
- pnpm dlx pkgref
7
- # list package.json deps in interactive mode for select and clone repo to target dir (default to docs/pkg-reference).
8
- pnpm dlx pkgref --pkgs=react,vitest --dir docs/repo
9
- # specify pkg and dir to clone with cli param
10
- pnpm dlx pkgref update
11
- # fast-forward all clones in docs/pkg-reference
13
+ npx pkgref
12
14
  ```
13
15
 
14
- ## Features
16
+ Use the arrow keys to navigate, Space to select packages, and Enter to confirm.
17
+ pkgref then shows the Git URLs, asks for a target directory (default:
18
+ `docs/pkg-reference`), and offers to link the index from `AGENTS.md`.
15
19
 
16
- - list docs/example dir in cloned repo to root as index markdown for search
20
+ Skip prompts by supplying packages and a target:
17
21
 
18
- ## Future
22
+ ```sh
23
+ npx pkgref --pkgs=react,vitest --dir docs/pkg-reference
24
+ ```
19
25
 
20
- - support more than package.json
26
+ Update every clean clone in the target:
21
27
 
22
- ## Development
28
+ ```sh
29
+ npx pkgref update
30
+ npx pkgref update --dir docs/other-references
31
+ ```
23
32
 
24
- - Install dependencies:
33
+ ## Output
25
34
 
26
- ```bash
27
- vp install
28
- ```
35
+ Repositories are shallow-cloned and deduplicated. `INDEX.md` links to nested
36
+ `doc`, `docs`, `example`, and `examples` directories, or to the repository root
37
+ when none exist. Reruns preserve earlier index entries.
29
38
 
30
- - Run the unit tests:
39
+ pkgref never overwrites a user-owned index or unrelated path. Existing clones
40
+ with local changes are left untouched. Failures return a nonzero exit code
41
+ without discarding successful work.
31
42
 
32
- ```bash
33
- vp test
34
- ```
43
+ See [SPEC.md](./SPEC.md) for the full behavioral contract.
35
44
 
36
- - Build the library:
45
+ ## Development
37
46
 
38
- ```bash
47
+ ```sh
48
+ vp install
49
+ vp check
50
+ vp test
39
51
  vp pack
40
52
  ```
53
+
54
+ [GitHub](https://github.com/yue4u/pkgref)
package/dist/cli.mjs CHANGED
@@ -1,11 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  import { execFile } from "node:child_process";
3
+ import { realpathSync } from "node:fs";
3
4
  import { access, mkdir, readFile, readdir, writeFile } from "node:fs/promises";
4
5
  import { basename, join, relative, resolve, sep } from "node:path";
5
6
  import { parseArgs, promisify } from "node:util";
6
7
  import { cancel, confirm, isCancel, multiselect, note, text } from "@clack/prompts";
7
8
  //#region package.json
8
- var version = "0.0.1";
9
+ var version = "0.0.2";
9
10
  //#endregion
10
11
  //#region src/core.ts
11
12
  const INDEX_MARKER = "<!-- generated by pkgref; do not edit -->";
@@ -459,6 +460,6 @@ async function exists(path) {
459
460
  return false;
460
461
  }
461
462
  }
462
- if (import.meta.url === `file://${process.argv[1]}`) process.exitCode = await runCli();
463
+ if (import.meta.filename === realpathSync(process.argv[1])) process.exitCode = await runCli();
463
464
  //#endregion
464
465
  export { invalidCloneReason, processRepository, pullRepository, resolveRepository, runCli };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pkgref",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "Clone dependency source repositories and index their docs and examples.",
5
5
  "homepage": "https://github.com/yue4u/pkgref#readme",
6
6
  "bugs": {
@@ -34,15 +34,8 @@
34
34
  "vite": "npm:@voidzero-dev/vite-plus-core@0.2.5",
35
35
  "vite-plus": "0.2.5"
36
36
  },
37
- "devEngines": {
38
- "packageManager": {
39
- "name": "pnpm",
40
- "version": "11.17.0",
41
- "onFail": "download"
42
- }
43
- },
44
37
  "engines": {
45
- "node": ">=20"
38
+ "node": ">=24"
46
39
  },
47
40
  "scripts": {
48
41
  "build": "vp pack",