tenjin-cli 0.1.0-alpha.3 → 0.1.0-alpha.5

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 (157) hide show
  1. package/README.md +322 -197
  2. package/dist/{_esm-FEASBWRP.js → _esm-N4KAVXQR.js} +9 -9
  3. package/dist/buy-YMXXVNFH.js +42 -0
  4. package/dist/candidate-H7FR4AU5.js +22 -0
  5. package/dist/{ccip-XR5NE5QK.js → ccip-RPPPKTJR.js} +5 -5
  6. package/dist/{ccip-NQXCEK2U.js → ccip-ZGGWQN4X.js} +4 -4
  7. package/dist/{chunk-MUBUQVC3.js → chunk-2JQ5JSG6.js} +3 -2
  8. package/dist/{chunk-MUBUQVC3.js.map → chunk-2JQ5JSG6.js.map} +1 -1
  9. package/dist/{chunk-662MSGZB.js → chunk-3IRDP7TN.js} +100 -66
  10. package/dist/chunk-3IRDP7TN.js.map +1 -0
  11. package/dist/{chunk-YALGASEU.js → chunk-47PP7TAG.js} +1610 -1610
  12. package/dist/chunk-47PP7TAG.js.map +1 -0
  13. package/dist/{buy-EE6SEXP6.js → chunk-4WVKXKDK.js} +27 -59
  14. package/dist/chunk-4WVKXKDK.js.map +1 -0
  15. package/dist/chunk-5SCU253N.js +412 -0
  16. package/dist/chunk-5SCU253N.js.map +1 -0
  17. package/dist/{chunk-UGX7YPX2.js → chunk-7FK2UN2T.js} +65 -65
  18. package/dist/{chunk-UGX7YPX2.js.map → chunk-7FK2UN2T.js.map} +1 -1
  19. package/dist/chunk-ADJYSM45.js +135 -0
  20. package/dist/chunk-ADJYSM45.js.map +1 -0
  21. package/dist/{chunk-DXTQ3CSI.js → chunk-BIKAUVC2.js} +43 -11
  22. package/dist/chunk-BIKAUVC2.js.map +1 -0
  23. package/dist/{chunk-Z6MFJV5Z.js → chunk-C444K6MI.js} +266 -55
  24. package/dist/chunk-C444K6MI.js.map +1 -0
  25. package/dist/{chunk-JPHG2JW3.js → chunk-CVX6JNGD.js} +26 -26
  26. package/dist/chunk-CVX6JNGD.js.map +1 -0
  27. package/dist/{chunk-S3IGX57D.js → chunk-FU6MCSLG.js} +9 -9
  28. package/dist/{lookup-ZPN2Q67N.js → chunk-HTDALK7M.js} +46 -32
  29. package/dist/chunk-HTDALK7M.js.map +1 -0
  30. package/dist/chunk-IOPWPMT2.js +239 -0
  31. package/dist/chunk-IOPWPMT2.js.map +1 -0
  32. package/dist/{chunk-5CLSD5YN.js → chunk-KYQVEKP5.js} +7 -7
  33. package/dist/{chunk-RRN3YTK7.js → chunk-KZAAWQNP.js} +3 -3
  34. package/dist/{chunk-7KUW4MJD.js → chunk-L4IHCN6B.js} +11 -7
  35. package/dist/chunk-L4IHCN6B.js.map +1 -0
  36. package/dist/{chunk-XHC6FCGZ.js → chunk-LAM66WFJ.js} +25 -11
  37. package/dist/chunk-LAM66WFJ.js.map +1 -0
  38. package/dist/{chunk-NCE5NSN6.js → chunk-M2O56UK7.js} +158 -158
  39. package/dist/chunk-M2O56UK7.js.map +1 -0
  40. package/dist/{chunk-GO75V3NZ.js → chunk-MDDGEGSW.js} +8 -6
  41. package/dist/chunk-MDDGEGSW.js.map +1 -0
  42. package/dist/{chunk-XJIW7USF.js → chunk-MJZZTKCC.js} +112 -6
  43. package/dist/chunk-MJZZTKCC.js.map +1 -0
  44. package/dist/{chunk-Z52RA3NC.js → chunk-NFSOVL3C.js} +51 -21
  45. package/dist/chunk-NFSOVL3C.js.map +1 -0
  46. package/dist/{chunk-FJPLRISB.js → chunk-NJF2WENW.js} +5 -4
  47. package/dist/chunk-NJF2WENW.js.map +1 -0
  48. package/dist/{chunk-OYMYCW7J.js → chunk-PAUXMRSF.js} +45 -4
  49. package/dist/{chunk-OYMYCW7J.js.map → chunk-PAUXMRSF.js.map} +1 -1
  50. package/dist/{chunk-ZABPQJ3M.js → chunk-POJRB2AE.js} +2 -2
  51. package/dist/{publish-BKBQQAW4.js → chunk-PYNSGYBE.js} +254 -57
  52. package/dist/chunk-PYNSGYBE.js.map +1 -0
  53. package/dist/{chunk-YN5SHIXQ.js → chunk-QONTBYQW.js} +12 -9
  54. package/dist/chunk-QONTBYQW.js.map +1 -0
  55. package/dist/chunk-QW2Q2KAH.js +27 -0
  56. package/dist/chunk-QW2Q2KAH.js.map +1 -0
  57. package/dist/chunk-RTJLLPFA.js +599 -0
  58. package/dist/chunk-RTJLLPFA.js.map +1 -0
  59. package/dist/{chunk-CYOF7ROH.js → chunk-S5RYMCV6.js} +3 -3
  60. package/dist/chunk-TXPPMK4L.js +59 -0
  61. package/dist/chunk-TXPPMK4L.js.map +1 -0
  62. package/dist/{chunk-ZMHYXMO6.js → chunk-U5S527PP.js} +3 -3
  63. package/dist/{chunk-RY4XKNV3.js → chunk-UHTVXQ2O.js} +3 -3
  64. package/dist/{chunk-QVX5MWJZ.js → chunk-W6R3HAAG.js} +2 -2
  65. package/dist/{chunk-3OV7E5G5.js → chunk-WWX32ML4.js} +1 -1
  66. package/dist/{chunk-3OV7E5G5.js.map → chunk-WWX32ML4.js.map} +1 -1
  67. package/dist/{chunk-HIVZG55D.js → chunk-XJN5WUKL.js} +2 -2
  68. package/dist/{chunk-HSDCI7OV.js → chunk-YLYINX2H.js} +3 -3
  69. package/dist/{chunk-4ONXEEQL.js → chunk-ZDY2KY5X.js} +2 -2
  70. package/dist/{chunk-4ONXEEQL.js.map → chunk-ZDY2KY5X.js.map} +1 -1
  71. package/dist/{chunk-TLCMMYLY.js → chunk-ZIYVN4CD.js} +6 -6
  72. package/dist/chunk-ZIYVN4CD.js.map +1 -0
  73. package/dist/{candidate-ERMSYYQZ.js → chunk-ZW3B5LWX.js} +15 -19
  74. package/dist/{candidate-ERMSYYQZ.js.map → chunk-ZW3B5LWX.js.map} +1 -1
  75. package/dist/{cli-SBXI5AMS.js → cli-IW76QTN3.js} +64 -40
  76. package/dist/{cli-SBXI5AMS.js.map → cli-IW76QTN3.js.map} +1 -1
  77. package/dist/{config-VELDKLHY.js → config-VCOS7P5K.js} +8 -6
  78. package/dist/{doctor-T3KWNNP2.js → doctor-WS65JG3V.js} +9 -8
  79. package/dist/{ethersCompat-Df4a6QIZ-3YZIAXDK.js → ethersCompat-Df4a6QIZ-WHYKB6HA.js} +5 -5
  80. package/dist/index.js +1 -1
  81. package/dist/inspect-SFJWUQHO.js +33 -0
  82. package/dist/install-RVPQPCKH.js +589 -0
  83. package/dist/install-RVPQPCKH.js.map +1 -0
  84. package/dist/outcome-GNYCSZ7J.js +20 -0
  85. package/dist/publish-DSFWQRUN.js +36 -0
  86. package/dist/publish-DSFWQRUN.js.map +1 -0
  87. package/dist/run-OMPKA43G.js +16807 -0
  88. package/dist/run-OMPKA43G.js.map +1 -0
  89. package/dist/search-KOI6Y7P6.js +24 -0
  90. package/dist/search-KOI6Y7P6.js.map +1 -0
  91. package/dist/{secp256k1-N3ZHU7LB.js → secp256k1-XRPVBC6V.js} +3 -3
  92. package/dist/secp256k1-XRPVBC6V.js.map +1 -0
  93. package/dist/send-3G4C64HJ.js +222 -0
  94. package/dist/send-3G4C64HJ.js.map +1 -0
  95. package/dist/usdc-4VCDHFWX.js +38 -0
  96. package/dist/usdc-4VCDHFWX.js.map +1 -0
  97. package/dist/{viemAdapter-By13KInL-ZZE6UV4Y.js → viemAdapter-By13KInL-TUQJBMHM.js} +5 -5
  98. package/dist/viemAdapter-By13KInL-TUQJBMHM.js.map +1 -0
  99. package/dist/wallet-B7KJS2R5.js +40 -0
  100. package/dist/wallet-B7KJS2R5.js.map +1 -0
  101. package/dist/wallet-PP22LAX7.js +31 -0
  102. package/dist/wallet-PP22LAX7.js.map +1 -0
  103. package/package.json +4 -3
  104. package/skills/tenjin/SKILL.md +83 -15
  105. package/skills/tenjin-publish/SKILL.md +118 -18
  106. package/skills/tenjin-search/SKILL.md +149 -31
  107. package/dist/buy-EE6SEXP6.js.map +0 -1
  108. package/dist/chunk-662MSGZB.js.map +0 -1
  109. package/dist/chunk-7KUW4MJD.js.map +0 -1
  110. package/dist/chunk-AWPAWHNX.js +0 -333
  111. package/dist/chunk-AWPAWHNX.js.map +0 -1
  112. package/dist/chunk-DXTQ3CSI.js.map +0 -1
  113. package/dist/chunk-ESPNTPQ2.js +0 -207
  114. package/dist/chunk-ESPNTPQ2.js.map +0 -1
  115. package/dist/chunk-FJPLRISB.js.map +0 -1
  116. package/dist/chunk-GO75V3NZ.js.map +0 -1
  117. package/dist/chunk-JPHG2JW3.js.map +0 -1
  118. package/dist/chunk-NCE5NSN6.js.map +0 -1
  119. package/dist/chunk-TLCMMYLY.js.map +0 -1
  120. package/dist/chunk-XHC6FCGZ.js.map +0 -1
  121. package/dist/chunk-XJIW7USF.js.map +0 -1
  122. package/dist/chunk-YALGASEU.js.map +0 -1
  123. package/dist/chunk-YN5SHIXQ.js.map +0 -1
  124. package/dist/chunk-Z52RA3NC.js.map +0 -1
  125. package/dist/chunk-Z6MFJV5Z.js.map +0 -1
  126. package/dist/inspect-LMKOXE4Y.js +0 -96
  127. package/dist/inspect-LMKOXE4Y.js.map +0 -1
  128. package/dist/install-LEX3ENQ6.js +0 -387
  129. package/dist/install-LEX3ENQ6.js.map +0 -1
  130. package/dist/lookup-ZPN2Q67N.js.map +0 -1
  131. package/dist/outcome-N7TAK6WR.js +0 -66
  132. package/dist/outcome-N7TAK6WR.js.map +0 -1
  133. package/dist/publish-BKBQQAW4.js.map +0 -1
  134. package/dist/usdc-JIAJW4SV.js +0 -22
  135. package/dist/wallet-CWEMYVIH.js +0 -179
  136. package/dist/wallet-CWEMYVIH.js.map +0 -1
  137. package/dist/wallet-PA54CRBL.js +0 -30
  138. /package/dist/{_esm-FEASBWRP.js.map → _esm-N4KAVXQR.js.map} +0 -0
  139. /package/dist/{ccip-NQXCEK2U.js.map → buy-YMXXVNFH.js.map} +0 -0
  140. /package/dist/{ccip-XR5NE5QK.js.map → candidate-H7FR4AU5.js.map} +0 -0
  141. /package/dist/{config-VELDKLHY.js.map → ccip-RPPPKTJR.js.map} +0 -0
  142. /package/dist/{doctor-T3KWNNP2.js.map → ccip-ZGGWQN4X.js.map} +0 -0
  143. /package/dist/{chunk-S3IGX57D.js.map → chunk-FU6MCSLG.js.map} +0 -0
  144. /package/dist/{chunk-5CLSD5YN.js.map → chunk-KYQVEKP5.js.map} +0 -0
  145. /package/dist/{chunk-RRN3YTK7.js.map → chunk-KZAAWQNP.js.map} +0 -0
  146. /package/dist/{chunk-ZABPQJ3M.js.map → chunk-POJRB2AE.js.map} +0 -0
  147. /package/dist/{chunk-CYOF7ROH.js.map → chunk-S5RYMCV6.js.map} +0 -0
  148. /package/dist/{chunk-ZMHYXMO6.js.map → chunk-U5S527PP.js.map} +0 -0
  149. /package/dist/{chunk-RY4XKNV3.js.map → chunk-UHTVXQ2O.js.map} +0 -0
  150. /package/dist/{chunk-QVX5MWJZ.js.map → chunk-W6R3HAAG.js.map} +0 -0
  151. /package/dist/{chunk-HIVZG55D.js.map → chunk-XJN5WUKL.js.map} +0 -0
  152. /package/dist/{chunk-HSDCI7OV.js.map → chunk-YLYINX2H.js.map} +0 -0
  153. /package/dist/{ethersCompat-Df4a6QIZ-3YZIAXDK.js.map → config-VCOS7P5K.js.map} +0 -0
  154. /package/dist/{secp256k1-N3ZHU7LB.js.map → doctor-WS65JG3V.js.map} +0 -0
  155. /package/dist/{usdc-JIAJW4SV.js.map → ethersCompat-Df4a6QIZ-WHYKB6HA.js.map} +0 -0
  156. /package/dist/{viemAdapter-By13KInL-ZZE6UV4Y.js.map → inspect-SFJWUQHO.js.map} +0 -0
  157. /package/dist/{wallet-PA54CRBL.js.map → outcome-GNYCSZ7J.js.map} +0 -0
@@ -5,7 +5,7 @@ import {
5
5
  p,
6
6
  r,
7
7
  t
8
- } from "./chunk-HSDCI7OV.js";
8
+ } from "./chunk-YLYINX2H.js";
9
9
 
10
10
  // node_modules/.pnpm/@signinwithethereum+siwe@4.2.0_viem@2.55.2_typescript@6.0.3_zod@4.4.3_/node_modules/@signinwithethereum/siwe/dist/ethersCompat-Df4a6QIZ.js
11
11
  var a2 = "6492649264926492649264926492649264926492649264926492649264926492";
@@ -80,4 +80,4 @@ export {
80
80
  c,
81
81
  f
82
82
  };
83
- //# sourceMappingURL=chunk-ZABPQJ3M.js.map
83
+ //# sourceMappingURL=chunk-POJRB2AE.js.map
@@ -2,83 +2,99 @@ import { createRequire as __tenjinCreateRequire } from 'node:module'; const requ
2
2
  import {
3
3
  buildSiwxHeader,
4
4
  headingOutline
5
- } from "./chunk-S3IGX57D.js";
5
+ } from "./chunk-FU6MCSLG.js";
6
+ import {
7
+ describeWallet,
8
+ resolveWalletProvider
9
+ } from "./chunk-C444K6MI.js";
6
10
  import {
7
11
  rateLimitError
8
- } from "./chunk-662MSGZB.js";
12
+ } from "./chunk-3IRDP7TN.js";
9
13
  import {
10
14
  dropCandidate,
11
15
  readCandidate
12
- } from "./chunk-TLCMMYLY.js";
16
+ } from "./chunk-ZIYVN4CD.js";
13
17
  import {
14
18
  ATOMIC_RE,
15
19
  UUID_RE
16
- } from "./chunk-3OV7E5G5.js";
17
- import {
18
- sanitizeForTerminal
19
- } from "./chunk-Z52RA3NC.js";
20
+ } from "./chunk-WWX32ML4.js";
20
21
  import {
21
22
  CLIENT_HEADER,
22
23
  httpRequest,
23
24
  trimSlash
24
- } from "./chunk-4ONXEEQL.js";
25
- import "./chunk-FJPLRISB.js";
26
- import "./chunk-RRN3YTK7.js";
27
- import "./chunk-CYOF7ROH.js";
28
- import "./chunk-ZABPQJ3M.js";
29
- import "./chunk-HSDCI7OV.js";
25
+ } from "./chunk-ZDY2KY5X.js";
26
+ import {
27
+ sanitizeForTerminal
28
+ } from "./chunk-NFSOVL3C.js";
29
+ import {
30
+ hasCode
31
+ } from "./chunk-2I4QTOLB.js";
30
32
  import {
31
33
  resolveContextSettings,
32
34
  resolvePublishSettings
33
- } from "./chunk-GO75V3NZ.js";
35
+ } from "./chunk-MDDGEGSW.js";
34
36
  import {
35
37
  PublishModeSchema,
36
38
  parsePublishModeFlag,
37
39
  parseUsdToAtomic,
38
40
  toMoney
39
- } from "./chunk-ESPNTPQ2.js";
40
- import {
41
- describeWallet,
42
- resolveWalletProvider
43
- } from "./chunk-Z6MFJV5Z.js";
44
- import "./chunk-YN5SHIXQ.js";
45
- import {
46
- hasCode
47
- } from "./chunk-2I4QTOLB.js";
48
- import "./chunk-YBMMV4Y4.js";
49
- import "./chunk-UO22YNY4.js";
41
+ } from "./chunk-5SCU253N.js";
50
42
  import {
51
43
  writeFileAtomic
52
- } from "./chunk-MUBUQVC3.js";
44
+ } from "./chunk-2JQ5JSG6.js";
53
45
  import {
54
46
  CliError,
55
47
  external_exports,
56
48
  sessionPath
57
- } from "./chunk-OYMYCW7J.js";
58
- import "./chunk-NCE5NSN6.js";
59
- import "./chunk-RY4XKNV3.js";
60
- import "./chunk-QVX5MWJZ.js";
61
- import "./chunk-YALGASEU.js";
62
- import "./chunk-HIVZG55D.js";
63
- import "./chunk-RBJPAZFI.js";
64
- import "./chunk-5CLSD5YN.js";
65
- import "./chunk-ZXTAQYNA.js";
49
+ } from "./chunk-PAUXMRSF.js";
66
50
 
67
51
  // src/commands/publish.ts
68
- import { readFile as readFile2 } from "fs/promises";
52
+ import { readFile as readFile3 } from "fs/promises";
53
+ import { dirname as dirname2, resolve as resolve2 } from "path";
69
54
 
70
55
  // src/lib/scan.ts
71
56
  var LONG_QUOTE_WORDS = 80;
72
- function scan(text) {
57
+ function scan(text, context = {}) {
73
58
  const lines = text.split("\n");
74
59
  const findings = [
75
60
  ...scanHex64(lines),
76
61
  ...scanLineDetectors(lines),
77
62
  ...scanPemBlocks(lines),
78
- ...scanLongVerbatim(lines)
63
+ ...scanLongVerbatim(lines),
64
+ ...scanProjectMarkers(lines, context.projectMarkers ?? [])
79
65
  ];
80
66
  return dedupeAndSort(suppressEmailsInDbUris(findings));
81
67
  }
68
+ function scanProjectMarkers(lines, markers) {
69
+ const cleaned = [...new Set(markers.filter((m) => m.trim().length >= 3))];
70
+ if (cleaned.length === 0) return [];
71
+ const needles = cleaned.map((marker) => ({
72
+ marker,
73
+ re: new RegExp(`(?<![A-Za-z0-9._-])${escapeRegExp(marker)}(?![A-Za-z0-9_-])`, "gi")
74
+ }));
75
+ const out = [];
76
+ for (let i = 0; i < lines.length; i++) {
77
+ const line = lines[i] ?? "";
78
+ for (const { marker, re } of needles) {
79
+ re.lastIndex = 0;
80
+ let m;
81
+ while ((m = re.exec(line)) !== null) {
82
+ out.push({
83
+ check: "private-repo-reference",
84
+ severity: "warn",
85
+ line: i + 1,
86
+ span: [m.index, m.index + m[0].length],
87
+ excerpt: marker
88
+ });
89
+ }
90
+ }
91
+ }
92
+ return out;
93
+ }
94
+ function escapeRegExp(s) {
95
+ return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
96
+ }
97
+ var PLACEHOLDER_USERNAME = /^(?:user(?:name)?|you(?:rname)?|example|foo|me|myuser|somebody)$/i;
82
98
  function suppressEmailsInDbUris(findings) {
83
99
  const uris = findings.filter((f) => f.check === "db-connection-uri");
84
100
  if (uris.length === 0) return findings;
@@ -193,8 +209,10 @@ var LINE_DETECTORS = [
193
209
  },
194
210
  // Generic secret-named assignment — WARN, not block (review): a keyword match is
195
211
  // lower-confidence than a structured shape, and a warn still forces confirmation
196
- // in auto mode (and review always asks), so nothing publishes unseen while benign
197
- // config (SECRET_NAME=…, MYSQL_ROOT_PASSWORD=…) is not permanently non-bypassable. The
212
+ // under `review` and `auto`, while benign config (SECRET_NAME=…,
213
+ // MYSQL_ROOT_PASSWORD=…) is not permanently non-bypassable. `full-auto` and a bare
214
+ // `--yes` DO clear it unseen, which is the price of that choice; the publish skill
215
+ // says so rather than implying keys and tokens are all in the blocking tier. The
198
216
  // excerpt stays masked. Placeholder and structural (path/URL/regex) values are
199
217
  // skipped entirely.
200
218
  {
@@ -205,12 +223,7 @@ var LINE_DETECTORS = [
205
223
  // (interior spaces allowed) or an unquoted run, ≥6 chars. Value is masked.
206
224
  re: /\b([A-Za-z0-9_]*(?:API[_-]?KEY|SECRET|ACCESS[_-]?KEY|PRIVATE[_-]?KEY|PASSW(?:OR)?D|TOKEN|CREDENTIALS?|AUTH[_-]?TOKEN)[A-Za-z0-9_]*)\s*[:=]\s*("[^"]{6,}"|'[^']{6,}'|[^\s"']{6,})/gi,
207
225
  excerpt: (m) => `${m[1]}=[redacted ${dequote(m[2] ?? "").length} chars]`,
208
- skip: (m) => {
209
- const raw = m[2] ?? "";
210
- const value = dequote(raw);
211
- if (isPlaceholder(value) || isStructural(value)) return true;
212
- return raw === value && isCodeExpression(value);
213
- }
226
+ skip: skipNonLiteralValue
214
227
  },
215
228
  // Wallet addresses — warn (a contract address may be intentional). Not a secret,
216
229
  // shown abbreviated. viem's checksum validation is deliberately NOT used to gate
@@ -222,11 +235,34 @@ var LINE_DETECTORS = [
222
235
  re: /(?<![0-9a-fx])0x[0-9a-fA-F]{40}(?![0-9a-fA-F])/gi,
223
236
  excerpt: (m) => `${m[0].slice(0, 6)}\u2026${m[0].slice(-4)}`
224
237
  },
225
- // Employer-internal markers — warn.
238
+ // Employer-internal markers — warn. Marker-SHAPED, not word-in-phrase (#36):
239
+ // the detector targets the classification legend a document stamp carries
240
+ // (CONFIDENTIAL, CONFIDENTIAL DRAFT/INFORMATION, STRICTLY/COMPANY
241
+ // CONFIDENTIAL, "Acme Inc. Confidential", INTERNAL (USE) ONLY, DO NOT
242
+ // DISTRIBUTE), so it is case-SENSITIVE — prose about "confidential computing"
243
+ // never fires. The phrase-vs-legend split is positional, not a blanket
244
+ // next-word lookahead (review r5: the old lookahead lost CONFIDENTIAL
245
+ // INFORMATION and every title-case legend):
246
+ // - all-caps CONFIDENTIAL is suppressed only when all-caps words flank it on
247
+ // BOTH sides — that is what a mid-phrase mention in a shouting heading
248
+ // looks like (A SURVEY OF CONFIDENTIAL COMPUTING …). A legend either leads
249
+ // its line (CONFIDENTIAL DRAFT) or ends it (ACME CONFIDENTIAL, HIGHLY
250
+ // CONFIDENTIAL, PROPRIETARY AND CONFIDENTIAL), so one-sided caps still
251
+ // fire (review r6: the caps-prefixed company stamp is the most common real
252
+ // legend form, and the old left-only rule missed the whole family).
253
+ // Accepted FP: a caps heading that LEADS with the topic word
254
+ // (# CONFIDENTIAL COMPUTING ON AWS) warns — fail-safe direction. Accepted
255
+ // FN: a caps-flanked legend without a whitelisted prefix (ACME
256
+ // CONFIDENTIAL INFORMATION) is indistinguishable from a shouting-heading
257
+ // phrase and misses; STRICTLY/COMPANY/HIGHLY prefixes are legend-only
258
+ // vocabulary and are whitelisted through.
259
+ // - Title-case Confidential fires only before punctuation or end-of-line
260
+ // ("Acme Inc. Confidential", "## Confidential: …"), never mid-title
261
+ // ("Confidential Computing: a TEE survey").
226
262
  {
227
263
  check: "confidential-marker",
228
264
  severity: "warn",
229
- re: /\b(?:CONFIDENTIAL|INTERNAL ONLY)\b/gi,
265
+ re: /\b(?:STRICTLY|COMPANY|HIGHLY)\s+CONFIDENTIAL\b|(?<![A-Z]{2,}[ \t]+)\bCONFIDENTIAL\b|\bCONFIDENTIAL\b(?![ \t]+[A-Z]{2,})|\bConfidential(?=\s*(?:[-:.,;–—]|$))|\b(?:INTERNAL|Internal)(?:\s+(?:USE|Use))?\s+(?:ONLY|Only)\b|\b(?:DO\s+NOT\s+DISTRIBUTE|Do\s+Not\s+Distribute)\b/g,
230
266
  excerpt: (m) => m[0]
231
267
  },
232
268
  {
@@ -235,6 +271,80 @@ var LINE_DETECTORS = [
235
271
  re: /\b(?:[a-z0-9-]+\.)+(?:internal|corp|local|lan|intranet)\b/gi,
236
272
  excerpt: (m) => m[0]
237
273
  },
274
+ // Home-anchored local filesystem paths — warn (open-questions publishing-safety:
275
+ // private paths). A /Users/<name>/… or /home/<name>/… or C:\Users\<name>\…
276
+ // path leaks the machine username and private project layout. The username
277
+ // segment is masked in the excerpt; obvious placeholder usernames
278
+ // (/home/user/…, /Users/username/…) are docs examples and skip. `~/…` paths
279
+ // deliberately do NOT fire: they are already generalized. The unix branch
280
+ // requires a non-name left boundary so a web-URL path segment
281
+ // (docs.example.com/home/…) is not a local path, and the segment class
282
+ // excludes `?`/`&` so a query string (…?api_key=…) is never swallowed into a
283
+ // verbatim excerpt a sibling detector would have masked (review r5). Windows
284
+ // matches [Uu]sers: the filesystem is case-insensitive.
285
+ {
286
+ check: "local-path",
287
+ severity: "warn",
288
+ re: /(?:(?<![\w.-])\/(?:Users|home)\/([A-Za-z0-9._-]+)(?:\/[^\s"'`)\]}>:,;?&]+)+|\b[A-Za-z]:\\[Uu]sers\\([^\\\s"']+)(?:\\[^\\\s"']+)+)/dg,
289
+ excerpt: (m) => {
290
+ const bounds = m.indices?.[1] ?? m.indices?.[2];
291
+ const masked = bounds === void 0 ? m[0] : `${m[0].slice(0, bounds[0] - m.index)}[user]${m[0].slice(bounds[1] - m.index)}`;
292
+ return masked.length > 60 ? `${masked.slice(0, 57)}\u2026` : masked;
293
+ },
294
+ skip: (m) => PLACEHOLDER_USERNAME.test(m[1] ?? m[2] ?? "")
295
+ },
296
+ // Labeled customer/account identifiers — warn (open-questions publishing-safety:
297
+ // customer identifiers). Fires only on the explicit label + separator + value
298
+ // shape (customer_id: 84213, Account Number: ACME-0042); the value is masked
299
+ // like a secret-assignment value since a customer identifier is third-party
300
+ // data. Chosen tradeoff: an unlabeled identifier (bare CUST-4812) is a false
301
+ // negative — an unlabeled token is indistinguishable from a SKU or version tag.
302
+ {
303
+ check: "customer-identifier",
304
+ severity: "warn",
305
+ re: /\b((?:customer|client|account|tenant|subscriber)[ _-]?(?:id|number|no))\b\s*[:=#]\s*("[^"]{2,}"|'[^']{2,}'|[A-Za-z0-9][A-Za-z0-9._-]{2,})/gi,
306
+ excerpt: (m) => `${m[1]}=[redacted ${dequote(m[2] ?? "").length} chars]`,
307
+ skip: skipNonLiteralValue
308
+ },
309
+ // Third-party paid/licensed-content markers — warn (open-questions
310
+ // publishing-safety: third-party copyrighted inputs). A rights LEGEND in the
311
+ // draft suggests copied licensed material; ambiguity-class (the author may
312
+ // hold the rights), so warn, never block. Legend shapes only — bare paywall
313
+ // vocabulary (paywalled, premium content, subscriber-only, behind a paywall)
314
+ // deliberately does NOT fire: it is this marketplace's own subject matter and
315
+ // measured 100% false-positive on the dogfood corpus (review r5), the exact
316
+ // word-in-phrase failure #36 is about.
317
+ {
318
+ check: "paid-content-marker",
319
+ severity: "warn",
320
+ re: /\ball rights reserved\b|\b(?:reprinted|reproduced|used) with permission\b|\bnot for (?:redistribution|republication)\b|\bdo not (?:redistribute|republish)\b|(?:©|\(c\)|copyright)\s*(?:19|20)\d{2}\b/gi,
321
+ excerpt: (m) => m[0]
322
+ },
323
+ // Embedded prompt/tool-output instruction patterns — warn (open-questions
324
+ // publishing-safety: embedded instructions). Source material captured from
325
+ // prompts or tool output can carry injection-shaped imperatives that would
326
+ // ship to every future buyer. High-precision imperative shapes only: a bare
327
+ // "system prompt" mention, chat-template delimiters (<system>, [INST]), and
328
+ // persona phrases ("you are an assistant", "as an AI") deliberately do NOT
329
+ // fire — legitimate agent-engineering exposition quotes all of them
330
+ // constantly (review r5), and only the imperative shapes are injection-typed.
331
+ // Two entries under one check name: the imperative shapes are case-INsensitive
332
+ // (adversarial text uses any case), while BEGIN SYSTEM/HIDDEN PROMPT is
333
+ // case-SENSITIVE — its signal is that it reads as a document header, and
334
+ // lowercase "begin system prompt" is ordinary prose on this marketplace's own
335
+ // subject matter (greptile r7), the #36 word-in-phrase class again.
336
+ {
337
+ check: "embedded-instruction",
338
+ severity: "warn",
339
+ re: /\b(?:ignore|disregard|forget)\s+(?:all\s+|any\s+)?(?:previous|prior|above|earlier|preceding)\s+(?:instructions?|prompts?|context|messages?)\b|\bdo not (?:reveal|disclose|mention) (?:this|these|the above)\b/gi,
340
+ excerpt: (m) => m[0]
341
+ },
342
+ {
343
+ check: "embedded-instruction",
344
+ severity: "warn",
345
+ re: /\bBEGIN (?:SYSTEM|HIDDEN) (?:PROMPT|INSTRUCTIONS)\b/g,
346
+ excerpt: (m) => m[0]
347
+ },
238
348
  // Personal data — warn. `email` subsumes corp-domain emails (an internal marker).
239
349
  {
240
350
  check: "email",
@@ -271,6 +381,12 @@ function scanLineDetectors(lines) {
271
381
  }
272
382
  return out;
273
383
  }
384
+ function skipNonLiteralValue(m) {
385
+ const raw = m[2] ?? "";
386
+ const value = dequote(raw);
387
+ if (isPlaceholder(value) || isStructural(value)) return true;
388
+ return raw === value && isCodeExpression(value);
389
+ }
274
390
  function dequote(value) {
275
391
  const m = /^"([^"]*)"$|^'([^']*)'$/.exec(value);
276
392
  return m !== null ? m[1] ?? m[2] ?? "" : value;
@@ -417,6 +533,81 @@ function dedupeAndSort(findings) {
417
533
  );
418
534
  }
419
535
 
536
+ // src/lib/scan-context.ts
537
+ import { readFile, stat } from "fs/promises";
538
+ import { dirname, isAbsolute, join, resolve } from "path";
539
+ async function deriveProjectMarkers(cwd) {
540
+ try {
541
+ const configPath = await findGitConfig(resolve(cwd));
542
+ if (configPath === void 0) return [];
543
+ const config = await readSmallFile(configPath);
544
+ return config === void 0 ? [] : extractRemoteSlugs(config);
545
+ } catch {
546
+ return [];
547
+ }
548
+ }
549
+ var MAX_GIT_FILE_BYTES = 1024 * 1024;
550
+ async function readSmallFile(path) {
551
+ const s = await stat(path).catch(() => void 0);
552
+ if (s?.isFile() !== true || s.size > MAX_GIT_FILE_BYTES) return void 0;
553
+ return readFile(path, "utf8").catch(() => void 0);
554
+ }
555
+ async function findGitConfig(dir) {
556
+ for (let current = dir; ; current = dirname(current)) {
557
+ const dotGit = join(current, ".git");
558
+ const s = await stat(dotGit).catch(() => void 0);
559
+ if (s?.isDirectory() === true) return join(dotGit, "config");
560
+ if (s?.isFile() === true) {
561
+ const resolved = await resolveGitFile(dotGit, current);
562
+ if (resolved !== void 0) return resolved;
563
+ }
564
+ if (dirname(current) === current) return void 0;
565
+ }
566
+ }
567
+ async function resolveGitFile(dotGitFile, containingDir) {
568
+ const content = await readSmallFile(dotGitFile);
569
+ if (content === void 0) return void 0;
570
+ const m = /^gitdir:\s*(.+)\s*$/m.exec(content);
571
+ if (m?.[1] === void 0) return void 0;
572
+ const gitdir = isAbsolute(m[1]) ? m[1] : resolve(containingDir, m[1]);
573
+ const commondirFile = await readSmallFile(join(gitdir, "commondir"));
574
+ if (commondirFile !== void 0) {
575
+ const common = commondirFile.trim();
576
+ return join(isAbsolute(common) ? common : resolve(gitdir, common), "config");
577
+ }
578
+ return join(gitdir, "config");
579
+ }
580
+ var SECTION_LINE = /^\s*\[([^\]]*)\]/;
581
+ var URL_LINE = /^\s*url\s*=\s*(.+?)\s*$/i;
582
+ function extractRemoteSlugs(gitConfig) {
583
+ const slugs = /* @__PURE__ */ new Set();
584
+ let inRemoteSection = false;
585
+ for (const line of gitConfig.split("\n")) {
586
+ const section = SECTION_LINE.exec(line);
587
+ if (section !== null) {
588
+ inRemoteSection = /^remote\b/i.test((section[1] ?? "").trim());
589
+ continue;
590
+ }
591
+ if (!inRemoteSection) continue;
592
+ const m = URL_LINE.exec(line);
593
+ if (m === null) continue;
594
+ const value = (m[1] ?? "").split(/[#;]/, 1)[0]?.trim() ?? "";
595
+ const slug = slugFromRemoteUrl(value);
596
+ if (slug !== void 0) slugs.add(slug);
597
+ }
598
+ return [...slugs];
599
+ }
600
+ function slugFromRemoteUrl(url) {
601
+ let path;
602
+ const scheme = /^[a-z][a-z0-9+.-]*:\/\/(?:[^/@\s]+@)?[^/\s]+\/(.+)$/i.exec(url);
603
+ const scp = /^[^/@\s]+@[^:/\s]+:(.+)$/.exec(url);
604
+ if (scheme !== null) path = scheme[1];
605
+ else if (scp !== null) path = scp[1];
606
+ if (path === void 0) return void 0;
607
+ const slug = path.replace(/^\/+/, "").replace(/\/+$/, "").replace(/\.git$/i, "");
608
+ return slug.includes("/") && slug.length >= 3 ? slug : void 0;
609
+ }
610
+
420
611
  // src/lib/card.ts
421
612
  var FRONTMATTER_RE = /^---\r?\n([\s\S]*?)\r?\n---\r?\n?/;
422
613
  function parseFrontmatter(text) {
@@ -935,13 +1126,13 @@ function publishFailed(res) {
935
1126
  function writeTransportError(url, result) {
936
1127
  const code = result.kind === "network" || result.kind === "timeout" ? "NETWORK_ERROR" : "API_UNREACHABLE";
937
1128
  return new CliError(code, `${url}: ${result.message}`, {
938
- fix: "Check --base-url and your network, then retry."
1129
+ fix: "Check your network and the configured base URL (`tenjin config get baseUrl`), then retry."
939
1130
  });
940
1131
  }
941
1132
 
942
1133
  // src/lib/session-key.ts
943
1134
  import { createHash, randomBytes, webcrypto } from "crypto";
944
- import { readFile, stat } from "fs/promises";
1135
+ import { readFile as readFile2, stat as stat2 } from "fs/promises";
945
1136
  var SESSION_SCOPE = "read+write";
946
1137
  var SESSION_TTL_MS = 24 * 60 * 60 * 1e3;
947
1138
  var EXP_SKEW_MS = 6e4;
@@ -1068,7 +1259,7 @@ async function loadSessionFile(dir) {
1068
1259
  const path = sessionPath(dir);
1069
1260
  if (process.platform !== "win32") {
1070
1261
  try {
1071
- const mode = (await stat(path)).mode & 63;
1262
+ const mode = (await stat2(path)).mode & 63;
1072
1263
  if (mode !== 0) return null;
1073
1264
  } catch (err) {
1074
1265
  if (hasCode(err, "ENOENT")) return null;
@@ -1077,7 +1268,7 @@ async function loadSessionFile(dir) {
1077
1268
  }
1078
1269
  let raw;
1079
1270
  try {
1080
- raw = await readFile(path, "utf8");
1271
+ raw = await readFile2(path, "utf8");
1081
1272
  } catch (err) {
1082
1273
  if (hasCode(err, "ENOENT")) return null;
1083
1274
  throw sessionReadError(path, err);
@@ -1217,7 +1408,12 @@ async function runPublish(args, ctx, deps = {}) {
1217
1408
  );
1218
1409
  }
1219
1410
  const priceAtomic = resolvePrice(args, frontmatter, settings.defaultPriceAtomic);
1220
- const findings = dedupeFindings([...scan(raw), ...scan(cardScanText(card))]);
1411
+ const markerRoot = candidate !== void 0 ? candidate.meta.sourceProject : args.file !== void 0 ? dirname2(resolve2(cwd, args.file)) : cwd;
1412
+ const scanContext = { projectMarkers: await deriveProjectMarkers(markerRoot) };
1413
+ const findings = dedupeFindings([
1414
+ ...scan(raw, scanContext),
1415
+ ...scan(cardScanText(card), scanContext)
1416
+ ]);
1221
1417
  const blocking = findings.filter((f) => f.severity === "block");
1222
1418
  const warns = findings.filter((f) => f.severity === "warn");
1223
1419
  const eligibility = localCardEligibility(card);
@@ -1317,7 +1513,7 @@ async function resolveSource(args, dataDir) {
1317
1513
  }
1318
1514
  async function readDraft(record) {
1319
1515
  try {
1320
- return await readFile2(record.draftPath, "utf8");
1516
+ return await readFile3(record.draftPath, "utf8");
1321
1517
  } catch (err) {
1322
1518
  throw new CliError("INTERNAL", `Candidate ${record.id} is missing its draft.`, {
1323
1519
  fix: `Drop it with \`tenjin candidate drop ${record.id}\` and re-add the draft.`,
@@ -1333,7 +1529,7 @@ function receipt(result, baseUrl, candidateInfo) {
1333
1529
  const title = sanitizeForTerminal(result.title);
1334
1530
  const human = [
1335
1531
  `Published ${title} (${result.status}) for ${price.usd} USD \u2192 ${result.url}`,
1336
- cacheEligible ? "Answer card is lookup-eligible." : missing.length > 0 ? `Answer card not lookup-eligible yet: ${missing.join(" ")}` : "Published as a browse-only document (no answer card).",
1532
+ cacheEligible ? "Answer card is search-eligible." : missing.length > 0 ? `Answer card not search-eligible yet: ${missing.join(" ")}` : "Published as a browse-only document (no answer card).",
1337
1533
  ...candidateInfo?.cleared === true ? [`Cleared candidate ${candidateInfo.id}.`] : [],
1338
1534
  ...result.warnings.map((w) => `warning: ${sanitizeForTerminal(w)}`)
1339
1535
  ];
@@ -1354,7 +1550,7 @@ function receipt(result, baseUrl, candidateInfo) {
1354
1550
  }
1355
1551
  async function readMarkdown(file) {
1356
1552
  try {
1357
- return await readFile2(file, "utf8");
1553
+ return await readFile3(file, "utf8");
1358
1554
  } catch (err) {
1359
1555
  throw new CliError("USAGE", `Could not read ${JSON.stringify(file)}`, {
1360
1556
  fix: "Pass a path to a readable Markdown file, e.g. `tenjin publish post.md`.",
@@ -1472,7 +1668,8 @@ function blockMessage(blocking) {
1472
1668
  function confirmMessage(warnCount, priceUsd) {
1473
1669
  return warnCount > 0 ? `Publish needs confirmation: ${warnCount} finding(s), price $${priceUsd}.` : `Publish needs confirmation: price $${priceUsd}.`;
1474
1670
  }
1671
+
1475
1672
  export {
1476
1673
  runPublish
1477
1674
  };
1478
- //# sourceMappingURL=publish-BKBQQAW4.js.map
1675
+ //# sourceMappingURL=chunk-PYNSGYBE.js.map