@plune-ai/cli 0.39.5 → 0.39.7

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/dist/mcp-tools.js CHANGED
@@ -191,9 +191,171 @@ var bulkPreview = z.looseObject({
191
191
  expiresInSeconds: z.number().int()
192
192
  });
193
193
 
194
+ // src/mcp-testing/lint/thresholds.ts
195
+ var PLUNE_ANSWER_MEASURES = {
196
+ plune_project_context: { tokens: 387, of: "3 projects and 3 suites" },
197
+ plune_cases_search: { tokens: 7678, of: "a project of 48 cases" },
198
+ plune_review_list: { tokens: 695, of: "7 pending entries" },
199
+ plune_mission_get: { tokens: 455, of: "a mission with 5 sources" }
200
+ };
201
+ var HEADROOM = 0.1;
202
+ var limitOf = (measure) => Math.ceil(measure * (1 + HEADROOM));
203
+ var PLUNE_BUDGET = {
204
+ /** A limit is the measure times (1 + headroom), rounded up. */
205
+ headroom: HEADROOM,
206
+ /** A measure below this share of its limit means the limit is too loose: with 10% headroom a list may shrink ~12%. */
207
+ tooLooseShare: 0.8,
208
+ /** Whole tool lists, outputSchema and annotations included. */
209
+ lists: {
210
+ /** 2025 era, write scope, as listed first: 17 tools, measured 8927 on 2026-11-20 (8853 before the measured-answer lines of #2988). */
211
+ writeFirst: 9272,
212
+ /** 2025 era, write scope, after plune_discover_tools: 22 tools, measured 11403 on 2026-11-20 (11329 before the measured-answer lines). */
213
+ writeAll: 11926,
214
+ /** Read scope, either era: 7 tools, measured 2296 on 2026-11-20 (2222 before the measured-answer lines; a read token is not offered plune_discover_tools). */
215
+ read: 2445,
216
+ /** 2026-07-28 era, write scope: 17 tools, the list does not change after discover; measured 8927 on 2026-11-20 (8853 before the measured-answer lines). */
217
+ modernWrite: 9272
218
+ },
219
+ /** The biggest single tool, plune_strategy_propose, measured 2177. */
220
+ largestTool: 2395,
221
+ /**
222
+ * The text content of an answer, on live answers recorded in plune-budget.fixtures.ts, measured 2026-11-14 with the
223
+ * text unindented (before, with a two-space indent): the beta demo project of 2026-11-10 (cases in Ukrainian) gives
224
+ * plune_project_context with 3 projects, 3 suites, no missions 387 (548); plune_cases_search 7678 (10509) for the
225
+ * whole project of 48 cases (a page of 100 is not reached); plune_review_list of 7 pending entries 695 (895). The demo
226
+ * has no missions, so plune_mission_get reads a mission with 5 sources captured live on a beta test project on
227
+ * 2026-11-14: 455 (585; the synthetic mission it replaced measured 476 indented, under its limit of 524).
228
+ */
229
+ answers: {
230
+ plune_project_context: limitOf(PLUNE_ANSWER_MEASURES.plune_project_context.tokens),
231
+ plune_cases_search: limitOf(PLUNE_ANSWER_MEASURES.plune_cases_search.tokens),
232
+ plune_review_list: limitOf(PLUNE_ANSWER_MEASURES.plune_review_list.tokens),
233
+ plune_mission_get: limitOf(PLUNE_ANSWER_MEASURES.plune_mission_get.tokens)
234
+ }
235
+ };
236
+ var LINT_THRESHOLDS = {
237
+ description: {
238
+ /** Shorter than this many characters says too little for a model to choose the tool. */
239
+ minLength: 40,
240
+ /** Longer than this many characters costs every request and buries the point. */
241
+ maxLength: 1e3
242
+ },
243
+ names: {
244
+ /** The specification's length bound for a tool name. */
245
+ maxLength: 128,
246
+ /** A naming style is the server's convention when more than this share of its tools use it. */
247
+ majorityShare: 0.5
248
+ },
249
+ similarity: {
250
+ /** Word-set overlap (Jaccard) of two names, the shared server prefix left out, above which they are confusable. */
251
+ names: 0.75,
252
+ /** Word-set overlap of two descriptions above which a model cannot tell the tools apart. */
253
+ descriptions: 0.6,
254
+ /** Overlap of two descriptions above which the tools are related enough that "when not to use" matters more. */
255
+ related: 0.35,
256
+ /** Words shorter than this are left out of a description's word set. */
257
+ minWordLength: 3,
258
+ /** Decimals an overlap is reported with. */
259
+ decimals: 2,
260
+ /**
261
+ * Tools above which the rules that compare every pair (`tools-similar`, `desc-no-when-not`) do not run and say
262
+ * `could-not-run`: the work grows with the square of a count the server chooses. Measured 2026-11-10 on one
263
+ * desktop core, with no two tools alike (the slowest case: no early stop): at 1000 tools the two rules take 0.25 s
264
+ * with 60-character descriptions and 2.3 s with 1000-character ones (`description.maxLength`); at 4000 short ones,
265
+ * 4.5 s. Well above the tool lists of real servers, which hold tens to hundreds.
266
+ */
267
+ maxTools: 1e3
268
+ },
269
+ schema: {
270
+ /**
271
+ * Levels an input schema may nest (a named property, or an array's items, is one level below the node it is in)
272
+ * for the rules that read every node of it (`required-unknown-property`, `param-example-missing`); deeper, they
273
+ * say `could-not-run` for the tool. The server chooses the depth, and a node's path is as long as its depth.
274
+ * Hand-written and generated schemas nest to about 10-20 levels; 64 leaves three times that, and is the number
275
+ * the `--call` path stops copying an output schema at (counted there in JSON levels, two to a property).
276
+ * Measured 2026-11-10 on one desktop core: the two rules take 0.03 ms on a chain exactly 64 levels deep (0.09 ms
277
+ * with two siblings and an array at every level), and stop within 0.2 ms on a chain of 100 000 levels. The
278
+ * recursive walk this replaced overflowed the call stack at 10 000 levels.
279
+ */
280
+ maxDepth: 64
281
+ },
282
+ size: {
283
+ /**
284
+ * Estimated tokens of the whole visible tool list above which the list is reported: the limit of our own biggest
285
+ * list (`budget.lists.writeAll`), so a server that costs more than all of ours is told so.
286
+ */
287
+ maxListTokens: PLUNE_BUDGET.lists.writeAll,
288
+ /**
289
+ * The estimate: characters of a tool's JSON divided by this, rounded up, summed over the tools. No tokenizer, no
290
+ * network, the same number in CI on every run; a limit is a measure plus headroom, never an exact token count.
291
+ * Calibrated 2026-11-10 against a provider's token-counting endpoint on two current models (both gave the same
292
+ * counts): the estimate is low. On the same JSON (name, description, input schema: the fields a model API takes) a
293
+ * tool list costs 1.57-1.72 times the estimate, the tool-use preamble of ~320 tokens left out; the largest live
294
+ * answer (JSON with Ukrainian text) 1.84 times. The limits stay in estimated tokens; for real tokens multiply by
295
+ * ~1.7 (English JSON) to ~1.85 (Cyrillic). Table: docs/features/mcp-context-budget/budget.md.
296
+ */
297
+ charsPerToken: 4,
298
+ budget: PLUNE_BUDGET
299
+ },
300
+ call: {
301
+ /**
302
+ * Estimated tokens of one `tools/call` result (its JSON, as the client receives it) above which the answer is
303
+ * reported: the limit of our own biggest answer (`budget.answers.plune_cases_search`), as `maxListTokens` is for
304
+ * the list.
305
+ */
306
+ maxResultTokens: PLUNE_BUDGET.answers.plune_cases_search
307
+ },
308
+ language: {
309
+ /**
310
+ * A text is taken to be in a listed language when at least this many of its stop words occur; two, so a lone
311
+ * "a" or "in" of another Latin-script language does not pass for English.
312
+ */
313
+ minStopwords: 2
314
+ },
315
+ /** Name words that say a tool returns a list, so it should take a page size or cursor. */
316
+ listVerbs: ["list", "search", "find", "query", "browse"],
317
+ /** Parameter names that page a list. */
318
+ pagingParams: ["limit", "cursor", "page", "offset", "pagesize", "perpage", "per_page", "page_size", "pagetoken", "page_token"],
319
+ /** Name words of a tool that changes something; a read-only hint on such a tool contradicts its name. */
320
+ writeVerbs: ["create", "add", "update", "edit", "delete", "remove", "set", "write", "put", "patch", "insert", "replace", "send"],
321
+ /** Name words of a tool that overwrites or removes, which is not an "additive only" update. */
322
+ overwriteVerbs: ["update", "edit", "set", "replace", "delete", "remove", "overwrite", "patch", "clear", "reset", "rename", "move"],
323
+ /** Parameter name words that say the value is not free text. Booleans only by the first word (`isActive`). */
324
+ typedParamWords: {
325
+ number: ["count", "limit", "max", "min", "size", "offset", "total", "amount", "number", "port", "timeout", "retries", "quantity", "index"],
326
+ boolean: ["is", "has", "can", "should", "allow", "enable", "enabled"],
327
+ date: ["date", "time", "timestamp", "since", "until", "deadline"],
328
+ url: ["url", "uri", "href", "link", "endpoint", "website"]
329
+ },
330
+ /**
331
+ * Words by language. `script` is the alphabet the language is written in; `letters`, when given, are letters the
332
+ * language has and its neighbours in the same alphabet do not, so a Russian text is not read as Ukrainian.
333
+ * Phrases match at the start of a word, so a stem (`не використов`) covers its inflected forms.
334
+ */
335
+ languages: {
336
+ en: {
337
+ script: "Latin",
338
+ letters: "",
339
+ stopwords: ["the", "a", "an", "to", "of", "and", "or", "is", "are", "in", "for", "with", "it", "its", "as", "at", "be", "not", "can", "you", "your", "this", "that", "them", "by", "on", "from", "if", "when", "each"],
340
+ whenNot: ["do not", "don't", "instead", "rather than", "only", "not for", "avoid", "never"],
341
+ example: ["e.g.", "for example", "for instance", "such as", "example"],
342
+ closedSet: ["one of", "either"]
343
+ },
344
+ uk: {
345
+ script: "Cyrillic",
346
+ letters: "\u0456\u0457\u0454\u0491",
347
+ stopwords: ["\u0456", "\u0439", "\u0442\u0430", "\u0432", "\u0443", "\u043D\u0430", "\u0437", "\u0456\u0437", "\u0449\u043E", "\u0446\u0435", "\u0434\u043E", "\u043D\u0435", "\u0434\u043B\u044F", "\u044F\u043A", "\u0430\u0431\u043E", "\u043A\u043E\u043B\u0438", "\u0439\u043E\u0433\u043E", "\u0457\u0457", "\u0432\u0456\u0434"],
348
+ whenNot: ["\u043D\u0435 \u0432\u0438\u043A\u043E\u0440\u0438\u0441\u0442\u043E\u0432", "\u043D\u0435 \u0432\u0438\u043A\u043B\u0438\u043A", "\u043D\u0435 \u0437\u0430\u0441\u0442\u043E\u0441\u043E\u0432", "\u0437\u0430\u043C\u0456\u0441\u0442\u044C", "\u043B\u0438\u0448\u0435", "\u0442\u0456\u043B\u044C\u043A\u0438", "\u043D\u0435 \u0434\u043B\u044F", "\u043D\u0456\u043A\u043E\u043B\u0438"],
349
+ example: ["\u043D\u0430\u043F\u0440\u0438\u043A\u043B\u0430\u0434", "\u043D\u0430\u043F\u0440.", "\u043F\u0440\u0438\u043A\u043B\u0430\u0434", "\u0437\u043E\u043A\u0440\u0435\u043C\u0430"],
350
+ closedSet: ["\u043E\u0434\u043D\u0435 \u0437", "\u043E\u0434\u0438\u043D \u0437", "\u043E\u0434\u043D\u0430 \u0437", "\u043E\u0434\u043D\u0435 \u0456\u0437", "\u043E\u0434\u0438\u043D \u0456\u0437", "\u043E\u0434\u043D\u0430 \u0456\u0437"]
351
+ }
352
+ }
353
+ };
354
+
194
355
  // src/mcp-tools/contract.ts
195
356
  var MAX_VISIBLE_TOOLS = 20;
196
357
  var define = (tool) => tool;
358
+ var measuredCost = (tool) => ` Measured answer: ~${PLUNE_ANSWER_MEASURES[tool].tokens} tokens (characters / 4) for ${PLUNE_ANSWER_MEASURES[tool].of}.`;
197
359
  var listPage = {
198
360
  limit: z2.number().int().min(1).max(BATCH_MAX).optional(),
199
361
  cursor: z2.string().min(1).optional().describe("nextCursor of the previous page")
@@ -204,7 +366,7 @@ var PLUNE_TOOLS = [
204
366
  define({
205
367
  name: "plune_project_context",
206
368
  title: "Project context",
207
- description: "Start here: learn the project you are working in with one call \u2014 its projects, the suite tree, how many test cases it has, its testing missions, how much waits in the review queue, and the rules of its memory: what a person accepted for this project, to follow without asking again.",
369
+ description: "Start here: learn the project you are working in with one call \u2014 its projects, the suite tree, how many test cases it has, its testing missions, how much waits in the review queue, and the rules of its memory: what a person accepted for this project, to follow without asking again." + measuredCost("plune_project_context"),
208
370
  input: z2.strictObject({}),
209
371
  output: z2.object({
210
372
  projectId: z2.string().nullable(),
@@ -232,7 +394,7 @@ var PLUNE_TOOLS = [
232
394
  define({
233
395
  name: "plune_cases_search",
234
396
  title: "Find test cases",
235
- description: "Find test cases of the project by filter \u2014 free text in q, suite, state, tag, priority and the other filters of the case list \u2014 one page at a time, with the total and how many match.",
397
+ description: "Find test cases of the project by filter \u2014 free text in q, suite, state, tag, priority and the other filters of the case list \u2014 one page at a time, with the total and how many match." + measuredCost("plune_cases_search"),
236
398
  input: z2.strictObject({
237
399
  filters: z2.record(z2.string(), z2.union([z2.string(), z2.array(z2.string())])).optional().describe('Query filters of GET /v1/test-cases: free text is the key q, and a key the list does not know is ignored, so all cases come back; a list is OR inside one key, keys are AND-ed (e.g. {"q": "card", "tag": ["smoke"]})'),
238
400
  ...listPage
@@ -250,7 +412,7 @@ var PLUNE_TOOLS = [
250
412
  define({
251
413
  name: "plune_review_list",
252
414
  title: "Read the review queue",
253
- description: "See what waits for a decision in the review queue \u2014 proposed cases, discovered tests, endpoints, strategies, reports \u2014 narrowed by state, kind and mission, newest first, one page at a time. The mission filter needs a platform that supports it; an older one returns the whole queue.",
415
+ description: "See what waits for a decision in the review queue \u2014 proposed cases, discovered tests, endpoints, strategies, reports \u2014 narrowed by state, kind and mission, newest first, one page at a time. The mission filter needs a platform that supports it; an older one returns the whole queue." + measuredCost("plune_review_list"),
254
416
  input: z2.strictObject({
255
417
  state: z2.enum(REVIEW_STATES).optional(),
256
418
  kinds: z2.array(z2.enum(REVIEW_KINDS)).min(1).optional().describe("Questions are read with the question tool"),
@@ -331,7 +493,7 @@ var PLUNE_TOOLS = [
331
493
  define({
332
494
  name: "plune_mission_get",
333
495
  title: "Read a mission",
334
- description: "Read a testing mission with everything it holds \u2014 its brief, state, documentation answer and every source attached to it \u2014 before planning or continuing the work on it.",
496
+ description: "Read a testing mission with everything it holds \u2014 its brief, state, documentation answer and every source attached to it \u2014 before planning or continuing the work on it." + measuredCost("plune_mission_get"),
335
497
  input: z2.strictObject({ missionId }),
336
498
  output: z2.object({ mission: entity }),
337
499
  write: false,
@@ -648,8 +810,10 @@ function errorOf(err) {
648
810
  return { status: 401, code: "token_rejected", message: `Plune rejected the token (401): ${err.message}. Run \`plune login\` or set PLUNE_TOKEN to a live token.` };
649
811
  if (err.status === 403 && err.message === READ_ONLY_REFUSAL)
650
812
  return { status: 403, code: "read_only_token", message: `Plune refused (403): ${readScopeMessage("it cannot write")}` };
651
- const code = err.code ?? `http_${err.status}`;
652
- return { status: err.status, code, message: `Plune refused (${err.status} ${code}): ${err.message}${detailLines(err.body)}`, details: err.body };
813
+ const quota = err.status === 429 && asRecord(err.body)["quota"] !== void 0;
814
+ const code = err.code ?? (quota ? "quota_exceeded" : `http_${err.status}`);
815
+ const why = quota ? "a plan limit is reached, not a missing permission \u2014 " : err.status === 403 ? "the token or its user lacks the permission, not a plan limit \u2014 " : "";
816
+ return { status: err.status, code, message: `Plune refused (${err.status} ${code}): ${why}${err.message}${detailLines(err.body)}`, details: err.body };
653
817
  }
654
818
  if (err instanceof PluneNetworkError) return { code: "network", message: `${err.message}. Check PLUNE_API_URL and the network.` };
655
819
  throw err;
@@ -683,7 +847,6 @@ function createPluneToolExecutor(opts) {
683
847
  let scope = opts.scope;
684
848
  const revealed = /* @__PURE__ */ new Set();
685
849
  const confirms = /* @__PURE__ */ new Map();
686
- let proposals = 0;
687
850
  const visibleTools = () => {
688
851
  const core = defaultVisibleTools(scope);
689
852
  const extra = [...revealed].filter((n) => !(scope === "read" && pluneTool(n).write) && !core.includes(n));
@@ -802,13 +965,12 @@ function createPluneToolExecutor(opts) {
802
965
  const stableId = createHash("sha256").update([c["title"], ...steps, c["expected"]].join("\n")).digest("hex").slice(0, 32);
803
966
  return withoutUndefined({ stableId, execution: "manual", ...c });
804
967
  });
805
- proposals += 1;
806
968
  const req = {
807
969
  method: "POST",
808
970
  path: "/v1/ingest/cairn",
809
971
  body: {
810
972
  schemaVersion: 1,
811
- run: withoutUndefined({ runId: `mcp-${sessionId}-${proposals}`, mode: "design", target: str(i["target"]), missionId: i["missionId"] }),
973
+ run: withoutUndefined({ runId: `mcp-${sessionId}-${randomUUID().slice(0, 8)}`, mode: "design", target: str(i["target"]), missionId: i["missionId"] }),
812
974
  cases
813
975
  }
814
976
  };
@@ -943,6 +1105,8 @@ function createPluneToolExecutor(opts) {
943
1105
  if (isDeletion(req)) {
944
1106
  const t = now();
945
1107
  for (const [k, v] of confirms) if (v.expires <= t) confirms.delete(k);
1108
+ if (confirm === void 0 && opts.oneRequest === true)
1109
+ return fail("agent_cannot_delete", "Nothing was sent, and it will not be: the platform refuses an agent any deletion. A person deletes in the app.");
946
1110
  if (confirm === void 0) {
947
1111
  const value = randomBytes(24).toString("base64url");
948
1112
  confirms.set(value, { fingerprint: fingerprint(req), expires: t + CONFIRM_TTL_MS });
@@ -411,6 +411,7 @@ function readEnv(env = process.env) {
411
411
  ...shardError !== void 0 ? { shardError } : {},
412
412
  ...configurationError !== void 0 ? { configurationError } : {},
413
413
  ...importTimeout !== void 0 ? { importTimeout } : {},
414
+ secretCheck: !["0", "false", "no", "off"].includes(value(env, "PLUNE_SECRET_CHECK")?.toLowerCase() ?? ""),
414
415
  ignored: UNSUPPORTED_VARS.filter((name) => value(env, name) !== void 0),
415
416
  warnings
416
417
  };
@@ -777,6 +778,30 @@ function maskCredentials(text) {
777
778
  "$1$2\u2039credential\u203A"
778
779
  ).replace(/\b(PLUNE_[A-Z0-9_]*=)(?!‹)[^\s'"\x60;,)]+/g, "$1\u2039env-secret\u203A").replace(QUERY_PARAM, "$1\u2039credential\u203A").replace(/\b([a-z][\w+.-]*:\/\/)[^\s/@'"\x60]+@/gi, "$1\u2039credential\u203A@");
779
780
  }
781
+ function credentialsIn(text) {
782
+ const masked = maskCredentials(text);
783
+ if (masked === text) return [];
784
+ const found = [];
785
+ let from = 0;
786
+ let at = 0;
787
+ for (let open = masked.indexOf("\u2039", at); open >= 0; open = masked.indexOf("\u2039", at)) {
788
+ const start = from + (open - at);
789
+ let close = masked.indexOf("\u203A", open);
790
+ while (close >= 0 && masked[close + 1] === "\u2039") close = masked.indexOf("\u203A", close + 1);
791
+ if (close < 0) break;
792
+ const next = masked.indexOf("\u2039", close + 1);
793
+ const tail = masked.slice(close + 1, next < 0 ? void 0 : next);
794
+ const end = next < 0 ? text.length - tail.length : text.indexOf(tail, start);
795
+ if (end < start) break;
796
+ const marker = masked.slice(open, close + 1);
797
+ if (!(end - start === marker.length && text.startsWith(marker, start))) {
798
+ found.push({ line: text.slice(0, start).split("\n").length, length: end - start });
799
+ }
800
+ from = end + tail.length;
801
+ at = close + 1 + tail.length;
802
+ }
803
+ return found;
804
+ }
780
805
  function snapshotAt(at, files) {
781
806
  let source = files.get(at.file);
782
807
  if (source === void 0) {
@@ -1791,6 +1816,27 @@ async function startRun(passed, declared) {
1791
1816
  log(`::warning::${stats.deferred} result(s) were not delivered to Plune \u2014 see the reporting step's log.`);
1792
1817
  }
1793
1818
  }
1819
+ async function warnOfSecrets(result) {
1820
+ const of = printable(result.title ?? result.resultKey);
1821
+ const say = (what, text) => {
1822
+ for (const { line, length } of credentialsIn(text)) {
1823
+ log(
1824
+ `plune: ${what} of "${of}" holds what looks like a secret on line ${line} (${length} characters) \u2014 sent as it is; mask it in the test, or set PLUNE_SECRET_CHECK=0 to turn this check off.`
1825
+ );
1826
+ }
1827
+ };
1828
+ const error = result.errorContext ?? result.failure?.headline;
1829
+ if (error !== void 0) say("the error text", error);
1830
+ for (const file of result.files ?? []) {
1831
+ if (!isTextType(file.contentType)) continue;
1832
+ let bytes = file.body;
1833
+ if (bytes === void 0 && file.path !== void 0) {
1834
+ const size = await import_node_fs6.promises.stat(file.path).then((s) => s.size, () => Infinity);
1835
+ if (size <= TEXT_BYTES) bytes = await import_node_fs6.promises.readFile(file.path).catch(() => void 0);
1836
+ }
1837
+ if (bytes !== void 0 && bytes.length <= TEXT_BYTES) say(`the attachment "${printable(file.name)}"`, bytes.toString("utf8"));
1838
+ }
1839
+ }
1794
1840
  const shardLines = [];
1795
1841
  return {
1796
1842
  get runId() {
@@ -1804,6 +1850,7 @@ async function startRun(passed, declared) {
1804
1850
  },
1805
1851
  async add(result) {
1806
1852
  const { codeAt, ...rest } = result;
1853
+ if (env.secretCheck) await warnOfSecrets(result);
1807
1854
  const text = codeAt === void 0 ? void 0 : snapshotAt(codeAt, specFiles);
1808
1855
  if (text !== void 0) snapshotByKey.set(result.resultKey, text);
1809
1856
  buffer.push({ ...rest, keys: bound(result.keys) });
@@ -555,6 +555,11 @@ interface EnvSettings {
555
555
  configurationError?: string;
556
556
  /** `PLUNE_IMPORT_TIMEOUT` in seconds, when set and usable. */
557
557
  importTimeout?: number;
558
+ /**
559
+ * Whether the error text and the text attachments of a result are checked for something that looks like a
560
+ * secret before they are sent: on unless `PLUNE_SECRET_CHECK` is `0`, `false`, `no` or `off`. The check only warns.
561
+ */
562
+ secretCheck: boolean;
558
563
  /** Variables that were set and have nowhere to land. The caller says so once. */
559
564
  ignored: string[];
560
565
  /** Variables that were set to something unusable and fell back to their default. The caller says so once. */
@@ -555,6 +555,11 @@ interface EnvSettings {
555
555
  configurationError?: string;
556
556
  /** `PLUNE_IMPORT_TIMEOUT` in seconds, when set and usable. */
557
557
  importTimeout?: number;
558
+ /**
559
+ * Whether the error text and the text attachments of a result are checked for something that looks like a
560
+ * secret before they are sent: on unless `PLUNE_SECRET_CHECK` is `0`, `false`, `no` or `off`. The check only warns.
561
+ */
562
+ secretCheck: boolean;
558
563
  /** Variables that were set and have nowhere to land. The caller says so once. */
559
564
  ignored: string[];
560
565
  /** Variables that were set to something unusable and fell back to their default. The caller says so once. */
@@ -361,6 +361,7 @@ function readEnv(env = process.env) {
361
361
  ...shardError !== void 0 ? { shardError } : {},
362
362
  ...configurationError !== void 0 ? { configurationError } : {},
363
363
  ...importTimeout !== void 0 ? { importTimeout } : {},
364
+ secretCheck: !["0", "false", "no", "off"].includes(value(env, "PLUNE_SECRET_CHECK")?.toLowerCase() ?? ""),
364
365
  ignored: UNSUPPORTED_VARS.filter((name) => value(env, name) !== void 0),
365
366
  warnings
366
367
  };
@@ -727,6 +728,30 @@ function maskCredentials(text) {
727
728
  "$1$2\u2039credential\u203A"
728
729
  ).replace(/\b(PLUNE_[A-Z0-9_]*=)(?!‹)[^\s'"\x60;,)]+/g, "$1\u2039env-secret\u203A").replace(QUERY_PARAM, "$1\u2039credential\u203A").replace(/\b([a-z][\w+.-]*:\/\/)[^\s/@'"\x60]+@/gi, "$1\u2039credential\u203A@");
729
730
  }
731
+ function credentialsIn(text) {
732
+ const masked = maskCredentials(text);
733
+ if (masked === text) return [];
734
+ const found = [];
735
+ let from = 0;
736
+ let at = 0;
737
+ for (let open = masked.indexOf("\u2039", at); open >= 0; open = masked.indexOf("\u2039", at)) {
738
+ const start = from + (open - at);
739
+ let close = masked.indexOf("\u203A", open);
740
+ while (close >= 0 && masked[close + 1] === "\u2039") close = masked.indexOf("\u203A", close + 1);
741
+ if (close < 0) break;
742
+ const next = masked.indexOf("\u2039", close + 1);
743
+ const tail = masked.slice(close + 1, next < 0 ? void 0 : next);
744
+ const end = next < 0 ? text.length - tail.length : text.indexOf(tail, start);
745
+ if (end < start) break;
746
+ const marker = masked.slice(open, close + 1);
747
+ if (!(end - start === marker.length && text.startsWith(marker, start))) {
748
+ found.push({ line: text.slice(0, start).split("\n").length, length: end - start });
749
+ }
750
+ from = end + tail.length;
751
+ at = close + 1 + tail.length;
752
+ }
753
+ return found;
754
+ }
730
755
  function snapshotAt(at, files) {
731
756
  let source = files.get(at.file);
732
757
  if (source === void 0) {
@@ -1741,6 +1766,27 @@ async function startRun(passed, declared) {
1741
1766
  log(`::warning::${stats.deferred} result(s) were not delivered to Plune \u2014 see the reporting step's log.`);
1742
1767
  }
1743
1768
  }
1769
+ async function warnOfSecrets(result) {
1770
+ const of = printable(result.title ?? result.resultKey);
1771
+ const say = (what, text) => {
1772
+ for (const { line, length } of credentialsIn(text)) {
1773
+ log(
1774
+ `plune: ${what} of "${of}" holds what looks like a secret on line ${line} (${length} characters) \u2014 sent as it is; mask it in the test, or set PLUNE_SECRET_CHECK=0 to turn this check off.`
1775
+ );
1776
+ }
1777
+ };
1778
+ const error = result.errorContext ?? result.failure?.headline;
1779
+ if (error !== void 0) say("the error text", error);
1780
+ for (const file of result.files ?? []) {
1781
+ if (!isTextType(file.contentType)) continue;
1782
+ let bytes = file.body;
1783
+ if (bytes === void 0 && file.path !== void 0) {
1784
+ const size = await disk.stat(file.path).then((s) => s.size, () => Infinity);
1785
+ if (size <= TEXT_BYTES) bytes = await disk.readFile(file.path).catch(() => void 0);
1786
+ }
1787
+ if (bytes !== void 0 && bytes.length <= TEXT_BYTES) say(`the attachment "${printable(file.name)}"`, bytes.toString("utf8"));
1788
+ }
1789
+ }
1744
1790
  const shardLines = [];
1745
1791
  return {
1746
1792
  get runId() {
@@ -1754,6 +1800,7 @@ async function startRun(passed, declared) {
1754
1800
  },
1755
1801
  async add(result) {
1756
1802
  const { codeAt, ...rest } = result;
1803
+ if (env.secretCheck) await warnOfSecrets(result);
1757
1804
  const text = codeAt === void 0 ? void 0 : snapshotAt(codeAt, specFiles);
1758
1805
  if (text !== void 0) snapshotByKey.set(result.resultKey, text);
1759
1806
  buffer.push({ ...rest, keys: bound(result.keys) });
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@plune-ai/cli",
3
- "version": "0.39.5",
3
+ "version": "0.39.7",
4
+ "mcpName": "io.github.plune-ai/cli",
4
5
  "description": "AI-powered assertion testing for LLM apps — write assertions, run them against any provider, get a pass/fail report (local, CI, or diff).",
5
6
  "keywords": [
6
7
  "ai",
@@ -38,6 +39,11 @@
38
39
  "types": "./dist/mcp-tools.d.ts",
39
40
  "import": "./dist/mcp-tools.js",
40
41
  "require": "./dist/mcp-tools.cjs"
42
+ },
43
+ "./mcp-http": {
44
+ "types": "./dist/mcp-http.d.ts",
45
+ "import": "./dist/mcp-http.js",
46
+ "require": "./dist/mcp-http.cjs"
41
47
  }
42
48
  },
43
49
  "files": [
@@ -0,0 +1,23 @@
1
+ ---
2
+ name: plune
3
+ description: Work in a Plune project through the Plune MCP tools - read the review queue, cases, missions and reports, and propose cases, decisions and strategy for a person to approve. Use when the user asks about their Plune project, its test cases or review queue, or asks to add tests to Plune.
4
+ license: MIT
5
+ compatibility: Needs the Plune MCP server (npx -y @plune-ai/cli mcp serve) and a Plune login (plune login) or PLUNE_TOKEN. A read token offers only the read tools.
6
+ ---
7
+
8
+ # Plune
9
+
10
+ The tool descriptions say what each tool does. This file says only how to work with them.
11
+
12
+ - Call `plune_project_context` first, once per conversation: it names the project, the suite tree and
13
+ the rules a person already accepted. Follow those rules without asking again.
14
+ - What you write is a proposal. A case lands in the review queue, and a person approves it; say so
15
+ to the user instead of calling it done.
16
+ - Before a write, call it with `dry_run: true` and show the user what it would change. Write after
17
+ they agree.
18
+ - Some write tools are not listed at the start. Find them with `plune_discover_tools` when the user
19
+ asks for something the listed tools do not do.
20
+ - A refusal carries a `code`. A plan limit and a missing permission are different refusals: tell the
21
+ user which one it is, and do not retry the same call.
22
+ - For a whole testing mission (sources, questions, strategy, 20 or more cases), use the
23
+ `qa-mission` skill.