Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(commands): rename the github_commands product to commands (#116831)

Julian Bezd0ebb94f1fb7
diff --git a/.github/workflows/ci-python.yml b/.github/workflows/ci-python.yml
index 80f10e4c3ef9..cbb29236d2ca 100644
--- a/.github/workflows/ci-python.yml
+++ b/.github/workflows/ci-python.yml
@@ -136,8 +136,8 @@ jobs:
- 'packages/agent/packages/agent-contracts/src/model-catalog.generated.ts'
- 'services/mcp/src/lib/oauth-scopes.generated.ts'
- 'frontend/src/lib/oauthScopes.generated.ts'
- - 'products/github_commands/commands.generated.json'
- - 'products/github_commands/COMMANDS.generated.md'
+ - 'products/commands/commands.generated.json'
+ - 'products/commands/COMMANDS.generated.md'
# hogli CLI changes need validation
- 'tools/hogli/**'
- 'tools/hogli-commands/hogli_commands/**'
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 7fed4cef3536..7217a9fe571b 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -2918,6 +2918,8 @@ importers:
specifier: 'catalog:'
version: 0.2.4([email protected](patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5)([email protected]))
+ products/commands: {}
+
products/context_layer: {}
products/conversations:
@@ -3792,8 +3794,6 @@ importers:
specifier: ^14.3.1
- products/github_commands: {}
-
products/groups:
dependencies:
'@posthog/icons':
diff --git a/posthog/ingress/README.md b/posthog/ingress/README.md
index f00b42b9062f..a5c36564fa3e 100644
--- a/posthog/ingress/README.md
+++ b/posthog/ingress/README.md
@@ -65,20 +65,20 @@ Three duties fall on the incarnation rather than on `BearerJwt`, and none is enf
## Endpoints
-| Provider | Path | App | Consumers | Product code |
-| ------------ | ------------------------------------------------------- | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
-| `github` | `/webhooks/github`, `/webhooks/github/pr` | `posthog` | `installation_lifecycle`, `installation_repositories` (core), `conversations`, `error_tracking_external_references`, `github_commands`, `loops`, `review_hog_authored_prs`, `tasks_pr_backstop`, `tasks_pr_review`, `workflows` | `products/{tasks,conversations,error_tracking,github_commands,review_hog,workflows}/backend/webhook_consumers.py` |
-| `github` | `/webhooks/stamphog/github` | `stamphog` | `stamphog_review` | `products/stamphog/backend/webhook_consumers.py` |
-| `slack` | `/api/conversations/v1/slack/events` | `supporthog` | `conversations_slack` | `products/conversations/backend/webhook_consumers.py` |
-| `slack` | `/api/conversations/v1/slack/interactivity` | `supporthog_interactivity` | `conversations_slack_interactivity` | `products/conversations/backend/webhook_consumers.py` |
-| `teams` | `/api/conversations/v1/teams/events` | `supporthog` | `conversations_teams` | `products/conversations/backend/webhook_consumers.py` |
-| `pandadoc` | `/api/legal_documents/pandadoc` | `default` | `legal_documents_signatures` | `products/legal_documents/backend/webhook_consumers.py` |
-| `mailgun` | `/api/conversations/v1/email/inbound` | `inbound` | `conversations_email_inbound` | `products/conversations/backend/webhook_consumers.py` |
-| `mailgun` | `/api/conversations/v1/email/outbound` | `outbound` | `conversations_email_outbound` | `products/conversations/backend/webhook_consumers.py` |
-| `mailgun` | `/api/conversations/v1/email/capture` | `capture` | `conversations_email_capture` | `products/conversations/backend/webhook_consumers.py` |
-| `sns` | `/webhooks/workflows/ses-events` | `default` | `workflows_ses_events` | `products/workflows/backend/webhook_consumers.py` |
-| `customerio` | `/api/projects/<team_id>/messaging/customerio/webhook/` | none | none, it is the DRF adapter path | `products/messaging/backend/api/customerio_webhook.py` |
-| `vercel` | `/webhooks/vercel` | `marketplace` | `vercel_marketplace` | `ee/api/vercel/webhook_consumers.py` |
+| Provider | Path | App | Consumers | Product code |
+| ------------ | ------------------------------------------------------- | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------- |
+| `github` | `/webhooks/github`, `/webhooks/github/pr` | `posthog` | `installation_lifecycle`, `installation_repositories` (core), `commands`, `conversations`, `error_tracking_external_references`, `loops`, `review_hog_authored_prs`, `tasks_pr_backstop`, `tasks_pr_review`, `workflows` | `products/{commands,conversations,error_tracking,review_hog,tasks,workflows}/backend/webhook_consumers.py` |
+| `github` | `/webhooks/stamphog/github` | `stamphog` | `stamphog_review` | `products/stamphog/backend/webhook_consumers.py` |
+| `slack` | `/api/conversations/v1/slack/events` | `supporthog` | `conversations_slack` | `products/conversations/backend/webhook_consumers.py` |
+| `slack` | `/api/conversations/v1/slack/interactivity` | `supporthog_interactivity` | `conversations_slack_interactivity` | `products/conversations/backend/webhook_consumers.py` |
+| `teams` | `/api/conversations/v1/teams/events` | `supporthog` | `conversations_teams` | `products/conversations/backend/webhook_consumers.py` |
+| `pandadoc` | `/api/legal_documents/pandadoc` | `default` | `legal_documents_signatures` | `products/legal_documents/backend/webhook_consumers.py` |
+| `mailgun` | `/api/conversations/v1/email/inbound` | `inbound` | `conversations_email_inbound` | `products/conversations/backend/webhook_consumers.py` |
+| `mailgun` | `/api/conversations/v1/email/outbound` | `outbound` | `conversations_email_outbound` | `products/conversations/backend/webhook_consumers.py` |
+| `mailgun` | `/api/conversations/v1/email/capture` | `capture` | `conversations_email_capture` | `products/conversations/backend/webhook_consumers.py` |
+| `sns` | `/webhooks/workflows/ses-events` | `default` | `workflows_ses_events` | `products/workflows/backend/webhook_consumers.py` |
+| `customerio` | `/api/projects/<team_id>/messaging/customerio/webhook/` | none | none, it is the DRF adapter path | `products/messaging/backend/api/customerio_webhook.py` |
+| `vercel` | `/webhooks/vercel` | `marketplace` | `vercel_marketplace` | `ee/api/vercel/webhook_consumers.py` |
The owner of the third-party App registration owns the route.
The customer-facing GitHub App is shared across products, so its two endpoints are declared in `posthog/urls.py`.
diff --git a/posthog/ingress/github/README.md b/posthog/ingress/github/README.md
index ea8c064f56d0..b5a6c7e0aa11 100644
--- a/posthog/ingress/github/README.md
+++ b/posthog/ingress/github/README.md
@@ -44,7 +44,7 @@ See [Regional forwarding](../README.md#regional-forwarding) for the lane the pro
## Consumers
- `posthog/ingress/github/provider.py` registers `installation_lifecycle` and `installation_repositories` on the `posthog` app.
-- `products/{tasks,conversations,error_tracking,github_commands,review_hog,workflows}/backend/webhook_consumers.py` register the product consumers on the `posthog` app.
+- `products/{commands,conversations,error_tracking,review_hog,tasks,workflows}/backend/webhook_consumers.py` register the product consumers on the `posthog` app.
- `products/stamphog/backend/webhook_consumers.py` registers `stamphog_review` on the `stamphog` app.
The Error Tracking consumer handles opened and edited issues and pull requests from repository owners, members, and collaborators.
@@ -52,9 +52,9 @@ It scans descriptions for direct issue links and fingerprint permalinks on the c
Repeated links and deliveries reuse an existing reference.
Removing a link from a later description does not remove the reference.
-The GitHub commands consumer reads `@posthog <command>` lines in new pull request comments from repository owners, members and collaborators, and queues one task per command.
+The commands consumer reads `@posthog <command>` lines in new pull request comments from repository owners, members and collaborators, and queues one task per command.
The task checks the commenter's write access with GitHub and their linked PostHog account before any command runs.
-See `products/github_commands/README.md`.
+See `products/commands/README.md`.
### Picking the project
diff --git a/posthog/settings/web.py b/posthog/settings/web.py
index 1a9431ad0cb8..42c00071d6b8 100644
--- a/posthog/settings/web.py
+++ b/posthog/settings/web.py
@@ -99,7 +99,7 @@ PRODUCTS_APPS = [
"products.platform_features.backend.apps.PlatformFeaturesConfig",
"products.streamlit_apps.backend.apps.StreamlitAppsConfig",
"products.legal_documents.backend.apps.LegalDocumentsConfig",
- "products.github_commands.backend.apps.GithubCommandsConfig",
+ "products.commands.backend.apps.CommandsConfig",
"products.access_control.backend.apps.AccessControlConfig",
"products.warehouse_sources_queue.backend.apps.WarehouseSourcesQueueConfig",
"products.business_knowledge.backend.apps.BusinessKnowledgeConfig",
diff --git a/products/github_commands/COMMANDS.generated.md b/products/commands/COMMANDS.generated.md
similarity index 100%
rename from products/github_commands/COMMANDS.generated.md
rename to products/commands/COMMANDS.generated.md
diff --git a/products/github_commands/README.md b/products/commands/README.md
similarity index 97%
rename from products/github_commands/README.md
rename to products/commands/README.md
index 74d3716b56c2..be5f3e7c4421 100644
--- a/products/github_commands/README.md
+++ b/products/commands/README.md
@@ -1,4 +1,4 @@
-# GitHub commands
+# Commands
People with write access to a repository can ask PostHog to do something on a pull request by commenting a command on it:
@@ -29,7 +29,7 @@ Both are generated from `backend/logic/schema.py`, like the `@posthog help` repl
## How a comment becomes a command
-1. `backend/webhook_consumers.py` registers the `github_commands` consumer for `issue_comment` on the customer-facing GitHub App endpoint.
+1. `backend/webhook_consumers.py` registers the `commands` consumer for `issue_comment` on the customer-facing GitHub App endpoint.
2. `logic/intake.py` reads the payload inside the webhook request, with no database and no API call. It drops everything that is not a new command comment and queues a task for the rest. `logic/parsing.py` finds the command: the CommonMark reference parser gives the comment's block structure, and a command fires only from a top-level paragraph.
3. `logic/dispatch.py` runs in the task. It applies every check (listed in its module docstring), then calls the command's handler.
4. `logic/handlers.py` calls the target product's facade and returns the text of the reply.
diff --git a/products/github_commands/__init__.py b/products/commands/__init__.py
similarity index 100%
rename from products/github_commands/__init__.py
rename to products/commands/__init__.py
diff --git a/products/github_commands/backend/__init__.py b/products/commands/backend/__init__.py
similarity index 100%
rename from products/github_commands/backend/__init__.py
rename to products/commands/backend/__init__.py
diff --git a/products/commands/backend/apps.py b/products/commands/backend/apps.py
new file mode 100644
index 000000000000..166ccb3f0c22
--- /dev/null
+++ b/products/commands/backend/apps.py
@@ -0,0 +1,8 @@
+"""Django app configuration for commands."""
+
+from django.apps import AppConfig
+
+
+class CommandsConfig(AppConfig):
+ name = "products.commands.backend"
+ label = "commands"
diff --git a/products/github_commands/backend/commands_projection.py b/products/commands/backend/commands_projection.py
similarity index 76%
rename from products/github_commands/backend/commands_projection.py
rename to products/commands/backend/commands_projection.py
index 5983ae6071f5..4f4224d1ee9c 100644
--- a/products/github_commands/backend/commands_projection.py
+++ b/products/commands/backend/commands_projection.py
@@ -10,10 +10,10 @@ Registered in `tools/hogli-commands/hogli_commands/projections.py`; run
import json
-from products.github_commands.backend.logic.schema import help_table, signature
+from products.commands.backend.logic.schema import help_table, signature
-JSON_OUTPUT = "products/github_commands/commands.generated.json"
-MARKDOWN_OUTPUT = "products/github_commands/COMMANDS.generated.md"
+JSON_OUTPUT = "products/commands/commands.generated.json"
+MARKDOWN_OUTPUT = "products/commands/COMMANDS.generated.md"
def render() -> dict[str, str]:
diff --git a/products/github_commands/backend/facade/__init__.py b/products/commands/backend/facade/__init__.py
similarity index 100%
rename from products/github_commands/backend/facade/__init__.py
rename to products/commands/backend/facade/__init__.py
diff --git a/products/github_commands/backend/facade/api.py b/products/commands/backend/facade/api.py
similarity index 98%
rename from products/github_commands/backend/facade/api.py
rename to products/commands/backend/facade/api.py
index f8abeb9ac83a..aac1a778f342 100644
--- a/products/github_commands/backend/facade/api.py
+++ b/products/commands/backend/facade/api.py
@@ -1,4 +1,4 @@
-"""Facade for github_commands.
+"""Facade for commands.
The ONLY module other products and core may import. It stays cheap to import, because the webhook
consumer calls it inside the request for every comment on every pull request.
diff --git a/products/github_commands/backend/facade/contracts.py b/products/commands/backend/facade/contracts.py
similarity index 78%
rename from products/github_commands/backend/facade/contracts.py
rename to products/commands/backend/facade/contracts.py
index 366416b0a7ee..362011b2881c 100644
--- a/products/github_commands/backend/facade/contracts.py
+++ b/products/commands/backend/facade/contracts.py
@@ -1,4 +1,4 @@
-"""Contract types for github_commands.
+"""Contract types for commands.
The product exposes no data to other products yet: its only cross-product surface is the webhook
consumer's entry point in ``api.py``.
diff --git a/products/commands/backend/logic/__init__.py b/products/commands/backend/logic/__init__.py
new file mode 100644
index 000000000000..0288eba4278e
--- /dev/null
+++ b/products/commands/backend/logic/__init__.py
@@ -0,0 +1 @@
+"""Business logic for commands."""
diff --git a/products/github_commands/backend/logic/commands.py b/products/commands/backend/logic/commands.py
similarity index 100%
rename from products/github_commands/backend/logic/commands.py
rename to products/commands/backend/logic/commands.py
diff --git a/products/github_commands/backend/logic/dispatch.py b/products/commands/backend/logic/dispatch.py
similarity index 98%
rename from products/github_commands/backend/logic/dispatch.py
rename to products/commands/backend/logic/dispatch.py
index 278e35efdfbb..8bc033ef144e 100644
--- a/products/github_commands/backend/logic/dispatch.py
+++ b/products/commands/backend/logic/dispatch.py
@@ -82,8 +82,8 @@ DispatchOutcome = Literal[
"failed",
]
-GITHUB_COMMANDS_TOTAL = Counter(
- "posthog_github_commands_total",
+COMMANDS_TOTAL = Counter(
+ "posthog_commands_total",
"Pull request comment commands, by command and what dispatch did with them",
labelnames=["verb", "outcome"],
)
@@ -96,7 +96,7 @@ def dispatch_comment_command(request: CommentCommandRequest, *, github: CommandG
# Unknown verbs share one label value, so a comment cannot mint a metric series. Aliases count
# under their canonical verb.
verb_label = spec.declaration.verb if spec else (HELP_VERB if request.verb == HELP_VERB else "unknown")
- GITHUB_COMMANDS_TOTAL.labels(verb=verb_label, outcome=outcome).inc()
+ COMMANDS_TOTAL.labels(verb=verb_label, outcome=outcome).inc()
logger.info(
"github_command_dispatched",
verb=verb_label,
@@ -276,7 +276,7 @@ def _reply_body(request: CommentCommandRequest, message: str) -> str:
def _claim_key(comment_id: int) -> str:
- return f"github_commands:comment:{comment_id}"
+ return f"commands:github_comment:{comment_id}"
def _claim_comment(comment_id: int) -> DispatchOutcome | None:
@@ -299,7 +299,7 @@ def _release_comment(comment_id: int) -> None:
def _within_rate_limit(github_user_id: int) -> bool:
- decision = consume(f"github_commands:commenter:{github_user_id}", _COMMENTER_BUDGET)
+ decision = consume(f"commands:github_commenter:{github_user_id}", _COMMENTER_BUDGET)
# Fail open when Redis can't answer, like the other per-caller buckets.
return not isinstance(decision, BucketDecision) or decision.allowed
diff --git a/products/github_commands/backend/logic/github.py b/products/commands/backend/logic/github.py
similarity index 99%
rename from products/github_commands/backend/logic/github.py
rename to products/commands/backend/logic/github.py
index f24000ef6c21..3c611eff21fb 100644
--- a/products/github_commands/backend/logic/github.py
+++ b/products/commands/backend/logic/github.py
@@ -22,7 +22,7 @@ logger = structlog.get_logger(__name__)
Reaction = Literal["eyes", "rocket"]
-_SOURCE = "github_commands"
+_SOURCE = "commands"
# The branch name goes into an agent prompt and a loop payload, so only a plain identifier passes.
_BRANCH_NAME_RE = re.compile(r"[A-Za-z0-9._/-]{1,255}")
diff --git a/products/github_commands/backend/logic/handlers.py b/products/commands/backend/logic/handlers.py
similarity index 100%
rename from products/github_commands/backend/logic/handlers.py
rename to products/commands/backend/logic/handlers.py
diff --git a/products/github_commands/backend/logic/identity.py b/products/commands/backend/logic/identity.py
similarity index 100%
rename from products/github_commands/backend/logic/identity.py
rename to products/commands/backend/logic/identity.py
diff --git a/products/github_commands/backend/logic/intake.py b/products/commands/backend/logic/intake.py
similarity index 100%
rename from products/github_commands/backend/logic/intake.py
rename to products/commands/backend/logic/intake.py
diff --git a/products/github_commands/backend/logic/parsing.py b/products/commands/backend/logic/parsing.py
similarity index 100%
rename from products/github_commands/backend/logic/parsing.py
rename to products/commands/backend/logic/parsing.py
diff --git a/products/github_commands/backend/logic/registry.py b/products/commands/backend/logic/registry.py
similarity index 100%
rename from products/github_commands/backend/logic/registry.py
rename to products/commands/backend/logic/registry.py
diff --git a/products/github_commands/backend/logic/schema.py b/products/commands/backend/logic/schema.py
similarity index 100%
rename from products/github_commands/backend/logic/schema.py
rename to products/commands/backend/logic/schema.py
diff --git a/products/github_commands/backend/tasks/__init__.py b/products/commands/backend/tasks/__init__.py
similarity index 62%
rename from products/github_commands/backend/tasks/__init__.py
rename to products/commands/backend/tasks/__init__.py
index cbb522dada10..c9ff24d75841 100644
--- a/products/github_commands/backend/tasks/__init__.py
+++ b/products/commands/backend/tasks/__init__.py
@@ -1,7 +1,7 @@
-"""GitHub commands Celery tasks.
+"""Commands Celery tasks.
Import the task-defining submodules here so Celery's ``autodiscover_tasks`` (which imports the
app's ``tasks`` package) registers every ``@shared_task`` on workers.
"""
-from products.github_commands.backend.tasks import tasks # noqa: F401
+from products.commands.backend.tasks import tasks # noqa: F401
diff --git a/products/github_commands/backend/tasks/tasks.py b/products/commands/backend/tasks/tasks.py
similarity index 96%
rename from products/github_commands/backend/tasks/tasks.py
rename to products/commands/backend/tasks/tasks.py
index c37c0e2e91b8..9826b0a44484 100644
--- a/products/github_commands/backend/tasks/tasks.py
+++ b/products/commands/backend/tasks/tasks.py
@@ -1,4 +1,4 @@
-"""Celery tasks for github_commands."""
+"""Celery tasks for commands."""
from celery import shared_task
diff --git a/products/github_commands/backend/tests/__init__.py b/products/commands/backend/tests/__init__.py
similarity index 100%
rename from products/github_commands/backend/tests/__init__.py
rename to products/commands/backend/tests/__init__.py
diff --git a/products/github_commands/backend/tests/conftest.py b/products/commands/backend/tests/conftest.py
similarity index 100%
rename from products/github_commands/backend/tests/conftest.py
rename to products/commands/backend/tests/conftest.py
diff --git a/products/github_commands/backend/tests/test_dispatch.py b/products/commands/backend/tests/test_dispatch.py
similarity index 92%
rename from products/github_commands/backend/tests/test_dispatch.py
rename to products/commands/backend/tests/test_dispatch.py
index 1baad53940c1..1747a6b74164 100644
--- a/products/github_commands/backend/tests/test_dispatch.py
+++ b/products/commands/backend/tests/test_dispatch.py
@@ -26,12 +26,12 @@ from posthog.models.user_integration import UserIntegration
from posthog.token_bucket import BucketDecision
from products.access_control.backend.facade.testing import create_access_control
-from products.github_commands.backend.logic.commands import CommandContext, ProjectMember, PullRequestFacts
-from products.github_commands.backend.logic.dispatch import dispatch_comment_command
-from products.github_commands.backend.logic.github import InstallationGitHub, Reaction, UnsupportedPullRequest
-from products.github_commands.backend.logic.handlers import handle_loop, handle_qa, handle_review
-from products.github_commands.backend.logic.intake import CommentCommandRequest
-from products.github_commands.backend.logic.schema import LoopArgs, QaArgs, ReviewArgs
+from products.commands.backend.logic.commands import CommandContext, ProjectMember, PullRequestFacts
+from products.commands.backend.logic.dispatch import dispatch_comment_command
+from products.commands.backend.logic.github import InstallationGitHub, Reaction, UnsupportedPullRequest
+from products.commands.backend.logic.handlers import handle_loop, handle_qa, handle_review
+from products.commands.backend.logic.intake import CommentCommandRequest
+from products.commands.backend.logic.schema import LoopArgs, QaArgs, ReviewArgs
from products.review_hog.backend.facade.reviews import (
RUN_MODE_FLASH,
RUN_MODE_REVIEW,
@@ -43,16 +43,16 @@ from products.tasks.backend.facade.access import DesktopAccessDecision
INSTALLATION_ID = "31337"
REPOSITORY = "acme/widgets"
-FLAG = "products.github_commands.backend.logic.dispatch.posthog_feature_flag_enabled"
-REQUEST_STAMPHOG_REVIEW = "products.github_commands.backend.logic.handlers.stamphog_requests.request_review"
-DESKTOP_ACCESS = "products.github_commands.backend.logic.handlers.tasks_access.get_desktop_access_decision"
-CREATE_TASK = "products.github_commands.backend.logic.handlers.tasks_facade.create_and_run_task"
-USAGE_LIMITED = "products.github_commands.backend.logic.handlers.tasks_usage.task_run_usage_limited"
-REQUEST_PR_REVIEW = "products.github_commands.backend.logic.handlers.review_hog_facade.request_pr_review"
-OWNING_TEAM_ID = "products.github_commands.backend.logic.handlers.review_hog_github.owning_team_id"
-CLAIM_CACHE = "products.github_commands.backend.logic.dispatch.cache"
-CONSUME_BUDGET = "products.github_commands.backend.logic.dispatch.consume"
-RUN_COMMENT_COMMAND = "products.github_commands.backend.tasks.tasks.run_comment_command.delay"
+FLAG = "products.commands.backend.logic.dispatch.posthog_feature_flag_enabled"
+REQUEST_STAMPHOG_REVIEW = "products.commands.backend.logic.handlers.stamphog_requests.request_review"
+DESKTOP_ACCESS = "products.commands.backend.logic.handlers.tasks_access.get_desktop_access_decision"
+CREATE_TASK = "products.commands.backend.logic.handlers.tasks_facade.create_and_run_task"
+USAGE_LIMITED = "products.commands.backend.logic.handlers.tasks_usage.task_run_usage_limited"
+REQUEST_PR_REVIEW = "products.commands.backend.logic.handlers.review_hog_facade.request_pr_review"
+OWNING_TEAM_ID = "products.commands.backend.logic.handlers.review_hog_github.owning_team_id"
+CLAIM_CACHE = "products.commands.backend.logic.dispatch.cache"
+CONSUME_BUDGET = "products.commands.backend.logic.dispatch.consume"
+RUN_COMMENT_COMMAND = "products.commands.backend.tasks.tasks.run_comment_command.delay"
# Each test gets its own commenter, so the per-commenter rate limit in Redis never carries over.
_github_ids = count(10_000)
@@ -189,7 +189,7 @@ class TestDispatchCommentCommand(BaseTest):
github = FakeGitHub()
with (
- patch("products.github_commands.backend.logic.identity.access_refused", return_value=True),
+ patch("products.commands.backend.logic.identity.access_refused", return_value=True),
patch(REQUEST_STAMPHOG_REVIEW) as request_review,
):
outcome = dispatch_comment_command(self._request(), github=github)
@@ -233,7 +233,7 @@ class TestDispatchCommentCommand(BaseTest):
with (
patch(
- "products.github_commands.backend.logic.identity.access_refused",
+ "products.commands.backend.logic.identity.access_refused",
side_effect=lambda subject, *_args, **_kwargs: second_refused and subject.email == second_user.email,
),
patch(OWNING_TEAM_ID, return_value=owner_team.id),
diff --git a/products/github_commands/backend/tests/test_intake.py b/products/commands/backend/tests/test_intake.py
similarity index 97%
rename from products/github_commands/backend/tests/test_intake.py
rename to products/commands/backend/tests/test_intake.py
index 41f193420d72..f382f20ed0f7 100644
--- a/products/github_commands/backend/tests/test_intake.py
+++ b/products/commands/backend/tests/test_intake.py
@@ -3,8 +3,8 @@ from typing import Any
import pytest
-from products.github_commands.backend.logic.intake import CommentCommandRequest, Dropped, read_comment_command
-from products.github_commands.backend.logic.parsing import (
+from products.commands.backend.logic.intake import CommentCommandRequest, Dropped, read_comment_command
+from products.commands.backend.logic.parsing import (
MAX_ARGUMENT_LENGTH,
MAX_BODY_LENGTH,
AmbiguousCommand,
diff --git a/products/github_commands/backend/tests/test_schema.py b/products/commands/backend/tests/test_schema.py
similarity index 98%
rename from products/github_commands/backend/tests/test_schema.py
rename to products/commands/backend/tests/test_schema.py
index 22c1018ea920..f0cbc53ed2bf 100644
--- a/products/github_commands/backend/tests/test_schema.py
+++ b/products/commands/backend/tests/test_schema.py
@@ -4,7 +4,7 @@ import pytest
from posthog.dataclasses import frozen
-from products.github_commands.backend.logic.schema import (
+from products.commands.backend.logic.schema import (
COMMAND_DECLARATIONS,
HELP,
LOOP,
diff --git a/products/github_commands/backend/webhook_consumers.py b/products/commands/backend/webhook_consumers.py
similarity index 73%
rename from products/github_commands/backend/webhook_consumers.py
rename to products/commands/backend/webhook_consumers.py
index 5e9d636e9880..facb8709c263 100644
--- a/products/github_commands/backend/webhook_consumers.py
+++ b/products/commands/backend/webhook_consumers.py
@@ -1,4 +1,4 @@
-"""GitHub commands' consumer on the customer-facing GitHub App endpoint.
+"""The commands consumer on the customer-facing GitHub App endpoint.
The registry imports this module on the first delivery, so it stays cheap: the handler defers the
facade import, and the facade defers the task import until a comment holds a command.
@@ -8,14 +8,14 @@ from posthog.ingress.contracts import WebhookConsumer, WebhookDelivery
def _accept_comment(delivery: WebhookDelivery) -> None:
- from products.github_commands.backend.facade.api import accept_issue_comment # noqa: PLC0415
+ from products.commands.backend.facade.api import accept_issue_comment # noqa: PLC0415
accept_issue_comment(delivery.payload)
WEBHOOK_CONSUMERS = (
WebhookConsumer(
- name="github_commands",
+ name="commands",
provider="github",
app="posthog",
event_types=frozenset({"issue_comment"}),
diff --git a/products/github_commands/commands.generated.json b/products/commands/commands.generated.json
similarity index 100%
rename from products/github_commands/commands.generated.json
rename to products/commands/commands.generated.json
diff --git a/products/github_commands/manifest.tsx b/products/commands/manifest.tsx
similarity index 83%
rename from products/github_commands/manifest.tsx
rename to products/commands/manifest.tsx
index 16c51be6de91..b531bdbaa8b5 100644
--- a/products/github_commands/manifest.tsx
+++ b/products/commands/manifest.tsx
@@ -1,12 +1,12 @@
/**
- * Product manifest for github_commands.
+ * Product manifest for commands.
*
* The product has no frontend: it answers `@posthog` commands in GitHub pull request comments.
*/
import { ProductManifest } from '../../frontend/src/types'
export const manifest: ProductManifest = {
- name: 'GitHub commands',
+ name: 'Commands',
scenes: {},
routes: {},
redirects: {},
diff --git a/products/github_commands/package.json b/products/commands/package.json
similarity index 79%
rename from products/github_commands/package.json
rename to products/commands/package.json
index 48b4c523e348..6dd056cd2cc5 100644
--- a/products/github_commands/package.json
+++ b/products/commands/package.json
@@ -1,5 +1,5 @@
{
- "name": "@posthog/products-github-commands",
+ "name": "@posthog/products-commands",
"scripts": {
"backend:test": "pytest -c ../../pytest.ini --rootdir ../.. backend/tests -v --tb=short",
"backend:contract-check": "echo 'Contract files unchanged'"
diff --git a/products/github_commands/product.yaml b/products/commands/product.yaml
similarity index 53%
rename from products/github_commands/product.yaml
rename to products/commands/product.yaml
index 9791255f1e7c..db11d5ff9fcf 100644
--- a/products/github_commands/product.yaml
+++ b/products/commands/product.yaml
@@ -1,3 +1,3 @@
-name: GitHub commands
+name: Commands
owners:
- team-devex
diff --git a/products/github_commands/tsconfig.json b/products/commands/tsconfig.json
similarity index 100%
rename from products/github_commands/tsconfig.json
rename to products/commands/tsconfig.json
diff --git a/products/github_commands/turbo.json b/products/commands/turbo.json
similarity index 100%
rename from products/github_commands/turbo.json
rename to products/commands/turbo.json
diff --git a/products/github_commands/backend/apps.py b/products/github_commands/backend/apps.py
deleted file mode 100644
index 945749e2f7bb..000000000000
--- a/products/github_commands/backend/apps.py
+++ /dev/null
@@ -1,8 +0,0 @@
-"""Django app configuration for github_commands."""
-
-from django.apps import AppConfig
-
-
-class GithubCommandsConfig(AppConfig):
- name = "products.github_commands.backend"
- label = "github_commands"
diff --git a/products/github_commands/backend/logic/__init__.py b/products/github_commands/backend/logic/__init__.py
deleted file mode 100644
index 215c21ef2cbc..000000000000
--- a/products/github_commands/backend/logic/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-"""Business logic for github_commands."""
diff --git a/products/review_hog/backend/label_reviews.py b/products/review_hog/backend/label_reviews.py
index 45bccad1a96c..1ed457f1c40c 100644
--- a/products/review_hog/backend/label_reviews.py
+++ b/products/review_hog/backend/label_reviews.py
@@ -49,8 +49,8 @@ BOT_LABEL_COMMENT = (
"so the label was removed. Add the label yourself to start a review."
)
-# The rollout flag of `@posthog` pull request comments (products/github_commands). Read here by key,
-# because github_commands already depends on this product.
+# The rollout flag of `@posthog` pull request comments (products/commands). Read here by key,
+# because the commands product already depends on this product.
COMMENT_COMMANDS_FLAG = "github-commands"
diff --git a/products/tasks/backend/temporal/babysit_pr/snapshot.py b/products/tasks/backend/temporal/babysit_pr/snapshot.py
index cb46b2bdc032..15a963b521be 100644
--- a/products/tasks/backend/temporal/babysit_pr/snapshot.py
+++ b/products/tasks/backend/temporal/babysit_pr/snapshot.py
@@ -9,7 +9,7 @@ BODY_EXCERPT_MAX_CHARS = 1500
CONFLICT_KEY = "merge-conflict"
-# `@posthog <command>` lines belong to the pull request comment dispatcher (products/github_commands),
+# `@posthog <command>` lines belong to the pull request comment dispatcher (products/commands),
# which also marks its replies. Neither is feedback for this loop, and acting on a command such as
# `@posthog stamp` here would run it a second time.
_DISPATCHER_COMMAND_LINE_RE = re.compile(r"^ {0,3}@posthog(?![\w-])", re.IGNORECASE)
diff --git a/tach.toml b/tach.toml
index fbc41806039e..b01c05ec7d8c 100644
--- a/tach.toml
+++ b/tach.toml
@@ -1734,7 +1734,7 @@ from = [
]
[[modules]]
-path = "products.github_commands"
+path = "products.commands"
# Facade-only (enforced by each product's [[interfaces]] block): pull request comment commands
# dispatch into these products.
depends_on = ["posthog", "products.review_hog", "products.security", "products.stamphog", "products.tasks"]
@@ -1745,7 +1745,7 @@ expose = [
"backend\\.facade.*",
]
from = [
- "products.github_commands",
+ "products.commands",
]
[[modules]]
diff --git a/tools/hogli-commands/hogli_commands/projections.py b/tools/hogli-commands/hogli_commands/projections.py
index 175ad1adb0fb..fe250461a1a1 100644
--- a/tools/hogli-commands/hogli_commands/projections.py
+++ b/tools/hogli-commands/hogli_commands/projections.py
@@ -93,15 +93,15 @@ PROJECTIONS: tuple[Projection, ...] = (
),
),
Projection(
- name="github-commands",
- renderer="products/github_commands/backend/commands_projection.py",
+ name="commands",
+ renderer="products/commands/backend/commands_projection.py",
inputs=(
- "products/github_commands/backend/logic/schema.py",
- "products/github_commands/backend/logic/parsing.py",
+ "products/commands/backend/logic/schema.py",
+ "products/commands/backend/logic/parsing.py",
),
outputs=(
- "products/github_commands/commands.generated.json",
- "products/github_commands/COMMANDS.generated.md",
+ "products/commands/commands.generated.json",
+ "products/commands/COMMANDS.generated.md",
),
),
)