tenjin-cli 0.1.0-alpha.4 → 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.
- package/README.md +168 -11
- package/dist/{buy-OOOLUDND.js → buy-YMXXVNFH.js} +18 -17
- package/dist/{candidate-TWCWTFGA.js → candidate-H7FR4AU5.js} +8 -8
- package/dist/{chunk-MUBUQVC3.js → chunk-2JQ5JSG6.js} +3 -2
- package/dist/{chunk-MUBUQVC3.js.map → chunk-2JQ5JSG6.js.map} +1 -1
- package/dist/{chunk-NXCJN2FJ.js → chunk-3IRDP7TN.js} +48 -41
- package/dist/chunk-3IRDP7TN.js.map +1 -0
- package/dist/{chunk-4GR7DGD6.js → chunk-4WVKXKDK.js} +14 -28
- package/dist/chunk-4WVKXKDK.js.map +1 -0
- package/dist/chunk-5SCU253N.js +412 -0
- package/dist/chunk-5SCU253N.js.map +1 -0
- package/dist/chunk-ADJYSM45.js +135 -0
- package/dist/chunk-ADJYSM45.js.map +1 -0
- package/dist/{chunk-5JH7ZB6Z.js → chunk-BIKAUVC2.js} +40 -8
- package/dist/chunk-BIKAUVC2.js.map +1 -0
- package/dist/{chunk-S3KZ3PPK.js → chunk-C444K6MI.js} +254 -47
- package/dist/chunk-C444K6MI.js.map +1 -0
- package/dist/{chunk-XNNOR7F7.js → chunk-CVX6JNGD.js} +3 -3
- package/dist/{chunk-H5ETJRQD.js → chunk-HTDALK7M.js} +16 -11
- package/dist/chunk-HTDALK7M.js.map +1 -0
- package/dist/chunk-IOPWPMT2.js +239 -0
- package/dist/chunk-IOPWPMT2.js.map +1 -0
- package/dist/{chunk-MM4TGTST.js → chunk-L4IHCN6B.js} +8 -4
- package/dist/chunk-L4IHCN6B.js.map +1 -0
- package/dist/{chunk-EUQN3L5X.js → chunk-LAM66WFJ.js} +20 -6
- package/dist/chunk-LAM66WFJ.js.map +1 -0
- package/dist/{chunk-FHB3VKZW.js → chunk-MDDGEGSW.js} +5 -3
- package/dist/chunk-MDDGEGSW.js.map +1 -0
- package/dist/{chunk-333FOTUJ.js → chunk-MJZZTKCC.js} +108 -2
- package/dist/chunk-MJZZTKCC.js.map +1 -0
- package/dist/{chunk-VV4P5RVK.js → chunk-NFSOVL3C.js} +6 -3
- package/dist/{chunk-VV4P5RVK.js.map → chunk-NFSOVL3C.js.map} +1 -1
- package/dist/{chunk-QH6677FJ.js → chunk-NJF2WENW.js} +2 -2
- package/dist/{chunk-QH6677FJ.js.map → chunk-NJF2WENW.js.map} +1 -1
- package/dist/{chunk-6WWVYYSB.js → chunk-PAUXMRSF.js} +14 -3
- package/dist/{chunk-6WWVYYSB.js.map → chunk-PAUXMRSF.js.map} +1 -1
- package/dist/{chunk-ULLWHHIT.js → chunk-PYNSGYBE.js} +244 -32
- package/dist/chunk-PYNSGYBE.js.map +1 -0
- package/dist/{chunk-DPET3TW5.js → chunk-QONTBYQW.js} +12 -9
- package/dist/chunk-QONTBYQW.js.map +1 -0
- package/dist/chunk-QW2Q2KAH.js +27 -0
- package/dist/chunk-QW2Q2KAH.js.map +1 -0
- package/dist/chunk-RTJLLPFA.js +599 -0
- package/dist/chunk-RTJLLPFA.js.map +1 -0
- package/dist/{chunk-KXIX7YDV.js → chunk-TXPPMK4L.js} +5 -5
- package/dist/{chunk-C4TIWOAM.js → chunk-ZDY2KY5X.js} +2 -2
- package/dist/{chunk-DPUMEMGM.js → chunk-ZIYVN4CD.js} +3 -3
- package/dist/{chunk-OJD54DIU.js → chunk-ZW3B5LWX.js} +5 -5
- package/dist/{cli-AFSLAKR6.js → cli-IW76QTN3.js} +38 -25
- package/dist/{cli-AFSLAKR6.js.map → cli-IW76QTN3.js.map} +1 -1
- package/dist/{config-DBEEM3UA.js → config-VCOS7P5K.js} +8 -6
- package/dist/{doctor-XDA3YU6H.js → doctor-WS65JG3V.js} +9 -8
- package/dist/index.js +1 -1
- package/dist/{inspect-YBGDAG47.js → inspect-SFJWUQHO.js} +14 -14
- package/dist/{install-7J6KKEEP.js → install-RVPQPCKH.js} +177 -130
- package/dist/install-RVPQPCKH.js.map +1 -0
- package/dist/outcome-GNYCSZ7J.js +20 -0
- package/dist/{publish-IH7RJXGB.js → publish-DSFWQRUN.js} +14 -14
- package/dist/{run-DCZFEW2C.js → run-OMPKA43G.js} +29 -28
- package/dist/{run-DCZFEW2C.js.map → run-OMPKA43G.js.map} +1 -1
- package/dist/search-KOI6Y7P6.js +24 -0
- package/dist/send-3G4C64HJ.js +222 -0
- package/dist/send-3G4C64HJ.js.map +1 -0
- package/dist/{usdc-AU6ZIKA6.js → usdc-4VCDHFWX.js} +20 -4
- package/dist/{wallet-HKG3GSTX.js → wallet-B7KJS2R5.js} +17 -7
- package/dist/{wallet-UWHSHWC6.js → wallet-PP22LAX7.js} +8 -8
- package/package.json +1 -1
- package/skills/tenjin/SKILL.md +32 -7
- package/skills/tenjin-publish/SKILL.md +97 -12
- package/skills/tenjin-search/SKILL.md +115 -12
- package/dist/chunk-333FOTUJ.js.map +0 -1
- package/dist/chunk-4GR7DGD6.js.map +0 -1
- package/dist/chunk-5JH7ZB6Z.js.map +0 -1
- package/dist/chunk-BXUS5UCT.js +0 -212
- package/dist/chunk-BXUS5UCT.js.map +0 -1
- package/dist/chunk-CJU555P5.js +0 -333
- package/dist/chunk-CJU555P5.js.map +0 -1
- package/dist/chunk-DPET3TW5.js.map +0 -1
- package/dist/chunk-EUQN3L5X.js.map +0 -1
- package/dist/chunk-FHB3VKZW.js.map +0 -1
- package/dist/chunk-H5ETJRQD.js.map +0 -1
- package/dist/chunk-MM4TGTST.js.map +0 -1
- package/dist/chunk-NXCJN2FJ.js.map +0 -1
- package/dist/chunk-R7BMDJZM.js +0 -167
- package/dist/chunk-R7BMDJZM.js.map +0 -1
- package/dist/chunk-S3KZ3PPK.js.map +0 -1
- package/dist/chunk-ULLWHHIT.js.map +0 -1
- package/dist/chunk-YFREUEUI.js +0 -78
- package/dist/chunk-YFREUEUI.js.map +0 -1
- package/dist/install-7J6KKEEP.js.map +0 -1
- package/dist/outcome-ZFGHX2XW.js +0 -20
- package/dist/search-R6NIQFXI.js +0 -24
- /package/dist/{buy-OOOLUDND.js.map → buy-YMXXVNFH.js.map} +0 -0
- /package/dist/{candidate-TWCWTFGA.js.map → candidate-H7FR4AU5.js.map} +0 -0
- /package/dist/{chunk-XNNOR7F7.js.map → chunk-CVX6JNGD.js.map} +0 -0
- /package/dist/{chunk-KXIX7YDV.js.map → chunk-TXPPMK4L.js.map} +0 -0
- /package/dist/{chunk-C4TIWOAM.js.map → chunk-ZDY2KY5X.js.map} +0 -0
- /package/dist/{chunk-DPUMEMGM.js.map → chunk-ZIYVN4CD.js.map} +0 -0
- /package/dist/{chunk-OJD54DIU.js.map → chunk-ZW3B5LWX.js.map} +0 -0
- /package/dist/{config-DBEEM3UA.js.map → config-VCOS7P5K.js.map} +0 -0
- /package/dist/{doctor-XDA3YU6H.js.map → doctor-WS65JG3V.js.map} +0 -0
- /package/dist/{inspect-YBGDAG47.js.map → inspect-SFJWUQHO.js.map} +0 -0
- /package/dist/{outcome-ZFGHX2XW.js.map → outcome-GNYCSZ7J.js.map} +0 -0
- /package/dist/{publish-IH7RJXGB.js.map → publish-DSFWQRUN.js.map} +0 -0
- /package/dist/{search-R6NIQFXI.js.map → search-KOI6Y7P6.js.map} +0 -0
- /package/dist/{usdc-AU6ZIKA6.js.map → usdc-4VCDHFWX.js.map} +0 -0
- /package/dist/{wallet-HKG3GSTX.js.map → wallet-B7KJS2R5.js.map} +0 -0
- /package/dist/{wallet-UWHSHWC6.js.map → wallet-PP22LAX7.js.map} +0 -0
|
@@ -6,63 +6,95 @@ import {
|
|
|
6
6
|
import {
|
|
7
7
|
describeWallet,
|
|
8
8
|
resolveWalletProvider
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-C444K6MI.js";
|
|
10
10
|
import {
|
|
11
11
|
rateLimitError
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-3IRDP7TN.js";
|
|
13
13
|
import {
|
|
14
14
|
dropCandidate,
|
|
15
15
|
readCandidate
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-ZIYVN4CD.js";
|
|
17
17
|
import {
|
|
18
18
|
ATOMIC_RE,
|
|
19
19
|
UUID_RE
|
|
20
20
|
} from "./chunk-WWX32ML4.js";
|
|
21
|
-
import {
|
|
22
|
-
sanitizeForTerminal
|
|
23
|
-
} from "./chunk-VV4P5RVK.js";
|
|
24
21
|
import {
|
|
25
22
|
CLIENT_HEADER,
|
|
26
23
|
httpRequest,
|
|
27
24
|
trimSlash
|
|
28
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-ZDY2KY5X.js";
|
|
26
|
+
import {
|
|
27
|
+
sanitizeForTerminal
|
|
28
|
+
} from "./chunk-NFSOVL3C.js";
|
|
29
29
|
import {
|
|
30
30
|
hasCode
|
|
31
31
|
} from "./chunk-2I4QTOLB.js";
|
|
32
32
|
import {
|
|
33
33
|
resolveContextSettings,
|
|
34
34
|
resolvePublishSettings
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-MDDGEGSW.js";
|
|
36
36
|
import {
|
|
37
37
|
PublishModeSchema,
|
|
38
38
|
parsePublishModeFlag,
|
|
39
39
|
parseUsdToAtomic,
|
|
40
40
|
toMoney
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-5SCU253N.js";
|
|
42
42
|
import {
|
|
43
43
|
writeFileAtomic
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-2JQ5JSG6.js";
|
|
45
45
|
import {
|
|
46
46
|
CliError,
|
|
47
47
|
external_exports,
|
|
48
48
|
sessionPath
|
|
49
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-PAUXMRSF.js";
|
|
50
50
|
|
|
51
51
|
// src/commands/publish.ts
|
|
52
|
-
import { readFile as
|
|
52
|
+
import { readFile as readFile3 } from "fs/promises";
|
|
53
|
+
import { dirname as dirname2, resolve as resolve2 } from "path";
|
|
53
54
|
|
|
54
55
|
// src/lib/scan.ts
|
|
55
56
|
var LONG_QUOTE_WORDS = 80;
|
|
56
|
-
function scan(text) {
|
|
57
|
+
function scan(text, context = {}) {
|
|
57
58
|
const lines = text.split("\n");
|
|
58
59
|
const findings = [
|
|
59
60
|
...scanHex64(lines),
|
|
60
61
|
...scanLineDetectors(lines),
|
|
61
62
|
...scanPemBlocks(lines),
|
|
62
|
-
...scanLongVerbatim(lines)
|
|
63
|
+
...scanLongVerbatim(lines),
|
|
64
|
+
...scanProjectMarkers(lines, context.projectMarkers ?? [])
|
|
63
65
|
];
|
|
64
66
|
return dedupeAndSort(suppressEmailsInDbUris(findings));
|
|
65
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;
|
|
66
98
|
function suppressEmailsInDbUris(findings) {
|
|
67
99
|
const uris = findings.filter((f) => f.check === "db-connection-uri");
|
|
68
100
|
if (uris.length === 0) return findings;
|
|
@@ -177,8 +209,10 @@ var LINE_DETECTORS = [
|
|
|
177
209
|
},
|
|
178
210
|
// Generic secret-named assignment — WARN, not block (review): a keyword match is
|
|
179
211
|
// lower-confidence than a structured shape, and a warn still forces confirmation
|
|
180
|
-
//
|
|
181
|
-
//
|
|
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
|
|
182
216
|
// excerpt stays masked. Placeholder and structural (path/URL/regex) values are
|
|
183
217
|
// skipped entirely.
|
|
184
218
|
{
|
|
@@ -189,12 +223,7 @@ var LINE_DETECTORS = [
|
|
|
189
223
|
// (interior spaces allowed) or an unquoted run, ≥6 chars. Value is masked.
|
|
190
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,
|
|
191
225
|
excerpt: (m) => `${m[1]}=[redacted ${dequote(m[2] ?? "").length} chars]`,
|
|
192
|
-
skip:
|
|
193
|
-
const raw = m[2] ?? "";
|
|
194
|
-
const value = dequote(raw);
|
|
195
|
-
if (isPlaceholder(value) || isStructural(value)) return true;
|
|
196
|
-
return raw === value && isCodeExpression(value);
|
|
197
|
-
}
|
|
226
|
+
skip: skipNonLiteralValue
|
|
198
227
|
},
|
|
199
228
|
// Wallet addresses — warn (a contract address may be intentional). Not a secret,
|
|
200
229
|
// shown abbreviated. viem's checksum validation is deliberately NOT used to gate
|
|
@@ -206,11 +235,34 @@ var LINE_DETECTORS = [
|
|
|
206
235
|
re: /(?<![0-9a-fx])0x[0-9a-fA-F]{40}(?![0-9a-fA-F])/gi,
|
|
207
236
|
excerpt: (m) => `${m[0].slice(0, 6)}\u2026${m[0].slice(-4)}`
|
|
208
237
|
},
|
|
209
|
-
// 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").
|
|
210
262
|
{
|
|
211
263
|
check: "confidential-marker",
|
|
212
264
|
severity: "warn",
|
|
213
|
-
re: /\b(?:CONFIDENTIAL|INTERNAL
|
|
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,
|
|
214
266
|
excerpt: (m) => m[0]
|
|
215
267
|
},
|
|
216
268
|
{
|
|
@@ -219,6 +271,80 @@ var LINE_DETECTORS = [
|
|
|
219
271
|
re: /\b(?:[a-z0-9-]+\.)+(?:internal|corp|local|lan|intranet)\b/gi,
|
|
220
272
|
excerpt: (m) => m[0]
|
|
221
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
|
+
},
|
|
222
348
|
// Personal data — warn. `email` subsumes corp-domain emails (an internal marker).
|
|
223
349
|
{
|
|
224
350
|
check: "email",
|
|
@@ -255,6 +381,12 @@ function scanLineDetectors(lines) {
|
|
|
255
381
|
}
|
|
256
382
|
return out;
|
|
257
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
|
+
}
|
|
258
390
|
function dequote(value) {
|
|
259
391
|
const m = /^"([^"]*)"$|^'([^']*)'$/.exec(value);
|
|
260
392
|
return m !== null ? m[1] ?? m[2] ?? "" : value;
|
|
@@ -401,6 +533,81 @@ function dedupeAndSort(findings) {
|
|
|
401
533
|
);
|
|
402
534
|
}
|
|
403
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
|
+
|
|
404
611
|
// src/lib/card.ts
|
|
405
612
|
var FRONTMATTER_RE = /^---\r?\n([\s\S]*?)\r?\n---\r?\n?/;
|
|
406
613
|
function parseFrontmatter(text) {
|
|
@@ -919,13 +1126,13 @@ function publishFailed(res) {
|
|
|
919
1126
|
function writeTransportError(url, result) {
|
|
920
1127
|
const code = result.kind === "network" || result.kind === "timeout" ? "NETWORK_ERROR" : "API_UNREACHABLE";
|
|
921
1128
|
return new CliError(code, `${url}: ${result.message}`, {
|
|
922
|
-
fix: "Check
|
|
1129
|
+
fix: "Check your network and the configured base URL (`tenjin config get baseUrl`), then retry."
|
|
923
1130
|
});
|
|
924
1131
|
}
|
|
925
1132
|
|
|
926
1133
|
// src/lib/session-key.ts
|
|
927
1134
|
import { createHash, randomBytes, webcrypto } from "crypto";
|
|
928
|
-
import { readFile, stat } from "fs/promises";
|
|
1135
|
+
import { readFile as readFile2, stat as stat2 } from "fs/promises";
|
|
929
1136
|
var SESSION_SCOPE = "read+write";
|
|
930
1137
|
var SESSION_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
931
1138
|
var EXP_SKEW_MS = 6e4;
|
|
@@ -1052,7 +1259,7 @@ async function loadSessionFile(dir) {
|
|
|
1052
1259
|
const path = sessionPath(dir);
|
|
1053
1260
|
if (process.platform !== "win32") {
|
|
1054
1261
|
try {
|
|
1055
|
-
const mode = (await
|
|
1262
|
+
const mode = (await stat2(path)).mode & 63;
|
|
1056
1263
|
if (mode !== 0) return null;
|
|
1057
1264
|
} catch (err) {
|
|
1058
1265
|
if (hasCode(err, "ENOENT")) return null;
|
|
@@ -1061,7 +1268,7 @@ async function loadSessionFile(dir) {
|
|
|
1061
1268
|
}
|
|
1062
1269
|
let raw;
|
|
1063
1270
|
try {
|
|
1064
|
-
raw = await
|
|
1271
|
+
raw = await readFile2(path, "utf8");
|
|
1065
1272
|
} catch (err) {
|
|
1066
1273
|
if (hasCode(err, "ENOENT")) return null;
|
|
1067
1274
|
throw sessionReadError(path, err);
|
|
@@ -1201,7 +1408,12 @@ async function runPublish(args, ctx, deps = {}) {
|
|
|
1201
1408
|
);
|
|
1202
1409
|
}
|
|
1203
1410
|
const priceAtomic = resolvePrice(args, frontmatter, settings.defaultPriceAtomic);
|
|
1204
|
-
const
|
|
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
|
+
]);
|
|
1205
1417
|
const blocking = findings.filter((f) => f.severity === "block");
|
|
1206
1418
|
const warns = findings.filter((f) => f.severity === "warn");
|
|
1207
1419
|
const eligibility = localCardEligibility(card);
|
|
@@ -1301,7 +1513,7 @@ async function resolveSource(args, dataDir) {
|
|
|
1301
1513
|
}
|
|
1302
1514
|
async function readDraft(record) {
|
|
1303
1515
|
try {
|
|
1304
|
-
return await
|
|
1516
|
+
return await readFile3(record.draftPath, "utf8");
|
|
1305
1517
|
} catch (err) {
|
|
1306
1518
|
throw new CliError("INTERNAL", `Candidate ${record.id} is missing its draft.`, {
|
|
1307
1519
|
fix: `Drop it with \`tenjin candidate drop ${record.id}\` and re-add the draft.`,
|
|
@@ -1338,7 +1550,7 @@ function receipt(result, baseUrl, candidateInfo) {
|
|
|
1338
1550
|
}
|
|
1339
1551
|
async function readMarkdown(file) {
|
|
1340
1552
|
try {
|
|
1341
|
-
return await
|
|
1553
|
+
return await readFile3(file, "utf8");
|
|
1342
1554
|
} catch (err) {
|
|
1343
1555
|
throw new CliError("USAGE", `Could not read ${JSON.stringify(file)}`, {
|
|
1344
1556
|
fix: "Pass a path to a readable Markdown file, e.g. `tenjin publish post.md`.",
|
|
@@ -1460,4 +1672,4 @@ function confirmMessage(warnCount, priceUsd) {
|
|
|
1460
1672
|
export {
|
|
1461
1673
|
runPublish
|
|
1462
1674
|
};
|
|
1463
|
-
//# sourceMappingURL=chunk-
|
|
1675
|
+
//# sourceMappingURL=chunk-PYNSGYBE.js.map
|