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 .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
node-version: "22"
cache: npm
- run: npm install
- run: npm run lint
- run: npm run build
- run: npm test
- name: Umami proxy tests
Expand Down
41 changes: 41 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"$schema": "https://biomejs.dev/schemas/2.5.10/schema.json",
"files": {
"includes": [
"**",
"!packages/cli/dist",
"!website/.docusaurus",
"!website/build",
"!coverage"
]
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 2
},
"linter": {
"enabled": true,
"rules": {
"preset": "recommended"
}
},
"overrides": [
{
"includes": ["website/static/img/logo.svg"],
"linter": {
"rules": {
"a11y": {
"noSvgWithoutTitle": "off"
}
}
}
}
],
"javascript": {
"formatter": {
"quoteStyle": "double",
"trailingCommas": "all"
}
}
}
1 change: 0 additions & 1 deletion infra/umami-proxy/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
*/

import {
COLLECT_PATH,
ORIGIN_COLLECT,
ORIGIN_SCRIPT,
matchProxyPath,
Expand Down
166 changes: 166 additions & 0 deletions package-lock.json

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

6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
"prepare": "node scripts/link-skills.mjs && node scripts/sync-hooks.mjs",
"build": "npm run build -w @chtnnh/know-code",
"build:docs": "npm run build -w website",
"lint": "biome lint .",
"lint:fix": "biome lint --write .",
"format:check": "biome format .",
"test": "npm run test -w @chtnnh/know-code",
"smoke": "bash scripts/smoke-enforcement.sh",
"smoke:verify": "bash scripts/smoke-verify-ci.sh",
Expand All @@ -26,5 +29,8 @@
"repository": {
"type": "git",
"url": "git+https://github.com/chtnnh/know-code.git"
},
"devDependencies": {
"@biomejs/biome": "^2.5.10"
}
}
3 changes: 3 additions & 0 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
"files": [
"bin",
"dist",
"!dist/**/*.test.*",
"!dist/test-helpers.*",
Comment thread
cursor[bot] marked this conversation as resolved.
"!dist/**/*.map",
"hooks",
"README.md",
"LICENSE"
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/cli-surface.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ describe("cli surface (spawned)", () => {
assert.equal(r.status, 0);
const session = readRangeSession(root);
assert.ok(session, "expected a new range session");
assert.equal(session!.fromOid, head);
assert.equal(session?.fromOid, head);
} finally {
cleanup();
}
Expand Down
8 changes: 5 additions & 3 deletions packages/cli/src/commands-core.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ describe("commands: config / init / quiz / doctor / reset / ship", () => {
assert.match(workflow, /github\.event\.before/);
assert.match(workflow, /github\.event\.pull_request\.head\.sha \|\| github\.sha/);
assert.match(workflow, /new branch push/);
assert.match(workflow, /else\n know-code verify\n/);
assert.match(workflow, /else\n {12}know-code verify\n/);

const action = readFileSync(join(repoRoot, "action", "action.yml"), "utf8");
assert.match(action, /actions\/setup-node@v5/);
Expand Down Expand Up @@ -333,10 +333,12 @@ describe("commands: config / init / quiz / doctor / reset / ship", () => {
const checks = await runDoctor(root);
const hooks = checks.find((c) => c.name === "git-hooks");
assert.ok(hooks);
assert.equal(hooks!.ok, false);
assert.equal(hooks.ok, false);
installGitHooks(root);
const after = await runDoctor(root);
assert.equal(after.find((c) => c.name === "git-hooks")!.ok, true);
const hooksAfterInstall = after.find((c) => c.name === "git-hooks");
assert.ok(hooksAfterInstall);
assert.equal(hooksAfterInstall.ok, true);
} finally {
cleanup();
}
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/amend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function buildAmendArgs(
): string[] {
const noTrailer = rawArgs.includes("--no-trailer");
const gitArgs = rawArgs.filter((a) => a !== "--no-trailer");
let finalArgs = ["--amend", ...gitArgs];
const finalArgs = ["--amend", ...gitArgs];

if (noTrailer) return finalArgs;

Expand Down
7 changes: 4 additions & 3 deletions packages/cli/src/commands/check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,19 +128,20 @@ export function cmdCheck(opts: RunCheckOptions = {}): never {
"know-code: KNOW_CODE_OVERRIDE=1 — check passed via human override (logged).",
);
} else if (isSealedRewriteRangeOpen(repoRoot)) {
const seal = readRangeSeal(repoRoot)!;
const seal = readRangeSeal(repoRoot);
if (!seal) throw new Error("sealed rewrite range missing seal");
console.error(
`know-code: gate open (sealed rewrite range) for ${seal.diffHash.slice(0, 12)}…`,
);
} else {
const receipt = readGateSafe(repoRoot);
if (commitDrift) {
console.error(
`know-code: gate open (${receipt!.level}, ${ctx.scope}) — tree unchanged since pass (${effectiveHash.slice(0, 12)}…)`,
`know-code: gate open (${receipt?.level}, ${ctx.scope}) — tree unchanged since pass (${effectiveHash.slice(0, 12)}…)`,
);
} else {
console.error(
`know-code: gate open (${receipt!.level}, ${ctx.scope}) for ${ctx.diffHash.slice(0, 12)}…`,
`know-code: gate open (${receipt?.level}, ${ctx.scope}) for ${ctx.diffHash.slice(0, 12)}…`,
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { readConfig, setConfigValue, writeConfig } from "../config.js";
import { readConfig, setConfigValue } from "../config.js";
import { resolveQuizContext } from "../hash.js";
import {
findGitRoot,
Expand Down
Loading