@zebeqo/vendy 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/main.mjs +26 -7
  2. package/package.json +1 -1
package/dist/main.mjs CHANGED
@@ -32319,12 +32319,22 @@ const parse$1 = (tag) => {
32319
32319
  };
32320
32320
  };
32321
32321
  const packagePrefix = (name) => `${name}@`;
32322
+ /** The version `release` gives package `name` of a repo publishing `packages`: a `<name>@<version>` tag, or a `v<version>` or `<version>` tag when `name` is the only package. */
32323
+ const packageVersion = (release, name, packages) => release.prefix === packagePrefix(name) || (release.prefix === "v" || release.prefix === "") && packages.length === 1 && packages[0] === name ? release.version : void 0;
32322
32324
  const isPrerelease = (release) => import_semver.default.prerelease(release.version) !== null;
32323
- const sameLine = (left, right) => import_semver.default.major(left.version) === import_semver.default.major(right.version) && import_semver.default.minor(left.version) === import_semver.default.minor(right.version) && import_semver.default.patch(left.version) === import_semver.default.patch(right.version);
32325
+ const forwardChannels = [
32326
+ "alpha",
32327
+ "beta",
32328
+ "rc"
32329
+ ];
32330
+ const channel = (release) => String(import_semver.default.prerelease(release.version)?.[0] ?? "").replace(/[^A-Za-z].*$/, "");
32331
+ const sameCore = (left, right) => import_semver.default.major(left.version) === import_semver.default.major(right.version) && import_semver.default.minor(left.version) === import_semver.default.minor(right.version) && import_semver.default.patch(left.version) === import_semver.default.patch(right.version);
32332
+ const sameChannel = (left, right) => channel(left) === channel(right) || forwardChannels.includes(channel(left)) && forwardChannels.includes(channel(right));
32333
+ const onLine = (release, current) => !isPrerelease(release) || isPrerelease(current) && sameCore(release, current) && sameChannel(release, current);
32324
32334
  const newest = (releases, current) => {
32325
32335
  const byVersion = (left, right) => import_semver.default.compare(left.version, right.version);
32326
32336
  const stable = releases.filter((release) => !isPrerelease(release));
32327
- return (current === void 0 ? stable.length > 0 ? stable : releases : [current, ...releases.filter((release) => release.prefix === current.prefix && (!isPrerelease(release) || isPrerelease(current) && sameLine(release, current)))]).reduce((best, release) => best === void 0 || byVersion(release, best) > 0 ? release : best, void 0);
32337
+ return (current === void 0 ? stable.length > 0 ? stable : releases : [current, ...releases.filter((release) => release.prefix === current.prefix && onLine(release, current))]).reduce((best, release) => best === void 0 || byVersion(release, best) > 0 ? release : best, void 0);
32328
32338
  };
32329
32339
  var NoReleases = class extends TaggedError()("NoReleases", {
32330
32340
  url: String$7,
@@ -36516,6 +36526,15 @@ const readFindings = (repo, paths) => (repo.uses ?? []).flatMap((use) => (use.re
36516
36526
  }];
36517
36527
  }));
36518
36528
  const vendoredManifests = (repo) => (paths) => paths.filter((path) => isPackageJson(path) && !path.split("/").includes("node_modules") && (repo.paths === void 0 || repo.paths.some((vendored) => covers(vendored, path))));
36529
+ const releasedPackages = (repo, published) => {
36530
+ const release = parse$1(repo.ref);
36531
+ if (release === void 0) return published;
36532
+ const names = published.map((pkg) => pkg.name);
36533
+ return published.map((pkg) => ({
36534
+ ...pkg,
36535
+ version: packageVersion(release, pkg.name, names) ?? pkg.version
36536
+ }));
36537
+ };
36519
36538
  const packageOf = (packages, file) => packages.find((directory) => directory === "" || covers(directory, file)) ?? "";
36520
36539
  const governedPackages = (library, project) => (library.repo.uses ?? []).every((use) => use.scope === void 0) ? new Set(project.packages) : new Set(project.files.filter((file) => library.scope.covers(file)).map((file) => packageOf(project.packages, file)));
36521
36540
  const declaredIn = (directory) => directory === "" ? "package.json" : `${directory}/package.json`;
@@ -36624,7 +36643,7 @@ const inspect$4 = fn("Check.inspect")(function* (options) {
36624
36643
  const snapshot = pinned.get(repo.name);
36625
36644
  return snapshot?._tag === "Available" ? [{
36626
36645
  repo,
36627
- published: published(snapshot.files),
36646
+ published: releasedPackages(repo, published(snapshot.files)),
36628
36647
  scope: repoScope(repo)
36629
36648
  }] : [];
36630
36649
  });
@@ -45581,8 +45600,8 @@ const skills$1 = {
45581
45600
  content: "---\nname: research\ndescription: Before building a feature, find what it should be built on or modeled after — what the map already covers, then three to five current, credible open-source candidates laid out with the data to choose between them. Ends when the user picks one and the vendor workflow takes over.\n---\n\n# research a feature\n\nDo not write the feature yet. Find what it should stand on, so nothing is reinvented and nothing is guessed.\n\n## 1. Pin down the feature\n\nOne sentence: what it does for the user of this project, and what it touches. If the request leaves that open, ask before searching — candidates are only comparable against a stated need.\n\n## 2. Look in the map first\n\n```bash\nvendy catalog\n```\n\nA repo already here may cover it. A framework the project is built on often ships the feature itself — a local database on an Effect project means Effect's own SQL modules before any new library — and a project already imitated may already solve the same problem. Read the relevant snapshot far enough to say yes or no.\n\nIf the map covers it, say so, name the evidence (`.vendy/<name>/<path>`), and offer to go straight to building. Research continues only if the user wants alternatives.\n\n## 3. Find candidates\n\nTwo kinds, and say which each one is:\n\n- **Library** — the project would depend on it.\n- **Reference** — a project that already ships this feature well, to imitate its implementation and its UX.\n\nSources: `gh search repos <terms> --sort stars --limit 20`, web search for recent comparisons and announcements, and the dependencies and choices of the high-quality projects already vendored. Prefer what is actively developed: the user favors newer tools with cleaner designs over incumbents, so a young project with momentum is a real candidate, not a risk to filter out.\n\n## 4. Gather the facts\n\nFor each candidate:\n\n```bash\ngh repo view <owner>/<repo> --json stargazerCount,pushedAt,licenseInfo,latestRelease,description\ngh release list --repo <owner>/<repo> --limit 5\ngh api 'repos/<owner>/<repo>/git/trees/HEAD?recursive=1' \\\n --jq '[.tree[] | select(.type == \"blob\")] as $b | {truncated, files: ($b | length), bytes: ($b | map(.size) | add)}'\n```\n\nThe last one sizes the snapshot: the files at the default branch's tip, which is what vendoring puts on disk. Not `diskUsage` from `gh repo view`, which counts the whole history and overstates a large repository several times over. `truncated: true` means the tree is too large for one response; report it as very large.\n\nRead its README and enough of its docs or source to judge fit with this project's stack — whether it is native to the framework the project already uses, its runtime, its module format.\n\n## 5. Present the options\n\nThree to five candidates in one table, then a recommendation:\n\n| Candidate | Kind | Stars | Last release | Last push | License | Snapshot | Fit with this project | Why it stands out |\n| --------- | ---- | ----: | ------------ | --------- | ------- | -------: | --------------------- | ----------------- |\n\nWrite the snapshot as files and megabytes (`2,628 files, 41 MB`). No hard thresholds: show the numbers and let the user weigh them. A large snapshot is not a reason to drop a candidate; it is a reason to vendor only the paths the use needs (vendor workflow), so say which ones when it is. The recommendation names one candidate and the reason, citing what you read.\n\n## 6. Hand off\n\nWhen the user picks, load `vendy skills get vendor` and vendor it with the feature as the purpose — unless it fails that workflow's \"Is it worth a repo?\", in which case it becomes a dependency without a repo. A pick of \"none\" ends here with nothing vendored.\n"
45582
45601
  },
45583
45602
  "review": {
45584
- description: "Review the current branch's changes against the map — the health check narrowed to the files the branch touched: does the new code follow the evidence of the uses it falls under, did it bring in vendored packages or imitated mechanisms the map does not record, and do the guides it affects still hold. Vendor alignment only; general bugs belong to a code review.",
45585
- content: "---\nname: review\ndescription: Review the current branch's changes against the map — the health check narrowed to the files the branch touched: does the new code follow the evidence of the uses it falls under, did it bring in vendored packages or imitated mechanisms the map does not record, and do the guides it affects still hold. Vendor alignment only; general bugs belong to a code review.\n---\n\n# review the branch\n\nThe health check, narrowed to what this branch changed. Load `vendy skills get health` for the judgments; this workflow says only what is different.\n\n## 1. The changes\n\nEvery file changed since the merge-base with the base branch — main unless the user says otherwise — committed or not.\n\n## 2. The uses they fall under\n\nRun `vendy check`, then match every changed file against the map: every project-wide use applies to all of them, and a scoped use applies to the files its globs match and its `!` globs do not. A changed file under no use is still read — it is where unmapped findings come from.\n\n## 3. Judge the changed lines\n\nHealth's step 3, on the changed lines and what they call, not the whole scope:\n\n- **Deviation** — the new code against its uses' evidence.\n- **Unmapped** — a new import of a vendored package outside every scope, or new code imitating a reference repo with no use recording it.\n- **Not worth a repo** — the branch vendored a library that health would flag as not worth one.\n- **Stale map** — the branch moved or deleted what a scope covered, or changed a feature's role without changing its use.\n- **Guide** — a guide whose use the branch changed, now out of date.\n\nThe fix for an unmapped or stale finding is usually an align the branch skipped: say so.\n\n## 4. Report, then fix\n\nReport as health's step 4 does, findings only for this branch. Fix what the user picks.\n"
45603
+ description: "Review the current branch's changes against the map — the health check narrowed to the files the branch touched. Does the new code follow the evidence of the uses it falls under, did it bring in vendored packages or imitated mechanisms the map does not record, and do the guides it affects still hold? Vendor alignment only; general bugs belong to a code review.",
45604
+ content: "---\nname: review\ndescription: Review the current branch's changes against the map — the health check narrowed to the files the branch touched. Does the new code follow the evidence of the uses it falls under, did it bring in vendored packages or imitated mechanisms the map does not record, and do the guides it affects still hold? Vendor alignment only; general bugs belong to a code review.\n---\n\n# review the branch\n\nThe health check, narrowed to what this branch changed. Load `vendy skills get health` for the judgments; this workflow says only what is different.\n\n## 1. The changes\n\nEvery file changed since the merge-base with the base branch — main unless the user says otherwise — committed or not.\n\n## 2. The uses they fall under\n\nRun `vendy check`, then match every changed file against the map: every project-wide use applies to all of them, and a scoped use applies to the files its globs match and its `!` globs do not. A changed file under no use is still read — it is where unmapped findings come from.\n\n## 3. Judge the changed lines\n\nHealth's step 3, on the changed lines and what they call, not the whole scope:\n\n- **Deviation** — the new code against its uses' evidence.\n- **Unmapped** — a new import of a vendored package outside every scope, or new code imitating a reference repo with no use recording it.\n- **Not worth a repo** — the branch vendored a library that health would flag as not worth one.\n- **Stale map** — the branch moved or deleted what a scope covered, or changed a feature's role without changing its use.\n- **Guide** — a guide whose use the branch changed, now out of date.\n\nThe fix for an unmapped or stale finding is usually an align the branch skipped: say so.\n\n## 4. Report, then fix\n\nReport as health's step 4 does, findings only for this branch. Fix what the user picks.\n"
45586
45605
  },
45587
45606
  "setup": {
45588
45607
  description: "Bring vendy into a project and decide how it behaves — which agents get session hooks, and editor exclusions. Also covers what setup writes into AGENTS.md, and changing any of it later.",
@@ -45590,7 +45609,7 @@ const skills$1 = {
45590
45609
  },
45591
45610
  "update": {
45592
45611
  description: "Move snapshots to their newest upstream one repo at a time — libraries to their newest release with the dependency alongside, references to their branch tip — then trace what changed to the uses it affects, carry the project's code and guides forward, and recommend new upstream features the map has a use for.",
45593
- content: "---\nname: update\ndescription: Move snapshots to their newest upstream one repo at a time — libraries to their newest release with the dependency alongside, references to their branch tip — then trace what changed to the uses it affects, carry the project's code and guides forward, and recommend new upstream features the map has a use for.\n---\n\n# update snapshots\n\nThe project always runs on the newest upstream. One repo at a time, each finished before the next starts: move it, trace the change to the map, carry the project forward, commit.\n\nWith no repo named, take every repo in `vendy catalog`. Start from `vendy status` to see which have anything new.\n\n## 1. Move the pin\n\n```bash\nvendy update <name> # prints: updated <name> <from>..<to>, then a diffstat of the whole snapshot\nvendy update <name> --patch # the full patch instead\n```\n\n`<from>..<to>` is the range every command below takes. Name revisions by SHA: the store fetches no upstream tags.\n\nA reference repo follows its branch to the tip. A library repo on a release tag moves to the newest release with the same tag pattern — prereleases only on the line it is already on — and never backward. Then bring the dependency along — for a reference repo, the tool pin its documentation describes: `vendy skills get core`, \"Matching a dependency to its snapshot\".\n\nA library repo still on a branch gets onto releases first:\n\n```bash\nvendy track <name> --release # the repository's own releases: v<version>, or <repo>@<version>\nvendy track <name> --release --package <pkg> # a monorepo's <pkg>@<version> tags\n```\n\nIf the project installs a newer release than the newest tag vendy finds — a prerelease line the snapshot is not on — track that release's tag by name instead: `vendy track <name> <tag>`.\n\nNothing new upstream → next repo.\n\n## 2. Find what changed\n\nTwo questions, read at different breadths.\n\n### What the project must follow\n\nNarrow: only the uses' evidence decides what the project's code depends on. Stop at the first layer that answers it:\n\n1. **The changelog.** `gh release view <tag> --repo <owner>/<repo>` for each release crossed, or the `CHANGELOG.md`, `.changeset/`, or release notes inside the snapshot. Breaking changes and deprecations, at the highest signal per line.\n2. **The diff in the `read` paths.**\n\n ```bash\n vendy diff <name> <from>..<to> --read --stat # which evidence changed\n vendy diff <name> <from>..<to> --read # how\n ```\n\n3. **Fresh read.** When the update crosses a major version, or a `read` path was moved or deleted, read the affected use's evidence again from scratch, as if vendoring it, and decide what the best practice is now.\n\n### What is new\n\nWide: never narrowed to the `read` paths, because a feature a use could take up often lands where the map does not read yet. Weigh each new thing against what each use is `for`, not where it reads.\n\n1. **The changelog** for every release crossed. When it names each feature and what it is for, it is enough: open a feature's code only once you are about to recommend it, to cite its evidence.\n2. **Where upstream changed**, when there is no changelog or it is too thin to judge from — a reference repo usually has none. Start from `vendy git <name> log --oneline <from>..<to>` and the diffstat `vendy update` printed; for a large update, `vendy diff <name> <from>..<to> --dirstat` shows it by directory.\n\n## 3. Trace it to the map\n\nFor every use of the repo, decide:\n\n- **Unaffected** — nothing in its evidence changed in a way its code depends on.\n- **Code must follow** — a breaking change, a deprecation, or a new recommended way of doing what this use's code does. List the files in its scope and what changes, citing the upstream evidence for each.\n- **Map must follow** — a `read` path moved, the evidence now lives elsewhere, or a recommended feature's evidence lies outside the use's `read` paths.\n- **Guide must follow** — a runbook step or an explained mechanism no longer matches.\n\nThen **recommend new features** from \"What is new\": anything one of the repo's uses could take up — a simpler API for what the code does by hand, a capability the scope's feature is missing. Only what the map has a use for; new features the project has no use for are noise.\n\n## 4. Carry the project forward\n\nEverything unaffected → commit the pin (and dependency) alone and move on.\n\nAnything affected → show the user the plan from step 3, with the recommendations kept separate from the required changes, and wait. On approval: change the code, update the `read` paths and guides, run `vendy check` and the project's own checks and tests, and commit — one commit per repo, holding its pin, its dependency, and the code and guides that followed it.\n\nWhen a repo cannot be carried forward cleanly — a migration too large for this pass, tests that will not go green — stop at that repo and report. Do not continue to the next on top of a broken one. Put the repo back where it was while the user decides — `vendy pin <name> <from>` for a reference repo, `vendy track <name> <old-tag>` and the old dependency for a library — so the snapshot never describes code the project does not run.\n"
45612
+ content: "---\nname: update\ndescription: Move snapshots to their newest upstream one repo at a time — libraries to their newest release with the dependency alongside, references to their branch tip — then trace what changed to the uses it affects, carry the project's code and guides forward, and recommend new upstream features the map has a use for.\n---\n\n# update snapshots\n\nThe project always runs on the newest upstream. One repo at a time, each finished before the next starts: move it, trace the change to the map, carry the project forward, commit.\n\nWith no repo named, take every repo in `vendy catalog`. Start from `vendy status` to see which have anything new.\n\n## 1. Move the pin\n\n```bash\nvendy update <name> # prints: updated <name> <from>..<to>, then a diffstat of the whole snapshot\nvendy update <name> --patch # the full patch instead\n```\n\n`<from>..<to>` is the range every command below takes. Name revisions by SHA: the store fetches no upstream tags.\n\nA reference repo follows its branch to the tip. A library repo on a release tag moves to the newest release with the same tag pattern — prereleases only on the line it is already on (alpha → beta → rc; a nightly or canary channel only from that channel) — and never backward. Then bring the dependency along — for a reference repo, the tool pin its documentation describes: `vendy skills get core`, \"Matching a dependency to its snapshot\".\n\nA library repo still on a branch gets onto releases first:\n\n```bash\nvendy track <name> --release # the repository's own releases: v<version>, or <repo>@<version>\nvendy track <name> --release --package <pkg> # a monorepo's <pkg>@<version> tags\n```\n\nIf the project installs a newer release than the newest tag vendy finds — a prerelease line the snapshot is not on — track that release's tag by name instead: `vendy track <name> <tag>`.\n\nNothing new upstream → next repo.\n\n## 2. Find what changed\n\nTwo questions, read at different breadths.\n\n### What the project must follow\n\nNarrow: only the uses' evidence decides what the project's code depends on. Stop at the first layer that answers it:\n\n1. **The changelog.** `gh release view <tag> --repo <owner>/<repo>` for each release crossed, or the `CHANGELOG.md`, `.changeset/`, or release notes inside the snapshot. Breaking changes and deprecations, at the highest signal per line.\n2. **The diff in the `read` paths.**\n\n ```bash\n vendy diff <name> <from>..<to> --read --stat # which evidence changed\n vendy diff <name> <from>..<to> --read # how\n ```\n\n3. **Fresh read.** When the update crosses a major version, or a `read` path was moved or deleted, read the affected use's evidence again from scratch, as if vendoring it, and decide what the best practice is now.\n\n### What is new\n\nWide: never narrowed to the `read` paths, because a feature a use could take up often lands where the map does not read yet. Weigh each new thing against what each use is `for`, not where it reads.\n\n1. **The changelog** for every release crossed. When it names each feature and what it is for, it is enough: open a feature's code only once you are about to recommend it, to cite its evidence.\n2. **Where upstream changed**, when there is no changelog or it is too thin to judge from — a reference repo usually has none. Start from `vendy git <name> log --oneline <from>..<to>` and the diffstat `vendy update` printed; for a large update, `vendy diff <name> <from>..<to> --dirstat` shows it by directory.\n\n## 3. Trace it to the map\n\nFor every use of the repo, decide:\n\n- **Unaffected** — nothing in its evidence changed in a way its code depends on.\n- **Code must follow** — a breaking change, a deprecation, or a new recommended way of doing what this use's code does. List the files in its scope and what changes, citing the upstream evidence for each.\n- **Map must follow** — a `read` path moved, the evidence now lives elsewhere, or a recommended feature's evidence lies outside the use's `read` paths.\n- **Guide must follow** — a runbook step or an explained mechanism no longer matches.\n\nThen **recommend new features** from \"What is new\": anything one of the repo's uses could take up — a simpler API for what the code does by hand, a capability the scope's feature is missing. Only what the map has a use for; new features the project has no use for are noise.\n\n## 4. Carry the project forward\n\nEverything unaffected → commit the pin (and dependency) alone and move on.\n\nAnything affected → show the user the plan from step 3, with the recommendations kept separate from the required changes, and wait. On approval: change the code, update the `read` paths and guides, run `vendy check` and the project's own checks and tests, and commit — one commit per repo, holding its pin, its dependency, and the code and guides that followed it.\n\nWhen a repo cannot be carried forward cleanly — a migration too large for this pass, tests that will not go green — stop at that repo and report. Do not continue to the next on top of a broken one. Put the repo back where it was while the user decides — `vendy pin <name> <from>` for a reference repo, `vendy track <name> <old-tag>` and the old dependency for a library — so the snapshot never describes code the project does not run.\n"
45594
45613
  },
45595
45614
  "vendor": {
45596
45615
  description: "Vendor an external repository and build with it — resolving the URL, pinning a library to its newest release and moving the dependency alongside, recording a provisional use for what the user wants from it, building the feature from its evidence, and finishing with align. Also covers vendoring a package on your own instead of reading node_modules.",
@@ -46193,7 +46212,7 @@ const withGitSeparator = (args) => {
46193
46212
  const run = (args, config) => runWith(vendy, config)(withGitSeparator(args)).pipe(provideService(Blocking, (description) => error(`waiting for file lock on ${description}`)), provideService(runner, invocation(process.cwd())), provideService(CliConfig, cliConfig), provideService(Formatter, formatter));
46194
46213
  //#endregion
46195
46214
  //#region src/main.ts
46196
- const version = "0.1.0";
46215
+ const version = "0.1.2";
46197
46216
  const isSqliteExperimentalWarning = (warning) => warning.name === "ExperimentalWarning" && warning.message.startsWith("SQLite ");
46198
46217
  for (const printWarning of process.listeners("warning")) {
46199
46218
  process.off("warning", printWarning);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zebeqo/vendy",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Let your coding agent choose, build with, and maintain vendored repos, and keep your code in step as upstream moves",
5
5
  "license": "MIT",
6
6
  "repository": {