Skip to content

♻️ chore: rename recipes → commands (internal + DB, safe half) (#660)#379

Open
MaloPromyze wants to merge 5 commits into
mainfrom
chore/rename-recipes-to-commands
Open

♻️ chore: rename recipes → commands (internal + DB, safe half) (#660)#379
MaloPromyze wants to merge 5 commits into
mainfrom
chore/rename-recipes-to-commands

Conversation

@MaloPromyze

Copy link
Copy Markdown
Contributor

Summary

The "safe" half of the recipes → commands product rename (#660). This renames everything internal — the package, all domain identifiers, and the physical DB schema — while leaving external contracts untouched (HTTP routes + wire DTO field names), which land in a follow-up PR with an expand/contract (old+new side-by-side) strategy.

This is a reproduction on OSS (upstream) of the work originally opened on the proprietary fork in PackmindHub/packmind-proprietary#669; that PR is being closed in favour of this one, which syncs down to proprietary.

What's in here (3 commits)

  1. Package/project renamepackages/recipes → packages/commands, nx project recipes → commands, @packmind/recipes → @packmind/commands, tsconfig/webpack/migrations/jest aliases. A backward-compat @packmind/recipes alias still resolves to the commands package during the transition.
  2. Internal identifiers — symbol-aware (ts-morph) rename of 456 declaration names: types/brands (Recipe→Command, RecipeId→CommandId, RecipeVersion(Id)→CommandVersion(Id)), the port + DI token (IRecipesPort→ICommandsPort, 'IRecipesPort'→'ICommandsPort'), services/repositories/schemas/adapters/hexa/jobs, use-case contract types, methods, and the corresponding files/dirs (types/src/recipes→commands, frontend/src/domain/recipes→commands, api spaces/recipes→spaces/commands, …).
  3. Physical DB rename — migration 1811000000000-RenameRecipesToCommands (catalog-only ALTER … RENAME, fully reversible), plus TypeORM schema mappings and raw-SQL repository refs.

Naming conventions applied

  • The CQRS Command suffix is intentionally NOT collapsed with the business Command noun: CaptureRecipeCommand → CaptureCommandCommand, DeleteRecipeCommand → DeleteCommandCommand. The two Commands are distinct concepts (the business item vs. the Query/Command pattern).
  • Wire field keys kept for now: recipeId: RecipeId became recipeId: CommandId — the key stays, only the type is renamed. TS property names, relation aliases, and DB column property keys are unchanged so TypeORM auto-maps to the new physical columns.

Deliberately NOT changed (→ follow-up PR / rendering contract)

  • HTTP routes (/…/recipes, recipes/publish, deployments/recipe/:id) and route-param filenames.
  • Wire DTO field names (recipeId, recipes, recipeName, recipesCount, …) — these go in the follow-up PR with new fields living alongside the old ones (expand/contract), removing the old ones in ~1–2 months.
  • On-disk .packmind/recipes artifact paths and the whole rendering/deployer pipeline.
  • Chakra defineRecipe/.recipe.ts in @packmind/ui (unrelated concept).

Physical DB objects renamed

Kind Old → New
Tables recipes→commands, recipe_versions→command_versions, package_recipes→package_commands, distributed_package_recipe_versions→distributed_package_command_versions
Columns recipe_id→command_id, recipe_version_id→command_version_id
Indexes idx_recipe_user/space, idx_package_recipes_unique, idx_dprv_uniquecommand/dpcv
FK constraints FK_recipe_*, FK_package_recipes_*, FK_dprv_*command

(recipe_usage and deployment_recipe_versions were already dropped and are not touched. Auto-named FKs are left — Postgres updates them on rename.)

⚠️ Deploy notes

  • Single-cutover DB rename requires a brief maintenance window (no compatibility views): old pods query the old table names, new pods the new ones, so a rolling deploy would error mid-rollout. Deploy with Recreate/scale-to-zero or a short window.
  • The migration up()/down() were NOT run against a live Postgres (no Docker in the build env). The rename SQL is catalog-only and the object names were verified by replaying migration history, and the schema mapping is validated end-to-end by integration-tests (506) against pg-mem — but please dry-run the migration on staging before prod.

Validation

  • build: commands, api, mcp-server, packmind-cli, deployments, coding-agent, frontend, migrations — pass
  • typecheck: all affected packages — pass
  • test: commands (226), deployments (1228), coding-agent (1081), packmind-cli (3144), mcp-server (335), playbook-change-applier (95), integration-tests (506), frontend, spaces, standards, accounts, skills — pass

Part of #660.

🤖 Generated with Claude Code

MaloPromyze and others added 3 commits July 8, 2026 07:05
Rename the nx project `recipes` -> `commands` and the `@packmind/recipes`
package -> `@packmind/commands` (git mv packages/recipes -> packages/commands).
Update all import specifiers, tsconfig/webpack/migrations/jest aliases, and
project/package/jest config. A backward-compat `@packmind/recipes` alias points
at the commands package during the transition.

Internal domain identifiers (Recipe/RecipeId/RecipeVersion/IRecipesPort/
RecipesHexa...), physical DB names, HTTP routes, wire DTO fields and on-disk
`.packmind/recipes` artifact paths are deliberately left unchanged here and
handled as follow-ups.

Backport of PackmindHub/packmind-proprietary#669 onto OSS (upstream).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Symbol-aware rename (ts-morph) of internal domain identifiers from the
recipe vocabulary to command: types/brands (Recipe->Command, RecipeId->
CommandId, RecipeVersion(Id)->CommandVersion(Id)), the port + DI token
(IRecipesPort->ICommandsPort, 'IRecipesPort'->'ICommandsPort'), services/
repositories/schemas/adapters/hexa/jobs, use-case contract types, methods,
and the corresponding files/dirs (packages/types/src/recipes->commands,
frontend domain/recipes->commands, api spaces/recipes->spaces/commands, etc.).

The CQRS "Command" suffix is intentionally NOT collapsed with the business
"Command" noun (e.g. CaptureRecipeCommand -> CaptureCommandCommand): the two
Commands are distinct concepts.

Deliberately NOT changed here (external contract / PR2 / rendering):
- wire DTO field keys (recipeId, recipes, recipeName, recipesCount...) kept
- HTTP routes and route-param filenames
- DB tableName/column string literals, event-name strings, brand strings
- on-disk .packmind/recipes artifact paths and the rendering pipeline
- Chakra defineRecipe in @packmind/ui

Builds, typecheck and tests green across commands, api, mcp-server,
packmind-cli, deployments, coding-agent, frontend, playbook-change-applier
and the domain packages.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Single-cutover physical rename of the recipes domain tables/columns/
indexes/FK constraints to command naming, with matching TypeORM schema
updates. New migration 1811000000000-RenameRecipesToCommands (catalog-only
ALTER ... RENAME, fully reversible down()).

Tables : recipes->commands, recipe_versions->command_versions,
         package_recipes->package_commands,
         distributed_package_recipe_versions->distributed_package_command_versions
Columns: recipe_id->command_id, recipe_version_id->command_version_id
Indexes: idx_recipe_user/space, idx_package_recipes_unique, idx_dprv_unique -> command
FKs    : FK_recipe_*, FK_package_recipes_*, FK_dprv_* -> command

EntitySchemas: tableName + physical column/joinTable/index name mappings
updated; ORM entity names flipped ('Recipe'->'Command' etc., referenced
only within schemas). TS property keys (recipeId) and relation aliases are
kept (they auto-map to the new columns; wire field renames are PR2).
Raw-SQL/QueryBuilder repository refs to physical columns/tables updated to
the new names.

Deploy note: requires a brief maintenance window (single cutover, no compat
views). Migration up/down not yet exercised against a live Postgres (no
Docker in CI-less env) — verify on staging before prod. Schema mapping is
validated end-to-end by integration-tests (506) against pg-mem.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Too many files changed for review. (380 files found, 100 file limit)

Bypass the limit by tagging @greptile-apps to review.

@MaloPromyze MaloPromyze marked this pull request as draft July 8, 2026 08:06
The api commands.controller spec's jest.Mocked<CommandsService> still
declared the old recipe-named method keys after the internal rename;
align the mock keys and call sites with the renamed command-* methods.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@MaloPromyze MaloPromyze marked this pull request as ready for review July 8, 2026 08:12
Reconcile the recipes→commands rename (#660) with 39 commits of main.
Resolution rule: take main's semantic changes, re-apply PR1's mechanical
recipe→command rename.

- drop MCP (#374): accept deletion of apps/mcp-server
- remove recipe version summary feature (#659): drop summary services/jobs
  and their command-renamed counterparts (CommandSummaryService,
  UpdateCommandsAndGenerateSummaries*, llmPort/setLlmPort wiring)
- drop one-click trial (#373): accept GetStartedWithPackmindWidget deletion
- adopt main's modal→drawer refactor (#657) for ProposeDescriptionChangeModal

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

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.

1 participant