Skip to content

refactor: Extract internal/document package, simplify manifest format (#218) - #221

Merged
David-Noble-at-work merged 4 commits into
developfrom
feature/structured-document-io
Mar 15, 2026
Merged

David-Noble-at-work merged 4 commits into
developfrom
feature/structured-document-io

Conversation

@David-Noble-at-work

Copy link
Copy Markdown
Contributor

Summary

  • New internal/document package with Read, ReadIfExists, and Write functions that encapsulate
    structured document I/O (YAML/JSON) with consistent error wrapping, permission modes, and directory creation.
  • Migrated 24 call sites across 13 files to use the new package, eliminating repeated
    ReadFile+Unmarshal and Marshal+WriteFile boilerplate.
  • Simplified packages-manifest format: replaced polymorphic entries (bare string or single-key map) with
    uniform objects using explicit name/with fields. Deleted Parse, parsePackageEntry, PackageOptions,
    and ValidateBytes — all artifacts of the old polymorphic format with zero external callers.
  • Style compliance: doc comments with Parameters/Returns, blank lines after signatures, region markers on
    rewritten files.

Net: +579 lines (1202 added, 623 deleted) across 20 files.

Closes #218

Test plan

  • make vet passes
  • make test passes — all 22 new document tests + all existing tests
  • Manifest format change covered by updated tests in manifest_test.go, commands_test.go, builder_test.go
  • JSON schema updated to match new format
  • Old Parse/ValidateBytes APIs deleted — greenfield, no downstream consumers

David Noble added 4 commits March 14, 2026 22:03
Add internal/document package with Read, ReadIfExists, and Write functions
that encapsulate structured document I/O (YAML/JSON) with consistent error
wrapping, permission modes, and directory creation.

Migrate 24 call sites across 13 files to use the new package, eliminating
repeated ReadFile+Unmarshal and Marshal+WriteFile boilerplate.

Simplify packages-manifest format: replace polymorphic entries (bare string
or single-key map) with uniform objects using explicit name/with fields.
Delete Parse, parsePackageEntry, PackageOptions, and ValidateBytes — all
artifacts of the old polymorphic format with zero external callers.

Net: -231 lines (337 added, 568 deleted) across 17 files.

Closes #218
Add internal/document package with Read, ReadIfExists, and Write functions
that encapsulate structured document I/O (YAML/JSON) with consistent error
wrapping, permission modes, and directory creation.

Migrate 24 call sites across 13 files to use the new package, eliminating
repeated ReadFile+Unmarshal and Marshal+WriteFile boilerplate.

Simplify packages-manifest format: replace polymorphic entries (bare string
or single-key map) with uniform objects using explicit name/with fields.
Delete Parse, parsePackageEntry, PackageOptions, and ValidateBytes — all
artifacts of the old polymorphic format with zero external callers.

Net: -231 lines (337 added, 568 deleted) across 17 files.

Closes #218
…or/devlore-cli into feature/structured-document-io
@David-Noble-at-work
David-Noble-at-work merged commit 2cf5c38 into develop Mar 15, 2026
2 checks passed
@David-Noble-at-work
David-Noble-at-work deleted the feature/structured-document-io branch August 11, 2026 18:43
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.

Consolidate code around coherent helpers/packages

1 participant