circle-ir-ai 4.35.2 → 4.36.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.
Files changed (107) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/health-score/calculator.d.ts +15 -0
  3. package/dist/health-score/calculator.d.ts.map +1 -1
  4. package/dist/health-score/calculator.js +16 -4
  5. package/dist/health-score/calculator.js.map +1 -1
  6. package/dist/index.d.ts +1 -0
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +2 -0
  9. package/dist/index.js.map +1 -1
  10. package/dist/quality/calculator.d.ts +9 -0
  11. package/dist/quality/calculator.d.ts.map +1 -1
  12. package/dist/quality/calculator.js +5 -0
  13. package/dist/quality/calculator.js.map +1 -1
  14. package/dist/quality/types.d.ts +2 -0
  15. package/dist/quality/types.d.ts.map +1 -1
  16. package/dist/scope/product-paths.d.ts +168 -0
  17. package/dist/scope/product-paths.d.ts.map +1 -0
  18. package/dist/scope/product-paths.js +512 -0
  19. package/dist/scope/product-paths.js.map +1 -0
  20. package/dist/security-scan/scanner.d.ts +13 -0
  21. package/dist/security-scan/scanner.d.ts.map +1 -1
  22. package/dist/security-scan/scanner.js +22 -0
  23. package/dist/security-scan/scanner.js.map +1 -1
  24. package/dist/specifica/environment/index.d.ts +13 -0
  25. package/dist/specifica/environment/index.d.ts.map +1 -1
  26. package/dist/specifica/environment/index.js +9 -0
  27. package/dist/specifica/environment/index.js.map +1 -1
  28. package/dist/specifica/environment/merge.d.ts +6 -0
  29. package/dist/specifica/environment/merge.d.ts.map +1 -1
  30. package/dist/specifica/environment/merge.js +18 -1
  31. package/dist/specifica/environment/merge.js.map +1 -1
  32. package/dist/specifica/environment/write.d.ts.map +1 -1
  33. package/dist/specifica/environment/write.js +5 -2
  34. package/dist/specifica/environment/write.js.map +1 -1
  35. package/dist/specifica/generator.d.ts.map +1 -1
  36. package/dist/specifica/generator.js +38 -5
  37. package/dist/specifica/generator.js.map +1 -1
  38. package/dist/specifica/library-surface.d.ts +15 -1
  39. package/dist/specifica/library-surface.d.ts.map +1 -1
  40. package/dist/specifica/library-surface.js +37 -4
  41. package/dist/specifica/library-surface.js.map +1 -1
  42. package/dist/specifica/modules.d.ts +14 -0
  43. package/dist/specifica/modules.d.ts.map +1 -1
  44. package/dist/specifica/modules.js +51 -7
  45. package/dist/specifica/modules.js.map +1 -1
  46. package/dist/specifica/spec-tree.d.ts +3 -0
  47. package/dist/specifica/spec-tree.d.ts.map +1 -1
  48. package/dist/specifica/spec-tree.js +33 -11
  49. package/dist/specifica/spec-tree.js.map +1 -1
  50. package/dist/specifica/tree-writer.d.ts.map +1 -1
  51. package/dist/specifica/tree-writer.js +16 -1
  52. package/dist/specifica/tree-writer.js.map +1 -1
  53. package/dist/specifica/types.d.ts +10 -0
  54. package/dist/specifica/types.d.ts.map +1 -1
  55. package/dist/specifica/use-cases.d.ts +6 -0
  56. package/dist/specifica/use-cases.d.ts.map +1 -1
  57. package/dist/specifica/use-cases.js +36 -2
  58. package/dist/specifica/use-cases.js.map +1 -1
  59. package/dist/trust/passes/ai-generated-fingerprint.d.ts.map +1 -1
  60. package/dist/trust/passes/ai-generated-fingerprint.js +2 -1
  61. package/dist/trust/passes/ai-generated-fingerprint.js.map +1 -1
  62. package/dist/trust/passes/code-complexity.d.ts.map +1 -1
  63. package/dist/trust/passes/code-complexity.js +2 -1
  64. package/dist/trust/passes/code-complexity.js.map +1 -1
  65. package/dist/trust/passes/cross-skill-interaction.d.ts.map +1 -1
  66. package/dist/trust/passes/cross-skill-interaction.js +2 -1
  67. package/dist/trust/passes/cross-skill-interaction.js.map +1 -1
  68. package/dist/trust/passes/data-exfiltration.d.ts.map +1 -1
  69. package/dist/trust/passes/data-exfiltration.js +2 -1
  70. package/dist/trust/passes/data-exfiltration.js.map +1 -1
  71. package/dist/trust/passes/deprecated-usage.d.ts.map +1 -1
  72. package/dist/trust/passes/deprecated-usage.js +2 -1
  73. package/dist/trust/passes/deprecated-usage.js.map +1 -1
  74. package/dist/trust/passes/deprecation-no-replacement.d.ts.map +1 -1
  75. package/dist/trust/passes/deprecation-no-replacement.js +2 -1
  76. package/dist/trust/passes/deprecation-no-replacement.js.map +1 -1
  77. package/dist/trust/passes/doc-coverage.d.ts.map +1 -1
  78. package/dist/trust/passes/doc-coverage.js +2 -1
  79. package/dist/trust/passes/doc-coverage.js.map +1 -1
  80. package/dist/trust/passes/inconsistent-error-handling.d.ts.map +1 -1
  81. package/dist/trust/passes/inconsistent-error-handling.js +2 -1
  82. package/dist/trust/passes/inconsistent-error-handling.js.map +1 -1
  83. package/dist/trust/passes/inconsistent-naming.d.ts.map +1 -1
  84. package/dist/trust/passes/inconsistent-naming.js +2 -1
  85. package/dist/trust/passes/inconsistent-naming.js.map +1 -1
  86. package/dist/trust/passes/inconsistent-param-order.d.ts.map +1 -1
  87. package/dist/trust/passes/inconsistent-param-order.js +2 -1
  88. package/dist/trust/passes/inconsistent-param-order.js.map +1 -1
  89. package/dist/trust/passes/missing-guard-dom.d.ts.map +1 -1
  90. package/dist/trust/passes/missing-guard-dom.js +3 -2
  91. package/dist/trust/passes/missing-guard-dom.js.map +1 -1
  92. package/dist/trust/passes/performance-passes.d.ts.map +1 -1
  93. package/dist/trust/passes/performance-passes.js +2 -1
  94. package/dist/trust/passes/performance-passes.js.map +1 -1
  95. package/dist/trust/passes/prompt-injection.d.ts.map +1 -1
  96. package/dist/trust/passes/prompt-injection.js +2 -1
  97. package/dist/trust/passes/prompt-injection.js.map +1 -1
  98. package/dist/trust/passes/throws-mismatch.d.ts.map +1 -1
  99. package/dist/trust/passes/throws-mismatch.js +2 -1
  100. package/dist/trust/passes/throws-mismatch.js.map +1 -1
  101. package/dist/trust/passes/tool-poisoning.d.ts.map +1 -1
  102. package/dist/trust/passes/tool-poisoning.js +2 -1
  103. package/dist/trust/passes/tool-poisoning.js.map +1 -1
  104. package/dist/trust/passes/unnecessary-object-hotspot.d.ts.map +1 -1
  105. package/dist/trust/passes/unnecessary-object-hotspot.js +2 -1
  106. package/dist/trust/passes/unnecessary-object-hotspot.js.map +1 -1
  107. package/package.json +1 -1
@@ -0,0 +1,168 @@
1
+ /**
2
+ * Product scope: which paths of a repository belong to the product.
3
+ *
4
+ * One rule, shared by the spec, security (scan), quality and trust checks.
5
+ * Folders that belong to no product module (tests, fixtures, examples, test
6
+ * harnesses, benchmarks, tooling and scripts, vendored and generated code)
7
+ * are left out of those checks by default. The secrets scanner and trust's
8
+ * hardcoded-secrets pass do NOT use this rule: a key in a test fixture is
9
+ * still a leaked key.
10
+ *
11
+ * Canonical copy: `circle-ir-ai/src/scope/product-paths.ts`. Byte-identical
12
+ * copies live in `cognium-ai/src/cli/product-paths.ts` and
13
+ * `circle-pack/src/api/analysis/product-paths.ts` until both packages depend
14
+ * on a published `circle-ir-ai` that exports it; a test in each package fails
15
+ * when its copy drifts.
16
+ *
17
+ * The rule is deterministic: it reads directory listings only (never file
18
+ * contents) and decides by where a directory sits, not by its name alone, so
19
+ * a Java package named `benchmark`, `samples` or `example` stays product code.
20
+ *
21
+ * - **Never left out:** anything under a `src/main/` directory (Maven and
22
+ * Gradle source sets, at any depth). Under `lib/` or `app/` at a package
23
+ * root, only `__tests__`, `__mocks__` and `__fixtures__` go. A directory
24
+ * that is itself a Go package (holds a `.go` file) or a Python package
25
+ * (holds `__init__.py`) is kept unless it is a test or fixture directory.
26
+ * - **test:** `src/test/` at any depth; `src/it/` in a Maven or Gradle
27
+ * module; `test/`, `tests/`, `e2e/` directly under a package root (the
28
+ * repository root, or a directory holding `package.json`, `pom.xml`,
29
+ * `go.mod`, `Cargo.toml`, `pyproject.toml`, `build.gradle(.kts)`);
30
+ * `__tests__/`, `__mocks__/` anywhere; .NET test projects (`Foo.Tests/`,
31
+ * `Foo.UnitTests/`, `Foo.Specs/` ...); hyphenated `*-test(s)/`, `test-<name>/`
32
+ * and `integration-tests/` anywhere (a hyphen cannot occur in a package
33
+ * segment); files `*.test.*`, `*.spec.*`, `*_test.go`, `test_*.py`,
34
+ * `*_test.py`, `conftest.py`.
35
+ * - **fixture:** `fixtures/`, `__fixtures__/`, `testdata/`, `test-fixtures/`,
36
+ * `test_data/`, `*-fixture(s)/` anywhere.
37
+ * - **example:** `example(s)/`, `sample(s)/`, `demo(s)/`, `playground/`
38
+ * directly under a package root; `*-example(s)/`, `*-sample(s)/`,
39
+ * `*-demo(s)/`, `samples-<name>/` anywhere; files `*.stories.*`.
40
+ * - **harness:** `testharness/`, `test-harness/`, `test_harness/` anywhere;
41
+ * `harness/` directly under a package root.
42
+ * - **benchmark:** `bench/`, `benchmark(s)/` directly under a package root;
43
+ * `*-benchmark(s)/` anywhere; files `*.bench.*`.
44
+ * - **tooling:** `scripts/`, `script/`, `tools/`, `tooling/`, `buildSrc/`,
45
+ * `ci/`, `hack/` directly under a package root; every hidden directory
46
+ * (`.github/`, `.husky/` ...).
47
+ * - **vendored:** `vendor/`, `third_party/`, `third-party/`,
48
+ * `bower_components/` anywhere.
49
+ * - **generated:** `generated/`, `__generated__/` anywhere; files `*.min.js`,
50
+ * `*-min.js`, `*.bundle.js`, `*.generated.*`, `*.pb.go`, `*_pb2.py`,
51
+ * `*_pb2_grpc.py`.
52
+ *
53
+ * File markers never apply under `src/main/`.
54
+ *
55
+ * Override: `include` globs (minimatch, relative to the root) bring a path
56
+ * back into scope; a directory is kept when an include glob could match a
57
+ * path inside it. `allPaths: true`, or `SCOPE_ALL_PATHS=1` in the
58
+ * environment, turns the rule off.
59
+ */
60
+ /** Bumped whenever the rule's decisions change. Recorded in every result. */
61
+ export declare const PRODUCT_SCOPE_RULE_VERSION = "product-paths/1";
62
+ /** Environment switch that turns the rule off (`1`). */
63
+ export declare const SCOPE_ALL_PATHS_ENV = "SCOPE_ALL_PATHS";
64
+ /** Environment override: comma-separated globs brought back into scope (when `include` is not given). */
65
+ export declare const SCOPE_INCLUDE_ENV = "SCOPE_INCLUDE";
66
+ /** Why a path is not product code. */
67
+ export type ScopeReason = 'test' | 'fixture' | 'example' | 'harness' | 'benchmark' | 'tooling' | 'vendored' | 'generated';
68
+ export declare const SCOPE_REASONS: readonly ScopeReason[];
69
+ /** What every result records about the paths it skipped. Additive output. */
70
+ export interface ScopeSummary {
71
+ /** Source files left out by the rule. */
72
+ excluded_paths_count: number;
73
+ /** The same files by reason (reasons with no file are omitted). */
74
+ excluded_reasons: Partial<Record<ScopeReason, number>>;
75
+ /** {@link PRODUCT_SCOPE_RULE_VERSION}. */
76
+ rule_version: string;
77
+ /** Present when the rule was turned off (`--all-paths` / `SCOPE_ALL_PATHS=1`). */
78
+ all_paths?: true;
79
+ /**
80
+ * Present when the rule left nothing to read and the check read every
81
+ * path instead (spec generation only).
82
+ */
83
+ fallback?: 'all_paths';
84
+ }
85
+ export interface ProductScopeOptions {
86
+ /** Turn the rule off. */
87
+ allPaths?: boolean;
88
+ /** Globs that bring a path back into scope (per-repo override). */
89
+ include?: string[];
90
+ /** Environment to read {@link SCOPE_ALL_PATHS_ENV} from. Default `process.env`. */
91
+ env?: Record<string, string | undefined>;
92
+ /** Extensions counted in `excluded_paths_count`. Default {@link SOURCE_EXTENSIONS}. */
93
+ countExtensions?: ReadonlySet<string>;
94
+ }
95
+ export interface ScopeDecision {
96
+ reason: ScopeReason;
97
+ /** The rule that decided (for diagnostics and tests). */
98
+ rule: string;
99
+ }
100
+ export interface ProductScope {
101
+ ruleVersion: string;
102
+ /** False when the rule is off: {@link classify} then keeps every path. */
103
+ enabled: boolean;
104
+ /** Root-relative directories left out (forward slashes). */
105
+ excludedDirs: Array<{
106
+ path: string;
107
+ } & ScopeDecision>;
108
+ /**
109
+ * Minimatch globs (`dot`, `matchBase`) that exclude the same paths, for
110
+ * walkers that only take exclude patterns. At most
111
+ * {@link MAX_ANCHORED_PATTERNS} anchored directories are sent; past that the
112
+ * rest are read, never guessed at ({@link overCap}).
113
+ */
114
+ patterns: string[];
115
+ /** Directories that did not fit in {@link patterns}. */
116
+ overCap: number;
117
+ /**
118
+ * Is this root-relative path (file or directory) outside the product?
119
+ * Exact: does not depend on the pattern cap.
120
+ */
121
+ classify(relativePath: string): ScopeDecision | null;
122
+ /** The summary every result records. */
123
+ summary: ScopeSummary;
124
+ }
125
+ /** Extensions counted as source files in the summary. */
126
+ export declare const SOURCE_EXTENSIONS: ReadonlySet<string>;
127
+ /** Anchored (per-directory) patterns sent at most. */
128
+ export declare const MAX_ANCHORED_PATTERNS = 300;
129
+ /** File markers: the glob sent to pattern walkers and the same test on a base name. */
130
+ export declare const FILE_MARKERS: ReadonlyArray<{
131
+ glob: string;
132
+ reason: ScopeReason;
133
+ test: (base: string) => boolean;
134
+ }>;
135
+ /** `SCOPE_ALL_PATHS=1` (or `true`) turns the rule off. */
136
+ export declare function isScopeAllPaths(env?: Record<string, string | undefined>): boolean;
137
+ /**
138
+ * Include globs that name a place (`examples/**`, `tests/integration/**`)
139
+ * rather than a shape (`**\/*.ts`). A user's `include` of this kind brings
140
+ * that place back into scope; a shape filter does not.
141
+ */
142
+ export declare function placeIncludePatterns(include: readonly string[] | undefined): string[];
143
+ /** Escape a path so minimatch reads it literally. */
144
+ export declare function escapeGlob(text: string): string;
145
+ /** The pattern that excludes one directory (and everything in it) and nothing else. */
146
+ export declare function anchoredDirPattern(rel: string): string;
147
+ /**
148
+ * Walk `root` and work out what is outside the product. Reads directory
149
+ * listings only. A file `root` (single-file target) is never filtered: the
150
+ * caller picked that file.
151
+ */
152
+ export declare function productScope(root: string, options?: ProductScopeOptions): ProductScope;
153
+ /**
154
+ * The patterns for every reason but `except` (quality keeps test files: its
155
+ * test-coverage pass counts them). Anchored directories of the other reasons
156
+ * and their file markers.
157
+ */
158
+ export declare function scopePatternsExcept(scope: ProductScope, except: readonly ScopeReason[]): string[];
159
+ /** The summary with the counts of `except` reasons removed (see {@link scopePatternsExcept}). */
160
+ export declare function scopeSummaryExcept(summary: ScopeSummary, except: readonly ScopeReason[]): ScopeSummary;
161
+ /**
162
+ * Keep the files under `root` that the rule calls product code. For walkers
163
+ * that collect files their own way (trust passes). The scope of a root is
164
+ * kept for a minute, keyed by the environment switches, so the passes of one
165
+ * run share one walk.
166
+ */
167
+ export declare function filterToProductScope(root: string, files: string[]): string[];
168
+ //# sourceMappingURL=product-paths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product-paths.d.ts","sourceRoot":"","sources":["../../src/scope/product-paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AAMH,6EAA6E;AAC7E,eAAO,MAAM,0BAA0B,oBAAoB,CAAC;AAE5D,wDAAwD;AACxD,eAAO,MAAM,mBAAmB,oBAAoB,CAAC;AAErD,yGAAyG;AACzG,eAAO,MAAM,iBAAiB,kBAAkB,CAAC;AAEjD,sCAAsC;AACtC,MAAM,MAAM,WAAW,GACnB,MAAM,GACN,SAAS,GACT,SAAS,GACT,SAAS,GACT,WAAW,GACX,SAAS,GACT,UAAU,GACV,WAAW,CAAC;AAEhB,eAAO,MAAM,aAAa,EAAE,SAAS,WAAW,EAS9C,CAAC;AAEH,6EAA6E;AAC7E,MAAM,WAAW,YAAY;IAC3B,yCAAyC;IACzC,oBAAoB,EAAE,MAAM,CAAC;IAC7B,mEAAmE;IACnE,gBAAgB,EAAE,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC;IACvD,0CAA0C;IAC1C,YAAY,EAAE,MAAM,CAAC;IACrB,kFAAkF;IAClF,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB;;;OAGG;IACH,QAAQ,CAAC,EAAE,WAAW,CAAC;CACxB;AAED,MAAM,WAAW,mBAAmB;IAClC,yBAAyB;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,mEAAmE;IACnE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,mFAAmF;IACnF,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CA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