auditkit 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cargo.lock +1 -1
- package/Cargo.toml +4 -1
- package/LICENSE +21 -0
- package/README.md +2 -19
- package/audits/.gitkeep +1 -0
- package/package.json +15 -18
- package/scripts/auditkit/ak +10 -9
- package/scripts/lighthouse.mjs +38 -0
- package/src/main.rs +1 -5
- package/scripts/auditkit/postinstall.mjs +0 -31
package/Cargo.lock
CHANGED
package/Cargo.toml
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "auditkit"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.1"
|
|
4
4
|
edition = "2021"
|
|
5
|
+
description = "Local hybrid CLI for agency website audits."
|
|
6
|
+
license = "MIT"
|
|
7
|
+
repository = "https://github.com/Danilaa1/auditkit"
|
|
5
8
|
|
|
6
9
|
[dependencies]
|
|
7
10
|
anyhow = "1.0"
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Daniel
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -6,28 +6,11 @@ Rust runs the core workflow: audit folders, quick HTML checks, security checks,
|
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
bun install -g auditkit
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
NPM also works:
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
npm install -g auditkit
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
Run without installing globally:
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
bunx auditkit --help
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
Local development install from this project folder:
|
|
9
|
+
From this project folder:
|
|
28
10
|
|
|
29
11
|
```bash
|
|
30
12
|
npm install
|
|
13
|
+
cargo build
|
|
31
14
|
npm link
|
|
32
15
|
```
|
|
33
16
|
|
package/audits/.gitkeep
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/package.json
CHANGED
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "auditkit",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Local hybrid CLI for agency website audits.",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+ssh://git@github.com/Danilaa1/auditkit.git"
|
|
10
10
|
},
|
|
11
11
|
"files": [
|
|
12
|
-
"Cargo.toml",
|
|
13
12
|
"Cargo.lock",
|
|
14
|
-
"
|
|
15
|
-
"
|
|
13
|
+
"Cargo.toml",
|
|
14
|
+
"LICENSE",
|
|
15
|
+
"README.md",
|
|
16
16
|
"auditkit.config.json",
|
|
17
|
-
"
|
|
17
|
+
"audits/.gitkeep",
|
|
18
|
+
"docs",
|
|
19
|
+
"scripts",
|
|
20
|
+
"src"
|
|
18
21
|
],
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
"engines": {
|
|
23
|
-
"node": ">=24"
|
|
22
|
+
"bin": {
|
|
23
|
+
"auditkit": "scripts/auditkit/ak",
|
|
24
|
+
"ak": "scripts/auditkit/ak"
|
|
24
25
|
},
|
|
25
26
|
"scripts": {
|
|
26
27
|
"audit": "cargo run --quiet --",
|
|
@@ -31,10 +32,6 @@
|
|
|
31
32
|
"audit:security": "cargo run --quiet -- security",
|
|
32
33
|
"audit:lighthouse": "cargo run --quiet -- lighthouse",
|
|
33
34
|
"audit:inspect": "cargo run --quiet -- inspect",
|
|
34
|
-
"postinstall": "node scripts/auditkit/postinstall.mjs",
|
|
35
|
-
"site:dev": "npm --prefix site run dev",
|
|
36
|
-
"site:build": "npm --prefix site run build",
|
|
37
|
-
"site:preview": "npm --prefix site run preview",
|
|
38
35
|
"test": "npm run test:node && npm run test:rust",
|
|
39
36
|
"test:node": "node --test",
|
|
40
37
|
"test:rust": "cargo test"
|
package/scripts/auditkit/ak
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
#!/usr/bin/env
|
|
2
|
-
set -
|
|
1
|
+
#!/usr/bin/env zsh
|
|
2
|
+
set -euo pipefail
|
|
3
3
|
|
|
4
4
|
SOURCE="$0"
|
|
5
5
|
while [ -L "$SOURCE" ]; do
|
|
6
|
-
DIR="$(
|
|
6
|
+
DIR="$(cd "$(dirname "$SOURCE")" && pwd)"
|
|
7
7
|
TARGET="$(readlink "$SOURCE")"
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
if [[ "$TARGET" == /* ]]; then
|
|
9
|
+
SOURCE="$TARGET"
|
|
10
|
+
else
|
|
11
|
+
SOURCE="$DIR/$TARGET"
|
|
12
|
+
fi
|
|
12
13
|
done
|
|
13
14
|
|
|
14
|
-
SCRIPT_DIR="$(
|
|
15
|
-
ROOT_DIR="$(
|
|
15
|
+
SCRIPT_DIR="$(cd "$(dirname "$SOURCE")" && pwd)"
|
|
16
|
+
ROOT_DIR="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
16
17
|
BINARY="$ROOT_DIR/target/debug/auditkit"
|
|
17
18
|
|
|
18
19
|
if [ ! -x "$BINARY" ]; then
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { mkdir, writeFile } from "node:fs/promises";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import {
|
|
6
|
+
formatLighthouseCli,
|
|
7
|
+
formatLighthouseReport,
|
|
8
|
+
runLighthouse,
|
|
9
|
+
} from "./auditkit/lighthouse-runner.mjs";
|
|
10
|
+
|
|
11
|
+
const url = process.argv[2];
|
|
12
|
+
const outIndex = process.argv.indexOf("--out");
|
|
13
|
+
const outDir = outIndex >= 0 ? process.argv[outIndex + 1] : null;
|
|
14
|
+
|
|
15
|
+
if (!url) {
|
|
16
|
+
console.error("Usage: node scripts/lighthouse.mjs <url> [--out <folder>]");
|
|
17
|
+
process.exit(1);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
try {
|
|
21
|
+
const result = await runLighthouse(url);
|
|
22
|
+
console.log(formatLighthouseCli(result.summary));
|
|
23
|
+
|
|
24
|
+
const folder = outDir ?? process.cwd();
|
|
25
|
+
await mkdir(folder, { recursive: true });
|
|
26
|
+
|
|
27
|
+
const markdownPath = path.join(folder, "lighthouse.md");
|
|
28
|
+
const jsonPath = path.join(folder, "lighthouse.json");
|
|
29
|
+
|
|
30
|
+
await writeFile(markdownPath, formatLighthouseReport(result.summary), "utf8");
|
|
31
|
+
await writeFile(jsonPath, result.json, "utf8");
|
|
32
|
+
|
|
33
|
+
console.log(`LIGHTHOUSE_MD: ${markdownPath}`);
|
|
34
|
+
console.log(`LIGHTHOUSE_JSON: ${jsonPath}`);
|
|
35
|
+
} catch (error) {
|
|
36
|
+
console.error(error.message);
|
|
37
|
+
process.exit(1);
|
|
38
|
+
}
|
package/src/main.rs
CHANGED
|
@@ -12,11 +12,7 @@ use chrono::Local;
|
|
|
12
12
|
use clap::{Parser, Subcommand};
|
|
13
13
|
|
|
14
14
|
#[derive(Parser)]
|
|
15
|
-
#[command(
|
|
16
|
-
name = "auditkit",
|
|
17
|
-
version,
|
|
18
|
-
about = "Audit Kit: small agency website audit workflow"
|
|
19
|
-
)]
|
|
15
|
+
#[command(name = "ak", about = "Audit Kit: small agency website audit workflow")]
|
|
20
16
|
struct Cli {
|
|
21
17
|
#[command(subcommand)]
|
|
22
18
|
command: Option<Command>,
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
const useColor = process.stdout.isTTY && !process.env.NO_COLOR;
|
|
2
|
-
|
|
3
|
-
const cyan = (value) => (useColor ? `\x1b[36m${value}\x1b[0m` : value);
|
|
4
|
-
const green = (value) => (useColor ? `\x1b[32m${value}\x1b[0m` : value);
|
|
5
|
-
const bold = (value) => (useColor ? `\x1b[1m${value}\x1b[0m` : value);
|
|
6
|
-
const dim = (value) => (useColor ? `\x1b[2m${value}\x1b[0m` : value);
|
|
7
|
-
|
|
8
|
-
const width = 54;
|
|
9
|
-
const edge = cyan("│");
|
|
10
|
-
const boxLine = (value = "", format = (text) => text) => {
|
|
11
|
-
const padded = value.padEnd(width - 4, " ");
|
|
12
|
-
return `${edge} ${format(value)}${" ".repeat(padded.length - value.length)} ${edge}`;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const lines = [
|
|
16
|
-
"",
|
|
17
|
-
cyan(`┌${"─".repeat(width - 2)}┐`),
|
|
18
|
-
boxLine("Welcome to Audit Kit", bold),
|
|
19
|
-
boxLine("Local audits, Lighthouse, and security checks."),
|
|
20
|
-
cyan(`└${"─".repeat(width - 2)}┘`),
|
|
21
|
-
"",
|
|
22
|
-
`${green("Next steps")}`,
|
|
23
|
-
` ${bold("ak new")} create audit workspace`,
|
|
24
|
-
` ${bold("ak inspect latest")} run checks for latest audit`,
|
|
25
|
-
` ${bold("ak report latest")} generate final report`,
|
|
26
|
-
"",
|
|
27
|
-
`${dim("Tip: first run builds the Rust CLI, so it may take a few seconds.")}`,
|
|
28
|
-
"",
|
|
29
|
-
];
|
|
30
|
-
|
|
31
|
-
console.log(lines.join("\n"));
|