Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,15 @@ IF THESE COMMANDS FAIL, CI WILL FAIL, AND YOUR PR WILL BE REJECTED OUT OF HAND.
FIXING ERRORS FROM THESE COMMANDS IS YOUR HIGHEST PRIORITY.
ENSURE YOU DO THE RIGHT THINGS TO MAKE THEM PASS.
```sh
npx hereby build # Build the project
npx hereby test # Run tests
npx hereby lint # Run linters
npx hereby format # Format the code
npx hereby validate # Build, test, lint, and format the project

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

One of the things I want to do in this file is to make it clear that the build, test, lint, just matter when editing the tsc dir.

We can probably do that in a followup, as the "CRITICAL" language here should really be in the CCA file instead

```
</critical>

If you are writing or testing TS API features (eg, code in packages/typescript/src/api/async/api.ts), additionally, you need to run
```sh
npx hereby test:api
npx hereby validate --api # Also run the TypeScript API tests
```
which is not run as part of the primary suite.
instead. API tests are not run by `npx hereby validate` without `--api`.

## Compiler Features, Fixes, and Tests

Expand Down Expand Up @@ -134,10 +131,8 @@ Were alternate fixes considered? Describe them briefly if so
## Copilot Checklist

<!-- don't lie! -->
I successfully ran these commands at the end of my session, and they completed without error:
* [ ] npx hereby build
* [ ] npx hereby test
* [ ] npx hereby lint
* [ ] npx hereby format
I successfully ran the applicable command at the end of my session, and it completed without error:
* [ ] npx hereby validate
* [ ] npx hereby validate --api (for TypeScript API changes)

```
38 changes: 38 additions & 0 deletions Herebyfile.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ const { values: rawOptions } = parseArgs({
options: {
tests: { type: "string", short: "t" },
fix: { type: "boolean" },
api: { type: "boolean" },
debug: { type: "boolean" },
dirty: { type: "boolean" },
release: { type: "boolean" },
Expand Down Expand Up @@ -1364,6 +1365,43 @@ async function runFormat() {
await run("dprint", ["fmt"]);
}

export const validate = task({
name: "validate",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We have a lot of terms, test, check, validate... Sort of wonder if we should somehow name this with "all" in the name to make it very clear what must be done

description: "Builds, tests, lints, and formats the repo. Pass --api to include API tests.",
dependencies: [build],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I didn't notice this, but yeah build doesn't need to be a dep, right? nothing needs that to have happened? I guess the API does?

@weswigham Wesley Wigham (weswigham) Sep 4, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The API needs it to work and I have doubts on if lint, test, and format would reliably work in the presence of a non-functioning build.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

So right, I was just surprised by it being a dep versus another func call, but it doesn't practically matter.

run: async () => {
/** @type {{ name: string; error: unknown }[]} */
const failures = [];
/** @param {string} name @param {() => Promise<void>} action */
const runValidation = async (name, action) => {
try {
await action();
}
catch (error) {
failures.push({ name, error });
console.error(styleText("red", `${name} failed; continuing validation.`));
}
};

await runValidation("test", async () => {
await runTests();
await runTestExtension();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we take the time now to get these extension tests out too into their own task? I've been wanting hereby test to not run them.

});
if (options.api) {
await runValidation("test:api", runTestAPI);
}
await runValidation("lint", runLint);
await runValidation("format", runFormat);

if (failures.length) {
throw new AggregateError(
failures.map(failure => failure.error),
`Validation failed: ${failures.map(failure => failure.name).join(", ")}`,
);
}
},
});

export const checkFormat = task({
name: "check:format",
description: "Checks that the repo is formatted.",
Expand Down