Skip to content
This repository was archived by the owner on May 14, 2026. It is now read-only.

docs: add AGENTS.md with upstream-parity guidance#268

Merged
zkochan merged 3 commits into
mainfrom
agents-md
Apr 24, 2026
Merged

docs: add AGENTS.md with upstream-parity guidance#268
zkochan merged 3 commits into
mainfrom
agents-md

Conversation

@zkochan

@zkochan zkochan commented Apr 24, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds AGENTS.md at the repo root for AI coding agents.
  • Central rule: any change here must match how the same feature is implemented in pnpm/pnpm on latest main — pacquet is a port, not a reimagining.
  • Covers repo layout, just commands, narrow test targeting, insta snapshot workflow, CODE_STYLE_GUIDE.md highlights, code-reuse expectations, error/diagnostics contract with pnpm, and Conventional Commits (with examples lifted from this repo's own git log).
  • Borrows applicable pieces from the upstream pnpm/pnpm AGENTS.md (test targeting, "never ignore test failures", code-reuse guidance, commit conventions); drops JS-only bits (changesets, bundle step, Jest realm gotcha).

Test plan

  • Render the file on GitHub and skim for formatting issues.
  • Verify the command examples (just ready, cargo nextest -p <crate>, etc.) match the current justfile.

zkochan added 2 commits April 24, 2026 14:32
Documents the cardinal rule (mirror pnpm/pnpm main), build/test/lint
commands, test targeting, code-reuse expectations, and Conventional
Commits conventions for AI coding agents working in this repo.
So Claude Code picks up the same guidance automatically without
duplicating the content.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a new root-level AGENTS.md document intended to guide AI coding agents contributing to pacquet, emphasizing upstream parity with pnpm/pnpm and documenting repo workflows (commands, testing, style, errors, and commit conventions).

Changes:

  • Introduces AGENTS.md with upstream-parity (“port, not reimagining”) guidance.
  • Documents canonical just commands, test targeting, snapshot workflow, and style highlights.
  • Adds guidelines for code reuse, diagnostics parity, and Conventional Commits.

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

Comment thread AGENTS.md
Comment thread AGENTS.md Outdated
Comment thread AGENTS.md Outdated
@github-actions

github-actions Bot commented Apr 24, 2026

Copy link
Copy Markdown

Micro-Benchmark Results

Linux

group                          main                                   pr
-----                          ----                                   --
tarball/download_dependency    1.00     18.6±0.43ms   232.8 KB/sec    1.08    20.2±13.09ms   215.2 KB/sec

- Shared test fixtures live under crates/testing-utils/src/fixtures/, not
  under __fixtures__ directories (that's a pnpm-ism).
- Reword the commands section to allow dropping to cargo/taplo directly
  when the just recipe doesn't expose the flag you need, matching the
  later narrow-test guidance that uses `cargo nextest -p <crate>`.
@zkochan zkochan merged commit 6b7b418 into main Apr 24, 2026
1 of 2 checks passed
@zkochan zkochan deleted the agents-md branch April 24, 2026 12:42
zkochan added a commit that referenced this pull request Apr 24, 2026
# Conflicts:
#	crates/tarball/src/lib.rs
KSXGitHub pushed a commit that referenced this pull request Apr 25, 2026
main already has an AGENTS.md (added in #268) with content unrelated
to my edits. Removing the duplicate so the merge from main pulls in
that file cleanly; the AI-guide references will be re-added on top.
KSXGitHub pushed a commit that referenced this pull request Apr 25, 2026
Brings in the AGENTS.md introduced in #268, along with the recent
performance, refactor, and benchmark work landed since this branch
was started. The local placeholder AGENTS.md was removed in the
preceding commit so the merge takes main's version unmodified.
zkochan pushed a commit that referenced this pull request Apr 25, 2026
* docs: fix bugs and typos in CODE_STYLE_GUIDE.md

- Correct push_path/push_back function name mismatch
- Fix non-compiling call sites in the &Path example so the snippet
  type-checks against the stated signature
- Add missing `move` and trailing `;` to tokio::task::spawn examples
  so they compile
- Rename "Cloning an atomic counter" section to "Cloning `Arc` and `Rc`"
  since Arc/Rc are reference counters, not atomic counters
- Fix missing semicolon in an assert_eq! example
- Grammar fixes ("could easily be refactored", "Explicitly marking
  the cloned type aids", "as more pull requests are reviewed")

* docs: add CONTRIBUTING.md and AGENTS.md

Adapted from KSXGitHub/parallel-disk-usage's CONTRIBUTING.md, with
pacquet-specific changes:

- No version-release exception in the commit message convention
- Setup and automated-check sections rewritten around `just init`,
  `just install`, and `just ready` instead of `test.sh`
- Dropped the squashfs/fuse external-dependency section (not relevant
  to pacquet); kept the registry-mock note instead
- Examples reworked to use pacquet types (manifests, store, etc.)
- Cross-links between CONTRIBUTING.md and CODE_STYLE_GUIDE.md so the
  two documents are discovered together

AGENTS.md instructs AI agents to follow both guides.

* docs: pass &mut my_list in push_path examples

Addresses copilot review comment on PR #255: `push_path` takes
`&mut Vec<PathBuf>`, so the call sites need `&mut my_list` rather
than `my_list` to compile.

* chore: temporarily remove AGENTS.md before merging main

main already has an AGENTS.md (added in #268) with content unrelated
to my edits. Removing the duplicate so the merge from main pulls in
that file cleanly; the AI-guide references will be re-added on top.

* docs(agents): point at CONTRIBUTING.md and CODE_STYLE_GUIDE.md

Adds an explicit "Follow the project guides" section near the top of
AGENTS.md and lists CONTRIBUTING.md alongside CODE_STYLE_GUIDE.md in
the repo-layout overview, so both guides are surfaced as required
reading.

* docs: move code-style sections from CONTRIBUTING.md to CODE_STYLE_GUIDE.md

Per option A of the contributing/style split discussion: keep
CONTRIBUTING.md focused on process (commit message format, writing
style, setup, automated checks), and have CODE_STYLE_GUIDE.md own
every code-level convention.

Moved into CODE_STYLE_GUIDE.md (under the existing `## Guides`
section, in thematic order):

- Module Organization
- Import Organization
- Derive Macro Ordering
- Generic Parameter Naming
- Variable and Closure Parameter Naming (with the single-letter rules)
- Trait Bounds
- Pattern Matching
- Using `pipe-trait` (with when-to-use and when-not-to-use)
- Error Handling
- Conditional Test Skipping (`#[cfg]` vs `#[cfg_attr(..., ignore)]`)
- Unit test file layout (was the top-level `## Unit Tests` section)

The intra-doc link from "Where the external file sits" to
"Module Organization" still resolves because both sections now live
in the same file.

Updated `AGENTS.md`'s descriptions for both guides to reflect the new
split. Per the review thread on this PR, no other prose in
`AGENTS.md` was rewritten for writing-style conformance; that is
deferred to the maintainer.

* docs(style): drop "Derive Macro Ordering" section

The codebase does not follow the rules this section prescribed, so
the section was aspirational rather than descriptive of pacquet's
actual conventions:

- "Split across multiple #[derive(...)] lines" — never done. Across
  52 files with derives, zero stack two #[derive(...)] attributes.
- Prescribed standard → comparison → Hash → derive_more order —
  frequently violated. The dominant pattern places Display right
  after Debug (e.g. crates/lockfile/src/comver.rs:8,
  crates/lockfile/src/pkg_ver_peer.rs:12).
- #[cfg_attr(feature = "...", derive(...))] split — zero
  occurrences anywhere in crates/.

The codebase's actual convention is too loose to codify usefully
(one #[derive(...)] line, Debug first when present), so the section
is removed rather than weakened to a near-tautology.

* docs(style): use .filter on both sides of the parameter-naming example

The pair was meant to contrast the closure parameter name (`entry`
vs. `x`), but using `.filter_map` on the good side and `.filter` on
the bad side muddled that with a method-choice difference. The
mismatch was carried over from the upstream parallel-disk-usage
guide. Use `.filter` on both sides so the example isolates the rule
under discussion.

* docs(style): fix four porting quirks in CODE_STYLE_GUIDE.md examples

Sweep for the same class of issue as the .filter / .filter_map
mismatch (#255, KSXGitHub review): examples that were degraded when
ported from upstream parallel-disk-usage.

- show_path with `path: &Path`: passing `my_path_buf` directly
  doesn't compile because `PathBuf` does not auto-coerce to `&Path`
  in argument position. Use `&my_path_buf` (same fix family as the
  earlier push_path call sites).
- "Avoiding deeply nested function calls": the pre-pipe version was
  a single non-nested call, so the rule's motivation wasn't visible.
  Replaced with a genuinely nested constructor chain that piping
  flattens.
- "pipe_as_ref" example lost its contrast in the port; restored the
  "without pipe" companion line so the rule's payoff is shown.
- Picked a custom-looking pacquet function name (is_within_store)
  for that example instead of `Path::exists`, since nobody uses
  `path_buf.pipe_as_ref(Path::exists)` over `path_buf.exists()`.
- Renamed `rows.zip(cols)` to `left_indices.zip(right_indices)` so
  the `(i, j)` closure parameters line up with the rule about index
  variables.

* docs: address review-agent findings on the docs branch

- AGENTS.md: drop the stale "derives" topic from both descriptions
  of CODE_STYLE_GUIDE.md, since the Derive Macro Ordering section
  was removed in 06c08ff for not matching the codebase.
- AGENTS.md: replace the inaccurate "pre-commit checks" wording in
  the repo-layout entry for CONTRIBUTING.md. The pre-push hook only
  runs format checks; the full `just ready` suite is a manual step
  before submitting, not an automated pre-commit hook.
- CODE_STYLE_GUIDE.md: fix subjunctive grammar — "should a test
  fails" should be "should a test fail" (predates the recent move,
  but caught while reviewing the section).

* Revert "docs(style): fix four porting quirks in CODE_STYLE_GUIDE.md examples"

This reverts commit 0d1e434.

* docs(style): make the pipe_as_ref example actually mid-chain

The text says "to pass a reference mid-chain", but the example was
a single `path_buf.pipe_as_ref(Path::exists)` call with no chain at
all. Replaced with a four-step chain that has methods before and
after `pipe_as_ref`, so the rule's wording matches the demonstration.

Audited every other pipe example in the section: each one is either
already part of a chain (dependencies, into_iter, summarize, etc.)
or is intentionally chain-free in the "When NOT to use pipe"
section, so no other rectification was needed.

Addresses KSXGitHub review on PR #255.

* docs(contributing): describe `just install` generically

Replace "Install the registry-mock dependencies" with "Install the
test dependencies". The previous wording named an internal component
(registry-mock) and would drift if `just install` ever did more or
different work. The new wording defers to `just install` as the
source of truth for what gets installed.

Per KSXGitHub review on PR #255.

* docs(style): drop `idx` from the index-naming alternatives

Per @zkochan review on PR #255: reduce the number of alternatives
listed for index variables. Keep `index` and `*_index` (such as
`row_index`); drop `idx`.

Applied to both places where the triple appeared: the "Conventional
single-letter names" bullet and the "Index variables" rule, so the
two stay consistent.

---------

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants