Skip to content

chore: Knip in check, declare long, ci-bun pack smoke test - #195

Merged
neoromantic merged 4 commits into
mainfrom
chore/knip-quality
Nov 18, 2026
Merged

neoromantic merged 4 commits into
mainfrom
chore/knip-quality

Conversation

@neoromantic

Copy link
Copy Markdown
Owner

Adds Knip to bun run check, fixes what it found, and moves the npm tarball smoke test to devkit's ci-bun pack step.

Changes

  • fix(deps): declare long (^5.3.2, lock stays at 5.3.2). src/utils/long.ts and src/utils/raw-json.ts import it, but it only arrived through @mtcute/core. Changelog entry under Unreleased → Fixed.
  • chore: check:knip (Knip 6.45.1, exact devDependency) runs at the end of bun run check. It checks files, dependencies, devDependencies, unlisted and unresolved imports, and binaries, but not exports, which are public API. knip.json lists two extra entries: the root index.ts shim and session-exit-child.ts, which a test spawns by path. Removes the unused test helper src/__tests__/helpers/snapshots.ts.
  • ci: the build job sets pack: true and pack-args: '[["--help"],["--version"]]', so the tarball is installed in a clean project and tg --help/tg --version run with no credentials. The repo's pack job becomes binary: it compiles dist/tg and runs --version and --help in an empty environment. The tarball steps it duplicated are removed. The required check is still ci.

Verification

  • bun run check (Biome, tsc, Knip): passes.
  • Knip fails, as it should, on an injected unused file and an injected unlisted import.
  • pack-smoke from devkit v1 with [["--help"],["--version"]]: passes; the packed tg prints 0.14.0.
  • bun run build, then dist/tg --version/--help under env -i: passes.
  • actionlint 1.7.7 and zizmor 1.32.0 (offline) on ci.yml: no findings.
  • Unit and e2e acceptance is this PR's CI. Locally as root, three permission tests fail the same way on unmodified main.

No version bump: the release procedure handles that.

🤖 Generated with Claude Code

neoromantic and others added 4 commits November 18, 2026 13:25
src/utils/long.ts and src/utils/raw-json.ts import `long` directly, but it
reached node_modules only as a dependency of @mtcute/core. An install that
doesn't hoist transitive dependencies would leave tg unable to start. Knip
reports it as an unlisted dependency.

The range ^5.3.2 matches what @mtcute already resolves, so the lockfile keeps
[email protected].

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`bun run check` now ends with `check:knip`, which runs Knip 6.45.1 (exact
devDependency) on files, dependencies, devDependencies, unlisted and
unresolved imports and binaries. Exports and types stay out of scope: they
are tg's public API.

knip.json adds two entries on top of what Knip finds from package.json
(bin, scripts, bun test):
- index.ts, the root shim that runs src/index.ts, which Knip's default entry
  covered until an explicit `entry` replaced the defaults;
- src/__tests__/helpers/session-exit-child.ts, which daemon-platform.test.ts
  spawns by path.

src/__tests__/helpers/snapshots.ts had no importers and is not packaged, so
it is removed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
ci-bun (devkit v1.6) can pack the package, install the tarball in a clean
project outside the checkout and run every bin with an allowlisted
environment and a fresh HOME. The build job turns it on with
pack-args '[["--help"],["--version"]]', so `tg --help` and `tg --version`
still run from the packed package with no Telegram credentials.

That replaces the tarball steps of the repo's own pack job. The job keeps
what devkit doesn't cover, the compiled single-file binary that releases
ship: it is renamed `binary`, builds dist/tg and runs `--version` and
`--help` in an empty environment. The required check is still `ci`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
docs/testing.md imported snapshotLines from src/__tests__/helpers/snapshots.ts,
which the Knip commit removed as unused. The example now mirrors the
snapshots block in src/__tests__/output.test.ts, which spies on console.log.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@neoromantic
neoromantic merged commit 9d8470d into main Nov 18, 2026
5 checks passed
@neoromantic
neoromantic deleted the chore/knip-quality branch November 18, 2026 12:40
ertembiyik added a commit to ertembiyik/telegram-sync-cli that referenced this pull request Nov 18, 2026
main now has neoromantic#195: Knip in bun run check, and long as a runtime dependency. No conflict; the check is clean.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
ertembiyik added a commit to ertembiyik/telegram-sync-cli that referenced this pull request Nov 18, 2026
main now has neoromantic#195: Knip in bun run check, and long as a runtime dependency. No conflict; the check is clean.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
ertembiyik added a commit to ertembiyik/telegram-sync-cli that referenced this pull request Nov 18, 2026
main now has neoromantic#195: Knip in bun run check, and long as a runtime dependency. No conflict; the check is clean.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
ertembiyik added a commit to ertembiyik/telegram-sync-cli that referenced this pull request Nov 18, 2026
main now has neoromantic#195: Knip in bun run check, and long as a runtime dependency. No conflict; the check is clean.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
ertembiyik added a commit to ertembiyik/telegram-sync-cli that referenced this pull request Nov 18, 2026
main now has neoromantic#195: Knip in bun run check, and long as a runtime dependency. No conflict; the check is clean.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
ertembiyik added a commit to ertembiyik/telegram-sync-cli that referenced this pull request Nov 18, 2026
main now has neoromantic#195: Knip in bun run check, and long as a runtime dependency. No conflict; the check is clean.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
ertembiyik added a commit to ertembiyik/telegram-sync-cli that referenced this pull request Nov 18, 2026
main now has neoromantic#195: Knip in bun run check, and long as a runtime dependency. No conflict; the check is clean.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
ertembiyik added a commit to ertembiyik/telegram-sync-cli that referenced this pull request Nov 18, 2026
main now has neoromantic#195: Knip in bun run check, and long as a runtime dependency. No conflict; the check is clean.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
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.

1 participant