@gobing-ai/knowledge-kit 0.0.29 → 0.0.30
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/.claude-plugin/marketplace.json +1 -1
- package/dist/index.js +114 -38
- package/package.json +1 -1
- package/plugins/generations/daily-article-gen/dist/index.js +24 -7
- package/plugins/generations/daily-article-gen/src/index.ts +36 -12
- package/plugins/generations/dailynews-gen/dist/index.js +19 -2
- package/plugins/generations/dailynews-gen/src/index.ts +7 -0
- package/plugins/generations/dailynews-gen/src/script-plan.ts +21 -3
- package/plugins/generations/episode-plan-gen/dist/index.js +55 -4
- package/plugins/generations/episode-plan-gen/src/index.ts +80 -2
- package/plugins/generations/image-gen/dist/index.js +122 -20
- package/plugins/generations/image-gen/src/bytes.ts +106 -18
- package/plugins/generations/image-gen/src/index.ts +46 -6
- package/plugins/generations/image-gen/src/job.ts +6 -0
- package/plugins/generations/image-gen/src/providers/minimax.ts +12 -4
- package/plugins/generations/image-gen/src/providers/types.ts +12 -1
- package/plugins/kk/plugin.json +1 -1
- package/plugins/kk/scripts/daily-voice-style.zh.md +5 -5
- package/plugins/kk/scripts/itc-stages.ts +21 -3
- package/plugins/kk/scripts/kk-workflow-stages.ts +199 -7
- package/plugins/kk/scripts/topic-boundary.json +3 -12
- package/plugins/kk/skills/content-judge/SKILL.md +30 -0
- package/plugins/kk/skills/content-judge/references/workflow-integration.md +9 -2
- package/plugins/kk/skills/publish/SKILL.md +1 -1
- package/plugins/kk/workflows/judge-gated-publish-example.yaml +18 -10
- package/plugins/kk/workflows/kk-daily-ai-voice.yaml +39 -14
- package/plugins/kk/workflows/kk-itc.yaml +21 -8
- package/plugins/publishings/xhs-pub/dist/index.js +1 -1
- package/plugins/publishings/xhs-pub/src/automation-guard.ts +2 -2
- package/plugins/publishings/xhs-pub/src/index.ts +1 -1
- package/plugins/publishings/xhs-pub/src/profile-check.ts +2 -2
- package/plugins/sp/lib/env.ts +0 -46
- package/plugins/sp/lib/inline-run.generated.mjs +0 -1489
- package/plugins/sp/scripts/batch-preflight.mjs +0 -346
- package/plugins/sp/scripts/batch-preflight.ts +0 -459
- package/plugins/sp/scripts/daily-summary/daily-summary.mjs +0 -615
- package/plugins/sp/scripts/daily-summary/daily-summary.ts +0 -846
- package/plugins/sp/scripts/daily-summary/logger.ts +0 -28
- package/plugins/sp/scripts/dogfood-testing/detect-pipeline-driving.mjs +0 -223
- package/plugins/sp/scripts/dogfood-testing/detect-pipeline-driving.ts +0 -367
- package/plugins/sp/scripts/dogfood-testing/validate-report.mjs +0 -132
- package/plugins/sp/scripts/dogfood-testing/validate-report.ts +0 -169
- package/plugins/sp/scripts/feature-dev-precheck.mjs +0 -171
- package/plugins/sp/scripts/feature-dev-precheck.ts +0 -238
- package/plugins/sp/scripts/feature-sync-bounded.mjs +0 -285
- package/plugins/sp/scripts/feature-sync-bounded.ts +0 -478
- package/plugins/sp/scripts/feature-verification-steps.ts +0 -275
- package/plugins/sp/scripts/history-anatomy-cache.mjs +0 -902
- package/plugins/sp/scripts/history-anatomy-cache.ts +0 -1028
- package/plugins/sp/scripts/idea-handoff.mjs +0 -22
- package/plugins/sp/scripts/idea-handoff.ts +0 -44
- package/plugins/sp/scripts/inline-pipeline-parity-check.ts +0 -185
- package/plugins/sp/scripts/inline-run-setup.ts +0 -722
- package/plugins/sp/scripts/pr-reviewing.mjs +0 -769
- package/plugins/sp/scripts/pr-reviewing.ts +0 -925
- package/plugins/sp/scripts/quality-gate.mjs +0 -179
- package/plugins/sp/scripts/quality-gate.ts +0 -217
- package/plugins/sp/scripts/script-contract-check.ts +0 -319
- package/plugins/sp/scripts/stage-registry-adapter.ts +0 -1533
- package/plugins/sp/scripts/surface-drift-inventory.ts +0 -929
- package/plugins/sp/scripts/task-evidence-precheck.ts +0 -181
- package/plugins/sp/scripts/task-size-precheck.ts +0 -175
- package/plugins/sp/scripts/transition-shim-check.ts +0 -238
- package/plugins/sp/scripts/validate-commands.ts +0 -689
- package/plugins/sp/scripts/validate-flag-contracts.ts +0 -878
- package/plugins/sp/scripts/verify-answer-lint.ts +0 -530
- package/plugins/sp/scripts/workflow-step-profile.mjs +0 -316
- package/plugins/sp/scripts/workflow-step-profile.ts +0 -456
- package/plugins/sp/scripts/wrapup-drift-probe.mjs +0 -190
- package/plugins/sp/scripts/wrapup-drift-probe.ts +0 -258
- package/plugins/sp/scripts/wrapup-steps.mjs +0 -444
- package/plugins/sp/scripts/wrapup-steps.ts +0 -552
|
@@ -113,6 +113,17 @@ vars:
|
|
|
113
113
|
qc_min_importance: "3"
|
|
114
114
|
qc_min_urgency: "2"
|
|
115
115
|
qc_min_impact: "1"
|
|
116
|
+
# 20261002 episode floor: a weak, policy-heavy day filtered to 5 QC-kept docs and the prompt-layer
|
|
117
|
+
# 选题边界 dropped 2 more at script-write → a 5-minute episode. Below this count, importance-only
|
|
118
|
+
# rejects (quality/urgency/impact still hard) backfill the plan; floor is 8 because the script-layer
|
|
119
|
+
# drops land AFTER this gate (lossy upstream compensation). Moves in lockstep with
|
|
120
|
+
# DEFAULT_FILTER_CONFIG.minEpisodeItems (env wins).
|
|
121
|
+
qc_min_episode_items: "8"
|
|
122
|
+
# Standing requirement (20261002, operator): episodes run 15–20 minutes; duration is
|
|
123
|
+
# authoritative and the 8–10-item figure is only an estimate. Enforced by the
|
|
124
|
+
# episode-duration stage after intro-music (fail loud outside the window).
|
|
125
|
+
episode_min_minutes: "15"
|
|
126
|
+
episode_max_minutes: "20"
|
|
116
127
|
__hitlAnswer: ""
|
|
117
128
|
|
|
118
129
|
states:
|
|
@@ -169,7 +180,7 @@ states:
|
|
|
169
180
|
- kind: shell
|
|
170
181
|
options:
|
|
171
182
|
command: >-
|
|
172
|
-
kk stage daily-qc-content "${vars.work_dir}" "${vars.run_date}" "${vars.plugins_path}" "${vars.qc_categories}" "${vars.qc_min_quality}" "${vars.qc_min_importance}" "${vars.qc_min_urgency}" "${vars.qc_min_impact}"
|
|
183
|
+
kk stage daily-qc-content "${vars.work_dir}" "${vars.run_date}" "${vars.plugins_path}" "${vars.qc_categories}" "${vars.qc_min_quality}" "${vars.qc_min_importance}" "${vars.qc_min_urgency}" "${vars.qc_min_impact}" "${vars.qc_min_episode_items}"
|
|
173
184
|
|
|
174
185
|
- id: plan-translate
|
|
175
186
|
description: "Translate needsTranslation plan items into the output plan.json via agent.run"
|
|
@@ -181,11 +192,11 @@ states:
|
|
|
181
192
|
# ADR-115 error tier: keep this prompt <= 1000 chars (0133 R3; 0138 R4a adds the copy discipline).
|
|
182
193
|
input: |
|
|
183
194
|
Read ${vars.work_dir}/21-plan/${vars.run_date}_04_quality-control-content_candidates.json — metadata.docs (Doc[]) is the plan; don't edit it.
|
|
184
|
-
For items
|
|
185
|
-
Titles read as a news event
|
|
195
|
+
For needsTranslation items, adapt "title", "body" and "metadata.brief" into spoken simplified Chinese — full coverage, not a summary: keep every fact, number, name, quote and hedge (口播全长改编,不摘要不省略), body ≈0.6–0.7× the source.
|
|
196
|
+
Titles read as a news event; keep product/model names verbatim, preserve body URLs, use 「」 not ASCII double quotes.
|
|
186
197
|
Copy discipline: reader-facing news copy — no scaffold labels (「可做角度」「为什么现在值得注意」「社区讨论」「背景」「潜在影响」「影响」), no duplicated labels or hedging (「读者宜另行核实」「仍待验证」) — merge their substance into prose or drop.
|
|
187
|
-
Keep other fields (id, sourceUri, mediaType, metadata)
|
|
188
|
-
Output strictly valid JSON — a same-length, same-order array
|
|
198
|
+
Keep other fields (id, sourceUri, mediaType, metadata) as-is; no comments or trailing commas.
|
|
199
|
+
Output strictly valid JSON — a same-length, same-order array — to ${vars.work_dir}/21-plan/${vars.run_date}_03_plan_plan.json.
|
|
189
200
|
expectFile: ${vars.work_dir}/21-plan/${vars.run_date}_03_plan_plan.json
|
|
190
201
|
allowAppend: false
|
|
191
202
|
|
|
@@ -201,8 +212,8 @@ states:
|
|
|
201
212
|
input: |
|
|
202
213
|
Read ${vars.work_dir}/21-plan/${vars.run_date}_03_plan_plan.json — metadata.docs (Doc[]) is the translated plan; don't edit it.
|
|
203
214
|
Write a tech-sharing prose article in natural simplified Chinese for the 「AI 乱炖」 column (show 「咸话咸说」, tools/papers/hands-on practice 随聊): no title line (the pipeline computes it), an intro paragraph (2–3 sentences), then one section per item (## numbered title, 2–4 sentences of flowing prose, source link [来源:<label>](<sourceUri>) inline), a closing paragraph tying items together.
|
|
204
|
-
选题边界:只写技术内容;某条主线若属政治/外交或贸易管制/军事/公共政策争议/社会公共事件,跳过该条并在文末加一行「> 注:<N>
|
|
205
|
-
|
|
215
|
+
选题边界:只写技术内容;某条主线若属政治/外交或贸易管制/军事/公共政策争议/社会公共事件,跳过该条并在文末加一行「> 注:<N> 条条目因选题边界未写入:<id>(<原因>)、<id>(<原因>)」。
|
|
216
|
+
事实纪律:每个事实取自该条计划内容,不虚构、不引他处;数字与主体不得放大(如 16 张卡不得写成「几十张卡」,具名主体不得写成「顶级大厂」);引语只能归属其原句主语;保留「据报道/称/承诺」等限定词;导语/收束不加计划外程度词(如「稳定解决」「高维」「治理」);材料不足就少写或不写,不凑数。
|
|
206
217
|
Narrative register — smooth transitions, no list-like bulleting, no scaffold labels (「可做角度」「背景」「潜在影响」), no hedging (「读者宜另行核实」「仍待验证」). 「」 quotes.
|
|
207
218
|
Output the markdown to ${vars.work_dir}/22-article/${vars.run_date}_06_article-write_body.md.
|
|
208
219
|
expectFile: ${vars.work_dir}/22-article/${vars.run_date}_06_article-write_body.md
|
|
@@ -229,7 +240,7 @@ states:
|
|
|
229
240
|
# ADR-115 error tier: keep this prompt <= 1000 chars.
|
|
230
241
|
input: |
|
|
231
242
|
Read ${vars.work_dir}/21-plan/${vars.run_date}_03_plan_plan.json — a JSON array of plan docs; don't edit it.
|
|
232
|
-
Take item 1 only (its "title" and "metadata.brief") — the episode's lead story.
|
|
243
|
+
Take item 1 only (its "title" and "metadata.brief") — the episode's lead story. If item 1's mainline is public affairs (politics/diplomacy, trade controls, military, policy disputes, social events), take the first in-scope item instead.
|
|
233
244
|
Write one concrete visual scene in English, ≤240 characters, that a viewer would connect to that story: objects, settings, symbols, metaphor.
|
|
234
245
|
No text, letters, numbers, logos, brand marks, flags, or recognizable real people. No style, color, lighting, or composition words — the preset owns those.
|
|
235
246
|
Output strictly valid JSON {"subject": "..."} to ${vars.work_dir}/23-cover/${vars.run_date}_07_cover-brief.json.
|
|
@@ -264,10 +275,10 @@ states:
|
|
|
264
275
|
agent: ${vars.agent}
|
|
265
276
|
# ADR-115 error tier: keep this prompt <= 1000 chars.
|
|
266
277
|
input: |
|
|
267
|
-
Read ${vars.work_dir}/21-plan/${vars.run_date}_03_plan_plan.json — a JSON array of docs;
|
|
268
|
-
For each doc write a `lead` (a spoken bridge
|
|
269
|
-
|
|
270
|
-
Output only
|
|
278
|
+
Read ${vars.work_dir}/21-plan/${vars.run_date}_03_plan_plan.json — a JSON array of docs; don't edit it. Also read the style contract ${vars.work_dir}/24-script/${vars.run_date}_08_script-write_style.md and obey its char caps, duration budget and banned phrases.
|
|
279
|
+
For each doc write a `lead` (a spoken bridge, not containing the title) and an `insight` (grounded only in that doc's facts: keep its numbers and hedges(据报道), add no new degree words like「高预算穷举」).
|
|
280
|
+
intro/outro hook only in-scope items; no greeting or sign-off — the builder adds both. 选题边界:政治/外交、贸易管制、军事、公共政策争议、社会公共事件条目绝不复述;读文章 22-article/*_06_article-write_body.md,其文末注记点名的 id 一并进 excluded,各配中文原因。
|
|
281
|
+
Output only JSON {"version":1,"intro":"…","outro":"…","items":[{"id":"…","lead":"…","insight":"…"}],"excluded":[{"id":"…","reason":"…"}]} to ${vars.work_dir}/24-script/${vars.run_date}_08_script-write_plan.json. Exactly one `items` entry per doc not in `excluded`.
|
|
271
282
|
expectFile: ${vars.work_dir}/24-script/${vars.run_date}_08_script-write_plan.json
|
|
272
283
|
allowAppend: false
|
|
273
284
|
|
|
@@ -356,6 +367,14 @@ states:
|
|
|
356
367
|
command: >-
|
|
357
368
|
kk stage daily-intro "${vars.work_dir}" "${vars.run_date}" "${vars.intro_music}"
|
|
358
369
|
|
|
370
|
+
- id: episode-duration
|
|
371
|
+
description: "Fail loud unless final episode duration sits in the 15–20 min window (duration authoritative)"
|
|
372
|
+
onEnter:
|
|
373
|
+
- kind: shell
|
|
374
|
+
options:
|
|
375
|
+
command: >-
|
|
376
|
+
kk stage daily-episode-duration "${vars.work_dir}" "${vars.run_date}" "${vars.episode_min_minutes}" "${vars.episode_max_minutes}"
|
|
377
|
+
|
|
359
378
|
- id: quality-control
|
|
360
379
|
description: "Verify audio quality, speech rate, and silence/repetition QC metrics"
|
|
361
380
|
onEnter:
|
|
@@ -423,7 +442,7 @@ states:
|
|
|
423
442
|
kk stage daily-xhs-render "${vars.work_dir}" "${vars.run_date}" "${vars.plugins_path}" "${vars.xhs_cards}" "${vars.xhs_style}" "${vars.xhs_provider}" "${vars.xhs_model}"
|
|
424
443
|
|
|
425
444
|
- id: xhs-publish
|
|
426
|
-
description: "Publish the packaged card series to XHS — draft, or live only when xhs_live=true (ADR-022); independent and non-blocking: its outcome never enters publish_status. xhs-pub itself enforces a headless session preflight and a
|
|
445
|
+
description: "Publish the packaged card series to XHS — draft, or live only when xhs_live=true (ADR-022); independent and non-blocking: its outcome never enters publish_status. xhs-pub itself enforces a headless session preflight and a 2h publish/check cap (ADR-025), so a sessionless or capped run fails soft with a named reason and the run continues"
|
|
427
446
|
onEnter:
|
|
428
447
|
- kind: shell
|
|
429
448
|
onError: continue
|
|
@@ -715,8 +734,14 @@ transitions:
|
|
|
715
734
|
kind: always
|
|
716
735
|
|
|
717
736
|
- from: intro-music
|
|
737
|
+
to: episode-duration
|
|
738
|
+
description: "Intro merged -> gate final episode duration (15–20 min, standing requirement)"
|
|
739
|
+
guard:
|
|
740
|
+
kind: always
|
|
741
|
+
|
|
742
|
+
- from: episode-duration
|
|
718
743
|
to: quality-control
|
|
719
|
-
description: "
|
|
744
|
+
description: "Duration within window -> run quality control validation"
|
|
720
745
|
guard:
|
|
721
746
|
kind: always
|
|
722
747
|
|
|
@@ -503,27 +503,38 @@ transitions:
|
|
|
503
503
|
|
|
504
504
|
- from: judge
|
|
505
505
|
to: done
|
|
506
|
-
description: "Interactive mode, verdict PASS (or empty in dry-run), no publish targets -> complete workflow"
|
|
506
|
+
description: "Interactive mode, verdict PASS with a valid confidence (or empty in dry-run), no publish targets -> complete workflow"
|
|
507
507
|
guard:
|
|
508
508
|
kind: shell
|
|
509
509
|
options:
|
|
510
|
-
command:
|
|
510
|
+
command: >-
|
|
511
|
+
{ test "${vars.auto}" != "true"; } &&
|
|
512
|
+
{ v="$(jq -r 'if (.verdict // "") == "PASS" then (.verdict + (if ((.confidence // "") | test("^(HIGH|MEDIUM|LOW)$")) then "" else "!" end)) else (.verdict // "") end' ${vars.work_dir}/.itc-verdict.json 2>/dev/null)";
|
|
513
|
+
test -z "$v" -o "$v" = PASS; } &&
|
|
514
|
+
test -z "${vars.publish_targets}"
|
|
511
515
|
|
|
512
516
|
- from: judge
|
|
513
517
|
to: publish-entry
|
|
514
|
-
description: "Verdict PASS with targets set -> enter the publish tail (auto runs report after the tail)"
|
|
518
|
+
description: "Verdict PASS with a valid confidence and targets set -> enter the publish tail (auto runs report after the tail)"
|
|
515
519
|
guard:
|
|
516
520
|
kind: shell
|
|
517
521
|
options:
|
|
518
|
-
command:
|
|
522
|
+
command: >-
|
|
523
|
+
{ v="$(jq -r 'if (.verdict // "") == "PASS" then (.verdict + (if ((.confidence // "") | test("^(HIGH|MEDIUM|LOW)$")) then "" else "!" end)) else (.verdict // "") end' ${vars.work_dir}/.itc-verdict.json 2>/dev/null)";
|
|
524
|
+
test -z "$v" -o "$v" = PASS; } &&
|
|
525
|
+
test -n "${vars.publish_targets}"
|
|
519
526
|
|
|
520
527
|
- from: judge
|
|
521
528
|
to: report
|
|
522
|
-
description: "Auto mode -> the run ends in the report (PASS without targets, FAIL, or exhausted NEEDS_REVISION)"
|
|
529
|
+
description: "Auto mode -> the run ends in the report (valid PASS without targets, FAIL, or exhausted NEEDS_REVISION)"
|
|
523
530
|
guard:
|
|
524
531
|
kind: shell
|
|
525
532
|
options:
|
|
526
|
-
command:
|
|
533
|
+
command: >-
|
|
534
|
+
{ test "${vars.auto}" = "true"; } &&
|
|
535
|
+
{ v="$(jq -r 'if (.verdict // "") == "PASS" then (.verdict + (if ((.confidence // "") | test("^(HIGH|MEDIUM|LOW)$")) then "" else "!" end)) else (.verdict // "") end' ${vars.work_dir}/.itc-verdict.json 2>/dev/null)";
|
|
536
|
+
c="$(cat "${vars.work_dir}/.auto-revise-count" 2>/dev/null || echo 0)";
|
|
537
|
+
{ test -z "$v" -o "$v" = PASS; } || test "$v" = FAIL || { test "$v" = NEEDS_REVISION -a "$c" -ge "${vars.max_revisions}"; }; }
|
|
527
538
|
|
|
528
539
|
- from: judge
|
|
529
540
|
to: draft-autorevise
|
|
@@ -706,8 +717,10 @@ transitions:
|
|
|
706
717
|
|
|
707
718
|
- from: judge
|
|
708
719
|
to: failed
|
|
709
|
-
description: "Catch-all: an out-of-contract verdict string fails the run instead of deadlocking the machine (0149 review P3)"
|
|
720
|
+
description: "Catch-all: an out-of-contract verdict string fails the run instead of deadlocking the machine (0149 review P3); a PASS whose confidence is missing or outside HIGH/MEDIUM/LOW reads as `PASS!` and lands here"
|
|
710
721
|
guard:
|
|
711
722
|
kind: shell
|
|
712
723
|
options:
|
|
713
|
-
command:
|
|
724
|
+
command: >-
|
|
725
|
+
v="$(jq -r 'if (.verdict // "") == "PASS" then (.verdict + (if ((.confidence // "") | test("^(HIGH|MEDIUM|LOW)$")) then "" else "!" end)) else (.verdict // "") end' ${vars.work_dir}/.itc-verdict.json 2>/dev/null)";
|
|
726
|
+
test -n "$v" -a "$v" != PASS -a "$v" != FAIL -a "$v" != NEEDS_REVISION
|
|
@@ -30127,7 +30127,7 @@ init_dist();
|
|
|
30127
30127
|
import { homedir as homedir2 } from "os";
|
|
30128
30128
|
import { join as join2, resolve as resolve2 } from "path";
|
|
30129
30129
|
var fs = createNodeFileSystem();
|
|
30130
|
-
var CAP_WINDOW_MS =
|
|
30130
|
+
var CAP_WINDOW_MS = 2 * 60 * 60 * 1000;
|
|
30131
30131
|
var AUTOMATION_STATE_ENV = "KK_XHS_AUTOMATION_STATE";
|
|
30132
30132
|
function resolveAutomationStatePath(override) {
|
|
30133
30133
|
const explicit = override ?? process.env[AUTOMATION_STATE_ENV];
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* XHS warned the operator about automated login/publish activity. This channel is the only target
|
|
5
5
|
* in the repo that drives an interactive creator console from a browser, so a repeated or runaway
|
|
6
6
|
* visit is an account-level risk rather than a failed run. The guard bounds console visits with two
|
|
7
|
-
* independent
|
|
7
|
+
* independent 2h budgets — one headed publish cycle and one read-only session check — recorded in
|
|
8
8
|
* a small state file.
|
|
9
9
|
*
|
|
10
10
|
* Semantics that matter:
|
|
@@ -33,7 +33,7 @@ const fs = createNodeFileSystem() as unknown as {
|
|
|
33
33
|
export type XhsAutomationEvent = 'check' | 'publish';
|
|
34
34
|
|
|
35
35
|
/** One headed publish cycle and one read-only session check per window. */
|
|
36
|
-
export const CAP_WINDOW_MS =
|
|
36
|
+
export const CAP_WINDOW_MS = 2 * 60 * 60 * 1000;
|
|
37
37
|
|
|
38
38
|
/** State-file override for tests and multi-account machines; default is the shared kk config dir. */
|
|
39
39
|
export const AUTOMATION_STATE_ENV = 'KK_XHS_AUTOMATION_STATE';
|
|
@@ -480,7 +480,7 @@ export class XhsBrowserTransport implements PublishTransport {
|
|
|
480
480
|
submitSettleMs?: number;
|
|
481
481
|
submitAttempts?: number;
|
|
482
482
|
openPage?: OpenPage;
|
|
483
|
-
/** ADR-025 automation-risk guard; defaults to the real
|
|
483
|
+
/** ADR-025 automation-risk guard; defaults to the real 2h-capped state file. */
|
|
484
484
|
automation?: AutomationGuard;
|
|
485
485
|
/** ADR-025 headless session preflight; defaults to `checkXhsProfileSession`. */
|
|
486
486
|
preflight?: (profileDir: string) => Promise<ProfileSessionCheck>;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* fresh directory.
|
|
14
14
|
*
|
|
15
15
|
* ADR-025 (2026-09-28): the publish flow now runs this same check as a preflight before any headed
|
|
16
|
-
* visit, and `check` draws on the shared
|
|
16
|
+
* visit, and `check` draws on the shared 2h automation budget — the cap bounds total console
|
|
17
17
|
* visits, not just publishes. The implementation lives in `./index` so both paths share it.
|
|
18
18
|
*
|
|
19
19
|
* Manual dogfood: `bun plugins/publishings/xhs-pub/src/profile-check.ts login` then
|
|
@@ -110,7 +110,7 @@ export async function main(
|
|
|
110
110
|
);
|
|
111
111
|
return 1;
|
|
112
112
|
}
|
|
113
|
-
// ADR-025: a manual session check is a real console visit, so it draws on the shared
|
|
113
|
+
// ADR-025: a manual session check is a real console visit, so it draws on the shared 2h
|
|
114
114
|
// automation budget rather than a separate one. `login` is deliberately uncapped above: it is
|
|
115
115
|
// operator-interactive, so capping it would only block recovery from an expired session.
|
|
116
116
|
const cap = guard.allow('check');
|
package/plugins/sp/lib/env.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Vendored env gateway for the sp plugin.
|
|
3
|
-
*
|
|
4
|
-
* WHY this copy exists: hooks and scripts in this plugin are bundled
|
|
5
|
-
* standalone by `superskill install` on targets that have no node_modules —
|
|
6
|
-
* any `@gobing-ai/*` import fails to resolve there and aborts the install
|
|
7
|
-
* ("Bundle failed", task 0669). This file mirrors the semantics of the
|
|
8
|
-
* canonical gateway (`@gobing-ai/ts-utils` dist/env, ts-libs) so the plugin
|
|
9
|
-
* stays self-contained. Keep in sync when the upstream gateway changes.
|
|
10
|
-
*
|
|
11
|
-
* These accessors are node-bun only: on `cloudflare-workers` there is no
|
|
12
|
-
* `process`; inject config explicitly rather than calling them (ADR-008).
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Read one environment variable. Only an unset variable yields `fallback`;
|
|
17
|
-
* an empty string is a set value and is returned as-is.
|
|
18
|
-
*/
|
|
19
|
-
export function getEnvVar(name: string, fallback?: string): string | undefined {
|
|
20
|
-
const raw = process.env[name];
|
|
21
|
-
return raw === undefined ? fallback : raw;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Read the live environment as a record. The returned object IS `process.env`
|
|
26
|
-
* (not a copy): whole-record operations see later mutations, which child-spawn
|
|
27
|
-
* composition relies on. For single variables prefer {@link getEnvVar}.
|
|
28
|
-
*/
|
|
29
|
-
export function getEnvVars(): Record<string, string | undefined> {
|
|
30
|
-
return process.env;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Set one environment variable through the gateway. Passing `undefined` removes
|
|
35
|
-
* the key, so the save/restore idiom (`const prev = getEnvVar(k); …
|
|
36
|
-
* setEnvVar(k, prev)`) restores absence exactly.
|
|
37
|
-
*/
|
|
38
|
-
export function setEnvVar(name: string, value: string | undefined): void {
|
|
39
|
-
if (value === undefined) delete process.env[name];
|
|
40
|
-
else process.env[name] = value;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/** Remove one environment variable; a no-op when the key is absent. */
|
|
44
|
-
export function removeEnvVar(name: string): void {
|
|
45
|
-
delete process.env[name];
|
|
46
|
-
}
|