@paparats/shared 0.2.1 → 0.2.3
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/README.md +50 -4
- package/package.json +6 -3
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @paparats/shared
|
|
2
2
|
|
|
3
|
-
Shared utilities for [Paparats MCP](https://github.com/IBazylchuk/paparats-mcp)
|
|
3
|
+
Shared utilities for [Paparats MCP](https://github.com/IBazylchuk/paparats-mcp) - path validation, gitignore filtering, and language-aware exclude patterns used by the server and CLI packages.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
@@ -8,12 +8,58 @@ Shared utilities for [Paparats MCP](https://github.com/IBazylchuk/paparats-mcp):
|
|
|
8
8
|
npm install @paparats/shared
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## API
|
|
12
|
+
|
|
13
|
+
### Path Validation
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { validateIndexingPaths } from '@paparats/shared';
|
|
17
|
+
|
|
18
|
+
// Rejects absolute paths and path traversal in indexing config
|
|
19
|
+
const errors = validateIndexingPaths(['src', '../etc/passwd']);
|
|
20
|
+
// errors: ['Path traversal not allowed: ../etc/passwd']
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Gitignore Filtering
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
import { createGitignoreFilter, filterFilesByGitignore } from '@paparats/shared';
|
|
27
|
+
|
|
28
|
+
// Per-file check
|
|
29
|
+
const filter = createGitignoreFilter('/path/to/repo');
|
|
30
|
+
if (filter('node_modules/foo.js')) {
|
|
31
|
+
// file is gitignored
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Bulk filter
|
|
35
|
+
const included = filterFilesByGitignore('/path/to/repo', allFiles);
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Exclude Patterns
|
|
12
39
|
|
|
13
40
|
```ts
|
|
14
41
|
import {
|
|
15
|
-
validateIndexingPaths,
|
|
16
|
-
createGitignoreFilter,
|
|
17
42
|
normalizeExcludePatterns,
|
|
43
|
+
getDefaultExcludeForLanguages,
|
|
44
|
+
LANGUAGE_EXCLUDE_DEFAULTS,
|
|
45
|
+
COMMON_EXCLUDE,
|
|
46
|
+
DEFAULT_EXCLUDE_BARE,
|
|
18
47
|
} from '@paparats/shared';
|
|
48
|
+
|
|
49
|
+
// Bare dir names become glob patterns: 'node_modules' -> '**/node_modules/**'
|
|
50
|
+
const patterns = normalizeExcludePatterns(['node_modules', 'dist']);
|
|
51
|
+
|
|
52
|
+
// Get default excludes for specific languages
|
|
53
|
+
const excludes = getDefaultExcludeForLanguages(['typescript', 'python']);
|
|
19
54
|
```
|
|
55
|
+
|
|
56
|
+
## Part of Paparats MCP
|
|
57
|
+
|
|
58
|
+
This package provides shared utilities used by:
|
|
59
|
+
|
|
60
|
+
- **[@paparats/cli](https://www.npmjs.com/package/@paparats/cli)** - CLI tool for project indexing and setup
|
|
61
|
+
- **@paparats/server** - MCP server with semantic code search ([Docker image](https://hub.docker.com/r/ibaz/paparats-server))
|
|
62
|
+
|
|
63
|
+
## License
|
|
64
|
+
|
|
65
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paparats/shared",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "Shared utilities for Paparats MCP
|
|
5
|
+
"description": "Shared utilities for Paparats MCP - path validation, gitignore filtering, language-aware exclude patterns",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "Ilya Bazylchuk",
|
|
8
8
|
"homepage": "https://github.com/IBazylchuk/paparats-mcp#readme",
|
|
@@ -12,7 +12,10 @@
|
|
|
12
12
|
"gitignore",
|
|
13
13
|
"path-validation",
|
|
14
14
|
"exclude-patterns",
|
|
15
|
-
"file-filtering"
|
|
15
|
+
"file-filtering",
|
|
16
|
+
"language-excludes",
|
|
17
|
+
"code-indexing",
|
|
18
|
+
"paparats"
|
|
16
19
|
],
|
|
17
20
|
"repository": {
|
|
18
21
|
"type": "git",
|