Skip to content

Sort tasks by Taskfile definition order when using default sort #230

Closed as not planned

Description

@kyrokode

Currently, when taskfile.tree.sort is set to "default", tasks in the sidebar are displayed in the order returned by the task CLI, which does not necessarily match the order in which they are defined in the Taskfile.

This can be confusing for users who carefully organize their Taskfile, expecting the sidebar to reflect the same structure.

Proposed behavior:

When the sort mode is "default", tasks and namespaces should be sorted by their location.line property, preserving the original definition order from the Taskfile.

Example:

Given this Taskfile:

tasks:
  build:
    desc: Build the project
  test:
    desc: Run tests
  lint:
    desc: Lint the code

The sidebar should display: build, test, lint — not alphabetically or in an arbitrary order.

For namespaces (included Taskfiles), the namespace position is determined by the smallest location.line of its contained tasks, scoped to the parent Taskfile to prevent included files from pulling a namespace out of order.

Activity

  1. pd93 commented on Feb 14, 2026

    @pd93
    Member

    @kyrokode taskfile.tree.sort already does this when set to none.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions