{"record":{"id":"bdaabf0b5d71940a","repo":"Hmbown/CodeWhale","slug":"unexpected-first-party-source-spec","errorCode":null,"errorMessage":"unexpected first-party source: {spec}","messagePattern":"unexpected first-party source: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scripts/sync-marketplace.py","lineNumber":25,"sourceCode":"import argparse\nimport json\nfrom pathlib import Path\nimport subprocess\n\nROOT = Path(__file__).resolve().parents[1]\nREPOSITORY = \"https://github.com/Hmbown/codewhale-plugin-marketplace\"\nparser = argparse.ArgumentParser(description=__doc__)\nparser.add_argument(\"--marketplace\", type=Path, default=ROOT.parent / \"codewhale-plugin-marketplace\")\nparser.add_argument(\"--check\", action=\"store_true\")\nargs = parser.parse_args()\nsource = args.marketplace.resolve()\nraw = subprocess.check_output([\"git\", \"show\", \"HEAD:marketplace.json\"], cwd=source)\nrevision = subprocess.check_output([\"git\", \"rev-parse\", \"HEAD\"], cwd=source, text=True).strip()\ncatalog = json.loads(raw)\nfor candidate in catalog[\"plugins\"]:\n    spec = candidate[\"source\"]\n    if not spec.startswith(\"path:\"):\n        raise SystemExit(f\"unexpected first-party source: {spec}\")\n    relative = spec[5:]\n    if any(part in (\"\", \".\", \"..\") or not all(c.isascii() and (c.isalnum() or c in \"-_.\") for c in part) for part in relative.split(\"/\")):\n        raise SystemExit(f\"unsafe bundle path: {relative}\")\n    # Pin every install source to the reviewed marketplace revision so the\n    # bytes a user installs are the bytes this snapshot describes. Freshness\n    # comes from bumping the pin (the marketplace-sync workflow reports drift\n    # against `main` weekly); `/plugin update` re-downloads the same archive\n    # and reports no change until the pin moves.\n    candidate[\"source\"] = f\"https://codeload.github.com/Hmbown/codewhale-plugin-marketplace/tar.gz/{revision}#path={relative}\"\nsnapshot = {\"repository\": REPOSITORY, \"revision\": revision, \"catalog\": catalog}\nrendered = json.dumps(snapshot, indent=2, ensure_ascii=False) + \"\\n\"\noutput = ROOT / \"crates/tui/assets/first-party-marketplace.json\"\nif args.check:\n    if not output.exists() or output.read_text() != rendered:\n        raise SystemExit(\"First-party catalog drift: run python3 scripts/sync-marketplace.py, review, and rebuild.\")\n    print(f\"First-party catalog matches marketplace {revision}\")\nelse:\n    output.write_text(rendered)","sourceCodeStart":7,"sourceCodeEnd":43,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/433685b2024e7bc4c99e1e2e326bcad39b4d9d65/scripts/sync-marketplace.py#L7-L43","documentation":"scripts/sync-marketplace.py snapshots the first-party plugin marketplace. Every plugin entry's `source` in marketplace.json must be a `path:` spec pointing into the repository; anything else is unexpected because the marketplace only ships first-party, in-repo plugins. It exits via SystemExit when it encounters a non-path source spec.","triggerScenarios":"A marketplace.json plugin entry uses a `git:`, `https:`, or bare source spec; someone edits marketplace.json to point at an external plugin.","commonSituations":"Copying a plugin entry from a third-party marketplace catalog; hand-editing marketplace.json to reference an external repo; a tool generating remote-source entries.","solutions":["Open marketplace.json and find the plugin whose source is not `path:`.","Change it to a `path:relative/dir` spec pointing at the plugin's directory in the repo.","If the plugin is external, host its bundle inside the marketplace repo instead.","Re-run scripts/sync-marketplace.py."],"exampleFix":"// before (marketplace.json)\n{\"name\": \"x\", \"source\": \"git+https://github.com/me/x\"}\n// after\n{\"name\": \"x\", \"source\": \"path:plugins/x\"}","handlingStrategy":"validation","validationCode":"import json\ncatalog = json.load(open('marketplace.json'))\nfor c in catalog['plugins']:\n    assert c['source'].startswith('path:'), f\"{c['name']} not a path source\"","typeGuard":null,"tryCatchPattern":"try:\n    subprocess.run(['python3','scripts/sync-marketplace.py','--check'], check=True)\nexcept SystemExit as e:\n    print('marketplace source error:', e)","preventionTips":["Only add plugins that live inside the marketplace repo","Lint marketplace.json in CI for source-spec shape","Never copy source specs from third-party catalogs"],"tags":["marketplace","plugins","validation","script"],"backgroundTag":"unsupported-source-type","analyzedSha":"433685b2024e7bc4c99e1e2e326bcad39b4d9d65","analyzedAt":"2026-09-15T12:24:24.634Z","contentChangedAt":"2026-09-15T12:24:24.634Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}