Add affiliate: a cursor over a list of signup pages - #18
Merged
Conversation
Point it at any text file with links in it and it walks them one at a time, remembers which you have dealt with, and keeps the referral link each one hands back. affiliate list --file programs.md affiliate next --open affiliate join elevenlabs https://try.elevenlabs.io/abc123 affiliate links --format markdown Nothing here knows what an affiliate program is. The list is the input: a bare column of URLs, a markdown table, a bullet list, a CSV. Rather than asking which format it is, take the first URL on the line and work the name out from context — the bracketed text of a markdown link, the first cell of a table row, or the host. A line with no URL is a heading, not an error. Details that are deliberate: - Entries differing only by utm_* are one program. The same page shared from a newsletter and from a tweet would otherwise ask you to sign up twice. - A joined entry survives being dropped from the list — it moves to the end. Losing a referral link because somebody tidied the source file would be the worst thing this could do. - A referral link already recorded survives a later status change, so `skip` typed at the wrong index is not unrecoverable. - The contact address resolves --email, then $AFFILIATE_EMAIL, then the profile file, then `moshcode whoami`. The account is last because it is the one you cannot override in the moment. - `answers` prints gaps as (not set) rather than inventing them. A form that asks for audience size and gets an unchecked number is the fastest way to lose the account it was meant to open. It does not fill the forms in. Signing up accepts terms and hands over payout identity as a named person, and it is behind an email verification loop regardless — so a filler would stop at the same wall with one more thing that can break. Opening the next one and keeping the links in one place is the part that was tedious. The URL pattern deliberately does not treat ")" as a terminator: doing so truncates any path containing a bracket. It over-matches and balances back, which handles both that and a markdown link. Suite is 253 tests. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
ThreatCrush Security Scan6 finding(s) MEDIUM: 1 | LOW: 5
Snippets are redacted; ThreatCrush never prints matched credential material. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Point it at any text file with links in it. It walks them one at a time, remembers which you have dealt with, and keeps the referral link each one hands back.
Nothing in it knows what an affiliate program is — the list is the input, so it works for any batch of signup pages.
Parsing
A bare column of URLs, a markdown table, a bullet list, a CSV. Rather than asking which format it is, it takes the first URL on the line and works the name out from context: the bracketed text of a markdown link, the first cell of a table row, or the host when there is nothing else. A line with no URL is a heading, not an error.
The URL pattern deliberately does not treat
)as a terminator. Doing so truncates any path containing a bracket (/wiki_(disambiguation)); it over-matches and balances back instead, which handles that and markdown links with the same code.The parts worth reviewing
utm_*collapses to one entry. The same page shared from a newsletter and from a tweet would otherwise ask you to sign up twice.skiptyped at the wrong index is not unrecoverable.--email→$AFFILIATE_EMAIL→ profile file →moshcode whoami. The account is last because it is the one you cannot override in the moment, and signing up as the wrong identity does not undo.answersprints gaps as(not set)rather than inventing them. A form that asks for audience size and receives an unchecked number is the fastest way to lose the account it was meant to open.ListErrorvsUsageErrorso a bad index exits 1 ("you typed it wrong") and 2 stays "this broke".It does not submit anything
Signing up accepts terms and hands over payout identity as a named person, and every one of these is behind an email-verification loop regardless — a form-filler would stop at the same wall with one more moving part. Opening the next page, having the answers ready to paste, and keeping the links in one place is the part that was actually tedious.
Verification
pnpm typecheckclean.moshcode whoami.🤖 Generated with Claude Code