@nanocollective/sentinel 0.1.0-alpha.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 (163) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +66 -0
  3. package/dist/cli.d.ts +12 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +254 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/config/parse.d.ts +13 -0
  8. package/dist/config/parse.d.ts.map +1 -0
  9. package/dist/config/parse.js +271 -0
  10. package/dist/config/parse.js.map +1 -0
  11. package/dist/config/repo-override.d.ts +13 -0
  12. package/dist/config/repo-override.d.ts.map +1 -0
  13. package/dist/config/repo-override.js +128 -0
  14. package/dist/config/repo-override.js.map +1 -0
  15. package/dist/config/types.d.ts +86 -0
  16. package/dist/config/types.d.ts.map +1 -0
  17. package/dist/config/types.js +8 -0
  18. package/dist/config/types.js.map +1 -0
  19. package/dist/dedup/hash.d.ts +10 -0
  20. package/dist/dedup/hash.d.ts.map +1 -0
  21. package/dist/dedup/hash.js +18 -0
  22. package/dist/dedup/hash.js.map +1 -0
  23. package/dist/dedup/markers.d.ts +13 -0
  24. package/dist/dedup/markers.d.ts.map +1 -0
  25. package/dist/dedup/markers.js +42 -0
  26. package/dist/dedup/markers.js.map +1 -0
  27. package/dist/dedup/plan.d.ts +45 -0
  28. package/dist/dedup/plan.d.ts.map +1 -0
  29. package/dist/dedup/plan.js +83 -0
  30. package/dist/dedup/plan.js.map +1 -0
  31. package/dist/dedup/reconcile.d.ts +29 -0
  32. package/dist/dedup/reconcile.d.ts.map +1 -0
  33. package/dist/dedup/reconcile.js +73 -0
  34. package/dist/dedup/reconcile.js.map +1 -0
  35. package/dist/findings/types.d.ts +53 -0
  36. package/dist/findings/types.d.ts.map +1 -0
  37. package/dist/findings/types.js +28 -0
  38. package/dist/findings/types.js.map +1 -0
  39. package/dist/findings/validate.d.ts +36 -0
  40. package/dist/findings/validate.d.ts.map +1 -0
  41. package/dist/findings/validate.js +178 -0
  42. package/dist/findings/validate.js.map +1 -0
  43. package/dist/index.d.ts +48 -0
  44. package/dist/index.d.ts.map +1 -0
  45. package/dist/index.js +39 -0
  46. package/dist/index.js.map +1 -0
  47. package/dist/init/args.d.ts +20 -0
  48. package/dist/init/args.d.ts.map +1 -0
  49. package/dist/init/args.js +80 -0
  50. package/dist/init/args.js.map +1 -0
  51. package/dist/init/plan.d.ts +9 -0
  52. package/dist/init/plan.d.ts.map +1 -0
  53. package/dist/init/plan.js +17 -0
  54. package/dist/init/plan.js.map +1 -0
  55. package/dist/init/scaffold.d.ts +17 -0
  56. package/dist/init/scaffold.d.ts.map +1 -0
  57. package/dist/init/scaffold.js +27 -0
  58. package/dist/init/scaffold.js.map +1 -0
  59. package/dist/init/templates.d.ts +28 -0
  60. package/dist/init/templates.d.ts.map +1 -0
  61. package/dist/init/templates.js +187 -0
  62. package/dist/init/templates.js.map +1 -0
  63. package/dist/init/types.d.ts +29 -0
  64. package/dist/init/types.d.ts.map +1 -0
  65. package/dist/init/types.js +15 -0
  66. package/dist/init/types.js.map +1 -0
  67. package/dist/issues/body.d.ts +12 -0
  68. package/dist/issues/body.d.ts.map +1 -0
  69. package/dist/issues/body.js +53 -0
  70. package/dist/issues/body.js.map +1 -0
  71. package/dist/issues/file.d.ts +24 -0
  72. package/dist/issues/file.d.ts.map +1 -0
  73. package/dist/issues/file.js +61 -0
  74. package/dist/issues/file.js.map +1 -0
  75. package/dist/issues/gh-client.d.ts +21 -0
  76. package/dist/issues/gh-client.d.ts.map +1 -0
  77. package/dist/issues/gh-client.js +133 -0
  78. package/dist/issues/gh-client.js.map +1 -0
  79. package/dist/issues/types.d.ts +85 -0
  80. package/dist/issues/types.d.ts.map +1 -0
  81. package/dist/issues/types.js +8 -0
  82. package/dist/issues/types.js.map +1 -0
  83. package/dist/orchestrator/audit.d.ts +14 -0
  84. package/dist/orchestrator/audit.d.ts.map +1 -0
  85. package/dist/orchestrator/audit.js +47 -0
  86. package/dist/orchestrator/audit.js.map +1 -0
  87. package/dist/orchestrator/auto-fix.d.ts +31 -0
  88. package/dist/orchestrator/auto-fix.d.ts.map +1 -0
  89. package/dist/orchestrator/auto-fix.js +59 -0
  90. package/dist/orchestrator/auto-fix.js.map +1 -0
  91. package/dist/orchestrator/extract.d.ts +14 -0
  92. package/dist/orchestrator/extract.d.ts.map +1 -0
  93. package/dist/orchestrator/extract.js +70 -0
  94. package/dist/orchestrator/extract.js.map +1 -0
  95. package/dist/orchestrator/nanocoder-runner.d.ts +33 -0
  96. package/dist/orchestrator/nanocoder-runner.d.ts.map +1 -0
  97. package/dist/orchestrator/nanocoder-runner.js +125 -0
  98. package/dist/orchestrator/nanocoder-runner.js.map +1 -0
  99. package/dist/orchestrator/types.d.ts +51 -0
  100. package/dist/orchestrator/types.d.ts.map +1 -0
  101. package/dist/orchestrator/types.js +8 -0
  102. package/dist/orchestrator/types.js.map +1 -0
  103. package/dist/prompt/build.d.ts +14 -0
  104. package/dist/prompt/build.d.ts.map +1 -0
  105. package/dist/prompt/build.js +123 -0
  106. package/dist/prompt/build.js.map +1 -0
  107. package/dist/prompt/types.d.ts +34 -0
  108. package/dist/prompt/types.d.ts.map +1 -0
  109. package/dist/prompt/types.js +8 -0
  110. package/dist/prompt/types.js.map +1 -0
  111. package/dist/rule-packs/dependencies.d.ts +20 -0
  112. package/dist/rule-packs/dependencies.d.ts.map +1 -0
  113. package/dist/rule-packs/dependencies.js +58 -0
  114. package/dist/rule-packs/dependencies.js.map +1 -0
  115. package/dist/rule-packs/glob.d.ts +23 -0
  116. package/dist/rule-packs/glob.d.ts.map +1 -0
  117. package/dist/rule-packs/glob.js +66 -0
  118. package/dist/rule-packs/glob.js.map +1 -0
  119. package/dist/rule-packs/parse.d.ts +21 -0
  120. package/dist/rule-packs/parse.d.ts.map +1 -0
  121. package/dist/rule-packs/parse.js +230 -0
  122. package/dist/rule-packs/parse.js.map +1 -0
  123. package/dist/rule-packs/types.d.ts +55 -0
  124. package/dist/rule-packs/types.d.ts.map +1 -0
  125. package/dist/rule-packs/types.js +10 -0
  126. package/dist/rule-packs/types.js.map +1 -0
  127. package/dist/run/audit.d.ts +20 -0
  128. package/dist/run/audit.d.ts.map +1 -0
  129. package/dist/run/audit.js +28 -0
  130. package/dist/run/audit.js.map +1 -0
  131. package/dist/run/clone.d.ts +23 -0
  132. package/dist/run/clone.d.ts.map +1 -0
  133. package/dist/run/clone.js +51 -0
  134. package/dist/run/clone.js.map +1 -0
  135. package/dist/run/preview.d.ts +34 -0
  136. package/dist/run/preview.d.ts.map +1 -0
  137. package/dist/run/preview.js +68 -0
  138. package/dist/run/preview.js.map +1 -0
  139. package/dist/run/report.d.ts +10 -0
  140. package/dist/run/report.d.ts.map +1 -0
  141. package/dist/run/report.js +73 -0
  142. package/dist/run/report.js.map +1 -0
  143. package/dist/run/run.d.ts +74 -0
  144. package/dist/run/run.d.ts.map +1 -0
  145. package/dist/run/run.js +131 -0
  146. package/dist/run/run.js.map +1 -0
  147. package/dist/run/select.d.ts +14 -0
  148. package/dist/run/select.d.ts.map +1 -0
  149. package/dist/run/select.js +31 -0
  150. package/dist/run/select.js.map +1 -0
  151. package/dist/run/sources.d.ts +11 -0
  152. package/dist/run/sources.d.ts.map +1 -0
  153. package/dist/run/sources.js +106 -0
  154. package/dist/run/sources.js.map +1 -0
  155. package/dist/run/types.d.ts +55 -0
  156. package/dist/run/types.d.ts.map +1 -0
  157. package/dist/run/types.js +7 -0
  158. package/dist/run/types.js.map +1 -0
  159. package/dist/suppression/apply.d.ts +33 -0
  160. package/dist/suppression/apply.d.ts.map +1 -0
  161. package/dist/suppression/apply.js +55 -0
  162. package/dist/suppression/apply.js.map +1 -0
  163. package/package.json +118 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.js","sourceRoot":"","sources":["../../source/run/run.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAC;AAC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I,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QACnC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM;aAC1B,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,KAAK,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC;aAChD,IAAI,CAAC,IAAI,CAAC,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,qBAAqB,QAAQ,KAAK,MAAM,EAAE,CAAC,CAAC;IAC7D,CAAC;IAED,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;IACzB,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC5E,MAAM,OAAO,GAAG,MAAM,SAAS,CAC9B,IAAI,EACJ,EAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAC,EAC1B,KAAK,EACL,IAAI,CAAC,MAAM,EACX,EAAC,GAAG,OAAO,EAAE,GAAG,EAAE,OAAO,EAAC,CAC1B,CAAC;IAEF,OAAO,EAAC,KAAK,EAAE,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,OAAO,CAAC,EAAE,YAAY,EAAE,EAAE,EAAC,CAAC,EAAC,CAAC;AACvE,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Pure helpers for selecting pack files and the file patterns to gather. A pack
3
+ * file is an enabled `.md` whose path contains no underscore-prefixed segment —
4
+ * the `_starter/` convention that keeps template packs from loading.
5
+ */
6
+ import type { RulePack } from '../rule-packs/types.js';
7
+ /** True if a rule-packs-relative path is an enabled pack file. */
8
+ export declare function isEnabledPackPath(relativePath: string): boolean;
9
+ /**
10
+ * The union of applies_to path globs across packs. Returns an empty list if any
11
+ * pack applies to the whole repository (empty paths), meaning "gather all".
12
+ */
13
+ export declare function unionPatterns(packs: RulePack[]): string[];
14
+ //# sourceMappingURL=select.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../source/run/select.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,wBAAwB,CAAC;AAErD,kEAAkE;AAClE,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAO/D;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,MAAM,EAAE,CAWzD"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Pure helpers for selecting pack files and the file patterns to gather. A pack
3
+ * file is an enabled `.md` whose path contains no underscore-prefixed segment —
4
+ * the `_starter/` convention that keeps template packs from loading.
5
+ */
6
+ /** True if a rule-packs-relative path is an enabled pack file. */
7
+ export function isEnabledPackPath(relativePath) {
8
+ if (!relativePath.endsWith('.md')) {
9
+ return false;
10
+ }
11
+ return relativePath
12
+ .split('/')
13
+ .every(segment => segment.length > 0 && !segment.startsWith('_'));
14
+ }
15
+ /**
16
+ * The union of applies_to path globs across packs. Returns an empty list if any
17
+ * pack applies to the whole repository (empty paths), meaning "gather all".
18
+ */
19
+ export function unionPatterns(packs) {
20
+ const patterns = new Set();
21
+ for (const pack of packs) {
22
+ if (pack.manifest.appliesTo.paths.length === 0) {
23
+ return [];
24
+ }
25
+ for (const pattern of pack.manifest.appliesTo.paths) {
26
+ patterns.add(pattern);
27
+ }
28
+ }
29
+ return [...patterns];
30
+ }
31
+ //# sourceMappingURL=select.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"select.js","sourceRoot":"","sources":["../../source/run/select.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,kEAAkE;AAClE,MAAM,UAAU,iBAAiB,CAAC,YAAoB;IACrD,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACnC,OAAO,KAAK,CAAC;IACd,CAAC;IACD,OAAO,YAAY;SACjB,KAAK,CAAC,GAAG,CAAC;SACV,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;AACpE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,KAAiB;IAC9C,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAU,CAAC;IACnC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QAC1B,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAChD,OAAO,EAAE,CAAC;QACX,CAAC;QACD,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;YACrD,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACvB,CAAC;IACF,CAAC;IACD,OAAO,CAAC,GAAG,QAAQ,CAAC,CAAC;AACtB,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Real filesystem implementations of RepoFiles and PackLoader. Paths come from
3
+ * the operator's own config repo and the repositories they chose to audit, not
4
+ * untrusted input, so the fs reads are annotated nosemgrep.
5
+ */
6
+ import type { PackLoader, RepoFiles } from './types.js';
7
+ /** Read repository files and single files from the local filesystem. */
8
+ export declare const fsRepoFiles: RepoFiles;
9
+ /** Load and parse the enabled rule packs from a directory. */
10
+ export declare const fsPackLoader: PackLoader;
11
+ //# sourceMappingURL=sources.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sources.d.ts","sourceRoot":"","sources":["../../source/run/sources.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH,OAAO,KAAK,EAAc,UAAU,EAAE,SAAS,EAAC,MAAM,YAAY,CAAC;AAiDnE,wEAAwE;AACxE,eAAO,MAAM,WAAW,EAAE,SA2BzB,CAAC;AAEF,8DAA8D;AAC9D,eAAO,MAAM,YAAY,EAAE,UAoB1B,CAAC"}
@@ -0,0 +1,106 @@
1
+ /**
2
+ * Real filesystem implementations of RepoFiles and PackLoader. Paths come from
3
+ * the operator's own config repo and the repositories they chose to audit, not
4
+ * untrusted input, so the fs reads are annotated nosemgrep.
5
+ */
6
+ import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';
7
+ import { join, relative, sep } from 'node:path';
8
+ import { matchesGlob } from '../rule-packs/glob.js';
9
+ import { parseRulePack } from '../rule-packs/parse.js';
10
+ import { isEnabledPackPath } from './select.js';
11
+ const IGNORED_DIRS = new Set([
12
+ '.git',
13
+ 'node_modules',
14
+ 'dist',
15
+ 'build',
16
+ 'coverage',
17
+ '.next',
18
+ 'out',
19
+ 'vendor',
20
+ 'target',
21
+ ]);
22
+ /** Skip files larger than this — likely generated or binary, and token-heavy. */
23
+ const MAX_FILE_BYTES = 512 * 1024;
24
+ /** Recursively list files under root, skipping noise directories. */
25
+ function walkFiles(root) {
26
+ const out = [];
27
+ const stack = [root];
28
+ while (stack.length > 0) {
29
+ const dir = stack.pop();
30
+ let entries;
31
+ try {
32
+ entries = readdirSync(dir); // nosemgrep
33
+ }
34
+ catch {
35
+ /* c8 ignore next 2 -- unreadable directory */
36
+ continue;
37
+ }
38
+ for (const entry of entries) {
39
+ const full = join(dir, entry);
40
+ const stats = statSync(full); // nosemgrep
41
+ if (stats.isDirectory()) {
42
+ if (!IGNORED_DIRS.has(entry)) {
43
+ stack.push(full);
44
+ }
45
+ }
46
+ else if (stats.isFile()) {
47
+ out.push(full);
48
+ }
49
+ }
50
+ }
51
+ return out;
52
+ }
53
+ function toPosix(path) {
54
+ return path.split(sep).join('/');
55
+ }
56
+ /** Read repository files and single files from the local filesystem. */
57
+ export const fsRepoFiles = {
58
+ async read(repoDir, patterns) {
59
+ const files = [];
60
+ for (const full of walkFiles(repoDir)) {
61
+ const relativePath = toPosix(relative(repoDir, full));
62
+ if (patterns.length > 0 &&
63
+ !patterns.some(pattern => matchesGlob(pattern, relativePath))) {
64
+ continue;
65
+ }
66
+ if (statSync(full).size > MAX_FILE_BYTES) {
67
+ continue;
68
+ }
69
+ files.push({ path: relativePath, content: readFileSync(full, 'utf8') }); // nosemgrep
70
+ }
71
+ files.sort((a, b) => a.path.localeCompare(b.path));
72
+ return files;
73
+ },
74
+ async readText(path) {
75
+ try {
76
+ return readFileSync(path, 'utf8'); // nosemgrep
77
+ }
78
+ catch {
79
+ return null;
80
+ }
81
+ },
82
+ };
83
+ /** Load and parse the enabled rule packs from a directory. */
84
+ export const fsPackLoader = {
85
+ async load(packsDir) {
86
+ const result = { packs: [], errors: [] };
87
+ if (!existsSync(packsDir)) {
88
+ return result;
89
+ }
90
+ for (const full of walkFiles(packsDir)) {
91
+ const relativePath = toPosix(relative(packsDir, full));
92
+ if (!isEnabledPackPath(relativePath)) {
93
+ continue;
94
+ }
95
+ const parsed = parseRulePack(readFileSync(full, 'utf8')); // nosemgrep
96
+ if (parsed.valid && parsed.pack) {
97
+ result.packs.push(parsed.pack);
98
+ }
99
+ else {
100
+ result.errors.push({ file: relativePath, errors: parsed.errors });
101
+ }
102
+ }
103
+ return result;
104
+ },
105
+ };
106
+ //# sourceMappingURL=sources.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sources.js","sourceRoot":"","sources":["../../source/run/sources.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAC,MAAM,SAAS,CAAC;AACxE,OAAO,EAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAC,MAAM,WAAW,CAAC;AAE9C,OAAO,EAAC,WAAW,EAAC,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAC,aAAa,EAAC,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAC,iBAAiB,EAAC,MAAM,aAAa,CAAC;AAG9C,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC;I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,MAAM,GAAgB,EAAC,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAC,CAAC;QACpD,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC3B,OAAO,MAAM,CAAC;QACf,CAAC;QACD,KAAK,MAAM,IAAI,IAAI,SAAS,CAAC,QAAQ,CAAC,EAAE,CAAC;YACxC,MAAM,YAAY,GAAG,OAAO,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC;YACvD,IAAI,CAAC,iBAAiB,CAAC,YAAY,CAAC,EAAE,CAAC;gBACtC,SAAS;YACV,CAAC;YACD,MAAM,MAAM,GAAG,aAAa,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,YAAY;YACtE,IAAI,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;gBACjC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAChC,CAAC;iBAAM,CAAC;gBACP,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAC,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAC,CAAC,CAAC;YACjE,CAAC;QACF,CAAC;QACD,OAAO,MAAM,CAAC;IACf,CAAC;CACD,CAAC"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Types for `sentinel run`, the audit runtime. The orchestrator (run.ts)
3
+ * depends on these injectable sources so the whole pipeline is testable with
4
+ * fakes; the real filesystem/gh/nanocoder implementations live at the edges.
5
+ */
6
+ import type { Finding } from '../findings/types.js';
7
+ import type { ValidationError } from '../findings/validate.js';
8
+ import type { SourceFile } from '../prompt/types.js';
9
+ import type { RulePack, RulePackError } from '../rule-packs/types.js';
10
+ /** Reads repository source files and single files from disk (injectable). */
11
+ export interface RepoFiles {
12
+ /** Read files under `repoDir` matching any of the glob patterns. An empty
13
+ * pattern list means the whole repository. */
14
+ read(repoDir: string, patterns: string[]): Promise<SourceFile[]>;
15
+ /** Read a single file's text, or null if it does not exist. */
16
+ readText(path: string): Promise<string | null>;
17
+ }
18
+ /** A pack that failed to parse while loading the rule-packs directory. */
19
+ export interface PackLoadError {
20
+ file: string;
21
+ errors: RulePackError[];
22
+ }
23
+ /** The result of loading the rule-packs directory. */
24
+ export interface LoadedPacks {
25
+ packs: RulePack[];
26
+ errors: PackLoadError[];
27
+ }
28
+ /** Loads and parses the enabled rule packs from a directory (injectable). */
29
+ export interface PackLoader {
30
+ load(packsDir: string): Promise<LoadedPacks>;
31
+ }
32
+ /** The outcome of one pack's audit pass against one repository. */
33
+ export interface PackOutcome {
34
+ pack: string;
35
+ version: string;
36
+ findings: Finding[];
37
+ attempts: number;
38
+ ok: boolean;
39
+ errors: ValidationError[];
40
+ runError?: string;
41
+ /** The raw model output, kept for diagnosing a failed audit. */
42
+ raw?: string;
43
+ }
44
+ /** All pack outcomes for one repository. */
45
+ export interface RepoOutcome {
46
+ repo: string;
47
+ packs: PackOutcome[];
48
+ /** Packs named by the target but missing from the rule-packs directory. */
49
+ missingPacks: string[];
50
+ }
51
+ /** Everything one run produced. */
52
+ export interface RunOutcome {
53
+ repos: RepoOutcome[];
54
+ }
55
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../source/run/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAC,QAAQ,EAAE,aAAa,EAAC,MAAM,wBAAwB,CAAC;AAEpE,6EAA6E;AAC7E,MAAM,WAAW,SAAS;IACzB;kDAC8C;IAC9C,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;IACjE,+DAA+D;IAC/D,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CAC/C;AAED,0EAA0E;AAC1E,MAAM,WAAW,aAAa;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,aAAa,EAAE,CAAC;CACxB;AAED,sDAAsD;AACtD,MAAM,WAAW,WAAW;IAC3B,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,MAAM,EAAE,aAAa,EAAE,CAAC;CACxB;AAED,6EAA6E;AAC7E,MAAM,WAAW,UAAU;IAC1B,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;CAC7C;AAED,mEAAmE;AACnE,MAAM,WAAW,WAAW;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,eAAe,EAAE,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gEAAgE;IAChE,GAAG,CAAC,EAAE,MAAM,CAAC;CACb;AAED,4CAA4C;AAC5C,MAAM,WAAW,WAAW;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,2EAA2E;IAC3E,YAAY,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,mCAAmC;AACnC,MAAM,WAAW,UAAU;IAC1B,KAAK,EAAE,WAAW,EAAE,CAAC;CACrB"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Types for `sentinel run`, the audit runtime. The orchestrator (run.ts)
3
+ * depends on these injectable sources so the whole pipeline is testable with
4
+ * fakes; the real filesystem/gh/nanocoder implementations live at the edges.
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../source/run/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * The third suppression layer: the opt-in per-repo `sentinel.yaml` override
3
+ * (see docs/findings/index.md#suppression). It can lower or raise the filing
4
+ * threshold for one repo and declare systematic-noise exemptions matched by
5
+ * rule and/or path glob. The content-hash floor and the label layer live in the
6
+ * dedup planner; this is the escape hatch layered on top.
7
+ */
8
+ import type { RepoOverride, SentinelConfig, Suppression } from '../config/types.js';
9
+ import type { Finding, Severity } from '../findings/types.js';
10
+ /**
11
+ * A finding matches a suppression when its rule matches (if the suppression
12
+ * names one) and its file matches (if the suppression lists paths). Rule and
13
+ * path patterns are globs, so `solana-anchor/*` or `programs/vault/**` work.
14
+ */
15
+ export declare function matchesSuppression(finding: Finding, suppression: Suppression): boolean;
16
+ /** True if any of the override's suppressions match the finding. */
17
+ export declare function isSuppressed(finding: Finding, override: RepoOverride): boolean;
18
+ /** The effect of applying a per-repo override to a run's findings. */
19
+ export interface OverrideOutcome {
20
+ /** Findings that survive the override, in input order. */
21
+ kept: Finding[];
22
+ /** Findings removed by a suppression rule. */
23
+ suppressed: Finding[];
24
+ /** The threshold to file at: the override's, or the org default. */
25
+ threshold: Severity;
26
+ }
27
+ /**
28
+ * Apply a per-repo override to a run's findings: partition out the suppressed
29
+ * ones and resolve the effective severity threshold. With no override, every
30
+ * finding is kept and the org threshold stands.
31
+ */
32
+ export declare function applyRepoOverride(findings: Finding[], config: SentinelConfig, override?: RepoOverride): OverrideOutcome;
33
+ //# sourceMappingURL=apply.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apply.d.ts","sourceRoot":"","sources":["../../source/suppression/apply.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACX,YAAY,EACZ,cAAc,EACd,WAAW,EACX,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAG5D;;;;GAIG;AACH,wBAAgB,kBAAkB,CACjC,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,WAAW,GACtB,OAAO,CAcT;AAED,oEAAoE;AACpE,wBAAgB,YAAY,CAC3B,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,YAAY,GACpB,OAAO,CAIT;AAED,sEAAsE;AACtE,MAAM,WAAW,eAAe;IAC/B,0DAA0D;IAC1D,IAAI,EAAE,OAAO,EAAE,CAAC;IAChB,8CAA8C;IAC9C,UAAU,EAAE,OAAO,EAAE,CAAC;IACtB,oEAAoE;IACpE,SAAS,EAAE,QAAQ,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAChC,QAAQ,EAAE,OAAO,EAAE,EACnB,MAAM,EAAE,cAAc,EACtB,QAAQ,CAAC,EAAE,YAAY,GACrB,eAAe,CAgBjB"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * The third suppression layer: the opt-in per-repo `sentinel.yaml` override
3
+ * (see docs/findings/index.md#suppression). It can lower or raise the filing
4
+ * threshold for one repo and declare systematic-noise exemptions matched by
5
+ * rule and/or path glob. The content-hash floor and the label layer live in the
6
+ * dedup planner; this is the escape hatch layered on top.
7
+ */
8
+ import { matchesGlob } from '../rule-packs/glob.js';
9
+ /**
10
+ * A finding matches a suppression when its rule matches (if the suppression
11
+ * names one) and its file matches (if the suppression lists paths). Rule and
12
+ * path patterns are globs, so `solana-anchor/*` or `programs/vault/**` work.
13
+ */
14
+ export function matchesSuppression(finding, suppression) {
15
+ const hasRule = suppression.rule !== undefined && suppression.rule.length > 0;
16
+ const hasPaths = suppression.paths.length > 0;
17
+ // Defensive: a suppression with neither clause never matches anything.
18
+ if (!hasRule && !hasPaths) {
19
+ return false;
20
+ }
21
+ const ruleMatches = hasRule
22
+ ? matchesGlob(suppression.rule, finding.rule)
23
+ : true;
24
+ const pathMatches = hasPaths
25
+ ? suppression.paths.some(pattern => matchesGlob(pattern, finding.file))
26
+ : true;
27
+ return ruleMatches && pathMatches;
28
+ }
29
+ /** True if any of the override's suppressions match the finding. */
30
+ export function isSuppressed(finding, override) {
31
+ return override.suppress.some(suppression => matchesSuppression(finding, suppression));
32
+ }
33
+ /**
34
+ * Apply a per-repo override to a run's findings: partition out the suppressed
35
+ * ones and resolve the effective severity threshold. With no override, every
36
+ * finding is kept and the org threshold stands.
37
+ */
38
+ export function applyRepoOverride(findings, config, override) {
39
+ const threshold = override?.severityThreshold ?? config.severityThreshold;
40
+ if (!override || override.suppress.length === 0) {
41
+ return { kept: findings, suppressed: [], threshold };
42
+ }
43
+ const kept = [];
44
+ const suppressed = [];
45
+ for (const finding of findings) {
46
+ if (isSuppressed(finding, override)) {
47
+ suppressed.push(finding);
48
+ }
49
+ else {
50
+ kept.push(finding);
51
+ }
52
+ }
53
+ return { kept, suppressed, threshold };
54
+ }
55
+ //# sourceMappingURL=apply.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apply.js","sourceRoot":"","sources":["../../source/suppression/apply.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAQH,OAAO,EAAC,WAAW,EAAC,MAAM,uBAAuB,CAAC;AAElD;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CACjC,OAAgB,EAChB,WAAwB;IAExB,MAAM,OAAO,GAAG,WAAW,CAAC,IAAI,KAAK,SAAS,IAAI,WAAW,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;IAC9E,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;IAC9C,uEAAuE;IACvE,IAAI,CAAC,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC3B,OAAO,KAAK,CAAC;IACd,CAAC;IACD,MAAM,WAAW,GAAG,OAAO;QAC1B,CAAC,CA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,EAAE,UAAU,EAAE,SAAS,EAAC,CAAC;AACtC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,118 @@
1
+ {
2
+ "name": "@nanocollective/sentinel",
3
+ "version": "0.1.0-alpha.0",
4
+ "description": "An installable, Nanocoder-driven workflow that runs continuous, configurable security and code audits across a GitHub organisation's repositories and files findings as issues.",
5
+ "keywords": [
6
+ "security",
7
+ "audit",
8
+ "sast",
9
+ "github-actions",
10
+ "nanocoder",
11
+ "local-first",
12
+ "code-review",
13
+ "typescript"
14
+ ],
15
+ "author": "Nano Collective",
16
+ "license": "MIT",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "https://github.com/Nano-Collective/sentinel.git"
20
+ },
21
+ "homepage": "https://github.com/Nano-Collective/sentinel#readme",
22
+ "bugs": {
23
+ "url": "https://github.com/Nano-Collective/sentinel/issues"
24
+ },
25
+ "type": "module",
26
+ "main": "dist/index.js",
27
+ "types": "dist/index.d.ts",
28
+ "bin": {
29
+ "sentinel": "dist/cli.js"
30
+ },
31
+ "packageManager": "pnpm@11.0.9",
32
+ "engines": {
33
+ "node": ">=22"
34
+ },
35
+ "publishConfig": {
36
+ "access": "public"
37
+ },
38
+ "files": [
39
+ "dist",
40
+ "README.md",
41
+ "LICENSE"
42
+ ],
43
+ "scripts": {
44
+ "build": "tsc && tsc-alias && chmod +x dist/cli.js",
45
+ "dev": "tsc --watch",
46
+ "start": "node dist/cli.js",
47
+ "prepublishOnly": "pnpm build",
48
+ "test:all": "./scripts/test.sh",
49
+ "test:ava": "ava",
50
+ "test:ava:coverage": "c8 ava",
51
+ "test:format": "biome check --no-errors-on-unmatched .",
52
+ "test:types": "tsc --noEmit",
53
+ "test:lint": "biome lint .",
54
+ "test:lint:fix": "biome check --write --unsafe .",
55
+ "test:knip": "knip",
56
+ "test:audit": "pnpm audit --audit-level=high --ignore-unfixable",
57
+ "test:security": "semgrep scan --config auto --error",
58
+ "format": "biome check --write .",
59
+ "format:check": "biome check .",
60
+ "prepare": "husky"
61
+ },
62
+ "dependencies": {
63
+ "yaml": "^2.8.3"
64
+ },
65
+ "devDependencies": {
66
+ "@biomejs/biome": "^2.5.0",
67
+ "@types/node": "^25.9.3",
68
+ "ava": "^7.0.0",
69
+ "c8": "^11.0.0",
70
+ "husky": "^9.1.7",
71
+ "knip": "^6.0.0",
72
+ "lint-staged": "^17.0.7",
73
+ "tsc-alias": "^1.8.16",
74
+ "tsx": "^4.20.6",
75
+ "typescript": "^5.0.3"
76
+ },
77
+ "lint-staged": {
78
+ "*.{js,ts,jsx,tsx,json,md}": [
79
+ "biome check --write --no-errors-on-unmatched"
80
+ ]
81
+ },
82
+ "ava": {
83
+ "extensions": {
84
+ "ts": "module"
85
+ },
86
+ "nodeArguments": [
87
+ "--import=tsx",
88
+ "--no-warnings"
89
+ ],
90
+ "files": [
91
+ "source/**/*.spec.ts",
92
+ "!source/**/*-helpers.ts",
93
+ "!source/**/test-helpers.ts"
94
+ ],
95
+ "workerThreads": false,
96
+ "serial": true,
97
+ "environmentVariables": {
98
+ "NODE_ENV": "test"
99
+ }
100
+ },
101
+ "c8": {
102
+ "exclude": [
103
+ "source/cli.ts",
104
+ "source/index.ts",
105
+ "source/**/*.spec.ts"
106
+ ],
107
+ "reporter": [
108
+ "text",
109
+ "json-summary",
110
+ "lcov"
111
+ ],
112
+ "check-coverage": true,
113
+ "lines": 80,
114
+ "functions": 0,
115
+ "branches": 0,
116
+ "statements": 0
117
+ }
118
+ }