@indigoai-us/hq-cli 5.345.247 → 5.345.250
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/CHANGELOG.md +95 -0
- package/assets/lanes-hooks/hq-lanes-drain.sh +1 -1
- package/contracts/host-canary-release.json +14 -0
- package/dist/command-catalog.generated.d.ts +1198 -0
- package/dist/command-catalog.generated.js +1476 -0
- package/dist/command-registration-plan.d.ts +6 -0
- package/dist/command-registration-plan.js +1 -0
- package/dist/commands/core-job-run-native.js +4 -0
- package/dist/commands/core-knowledge-prefs.d.ts +1 -1
- package/dist/commands/core-knowledge-prefs.js +1 -16
- package/dist/commands/core.js +0 -2
- package/dist/commands/daemon.js +21 -0
- package/dist/commands/lanes-hold.js +7 -7
- package/dist/commands/lanes-resume.js +2 -2
- package/dist/commands/lanes-review.js +1 -1
- package/dist/commands/lanes-session-start.d.ts +1 -1
- package/dist/commands/lanes-session-start.js +3 -3
- package/dist/commands/lanes-shared.d.ts +1 -1
- package/dist/commands/lanes.d.ts +2 -2
- package/dist/commands/lanes.js +50 -50
- package/dist/commands/mesh.d.ts +25 -0
- package/dist/commands/mesh.js +48 -8
- package/dist/commands/ontology-graph.d.ts +63 -0
- package/dist/commands/ontology-graph.js +470 -0
- package/dist/commands/sync-core.js +6 -0
- package/dist/fast-scaffold.js +1 -3
- package/dist/hq-cloud-sync-runner/bin/sync-runner.js +281 -256
- package/dist/hq-cloud-sync-runner/package.json +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.js +48 -1
- package/dist/lanes-monitor-check-argv.d.ts +1 -1
- package/dist/lanes-monitor-check-argv.js +1 -1
- package/dist/lanes-monitor-check-fast.d.ts +1 -1
- package/dist/lanes-monitor-check-fast.js +1 -1
- package/dist/lanes-session-start-argv.d.ts +1 -1
- package/dist/lanes-session-start-argv.js +1 -1
- package/dist/lib/capacity/sign-in.d.ts +1 -1
- package/dist/lib/capacity/sign-in.js +1 -1
- package/dist/lib/daemon/hook-requests-conduct-link.js +2 -2
- package/dist/lib/daemon/installed-cli-restart.d.ts +57 -0
- package/dist/lib/daemon/installed-cli-restart.js +114 -0
- package/dist/lib/daemon/lanes-monitor-state.d.ts +2 -2
- package/dist/lib/daemon/lanes-monitor-state.js +2 -2
- package/dist/lib/daemon/legacy-journal-gate.d.ts +32 -0
- package/dist/lib/daemon/legacy-journal-gate.js +102 -0
- package/dist/lib/daemon/machine-checks.d.ts +7 -0
- package/dist/lib/daemon/machine-checks.js +10 -0
- package/dist/lib/daemon/merge-sections.d.ts +3 -3
- package/dist/lib/daemon/merge-sections.js +7 -7
- package/dist/lib/daemon/remote-control-pools.js +1 -1
- package/dist/lib/daemon/run.d.ts +3 -1
- package/dist/lib/daemon/run.js +49 -6
- package/dist/lib/daemon/state-file.d.ts +1 -1
- package/dist/lib/daemon/state-file.js +1 -1
- package/dist/lib/flag-registry-worker-source.generated.d.ts +1 -1
- package/dist/lib/flag-registry-worker-source.generated.js +1 -1
- package/dist/lib/flag-snapshot-file.d.ts +2 -0
- package/dist/lib/flag-snapshot-file.js +118 -48
- package/dist/lib/hook-engine/canary-gate.d.ts +57 -3
- package/dist/lib/hook-engine/canary-gate.js +138 -6
- package/dist/lib/hook-engine/coverage.d.ts +82 -13
- package/dist/lib/hook-engine/coverage.js +214 -18
- package/dist/lib/hook-engine/registration-identity.d.ts +5 -0
- package/dist/lib/hook-engine/registration-identity.js +1 -1
- package/dist/lib/hook-engine/resolve.d.ts +23 -0
- package/dist/lib/hook-engine/resolve.js +48 -1
- package/dist/lib/hook-engine/stable-heal.d.ts +87 -0
- package/dist/lib/hook-engine/stable-heal.js +214 -0
- package/dist/lib/hot-channels/graph-context.d.ts +105 -0
- package/dist/lib/hot-channels/graph-context.js +380 -0
- package/dist/lib/hot-channels/signals-pass.js +27 -1
- package/dist/lib/lanes/claude-credential.d.ts +1 -1
- package/dist/lib/lanes/claude-credential.js +1 -1
- package/dist/lib/lanes/delivery-core.d.ts +1 -1
- package/dist/lib/lanes/delivery-core.js +1 -1
- package/dist/lib/lanes/delivery.d.ts +10 -10
- package/dist/lib/lanes/delivery.js +8 -8
- package/dist/lib/lanes/dropbox.d.ts +1 -1
- package/dist/lib/lanes/dropbox.js +1 -1
- package/dist/lib/lanes/hooks-install.js +2 -2
- package/dist/lib/lanes/index.d.ts +1 -1
- package/dist/lib/lanes/index.js +1 -1
- package/dist/lib/lanes/monitor.js +1 -1
- package/dist/lib/lanes/quota-notice.js +1 -1
- package/dist/lib/lanes/quota.d.ts +1 -1
- package/dist/lib/lanes/quota.js +1 -1
- package/dist/lib/lanes/repo-merge-hold.d.ts +2 -2
- package/dist/lib/lanes/repo-merge-hold.js +2 -2
- package/dist/lib/lanes/spawn.d.ts +4 -4
- package/dist/lib/lanes/spawn.js +5 -5
- package/dist/lib/mesh/live/company-flag-refresh.d.ts +61 -0
- package/dist/lib/mesh/live/company-flag-refresh.js +159 -0
- package/dist/lib/mesh/live/company-reporting-gaps.d.ts +61 -0
- package/dist/lib/mesh/live/company-reporting-gaps.js +238 -0
- package/dist/lib/mesh/live/daemon/duplicate-unit.d.ts +156 -0
- package/dist/lib/mesh/live/daemon/duplicate-unit.js +616 -0
- package/dist/lib/mesh/live/daemon/run.d.ts +13 -0
- package/dist/lib/mesh/live/daemon/run.js +35 -2
- package/dist/lib/mesh/live/direct-drain.js +1 -1
- package/dist/lib/mesh/live/emit.d.ts +3 -0
- package/dist/lib/mesh/live/emit.js +32 -9
- package/dist/lib/mesh/live/flush.d.ts +3 -0
- package/dist/lib/mesh/live/flush.js +115 -32
- package/dist/lib/mesh/live/liveness-carry.d.ts +1 -1
- package/dist/lib/mesh/live/liveness-carry.js +1 -1
- package/dist/lib/mesh/live/reporting-privacy.d.ts +119 -3
- package/dist/lib/mesh/live/reporting-privacy.js +235 -11
- package/dist/lib/mesh/live/spool.d.ts +17 -2
- package/dist/lib/mesh/live/spool.js +22 -6
- package/dist/lib/ontology-graph/legacy/coverage.d.ts +67 -0
- package/dist/lib/ontology-graph/legacy/coverage.js +192 -0
- package/dist/lib/ontology-graph/legacy/index.d.ts +199 -0
- package/dist/lib/ontology-graph/legacy/index.js +1150 -0
- package/dist/lib/ontology-graph/legacy/parse.d.ts +49 -0
- package/dist/lib/ontology-graph/legacy/parse.js +126 -0
- package/dist/lib/ontology-graph/legacy/report.d.ts +14 -0
- package/dist/lib/ontology-graph/legacy/report.js +254 -0
- package/dist/lib/ontology-graph/legacy/verb-map.d.ts +35 -0
- package/dist/lib/ontology-graph/legacy/verb-map.js +84 -0
- package/dist/lib/ontology-graph/lint/checks.d.ts +140 -0
- package/dist/lib/ontology-graph/lint/checks.js +717 -0
- package/dist/lib/ontology-graph/lint/coverage.d.ts +106 -0
- package/dist/lib/ontology-graph/lint/coverage.js +241 -0
- package/dist/lib/ontology-graph/lint/daily-job.d.ts +259 -0
- package/dist/lib/ontology-graph/lint/daily-job.js +595 -0
- package/dist/lib/ontology-graph/lint/index.d.ts +65 -0
- package/dist/lib/ontology-graph/lint/index.js +176 -0
- package/dist/lib/ontology-graph/model/files.d.ts +20 -0
- package/dist/lib/ontology-graph/model/files.js +89 -0
- package/dist/lib/ontology-graph/model/index.d.ts +65 -0
- package/dist/lib/ontology-graph/model/index.js +100 -0
- package/dist/lib/ontology-graph/model/pass-tasks.d.ts +156 -0
- package/dist/lib/ontology-graph/model/pass-tasks.js +345 -0
- package/dist/lib/ontology-graph/model/pass.d.ts +109 -0
- package/dist/lib/ontology-graph/model/pass.js +958 -0
- package/dist/lib/ontology-graph/model/runner.d.ts +50 -0
- package/dist/lib/ontology-graph/model/runner.js +160 -0
- package/dist/lib/ontology-graph/model/step.d.ts +197 -0
- package/dist/lib/ontology-graph/model/step.js +526 -0
- package/dist/lib/ontology-graph/model/tasks.d.ts +183 -0
- package/dist/lib/ontology-graph/model/tasks.js +349 -0
- package/dist/lib/ontology-graph/not-implemented.d.ts +5 -0
- package/dist/lib/ontology-graph/not-implemented.js +8 -0
- package/dist/lib/ontology-graph/org/compare.d.ts +28 -0
- package/dist/lib/ontology-graph/org/compare.js +239 -0
- package/dist/lib/ontology-graph/org/derive.d.ts +67 -0
- package/dist/lib/ontology-graph/org/derive.js +359 -0
- package/dist/lib/ontology-graph/org/index.d.ts +102 -0
- package/dist/lib/ontology-graph/org/index.js +630 -0
- package/dist/lib/ontology-graph/org/load.d.ts +31 -0
- package/dist/lib/ontology-graph/org/load.js +476 -0
- package/dist/lib/ontology-graph/org/role.d.ts +38 -0
- package/dist/lib/ontology-graph/org/role.js +268 -0
- package/dist/lib/ontology-graph/org/structure.d.ts +63 -0
- package/dist/lib/ontology-graph/org/structure.js +437 -0
- package/dist/lib/ontology-graph/org/text.d.ts +97 -0
- package/dist/lib/ontology-graph/org/text.js +321 -0
- package/dist/lib/ontology-graph/org/types.d.ts +457 -0
- package/dist/lib/ontology-graph/org/types.js +80 -0
- package/dist/lib/ontology-graph/pages/index.d.ts +64 -0
- package/dist/lib/ontology-graph/pages/index.js +193 -0
- package/dist/lib/ontology-graph/pages/render.d.ts +144 -0
- package/dist/lib/ontology-graph/pages/render.js +688 -0
- package/dist/lib/ontology-graph/proposals/apply.d.ts +109 -0
- package/dist/lib/ontology-graph/proposals/apply.js +468 -0
- package/dist/lib/ontology-graph/proposals/group.d.ts +63 -0
- package/dist/lib/ontology-graph/proposals/group.js +232 -0
- package/dist/lib/ontology-graph/proposals/index.d.ts +173 -0
- package/dist/lib/ontology-graph/proposals/index.js +474 -0
- package/dist/lib/ontology-graph/proposals/model.d.ts +162 -0
- package/dist/lib/ontology-graph/proposals/model.js +196 -0
- package/dist/lib/ontology-graph/proposals/org-chart.d.ts +82 -0
- package/dist/lib/ontology-graph/proposals/org-chart.js +340 -0
- package/dist/lib/ontology-graph/read/brief.d.ts +26 -0
- package/dist/lib/ontology-graph/read/brief.js +254 -0
- package/dist/lib/ontology-graph/read/graph-index.d.ts +76 -0
- package/dist/lib/ontology-graph/read/graph-index.js +198 -0
- package/dist/lib/ontology-graph/read/index.d.ts +59 -0
- package/dist/lib/ontology-graph/read/index.js +803 -0
- package/dist/lib/ontology-graph/read/member.d.ts +7 -0
- package/dist/lib/ontology-graph/read/member.js +34 -0
- package/dist/lib/ontology-graph/read/names.d.ts +49 -0
- package/dist/lib/ontology-graph/read/names.js +297 -0
- package/dist/lib/ontology-graph/read/reader-setting.d.ts +19 -0
- package/dist/lib/ontology-graph/read/reader-setting.js +62 -0
- package/dist/lib/ontology-graph/read/test-graph.d.ts +37 -0
- package/dist/lib/ontology-graph/read/test-graph.js +150 -0
- package/dist/lib/ontology-graph/replay/buffered-store.d.ts +33 -0
- package/dist/lib/ontology-graph/replay/buffered-store.js +50 -0
- package/dist/lib/ontology-graph/replay/config.d.ts +41 -0
- package/dist/lib/ontology-graph/replay/config.js +105 -0
- package/dist/lib/ontology-graph/replay/engine.d.ts +146 -0
- package/dist/lib/ontology-graph/replay/engine.js +1240 -0
- package/dist/lib/ontology-graph/replay/extractors.d.ts +59 -0
- package/dist/lib/ontology-graph/replay/extractors.js +1555 -0
- package/dist/lib/ontology-graph/replay/index.d.ts +91 -0
- package/dist/lib/ontology-graph/replay/index.js +220 -0
- package/dist/lib/ontology-graph/replay/listing-manifest.d.ts +66 -0
- package/dist/lib/ontology-graph/replay/listing-manifest.js +242 -0
- package/dist/lib/ontology-graph/replay/member.d.ts +19 -0
- package/dist/lib/ontology-graph/replay/member.js +65 -0
- package/dist/lib/ontology-graph/replay/mentions.d.ts +58 -0
- package/dist/lib/ontology-graph/replay/mentions.js +239 -0
- package/dist/lib/ontology-graph/replay/readers.d.ts +98 -0
- package/dist/lib/ontology-graph/replay/readers.js +1251 -0
- package/dist/lib/ontology-graph/replay/rules.d.ts +127 -0
- package/dist/lib/ontology-graph/replay/rules.js +374 -0
- package/dist/lib/ontology-graph/replay/scope.d.ts +35 -0
- package/dist/lib/ontology-graph/replay/scope.js +115 -0
- package/dist/lib/ontology-graph/replay/transcripts.d.ts +39 -0
- package/dist/lib/ontology-graph/replay/transcripts.js +224 -0
- package/dist/lib/ontology-graph/replay/util.d.ts +55 -0
- package/dist/lib/ontology-graph/replay/util.js +256 -0
- package/dist/lib/ontology-graph/resolve/entity-index.d.ts +159 -0
- package/dist/lib/ontology-graph/resolve/entity-index.js +652 -0
- package/dist/lib/ontology-graph/resolve/index.d.ts +113 -0
- package/dist/lib/ontology-graph/resolve/index.js +214 -0
- package/dist/lib/ontology-graph/resolve/machine.d.ts +34 -0
- package/dist/lib/ontology-graph/resolve/machine.js +95 -0
- package/dist/lib/ontology-graph/resolve/normalize.d.ts +35 -0
- package/dist/lib/ontology-graph/resolve/normalize.js +124 -0
- package/dist/lib/ontology-graph/resolve/org-chart.d.ts +107 -0
- package/dist/lib/ontology-graph/resolve/org-chart.js +578 -0
- package/dist/lib/ontology-graph/resolve/org-layer.d.ts +78 -0
- package/dist/lib/ontology-graph/resolve/org-layer.js +159 -0
- package/dist/lib/ontology-graph/resolve/org-seed.d.ts +141 -0
- package/dist/lib/ontology-graph/resolve/org-seed.js +631 -0
- package/dist/lib/ontology-graph/resolve/org-sources.d.ts +165 -0
- package/dist/lib/ontology-graph/resolve/org-sources.js +634 -0
- package/dist/lib/ontology-graph/resolve/roster.d.ts +76 -0
- package/dist/lib/ontology-graph/resolve/roster.js +226 -0
- package/dist/lib/ontology-graph/resolve/seed.d.ts +267 -0
- package/dist/lib/ontology-graph/resolve/seed.js +1198 -0
- package/dist/lib/ontology-graph/resolve/upsert.d.ts +58 -0
- package/dist/lib/ontology-graph/resolve/upsert.js +139 -0
- package/dist/lib/ontology-graph/resolve/writer.d.ts +128 -0
- package/dist/lib/ontology-graph/resolve/writer.js +351 -0
- package/dist/lib/ontology-graph/schema/authority.d.ts +107 -0
- package/dist/lib/ontology-graph/schema/authority.js +186 -0
- package/dist/lib/ontology-graph/schema/default-schema.d.ts +10 -0
- package/dist/lib/ontology-graph/schema/default-schema.js +242 -0
- package/dist/lib/ontology-graph/schema/grammar.d.ts +57 -0
- package/dist/lib/ontology-graph/schema/grammar.js +409 -0
- package/dist/lib/ontology-graph/schema/index.d.ts +12 -0
- package/dist/lib/ontology-graph/schema/index.js +10 -0
- package/dist/lib/ontology-graph/schema/validate.d.ts +13 -0
- package/dist/lib/ontology-graph/schema/validate.js +132 -0
- package/dist/lib/ontology-graph/store/files.d.ts +34 -0
- package/dist/lib/ontology-graph/store/files.js +207 -0
- package/dist/lib/ontology-graph/store/fs.d.ts +30 -0
- package/dist/lib/ontology-graph/store/fs.js +101 -0
- package/dist/lib/ontology-graph/store/graph-store.d.ts +14 -0
- package/dist/lib/ontology-graph/store/graph-store.js +520 -0
- package/dist/lib/ontology-graph/store/index.d.ts +18 -0
- package/dist/lib/ontology-graph/store/index.js +15 -0
- package/dist/lib/ontology-graph/store/ingest.d.ts +37 -0
- package/dist/lib/ontology-graph/store/ingest.js +323 -0
- package/dist/lib/ontology-graph/store/paths.d.ts +114 -0
- package/dist/lib/ontology-graph/store/paths.js +232 -0
- package/dist/lib/ontology-graph/types.d.ts +1190 -0
- package/dist/lib/ontology-graph/types.js +131 -0
- package/dist/lib/secret-scan/gitleaks-rules.generated.js +1 -1
- package/dist/lib/sync-core/engine-holds.d.ts +1 -1
- package/dist/lib/sync-core/engine-holds.js +12 -2
- package/dist/lib/sync-core/hand-back.d.ts +2 -1
- package/dist/lib/sync-core/hand-back.js +16 -2
- package/dist/lib/sync-core/legacy-journal-export-child.d.ts +2 -0
- package/dist/lib/sync-core/legacy-journal-export-child.js +24 -0
- package/dist/lib/sync-core/legacy-journal-export.d.ts +39 -0
- package/dist/lib/sync-core/legacy-journal-export.js +241 -0
- package/dist/lib/sync-core/legacy-journal-reader.d.ts +15 -0
- package/dist/lib/sync-core/legacy-journal-reader.js +56 -0
- package/dist/lib/sync-core/reconcile.d.ts +3 -0
- package/dist/lib/sync-core/reconcile.js +43 -3
- package/dist/utils/cli-telemetry.d.ts +1 -0
- package/dist/utils/cli-telemetry.js +6 -3
- package/dist/utils/frontmatter.d.ts +14 -0
- package/dist/utils/frontmatter.js +18 -0
- package/dist/utils/hook-engine-rollup.d.ts +96 -0
- package/dist/utils/hook-engine-rollup.js +725 -0
- package/dist/utils/interactive-caller.js +1 -1
- package/package.json +9 -9
- package/scripts/install-hook-engine.mjs +4 -0
- package/assets/scaffold/core/scripts/knowledge-prefs.sh +0 -55
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { EntityKeys, EntityRef, IsoTimestamp } from "../types.js";
|
|
2
|
+
export declare const ROSTER_STATE = ".state/roster.json";
|
|
3
|
+
export type RosterReason = "roster_first_name" | "roster_misspelling" | "roster_initial" | "roster_superset" | "roster_descriptor";
|
|
4
|
+
export declare const ROSTER_REASONS: readonly RosterReason[];
|
|
5
|
+
export interface RosterMember {
|
|
6
|
+
ref: EntityRef;
|
|
7
|
+
name: string;
|
|
8
|
+
/** Every email the roster records for the person. */
|
|
9
|
+
emails: string[];
|
|
10
|
+
slackIds: string[];
|
|
11
|
+
/** HQ person uids. One person can hold several member accounts. */
|
|
12
|
+
personUids: string[];
|
|
13
|
+
/** `org-layer`, `people`. */
|
|
14
|
+
from: string[];
|
|
15
|
+
}
|
|
16
|
+
export interface RosterFile {
|
|
17
|
+
schema: 1;
|
|
18
|
+
writtenAt: IsoTimestamp;
|
|
19
|
+
/** Normalized words of the company's own name and its products. */
|
|
20
|
+
ownWords: string[];
|
|
21
|
+
/** Normalized names that are bots, agents or services in this company. */
|
|
22
|
+
machineNames: string[];
|
|
23
|
+
members: RosterMember[];
|
|
24
|
+
}
|
|
25
|
+
export declare function readRosterFile(graphRoot: string): RosterFile | null;
|
|
26
|
+
export declare function writeRosterFile(graphRoot: string, roster: Omit<RosterFile, "schema">): void;
|
|
27
|
+
/** Edit distance with insert, delete, substitute and a swap of two neighbours. Stops caring above `max`. */
|
|
28
|
+
export declare function editDistance(a: string, b: string, max?: number): number;
|
|
29
|
+
/** The consonants of a word in order, doubles collapsed: `hassaan` and `hasan` are both `hsn`, `shawon` is `shwn`, `shaan` is `shn`. */
|
|
30
|
+
export declare function consonantSkeleton(word: string): string;
|
|
31
|
+
/**
|
|
32
|
+
* One or two letters off, same first letter, and long enough that the
|
|
33
|
+
* difference is a slip and not another name. Two letters off counts only when
|
|
34
|
+
* the consonants agree, so `Lizzy` is Lizzie and `Shaan` is not Shawon.
|
|
35
|
+
*/
|
|
36
|
+
export declare function isMisspellingOf(written: string, real: string): boolean;
|
|
37
|
+
export interface RosterMatch {
|
|
38
|
+
ref: EntityRef;
|
|
39
|
+
reason: RosterReason;
|
|
40
|
+
}
|
|
41
|
+
export interface RosterMatchOptions {
|
|
42
|
+
/** True when the word is a title word or a working-group word (`lead`, `infrastructure`). */
|
|
43
|
+
isDescriptor?: (word: string) => boolean;
|
|
44
|
+
/**
|
|
45
|
+
* True when another person in the graph, not on the roster, carries this
|
|
46
|
+
* word as a first name of their own. A misspelled single name is folded
|
|
47
|
+
* only when nobody does.
|
|
48
|
+
*/
|
|
49
|
+
firstNameTaken?: (word: string) => boolean;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Matches names against the roster. Built once per run from the roster
|
|
53
|
+
* members; answers from maps.
|
|
54
|
+
*/
|
|
55
|
+
export declare class Roster {
|
|
56
|
+
private readonly members;
|
|
57
|
+
private readonly byRef;
|
|
58
|
+
private readonly ownWords;
|
|
59
|
+
constructor(members: readonly RosterMember[], ownWords?: Iterable<string>);
|
|
60
|
+
get size(): number;
|
|
61
|
+
has(ref: EntityRef): boolean;
|
|
62
|
+
refs(): EntityRef[];
|
|
63
|
+
get(ref: EntityRef): RosterMember | undefined;
|
|
64
|
+
list(): RosterMember[];
|
|
65
|
+
/** The roster people whose first name is exactly this word. */
|
|
66
|
+
withFirstName(word: string): EntityRef[];
|
|
67
|
+
/** True when the candidate carries an email or a Slack id and the member carries one too, and none is shared. */
|
|
68
|
+
keysConflict(ref: EntityRef, keys: Partial<EntityKeys> | undefined): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* The one roster person this name is a variant of, with the reason code, or
|
|
71
|
+
* null. Null when two roster people fit, when the name is a roster name
|
|
72
|
+
* itself, or when the candidate's keys contradict the person.
|
|
73
|
+
*/
|
|
74
|
+
match(name: string, keys?: Partial<EntityKeys>, options?: RosterMatchOptions): RosterMatch | null;
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=roster.d.ts.map
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WP-C: the internal roster and the rule that folds name variants into it.
|
|
3
|
+
*
|
|
4
|
+
* The roster is the list of the company's own people that a record states:
|
|
5
|
+
* the human members of its HQ workspace (the org-layer read) and the people
|
|
6
|
+
* files a person keeps. It is the only thing that makes a person internal.
|
|
7
|
+
*
|
|
8
|
+
* A name with no identity key of its own is folded into a roster person when
|
|
9
|
+
* exactly one roster person fits it and nothing the name carries contradicts
|
|
10
|
+
* that person:
|
|
11
|
+
*
|
|
12
|
+
* roster_first_name `Jacob` the one roster person with that first name
|
|
13
|
+
* roster_misspelling `Shazeb`, `Jacob Pasell`, `Geoffrey McFarlane`
|
|
14
|
+
* a first or last name one or two letters off
|
|
15
|
+
* roster_initial `Yousuf K`, `Caitlin Hutch` last name cut short
|
|
16
|
+
* roster_superset `Chaudhry Hassaan Saleem` the roster name with more words
|
|
17
|
+
* roster_descriptor `Stefan (Infrastructure Lead)` first name plus a title or the company's own words
|
|
18
|
+
*
|
|
19
|
+
* Anything else stays a proposal. Pure functions plus one small state file.
|
|
20
|
+
*/
|
|
21
|
+
import * as fs from "node:fs";
|
|
22
|
+
import { atomicWriteFile, graphPath } from "../store/index.js";
|
|
23
|
+
import { isEmail, nameTokens, normalizeEmail, normalizeName, slackIdOf, sortedUnique } from "./normalize.js";
|
|
24
|
+
export const ROSTER_STATE = ".state/roster.json";
|
|
25
|
+
export const ROSTER_REASONS = ["roster_first_name", "roster_misspelling", "roster_initial", "roster_superset", "roster_descriptor"];
|
|
26
|
+
export function readRosterFile(graphRoot) {
|
|
27
|
+
try {
|
|
28
|
+
const loaded = JSON.parse(fs.readFileSync(graphPath(graphRoot, ROSTER_STATE), "utf8"));
|
|
29
|
+
if (loaded.schema !== 1 || !Array.isArray(loaded.members))
|
|
30
|
+
return null;
|
|
31
|
+
return {
|
|
32
|
+
schema: 1,
|
|
33
|
+
writtenAt: typeof loaded.writtenAt === "string" ? loaded.writtenAt : "",
|
|
34
|
+
ownWords: Array.isArray(loaded.ownWords) ? loaded.ownWords.filter((word) => typeof word === "string") : [],
|
|
35
|
+
machineNames: Array.isArray(loaded.machineNames) ? loaded.machineNames.filter((word) => typeof word === "string") : [],
|
|
36
|
+
members: loaded.members.filter((member) => Boolean(member) && typeof member.ref === "string" && typeof member.name === "string"),
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
export function writeRosterFile(graphRoot, roster) {
|
|
44
|
+
const members = [...roster.members]
|
|
45
|
+
.map((member) => ({
|
|
46
|
+
ref: member.ref,
|
|
47
|
+
name: member.name,
|
|
48
|
+
emails: sortedUnique(member.emails),
|
|
49
|
+
slackIds: sortedUnique(member.slackIds),
|
|
50
|
+
personUids: sortedUnique(member.personUids),
|
|
51
|
+
from: sortedUnique(member.from),
|
|
52
|
+
}))
|
|
53
|
+
.sort((a, b) => (a.ref < b.ref ? -1 : a.ref > b.ref ? 1 : 0));
|
|
54
|
+
const file = { schema: 1, writtenAt: roster.writtenAt, ownWords: sortedUnique(roster.ownWords), machineNames: sortedUnique(roster.machineNames), members };
|
|
55
|
+
atomicWriteFile(graphPath(graphRoot, ROSTER_STATE), `${JSON.stringify(file, null, 2)}\n`);
|
|
56
|
+
}
|
|
57
|
+
/** Edit distance with insert, delete, substitute and a swap of two neighbours. Stops caring above `max`. */
|
|
58
|
+
export function editDistance(a, b, max = 3) {
|
|
59
|
+
if (a === b)
|
|
60
|
+
return 0;
|
|
61
|
+
if (Math.abs(a.length - b.length) > max)
|
|
62
|
+
return max + 1;
|
|
63
|
+
let previous2 = [];
|
|
64
|
+
let previous = Array.from({ length: b.length + 1 }, (_, index) => index);
|
|
65
|
+
for (let i = 1; i <= a.length; i += 1) {
|
|
66
|
+
const current = [i];
|
|
67
|
+
let best = i;
|
|
68
|
+
for (let j = 1; j <= b.length; j += 1) {
|
|
69
|
+
const cost = a[i - 1] === b[j - 1] ? 0 : 1;
|
|
70
|
+
let value = Math.min(previous[j] + 1, current[j - 1] + 1, previous[j - 1] + cost);
|
|
71
|
+
if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1])
|
|
72
|
+
value = Math.min(value, previous2[j - 2] + 1);
|
|
73
|
+
current.push(value);
|
|
74
|
+
if (value < best)
|
|
75
|
+
best = value;
|
|
76
|
+
}
|
|
77
|
+
if (best > max)
|
|
78
|
+
return max + 1;
|
|
79
|
+
previous2 = previous;
|
|
80
|
+
previous = current;
|
|
81
|
+
}
|
|
82
|
+
return previous[b.length];
|
|
83
|
+
}
|
|
84
|
+
/** The consonants of a word in order, doubles collapsed: `hassaan` and `hasan` are both `hsn`, `shawon` is `shwn`, `shaan` is `shn`. */
|
|
85
|
+
export function consonantSkeleton(word) {
|
|
86
|
+
return word.replace(/[aeiouy]/g, "").replace(/(.)\1+/g, "$1");
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* One or two letters off, same first letter, and long enough that the
|
|
90
|
+
* difference is a slip and not another name. Two letters off counts only when
|
|
91
|
+
* the consonants agree, so `Lizzy` is Lizzie and `Shaan` is not Shawon.
|
|
92
|
+
*/
|
|
93
|
+
export function isMisspellingOf(written, real) {
|
|
94
|
+
if (written === real || written[0] !== real[0])
|
|
95
|
+
return false;
|
|
96
|
+
const shorter = Math.min(written.length, real.length);
|
|
97
|
+
if (shorter < 4)
|
|
98
|
+
return false;
|
|
99
|
+
const distance = editDistance(written, real, 2);
|
|
100
|
+
return distance === 1 || (distance === 2 && shorter >= 5 && consonantSkeleton(written) === consonantSkeleton(real));
|
|
101
|
+
}
|
|
102
|
+
/** `geoffrey` for `geoff`, `zachary` for `zach`: one is the start of the other, four letters or more. */
|
|
103
|
+
function isLongForm(written, real) {
|
|
104
|
+
if (written === real)
|
|
105
|
+
return false;
|
|
106
|
+
const [short, long] = written.length < real.length ? [written, real] : [real, written];
|
|
107
|
+
return short.length >= 4 && long.startsWith(short);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Matches names against the roster. Built once per run from the roster
|
|
111
|
+
* members; answers from maps.
|
|
112
|
+
*/
|
|
113
|
+
export class Roster {
|
|
114
|
+
members = [];
|
|
115
|
+
byRef = new Map();
|
|
116
|
+
ownWords;
|
|
117
|
+
constructor(members, ownWords = []) {
|
|
118
|
+
this.ownWords = new Set([...ownWords].map((word) => normalizeName(word)).flatMap((word) => nameTokens(word)));
|
|
119
|
+
for (const member of members) {
|
|
120
|
+
const tokens = nameTokens(normalizeName(member.name));
|
|
121
|
+
if (tokens.length < 2)
|
|
122
|
+
continue;
|
|
123
|
+
const indexed = { member, tokens, first: tokens[0], last: tokens[tokens.length - 1] };
|
|
124
|
+
this.members.push(indexed);
|
|
125
|
+
this.byRef.set(member.ref, indexed);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
get size() {
|
|
129
|
+
return this.members.length;
|
|
130
|
+
}
|
|
131
|
+
has(ref) {
|
|
132
|
+
return this.byRef.has(ref);
|
|
133
|
+
}
|
|
134
|
+
refs() {
|
|
135
|
+
return sortedUnique(this.byRef.keys());
|
|
136
|
+
}
|
|
137
|
+
get(ref) {
|
|
138
|
+
return this.byRef.get(ref)?.member;
|
|
139
|
+
}
|
|
140
|
+
list() {
|
|
141
|
+
return this.members.map((entry) => entry.member);
|
|
142
|
+
}
|
|
143
|
+
/** The roster people whose first name is exactly this word. */
|
|
144
|
+
withFirstName(word) {
|
|
145
|
+
return this.members.filter((entry) => entry.first === word).map((entry) => entry.member.ref);
|
|
146
|
+
}
|
|
147
|
+
/** True when the candidate carries an email or a Slack id and the member carries one too, and none is shared. */
|
|
148
|
+
keysConflict(ref, keys) {
|
|
149
|
+
const entry = this.byRef.get(ref);
|
|
150
|
+
if (!entry || !keys)
|
|
151
|
+
return false;
|
|
152
|
+
const emails = (keys.email ?? []).map((email) => normalizeEmail(email)).filter((email) => isEmail(email));
|
|
153
|
+
if (emails.length > 0 && entry.member.emails.length > 0 && !emails.some((email) => entry.member.emails.includes(email)))
|
|
154
|
+
return true;
|
|
155
|
+
const slackIds = (keys.slack_id ?? []).map((id) => slackIdOf(id)).filter((id) => id !== null);
|
|
156
|
+
if (slackIds.length > 0 && entry.member.slackIds.length > 0 && !slackIds.some((id) => entry.member.slackIds.includes(id)))
|
|
157
|
+
return true;
|
|
158
|
+
const uids = (keys.external_ids ?? []).filter((id) => /^hq:prs_/.test(id)).map((id) => id.slice(3));
|
|
159
|
+
if (uids.length > 0 && entry.member.personUids.length > 0 && !uids.some((uid) => entry.member.personUids.includes(uid)))
|
|
160
|
+
return true;
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* The one roster person this name is a variant of, with the reason code, or
|
|
165
|
+
* null. Null when two roster people fit, when the name is a roster name
|
|
166
|
+
* itself, or when the candidate's keys contradict the person.
|
|
167
|
+
*/
|
|
168
|
+
match(name, keys, options = {}) {
|
|
169
|
+
const tokens = nameTokens(normalizeName(name));
|
|
170
|
+
if (tokens.length === 0)
|
|
171
|
+
return null;
|
|
172
|
+
const isDescriptor = (word) => this.ownWords.has(word) || (options.isDescriptor?.(word) ?? false);
|
|
173
|
+
const hits = new Map();
|
|
174
|
+
const note = (entry, reason) => {
|
|
175
|
+
if (!hits.has(entry.member.ref))
|
|
176
|
+
hits.set(entry.member.ref, reason);
|
|
177
|
+
};
|
|
178
|
+
if (tokens.length === 1) {
|
|
179
|
+
const word = tokens[0];
|
|
180
|
+
if (word.length < 3)
|
|
181
|
+
return null;
|
|
182
|
+
const exact = this.members.filter((entry) => entry.first === word);
|
|
183
|
+
for (const entry of exact)
|
|
184
|
+
note(entry, "roster_first_name");
|
|
185
|
+
// A single word that is not a roster first name: only five letters or more, and only when nobody else is called that.
|
|
186
|
+
if (exact.length === 0 && word.length >= 5 && !(options.firstNameTaken?.(word) ?? false)) {
|
|
187
|
+
for (const entry of this.members)
|
|
188
|
+
if (isMisspellingOf(word, entry.first))
|
|
189
|
+
note(entry, "roster_misspelling");
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
const first = tokens[0];
|
|
194
|
+
const rest = tokens.slice(1);
|
|
195
|
+
const last = tokens[tokens.length - 1];
|
|
196
|
+
for (const entry of this.members) {
|
|
197
|
+
if (entry.tokens.join(" ") === tokens.join(" "))
|
|
198
|
+
return null;
|
|
199
|
+
if (tokens.length > entry.tokens.length && entry.tokens.every((token) => tokens.includes(token))) {
|
|
200
|
+
note(entry, "roster_superset");
|
|
201
|
+
continue;
|
|
202
|
+
}
|
|
203
|
+
if (entry.first === first) {
|
|
204
|
+
if (tokens.length === 2 && last !== entry.last && entry.last.startsWith(last))
|
|
205
|
+
note(entry, "roster_initial");
|
|
206
|
+
else if (tokens.length === 2 && isMisspellingOf(last, entry.last))
|
|
207
|
+
note(entry, "roster_misspelling");
|
|
208
|
+
else if (rest.every((word) => isDescriptor(word)))
|
|
209
|
+
note(entry, "roster_descriptor");
|
|
210
|
+
continue;
|
|
211
|
+
}
|
|
212
|
+
if (tokens.length === entry.tokens.length && last === entry.last && (isMisspellingOf(first, entry.first) || isLongForm(first, entry.first))) {
|
|
213
|
+
note(entry, "roster_misspelling");
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
// `Stefan (Infrastructure Lead)` fits everyone called Stefan: only one may be.
|
|
217
|
+
}
|
|
218
|
+
if (hits.size !== 1)
|
|
219
|
+
return null;
|
|
220
|
+
const [ref, reason] = [...hits][0];
|
|
221
|
+
if (this.keysConflict(ref, keys))
|
|
222
|
+
return null;
|
|
223
|
+
return { ref, reason };
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
//# sourceMappingURL=roster.js.map
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import type { GraphContext, IsoDate, IsoTimestamp, MemberIdentity, Origin, Proposal, SourceRef } from "../types.js";
|
|
2
|
+
import type { SlackDirectory } from "./entity-index.js";
|
|
3
|
+
import { type ConfirmedOrgChart } from "./org-chart.js";
|
|
4
|
+
import { type OrgLayerSeed } from "./org-layer.js";
|
|
5
|
+
import { type RosterMember } from "./roster.js";
|
|
6
|
+
import { type OrgSeedCounts, type TeamEvidence } from "./org-seed.js";
|
|
7
|
+
import { type OrgSources } from "./org-sources.js";
|
|
8
|
+
import { type GraphWriter } from "./writer.js";
|
|
9
|
+
/** True for a sync conflict copy: `name 2.md` or `name.md.conflict-<stamp>.md`. */
|
|
10
|
+
export declare function isCopyName(name: string): boolean;
|
|
11
|
+
/** The YAML frontmatter of a markdown file, or null. */
|
|
12
|
+
export declare function readFrontmatter(text: string | null): Record<string, unknown> | null;
|
|
13
|
+
export interface SeedPerson {
|
|
14
|
+
name: string;
|
|
15
|
+
aliases: string[];
|
|
16
|
+
emails: string[];
|
|
17
|
+
slackIds: string[];
|
|
18
|
+
/** `hq:<person uid>`, `github:<login>`, `linear:<id>`. */
|
|
19
|
+
externalIds: string[];
|
|
20
|
+
role?: string;
|
|
21
|
+
/** True for a member of the company itself. */
|
|
22
|
+
internal?: boolean;
|
|
23
|
+
/** True when a record lists the person as one of the company's own: a member of its HQ workspace, or a people file that says internal. */
|
|
24
|
+
roster?: boolean;
|
|
25
|
+
/** HQ person uids of the member accounts the person holds. */
|
|
26
|
+
personUids?: string[];
|
|
27
|
+
organization?: string;
|
|
28
|
+
teams: string[];
|
|
29
|
+
/** Free tags on a people file (`gtm`, `engineering`). */
|
|
30
|
+
tags?: string[];
|
|
31
|
+
/** The person's role in the company's HQ workspace (owner, admin, member, guest). Not a job title. */
|
|
32
|
+
workspaceRole?: string;
|
|
33
|
+
/** Set when a rule, not the people file, says the person belongs to the company. */
|
|
34
|
+
internalBy?: {
|
|
35
|
+
by: Origin;
|
|
36
|
+
conf: number;
|
|
37
|
+
src: SourceRef;
|
|
38
|
+
};
|
|
39
|
+
manager?: string;
|
|
40
|
+
seen: IsoDate;
|
|
41
|
+
src: SourceRef;
|
|
42
|
+
by: Origin;
|
|
43
|
+
conf: number;
|
|
44
|
+
/** Which sources contributed. */
|
|
45
|
+
from: string[];
|
|
46
|
+
}
|
|
47
|
+
export interface SeedChannel {
|
|
48
|
+
name: string;
|
|
49
|
+
firstFile: string;
|
|
50
|
+
firstDay: IsoDate;
|
|
51
|
+
/** Slack id to thread count and first day. */
|
|
52
|
+
participants: Record<string, {
|
|
53
|
+
threads: number;
|
|
54
|
+
firstDay: IsoDate;
|
|
55
|
+
}>;
|
|
56
|
+
}
|
|
57
|
+
export interface SeedRepo {
|
|
58
|
+
name: string;
|
|
59
|
+
/** Newest commit day in the repo. */
|
|
60
|
+
lastDay?: IsoDate;
|
|
61
|
+
/** Author email to its commits. */
|
|
62
|
+
authors: {
|
|
63
|
+
name: string;
|
|
64
|
+
email: string;
|
|
65
|
+
commits: number;
|
|
66
|
+
firstDay: IsoDate;
|
|
67
|
+
lastDay: IsoDate;
|
|
68
|
+
}[];
|
|
69
|
+
}
|
|
70
|
+
export interface SeedBoardProject {
|
|
71
|
+
id: string;
|
|
72
|
+
name: string;
|
|
73
|
+
title: string;
|
|
74
|
+
status: string;
|
|
75
|
+
owner: string;
|
|
76
|
+
created: IsoDate;
|
|
77
|
+
}
|
|
78
|
+
export interface SeedAccount {
|
|
79
|
+
id: string;
|
|
80
|
+
name: string;
|
|
81
|
+
domain: string;
|
|
82
|
+
stage: string;
|
|
83
|
+
externalIds: string[];
|
|
84
|
+
day: IsoDate;
|
|
85
|
+
}
|
|
86
|
+
export interface IdentitySeedCounts {
|
|
87
|
+
peopleFiles: number;
|
|
88
|
+
dmFilesRead: number;
|
|
89
|
+
dmFilesSkippedOtherOwner: number;
|
|
90
|
+
slackIdsWithEmail: number;
|
|
91
|
+
slackIdsWithName: number;
|
|
92
|
+
meshContacts: number;
|
|
93
|
+
meshContactsMatched: number;
|
|
94
|
+
meshContactsUnmatched: number;
|
|
95
|
+
meshAgentsSkipped: number;
|
|
96
|
+
gitRepos: number;
|
|
97
|
+
gitReposFailed: number;
|
|
98
|
+
gitAuthors: number;
|
|
99
|
+
gitBotsSkipped: number;
|
|
100
|
+
gitAuthorsSameNameOtherEmail: number;
|
|
101
|
+
boardProjects: number;
|
|
102
|
+
crmAccounts: number;
|
|
103
|
+
crmAccountsUnnamed: number;
|
|
104
|
+
/** Identities with keys but no name anywhere: kept in the Slack directory, never made a person. */
|
|
105
|
+
namelessIdentities: number;
|
|
106
|
+
/** Repos listed for the company in the manifest. */
|
|
107
|
+
gitReposListed?: number;
|
|
108
|
+
/** Human members in the kept org-layer answer. */
|
|
109
|
+
orgLayerMembers?: number;
|
|
110
|
+
orgLayerAgentsSkipped?: number;
|
|
111
|
+
orgLayerMembersAdded?: number;
|
|
112
|
+
/** CRM accounts whose stage was left out because every account carries the same one. */
|
|
113
|
+
crmStageConstant?: number;
|
|
114
|
+
/** Org-layer member accounts that are a second account of a person already on the roster (same full name). */
|
|
115
|
+
orgLayerAccountsMerged?: number;
|
|
116
|
+
/** Org-layer members listed as human whose name marks a machine (`HQ Operator API`). */
|
|
117
|
+
orgLayerMachinesSkipped?: number;
|
|
118
|
+
/** Org-layer members listed as human with no usable name (one word, no email). */
|
|
119
|
+
orgLayerUnnamed?: number;
|
|
120
|
+
/** Distinct people on the roster. */
|
|
121
|
+
rosterPeople?: number;
|
|
122
|
+
/** CRM accounts that matched no company another source names: kept out of the graph. */
|
|
123
|
+
crmAccountsHeld?: number;
|
|
124
|
+
/** CRM accounts whose ids and domain were attached to a company another source names. */
|
|
125
|
+
crmAccountsAttached?: number;
|
|
126
|
+
}
|
|
127
|
+
/** Optional `settings/ontology-graph.yaml` in the company folder: what rules cannot know. Every list may be absent. */
|
|
128
|
+
export interface GraphSettings {
|
|
129
|
+
products: string[];
|
|
130
|
+
vendors: string[];
|
|
131
|
+
ownCompanies: string[];
|
|
132
|
+
machineIdentities: string[];
|
|
133
|
+
}
|
|
134
|
+
export interface IdentitySeed {
|
|
135
|
+
self: {
|
|
136
|
+
name: string;
|
|
137
|
+
slug: string;
|
|
138
|
+
} | null;
|
|
139
|
+
people: SeedPerson[];
|
|
140
|
+
directory: SlackDirectory;
|
|
141
|
+
channels: SeedChannel[];
|
|
142
|
+
repos: SeedRepo[];
|
|
143
|
+
boardProjects: SeedBoardProject[];
|
|
144
|
+
accounts: SeedAccount[];
|
|
145
|
+
/** Same full name as a seeded person, different email, no shared key: proposal only. */
|
|
146
|
+
sameNameOtherEmail: {
|
|
147
|
+
name: string;
|
|
148
|
+
email: string;
|
|
149
|
+
src: SourceRef;
|
|
150
|
+
}[];
|
|
151
|
+
counts: IdentitySeedCounts;
|
|
152
|
+
/** Mail domains of the company's own people: named in company.yaml, or shared by two roster members. */
|
|
153
|
+
ownDomains?: string[];
|
|
154
|
+
/** The org chart people keep in HQ, from the kept answer. Null when there is none. */
|
|
155
|
+
orgLayer?: OrgLayerSeed | null;
|
|
156
|
+
/** Standup notes, policy and signal role statements, PRD owners, clients. */
|
|
157
|
+
org?: OrgSources | null;
|
|
158
|
+
/** Normalized names of bots, agents and services: the agents the workspace lists, agent contacts, the settings file. */
|
|
159
|
+
machineNames?: string[];
|
|
160
|
+
settings?: GraphSettings;
|
|
161
|
+
/** `people/org-chart.yaml`: the role, team and manager a person confirmed. Null when there is no signed file. */
|
|
162
|
+
confirmedOrgChart?: ConfirmedOrgChart | null;
|
|
163
|
+
}
|
|
164
|
+
export interface GitAuthorLine {
|
|
165
|
+
name: string;
|
|
166
|
+
email: string;
|
|
167
|
+
day: IsoDate;
|
|
168
|
+
}
|
|
169
|
+
export interface IdentitySeedOptions {
|
|
170
|
+
/** `learned` date stamped on seeded rows. */
|
|
171
|
+
learned: IsoDate;
|
|
172
|
+
/** Default: `context.member`. Without a member no DM file and no contacts file is read. */
|
|
173
|
+
member?: MemberIdentity;
|
|
174
|
+
/** Folder of `<person uid>.json` contact files. Default `~/.hq/work-mesh/cache/contacts`. Null turns the source off. */
|
|
175
|
+
meshContactsDir?: string | null;
|
|
176
|
+
/**
|
|
177
|
+
* Absolute repo paths. Default: the company's `repos` in `companies/manifest.yaml`, plus every other
|
|
178
|
+
* clone under `<hqRoot>/repos` whose origin has the same GitHub owner and is not listed for another company.
|
|
179
|
+
*/
|
|
180
|
+
repos?: readonly string[];
|
|
181
|
+
/** The org layer to seed from. Default: the kept answer in the graph folder. Null turns the source off. */
|
|
182
|
+
orgLayer?: OrgLayerSeed | null;
|
|
183
|
+
/** Read standup notes, policies, PRDs, signals and clients. Default true. */
|
|
184
|
+
orgSources?: boolean;
|
|
185
|
+
/** A person needs this many commits across the company's repos to count as evidence of engineering work. Default 10. */
|
|
186
|
+
minEngineeringCommits?: number;
|
|
187
|
+
/** Reads one repo's author lines. Default: `git log`. Injected in tests. */
|
|
188
|
+
gitLog?: (repo: string) => GitAuthorLine[];
|
|
189
|
+
/** An author needs this many commits in a repo for a works_on edge. Default 3. */
|
|
190
|
+
minCommits?: number;
|
|
191
|
+
/** A person needs this many threads in a channel for a member_of edge. Default 3. */
|
|
192
|
+
minChannelThreads?: number;
|
|
193
|
+
}
|
|
194
|
+
/** Slack id maps and channel participation from the company's Slack sources, limited to what the member may read. */
|
|
195
|
+
export declare function loadSlackDirectory(companyRoot: string, member?: MemberIdentity): {
|
|
196
|
+
directory: SlackDirectory;
|
|
197
|
+
channels: SeedChannel[];
|
|
198
|
+
uidBySlackId: Record<string, string>;
|
|
199
|
+
dmFilesRead: number;
|
|
200
|
+
dmFilesSkipped: number;
|
|
201
|
+
};
|
|
202
|
+
/** Reads every identity source. Writes nothing. */
|
|
203
|
+
export declare function buildIdentitySeed(context: GraphContext, options: IdentitySeedOptions): IdentitySeed;
|
|
204
|
+
export interface IdentitySeedResult {
|
|
205
|
+
counts: IdentitySeedCounts;
|
|
206
|
+
peopleSeeded: number;
|
|
207
|
+
peopleMerged: number;
|
|
208
|
+
peopleRefused: number;
|
|
209
|
+
roles: number;
|
|
210
|
+
teams: number;
|
|
211
|
+
projects: number;
|
|
212
|
+
companies: number;
|
|
213
|
+
customerEdges: number;
|
|
214
|
+
worksOnEdges: number;
|
|
215
|
+
ownsEdges: number;
|
|
216
|
+
reportsToEdges: number;
|
|
217
|
+
memberOfEdges: number;
|
|
218
|
+
/** Board owners and managers that did not resolve to one person. */
|
|
219
|
+
unresolvedOwners: number;
|
|
220
|
+
/** Counts of the org rules: roles, teams, org layer, clients, affiliation. */
|
|
221
|
+
org: OrgSeedCounts;
|
|
222
|
+
proposals: Proposal[];
|
|
223
|
+
/** The roster as written: one entry per person, with the entity it became. */
|
|
224
|
+
roster?: RosterMember[];
|
|
225
|
+
/** Every pointer from a source to "this person is in this working group", kept for the org chart draft. */
|
|
226
|
+
teamEvidence?: TeamEvidence[];
|
|
227
|
+
/** Role titles a kept record or a rule states, by person. */
|
|
228
|
+
titled?: Record<string, {
|
|
229
|
+
title: string;
|
|
230
|
+
conf: number;
|
|
231
|
+
src: SourceRef;
|
|
232
|
+
day: IsoDate;
|
|
233
|
+
}>;
|
|
234
|
+
/** Lines of the confirmed org chart written as origin human, and names in it that matched nobody. */
|
|
235
|
+
confirmedOrgChart?: {
|
|
236
|
+
roles: number;
|
|
237
|
+
teams: number;
|
|
238
|
+
managers: number;
|
|
239
|
+
unresolved: string[];
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Writes the seed through the writer: entities by the merge policy, then
|
|
244
|
+
* rows. Every row is cited (`doc:`, `record:` or `source:`) and dated.
|
|
245
|
+
*/
|
|
246
|
+
export interface ApplyIdentitySeedOptions {
|
|
247
|
+
learned: IsoDate;
|
|
248
|
+
minCommits?: number;
|
|
249
|
+
minChannelThreads?: number;
|
|
250
|
+
/** Commits across the company's repos that count as one source for engineering work. Default 10. */
|
|
251
|
+
minEngineeringCommits?: number;
|
|
252
|
+
/** A works_on edge from git is closed at the last commit day when that day is this many days old. Default 90. */
|
|
253
|
+
inactiveAfterDays?: number;
|
|
254
|
+
now?: IsoTimestamp;
|
|
255
|
+
/**
|
|
256
|
+
* `anchors`: entities and the rows that rest on an identity key. `links`:
|
|
257
|
+
* the rows that rest on resolving a name or a Slack id (a manager, a board
|
|
258
|
+
* owner, a channel participant). The legacy import runs between the two, so
|
|
259
|
+
* a name resolves against every entity and a second run decides the same.
|
|
260
|
+
* Default `all`: both, in that order.
|
|
261
|
+
*/
|
|
262
|
+
phase?: "anchors" | "links" | "all";
|
|
263
|
+
/** The result of the `anchors` phase, to add the `links` counts to. */
|
|
264
|
+
previous?: IdentitySeedResult;
|
|
265
|
+
}
|
|
266
|
+
export declare function applyIdentitySeed(seed: IdentitySeed, writer: GraphWriter, options: ApplyIdentitySeedOptions): IdentitySeedResult;
|
|
267
|
+
//# sourceMappingURL=seed.d.ts.map
|