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
4 changes: 2 additions & 2 deletions .archgate/adrs/ARCH-001-command-structure.rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
const files = ctx.scopedFiles.filter((f) => !f.endsWith("index.ts"));
const checks = files.map(async (file) => {
const content = await ctx.readFile(file);
if (!/export\s+function\s+register\w+Command/.test(content)) {
if (!/export\s+function\s+register\w+Command/u.test(content)) {
ctx.report.violation({
message: "Command file must export a register*Command function",
file,
Expand All @@ -27,7 +27,7 @@ export default {
files.map((file) =>
ctx.grep(
file,
/\.(parse|match|replace|split)\(.*\).*\.(parse|match|replace|split)\(/
/\.(parse|match|replace|split)\(.*\).*\.(parse|match|replace|split)\(/u
)
)
);
Expand Down
8 changes: 4 additions & 4 deletions .archgate/adrs/ARCH-002-error-handling.rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default {
(f) => !f.endsWith("helpers/log.ts") && !f.includes("tests/")
);
const matches = await Promise.all(
files.map((file) => ctx.grep(file, /console\.error\(/))
files.map((file) => ctx.grep(file, /console\.error\(/u))
);
for (const fileMatches of matches) {
for (const m of fileMatches) {
Expand Down Expand Up @@ -38,7 +38,7 @@ export default {
!f.includes("tests/")
);
const matches = await Promise.all(
files.map((file) => ctx.grep(file, /console\.(log|warn|info)\s*\(/))
files.map((file) => ctx.grep(file, /console\.(log|warn|info)\s*\(/u))
);
for (const fileMatches of matches) {
for (const m of fileMatches) {
Expand All @@ -59,12 +59,12 @@ export default {
const allowedCodes = new Set([0, 1, 2, 130]);
const matches = await Promise.all(
ctx.scopedFiles.map((file) =>
ctx.grep(file, /process\.exit\((\d+)\)/)
ctx.grep(file, /process\.exit\((\d+)\)/u)
)
);
for (const fileMatches of matches) {
for (const m of fileMatches) {
const codeMatch = m.content.match(/process\.exit\((\d+)\)/);
const codeMatch = m.content.match(/process\.exit\((\d+)\)/u);
if (codeMatch) {
const code = Number(codeMatch[1]);
if (!allowedCodes.has(code)) {
Expand Down
2 changes: 1 addition & 1 deletion .archgate/adrs/ARCH-003-output-formatting.rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default {
(f) => !f.includes("tests/") && !f.includes(".archgate/")
);
const matches = await Promise.all(
files.map((file) => ctx.grep(file, /\\u001b\[|\\x1b\[|\\033\[/))
files.map((file) => ctx.grep(file, /\\u001b\[|\\x1b\[|\\033\[/u))
);
for (const fileMatches of matches) {
for (const m of fileMatches) {
Expand Down
2 changes: 1 addition & 1 deletion .archgate/adrs/ARCH-004-no-barrel-files.rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function isBarrelFile(content: string): boolean {
// Continuation of multi-line export blocks
line.startsWith("} from") ||
line.startsWith("type ") ||
/^[A-Za-z_$,\s]+$/.test(line) ||
/^[A-Za-z_$,\s]+$/u.test(line) ||
line === "}" ||
line === "};"
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default {

// Check for Bun.$ template literal usage
const bunShellMatches = await Promise.all(
files.map((file) => ctx.grep(file, /Bun\.\$`/))
files.map((file) => ctx.grep(file, /Bun\.\$`/u))
);
for (const fileMatches of bunShellMatches) {
for (const m of fileMatches) {
Expand All @@ -29,7 +29,7 @@ export default {
// Check for $ import from "bun" (the shell API)
const dollarImportMatches = await Promise.all(
files.map((file) =>
ctx.grep(file, /import\s*\{[^}]*\$[^}]*\}\s*from\s*["']bun["']/)
ctx.grep(file, /import\s*\{[^}]*\$[^}]*\}\s*from\s*["']bun["']/u)
)
);
for (const fileMatches of dollarImportMatches) {
Expand All @@ -46,7 +46,7 @@ export default {

// Check for await $` pattern (destructured $ usage)
const destructuredMatches = await Promise.all(
files.map((file) => ctx.grep(file, /await\s+\$`/))
files.map((file) => ctx.grep(file, /await\s+\$`/u))
);
for (const fileMatches of destructuredMatches) {
for (const m of fileMatches) {
Expand Down
4 changes: 2 additions & 2 deletions .archgate/adrs/ARCH-008-typed-command-options.rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default {
files.map((file) =>
ctx.grep(
file,
/\.option\(\s*["']--\w+\s+<\w+>["'],\s*["'][^"']*(?:claude.*cursor|backend.*frontend)[^"']*["']/
/\.option\(\s*["']--\w+\s+<\w+>["'],\s*["'][^"']*(?:claude.*cursor|backend.*frontend)[^"']*["']/u
)
)
);
Expand Down Expand Up @@ -44,7 +44,7 @@ export default {
files.map((file) =>
ctx.grep(
file,
/\.option\(\s*["']--\w+\s+<\w+>["'],\s*["'][^"']*["'],\s*(?:parseInt|parseFloat|\()/
/\.option\(\s*["']--\w+\s+<\w+>["'],\s*["'][^"']*["'],\s*(?:parseInt|parseFloat|\()/u
)
)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default {
);

const matches = await Promise.all(
files.map((file) => ctx.grep(file, /process\.platform/))
files.map((file) => ctx.grep(file, /process\.platform/u))
);
for (const fileMatches of matches) {
for (const m of fileMatches) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default {
// Pattern 1: single-expression JSON.parse(await Bun.file(...).text())
const inlineMatches = await Promise.all(
files.map((file) =>
ctx.grep(file, /JSON\.parse\(\s*await\s+Bun\.file/)
ctx.grep(file, /JSON\.parse\(\s*await\s+Bun\.file/u)
)
);
for (const fileMatches of inlineMatches) {
Expand All @@ -39,7 +39,7 @@ export default {

const textCalls = await ctx.grep(
file,
/Bun\.file\([^)]+\)\.text\(\)/
/Bun\.file\([^)]+\)\.text\(\)/u
);
if (textCalls.length === 0) return;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default {
);

const checks = files.map(async (file) => {
const matches = await ctx.grep(file, /process\.cwd\(\)/);
const matches = await ctx.grep(file, /process\.cwd\(\)/u);
for (const m of matches) {
// Allow process.cwd() as a fallback after findProjectRoot()
// e.g. findProjectRoot() ?? process.cwd()
Expand Down
8 changes: 4 additions & 4 deletions .archgate/adrs/ARCH-012-command-error-boundaries.rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ export default {
const content = await ctx.readFile(file);

// Find async action callbacks
const hasAsyncAction = /\.action\(\s*async\s/.test(content);
const hasAsyncAction = /\.action\(\s*async\s/u.test(content);
if (!hasAsyncAction) return;

// Check if the async action body contains a try block
// Match: .action(async (...) => { ... try { ... } ... })
const hasTryCatch = /\.action\(\s*async\s[\s\S]*?\btry\s*\{/.test(
const hasTryCatch = /\.action\(\s*async\s[\s\S]*?\btry\s*\{/u.test(
content
);

Expand Down Expand Up @@ -51,13 +51,13 @@ export default {

// Only check files with async actions that have try-catch
const hasAsyncActionWithTryCatch =
/\.action\(\s*async\s[\s\S]*?\btry\s*\{/.test(content);
/\.action\(\s*async\s[\s\S]*?\btry\s*\{/u.test(content);
if (!hasAsyncActionWithTryCatch) return;

// Check for the ExitPromptError re-throw pattern anywhere in the file.
// The canonical pattern is:
// if (err instanceof Error && err.name === "ExitPromptError") throw err;
const hasExitPromptRethrow = /ExitPromptError/.test(content);
const hasExitPromptRethrow = /ExitPromptError/u.test(content);

if (!hasExitPromptRethrow) {
ctx.report.violation({
Expand Down
2 changes: 1 addition & 1 deletion .archgate/adrs/ARCH-013-version-synchronization.rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default {
return;
}

const match = astroConfig.match(/softwareVersion:\s*"([^"]+)"/);
const match = astroConfig.match(/softwareVersion:\s*"([^"]+)"/u);
if (!match) return;

const docsVersion = match[1];
Expand Down
2 changes: 1 addition & 1 deletion .archgate/adrs/ARCH-014-prefer-bun-env.rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default {
);

const matches = await Promise.all(
files.map((file) => ctx.grep(file, /process\.env\b/))
files.map((file) => ctx.grep(file, /process\.env\b/u))
);
for (const fileMatches of matches) {
for (const m of fileMatches) {
Expand Down
6 changes: 3 additions & 3 deletions .archgate/adrs/CI-001-pin-github-actions-by-hash.rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
* Captures: owner/action@ref (ignoring local refs like `./.github/...` and
* docker refs like `docker://...`).
*/
const USES_PATTERN = /uses:\s+(?!\.\/|docker:\/\/)(\S+@\S+)/g;
const USES_PATTERN = /uses:\s+(?!\.\/|docker:\/\/)(\S+@\S+)/gu;

/**
* A valid pinned reference: 40 hex characters (full SHA), optionally followed
* by a version comment.
*/
const PINNED_SHA_PATTERN = /^.+@[0-9a-f]{40}\b/;
const PINNED_SHA_PATTERN = /^.+@[0-9a-f]{40}\b/u;

/**
* Carved-out exceptions where the upstream provider does not support SHA pinning.
Expand Down Expand Up @@ -44,7 +44,7 @@ export default {
for (const m of matches) {
// Extract the full `uses:` value from the matched line
const usesMatch = m.content.match(
/uses:\s+(?!\.\/|docker:\/\/)(\S+@\S+)/
/uses:\s+(?!\.\/|docker:\/\/)(\S+@\S+)/u
);
if (!usesMatch) continue;

Expand Down
2 changes: 1 addition & 1 deletion .archgate/adrs/GEN-002-docs-i18n.rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const CONTENT_ROOT = "docs/src/content/docs";

/** Patterns that match locale-prefixed internal links in MDX files. */
const LOCALE_LINK_PATTERNS = LOCALES.map(
(locale) => new RegExp(`(?:href="|\\]\\()/${locale}/`, "g")
(locale) => new RegExp(`(?:href="|\\]\\()/${locale}/`, "gu")
);

export default {
Expand Down
2 changes: 1 addition & 1 deletion .simple-release.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ArchgateProject extends NpmProject {
if (existsSync(astroConfigPath)) {
const astroConfig = readFileSync(astroConfigPath, "utf8");
const updated = astroConfig.replace(
/softwareVersion:\s*"[^"]+"/,
/softwareVersion:\s*"[^"]+"/u,
`softwareVersion: "${version}"`
);
if (updated !== astroConfig) {
Expand Down
Loading
Loading