@voidh4x0r/slopgate 0.0.0-stage → 0.1.1

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.
Files changed (50) hide show
  1. package/CHANGELOG.md +82 -0
  2. package/LICENSE +21 -0
  3. package/README.md +304 -2
  4. package/dist/ast.d.ts +29 -0
  5. package/dist/ast.js +3 -0
  6. package/dist/baseline.d.ts +33 -0
  7. package/dist/baseline.js +104 -0
  8. package/dist/cli.d.ts +9 -0
  9. package/dist/cli.js +487 -0
  10. package/dist/config.d.ts +25 -0
  11. package/dist/config.js +91 -0
  12. package/dist/data/python-stdlib.d.ts +21 -0
  13. package/dist/data/python-stdlib.js +92 -0
  14. package/dist/deps.d.ts +8 -0
  15. package/dist/deps.js +491 -0
  16. package/dist/diff.d.ts +30 -0
  17. package/dist/diff.js +217 -0
  18. package/dist/engine.d.ts +15 -0
  19. package/dist/engine.js +169 -0
  20. package/dist/files.d.ts +33 -0
  21. package/dist/files.js +214 -0
  22. package/dist/mcp.d.ts +41 -0
  23. package/dist/mcp.js +226 -0
  24. package/dist/parser.d.ts +3 -0
  25. package/dist/parser.js +45 -0
  26. package/dist/reporters/github.d.ts +2 -0
  27. package/dist/reporters/github.js +44 -0
  28. package/dist/reporters/json.d.ts +10 -0
  29. package/dist/reporters/json.js +36 -0
  30. package/dist/reporters/pretty.d.ts +12 -0
  31. package/dist/reporters/pretty.js +103 -0
  32. package/dist/reporters/sarif.d.ts +2 -0
  33. package/dist/reporters/sarif.js +75 -0
  34. package/dist/rules/helpers.d.ts +53 -0
  35. package/dist/rules/helpers.js +178 -0
  36. package/dist/rules/index.d.ts +3 -0
  37. package/dist/rules/index.js +4 -0
  38. package/dist/rules/python.d.ts +2 -0
  39. package/dist/rules/python.js +632 -0
  40. package/dist/rules/typescript.d.ts +2 -0
  41. package/dist/rules/typescript.js +563 -0
  42. package/dist/suppress.d.ts +12 -0
  43. package/dist/suppress.js +52 -0
  44. package/dist/types.d.ts +95 -0
  45. package/dist/types.js +1 -0
  46. package/grammars/README.md +28 -0
  47. package/grammars/tree-sitter-python.wasm +0 -0
  48. package/grammars/tree-sitter-tsx.wasm +0 -0
  49. package/grammars/tree-sitter-typescript.wasm +0 -0
  50. package/package.json +61 -4
@@ -0,0 +1,95 @@
1
+ import type { AstNode } from './ast.ts';
2
+ /** Tree-sitter grammars we ship. */
3
+ export type LanguageId = 'python' | 'typescript' | 'tsx';
4
+ /** How sure we are that a finding is worth a human's time. */
5
+ export type Confidence = 'high' | 'medium' | 'low';
6
+ export type Severity = 'error' | 'warning' | 'info';
7
+ /** 1-based line, 1-based column. */
8
+ export interface Position {
9
+ line: number;
10
+ column: number;
11
+ }
12
+ /** A comment node's line span, used for "a comment explains this" decisions. */
13
+ export interface CommentRange {
14
+ startLine: number;
15
+ endLine: number;
16
+ }
17
+ export interface Finding {
18
+ ruleId: string;
19
+ message: string;
20
+ severity: Severity;
21
+ confidence: Confidence;
22
+ /** Repository-relative path, always with forward slashes. */
23
+ file: string;
24
+ start: Position;
25
+ end: Position;
26
+ /** Single-line excerpt of the offending source, trimmed and capped. */
27
+ snippet: string;
28
+ /** Facts a reviewer can check for themselves. */
29
+ evidence: string[];
30
+ help?: string;
31
+ }
32
+ /** What a rule returns; the engine fills in rule id, file and defaults. */
33
+ export interface RuleDraft {
34
+ message: string;
35
+ start: Position;
36
+ end: Position;
37
+ snippet?: string;
38
+ evidence?: string[];
39
+ help?: string;
40
+ confidence?: Confidence;
41
+ severity?: Severity;
42
+ }
43
+ export interface RuleMeta {
44
+ /** Namespaced id, e.g. `py/noop-test`. */
45
+ id: string;
46
+ title: string;
47
+ summary: string;
48
+ severity: Severity;
49
+ confidence: Confidence;
50
+ languages: LanguageId[];
51
+ tags: string[];
52
+ }
53
+ export interface PythonDeps {
54
+ declared: Set<string>;
55
+ manifests: string[];
56
+ /** Top-level module names that exist inside the repository. */
57
+ localModules: Set<string>;
58
+ }
59
+ export interface NodeDeps {
60
+ declared: Set<string>;
61
+ workspaces: Set<string>;
62
+ /** Import aliases declared in tsconfig `compilerOptions.paths`. */
63
+ aliases: string[];
64
+ hasPackageJson: boolean;
65
+ /** Resolvable packages discovered in node_modules (top level and scoped). */
66
+ installed: Set<string>;
67
+ }
68
+ export interface ProjectDeps {
69
+ root: string;
70
+ python: PythonDeps;
71
+ node: NodeDeps;
72
+ /** Module/package names the user told us to trust (`ignoreModules`). */
73
+ ignoredModules: Set<string>;
74
+ }
75
+ export interface RuleContext {
76
+ /** Repository-relative POSIX path. */
77
+ file: string;
78
+ lines: string[];
79
+ root: AstNode;
80
+ language: LanguageId;
81
+ deps: ProjectDeps;
82
+ /** Real comment nodes in this file; strings and regexes are not comments. */
83
+ comments: readonly CommentRange[];
84
+ }
85
+ export interface Rule {
86
+ meta: RuleMeta;
87
+ run(ctx: RuleContext): RuleDraft[];
88
+ }
89
+ export interface ScanStats {
90
+ files: number;
91
+ byLanguage: Record<LanguageId, number>;
92
+ skipped: number;
93
+ parseErrors: number;
94
+ durationMs: number;
95
+ }
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,28 @@
1
+ # Bundled grammars
2
+
3
+ These `.wasm` files are tree-sitter parsers compiled for the [web-tree-sitter](https://github.com/tree-sitter/tree-sitter/tree/master/lib/binding_web) runtime, vendored so that `slopgate` works offline and without a build step.
4
+
5
+ | File | Upstream | License |
6
+ | --- | --- | --- |
7
+ | `tree-sitter-python.wasm` | [tree-sitter/tree-sitter-python](https://github.com/tree-sitter/tree-sitter-python) | MIT |
8
+ | `tree-sitter-typescript.wasm` | [tree-sitter/tree-sitter-typescript](https://github.com/tree-sitter/tree-sitter-typescript) | MIT |
9
+ | `tree-sitter-tsx.wasm` | [tree-sitter/tree-sitter-typescript](https://github.com/tree-sitter/tree-sitter-typescript) | MIT |
10
+
11
+ (Tree-sitter itself is MIT licensed; the grammars carry their own MIT licenses, reproduced by their upstream repositories.)
12
+
13
+ We use the prebuilt artifacts from [`tree-sitter-wasms`](https://www.npmjs.com/package/tree-sitter-wasms). The TypeScript grammar is also used for plain JavaScript, and the TSX grammar for `.jsx` / `.tsx`.
14
+
15
+ ## Compatibility
16
+
17
+ `web-tree-sitter` is pinned to `0.25.x` in `package.json`. Newer runtimes (0.26+) load grammars built with a different dynamic-linking convention and currently reject these files — that is why the dependency is pinned rather than ranged. If you upgrade the runtime, re-verify grammar loading before publishing.
18
+
19
+ ## Updating a grammar
20
+
21
+ ```bash
22
+ npm pack tree-sitter-wasms
23
+ tar -xzf tree-sitter-wasms-*.tgz
24
+ cp package/out/tree-sitter-python.wasm grammars/
25
+ cp package/out/tree-sitter-typescript.wasm grammars/
26
+ cp package/out/tree-sitter-tsx.wasm grammars/
27
+ npm test
28
+ ```
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,63 @@
1
1
  {
2
2
  "name": "@voidh4x0r/slopgate",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.1",
4
+ "description": "The slop gate for AI-written code. Precision-first structural linting for Python and TypeScript.",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "author": "slopgate contributors",
8
+ "homepage": "https://github.com/VoidH4x0r/slopgate#readme",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/VoidH4x0r/slopgate.git"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/VoidH4x0r/slopgate/issues"
15
+ },
16
+ "bin": {
17
+ "slopgate": "dist/cli.js"
18
+ },
19
+ "files": [
20
+ "dist",
21
+ "grammars",
22
+ "README.md",
23
+ "LICENSE",
24
+ "CHANGELOG.md"
25
+ ],
26
+ "engines": {
27
+ "node": ">=20.11"
28
+ },
29
+ "scripts": {
30
+ "build": "tsc -p tsconfig.build.json",
31
+ "test": "node --test \"test/**/*.test.ts\"",
32
+ "test:sandbox": "node --test --test-isolation=none \"test/**/*.test.ts\"",
33
+ "typecheck": "tsc --noEmit",
34
+ "bench": "node scripts/benchmark.mjs",
35
+ "demo:gif": "node scripts/make-demo-gif.mjs",
36
+ "set-repo": "node scripts/set-repo.mjs",
37
+ "verify": "npm run typecheck && node scripts/check-links.mjs && npm run test:sandbox && npm run build && node dist/cli.js . --fail-on high && npm pack --dry-run",
38
+ "prepublishOnly": "npm run build && npm run typecheck"
39
+ },
40
+ "dependencies": {
41
+ "web-tree-sitter": "^0.25.10"
42
+ },
43
+ "devDependencies": {
44
+ "@types/node": "^20.19.43",
45
+ "typescript": "^5.9.0"
46
+ },
47
+ "keywords": [
48
+ "linter",
49
+ "ai-generated-code",
50
+ "static-analysis",
51
+ "code-quality",
52
+ "tree-sitter",
53
+ "cli",
54
+ "mcp",
55
+ "model-context-protocol",
56
+ "ai-agents",
57
+ "python",
58
+ "typescript"
59
+ ],
60
+ "publishConfig": {
61
+ "access": "public"
62
+ }
63
+ }