@indigoai-us/hq-cli 5.35.0 → 5.35.1
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/commands/cloud.d.ts +1 -0
- package/dist/commands/cloud.js +35 -2
- package/package.json +3 -3
- package/src/commands/cloud.ts +35 -0
package/dist/commands/cloud.d.ts
CHANGED
|
@@ -104,6 +104,7 @@ export interface ShareCallOptions {
|
|
|
104
104
|
message?: string;
|
|
105
105
|
skipUnchanged?: boolean;
|
|
106
106
|
propagateDeletes?: boolean;
|
|
107
|
+
propagateDeletePolicy?: "owned-only" | "currency-gated" | "all";
|
|
107
108
|
}
|
|
108
109
|
export interface ShareCallResult {
|
|
109
110
|
filesUploaded: number;
|
package/dist/commands/cloud.js
CHANGED
|
@@ -13,13 +13,40 @@
|
|
|
13
13
|
* hq sync status — show local journal summary
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
16
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="94a293c9-eb80-5100-a3e0-d64c93f7165c")}catch(e){}}();
|
|
17
17
|
import chalk from "chalk";
|
|
18
18
|
import * as fs from "fs";
|
|
19
19
|
import * as path from "path";
|
|
20
20
|
import { share, sync, readJournal, getJournalPath, loadCachedTokens, VaultClient, computePersonalVaultPaths, } from "@indigoai-us/hq-cloud";
|
|
21
21
|
import { DEFAULT_HQ_ROOT, ensureCognitoToken, buildVaultConfig, } from "../utils/cognito-session.js";
|
|
22
22
|
import { emitNarrowHint, isStrictRefusal, resolveBannerLevel, } from "../lib/narrow-hint-banner.js";
|
|
23
|
+
/**
|
|
24
|
+
* Resolve the `propagateDeletePolicy` for share() calls.
|
|
25
|
+
*
|
|
26
|
+
* Mirrors `@indigoai-us/hq-cloud`'s `bin/sync-runner.js` `resolveDeletePolicy`
|
|
27
|
+
* — the same function the AppBar HQ Sync menubar uses — so the CLI and the
|
|
28
|
+
* menubar agree on the policy by default. Inlined here (rather than
|
|
29
|
+
* deep-imported from `dist/bin/sync-runner.js`) to avoid coupling to a
|
|
30
|
+
* non-public subpath.
|
|
31
|
+
*
|
|
32
|
+
* Default is `"currency-gated"` (etag-verified safe delete). Override via
|
|
33
|
+
* the `HQ_SYNC_DELETE_POLICY` env var: `owned-only` (legacy direction-of-
|
|
34
|
+
* origin filter, multi-user safe but stranded down-stream litter on
|
|
35
|
+
* personal vaults until hq-cloud 6.0.1's prs_ override), `currency-gated`
|
|
36
|
+
* (the menubar default), or `all` (emergency-reconcile, no safety gates).
|
|
37
|
+
*
|
|
38
|
+
* Prior to this helper, the CLI passed nothing → share() fell through to
|
|
39
|
+
* its own `"owned-only"` default, leaving CLI users on a stricter (and
|
|
40
|
+
* sometimes wrong, on personal vault) policy than menubar users for
|
|
41
|
+
* months. See `workspace/reports/owned-only-delete-policy-purpose-debug.md`.
|
|
42
|
+
*/
|
|
43
|
+
function resolveDeletePolicy() {
|
|
44
|
+
const env = process.env.HQ_SYNC_DELETE_POLICY;
|
|
45
|
+
if (env === "owned-only" || env === "all" || env === "currency-gated") {
|
|
46
|
+
return env;
|
|
47
|
+
}
|
|
48
|
+
return "currency-gated";
|
|
49
|
+
}
|
|
23
50
|
// Oldest-first by createdAt, ties broken by uid lexicographic — matches
|
|
24
51
|
// `pickCanonicalPersonEntity` in @indigoai-us/hq-cloud so the CLI lands on
|
|
25
52
|
// the same person bucket that `hq-sync-runner` picks.
|
|
@@ -171,6 +198,7 @@ export async function pushAll(options, deps) {
|
|
|
171
198
|
paths: [path.join(options.hqRoot, "companies", slug)],
|
|
172
199
|
skipUnchanged: true,
|
|
173
200
|
propagateDeletes: true,
|
|
201
|
+
propagateDeletePolicy: resolveDeletePolicy(),
|
|
174
202
|
...(options.onConflict ? { onConflict: options.onConflict } : {}),
|
|
175
203
|
...(options.message ? { message: options.message } : {}),
|
|
176
204
|
},
|
|
@@ -188,6 +216,7 @@ export async function pushAll(options, deps) {
|
|
|
188
216
|
journalSlug: "personal",
|
|
189
217
|
skipUnchanged: true,
|
|
190
218
|
propagateDeletes: true,
|
|
219
|
+
propagateDeletePolicy: resolveDeletePolicy(),
|
|
191
220
|
...(options.onConflict ? { onConflict: options.onConflict } : {}),
|
|
192
221
|
...(options.message ? { message: options.message } : {}),
|
|
193
222
|
},
|
|
@@ -869,6 +898,9 @@ async function runPushAll(hqRoot, message, onConflict, skipPersonal) {
|
|
|
869
898
|
...(opts.propagateDeletes !== undefined
|
|
870
899
|
? { propagateDeletes: opts.propagateDeletes }
|
|
871
900
|
: {}),
|
|
901
|
+
...(opts.propagateDeletePolicy !== undefined
|
|
902
|
+
? { propagateDeletePolicy: opts.propagateDeletePolicy }
|
|
903
|
+
: {}),
|
|
872
904
|
...(author ? { author } : {}),
|
|
873
905
|
}),
|
|
874
906
|
});
|
|
@@ -949,6 +981,7 @@ async function runNowSingle(hqRoot, company, personal, message, onConflict, mode
|
|
|
949
981
|
hqRoot,
|
|
950
982
|
skipUnchanged: true,
|
|
951
983
|
propagateDeletes: true,
|
|
984
|
+
propagateDeletePolicy: resolveDeletePolicy(),
|
|
952
985
|
...(onConflict ? { onConflict } : {}),
|
|
953
986
|
...(message ? { message } : {}),
|
|
954
987
|
...(personalMode ? { personalMode: true } : {}),
|
|
@@ -1130,4 +1163,4 @@ function resolveUploadAuthorFromCache() {
|
|
|
1130
1163
|
}
|
|
1131
1164
|
}
|
|
1132
1165
|
//# sourceMappingURL=cloud.js.map
|
|
1133
|
-
//# debugId=
|
|
1166
|
+
//# debugId=94a293c9-eb80-5100-a3e0-d64c93f7165c
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@indigoai-us/hq-cli",
|
|
3
|
-
"version": "5.35.
|
|
4
|
-
"description": "HQ by Indigo management CLI
|
|
3
|
+
"version": "5.35.1",
|
|
4
|
+
"description": "HQ by Indigo management CLI \u2014 modules and cloud sync",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"hq": "dist/index.js",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"clean": "rm -rf dist"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@indigoai-us/hq-cloud": "^6.0.
|
|
18
|
+
"@indigoai-us/hq-cloud": "^6.0.1",
|
|
19
19
|
"@indigoai-us/hq-onboarding": "^0.1.0",
|
|
20
20
|
"@sentry/node": "^10.49.0",
|
|
21
21
|
"chalk": "^5.3.0",
|
package/src/commands/cloud.ts
CHANGED
|
@@ -45,6 +45,34 @@ import {
|
|
|
45
45
|
type BannerLevel,
|
|
46
46
|
} from "../lib/narrow-hint-banner.js";
|
|
47
47
|
|
|
48
|
+
/**
|
|
49
|
+
* Resolve the `propagateDeletePolicy` for share() calls.
|
|
50
|
+
*
|
|
51
|
+
* Mirrors `@indigoai-us/hq-cloud`'s `bin/sync-runner.js` `resolveDeletePolicy`
|
|
52
|
+
* — the same function the AppBar HQ Sync menubar uses — so the CLI and the
|
|
53
|
+
* menubar agree on the policy by default. Inlined here (rather than
|
|
54
|
+
* deep-imported from `dist/bin/sync-runner.js`) to avoid coupling to a
|
|
55
|
+
* non-public subpath.
|
|
56
|
+
*
|
|
57
|
+
* Default is `"currency-gated"` (etag-verified safe delete). Override via
|
|
58
|
+
* the `HQ_SYNC_DELETE_POLICY` env var: `owned-only` (legacy direction-of-
|
|
59
|
+
* origin filter, multi-user safe but stranded down-stream litter on
|
|
60
|
+
* personal vaults until hq-cloud 6.0.1's prs_ override), `currency-gated`
|
|
61
|
+
* (the menubar default), or `all` (emergency-reconcile, no safety gates).
|
|
62
|
+
*
|
|
63
|
+
* Prior to this helper, the CLI passed nothing → share() fell through to
|
|
64
|
+
* its own `"owned-only"` default, leaving CLI users on a stricter (and
|
|
65
|
+
* sometimes wrong, on personal vault) policy than menubar users for
|
|
66
|
+
* months. See `workspace/reports/owned-only-delete-policy-purpose-debug.md`.
|
|
67
|
+
*/
|
|
68
|
+
function resolveDeletePolicy(): "owned-only" | "currency-gated" | "all" {
|
|
69
|
+
const env = process.env.HQ_SYNC_DELETE_POLICY;
|
|
70
|
+
if (env === "owned-only" || env === "all" || env === "currency-gated") {
|
|
71
|
+
return env;
|
|
72
|
+
}
|
|
73
|
+
return "currency-gated";
|
|
74
|
+
}
|
|
75
|
+
|
|
48
76
|
interface CommonSyncOptions {
|
|
49
77
|
hqRoot: string;
|
|
50
78
|
company?: string;
|
|
@@ -164,6 +192,7 @@ export interface ShareCallOptions {
|
|
|
164
192
|
message?: string;
|
|
165
193
|
skipUnchanged?: boolean;
|
|
166
194
|
propagateDeletes?: boolean;
|
|
195
|
+
propagateDeletePolicy?: "owned-only" | "currency-gated" | "all";
|
|
167
196
|
}
|
|
168
197
|
|
|
169
198
|
export interface ShareCallResult {
|
|
@@ -397,6 +426,7 @@ export async function pushAll(
|
|
|
397
426
|
paths: [path.join(options.hqRoot, "companies", slug)],
|
|
398
427
|
skipUnchanged: true,
|
|
399
428
|
propagateDeletes: true,
|
|
429
|
+
propagateDeletePolicy: resolveDeletePolicy(),
|
|
400
430
|
...(options.onConflict ? { onConflict: options.onConflict } : {}),
|
|
401
431
|
...(options.message ? { message: options.message } : {}),
|
|
402
432
|
},
|
|
@@ -415,6 +445,7 @@ export async function pushAll(
|
|
|
415
445
|
journalSlug: "personal",
|
|
416
446
|
skipUnchanged: true,
|
|
417
447
|
propagateDeletes: true,
|
|
448
|
+
propagateDeletePolicy: resolveDeletePolicy(),
|
|
418
449
|
...(options.onConflict ? { onConflict: options.onConflict } : {}),
|
|
419
450
|
...(options.message ? { message: options.message } : {}),
|
|
420
451
|
},
|
|
@@ -1406,6 +1437,9 @@ async function runPushAll(
|
|
|
1406
1437
|
...(opts.propagateDeletes !== undefined
|
|
1407
1438
|
? { propagateDeletes: opts.propagateDeletes }
|
|
1408
1439
|
: {}),
|
|
1440
|
+
...(opts.propagateDeletePolicy !== undefined
|
|
1441
|
+
? { propagateDeletePolicy: opts.propagateDeletePolicy }
|
|
1442
|
+
: {}),
|
|
1409
1443
|
...(author ? { author } : {}),
|
|
1410
1444
|
}),
|
|
1411
1445
|
},
|
|
@@ -1505,6 +1539,7 @@ async function runNowSingle(
|
|
|
1505
1539
|
hqRoot,
|
|
1506
1540
|
skipUnchanged: true,
|
|
1507
1541
|
propagateDeletes: true,
|
|
1542
|
+
propagateDeletePolicy: resolveDeletePolicy(),
|
|
1508
1543
|
...(onConflict ? { onConflict } : {}),
|
|
1509
1544
|
...(message ? { message } : {}),
|
|
1510
1545
|
...(personalMode ? { personalMode: true } : {}),
|