library-skills 0.0.4 → 0.0.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "library-skills",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "description": "Library Skills, AI Agents using libraries, as intended, always up to date.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -45,7 +45,7 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "@inquirer/checkbox": "^5.1.4",
48
- "commander": "^14.0.3",
48
+ "commander": "^15.0.0",
49
49
  "csv-parse": "^6.2.1",
50
50
  "smol-toml": "^1.6.1"
51
51
  },
@@ -48,6 +48,7 @@ function scanPythonDistributions(sitePackages) {
48
48
  if (found.skills.length === 0) {
49
49
  const fallback = scanEditableDirectUrl({
50
50
  distInfo,
51
+ sitePackages,
51
52
  packageName: dist.name,
52
53
  packageVersion: dist.version,
53
54
  seenSkillDirs
@@ -231,6 +232,7 @@ function isSkillFileRecord(installedPath) {
231
232
  }
232
233
  function scanEditableDirectUrl({
233
234
  distInfo,
235
+ sitePackages,
234
236
  packageName,
235
237
  packageVersion,
236
238
  seenSkillDirs
@@ -245,6 +247,9 @@ function scanEditableDirectUrl({
245
247
  if (!isRelativeTo(resolvedSkillMd, sourceRoot)) {
246
248
  continue;
247
249
  }
250
+ if (sitePackages && isRelativeTo(resolvedSkillMd, sitePackages)) {
251
+ continue;
252
+ }
248
253
  const skillDir = dirname(resolvedSkillMd);
249
254
  if (seenSkillDirs.has(skillDir)) {
250
255
  continue;
package/ts/dist/cli.js CHANGED
@@ -62,6 +62,7 @@ function scanPythonDistributions(sitePackages) {
62
62
  if (found.skills.length === 0) {
63
63
  const fallback = scanEditableDirectUrl({
64
64
  distInfo,
65
+ sitePackages,
65
66
  packageName: dist.name,
66
67
  packageVersion: dist.version,
67
68
  seenSkillDirs
@@ -245,6 +246,7 @@ function isSkillFileRecord(installedPath) {
245
246
  }
246
247
  function scanEditableDirectUrl({
247
248
  distInfo,
249
+ sitePackages,
248
250
  packageName,
249
251
  packageVersion,
250
252
  seenSkillDirs
@@ -259,6 +261,9 @@ function scanEditableDirectUrl({
259
261
  if (!isRelativeTo(resolvedSkillMd, sourceRoot)) {
260
262
  continue;
261
263
  }
264
+ if (sitePackages && isRelativeTo(resolvedSkillMd, sitePackages)) {
265
+ continue;
266
+ }
262
267
  const skillDir = dirname(resolvedSkillMd);
263
268
  if (seenSkillDirs.has(skillDir)) {
264
269
  continue;
@@ -653,11 +658,11 @@ function isDirectory2(path) {
653
658
  }
654
659
 
655
660
  // ts/src/python-env.ts
656
- import { readdirSync as readdirSync3, statSync as statSync3 } from "fs";
661
+ import { readFileSync as readFileSync3, readdirSync as readdirSync3, statSync as statSync3 } from "fs";
657
662
  import { dirname as dirname3, isAbsolute as isAbsolute2, join as join4, resolve as resolve3, sep } from "path";
658
663
  function findProjectRoot(cwd) {
659
664
  for (const directory of ancestors(cwd)) {
660
- if (isFile(join4(directory, "pyproject.toml")) || isFile(join4(directory, "uv.lock")) || isFile(join4(directory, ".venv", "pyvenv.cfg")) || isFile(join4(directory, "package.json")) || isDirectory3(join4(directory, "node_modules"))) {
665
+ if (isFile(join4(directory, "pyproject.toml")) || isFile(join4(directory, "uv.lock")) || venvFromDotVenv(directory) !== null || isFile(join4(directory, "package.json")) || isDirectory3(join4(directory, "node_modules"))) {
661
666
  return directory;
662
667
  }
663
668
  }
@@ -673,9 +678,9 @@ function findVenv(cwd = process.cwd()) {
673
678
  }
674
679
  }
675
680
  for (const directory of ancestors(cwd)) {
676
- const dotVenv = join4(directory, ".venv");
677
- if (isVenvDir(dotVenv)) {
678
- return dotVenv;
681
+ const venv = venvFromDotVenv(directory);
682
+ if (venv !== null) {
683
+ return venv;
679
684
  }
680
685
  }
681
686
  const virtualEnv = process.env["VIRTUAL_ENV"];
@@ -719,6 +724,30 @@ function findNodeModules(cwd = process.cwd()) {
719
724
  function isVenvDir(directory) {
720
725
  return isFile(join4(directory, "pyvenv.cfg"));
721
726
  }
727
+ function venvFromDotVenv(projectRoot) {
728
+ const dotVenv = join4(projectRoot, ".venv");
729
+ if (isDirectory3(dotVenv)) {
730
+ return isVenvDir(dotVenv) ? dotVenv : null;
731
+ }
732
+ if (isFile(dotVenv)) {
733
+ return readVenvRedirectFile(dotVenv);
734
+ }
735
+ return null;
736
+ }
737
+ function readVenvRedirectFile(path) {
738
+ let content;
739
+ try {
740
+ content = readFileSync3(path, "utf8");
741
+ } catch {
742
+ return null;
743
+ }
744
+ const redirect = content.split(/\r?\n/, 1)[0];
745
+ if (!redirect) {
746
+ return null;
747
+ }
748
+ const venv = isAbsolute2(redirect) ? redirect : join4(dirname3(path), redirect);
749
+ return isVenvDir(venv) ? venv : null;
750
+ }
722
751
  function ancestors(start) {
723
752
  const result = [];
724
753
  let directory = resolve3(start);
package/ts/dist/deps.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  normalizePackageName
3
- } from "./chunk-UGJ6NJYF.js";
3
+ } from "./chunk-DKDHRFD4.js";
4
4
 
5
5
  // ts/src/deps.ts
6
6
  import { existsSync, readFileSync } from "fs";
@@ -31,7 +31,7 @@ var import_node_fs = require("fs");
31
31
  var import_node_path = require("path");
32
32
  function findProjectRoot(cwd) {
33
33
  for (const directory of ancestors(cwd)) {
34
- if (isFile((0, import_node_path.join)(directory, "pyproject.toml")) || isFile((0, import_node_path.join)(directory, "uv.lock")) || isFile((0, import_node_path.join)(directory, ".venv", "pyvenv.cfg")) || isFile((0, import_node_path.join)(directory, "package.json")) || isDirectory((0, import_node_path.join)(directory, "node_modules"))) {
34
+ if (isFile((0, import_node_path.join)(directory, "pyproject.toml")) || isFile((0, import_node_path.join)(directory, "uv.lock")) || venvFromDotVenv(directory) !== null || isFile((0, import_node_path.join)(directory, "package.json")) || isDirectory((0, import_node_path.join)(directory, "node_modules"))) {
35
35
  return directory;
36
36
  }
37
37
  }
@@ -47,9 +47,9 @@ function findVenv(cwd = process.cwd()) {
47
47
  }
48
48
  }
49
49
  for (const directory of ancestors(cwd)) {
50
- const dotVenv = (0, import_node_path.join)(directory, ".venv");
51
- if (isVenvDir(dotVenv)) {
52
- return dotVenv;
50
+ const venv = venvFromDotVenv(directory);
51
+ if (venv !== null) {
52
+ return venv;
53
53
  }
54
54
  }
55
55
  const virtualEnv = process.env["VIRTUAL_ENV"];
@@ -94,6 +94,30 @@ function findNodeModules(cwd = process.cwd()) {
94
94
  function isVenvDir(directory) {
95
95
  return isFile((0, import_node_path.join)(directory, "pyvenv.cfg"));
96
96
  }
97
+ function venvFromDotVenv(projectRoot) {
98
+ const dotVenv = (0, import_node_path.join)(projectRoot, ".venv");
99
+ if (isDirectory(dotVenv)) {
100
+ return isVenvDir(dotVenv) ? dotVenv : null;
101
+ }
102
+ if (isFile(dotVenv)) {
103
+ return readVenvRedirectFile(dotVenv);
104
+ }
105
+ return null;
106
+ }
107
+ function readVenvRedirectFile(path) {
108
+ let content;
109
+ try {
110
+ content = (0, import_node_fs.readFileSync)(path, "utf8");
111
+ } catch {
112
+ return null;
113
+ }
114
+ const redirect = content.split(/\r?\n/, 1)[0];
115
+ if (!redirect) {
116
+ return null;
117
+ }
118
+ const venv = (0, import_node_path.isAbsolute)(redirect) ? redirect : (0, import_node_path.join)((0, import_node_path.dirname)(path), redirect);
119
+ return isVenvDir(venv) ? venv : null;
120
+ }
97
121
  function ancestors(start) {
98
122
  const result = [];
99
123
  let directory = (0, import_node_path.resolve)(start);
@@ -1,9 +1,9 @@
1
1
  // ts/src/python-env.ts
2
- import { readdirSync, statSync } from "fs";
2
+ import { readFileSync, readdirSync, statSync } from "fs";
3
3
  import { dirname, isAbsolute, join, resolve, sep } from "path";
4
4
  function findProjectRoot(cwd) {
5
5
  for (const directory of ancestors(cwd)) {
6
- if (isFile(join(directory, "pyproject.toml")) || isFile(join(directory, "uv.lock")) || isFile(join(directory, ".venv", "pyvenv.cfg")) || isFile(join(directory, "package.json")) || isDirectory(join(directory, "node_modules"))) {
6
+ if (isFile(join(directory, "pyproject.toml")) || isFile(join(directory, "uv.lock")) || venvFromDotVenv(directory) !== null || isFile(join(directory, "package.json")) || isDirectory(join(directory, "node_modules"))) {
7
7
  return directory;
8
8
  }
9
9
  }
@@ -19,9 +19,9 @@ function findVenv(cwd = process.cwd()) {
19
19
  }
20
20
  }
21
21
  for (const directory of ancestors(cwd)) {
22
- const dotVenv = join(directory, ".venv");
23
- if (isVenvDir(dotVenv)) {
24
- return dotVenv;
22
+ const venv = venvFromDotVenv(directory);
23
+ if (venv !== null) {
24
+ return venv;
25
25
  }
26
26
  }
27
27
  const virtualEnv = process.env["VIRTUAL_ENV"];
@@ -66,6 +66,30 @@ function findNodeModules(cwd = process.cwd()) {
66
66
  function isVenvDir(directory) {
67
67
  return isFile(join(directory, "pyvenv.cfg"));
68
68
  }
69
+ function venvFromDotVenv(projectRoot) {
70
+ const dotVenv = join(projectRoot, ".venv");
71
+ if (isDirectory(dotVenv)) {
72
+ return isVenvDir(dotVenv) ? dotVenv : null;
73
+ }
74
+ if (isFile(dotVenv)) {
75
+ return readVenvRedirectFile(dotVenv);
76
+ }
77
+ return null;
78
+ }
79
+ function readVenvRedirectFile(path) {
80
+ let content;
81
+ try {
82
+ content = readFileSync(path, "utf8");
83
+ } catch {
84
+ return null;
85
+ }
86
+ const redirect = content.split(/\r?\n/, 1)[0];
87
+ if (!redirect) {
88
+ return null;
89
+ }
90
+ const venv = isAbsolute(redirect) ? redirect : join(dirname(path), redirect);
91
+ return isVenvDir(venv) ? venv : null;
92
+ }
69
93
  function ancestors(start) {
70
94
  const result = [];
71
95
  let directory = resolve(start);
@@ -61,6 +61,7 @@ function scanPythonDistributions(sitePackages) {
61
61
  if (found.skills.length === 0) {
62
62
  const fallback = scanEditableDirectUrl({
63
63
  distInfo,
64
+ sitePackages,
64
65
  packageName: dist.name,
65
66
  packageVersion: dist.version,
66
67
  seenSkillDirs
@@ -244,6 +245,7 @@ function isSkillFileRecord(installedPath) {
244
245
  }
245
246
  function scanEditableDirectUrl({
246
247
  distInfo,
248
+ sitePackages,
247
249
  packageName,
248
250
  packageVersion,
249
251
  seenSkillDirs
@@ -258,6 +260,9 @@ function scanEditableDirectUrl({
258
260
  if (!isRelativeTo(resolvedSkillMd, sourceRoot)) {
259
261
  continue;
260
262
  }
263
+ if (sitePackages && isRelativeTo(resolvedSkillMd, sitePackages)) {
264
+ continue;
265
+ }
261
266
  const skillDir = (0, import_node_path.dirname)(resolvedSkillMd);
262
267
  if (seenSkillDirs.has(skillDir)) {
263
268
  continue;
@@ -21,8 +21,9 @@ declare function iterNodePackageRoots(nodeModules: string): string[];
21
21
  declare function readNodePackageInfo(packageRoot: string): DistributionInfo | null;
22
22
  declare function findNodeSkillMarkdownFiles(packageRoot: string): string[];
23
23
  declare function isSkillFileRecord(installedPath: string): boolean;
24
- declare function scanEditableDirectUrl({ distInfo, packageName, packageVersion, seenSkillDirs, }: {
24
+ declare function scanEditableDirectUrl({ distInfo, sitePackages, packageName, packageVersion, seenSkillDirs, }: {
25
25
  distInfo: string;
26
+ sitePackages?: string;
26
27
  packageName: string;
27
28
  packageVersion: string;
28
29
  seenSkillDirs: Set<string>;
@@ -21,8 +21,9 @@ declare function iterNodePackageRoots(nodeModules: string): string[];
21
21
  declare function readNodePackageInfo(packageRoot: string): DistributionInfo | null;
22
22
  declare function findNodeSkillMarkdownFiles(packageRoot: string): string[];
23
23
  declare function isSkillFileRecord(installedPath: string): boolean;
24
- declare function scanEditableDirectUrl({ distInfo, packageName, packageVersion, seenSkillDirs, }: {
24
+ declare function scanEditableDirectUrl({ distInfo, sitePackages, packageName, packageVersion, seenSkillDirs, }: {
25
25
  distInfo: string;
26
+ sitePackages?: string;
26
27
  packageName: string;
27
28
  packageVersion: string;
28
29
  seenSkillDirs: Set<string>;
@@ -3,7 +3,7 @@ import {
3
3
  scanNodePackages,
4
4
  scanPythonDistributions,
5
5
  testing
6
- } from "./chunk-UGJ6NJYF.js";
6
+ } from "./chunk-DKDHRFD4.js";
7
7
  export {
8
8
  normalizePackageName,
9
9
  scanNodePackages,