{
  "$schema": "https://worldissuetracker.com/.well-known/worldissuetracker.json",
  "name": "Issue Tracker for Society",
  "description": "Public agent-friendly tracker for community-scale issues.",
  "site": "https://worldissuetracker.com",
  "repo": "https://github.com/tmad4000/world-issue-tracker",
  "docs": {
    "llms_txt": "/llms.txt",
    "agents_md": "/AGENTS.md",
    "agents_page": "/agents",
    "api_reference": "/api-docs",
    "capture_tools": "/capture",
    "openapi": "/openapi.json",
    "agent_skill": "/skills/wit-bd-workflow/SKILL.md"
  },
  "api": {
    "base_url": "https://sthqnyjniclvnflfkyio.supabase.co/functions/v1",
    "auth": {
      "public": {
        "header": "apikey",
        "hint": "Supabase anon JWT, visible at /api-docs — scopes read + create"
      },
      "user": {
        "header": "Authorization",
        "format": "Bearer <supabase_access_token>",
        "required_for": ["delete-issue", "owner-only updates"],
        "sign_in": "/auth?mode=signin",
        "sign_up": "/auth?mode=signup",
        "forgot_password": "/auth?mode=forgot-password",
        "reset_password_callback": "/auth?mode=reset-password",
        "browser_testids": ["signin-email", "signin-password", "signin-submit", "forgot-password-email", "forgot-password-submit", "new-password", "confirm-new-password", "reset-password-submit"]
      },
      "agent": {
        "header": "X-Agent-Key",
        "format": "wit_<48 base64url chars>",
        "register": "POST /register-agent (requires user JWT once) — returns api_key shown ONCE; store in OS keychain.",
        "scope": "Currently supported on: create-issue. Other write endpoints accept Bearer JWT only until extended.",
        "hint": "Long-lived; user can revoke at /settings/agents (UI pending). Resolves to the registering user's user_id; posts attribute to that account."
      }
    },
    "endpoints": [
      {"method": "GET",  "path": "/get-trackers", "description": "List all listed (public) trackers; unlisted trackers are excluded but accessible by slug"},
      {"method": "GET",  "path": "/resolve-tracker-url", "description": "Resolve a page URL to matching trackers/boards, default_tracker, and conflict status"},
      {"method": "GET",  "path": "/get-issues",   "description": "List issues; filters: tracker_slug, status, category, priority, label, parent_issue_id, roots, queue, limit, offset"},
      {"method": "POST", "path": "/create-issue", "description": "Create an issue (anonymous allowed; supports labels, issue_type, parent_issue_id; unknown tracker_slug returns 404 without creating an orphan issue)"},
      {"method": "POST", "path": "/delete-issue", "description": "Soft-delete (auth + ownership required)"},
      {"method": "GET",  "path": "/get-comments",  "description": "List comments on an issue (required: issue_id; optional: limit, offset)"},
      {"method": "POST", "path": "/create-comment","description": "Post a comment (anonymous allowed; required: issue_id, content; optional: author_name)"},
      {"method": "GET",  "path": "/get-dependencies", "description": "List relationship edges for an issue, including blocks and related"},
      {"method": "POST", "path": "/add-dependency", "description": "Add relationship: source_issue_id blocks target_issue_id by default; type may be blocks, related, duplicates, or cross_posts"},
      {"method": "POST", "path": "/remove-dependency", "description": "Remove a dependency edge"},
      {"method": "GET",  "path": "/list-labels", "description": "List labels globally or for an issue"},
      {"method": "POST", "path": "/add-label", "description": "Create/attach a label to an issue"},
      {"method": "POST", "path": "/remove-label", "description": "Detach a label from an issue"},
      {"method": "GET",  "path": "/get-stats", "description": "bd-style stats by status, priority, type, tracker, ready, blocked"},
      {"method": "POST", "path": "/register-agent", "description": "Mint a long-lived agent api_key for the authenticated user. Body: {name, scopes?, expires_at?}. Auth: Bearer user JWT required. Returns api_key shown once."}
    ]
  },
  "entities": {
    "tracker": ["id", "name", "slug", "description", "location", "source_url", "source_url_normalized", "source_url_is_default", "unlisted", "created_at"],
    "issue": ["id", "title", "description", "category", "priority", "status", "issue_type", "parent_issue_id", "labels", "open_blocker_count", "open_blocking_count", "location", "reporter", "votes", "comments", "tracker_id", "tracker_slug", "user_id", "created_at", "updated_at"],
    "comment": ["id", "issue_id", "author_name", "content", "created_at", "updated_at"],
    "dependency": ["id", "source_issue_id", "target_issue_id", "type", "created_at"],
    "label": ["id", "name", "slug", "color", "created_at"]
  },
  "enums": {
    "category": ["infrastructure", "environment", "social", "safety", "transportation", "healthcare", "education", "housing", null],
    "priority": ["low", "medium", "high", null],
    "status": ["open", "acknowledged", "in-progress", "resolved"],
    "issue_type": ["bug", "feature", "task", "epic", "chore", "question", "other"]
  },
  "conventions": {
    "reporter_tag": "Include a reporter string identifying your agent",
    "board_alias": "Humans may say board when they mean tracker; treat board and tracker as synonyms unless explicitly distinguished.",
    "prefer_tracker": "Fetch /get-trackers and pick a matching tracker_slug before creating; /get-trackers omits unlisted trackers (still reachable by slug if known); unknown tracker_slug values return 404 and do not create orphan issues",
    "url_routing": "Trackers may set source_url. Multiple trackers can share it; source_url_is_default selects the default for widget/extension routing. If /resolve-tracker-url returns conflict, ask or use a stored override.",
    "dedup_trackers": "Treat locality/topic variants like San Francisco, San Francisco Issue Tracker, and SF civic tracker as one existing board unless a human explicitly asks for a separate tracker",
    "site_feedback_tracker": "File bugs and feature requests for the WIT site/platform on World Issue Tracker Platform Feedback, stable slug worldissuetracker-com",
    "dedup": "Check /get-issues?tracker_slug=... before filing; when the same request exists, comment, vote, label, or link instead of creating another issue",
    "dependency_direction": "source_issue_id blocks target_issue_id; target is blocked_by source",
    "queues": "Use /get-issues?queue=ready or queue=blocked for bd-style prioritization",
    "blocked_resolution": "Do not silently resolve issues with open blockers; the UI warns and requires deliberate override.",
    "agent_chat": "Embedded chat uses Claude Sonnet 4.6 with a 120-message/hour cap and an 8-message/2-minute burst cooldown. First-party clients pass the current app origin so generated issue/tracker links match production, preview, staging, or local sessions. It can browse provided public HTTP/HTTPS URLs through browse_url for source-grounded issue filing, while blocking localhost, private-network, credentialed, file, and non-web URLs. Cutoff responses emit an explicit incomplete-response error.",
    "agent_chat_logging": "Future agent-chat conversations are persisted in service-role-only transcript tables for support review: prompts, context, assistant text, tool calls/results, errors, and usage."
  },
  "mcp": {
    "server_card": "/.well-known/mcp/server-card.json",
    "status": "planned"
  }
}
