@oalo-ai/cli 0.8.0 → 0.9.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/man/oalo.1 +163 -3
- package/package.json +1 -1
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/skills/oalo/SKILL.md +27 -0
- package/src/commands/calls.js +23 -0
- package/src/commands/crm.js +22 -4
- package/src/commands/data.js +17 -2
- package/src/commands/forthwith.js +497 -0
- package/src/commands/privacy.js +106 -0
- package/src/coord-release.json +9 -9
- package/src/help.js +90 -2
- package/src/index.js +17 -2
- package/src/privacy/anonymize.js +321 -0
package/man/oalo.1
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.TH OALO 1 "" "oalo 0.
|
|
1
|
+
.TH OALO 1 "" "oalo 0.9.1" "OALO CLI"
|
|
2
2
|
.SH NAME
|
|
3
3
|
oalo \- wire a local app into your Oalo workspace
|
|
4
4
|
.SH SYNOPSIS
|
|
@@ -354,6 +354,18 @@ push: skip the first N records, to resume a push that stopped.
|
|
|
354
354
|
\fB\-\-new\-ids\fR
|
|
355
355
|
push: let the server make ids for records without one. A re\-send then adds copies.
|
|
356
356
|
.TP
|
|
357
|
+
\fB\-\-anonymize\fR
|
|
358
|
+
push: anonymize PII columns locally before upload (default mode: pseudonymize).
|
|
359
|
+
.TP
|
|
360
|
+
\fB\-\-anonymize\-mode <mode>\fR
|
|
361
|
+
push: client\-side PII mode: pseudonymize (deterministic HMAC), mask, drop, or scrub (inline free text).
|
|
362
|
+
.TP
|
|
363
|
+
\fB\-\-anonymize\-fields <a,b>\fR
|
|
364
|
+
push: comma\-separated fields to anonymize (defaults to standard PII columns like email, phone, ssn, dob, address).
|
|
365
|
+
.TP
|
|
366
|
+
\fB\-\-salt\-file <path>\fR
|
|
367
|
+
push: local HMAC salt file for deterministic pseudonymize joins (default ~/.oalo/anonymize.salt, mode 0600).
|
|
368
|
+
.TP
|
|
357
369
|
\fB\-\-dry\-run\fR
|
|
358
370
|
push: parse, check the model exists, show the first row, write nothing.
|
|
359
371
|
.TP
|
|
@@ -1563,14 +1575,26 @@ Saved replies (\fBoalo inbox replies\fR) are org\-wide \fB/\fR quick replies ava
|
|
|
1563
1575
|
.PP
|
|
1564
1576
|
Exit codes: 0 done; 1 refused or failed; 2 bad arguments or no CLI token.
|
|
1565
1577
|
.SS crm
|
|
1566
|
-
Bulk\-import CRM contacts from a CSV file with email/phone deduplication and
|
|
1578
|
+
Bulk\-import CRM contacts from a CSV file with email/phone deduplication, optional client\-side PII anonymization, and tags.
|
|
1567
1579
|
.PP
|
|
1568
|
-
\fBoalo crm import <file.csv> [\-\-tags a,b] [\-\-dry\-run] [\-\-json]\fR
|
|
1580
|
+
\fBoalo crm import <file.csv> [\-\-tags a,b] [\-\-anonymize] [\-\-anonymize\-mode pseudonymize|mask|drop|scrub] [\-\-anonymize\-fields a,b] [\-\-salt\-file <path>] [\-\-dry\-run] [\-\-json]\fR
|
|
1569
1581
|
.br
|
|
1570
1582
|
.TP
|
|
1571
1583
|
\fB\-\-tags <a,b>\fR
|
|
1572
1584
|
Comma\-separated tags to apply to every imported contact.
|
|
1573
1585
|
.TP
|
|
1586
|
+
\fB\-\-anonymize\fR
|
|
1587
|
+
Anonymize PII columns locally before upload (default mode: pseudonymize).
|
|
1588
|
+
.TP
|
|
1589
|
+
\fB\-\-anonymize\-mode <mode>\fR
|
|
1590
|
+
Client\-side PII mode: pseudonymize (deterministic HMAC), mask, drop, or scrub (inline free text).
|
|
1591
|
+
.TP
|
|
1592
|
+
\fB\-\-anonymize\-fields <a,b>\fR
|
|
1593
|
+
Comma\-separated fields to anonymize (defaults to standard PII columns like email, phone, ssn, dob, address).
|
|
1594
|
+
.TP
|
|
1595
|
+
\fB\-\-salt\-file <path>\fR
|
|
1596
|
+
Local HMAC salt file for deterministic pseudonymize joins (default ~/.oalo/anonymize.salt, mode 0600).
|
|
1597
|
+
.TP
|
|
1574
1598
|
\fB\-\-dry\-run\fR
|
|
1575
1599
|
Parse the CSV locally and preview the first 5 rows without writing.
|
|
1576
1600
|
.TP
|
|
@@ -1578,8 +1602,141 @@ Parse the CSV locally and preview the first 5 rows without writing.
|
|
|
1578
1602
|
Print JSON output.
|
|
1579
1603
|
.IP \(bu 2
|
|
1580
1604
|
Reads standard CSV headers (\fBemail\fR, \fBphone\fR, \fBname\fR, \fBfirst_name\fR, \fBlast_name\fR, \fBtags\fR, \fBcompany\fR, etc.) and upserts via \fBcrm:import_contacts\fR, deduplicating by email/phone/external_ref.
|
|
1605
|
+
.IP \(bu 2
|
|
1606
|
+
With \fB\-\-anonymize\fR, transformations happen in memory on your machine before any row is uploaded to Oalo.
|
|
1581
1607
|
.PP
|
|
1582
1608
|
Exit codes: 0 done; 1 refused or failed; 2 bad arguments, unreadable file, or no CLI token.
|
|
1609
|
+
.SS privacy
|
|
1610
|
+
View or set the workspace Privacy Mode (standard, zdr, local_only) and LLM\-boundary PII Vault scrubbing.
|
|
1611
|
+
.PP
|
|
1612
|
+
\fBoalo privacy [\-\-json]\fR
|
|
1613
|
+
.br
|
|
1614
|
+
\fBoalo privacy set \-\-mode standard|zdr|local_only [\-\-scrub\-pii on|off] [\-\-cloud\-embeddings on|off] [\-\-cloud\-jobs on|off] [\-\-json]\fR
|
|
1615
|
+
.br
|
|
1616
|
+
.TP
|
|
1617
|
+
\fB\-\-mode <mode>\fR
|
|
1618
|
+
set: workspace privacy tier: standard, zdr (Zero Data Retention: Bedrock and local byo\-* only), or local_only (only local byo\-* models, no cloud embeddings or cloud background jobs).
|
|
1619
|
+
.TP
|
|
1620
|
+
\fB\-\-scrub\-pii <on|off>\fR
|
|
1621
|
+
set: deterministically replace SSNs, Luhn credit cards, emails, phones, and IPv4 addresses with tokens before hosted LLM calls.
|
|
1622
|
+
.TP
|
|
1623
|
+
\fB\-\-cloud\-embeddings <on|off>\fR
|
|
1624
|
+
set: allow or disable cloud embeddings (always off in local_only mode).
|
|
1625
|
+
.TP
|
|
1626
|
+
\fB\-\-cloud\-jobs <on|off>\fR
|
|
1627
|
+
set: allow or disable cloud background LLM jobs such as Whisper transcription and summaries (always off in local_only mode).
|
|
1628
|
+
.TP
|
|
1629
|
+
\fB\-\-json\fR
|
|
1630
|
+
Print JSON output.
|
|
1631
|
+
.IP \(bu 2
|
|
1632
|
+
Workspace admins can change the policy; all members can inspect it.
|
|
1633
|
+
.IP \(bu 2
|
|
1634
|
+
Calls inherit the workspace privacy mode and can only raise privacy (never downgrade a zdr or local_only workspace).
|
|
1635
|
+
.IP \(bu 2
|
|
1636
|
+
For client\-side anonymization before import, pass \fB\-\-anonymize\fR to \fBoalo data push\fR or \fBoalo crm import\fR.
|
|
1637
|
+
.PP
|
|
1638
|
+
Exit codes: 0 done; 1 refused or failed; 2 bad arguments or no CLI token.
|
|
1639
|
+
.SS calls
|
|
1640
|
+
Manage Oalo Calls (1\-on\-1 video rooms, live classes, and Forthwith sessions): list, inspect, share recordings, and verify SHA\-256 notarization.
|
|
1641
|
+
.PP
|
|
1642
|
+
\fBoalo calls list [\-\-kind external|one_on_one|live_class] [\-\-status live|ended] [\-\-json]\fR
|
|
1643
|
+
.br
|
|
1644
|
+
\fBoalo calls show <call\-id> [\-\-json]\fR
|
|
1645
|
+
.br
|
|
1646
|
+
\fBoalo calls share <call\-id> \-\-on | \-\-off [\-\-json]\fR
|
|
1647
|
+
.br
|
|
1648
|
+
\fBoalo calls verify <call\-id> [\-\-json]\fR
|
|
1649
|
+
.br
|
|
1650
|
+
.TP
|
|
1651
|
+
\fB\-\-kind <kind>\fR
|
|
1652
|
+
list: filter by call kind (external, one_on_one, live_class).
|
|
1653
|
+
.TP
|
|
1654
|
+
\fB\-\-status <status>\fR
|
|
1655
|
+
list: filter by status (live, ended).
|
|
1656
|
+
.TP
|
|
1657
|
+
\fB\-\-on\fR
|
|
1658
|
+
share: allow verified call participants to view the recording and notarized transcript.
|
|
1659
|
+
.TP
|
|
1660
|
+
\fB\-\-off\fR
|
|
1661
|
+
share: restrict the recording and transcript to the host only.
|
|
1662
|
+
.TP
|
|
1663
|
+
\fB\-\-json\fR
|
|
1664
|
+
Print JSON output.
|
|
1665
|
+
.IP \(bu 2
|
|
1666
|
+
Oalo Calls is the video room, recording, and SHA\-256 notarization platform. For the live real\-time assistant on external Zoom, Meet, or Teams calls, run \fBoalo forthwith\fR.
|
|
1667
|
+
.IP \(bu 2
|
|
1668
|
+
Note: \fBoalo call\fR (singular) calls a raw Base event; \fBoalo calls\fR (plural) manages video and external calls.
|
|
1669
|
+
.PP
|
|
1670
|
+
Exit codes: 0 done; 1 failed or verification mismatch; 2 bad arguments or no CLI token.
|
|
1671
|
+
.SS forthwith
|
|
1672
|
+
Forthwith: Oalo's real\-time call assistant for Zoom, Meet, Teams, or phone calls with Pre\-Call Dossier, private whispers, and SHA\-256 notarization.
|
|
1673
|
+
.PP
|
|
1674
|
+
\fBoalo forthwith start [\-\-title <text>] [\-\-contact <ref>] [\-\-booking <id>] [\-\-privacy standard|zdr|local_only] [\-\-local] [\-\-offline] [\-\-stt\-cmd <cmd>] [\-\-speaker <name>] [\-\-scrub\-pii] [\-\-no\-telemetry] [\-\-out <file>] [\-\-json]\fR
|
|
1675
|
+
.br
|
|
1676
|
+
\fBoalo forthwith list [\-\-kind external|one_on_one|live_class] [\-\-status live|ended] [\-\-json]\fR
|
|
1677
|
+
.br
|
|
1678
|
+
\fBoalo forthwith show <call\-id> [\-\-json]\fR
|
|
1679
|
+
.br
|
|
1680
|
+
\fBoalo forthwith share <call\-id> \-\-on | \-\-off [\-\-json]\fR
|
|
1681
|
+
.br
|
|
1682
|
+
\fBoalo forthwith verify <call\-id> [\-\-json]\fR
|
|
1683
|
+
.br
|
|
1684
|
+
.TP
|
|
1685
|
+
\fB\-\-title <text>\fR
|
|
1686
|
+
start: call title (default: External call).
|
|
1687
|
+
.TP
|
|
1688
|
+
\fB\-\-contact <ref>\fR
|
|
1689
|
+
start: contact email, phone, or external ref to preload into the minute\-0 Pre\-Call Dossier.
|
|
1690
|
+
.TP
|
|
1691
|
+
\fB\-\-booking <id>\fR
|
|
1692
|
+
start: link the call to a calendar booking id.
|
|
1693
|
+
.TP
|
|
1694
|
+
\fB\-\-privacy <mode>\fR
|
|
1695
|
+
start: call privacy tier (standard, zdr, local_only); cannot downgrade workspace policy.
|
|
1696
|
+
.TP
|
|
1697
|
+
\fB\-\-local\fR
|
|
1698
|
+
start: shorthand for \-\-privacy local_only (keeps AI evaluation on local byo\-* models).
|
|
1699
|
+
.TP
|
|
1700
|
+
\fB\-\-offline\fR
|
|
1701
|
+
start: strictly local zero\-egress capture with local SHA\-256 notarization and no network calls.
|
|
1702
|
+
.TP
|
|
1703
|
+
\fB\-\-stt\-cmd <cmd>\fR
|
|
1704
|
+
start: local speech\-to\-text command whose stdout lines stream as live transcript turns (for example local whisper\-stream).
|
|
1705
|
+
.TP
|
|
1706
|
+
\fB\-\-speaker <name>\fR
|
|
1707
|
+
start: default speaker label for stdin or STT lines without a \fBName: text\fR prefix.
|
|
1708
|
+
.TP
|
|
1709
|
+
\fB\-\-scrub\-pii\fR
|
|
1710
|
+
start: scrub SSNs, Luhn cards, emails, phones, and IPs locally before sending transcript lines.
|
|
1711
|
+
.TP
|
|
1712
|
+
\fB\-\-no\-telemetry\fR
|
|
1713
|
+
Disable CLI update notices and telemetry (same as OALO_NO_TELEMETRY=1).
|
|
1714
|
+
.TP
|
|
1715
|
+
\fB\-\-out <file>\fR
|
|
1716
|
+
start with \-\-offline: save the locally notarized transcript JSON file (mode 0600).
|
|
1717
|
+
.TP
|
|
1718
|
+
\fB\-\-kind <kind>\fR
|
|
1719
|
+
list: filter by call kind (external, one_on_one, live_class).
|
|
1720
|
+
.TP
|
|
1721
|
+
\fB\-\-status <status>\fR
|
|
1722
|
+
list: filter by status (live, ended).
|
|
1723
|
+
.TP
|
|
1724
|
+
\fB\-\-on\fR
|
|
1725
|
+
share: allow verified call participants to view the recording and notarized transcript.
|
|
1726
|
+
.TP
|
|
1727
|
+
\fB\-\-off\fR
|
|
1728
|
+
share: restrict the recording and transcript to the host only.
|
|
1729
|
+
.TP
|
|
1730
|
+
\fB\-\-json\fR
|
|
1731
|
+
Print JSON (or NDJSON event stream during start).
|
|
1732
|
+
.IP \(bu 2
|
|
1733
|
+
During a live session, type \fB/ask <question>\fR for an instant private whisper card, \fB/share <title> | <content> [| <url>]\fR to push an attendee card, \fB/brief\fR to re\-print the Pre\-Call Dossier, or \fB/end\fR to finish and notarize the call.
|
|
1734
|
+
.IP \(bu 2
|
|
1735
|
+
Lines prefixed with \fBName: utterance\fR automatically tag the speaker; other lines use \fB\-\-speaker\fR.
|
|
1736
|
+
.IP \(bu 2
|
|
1737
|
+
Use \fB\-\-offline \-\-scrub\-pii \-\-no\-telemetry\fR for zero\-egress local transcription and local SHA\-256 notarization.
|
|
1738
|
+
.PP
|
|
1739
|
+
Exit codes: 0 done; 1 failed or verification mismatch; 2 bad arguments or no CLI token.
|
|
1583
1740
|
.SS flows
|
|
1584
1741
|
Turn a chat flow on or off, or delete it, by bot and flow name, without pulling and pushing it.
|
|
1585
1742
|
.PP
|
|
@@ -2414,6 +2571,9 @@ Default headless agent harness for coord up, ralph, race, review, swarm, auto.
|
|
|
2414
2571
|
\fBOALO_DEBUG\fR
|
|
2415
2572
|
Log channel transport activity to stderr.
|
|
2416
2573
|
.TP
|
|
2574
|
+
\fBOALO_NO_TELEMETRY\fR
|
|
2575
|
+
Set to 1 to suppress CLI update notices and telemetry.
|
|
2576
|
+
.TP
|
|
2417
2577
|
\fBNO_COLOR\fR
|
|
2418
2578
|
Disable colour in tail output.
|
|
2419
2579
|
.SH SEE ALSO
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oalo",
|
|
3
3
|
"description": "Work on an Oalo workspace from Claude Code: edit chat flows, loops and code tools, deploy and migrate apps, inspect and self-heal runtime errors, and run test conversations with a bot.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.6.0",
|
|
5
5
|
"author": { "name": "Oalo" },
|
|
6
6
|
"mcpServers": {
|
|
7
7
|
"oalo": {
|
|
@@ -560,6 +560,33 @@ oalo crm import contacts.csv --tags vip,latam [--dry-run] [--json]
|
|
|
560
560
|
|
|
561
561
|
Operational trigger events available in `trigger_catalog` for error workflows and alerts: `loop.failed`, `bot.cap_reached`, `guardrail.triggered`, and `conversation.transferred`. Inbound WhatsApp/Instagram voice notes are auto-transcribed via Whisper before the bot turn.
|
|
562
562
|
|
|
563
|
+
## Calls, `oalo forthwith`, Privacy Mode & PII Anonymization
|
|
564
|
+
|
|
565
|
+
```sh
|
|
566
|
+
# Workspace Privacy Mode (standard | zdr | local_only) and LLM-boundary PII Vault scrubbing
|
|
567
|
+
oalo privacy [--json]
|
|
568
|
+
oalo privacy set --mode zdr --scrub-pii on [--json]
|
|
569
|
+
oalo privacy set --mode local_only [--json]
|
|
570
|
+
|
|
571
|
+
# Client-side PII anonymization BEFORE upload (pseudonymize | mask | drop | scrub)
|
|
572
|
+
oalo data push patients patients.csv --anonymize --anonymize-mode pseudonymize [--anonymize-fields email,phone,ssn]
|
|
573
|
+
oalo crm import contacts.csv --anonymize --anonymize-mode mask [--dry-run]
|
|
574
|
+
|
|
575
|
+
# Forthwith: live local call assistant for Zoom/Meet/Teams/phone (Pre-Call Dossier, private whispers, SHA-256 notarization)
|
|
576
|
+
oalo forthwith start --title "Renewal Call" --contact ana@clinic.org [--privacy zdr] [--scrub-pii] [--stt-cmd "whisper-stream"]
|
|
577
|
+
oalo forthwith start --title "Private Consult" --offline --scrub-pii --no-telemetry --out consult.json
|
|
578
|
+
|
|
579
|
+
# Oalo Calls management (list, inspect, toggle participant recording sharing, verify SHA-256 digest)
|
|
580
|
+
oalo calls list [--kind external|one_on_one|live_class] [--json]
|
|
581
|
+
oalo calls show <call-id> [--json]
|
|
582
|
+
oalo calls share <call-id> --on | --off
|
|
583
|
+
oalo calls verify <call-id> [--json]
|
|
584
|
+
```
|
|
585
|
+
|
|
586
|
+
- `privacy_mode = zdr` restricts hosted AI calls to Zero-Data-Retention providers (`bedrock/*`) and local `byo-*` models; `local_only` permits only local `byo-*` models via `oalo serve` and disables cloud embeddings, cloud Whisper, and cloud background jobs. Calls inherit workspace privacy and can never downgrade it.
|
|
587
|
+
- `--anonymize` runs in memory on the local machine before upload (`pseudonymize` uses a local `0600` HMAC salt so cross-table joins remain intact). Set `OALO_NO_TELEMETRY=1` (or `--no-telemetry`) to suppress CLI update notices.
|
|
588
|
+
- Call lifecycle workflow trigger events in `trigger_catalog`: `call.started`, `call.ended`, and `call.transcribed`. Read `oalo docs video-calls-and-classes`, `oalo docs call-copilot-and-forthwith`, and `oalo docs pii-and-privacy-mode`.
|
|
589
|
+
|
|
563
590
|
## Several agents on one repo
|
|
564
591
|
|
|
565
592
|
When the person wants to coordinate agents across a repo (no Oalo workspace
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { forthwith } from "./forthwith.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* `oalo calls`: manage Oalo Calls (1-on-1 video rooms, live classes, and
|
|
5
|
+
* Forthwith external calls): list, inspect, toggle participant recording
|
|
6
|
+
* sharing, and verify SHA-256 notarization digests.
|
|
7
|
+
*
|
|
8
|
+
* oalo calls list [--kind external|one_on_one|live_class] [--status live|ended] [--json]
|
|
9
|
+
* oalo calls show <call-id> [--json]
|
|
10
|
+
* oalo calls share <call-id> --on | --off [--json]
|
|
11
|
+
* oalo calls verify <call-id> [--json]
|
|
12
|
+
*/
|
|
13
|
+
export async function calls(flags, rest, opts = {}) {
|
|
14
|
+
const sub = rest[1] || "list";
|
|
15
|
+
if (!["list", "show", "share", "verify"].includes(sub)) {
|
|
16
|
+
const msg = "usage: oalo calls list | show <call-id> | share <call-id> --on|--off | verify <call-id>";
|
|
17
|
+
if (flags?.json) console.log(JSON.stringify({ error: msg }));
|
|
18
|
+
else console.error(msg);
|
|
19
|
+
process.exitCode = 2;
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
return await forthwith(flags, ["forthwith", sub, ...rest.slice(2)], opts);
|
|
23
|
+
}
|
package/src/commands/crm.js
CHANGED
|
@@ -2,17 +2,18 @@ import { readFileSync } from "node:fs";
|
|
|
2
2
|
import { OaloChannel } from "../channel.js";
|
|
3
3
|
import { resolve as resolveConfig, controlPlane, HOW_TO_CONNECT } from "../config.js";
|
|
4
4
|
import { dim } from "../events.js";
|
|
5
|
+
import { anonymizeRows, parseAnonymizeFlags } from "../privacy/anonymize.js";
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* `oalo crm`: CRM contact import (`crm:import_contacts`).
|
|
8
9
|
*
|
|
9
|
-
* oalo crm import <file.csv> [--tags tag1,tag2] [--dry-run] [--json]
|
|
10
|
+
* oalo crm import <file.csv> [--tags tag1,tag2] [--anonymize] [--anonymize-mode pseudonymize|mask|drop|scrub] [--anonymize-fields a,b] [--salt-file path] [--dry-run] [--json]
|
|
10
11
|
*/
|
|
11
12
|
export async function crm(flags, rest, opts = {}) {
|
|
12
13
|
const sub = rest[1];
|
|
13
14
|
const filePath = rest[2];
|
|
14
15
|
if (sub !== "import" || !filePath) {
|
|
15
|
-
return fail("usage: oalo crm import <file.csv> [--tags a,b] [--dry-run] [--json]", 2, flags);
|
|
16
|
+
return fail("usage: oalo crm import <file.csv> [--tags a,b] [--anonymize] [--dry-run] [--json]", 2, flags);
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
let csvText;
|
|
@@ -22,18 +23,35 @@ export async function crm(flags, rest, opts = {}) {
|
|
|
22
23
|
return fail(`could not read ${filePath}: ${e.message}`, 2, flags);
|
|
23
24
|
}
|
|
24
25
|
|
|
25
|
-
|
|
26
|
+
let rows = parseContactsCsv(csvText);
|
|
26
27
|
if (!rows.length) {
|
|
27
28
|
return fail("no contact rows found in CSV (expected a header row with email, phone, or name)", 2, flags);
|
|
28
29
|
}
|
|
29
30
|
|
|
31
|
+
let anonStats = null;
|
|
32
|
+
try {
|
|
33
|
+
const anonOpts = parseAnonymizeFlags(flags);
|
|
34
|
+
if (anonOpts) {
|
|
35
|
+
const res = anonymizeRows(rows, anonOpts);
|
|
36
|
+
rows = res.rows;
|
|
37
|
+
anonStats = res.stats;
|
|
38
|
+
console.error(
|
|
39
|
+
dim(
|
|
40
|
+
`anonymized locally (${anonStats.mode}): ${anonStats.valuesTransformed} value(s) across ${anonStats.fieldsTouched.length ? anonStats.fieldsTouched.join(", ") : "no matching fields"} before upload`,
|
|
41
|
+
),
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
} catch (e) {
|
|
45
|
+
return fail(e.message, 2, flags);
|
|
46
|
+
}
|
|
47
|
+
|
|
30
48
|
const tags =
|
|
31
49
|
typeof flags.tags === "string"
|
|
32
50
|
? flags.tags.split(",").map((t) => t.trim()).filter(Boolean)
|
|
33
51
|
: [];
|
|
34
52
|
|
|
35
53
|
if (flags["dry-run"]) {
|
|
36
|
-
if (flags.json) return void console.log(JSON.stringify({ dry_run: true, count: rows.length, tags, preview: rows.slice(0, 5) }, null, 2));
|
|
54
|
+
if (flags.json) return void console.log(JSON.stringify({ dry_run: true, count: rows.length, tags, anonymized: anonStats, preview: rows.slice(0, 5) }, null, 2));
|
|
37
55
|
console.log(`dry run: ${rows.length} contact row(s) ready to import${tags.length ? ` with tags [${tags.join(", ")}]` : ""}`);
|
|
38
56
|
for (const r of rows.slice(0, 5)) console.log(` ${dim(JSON.stringify(r))}`);
|
|
39
57
|
return;
|
package/src/commands/data.js
CHANGED
|
@@ -5,6 +5,7 @@ import { resolve as resolveConfig, controlPlane, readToken, HOW_TO_CONNECT } fro
|
|
|
5
5
|
import { requireFeature } from "../server.js";
|
|
6
6
|
import { ApiError } from "../api.js";
|
|
7
7
|
import { dim } from "../events.js";
|
|
8
|
+
import { anonymizeRows, parseAnonymizeFlags } from "../privacy/anonymize.js";
|
|
8
9
|
import {
|
|
9
10
|
parseRecords,
|
|
10
11
|
toRows,
|
|
@@ -380,7 +381,21 @@ async function push(flags, rest, cfg) {
|
|
|
380
381
|
});
|
|
381
382
|
const { rows, missing } = toRows(records, { idField, newIds: !!flags["new-ids"] });
|
|
382
383
|
const from = Number(flags.from || 0);
|
|
383
|
-
|
|
384
|
+
let todo = rows.slice(from);
|
|
385
|
+
|
|
386
|
+
// Client-side PII anonymization runs locally BEFORE anything is uploaded.
|
|
387
|
+
const anonOpts = parseAnonymizeFlags(flags);
|
|
388
|
+
let anonStats = null;
|
|
389
|
+
if (anonOpts) {
|
|
390
|
+
const res = anonymizeRows(todo, anonOpts);
|
|
391
|
+
todo = res.rows;
|
|
392
|
+
anonStats = res.stats;
|
|
393
|
+
console.error(
|
|
394
|
+
dim(
|
|
395
|
+
`anonymized locally (${anonStats.mode}): ${anonStats.valuesTransformed} value(s) across ${anonStats.fieldsTouched.length ? anonStats.fieldsTouched.join(", ") : "no matching fields"} before upload`,
|
|
396
|
+
),
|
|
397
|
+
);
|
|
398
|
+
}
|
|
384
399
|
|
|
385
400
|
if (missing.length) {
|
|
386
401
|
console.error(`${missing.length} record${missing.length === 1 ? "" : "s"} have no ${idField} and will be skipped (first: #${missing[0].index + 1}). ` +
|
|
@@ -395,7 +410,7 @@ async function push(flags, rest, cfg) {
|
|
|
395
410
|
}
|
|
396
411
|
|
|
397
412
|
if (flags["dry-run"]) {
|
|
398
|
-
out(flags, { table, env, rows: todo.length, skipped: missing.length, first: todo[0] ?? null }, () => {
|
|
413
|
+
out(flags, { table, env, rows: todo.length, skipped: missing.length, anonymized: anonStats, first: todo[0] ?? null }, () => {
|
|
399
414
|
console.log(`${todo.length} rows would be upserted into ${table} in ${read.serverUrl} (${env}), by ${idField}.`);
|
|
400
415
|
if (todo[0]) console.log(dim(`first: ${JSON.stringify(todo[0])}`));
|
|
401
416
|
console.log(dim("dry run: nothing was written"));
|