Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

fix(cli): past-end token offsets print reversed output ranges

Open Beginner friendly
#273 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
node.js, typescript
Domain
cli

Research direction

The issue points to token pagination in src/Cli.ts:1622–1630; start by reading that range and the Global options and Token pagination section of README.md. Reproduce with the provided fixture and compare the footer for a past-end offset with the exact-end and limit controls. Done when the past-end footer shows a coherent empty range or a clear bounds error, while the controls retain their reported behavior.

Written by the indexing model from the issue text.

Description

Summary

A nonnegative token offset beyond the total output length returns an empty slice but labels it as a reversed range, such as showing tokens 100000–13 of 13.

Steps to reproduce

In a fresh directory, run npm install --no-save --package-lock=false --ignore-scripts [email protected] and save this complete fixture as cli.mjs:

import { Cli } from 'incur';
await Cli.create('demo', { sync: false, update: false })
  .command('hello', {
    run: () => ({ message: 'one two three four five six seven eight nine ten' }),
  })
  .serve();

Run:

node cli.mjs hello --token-count
node cli.mjs hello --token-offset 100000
node cli.mjs hello --token-offset 13
node cli.mjs hello --token-offset 0
node cli.mjs hello --token-limit 5

The same fixture was also executed against the default-branch source by changing its import to the clone's src/index.ts and running with node --import tsx. Both builds produced the results below.

Expected behavior

The pagination footer should describe a coherent output window with a start no greater than its end. Skipping beyond the output end can yield an empty result or an explicit bounds error; it should not claim to show a reversed range.

Actual behavior

All commands exit 0. Token count is 13. The past-end case prints:


[truncated: showing tokens 100000–13 of 13]

The exact-end control prints an empty slice with 13–13 of 13; zero offset returns the complete message without a truncation footer; the positive limit returns message: one two with 0–5 of 13.

Evidence

  • Expected source: README.md, Global options and Token pagination, describes --token-offset as skipping the first n tokens; the generated footer itself claims to describe the shown token range.
  • Failure source: The standalone fixture on both builds. src/Cli.ts:1622–1630 retains the requested offset but clamps only the end when constructing the footer.
  • Evidence provenance: observed
  • Local verification: reproduced
  • Reproduction completeness: complete

Restoration check

Repeat the past-end case and require a coherent empty-window range or a clear bounds error. Preserve the exact-end empty window, zero-offset full result, and positive-limit controls.

Runtime or environment

  • Package version: [email protected], the latest published npm release at verification.
  • Default-branch source: main at e0c4a1a8f62631d66997a4427ce8b3f961e9d95e, executed directly through [email protected] with the same resolved runtime dependencies as the release install, including [email protected]; this was not the repository's frozen lockfile dependency tree.
  • Runtime: Node.js 26.12.0, macOS arm64. Bash controls, where used: 3.2.57(1)-release and 5.3.20(1)-release.

Check existing issues

  • I checked open and closed issues and pull requests for this behavior.

Additional context

Existing negative-bound report https://github.com/wevm/incur/issues/247 and its open fix reject negative inputs. This case uses a finite nonnegative integer and has a separate restoration signal; rejecting negatives leaves it unchanged. This report concerns range metadata, not token slicing accuracy.

Triage assessment

  • Impact level: P3
  • Assessment status: supported
  • Impact basis: The observed defect is the footer wording for an empty past-end window. The slice is empty as expected; no wrong nonempty content, persistent change, or broken continuation was observed.
  • Workaround status: available
  • Workaround basis: Use --token-count to avoid requesting an offset beyond the reported total. The count and exact-end controls were verified on both builds.
Dominant language
TypeScript
Stars
632
Forks
38
Avg merge
2h 47m
Merged PRs (30d)
6

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from wevm/incur

All issues in wevm/incur

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.