@indigoai-us/hq-cloud 6.15.0 → 6.15.2
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/dist/bin/sync-mutation.d.ts +16 -0
- package/dist/bin/sync-mutation.d.ts.map +1 -0
- package/dist/bin/sync-mutation.js +60 -0
- package/dist/bin/sync-mutation.js.map +1 -0
- package/dist/bin/sync-mutation.test.d.ts +2 -0
- package/dist/bin/sync-mutation.test.d.ts.map +1 -0
- package/dist/bin/sync-mutation.test.js +165 -0
- package/dist/bin/sync-mutation.test.js.map +1 -0
- package/dist/bin/sync-runner-company.d.ts +8 -0
- package/dist/bin/sync-runner-company.d.ts.map +1 -1
- package/dist/bin/sync-runner-company.js +16 -0
- package/dist/bin/sync-runner-company.js.map +1 -1
- package/dist/bin/sync-runner-company.test.d.ts +2 -0
- package/dist/bin/sync-runner-company.test.d.ts.map +1 -0
- package/dist/bin/sync-runner-company.test.js +36 -0
- package/dist/bin/sync-runner-company.test.js.map +1 -0
- package/dist/bin/sync-runner-watch-loop.d.ts.map +1 -1
- package/dist/bin/sync-runner-watch-loop.js +98 -8
- package/dist/bin/sync-runner-watch-loop.js.map +1 -1
- package/dist/bin/sync-runner.d.ts +17 -0
- package/dist/bin/sync-runner.d.ts.map +1 -1
- package/dist/bin/sync-runner.js.map +1 -1
- package/dist/bin/sync-runner.test.js +109 -0
- package/dist/bin/sync-runner.test.js.map +1 -1
- package/dist/cli/conflict-recovery.test.d.ts +2 -0
- package/dist/cli/conflict-recovery.test.d.ts.map +1 -0
- package/dist/cli/conflict-recovery.test.js +201 -0
- package/dist/cli/conflict-recovery.test.js.map +1 -0
- package/dist/cli/conflict.d.ts +60 -0
- package/dist/cli/conflict.d.ts.map +1 -1
- package/dist/cli/conflict.js +333 -0
- package/dist/cli/conflict.js.map +1 -1
- package/dist/cli/sync.d.ts +35 -0
- package/dist/cli/sync.d.ts.map +1 -1
- package/dist/cli/sync.js +100 -0
- package/dist/cli/sync.js.map +1 -1
- package/dist/cli/sync.test.js +85 -1
- package/dist/cli/sync.test.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/skill-telemetry.d.ts +6 -0
- package/dist/skill-telemetry.d.ts.map +1 -1
- package/dist/skill-telemetry.js +14 -2
- package/dist/skill-telemetry.js.map +1 -1
- package/dist/skill-telemetry.test.js +79 -0
- package/dist/skill-telemetry.test.js.map +1 -1
- package/dist/sync/candidate-uploader.d.ts +88 -0
- package/dist/sync/candidate-uploader.d.ts.map +1 -0
- package/dist/sync/candidate-uploader.js +212 -0
- package/dist/sync/candidate-uploader.js.map +1 -0
- package/dist/sync/candidate-uploader.test.d.ts +2 -0
- package/dist/sync/candidate-uploader.test.d.ts.map +1 -0
- package/dist/sync/candidate-uploader.test.js +132 -0
- package/dist/sync/candidate-uploader.test.js.map +1 -0
- package/dist/sync/delta-client.d.ts +73 -0
- package/dist/sync/delta-client.d.ts.map +1 -0
- package/dist/sync/delta-client.js +201 -0
- package/dist/sync/delta-client.js.map +1 -0
- package/dist/sync/delta-client.test.d.ts +2 -0
- package/dist/sync/delta-client.test.d.ts.map +1 -0
- package/dist/sync/delta-client.test.js +97 -0
- package/dist/sync/delta-client.test.js.map +1 -0
- package/dist/sync/durable-apply.d.ts +76 -0
- package/dist/sync/durable-apply.d.ts.map +1 -0
- package/dist/sync/durable-apply.js +530 -0
- package/dist/sync/durable-apply.js.map +1 -0
- package/dist/sync/durable-apply.test.d.ts +2 -0
- package/dist/sync/durable-apply.test.d.ts.map +1 -0
- package/dist/sync/durable-apply.test.js +180 -0
- package/dist/sync/durable-apply.test.js.map +1 -0
- package/dist/sync/event-sync.d.ts +33 -1
- package/dist/sync/event-sync.d.ts.map +1 -1
- package/dist/sync/event-sync.js +149 -1
- package/dist/sync/event-sync.js.map +1 -1
- package/dist/sync/event-sync.test.js +142 -1
- package/dist/sync/event-sync.test.js.map +1 -1
- package/dist/sync/index.d.ts +2 -0
- package/dist/sync/index.d.ts.map +1 -1
- package/dist/sync/index.js +1 -0
- package/dist/sync/index.js.map +1 -1
- package/dist/sync/multipart-uploader.d.ts +99 -0
- package/dist/sync/multipart-uploader.d.ts.map +1 -0
- package/dist/sync/multipart-uploader.js +447 -0
- package/dist/sync/multipart-uploader.js.map +1 -0
- package/dist/sync/multipart-uploader.test.d.ts +2 -0
- package/dist/sync/multipart-uploader.test.d.ts.map +1 -0
- package/dist/sync/multipart-uploader.test.js +119 -0
- package/dist/sync/multipart-uploader.test.js.map +1 -0
- package/dist/sync/mutation-client.d.ts +85 -0
- package/dist/sync/mutation-client.d.ts.map +1 -0
- package/dist/sync/mutation-client.js +245 -0
- package/dist/sync/mutation-client.js.map +1 -0
- package/dist/sync/mutation-client.test.d.ts +2 -0
- package/dist/sync/mutation-client.test.d.ts.map +1 -0
- package/dist/sync/mutation-client.test.js +51 -0
- package/dist/sync/mutation-client.test.js.map +1 -0
- package/dist/sync/push-receiver.d.ts +45 -0
- package/dist/sync/push-receiver.d.ts.map +1 -1
- package/dist/sync/push-receiver.js +101 -0
- package/dist/sync/push-receiver.js.map +1 -1
- package/dist/sync/push-receiver.test.js +54 -2
- package/dist/sync/push-receiver.test.js.map +1 -1
- package/dist/sync/scope-inventory-client.d.ts +69 -0
- package/dist/sync/scope-inventory-client.d.ts.map +1 -0
- package/dist/sync/scope-inventory-client.js +210 -0
- package/dist/sync/scope-inventory-client.js.map +1 -0
- package/dist/sync/scope-inventory-client.test.d.ts +2 -0
- package/dist/sync/scope-inventory-client.test.d.ts.map +1 -0
- package/dist/sync/scope-inventory-client.test.js +94 -0
- package/dist/sync/scope-inventory-client.test.js.map +1 -0
- package/dist/sync/snapshot-client.d.ts +98 -0
- package/dist/sync/snapshot-client.d.ts.map +1 -0
- package/dist/sync/snapshot-client.js +402 -0
- package/dist/sync/snapshot-client.js.map +1 -0
- package/dist/sync/snapshot-client.test.d.ts +2 -0
- package/dist/sync/snapshot-client.test.d.ts.map +1 -0
- package/dist/sync/snapshot-client.test.js +169 -0
- package/dist/sync/snapshot-client.test.js.map +1 -0
- package/dist/sync/uploader-finalization.d.ts +97 -0
- package/dist/sync/uploader-finalization.d.ts.map +1 -0
- package/dist/sync/uploader-finalization.js +273 -0
- package/dist/sync/uploader-finalization.js.map +1 -0
- package/dist/sync/uploader-finalization.test.d.ts +2 -0
- package/dist/sync/uploader-finalization.test.d.ts.map +1 -0
- package/dist/sync/uploader-finalization.test.js +92 -0
- package/dist/sync/uploader-finalization.test.js.map +1 -0
- package/dist/telemetry.d.ts +11 -1
- package/dist/telemetry.d.ts.map +1 -1
- package/dist/telemetry.js +21 -2
- package/dist/telemetry.js.map +1 -1
- package/dist/telemetry.test.js +80 -0
- package/dist/telemetry.test.js.map +1 -1
- package/package.json +6 -1
- package/.claude/policies/hq-cloud-esm-cannot-spy-fs-builtins.md +0 -30
- package/.claude/policies/hq-cloud-strip-types-no-parameter-properties.md +0 -22
- package/.github/workflows/ci.yml +0 -84
- package/.github/workflows/publish.yml +0 -56
- package/.github/workflows/unreleased-commits-nag.yml +0 -256
- package/eslint.config.js +0 -67
- package/pnpm-workspace.yaml +0 -2
- package/scripts/presign-transport-e2e.mjs +0 -250
- package/scripts/vault-rebaseline.sh +0 -323
- package/scripts/vault-rescue.sh +0 -332
- package/src/active-company.test.ts +0 -188
- package/src/active-company.ts +0 -168
- package/src/agent-codex-instructions.test.ts +0 -332
- package/src/agent-codex-instructions.ts +0 -309
- package/src/auth.ts +0 -146
- package/src/backup-prune.test.ts +0 -98
- package/src/backup-prune.ts +0 -182
- package/src/bin/backup-prune-runner.ts +0 -33
- package/src/bin/rescue-runner.ts +0 -25
- package/src/bin/sync-runner-company.ts +0 -695
- package/src/bin/sync-runner-events.test.ts +0 -143
- package/src/bin/sync-runner-events.ts +0 -55
- package/src/bin/sync-runner-planning.test.ts +0 -311
- package/src/bin/sync-runner-planning.ts +0 -258
- package/src/bin/sync-runner-rollup.test.ts +0 -37
- package/src/bin/sync-runner-rollup.ts +0 -97
- package/src/bin/sync-runner-telemetry.ts +0 -15
- package/src/bin/sync-runner-watch-loop.ts +0 -1235
- package/src/bin/sync-runner-watch-routes.test.ts +0 -71
- package/src/bin/sync-runner-watch-routes.ts +0 -184
- package/src/bin/sync-runner.test.ts +0 -8767
- package/src/bin/sync-runner.ts +0 -2190
- package/src/cli/accept.ts +0 -124
- package/src/cli/conflict.ts +0 -119
- package/src/cli/doctor.test.ts +0 -581
- package/src/cli/doctor.ts +0 -642
- package/src/cli/index.ts +0 -49
- package/src/cli/invite.test.ts +0 -250
- package/src/cli/invite.ts +0 -214
- package/src/cli/promote.ts +0 -157
- package/src/cli/reindex-knowledge.test.ts +0 -307
- package/src/cli/reindex-knowledge.ts +0 -450
- package/src/cli/reindex.test.ts +0 -957
- package/src/cli/reindex.ts +0 -979
- package/src/cli/rescue-classify-ordering.test.ts +0 -548
- package/src/cli/rescue-clone-diagnostics.test.ts +0 -120
- package/src/cli/rescue-core.ts +0 -3011
- package/src/cli/rescue-drift-reconcile.test.ts +0 -179
- package/src/cli/rescue-drop-dir-symlink.test.ts +0 -224
- package/src/cli/rescue-exec-bit-preserve.test.ts +0 -187
- package/src/cli/rescue-hq-root-guard.test.ts +0 -232
- package/src/cli/rescue-journal-reconcile.test.ts +0 -215
- package/src/cli/rescue-mtime-preserve.test.ts +0 -203
- package/src/cli/rescue-settings-reconcile.test.ts +0 -637
- package/src/cli/rescue-snapshot.test.ts +0 -57
- package/src/cli/rescue-snapshot.ts +0 -51
- package/src/cli/rescue.reindex.test.ts +0 -63
- package/src/cli/rescue.test.ts +0 -131
- package/src/cli/rescue.ts +0 -182
- package/src/cli/share.test.ts +0 -7843
- package/src/cli/share.ts +0 -3663
- package/src/cli/sync-scope.test.ts +0 -652
- package/src/cli/sync.test.ts +0 -5207
- package/src/cli/sync.ts +0 -3470
- package/src/cli/tombstones.ts +0 -106
- package/src/cli/watch-event-push-conflict.test.ts +0 -234
- package/src/client-info.test.ts +0 -214
- package/src/client-info.ts +0 -121
- package/src/cognito-auth.test.ts +0 -712
- package/src/cognito-auth.ts +0 -1422
- package/src/company-resolver.test.ts +0 -618
- package/src/company-resolver.ts +0 -521
- package/src/context.test.ts +0 -583
- package/src/context.ts +0 -378
- package/src/daemon-worker.ts +0 -26
- package/src/daemon.ts +0 -99
- package/src/entity-resolver.test.ts +0 -315
- package/src/entity-resolver.ts +0 -180
- package/src/ignore.test.ts +0 -466
- package/src/ignore.ts +0 -469
- package/src/index.ts +0 -439
- package/src/journal.test.ts +0 -968
- package/src/journal.ts +0 -765
- package/src/lib/cloud-authoritative.test.ts +0 -45
- package/src/lib/cloud-authoritative.ts +0 -59
- package/src/lib/conflict-file.ts +0 -86
- package/src/lib/conflict-index.ts +0 -289
- package/src/lib/conflict.test.ts +0 -348
- package/src/lib/describe-error.test.ts +0 -100
- package/src/lib/describe-error.ts +0 -58
- package/src/lib/exit-codes.ts +0 -24
- package/src/lib/machine-id.test.ts +0 -231
- package/src/lib/machine-id.ts +0 -175
- package/src/lib/net-errors.test.ts +0 -65
- package/src/lib/net-errors.ts +0 -86
- package/src/lib/readlink-safe.test.ts +0 -43
- package/src/lib/readlink-safe.ts +0 -29
- package/src/local-path-codec.test.ts +0 -138
- package/src/local-path-codec.ts +0 -161
- package/src/machine-auth.test.ts +0 -1323
- package/src/manifest-reconcile.test.ts +0 -1123
- package/src/manifest-reconcile.ts +0 -518
- package/src/object-io.test.ts +0 -1221
- package/src/object-io.ts +0 -1306
- package/src/operation-lock.test.ts +0 -484
- package/src/operation-lock.ts +0 -680
- package/src/outcome-telemetry.test.ts +0 -498
- package/src/outcome-telemetry.ts +0 -639
- package/src/personal-vault-exclusions.test.ts +0 -308
- package/src/personal-vault-exclusions.ts +0 -354
- package/src/personal-vault.test.ts +0 -756
- package/src/personal-vault.ts +0 -496
- package/src/prefix-coalesce.test.ts +0 -240
- package/src/prefix-coalesce.ts +0 -273
- package/src/public-surface.test.ts +0 -117
- package/src/qmd-reindex.test.ts +0 -877
- package/src/qmd-reindex.ts +0 -842
- package/src/read-only-state-dir.test.ts +0 -188
- package/src/remote-pull.test.ts +0 -1130
- package/src/remote-pull.ts +0 -618
- package/src/s3.symlink-materialize.test.ts +0 -492
- package/src/s3.test.ts +0 -1789
- package/src/s3.ts +0 -1532
- package/src/schemas/signal-types.test.ts +0 -82
- package/src/schemas/signal-types.ts +0 -38
- package/src/schemas/source-channels.test.ts +0 -82
- package/src/schemas/source-channels.ts +0 -53
- package/src/scope-shrink.test.ts +0 -633
- package/src/scope-shrink.ts +0 -481
- package/src/signals/get.test.ts +0 -310
- package/src/signals/get.ts +0 -75
- package/src/signals/internals.ts +0 -195
- package/src/signals/list.test.ts +0 -420
- package/src/signals/list.ts +0 -79
- package/src/signals/parse.ts +0 -8
- package/src/signals/types.ts +0 -91
- package/src/skill-telemetry.test.ts +0 -1825
- package/src/skill-telemetry.ts +0 -1439
- package/src/sources/get.test.ts +0 -293
- package/src/sources/get.ts +0 -66
- package/src/sources/internals.ts +0 -198
- package/src/sources/list.test.ts +0 -402
- package/src/sources/list.ts +0 -84
- package/src/sources/parse.ts +0 -43
- package/src/sources/types.ts +0 -84
- package/src/sync/event-sync.test.ts +0 -594
- package/src/sync/event-sync.ts +0 -545
- package/src/sync/feature-flags.test.ts +0 -378
- package/src/sync/feature-flags.ts +0 -62
- package/src/sync/index.ts +0 -76
- package/src/sync/lease-client.test.ts +0 -128
- package/src/sync/lease-client.ts +0 -207
- package/src/sync/logger.test.ts +0 -242
- package/src/sync/logger.ts +0 -79
- package/src/sync/metrics.test.ts +0 -462
- package/src/sync/metrics.ts +0 -213
- package/src/sync/pull-scope.ts +0 -265
- package/src/sync/push-event.test.ts +0 -266
- package/src/sync/push-event.ts +0 -224
- package/src/sync/push-receiver.test.ts +0 -566
- package/src/sync/push-receiver.ts +0 -1048
- package/src/sync/push-transport.ts +0 -231
- package/src/sync/realtime-rollout.test.ts +0 -86
- package/src/sync/realtime-rollout.ts +0 -262
- package/src/sync/state-store.test.ts +0 -194
- package/src/sync/state-store.ts +0 -727
- package/src/sync-core.ts +0 -58
- package/src/sync-progress.test.ts +0 -94
- package/src/sync-progress.ts +0 -140
- package/src/telemetry-events.test.ts +0 -88
- package/src/telemetry-events.ts +0 -205
- package/src/telemetry.test.ts +0 -1280
- package/src/telemetry.ts +0 -1109
- package/src/types.ts +0 -314
- package/src/vault-client.test.ts +0 -1380
- package/src/vault-client.ts +0 -1694
- package/src/version.ts +0 -24
- package/src/watch-roots.test.ts +0 -278
- package/src/watch-roots.ts +0 -162
- package/src/watcher-event-gate.test.ts +0 -212
- package/src/watcher.test.ts +0 -1079
- package/src/watcher.ts +0 -1741
- package/test/e2e/sync/cross-tenant-isolation.test.ts +0 -630
- package/test/e2e/sync/skill-telemetry-oversized-transcript.test.ts +0 -124
- package/test/e2e/sync/transient-company-leg.test.ts +0 -384
- package/test/e2e/sync/windows-unreadable-link-leg.test.ts +0 -191
- package/test/e2e/watcher-real-chokidar.test.ts +0 -165
- package/test/e2e/watcher-recursive-backend.test.ts +0 -181
- package/test/e2e/watcher-scoped-coverage.test.ts +0 -381
- package/test/invite-flow.integration.test.ts +0 -244
- package/test/joiner-manifest-reconcile.integration.test.ts +0 -322
- package/test/share-sync.integration.test.ts +0 -213
- package/tsconfig.json +0 -19
- package/vitest.config.ts +0 -22
package/src/ignore.test.ts
DELETED
|
@@ -1,466 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Unit tests for createIgnoreFilter.
|
|
3
|
-
*
|
|
4
|
-
* Covers both modes: legacy permissive (no .hqinclude) and allowlist mode
|
|
5
|
-
* (.hqinclude present). The allowlist tests guard against accidentally
|
|
6
|
-
* leaking sensitive subtrees like data/ or workers/ to S3 — a regression
|
|
7
|
-
* here would silently push private content on the next sync.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import { describe, it, expect, beforeEach, afterEach } from "vitest";
|
|
11
|
-
import * as fs from "fs";
|
|
12
|
-
import * as os from "os";
|
|
13
|
-
import * as path from "path";
|
|
14
|
-
import { createIgnoreFilter, isExpectedIgnore } from "./ignore.js";
|
|
15
|
-
import { wrapFilterWithIgnoreVisibility } from "./cli/share.js";
|
|
16
|
-
|
|
17
|
-
describe("isExpectedIgnore", () => {
|
|
18
|
-
it("classifies top-level HQ-managed roots as expected", () => {
|
|
19
|
-
expect(isExpectedIgnore("repos")).toBe(true);
|
|
20
|
-
expect(isExpectedIgnore("repos/private/x.ts")).toBe(true);
|
|
21
|
-
expect(isExpectedIgnore("workspace/tmp/file.md")).toBe(true);
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it("classifies build, VCS, cache, and known basename noise as expected", () => {
|
|
25
|
-
expect(isExpectedIgnore("node_modules/react/index.js")).toBe(true);
|
|
26
|
-
expect(isExpectedIgnore("apps/web/node_modules/react/index.js")).toBe(true);
|
|
27
|
-
expect(isExpectedIgnore(".git/config")).toBe(true);
|
|
28
|
-
expect(isExpectedIgnore(".DS_Store")).toBe(true);
|
|
29
|
-
expect(isExpectedIgnore("x/.env")).toBe(true);
|
|
30
|
-
expect(isExpectedIgnore("a/b/.hq-sync.pid")).toBe(true);
|
|
31
|
-
expect(isExpectedIgnore("y/foo.pyc")).toBe(true);
|
|
32
|
-
// Cloud-only skill hero images (US-014) are an expected by-design exclusion.
|
|
33
|
-
expect(isExpectedIgnore(".claude/skills/foo/.skill-media/hero.png")).toBe(true);
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it("classifies macOS Finder Icon\\r files as expected noise", () => {
|
|
37
|
-
// Finder scatters one into every directory it renders a custom icon for,
|
|
38
|
-
// and a folder-level cloud-sync agent propagates them tree-wide. Treated
|
|
39
|
-
// exactly like .DS_Store so a seeded tree stays silent rather than firing
|
|
40
|
-
// the "EXCLUDED from sync — review in case this is unintended" warning
|
|
41
|
-
// once per file.
|
|
42
|
-
expect(isExpectedIgnore("Icon\r")).toBe(true);
|
|
43
|
-
expect(isExpectedIgnore("companies/indigo/Icon\r")).toBe(true);
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
it("keeps a real file named Icons noteworthy (no `Icon?` over-match)", () => {
|
|
47
|
-
// The `Icon?` gitignore workaround would swallow these. Dropping real
|
|
48
|
-
// user content is a worse failure than the cruft being excluded.
|
|
49
|
-
expect(isExpectedIgnore("companies/indigo/Icons")).toBe(false);
|
|
50
|
-
expect(isExpectedIgnore("companies/indigo/Icon")).toBe(false);
|
|
51
|
-
expect(isExpectedIgnore("companies/indigo/Icons.md")).toBe(false);
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
it("keeps nested repos/workspace and ordinary content noteworthy", () => {
|
|
55
|
-
expect(isExpectedIgnore("companies/indigo/knowledge/repos/foo/notes.md")).toBe(false);
|
|
56
|
-
expect(isExpectedIgnore("companies/indigo/knowledge/overview.md")).toBe(false);
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
describe("createIgnoreFilter", () => {
|
|
61
|
-
let hqRoot: string;
|
|
62
|
-
|
|
63
|
-
beforeEach(() => {
|
|
64
|
-
hqRoot = fs.mkdtempSync(path.join(os.tmpdir(), "hq-ignore-test-"));
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
afterEach(() => {
|
|
68
|
-
fs.rmSync(hqRoot, { recursive: true, force: true });
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
it("permissive mode: regular files sync, defaults are ignored", () => {
|
|
72
|
-
const shouldSync = createIgnoreFilter(hqRoot);
|
|
73
|
-
expect(shouldSync(path.join(hqRoot, "companies/indigo/notes.md"))).toBe(true);
|
|
74
|
-
expect(shouldSync(path.join(hqRoot, "node_modules/foo/x.js"))).toBe(false);
|
|
75
|
-
expect(shouldSync(path.join(hqRoot, ".env"))).toBe(false);
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
it("permissive mode: project-local .qmd index is ignored by default", () => {
|
|
79
|
-
// feedback_332c7ccc / sqlite-vec#297 — never round-trip a project-local
|
|
80
|
-
// qmd index through the vault.
|
|
81
|
-
const shouldSync = createIgnoreFilter(hqRoot);
|
|
82
|
-
expect(shouldSync(path.join(hqRoot, ".qmd"), true)).toBe(false);
|
|
83
|
-
expect(shouldSync(path.join(hqRoot, ".qmd/index.sqlite"))).toBe(false);
|
|
84
|
-
expect(shouldSync(path.join(hqRoot, ".qmd/index.sqlite-wal"))).toBe(false);
|
|
85
|
-
expect(isExpectedIgnore(".qmd/index.sqlite")).toBe(true);
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
it("permissive mode: pnpm content-addressed store is ignored by default", () => {
|
|
89
|
-
// .pnpm-store/ is pnpm's content-addressed package store. Like
|
|
90
|
-
// node_modules/ it is large and machine-local and must never sync — a
|
|
91
|
-
// synced store writes a `.conflict-` copy of every blob each cycle, which
|
|
92
|
-
// then re-syncs and amplifies into tens of thousands of files. Regression
|
|
93
|
-
// guard for that storm.
|
|
94
|
-
const shouldSync = createIgnoreFilter(hqRoot);
|
|
95
|
-
// The store directory and everything beneath it is excluded.
|
|
96
|
-
expect(shouldSync(path.join(hqRoot, ".pnpm-store"), true)).toBe(false);
|
|
97
|
-
expect(shouldSync(path.join(hqRoot, ".pnpm-store/v10/files/00/abc123"))).toBe(false);
|
|
98
|
-
// Caught at any depth — a project store nested under a synced subtree.
|
|
99
|
-
expect(
|
|
100
|
-
shouldSync(path.join(hqRoot, "companies/indigo/repos/x/.pnpm-store/v10/blob")),
|
|
101
|
-
).toBe(false);
|
|
102
|
-
// node_modules/ is already covered; asserted here so the pair travels together.
|
|
103
|
-
expect(shouldSync(path.join(hqRoot, "node_modules/react/index.js"))).toBe(false);
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
it("permissive mode: macOS Finder Icon\\r files never enter the walk", () => {
|
|
107
|
-
// A CR is a control character, so the vault key validator rejects the key
|
|
108
|
-
// (INVALID_KEY_CONTROL_CHARS) and the upload can only ever throw. Dropping
|
|
109
|
-
// them during the walk is what keeps them off the upload path entirely.
|
|
110
|
-
const shouldSync = createIgnoreFilter(hqRoot);
|
|
111
|
-
expect(shouldSync(path.join(hqRoot, "Icon\r"))).toBe(false);
|
|
112
|
-
expect(shouldSync(path.join(hqRoot, "companies/indigo/Icon\r"))).toBe(false);
|
|
113
|
-
expect(shouldSync(path.join(hqRoot, ".agents/Icon\r"))).toBe(false);
|
|
114
|
-
// Caught at any depth, like the other OS-cruft exclusions.
|
|
115
|
-
expect(shouldSync(path.join(hqRoot, "a/b/c/d/Icon\r"))).toBe(false);
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
it("permissive mode: a real file named Icons still syncs", () => {
|
|
119
|
-
// Regression guard for the `Icon?` gitignore workaround, whose `?`
|
|
120
|
-
// single-char wildcard also matches Icons / Icon1 / IconX. This exclusion
|
|
121
|
-
// matches the exact Finder byte sequence instead, so real content survives.
|
|
122
|
-
const shouldSync = createIgnoreFilter(hqRoot);
|
|
123
|
-
expect(shouldSync(path.join(hqRoot, "companies/indigo/Icons"))).toBe(true);
|
|
124
|
-
expect(shouldSync(path.join(hqRoot, "companies/indigo/Icon"))).toBe(true);
|
|
125
|
-
expect(shouldSync(path.join(hqRoot, "companies/indigo/Icon1"))).toBe(true);
|
|
126
|
-
expect(shouldSync(path.join(hqRoot, "companies/indigo/Icons.md"))).toBe(true);
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
it("a literal Icon+CR line in .gitignore does NOT reach the ignore lib", () => {
|
|
130
|
-
// This is why the exclusion is a predicate and not a DEFAULT_IGNORES
|
|
131
|
-
// entry. ignore@5 strips a trailing CR from a pattern line, so the
|
|
132
|
-
// spelling git itself requires silently never matches. Pinning the
|
|
133
|
-
// upstream behavior here means a future ignore-lib bump that changes it
|
|
134
|
-
// surfaces as a failing test rather than a silent double-exclusion.
|
|
135
|
-
fs.writeFileSync(path.join(hqRoot, ".gitignore"), "Icon\r\n");
|
|
136
|
-
const shouldSync = createIgnoreFilter(hqRoot);
|
|
137
|
-
// Still excluded — by the predicate, not by the pattern.
|
|
138
|
-
expect(shouldSync(path.join(hqRoot, "Icon\r"))).toBe(false);
|
|
139
|
-
// Proof the pattern itself is inert: it did not take `Icons` with it.
|
|
140
|
-
expect(shouldSync(path.join(hqRoot, "Icons"))).toBe(true);
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
it("repos/ exclusion is root-anchored to hqRoot (DEV-1791)", () => {
|
|
144
|
-
const shouldSync = createIgnoreFilter(hqRoot);
|
|
145
|
-
expect(shouldSync(path.join(hqRoot, "repos/private/hq-cloud/src/x.ts"))).toBe(false);
|
|
146
|
-
expect(shouldSync(path.join(hqRoot, "repos/public/hq-core/README.md"))).toBe(false);
|
|
147
|
-
expect(
|
|
148
|
-
shouldSync(path.join(hqRoot, "companies/lutiq/knowledge/repos/dev-docs-mcp/overview.md")),
|
|
149
|
-
).toBe(true);
|
|
150
|
-
expect(shouldSync(path.join(hqRoot, "companies/indigo/knowledge/repos/foo/notes.md"))).toBe(
|
|
151
|
-
true,
|
|
152
|
-
);
|
|
153
|
-
expect(shouldSync(path.join(hqRoot, "companies/lutiq/knowledge/repos"), true)).toBe(true);
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
it("permissive mode: .hqignore patterns are honored", () => {
|
|
157
|
-
fs.writeFileSync(path.join(hqRoot, ".hqignore"), "companies/*/data/\n");
|
|
158
|
-
const shouldSync = createIgnoreFilter(hqRoot);
|
|
159
|
-
expect(shouldSync(path.join(hqRoot, "companies/indigo/data/x.csv"))).toBe(false);
|
|
160
|
-
expect(shouldSync(path.join(hqRoot, "companies/indigo/notes.md"))).toBe(true);
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
it("visibility fires on an OVER-BROAD exclusion (real filter + recorder, DEV-1791)", () => {
|
|
164
|
-
// Simulate the regressed over-broad bug: an un-anchored `repos/` in
|
|
165
|
-
// .hqignore that matches ANY nested repos segment — exactly what
|
|
166
|
-
// silently ate /discover knowledge under companies/*/knowledge/repos/
|
|
167
|
-
// before the root-anchor fix. The visibility recorder must surface the
|
|
168
|
-
// dropped knowledge as NOTEWORTHY while staying quiet on build noise.
|
|
169
|
-
fs.writeFileSync(path.join(hqRoot, ".hqignore"), "repos/\n");
|
|
170
|
-
const ignoreFilter = createIgnoreFilter(hqRoot);
|
|
171
|
-
const noteworthy: string[] = [];
|
|
172
|
-
let total = 0;
|
|
173
|
-
const recorded = wrapFilterWithIgnoreVisibility(
|
|
174
|
-
ignoreFilter,
|
|
175
|
-
hqRoot,
|
|
176
|
-
(rel) => { noteworthy.push(rel); },
|
|
177
|
-
() => { total++; },
|
|
178
|
-
);
|
|
179
|
-
|
|
180
|
-
// Knowledge under a nested repos/ is dropped by the over-broad rule and
|
|
181
|
-
// is genuine content → captured as noteworthy.
|
|
182
|
-
expect(recorded(path.join(hqRoot, "companies/indigo/knowledge/repos/foo/notes.md"))).toBe(false);
|
|
183
|
-
// Build noise is also excluded but is EXPECTED → counted, not noteworthy.
|
|
184
|
-
expect(recorded(path.join(hqRoot, "node_modules/react/index.js"))).toBe(false);
|
|
185
|
-
// Ordinary knowledge that the filter ALLOWS fires nothing.
|
|
186
|
-
expect(recorded(path.join(hqRoot, "companies/indigo/knowledge/overview.md"))).toBe(true);
|
|
187
|
-
|
|
188
|
-
expect(noteworthy).toEqual(["companies/indigo/knowledge/repos/foo/notes.md"]);
|
|
189
|
-
expect(total).toBe(2); // both exclusions counted; only one is noteworthy
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
it("v15+ layout (core/core.yaml present): root core.yaml is ignored, nested core/core.yaml syncs", () => {
|
|
193
|
-
// On v15+ the scaffold/version manifest lives at `core/core.yaml` (a real
|
|
194
|
-
// project file that DOES sync). Any root-level `core.yaml` here is a stale
|
|
195
|
-
// per-machine duplicate that must never round-trip — pulling another
|
|
196
|
-
// machine's marker would corrupt root discovery. The exclusion is anchored
|
|
197
|
-
// (`/core.yaml`) so it never touches `core/core.yaml`.
|
|
198
|
-
fs.mkdirSync(path.join(hqRoot, "core"), { recursive: true });
|
|
199
|
-
fs.writeFileSync(path.join(hqRoot, "core/core.yaml"), 'version: 1\nhqVersion: "15.0.12"\n');
|
|
200
|
-
fs.writeFileSync(path.join(hqRoot, "core.yaml"), 'version: 1\nhqVersion: "15.0.12"\n');
|
|
201
|
-
const shouldSync = createIgnoreFilter(hqRoot);
|
|
202
|
-
expect(shouldSync(path.join(hqRoot, "core.yaml"))).toBe(false);
|
|
203
|
-
expect(shouldSync(path.join(hqRoot, "core/core.yaml"))).toBe(true);
|
|
204
|
-
});
|
|
205
|
-
|
|
206
|
-
it("v12–v14 layout (no core/core.yaml): root core.yaml IS the manifest and MUST sync", () => {
|
|
207
|
-
// Regression for DEV-1729 / the ~98 "no core.yaml in vault, version
|
|
208
|
-
// undetectable" sync users. On v12–v14 roots there is NO `core/core.yaml`
|
|
209
|
-
// — the ROOT `core.yaml` is the scaffold/version manifest. The old
|
|
210
|
-
// unconditional `/core.yaml` exclusion silently dropped it (while
|
|
211
|
-
// computePersonalVaultPaths still enumerated it), so the vault never
|
|
212
|
-
// received a version marker. With no `core/core.yaml` on disk, the root
|
|
213
|
-
// `core.yaml` must round-trip like any other top-level file.
|
|
214
|
-
fs.writeFileSync(path.join(hqRoot, "core.yaml"), 'version: 1\nhqVersion: "14.0.0"\n');
|
|
215
|
-
const shouldSync = createIgnoreFilter(hqRoot);
|
|
216
|
-
expect(shouldSync(path.join(hqRoot, "core.yaml"))).toBe(true);
|
|
217
|
-
});
|
|
218
|
-
|
|
219
|
-
it("permissive mode: modules/modules.yaml manifest is ignored", () => {
|
|
220
|
-
// modules.yaml is the local modules-resolution manifest. Per-machine
|
|
221
|
-
// state, never synced.
|
|
222
|
-
const shouldSync = createIgnoreFilter(hqRoot);
|
|
223
|
-
expect(shouldSync(path.join(hqRoot, "modules/modules.yaml"))).toBe(false);
|
|
224
|
-
});
|
|
225
|
-
|
|
226
|
-
it("permissive mode: per-company company.yaml is ignored", () => {
|
|
227
|
-
// company.yaml is written locally on first sync from the entity context.
|
|
228
|
-
// Round-tripping it would let one machine's identity overwrite another's.
|
|
229
|
-
const shouldSync = createIgnoreFilter(hqRoot);
|
|
230
|
-
expect(shouldSync(path.join(hqRoot, "companies/indigo/company.yaml"))).toBe(false);
|
|
231
|
-
expect(shouldSync(path.join(hqRoot, "company.yaml"))).toBe(false);
|
|
232
|
-
});
|
|
233
|
-
|
|
234
|
-
it("permissive mode: INDEX.md and policies/_digest.md are ignored", () => {
|
|
235
|
-
// Both are auto-generated locally — INDEX.md by the tools indexer and
|
|
236
|
-
// policies/_digest.md by the policies digest builder.
|
|
237
|
-
const shouldSync = createIgnoreFilter(hqRoot);
|
|
238
|
-
expect(shouldSync(path.join(hqRoot, "INDEX.md"))).toBe(false);
|
|
239
|
-
expect(shouldSync(path.join(hqRoot, "companies/ghq/tools/INDEX.md"))).toBe(false);
|
|
240
|
-
expect(shouldSync(path.join(hqRoot, "policies/_digest.md"))).toBe(false);
|
|
241
|
-
});
|
|
242
|
-
|
|
243
|
-
it("permissive mode: .claude/worktrees/ is ignored", () => {
|
|
244
|
-
const shouldSync = createIgnoreFilter(hqRoot);
|
|
245
|
-
expect(shouldSync(path.join(hqRoot, ".claude/worktrees/foo/file.ts"))).toBe(false);
|
|
246
|
-
expect(shouldSync(path.join(hqRoot, "companies/indigo/.claude/worktrees/bar/x.md"))).toBe(false);
|
|
247
|
-
// The .claude/ dir itself (commands, skills, hooks) still syncs.
|
|
248
|
-
expect(shouldSync(path.join(hqRoot, ".claude/skills/foo/SKILL.md"))).toBe(true);
|
|
249
|
-
});
|
|
250
|
-
|
|
251
|
-
it("permissive mode: .skill-media/ (cloud-only skill images) is ignored (US-014)", () => {
|
|
252
|
-
const shouldSync = createIgnoreFilter(hqRoot);
|
|
253
|
-
// Skill hero images are cloud-only — excluded from push AND pull at any depth.
|
|
254
|
-
expect(
|
|
255
|
-
shouldSync(path.join(hqRoot, ".claude/skills/lead-qualifier/.skill-media/hero.png")),
|
|
256
|
-
).toBe(false);
|
|
257
|
-
expect(
|
|
258
|
-
shouldSync(path.join(hqRoot, "companies/indigo/skills/foo/.skill-media/cover.jpg")),
|
|
259
|
-
).toBe(false);
|
|
260
|
-
expect(shouldSync(path.join(hqRoot, "skills/bar/.skill-media"), true)).toBe(false);
|
|
261
|
-
// The skill's SKILL.md and other content still sync — the rule is scoped to
|
|
262
|
-
// the media dir only, never the skill.
|
|
263
|
-
expect(shouldSync(path.join(hqRoot, ".claude/skills/lead-qualifier/SKILL.md"))).toBe(true);
|
|
264
|
-
});
|
|
265
|
-
|
|
266
|
-
it("permissive mode: .hq-* internal state is ignored, .hqignore family still sync", () => {
|
|
267
|
-
const shouldSync = createIgnoreFilter(hqRoot);
|
|
268
|
-
// Internal state files that must never round-trip through the bucket.
|
|
269
|
-
expect(shouldSync(path.join(hqRoot, ".hq-sync.pid"))).toBe(false);
|
|
270
|
-
expect(shouldSync(path.join(hqRoot, ".hq-sync-journal.json"))).toBe(false);
|
|
271
|
-
expect(shouldSync(path.join(hqRoot, ".hq-sync-state.json"))).toBe(false);
|
|
272
|
-
expect(shouldSync(path.join(hqRoot, ".hq-embeddings-pending.json"))).toBe(false);
|
|
273
|
-
expect(shouldSync(path.join(hqRoot, "companies/indigo/.hq-foo.json"))).toBe(false);
|
|
274
|
-
expect(shouldSync(path.join(hqRoot, ".hq-cache/blob.bin"))).toBe(false);
|
|
275
|
-
// Sync-config files still sync (no hyphen, doesn't match `.hq-*`).
|
|
276
|
-
expect(shouldSync(path.join(hqRoot, ".hqignore"))).toBe(true);
|
|
277
|
-
expect(shouldSync(path.join(hqRoot, ".hqsyncignore"))).toBe(true);
|
|
278
|
-
expect(shouldSync(path.join(hqRoot, ".hqinclude"))).toBe(true);
|
|
279
|
-
});
|
|
280
|
-
|
|
281
|
-
it("permissive mode: .claude/state/ and .claude/audit/ are per-host, never synced", () => {
|
|
282
|
-
// 5.34.0 live cross-machine sync test (macOS ↔ Lightsail) wrote
|
|
283
|
-
// ~25 of the 30 conflict mirrors directly to these paths. They're
|
|
284
|
-
// session-/host-scoped by design:
|
|
285
|
-
// - .claude/state/active-session-project: the active project
|
|
286
|
-
// pointer for the currently-foregrounded Claude Code session.
|
|
287
|
-
// - .claude/state/auto-session-project-<sessionUuid>: one
|
|
288
|
-
// marker per spawned session; entirely host-local.
|
|
289
|
-
// - .claude/audit/: hook-decision audit log + suppressions
|
|
290
|
-
// config; host-specific by nature.
|
|
291
|
-
// Syncing produces guaranteed conflicts per machine per session.
|
|
292
|
-
const shouldSync = createIgnoreFilter(hqRoot);
|
|
293
|
-
expect(shouldSync(path.join(hqRoot, ".claude/state/active-session-project"))).toBe(false);
|
|
294
|
-
expect(
|
|
295
|
-
shouldSync(
|
|
296
|
-
path.join(hqRoot, ".claude/state/auto-session-project-571177ff-59bb-4728-8670-0bf66a6410a5"),
|
|
297
|
-
),
|
|
298
|
-
).toBe(false);
|
|
299
|
-
expect(shouldSync(path.join(hqRoot, ".claude/audit/instructions.md"))).toBe(false);
|
|
300
|
-
expect(shouldSync(path.join(hqRoot, ".claude/audit/suppressions.yaml"))).toBe(false);
|
|
301
|
-
expect(shouldSync(path.join(hqRoot, ".claude/state"), true)).toBe(false);
|
|
302
|
-
expect(shouldSync(path.join(hqRoot, ".claude/audit"), true)).toBe(false);
|
|
303
|
-
// Nested .claude/ inside a company also stays local — same anchor
|
|
304
|
-
// shape as the .claude/worktrees/ rule directly above.
|
|
305
|
-
expect(
|
|
306
|
-
shouldSync(path.join(hqRoot, "companies/indigo/.claude/state/active-session-project")),
|
|
307
|
-
).toBe(false);
|
|
308
|
-
expect(
|
|
309
|
-
shouldSync(path.join(hqRoot, "companies/indigo/.claude/audit/instructions.md")),
|
|
310
|
-
).toBe(false);
|
|
311
|
-
// The .claude/ dir's other contents (commands, skills, hooks) still
|
|
312
|
-
// sync — the rule MUST NOT broaden to .claude/.
|
|
313
|
-
expect(shouldSync(path.join(hqRoot, ".claude/skills/foo/SKILL.md"))).toBe(true);
|
|
314
|
-
expect(shouldSync(path.join(hqRoot, ".claude/hooks/foo.sh"))).toBe(true);
|
|
315
|
-
});
|
|
316
|
-
|
|
317
|
-
it("permissive mode: .claude/settings*.json is machine-local, never synced (qmd PATH regression)", () => {
|
|
318
|
-
// 2026-07-01 e2e-mac report (20260701-qmd-path): cloud sync pulled the
|
|
319
|
-
// operator's .claude/settings.json over a fresh install's copy ~40s
|
|
320
|
-
// after install, byte-identical to the source machine — reverting the
|
|
321
|
-
// installer's day-one env.PATH fix and propagating one host's PATH
|
|
322
|
-
// snapshot to every machine/teammate. This is the recurrence mechanism
|
|
323
|
-
// behind the recurring "qmd: command not found" reports. Settings are
|
|
324
|
-
// machine-local (PATH snapshot, model prefs) and must never round-trip
|
|
325
|
-
// in EITHER direction — the pull planner consults this same filter, so
|
|
326
|
-
// an existing vault copy is also never applied locally.
|
|
327
|
-
const shouldSync = createIgnoreFilter(hqRoot);
|
|
328
|
-
expect(shouldSync(path.join(hqRoot, ".claude/settings.json"))).toBe(false);
|
|
329
|
-
expect(shouldSync(path.join(hqRoot, ".claude/settings.local.json"))).toBe(false);
|
|
330
|
-
// Nested .claude/ inside a company stays local too — same anchor shape
|
|
331
|
-
// as the state/audit rules above.
|
|
332
|
-
expect(
|
|
333
|
-
shouldSync(path.join(hqRoot, "companies/indigo/.claude/settings.json")),
|
|
334
|
-
).toBe(false);
|
|
335
|
-
// Siblings still sync — the rule must not broaden past settings files.
|
|
336
|
-
expect(shouldSync(path.join(hqRoot, ".claude/skills/foo/SKILL.md"))).toBe(true);
|
|
337
|
-
expect(shouldSync(path.join(hqRoot, ".claude/hooks/foo.sh"))).toBe(true);
|
|
338
|
-
expect(shouldSync(path.join(hqRoot, ".claude/CLAUDE.md"))).toBe(true);
|
|
339
|
-
});
|
|
340
|
-
|
|
341
|
-
it("permissive mode: .hq/ directory is per-host state, never synced (Bug #1/#6/#8)", () => {
|
|
342
|
-
// Bug catalog: `.hq/install-manifest.json`, `.hq/machine-id`, and
|
|
343
|
-
// `.hq/machine.json` are per-host source-of-truth files. The original
|
|
344
|
-
// `DEFAULT_IGNORES` only covered the `.hq-*` wildcard (with hyphen) and
|
|
345
|
-
// explicitly left the `.hq/` directory unaffected — so the install
|
|
346
|
-
// manifest and machine-id round-tripped through S3 between hosts,
|
|
347
|
-
// breaking the per-machine identity contract that the 5.33.0
|
|
348
|
-
// machine-id fix relies on.
|
|
349
|
-
const shouldSync = createIgnoreFilter(hqRoot);
|
|
350
|
-
expect(shouldSync(path.join(hqRoot, ".hq/install-manifest.json"))).toBe(false);
|
|
351
|
-
expect(shouldSync(path.join(hqRoot, ".hq/machine-id"))).toBe(false);
|
|
352
|
-
expect(shouldSync(path.join(hqRoot, ".hq/machine.json"))).toBe(false);
|
|
353
|
-
expect(shouldSync(path.join(hqRoot, ".hq/config.json"))).toBe(false);
|
|
354
|
-
expect(shouldSync(path.join(hqRoot, ".hq"), true)).toBe(false);
|
|
355
|
-
// Nested .hq/ inside a company also stays local (per-host scoping).
|
|
356
|
-
expect(shouldSync(path.join(hqRoot, "companies/indigo/.hq/config.json"))).toBe(false);
|
|
357
|
-
});
|
|
358
|
-
|
|
359
|
-
it("allowlist mode: presence of .hqinclude switches to opt-in", () => {
|
|
360
|
-
fs.writeFileSync(
|
|
361
|
-
path.join(hqRoot, ".hqinclude"),
|
|
362
|
-
"companies/*/knowledge/\ncompanies/*/projects/\n",
|
|
363
|
-
);
|
|
364
|
-
const shouldSync = createIgnoreFilter(hqRoot);
|
|
365
|
-
// Allowlisted paths sync.
|
|
366
|
-
expect(shouldSync(path.join(hqRoot, "companies/indigo/knowledge/foo.md"))).toBe(true);
|
|
367
|
-
expect(shouldSync(path.join(hqRoot, "companies/indigo/projects/p1/prd.json"))).toBe(true);
|
|
368
|
-
// Anything else stays local — this is the privacy guarantee.
|
|
369
|
-
expect(shouldSync(path.join(hqRoot, "companies/indigo/data/leads.csv"))).toBe(false);
|
|
370
|
-
expect(shouldSync(path.join(hqRoot, "companies/indigo/workers/cmo/skill.md"))).toBe(false);
|
|
371
|
-
expect(shouldSync(path.join(hqRoot, "companies/indigo/settings/aws.json"))).toBe(false);
|
|
372
|
-
expect(shouldSync(path.join(hqRoot, "personal/journal/2026-04-26.md"))).toBe(false);
|
|
373
|
-
});
|
|
374
|
-
|
|
375
|
-
it("allowlist mode: directory entries match dir-suffix include patterns (walker descent)", () => {
|
|
376
|
-
// Regression: walkDir tests directory entries when deciding whether to
|
|
377
|
-
// descend. The `ignore` lib only matches dir-only patterns like
|
|
378
|
-
// `companies/*/knowledge/` against paths that end with `/`. The filter
|
|
379
|
-
// accepts an `isDir` hint and appends the trailing slash before probing,
|
|
380
|
-
// mirroring how git itself decides (it knows from the index whether
|
|
381
|
-
// each entry is a tree or a blob). Without the hint the walker would
|
|
382
|
-
// see `companies/indigo/knowledge` -> not allowed -> never descend ->
|
|
383
|
-
// entire subtree silently lost. Files inside still work because
|
|
384
|
-
// `ignore` walks ancestors internally; the bug only bites the descent
|
|
385
|
-
// decision for directory entries.
|
|
386
|
-
fs.writeFileSync(
|
|
387
|
-
path.join(hqRoot, ".hqinclude"),
|
|
388
|
-
"companies/*/knowledge/\ncompanies/*/projects/\n.claude/\n",
|
|
389
|
-
);
|
|
390
|
-
const shouldSync = createIgnoreFilter(hqRoot);
|
|
391
|
-
// Directory entries must be allowed when the caller hints isDir=true.
|
|
392
|
-
expect(shouldSync(path.join(hqRoot, "companies/indigo/knowledge"), true)).toBe(true);
|
|
393
|
-
expect(shouldSync(path.join(hqRoot, "companies/indigo/projects"), true)).toBe(true);
|
|
394
|
-
expect(shouldSync(path.join(hqRoot, ".claude"), true)).toBe(true);
|
|
395
|
-
// Files inside still resolve correctly without the hint.
|
|
396
|
-
expect(shouldSync(path.join(hqRoot, "companies/indigo/knowledge/x.md"))).toBe(true);
|
|
397
|
-
expect(shouldSync(path.join(hqRoot, ".claude/skills/foo/SKILL.md"))).toBe(true);
|
|
398
|
-
// Machine-local settings stay excluded even inside an allowlisted
|
|
399
|
-
// subtree — exclusion layers subtract on top of the allowlist.
|
|
400
|
-
expect(shouldSync(path.join(hqRoot, ".claude/settings.json"))).toBe(false);
|
|
401
|
-
// Non-allowlisted siblings stay excluded — privacy guarantee intact.
|
|
402
|
-
expect(shouldSync(path.join(hqRoot, "companies/indigo/data"), true)).toBe(false);
|
|
403
|
-
expect(shouldSync(path.join(hqRoot, "companies/indigo/workers"), true)).toBe(false);
|
|
404
|
-
});
|
|
405
|
-
|
|
406
|
-
it("allowlist mode: walker descends through intermediate ancestor dirs", () => {
|
|
407
|
-
// Full gitignore semantics: a walker starting at hqRoot must be able to
|
|
408
|
-
// descend through `companies/` and `companies/indigo/` to reach the
|
|
409
|
-
// allowlisted leaf `companies/*/knowledge/`. The ancestor matcher
|
|
410
|
-
// permits this for dir-mode queries while keeping files directly inside
|
|
411
|
-
// those intermediate dirs excluded — privacy invariant intact.
|
|
412
|
-
fs.writeFileSync(
|
|
413
|
-
path.join(hqRoot, ".hqinclude"),
|
|
414
|
-
"companies/*/knowledge/\n",
|
|
415
|
-
);
|
|
416
|
-
const shouldSync = createIgnoreFilter(hqRoot);
|
|
417
|
-
// Intermediate directories along the path to the leaf are descent-allowed.
|
|
418
|
-
expect(shouldSync(path.join(hqRoot, "companies"), true)).toBe(true);
|
|
419
|
-
expect(shouldSync(path.join(hqRoot, "companies/indigo"), true)).toBe(true);
|
|
420
|
-
// The leaf itself is allowed.
|
|
421
|
-
expect(shouldSync(path.join(hqRoot, "companies/indigo/knowledge"), true)).toBe(true);
|
|
422
|
-
// Files directly inside intermediate dirs are still excluded — only the
|
|
423
|
-
// dir is descent-allowed, the dir's loose files are not.
|
|
424
|
-
expect(shouldSync(path.join(hqRoot, "companies/indigo/notes.md"))).toBe(false);
|
|
425
|
-
expect(shouldSync(path.join(hqRoot, "companies/README.md"))).toBe(false);
|
|
426
|
-
// Files inside the allowlisted leaf still sync.
|
|
427
|
-
expect(shouldSync(path.join(hqRoot, "companies/indigo/knowledge/x.md"))).toBe(true);
|
|
428
|
-
});
|
|
429
|
-
|
|
430
|
-
it("dir-only ignore patterns honor the isDir hint symmetrically", () => {
|
|
431
|
-
// Gitignore semantics: a trailing-slash pattern (`foo/`) matches only
|
|
432
|
-
// directories, never files of the same name. The filter applies this
|
|
433
|
-
// on BOTH layers — exclude and include — by appending `/` to the probe
|
|
434
|
-
// when the caller passes isDir=true, and leaving it as-is otherwise.
|
|
435
|
-
// This guarantees:
|
|
436
|
-
// - a directory `node_modules` is excluded (descent skipped),
|
|
437
|
-
// - but a regular file literally named `node_modules` is NOT
|
|
438
|
-
// mistakenly excluded by the dir-only pattern.
|
|
439
|
-
fs.writeFileSync(path.join(hqRoot, ".hqignore"), "build/\n");
|
|
440
|
-
const shouldSync = createIgnoreFilter(hqRoot);
|
|
441
|
-
// Directory `build` matches the dir-only exclusion.
|
|
442
|
-
expect(shouldSync(path.join(hqRoot, "build"), true)).toBe(false);
|
|
443
|
-
// A file literally named `build` (not a dir) does NOT match `build/`.
|
|
444
|
-
// This is the asymmetry that previous PR comments warned about and
|
|
445
|
-
// that the isDir hint resolves cleanly.
|
|
446
|
-
expect(shouldSync(path.join(hqRoot, "build"), false)).toBe(true);
|
|
447
|
-
// Default-call (no hint) is treated as "not a directory" — matches
|
|
448
|
-
// gitignore's blob-default and preserves the file-side guarantee.
|
|
449
|
-
expect(shouldSync(path.join(hqRoot, "build"))).toBe(true);
|
|
450
|
-
});
|
|
451
|
-
|
|
452
|
-
it("allowlist mode: exclusion layers still subtract on top", () => {
|
|
453
|
-
// Even when a subtree is allowlisted, default ignores like node_modules/
|
|
454
|
-
// and .env must still apply. Otherwise an allowlisted subdir would sync
|
|
455
|
-
// gigabytes of dependency junk or leak secret env files.
|
|
456
|
-
fs.writeFileSync(path.join(hqRoot, ".hqinclude"), "companies/*/projects/\n");
|
|
457
|
-
const shouldSync = createIgnoreFilter(hqRoot);
|
|
458
|
-
expect(
|
|
459
|
-
shouldSync(path.join(hqRoot, "companies/indigo/projects/p1/prd.json")),
|
|
460
|
-
).toBe(true);
|
|
461
|
-
expect(
|
|
462
|
-
shouldSync(path.join(hqRoot, "companies/indigo/projects/p1/node_modules/react/index.js")),
|
|
463
|
-
).toBe(false);
|
|
464
|
-
expect(shouldSync(path.join(hqRoot, "companies/indigo/projects/p1/.env"))).toBe(false);
|
|
465
|
-
});
|
|
466
|
-
});
|