Skip to content

feat(instagram): Adapt Instagram support into the new adapter structure#18

Open
borkweb wants to merge 5 commits into
mainfrom
feature/instagram
Open

feat(instagram): Adapt Instagram support into the new adapter structure#18
borkweb wants to merge 5 commits into
mainfrom
feature/instagram

Conversation

@borkweb

@borkweb borkweb commented Apr 12, 2026

Copy link
Copy Markdown
Member

Summary

What's in the branch

  • src/adapters/instagram.ts + registration in src/mcp-server.ts and detect-platform.ts
  • test/adapters/instagram.test.ts (20 tests) + test/fixtures/instagram-inventory.json + new case in test/detect-platform.test.ts
  • Removed legacy scripts/instagram/ and tests/instagram.test.js (pre-restructure standalone scripts)
  • Refreshed prompts/instagram.md for the npm run liberate workflow
  • Updated README.md, AGENTS.md (→ CLAUDE.md symlink), CONTRIBUTING.md, docs/mcp.md, DISCOVERIES.md

Author credit

Branched from @edequalsawesome's commit 337c915 so the original Instagram work is preserved in history. Follow-up commits adapt it to the new structure and address review feedback.

Test plan

  • npx vitest run test/adapters/instagram.test.ts test/detect-platform.test.ts — 31/31 passing
  • End-to-end smoke test against a real authenticated Instagram profile via CDP
  • Import the resulting WXR into a WordPress site and verify carousel/gallery rendering

Note: pre-existing test/content-differ.test.ts failures on main are unrelated and not introduced by this branch.

edequalsawesome and others added 4 commits April 4, 2026 21:28
Adds a complete Instagram-to-WordPress migration pipeline using the same
CDP-based approach as Wix and Squarespace extractors.

Scripts:
- scripts/instagram/discover.js: Scroll-based GraphQL interception to
  inventory all posts with metadata, captions, timestamps, locations
- scripts/instagram/extract.js: Per-post extraction with ?img_index=N
  for carousel slides, deduplication by Instagram media ID
- scripts/instagram/import.js: XML-RPC import with wp.uploadFile for
  media, wp.newPost with featured images, gallery blocks for carousels,
  correct backdated post dates, and source links to original posts

Also includes:
- prompts/instagram.md: User-facing migration prompt
- tests/instagram.test.js: 32 unit tests covering data transformation,
  XML-RPC encoding, carousel deduplication, and content generation
- DISCOVERIES.md entry documenting key findings
- Updated AGENTS.md, README.md, cli.js for Instagram support

Tested against a 308-post profile: 364 media files uploaded, all posts
imported with correct dates, unique carousel slides in gallery blocks,
and featured images. Zero failures.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
# Conflicts:
#	.gitignore
#	AGENTS.md
#	README.md
Reworks the Instagram support originally added in #4 (by @edequalsawesome)
on top of the new adapter/lib architecture introduced in #6.

- src/adapters/instagram.ts implementing PlatformAdapter:
  - discover() scrolls the profile via CDP and intercepts GraphQL responses
  - extract() visits each post via CDP, walks ?img_index=N for carousel
    slides (deduped by Instagram media ID), downloads media, and emits
    wp:image / wp:gallery / wp:video Gutenberg blocks
  - hashtags become WP tags; @mentions and #hashtags in captions are linked
- Registered in src/mcp-server.ts and detect-platform URL patterns
- Removed the legacy scripts/instagram/ scripts and tests/instagram.test.js,
  which targeted the pre-restructure standalone-script entry points
- Added test/adapters/instagram.test.ts with a fixture-driven dry-run that
  exercises the WXR pipeline end to end
- Refreshed prompts/instagram.md for the new npm run liberate workflow
- Updated README, AGENTS.md, CONTRIBUTING.md, docs/mcp.md to mention Instagram
…ame parsing

- cli.js: revert PR #4's Instagram branch — it referenced scripts/instagram/
  scripts that no longer exist after restructuring. The legacy CLI is for
  legacy script entry points only; Instagram is reachable via the adapter.
- src/adapters/instagram.ts: parseInstagramUsername now strips path segments
  from non-URL inputs so 'foo/bar' cannot be smuggled into a navigation URL.
- DISCOVERIES.md: rewrite the 'How it works' paragraph for the adapter
  pipeline instead of the deleted scripts/instagram/ pipeline.
@borkweb borkweb mentioned this pull request Apr 12, 2026
7 tasks
@borkweb borkweb changed the title Adapt Instagram support into the new adapter structure feat(instagram): Adapt Instagram support into the new adapter structure Apr 12, 2026
# Conflicts:
#	AGENTS.md
#	CONTRIBUTING.md
#	DISCOVERIES.md
#	README.md
#	docs/mcp.md
#	src/lib/extraction/detect-platform.ts
#	src/mcp-server.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants