///|
/// A reusable profile for MoonBit package acceptance checklists.
pub fn moonbit_acceptance_profile() -> Array[Rule] {
[
Rule::must_contain_any(
"moonbit-primary-language",
"MoonBit is named as the primary implementation language",
"identity",
Error,
12,
["moonbit"],
"State the implementation language clearly in README and release notes.",
),
Rule::must_contain_any(
"readme-purpose",
"Project purpose is explained",
"readme",
Error,
10,
["purpose", "problem", "use case", "scenario"],
"Describe what the package does and why a developer should use it.",
),
Rule::must_contain_any(
"usage-example",
"Runnable usage example is documented",
"example",
Error,
12,
["moon run", "example", "usage"],
"Include a command that a reviewer can copy and execute.",
),
Rule::must_contain_any(
"test-command",
"Test command is documented",
"testing",
Error,
12,
["moon test", "tests"],
"Expose the verification path and keep it aligned with CI.",
),
Rule::must_contain_any(
"ci-command",
"Continuous integration is described",
"ci",
Warning,
8,
["github actions", "ci", "moon check"],
"Mention the automated check/build/test workflow.",
),
Rule::must_contain_any(
"mooncakes-release",
"Mooncakes release path is present",
"release",
Error,
12,
["mooncakes", "moon publish", "moon publish --dry-run"],
"Explain how the package is published and verified on mooncakes.io.",
),
Rule::must_contain_any(
"license-declared",
"Open source license is declared",
"license",
Error,
10,
["mit", "apache-2.0", "license"],
"Declare the OSI license and keep third-party notes explicit.",
),
Rule::requires_pair(
"dry-run-before-publish",
"Dry-run is paired with publish command",
"release",
Warning,
6,
"moon publish",
"moon publish --dry-run",
"A dry-run step makes the release flow reproducible before upload.",
),
Rule::section_order(
"readme-flow",
"README follows a reviewer-friendly order",
"readme",
Warning,
8,
["overview", "installation", "usage", "testing", "license"],
"Reviewers should be able to scan from purpose to validation quickly.",
),
Rule::max_line_length(
"readable-line-budget",
"Lines stay readable in terminals",
"style",
Info,
4,
120,
"Short lines make diffs and review comments easier to inspect.",
),
Rule::must_not_contain_any(
"no-placeholder-smell",
"Common placeholder smells are absent",
"quality",
Warning,
6,
["todo", "fixme", "lorem ipsum", "coming soon"],
"Remove stale placeholders before release.",
),
]
}
///|
/// A compact profile for changelog and release-note text.
pub fn release_note_profile() -> Array[Rule] {
[
Rule::must_contain_any(
"version",
"Release version is visible",
"release",
Error,
10,
["0.", "1.", "version"],
"Name the released version.",
),
Rule::must_contain_any(
"changes",
"Changes are summarized",
"release",
Error,
10,
["added", "changed", "fixed", "removed"],
"Release notes should summarize user-visible changes.",
),
Rule::must_contain_any(
"verification",
"Verification command is included",
"testing",
Warning,
8,
["moon test", "moon check", "moon build"],
"Keep release notes tied to reproducible validation.",
),
Rule::must_not_contain_any(
"no-private-token",
"Private token wording is absent",
"security",
Error,
12,
["password", "secret token", "private key"],
"Do not include credentials or sensitive operational details.",
),
]
}
///|
/// A profile for compact project briefs and application forms.
pub fn application_profile() -> Array[Rule] {
[
Rule::must_contain_any(
"clear-boundary",
"Functional boundary is stated",
"scope",
Error,
12,
["scope", "boundary", "does not support", "non-goals"],
"Acceptance is easier when supported and unsupported areas are explicit.",
),
Rule::must_contain_any(
"maintenance-value",
"Maintenance value is stated",
"maintenance",
Warning,
8,
["maintain", "roadmap", "future", "extension"],
"Show why the package is worth maintaining after the event.",
),
Rule::must_contain_any(
"originality",
"Originality or reference status is declared",
"license",
Error,
10,
["original", "reference", "third-party", "license"],
"Clarify whether the package is original or derived from another project.",
),
]
}
///|
/// Built-in sample used by `moon run cmd/main`.
pub fn example_text() -> String {
(
#|# Constraint Lens
#|
#|## Overview
#|
#|Constraint Lens is a MoonBit package for explainable project text audits.
#|Its purpose is to help maintainers check README files, release notes, and
#|acceptance briefs before publishing a MoonBit package.
#|
#|## Installation
#|
#|Install through mooncakes.io after the repository owner publishes the
#|package. The package name is WB-ai-nb/constraint-lens.
#|
#|## Usage
#|
#|Run the embedded example:
#|
#|```bash
#|moon run cmd/main
#|```
#|
#|## Testing
#|
#|Run moon check, moon build, and moon test before release.
#|
#|## Release
#|
#|Run moon publish --dry-run before moon publish, then verify the package on
#|mooncakes.io.
#|
#|## License
#|
#|The project is released under the MIT license and uses no third-party code.
)
}