diff --git a/.changeset/anonymous-quiet-notice.md b/.changeset/anonymous-quiet-notice.md new file mode 100644 index 000000000..c3d73c9a9 --- /dev/null +++ b/.changeset/anonymous-quiet-notice.md @@ -0,0 +1,5 @@ +--- +"@taskless/cli": patch +--- + +`check --anonymous` no longer prints "Rules were not verified" on every run in a project with no runtime rules. The flag already asks for an unverified run, so the notice only repeated it back into every local and CI log. Static rules still run unverified exactly as before. A project with runtime rules keeps the notice, since it is what says those rules were skipped, and every other unverified cause (no token, no repository URL, a reconcile that cannot complete) still prints its notice and remedy. diff --git a/openspec/changes/archive/2026-12-01-anonymous-quiet-notice/.openspec.yaml b/openspec/changes/archive/2026-12-01-anonymous-quiet-notice/.openspec.yaml new file mode 100644 index 000000000..785b15074 --- /dev/null +++ b/openspec/changes/archive/2026-12-01-anonymous-quiet-notice/.openspec.yaml @@ -0,0 +1,2 @@ +schema: spec-driven +created: 2026-12-01 diff --git a/openspec/changes/archive/2026-12-01-anonymous-quiet-notice/proposal.md b/openspec/changes/archive/2026-12-01-anonymous-quiet-notice/proposal.md new file mode 100644 index 000000000..2a8be9aa3 --- /dev/null +++ b/openspec/changes/archive/2026-12-01-anonymous-quiet-notice/proposal.md @@ -0,0 +1,25 @@ +## Why + +Issue #732: a project that runs only local static rules uses `check --anonymous` on purpose, and every run prints `Notice: Rules were not verified: --anonymous was set. ... Run check without --anonymous to verify them.` For that project the notice describes the expected state and asks them to undo a choice they made deliberately. It lands in every local and CI log, reads like a warning, and nothing turns it off. + +`--anonymous` is already the explicit statement "do not verify". Repeating it back on every run carries no information, except when it has a consequence the person may not have noticed: runtime rules that did not run. + +## What Changes + +- `check --anonymous` in a project with no runtime rules emits no not-verified notice. Static rules still run unverified, exactly as before. +- `check --anonymous` in a project with runtime rules keeps the notice, since those rules were skipped and the notice is what says so. +- Every other unverified cause (no token, no repository URL, a reconcile that cannot complete) is unchanged: those runs did not ask to skip verification, so the notice still names the fix. + +No new flag or `taskless.json` setting: the flag already records the choice. + +Not breaking. The bump is `patch`. + +## Delivery shape + +**Single PR.** One branch in `planCheck`, its tests, and the spec delta land together with the archive. + +## Impact + +- `packages/cli/src/rules/plan-check.ts` +- `packages/cli/test/runtime-check.test.ts` +- `openspec/specs/cli-check/spec.md` diff --git a/openspec/changes/archive/2026-12-01-anonymous-quiet-notice/specs/cli-check/spec.md b/openspec/changes/archive/2026-12-01-anonymous-quiet-notice/specs/cli-check/spec.md new file mode 100644 index 000000000..42c55bdd2 --- /dev/null +++ b/openspec/changes/archive/2026-12-01-anonymous-quiet-notice/specs/cli-check/spec.md @@ -0,0 +1,83 @@ +## MODIFIED Requirements + +### Requirement: Check accepts --anonymous as a no-op + +The `taskless check` command SHALL accept the global `--anonymous` flag (per the `cli` +capability). Because `check` reconciles against the Taskless API when authenticated, +`--anonymous` SHALL force the logged-out path: it SHALL suppress the reconcile network call +and run all local static rules. Aside from forcing the logged-out path, `--anonymous` SHALL NOT +change scan behavior, output shape, or exit codes relative to an unauthenticated `check`. The +not-verified notice SHALL name `--anonymous` as its cause rather than authentication, and SHALL +be omitted when the project has no runtime rules (see the requirement on unverified runs). + +#### Scenario: check --anonymous skips reconciliation + +- **WHEN** a user runs `taskless check --anonymous` +- **THEN** the CLI SHALL NOT call `POST /cli/api/v2/reconcile` +- **AND** SHALL scan all local static rules + +#### Scenario: check --anonymous matches an unauthenticated check + +- **WHEN** a user runs `taskless check --anonymous` +- **THEN** its scan behavior, output shape, and exit code SHALL match `taskless check` run with + no available token +- **AND** only the not-verified notice SHALL differ: its cause and remedy, and its absence when + the project has no runtime rules + +### Requirement: Check names the remedy when rules run unverified + +Whenever `taskless check` runs rules without verifying them, because `--anonymous` is set, +no token is available, no GitHub repository URL resolves, or reconciliation cannot complete, +it SHALL emit exactly one notice that says the rules were not verified, states the cause, and +names what would let verification happen. The notice SHALL be emitted whether or not the +project has runtime rules, with one exception: when `--anonymous` is set and the project has no +runtime rules, `check` SHALL emit no not-verified notice, because the person asked for an +unverified run and nothing they wrote was skipped. It SHALL NOT change the exit code. It SHALL be a single line, cause +and remedy together, so that under `--json` it is one entry in the `notices` array; in human +output it SHALL be written to stderr marked as a notice. `--dangerously-run-scripts` is excluded: it carries its own warning. + +The remedy SHALL be specific to the cause: + +- `--anonymous`: run `check` without `--anonymous`. +- No token: `taskless auth login`, or a `TASKLESS_TOKEN` where `check` runs in CI. +- No repository URL: which of the three problems applies (not a git repository, no `origin` + remote, or an `origin` that is not GitHub) and the step for that problem. +- A rejected token: re-authenticate with `taskless auth login`, or replace the token. +- `404 organization_not_found`: the same steps `rule create` gives for that code, confirming + the Taskless GitHub App installation covers the repository and re-authenticating with + `taskless auth login`. + +#### Scenario: Logged out with no runtime rules still says so + +- **WHEN** a user runs `taskless check` with no available token in a project with no runtime rules +- **THEN** the CLI SHALL emit one notice that the rules were not verified +- **AND** the notice SHALL name `auth login` +- **AND** the exit code SHALL NOT change because of the notice + +#### Scenario: Anonymous names the flag, not authentication + +- **WHEN** a user runs `taskless check --anonymous` in a project with runtime rules +- **THEN** the notice SHALL name `--anonymous` as the cause and running without it as the remedy +- **AND** the notice SHALL say how many runtime rules did not run + +#### Scenario: Anonymous with no runtime rules prints no notice + +- **WHEN** a user runs `taskless check --anonymous` in a project with no runtime rules +- **THEN** the CLI SHALL emit no not-verified notice, in text output or in the `--json` `notices` array +- **AND** SHALL still scan all local static rules with an unchanged exit code + +#### Scenario: A missing origin is named as such + +- **WHEN** an authenticated `check` runs in a git repository with no `origin` remote +- **THEN** the notice SHALL say the repository has no `origin` remote and how to add one + +#### Scenario: Organization not found carries the installation remedy + +- **WHEN** reconciliation returns `404 organization_not_found` +- **THEN** the notice SHALL name confirming the Taskless GitHub App installation and re-authenticating with `auth login` + +#### Scenario: The notice is a notices entry under --json + +- **WHEN** `taskless check --json` runs unverified +- **THEN** the `notices` array SHALL contain the notice +- **AND** `success`, `results`, and `skipped` SHALL keep their existing meaning diff --git a/openspec/changes/archive/2026-12-01-anonymous-quiet-notice/tasks.md b/openspec/changes/archive/2026-12-01-anonymous-quiet-notice/tasks.md new file mode 100644 index 000000000..a4c9c5fb7 --- /dev/null +++ b/openspec/changes/archive/2026-12-01-anonymous-quiet-notice/tasks.md @@ -0,0 +1,6 @@ +## 1. Quiet anonymous notice + +- [x] 1.1 In `planCheck`, return a plan with no notice when `--anonymous` is set and no runtime rules were discovered +- [x] 1.2 Test: `--anonymous` without runtime rules prints no notice, in text and `--json` +- [x] 1.3 Test: `--anonymous` with runtime rules still prints the notice naming the skipped rules +- [x] 1.4 Update the `cli-check` spec requirements for `--anonymous` and the unverified notice diff --git a/openspec/specs/cli-check/spec.md b/openspec/specs/cli-check/spec.md index 4cb0b91a1..c9dc3659b 100644 --- a/openspec/specs/cli-check/spec.md +++ b/openspec/specs/cli-check/spec.md @@ -276,7 +276,8 @@ capability). Because `check` reconciles against the Taskless API when authentica `--anonymous` SHALL force the logged-out path: it SHALL suppress the reconcile network call and run all local static rules. Aside from forcing the logged-out path, `--anonymous` SHALL NOT change scan behavior, output shape, or exit codes relative to an unauthenticated `check`. The -not-verified notice SHALL name `--anonymous` as its cause rather than authentication. +not-verified notice SHALL name `--anonymous` as its cause rather than authentication, and SHALL +be omitted when the project has no runtime rules (see the requirement on unverified runs). #### Scenario: check --anonymous skips reconciliation @@ -289,7 +290,8 @@ not-verified notice SHALL name `--anonymous` as its cause rather than authentica - **WHEN** a user runs `taskless check --anonymous` - **THEN** its scan behavior, output shape, and exit code SHALL match `taskless check` run with no available token -- **AND** only the cause and remedy named in the not-verified notice SHALL differ +- **AND** only the not-verified notice SHALL differ: its cause and remedy, and its absence when + the project has no runtime rules ### Requirement: Check error output uses standardized error envelope @@ -800,7 +802,9 @@ Whenever `taskless check` runs rules without verifying them, because `--anonymou no token is available, no GitHub repository URL resolves, or reconciliation cannot complete, it SHALL emit exactly one notice that says the rules were not verified, states the cause, and names what would let verification happen. The notice SHALL be emitted whether or not the -project has runtime rules. It SHALL NOT change the exit code. It SHALL be a single line, cause +project has runtime rules, with one exception: when `--anonymous` is set and the project has no +runtime rules, `check` SHALL emit no not-verified notice, because the person asked for an +unverified run and nothing they wrote was skipped. It SHALL NOT change the exit code. It SHALL be a single line, cause and remedy together, so that under `--json` it is one entry in the `notices` array; in human output it SHALL be written to stderr marked as a notice. `--dangerously-run-scripts` is excluded: it carries its own warning. @@ -824,8 +828,15 @@ The remedy SHALL be specific to the cause: #### Scenario: Anonymous names the flag, not authentication -- **WHEN** a user runs `taskless check --anonymous` +- **WHEN** a user runs `taskless check --anonymous` in a project with runtime rules - **THEN** the notice SHALL name `--anonymous` as the cause and running without it as the remedy +- **AND** the notice SHALL say how many runtime rules did not run + +#### Scenario: Anonymous with no runtime rules prints no notice + +- **WHEN** a user runs `taskless check --anonymous` in a project with no runtime rules +- **THEN** the CLI SHALL emit no not-verified notice, in text output or in the `--json` `notices` array +- **AND** SHALL still scan all local static rules with an unchanged exit code #### Scenario: A missing origin is named as such diff --git a/packages/cli/src/rules/plan-check.ts b/packages/cli/src/rules/plan-check.ts index 777029217..e65062c92 100644 --- a/packages/cli/src/rules/plan-check.ts +++ b/packages/cli/src/rules/plan-check.ts @@ -136,6 +136,13 @@ export async function planCheck( } if (options.anonymous) { + // `--anonymous` already says "do not verify". With nothing skipped, a + // notice would only repeat that back on every run (#732). Runtime rules + // that did not run are a consequence worth naming, so they keep it. + if (discovered.length === 0) { + log.write("unverified run: `--anonymous` was set, no runtime rules"); + return empty; + } return unverified(discovered, { cause: "`--anonymous` was set", remedy: ["Run `check` without `--anonymous` to verify them."], diff --git a/packages/cli/test/runtime-check.test.ts b/packages/cli/test/runtime-check.test.ts index e2780328a..8364369dc 100644 --- a/packages/cli/test/runtime-check.test.ts +++ b/packages/cli/test/runtime-check.test.ts @@ -378,9 +378,34 @@ describe("check: static vs runtime dispatch", () => { const { stderr } = await runCli(["check", "-d", directory, "--anonymous"]); expect(stderr).toContain("Rules were not verified: `--anonymous` was set."); expect(stderr).toContain("without `--anonymous`"); + expect(stderr).toContain("1 runtime rule(s) did not run"); expect(stderr).not.toContain("auth login"); }); + it("--anonymous with no runtime rules: no notice, static rules still run (#732)", async () => { + await rm(join(directory, ".taskless", "runtime"), { + recursive: true, + force: true, + }); + const human = await runCli(["check", "-d", directory, "--anonymous"]); + expect(human.stderr).not.toContain("Rules were not verified"); + expect(human.stdout).toContain("no-console"); + + const { stdout, exitCode } = await runCli([ + "check", + "-d", + directory, + "--anonymous", + "--json", + ]); + const output = parseJson(stdout); + expect(exitCode).toBe(0); + expect(output.results.some((r) => r.ruleId === "no-console")).toBe(true); + expect(output.notices?.join("\n") ?? "").not.toMatch( + /Rules were not verified/ + ); + }); + it.each([ { name: "no origin remote",