Skip to content
Closed
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
2 changes: 1 addition & 1 deletion .agents/checks/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Rules lint and types can't express. Most are written in `AGENTS.md` and `CODEBAS
- Reference parsing (ids, URLs, fuzzy names) written again instead of using `src/lib/refs.ts`.
- A positional `[workspace-ref]` without the `--workspace` alias, or one that accepts both without an error.
- A new top-level command not wired into the lazy registry in `src/index.ts`.
- A barrel file, or a helper that duplicates one in `src/lib/` or `@doist/cli-core`. Where cli-core has a convention, the CLI follows it.
- A barrel file, or a helper that duplicates one in `src/lib/` or `@todoist/cli-core`. Where cli-core has a convention, the CLI follows it.

## Fine

Expand Down
2 changes: 1 addition & 1 deletion .agents/checks/evidence.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Apply to the PR description and any report from an agent.

- A behaviour claim ("fixed", "works", "safe", "no regressions") with no test or command that ran it.
- A "Not verified" section missing when something could not be checked: the real Comms API, output in a real terminal, the other Node version CI tests on.
- A change to shared code (`src/lib/`, command registration or global flags in `src/index.ts`, an `@doist/cli-core` or `@doist/comms-sdk` upgrade) without the one fact that makes it safe.
- A change to shared code (`src/lib/`, command registration or global flags in `src/index.ts`, an `@todoist/cli-core` or `@todoist/comms-sdk` upgrade) without the one fact that makes it safe.
- A PR title whose type doesn't match the change: behaviour changes need `feat:`, `fix:` or `perf:` to release (`!` for breaking); tooling and docs use `chore:`, `ci:`, `docs:` or `test:` so they don't.

## Fine
Expand Down
4 changes: 2 additions & 2 deletions .agents/scripts/instructions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ it('lists every skill in AGENTS.md, and only those', () => {
expect(listedUnder(text, '## Skills').toSorted()).toEqual(skills.toSorted())
})

it('names only test helpers that the fixtures, global-args or @doist/cli-core/testing export', async () => {
it('names only test helpers that the fixtures, global-args or @todoist/cli-core/testing export', async () => {
const skill = readFileSync(join(SKILLS_DIR, 'write-tests/SKILL.md'), 'utf8')
const section = skill.split('## Helpers')[1]?.split('\n## ')[0] ?? ''
const named = [...section.matchAll(/`(\w+)`/g)].map((match) => match[1] ?? '')
Expand All @@ -161,7 +161,7 @@ it('names only test helpers that the fixtures, global-args or @doist/cli-core/te
),
].map((match) => match[1]),
)
const shared = Object.keys(await import('@doist/cli-core/testing'))
const shared = Object.keys(await import('@todoist/cli-core/testing'))
expect(named.length).toBeGreaterThan(5)
expect(named.filter((name) => !local.includes(name) && !shared.includes(name))).toEqual([])
})
Expand Down
2 changes: 1 addition & 1 deletion .agents/skills/review-changes/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Done when the brief is written and the tree holds only the change, with no secre
## 2. Run the reviews in parallel

- **Task review**, always: a fresh subagent with the brief and the diff. It looks for missing pieces, unrequested changes, unhandled cases, tests that would pass with the feature broken, and, in a refactor, any changed test input or assertion. Doistbot can't do this: it never sees the task.
- **Blast-radius review**, when the change alters code others rely on: `src/lib/` (the client and caches in `src/lib/api.ts` above all), command registration, global flags or argv handling in `src/index.ts`, the `@doist/cli-core` or `@doist/comms-sdk` version, other `package.json` dependencies, build or CI config. It names the one fact that makes the change safe and proves it by running code. It looks where text search stops: library versions in `package-lock.json`, the shape of API responses, scripts and installed skills reading `--json` output.
- **Blast-radius review**, when the change alters code others rely on: `src/lib/` (the client and caches in `src/lib/api.ts` above all), command registration, global flags or argv handling in `src/index.ts`, the `@todoist/cli-core` or `@todoist/comms-sdk` version, other `package.json` dependencies, build or CI config. It names the one fact that makes the change safe and proves it by running code. It looks where text search stops: library versions in `package-lock.json`, the shape of API responses, scripts and installed skills reading `--json` output.
- **Code review**: Doistbot if it is set up (below). Otherwise one subagent per relevant check in `.agents/checks/`, each with the brief and that check.

Every brief says: **the shared working tree is read-only.** A reviewer that needs to run or break code makes its own copy with `npm run review:worktree -- <dir>`, then `npm ci` in it, and removes it after.
Expand Down
2 changes: 1 addition & 1 deletion .agents/skills/verify/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Rate every claim on this ladder:

Claims about behaviour ("fixed", "works", "safe", "no regressions") need **ran** or higher. A fact the code shows needs **cited**. Anything lower goes under **Not verified**, with why.

For a change to code others rely on (shared helpers in `src/lib/`, command registration and global flags in `src/index.ts`, an `@doist/cli-core` or `@doist/comms-sdk` upgrade), name the one fact that makes it safe, and how you proved it.
For a change to code others rely on (shared helpers in `src/lib/`, command registration and global flags in `src/index.ts`, an `@todoist/cli-core` or `@todoist/comms-sdk` upgrade), name the one fact that makes it safe, and how you proved it.

Report format:

Expand Down
2 changes: 1 addition & 1 deletion .agents/skills/write-tests/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ description: Writes or changes tests in this repository to its quality bar, with

## Helpers

From `src/lib/__fixtures__/accounts.ts`: `STORED_ALAN`, `STORED_ELLIE`, `ACCOUNT_ALAN`, `ACCOUNT_ELLIE`. From `@doist/cli-core/testing`: `createTestProgram`, `captureConsole`, `captureStream`, `describeEmptyMachineOutput` (the shared check that `--json` and `--ndjson` print nothing extra for an empty result). Reset global flag state between tests with `resetGlobalArgs` from `src/lib/global-args.ts`.
From `src/lib/__fixtures__/accounts.ts`: `STORED_ALAN`, `STORED_ELLIE`, `ACCOUNT_ALAN`, `ACCOUNT_ELLIE`. From `@todoist/cli-core/testing`: `createTestProgram`, `captureConsole`, `captureStream`, `describeEmptyMachineOutput` (the shared check that `--json` and `--ndjson` print nothing extra for an empty result). Reset global flag state between tests with `resetGlobalArgs` from `src/lib/global-args.ts`.

## The quality bar

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/issue-automation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ jobs:
- name: Add issue to project
uses: actions/add-to-project@27022a19346d0433f2b9859dd2b69d38f4277808
with:
project-url: https://github.com/orgs/Doist/projects/83
project-url: https://github.com/orgs/todoist/projects/83
github-token: ${{ secrets.HERO_BOARD_PAT }}
140 changes: 140 additions & 0 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
name: Publish retained release

on:
workflow_dispatch:
inputs:
artifact_run_id:
description: Successful Release artifact run ID
required: true
artifact_run_attempt:
description: Original successful build attempt (never a later rerun)
required: true
source_sha:
description: Full reviewed build commit SHA
required: true
destination:
type: choice
options: [both, github, npmjs]
default: both
tag:
type: choice
options: [normal, migration-recovery]
default: normal
workflow_run:
workflows: [Release artifact]
types: [completed]
branches: [main, next]

permissions:
contents: read
actions: read
packages: write
id-token: write

# Serialize both channels and all mirror retries; do not cancel an in-flight publish.
concurrency:
group: comms-cli-publication
cancel-in-progress: false

jobs:
publish:
if: >-
(github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main') ||
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' &&
github.event.workflow_run.event == 'push' && vars.COMMS_CLI_AUTOMATIC_RELEASES == 'true')

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.

P2 SDK-update releases can never auto-publish, and their artifacts block later builds. update-comms-sdk.yml pushes its commit with GITHUB_TOKEN (which does not trigger workflows) and then runs gh workflow run release.yml, so the only build for an SDK bump is a workflow_dispatch run — and this condition requires workflow_run.event == 'push', so it never publishes even after COMMS_CLI_AUTOMATIC_RELEASES=true. Since prepare-release.mjs fails any later push build while an unrecorded artifact exists (Retained release ... is not recorded), every SDK update also bricks the next main build until a maintainer manually dispatches publish-release.yml. Fix by having update-comms-sdk.yml push with the release bot app token (producing a real push-event build that auto-publishes) or by dispatching publish-release.yml itself after the artifact build succeeds.

environment: npm-release
runs-on: ubuntu-latest
timeout-minutes: 30
env:
ARTIFACT_RUN_ID: ${{ inputs.artifact_run_id || github.event.workflow_run.id }}
ARTIFACT_RUN_ATTEMPT: ${{ inputs.artifact_run_attempt || github.event.workflow_run.run_attempt }}
RELEASE_SHA: ${{ inputs.source_sha || github.event.workflow_run.head_sha }}
steps:
# Validation/publishing code always comes from the publisher's reviewed default branch.
- uses: actions/checkout@v6
with:
ref: ${{ github.sha }}
fetch-depth: 0
- uses: actions/setup-node@v6
with:
node-version-file: .nvmrc
- name: Validate successful source run
id: source
env:
GH_TOKEN: ${{ github.token }}
run: |
mkdir -p .tmp
node scripts/validate-source-run.mjs
- uses: actions/download-artifact@v4
if: steps.source.outputs.available == 'true'
with:
name: ${{ steps.source.outputs.artifact }}
path: .tmp/release
run-id: ${{ env.ARTIFACT_RUN_ID }}
github-token: ${{ github.token }}
- name: Verify retained bytes and select channel
id: artifact
if: steps.source.outputs.available == 'true'
env:
GH_TOKEN: ${{ github.token }}
REQUESTED_TAG: ${{ inputs.tag || 'normal' }}
run: |
node scripts/release.mjs verify .tmp/release
node --input-type=module <<'JS'
import fs from 'node:fs'
const release = JSON.parse(fs.readFileSync('.tmp/release/release.json'))
const tag = process.env.REQUESTED_TAG === 'migration-recovery' ? 'migration-recovery' : release.branch === 'next' ? 'next' : 'latest'
fs.appendFileSync(process.env.GITHUB_ENV, `RELEASE_TAG=${tag}\n`)
fs.appendFileSync(process.env.GITHUB_OUTPUT, `version=${release.version}\n`)
JS
- name: Publish missing npm mirror using configured trust
if: steps.source.outputs.available == 'true' && inputs.destination != 'github'
env:
GH_TOKEN: ${{ github.token }}
GH_PACKAGES_TOKEN: ${{ github.token }}
run: node scripts/release.mjs publish .tmp/release npmjs

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.

P2 This automatic npmjs publish has no npm credentials. scripts/release.mjs publish ... npmjs uses command: 'publish', which skips the interactive npm login that only bootstrap-npm performs, strips NODE_AUTH_TOKEN/NPM_TOKEN from the isolated environment, and then publishes with --provenance=false, so it never enters the OIDC trusted-publishing path either. Once COMMS_CLI_AUTOMATIC_RELEASES=true is enabled, this step will fail with ENEEDAUTH. Use trusted publishing (provenance) for later npmjs releases or supply a scoped npm token that the isolated npmjs environment retains.

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.

P2 Each publish/check-registry invocation re-enters release.mjs verify(), which re-downloads the full GitHub artifact through compareRetainedArtifact and re-inspects the tarball. The job already ran the same verify in the previous step, and record-release.mjs (line 121) repeats it three more times internally, so a normal both publish downloads and hashes the same artifact roughly eight times. Add a lightweight mode for the subsequent publish/check-registry/record steps (or pass the already-verified metadata/tarball) while keeping the per-write registry preflights.

- name: Publish missing GitHub mirror
if: steps.source.outputs.available == 'true' && inputs.destination != 'npmjs'
env:
GH_TOKEN: ${{ github.token }}
GH_PACKAGES_TOKEN: ${{ github.token }}
run: node scripts/release.mjs publish .tmp/release github
- name: Require identical bytes in both registries
if: steps.source.outputs.available == 'true'
env:
GH_TOKEN: ${{ github.token }}
GH_PACKAGES_TOKEN: ${{ github.token }}
run: |
node scripts/release.mjs check-registry .tmp/release npmjs
node scripts/release.mjs check-registry .tmp/release github
- name: Generate release-record token
if: steps.source.outputs.available == 'true' && env.RELEASE_TAG != 'migration-recovery'
id: generate_token
uses: actions/create-github-app-token@v3
with:
app-id: ${{ secrets.DOIST_RELEASE_BOT_ID }}
private-key: ${{ secrets.DOIST_RELEASE_BOT_PRIVATE_KEY }}
permission-contents: write
- name: Record release without rebuilding or recalculating
if: steps.source.outputs.available == 'true' && env.RELEASE_TAG != 'migration-recovery'
id: record
run: node scripts/record-release.mjs .tmp/release
env:
GH_TOKEN: ${{ steps.generate_token.outputs.token }}
SOURCE_GH_TOKEN: ${{ github.token }}
GH_PACKAGES_TOKEN: ${{ github.token }}
- name: Announce stable release in Comms
if: steps.record.outputs.created == 'true' && steps.source.outputs.branch == 'main'
uses: todoist/comms-actions/post-comment-action@aeeefe3270ad30d0c4cdd7dbf94b2fac1dcb8ceb
with:
comms-client-id: ${{ secrets.COMMS_DOISTBOT_CLIENT_ID }}
comms-client-secret: ${{ secrets.COMMS_DOISTBOT_CLIENT_SECRET }}
comms-username: ${{ secrets.COMMS_DOISTBOT_USER }}
comms-password: ${{ secrets.COMMS_DOISTBOT_PASSWORD }}
workspace-id: 69
thread-id: CZECS4Yebwx7c1c8hDRmB
content: >-
Comms CLI v${{ steps.artifact.outputs.version }} published.
https://github.com/todoist/comms-cli/releases/tag/v${{ steps.artifact.outputs.version }}
audience: thread
continue-on-error: true
Loading
Loading