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
19 changes: 11 additions & 8 deletions src/examples.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Curated interactive examples: real inputs and terminal output captured from
// actual `flashtrace` runs (v0.7.0). No in-browser execution - the CLI needs
// actual `flashtrace` runs (v0.12.0). No in-browser execution - the CLI needs
// node:fs and git, so v1 ships pre-computed, trustworthy captures.
import { esc } from './layout.mjs';

Expand Down Expand Up @@ -27,9 +27,12 @@ export function colorizeReport(text) {
s = s.replace(/^( )(needs|covers|wanted by)( )/gm, '$1<span class="t-dim">$2</span>$3');
s = s.replace(/^Summary$/m, '<span class="t-bold">Summary</span>');
s = s.replace(/^( items +\d+ )(\(.*\))$/m, '$1<span class="t-dim">$2</span>');
s = s.replace(/^( ok +)(\d+)$/m, '$1<span class="t-green">$2</span>');
s = s.replace(
/^( ok +)(\d+)( \(.*\))?$/m,
(m, pre, n, breakdown) =>
`${pre}<span class="t-green">${n}</span>${breakdown ? `<span class="t-dim">${breakdown}</span>` : ''}`,
);
s = s.replace(/^( defective +)([1-9]\d*)$/m, '$1<span class="t-red">$2</span>');
s = s.replace(/^( )(of the ok items.*)$/m, '$1<span class="t-dim">$2</span>');
s = s.replace(/^ok$/m, '<span class="t-green t-bold">ok</span>');
s = s.replace(/^not ok$/m, '<span class="t-red t-bold">not ok</span>');
return s;
Expand All @@ -38,7 +41,7 @@ export function colorizeReport(text) {
export const heroTerminal = {
command: 'npx flashtrace',
output: `Summary
items 2 (1 from markdown, 1 from code)
items 2 (1 from specs, 1 from code)
ok 2
defective 0

Expand All @@ -50,7 +53,7 @@ export const examples = [
id: 'clean',
title: 'A clean, deep-covered trace',
blurb:
'A requirement needs an implementation at any 2.x revision; the wildcard resolves to impl:login#2.4 and the whole chain is deep-covered.',
'A requirement accepts anything within revision 2 - the 2.x wildcard resolves to impl:login#2.4 and the whole chain is deep-covered.',
command: 'flashtrace -v',
files: [
{
Expand Down Expand Up @@ -78,7 +81,7 @@ export function login(token: SessionToken) {
needs impl:login#2.x (→ impl:login#2.4) ✔ login.ts:1

Summary
items 2 (1 from markdown, 1 from code)
items 2 (1 from specs, 1 from code)
ok 2
defective 0

Expand Down Expand Up @@ -119,7 +122,7 @@ test('login opens a session', () => { ... });`,
• uncovered: needs test:auth/login#2, which does not exist (revision mismatch: existing revision(s) of test:auth/login: 1)

Summary
items 3 (1 from markdown, 2 from code)
items 3 (1 from specs, 2 from code)
ok 1
defective 2

Expand Down Expand Up @@ -165,7 +168,7 @@ export function openSession(token: SessionToken) { ... }`,
needs impl:auth#1 ✔ auth.ts:1

Summary
items 3 (2 from markdown, 1 from code)
items 3 (2 from specs, 1 from code)
ok 3
defective 0

Expand Down
9 changes: 5 additions & 4 deletions src/landing.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export function login(token) {
snippet: `$ npx flashtrace

Summary
items 3 (1 from markdown, 2 from code)
items 3 (1 from specs, 2 from code)
ok 3
defective 0

Expand Down Expand Up @@ -124,11 +124,12 @@ const highlightSnippet = (text) => highlightTokens(esc(text));
const features = [
['Zero runtime dependencies', 'One self-contained script. Vendor it or install it - nothing else comes along.', null],
['Runs anywhere', 'Everything Node.js ≥ 18 runs on: your laptop, your CI, your air-gapped build box.', null],
['Many languages', 'Tags live in ordinary comments - C-family, Python, Ruby, shell, SQL, Lua, HTML, Vue and more.', '/docs/code-tags/'],
['Many languages (40+)', 'A tag is just a comment, so one syntax spans them all: C-family, hash (Python, shell, ..), SQL, Lua, HTML, ...', '/docs/code-tags/'],
['Deep, transitive coverage', 'An item is only deep-covered when its whole tracing chain is. Broken links show up wherever they hide.', '/docs/coverage-rules/'],
['Wildcards &amp; forwarding', 'Accept any 2.x revision, or delegate a requirement’s obligation to another item with a forwarding tag.', '/docs/forwarding/'],
['SemVer revisions &amp; wildcards', 'Revisions match as SemVer versions - 2.4 equals 2.4.0 - and a 2.x wildcard accepts anything within revision 2.', '/docs/revisions/'],
['Forwarding', 'Delegate a requirement’s obligation to another item with a forwarding tag - coverage follows the chain.', '/docs/forwarding/'],
['Git-aware scanning', 'Files ignored by git are excluded automatically - no config to keep in sync.', '/docs/usage/'],
['CI-friendly', 'Plain-text report, meaningful exit codes: 0 clean, 1 defects found, 2 usage error.', '/docs/command-line/'],
['Rich, CI-friendly reports', 'A readable text report or deterministic, schema-backed JSON on stdout - and meaningful exit codes: 0 clean, 1 defects found, 2 usage error.', '/docs/json-report/'],
];

function featureGrid() {
Expand Down