soundings-cli 0.1.0 → 0.2.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/LICENSE CHANGED
@@ -6,8 +6,8 @@ Soundings is source-available. It is not open source in the OSI sense. Two licen
6
6
 
7
7
  | Part | Licence |
8
8
  | --- | --- |
9
- | Everything in this repository and package **except** `src/pro/` | Functional Source License 1.1, Apache 2.0 future licence (`FSL-1.1-ALv2`), below |
10
- | `src/pro/`, and the parts of `dist/` compiled from it (the paid features) | Soundings Commercial Licence, in [`LICENSE-COMMERCIAL.md`](LICENSE-COMMERCIAL.md) |
9
+ | Everything in this repository and package **except** the paid features listed in `LICENSE-COMMERCIAL.md` | Functional Source License 1.1, Apache 2.0 future licence (`FSL-1.1-ALv2`), below |
10
+ | The paid features: the files and folders listed in section 1 of [`LICENSE-COMMERCIAL.md`](LICENSE-COMMERCIAL.md), and the parts of `dist/` compiled from them | Soundings Commercial Licence, in [`LICENSE-COMMERCIAL.md`](LICENSE-COMMERCIAL.md) | Soundings Commercial Licence, in [`LICENSE-COMMERCIAL.md`](LICENSE-COMMERCIAL.md) |
11
11
 
12
12
  In plain terms, and not replacing either licence:
13
13
 
@@ -4,7 +4,14 @@ Copyright 2026 Dynamo Maritime Ltd, registered in England and Wales, company num
4
4
 
5
5
  ## 1. What this licence covers
6
6
 
7
- "Paid Features" means the source code in the `src/pro/` folder of Soundings, and that code in any compiled or bundled form, including the parts of `dist/` built from it. The rest of Soundings is licensed separately under the Functional Source License (see `LICENSE`).
7
+ "Paid Features" means the source code of these files and folders of Soundings, and that code in any compiled or bundled form, including the parts of `dist/` built from it:
8
+
9
+ - `src/documents/build.ts`;
10
+ - the `src/import/` folder;
11
+ - these files in `src/export/`: `docx.ts`, `footnotes.ts`, `html.ts`, `markdown-model.ts`, `questionnaire.ts`, `render.ts` and `zip.ts`; and
12
+ - the parts of `src/cli/main.ts` that run the `answers`, `answer` and `document` commands and the `html` and `docx` export formats.
13
+
14
+ Everything else in Soundings is licensed separately under the Functional Source License (see `LICENSE`). That includes the scanner, the question flow, the `verify` command, the fixed wording in `src/export/notice.ts` and `src/documents/templates.ts`, and the licence check itself (which section 4 still protects). If a file is added to the list above in a later release, the change is recorded in `CHANGELOG.md`.
8
15
 
9
16
  "Licence Key" means a key issued by us, or by a reseller acting for us, when you buy a Soundings plan (for example Pro or Agency). "Plan" means the plan the Licence Key was issued for, together with its limits, such as the number of machines.
10
17
 
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  Soundings scans a project on your own machine and records what it finds: which AI providers it calls, where data is stored and sent, how users sign in, how keys are handled. Answers to a client's security questionnaire are then built from those findings, and anything the code can't tell it becomes a question for you. Your code never leaves your machine.
6
6
 
7
- Status: 0.1.0. Scanning, questions, answers, questionnaire import, verification, licensing, the five documents and the exports work. Nothing is published yet. Nothing is published yet.
7
+ Status: 0.2.0. Scanning, questions, answers, questionnaire import, verification, licensing, the five documents and the exports work. Available on npm as `soundings-cli`.
8
8
 
9
9
  ```
10
10
  soundings scan . # what does the code show?
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- /*! Soundings (c) 2026 Dynamo Maritime Ltd. Licensed under FSL-1.1-ALv2, except code from src/pro/,
3
- * which is under the Soundings Commercial Licence. See LICENSE and LICENSE-COMMERCIAL.md. */
2
+ /*! Soundings (c) 2026 Dynamo Maritime Ltd. Licensed under FSL-1.1-ALv2, except the paid features listed in LICENSE-COMMERCIAL.md,
3
+ * which are under the Soundings Commercial Licence. See LICENSE. */
4
4
 
5
5
  // src/cli/index.ts
6
6
  import { createInterface } from "readline/promises";
@@ -2030,16 +2030,20 @@ var AI_CALL_TAILS = [
2030
2030
  ["messages", "stream"],
2031
2031
  ["generate_content"],
2032
2032
  ["generate_content_async"],
2033
- ["generate_text"]
2033
+ ["generate_text"],
2034
+ ["chat", "complete"],
2035
+ ["chat", "complete_async"],
2036
+ ["chat", "stream"],
2037
+ ["chat", "stream_async"]
2034
2038
  ];
2035
2039
  var CONTENT_KEYS = /* @__PURE__ */ new Set(["content", "prompt", "input", "contents", "text", "system", "messages", "query"]);
2036
- function aiPayload(lines, calls2, funcs) {
2040
+ function aiPayload(lines, calls2, funcs, ownTails = []) {
2037
2041
  const params = new Set(funcs.flatMap((f) => f.params));
2038
2042
  for (const n of handlerInputs(funcs)) params.add(n);
2039
2043
  const reqVars = requestVariables2(lines);
2040
2044
  let best = null;
2041
2045
  for (const c of calls2) {
2042
- if (!AI_CALL_TAILS.some((t) => callEndsWith(c.chain, t))) continue;
2046
+ if (!AI_CALL_TAILS.some((t) => callEndsWith(c.chain, t)) && !ownTails.some((t) => c.chain.length > t.length && callEndsWith(c.chain, t))) continue;
2043
2047
  const roots = /* @__PURE__ */ new Set();
2044
2048
  for (const v of valuesOf(c.args, CONTENT_KEYS)) {
2045
2049
  if (v.length === 1 && v[0].t === "str" && !isFString(v[0].s)) continue;
@@ -2180,6 +2184,22 @@ var AI_PROVIDERS = [
2180
2184
  { id: "ai-provider/openai-sdk", subject: "OpenAI", packages: ["openai", "@ai-sdk/openai"], pyModules: ["openai", "langchain_openai"] },
2181
2185
  { id: "ai-provider/anthropic-sdk", subject: "Anthropic", packages: ["@anthropic-ai/sdk", "@ai-sdk/anthropic"], pyModules: ["anthropic", "langchain_anthropic"] },
2182
2186
  { id: "ai-provider/google-sdk", subject: "Google AI", packages: ["@google/generative-ai", "@google/genai", "@ai-sdk/google"], pyModules: ["google.generativeai", "google.genai", "langchain_google_genai", "vertexai"] },
2187
+ { id: "ai-provider/mistral-sdk", subject: "Mistral", packages: ["@mistralai/mistralai", "@ai-sdk/mistral"], pyModules: ["mistralai", "langchain_mistralai"] },
2188
+ {
2189
+ id: "ai-provider/cohere-sdk",
2190
+ subject: "Cohere",
2191
+ packages: ["cohere-ai", "@ai-sdk/cohere"],
2192
+ pyModules: ["cohere", "langchain_cohere"],
2193
+ calls: { js: [["chat"], ["chatStream"]], py: [["chat"], ["chat_stream"]] }
2194
+ },
2195
+ { id: "ai-provider/groq-sdk", subject: "Groq", packages: ["groq-sdk", "@ai-sdk/groq"], pyModules: ["groq"] },
2196
+ {
2197
+ id: "ai-provider/bedrock-sdk",
2198
+ subject: "AWS Bedrock",
2199
+ packages: ["@aws-sdk/client-bedrock-runtime", "@ai-sdk/amazon-bedrock"],
2200
+ pyModules: ["langchain_aws"],
2201
+ commands: ["ConverseCommand", "ConverseStreamCommand"]
2202
+ },
2183
2203
  { id: "ai-provider/vercel-ai-sdk", subject: "Vercel AI SDK", packages: ["ai"], pyModules: [] }
2184
2204
  ];
2185
2205
  function providersIn(f) {
@@ -2238,19 +2258,36 @@ var AI_CALL_TAILS2 = [
2238
2258
  ["messages", "create"],
2239
2259
  ["messages", "stream"],
2240
2260
  ["generateContent"],
2241
- ["generateContentStream"]
2261
+ ["generateContentStream"],
2262
+ ["chat", "complete"],
2263
+ ["chat", "stream"]
2242
2264
  ];
2243
2265
  var AI_CALL_FUNCTIONS = /* @__PURE__ */ new Set(["generateText", "streamText", "generateObject", "streamObject", "embed", "embedMany"]);
2244
2266
  var CONTENT_KEYS2 = /* @__PURE__ */ new Set(["content", "prompt", "input", "contents", "text", "system", "messages"]);
2245
- function payloadIn(f) {
2267
+ function payloadIn(f, providers) {
2246
2268
  const requestVars = requestVariables(f.ast);
2247
2269
  const params = paramNames(f.ast);
2270
+ const ownTails = providers.flatMap((p) => p.calls?.js ?? []);
2271
+ const commands = new Set(providers.flatMap((p) => p.commands ?? []));
2248
2272
  let best = null;
2273
+ const sends = [];
2249
2274
  for (const call of calls(f.ast)) {
2250
- const isAiCall = call.chain !== null && AI_CALL_TAILS2.some((t) => endsWith(call.chain, t)) || call.chain !== null && call.chain.length === 1 && AI_CALL_FUNCTIONS.has(call.chain[0]);
2251
- if (!isAiCall || call.node.type !== "CallExpression") continue;
2275
+ const isAiCall = call.chain !== null && AI_CALL_TAILS2.some((t) => endsWith(call.chain, t)) || call.chain !== null && call.chain.length === 1 && AI_CALL_FUNCTIONS.has(call.chain[0]) || call.chain !== null && ownTails.some((t) => call.chain.length > t.length && endsWith(call.chain, t));
2276
+ if (isAiCall && call.node.type === "CallExpression") sends.push({ args: call.node.arguments, ...call.line ? { line: call.line } : {} });
2277
+ }
2278
+ if (commands.size > 0) {
2279
+ walkAst(f.ast, (n) => {
2280
+ if (n.type !== "NewExpression") return void 0;
2281
+ const chain = chainOf(n.callee);
2282
+ const line = lineOf(n);
2283
+ if (chain && commands.has(chain[chain.length - 1])) sends.push({ args: n.arguments, ...line ? { line } : {} });
2284
+ return void 0;
2285
+ });
2286
+ }
2287
+ sends.sort((a, b) => (a.line ?? 0) - (b.line ?? 0));
2288
+ for (const call of sends) {
2252
2289
  const roots = /* @__PURE__ */ new Set();
2253
- for (const arg of call.node.arguments) {
2290
+ for (const arg of call.args) {
2254
2291
  walkAst(arg, (n) => {
2255
2292
  if (n.type === "ObjectProperty" && !n.computed) {
2256
2293
  const key = n.key.type === "Identifier" ? n.key.name : n.key.type === "StringLiteral" ? n.key.value : null;
@@ -2274,7 +2311,7 @@ var dataFlowDetector = {
2274
2311
  for (const f of ctx.py) {
2275
2312
  const providers = AI_PROVIDERS.filter((p) => p.pyModules.length > 0 && importsPy(f, ...p.pyModules));
2276
2313
  if (providers.length === 0) continue;
2277
- const payload = aiPayload(f.lines, f.calls, f.funcs);
2314
+ const payload = aiPayload(f.lines, f.calls, f.funcs, providers.flatMap((p) => p.calls?.py ?? []));
2278
2315
  if (!payload) continue;
2279
2316
  for (const p of providers) {
2280
2317
  facts.push({
@@ -2292,7 +2329,7 @@ var dataFlowDetector = {
2292
2329
  for (const f of ctx.js) {
2293
2330
  const providers = providersIn(f);
2294
2331
  if (providers.length === 0) continue;
2295
- const payload = payloadIn(f);
2332
+ const payload = payloadIn(f, providers);
2296
2333
  if (!payload) continue;
2297
2334
  for (const p of providers) {
2298
2335
  facts.push({
@@ -2625,6 +2662,98 @@ function storeDetector(spec) {
2625
2662
  ]
2626
2663
  };
2627
2664
  }
2665
+ var ENGINES = {
2666
+ postgresql: { subject: "PostgreSQL", engine: "postgresql" },
2667
+ postgres: { subject: "PostgreSQL", engine: "postgresql" },
2668
+ mysql: { subject: "MySQL", engine: "mysql" },
2669
+ sqlite: { subject: "SQLite", engine: "sqlite" },
2670
+ mongodb: { subject: "MongoDB", engine: "mongodb" },
2671
+ sqlserver: { subject: "SQL Server", engine: "sqlserver" },
2672
+ cockroachdb: { subject: "CockroachDB", engine: "cockroachdb" }
2673
+ };
2674
+ var PRISMA_STRING = /"(?:[^"\\\n]|\\.)*"/.source;
2675
+ var blankLineComments = (text) => text.replace(new RegExp(`${PRISMA_STRING}|\\/\\/[^\\n]*`, "g"), (m) => m.startsWith("//") ? " ".repeat(m.length) : m);
2676
+ function prismaProviders(text) {
2677
+ const code = blankLineComments(text);
2678
+ const out = [];
2679
+ for (const block of code.matchAll(/\bdatasource\s+\w+\s*\{([^}]*)\}/g)) {
2680
+ const body = block[1];
2681
+ const m = [...body.matchAll(new RegExp(`${PRISMA_STRING}|\\bprovider\\s*=\\s*"([^"\\n]*)"`, "g"))].find((x) => x[0].startsWith("provider"));
2682
+ if (!m) continue;
2683
+ const start = (block.index ?? 0) + block[0].indexOf(body) + (m.index ?? 0);
2684
+ out.push({ provider: m[1].trim().toLowerCase(), offset: start });
2685
+ }
2686
+ return out;
2687
+ }
2688
+ var prisma = {
2689
+ id: "data-store/prisma",
2690
+ skipReason: (ctx) => ctx.hasDep("@prisma/client") ? null : "no Prisma client in dependencies",
2691
+ run: (ctx) => {
2692
+ const imports = ctx.js.flatMap((f) => {
2693
+ const imp = importsModule(f, "@prisma/client");
2694
+ return imp ? [{ file: f.file, ...imp.line ? { line: imp.line } : {} }] : [];
2695
+ });
2696
+ if (imports.length === 0) return [];
2697
+ const facts = [];
2698
+ const schemas = ctx.project.files.filter((f) => f.endsWith(".prisma") && isProductFile(f)).sort();
2699
+ for (const file of schemas) {
2700
+ const text = ctx.project.read(file);
2701
+ if (text === null) continue;
2702
+ for (const { provider, offset } of prismaProviders(text)) {
2703
+ const known = ENGINES[provider];
2704
+ if (!known) continue;
2705
+ facts.push({
2706
+ kind: "data_store",
2707
+ subject: known.subject,
2708
+ claim: `The app stores data in ${known.subject} through Prisma, as set by the datasource provider in its Prisma schema.`,
2709
+ attributes: { engine: known.engine },
2710
+ confidence: "high",
2711
+ detector: "data-store/prisma",
2712
+ key: file,
2713
+ // The schema line is the source of the engine; the import only has to exist for the fact to.
2714
+ locations: [{ file, line: ctx.project.position(file, offset).line }]
2715
+ });
2716
+ }
2717
+ }
2718
+ if (facts.length > 0) return facts;
2719
+ return [
2720
+ {
2721
+ kind: "data_store",
2722
+ subject: "SQL database (Prisma)",
2723
+ claim: "The app uses the Prisma client, but no Prisma schema in the project says which database engine it connects to.",
2724
+ attributes: { engine: "sql" },
2725
+ confidence: "medium",
2726
+ detector: "data-store/prisma",
2727
+ key: imports[0].file,
2728
+ locations: imports
2729
+ }
2730
+ ];
2731
+ }
2732
+ };
2733
+ var DRIZZLE_CORE = { "drizzle-orm/pg-core": "postgresql", "drizzle-orm/mysql-core": "mysql", "drizzle-orm/sqlite-core": "sqlite" };
2734
+ var drizzle = {
2735
+ id: "data-store/drizzle",
2736
+ skipReason: (ctx) => ctx.hasDep("drizzle-orm") ? null : "no Drizzle ORM in dependencies",
2737
+ run: (ctx) => ctx.js.flatMap((f) => {
2738
+ const uses = f.imports.filter((i) => i.source === "drizzle-orm" || i.source.startsWith("drizzle-orm/"));
2739
+ if (uses.length === 0) return [];
2740
+ const fact = (subject, engine, claim, line) => ({
2741
+ kind: "data_store",
2742
+ subject,
2743
+ claim,
2744
+ attributes: { engine },
2745
+ confidence: "high",
2746
+ detector: "data-store/drizzle",
2747
+ key: f.file,
2748
+ locations: [{ file: f.file, ...line ? { line } : {} }]
2749
+ });
2750
+ const specific = uses.flatMap((i) => {
2751
+ const known = ENGINES[DRIZZLE_CORE[i.source] ?? ""];
2752
+ return known ? [fact(known.subject, known.engine, `The app stores data in ${known.subject} through Drizzle ORM: it imports Drizzle's ${known.subject} schema module.`, i.line)] : [];
2753
+ });
2754
+ return specific.length > 0 ? specific : [fact("SQL database (Drizzle)", "sql", "The app uses Drizzle ORM, but its imports don't show which database engine it connects to.", uses[0].line)];
2755
+ })
2756
+ };
2628
2757
  var CONNECTION_FILE = /\.(?:py|ya?ml|toml|ini|cfg|json)$|(?:^|\/)\.env(?:\.[\w.-]+)?$/;
2629
2758
  var CONNECTION_STRING = /\b(postgres(?:ql)?(?:\+\w+)?|mysql(?:\+\w+)?|mongodb(?:\+srv)?|rediss?):\/\//gi;
2630
2759
  var CONNECTION_SUBJECT = (scheme) => {
@@ -2660,7 +2789,7 @@ var connectionString = {
2660
2789
  return facts;
2661
2790
  }
2662
2791
  };
2663
- var storeDetectors = [supabase, ...STORES.map(storeDetector), connectionString];
2792
+ var storeDetectors = [supabase, ...STORES.map(storeDetector), prisma, drizzle, connectionString];
2664
2793
 
2665
2794
  // src/verify/entities.ts
2666
2795
  var EXTRA = [
@@ -2689,12 +2818,13 @@ var EXTRA = [
2689
2818
  "Zendesk",
2690
2819
  "Intercom"
2691
2820
  ];
2692
- var VENDOR_WORDS = ["Vercel", "Supabase", "Firebase", "Google", "Plausible", "Stripe", "OpenAI", "Anthropic", "Sentry", "PostHog", "Mixpanel", "Segment", "Resend", "SendGrid", "Postmark", "Twilio", "Clerk", "Auth0", "Hotjar"];
2821
+ var VENDOR_WORDS = ["Vercel", "Supabase", "Firebase", "Google", "Bedrock", "Plausible", "Stripe", "OpenAI", "Anthropic", "Sentry", "PostHog", "Mixpanel", "Segment", "Resend", "SendGrid", "Postmark", "Twilio", "Clerk", "Auth0", "Hotjar"];
2693
2822
  function build() {
2694
2823
  const names = /* @__PURE__ */ new Set();
2695
2824
  for (const p of AI_PROVIDERS) names.add(p.subject);
2696
2825
  for (const s of SERVICES) names.add(s.subject);
2697
2826
  for (const s of STORES) names.add(s.subject);
2827
+ for (const e of Object.values(ENGINES)) names.add(e.subject);
2698
2828
  for (const a of AUTH_PACKAGES) names.add(a.subject);
2699
2829
  for (const e of EXTRA) names.add(e);
2700
2830
  for (const w of VENDOR_WORDS) names.add(w);
@@ -3471,7 +3601,7 @@ function readGitignore(dir) {
3471
3601
  }
3472
3602
 
3473
3603
  // src/version.ts
3474
- var VERSION = "0.1.0";
3604
+ var VERSION = "0.2.0";
3475
3605
 
3476
3606
  // src/scanner/detectors/exposure.ts
3477
3607
  var PUBLIC_PREFIX = /^(?:NEXT_PUBLIC_|VITE_|REACT_APP_|EXPO_PUBLIC_|NUXT_PUBLIC_|GATSBY_|PUBLIC_)/;
@@ -3858,15 +3988,28 @@ function unanalysedQuestion(unsupported) {
3858
3988
  why: "Soundings reads JavaScript and TypeScript only, so what the other code does is not in this scan."
3859
3989
  };
3860
3990
  }
3861
- var SPECIFIC_SQL = /* @__PURE__ */ new Set(["PostgreSQL", "MySQL", "Supabase Postgres"]);
3991
+ var SPECIFIC_SQL = /* @__PURE__ */ new Set(["PostgreSQL", "MySQL", "Supabase Postgres", "SQLite", "SQL Server", "CockroachDB"]);
3992
+ var GENERIC_SQL = /* @__PURE__ */ new Set(["SQL database (SQLAlchemy)", "SQL database (Prisma)", "SQL database (Drizzle)"]);
3993
+ var ORMS = ["data-store/prisma", "data-store/drizzle"];
3994
+ var ormRank = (f) => ORMS.indexOf(f.detector);
3862
3995
  function dropRedundant(facts) {
3863
- const stores = facts.filter((f) => f.kind === "data_store");
3864
- return facts.filter((f) => {
3996
+ const stores = facts.filter((f) => f.kind === "data_store" && f.claimType !== "not-found");
3997
+ const folded = /* @__PURE__ */ new Map();
3998
+ const kept = facts.filter((f) => {
3865
3999
  if (f.kind !== "data_store") return true;
3866
4000
  if (f.detector === "data-store/connection-string") return !stores.some((o) => o.subject === f.subject && o.detector !== f.detector);
3867
- if (f.subject === "SQL database (SQLAlchemy)") return !stores.some((o) => SPECIFIC_SQL.has(o.subject));
4001
+ if (GENERIC_SQL.has(f.subject)) return !stores.some((o) => SPECIFIC_SQL.has(o.subject));
4002
+ if (ormRank(f) >= 0) {
4003
+ const same = stores.filter((o) => o.subject === f.subject && o.detector !== "data-store/connection-string" && ormRank(o) < ormRank(f));
4004
+ const into = same.sort((a, b) => ormRank(a) - ormRank(b))[0];
4005
+ if (into) {
4006
+ folded.set(into, [...folded.get(into) ?? [], ...f.locations ?? []]);
4007
+ return false;
4008
+ }
4009
+ }
3868
4010
  return true;
3869
4011
  });
4012
+ return kept.map((f) => folded.has(f) ? { ...f, locations: [...f.locations ?? [], ...folded.get(f)].slice(0, MAX_LOCATIONS) } : f);
3870
4013
  }
3871
4014
  function scan(opts) {
3872
4015
  const started = Date.now();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "soundings-cli",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Evidence-backed answers to security questionnaires, run locally.",
5
5
  "homepage": "https://dynamomaritime.com/soundings",
6
6
  "bugs": {