Skip to content

Rename PlatformConfig directory-segment fields to *DirName #796

Description

@williamthorsen

Description

Problem

PlatformConfig's directory fields (skillsDir, subagentsDir, scriptsDir) hold bare directory names such as "agents". But resolvePlatformPaths returns an object that reuses the same field names for fully-resolved absolute paths such as ~/.claude/agents. When both objects are in scope, as in installSubagents, the identical names are ambiguous: a reader cannot tell a name from a path without tracing the type. This has already forced a workaround. A local alias, const subagentsDirName = platformConfig.subagentsDir, exists at one install site purely to disambiguate the segment from the path.

Context

  • PlatformConfig is defined in packages/agents/src/lib/types.ts.
  • The PLATFORMS literal and resolvePlatformPaths live in packages/agents/src/lib/platform.ts.
  • Bare-name field consumers are resolvePlatformPaths plus three reads in packages/agents/src/commands/install.ts, roughly 15 edit sites across the three files.
  • Resolved-path consumers (paths.* / platformPaths.*) are a separate, larger set that keeps the *Dir names, because those values genuinely are paths.
  • homeDir is intentionally excluded. It has no resolved-path counterpart (resolved paths use platformHome), so it is unambiguous.
  • platform.test.ts reads the renamed segments directly (e.g. PLATFORMS.claude.skillsDir), so its assertions must be updated to the new names.
  • PlatformConfig is confirmed package-internal: the @codeassembly/agents package exposes only a bin (no exports/main/module), so no changelog, docs, or migration are required.

Relevant considerations

  • Minimal scope: rename the config segments only. The *DirName (name) versus *Dir (path) contrast disambiguates without introducing a broader *Name / *Path / *FullPath vocabulary the codebase does not otherwise use.
  • Pure rename with no behavioral change. No new tests are expected, though existing assertions that reference the renamed segments must be updated to the new names.

Proposed solution

Rename skillsDir / subagentsDir / scriptsDir to skillsDirName / subagentsDirName / scriptsDirName on PlatformConfig and in the PLATFORMS literal, updating each renamed field's doc comment to describe a directory name rather than a path. Update resolvePlatformPaths to read the renamed segment fields while keeping its output keys (the full paths) named *Dir. Update the three platformConfig.*Dir reads in install.ts, inline the now-redundant subagentsDirName alias, and update the platform.test.ts assertions that reference the renamed segments.

Acceptance criteria

Must have

  • PlatformConfig's skillsDir / subagentsDir / scriptsDir are renamed to skillsDirName / subagentsDirName / scriptsDirName, and all config-segment reads are updated.
  • The full-path fields returned by resolvePlatformPaths keep their *Dir names.
  • The redundant disambiguation alias at the subagent install site is inlined.
  • No behavioral change and no new or modified test logic.
  • Test assertions that reference the renamed config segments (e.g. PLATFORMS.claude.skillsDir in packages/agents/src/lib/__tests__/platform.test.ts) are updated to the *DirName names, and the full test suite passes.

Metadata

Metadata

Labels

refactoringImprovement to code without change in functionalityscope:agents

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions