Skip to content
Merged
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
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
15 changes: 15 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: Bug report
about: Help us reproduce a real problem
labels: bug
---

Version, Node version, OS, shell and terminal/font:

Minimal command or API call (remove sensitive data):

Expected behavior:

Actual output and exit status:

Does --no-color or change the result?
11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
name: Feature request
about: A useful idea with questionable priorities
labels: enhancement
---

Developer problem:

Example command/API and expected output:

Compatibility, accessibility and offline-runtime considerations:
11 changes: 11 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## Behavior

What does a user see before and after?

## Compatibility

Describe API/output changes and migration requirements.

## Validation

List checks and meaningful regression coverage. Confirm workplace-safe humor and useful error handling. No npm publication is implied by this PR.
12 changes: 10 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,26 @@ permissions:
contents: read
jobs:
check:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
node: [22, 24]
os: [ubuntu-latest]
include:
- { os: windows-latest, node: 24 }
- { os: macos-latest, node: 24 }
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: npm
- run: npm ci
- run: npm run build
- run: npm run lint
- run: npm run format:check
- run: npm test
- run: npm run coverage
- run: npm run test:types
- run: npm run verify:package
- run: npm pack --dry-run
- run: npm audit --omit=dev --audit-level=high
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ node_modules/
coverage/
.env
.env.*

dist/
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
node_modules/
package-lock.json

dist/
coverage/
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 0.3.0 — 2026-10-08

- Useful structured API/CLI additions described in README.
- TypeScript declarations, CommonJS entry, coverage gates and installed archive checks.
- Linux Node 22/24 plus Windows/macOS Node 24 CI.

## 0.2.0 — 2026-10-08

- Meeting preparation mode: Generate 1–20 excuses with `excuseBatch(category, { count, seed })`. A batch cycles through the category without repeats until its pool is exhausted. Seeds keep the starting point repeatable. CLI `--json` returns a string or array.
Expand Down
5 changes: 5 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Community conduct

Be kind, specific and curious. Welcome beginners, respect different backgrounds, and critique code without attacking people. Harassment, discrimination, threats and publishing private information are not welcome. Keep humor workplace-safe.

Maintainers may remove harmful contributions and restrict repeated misconduct. Report conduct concerns privately through a maintainer's GitHub profile contact method; do not post sensitive details in public issues. Maintainers should explain decisions respectfully and handle reports confidentially where possible.
19 changes: 3 additions & 16 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,7 @@
# Contributing

Welcome! Keep jokes original, workplace-safe, and about technology rather than people.
Welcome to DeployAnyway: tools for developers who probably know better. Keep the core independently useful, offline, and workplace-safe. Use Node 22.13+ or 24, npm ci and a feature branch.

Use Node 22.13+ or 24. Create a feature branch, run `npm ci`, and add phrases
to `src/excuses.js`. Categories must be lowercase and contain nonempty strings.
Keep at least three phrases per category. Add tests when changing behavior.
Source lives in src/; CLI orchestration is measured alongside the API. Add meaningful behavior and failure tests. Run npm run build, npm run format, npm run lint, npm run format:check, npm run coverage, npm run test:types, npm run verify:package and npm audit.

Before submitting a PR, run:

```sh
npm run format
npm run lint
npm run format:check
npm test
npm pack --dry-run
```

Describe changes and validation. Changing phrase order or count can change seeded
output; mention it in the changelog. Discuss public API changes in an issue first.
Coverage gates: 90% statements/lines/functions and 85% branches. Archive checks install a temporary local tarball and never publish. Document API/output changes and show a concrete use case in your PR. See CODE_OF_CONDUCT.md and SECURITY.md. Release candidates require explicit publication approval.
5 changes: 5 additions & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# 0.3.0 migration

Node 22.13+ is required. Existing core APIs remain available; TypeScript declarations and CommonJS exports are new. The CLI now lives in src/cli.js behind the same executable path. Input/stdout behavior for new options is documented in README.

Install 0.3.0 with npm. Seeds and exact humorous wording are version-specific. Do not treat jokes or heuristic scores as production evidence.
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# excuse-js

> **Version 0.3.0:** install from npm with Node 22.13+ or Node 24. See MIGRATION.md for changes from 0.2.0.

[![npm version](https://img.shields.io/npm/v/%40deployanyway%2Fexcuse-js)](https://www.npmjs.com/package/@deployanyway/excuse-js)
[![CI](https://github.com/DeployAnyway/excuse-js/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/DeployAnyway/excuse-js/actions/workflows/ci.yml)

Expand Down Expand Up @@ -126,3 +128,41 @@ API (import the named functions from this package):
```js
excuseBatch("deployment", { count: 3, seed: "demo" });
```

## Jokes with a useful exit strategy

```js
import { excuseReport } from "@deployanyway/excuse-js";
const report = excuseReport("testing", { seed: 42 });
console.log(report.excuse);
console.log(report.nextStep);
```

The structured report pairs the original comic excuse with a category-specific, honest next step. It does not invent evidence or recommend lying. Seeds are stateless and version-specific; numeric 42 differs from the CLI's string seed "42".

```sh
node bin/cli.js testing --report --seed demo
node bin/cli.js deployment --report --json
```

--report cannot be combined with --count or --list. Existing string and batch JSON output stays available. No stdin is needed: this generator has no external input payload. Do not use jokes as incident reports.

## Run from source

```sh
git clone --branch main https://github.com/DeployAnyway/excuse-js.git
cd excuse-js
npm ci
npm run build
node bin/cli.js --help
```

## Candidate quality standard

Version 0.3 provides useful declaration types, ESM/CommonJS exports, installed-archive checks, and coverage gates (90% statements/lines/functions, 85% branches). CI covers Linux Node 22/24 and Windows/macOS Node 24. Node 22.13+ is required. No runtime dependencies, telemetry or network requests.

From a source checkout: npm ci, npm run build, npm run coverage, npm run test:types, npm run verify:package. Pack verification installs a temporary local archive and checks module entries, types, executable and offline npm exec.

[Contribution guide](CONTRIBUTING.md) · [Conduct](CODE_OF_CONDUCT.md) · [Security](SECURITY.md) · [Roadmap](ROADMAP.md) · [Migration](MIGRATION.md).

**Tools for developers who probably know better.** Software nobody requested, built with questionable priorities, and shipped with absolute confidence!
3 changes: 3 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 0.3.0 — 2026-10-08

Adds useful API/CLI capabilities, TypeScript and CommonJS, coverage and installed-archive gates, and consistent contributor documentation. See README and MIGRATION.md for behavior and compatibility. Published through the repository’s trusted GitHub Actions workflow.
13 changes: 13 additions & 0 deletions ROADMAP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Roadmap

## Now

Useful structured APIs, explicit validation, types, ESM/CommonJS, installed-archive checks, coverage gates, cross-platform CI and honest release-candidate documentation.

## Next

Collect user feedback and real integrations. Prioritize evidence-based improvements over more flags.

## Later

Optional adapters to other DeployAnyway tools through public APIs or pipes. Keep runtime dependencies and telemetry out unless justified separately.
7 changes: 7 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Security

The package works offline, without telemetry, network requests, shell execution or executable character loading. Avoid logging secrets. Treat user-provided messages as untrusted data; terminal emulators can interpret control sequences. These tools are not redaction or terminal-sanitization boundaries.

Use GitHub Security → Report a vulnerability if available, or contact a maintainer privately through their GitHub profile. Include affected version, reproduction and impact; do not post credentials or exploit details in public issues. No response-time guarantee is promised.

The 0.3 feature branch is an unreleased candidate. Visual output is not a machine-readable protocol or security boundary; use JSON for automation.
61 changes: 1 addition & 60 deletions bin/cli.js
Original file line number Diff line number Diff line change
@@ -1,61 +1,2 @@
#!/usr/bin/env node
import { parseArgs } from "node:util";
import { readFileSync } from "node:fs";
import { URL } from "node:url";
import { excuse, categories, excuseBatch } from "../src/index.js";

try {
const { values, positionals } = parseArgs({
allowPositionals: true,
options: {
help: { type: "boolean", short: "h" },
version: { type: "boolean", short: "v" },
seed: { type: "string" },
list: { type: "boolean" },
count: { type: "string" },
json: { type: "boolean" },
},
});
if (values.help) {
console.log(
"Usage: excuse-js [category] [--seed text] [--count 3] [--json]\n\nDefault category: deployment\n\nOptions:\n --seed text Repeatable selection (always a string seed)\n --count 1..20 Prepare a batch for the meeting\n --json Structured string or batch\n --list List categories\n -h, --help Show help\n -v, --version Show version\n\nExample: excuse-js deployment --seed demo\nExit codes: 0 success; 2 invalid arguments.",
);
} else if (values.version) {
console.log(
JSON.parse(
readFileSync(new URL("../package.json", import.meta.url), "utf8"),
).version,
);
} else if (values.list) {
if (
positionals.length ||
values.seed !== undefined ||
values.count !== undefined ||
values.json
)
throw new TypeError("--list does not accept a category or seed.");
console.log(categories().join("\n"));
} else {
if (positionals.length > 1)
throw new TypeError("Provide only one category.");
if (values.count !== undefined && !/^[0-9]+$/.test(values.count))
throw new TypeError("count must be an integer.");
const result =
values.count === undefined
? excuse(positionals[0], { seed: values.seed })
: excuseBatch(positionals[0], {
seed: values.seed,
count: Number(values.count),
});
console.log(
values.json
? JSON.stringify(result)
: Array.isArray(result)
? result.map((line, i) => `${i + 1}. ${line}`).join("\n")
: result,
);
}
} catch (error) {
console.error(`excuse-js: ${error.message}\nRun with --help for usage.`);
process.exitCode = 2;
}
import "../src/cli.js";
4 changes: 2 additions & 2 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
export default [
{
ignores: ["node_modules/**"],
ignores: ["node_modules/**", "dist/**", "coverage/**"],
},
{
files: ["**/*.js"],
languageOptions: {
ecmaVersion: "latest",
sourceType: "module",
globals: { console: "readonly", process: "readonly" },
globals: { console: "readonly", process: "readonly", Buffer: "readonly" },
},
rules: {
"no-unused-vars": "error",
Expand Down
30 changes: 30 additions & 0 deletions index.d.cts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
export type Category =
| "deployment"
| "build"
| "production"
| "bug"
| "api"
| "database"
| "deadline"
| "testing"
| "network"
| "merge-conflict"
| "demo";
export interface ExcuseOptions {
seed?: string | number;
}
export interface ExcuseReport {
category: Category;
excuse: string;
nextStep: string;
}
export function categories(): Category[];
export function excuse(category?: Category, options?: ExcuseOptions): string;
export function excuseBatch(
category?: Category,
options?: ExcuseOptions & { count?: number },
): string[];
export function excuseReport(
category?: Category,
options?: ExcuseOptions,
): ExcuseReport;
30 changes: 30 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
export type Category =
| "deployment"
| "build"
| "production"
| "bug"
| "api"
| "database"
| "deadline"
| "testing"
| "network"
| "merge-conflict"
| "demo";
export interface ExcuseOptions {
seed?: string | number;
}
export interface ExcuseReport {
category: Category;
excuse: string;
nextStep: string;
}
export function categories(): Category[];
export function excuse(category?: Category, options?: ExcuseOptions): string;
export function excuseBatch(
category?: Category,
options?: ExcuseOptions & { count?: number },
): string[];
export function excuseReport(
category?: Category,
options?: ExcuseOptions,
): ExcuseReport;
Loading
Loading