Skip to content

[meetup] Support --groups for the file-per-event create command - #5

Open
duxi90 wants to merge 1 commit into
mainfrom
feat/create-groups
Open

duxi90 wants to merge 1 commit into
mainfrom
feat/create-groups

Conversation

@duxi90

@duxi90 duxi90 commented Aug 18, 2026

Copy link
Copy Markdown
Member

Description

  • create <eventFile> now takes --groups "a,b" | all, matching create-from-json.
    Without it the command behaves as before, including its --output shape.
  • Frontmatter gains a meetup_events list (PublishedEventRef, added to core) recording
    every group the event was created in. The event_url / event_id scalars stay, and
    mirror the primary group's row only.
  • Idempotency and write-back are per group: a recorded group is never created again, each
    group is written back as it succeeds so a half-failed run resumes cleanly, and a run
    where everything is already recorded returns before building a client or touching the
    file. No migration step — a legacy scalar pair is attributed to its group via the event
    URL, which already names it.
  • Fix: --groups "," parsed to [], which is truthy, so the "only these groups" filter
    was skipped and it silently meant --groups all.
  • onCreated now reports groupUrlname, so an adopter creating in several groups can tell
    which group's id it was handed.

Only the primary group's ids reach the scalars: a secondary id there would make a later
plain create skip the file and so never create the primary event, and would point an
adopter's "Register on Meetup" link at the wrong group.

_meetup-event-draft.yml is deliberately left alone. Wiring --groups into it first needs
its event_url before/after grep replaced with git diff --quiet, because a run whose
primary group is skipped changes only meetup_events.

Motivation

create-from-json has taken --groups since #2, but the file-per-event path — the one
adopters keeping a markdown file per event actually use — could still only ever create one
draft, in meetup.groupUrlname.

Testing

Tested locally. Full CI chain green (build, lint, format:check, typecheck, spell, test),
158 tests — 33 new across create-drafts-from-file.test.ts, payload.test.ts and
cli.test.ts, covering per-group skip/attempt ordering, case-insensitive group matching,
legacy-scalar attribution, the malformed-meetup_events throw, write-back placement, the
--groups "," regression, and both --output shapes. All dry-run; nothing reaches the
Meetup API.

Checkup list

  • Labeled
  • Assigned to a project
  • Linked issue(s) (to close or track progress)
  • Documentation updated
  • Test coverage

`create <eventFile>` could only ever create one draft, in
`meetup.groupUrlname`, while `create-from-json` already took
`--groups "a,b" | all`. This gives the file path the same capability, with
idempotency and write-back tracked per group.

Frontmatter: the scalar `event_url` / `event_id` pair stays exactly as it is
and a complete `meetup_events` list is added alongside it, including the
primary group's own row:

    event_url: 'https://www.meetup.com/cpp-serbia/events/313413133/'
    event_id: '313413133'
    meetup_events:
      - group: cpp-serbia
        event_id: '313413133'
      - group: chicago-c-cpp-users-group
        event_id: '314900001'

Keeping the scalars, rather than replacing them with the list, is
load-bearing in three ways:

  * `.github/workflows/_meetup-event-draft.yml` greps `^event_url:` before
    and after the run and discards any file change that does not move that
    line. Dropping the scalar would make every write-back vanish.
  * Adopter sites read `event_url` for their "Register on Meetup" link, and
    they want one link, not a set.
  * A single-group `create` (no `--groups`) must keep behaving byte for byte
    as before, including its `--output` shape, so existing setups are
    untouched.

For the same reasons only the *primary* group's ids ever reach the scalars.
A secondary group's id there would make a later plain `create` skip the file
and so never create the primary event at all, and would point that
"Register on Meetup" link at the wrong group. `meetup_events` is the complete
record; the scalars are a mirror of one row of it.

Idempotency is per group and needs no migration step: `createdGroupEvents`
reads `meetup_events`, then folds in the legacy scalar pair attributed via
`groupUrlnameFromEventUrl` (a Meetup event URL already names its group),
falling back to an assumed group. Keys are lower-cased because Meetup
urlnames are case-insensitive. A malformed hand-edited row throws, naming the
file: silently ignoring a typo would silently create a duplicate draft, the
exact failure this record prevents.

Write-back happens inside `onCreated`, once per group, so a failure halfway
through leaves the groups that succeeded recorded on disk and a retry creates
only what is missing. When every requested group is already recorded the run
returns before building a client and before touching the file, so "the file
did not change" keeps meaning "no work was done".

Also fixed along the way:

  * `--groups ","` parsed to `[]`, which is truthy, so the "only these
    groups" filter was skipped and it silently meant `--groups all`.
    `parseCsvArg` (renamed from `parseHostArg`, which already parsed
    `--groups` too) now returns undefined for an all-empty value.
  * `runMain(main).then(() => process.exit(0))` discarded the
    `process.exitCode = 1` a partly-failed multi-group run sets, so
    `create-from-json --groups` has never signalled failure to CI despite the
    README promising it. It now exits with the code a command set.
  * `onCreated` now reports `groupUrlname`, so an adopter creating in several
    groups can tell which group's id it was handed.

`_meetup-event-draft.yml` is deliberately left alone: wiring `--groups` into
it first needs its `event_url` before/after grep replaced with
`git diff --quiet`, because a run whose primary group is skipped changes only
`meetup_events`.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@duxi90 duxi90 added documentation Improvements or additions to documentation enhancement New feature or request labels Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant