@indigoai-us/hq-cli 5.345.246 → 5.345.248
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 +63 -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 +1116 -3
- package/dist/command-catalog.generated.js +1373 -3
- package/dist/command-registration-plan.d.ts +6 -0
- package/dist/command-registration-plan.js +1 -0
- package/dist/commands/install-global.d.ts +15 -0
- package/dist/commands/install-global.js +98 -4
- 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/mcp-registration.d.ts +17 -0
- package/dist/commands/mcp-registration.js +119 -0
- package/dist/commands/mesh.d.ts +25 -0
- package/dist/commands/mesh.js +48 -8
- package/dist/commands/ontology-graph.d.ts +62 -0
- package/dist/commands/ontology-graph.js +439 -0
- package/dist/commands/pkg-install.js +1 -1
- package/dist/commands/reindex.js +1 -1
- package/dist/index.js +1 -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/lanes-monitor-state.d.ts +2 -2
- package/dist/lib/daemon/lanes-monitor-state.js +2 -2
- 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.js +1 -1
- package/dist/lib/daemon/state-file.d.ts +1 -1
- package/dist/lib/daemon/state-file.js +1 -1
- package/dist/lib/doctor/checks/antigravity-wiring.d.ts +21 -0
- package/dist/lib/doctor/checks/antigravity-wiring.js +75 -0
- package/dist/lib/doctor/checks/anywhere.js +30 -0
- package/dist/lib/doctor/checks/runtime-probe.js +13 -0
- package/dist/lib/doctor/platform.d.ts +1 -1
- package/dist/lib/doctor/platform.js +5 -0
- package/dist/lib/doctor/registry.js +3 -0
- 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 +91 -0
- package/dist/lib/hook-engine/coverage.js +184 -0
- package/dist/lib/hot-channels/graph-context.d.ts +105 -0
- package/dist/lib/hot-channels/graph-context.js +377 -0
- package/dist/lib/hot-channels/signals-pass.js +27 -1
- package/dist/lib/install/antigravity-targets.d.ts +39 -0
- package/dist/lib/install/antigravity-targets.js +122 -0
- 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 +195 -0
- package/dist/lib/ontology-graph/model/step.js +523 -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 +65 -0
- package/dist/lib/ontology-graph/org/derive.js +352 -0
- package/dist/lib/ontology-graph/org/index.d.ts +73 -0
- package/dist/lib/ontology-graph/org/index.js +513 -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 +95 -0
- package/dist/lib/ontology-graph/org/text.js +315 -0
- package/dist/lib/ontology-graph/org/types.d.ts +452 -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 +142 -0
- package/dist/lib/ontology-graph/pages/render.js +682 -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 +251 -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 +792 -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 +44 -0
- package/dist/lib/ontology-graph/read/names.js +292 -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 +100 -0
- package/dist/lib/ontology-graph/replay/engine.js +1174 -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 +90 -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 +73 -0
- package/dist/lib/ontology-graph/schema/authority.js +157 -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 +1183 -0
- package/dist/lib/ontology-graph/types.js +131 -0
- package/dist/lib/secret-scan/gitleaks-rules.generated.js +1 -1
- package/dist/utils/frontmatter.d.ts +14 -0
- package/dist/utils/frontmatter.js +18 -0
- package/dist/utils/interactive-caller.js +1 -1
- package/package.json +8 -8
package/dist/commands/mesh.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { reportingRuntimeState } from "../lib/mesh/live/reporting-privacy.js";
|
|
2
2
|
/**
|
|
3
3
|
* `hq mesh` — work-mesh verbs for agents and local sessions.
|
|
4
4
|
*
|
|
@@ -1154,9 +1154,10 @@ async function runPrdSync(opts) {
|
|
|
1154
1154
|
// Asked once. With HQ Anywhere off the events of a session with a verified
|
|
1155
1155
|
// company binding are still sent (emitEvents); the story claim below is a
|
|
1156
1156
|
// Board write on the person's behalf and stays off.
|
|
1157
|
-
const
|
|
1157
|
+
const reporting = await reportingRuntimeState(isMachineIdentity());
|
|
1158
|
+
const reportingOn = reporting === "on";
|
|
1158
1159
|
const emitted = await emitEvents({
|
|
1159
|
-
|
|
1160
|
+
reportingState: async () => reporting,
|
|
1160
1161
|
workMeshRoot: meshRoot,
|
|
1161
1162
|
poster,
|
|
1162
1163
|
newEvents: events,
|
|
@@ -2665,7 +2666,7 @@ async function runSessionEnqueue(cliKind, opts) {
|
|
|
2665
2666
|
baseUrl: resolveVaultApiBase(process.env),
|
|
2666
2667
|
});
|
|
2667
2668
|
const summary = await emitEvents({
|
|
2668
|
-
|
|
2669
|
+
reportingState: () => reportingRuntimeState(isMachineIdentity()),
|
|
2669
2670
|
workMeshRoot: meshRoot,
|
|
2670
2671
|
poster,
|
|
2671
2672
|
newEvents: [event],
|
|
@@ -2751,7 +2752,7 @@ async function runMeshEmit(opts) {
|
|
|
2751
2752
|
skipped = backlog.skipped;
|
|
2752
2753
|
newEvents = backlog.events;
|
|
2753
2754
|
}
|
|
2754
|
-
const summary = await emitEvents({
|
|
2755
|
+
const summary = await emitEvents({ reportingState: () => reportingRuntimeState(isMachineIdentity()), workMeshRoot: meshRoot, poster, newEvents });
|
|
2755
2756
|
const out = {
|
|
2756
2757
|
ok: true,
|
|
2757
2758
|
action: "emit",
|
|
@@ -2779,7 +2780,7 @@ async function runSessionFlush(opts) {
|
|
|
2779
2780
|
// In direct mode this is one drain cycle: the first run on a machine moves
|
|
2780
2781
|
// the queued files aside and posts nothing (US-038, owner decision 70).
|
|
2781
2782
|
const { summary, firstRun, setAside } = await flushForEmitMode(resolveMeshEmitMode(), {
|
|
2782
|
-
|
|
2783
|
+
reportingState: () => reportingRuntimeState(isMachineIdentity()),
|
|
2783
2784
|
workMeshRoot: workMeshHomeRoot(),
|
|
2784
2785
|
workContextRoot: workContextHomeRoot(),
|
|
2785
2786
|
poster,
|
|
@@ -3234,6 +3235,43 @@ async function runMeshPushStatus(opts) {
|
|
|
3234
3235
|
if (status.status === "stale")
|
|
3235
3236
|
process.exitCode = 1;
|
|
3236
3237
|
}
|
|
3238
|
+
/**
|
|
3239
|
+
* Start the Work Mesh daemon with the Linux duplicate user unit check around
|
|
3240
|
+
* it (boxes that run Work Mesh from /etc/systemd/system/hq-mesh-daemon.service
|
|
3241
|
+
* and also carry a per-user unit). Returns null when this process belongs to
|
|
3242
|
+
* the removed user unit and must exit. A process of the system unit removes
|
|
3243
|
+
* the user unit only after `start` has taken the pid lock; when another live
|
|
3244
|
+
* daemon holds the lock, `start` throws as before and nothing is removed.
|
|
3245
|
+
* The check itself never throws and never stops the daemon from starting.
|
|
3246
|
+
*/
|
|
3247
|
+
export async function startMeshDaemonWithDuplicateCheck(start, hooks = {}) {
|
|
3248
|
+
let check = {};
|
|
3249
|
+
if (hooks.reconcile || process.platform === "linux") {
|
|
3250
|
+
try {
|
|
3251
|
+
const reconcile = hooks.reconcile ?? (async () => {
|
|
3252
|
+
const { reconcileDuplicateMeshUnit } = await import("../lib/mesh/live/daemon/duplicate-unit.js");
|
|
3253
|
+
return reconcileDuplicateMeshUnit();
|
|
3254
|
+
});
|
|
3255
|
+
check = await reconcile();
|
|
3256
|
+
}
|
|
3257
|
+
catch (err) {
|
|
3258
|
+
console.error(`hq mesh daemon: duplicate unit check failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
3259
|
+
}
|
|
3260
|
+
}
|
|
3261
|
+
if (check.exitAfter === true)
|
|
3262
|
+
return null;
|
|
3263
|
+
const handle = await start();
|
|
3264
|
+
if (check.removeAfterLock === true) {
|
|
3265
|
+
const onLockHeld = hooks.onLockHeld ?? (async (lockDir) => {
|
|
3266
|
+
const { removeDuplicateUserUnitOnceSettled } = await import("../lib/mesh/live/daemon/duplicate-unit.js");
|
|
3267
|
+
return removeDuplicateUserUnitOnceSettled({ lockDir });
|
|
3268
|
+
});
|
|
3269
|
+
void onLockHeld(handle.dir).catch((err) => {
|
|
3270
|
+
console.error(`hq mesh daemon: duplicate unit removal failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
3271
|
+
});
|
|
3272
|
+
}
|
|
3273
|
+
return handle;
|
|
3274
|
+
}
|
|
3237
3275
|
/**
|
|
3238
3276
|
* The resident Work Mesh loop. `hq daemon` runs it as its `mesh` service
|
|
3239
3277
|
* (`hq daemon service mesh`); `hq mesh daemon run`, which older standalone
|
|
@@ -3245,10 +3283,12 @@ export async function runMeshDaemonService(opts = {}) {
|
|
|
3245
3283
|
async function runDaemonRun(opts = {}) {
|
|
3246
3284
|
const { runMeshDaemon } = await import("../lib/mesh/live/daemon/run.js");
|
|
3247
3285
|
const hqRoot = opts.hqRoot?.trim() || undefined;
|
|
3248
|
-
const handle = await runMeshDaemon({
|
|
3286
|
+
const handle = await startMeshDaemonWithDuplicateCheck(() => runMeshDaemon({
|
|
3249
3287
|
...(hqRoot ? { hqRoot } : {}),
|
|
3250
3288
|
enableWorkCache: true,
|
|
3251
|
-
});
|
|
3289
|
+
}));
|
|
3290
|
+
if (!handle)
|
|
3291
|
+
return;
|
|
3252
3292
|
// Stay alive until signal handlers call stop + exit.
|
|
3253
3293
|
await new Promise(() => {
|
|
3254
3294
|
void handle;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `hq ontology ...`: the ontology graph (sourced facts, typed edges, replay
|
|
3
|
+
* rebuild). This file only parses flags, resolves the company and graph
|
|
4
|
+
* folder, and prints. Each subcommand calls one entry point of a package under
|
|
5
|
+
* src/lib/ontology-graph/ (see CONTRACT.md there), imported on demand so a
|
|
6
|
+
* read command never loads the replay engine.
|
|
7
|
+
*
|
|
8
|
+
* hq ontology rebuild --company <slug> [--from D --to D] [--resume] [--budget-tokens N] [--no-model] [--dry-run]
|
|
9
|
+
* hq ontology update --company <slug> [--input <path>] [--budget-tokens N] [--no-model]
|
|
10
|
+
* hq ontology lookup <name> [--page] | neighbors <id> [--depth N] | search <text> | traverse <from> [<to>]
|
|
11
|
+
* hq ontology lint [--strict] [--coverage] | proposals list|accept|nope|undo [--set <name>] | brief
|
|
12
|
+
* hq ontology org-chart draft | confirm --from <file> [--yes] | show
|
|
13
|
+
* hq ontology org observed [--write] | compare | person <name> [--view company|member] [--as-of D] [--model]
|
|
14
|
+
* hq ontology daily | job install|uninstall|status
|
|
15
|
+
*
|
|
16
|
+
* No identity flag is needed (correction C5). Without `--member` the read
|
|
17
|
+
* commands and the brief take the member signed in to the CLI, and the
|
|
18
|
+
* audience keys are the `facts/@<key>` folders the member's graph holds.
|
|
19
|
+
* `rebuild`, `update`, `daily` and the proposals commands find the signed-in
|
|
20
|
+
* member in their own packages.
|
|
21
|
+
*
|
|
22
|
+
* The graph lives in `companies/<slug>/.hq/ontology-graph/` (a `.hq` folder is
|
|
23
|
+
* ignored by sync and by git), is local to this machine and is never uploaded.
|
|
24
|
+
* `--graph-root` or HQ_ONTOLOGY_GRAPH_ROOT points it elsewhere. `hq core ontology` (the checkpoint steps over
|
|
25
|
+
* the old `ontology/entities/` folder) is a different command and is unchanged.
|
|
26
|
+
*/
|
|
27
|
+
import { Command } from "commander";
|
|
28
|
+
import type { GraphContext, MemberIdentity } from "../lib/ontology-graph/types.js";
|
|
29
|
+
export declare class OntologyGraphUsageError extends Error {
|
|
30
|
+
constructor(message: string);
|
|
31
|
+
}
|
|
32
|
+
interface ScopeOptions {
|
|
33
|
+
company?: string;
|
|
34
|
+
hqRoot?: string;
|
|
35
|
+
graphRoot?: string;
|
|
36
|
+
member?: string;
|
|
37
|
+
audienceKey?: string[];
|
|
38
|
+
json?: boolean;
|
|
39
|
+
}
|
|
40
|
+
/** Environment variables for the member identity (correction C2). */
|
|
41
|
+
export declare const MEMBER_ENV = "HQ_ONTOLOGY_MEMBER";
|
|
42
|
+
export declare const MEMBER_AUDIENCE_KEYS_ENV = "HQ_ONTOLOGY_AUDIENCE_KEYS";
|
|
43
|
+
/**
|
|
44
|
+
* The member a run is for: `--member <person uid>` (else HQ_ONTOLOGY_MEMBER)
|
|
45
|
+
* and the audience keys the member holds from repeated `--audience-key` (else
|
|
46
|
+
* the comma-separated HQ_ONTOLOGY_AUDIENCE_KEYS). Undefined when no member is
|
|
47
|
+
* given; readers then read company scope only or refuse.
|
|
48
|
+
*/
|
|
49
|
+
export declare function resolveMemberIdentity(options: Pick<ScopeOptions, "member" | "audienceKey">, env?: NodeJS.ProcessEnv): MemberIdentity | undefined;
|
|
50
|
+
export interface OntologyGraphCommandDeps {
|
|
51
|
+
/** Receives stdout text. Default: process.stdout. */
|
|
52
|
+
write?: (text: string) => void;
|
|
53
|
+
/** Receives the exit code when it is not 0. Default: sets process.exitCode. */
|
|
54
|
+
setExitCode?: (code: number) => void;
|
|
55
|
+
/** Fills in the member for read commands. Default: `resolveReadMember` in read/member.ts. */
|
|
56
|
+
resolveReadMember?: (context: GraphContext) => GraphContext;
|
|
57
|
+
}
|
|
58
|
+
/** Resolves the company and the graph folder for one invocation. */
|
|
59
|
+
export declare function resolveGraphContext(options: ScopeOptions): GraphContext;
|
|
60
|
+
export declare function registerOntologyCommand(program: Command, deps?: OntologyGraphCommandDeps): Command;
|
|
61
|
+
export {};
|
|
62
|
+
//# sourceMappingURL=ontology-graph.d.ts.map
|
|
@@ -0,0 +1,439 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `hq ontology ...`: the ontology graph (sourced facts, typed edges, replay
|
|
3
|
+
* rebuild). This file only parses flags, resolves the company and graph
|
|
4
|
+
* folder, and prints. Each subcommand calls one entry point of a package under
|
|
5
|
+
* src/lib/ontology-graph/ (see CONTRACT.md there), imported on demand so a
|
|
6
|
+
* read command never loads the replay engine.
|
|
7
|
+
*
|
|
8
|
+
* hq ontology rebuild --company <slug> [--from D --to D] [--resume] [--budget-tokens N] [--no-model] [--dry-run]
|
|
9
|
+
* hq ontology update --company <slug> [--input <path>] [--budget-tokens N] [--no-model]
|
|
10
|
+
* hq ontology lookup <name> [--page] | neighbors <id> [--depth N] | search <text> | traverse <from> [<to>]
|
|
11
|
+
* hq ontology lint [--strict] [--coverage] | proposals list|accept|nope|undo [--set <name>] | brief
|
|
12
|
+
* hq ontology org-chart draft | confirm --from <file> [--yes] | show
|
|
13
|
+
* hq ontology org observed [--write] | compare | person <name> [--view company|member] [--as-of D] [--model]
|
|
14
|
+
* hq ontology daily | job install|uninstall|status
|
|
15
|
+
*
|
|
16
|
+
* No identity flag is needed (correction C5). Without `--member` the read
|
|
17
|
+
* commands and the brief take the member signed in to the CLI, and the
|
|
18
|
+
* audience keys are the `facts/@<key>` folders the member's graph holds.
|
|
19
|
+
* `rebuild`, `update`, `daily` and the proposals commands find the signed-in
|
|
20
|
+
* member in their own packages.
|
|
21
|
+
*
|
|
22
|
+
* The graph lives in `companies/<slug>/.hq/ontology-graph/` (a `.hq` folder is
|
|
23
|
+
* ignored by sync and by git), is local to this machine and is never uploaded.
|
|
24
|
+
* `--graph-root` or HQ_ONTOLOGY_GRAPH_ROOT points it elsewhere. `hq core ontology` (the checkpoint steps over
|
|
25
|
+
* the old `ontology/entities/` folder) is a different command and is unchanged.
|
|
26
|
+
*/
|
|
27
|
+
import { InvalidArgumentError } from "commander";
|
|
28
|
+
import { resolveOntologyCompany } from "../lib/checkpoint-ontology/company.js";
|
|
29
|
+
import { GraphCompanyMismatchError, GraphCompanyStampError, GraphCompanyUnclaimedError, assertGraphWritableFor, resolveGraphRoot } from "../lib/ontology-graph/store/paths.js";
|
|
30
|
+
import { resolveLiveRoot } from "../utils/hq-roots.js";
|
|
31
|
+
export class OntologyGraphUsageError extends Error {
|
|
32
|
+
constructor(message) {
|
|
33
|
+
super(message);
|
|
34
|
+
this.name = "OntologyGraphUsageError";
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/** Environment variables for the member identity (correction C2). */
|
|
38
|
+
export const MEMBER_ENV = "HQ_ONTOLOGY_MEMBER";
|
|
39
|
+
export const MEMBER_AUDIENCE_KEYS_ENV = "HQ_ONTOLOGY_AUDIENCE_KEYS";
|
|
40
|
+
const PERSON_UID = /^[A-Za-z0-9][A-Za-z0-9_-]{2,}$/;
|
|
41
|
+
const AUDIENCE_KEY_HEX = /^[0-9a-f]{16}$/;
|
|
42
|
+
/**
|
|
43
|
+
* The member a run is for: `--member <person uid>` (else HQ_ONTOLOGY_MEMBER)
|
|
44
|
+
* and the audience keys the member holds from repeated `--audience-key` (else
|
|
45
|
+
* the comma-separated HQ_ONTOLOGY_AUDIENCE_KEYS). Undefined when no member is
|
|
46
|
+
* given; readers then read company scope only or refuse.
|
|
47
|
+
*/
|
|
48
|
+
export function resolveMemberIdentity(options, env = process.env) {
|
|
49
|
+
const personUid = (options.member ?? env[MEMBER_ENV] ?? "").trim();
|
|
50
|
+
const rawKeys = options.audienceKey && options.audienceKey.length > 0
|
|
51
|
+
? options.audienceKey
|
|
52
|
+
: (env[MEMBER_AUDIENCE_KEYS_ENV] ?? "").split(",");
|
|
53
|
+
const keys = [...new Set(rawKeys.map((key) => key.trim()).filter((key) => key !== "" && key !== "company"))].sort();
|
|
54
|
+
if (personUid === "") {
|
|
55
|
+
if (keys.length > 0)
|
|
56
|
+
throw new OntologyGraphUsageError("ontology: --audience-key needs --member <person uid>");
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
if (!PERSON_UID.test(personUid))
|
|
60
|
+
throw new OntologyGraphUsageError("ontology: --member is not a person uid");
|
|
61
|
+
for (const key of keys) {
|
|
62
|
+
if (!AUDIENCE_KEY_HEX.test(key))
|
|
63
|
+
throw new OntologyGraphUsageError(`ontology: not an audience key (16 hex): ${key}`);
|
|
64
|
+
}
|
|
65
|
+
return { personUid, audienceKeys: keys };
|
|
66
|
+
}
|
|
67
|
+
const ISO_DATE = /^\d{4}-\d{2}-\d{2}$/;
|
|
68
|
+
function isoDateArg(value) {
|
|
69
|
+
if (!ISO_DATE.test(value) || Number.isNaN(Date.parse(`${value}T00:00:00Z`))) {
|
|
70
|
+
throw new InvalidArgumentError("expected a date as YYYY-MM-DD");
|
|
71
|
+
}
|
|
72
|
+
return value;
|
|
73
|
+
}
|
|
74
|
+
function positiveIntArg(value) {
|
|
75
|
+
const parsed = Number(value);
|
|
76
|
+
if (!Number.isInteger(parsed) || parsed < 1)
|
|
77
|
+
throw new InvalidArgumentError("expected a positive whole number");
|
|
78
|
+
return parsed;
|
|
79
|
+
}
|
|
80
|
+
/** A token budget. 0 is allowed and means rules only: no model call is made. */
|
|
81
|
+
function budgetArg(value) {
|
|
82
|
+
const parsed = Number(value);
|
|
83
|
+
if (value.trim() === "" || !Number.isInteger(parsed) || parsed < 0)
|
|
84
|
+
throw new InvalidArgumentError("expected a whole number, 0 or more");
|
|
85
|
+
return parsed;
|
|
86
|
+
}
|
|
87
|
+
function clockArg(value) {
|
|
88
|
+
if (!/^([01]?\d|2[0-3]):[0-5]\d$/.test(value))
|
|
89
|
+
throw new InvalidArgumentError("expected a time as HH:MM");
|
|
90
|
+
return value;
|
|
91
|
+
}
|
|
92
|
+
function depthArg(value) {
|
|
93
|
+
const parsed = Number(value);
|
|
94
|
+
if (!Number.isInteger(parsed) || parsed < 1 || parsed > 3)
|
|
95
|
+
throw new InvalidArgumentError("expected 1, 2 or 3");
|
|
96
|
+
return parsed;
|
|
97
|
+
}
|
|
98
|
+
/** Resolves the company and the graph folder for one invocation. */
|
|
99
|
+
export function resolveGraphContext(options) {
|
|
100
|
+
const hqRoot = resolveLiveRoot({ hqRoot: options.hqRoot });
|
|
101
|
+
const resolution = resolveOntologyCompany(hqRoot, options.company);
|
|
102
|
+
if (!resolution.ok) {
|
|
103
|
+
throw new OntologyGraphUsageError(options.company
|
|
104
|
+
? `ontology: company rejected: ${resolution.reason}`
|
|
105
|
+
: "ontology: --company <slug> is required");
|
|
106
|
+
}
|
|
107
|
+
const companyRoot = resolution.company.dir;
|
|
108
|
+
const member = resolveMemberIdentity(options);
|
|
109
|
+
const graphRoot = resolveGraphRoot({ companyRoot, flag: options.graphRoot });
|
|
110
|
+
// The root can be shared between companies (the flag, the env var): a folder stamped for another company,
|
|
111
|
+
// with a stamp that cannot be trusted, or at a shared root with a graph and no stamp, is refused for reads
|
|
112
|
+
// and writes alike. Nothing is stamped here: only a writer stamps.
|
|
113
|
+
try {
|
|
114
|
+
assertGraphWritableFor(graphRoot, resolution.company.slug, companyRoot);
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
if (error instanceof GraphCompanyMismatchError || error instanceof GraphCompanyStampError || error instanceof GraphCompanyUnclaimedError) {
|
|
118
|
+
throw new OntologyGraphUsageError(error.message);
|
|
119
|
+
}
|
|
120
|
+
throw error;
|
|
121
|
+
}
|
|
122
|
+
return {
|
|
123
|
+
hqRoot,
|
|
124
|
+
company: resolution.company.slug,
|
|
125
|
+
companyRoot,
|
|
126
|
+
graphRoot,
|
|
127
|
+
json: Boolean(options.json),
|
|
128
|
+
...(member ? { member } : {}),
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
function orgViewArg(value) {
|
|
132
|
+
if (value !== "company" && value !== "member")
|
|
133
|
+
throw new InvalidArgumentError("expected company or member");
|
|
134
|
+
return value;
|
|
135
|
+
}
|
|
136
|
+
function scoped(command) {
|
|
137
|
+
return command
|
|
138
|
+
.option("--company <slug>", "company whose graph to use")
|
|
139
|
+
.option("--hq-root <path>", "HQ installation to operate on")
|
|
140
|
+
.option("--graph-root <path>", "graph folder to use instead of companies/<slug>/.hq/ontology-graph (env HQ_ONTOLOGY_GRAPH_ROOT)")
|
|
141
|
+
.option("--member <person uid>", "member the graph is built or read for (env HQ_ONTOLOGY_MEMBER)")
|
|
142
|
+
.option("--audience-key <key>", "audience key the member holds; repeat for more (env HQ_ONTOLOGY_AUDIENCE_KEYS, comma-separated)", (value, previous = []) => [...previous, value])
|
|
143
|
+
.option("--json", "print JSON");
|
|
144
|
+
}
|
|
145
|
+
/** Options given on a subcommand or on any of its parents, nearest first. */
|
|
146
|
+
function mergedOptions(command) {
|
|
147
|
+
const chain = [];
|
|
148
|
+
for (let current = command; current; current = current.parent)
|
|
149
|
+
chain.unshift(current);
|
|
150
|
+
return Object.assign({}, ...chain.map((entry) => entry.opts()));
|
|
151
|
+
}
|
|
152
|
+
export function registerOntologyCommand(program, deps = {}) {
|
|
153
|
+
const write = deps.write ?? ((text) => void process.stdout.write(text));
|
|
154
|
+
const setExitCode = deps.setExitCode ?? ((code) => void (process.exitCode = code));
|
|
155
|
+
const emit = (context, output) => {
|
|
156
|
+
const text = context.json ? JSON.stringify(output.json, null, 2) : output.text;
|
|
157
|
+
write(text.endsWith("\n") ? text : `${text}\n`);
|
|
158
|
+
if (output.exitCode)
|
|
159
|
+
setExitCode(output.exitCode);
|
|
160
|
+
};
|
|
161
|
+
/** Wraps an action: resolve the context, run the entry point, print. */
|
|
162
|
+
const run = (entry, mode = "plain") => async function action(...raw) {
|
|
163
|
+
const args = raw.filter((value) => typeof value === "string");
|
|
164
|
+
const options = mergedOptions(this);
|
|
165
|
+
let context = resolveGraphContext(options);
|
|
166
|
+
if (mode === "read") {
|
|
167
|
+
// No identity flags needed (correction C5): the signed-in member and the keys their graph holds.
|
|
168
|
+
const { resolveReadMember } = await import("../lib/ontology-graph/read/member.js");
|
|
169
|
+
context = (deps.resolveReadMember ?? resolveReadMember)(context);
|
|
170
|
+
}
|
|
171
|
+
emit(context, await entry(context, options, args));
|
|
172
|
+
};
|
|
173
|
+
/** A read command: `run` with the member filled in from the sign-in when no flag names one. */
|
|
174
|
+
const read = (entry) => run(entry, "read");
|
|
175
|
+
const ontology = program
|
|
176
|
+
.command("ontology")
|
|
177
|
+
.description("Ontology graph: sourced facts, typed relationships, rebuilt from the files on this machine (local only)");
|
|
178
|
+
scoped(ontology.command("rebuild"))
|
|
179
|
+
.description("Rebuild the graph: import the old entity files, then replay the vault day by day")
|
|
180
|
+
.option("--from <date>", "first day to replay (YYYY-MM-DD)", isoDateArg)
|
|
181
|
+
.option("--to <date>", "last day to replay (YYYY-MM-DD)", isoDateArg)
|
|
182
|
+
.option("--resume", "continue from the last replayed day")
|
|
183
|
+
.option("--budget-tokens <n>", "stop model calls after this many input tokens; 0 runs rules only", budgetArg)
|
|
184
|
+
.option("--no-model", "rules only: make no model call and leave model work pending")
|
|
185
|
+
.option("--dry-run", "read and count, write nothing")
|
|
186
|
+
.action(run(async (context, options) => {
|
|
187
|
+
const { rebuildCommand } = await import("../lib/ontology-graph/replay/index.js");
|
|
188
|
+
return rebuildCommand(context, {
|
|
189
|
+
...(options.from ? { from: options.from } : {}),
|
|
190
|
+
...(options.to ? { to: options.to } : {}),
|
|
191
|
+
resume: Boolean(options.resume),
|
|
192
|
+
...(options.budgetTokens !== undefined ? { budgetTokens: options.budgetTokens } : {}),
|
|
193
|
+
...(options.model === false ? { noModel: true } : {}),
|
|
194
|
+
dryRun: Boolean(options.dryRun),
|
|
195
|
+
});
|
|
196
|
+
}));
|
|
197
|
+
scoped(ontology.command("update"))
|
|
198
|
+
.description("Replay the days after the last replayed day (the daily job), or one input file")
|
|
199
|
+
.option("--input <path>", "replay this one signal, source or document")
|
|
200
|
+
.option("--budget-tokens <n>", "stop model calls after this many input tokens; 0 runs rules only", budgetArg)
|
|
201
|
+
.option("--no-model", "rules only: make no model call and leave model work pending")
|
|
202
|
+
.option("--full-listing", "list the whole corpus again instead of only new and changed files")
|
|
203
|
+
.option("--dry-run", "read and count, write nothing")
|
|
204
|
+
.action(run(async (context, options) => {
|
|
205
|
+
const { updateCommand } = await import("../lib/ontology-graph/replay/index.js");
|
|
206
|
+
return updateCommand(context, {
|
|
207
|
+
...(options.input ? { input: options.input } : {}),
|
|
208
|
+
...(options.budgetTokens !== undefined ? { budgetTokens: options.budgetTokens } : {}),
|
|
209
|
+
...(options.model === false ? { noModel: true } : {}),
|
|
210
|
+
...(options.fullListing ? { fullListing: true } : {}),
|
|
211
|
+
dryRun: Boolean(options.dryRun),
|
|
212
|
+
});
|
|
213
|
+
}));
|
|
214
|
+
scoped(ontology.command("lookup"))
|
|
215
|
+
.description("Find an entity by name and print its facts, each with a source and date")
|
|
216
|
+
.argument("<name>", "name, alias, email or <type>/<slug>")
|
|
217
|
+
.option("--as-of <date>", "facts open on this day (YYYY-MM-DD)", isoDateArg)
|
|
218
|
+
.option("--limit <n>", "most relationships to print", positiveIntArg)
|
|
219
|
+
.option("--page", "print the compiled page instead, with lines outside your audiences removed")
|
|
220
|
+
.action(read(async (context, options, [name]) => {
|
|
221
|
+
const { lookupCommand } = await import("../lib/ontology-graph/read/index.js");
|
|
222
|
+
return lookupCommand(context, {
|
|
223
|
+
name,
|
|
224
|
+
...(options.asOf ? { asOf: options.asOf } : {}),
|
|
225
|
+
...(options.limit !== undefined ? { limit: options.limit } : {}),
|
|
226
|
+
...(options.page ? { page: true } : {}),
|
|
227
|
+
});
|
|
228
|
+
}));
|
|
229
|
+
scoped(ontology.command("neighbors"))
|
|
230
|
+
.description("List the entities one relationship away, with the source beside each")
|
|
231
|
+
.argument("<id>", "entity as <type>/<slug>, or a name")
|
|
232
|
+
.option("--verb <verb>", "only this relationship")
|
|
233
|
+
.option("--depth <n>", "how many steps away, 1 to 3 (default 1)", depthArg)
|
|
234
|
+
.option("--limit <n>", "most relationships to print", positiveIntArg)
|
|
235
|
+
.option("--as-of <date>", "relationships open on this day (YYYY-MM-DD)", isoDateArg)
|
|
236
|
+
.action(read(async (context, options, [id]) => {
|
|
237
|
+
const { neighborsCommand } = await import("../lib/ontology-graph/read/index.js");
|
|
238
|
+
return neighborsCommand(context, {
|
|
239
|
+
id,
|
|
240
|
+
...(options.verb ? { verb: options.verb } : {}),
|
|
241
|
+
...(options.depth !== undefined ? { depth: options.depth } : {}),
|
|
242
|
+
...(options.limit !== undefined ? { limit: options.limit } : {}),
|
|
243
|
+
...(options.asOf ? { asOf: options.asOf } : {}),
|
|
244
|
+
});
|
|
245
|
+
}));
|
|
246
|
+
scoped(ontology.command("search"))
|
|
247
|
+
.description("Search the compiled entity pages")
|
|
248
|
+
.argument("<text>", "text to search for")
|
|
249
|
+
.option("--limit <n>", "most results to print", positiveIntArg)
|
|
250
|
+
.action(read(async (context, options, [text]) => {
|
|
251
|
+
const { searchCommand } = await import("../lib/ontology-graph/read/index.js");
|
|
252
|
+
return searchCommand(context, { text, ...(options.limit !== undefined ? { limit: options.limit } : {}) });
|
|
253
|
+
}));
|
|
254
|
+
scoped(ontology.command("traverse"))
|
|
255
|
+
.description("Follow relationships outward from an entity, or find the shortest path between two")
|
|
256
|
+
.argument("<from>", "entity as <type>/<slug>, or a name")
|
|
257
|
+
.argument("[to]", "second entity: print the shortest path from the first to this one")
|
|
258
|
+
.option("--verb <verb>", "relationship to follow; a comma list follows several")
|
|
259
|
+
.option("--depth <n>", "how many steps to follow, 1 to 3 (default 1, or 3 with a second entity)", depthArg)
|
|
260
|
+
.option("--limit <n>", "most steps to print", positiveIntArg)
|
|
261
|
+
.option("--as-of <date>", "relationships open on this day (YYYY-MM-DD)", isoDateArg)
|
|
262
|
+
.action(read(async (context, options, [id, to]) => {
|
|
263
|
+
const { traverseCommand } = await import("../lib/ontology-graph/read/index.js");
|
|
264
|
+
return traverseCommand(context, {
|
|
265
|
+
id,
|
|
266
|
+
// A path between two entities is looked for as far as a walk may go unless --depth says less.
|
|
267
|
+
depth: options.depth ?? (to ? 3 : 1),
|
|
268
|
+
...(to ? { to } : {}),
|
|
269
|
+
...(options.verb ? { verb: options.verb } : {}),
|
|
270
|
+
...(options.limit !== undefined ? { limit: options.limit } : {}),
|
|
271
|
+
...(options.asOf ? { asOf: options.asOf } : {}),
|
|
272
|
+
});
|
|
273
|
+
}));
|
|
274
|
+
scoped(ontology.command("brief"))
|
|
275
|
+
.description("Write brief.md, the short summary every session starts with")
|
|
276
|
+
.option("--stdout", "print the brief without writing it")
|
|
277
|
+
.action(read(async (context, options) => {
|
|
278
|
+
const { briefCommand } = await import("../lib/ontology-graph/read/index.js");
|
|
279
|
+
return briefCommand(context, { stdout: Boolean(options.stdout) });
|
|
280
|
+
}));
|
|
281
|
+
scoped(ontology.command("lint"))
|
|
282
|
+
.description("Check the graph and print a count per kind of problem")
|
|
283
|
+
.option("--no-proposals", "report only; do not file proposals")
|
|
284
|
+
.option("--strict", "exit 1 when an error-class finding exists")
|
|
285
|
+
.option("--coverage", "print the org-coverage measures (a table, or JSON with --json) and write nothing")
|
|
286
|
+
.action(run(async (context, options) => {
|
|
287
|
+
const { lintCommand } = await import("../lib/ontology-graph/lint/index.js");
|
|
288
|
+
return lintCommand(context, {
|
|
289
|
+
fileProposals: options.proposals !== false,
|
|
290
|
+
strict: Boolean(options.strict),
|
|
291
|
+
...(options.coverage ? { coverage: true } : {}),
|
|
292
|
+
});
|
|
293
|
+
}));
|
|
294
|
+
const proposals = ontology.command("proposals").description("Review the changes lint and the replay propose");
|
|
295
|
+
scoped(proposals.command("list"))
|
|
296
|
+
.description("List open proposals")
|
|
297
|
+
.option("--kind <kind>", "only this kind")
|
|
298
|
+
.option("--set <name>", "only this reviewed set, for example \"org chart draft\"")
|
|
299
|
+
.option("--limit <n>", "most proposals to print", positiveIntArg)
|
|
300
|
+
.action(run(async (context, options) => {
|
|
301
|
+
const { proposalsListCommand } = await import("../lib/ontology-graph/proposals/index.js");
|
|
302
|
+
return proposalsListCommand(context, {
|
|
303
|
+
...(options.kind ? { kind: options.kind } : {}),
|
|
304
|
+
...(options.set ? { set: options.set } : {}),
|
|
305
|
+
...(options.limit !== undefined ? { limit: options.limit } : {}),
|
|
306
|
+
});
|
|
307
|
+
}));
|
|
308
|
+
for (const decision of ["accept", "nope"]) {
|
|
309
|
+
scoped(proposals.command(decision))
|
|
310
|
+
.description(decision === "accept"
|
|
311
|
+
? "Accept a proposal and apply its change, or a whole reviewed set with --set"
|
|
312
|
+
: "Decline a proposal, or a whole reviewed set with --set")
|
|
313
|
+
.argument("[id]", "proposal id")
|
|
314
|
+
.option("--set <name>", `${decision} every open proposal in this set`)
|
|
315
|
+
.option("--as <person>", "member making the decision (default: the signed-in member)")
|
|
316
|
+
.action(run(async (context, options, [id]) => {
|
|
317
|
+
const { proposalsDecideCommand } = await import("../lib/ontology-graph/proposals/index.js");
|
|
318
|
+
return proposalsDecideCommand(context, {
|
|
319
|
+
decision,
|
|
320
|
+
...(id ? { id } : {}),
|
|
321
|
+
...(options.set ? { set: options.set } : {}),
|
|
322
|
+
...(options.as ? { as: options.as } : {}),
|
|
323
|
+
});
|
|
324
|
+
}));
|
|
325
|
+
}
|
|
326
|
+
scoped(proposals.command("undo"))
|
|
327
|
+
.description("Undo an accepted proposal: remove the rows it added and reopen the rows it closed")
|
|
328
|
+
.argument("[id]", "proposal id")
|
|
329
|
+
.option("--set <name>", "take back every answer given to this set")
|
|
330
|
+
.option("--as <person>", "member undoing the decision (default: the signed-in member)")
|
|
331
|
+
.action(run(async (context, options, [id]) => {
|
|
332
|
+
const { proposalsUndoCommand } = await import("../lib/ontology-graph/proposals/index.js");
|
|
333
|
+
return proposalsUndoCommand(context, {
|
|
334
|
+
...(id ? { id } : {}),
|
|
335
|
+
...(options.set ? { set: options.set } : {}),
|
|
336
|
+
...(options.as ? { as: options.as } : {}),
|
|
337
|
+
});
|
|
338
|
+
}));
|
|
339
|
+
const orgChart = ontology
|
|
340
|
+
.command("org-chart")
|
|
341
|
+
.description("The org chart a person confirms: role, team and manager per person, above every other source");
|
|
342
|
+
scoped(orgChart.command("draft"))
|
|
343
|
+
.description("Print the current org chart draft as a table to correct")
|
|
344
|
+
.action(run(async (context) => {
|
|
345
|
+
const { orgChartDraftCommand } = await import("../lib/ontology-graph/proposals/org-chart.js");
|
|
346
|
+
return orgChartDraftCommand(context);
|
|
347
|
+
}));
|
|
348
|
+
scoped(orgChart.command("confirm"))
|
|
349
|
+
.description("Show what a corrected table would change in people/org-chart.yaml; write it with --yes")
|
|
350
|
+
.requiredOption("--from <file>", "the corrected draft (markdown table) or a YAML file with a people list")
|
|
351
|
+
.option("--yes", "write the file; without it the change is only shown")
|
|
352
|
+
.option("--replace", "drop people the file does not mention instead of keeping their confirmed lines")
|
|
353
|
+
.option("--as <person>", "person uid of whoever confirms (default: the signed-in member)")
|
|
354
|
+
.action(run(async (context, options) => {
|
|
355
|
+
const { orgChartConfirmCommand } = await import("../lib/ontology-graph/proposals/org-chart.js");
|
|
356
|
+
return orgChartConfirmCommand(context, {
|
|
357
|
+
from: options.from,
|
|
358
|
+
yes: Boolean(options.yes),
|
|
359
|
+
replace: Boolean(options.replace),
|
|
360
|
+
...(options.as ? { as: options.as } : {}),
|
|
361
|
+
});
|
|
362
|
+
}));
|
|
363
|
+
scoped(orgChart.command("show"))
|
|
364
|
+
.description("Print the confirmed org chart")
|
|
365
|
+
.action(run(async (context) => {
|
|
366
|
+
const { orgChartShowCommand } = await import("../lib/ontology-graph/proposals/org-chart.js");
|
|
367
|
+
return orgChartShowCommand(context);
|
|
368
|
+
}));
|
|
369
|
+
const org = ontology
|
|
370
|
+
.command("org")
|
|
371
|
+
.description("The org as observed from behavior in the graph, beside the stated one. Inferred, never a confirmed fact");
|
|
372
|
+
/** The options the three observed-org commands share. */
|
|
373
|
+
const orgScoped = (command) => scoped(command)
|
|
374
|
+
.option("--view <view>", "company (company-wide rows only) or member (also the rows only this member may read)", orgViewArg)
|
|
375
|
+
.option("--as-of <date>", "the day the 30, 90 and 365 day windows end on (YYYY-MM-DD; default today)", isoDateArg)
|
|
376
|
+
.option("--model", "phrase each active person's observed role with one small model call");
|
|
377
|
+
const orgOptions = (options) => ({
|
|
378
|
+
...(options.view ? { view: options.view } : {}),
|
|
379
|
+
...(options.asOf ? { asOf: options.asOf } : {}),
|
|
380
|
+
model: Boolean(options.model),
|
|
381
|
+
});
|
|
382
|
+
orgScoped(org.command("observed"))
|
|
383
|
+
.description("Print the observed org: role, areas, who appears to direct whom, groups and de facto owners. Stores nothing without --write")
|
|
384
|
+
.option("--write", "also store the derived rows in the graph folder, marked as inferred")
|
|
385
|
+
.action(read(async (context, options) => {
|
|
386
|
+
const { orgObservedCommand } = await import("../lib/ontology-graph/org/index.js");
|
|
387
|
+
return orgObservedCommand(context, { ...orgOptions(options), write: options.write === true });
|
|
388
|
+
}));
|
|
389
|
+
orgScoped(org.command("compare"))
|
|
390
|
+
.description("Print stated beside observed: title, manager and listed owner against behavior. Changes nothing")
|
|
391
|
+
.action(read(async (context, options) => {
|
|
392
|
+
const { orgCompareCommand } = await import("../lib/ontology-graph/org/index.js");
|
|
393
|
+
return orgCompareCommand(context, orgOptions(options));
|
|
394
|
+
}));
|
|
395
|
+
orgScoped(org.command("person"))
|
|
396
|
+
.description("Print one person's observed activity by window, coverage, edges and stated claims. Changes nothing")
|
|
397
|
+
.argument("<name>", "the person's name or slug")
|
|
398
|
+
.action(read(async (context, options, args) => {
|
|
399
|
+
const { orgPersonCommand } = await import("../lib/ontology-graph/org/index.js");
|
|
400
|
+
return orgPersonCommand(context, { ...orgOptions(options), name: args[0] ?? "" });
|
|
401
|
+
}));
|
|
402
|
+
scoped(ontology.command("daily"))
|
|
403
|
+
.description("The daily job: update, lint, brief, once a day unless --force")
|
|
404
|
+
.option("--force", "run even when today's run is already done")
|
|
405
|
+
.option("--budget-tokens <n>", "stop model calls after this many input tokens; 0 runs rules only", budgetArg)
|
|
406
|
+
.action(run(async (context, options) => {
|
|
407
|
+
const { dailyCommand } = await import("../lib/ontology-graph/lint/daily-job.js");
|
|
408
|
+
return dailyCommand(context, {
|
|
409
|
+
force: Boolean(options.force),
|
|
410
|
+
...(options.budgetTokens !== undefined ? { budgetTokens: options.budgetTokens } : {}),
|
|
411
|
+
});
|
|
412
|
+
}));
|
|
413
|
+
const job = ontology.command("job").description("The scheduled daily job on this machine");
|
|
414
|
+
scoped(job.command("install"))
|
|
415
|
+
.description("Schedule the daily job for this company")
|
|
416
|
+
.option("--at <HH:MM>", "local time of day to run", clockArg)
|
|
417
|
+
.option("--budget-tokens <n>", "token budget the scheduled run passes on; 0 runs rules only", budgetArg)
|
|
418
|
+
.action(run(async (context, options) => {
|
|
419
|
+
const { jobInstallCommand } = await import("../lib/ontology-graph/lint/daily-job.js");
|
|
420
|
+
return jobInstallCommand(context, {
|
|
421
|
+
...(options.at ? { at: options.at } : {}),
|
|
422
|
+
...(options.budgetTokens !== undefined ? { budgetTokens: options.budgetTokens } : {}),
|
|
423
|
+
});
|
|
424
|
+
}));
|
|
425
|
+
scoped(job.command("uninstall"))
|
|
426
|
+
.description("Remove the scheduled daily job for this company")
|
|
427
|
+
.action(run(async (context) => {
|
|
428
|
+
const { jobUninstallCommand } = await import("../lib/ontology-graph/lint/daily-job.js");
|
|
429
|
+
return jobUninstallCommand(context);
|
|
430
|
+
}));
|
|
431
|
+
scoped(job.command("status"))
|
|
432
|
+
.description("Say whether the daily job is scheduled and when it last ran")
|
|
433
|
+
.action(run(async (context) => {
|
|
434
|
+
const { jobStatusCommand } = await import("../lib/ontology-graph/lint/daily-job.js");
|
|
435
|
+
return jobStatusCommand(context);
|
|
436
|
+
}));
|
|
437
|
+
return ontology;
|
|
438
|
+
}
|
|
439
|
+
//# sourceMappingURL=ontology-graph.js.map
|
|
@@ -47,7 +47,7 @@ export function registerPackageInstallCommand(parent) {
|
|
|
47
47
|
.option('--start-bot', "After install, create and start the pack's setup bot (packs with a setup: block); prints `bot: <name>`")
|
|
48
48
|
.option('--branch', 'Follow a ref instead of SHA-pinning (git content-pack flow)')
|
|
49
49
|
.option('--global', 'Install HQ into an agent runtime at user scope (requires the hq-anywhere-runtime flag)')
|
|
50
|
-
.option('--runtime <runtime>', 'Runtime for --global (claude | codex | chatgpt | grok)', 'claude')
|
|
50
|
+
.option('--runtime <runtime>', 'Runtime for --global (claude | codex | chatgpt | grok | antigravity)', 'claude')
|
|
51
51
|
.option('--via <mode>', 'With --global Claude: install directly or via plugin (direct | plugin)', 'direct')
|
|
52
52
|
.option('--marketplace-dir <dir>', 'With --via plugin: local Claude Code marketplace directory (or HQ_CLAUDE_PLUGIN_MARKETPLACE)')
|
|
53
53
|
.option('--dry-run', 'With --global: print every file and config diff without writing')
|
package/dist/commands/reindex.js
CHANGED
|
@@ -741,7 +741,7 @@ export function registerReindexCommand(program) {
|
|
|
741
741
|
program
|
|
742
742
|
.command('reindex')
|
|
743
743
|
.alias('master-sync')
|
|
744
|
-
.description('Surface namespaced skills, materialize legacy knowledge repos, regenerate the workers registry, and trust HQ hooks for Codex, Grok, and Claude Code')
|
|
744
|
+
.description('Surface namespaced skills, materialize legacy knowledge repos, regenerate the workers registry, and trust HQ hooks for Codex, Grok, and Claude Code (Antigravity: rule and MCP come from hq install --global; hooks pending)')
|
|
745
745
|
.option('--repo-root <path>', 'HQ root to operate on (defaults to the current directory)')
|
|
746
746
|
.option('--from-hook', 'Invoked from a Claude/Codex lifecycle hook: never wait on the per-root operation lock — if a sync/rescue holds it, skip this reindex instead of blocking the session (equivalent to --lock-timeout 0)')
|
|
747
747
|
.option('--lock-timeout <seconds>', 'Bound the wait for the per-root operation lock (seconds). 0 = refuse immediately; omitted = wait indefinitely (the interactive default). --from-hook implies 0; an explicit --lock-timeout wins.')
|
package/dist/index.js
CHANGED
|
@@ -187,7 +187,7 @@ async function runMonitorCheckFastWithRecovery(request) {
|
|
|
187
187
|
await runMainWithInstallTreeRecovery();
|
|
188
188
|
}
|
|
189
189
|
/**
|
|
190
|
-
* The SessionStart hook runs `hq
|
|
190
|
+
* The SessionStart hook runs `hq runners session-start` on every new session
|
|
191
191
|
* under a 2 s cap. Load only that command's module, not the command graph.
|
|
192
192
|
*/
|
|
193
193
|
async function runLaneSessionStartFastWithRecovery() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Dependency-free argv matcher for the `hq
|
|
2
|
+
* Dependency-free argv matcher for the `hq runners monitor-check` fast route.
|
|
3
3
|
* Imported statically by src/index.ts, so it must not import anything.
|
|
4
4
|
*/
|
|
5
5
|
export interface MonitorCheckFastRequest {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Dependency-free argv matcher for the `hq
|
|
2
|
+
* Dependency-free argv matcher for the `hq runners monitor-check` fast route.
|
|
3
3
|
* Imported statically by src/index.ts, so it must not import anything.
|
|
4
4
|
*/
|
|
5
5
|
const SAFE_SESSION_ID = /^[A-Za-z0-9._:-]{1,200}$/u;
|