Skip to content

feat: describe modules for Open Mercato Modules and tag them for discovery - #13

Merged
pkarw merged 22 commits into
mainfrom
catalog/metadata
Oct 29, 2026
Merged

pkarw merged 22 commits into
mainfrom
catalog/metadata

Conversation

@wojciechszyjka

@wojciechszyjka wojciechszyjka commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Base: main · Head: catalog/metadata

🎯 What changes

Modules published with this tool become easy to list in Open Mercato Modules, the module catalog (open-mercato/modules). People and coding agents use it to find modules and check which Open Mercato versions they install on.

  • New describe <module_id> command. It prints the module's catalog entry as YAML from the saved publish settings. --open opens the submit page. --package describes a module before its first publish.
  • Description. In a terminal, init asks what the module does and saves it as description in the module metadata (scripts pass --description). It must be 20 to 140 characters of plain text, the same rule as the catalog summary. publish and describe warn when a module has no usable description and name the file to fix. Before, they silently used Open Mercato module: <id>.
  • Discovery metadata. Generated package.json files get the keywords open-mercato and open-mercato-module, the description and, with a dedicated repository, homepage and bugs. Linked releases keep their own keywords and add the two when missing. After npm accepts a release, the dedicated repository gets the same two GitHub topics (best effort, like the release tag).
  • Submit link. After a public release, publish prints the submit link (/submit?npm=<package>). Generated module READMEs link it too. They show no catalog badge, because the badge exists only for a listed module. The guide explains how to add it once the module is listed.
  • Peer ranges. Published packages declare framework, React, Next.js and MikroORM peers as caret ranges of the source app's versions (^0.9.0 instead of 0.9.0). Apps on later compatible releases install them without Yarn peer warnings, and the catalog stops reporting peer-exact-pin. devDependencies keep exact versions.
  • Smaller fixes. Printed install commands name an unscoped package as npm:<name>, because a bare name means a GitHub repository. Examples install @fastwhitecat/integration-ksef-direct@0.1.8, a module that exists on npm, and use your-org/your-module as the link placeholder. The suite resolves the temp directory, so it passes on macOS without TMPDIR=/private/tmp.
  • describe reads only the exported top-level metadata binding (also export { metadata }); a local metadata inside a helper no longer overrides it.
  • describe --open prints the fallback 'Open ... in your browser.' on stderr, so redirected stdout stays valid YAML.

⚠️ Decisions to review

  • Peer ranges change a protected surface. fix: defects from the 0.5.1 end-to-end test (npm 12, Yarn age gate, release tags, unlink, CI) #12 kept published peers exact and called widening them a release decision (BACKWARD_COMPATIBILITY.md, published package layout). This PR makes that decision: caret ranges. It needs a maintainer's yes. If you want exact peers, revert fix(package): declare framework peers as caret ranges and its changelog line; nothing else depends on it.
  • Launch switch. catalogLaunched in src/package.ts is false. While it is off, every printed catalog link carries "Open Mercato Modules has not launched yet" and describe --open does not open the browser. MERCATO_CATALOG_URL (any http(s) origin, with or without a path) points the tool at another deployment and counts as open. Keep it off until the site answers. Flip it, and the "has not launched" wording in the README and the guide, in one small commit once https://modules.openmercato.com/ serves the catalog. Ideally that lands before the next release of this tool.
  • New compatibility rows. BACKWARD_COMPATIBILITY.md now protects the two keywords and topics, and the describe output, which must stay valid for the catalog's descriptor-1.json.

🌐 Catalog URLs

The site will be served from the root of https://modules.openmercato.com/ (BASE_PATH /) once the Cloudflare deploy is switched on. Every URL this PR prints or documents uses that root:

  • /submit?npm=<package> (the submit form reads the npm parameter)
  • /m/<package> and /badge/<package>.svg
  • /schema/descriptor-1.json

I checked each route against the catalog's current build. Until the Cloudflare deploy goes live, these URLs answer 404 page not found from a wildcard host. That is expected and matches the "has not launched" note.

💥 Compatibility

  • New command describe, new flags --description, --package and --open. Nothing removed.
  • init asks one more question in a terminal. Scripts are not prompted.
  • Published peerDependencies become caret ranges (see above).
  • New package.json keywords, homepage and bugs, and two repository topics. Linked repositories keep their own keywords.

🧪 Validation

Rebased onto main after #12. No conflicts: this branch was built on #12's branch, and #12's squash has the same tree. On Node 24.21.0, npm 12.1.0 (head 948c2f2):

  • npm run typecheck: passed.
  • npm run lint: passed.
  • npm test: 238 tests, 233 passed, 0 failed, 5 skipped (the opt-in framework tests that need OPEN_MERCATO_ROOT; CI's framework-tests job runs them).
  • npm pack --dry-run: passed, 59 files.
  • git diff --check: clean.
  • test/describe.test.cjs checks the describe YAML against a copy of the catalog's descriptor-1.json. The copy is refreshed in this PR to the schema the catalog publishes today (summary and whenToUse length rules, optional screenshots).
  • npm run test:release:local passed on 25 Oct on create-mercato-app@0.9.0 with this branch plus the first license commits (recorded in the stacked license PR). Later changes here touch only help text and docs. CI's release-checks jobs (npm run test:release:local) passed on head fe87a68 for create-mercato-app@0.9.0 and @latest. They passed again on head 948c2f2, as did the unit-test matrix (node 24 with npm bundled and npm 12, node 26) and the framework-tests job.

📋 Follow-up

  • The license prompt is stacked on this branch as a separate PR.

…overy

New describe <module_id> prints the module's catalog entry from saved publish
settings and its metadata, without network access; --open opens the submit
page. Generated package.json files carry the open-mercato and
open-mercato-module keywords, the metadata description, and homepage and bugs
links for a dedicated repository; linked releases merge the keywords. Once npm
accepts a release, the dedicated repository gets the matching topics, best
effort like the tag. A public release ends with the submit link.
On macOS os.tmpdir() is /var/folders/..., a symlink to /private/var, and
scaffold() rejects module paths whose realpath differs. The tests now build
their temp apps under fs.realpathSync(os.tmpdir()), as install and
framework-peers tests already did, so node --test is green with the default
TMPDIR. The real CLI is unaffected: findApp resolves the start directory.
…pull request

The submit page opens a new file on GitHub with the entry filled in; the
author commits it and opens the pull request. Agents can check the catalog,
they do not search it on their own yet.
… untouched

The catalog check rejects any file that still has a # TODO comment, even when
the value beside it is right. The header now says to delete those comments,
category gets a plain comment so a fitting default needs no edit, and a blank
line after the header keeps the file in the catalog's canonical form.
After linking pkarw/marketing-consents the README switched to visits for
publish, link and unlink. Use marketing_consents there, say that publishing
needs push and npm rights, and keep visits only as the own local module case.
Published packages pinned @open-mercato/*, React, Next.js and MikroORM
peers to the source app's exact versions, so every app on a later
compatible release got Yarn peer warnings and Open Mercato Modules
reported peer-exact-pin for every module this tool publishes. Peers are
now ^<installed version>; devDependencies keep the exact versions the
module repository builds against.
…nother origin

modules.openmercato.com does not answer yet, and the github.io origin is
404 while the catalog repository is private, yet publish, describe and
--help printed the submit link as if it worked and describe --open
opened it. The origin now lives in one place in package.ts:
- printed links carry a note that the catalog has not launched, and
  --open does not open it, until catalogLaunched is set;
- MERCATO_CATALOG_URL (http or https) points describe, --open and the
  message after publish at another deployment, such as a local copy;
- generated module READMEs, which stay on npm, always link the public
  origin.
The help, the wizard prompt and two validation messages suggested
@your-name/visits, and authors who follow them publish a package whose
bare name equals the listed @piotrkarwatka/visits; Open Mercato Modules
then reads it as a look-alike and a curator has to review the name. The
examples now say @your-name/mercato-visits, as the README already did
for packages, and the README says why the package needs a name of its
own.
…kage

describe stopped with "no saved npm package" until the first publish,
so an author could not prepare the catalog entry next to the release.
--package names the package; saved settings of another package, such as
its repository, are left out, and the entry reminds the author to
publish to npm before submitting until a release is recorded.
…cribe have none

A module without a description in its metadata was published as "Open
Mercato module: <id>" and described with a placeholder summary, and
nothing told the author. Now:
- init asks in a terminal for one sentence of 20 to 140 characters of
  plain text, the catalog summary rule, and writes it into metadata;
  scripts and agents pass --description; Enter skips;
- publish (including dry runs) warns when the package would carry the
  fallback description;
- describe warns on stderr when the description is missing or cannot be
  the summary, and says where to set it.
…alike

A linked repository's package.json kept "Open Mercato module: <id>" from
its first export, and exportLinkedPackage preferred it over the module
metadata, so following the warning changed nothing: describe printed the
new summary while every publish still warned and npm still got the
fallback. Now:
- a linked repository's description that is empty or still the fallback
  gives way to the metadata, as describe already assumed;
- describe and publish share moduleDescription and descriptionWarning, so
  they name the same file (the checkout package.json when its own
  description wins) and publish also warns about a description that cannot
  be the catalog summary; restricted packages only get the missing warning;
- the warning says the description reaches the next version you publish
  instead of "before you publish", and interactively adds how to include
  it in this version.
…until then

The guide still told authors to open the submit link that publish prints,
its sample describe output lacked the pending-launch line, and README and
guide linked modules.openmercato.com, which does not answer yet, as a
catalog that lists modules today. Name the site without a link, say it
will list modules, explain what to do before launch (prepare the entry
with describe, submit once the site opens, npm keywords meanwhile), and
show the header lines describe prints before launch and before the first
release.
…ommands

install and link read a bare name as a repository of the signed-in GitHub
user, so the generated README and the release summary sent an unscoped
package such as mercato-visits to GitHub. They now print npm:mercato-visits,
which the documented locator rules route to npm. Scoped names are unchanged.
…no warning

publish now warns about a module without a description, so the local
release checks failed their own no-warning assertion on the first
release. init gets a description, and a unit test runs the harness's
publish arguments as a dry run to keep the assertion true.
The help text, README and guide used @piotrkarwatka/marketing-consents
and pkarw/marketing-consents for install and link. The npm examples now
install @fastwhitecat/integration-ksef-direct@0.1.8, the version Open
Mercato Modules verifies on 0.8, 0.9 and next. That package has no
dedicated module repository, so link examples use the placeholder
your-org/your-module (module ID your_module) instead.
Generated module READMEs keep one line that links the submit page for
the package, built from the public catalog origin, and show no badge:
the catalog serves a badge only for a listed module. The guide gives the
badge snippet as the step after listing, and a test keeps badges out of
the generated README.
The README step that installs a published module still used
@your-name/mercato-visits as its command, while --help and the guide
install @fastwhitecat/integration-ksef-direct@0.1.8. The step now
installs that package and says that the author's own module installs
the same way under its package name.
The catalog schema now carries the summary and whenToUse length rules
and the optional screenshots field. describe output still validates.
@wojciechszyjka

Copy link
Copy Markdown
Contributor Author

🤖 Claiming this PR. Starting om-auto-fix-pr run (--no-ui). Started: 2026-10-28T15:30:47Z.

@wojciechszyjka

Copy link
Copy Markdown
Contributor Author

🤖 om-auto-review-pr taking over the chain lock. Phase: review with autofix. Started: 2026-10-28T15:30:58Z.

describe printed the saved packageName and repository from
.mercato/module-tool.json as they were. A hand-edited value with a line
break could add a line to the YAML entry and reached the browser opener.
describe now checks both with the rules publish uses.
…iption

The module description now becomes the description of a new GitHub
repository. A description with a control character, such as one written
as a TS escape, falls back to Open Mercato module: <id>, as a long one
already did, so repository creation does not fail on it.

@wojciechszyjka wojciechszyjka left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

🤖 om-auto-review-pr: code review (autofix pass)

Verdict: approvable by severity. No blocker or major finding remains. This is a comment review: the PR author and the reviewing account are the same, and this run does not approve.

Fixed in this pass

  • minor src/describe.ts: describe used the saved packageName and repository from .mercato/module-tool.json without validation. A hand-edited value with a line break added a line to the YAML entry and reached the browser opener. Both are now checked with the publish rules. Fixed in 8e19602, test in test/describe.test.cjs.
  • nit src/publish.ts: the metadata description now goes to gh repo create --description. A control character (a TS escape such as \x07) could make repository creation fail. It now falls back to Open Mercato module: <id>, as a long description does. Fixed in fe87a68, test in test/module.test.cjs.

Left for follow-up issues (non-blocking)

  • minor src/describe.ts openCatalogPage: the opener runs synchronously with captured output. On Linux xdg-open can block until the browser exits (up to the 120 s timeout). On Windows explorer exits with status 1, so the fallback line always prints. Only reachable with MERCATO_CATALOG_URL while catalogLaunched is off.
  • nit src/publish.ts addTopics: a refused topic request prints nothing, while the summary says the topics are added. A warning like tagWarning would be clearer.

Declined

  • Quoting yes/no/on/off in describe output: the catalog parses entries with yaml 2.9 (YAML 1.2), which reads them as strings.

Decision for a maintainer (not a defect)

  • Caret peer ranges (f914d4d) change the peer rules of the published package layout, a surface in BACKWARD_COMPATIBILITY.md. The PR body lists it under "Decisions to review". This run leaves it as it is.

Checked against the catalog source

Routes /submit?npm=, /m/<package>, /badge/<package>.svg and the npm query parameter match open-mercato/modules at 587b293. catalogLaunched stays false.

Validation (head fe87a68, Node 24)

Command Result
npm run typecheck pass
npm test pass: 237 tests, 232 passed, 0 failed, 5 skipped (opt-in framework tests)
npm pack --dry-run pass, 59 files
npm run lint pass

CI for fe87a68 is still running. This review does not claim it green.

@wojciechszyjka

Copy link
Copy Markdown
Contributor Author

🤖 om-auto-review-pr completed: approvable by severity, two findings fixed (8e19602, fe87a68). Lock retained. Chain continues with CI.

@wojciechszyjka

wojciechszyjka commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 om-auto-fix-pr result

Next: once CI is green, om-approve-merge-pr 13, after the maintainer decides on the peer ranges.

@wojciechszyjka wojciechszyjka removed their assignment Oct 28, 2026
@wojciechszyjka

Copy link
Copy Markdown
Contributor Author

🤖 om-auto-fix-pr completed: merge-ready by review and CI. A maintainer decision on the caret peer ranges is still open. Lock released.

@wojciechszyjka wojciechszyjka changed the title # feat: describe modules for Open Mercato Modules and tag them for discovery feat: describe modules for Open Mercato Modules and tag them for discovery Oct 28, 2026
@wojciechszyjka wojciechszyjka self-assigned this Oct 29, 2026
@wojciechszyjka

Copy link
Copy Markdown
Contributor Author

🤖 Claimed by an om-auto-fix-pr run: exported-metadata-only lookup, stderr fallback for describe --open, PR body corrections.

…n stdout clean

moduleInfo looks only at top-level statements and takes the metadata
declaration that is exported directly or named in export { metadata }, so a
local metadata inside a helper no longer overrides the title or description.
The fallback 'Open ... in your browser.' goes to stderr, so redirected
describe --open output stays valid YAML.
@wojciechszyjka

Copy link
Copy Markdown
Contributor Author

🤖 om-auto-fix-pr result for head 948c2f2:

  • moduleInfo reads only the top-level metadata declaration that is exported directly or named in export { metadata }. A local metadata in a helper (function, block, arrow function) no longer overrides the title or description, and a file whose only metadata is nested counts as missing metadata.
  • describe --open prints the fallback Open ... in your browser. on stderr, so redirected stdout stays valid YAML.
  • New tests in test/describe.test.cjs cover both. They fail on fe87a68 and pass on 948c2f2. CHANGELOG has one line per fix.
  • The PR body is corrected: the Catalog URLs wording, the two new "What changes" bullets, and the Validation results and test counts.

Local gate (Node 24.21.0, npm 12.1.0): typecheck, lint, npm test 238 tests / 233 passed / 0 failed / 5 skipped, npm pack --dry-run 59 files, git diff --check clean. All 6 CI checks pass on 948c2f2, including both release-checks lanes.

No follow-up issues were filed. This run does not approve or merge. Next step: a maintainer reviews the PR. The stacked #14 should merge catalog/metadata in.

@wojciechszyjka wojciechszyjka removed their assignment Oct 29, 2026
wojciechszyjka added a commit that referenced this pull request Oct 29, 2026
…efault-license

Brings the exported-metadata fix and the describe --open stderr fix from #13.
moduleInfo now reads title, description and license from the exported
top-level metadata binding only.
@pkarw
pkarw merged commit e032464 into main Oct 29, 2026
7 checks passed
@wojciechszyjka
wojciechszyjka requested a review from pkarw October 29, 2026 15:41
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