Skip to content

Preserve CLI include paths for empty resources#1500

Merged
ChiragAgg5k merged 1 commit intomasterfrom
codex/preserve-cli-empty-includes
May 5, 2026
Merged

Preserve CLI include paths for empty resources#1500
ChiragAgg5k merged 1 commit intomasterfrom
codex/preserve-cli-empty-includes

Conversation

@ChiragAgg5k
Copy link
Copy Markdown
Member

What does this PR do?

Preserves configured CLI includes entries when an included resource array becomes empty during config writes.

Previously writeResolvedLocalConfig removed an include path when the corresponding resource data was empty. That left the empty include file behind but removed the root config hint, so future CLI sessions would write new resources inline instead of back into the previously configured include file.

This addresses the P1 review comment from appwrite/sdk-for-cli#305.

Test Plan

  • docker run --rm -v $(pwd):/app -w /app php:8.3-cli php example.php cli
  • composer lint-twig
  • git diff --check

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 5, 2026

Greptile Summary

  • Removes the nextIncludePaths copy-and-mutate pattern from writeResolvedLocalConfig; instead, the original includePaths is always written back to rootOutput.includes, preserving include-file hints even when the resource array is empty. This directly addresses the P1 review comment from the linked CLI PR.
  • The empty resource array is still written to the include file (existing behavior), and pruneEmptyTopLevelResourceArrays continues to remove empty inline arrays from the root config — neither interaction is affected by this change.

Confidence Score: 5/5

Safe to merge — minimal, targeted fix with correct logic and no regressions to adjacent code paths.

The change is a clean removal of a flawed deletion of include paths; the surrounding logic (empty-array pruning, include file writing) is unchanged and unaffected. No new issues found.

No files require special attention.

Important Files Changed

Filename Overview
templates/cli/lib/config.ts Removes the nextIncludePaths mutation pattern so that include paths for resources are always preserved in the root config, even when the corresponding resource array becomes empty. The empty array is still written to the include file, but the root-level includes entry is no longer dropped.

Reviews (2): Last reviewed commit: "Preserve CLI include paths for empty res..." | Re-trigger Greptile

@ChiragAgg5k ChiragAgg5k force-pushed the codex/preserve-cli-empty-includes branch from 8798bf9 to 43aebec Compare May 5, 2026 04:57
@ChiragAgg5k ChiragAgg5k merged commit 68009b9 into master May 5, 2026
56 checks passed
@ChiragAgg5k ChiragAgg5k deleted the codex/preserve-cli-empty-includes branch May 5, 2026 05:02
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