cli-e2e-test-authoring

A guide for writing end-to-end tests for the Packmind command-line tool. End-to-end tests run the real command-line program and check its behavior in realistic temporary or authenticated environments.

In plain words
What is it for?
Use it to add or update test specifications in `apps/cli-e2e-tests/` for Packmind CLI commands.
Why use it?
It explains which test helpers and setup to use, reducing mistakes when testing commands that need files, a user session, or an API.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/packmindhub/packmind/cli-e2e-test-authoring
Any agent
npx skills add PackmindHub/packmind --skill cli-e2e-test-authoring
Clone the repo
git clone --depth 1 https://github.com/PackmindHub/packmind

Made for: Claude Code, Codex.

Per session 56 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,487 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00056 $0.01487
Opus 5 $0.00028 $0.00744
Sonnet 5 $0.00011 $0.00297
Haiku 4.5 $0.00006 $0.00149

Measured 2d ago against content hash 04c70970c6fc, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

cli-e2e-test-authoring scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/skills/cli-e2e-test-authoring/SKILL.md · 192 lines

How it starts

The opening of the file, as written. The whole thing — 192 lines — stays where its author put it; the contents beside it link to each section on GitHub.

CLI E2E Test Authoring

Overview

Add end-to-end tests that exercise the Packmind CLI binary (dist/apps/cli/main.cjs) in realistic conditions. Tests run the actual CLI as a child process and, when authentication is needed, interact with a running API via HTTP gateways.

Test File Location

All spec files live in apps/cli-e2e-tests/src/ and follow the naming convention <command>.spec.ts.

Choosing a Test Wrapper

Two wrappers are available depending on whether the command requires authentication.

Unauthenticated commands — describeWithTempSpace

Provides an isolated temporary directory. No API required.

import { describeWithTempSpace, runCli } from './helpers';

describeWithTempSpace('my-command without auth', (getContext) => {
  let result: Awaited<ReturnType<typeof runCli>>;

  beforeEach(async () => {
    const { testDir } = await getContext();
    result = await runCli('my-command', { cwd: testDir });
  });

  it('exits with code 1', () => {
    expect(result.returnCode).toBe(1);
  });

  it('shows an error message', () => {
    expect(result.stdout).toContain('No credentials found');
  });
});

Authenticated commands — describeWithUserSignedUp

Extends describeWithTempSpace by creating a real user account, signing in, and generating an API key. Requires a running API at http://localhost:4200.

import { describeWithUserSignedUp, runCli } from './helpers';

describeWithUserSignedUp('my-command with auth', (getContext) => {
  let result: Awaited<ReturnType<typeof runCli>>;

  beforeEach(async () => {
    const { apiKey, testDir } = await getContext();
    result = await runCli('my-command', { apiKey, cwd: testDir });
  });

  it('succeeds', () => {
    expect(result.returnCode).toBe(0);
  });

  it('displays expected output', () => {
    expect(result.stdout).toContain('Expected text');
  });
});

The context object from describeWithUserSignedUp provides:

Field Description
testDir Isolated temporary directory
apiKey Valid API key for the created user
user User object (email, etc.)
organization Organization the user belongs to
spaceId Global space ID for the organization
gateway Authenticated gateway to call the API directly

Read the full file on GitHub · 192 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 192 lines · 56 tokens per session scan A 04c70970c6fc

Subscribe to this mod's changes

cli-e2e-test-authoring is a skill published in the GitHub repository PackmindHub/packmind (306 stars, last pushed 4d ago), licensed Apache-2.0. It adds 56 tokens to every session and 1,487 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.