@rigour-labs/core 6.2.4 → 6.3.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/README.md +2 -0
- package/dist/deep/code-context.d.ts +28 -0
- package/dist/deep/code-context.js +93 -0
- package/dist/deep/code-context.test.d.ts +1 -0
- package/dist/deep/code-context.test.js +48 -0
- package/dist/deep/code-pass.d.ts +15 -0
- package/dist/deep/code-pass.js +44 -0
- package/dist/deep/code-review-prompt.d.ts +17 -0
- package/dist/deep/code-review-prompt.js +30 -0
- package/dist/deep/code-review-prompt.test.d.ts +1 -0
- package/dist/deep/code-review-prompt.test.js +20 -0
- package/dist/deep/code-verifier.d.ts +19 -0
- package/dist/deep/code-verifier.js +48 -0
- package/dist/deep/code-verifier.test.d.ts +1 -0
- package/dist/deep/code-verifier.test.js +46 -0
- package/dist/deep/fact-extractor.d.ts +7 -1
- package/dist/deep/fact-extractor.js +16 -8
- package/dist/deep/fact-extractor.test.js +34 -1
- package/dist/deep/facts-pass.d.ts +24 -0
- package/dist/deep/facts-pass.js +69 -0
- package/dist/deep/index.d.ts +6 -1
- package/dist/deep/index.js +5 -1
- package/dist/deep/parse-findings.d.ts +12 -0
- package/dist/deep/parse-findings.js +73 -0
- package/dist/deep/parse-findings.test.d.ts +1 -0
- package/dist/deep/parse-findings.test.js +25 -0
- package/dist/deep/prompts.d.ts +1 -1
- package/dist/deep/prompts.js +7 -8
- package/dist/deep/prompts.test.js +15 -0
- package/dist/discovery-signals.d.ts +27 -0
- package/dist/discovery-signals.js +96 -0
- package/dist/discovery.d.ts +1 -2
- package/dist/discovery.js +36 -49
- package/dist/discovery.test.js +84 -71
- package/dist/gates/context.js +7 -0
- package/dist/gates/deep-analysis.d.ts +33 -8
- package/dist/gates/deep-analysis.js +169 -306
- package/dist/gates/deep-analysis.test.d.ts +1 -0
- package/dist/gates/deep-analysis.test.js +86 -0
- package/dist/gates/deep-intent.d.ts +3 -0
- package/dist/gates/deep-intent.js +57 -0
- package/dist/gates/deep-intent.test.d.ts +1 -0
- package/dist/gates/deep-intent.test.js +51 -0
- package/dist/gates/deep-runner.d.ts +15 -0
- package/dist/gates/deep-runner.js +66 -0
- package/dist/gates/dependency.js +4 -0
- package/dist/gates/deprecated-apis-ast.d.ts +8 -0
- package/dist/gates/deprecated-apis-ast.js +25 -0
- package/dist/gates/deprecated-apis-rules-node.js +2 -8
- package/dist/gates/deprecated-apis.js +5 -1
- package/dist/gates/deprecated-apis.test.js +30 -0
- package/dist/gates/frontend-secret-exposure.js +5 -1
- package/dist/gates/frontend-secret-exposure.test.js +20 -0
- package/dist/gates/hallucinated-imports/framework-modules.d.ts +14 -0
- package/dist/gates/hallucinated-imports/framework-modules.js +75 -0
- package/dist/gates/hallucinated-imports/index.js +14 -6
- package/dist/gates/hallucinated-imports/js-resolver.d.ts +16 -12
- package/dist/gates/hallucinated-imports/js-resolver.js +65 -153
- package/dist/gates/hallucinated-imports/ts-path-target.js +16 -0
- package/dist/gates/hallucinated-imports/tsconfig-paths.d.ts +16 -0
- package/dist/gates/hallucinated-imports/tsconfig-paths.js +120 -0
- package/dist/gates/hallucinated-imports-sveltekit.test.d.ts +1 -0
- package/dist/gates/hallucinated-imports-sveltekit.test.js +108 -0
- package/dist/gates/logic-drift.js +7 -1
- package/dist/gates/runner.js +10 -40
- package/dist/gates/runner.test.js +37 -25
- package/dist/gates/scoped-gates.test.d.ts +1 -0
- package/dist/gates/scoped-gates.test.js +52 -0
- package/dist/gates/semantic-bugs.d.ts +23 -0
- package/dist/gates/semantic-bugs.js +48 -0
- package/dist/gates/semantic-bugs.test.d.ts +1 -0
- package/dist/gates/semantic-bugs.test.js +70 -0
- package/dist/gates/side-effect-analysis/index.js +11 -1
- package/dist/gates/side-effect-analysis.test.d.ts +1 -0
- package/dist/gates/side-effect-analysis.test.js +162 -0
- package/dist/gates/side-effect-helpers/pattern-detection.js +35 -7
- package/dist/gates/side-effect-helpers/resource-tracking.js +17 -10
- package/dist/gates/side-effect-helpers/scope-analysis.d.ts +6 -0
- package/dist/gates/side-effect-helpers/scope-analysis.js +20 -0
- package/dist/gates/style-drift.js +3 -0
- package/dist/index.d.ts +11 -2
- package/dist/index.js +10 -2
- package/dist/inference/http-download.d.ts +22 -0
- package/dist/inference/http-download.js +132 -0
- package/dist/inference/http-download.test.d.ts +1 -0
- package/dist/inference/http-download.test.js +109 -0
- package/dist/inference/index.d.ts +5 -1
- package/dist/inference/index.js +2 -1
- package/dist/inference/llama-engine.d.ts +27 -0
- package/dist/inference/llama-engine.js +152 -0
- package/dist/inference/llama-engine.test.d.ts +1 -0
- package/dist/inference/llama-engine.test.js +51 -0
- package/dist/inference/llama-process.d.ts +72 -0
- package/dist/inference/llama-process.js +126 -0
- package/dist/inference/llama-process.test.d.ts +1 -0
- package/dist/inference/llama-process.test.js +61 -0
- package/dist/inference/model-download.test.d.ts +1 -0
- package/dist/inference/model-download.test.js +73 -0
- package/dist/inference/model-manager.d.ts +14 -1
- package/dist/inference/model-manager.js +65 -80
- package/dist/inference/sidecar-provider.d.ts +19 -10
- package/dist/inference/sidecar-provider.js +125 -342
- package/dist/inference/types.d.ts +2 -0
- package/dist/semantic/ast.d.ts +29 -0
- package/dist/semantic/ast.js +122 -0
- package/dist/semantic/benchmark.d.ts +16 -0
- package/dist/semantic/benchmark.js +31 -0
- package/dist/semantic/benchmark.test.d.ts +1 -0
- package/dist/semantic/benchmark.test.js +18 -0
- package/dist/semantic/engine.d.ts +8 -0
- package/dist/semantic/engine.js +45 -0
- package/dist/semantic/intent/benchmark.d.ts +31 -0
- package/dist/semantic/intent/benchmark.js +74 -0
- package/dist/semantic/intent/intent-check.d.ts +43 -0
- package/dist/semantic/intent/intent-check.js +72 -0
- package/dist/semantic/intent/intent.test.d.ts +1 -0
- package/dist/semantic/intent/intent.test.js +46 -0
- package/dist/semantic/intent/parallel-reads.d.ts +23 -0
- package/dist/semantic/intent/parallel-reads.js +59 -0
- package/dist/semantic/learn/benchmark.d.ts +20 -0
- package/dist/semantic/learn/benchmark.js +71 -0
- package/dist/semantic/learn/compile.d.ts +4 -0
- package/dist/semantic/learn/compile.js +56 -0
- package/dist/semantic/learn/conditions.d.ts +22 -0
- package/dist/semantic/learn/conditions.js +93 -0
- package/dist/semantic/learn/extract.d.ts +30 -0
- package/dist/semantic/learn/extract.js +122 -0
- package/dist/semantic/learn/git-trees.d.ts +8 -0
- package/dist/semantic/learn/git-trees.js +32 -0
- package/dist/semantic/learn/identity.d.ts +18 -0
- package/dist/semantic/learn/identity.js +97 -0
- package/dist/semantic/learn/learn.d.ts +25 -0
- package/dist/semantic/learn/learn.js +109 -0
- package/dist/semantic/learn/learn.test.d.ts +1 -0
- package/dist/semantic/learn/learn.test.js +67 -0
- package/dist/semantic/learn/store.d.ts +4 -0
- package/dist/semantic/learn/store.js +39 -0
- package/dist/semantic/learn/types.d.ts +468 -0
- package/dist/semantic/learn/types.js +55 -0
- package/dist/semantic/origins.d.ts +42 -0
- package/dist/semantic/origins.js +149 -0
- package/dist/semantic/origins.test.d.ts +1 -0
- package/dist/semantic/origins.test.js +77 -0
- package/dist/semantic/program.d.ts +13 -0
- package/dist/semantic/program.js +62 -0
- package/dist/semantic/rules/credential-redirect.d.ts +2 -0
- package/dist/semantic/rules/credential-redirect.js +209 -0
- package/dist/semantic/rules/degraded-response-cached.d.ts +2 -0
- package/dist/semantic/rules/degraded-response-cached.js +271 -0
- package/dist/semantic/rules/in-memory-aggregation.d.ts +2 -0
- package/dist/semantic/rules/in-memory-aggregation.js +179 -0
- package/dist/semantic/summaries.d.ts +18 -0
- package/dist/semantic/summaries.js +33 -0
- package/dist/semantic/types.d.ts +32 -0
- package/dist/semantic/types.js +1 -0
- package/dist/storage/index.d.ts +1 -0
- package/dist/storage/index.js +1 -0
- package/dist/storage/team-diagnostics.d.ts +22 -0
- package/dist/storage/team-diagnostics.js +58 -0
- package/dist/storage/team-diagnostics.test.d.ts +1 -0
- package/dist/storage/team-diagnostics.test.js +51 -0
- package/dist/storage/team-schema.d.ts +6 -0
- package/dist/storage/team-schema.js +82 -0
- package/dist/storage/team-store.js +25 -72
- package/dist/templates/universal-config.js +4 -2
- package/dist/types/index.d.ts +114 -14
- package/dist/types/index.js +16 -2
- package/dist/utils/deep-status.d.ts +7 -0
- package/dist/utils/deep-status.js +11 -0
- package/dist/utils/diff.d.ts +3 -0
- package/dist/utils/diff.js +52 -0
- package/dist/utils/diff.test.d.ts +1 -0
- package/dist/utils/diff.test.js +38 -0
- package/dist/utils/scanner.js +13 -2
- package/dist/utils/scanner.test.js +22 -8
- package/dist/utils/scope.d.ts +15 -0
- package/dist/utils/scope.js +51 -0
- package/dist/utils/scope.test.d.ts +1 -0
- package/dist/utils/scope.test.js +38 -0
- package/package.json +6 -6
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File scope for `rigour check <paths...>` and `rigour review`.
|
|
3
|
+
*
|
|
4
|
+
* CLI inputs may be absolute, relative or directories. Gates glob with
|
|
5
|
+
* globby, so each input becomes a cwd-relative glob with glob-special
|
|
6
|
+
* characters escaped (Next.js routes such as `app/[key]/route.ts` would
|
|
7
|
+
* otherwise be read as a character class).
|
|
8
|
+
*/
|
|
9
|
+
import path from 'path';
|
|
10
|
+
import fs from 'fs-extra';
|
|
11
|
+
import { convertPathToPattern } from 'globby';
|
|
12
|
+
import { FileScanner } from './scanner.js';
|
|
13
|
+
/** Convert CLI path arguments into cwd-relative, escaped glob patterns. */
|
|
14
|
+
export async function normalizeScopePatterns(cwd, inputs) {
|
|
15
|
+
const patterns = [];
|
|
16
|
+
for (const input of inputs) {
|
|
17
|
+
const absolute = path.resolve(cwd, input);
|
|
18
|
+
const relative = toPosix(path.relative(cwd, absolute)) || '.';
|
|
19
|
+
const isDirectory = await fs.stat(absolute).then(s => s.isDirectory()).catch(() => false);
|
|
20
|
+
if (!isDirectory && !(await fs.pathExists(absolute))) {
|
|
21
|
+
// Not a path on disk: keep it as the glob the user wrote.
|
|
22
|
+
patterns.push(toPosix(input));
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
const escaped = relative === '.' ? '' : convertPathToPattern(relative);
|
|
26
|
+
patterns.push(isDirectory ? (escaped ? `${escaped}/**/*` : '**/*') : escaped);
|
|
27
|
+
}
|
|
28
|
+
return patterns;
|
|
29
|
+
}
|
|
30
|
+
/** True when a gate context carries an explicit file scope. */
|
|
31
|
+
export function isScoped(patterns) {
|
|
32
|
+
return Array.isArray(patterns) && patterns.length > 0;
|
|
33
|
+
}
|
|
34
|
+
/** True when any of `files` is in the scoped file set (paths compared cwd-relative). */
|
|
35
|
+
export function touchesScope(files, scopedFiles) {
|
|
36
|
+
return (files ?? []).some(f => scopedFiles.has(toPosix(f).replace(/^\.\//, '')));
|
|
37
|
+
}
|
|
38
|
+
/** The concrete cwd-relative files matched by a scoped run's patterns. */
|
|
39
|
+
export async function resolveScopedFiles(cwd, patterns, ignore) {
|
|
40
|
+
const files = await FileScanner.findFiles({ cwd, patterns, ignore });
|
|
41
|
+
return new Set(files.map(toPosix));
|
|
42
|
+
}
|
|
43
|
+
/** True when a scoped run does not include `file` (a manifest such as package.json). */
|
|
44
|
+
export async function scopeExcludes(context, file) {
|
|
45
|
+
if (!isScoped(context.patterns))
|
|
46
|
+
return false;
|
|
47
|
+
return !(await resolveScopedFiles(context.cwd, context.patterns, context.ignore)).has(file);
|
|
48
|
+
}
|
|
49
|
+
export function toPosix(p) {
|
|
50
|
+
return p.replace(/\\/g, '/');
|
|
51
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import fs from 'fs-extra';
|
|
2
|
+
import os from 'os';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
|
5
|
+
import { isScoped, normalizeScopePatterns, resolveScopedFiles, touchesScope } from './scope.js';
|
|
6
|
+
describe('scope', () => {
|
|
7
|
+
let cwd;
|
|
8
|
+
beforeEach(async () => {
|
|
9
|
+
cwd = await fs.mkdtemp(path.join(os.tmpdir(), 'rigour-scope-'));
|
|
10
|
+
await fs.outputFile(path.join(cwd, 'src/app/[key]/route.ts'), 'export {}');
|
|
11
|
+
await fs.outputFile(path.join(cwd, 'src/app/k/route.ts'), 'export {}');
|
|
12
|
+
await fs.outputFile(path.join(cwd, 'src/lib/a.ts'), 'export {}');
|
|
13
|
+
});
|
|
14
|
+
afterEach(async () => { await fs.remove(cwd); });
|
|
15
|
+
it('turns absolute, relative and directory inputs into cwd-relative patterns', async () => {
|
|
16
|
+
const patterns = await normalizeScopePatterns(cwd, [path.join(cwd, 'src/lib/a.ts'), './src/lib', 'src/lib/a.ts']);
|
|
17
|
+
expect(patterns).toEqual(['src/lib/a.ts', 'src/lib/**/*', 'src/lib/a.ts']);
|
|
18
|
+
});
|
|
19
|
+
it('escapes glob characters so a Next.js [key] route matches only itself', async () => {
|
|
20
|
+
const patterns = await normalizeScopePatterns(cwd, ['src/app/[key]/route.ts']);
|
|
21
|
+
expect([...await resolveScopedFiles(cwd, patterns)]).toEqual(['src/app/[key]/route.ts']);
|
|
22
|
+
});
|
|
23
|
+
it('keeps a non-existent input as the glob the user wrote', async () => {
|
|
24
|
+
expect(await normalizeScopePatterns(cwd, ['src/**/*.ts'])).toEqual(['src/**/*.ts']);
|
|
25
|
+
});
|
|
26
|
+
it('treats the repo root as everything', async () => {
|
|
27
|
+
expect(await normalizeScopePatterns(cwd, ['.'])).toEqual(['**/*']);
|
|
28
|
+
});
|
|
29
|
+
it('detects scoped runs and scope membership', () => {
|
|
30
|
+
expect(isScoped(undefined)).toBe(false);
|
|
31
|
+
expect(isScoped([])).toBe(false);
|
|
32
|
+
expect(isScoped(['a.ts'])).toBe(true);
|
|
33
|
+
const scoped = new Set(['src/lib/a.ts']);
|
|
34
|
+
expect(touchesScope(['./src/lib/a.ts', 'b.ts'], scoped)).toBe(true);
|
|
35
|
+
expect(touchesScope(['b.ts'], scoped)).toBe(false);
|
|
36
|
+
expect(touchesScope(undefined, scoped)).toBe(false);
|
|
37
|
+
});
|
|
38
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rigour-labs/core",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.3.0",
|
|
4
4
|
"description": "AI-native quality gate engine with local Bayesian learning. AST analysis, drift detection, Fix Packet generation, and agent self-healing across TypeScript, JavaScript, Python, Go, Ruby, and C#.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://rigour.run",
|
|
@@ -67,11 +67,11 @@
|
|
|
67
67
|
"pg": "^8.16.3",
|
|
68
68
|
"sqlite3": "^5.1.7",
|
|
69
69
|
"openai": "^4.104.0",
|
|
70
|
-
"@rigour-labs/brain-darwin-arm64": "6.
|
|
71
|
-
"@rigour-labs/brain-darwin-x64": "6.
|
|
72
|
-
"@rigour-labs/brain-linux-
|
|
73
|
-
"@rigour-labs/brain-win-x64": "6.
|
|
74
|
-
"@rigour-labs/brain-linux-
|
|
70
|
+
"@rigour-labs/brain-darwin-arm64": "6.3.0",
|
|
71
|
+
"@rigour-labs/brain-darwin-x64": "6.3.0",
|
|
72
|
+
"@rigour-labs/brain-linux-arm64": "6.3.0",
|
|
73
|
+
"@rigour-labs/brain-win-x64": "6.3.0",
|
|
74
|
+
"@rigour-labs/brain-linux-x64": "6.3.0"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
77
|
"@types/fs-extra": "^11.0.4",
|