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
2 changes: 1 addition & 1 deletion site/bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 10 additions & 4 deletions site/content/about.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: About
description: What Straitjacket is, who builds it, and why it exists.
order: 9
order: 2
---

Straitjacket is a fast, deterministic scanner that flags the weird code and
Expand All @@ -17,12 +17,18 @@ pattern-level: Straitjacket tells you what is in the source, not what it means.
The reasoning behind the rule set is written down in
[the project philosophy](/project/philosophy/).

Straitjacket is built by
[Powderworks](https://powderworks.dev), an independent workshop of open-source
developer tools maintained by Zack Maril. The code is MIT-licensed and lives on
Straitjacket is built by [The Powderworks Agentic Code
Consortium](https://powderworks.dev), and maintained by
[Zack](https://github.com/zmaril). The code is MIT-licensed and lives on
[GitHub](https://github.com/PowderworksCode/straitjacket), where releases,
checksums, and the full commit history are public.

If you want to shape what it catches — a new smell, a false positive you should
not have to live with — the [contributing guide](/project/contributing/) is
the way in.

## Newsletter

Releases, and notes on building software with agents.

<iframe class="embed" title="Subscribe to the Powderworks newsletter" src="https://newsletter.powderworks.dev/embed" scrolling="no"></iframe>
2 changes: 1 addition & 1 deletion site/content/guides/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: How-to guides
description: Recipes for getting a specific job done with Straitjacket.
order: 2
order: 3
---

Each one is a focused recipe for a single job, assuming you already know the
Expand Down
12 changes: 4 additions & 8 deletions site/content/index.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
---
title: Straitjacket
description: A secret scanner, but for slop.
tab-title: Straitjacket by Powderworks
---

<!-- straitjacket-allow-file:emoji — the sample scan output quotes an emoji finding, so the literal is what is being demonstrated -->

<p class="cover"><img src="/strait-waistcoat.jpg" alt="Engraving of a patient restrained in a strait-waistcoat" width="220"></p>
<p class="cover"><img src="/strait-waistcoat.jpg" alt="Engraving of a patient restrained in a strait-waistcoat" width="220"><span class="credit">An 1838 engraving of a <a href="https://en.wikipedia.org/wiki/Straitjacket">strait-waistcoat</a>. <a href="https://wellcomecollection.org/works/dh2xhuph">Wellcome Collection</a>, <a href="https://creativecommons.org/publicdomain/mark/1.0/">Public Domain Mark</a>.</span></p>

**A secret scanner, but for slop.**

[Get started](/getting-started/) · [Read the docs](/guides/) · [Browse the rules](/reference/rules/) · [GitHub](https://github.com/PowderworksCode/straitjacket)

Straitjacket is a fast, deterministic scanner that flags the weird code and
text LLMs produce. It sweeps your files against a set of
snobby-but-configurable rules and flags anything it finds — one static Rust
binary, no runtime, so it drops into any repo's CI regardless of language or
stack.

[Get started](/getting-started/) · [Read the docs](/guides/) · [Browse the rules](/reference/rules/) · [GitHub](https://github.com/PowderworksCode/straitjacket)

```sh
curl -fsSL https://raw.githubusercontent.com/PowderworksCode/straitjacket/main/install.sh | sh
```
Expand Down Expand Up @@ -63,8 +64,3 @@ straitjacket: 5 error(s), 0 warning(s) across 128 file(s); 0 suppressed

Encode your taste as deterministic checks and run them across everything an
LLM writes — so you never have to go "Yuck!" by hand again.

---

Banner engraving: *Insane patient in a strait-waistcoat*, Wellcome Collection
(L0011301), [CC BY 4.0](https://creativecommons.org/licenses/by/4.0).
2 changes: 1 addition & 1 deletion site/content/project/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Project
description: Where Straitjacket came from, how to contribute a new smell, and the license.
order: 3
order: 4
---

Where Straitjacket came from, how to contribute a new smell, and the license
Expand Down
2 changes: 1 addition & 1 deletion site/content/reference/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Reference
description: Specifications — every rule, flag, Action input, and marker.
order: 4
order: 5
---

Dry, complete, and accurate. Come here to look something up, not to learn — the
Expand Down
2 changes: 1 addition & 1 deletion site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.0",
"private": true,
"scripts": {
"build": "rm -rf out && powderworks-docs build content --out out --site-url https://straitjacket.dev --name Straitjacket --description \"A secret scanner, but for slop.\" --github PowderworksCode/straitjacket --license MIT --logo /strait-face.png --static public",
"build": "rm -rf out && powderworks-docs build content --out out --site-url https://straitjacket.dev --name Straitjacket --description \"A secret scanner, but for slop.\" --github PowderworksCode/straitjacket --logo /strait-face.png --copyright \"Zack Maril\" --wordmark Straitjacket --wordmark-font '\"Manufacturing Consent\"' --wordmark-woff2 /manufacturing-consent-latin.woff2 --wordmark \"The Powderworks Agentic Code Consortium\" --wordmark-font '\"IM Fell English SC\"' --wordmark-woff2 /im-fell-english-sc-latin.woff2 --wordmark Powderworks --wordmark-font '\"IM Fell English SC\"' --wordmark-woff2 /im-fell-english-sc-latin.woff2 --static public",
"deploy": "wrangler deploy",
"dev": "wrangler dev",
"test": "bun test"
Expand Down
93 changes: 93 additions & 0 deletions site/public/im-fell-english-sc-OFL.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
Copyright (c) 2010, Igino Marini (mail@iginomarini.com)

This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL


-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------

PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.

The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.

DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.

"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).

"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).

"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.

"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.

PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:

1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.

2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.

3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.

4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.

5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.

TERMINATION
This license becomes null and void if any of the above conditions are
not met.

DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
Binary file added site/public/im-fell-english-sc-latin.woff2
Binary file not shown.
92 changes: 92 additions & 0 deletions site/public/manufacturing-consent-OFL.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
Copyright 2019 The Manufacturing Consent Project Authors (https://github.com/googlefonts/manufacturing-consent-font)

This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
https://openfontlicense.org

-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------

PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.

The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.

DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.

"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).

"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).

"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.

"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.

PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:

1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.

2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.

3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.

4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.

5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.

TERMINATION
This license becomes null and void if any of the above conditions are
not met.

DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
Binary file added site/public/manufacturing-consent-latin.woff2
Binary file not shown.
29 changes: 27 additions & 2 deletions site/tests/titles.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
//
// A page's <title> and its <h1> come from one frontmatter field, by separate
// paths through the generator. Asserting they agree catches either path
// dropping the title, which is how the tab broke.
// dropping the title, which is how the tab broke. A page may say `tab-title`
// to break that tie on purpose; then the tab must be exactly what it asked
// for, which is the same assertion pointed at a different source.
import { afterAll, describe, expect, test } from "bun:test";
import { build } from "powderworks-docs/src/build.mjs";
import { mkdtempSync, readdirSync, readFileSync, rmSync } from "node:fs";
Expand All @@ -20,8 +22,25 @@ await build(join(import.meta.dir, "..", "content"), out, {
name: SITE_NAME,
description: "A secret scanner, but for slop.",
github: "PowderworksCode/straitjacket",
wordmarks: [{ text: SITE_NAME }],
});

function tabTitlesByEmittedUrl(dir, trail = []) {
const found = new Map();
for (const entry of readdirSync(dir, { withFileTypes: true })) {
if (entry.isDirectory()) {
for (const [url, value] of tabTitlesByEmittedUrl(join(dir, entry.name), [...trail, entry.name]))
found.set(url, value);
} else if (entry.name.endsWith(".md")) {
const slug = entry.name.slice(0, -3);
const declared = /^tab-title:\s*(.+)$/m.exec(readFileSync(join(dir, entry.name), "utf8"));
if (declared)
found.set("/" + [...trail, ...(slug === "index" ? [] : [slug])].join("/"), declared[1].trim());
}
}
return found;
}

function pages(dir, trail = []) {
const found = [];
for (const entry of readdirSync(dir, { withFileTypes: true })) {
Expand All @@ -32,6 +51,7 @@ function pages(dir, trail = []) {
}

const built = pages(out);
const overrides = tabTitlesByEmittedUrl(join(import.meta.dir, "..", "content"));

describe("rendered titles", () => {
test("the build emitted a page for every section and leaf", () => {
Expand All @@ -42,12 +62,17 @@ describe("rendered titles", () => {
test(`${url} names itself in the tab`, () => {
const html = readFileSync(file, "utf8");
const title = /<title>([\s\S]*?)<\/title>/.exec(html)?.[1] ?? "";
const heading = /<h1[^>]*>([\s\S]*?)<\/h1>/.exec(html)?.[1] ?? "";
const heading = (/<h1[^>]*>([\s\S]*?)<\/h1>/.exec(html)?.[1] ?? "")
.replace(/<[^>]*>/g, "");

expect(title).not.toBe("");
expect(title).not.toContain("undefined");
expect(heading).not.toBe("");

if (overrides.has(url)) {
expect(title).toBe(overrides.get(url));
return;
}
const [name, ...rest] = title.split(" — ");
expect(name).toBe(heading);
expect(rest.join(" — ")).toBe(url === "/" ? "" : SITE_NAME);
Expand Down