Skip to content

Commit 62a7257

Browse files
authored
feat(contacts): add dedupe preview (#555)
Adds a read-only contacts dedupe preview command with JSON/table output, generated command docs, README/spec docs, and changelog credit for the extracted idea from #116.\n\nCo-authored-by: Rohan Patnaik <rohan-patnaik@users.noreply.github.com>
1 parent e9c496e commit 62a7257

10 files changed

Lines changed: 644 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- Docs: add `docs format` and plain-text `docs write` formatting flags for fonts, colors, bold/italic/underline/strikethrough, alignment, and line spacing. (#479) — thanks @mmaghsoodnia.
1010
- Drive: add `--fields` to `drive ls` and `drive get` so callers can pass Drive API field masks for fields beyond the default JSON set. (#495) — thanks @karbassi.
1111
- Drive: add read-only `drive tree`, `drive du`, and `drive inventory` reports for auditing folder contents and sizes. (#116) — thanks @rohan-patnaik.
12+
- Contacts: add preview-only `contacts dedupe` to find likely duplicate contacts by email/phone, with opt-in name matching and JSON/table merge plans. (#116) — thanks @rohan-patnaik.
1213
- Sheets: add `sheets table` list/get/create/delete commands for Google Sheets structured tables. (#470) — thanks @Pedrohgv.
1314
- Agent safety: add baked safety-profile builds for fail-closed agent binaries, with `agent-safe`, `readonly`, and `full` profiles, filtered help/schema output, docs, and build tooling. (#366, #239) — thanks @drewburchfield.
1415
- Calendar: add `--with-meet` to `calendar update` for adding Google Meet conferencing to existing events. (#538) — thanks @alexisperumal.

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1324,6 +1324,10 @@ gog contacts get people/<resourceName> --json | \
13241324

13251325
gog contacts delete people/<resourceName>
13261326

1327+
# Dedupe preview (read-only)
1328+
gog contacts dedupe
1329+
gog contacts dedupe --match email,phone,name --json
1330+
13271331
# Workspace directory (requires Google Workspace)
13281332
gog contacts directory list --max 50
13291333
gog contacts directory search "Jane" --max 50

docs/commands.generated.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ Generated from `gog schema --json`.
190190
- [`gog config unset (rm,del,remove) <key>`](commands/gog-config-unset.md) - Unset a config value
191191
- [`gog contacts (contact) <command> [flags]`](commands/gog-contacts.md) - Google Contacts
192192
- [`gog contacts (contact) create (add,new) [flags]`](commands/gog-contacts-create.md) - Create a contact
193+
- [`gog contacts (contact) dedupe [flags]`](commands/gog-contacts-dedupe.md) - Find likely duplicate contacts (preview only)
193194
- [`gog contacts (contact) delete (rm,del,remove) <resourceName>`](commands/gog-contacts-delete.md) - Delete a contact
194195
- [`gog contacts (contact) directory <command>`](commands/gog-contacts-directory.md) - Directory contacts
195196
- [`gog contacts (contact) directory list [flags]`](commands/gog-contacts-directory-list.md) - List people from the Workspace directory

docs/commands/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Every `gog` command has a generated docs page. The source of truth is the live CLI schema; run `make docs-commands` after changing command names, flags, help text, aliases, or arguments.
44

5-
Generated pages: 469.
5+
Generated pages: 470.
66

77
## Top-level Commands
88

@@ -233,6 +233,7 @@ Generated pages: 469.
233233
- [gog config unset](gog-config-unset.md) - Unset a config value
234234
- [gog contacts](gog-contacts.md) - Google Contacts
235235
- [gog contacts create](gog-contacts-create.md) - Create a contact
236+
- [gog contacts dedupe](gog-contacts-dedupe.md) - Find likely duplicate contacts (preview only)
236237
- [gog contacts delete](gog-contacts-delete.md) - Delete a contact
237238
- [gog contacts directory](gog-contacts-directory.md) - Directory contacts
238239
- [gog contacts directory list](gog-contacts-directory-list.md) - List people from the Workspace directory
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# `gog contacts dedupe`
2+
3+
> Generated from `gog schema --json`. Do not edit this page by hand; run `make docs-commands`.
4+
5+
Find likely duplicate contacts (preview only)
6+
7+
## Usage
8+
9+
```bash
10+
gog contacts (contact) dedupe [flags]
11+
```
12+
13+
## Parent
14+
15+
- [gog contacts](gog-contacts.md)
16+
17+
## Flags
18+
19+
| Flag | Type | Default | Help |
20+
| --- | --- | --- | --- |
21+
| `--access-token` | `string` | | Use provided access token directly (bypasses stored refresh tokens; token expires in ~1h) |
22+
| `-a`<br>`--account`<br>`--acct` | `string` | | Account email for API commands (gmail/calendar/chat/classroom/drive/docs/slides/contacts/tasks/people/sheets/forms/appscript/ads) |
23+
| `--client` | `string` | | OAuth client name (selects stored credentials + token bucket) |
24+
| `--color` | `string` | auto | Color output: auto\|always\|never |
25+
| `--disable-commands` | `string` | | Comma-separated list of disabled commands; dot paths allowed |
26+
| `-n`<br>`--dry-run`<br>`--dryrun`<br>`--noop`<br>`--preview` | `bool` | | Do not make changes; print intended actions and exit successfully |
27+
| `--enable-commands` | `string` | | Comma-separated list of enabled commands; dot paths allowed (restricts CLI) |
28+
| `--fail-empty`<br>`--non-empty`<br>`--require-results` | `bool` | | Exit with code 3 if no duplicates |
29+
| `-y`<br>`--force`<br>`--assume-yes`<br>`--yes` | `bool` | | Skip confirmations for destructive commands |
30+
| `--gmail-no-send` | `bool` | false | Block Gmail send operations (agent safety) |
31+
| `-h`<br>`--help` | `kong.helpFlag` | | Show context-sensitive help. |
32+
| `-j`<br>`--json`<br>`--machine` | `bool` | false | Output JSON to stdout (best for scripting) |
33+
| `--match` | `string` | email,phone | Match fields: email,phone,name |
34+
| `--max`<br>`--limit` | `int64` | 0 | Max contacts to scan (0 = all) |
35+
| `--no-input`<br>`--non-interactive`<br>`--noninteractive` | `bool` | | Never prompt; fail instead (useful for CI) |
36+
| `-p`<br>`--plain`<br>`--tsv` | `bool` | false | Output stable, parseable text to stdout (TSV; no colors) |
37+
| `--results-only` | `bool` | | In JSON mode, emit only the primary result (drops envelope fields like nextPageToken) |
38+
| `--select`<br>`--pick`<br>`--project` | `string` | | In JSON mode, select comma-separated fields (best-effort; supports dot paths). Desire path: use --fields for most commands. |
39+
| `-v`<br>`--verbose` | `bool` | | Enable verbose logging |
40+
| `--version` | `kong.VersionFlag` | | Print version and exit |
41+
42+
## See Also
43+
44+
- [gog contacts](gog-contacts.md)
45+
- [Command index](README.md)

docs/commands/gog-contacts.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ gog contacts (contact) <command> [flags]
1717
## Subcommands
1818

1919
- [gog contacts create](gog-contacts-create.md) - Create a contact
20+
- [gog contacts dedupe](gog-contacts-dedupe.md) - Find likely duplicate contacts (preview only)
2021
- [gog contacts delete](gog-contacts-delete.md) - Delete a contact
2122
- [gog contacts directory](gog-contacts-directory.md) - Directory contacts
2223
- [gog contacts export](gog-contacts-export.md) - Export contacts as vCard (.vcf)

docs/spec.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ Flag aliases:
278278
- `gog classroom guardian-invitations get <studentId> <invitationId>`
279279
- `gog classroom guardian-invitations create <studentId> --email EMAIL`
280280
- `gog classroom profile [userId]`
281+
- `gog contacts dedupe [--match email,phone,name] [--max N]`
281282
- `gog gmail search <query> [--max N] [--page TOKEN]`
282283
- `gog gmail messages search <query> [--max N] [--page TOKEN] [--include-body] [--body-format text|html] [--full]`
283284
- `gog gmail autoreply <query> [--max N] [--subject S] [--body B|--body-file PATH|--body-html HTML] [--from addr] [--reply-to addr] [--label L] [--archive] [--mark-read] [--skip-bulk] [--allow-self]`

internal/cmd/contacts.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ type ContactsCmd struct {
1717
List ContactsListCmd `cmd:"" name:"list" aliases:"ls" help:"List contacts"`
1818
Get ContactsGetCmd `cmd:"" name:"get" aliases:"info,show" help:"Get a contact"`
1919
Export ContactsExportCmd `cmd:"" name:"export" help:"Export contacts as vCard (.vcf)"`
20+
Dedupe ContactsDedupeCmd `cmd:"" name:"dedupe" help:"Find likely duplicate contacts (preview only)"`
2021
Create ContactsCreateCmd `cmd:"" name:"create" aliases:"add,new" help:"Create a contact"`
2122
Update ContactsUpdateCmd `cmd:"" name:"update" aliases:"edit,set" help:"Update a contact"`
2223
Delete ContactsDeleteCmd `cmd:"" name:"delete" aliases:"rm,del,remove" help:"Delete a contact"`

0 commit comments

Comments
 (0)