Skip to content

Add docs, ADRs, domain glossary, architecture reference, and actionable error messages - #23

Merged
adelrodriguez merged 1 commit into
mainfrom
08-05-add_docs_adrs_domain_glossary_architecture_reference_and_actionable_error_messages
Aug 6, 2026
Merged

Add docs, ADRs, domain glossary, architecture reference, and actionable error messages#23
adelrodriguez merged 1 commit into
mainfrom
08-05-add_docs_adrs_domain_glossary_architecture_reference_and_actionable_error_messages

Conversation

@adelrodriguez

Copy link
Copy Markdown
Collaborator

Add documentation, domain glossary, architecture records, and actionable error messages for v1

Introduces CONTEXT.md as the authoritative domain glossary defining terms such as "package source reference," "dependency-tracked reference," "materialization," and "global store" that are used consistently across the CLI, specification, and implementation.

Adds docs/architecture.md describing the module seams, add/sync and install flows, storage model, consistency boundaries, and source layout. Adds three architecture decision records covering dependency source inspection via Packref, the commit-lockfile/ignore-source-directory split, and the bounded tarball fallback strategy, along with an ADR index.

Rewrites README.md with a full command reference, source resolution explanation, operational boundaries, and storage layout. Moves the pastry attribution to the footer.

Adds .plans/README.md to orient contributors to the plans directory as implementation history rather than current guidance, and adds a historical-reference notice to implementation-strategy.md. Updates plan 09 to reflect its completed status and corrects the sync behavior note to match the implemented behavior: sync reconciles existing dependency-tracked references only and does not adopt unreferenced manifest dependencies.

Updates AGENTS.md to point to CONTEXT.md, docs/architecture.md, and the ADR index, and corrects the install description to say "restores locked references exactly" rather than "restores the lockfile exactly."

Sharpens all command descriptions to be specific and action-oriented, and extends every error message in src/lib/core/errors.ts with a concrete recovery instruction.

Adds a typecheck script to package.json and a CLI help test that asserts every v1 command appears with its description and that add, remove, and clean document their optional arguments and flags.

@adelrodriguez
adelrodriguez marked this pull request as ready for review August 6, 2026 02:18
@adelrodriguez
adelrodriguez force-pushed the 08-05-add_docs_adrs_domain_glossary_architecture_reference_and_actionable_error_messages branch from de7e0e5 to 9ba4719 Compare August 6, 2026 02:33
@adelrodriguez
adelrodriguez force-pushed the 08-05-add_first-party_packref_agent_skill_with_workflow_command_boundaries_and_readme_documentation branch from 2e333e6 to 81d5cd8 Compare August 6, 2026 02:33
@adelrodriguez
adelrodriguez force-pushed the 08-05-add_docs_adrs_domain_glossary_architecture_reference_and_actionable_error_messages branch from 9ba4719 to 1715919 Compare August 6, 2026 02:41
@adelrodriguez
adelrodriguez force-pushed the 08-05-add_first-party_packref_agent_skill_with_workflow_command_boundaries_and_readme_documentation branch from 81d5cd8 to 2b11f85 Compare August 6, 2026 02:41
@adelrodriguez
adelrodriguez force-pushed the 08-05-add_docs_adrs_domain_glossary_architecture_reference_and_actionable_error_messages branch from 1715919 to c4545bb Compare August 6, 2026 03:09
@adelrodriguez
adelrodriguez force-pushed the 08-05-add_first-party_packref_agent_skill_with_workflow_command_boundaries_and_readme_documentation branch from 2b11f85 to 921cff5 Compare August 6, 2026 03:09
Base automatically changed from 08-05-add_first-party_packref_agent_skill_with_workflow_command_boundaries_and_readme_documentation to main August 6, 2026 03:12
@adelrodriguez
adelrodriguez force-pushed the 08-05-add_docs_adrs_domain_glossary_architecture_reference_and_actionable_error_messages branch 3 times, most recently from 006651f to ed1aab9 Compare August 6, 2026 03:28
@adelrodriguez

Copy link
Copy Markdown
Collaborator Author

@codex review

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR prepares Packref v1 for release by adding a clear documentation set (domain glossary, architecture reference, ADRs), tightening CLI help text, and making core error messages more actionable, with tests to keep the CLI help surface stable.

Changes:

  • Added project docs: CONTEXT.md glossary, docs/architecture.md, and ADR index + three ADRs.
  • Refined CLI command descriptions and extended typed error messages with recovery guidance.
  • Added CLI help tests and minor tooling updates (typecheck script, parallel test runner, ANSI-stripping for test output).

Reviewed changes

Copilot reviewed 26 out of 26 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/lib/workspace/integration.ts Updates Packref guidance text embedded into integrations/agent guidance.
src/lib/core/errors.ts Adds actionable recovery instructions to core typed error messages.
src/commands/sync.ts Refines sync command description to reflect dependency-tracked behavior.
src/commands/remove.ts Refines remove command description.
src/commands/prune.ts Refines prune command description.
src/commands/list.ts Refines list command description.
src/commands/init.ts Refines init command description.
src/commands/clean.ts Refines clean command description.
src/commands/add.ts Refines add command description.
src/commands/tests/init.test.ts Updates init guidance assertion to match new wording.
src/commands/tests/helpers.ts Normalizes CLI output for tests by stripping VT control sequences.
src/commands/tests/help.test.ts Adds coverage ensuring v1 commands and optional args/flags appear in --help.
README.md Rewrites README with installation, command reference, storage model, and boundaries.
package.json Adds typecheck script; runs tests with bun test --parallel.
docs/architecture.md Adds an architecture overview (module seams, flows, storage model, boundaries).
docs/adr/README.md Adds ADR index.
docs/adr/0003-prefer-repository-source-with-bounded-tarball-fallback.md Documents bounded tarball fallback decision.
docs/adr/0002-commit-lock-metadata-and-materialize-source-locally.md Documents lockfile-vs-materialized-source split decision.
docs/adr/0001-use-packref-for-dependency-source-inspection.md Documents Packref as the dependency source inspection policy.
CONTEXT.md Introduces authoritative domain glossary for Packref terms.
AGENTS.md Updates contributor/agent guidance links and changeset guidance.
.plans/v2-features.md Removes items promoted/clarified as no longer v2 candidates.
.plans/README.md Adds orientation for plans directory as history vs current guidance.
.plans/implementation-strategy.md Adds “historical reference” notice and corrects sync behavior note.
.plans/09-cli-polish-docs-release.md Marks Plan 09 as implemented and updates scope language.
.changeset/first-minor-release.md Adds first release changeset describing Packref capabilities.
Suppressed comments (1)

src/commands/tests/help.test.ts:23

  • Same brittleness here: asserting exact spacing makes the test fail on harmless formatting changes. Prefer regex that anchors on the command name followed by whitespace and the description.
    expect(result.output).toContain("list       List package source references")
    expect(result.output).toContain("prune      Remove global store entries")
    expect(result.output).toContain("remove     Remove package source references")
    expect(result.output).toContain("sync       Update dependency-tracked references")

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .plans/09-cli-polish-docs-release.md Outdated
Comment on lines +9 to +11
Implemented. Command help and errors are actionable, the complete v1 workflow is documented, and
the executable package contents have been verified. The package remains at the pre-release `0.0.0`
baseline, so no changeset was created.
Comment thread .changeset/first-minor-release.md Outdated
- `packref add [package]` — add source references from manifest dependencies or by explicit name/version
- `packref remove [package]` — remove package references
- `packref install` — materialize every reference recorded in the committed lockfile
- `packref sync` — update dependency-tracked lock entries to match current `package.json` versions
Comment thread src/commands/__tests__/help.test.ts Outdated
Comment on lines +16 to +19
expect(result.output).toContain("add Add a package source reference")
expect(result.output).toContain("clean Clear current-project references")
expect(result.output).toContain("init Initialize Packref files")
expect(result.output).toContain("install Install Packref source references")

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ed1aab949f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/lib/core/errors.ts Outdated
}> {
override get message() {
return `Failed to resolve installed dependency versions for \`${this.path}\`.`
return `Failed to resolve installed dependency versions for \`${this.path}\`. Run your package manager's install command, then retry.`

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid prescribing installs for filesystem resolution failures

When package-manager detection or checking/reading a lockfile fails because of permissions or another filesystem error, PackageManagerResolver wraps that failure in ManifestResolutionError (for example, javascript.ts lines 311–318 and 397–404). Running the package manager's install command will not resolve those failures and may unnecessarily modify project state; tailor the recovery advice to the underlying cause or use guidance that also covers access/read errors.

Useful? React with 👍 / 👎.

Comment thread src/lib/core/errors.ts Outdated
}> {
override get message() {
return `Failed to fetch source snapshot from \`${this.source}\`.`
return `Failed to fetch source snapshot from \`${this.source}\`. Check your network access and retry.`

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Cover local failures in snapshot recovery guidance

When repository materialization fails because the global store is unwritable or out of space, materializeStoreEntry maps those filesystem errors into SnapshotFetchError through the callback in repository/fetch.ts, so checking network access cannot fix the reported failure. Make this advice cover filesystem permissions and disk space as well, or preserve enough cause information to select the appropriate recovery step.

Useful? React with 👍 / 👎.

Comment thread src/lib/core/errors.ts Outdated
}> {
override get message() {
return `Failed to fetch or extract package tarball from \`${this.url}\`.`
return `Failed to fetch or extract package tarball from \`${this.url}\`. Check your network access and retry.`

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Distinguish malformed tarballs from network failures

When a tarball downloads successfully but extraction rejects an invalid path, unsupported entry type, multiple roots, corrupt gzip data, or a local filesystem write, all of those paths raise TarballFetchError in sources/tarball/fetch.ts. Telling users only to check network access is therefore misleading for these common extraction failures; use cause-sensitive guidance or mention archive and filesystem failures too.

Useful? React with 👍 / 👎.

@adelrodriguez
adelrodriguez force-pushed the 08-05-add_docs_adrs_domain_glossary_architecture_reference_and_actionable_error_messages branch from ed1aab9 to 6a942d4 Compare August 6, 2026 03:38
@adelrodriguez

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6a942d4233

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/lib/core/errors.ts Outdated
}> {
override get message() {
return `Failed to parse project manifest at \`${this.path}\`.`
return `Failed to parse project manifest at \`${this.path}\`. Fix the invalid manifest, then retry.`

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Distinguish unreadable installed manifests

When readNodeModulesVersion cannot read an installed package's node_modules/<pkg>/package.json for any reason other than NotFound, javascript.ts lines 444–452 converts that filesystem failure into ManifestParseError. For a permissions or I/O failure, telling the user to fix an invalid manifest cannot resolve the problem; preserve the read failure or include filesystem-access guidance.

Useful? React with 👍 / 👎.

Comment thread src/lib/core/errors.ts Outdated
Comment on lines +211 to +212
? `Network request failed for \`${this.url}\`. Check your connection and retry.`
: "Network request failed. Check your connection and retry."

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid treating every registry response failure as connectivity

When the npm registry returns a non-2xx response or a body that fails JSON/schema decoding, NpmRegistryClient.getPackageMetadata maps it to NetworkError (client.ts lines 49–64). With a 401/403/5xx response or malformed metadata the connection can be healthy, so checking it and retrying may never help; mention authentication, registry status, or invalid responses, or retain enough cause information to select the recovery advice.

Useful? React with 👍 / 👎.

Comment thread src/lib/core/errors.ts Outdated
}> {
override get message() {
return `Global store entry at \`${this.path}\` is missing valid source metadata.`
return `Global store entry at \`${this.path}\` is missing valid source metadata. Run \`packref clean --global\`, then retry.`

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Do not wipe the store for metadata permission errors

When valid store metadata is unreadable, readStoreEntry wraps the readFileString failure—including EACCES—in StoreCorruptedError (store.ts lines 63–70). The new recovery step can therefore direct users to delete every global snapshot even though correcting permissions is sufficient, and deletion may still succeed when the parent directory is writable; distinguish access failures or avoid prescribing a global wipe for them.

Useful? React with 👍 / 👎.

Comment thread src/lib/core/errors.ts Outdated
}> {
override get message() {
return `Failed to materialize project reference from \`${this.source}\` to \`${this.target}\`.`
return `Failed to materialize project reference from \`${this.source}\` to \`${this.target}\`. Check filesystem permissions and available disk space, then retry.`

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Cover invalid repository directories in reflink guidance

When locked repository.directory metadata escapes the stored snapshot, createProjectReference explicitly raises ReflinkError (project.ts lines 82–87); a missing package subdirectory can also surface through the same error. In those cases permissions and disk space are unrelated, so the new advice leaves the user without a viable recovery path; distinguish invalid or missing source-directory metadata from actual filesystem copy failures.

Useful? React with 👍 / 👎.

@adelrodriguez
adelrodriguez force-pushed the 08-05-add_docs_adrs_domain_glossary_architecture_reference_and_actionable_error_messages branch from 6a942d4 to 457a1d2 Compare August 6, 2026 03:58
@adelrodriguez
adelrodriguez merged commit e460ca8 into main Aug 6, 2026
5 checks passed
@adelrodriguez
adelrodriguez deleted the 08-05-add_docs_adrs_domain_glossary_architecture_reference_and_actionable_error_messages branch August 6, 2026 04:00
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.

2 participants