@gooseworks/staff-cli 0.1.4 → 0.1.6
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/goose-staff.mjs +501 -388
- package/package.json +3 -3
package/goose-staff.mjs
CHANGED
|
@@ -15920,6 +15920,7 @@ var init_staff_findings = __esmMin((() => {
|
|
|
15920
15920
|
undrafted: number$1().int().nonnegative().describe("Published findings no staff draft opened that this view lists beside its drafts, from listUndrafted: only for one brand's published or resolved drafts with no other filter, else 0. Not in counts, lanes or groups."),
|
|
15921
15921
|
groups: array(object({
|
|
15922
15922
|
key: string().nullable().describe("The brand id, the owner's user id, the tier as text or the label name. null for no owner or no label in the group."),
|
|
15923
|
+
name: string().nullable().describe("The brand's name or the owner's email, so a group shows before its rows load. null for priority, label and no-owner groups."),
|
|
15923
15924
|
count: number$1().int().nonnegative(),
|
|
15924
15925
|
money: queueMoney
|
|
15925
15926
|
})).describe("When group is brand, owner, priority or label: every group among the drafts the filters match, in the order rows come, with how many and their money. Empty when group is null or lane.")
|
|
@@ -16377,13 +16378,14 @@ var init_audit_staff = __esmMin((() => {
|
|
|
16377
16378
|
finishedAt: date$1().nullable(),
|
|
16378
16379
|
givenAt: date$1().nullable(),
|
|
16379
16380
|
archivedAt: date$1().nullable(),
|
|
16380
|
-
rerunAuditId: uuid().nullable().describe("The newer audit staff started to run this failed one again, or null.")
|
|
16381
|
+
rerunAuditId: uuid().nullable().describe("The newer audit staff started to run this failed one again, or null."),
|
|
16382
|
+
failedTries: count$3.describe("On a failed audit: the failed tries of the same site for the same organization that day, itself included. Lists show only the newest of them. 0 otherwise.")
|
|
16381
16383
|
});
|
|
16382
16384
|
auditTotals = object({
|
|
16383
16385
|
running: count$3,
|
|
16384
16386
|
ready: count$3,
|
|
16385
16387
|
toGive: count$3.describe("Finished staff-run audits nobody gave to a client yet."),
|
|
16386
|
-
failed: count$3.describe("Failed audits nobody ran again yet."),
|
|
16388
|
+
failed: count$3.describe("Failed audits nobody ran again yet. A site's failed tries on one day count once."),
|
|
16387
16389
|
ranAgain: count$3.describe("Failed audits staff already ran again."),
|
|
16388
16390
|
spentUsd: number$1().nonnegative()
|
|
16389
16391
|
}).describe("Across the list filtered by everything but stage. Only the first page carries them.");
|
|
@@ -17548,7 +17550,7 @@ var init_data_files = __esmMin((() => {
|
|
|
17548
17550
|
asOf: day$1.nullable(),
|
|
17549
17551
|
label: string().nullable(),
|
|
17550
17552
|
rowIs: string().nullable(),
|
|
17551
|
-
|
|
17553
|
+
sheets: array(dataFileSheet).describe("Each described sheet, in the file's order: its name, header row and columns, the names data_file_read takes. Empty when not described."),
|
|
17552
17554
|
isLabelChanged: boolean().describe("true when this file's label differs from the one before it in its folder, by days.")
|
|
17553
17555
|
});
|
|
17554
17556
|
dataFilesFound = object({
|
|
@@ -17701,6 +17703,7 @@ var init_wiki = __esmMin((() => {
|
|
|
17701
17703
|
summary: string(),
|
|
17702
17704
|
writerKind: wikiWriterKind,
|
|
17703
17705
|
writerLabel: string(),
|
|
17706
|
+
writerName: string().nullable().describe("The staffer whose AI app saved this version, or who restored it. null for refresh runs, audits and deleted accounts."),
|
|
17704
17707
|
createdAt: datetime(),
|
|
17705
17708
|
sizeBytes: number$1().int().min(1),
|
|
17706
17709
|
isFromPublicPagesOnly: boolean(),
|
|
@@ -18840,7 +18843,7 @@ var init_staff_watch = __esmMin((() => {
|
|
|
18840
18843
|
"done",
|
|
18841
18844
|
"partial",
|
|
18842
18845
|
"failed"
|
|
18843
|
-
]).describe("How the run went, the same on every staff screen and Slack alert. running and failed follow its status. done: it finished with nothing for staff to fix. partial: it finished, but a check failed or couldn't run because a tool is signed out
|
|
18846
|
+
]).describe("How the run went, the same on every staff screen and Slack alert. running and failed follow its status. done: it finished with nothing for staff to fix. partial: it finished, but a check failed or couldn't run because a tool is signed out or the page browser didn't start. Ordinary skips (not_due, audit_only, not_applicable) and standing gaps (not_connected, missing_permission, no_read_guide, no_live_read, needs_number, data_behind) leave it done: the Accounts and All checks pages show those.");
|
|
18844
18847
|
watchDayStates = [
|
|
18845
18848
|
"failed",
|
|
18846
18849
|
"missed",
|
|
@@ -19047,7 +19050,7 @@ var init_staff_watch = __esmMin((() => {
|
|
|
19047
19050
|
reason: string().min(1).max(2e3).describe("Why the verdict, or what ruled it out."),
|
|
19048
19051
|
scores: watchScores.nullable().describe("The checker's three scores. null only for looks_fixed and muted, required otherwise."),
|
|
19049
19052
|
ruledOut: array(measureText.max(500)).max(20).describe("Each other explanation the checker tested and what ruled it out, one line each. Empty when no checker judged it."),
|
|
19050
|
-
proof: array(watchMeasure).max(20).describe("The numbers that show it: the reader's for the hit, then the checker's reruns. At least one on every flag with isMatched false."),
|
|
19053
|
+
proof: array(watchMeasure).max(20).describe("The numbers that show it: the reader's for the hit, then the checker's reruns. A rerun that reads the same as an earlier measure is saved once. At least one on every flag with isMatched false."),
|
|
19051
19054
|
keyNumberBreak: watchKeyNumberBreak.nullable().describe("The break, on a key number check's own topic flag, muted included. null on every other flag."),
|
|
19052
19055
|
isMatched: boolean().describe("true when the flag links an open draft or finding found before this check, false when this check made the draft."),
|
|
19053
19056
|
draftId: uuid().nullable().describe("The draft it made or matched, from finding_draft_save or findings_list."),
|
|
@@ -19669,6 +19672,7 @@ var init_account_maps = __esmMin((() => {
|
|
|
19669
19672
|
kind: _enum(["list", "segment"]),
|
|
19670
19673
|
link: mapLink
|
|
19671
19674
|
});
|
|
19675
|
+
`${String(100)}`;
|
|
19672
19676
|
emailMap = object({
|
|
19673
19677
|
kind: literal("email"),
|
|
19674
19678
|
platform: literal("klaviyo"),
|
|
@@ -19825,10 +19829,11 @@ var init_account_maps = __esmMin((() => {
|
|
|
19825
19829
|
"waiting",
|
|
19826
19830
|
"missing_permission",
|
|
19827
19831
|
"reads_failed",
|
|
19828
|
-
"
|
|
19829
|
-
"
|
|
19832
|
+
"not_checked",
|
|
19833
|
+
"not_read",
|
|
19834
|
+
"working"
|
|
19830
19835
|
];
|
|
19831
|
-
accountHealth = _enum(accountHealths).describe("How the account stands now. signed_out: Goose can't sign in to it. waiting: a Windsor connection waits for the brand to press Finish on Windsor's page. missing_permission: the sign-in or the daily checks lack access. reads_failed: every daily check that read it failed.
|
|
19836
|
+
accountHealth = _enum(accountHealths).describe("How the account stands now. signed_out: Goose can't sign in to it. waiting: a Windsor connection waits for the brand to press Finish on Windsor's page. missing_permission: the sign-in or the daily checks lack access. reads_failed: every daily check that read it failed. not_checked: daily checks cover it, but none read it last time. not_read: Goose has nothing read from it, because no daily check read it last time and its map has no saved read, or it has no map and no daily check reads it. working: daily checks read it last time, or its map has a saved read.");
|
|
19832
19837
|
checkCauses = [
|
|
19833
19838
|
"signed_out",
|
|
19834
19839
|
"missing_permission",
|
|
@@ -19845,7 +19850,7 @@ var init_account_maps = __esmMin((() => {
|
|
|
19845
19850
|
runDay: date().describe("The day of the run that checked it last."),
|
|
19846
19851
|
reason: string(),
|
|
19847
19852
|
permission: string().nullable().describe("The permission it lacked, for missing_permission."),
|
|
19848
|
-
accounts: array(accountKey).describe("The brand's accounts it read
|
|
19853
|
+
accounts: array(accountKey).describe("The brand's accounts it read: the vendors the check named, or the watch list's vendors for it when it failed before naming any. Empty when it read no connected account, so it shows only under the brand.")
|
|
19849
19854
|
});
|
|
19850
19855
|
stoppedChecks = array(object({
|
|
19851
19856
|
cause: checkCause,
|
|
@@ -19869,11 +19874,11 @@ var init_account_maps = __esmMin((() => {
|
|
|
19869
19874
|
latest: mapLatest.nullable()
|
|
19870
19875
|
}).nullable().describe("The account's map, with its newest saved read or null when it's not read yet. null when Goose keeps no map for it: it reads the account live only, in daily checks, or a Meta ad account has no live sign-in."),
|
|
19871
19876
|
health: accountHealth.describe("How the account stands now."),
|
|
19872
|
-
toFix: accountProblem.nullable().describe("
|
|
19877
|
+
toFix: accountProblem.nullable().describe("The saved sign-in problem the AI app's count and the brand's Home count read: signed_out or missing_permission. null when there is none. Staff count accounts to fix from health instead, with isAccountToFix."),
|
|
19873
19878
|
checkedAt: date$1().nullable().describe("When Goose last checked the account through its saved sign-in: a connect, a check, or a read that worked or was refused as signed out. A read moves it only once it's over 5 minutes old. The brand's Integrations page shows the same time. null for a Meta ad account Goose hasn't read since it began keeping this time."),
|
|
19874
|
-
saved: savedDays.nullable().describe("What Goose saved from it before syncing stopped. null when it never synced."),
|
|
19875
|
-
checks: stoppedChecks.describe("The daily checks that read this account
|
|
19876
|
-
looks: array(mapLook).describe("Connection problems: signed out, Finish on Windsor, missing a permission, off in Meta
|
|
19879
|
+
saved: savedDays.nullable().describe("What Goose saved from it before syncing stopped. null when it never synced, or Goose never read it: its map has no saved read, or it has no map and no daily check read it."),
|
|
19880
|
+
checks: stoppedChecks.describe("The daily checks that read this account and stopped."),
|
|
19881
|
+
looks: array(mapLook).describe("Connection problems: signed out, Finish on Windsor, missing a permission, off in Meta."),
|
|
19877
19882
|
quiet: array(mapQuiet).describe("The account's own stopped daily checks, one line per cause."),
|
|
19878
19883
|
lookCount: object({
|
|
19879
19884
|
red: int().min(0),
|
|
@@ -19979,8 +19984,7 @@ var init_brand_console = __esmMin((() => {
|
|
|
19979
19984
|
brandConsoleColumns = [
|
|
19980
19985
|
"name",
|
|
19981
19986
|
"atStake",
|
|
19982
|
-
"open"
|
|
19983
|
-
"drafts"
|
|
19987
|
+
"open"
|
|
19984
19988
|
];
|
|
19985
19989
|
brandConsoleColumnSort = listSort(brandConsoleColumns).describe("The grid column to rank every brand by. It wins over sort when set; null ranks by sort.");
|
|
19986
19990
|
brandConsoleScope = _enum(["all", "mine"]).describe("mine keeps the brands whose daily watch the caller owns.");
|
|
@@ -19989,7 +19993,7 @@ var init_brand_console = __esmMin((() => {
|
|
|
19989
19993
|
"accounts",
|
|
19990
19994
|
"watch",
|
|
19991
19995
|
"setup"
|
|
19992
|
-
]).describe("What a brand waits on a person for. drafts: drafts wait for review. accounts: a connected account
|
|
19996
|
+
]).describe("What a brand waits on a person for. drafts: drafts wait for review. accounts: a connected account must be connected again or finished on Windsor. watch: its newest watch day, skipping today while it's waiting, failed or was missed. setup: setup isn't finished.");
|
|
19993
19997
|
watchWeek = object({
|
|
19994
19998
|
isOn: boolean().describe("True when both the brand's own watch and the daily watch for every brand are on."),
|
|
19995
19999
|
days: array(object({
|
|
@@ -20351,7 +20355,7 @@ var init_staff = __esmMin((() => {
|
|
|
20351
20355
|
surfaces: array(usageSurface).describe("Where they used Goose that day. Empty on a day unused."),
|
|
20352
20356
|
aiApps: array(usageAiApp).describe("The AI apps they used Goose from that day.")
|
|
20353
20357
|
});
|
|
20354
|
-
useDays = array(useDay).
|
|
20358
|
+
useDays = array(useDay).min(1).max(30).describe("The last 30 days in US Eastern time, oldest first and today last. Fewer when Goose began saving use less than 30 days ago.");
|
|
20355
20359
|
connectedAiApp = object({
|
|
20356
20360
|
id: string(),
|
|
20357
20361
|
app: _enum(AI_APP_IDS).nullable().describe("The checked AI app, or null when Goose can't tell."),
|
|
@@ -20378,13 +20382,13 @@ var init_staff = __esmMin((() => {
|
|
|
20378
20382
|
days: array(object({
|
|
20379
20383
|
day: date(),
|
|
20380
20384
|
personCount: number$1().int().nonnegative()
|
|
20381
|
-
})).
|
|
20385
|
+
})).min(1).max(30).describe("Members using Goose each day of the same days as a person's use, oldest first and today last."),
|
|
20382
20386
|
people: array(object({
|
|
20383
20387
|
userId: uuid(),
|
|
20384
20388
|
dayCount: number$1().int().min(1).max(30),
|
|
20385
20389
|
surfaces: array(usageSurface),
|
|
20386
20390
|
aiApps: array(usageAiApp)
|
|
20387
|
-
})).describe("Members who used Goose
|
|
20391
|
+
})).describe("Members who used Goose on those days. A member missing here used it on none.")
|
|
20388
20392
|
});
|
|
20389
20393
|
brandFields = {
|
|
20390
20394
|
id: uuid(),
|
|
@@ -20443,7 +20447,7 @@ var init_staff = __esmMin((() => {
|
|
|
20443
20447
|
draftsReady: number$1().int().nonnegative().describe("Waiting drafts in the Findings page's Ready to publish lane."),
|
|
20444
20448
|
draftsAtStake: monthlyAtStake,
|
|
20445
20449
|
oldestDraftAt: date$1().nullable().describe("When staff last touched the longest-waiting draft. null with no drafts waiting."),
|
|
20446
|
-
accountsToFix: number$1().int().nonnegative().describe("Connected accounts to fix, each Meta ad account on its own: signed out,
|
|
20450
|
+
accountsToFix: number$1().int().nonnegative().describe("Connected accounts to fix, each Meta ad account on its own: signed out, missing a permission Goose needs, or a data account waiting for the brand to press Finish on Windsor. Someone must connect or finish each. The brand's Accounts page To fix tab lists the same accounts."),
|
|
20447
20451
|
watch: watchWeek,
|
|
20448
20452
|
needs: array(brandNeed).describe("What the brand waits on a person for, most pressing first.")
|
|
20449
20453
|
});
|
|
@@ -20505,7 +20509,10 @@ var init_staff = __esmMin((() => {
|
|
|
20505
20509
|
cancelRequestedAt: date$1().nullable(),
|
|
20506
20510
|
stuck: stuckJobStage.nullable().describe("How the job is stuck, or null while it isn't.")
|
|
20507
20511
|
});
|
|
20508
|
-
jobWithTeam = staffJob.extend({
|
|
20512
|
+
jobWithTeam = staffJob.extend({
|
|
20513
|
+
team: teamLabel.extend({ brands: teamBrandsSchema }),
|
|
20514
|
+
brandName: string().nullable().describe("The brand the work was for. null for work with no brand, or a deleted brand.")
|
|
20515
|
+
});
|
|
20509
20516
|
jobFilterInput = {
|
|
20510
20517
|
brandId: uuid().nullable(),
|
|
20511
20518
|
kind: jobKind.nullable()
|
|
@@ -20535,7 +20542,7 @@ var init_staff = __esmMin((() => {
|
|
|
20535
20542
|
failureCount: number$1().int().positive(),
|
|
20536
20543
|
runs: array(staffJob).min(1).max(20).describe("The group's newest failed runs, newest first. The first is the row itself."),
|
|
20537
20544
|
...retryFacts
|
|
20538
|
-
}).describe("Failed runs of the same work, shown as their newest failed run. The same work is one organization and brand's video read of one video, site read of the brand,
|
|
20545
|
+
}).describe("Failed runs of the same work, shown as their newest failed run. The same work is one organization and brand's video read of one video, site read of the brand, competitor read of one competitor with the same question and page count, or check of one page, whatever its version. Every other run is its own work.");
|
|
20539
20546
|
deletingTeam = object({
|
|
20540
20547
|
id: uuid(),
|
|
20541
20548
|
name: string(),
|
|
@@ -20746,7 +20753,7 @@ function waitingList(item) {
|
|
|
20746
20753
|
totalCount: count$1.describe("How many wait in all.")
|
|
20747
20754
|
});
|
|
20748
20755
|
}
|
|
20749
|
-
var fixCheckRules, fixCheckLimits, count$1, fixCheckPerson, fixCheckMode, fixCheckRunStatus, fixCheckRunFailure, fixCheckVerdict$1, fixCheckJob, fixCheckEffect, fixCheckSaleKind, fixCheckFixDaySource, fixCheckCounts, fixCheckRunSummary, fixCheckRunNotesInput, fixCheckRunRecord, timerOwnerPerson, fixCheckTimerOwner, fixCheckSetup, fixCheckWeekInput, fixCheckWeek, fixCheckCreditInput, fixCheckFixDay, fixCheckLookFields, neededLookParts, lookParts, lookNeeds, lookAsks$1, fixCheckLookInput, fixCheckReadInput, fixCheckLook, fixCheckLastLook, fixCheckMeasuring, fixCheckReturningDraft, fixCheckWatchHit, fixCheckFacts, fixCheckListItem, fixCheckFinding, fixCheckSavedLook, waitingFindingId, waitingTitle, fixCheckListedLook, waitingLook, fixCheckClose, fixCheckWaiting, fixCheckMoneyBack, fixCheckWeekState;
|
|
20756
|
+
var fixCheckRules, fixCheckLimits, count$1, fixCheckPerson, fixCheckMode, fixCheckRunStatus, fixCheckRunFailure, fixCheckVerdict$1, fixCheckJob, fixCheckEffect, fixCheckSaleKind, fixCheckFixDaySource, fixCheckCounts, fixCheckRunSummary, fixCheckRunNotesInput, fixCheckRunRecord, timerOwnerPerson, fixCheckTimerOwner, fixCheckSetup, fixCheckWeekInput, fixCheckWeek, fixCheckCreditInput, fixCheckFixDay, fixCheckLookFields, neededLookParts, lookParts, lookNeeds, lookAsks$1, fixCheckLookInput, fixCheckReadInput, fixCheckLook, fixCheckLastLook, fixCheckMeasuring, fixCheckReturningDraft, fixCheckWatchHit, fixCheckFacts, fixCheckListItem, fixCheckFinding, fixCheckSavedLook, waitingFindingId, waitingTitle, waitingLookNote, fixCheckListedLook, waitingLook, fixCheckClose, fixCheckWaiting, fixCheckMoneyBack, fixCheckWeekState;
|
|
20750
20757
|
var init_staff_fix_check = __esmMin((() => {
|
|
20751
20758
|
init_zod();
|
|
20752
20759
|
init_finding_checks();
|
|
@@ -21123,19 +21130,23 @@ var init_staff_fix_check = __esmMin((() => {
|
|
|
21123
21130
|
waitingFindingId = uuid().describe("The finding's id.");
|
|
21124
21131
|
waitingTitle = string().describe("The finding's title.");
|
|
21125
21132
|
fixCheckVerdict$1.extract([
|
|
21133
|
+
"still_open",
|
|
21126
21134
|
"partly_fixed",
|
|
21127
21135
|
"fix_seen",
|
|
21128
21136
|
"brand_decided",
|
|
21137
|
+
"fixed",
|
|
21138
|
+
"fix_held",
|
|
21129
21139
|
"cant_check"
|
|
21130
21140
|
]);
|
|
21141
|
+
waitingLookNote = string().describe("What isn't fixed yet, the week that will prove it, the brand's words, or why it couldn't be read, as the verdict has it.");
|
|
21131
21142
|
fixCheckListedLook = object({
|
|
21132
21143
|
findingId: waitingFindingId,
|
|
21133
21144
|
title: waitingTitle,
|
|
21134
21145
|
runWeek: date().describe("The run's week, its Monday in New York time."),
|
|
21135
|
-
proof: string().nullable().describe("What the look saw fixed or clean. null on brand_decided and cant_check."),
|
|
21136
|
-
note:
|
|
21146
|
+
proof: string().nullable().describe("What the look saw fixed or clean. null on still_open, brand_decided and cant_check."),
|
|
21147
|
+
note: waitingLookNote.nullable().describe("What isn't fixed yet, the week that will prove it, the brand's words, or why it couldn't be read, as the verdict has it. null on still_open, fixed and fix_held.")
|
|
21137
21148
|
});
|
|
21138
|
-
waitingLook = waitingList(fixCheckListedLook);
|
|
21149
|
+
waitingLook = waitingList(fixCheckListedLook.extend({ note: waitingLookNote }));
|
|
21139
21150
|
fixCheckClose = object({
|
|
21140
21151
|
findingId: waitingFindingId,
|
|
21141
21152
|
title: waitingTitle,
|
|
@@ -21265,7 +21276,8 @@ var init_staff_reports = __esmMin((() => {
|
|
|
21265
21276
|
reportBrand = object({
|
|
21266
21277
|
teamId: uuid(),
|
|
21267
21278
|
teamName: string(),
|
|
21268
|
-
brandName: string()
|
|
21279
|
+
brandName: string(),
|
|
21280
|
+
brandTimeZone: string().describe("The brand's time zone. Staff screens show the report's times in it.")
|
|
21269
21281
|
});
|
|
21270
21282
|
reportBody = object({
|
|
21271
21283
|
bodyMd: string().describe("The report in Markdown, or the page's words for an html report."),
|
|
@@ -21797,7 +21809,7 @@ var init_staff_agent = __esmMin((() => {
|
|
|
21797
21809
|
});
|
|
21798
21810
|
staffAgentContract = { staffAgent: {
|
|
21799
21811
|
findBrands: staffRead().input(object({
|
|
21800
|
-
search: string().trim().min(1).max(200).describe("
|
|
21812
|
+
search: string().trim().min(1).max(200).describe("A brand's id, or words that each match the start of a word in the brand's name or slug."),
|
|
21801
21813
|
cursor: encodedCursor.nullable(),
|
|
21802
21814
|
limit: number$1().int().min(1).max(staffBrandLimit)
|
|
21803
21815
|
})).output(object({
|
|
@@ -22214,8 +22226,8 @@ var init_staff_agent = __esmMin((() => {
|
|
|
22214
22226
|
getDataFileLinks: staffRead().input(brandInput.extend({ fileIds: array(uuid()).min(1).max(dataFileLinkLimit).refine(hasEachOnce, "Name each file once.").describe(`The files to download, by the fileId data_files_find gives each, at most ${dataFileLinkLimit}.`) })).output(object({ links: array(dataFileLink).describe("One download link per file. Each works for 1 hour for anyone holding it, so never share or print it.") })),
|
|
22215
22227
|
readDataFileTable: staffRead().input(brandInput.extend({
|
|
22216
22228
|
fileId: uuid().describe("The file, by the fileId data_files_find gives it."),
|
|
22217
|
-
sheet: string().min(1).nullable().describe("The sheet, by
|
|
22218
|
-
columns: array(string().min(1)).min(1).max(50).refine(hasEachOnce, "Name each column once.").describe(`The columns to read, by the names
|
|
22229
|
+
sheet: string().min(1).nullable().describe("The sheet, by a name in the file's sheets from data_files_find. null for the first one."),
|
|
22230
|
+
columns: array(string().min(1)).min(1).max(50).refine(hasEachOnce, "Name each column once.").describe(`The columns to read, by the names data_files_find lists for that sheet, at most 50. A column with isCustomerDetail true is refused.`)
|
|
22219
22231
|
})).output(dataFileTable.describe(`The asked columns of every row under the sheet's header, at most ${dataFileTableRowLimit.toLocaleString("en-US")} rows.`)),
|
|
22220
22232
|
createDataFolder: staffChange().input(brandInput.extend({
|
|
22221
22233
|
name: dataFolderInput.shape.name.describe("The folder's name, like Ulta weekly sales. Each folder in a brand has its own name, capitals ignored."),
|
|
@@ -22619,7 +22631,7 @@ var init_read_tools = __esmMin((() => {
|
|
|
22619
22631
|
brandsFind = defineTool({
|
|
22620
22632
|
name: "brands_find",
|
|
22621
22633
|
title: "Find brands",
|
|
22622
|
-
description: "Find customer brands by the start of
|
|
22634
|
+
description: "Find customer brands by their id, or by words: each typed word must match the start of a word in the brand's name or slug, so 'blue co' finds Blue Bottle Coffee. Each brand comes with its organization. Use it first to get the brandId every other tool takes. Pass cursor null, then the answer's nextCursor for more.",
|
|
22623
22635
|
effect: "read",
|
|
22624
22636
|
input: getCallInput(calls$5.findBrands),
|
|
22625
22637
|
run: (backend, input) => backend.findBrands(input)
|
|
@@ -22685,7 +22697,7 @@ Use the provider's normal paths, with the ids brand_get lists:
|
|
|
22685
22697
|
- onetext: GET /api/.... POST /api/reports/....
|
|
22686
22698
|
- amazon_seller: GET any Selling Partner path. POST reports, Data Kiosk queries, pricing, fees, replenishment and shipping-rate reads.
|
|
22687
22699
|
- tiktok_windsor: GET /tiktok/fields for the public field catalogue, without query parameters. GET /tiktok for Windsor report rows, not native TikTok API responses. Set fields as comma-separated public field IDs including source and account_id; add campaign_id/campaign, ad_group_id/ad_group_name or ad_id/ad_name, plus spend, impressions, clicks, conversions or results. Use date_from and date_to (YYYY-MM-DD) or date_preset, and _max_rows from 1 to 5000. Optional filter is a Windsor JSON array such as [["campaign_id","eq","123"]]. Goose fixes the company key, saved advertiser IDs and JSON renderer, and checks each returned row. Other parameters and paths, including /all, /options, native paths, exports and async jobs, are refused. Reports may be cached; data_fetched_at is the upstream fetch-start time and selecting it disables Windsor aggregation. Conversion/results describe the campaign objective, not necessarily purchases. _max_rows caps the result; it is not a cursor.
|
|
22688
|
-
- tiktok_shop_windsor: GET /tiktok_shop/fields for the public field catalogue, without query parameters. GET /tiktok_shop for TikTok Shop report rows. Set fields as comma-separated public field IDs including source and account_id, like date, shop_performance_gmv_amount, shop_performance_orders and shop_performance_buyers. Use date_from and date_to (YYYY-MM-DD) or date_preset, _max_rows from 1 to 5000, and an optional Windsor JSON filter. Other paths and parameters are refused.
|
|
22700
|
+
- tiktok_shop_windsor: GET /tiktok_shop/fields for the public field catalogue, without query parameters. GET /tiktok_shop for TikTok Shop report rows. Set fields as comma-separated public field IDs including source and account_id, like date, shop_performance_gmv_amount, shop_performance_orders and shop_performance_buyers. Use date_from and date_to (YYYY-MM-DD) or date_preset, _max_rows from 1 to 5000, and an optional Windsor JSON filter. Longer reads often time out: keep each read to 31 days or less, splitting a longer range into several such reads, and read any statement_transaction_order_transaction_sku_transactions_* field over 7 days or less. Other paths and parameters are refused.
|
|
22689
22701
|
- amazon_ads_windsor: GET /amazon_ads/fields for public field discovery without query parameters; GET /amazon_ads for Amazon Ads report rows. Include source and account_id in fields. Use current public field IDs, such as sponsored_products_campaign__spend, sponsored_products_campaign__impressions and sponsored_products_campaign__clicks with date and sponsored_products_campaign__campaignid. Discover fields before selecting other ad products; unprefixed spend, impressions and clicks are not in the current field catalogue. Use date_from/date_to or date_preset, _max_rows 1–5000 and optional documented JSON filter. Goose fixes the company key, saved Amazon Ads account IDs and JSON renderer and checks every returned row. Amazon Selling Partner paths, account options, writes, exports, async jobs and other sources are refused. Reports may be cached. Background syncing is off.
|
|
22690
22702
|
- amazon_windsor: GET /amazon_sp with fields, dates and every other read parameter, and /amazon_sp/fields for field names. Goose fills in the key and the brand's accounts.
|
|
22691
22703
|
Windsor builds a report it hasn't stored yet from Amazon, Amazon Ads or TikTok itself, which can take minutes, and serves it in a second or two once built. Reuse one set of fields, dates and filter across your questions, since each new set starts a new build, and don't send the same read twice at once. When Goose says Windsor is still building, do other reads and ask again about 2 minutes later with exactly the same path and query.`,
|
|
@@ -22856,7 +22868,7 @@ Windsor builds a report it hasn't stored yet from Amazon, Amazon Ads or TikTok i
|
|
|
22856
22868
|
dataFileRead = defineTool({
|
|
22857
22869
|
name: "data_file_read",
|
|
22858
22870
|
title: "Read a data file's rows",
|
|
22859
|
-
description: "Read the columns you name from every row of one data file's sheet, by the fileId
|
|
22871
|
+
description: "Read the columns you name from every row of one data file's sheet, by the fileId, sheet name and column names data_files_find lists in the file's sheets. A workbook can hold several sheets, like sales on one and stock on another. Each row carries its row number, isTotal for a total or subtotal row, and each cell as the file stores it, null when empty: an Excel percent shown as 20% comes as 0.2, and a number shown with leading zeros loses them. Name only the columns your numbers need. A column with isCustomerDetail true is refused. The CLI saves the rows to a file and prints only its path and row count: count them with jq, drop isTotal rows before adding, clean money and percent text, and never print rows. A file over 20,000 rows is refused: download it instead. Use it where no script can run, like a daily watch or fix check run.",
|
|
22860
22872
|
effect: "read",
|
|
22861
22873
|
input: getCallInput(calls$5.readDataFileTable),
|
|
22862
22874
|
run: (backend, input) => backend.readDataFileTable(input)
|
|
@@ -25761,7 +25773,7 @@ function readTexts(source, field) {
|
|
|
25761
25773
|
return item;
|
|
25762
25774
|
});
|
|
25763
25775
|
}
|
|
25764
|
-
function listRepeated
|
|
25776
|
+
function listRepeated(values) {
|
|
25765
25777
|
return [...new Set(values.filter((value, index) => values.indexOf(value) !== index))];
|
|
25766
25778
|
}
|
|
25767
25779
|
function toCanonical(value) {
|
|
@@ -25870,7 +25882,7 @@ function checkList(file, schema, value, path) {
|
|
|
25870
25882
|
if (items === void 0) return problems;
|
|
25871
25883
|
return [...problems, ...value.flatMap((item, index) => checkValue(file, items, item, `${path}[${index}]`))];
|
|
25872
25884
|
}
|
|
25873
|
-
function checkFields(file, schema, value, path) {
|
|
25885
|
+
function checkFields$1(file, schema, value, path) {
|
|
25874
25886
|
const fields = Object.keys(value);
|
|
25875
25887
|
const { names, others, minProperties } = schema;
|
|
25876
25888
|
const missing = schema.required.filter((field) => !(field in value)).map((field) => `${path}.${field} is missing.`);
|
|
@@ -25899,7 +25911,7 @@ function checkValue(file, given, value, path) {
|
|
|
25899
25911
|
if (typeof value === "string") problems.push(...checkText(schema, value, path));
|
|
25900
25912
|
if (typeof value === "number") problems.push(...checkNumber(schema, value, path));
|
|
25901
25913
|
if (Array.isArray(value)) problems.push(...checkList(file, schema, value, path));
|
|
25902
|
-
if (isFields$1(value)) problems.push(...checkFields(file, schema, value, path));
|
|
25914
|
+
if (isFields$1(value)) problems.push(...checkFields$1(file, schema, value, path));
|
|
25903
25915
|
return problems;
|
|
25904
25916
|
}
|
|
25905
25917
|
function checkAgainstSchema(schemaPath, value, name) {
|
|
@@ -26017,7 +26029,7 @@ function readClause(value, group) {
|
|
|
26017
26029
|
function readStoreInputs(path, schemaFile, answerIds) {
|
|
26018
26030
|
const file = resolve(path);
|
|
26019
26031
|
const value = readJson$1(file);
|
|
26020
|
-
const problems = checkAgainstSchema(join(harnessFolder$
|
|
26032
|
+
const problems = checkAgainstSchema(join(harnessFolder$3, "schema", schemaFile), value, "inputs");
|
|
26021
26033
|
if (problems.length > 0) throw new Error(`${file} isn't right:\n${problems.join("\n")}`);
|
|
26022
26034
|
const window = readField(value, "window");
|
|
26023
26035
|
const sources = readField(value, "orderSources");
|
|
@@ -26249,7 +26261,7 @@ function writeTable(folder, name, columns, rows) {
|
|
|
26249
26261
|
columns
|
|
26250
26262
|
};
|
|
26251
26263
|
}
|
|
26252
|
-
var ruledGroups, sourceGroups, clauseFields, netSalesFields, leftOutFields, leftOutBeforeWindow, paidStatuses, orderDefinitions, harnessFolder$
|
|
26264
|
+
var ruledGroups, sourceGroups, clauseFields, netSalesFields, leftOutFields, leftOutBeforeWindow, paidStatuses, orderDefinitions, harnessFolder$3, dayLength$1;
|
|
26253
26265
|
var init_store_orders = __esmMin((() => {
|
|
26254
26266
|
init_json_schema();
|
|
26255
26267
|
init_stack();
|
|
@@ -26296,7 +26308,7 @@ var init_store_orders = __esmMin((() => {
|
|
|
26296
26308
|
netSales: "Subtotal after discounts, without tax and shipping, less what was refunded for the goods, never below zero for an order. A refund's shipping (totalRefundedShippingSet) and its tax (totalTaxSet less currentTotalTaxSet) are no part of what was refunded for the goods. Where the store's prices include tax (taxesIncluded), the tax still on the goods comes off as well: currentTotalTaxSet less the shipping line's tax that wasn't refunded. A refunded tip or duty counts as a refund of goods.",
|
|
26297
26309
|
sourceGroups: "Each first order falls in the first group whose rule it matches, in the order tagged, meta_other, other_paid, email_sms, search, direct; then no_visit when the order has no first-visit record, else other."
|
|
26298
26310
|
};
|
|
26299
|
-
harnessFolder$
|
|
26311
|
+
harnessFolder$3 = fromHarness();
|
|
26300
26312
|
dayLength$1 = 864e5;
|
|
26301
26313
|
}));
|
|
26302
26314
|
// src/harness/customer-tables-shape.ts
|
|
@@ -26574,7 +26586,7 @@ function checkFile(fileName) {
|
|
|
26574
26586
|
};
|
|
26575
26587
|
const path = join(callsFolder$1, fileName);
|
|
26576
26588
|
const value = readJson$1(path);
|
|
26577
|
-
const schemaProblems = checkAgainstSchema(schemaFile$
|
|
26589
|
+
const schemaProblems = checkAgainstSchema(schemaFile$3, value, fileName);
|
|
26578
26590
|
if (schemaProblems.length > 0) return {
|
|
26579
26591
|
calls: [],
|
|
26580
26592
|
refused: [],
|
|
@@ -26609,15 +26621,15 @@ function run$23() {
|
|
|
26609
26621
|
if (problems.length > 0) throw new Error(`The call library in catalog/calls has problems:\n${problems.join("\n")}`);
|
|
26610
26622
|
console.log(`The call library holds ${String(calls.length)} calls and ${String(refused.length)} refused ones across ${String(files.length)} providers, each on its schema with no brand's own ids.`);
|
|
26611
26623
|
}
|
|
26612
|
-
var harnessFolder$
|
|
26624
|
+
var harnessFolder$2, callsFolder$1, schemaFile$3, providers, longNumber;
|
|
26613
26625
|
var init_check_calls = __esmMin((() => {
|
|
26614
26626
|
init_json_schema();
|
|
26615
26627
|
init_customer_tables_shape();
|
|
26616
26628
|
init_meta_tables_shape();
|
|
26617
26629
|
init_stack();
|
|
26618
|
-
harnessFolder$
|
|
26619
|
-
callsFolder$1 = join(harnessFolder$
|
|
26620
|
-
schemaFile$
|
|
26630
|
+
harnessFolder$2 = fromHarness();
|
|
26631
|
+
callsFolder$1 = join(harnessFolder$2, "catalog", "calls");
|
|
26632
|
+
schemaFile$3 = join(harnessFolder$2, "schema", "calls.schema.json");
|
|
26621
26633
|
providers = /* @__PURE__ */ new Map([
|
|
26622
26634
|
["meta", "meta"],
|
|
26623
26635
|
["shopify", "shopify"],
|
|
@@ -26631,10 +26643,10 @@ var init_check_calls = __esmMin((() => {
|
|
|
26631
26643
|
// src/harness/check-generators.ts
|
|
26632
26644
|
var check_generators_exports = /* @__PURE__ */ __exportAll({ run: () => run$22 });
|
|
26633
26645
|
function run$22() {
|
|
26634
|
-
const files = readdirSync(join(harnessFolder$
|
|
26646
|
+
const files = readdirSync(join(harnessFolder$1, "catalog", "generators")).filter((name) => name.endsWith(".md")).map((name) => basename(name, ".md"));
|
|
26635
26647
|
const current = generatorNames;
|
|
26636
26648
|
const retired = retiredGeneratorNames;
|
|
26637
|
-
const direction = readJson$1(join(harnessFolder$
|
|
26649
|
+
const direction = readJson$1(join(harnessFolder$1, "schema", "direction.schema.json"));
|
|
26638
26650
|
const unknownModes = readList$1([
|
|
26639
26651
|
"$defs",
|
|
26640
26652
|
"direction",
|
|
@@ -26655,12 +26667,12 @@ function run$22() {
|
|
|
26655
26667
|
if (problems.length > 0) throw new Error(`The harness's ways of hunting no longer match @gooseworks/contract/finding-generators:\n${problems.join("\n")}`);
|
|
26656
26668
|
console.log(`The contract names all ${String(files.length)} generators, ${String(retired.length)} retired, and every origin mode the Scout writes.`);
|
|
26657
26669
|
}
|
|
26658
|
-
var harnessFolder$
|
|
26670
|
+
var harnessFolder$1;
|
|
26659
26671
|
var init_check_generators = __esmMin((() => {
|
|
26660
26672
|
init_finding_generators();
|
|
26661
26673
|
init_json_schema();
|
|
26662
26674
|
init_stack();
|
|
26663
|
-
harnessFolder$
|
|
26675
|
+
harnessFolder$1 = fromHarness();
|
|
26664
26676
|
}));
|
|
26665
26677
|
// src/harness/dream-changes.ts
|
|
26666
26678
|
function readGroup(change) {
|
|
@@ -26682,8 +26694,8 @@ function listChangeProblems$1(value) {
|
|
|
26682
26694
|
const ids = changes.map((change) => change.id);
|
|
26683
26695
|
const groups = new Set(changes.flatMap(({ group }) => group === null ? [] : [group]));
|
|
26684
26696
|
return [
|
|
26685
|
-
...listRepeated
|
|
26686
|
-
...listRepeated
|
|
26697
|
+
...listRepeated(ids).map((id) => `The change ${id} is listed twice.`),
|
|
26698
|
+
...listRepeated(changes.flatMap((change) => change.commits)).map((commit) => `The commit ${commit} is listed twice.`),
|
|
26687
26699
|
...ids.filter((id) => groups.has(id)).map((id) => `${id} names a change and a group.`)
|
|
26688
26700
|
];
|
|
26689
26701
|
}
|
|
@@ -26769,7 +26781,7 @@ function parseLedger(text, name, stack) {
|
|
|
26769
26781
|
}
|
|
26770
26782
|
function listLedgerProblems(value) {
|
|
26771
26783
|
const lessons = readLessons(value);
|
|
26772
|
-
return [...listRepeated
|
|
26784
|
+
return [...listRepeated(lessons.map((lesson) => lesson.id)).map((id) => `The lesson ${id} is listed twice.`), ...lessons.flatMap(({ id, kind, rule }) => listRuleProblems(id, kind, rule))];
|
|
26773
26785
|
}
|
|
26774
26786
|
function listRuleProblems(id, kind, rule) {
|
|
26775
26787
|
if (!ruleKinds.includes(kind)) return rule === null ? [] : [`${id} is ${kind}, so its rule is null.`];
|
|
@@ -27037,7 +27049,7 @@ function listLoopProblems(ids, parents) {
|
|
|
27037
27049
|
function listRateProblems(value, nodes) {
|
|
27038
27050
|
const currency = readText$3(value, "currency");
|
|
27039
27051
|
const rated = readList$1(value, "rates").map((rate) => readText$3(rate, "currency"));
|
|
27040
|
-
const problems = listRepeated
|
|
27052
|
+
const problems = listRepeated(rated).map((code) => `rates gives ${code} more than once.`);
|
|
27041
27053
|
if (rated.includes(currency)) problems.push(`rates gives ${currency}, the map's own currency, which takes no rate.`);
|
|
27042
27054
|
for (const node of nodes) {
|
|
27043
27055
|
const readCurrency = readField(node, "readCurrency");
|
|
@@ -27057,7 +27069,7 @@ function listWindowProblems$1(value) {
|
|
|
27057
27069
|
function checkMoneyMap(value) {
|
|
27058
27070
|
const nodes = readList$1(value, "nodes");
|
|
27059
27071
|
const ids = nodes.map((node) => readText$3(node, "id"));
|
|
27060
|
-
const problems = listRepeated
|
|
27072
|
+
const problems = listRepeated(ids).map((id) => `Map node ${id} appears more than once.`);
|
|
27061
27073
|
problems.push(...listRootProblems(nodes), ...listRateProblems(value, nodes));
|
|
27062
27074
|
problems.push(...listWindowProblems$1(value));
|
|
27063
27075
|
const parents = new Map(nodes.map((node) => [readText$3(node, "id"), readField(node, "parent")]));
|
|
@@ -27119,7 +27131,7 @@ function listUnderstandMapProblems(nodes) {
|
|
|
27119
27131
|
});
|
|
27120
27132
|
}
|
|
27121
27133
|
function listMoneyMapProblems(value) {
|
|
27122
|
-
const schemaProblems = checkAgainstSchema(schemaFile$
|
|
27134
|
+
const schemaProblems = checkAgainstSchema(schemaFile$2, value, "money-map");
|
|
27123
27135
|
return schemaProblems.length > 0 ? schemaProblems : checkMoneyMap(value);
|
|
27124
27136
|
}
|
|
27125
27137
|
function toSavedName(pairs, value) {
|
|
@@ -27277,11 +27289,11 @@ function readMoneyMapAnswer(answerFile, slug) {
|
|
|
27277
27289
|
nodes: readList$1(map, "nodes").map(toFileNode)
|
|
27278
27290
|
};
|
|
27279
27291
|
}
|
|
27280
|
-
var schemaFile$
|
|
27292
|
+
var schemaFile$2, reachedBases, basisNames, visibilityNames;
|
|
27281
27293
|
var init_money_map_check = __esmMin((() => {
|
|
27282
27294
|
init_json_schema();
|
|
27283
27295
|
init_stack();
|
|
27284
|
-
schemaFile$
|
|
27296
|
+
schemaFile$2 = fromHarness("schema", "money-map.schema.json");
|
|
27285
27297
|
reachedBases = ["best-period", "best-segment"];
|
|
27286
27298
|
basisNames = [
|
|
27287
27299
|
["best-period", "best_period"],
|
|
@@ -27296,7 +27308,7 @@ var init_money_map_check = __esmMin((() => {
|
|
|
27296
27308
|
];
|
|
27297
27309
|
}));
|
|
27298
27310
|
// src/harness/proof-line.ts
|
|
27299
|
-
function listProofProblems(where, proof) {
|
|
27311
|
+
function listProofProblems$1(where, proof) {
|
|
27300
27312
|
return listProofStyleProblems(proof).map((problem) => `${where}: ${problem}`);
|
|
27301
27313
|
}
|
|
27302
27314
|
var init_proof_line = __esmMin((() => {
|
|
@@ -34036,7 +34048,7 @@ var init_files = __esmMin((() => {
|
|
|
34036
34048
|
recordPathPattern = /^([a-z0-9]+(?:-[a-z0-9]+)*)\/([a-z0-9]+(?:-[a-z0-9]+)*)\/([a-z0-9]+(?:-[a-z0-9]+)*)\/([a-z0-9]+(?:-[a-z0-9]+)*)\.yaml$/;
|
|
34037
34049
|
}));
|
|
34038
34050
|
// ../../packages/wiki/src/schema.ts
|
|
34039
|
-
var idPattern, id, text, nullableText, pageAddressPattern, pageAddress$1, blockAddress$1, whoValues, who, endings$1, cardStatuses, answer, cardSchema, recordFieldKinds, recordField, recordValue, catalogRecordSchema, stage, stageEdge, formulaTerm, summaryBlock, keyNumberBlock, statusBlock, headingBlock, paragraphBlock, listBlock, calloutBlock, tableBlock, chartBlock, cardsBlock, formulaBlock, diagramBlock, flowBlock, imageBlock, stepsBlock, checklistBlock, questionTreeBlock, decisionBlock, catalogBlock, section, tabsBlock, accordionBlock, blockSchema, pageTypes, pageStatuses, day, pageSchema, budgets;
|
|
34051
|
+
var idPattern, id, text, nullableText, pageAddressPattern, pageAddress$1, blockAddress$1, whoValues, who, endings$1, cardStatuses, answer, cardSchema, recordFieldKinds, recordField, recordLinkSchema, recordValue, catalogRecordSchema, stage, stageEdge, formulaTerm, summaryBlock, keyNumberBlock, statusBlock, headingBlock, paragraphBlock, listBlock, calloutBlock, tableBlock, chartBlock, cardsBlock, formulaBlock, diagramBlock, flowBlock, imageBlock, stepsBlock, checklistBlock, questionTreeBlock, decisionBlock, catalogBlock, section, tabsBlock, accordionBlock, blockSchema, pageTypes, pageStatuses, day, pageSchema, budgets;
|
|
34040
34052
|
var init_schema = __esmMin((() => {
|
|
34041
34053
|
init_zod();
|
|
34042
34054
|
idPattern = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
@@ -34080,7 +34092,8 @@ var init_schema = __esmMin((() => {
|
|
|
34080
34092
|
"texts",
|
|
34081
34093
|
"number",
|
|
34082
34094
|
"boolean",
|
|
34083
|
-
"addresses"
|
|
34095
|
+
"addresses",
|
|
34096
|
+
"links"
|
|
34084
34097
|
];
|
|
34085
34098
|
recordField = strictObject({
|
|
34086
34099
|
name: id,
|
|
@@ -34088,9 +34101,14 @@ var init_schema = __esmMin((() => {
|
|
|
34088
34101
|
kind: _enum(recordFieldKinds),
|
|
34089
34102
|
is_required: boolean()
|
|
34090
34103
|
});
|
|
34104
|
+
recordLinkSchema = strictObject({
|
|
34105
|
+
label: text,
|
|
34106
|
+
to: blockAddress$1
|
|
34107
|
+
});
|
|
34091
34108
|
recordValue = union([
|
|
34092
34109
|
text,
|
|
34093
34110
|
array(text),
|
|
34111
|
+
array(recordLinkSchema),
|
|
34094
34112
|
number$1(),
|
|
34095
34113
|
boolean(),
|
|
34096
34114
|
_null()
|
|
@@ -34777,6 +34795,60 @@ var init_address = __esmMin((() => {
|
|
|
34777
34795
|
init_wiki_error();
|
|
34778
34796
|
addressPattern = /^([a-z0-9]+(?:-[a-z0-9]+)*\/[a-z0-9]+(?:-[a-z0-9]+)*)(?:#([a-z0-9]+(?:-[a-z0-9]+)*))?$/;
|
|
34779
34797
|
}));
|
|
34798
|
+
// ../../packages/wiki/src/home.ts
|
|
34799
|
+
function readLeverRecords(wiki) {
|
|
34800
|
+
const page = wiki.pages.get(homeAddress);
|
|
34801
|
+
if (page === void 0) return {
|
|
34802
|
+
levers: [],
|
|
34803
|
+
problems: [`The wiki has no ${homeAddress}, the page Knowledge opens on.`]
|
|
34804
|
+
};
|
|
34805
|
+
const catalog = listBlocks(page.page.blocks).find((block) => block.id === leverCatalogId);
|
|
34806
|
+
if (catalog === void 0 || catalog.type !== "catalog") return {
|
|
34807
|
+
levers: [],
|
|
34808
|
+
problems: [`${homeAddress} has no catalog ${leverCatalogId}, the levers Knowledge opens on.`]
|
|
34809
|
+
};
|
|
34810
|
+
const problems = [];
|
|
34811
|
+
const levers = [...readCatalogRecords(page, leverCatalogId).values()].flatMap((record) => {
|
|
34812
|
+
const fields = leverFields.safeParse(record.value.fields);
|
|
34813
|
+
if (!fields.success) {
|
|
34814
|
+
problems.push(...fields.error.issues.map((issue) => `${record.path}${issue.path.length === 0 ? "" : ` at ${issue.path.join(".")}`}: ${issue.message}`));
|
|
34815
|
+
return [];
|
|
34816
|
+
}
|
|
34817
|
+
return [{
|
|
34818
|
+
id: record.value.id,
|
|
34819
|
+
title: record.value.title,
|
|
34820
|
+
summary: record.value.summary,
|
|
34821
|
+
order: fields.data.order,
|
|
34822
|
+
guides: fields.data.guides
|
|
34823
|
+
}];
|
|
34824
|
+
});
|
|
34825
|
+
const orders = levers.map((lever) => lever.order);
|
|
34826
|
+
for (const lever of levers) if (orders.indexOf(lever.order) !== orders.lastIndexOf(lever.order)) problems.push(`${homeAddress}#${lever.id} shares its order ${String(lever.order)}.`);
|
|
34827
|
+
return {
|
|
34828
|
+
levers: levers.toSorted((one, other) => one.order - other.order).map((lever) => ({
|
|
34829
|
+
id: lever.id,
|
|
34830
|
+
title: lever.title,
|
|
34831
|
+
summary: lever.summary,
|
|
34832
|
+
guides: lever.guides
|
|
34833
|
+
})),
|
|
34834
|
+
problems: [...new Set(problems)]
|
|
34835
|
+
};
|
|
34836
|
+
}
|
|
34837
|
+
function listHomeProblems(wiki) {
|
|
34838
|
+
return readLeverRecords(wiki).problems;
|
|
34839
|
+
}
|
|
34840
|
+
var homeAddress, leverCatalogId, leverFields;
|
|
34841
|
+
var init_home = __esmMin((() => {
|
|
34842
|
+
init_zod();
|
|
34843
|
+
init_load();
|
|
34844
|
+
init_schema();
|
|
34845
|
+
homeAddress = "start/index";
|
|
34846
|
+
leverCatalogId = "levers";
|
|
34847
|
+
leverFields = strictObject({
|
|
34848
|
+
order: number$1().int().positive(),
|
|
34849
|
+
guides: array(recordLinkSchema)
|
|
34850
|
+
});
|
|
34851
|
+
}));
|
|
34780
34852
|
// ../../packages/wiki/src/fill.ts
|
|
34781
34853
|
function countWords$1(value) {
|
|
34782
34854
|
if (typeof value === "string") return value.split(/\s+/).filter((word) => word !== "").length;
|
|
@@ -34804,7 +34876,7 @@ function measureTrees(page, blocks) {
|
|
|
34804
34876
|
}
|
|
34805
34877
|
function countTextWords(value) {
|
|
34806
34878
|
if (typeof value === "string") return value.split(/\s+/).filter((word) => word !== "").length;
|
|
34807
|
-
if (Array.isArray(value)) return value.reduce((sum, item) => sum + countTextWords(item), 0);
|
|
34879
|
+
if (Array.isArray(value)) return value.reduce((sum, item) => sum + (typeof item === "string" ? countTextWords(item) : 0), 0);
|
|
34808
34880
|
return 0;
|
|
34809
34881
|
}
|
|
34810
34882
|
function countRecordWords(record, proseFields) {
|
|
@@ -35013,7 +35085,7 @@ function renderRecord(catalog, record, context) {
|
|
|
35013
35085
|
...catalog.fields.map((field) => {
|
|
35014
35086
|
const value = readRecordField(record, field.name);
|
|
35015
35087
|
if (value === void 0 || value === null) return `- ${field.label} (${field.name}): none`;
|
|
35016
|
-
if (Array.isArray(value)) return `- ${field.label} (${field.name}): ${value.length === 0 ? "none" : value.map((item) => `\`${item}\``).join(", ")}`;
|
|
35088
|
+
if (Array.isArray(value)) return `- ${field.label} (${field.name}): ${value.length === 0 ? "none" : value.map((item) => typeof item === "string" ? `\`${item}\`` : `${item.label} (\`${item.to}\`)`).join(", ")}`;
|
|
35017
35089
|
return `- ${field.label} (${field.name}): ${String(value)}`;
|
|
35018
35090
|
})
|
|
35019
35091
|
].join("\n");
|
|
@@ -35141,7 +35213,7 @@ function matchesRecord(rules, record) {
|
|
|
35141
35213
|
if (rule.values.includes("*")) return true;
|
|
35142
35214
|
if (rule.key === "id") return rule.values.includes(record.id);
|
|
35143
35215
|
const value = readRecordField(record, rule.key);
|
|
35144
|
-
if (Array.isArray(value)) return value.some((item) => rule.values.includes(item));
|
|
35216
|
+
if (Array.isArray(value)) return value.some((item) => rule.values.includes(typeof item === "string" ? item : item.to));
|
|
35145
35217
|
return rule.values.includes(String(value));
|
|
35146
35218
|
});
|
|
35147
35219
|
}
|
|
@@ -35507,7 +35579,17 @@ function isKind$1(field, value) {
|
|
|
35507
35579
|
if (field.kind === "text") return typeof value === "string";
|
|
35508
35580
|
if (field.kind === "number") return typeof value === "number";
|
|
35509
35581
|
if (field.kind === "boolean") return typeof value === "boolean";
|
|
35510
|
-
|
|
35582
|
+
if (!Array.isArray(value)) return false;
|
|
35583
|
+
return field.kind === "links" ? value.every((item) => typeof item === "object") : value.every((item) => typeof item === "string");
|
|
35584
|
+
}
|
|
35585
|
+
function listFieldAddresses(field, value) {
|
|
35586
|
+
if (!Array.isArray(value)) return [];
|
|
35587
|
+
if (field.kind === "addresses") return value.filter((item) => typeof item === "string");
|
|
35588
|
+
if (field.kind !== "links") return [];
|
|
35589
|
+
return value.flatMap((item) => {
|
|
35590
|
+
const link = recordLinkSchema.safeParse(item);
|
|
35591
|
+
return link.success ? [link.data.to] : [];
|
|
35592
|
+
});
|
|
35511
35593
|
}
|
|
35512
35594
|
function listCatalogProblems(wiki, page, catalog) {
|
|
35513
35595
|
const names = catalog.fields.map((field) => field.name);
|
|
@@ -35517,8 +35599,7 @@ function listCatalogProblems(wiki, page, catalog) {
|
|
|
35517
35599
|
const value = readRecordField(record.value, field.name);
|
|
35518
35600
|
if (value === void 0 || value === null) return field.is_required ? [`${where} needs the field ${field.name}.`] : [];
|
|
35519
35601
|
if (!isKind$1(field, value)) return [`${where} field ${field.name} must be ${field.kind}.`];
|
|
35520
|
-
|
|
35521
|
-
return value.filter((address) => !canResolve(wiki, address)).map((address) => `${where} field ${field.name} names ${address}, which doesn't resolve.`);
|
|
35602
|
+
return listFieldAddresses(field, value).filter((address) => !canResolve(wiki, address)).map((address) => `${where} field ${field.name} names ${address}, which doesn't resolve.`);
|
|
35522
35603
|
})];
|
|
35523
35604
|
});
|
|
35524
35605
|
}
|
|
@@ -35628,7 +35709,8 @@ function checkLoaded(wiki) {
|
|
|
35628
35709
|
problems: [
|
|
35629
35710
|
...wiki.problems,
|
|
35630
35711
|
...wiki.commented.map((path) => `${path} holds a YAML comment, which an edit would drop. Move its words into a field.`),
|
|
35631
|
-
...pages.flatMap((page) => checkPage$1(wiki, page))
|
|
35712
|
+
...pages.flatMap((page) => checkPage$1(wiki, page)),
|
|
35713
|
+
...listHomeProblems(wiki)
|
|
35632
35714
|
],
|
|
35633
35715
|
pages: pages.length,
|
|
35634
35716
|
cards: pages.reduce((sum, page) => sum + [...page.cards.values()].reduce((inner, cards) => inner + cards.size, 0), 0),
|
|
@@ -35642,6 +35724,7 @@ var rawHtml, blockKeys;
|
|
|
35642
35724
|
var init_check = __esmMin((() => {
|
|
35643
35725
|
init_address();
|
|
35644
35726
|
init_hash();
|
|
35727
|
+
init_home();
|
|
35645
35728
|
init_load();
|
|
35646
35729
|
init_read();
|
|
35647
35730
|
init_record_field();
|
|
@@ -36194,6 +36277,7 @@ var init_src = __esmMin((() => {
|
|
|
36194
36277
|
init_edit();
|
|
36195
36278
|
init_fill();
|
|
36196
36279
|
init_files();
|
|
36280
|
+
init_home();
|
|
36197
36281
|
init_load();
|
|
36198
36282
|
init_read();
|
|
36199
36283
|
init_render();
|
|
@@ -36330,9 +36414,8 @@ function splitCardAddress(address) {
|
|
|
36330
36414
|
}
|
|
36331
36415
|
function readProblems() {
|
|
36332
36416
|
return listCatalogRecords(readMapWiki(), problemsAddress).map((record) => {
|
|
36333
|
-
const trees = record.fields
|
|
36334
|
-
const mustRead = record.fields
|
|
36335
|
-
if (!Array.isArray(trees) || !Array.isArray(mustRead)) throw new Error(`${problemsAddress} record ${record.id} holds no trees or must-read list.`);
|
|
36417
|
+
const trees = readTexts(record.fields, "trees");
|
|
36418
|
+
const mustRead = readTexts(record.fields, "must-read");
|
|
36336
36419
|
return {
|
|
36337
36420
|
key: record.id,
|
|
36338
36421
|
trees: trees.map(readSlug),
|
|
@@ -36669,7 +36752,7 @@ function listWalkRuleProblems(file, value) {
|
|
|
36669
36752
|
return [
|
|
36670
36753
|
...listEndLineProblems(value),
|
|
36671
36754
|
...shapeProblems.length > 0 ? shapeProblems : [...listCardListProblems(walk), ...listPassedProblems(walk)],
|
|
36672
|
-
...listRepeated
|
|
36755
|
+
...listRepeated(knownIds).map((id) => `known holds ${id} twice, here or in run.json.`),
|
|
36673
36756
|
...readField(value, "note") === null === isPickUp ? [] : ["note is null on a pick-up walk and on no other."],
|
|
36674
36757
|
...readList$1(value, "items").flatMap((item, index) => listItemProblems(walk, item, index, known)),
|
|
36675
36758
|
...listCausesProblems(walk, knownIds),
|
|
@@ -36944,7 +37027,7 @@ function listUpFrontProblems(run, parts) {
|
|
|
36944
37027
|
return [
|
|
36945
37028
|
...wanted.filter((name) => !held.includes(name)).map((name) => `upFront has no row for ${name}.`),
|
|
36946
37029
|
...held.filter((name) => !wanted.includes(name)).map((name) => `upFront holds ${name}, which the run's files don't show.`),
|
|
36947
|
-
...listRepeated
|
|
37030
|
+
...listRepeated(held).map((name) => `upFront holds ${name} twice.`),
|
|
36948
37031
|
...rows.filter((row) => upFrontWithNextRead.includes(readText$3(row, "kind")) && readField(row, "nextRead") === null).map((row) => `An upFront row of the kind ${readText$3(row, "kind")} has no next read.`)
|
|
36949
37032
|
];
|
|
36950
37033
|
}
|
|
@@ -37027,7 +37110,7 @@ function listPickedProblems(value, problem) {
|
|
|
37027
37110
|
if (!isSplitPick) return [];
|
|
37028
37111
|
const picked = readTexts(value, "picked");
|
|
37029
37112
|
const partTrees = listPartTrees();
|
|
37030
|
-
return [...picked.filter((tree) => !partTrees.includes(tree)).map((tree) => `picked holds ${tree}, which is no part tree.`), ...listRepeated
|
|
37113
|
+
return [...picked.filter((tree) => !partTrees.includes(tree)).map((tree) => `picked holds ${tree}, which is no part tree.`), ...listRepeated(picked).map((tree) => `picked holds ${tree} twice.`)];
|
|
37031
37114
|
}
|
|
37032
37115
|
function listProblemTrees(value, problem) {
|
|
37033
37116
|
const trees = readTexts(problem, "trees");
|
|
@@ -37057,7 +37140,7 @@ function listRunRowProblems(file, value, problem) {
|
|
|
37057
37140
|
...parts.filter((part) => readField(part, "ofProblem") !== problemTrees.includes(readText$3(part, "tree"))).map((part) => `${readText$3(part, "tree")}'s ofProblem doesn't match the problem's trees in meta-ads/problems, or picked.`),
|
|
37058
37141
|
...isSplitOnly ? listSplitOnlyProblems(parts) : [],
|
|
37059
37142
|
...ran.length === 0 && !isSplitOnly ? ["No tree ran."] : [],
|
|
37060
|
-
...listRepeated
|
|
37143
|
+
...listRepeated(readList$1(value, "known").map((row) => readText$3(row, "id"))).map((id) => `known holds ${id} twice.`),
|
|
37061
37144
|
...listKnownReadProblems(file, value)
|
|
37062
37145
|
];
|
|
37063
37146
|
}
|
|
@@ -37222,7 +37305,7 @@ function checkDirections(file, value) {
|
|
|
37222
37305
|
const nodes = new Set(mapNodes.keys());
|
|
37223
37306
|
problems.push(...listDoublingProblems(readField(value, "doubling"), mapNodes));
|
|
37224
37307
|
problems.push(...listNoteProblems(readList$1(value, "notes")));
|
|
37225
|
-
problems.push(...listRepeated
|
|
37308
|
+
problems.push(...listRepeated(directions.map((direction) => readText$3(direction, "id"))).map((id) => `${id} is used by more than one direction.`), ...listRankProblems(directions));
|
|
37226
37309
|
for (const direction of directions) {
|
|
37227
37310
|
const id = readText$3(direction, "id");
|
|
37228
37311
|
const origin = readField(direction, "origin");
|
|
@@ -37320,7 +37403,7 @@ function checkStreamKinds(streams, placements) {
|
|
|
37320
37403
|
if (ofKind("leaks").length > 2) problems.push(`A cycle has at most 2 leaks streams, not ${ofKind("leaks").length}.`);
|
|
37321
37404
|
if (ofKind("signals").length > 1) problems.push("A cycle has at most one signals stream.");
|
|
37322
37405
|
if (ofKind("backlog").length > 1) problems.push("A cycle has at most one backlog stream.");
|
|
37323
|
-
problems.push(...listRepeated
|
|
37406
|
+
problems.push(...listRepeated(streams.map((stream) => readText$3(stream, "id"))).map((id) => `Stream id ${id} is used more than once.`));
|
|
37324
37407
|
for (const stream of ofKind("deep")) {
|
|
37325
37408
|
const held = readTexts(stream, "directions");
|
|
37326
37409
|
if (held.length !== 1) problems.push(`Deep stream ${readText$3(stream, "id")} holds ${held.length} directions, not 1.`);
|
|
@@ -37763,7 +37846,7 @@ function listOpenFlagProblems(key, check) {
|
|
|
37763
37846
|
if (readField(open, "stillSeen") === true) return [];
|
|
37764
37847
|
const where = `${key}'s openFlags[${index}]`;
|
|
37765
37848
|
const note = readField(open, "note");
|
|
37766
|
-
const noteProblems = typeof note === "string" ? listProofProblems(`${where}.note`, note) : [`${where} is stillSeen false with no note proving it's gone.`];
|
|
37849
|
+
const noteProblems = typeof note === "string" ? listProofProblems$1(`${where}.note`, note) : [`${where} is stillSeen false with no note proving it's gone.`];
|
|
37767
37850
|
if (noteProblems.length === 0) return [];
|
|
37768
37851
|
return [...noteProblems, `Fix ${where}'s note, or write it stillSeen true when no read proves it's gone.`];
|
|
37769
37852
|
});
|
|
@@ -37838,7 +37921,7 @@ function listMeasureProblems(where, opening) {
|
|
|
37838
37921
|
const weeks = readList$1(opening, "beforeWeeks");
|
|
37839
37922
|
const starts = weeks.map((week) => readText$3(week, "weekStart"));
|
|
37840
37923
|
const lastYears = weeks.map((week) => readField(week, "lastYear")).filter((lastYear) => lastYear !== null);
|
|
37841
|
-
const problems = [...starts.filter((start) => !isMonday(start)).map((start) => `${where}.beforeWeeks names ${start}, which isn't a Monday. Name each before week by its Monday.`), ...listRepeated
|
|
37924
|
+
const problems = [...starts.filter((start) => !isMonday(start)).map((start) => `${where}.beforeWeeks names ${start}, which isn't a Monday. Name each before week by its Monday.`), ...listRepeated(starts).map((start) => `${where}.beforeWeeks names ${start} twice. Name each before week once.`)];
|
|
37842
37925
|
if (!isOldestFirst(starts)) problems.push(`${where}.beforeWeeks should run oldest first.`);
|
|
37843
37926
|
if (weeks.some((week) => readField(week, "comparisonValue") !== null !== hasComparison)) problems.push(hasComparison ? `${where} has a comparisonRead, so every before week needs its comparisonValue.` : `${where} has no comparisonRead, so every before week takes comparisonValue null.`);
|
|
37844
37927
|
if (lastYears.length > 0 && !hasLastYear) problems.push(`${where} has no lastYearRead, so every before week takes lastYear null.`);
|
|
@@ -37858,10 +37941,10 @@ function listShownFirstProblems(evidence) {
|
|
|
37858
37941
|
}
|
|
37859
37942
|
function checkWatchConfirm(value) {
|
|
37860
37943
|
if (readText$3(value, "verdict") !== "fixed") return [];
|
|
37861
|
-
return listProofProblems("proof", readText$3(value, "proof"));
|
|
37944
|
+
return listProofProblems$1("proof", readText$3(value, "proof"));
|
|
37862
37945
|
}
|
|
37863
37946
|
function listReverifyWordProblems(value) {
|
|
37864
|
-
return [...listClientNoteStyleProblems(readText$3(value, "reason")).map((problem) => `reason: ${problem}`), ...listProofProblems("proof", readText$3(value, "proof"))];
|
|
37947
|
+
return [...listClientNoteStyleProblems(readText$3(value, "reason")).map((problem) => `reason: ${problem}`), ...listProofProblems$1("proof", readText$3(value, "proof"))];
|
|
37865
37948
|
}
|
|
37866
37949
|
function listRerunProblems(reruns) {
|
|
37867
37950
|
return reruns.flatMap((rerun, index) => {
|
|
@@ -37880,7 +37963,7 @@ function listSizeProblems(size) {
|
|
|
37880
37963
|
}
|
|
37881
37964
|
function listUpdateProblems(update, facts) {
|
|
37882
37965
|
const moved = readTexts(update, "moved");
|
|
37883
|
-
const problems = listRepeated
|
|
37966
|
+
const problems = listRepeated(moved).map((part) => `update.moved names ${part} twice.`);
|
|
37884
37967
|
const parts = [[
|
|
37885
37968
|
"numbers",
|
|
37886
37969
|
facts.hasMovedNumber,
|
|
@@ -37978,7 +38061,7 @@ function readRunStart(startFile) {
|
|
|
37978
38061
|
};
|
|
37979
38062
|
}
|
|
37980
38063
|
function checkFixCheckList(value) {
|
|
37981
|
-
return listRepeated
|
|
38064
|
+
return listRepeated(readList$1(value, "findings").map((finding) => readText$3(finding, "findingId"))).map((id) => `${id} is listed more than once. List each finding once.`);
|
|
37982
38065
|
}
|
|
37983
38066
|
function listJobVerdicts(job) {
|
|
37984
38067
|
return job === "find_fix" ? [
|
|
@@ -38060,7 +38143,7 @@ function listLookPartProblems(value) {
|
|
|
38060
38143
|
function listLookProofProblems(value, entry) {
|
|
38061
38144
|
const proofKind = readField(value, "proofKind");
|
|
38062
38145
|
const proof = readField(value, "proof");
|
|
38063
|
-
const problems = typeof proof === "string" ? listProofProblems("proof", proof) : [];
|
|
38146
|
+
const problems = typeof proof === "string" ? listProofProblems$1("proof", proof) : [];
|
|
38064
38147
|
if (readText$3(value, "verdict") === "cant_check" !== (proofKind === null)) problems.push("proofKind is null on cant_check, and only there. On every other verdict name state or numbers.");
|
|
38065
38148
|
if (readField(entry, "isTest") === true && proofKind === "numbers") problems.push("This finding is a test, so its proofKind is state: a read shows whether the change it names is live.");
|
|
38066
38149
|
return problems;
|
|
@@ -38370,7 +38453,7 @@ function checkFixCheckLooks(file, value) {
|
|
|
38370
38453
|
};
|
|
38371
38454
|
return [
|
|
38372
38455
|
...readText$3(value, "runId") === runId ? [] : [`runId isn't ${runId}, the run start.json opened. Send looks to that run.`],
|
|
38373
|
-
...listRepeated
|
|
38456
|
+
...listRepeated(looks.map((look) => readText$3(look, "findingId"))).map((findingId) => `${findingId} has two looks in this save. Send each finding's look once.`),
|
|
38374
38457
|
...looks.flatMap((look) => listLookSourceProblems(look, sources))
|
|
38375
38458
|
];
|
|
38376
38459
|
}
|
|
@@ -38428,7 +38511,7 @@ function listWeekSumProblems(value) {
|
|
|
38428
38511
|
const days = readList$1(value, "days");
|
|
38429
38512
|
const names = days.map((day) => readText$3(day, "day"));
|
|
38430
38513
|
const sales = new Map(days.map((day) => [readText$3(day, "day"), readNumber(day, "netSales")]));
|
|
38431
|
-
const problems = listRepeated
|
|
38514
|
+
const problems = listRepeated(names).map((day) => `days holds ${day} twice. List each day once.`);
|
|
38432
38515
|
if (!isOldestFirst(names)) problems.push("days should run oldest first.");
|
|
38433
38516
|
return [...problems, ...readList$1(value, "weeks").flatMap((week) => {
|
|
38434
38517
|
const netSales = readField(week, "netSales");
|
|
@@ -38460,7 +38543,7 @@ function checkFixCheckWeeks(file, value) {
|
|
|
38460
38543
|
const problems = [
|
|
38461
38544
|
...asked.filter((weekStart) => !starts.includes(weekStart)).map((weekStart) => `weeks leaves out the week of ${weekStart}, which the brief asks for.`),
|
|
38462
38545
|
...starts.filter((weekStart) => !asked.includes(weekStart)).map((weekStart) => `weeks holds the week of ${weekStart}, which the brief doesn't ask for.`),
|
|
38463
|
-
...listRepeated
|
|
38546
|
+
...listRepeated(starts).map((weekStart) => `weeks holds the week of ${weekStart} twice.`)
|
|
38464
38547
|
];
|
|
38465
38548
|
if (!isOldestFirst(starts)) problems.push("weeks should run oldest first.");
|
|
38466
38549
|
return [
|
|
@@ -38485,7 +38568,7 @@ function listReadJobProblems(value, briefFile) {
|
|
|
38485
38568
|
const problems = [
|
|
38486
38569
|
...asked.filter((weekStart) => !named.includes(weekStart)).map((weekStart) => `The brief asks for the week of ${weekStart}: put it in reads, or in gaps with why.`),
|
|
38487
38570
|
...named.filter((weekStart) => !asked.includes(weekStart)).map((weekStart) => `The brief doesn't ask for the week of ${weekStart}. Take it out.`),
|
|
38488
|
-
...listRepeated
|
|
38571
|
+
...listRepeated(named).map((weekStart) => `reads and gaps name the week of ${weekStart} twice. Name each week once.`),
|
|
38489
38572
|
...listUncalledProblems(value, readWeeks)
|
|
38490
38573
|
];
|
|
38491
38574
|
if (readField(value, "opening") !== null || readField(value, "notMeasurable") !== null) problems.push("A read job proposes nothing: set opening and notMeasurable to null.");
|
|
@@ -38635,7 +38718,7 @@ function checkWatchBreaks(file, value) {
|
|
|
38635
38718
|
nodes,
|
|
38636
38719
|
breaksByNode: new Map(breaks.map((brokenNode) => [readText$3(brokenNode, "nodeId"), brokenNode]))
|
|
38637
38720
|
};
|
|
38638
|
-
const problems = listRepeated
|
|
38721
|
+
const problems = listRepeated(breaks.map((brokenNode) => readText$3(brokenNode, "nodeId"))).map((node) => `${node} breaks twice; one node has one break a day.`);
|
|
38639
38722
|
problems.push(...listWindowProblems(breaks, leftover));
|
|
38640
38723
|
for (const brokenNode of breaks) {
|
|
38641
38724
|
const mapNode = nodes.get(readText$3(brokenNode, "nodeId"));
|
|
@@ -38712,7 +38795,7 @@ function listRoomFiles(folder) {
|
|
|
38712
38795
|
function checkManifest(file, value) {
|
|
38713
38796
|
const entries = readList$1(value, "files");
|
|
38714
38797
|
const listed = entries.map((entry) => readText$3(entry, "file"));
|
|
38715
|
-
const problems = listRepeated
|
|
38798
|
+
const problems = listRepeated(listed).map((name) => `${name} is listed twice.`);
|
|
38716
38799
|
problems.push(...entries.flatMap(listCallProblems));
|
|
38717
38800
|
const room = readRoomFolder(file);
|
|
38718
38801
|
if (!existsSync(room)) return problems;
|
|
@@ -38767,7 +38850,7 @@ function checkDreamCandidates(value) {
|
|
|
38767
38850
|
const sessions = new Set(readTexts(value, "sessions"));
|
|
38768
38851
|
const candidates = readList$1(value, "candidates");
|
|
38769
38852
|
return [
|
|
38770
|
-
...listRepeated
|
|
38853
|
+
...listRepeated(candidates.map((candidate) => readText$3(candidate, "id"))).map((id) => `The candidate ${id} is listed twice.`),
|
|
38771
38854
|
...candidates.filter((candidate) => !sessions.has(readText$3(candidate, "session"))).map((candidate) => `${readText$3(candidate, "id")} names a session this reader wasn't given.`),
|
|
38772
38855
|
...readTexts(value, "briefs").filter((session) => !sessions.has(session)).map((session) => `The brief ${session} is a session this reader wasn't given.`)
|
|
38773
38856
|
];
|
|
@@ -43244,7 +43327,7 @@ var init_brand_marks = __esmMin((() => {
|
|
|
43244
43327
|
}));
|
|
43245
43328
|
// src/harness/leak-library.ts
|
|
43246
43329
|
function readRecords(address) {
|
|
43247
|
-
return listCatalogRecords(wiki, address);
|
|
43330
|
+
return listCatalogRecords(wiki$1, address);
|
|
43248
43331
|
}
|
|
43249
43332
|
function readId(record, field) {
|
|
43250
43333
|
const id = readText$3(record.fields, field);
|
|
@@ -43312,22 +43395,28 @@ function findTierPlace(entry) {
|
|
|
43312
43395
|
if (place < 0) throw new Error(`${entry.id} has the tier ${entry.tier}, which isn't a tier.`);
|
|
43313
43396
|
return place;
|
|
43314
43397
|
}
|
|
43398
|
+
function readOptionalText$1(fields, field) {
|
|
43399
|
+
const value = readField(fields, field);
|
|
43400
|
+
if (value === void 0 || value === null) return null;
|
|
43401
|
+
if (typeof value !== "string") throw new Error(`${field} should be text.`);
|
|
43402
|
+
return value;
|
|
43403
|
+
}
|
|
43315
43404
|
function readWikiMapLinks() {
|
|
43316
|
-
return
|
|
43405
|
+
return mapPages.map(({ map, page, catalog, rule }) => ({
|
|
43317
43406
|
map,
|
|
43318
43407
|
file: `wiki/${page}.yaml`,
|
|
43319
|
-
entries: readRecords(`${page}
|
|
43408
|
+
entries: readRecords(`${page}#${catalog}`).map((record) => ({
|
|
43320
43409
|
id: readId(record, "entry"),
|
|
43321
43410
|
tier: readText$3(record.fields, "tier"),
|
|
43322
43411
|
title: record.title,
|
|
43323
|
-
rule:
|
|
43412
|
+
rule: readOptionalText$1(record.fields, rule),
|
|
43324
43413
|
same: readTexts(record.fields, "same"),
|
|
43325
43414
|
dig: readTexts(record.fields, "dig"),
|
|
43326
43415
|
differs: readTexts(record.fields, "differs")
|
|
43327
43416
|
})).toSorted((one, other) => findTierPlace(one) - findTierPlace(other))
|
|
43328
43417
|
}));
|
|
43329
43418
|
}
|
|
43330
|
-
var leakLibraryAddress, tierOrder, mapPages, wiki;
|
|
43419
|
+
var leakLibraryAddress, tierOrder, mapPages, wiki$1;
|
|
43331
43420
|
var init_leak_library = __esmMin((() => {
|
|
43332
43421
|
init_src();
|
|
43333
43422
|
init_wiki_folder();
|
|
@@ -43338,8 +43427,18 @@ var init_leak_library = __esmMin((() => {
|
|
|
43338
43427
|
"first",
|
|
43339
43428
|
"deep"
|
|
43340
43429
|
];
|
|
43341
|
-
mapPages =
|
|
43342
|
-
|
|
43430
|
+
mapPages = [{
|
|
43431
|
+
map: "meta",
|
|
43432
|
+
page: "meta-ads/leak-links",
|
|
43433
|
+
catalog: "links",
|
|
43434
|
+
rule: "rule"
|
|
43435
|
+
}, {
|
|
43436
|
+
map: "retention",
|
|
43437
|
+
page: "retention/map",
|
|
43438
|
+
catalog: "questions",
|
|
43439
|
+
rule: "dig-when"
|
|
43440
|
+
}];
|
|
43441
|
+
wiki$1 = loadWiki(readWikiFiles(readWikiFolder()));
|
|
43343
43442
|
}));
|
|
43344
43443
|
// src/harness/check-leaks.ts
|
|
43345
43444
|
var check_leaks_exports = /* @__PURE__ */ __exportAll({ run: () => run$20 });
|
|
@@ -43361,8 +43460,8 @@ function listStageProblems(stage) {
|
|
|
43361
43460
|
...id.startsWith(prefix) ? [] : [`${id} is in ${name}, so its id should start with ${prefix}.`],
|
|
43362
43461
|
...role === "risk" && (hasSize || !hasRisk) ? [`${id} is in the risk stage ${name}, so it holds a risk and no size.`] : [],
|
|
43363
43462
|
...role !== "risk" && (!hasSize || hasRisk) ? [`${id} is in the ${role} stage ${name}, so it holds a size and no risk.`] : [],
|
|
43364
|
-
...listRepeated
|
|
43365
|
-
...listRepeated
|
|
43463
|
+
...listRepeated(readTexts(leak, "sources")).map((source) => `${id} lists the source ${source} twice.`),
|
|
43464
|
+
...listRepeated(readTexts(leak, "gates")).map((gate) => `${id} lists the gate ${gate} twice.`)
|
|
43366
43465
|
];
|
|
43367
43466
|
}), ...findBrandMarks(JSON.stringify(stage.value)).map((mark) => `${name} holds ${mark.found}, ${mark.name}. The library holds no brand's ids or findings.`)];
|
|
43368
43467
|
}
|
|
@@ -43385,11 +43484,11 @@ function listSignalProblems(leaks, signals) {
|
|
|
43385
43484
|
return [
|
|
43386
43485
|
...linked.filter((link) => !signalKeys.includes(link.signal)).map((link) => `${link.id} names the signal ${link.signal}, which isn't on the signal map.`),
|
|
43387
43486
|
...linked.filter((link) => offKeys.includes(link.signal)).map((link) => `${link.id} names the signal ${link.signal}, which is switched off and checks nothing.`),
|
|
43388
|
-
...listRepeated
|
|
43487
|
+
...listRepeated(linked.map((link) => link.signal)).map((signal) => `Two leaks name the signal ${signal}; a signal watches one leak.`)
|
|
43389
43488
|
];
|
|
43390
43489
|
}
|
|
43391
43490
|
function checkStage(value) {
|
|
43392
|
-
const problems = checkAgainstSchema(schemaFile$
|
|
43491
|
+
const problems = checkAgainstSchema(schemaFile$1, value, value.stage);
|
|
43393
43492
|
return {
|
|
43394
43493
|
stage: {
|
|
43395
43494
|
name: value.stage,
|
|
@@ -43410,22 +43509,22 @@ function run$20() {
|
|
|
43410
43509
|
const problems = [
|
|
43411
43510
|
...stages.flatMap(listStageProblems),
|
|
43412
43511
|
...listOrderProblems$1(stages),
|
|
43413
|
-
...listRepeated
|
|
43414
|
-
...listRepeated
|
|
43512
|
+
...listRepeated(stages.map((stage) => readText$3(stage.value, "prefix"))).map((prefix) => `Two stages use the prefix ${prefix}.`),
|
|
43513
|
+
...listRepeated(leaks.map((leak) => readText$3(leak, "id"))).map((id) => `${id} is the id of two leaks.`),
|
|
43415
43514
|
...listSignalProblems(leaks, readSignals$2()),
|
|
43416
|
-
...listRepeated
|
|
43515
|
+
...listRepeated(readSignalChecks().map((check) => String(check.order))).map((order) => `Two signal checks have the order ${order}.`)
|
|
43417
43516
|
];
|
|
43418
43517
|
if (problems.length > 0) throw new Error(`The leak library in ${leakLibraryAddress} has problems:\n${problems.join("\n")}`);
|
|
43419
43518
|
const count = (field, value) => String(leaks.filter((leak) => readField(leak, field) === value).length);
|
|
43420
43519
|
console.log(`${leakLibraryAddress} holds ${String(leaks.length)} leaks in ${String(stages.length)} stages: ${count("lane", "sure")} sure things, ${count("lane", "check")} quick checks and ${count("lane", "dig")} deep digs. ${String(leaks.filter((leak) => readField(leak, "isPlay") === true).length)} are missing plays and ${String(leaks.filter((leak) => readField(leak, "signal") !== null).length)} link a signal, with every id, prefix, signal and stage order resolved and no brand's own ids.`);
|
|
43421
43520
|
}
|
|
43422
|
-
var schemaFile$
|
|
43521
|
+
var schemaFile$1;
|
|
43423
43522
|
var init_check_leaks = __esmMin((() => {
|
|
43424
43523
|
init_brand_marks();
|
|
43425
43524
|
init_json_schema();
|
|
43426
43525
|
init_leak_library();
|
|
43427
43526
|
init_stack();
|
|
43428
|
-
schemaFile$
|
|
43527
|
+
schemaFile$1 = join(fromHarness(), "schema", "leaks.schema.json");
|
|
43429
43528
|
}));
|
|
43430
43529
|
// src/harness/check-limits.ts
|
|
43431
43530
|
var check_limits_exports = /* @__PURE__ */ __exportAll({ run: () => run$19 });
|
|
@@ -43953,251 +44052,269 @@ var init_check_limits = __esmMin((() => {
|
|
|
43953
44052
|
}));
|
|
43954
44053
|
// src/harness/check-map.ts
|
|
43955
44054
|
var check_map_exports = /* @__PURE__ */ __exportAll({ run: () => run$18 });
|
|
43956
|
-
function has(
|
|
43957
|
-
|
|
44055
|
+
function has(record, field) {
|
|
44056
|
+
const value = record.fields[field];
|
|
44057
|
+
return value !== void 0 && value !== null;
|
|
43958
44058
|
}
|
|
43959
|
-
function
|
|
43960
|
-
|
|
43961
|
-
|
|
43962
|
-
return value;
|
|
44059
|
+
function readValue$1(record, field) {
|
|
44060
|
+
if (!has(record, field)) throw new Error(`${record.id} has no ${field}.`);
|
|
44061
|
+
return record.fields[field];
|
|
43963
44062
|
}
|
|
43964
|
-
function
|
|
43965
|
-
const
|
|
43966
|
-
|
|
43967
|
-
|
|
43968
|
-
return {
|
|
43969
|
-
layers: new Map(Object.keys(layers).map((layer) => [layer, readText$3(layers, layer)])),
|
|
43970
|
-
counts: Object.keys(readFields(readField(value, "words"), "counts")),
|
|
43971
|
-
tables: Object.keys(readFields(value, "tables")),
|
|
43972
|
-
builder,
|
|
43973
|
-
sources: readTexts(value, "sources")
|
|
43974
|
-
};
|
|
43975
|
-
}
|
|
43976
|
-
function listRepeated(names) {
|
|
43977
|
-
return [...new Set(names.filter((name, index) => names.indexOf(name) !== index))];
|
|
43978
|
-
}
|
|
43979
|
-
function listDeclarationProblems(fileName, declarations) {
|
|
43980
|
-
return [...listRepeated([...declarations.layers.values()]).map((letter) => `${fileName} gives the letter ${letter} to two layers.`), ...listRepeated(declarations.sources).map((source) => `${fileName} lists the source ${source} twice.`)];
|
|
44063
|
+
function readWord$1(record, field) {
|
|
44064
|
+
const value = readValue$1(record, field);
|
|
44065
|
+
if (typeof value !== "string") throw new Error(`${record.id}'s ${field} should be text.`);
|
|
44066
|
+
return value;
|
|
43981
44067
|
}
|
|
43982
|
-
function
|
|
43983
|
-
|
|
44068
|
+
function readWords$1(record, field) {
|
|
44069
|
+
if (!has(record, field)) return [];
|
|
44070
|
+
const value = readValue$1(record, field);
|
|
44071
|
+
if (!Array.isArray(value)) throw new Error(`${record.id}'s ${field} should be a list.`);
|
|
44072
|
+
return value.map((item) => {
|
|
44073
|
+
if (typeof item !== "string") throw new Error(`${record.id}'s ${field} should hold text.`);
|
|
44074
|
+
return item;
|
|
44075
|
+
});
|
|
43984
44076
|
}
|
|
43985
|
-
function
|
|
43986
|
-
const
|
|
43987
|
-
if (
|
|
43988
|
-
|
|
43989
|
-
if (built === void 0) return [`${fileName} names the table builder ${builder}, which is no goose-staff harness command. The builders are ${[...tableBuilders.keys()].join(", ")}.`];
|
|
43990
|
-
return listTableMismatches(fileName, builder, tables, built);
|
|
44077
|
+
function readPlace(record) {
|
|
44078
|
+
const value = readValue$1(record, "place");
|
|
44079
|
+
if (typeof value !== "number") throw new Error(`${record.id}'s place should be a number.`);
|
|
44080
|
+
return value;
|
|
43991
44081
|
}
|
|
43992
|
-
function
|
|
43993
|
-
const { target } = resolveAddress(
|
|
43994
|
-
if (target.kind !== "block" || target.block.type !== "table") throw new Error(`${
|
|
44082
|
+
function readTableRows(address) {
|
|
44083
|
+
const { target } = resolveAddress(wiki, address);
|
|
44084
|
+
if (target.kind !== "block" || target.block.type !== "table") throw new Error(`${address} isn't a table block.`);
|
|
43995
44085
|
return target.block.rows.map((row) => {
|
|
43996
|
-
const [name] = row;
|
|
43997
|
-
if (name === void 0) throw new Error(`${
|
|
43998
|
-
return name;
|
|
44086
|
+
const [name, value] = row;
|
|
44087
|
+
if (name === void 0 || value === void 0) throw new Error(`${address} holds a row with fewer than 2 cells.`);
|
|
44088
|
+
return [name, value];
|
|
43999
44089
|
});
|
|
44000
44090
|
}
|
|
44001
|
-
function
|
|
44002
|
-
|
|
44091
|
+
function readListItems(address) {
|
|
44092
|
+
const { target } = resolveAddress(wiki, address);
|
|
44093
|
+
if (target.kind !== "block" || target.block.type !== "list") throw new Error(`${address} isn't a list block.`);
|
|
44094
|
+
return target.block.items;
|
|
44003
44095
|
}
|
|
44004
|
-
function
|
|
44005
|
-
|
|
44006
|
-
|
|
44007
|
-
|
|
44008
|
-
|
|
44009
|
-
|
|
44010
|
-
|
|
44011
|
-
return problems;
|
|
44096
|
+
function readDeclarations() {
|
|
44097
|
+
return {
|
|
44098
|
+
layers: new Map(readTableRows(`${wordsAddress}#layers`)),
|
|
44099
|
+
counts: readTableRows(`${wordsAddress}#counts`).map(([name]) => name),
|
|
44100
|
+
tables: readTableRows(`${wordsAddress}#tables`).map(([name]) => name),
|
|
44101
|
+
sources: readListItems(`${wordsAddress}#sources`)
|
|
44102
|
+
};
|
|
44012
44103
|
}
|
|
44013
|
-
function
|
|
44014
|
-
|
|
44015
|
-
return has(entry, "dig") ? readList$1(readField(entry, "dig"), "branches") : [];
|
|
44104
|
+
function listTableMismatches(address, builder, tables, built) {
|
|
44105
|
+
return [...tables.filter((table) => !built.includes(table)).map((table) => `${address} declares the table ${table}, which goose-staff harness ${builder} doesn't build. It builds ${built.join(", ")}.`), ...built.filter((table) => !tables.includes(table)).map((table) => `goose-staff harness ${builder} builds the table ${table}, which ${address} doesn't declare.`)];
|
|
44016
44106
|
}
|
|
44017
|
-
function
|
|
44018
|
-
const id = readText$3(entry, "id");
|
|
44019
|
-
const needs = has(entry, "needs") ? readTexts(entry, "needs") : [];
|
|
44020
|
-
const nexts = listBranches(entry).flatMap((branch) => readTexts(branch, "next"));
|
|
44107
|
+
function listDeclarationProblems(declarations) {
|
|
44021
44108
|
return [
|
|
44022
|
-
...
|
|
44023
|
-
...
|
|
44024
|
-
...
|
|
44109
|
+
...listRepeated([...declarations.layers.values()]).map((letter) => `${wordsAddress}#layers gives the letter ${letter} to two layers.`),
|
|
44110
|
+
...[...declarations.layers.values()].filter((letter) => !/^[A-Z]$/u.test(letter)).map((letter) => `${wordsAddress}#layers gives ${letter}, which isn't one capital letter.`),
|
|
44111
|
+
...listRepeated(declarations.sources).map((source) => `${wordsAddress}#sources lists the source ${source} twice.`),
|
|
44112
|
+
...listRepeated(declarations.counts).map((count) => `${wordsAddress}#counts lists the count ${count} twice.`),
|
|
44113
|
+
...listTableMismatches(`${wordsAddress}#tables`, retentionBuilder, declarations.tables, tableNames$1)
|
|
44025
44114
|
];
|
|
44026
44115
|
}
|
|
44027
|
-
function
|
|
44028
|
-
return
|
|
44029
|
-
}
|
|
44030
|
-
function listTableProblems(id, read, declarations) {
|
|
44031
|
-
const { builder, tables } = declarations;
|
|
44032
|
-
if (!tables.includes(read.slice(6))) return [`${id} reads ${read}, which is no table this map declares. Its tables are ${tables.join(", ")}.`];
|
|
44033
|
-
return builder === null ? [`${id} reads ${read}, but the map names no tableBuilder yet, so no table is built.`] : [];
|
|
44034
|
-
}
|
|
44035
|
-
function listReadProblems(entry, callIds, declarations) {
|
|
44036
|
-
const id = readText$3(entry, "id");
|
|
44037
|
-
return listReads$1(entry).flatMap((read) => {
|
|
44038
|
-
if (read.startsWith(tablePrefix)) return listTableProblems(id, read, declarations);
|
|
44039
|
-
return callIds.includes(read) ? [] : [`${id} reads ${read}, which is no call in catalog/calls. Name a call that has run, or list the read under callsToProve.`];
|
|
44040
|
-
});
|
|
44116
|
+
function listCallIds() {
|
|
44117
|
+
return readdirSync(callsFolder).filter((fileName) => fileName.endsWith(".json")).flatMap((fileName) => readList$1(readJson$1(join(callsFolder, fileName)), "calls")).map((call) => readText$3(call, "id"));
|
|
44041
44118
|
}
|
|
44042
|
-
function
|
|
44043
|
-
const
|
|
44044
|
-
|
|
44045
|
-
|
|
44046
|
-
|
|
44119
|
+
function readLeakLibrary() {
|
|
44120
|
+
const leaks = readLeakStages().flatMap((stage) => stage.leaks);
|
|
44121
|
+
const signals = readList$1(signals_default, "signals");
|
|
44122
|
+
return {
|
|
44123
|
+
leakIds: leaks.map((leak) => leak.id),
|
|
44124
|
+
strictSignal: new Map(leaks.flatMap((leak) => typeof leak.signal === "string" ? [[leak.signal, leak.id]] : [])),
|
|
44125
|
+
signalKeys: signals.map((signal) => readText$3(signal, "key")),
|
|
44126
|
+
offKeys: signals.filter((signal) => readText$3(signal, "scope") === "off").map((signal) => readText$3(signal, "key"))
|
|
44127
|
+
};
|
|
44047
44128
|
}
|
|
44048
|
-
function
|
|
44049
|
-
const
|
|
44050
|
-
|
|
44051
|
-
if (rules === void 0) return [];
|
|
44052
|
-
const problems = ["healthyWhen", "digWhen"].filter((field) => !number.test(readText$3(rules, field))).map((field) => `${id}'s ${field} holds no number.`);
|
|
44053
|
-
if (!has(entry, "countOn")) problems.push(`${id} gives a status and names no count in countOn.`);
|
|
44054
|
-
return problems;
|
|
44129
|
+
function readQuestionId(address) {
|
|
44130
|
+
const prefix = `${mapAddress}#`;
|
|
44131
|
+
return address.startsWith(prefix) ? address.slice(prefix.length) : null;
|
|
44055
44132
|
}
|
|
44056
|
-
function
|
|
44057
|
-
|
|
44058
|
-
|
|
44059
|
-
|
|
44060
|
-
|
|
44061
|
-
const branches = has(check, "costTestExempt") ? readList$1(check, "costTestExempt").map((exempt) => readText$3(exempt, "branch")) : [];
|
|
44062
|
-
const problems = [];
|
|
44063
|
-
if (isRequired && readText$3(entry, "tier") === "ground" && readField(entry, "givesStatus") !== true) problems.push(`${id} gives no status, so it can't require a cost test.`);
|
|
44064
|
-
if (!isRequired && branches.length > 0) problems.push(`${id} requires no cost test, so it lists no exempt branches.`);
|
|
44065
|
-
if (new Set(branches).size !== branches.length) problems.push(`${id} lists an exempt branch twice.`);
|
|
44066
|
-
return problems;
|
|
44133
|
+
function listAddressProblems(where, addresses, context) {
|
|
44134
|
+
return addresses.filter((address) => {
|
|
44135
|
+
const id = readQuestionId(address);
|
|
44136
|
+
return id === null || !context.questions.has(id);
|
|
44137
|
+
}).map((address) => `${where} names ${address}, which is no question of ${mapAddress}.`);
|
|
44067
44138
|
}
|
|
44068
|
-
function
|
|
44069
|
-
|
|
44070
|
-
const
|
|
44071
|
-
const
|
|
44072
|
-
|
|
44073
|
-
return [
|
|
44139
|
+
function listFieldProblems(question) {
|
|
44140
|
+
const { entry, record } = question;
|
|
44141
|
+
const tier = readWord$1(record, "tier");
|
|
44142
|
+
const fields = tierFields.get(tier);
|
|
44143
|
+
if (fields === void 0) return [`${entry} has the tier ${tier}, which is no tier.`];
|
|
44144
|
+
return [
|
|
44145
|
+
...fields.required.filter((field) => !has(record, field)).map((field) => `${entry} is a ${fields.name} with no ${field}.`),
|
|
44146
|
+
...fields.barred.filter((field) => has(record, field)).map((field) => `${entry} is a ${fields.name}, which holds no ${field}.`),
|
|
44147
|
+
...nonEmptyLists.filter((field) => has(record, field) && readWords$1(record, field).length === 0).map((field) => `${entry}'s ${field} is an empty list; give at least one.`),
|
|
44148
|
+
...tier === "deep" && has(record, "healthy-when") === has(record, "no-status") ? [`${entry} should hold status rules or no-status, and never both.`] : []
|
|
44149
|
+
];
|
|
44074
44150
|
}
|
|
44075
|
-
function listLayerProblems(
|
|
44076
|
-
const
|
|
44077
|
-
const layer =
|
|
44151
|
+
function listLayerProblems(question, layers) {
|
|
44152
|
+
const { entry, record } = question;
|
|
44153
|
+
const layer = readWord$1(record, "layer");
|
|
44078
44154
|
const letter = layers.get(layer);
|
|
44079
|
-
if (letter === void 0) return [`${
|
|
44080
|
-
return
|
|
44081
|
-
}
|
|
44082
|
-
function listSourceProblems(entry, sources) {
|
|
44083
|
-
if (!has(entry, "callsToProve")) return [];
|
|
44084
|
-
const id = readText$3(entry, "id");
|
|
44085
|
-
return readList$1(entry, "callsToProve").map((proof) => readText$3(proof, "provider")).filter((provider) => !sources.includes(provider)).map((provider) => `${id} has a call to prove on ${provider}, which is no source this map declares. Its sources are ${sources.join(", ")}.`);
|
|
44155
|
+
if (letter === void 0) return [`${entry} is in the layer ${layer}, which ${wordsAddress}#layers doesn't declare. Its layers are ${[...layers.keys()].join(", ")}.`];
|
|
44156
|
+
return entry.startsWith(letter) ? [] : [`${entry} is in the layer ${layer}, so its id should start with ${letter}.`];
|
|
44086
44157
|
}
|
|
44087
|
-
function
|
|
44088
|
-
|
|
44089
|
-
|
|
44090
|
-
|
|
44091
|
-
const earlier = rules.slice(0, index).map((before) => readText$3(before, "id"));
|
|
44092
|
-
const groundIds = rules.map((each) => readText$3(each, "id"));
|
|
44093
|
-
return [...readNumber(rule, "order") === index + 1 ? [] : [`${id} has the order ${String(readNumber(rule, "order"))}, where ${String(index + 1)} comes next.`], ...readTexts(rule, "needs").filter((need) => groundIds.includes(need) && !earlier.includes(need)).map((need) => `${id} needs ${need}, which runs after it.`)];
|
|
44158
|
+
function listReadProblems(question, context) {
|
|
44159
|
+
return readWords$1(question.record, "calls").flatMap((read) => {
|
|
44160
|
+
if (read.startsWith(tablePrefix)) return context.declarations.tables.includes(read.slice(6)) ? [] : [`${question.entry} reads ${read}, which is no table ${wordsAddress}#tables declares. Its tables are ${context.declarations.tables.join(", ")}.`];
|
|
44161
|
+
return context.callIds.includes(read) ? [] : [`${question.entry} reads ${read}, which is no call in catalog/calls. Name a call that has run, or add it to ${mapAddress}#reads-to-prove.`];
|
|
44094
44162
|
});
|
|
44095
44163
|
}
|
|
44096
|
-
function
|
|
44097
|
-
|
|
44098
|
-
|
|
44099
|
-
return {
|
|
44100
|
-
leakIds: leaks.map((leak) => readText$3(leak, "id")),
|
|
44101
|
-
strictSignal: new Map(leaks.flatMap((leak) => {
|
|
44102
|
-
const signal = readField(leak, "signal");
|
|
44103
|
-
return typeof signal === "string" ? [[signal, readText$3(leak, "id")]] : [];
|
|
44104
|
-
})),
|
|
44105
|
-
signalKeys: signals.map((signal) => readText$3(signal, "key")),
|
|
44106
|
-
offKeys: signals.filter((signal) => readText$3(signal, "scope") === "off").map((signal) => readText$3(signal, "key"))
|
|
44107
|
-
};
|
|
44164
|
+
function hasStatusRules(record) {
|
|
44165
|
+
if (readWord$1(record, "tier") === "ground" && readValue$1(record, "gives-status") !== true) return false;
|
|
44166
|
+
return has(record, "healthy-when");
|
|
44108
44167
|
}
|
|
44109
|
-
function
|
|
44110
|
-
|
|
44111
|
-
|
|
44112
|
-
|
|
44113
|
-
|
|
44114
|
-
|
|
44115
|
-
|
|
44168
|
+
function listStatusProblems(question) {
|
|
44169
|
+
const { entry, record } = question;
|
|
44170
|
+
if (!hasStatusRules(record)) return [];
|
|
44171
|
+
return [
|
|
44172
|
+
...["healthy-when", "dig-when"].filter((field) => !number.test(readWord$1(record, field))).map((field) => `${entry}'s ${field} holds no number.`),
|
|
44173
|
+
...["cost-test", "not-read"].filter((field) => !has(record, field)).map((field) => `${entry} gives a status and has no ${field}.`),
|
|
44174
|
+
...has(record, "counts") ? [] : [`${entry} gives a status and names no counts.`]
|
|
44175
|
+
];
|
|
44176
|
+
}
|
|
44177
|
+
function listCostTestProblems(question, context) {
|
|
44178
|
+
const { entry, record } = question;
|
|
44179
|
+
if (!has(record, "cost-test-required")) return [];
|
|
44180
|
+
const isRequired = readValue$1(record, "cost-test-required") === true;
|
|
44181
|
+
const exempt = context.exempts.filter((item) => item.fields.question === question.id);
|
|
44182
|
+
return [...isRequired && readWord$1(record, "tier") === "ground" && readValue$1(record, "gives-status") !== true ? [`${entry} gives no status, so it can't require a cost test.`] : [], ...!isRequired && exempt.length > 0 ? [`${entry} requires no cost test, so it has no dig branches exempt from one.`] : []];
|
|
44183
|
+
}
|
|
44184
|
+
function listCountProblems(question, counts) {
|
|
44185
|
+
const { entry, record } = question;
|
|
44186
|
+
if (!has(record, "counts")) return has(record, "count-note") ? [`${entry} has a count note and no counts.`] : [];
|
|
44187
|
+
const named = readWords$1(record, "counts");
|
|
44188
|
+
return [...named.length === 0 && !has(record, "count-note") ? [`${entry} reads no count and has no count note saying so.`] : [], ...named.filter((count) => !counts.includes(count)).map((count) => `${entry} counts on ${count}, which ${wordsAddress}#counts doesn't declare. The counts are ${counts.join(", ")}.`)];
|
|
44189
|
+
}
|
|
44190
|
+
function listOutputProblems(question) {
|
|
44191
|
+
return readWords$1(question.record, "output-kinds").filter((kind) => !outputKinds.includes(kind)).map((kind) => `${question.entry} files ${kind}, which is none of ${outputKinds.join(", ")}.`);
|
|
44192
|
+
}
|
|
44193
|
+
function listLinkProblems(question, library) {
|
|
44194
|
+
const { entry, record } = question;
|
|
44195
|
+
const same = readWords$1(record, "same");
|
|
44196
|
+
const dig = readWords$1(record, "dig");
|
|
44197
|
+
const differs = readWords$1(record, "differs");
|
|
44116
44198
|
const firstPass = [...same, ...differs];
|
|
44117
44199
|
return [
|
|
44118
|
-
...
|
|
44119
|
-
...
|
|
44120
|
-
...
|
|
44121
|
-
...same.filter((link) => differs.includes(link)).map((link) => `${id} links ${link} as both same and differs.`),
|
|
44200
|
+
...readWord$1(record, "tier") === "deep" && firstPass.length > 0 ? [`${entry} is a deep question, so it links leaks as dig, never same or differs.`] : [],
|
|
44201
|
+
...firstPass.filter((link) => dig.includes(link)).map((link) => `${entry} links ${link} as both a check and dig.`),
|
|
44202
|
+
...same.filter((link) => differs.includes(link)).map((link) => `${entry} links ${link} as both same and differs.`),
|
|
44122
44203
|
...[
|
|
44123
44204
|
...listRepeated(same),
|
|
44124
44205
|
...listRepeated(dig),
|
|
44125
44206
|
...listRepeated(differs)
|
|
44126
|
-
].map((link) => `${
|
|
44207
|
+
].map((link) => `${entry} links ${link} twice in one list.`),
|
|
44127
44208
|
...[...firstPass, ...dig].flatMap((link) => {
|
|
44128
|
-
if (leakId.test(link)) return library.leakIds.includes(link) ? [] : [`${
|
|
44129
|
-
if (!library.signalKeys.includes(link)) return [`${
|
|
44130
|
-
if (library.offKeys.includes(link)) return [`${
|
|
44209
|
+
if (leakId.test(link)) return library.leakIds.includes(link) ? [] : [`${entry} links the leak ${link}, which isn't in ${leakLibraryAddress}.`];
|
|
44210
|
+
if (!library.signalKeys.includes(link)) return [`${entry} links the signal ${link}, which isn't on the signal map.`];
|
|
44211
|
+
if (library.offKeys.includes(link)) return [`${entry} links the signal ${link}, which is switched off.`];
|
|
44131
44212
|
const leak = library.strictSignal.get(link);
|
|
44132
|
-
return leak === void 0 ? [] : [`${
|
|
44213
|
+
return leak === void 0 ? [] : [`${entry} links the signal ${link}; link the leak ${leak}, which owns it.`];
|
|
44133
44214
|
})
|
|
44134
44215
|
];
|
|
44135
44216
|
}
|
|
44136
|
-
function
|
|
44137
|
-
|
|
44217
|
+
function listQuestionProblems(question, context) {
|
|
44218
|
+
const { entry, record } = question;
|
|
44219
|
+
const fieldProblems = listFieldProblems(question);
|
|
44220
|
+
if (fieldProblems.length > 0) return fieldProblems;
|
|
44221
|
+
const needs = readWords$1(record, "needs");
|
|
44222
|
+
return [
|
|
44223
|
+
...questionId.test(entry) ? [] : [`${entry} isn't a layer's letter and a number.`],
|
|
44224
|
+
...listLayerProblems(question, context.declarations.layers),
|
|
44225
|
+
...listAddressProblems(`${entry}'s needs`, needs, context),
|
|
44226
|
+
...needs.includes(`${mapAddress}#${question.id}`) ? [`${entry} needs itself.`] : [],
|
|
44227
|
+
...context.branches.some((branch) => branch.fields.question === question.id) ? [] : [`${entry} has no branch in ${mapAddress}#branches.`],
|
|
44228
|
+
...listReadProblems(question, context),
|
|
44229
|
+
...listStatusProblems(question),
|
|
44230
|
+
...listCostTestProblems(question, context),
|
|
44231
|
+
...listCountProblems(question, context.declarations.counts),
|
|
44232
|
+
...listOutputProblems(question),
|
|
44233
|
+
...listLinkProblems(question, context.library)
|
|
44234
|
+
];
|
|
44235
|
+
}
|
|
44236
|
+
function listOwnerProblems(catalog, records, context) {
|
|
44237
|
+
return records.filter((record) => {
|
|
44238
|
+
const owner = record.fields.question;
|
|
44239
|
+
return typeof owner !== "string" || !context.questions.has(owner);
|
|
44240
|
+
}).map((record) => `${mapAddress}#${record.id} in ${catalog} belongs to no question of the map.`);
|
|
44241
|
+
}
|
|
44242
|
+
function listPlaceProblems(catalog, records) {
|
|
44243
|
+
return [...Map.groupBy(records, (record) => readWord$1(record, "question"))].flatMap(([owner, held]) => {
|
|
44244
|
+
const places = held.map(readPlace).toSorted((one, other) => one - other);
|
|
44245
|
+
return places.every((place, index) => place === index + 1) ? [] : [`${owner}'s ${catalog} are placed ${places.join(", ")}; number them from 1 with no gaps.`];
|
|
44246
|
+
});
|
|
44247
|
+
}
|
|
44248
|
+
function listBranchProblems(context) {
|
|
44249
|
+
return context.branches.flatMap((branch) => listAddressProblems(`${mapAddress}#${branch.id}`, readWords$1(branch, "next"), context));
|
|
44250
|
+
}
|
|
44251
|
+
function listProofProblems(context) {
|
|
44252
|
+
return context.proofs.map((proof) => readWord$1(proof, "provider")).filter((provider) => !context.declarations.sources.includes(provider)).map((provider) => `A read to prove names ${provider}, which ${wordsAddress}#sources doesn't list. Its sources are ${context.declarations.sources.join(", ")}.`);
|
|
44253
|
+
}
|
|
44254
|
+
function listOrderProblems(questions) {
|
|
44255
|
+
const rules = questions.filter((question) => readWord$1(question.record, "tier") === "ground").map((question) => {
|
|
44256
|
+
const order = readValue$1(question.record, "order");
|
|
44257
|
+
if (typeof order !== "number") throw new Error(`${question.entry}'s order should be a number.`);
|
|
44258
|
+
return {
|
|
44259
|
+
question,
|
|
44260
|
+
order
|
|
44261
|
+
};
|
|
44262
|
+
}).toSorted((one, other) => one.order - other.order);
|
|
44263
|
+
const ruleIds = rules.map((rule) => `${mapAddress}#${rule.question.id}`);
|
|
44264
|
+
return rules.flatMap((rule, index) => [...rule.order === index + 1 ? [] : [`${rule.question.entry} has the order ${String(rule.order)}, where ${String(index + 1)} comes next.`], ...readWords$1(rule.question.record, "needs").filter((need) => ruleIds.includes(need) && !ruleIds.slice(0, index).includes(need)).map((need) => `${rule.question.entry} needs ${need}, which runs after it.`)]);
|
|
44138
44265
|
}
|
|
44139
|
-
function
|
|
44140
|
-
|
|
44141
|
-
|
|
44142
|
-
|
|
44143
|
-
|
|
44144
|
-
problems: schemaProblems
|
|
44145
|
-
};
|
|
44146
|
-
const entries = readList$1(value, "entries");
|
|
44147
|
-
const fieldProblems = entries.flatMap(listFieldProblems);
|
|
44148
|
-
if (fieldProblems.length > 0) return {
|
|
44149
|
-
entries: [],
|
|
44150
|
-
problems: fieldProblems
|
|
44151
|
-
};
|
|
44152
|
-
const declarations = readDeclarations(value);
|
|
44153
|
-
const ids = entries.map((entry) => readText$3(entry, "id"));
|
|
44154
|
-
const name = basename(fileName, ".json");
|
|
44155
|
-
return {
|
|
44156
|
-
entries,
|
|
44157
|
-
problems: [
|
|
44158
|
-
...readText$3(value, "map") === name ? [] : [`${fileName} should say its map is ${name}.`],
|
|
44159
|
-
...listDeclarationProblems(fileName, declarations),
|
|
44160
|
-
...listBuilderProblems(fileName, declarations),
|
|
44161
|
-
...listRepeated(ids).map((id) => `${id} is the id of two entries.`),
|
|
44162
|
-
...entries.flatMap((entry) => [
|
|
44163
|
-
...listLayerProblems(entry, declarations.layers),
|
|
44164
|
-
...listTargetProblems(entry, ids),
|
|
44165
|
-
...listReadProblems(entry, callIds, declarations),
|
|
44166
|
-
...listSourceProblems(entry, declarations.sources),
|
|
44167
|
-
...listStatusProblems(entry),
|
|
44168
|
-
...listCostTestProblems(entry),
|
|
44169
|
-
...listCountProblems(entry, declarations.counts),
|
|
44170
|
-
...listLeakMapProblems(entry, library)
|
|
44171
|
-
]),
|
|
44172
|
-
...listOrderProblems(entries),
|
|
44173
|
-
...listBrandProblems(fileName)
|
|
44174
|
-
]
|
|
44175
|
-
};
|
|
44266
|
+
function listBrandProblems() {
|
|
44267
|
+
return [...readWikiFiles(readWikiFolder())].filter(([path]) => path.startsWith("retention/")).flatMap(([path, text]) => findBrandMarks(text).map((mark) => `${path} holds ${mark.found}, ${mark.name}. A map holds no brand's ids or findings.`));
|
|
44268
|
+
}
|
|
44269
|
+
function readMetaTables() {
|
|
44270
|
+
return readTableRows(metaTablesAddress).map(([name]) => name);
|
|
44176
44271
|
}
|
|
44177
|
-
function countTier(
|
|
44178
|
-
return String(
|
|
44272
|
+
function countTier(questions, tier) {
|
|
44273
|
+
return String(questions.filter((question) => readWord$1(question.record, "tier") === tier).length);
|
|
44179
44274
|
}
|
|
44180
|
-
function describeMap(
|
|
44181
|
-
const calls = new Set(
|
|
44182
|
-
|
|
44183
|
-
return `catalog/maps/${fileName} holds ${countTier(entries, "ground")} ground rules, ${countTier(entries, "first")} first-pass checks and ${countTier(entries, "deep")} deep questions. They name ${String(calls.size)} calls from catalog/calls and list ${String(toProve.length)} reads still to prove, with every id, layer, count, table and source resolved and no brand's own ids.`;
|
|
44275
|
+
function describeMap(questions, context) {
|
|
44276
|
+
const calls = new Set(questions.flatMap((question) => readWords$1(question.record, "calls")).filter((read) => !read.startsWith(tablePrefix)));
|
|
44277
|
+
return `${mapAddress} holds ${countTier(questions, "ground")} ground rules, ${countTier(questions, "first")} first-pass checks and ${countTier(questions, "deep")} deep questions, with ${String(context.branches.length)} branches. They name ${String(calls.size)} calls from catalog/calls and list ${String(context.proofs.length)} reads still to prove, with every id, layer, count, table and source resolved and no brand's own ids.`;
|
|
44184
44278
|
}
|
|
44185
44279
|
function run$18() {
|
|
44186
|
-
const
|
|
44187
|
-
|
|
44188
|
-
|
|
44189
|
-
|
|
44190
|
-
const checked = files.map((fileName) => ({
|
|
44191
|
-
fileName,
|
|
44192
|
-
...checkMap(fileName, callIds, library)
|
|
44280
|
+
const questions = listCatalogRecords(wiki, `${mapAddress}#questions`).map((record) => ({
|
|
44281
|
+
id: record.id,
|
|
44282
|
+
entry: readWord$1(record, "entry"),
|
|
44283
|
+
record
|
|
44193
44284
|
}));
|
|
44194
|
-
const
|
|
44195
|
-
|
|
44196
|
-
|
|
44197
|
-
|
|
44198
|
-
|
|
44199
|
-
}
|
|
44200
|
-
|
|
44285
|
+
const context = {
|
|
44286
|
+
questions: new Map(questions.map((question) => [question.id, question])),
|
|
44287
|
+
declarations: readDeclarations(),
|
|
44288
|
+
callIds: listCallIds(),
|
|
44289
|
+
library: readLeakLibrary(),
|
|
44290
|
+
branches: listCatalogRecords(wiki, `${mapAddress}#branches`),
|
|
44291
|
+
exempts: listCatalogRecords(wiki, `${mapAddress}#exempt-branches`),
|
|
44292
|
+
proofs: listCatalogRecords(wiki, `${mapAddress}#reads-to-prove`)
|
|
44293
|
+
};
|
|
44294
|
+
const benchmarks = listCatalogRecords(wiki, `${mapAddress}#benchmarks`);
|
|
44295
|
+
const metaTables = readMetaTables();
|
|
44296
|
+
const problems = [
|
|
44297
|
+
...questions.filter((question) => question.id !== question.entry.toLowerCase()).map((question) => `${mapAddress}#${question.id} holds the entry ${question.entry}; they should match.`),
|
|
44298
|
+
...listDeclarationProblems(context.declarations),
|
|
44299
|
+
...questions.flatMap((question) => listQuestionProblems(question, context)),
|
|
44300
|
+
...listOwnerProblems("branches", context.branches, context),
|
|
44301
|
+
...listOwnerProblems("benchmarks", benchmarks, context),
|
|
44302
|
+
...listOwnerProblems("reads-to-prove", context.proofs, context),
|
|
44303
|
+
...listOwnerProblems("exempt-branches", context.exempts, context),
|
|
44304
|
+
...listPlaceProblems("branches", context.branches),
|
|
44305
|
+
...listPlaceProblems("benchmarks", benchmarks),
|
|
44306
|
+
...listPlaceProblems("reads-to-prove", context.proofs),
|
|
44307
|
+
...listBranchProblems(context),
|
|
44308
|
+
...listProofProblems(context),
|
|
44309
|
+
...listOrderProblems(questions),
|
|
44310
|
+
...listBrandProblems(),
|
|
44311
|
+
...listTableMismatches(metaTablesAddress, "meta-tables", metaTables, tableNames)
|
|
44312
|
+
];
|
|
44313
|
+
if (problems.length > 0) throw new Error(`The retention map has problems:\n${problems.join("\n")}`);
|
|
44314
|
+
console.log(describeMap(questions, context));
|
|
44315
|
+
console.log(`${metaTablesAddress} names the ${String(metaTables.length)} tables goose-staff harness meta-tables builds.`);
|
|
44316
|
+
}
|
|
44317
|
+
var callsFolder, mapAddress, wordsAddress, metaTablesAddress, retentionBuilder, leakId, questionId, tablePrefix, number, outputKinds, checkFields, digFields, nonEmptyLists, tierFields, wiki;
|
|
44201
44318
|
var init_check_map = __esmMin((() => {
|
|
44202
44319
|
init_src();
|
|
44203
44320
|
init_wiki_folder();
|
|
@@ -44207,82 +44324,94 @@ var init_check_map = __esmMin((() => {
|
|
|
44207
44324
|
init_leak_library();
|
|
44208
44325
|
init_meta_tables_shape();
|
|
44209
44326
|
init_stack();
|
|
44210
|
-
|
|
44211
|
-
|
|
44212
|
-
|
|
44213
|
-
|
|
44214
|
-
|
|
44327
|
+
callsFolder = join(fromHarness(), "catalog", "calls");
|
|
44328
|
+
mapAddress = "retention/map";
|
|
44329
|
+
wordsAddress = "retention/words";
|
|
44330
|
+
metaTablesAddress = "meta-ads/counts-and-tables#tables";
|
|
44331
|
+
retentionBuilder = "customer-tables";
|
|
44215
44332
|
leakId = /^[A-Z]{2}[0-9]{1,2}$/u;
|
|
44333
|
+
questionId = /^[A-Z][0-9]{1,2}$/u;
|
|
44216
44334
|
tablePrefix = "table:";
|
|
44217
|
-
wikiTablesAddress = "meta-ads/counts-and-tables#tables";
|
|
44218
44335
|
number = /[0-9]/u;
|
|
44336
|
+
outputKinds = [
|
|
44337
|
+
"fact",
|
|
44338
|
+
"finding:leak",
|
|
44339
|
+
"finding:test",
|
|
44340
|
+
"finding:know",
|
|
44341
|
+
"ask"
|
|
44342
|
+
];
|
|
44343
|
+
checkFields = [
|
|
44344
|
+
"calls",
|
|
44345
|
+
"healthy-when",
|
|
44346
|
+
"dig-when",
|
|
44347
|
+
"cost-test",
|
|
44348
|
+
"cost-test-required",
|
|
44349
|
+
"not-read"
|
|
44350
|
+
];
|
|
44351
|
+
digFields = [
|
|
44352
|
+
"steps",
|
|
44353
|
+
"controls",
|
|
44354
|
+
"stop-when"
|
|
44355
|
+
];
|
|
44356
|
+
nonEmptyLists = [
|
|
44357
|
+
"reads",
|
|
44358
|
+
"writes",
|
|
44359
|
+
"calls",
|
|
44360
|
+
"method",
|
|
44361
|
+
"traps",
|
|
44362
|
+
"steps"
|
|
44363
|
+
];
|
|
44219
44364
|
tierFields = /* @__PURE__ */ new Map([
|
|
44220
44365
|
["ground", {
|
|
44221
44366
|
name: "ground rule",
|
|
44222
44367
|
required: [
|
|
44223
44368
|
"order",
|
|
44224
|
-
"
|
|
44225
|
-
"
|
|
44226
|
-
"
|
|
44227
|
-
"minData",
|
|
44369
|
+
"gives-status",
|
|
44370
|
+
"counts",
|
|
44371
|
+
"min-data",
|
|
44228
44372
|
"writes",
|
|
44229
44373
|
"rule",
|
|
44230
|
-
|
|
44374
|
+
...checkFields,
|
|
44231
44375
|
"memory",
|
|
44232
|
-
|
|
44233
|
-
"
|
|
44234
|
-
"output"
|
|
44376
|
+
...digFields,
|
|
44377
|
+
"size-how"
|
|
44235
44378
|
],
|
|
44236
|
-
barred: [
|
|
44237
|
-
"calls",
|
|
44238
|
-
"method",
|
|
44239
|
-
"branches",
|
|
44240
|
-
"controls",
|
|
44241
|
-
"stopWhen",
|
|
44242
|
-
"status",
|
|
44243
|
-
"noStatus"
|
|
44244
|
-
]
|
|
44379
|
+
barred: ["method", "no-status"]
|
|
44245
44380
|
}],
|
|
44246
44381
|
["first", {
|
|
44247
44382
|
name: "first-pass check",
|
|
44248
44383
|
required: [
|
|
44249
|
-
"
|
|
44250
|
-
"
|
|
44251
|
-
|
|
44252
|
-
"check",
|
|
44384
|
+
"counts",
|
|
44385
|
+
"min-data",
|
|
44386
|
+
...checkFields,
|
|
44253
44387
|
"memory",
|
|
44254
|
-
|
|
44255
|
-
"
|
|
44256
|
-
"output"
|
|
44388
|
+
...digFields,
|
|
44389
|
+
"size-how"
|
|
44257
44390
|
],
|
|
44258
44391
|
barred: [
|
|
44259
44392
|
"order",
|
|
44260
|
-
"
|
|
44393
|
+
"gives-status",
|
|
44261
44394
|
"writes",
|
|
44262
44395
|
"rule",
|
|
44263
|
-
"calls",
|
|
44264
44396
|
"method",
|
|
44265
|
-
"
|
|
44266
|
-
"controls",
|
|
44267
|
-
"stopWhen",
|
|
44268
|
-
"status",
|
|
44269
|
-
"noStatus"
|
|
44397
|
+
"no-status"
|
|
44270
44398
|
]
|
|
44271
44399
|
}],
|
|
44272
44400
|
["deep", {
|
|
44273
44401
|
name: "deep question",
|
|
44274
|
-
required: ["method"
|
|
44402
|
+
required: ["method"],
|
|
44275
44403
|
barred: [
|
|
44276
44404
|
"order",
|
|
44277
|
-
"
|
|
44405
|
+
"gives-status",
|
|
44278
44406
|
"writes",
|
|
44279
44407
|
"rule",
|
|
44280
|
-
"
|
|
44281
|
-
"
|
|
44282
|
-
"
|
|
44408
|
+
"cost-test-required",
|
|
44409
|
+
"memory",
|
|
44410
|
+
"steps"
|
|
44283
44411
|
]
|
|
44284
44412
|
}]
|
|
44285
44413
|
]);
|
|
44414
|
+
wiki = loadWiki(readWikiFiles(readWikiFolder()));
|
|
44286
44415
|
}));
|
|
44287
44416
|
// src/harness/check-skills.ts
|
|
44288
44417
|
var check_skills_exports = /* @__PURE__ */ __exportAll({ run: () => run$17 });
|
|
@@ -44481,7 +44610,7 @@ function checkContents(page) {
|
|
|
44481
44610
|
function listLinks(page) {
|
|
44482
44611
|
return page.body.flatMap((text, index) => {
|
|
44483
44612
|
if (page.isCode[index] === true) return [];
|
|
44484
|
-
return [...text.replaceAll(codeSpanPattern$1, "").matchAll(linkPattern$1)].map((found) => found[1]).filter((target) => target !== void 0).filter((target) => !webAddressPattern.test(target)
|
|
44613
|
+
return [...text.replaceAll(codeSpanPattern$1, "").matchAll(linkPattern$1)].map((found) => found[1]).filter((target) => target !== void 0).filter((target) => !webAddressPattern.test(target)).map((target) => ({
|
|
44485
44614
|
line: page.firstLine + index,
|
|
44486
44615
|
target
|
|
44487
44616
|
}));
|
|
@@ -44585,7 +44714,7 @@ function run$17() {
|
|
|
44585
44714
|
console.log(`All ${String(skills.folders.length)} skills name their folder, describe themselves and keep to ${String(skillWordLimit)} words. No paragraph or list item in them or in the ${String(agentPaths.length)} agent files runs over ${String(lineWordLimit)} words. Each of the ${String(longReferences.length)} reference files over ${String(contentsLineLimit)} lines, of ${String(references.length)}, links every section in its contents. All ${String(linkCount)} links to files and headings resolve.`);
|
|
44586
44715
|
}
|
|
44587
44716
|
}
|
|
44588
|
-
var stackRoot, stackMark$1, skillsFolder, agentsFolder, skillWordLimit, lineWordLimit, contentsLineLimit, contentsTitle, contentsHeadingWithin,
|
|
44717
|
+
var stackRoot, stackMark$1, skillsFolder, agentsFolder, skillWordLimit, lineWordLimit, contentsLineLimit, contentsTitle, contentsHeadingWithin, fenceOpenPattern, headingPattern, listMarkerPattern, quoteMarkerPattern, codeSpanPattern$1, linkPattern$1, webAddressPattern, pages;
|
|
44589
44718
|
var init_check_skills = __esmMin((() => {
|
|
44590
44719
|
init_stack();
|
|
44591
44720
|
stackRoot = readStackFolder();
|
|
@@ -44597,7 +44726,6 @@ var init_check_skills = __esmMin((() => {
|
|
|
44597
44726
|
contentsLineLimit = 100;
|
|
44598
44727
|
contentsTitle = "Contents";
|
|
44599
44728
|
contentsHeadingWithin = 15;
|
|
44600
|
-
clientMemoryFolder = "proactive-clients/";
|
|
44601
44729
|
fenceOpenPattern = /^\s*(`{3,}|~{3,})(.*)$/;
|
|
44602
44730
|
headingPattern = /^ {0,3}(#{1,6})\s+(.+?)\s*$/;
|
|
44603
44731
|
listMarkerPattern = /^\s*(?:[-*+]|\d+[.)])(?:\s|$)/;
|
|
@@ -45308,7 +45436,7 @@ function checkConfirmProof(verdict, proof) {
|
|
|
45308
45436
|
check: []
|
|
45309
45437
|
};
|
|
45310
45438
|
return {
|
|
45311
|
-
mustFix: verdict === "fixed" ? listProofProblems("proof", proof) : applyRules(leakRules, "The proof", proof),
|
|
45439
|
+
mustFix: verdict === "fixed" ? listProofProblems$1("proof", proof) : applyRules(leakRules, "The proof", proof),
|
|
45312
45440
|
check: []
|
|
45313
45441
|
};
|
|
45314
45442
|
}
|
|
@@ -46677,7 +46805,7 @@ function readArguments$6(values) {
|
|
|
46677
46805
|
const edits = Number(get("--edits"));
|
|
46678
46806
|
if (!Number.isFinite(budgetUsd) || budgetUsd <= 0) throw new Error("--budget-usd must be a positive number of dollars.");
|
|
46679
46807
|
if (!Number.isInteger(edits) || edits < 1 || edits > 10) throw new Error("--edits must be a whole number from 1 to 10.");
|
|
46680
|
-
if (!clientFactsModes.includes(get("--client-facts"))) throw new Error("--client-facts must be skip or list: the dream can't reach
|
|
46808
|
+
if (!clientFactsModes.includes(get("--client-facts"))) throw new Error("--client-facts must be skip or list: the dream can't reach a brand's wiki.");
|
|
46681
46809
|
const claude = get("--claude");
|
|
46682
46810
|
if (!isAbsolute(claude) || !existsSync(claude)) throw new Error(`--claude must be the full path of the Claude Code to run, and ${claude} isn't one. A scheduled run can find a different claude on its path than your terminal does.`);
|
|
46683
46811
|
return {
|
|
@@ -47898,31 +48026,7 @@ function readGroups$1() {
|
|
|
47898
48026
|
return new Map(readList$1(signal_groups_default, "groups").map((group) => [readText$3(group, "key"), readList$1(group, "vendors").map((vendor) => readText$3(vendor, "key"))]));
|
|
47899
48027
|
}
|
|
47900
48028
|
function readMaps() {
|
|
47901
|
-
|
|
47902
|
-
map: basename(fileName, ".json"),
|
|
47903
|
-
file: `harness/catalog/maps/${fileName}`,
|
|
47904
|
-
entries: readList$1(readJson$1(join(mapsFolder, fileName)), "entries").map((entry) => {
|
|
47905
|
-
const links = readOptional(entry, "leakMap");
|
|
47906
|
-
const check = readOptional(entry, "check");
|
|
47907
|
-
return {
|
|
47908
|
-
id: readText$3(entry, "id"),
|
|
47909
|
-
tier: readText$3(entry, "tier"),
|
|
47910
|
-
title: readText$3(entry, "title"),
|
|
47911
|
-
rule: check === null ? null : readOptionalText(check, "digWhen"),
|
|
47912
|
-
same: links === null ? [] : readTexts(links, "same"),
|
|
47913
|
-
dig: links === null ? [] : readTexts(links, "dig"),
|
|
47914
|
-
differs: links === null || readOptional(links, "differs") === null ? [] : readTexts(links, "differs")
|
|
47915
|
-
};
|
|
47916
|
-
})
|
|
47917
|
-
}));
|
|
47918
|
-
const pages = readWikiMapLinks().map((page) => ({
|
|
47919
|
-
...page,
|
|
47920
|
-
entries: page.entries.map((entry) => ({
|
|
47921
|
-
...entry,
|
|
47922
|
-
rule: readOptionalText(entry, "rule")
|
|
47923
|
-
}))
|
|
47924
|
-
}));
|
|
47925
|
-
return [...files, ...pages].toSorted((one, other) => one.map.localeCompare(other.map));
|
|
48029
|
+
return readWikiMapLinks().toSorted((one, other) => one.map.localeCompare(other.map));
|
|
47926
48030
|
}
|
|
47927
48031
|
function readConfigValue() {
|
|
47928
48032
|
const value = readJson$1(configFile);
|
|
@@ -48112,7 +48216,7 @@ function buildLeakMap() {
|
|
|
48112
48216
|
if (finder.id !== expected) problems.push(`${finder.id} should be ${expected}, after its lowest signal number.`);
|
|
48113
48217
|
}
|
|
48114
48218
|
for (const signal of signals) if (!placed.has(signal.key)) problems.push(`The signal ${signal.key} isn't on the leak map: add it to a leak's overlaps or to signalFinders.`);
|
|
48115
|
-
problems.push(...listRepeated
|
|
48219
|
+
problems.push(...listRepeated(config.signalFinders.map((finder) => finder.id)).map((id) => `${id} is the id of two signal finders.`));
|
|
48116
48220
|
const foldedInto = /* @__PURE__ */ new Map();
|
|
48117
48221
|
for (const fold of config.folds) {
|
|
48118
48222
|
if (!leakById.has(fold.into)) problems.push(`A fold goes into ${fold.into}, which isn't in ${leakLibraryAddress}.`);
|
|
@@ -48160,7 +48264,7 @@ function buildLeakMap() {
|
|
|
48160
48264
|
});
|
|
48161
48265
|
links.set(finderId, list);
|
|
48162
48266
|
}
|
|
48163
|
-
problems.push(...listRepeated
|
|
48267
|
+
problems.push(...listRepeated(config.overlaps.map((overlap) => overlap.leak)).map((id) => `${id} has two overlaps entries; give it one.`), ...listRepeated(config.settled.map((item) => item.leak)).map((id) => `${id} has two settled notes; give it one.`), ...listRepeated(config.folds.map((fold) => fold.into)).map((id) => `${id} takes in leaks in two folds; give it one.`));
|
|
48164
48268
|
for (const { map } of maps) if (!config.mapNames.has(map)) problems.push(`The map ${map} has no name in mapNames.`);
|
|
48165
48269
|
const knownIds = new Set(leakById.keys());
|
|
48166
48270
|
for (const item of config.settled) {
|
|
@@ -48344,20 +48448,19 @@ function buildLeakMap() {
|
|
|
48344
48448
|
else if (result.finders.length === 0) problems.push(`The preset ${preset.key} picks no finder.`);
|
|
48345
48449
|
if ("preset" in parseSelector(preset.select).tokens) problems.push(`The preset ${preset.key} names another preset.`);
|
|
48346
48450
|
}
|
|
48347
|
-
problems.push(...listRepeated
|
|
48451
|
+
problems.push(...listRepeated(config.presets.map((preset) => preset.key)).map((key) => `${key} is the key of two presets.`));
|
|
48348
48452
|
return {
|
|
48349
48453
|
problems,
|
|
48350
48454
|
map
|
|
48351
48455
|
};
|
|
48352
48456
|
}
|
|
48353
|
-
var harnessFolder,
|
|
48457
|
+
var harnessFolder, configFile, schemaFile, leaksSchemaFile, lanes, vendorSources, publicSources, howToRun;
|
|
48354
48458
|
var init_leak_map_build = __esmMin((() => {
|
|
48355
48459
|
init_json_schema();
|
|
48356
48460
|
init_leak_library();
|
|
48357
48461
|
init_leak_selector();
|
|
48358
48462
|
init_stack();
|
|
48359
48463
|
harnessFolder = fromHarness();
|
|
48360
|
-
mapsFolder = join(harnessFolder, "catalog", "maps");
|
|
48361
48464
|
configFile = join(harnessFolder, "catalog", "leak-map.json");
|
|
48362
48465
|
schemaFile = join(harnessFolder, "schema", "leak-map.schema.json");
|
|
48363
48466
|
leaksSchemaFile = join(harnessFolder, "schema", "leaks.schema.json");
|
|
@@ -53234,7 +53337,7 @@ var init_commands$1 = __esmMin((() => {
|
|
|
53234
53337
|
["check-map", {
|
|
53235
53338
|
subcommands: [],
|
|
53236
53339
|
usage: "",
|
|
53237
|
-
about: "Checks the
|
|
53340
|
+
about: "Checks the retention map in the knowledge wiki, and the Meta tables it shares a check with.",
|
|
53238
53341
|
flags: [],
|
|
53239
53342
|
load: () => Promise.resolve().then(() => (init_check_map(), check_map_exports))
|
|
53240
53343
|
}],
|
|
@@ -53404,7 +53507,7 @@ var init_commands$1 = __esmMin((() => {
|
|
|
53404
53507
|
load: () => Promise.resolve().then(() => (init_watch_page(), watch_page_exports))
|
|
53405
53508
|
}]
|
|
53406
53509
|
]);
|
|
53407
|
-
})), KNOWLEDGE_SYNC_PREFIX, wikiPath, pageAddress, wikiAddress, blockAddress, commit, hash, fieldPath, knowledgeFileChange, knowledgeEditKinds, knowledgeEditor, knowledgeChangeStates, knowledgeChange, knowledgePublished, knowledgeChangesAnswer, knowledgeSyncRefusal, knowledgeFillStates, pageFill, pageSummary, pendingSummary, snapshot, editErrors, savedEdit;
|
|
53510
|
+
})), KNOWLEDGE_SYNC_PREFIX, wikiPath, pageAddress, wikiAddress, blockAddress, commit, hash, fieldPath, knowledgeFileChange, knowledgeEditKinds, knowledgeEditor, knowledgeChangeStates, knowledgeChange, knowledgePublished, knowledgeChangesAnswer, knowledgeSyncRefusal, knowledgeFillStates, pageFill, pageSummary, pendingSummary, snapshot, lever, editErrors, savedEdit;
|
|
53408
53511
|
var init_knowledge = __esmMin((() => {
|
|
53409
53512
|
init_zod();
|
|
53410
53513
|
init_call_access();
|
|
@@ -53512,6 +53615,15 @@ var init_knowledge = __esmMin((() => {
|
|
|
53512
53615
|
commit,
|
|
53513
53616
|
publishedAt: date$1()
|
|
53514
53617
|
});
|
|
53618
|
+
lever = object({
|
|
53619
|
+
id: string(),
|
|
53620
|
+
title: string(),
|
|
53621
|
+
summary: string(),
|
|
53622
|
+
guides: array(object({
|
|
53623
|
+
label: string(),
|
|
53624
|
+
to: wikiAddress
|
|
53625
|
+
})).describe("The pages, stages and trees that answer it, in order. Empty when no guide exists yet.")
|
|
53626
|
+
});
|
|
53515
53627
|
editErrors = {
|
|
53516
53628
|
KNOWLEDGE_STALE: {
|
|
53517
53629
|
status: 409,
|
|
@@ -53531,6 +53643,7 @@ var init_knowledge = __esmMin((() => {
|
|
|
53531
53643
|
});
|
|
53532
53644
|
readCall("people").input(object({}).strict()).output(object({
|
|
53533
53645
|
snapshot: snapshot.nullable(),
|
|
53646
|
+
levers: array(lever).describe("What a staffer can fix, from start/index, in the order Knowledge shows them."),
|
|
53534
53647
|
areas: array(object({
|
|
53535
53648
|
area: string(),
|
|
53536
53649
|
pages: array(pageSummary)
|