@descent-vtt/spec-harness 0.0.0 → 0.1.0
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/.claude-plugin/marketplace.json +16 -0
- package/.claude-plugin/plugin.json +17 -0
- package/.mcp.json +12 -0
- package/CHANGELOG.md +46 -0
- package/README.md +127 -9
- package/bin/spec-harness.js +19 -0
- package/dist/audit.d.ts +69 -0
- package/dist/audit.js +93 -0
- package/dist/audit.js.map +1 -0
- package/dist/branch.d.ts +26 -0
- package/dist/branch.js +100 -0
- package/dist/branch.js.map +1 -0
- package/dist/briefs.d.ts +49 -0
- package/dist/briefs.js +111 -0
- package/dist/briefs.js.map +1 -0
- package/dist/cli.d.ts +14 -0
- package/dist/cli.js +245 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands.d.ts +18 -0
- package/dist/commands.js +224 -0
- package/dist/commands.js.map +1 -0
- package/dist/config.d.ts +57 -0
- package/dist/config.js +167 -0
- package/dist/config.js.map +1 -0
- package/dist/context.d.ts +56 -0
- package/dist/context.js +125 -0
- package/dist/context.js.map +1 -0
- package/dist/document.d.ts +33 -0
- package/dist/document.js +9 -0
- package/dist/document.js.map +1 -0
- package/dist/fs.d.ts +29 -0
- package/dist/fs.js +85 -0
- package/dist/fs.js.map +1 -0
- package/dist/git.d.ts +57 -0
- package/dist/git.js +129 -0
- package/dist/git.js.map +1 -0
- package/dist/guard.d.ts +43 -0
- package/dist/guard.js +120 -0
- package/dist/guard.js.map +1 -0
- package/dist/hooks.d.ts +50 -0
- package/dist/hooks.js +109 -0
- package/dist/hooks.js.map +1 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/junit.d.ts +30 -0
- package/dist/junit.js +166 -0
- package/dist/junit.js.map +1 -0
- package/dist/manifests.d.ts +52 -0
- package/dist/manifests.js +346 -0
- package/dist/manifests.js.map +1 -0
- package/dist/plugin.d.ts +45 -0
- package/dist/plugin.js +79 -0
- package/dist/plugin.js.map +1 -0
- package/dist/premises.d.ts +16 -0
- package/dist/premises.js +71 -0
- package/dist/premises.js.map +1 -0
- package/dist/probe.d.ts +108 -0
- package/dist/probe.js +203 -0
- package/dist/probe.js.map +1 -0
- package/dist/reader.d.ts +8 -0
- package/dist/reader.js +105 -0
- package/dist/reader.js.map +1 -0
- package/dist/round.d.ts +68 -0
- package/dist/round.js +339 -0
- package/dist/round.js.map +1 -0
- package/dist/rulings.d.ts +92 -0
- package/dist/rulings.js +160 -0
- package/dist/rulings.js.map +1 -0
- package/dist/sandbox.d.ts +28 -0
- package/dist/sandbox.js +110 -0
- package/dist/sandbox.js.map +1 -0
- package/dist/server.d.ts +13 -0
- package/dist/server.js +212 -0
- package/dist/server.js.map +1 -0
- package/dist/setup.d.ts +32 -0
- package/dist/setup.js +218 -0
- package/dist/setup.js.map +1 -0
- package/dist/siblings.d.ts +66 -0
- package/dist/siblings.js +134 -0
- package/dist/siblings.js.map +1 -0
- package/dist/types.d.ts +38 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/vendor/spec-core/jsonrpc/index.d.ts +2 -0
- package/dist/vendor/spec-core/jsonrpc/index.js +2 -0
- package/dist/vendor/spec-core/jsonrpc/index.js.map +1 -0
- package/dist/vendor/spec-core/jsonrpc/mcp.d.ts +157 -0
- package/dist/vendor/spec-core/jsonrpc/mcp.js +353 -0
- package/dist/vendor/spec-core/jsonrpc/mcp.js.map +1 -0
- package/dist/vendor/spec-core/markdown/frontmatter.d.ts +103 -0
- package/dist/vendor/spec-core/markdown/frontmatter.js +459 -0
- package/dist/vendor/spec-core/markdown/frontmatter.js.map +1 -0
- package/dist/vendor/spec-core/markdown/headings.d.ts +45 -0
- package/dist/vendor/spec-core/markdown/headings.js +199 -0
- package/dist/vendor/spec-core/markdown/headings.js.map +1 -0
- package/dist/vendor/spec-core/markdown/index.d.ts +5 -0
- package/dist/vendor/spec-core/markdown/index.js +4 -0
- package/dist/vendor/spec-core/markdown/index.js.map +1 -0
- package/dist/vendor/spec-core/markdown/layout.d.ts +39 -0
- package/dist/vendor/spec-core/markdown/layout.js +28 -0
- package/dist/vendor/spec-core/markdown/layout.js.map +1 -0
- package/dist/vendor/spec-core/markdown/links.d.ts +22 -0
- package/dist/vendor/spec-core/markdown/links.js +364 -0
- package/dist/vendor/spec-core/markdown/links.js.map +1 -0
- package/dist/vendor/spec-core/markdown/lists.d.ts +22 -0
- package/dist/vendor/spec-core/markdown/lists.js +127 -0
- package/dist/vendor/spec-core/markdown/lists.js.map +1 -0
- package/dist/vendor/spec-core/markdown/scan.d.ts +36 -0
- package/dist/vendor/spec-core/markdown/scan.js +439 -0
- package/dist/vendor/spec-core/markdown/scan.js.map +1 -0
- package/dist/vendor/spec-core/markdown/syntax.d.ts +75 -0
- package/dist/vendor/spec-core/markdown/syntax.js +181 -0
- package/dist/vendor/spec-core/markdown/syntax.js.map +1 -0
- package/dist/vendor/spec-core/markdown/tables.d.ts +18 -0
- package/dist/vendor/spec-core/markdown/tables.js +86 -0
- package/dist/vendor/spec-core/markdown/tables.js.map +1 -0
- package/dist/vendor/spec-core/markdown/types.d.ts +287 -0
- package/dist/vendor/spec-core/markdown/types.js +9 -0
- package/dist/vendor/spec-core/markdown/types.js.map +1 -0
- package/dist/vendor/spec-core/path/index.d.ts +1 -0
- package/dist/vendor/spec-core/path/index.js +2 -0
- package/dist/vendor/spec-core/path/index.js.map +1 -0
- package/dist/vendor/spec-core/path/posix.d.ts +83 -0
- package/dist/vendor/spec-core/path/posix.js +150 -0
- package/dist/vendor/spec-core/path/posix.js.map +1 -0
- package/dist/vendor/spec-core/pattern/automaton.d.ts +129 -0
- package/dist/vendor/spec-core/pattern/automaton.js +340 -0
- package/dist/vendor/spec-core/pattern/automaton.js.map +1 -0
- package/dist/vendor/spec-core/pattern/charset.d.ts +58 -0
- package/dist/vendor/spec-core/pattern/charset.js +116 -0
- package/dist/vendor/spec-core/pattern/charset.js.map +1 -0
- package/dist/vendor/spec-core/pattern/glob.d.ts +121 -0
- package/dist/vendor/spec-core/pattern/glob.js +481 -0
- package/dist/vendor/spec-core/pattern/glob.js.map +1 -0
- package/dist/vendor/spec-core/pattern/index.d.ts +6 -0
- package/dist/vendor/spec-core/pattern/index.js +4 -0
- package/dist/vendor/spec-core/pattern/index.js.map +1 -0
- package/dist/vendor/spec-core/pattern/regex.d.ts +67 -0
- package/dist/vendor/spec-core/pattern/regex.js +813 -0
- package/dist/vendor/spec-core/pattern/regex.js.map +1 -0
- package/dist/vendor/spec-core/text/index.d.ts +2 -0
- package/dist/vendor/spec-core/text/index.js +2 -0
- package/dist/vendor/spec-core/text/index.js.map +1 -0
- package/dist/vendor/spec-core/text/lines.d.ts +72 -0
- package/dist/vendor/spec-core/text/lines.js +156 -0
- package/dist/vendor/spec-core/text/lines.js.map +1 -0
- package/dist/versions.d.ts +42 -0
- package/dist/versions.js +57 -0
- package/dist/versions.js.map +1 -0
- package/dist/workspace.d.ts +77 -0
- package/dist/workspace.js +138 -0
- package/dist/workspace.js.map +1 -0
- package/hooks/hooks.json +28 -0
- package/package.json +86 -6
- package/skills/close-round/SKILL.md +38 -0
- package/skills/draft-brief/SKILL.md +64 -0
- package/skills/run-round/SKILL.md +46 -0
- package/skills/split-goal/SKILL.md +42 -0
- package/src/vendor/spec-core/LICENSE +21 -0
- package/src/vendor/spec-core/README.md +8 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glob.js","sourceRoot":"","sources":["../../../../src/vendor/spec-core/pattern/glob.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EACL,OAAO,EACP,WAAW,EACX,OAAO,EACP,cAAc,GAIf,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAkB,MAAM,cAAc,CAAC;AA2CpF,MAAM,OAAO,SAAU,SAAQ,KAAK;I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AAE,CAAC;QAC/B,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;QACxC,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxE,IAAI,CAAC,MAAM,CAAC,EAAE;YAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,OAAO,MAAM,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC;QAC7E,OAAO,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;IAC/C,CAAC;IACD,OAAO;QACL,EAAE,EAAE,IAAI;QACR,IAAI,EAAE;YACJ,OAAO;YACP,KAAK,CAAC,IAAY;gBAChB,IAAI,QAAQ,GAAG,KAAK,CAAC;gBACrB,KAAK,MAAM,KAAK,IAAI,OAAO;oBAAE,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;wBAAE,QAAQ,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC;gBACnF,OAAO,QAAQ,CAAC;YAClB,CAAC;SACF;KACF,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Globs, in the three dialects the spec-* tools speak, compiled to one kind of\n * automaton.\n *\n * The syntax is the part people type: `*`, `**`, `?`, `[abc]`, `[!a-z]`,\n * `{a,b}`, and `\\` to escape. What differs between the tools is not the\n * syntax but what a pattern is matched against, and those differences are\n * deliberate, so each has a name (docs/adr/0003-glob-dialects.md):\n *\n * - `path` - the whole repository-relative path, anchored at the root. A\n * pattern with no glob syntax names a file, a directory, or either, as the\n * caller says; `src/auth` may cover `src/auth/login.ts`.\n * - `ripgrep` - as ripgrep's `-g`: a pattern with no `/` is matched against\n * the last segment at any depth, so `*.ts` matches `src/deep/a.ts`; one with\n * a `/` is matched against the whole path.\n * - `gitignore` - as an exclusion list reads: a pattern matches a path or any\n * directory above it, so `tests` excludes everything under any `tests`; one\n * with a `/` other than a trailing one is anchored at the root, and a\n * leading `/` only anchors.\n *\n * Shared by all three:\n *\n * - `**` is a globstar only as a whole segment. `a/**\\/b` matches `a/b` and\n * `a/x/y/b`; a trailing `/**` matches everything inside a directory and not\n * the directory itself. Two stars inside a name, `**.md`, are refused: the\n * tools read it three ways, and the quiet reading narrowed their scope.\n * - `*`, `?` and classes never match `/`, and `*` matches a leading dot.\n * - Case is the caller's decision, stated every time. A result must not\n * depend on the host it ran on.\n * - A malformed pattern is an error, never a literal. An unclosed `[` or `{`,\n * an extended glob, a `..` - each is refused with a reason, because a typo\n * read as a literal is a scope that silently matches nothing. An extended\n * glob is a group holding a `|`, `+(a|b)`: without one, `C++(notes).md` is\n * a name with parentheses in it, as ripgrep and `.gitignore` read it.\n */\n\nimport {\n Builder,\n findWitness,\n Matcher,\n WITNESS_BUDGET,\n type Automaton,\n type Fragment,\n type Witness,\n} from './automaton.js';\nimport { ANY, classSet, literalSet, SEPARATOR, type CodeRange } from './charset.js';\n\nexport type GlobDialect = 'path' | 'ripgrep' | 'gitignore';\n\n/** How a `path` pattern with no glob syntax is read. */\nexport type LiteralReading = 'file' | 'directory' | 'either';\n\nexport interface GlobOptions {\n readonly dialect: GlobDialect;\n /** Whether `A` and `a` differ. No default: the caller decides, every time. */\n readonly caseSensitive: boolean;\n /**\n * `path` dialect only: how a pattern with no glob syntax is read - as a\n * file, as a directory and everything beneath it, or as either. A function\n * is asked per literal path, for a caller that knows the tree. `either` when\n * unset. A trailing `/` always means a directory.\n */\n readonly literal?: LiteralReading | ((path: string) => LiteralReading) | undefined;\n /**\n * `escape` (the default): `\\` escapes the next character, and a `\\` before a\n * letter or digit is refused as a Windows separator typed by mistake.\n * `separator`: every `\\` is a `/`, for patterns typed on a Windows shell.\n */\n readonly backslash?: 'escape' | 'separator' | undefined;\n}\n\nexport interface Glob {\n readonly source: string;\n readonly dialect: GlobDialect;\n readonly caseSensitive: boolean;\n /**\n * The directories a walk must enter to find every match: one per\n * alternative, the leading literal segments. `''` for an alternative that\n * can match at any depth.\n */\n readonly bases: readonly string[];\n readonly automaton: Automaton;\n /** Whether a canonical path - POSIX, no `.`, no empty or trailing segment - matches. */\n match(path: string): boolean;\n}\n\nexport type GlobParse = { readonly ok: true; readonly glob: Glob } | { readonly ok: false; readonly error: string };\n\nexport class GlobError extends Error {\n readonly source: string;\n constructor(source: string, reason: string) {\n super(`invalid glob \"${source}\": ${reason}`);\n this.name = 'GlobError';\n this.source = source;\n }\n}\n\n/** More alternatives than this is a pattern nobody meant. */\nexport const MAX_ALTERNATIVES = 256;\n\ntype Token =\n | { readonly kind: 'literal'; readonly point: number }\n | { readonly kind: 'any' }\n | { readonly kind: 'star' }\n | { readonly kind: 'class'; readonly negated: boolean; readonly ranges: readonly CodeRange[] };\n\ntype Segment = { readonly kind: 'globstar' } | { readonly kind: 'name'; readonly tokens: readonly Token[] };\n\ninterface Alternative {\n readonly segments: readonly Segment[];\n /** Written with a `/` somewhere other than at its end. */\n readonly slashed: boolean;\n}\n\n/** Whether a string uses glob syntax at all. */\nexport function isGlobSyntax(source: string): boolean {\n return /[*?[\\]{}]/.test(source);\n}\n\n/** Parses and compiles a glob, or says why it cannot. */\nexport function parseGlob(source: string, options: GlobOptions): GlobParse {\n const result = build(source, options);\n return typeof result === 'string' ? { ok: false, error: result } : { ok: true, glob: result };\n}\n\n/** Parses and compiles a glob, throwing {@link GlobError} when it cannot. */\nexport function compileGlob(source: string, options: GlobOptions): Glob {\n const result = build(source, options);\n if (typeof result === 'string') throw new GlobError(source, result);\n return result;\n}\n\nfunction build(source: string, options: GlobOptions): Glob | string {\n const escapes = options.backslash !== 'separator';\n let pattern = source.trim();\n if (!escapes) pattern = pattern.replace(/\\\\/g, '/');\n if (pattern.length === 0) return 'the pattern is empty';\n if (pattern.startsWith('!')) return 'a negated pattern is a list entry, not a glob; narrow the positive pattern';\n if (/(?:^|[^\\\\])[?*+@!]\\([^)]*\\|/.test(pattern)) return EXTGLOB;\n while (pattern.startsWith('./')) pattern = pattern.slice(2);\n\n // A leading slash roots a pattern at the filesystem's root in the path and\n // ripgrep dialects, and only anchors it at the repository root in gitignore.\n let rooted = false;\n let anchored = false;\n if (pattern.startsWith('/')) {\n if (options.dialect === 'gitignore') anchored = true;\n else rooted = true;\n pattern = pattern.replace(/^\\/+/, '');\n }\n // A trailing slash means a directory's contents, except in an exclusion,\n // where `build/` and `build` exclude the same things.\n if (pattern.endsWith('/')) {\n pattern = pattern.replace(/\\/+$/, '');\n if (options.dialect !== 'gitignore') pattern = `${pattern}/**`;\n }\n if (pattern.length === 0) return 'the pattern names the root itself, not a path under it';\n\n const expanded = expandBraces(pattern, escapes);\n if (typeof expanded === 'string') return expanded;\n\n const alternatives: Alternative[] = [];\n for (const text of expanded) {\n const parsed = parseAlternative(text, escapes);\n if (typeof parsed === 'string') return parsed;\n alternatives.push(parsed);\n }\n\n const builder = new Builder();\n const fragments: Fragment[] = [];\n const bases: string[] = [];\n for (const alternative of alternatives) {\n const compiled = compileAlternative(builder, alternative, options, rooted, anchored);\n fragments.push(compiled.fragment);\n bases.push(compiled.base);\n }\n const automaton = builder.finish(builder.either(fragments), options.caseSensitive);\n let matcher: Matcher | null = null;\n return {\n source,\n dialect: options.dialect,\n caseSensitive: options.caseSensitive,\n bases: [...new Set(bases)],\n automaton,\n match(path: string): boolean {\n matcher ??= new Matcher(automaton);\n return matcher.test(path);\n },\n };\n}\n\n/* ------------------------------------------------------------------ braces */\n\n/**\n * Expands `{a,b}` groups into the patterns they stand for, or says why the\n * pattern is malformed.\n *\n * Classes and escapes are skipped while looking for braces and commas, so\n * `{[,]x,y}` is two alternatives, `[,]x` and `y`. A lone `}` is a literal: it\n * cannot be read as anything else. An unclosed `{` is an error.\n */\nfunction expandBraces(pattern: string, escapes: boolean): string[] | string {\n let depth = 0;\n let open = -1;\n for (let i = 0; i < pattern.length; i += 1) {\n const ch = pattern.charAt(i);\n if (ch === '\\\\' && escapes) {\n i += 1;\n continue;\n }\n if (ch === '[') {\n const close = classEnd(pattern, i, escapes);\n if (close > 0) i = close;\n continue;\n }\n if (ch === '{') {\n if (depth === 0) open = i;\n depth += 1;\n continue;\n }\n if (ch !== '}' || depth === 0) continue;\n depth -= 1;\n if (depth > 0) continue;\n const prefix = pattern.slice(0, open);\n const suffix = pattern.slice(i + 1);\n const results: string[] = [];\n for (const option of splitOptions(pattern.slice(open + 1, i), escapes)) {\n const expanded = expandBraces(`${prefix}${option}${suffix}`, escapes);\n if (typeof expanded === 'string') return expanded;\n results.push(...expanded);\n if (results.length > MAX_ALTERNATIVES) return `the braces expand to more than ${MAX_ALTERNATIVES} patterns`;\n }\n return results;\n }\n if (depth > 0) return 'a \"{\" is never closed';\n return [pattern];\n}\n\n/** Splits a brace body on its top-level commas. */\nfunction splitOptions(body: string, escapes: boolean): string[] {\n const parts: string[] = [];\n let depth = 0;\n let start = 0;\n for (let i = 0; i < body.length; i += 1) {\n const ch = body.charAt(i);\n if (ch === '\\\\' && escapes) {\n i += 1;\n } else if (ch === '[') {\n const close = classEnd(body, i, escapes);\n if (close > 0) i = close;\n } else if (ch === '{') {\n depth += 1;\n } else if (ch === '}') {\n depth -= 1;\n } else if (ch === ',' && depth === 0) {\n parts.push(body.slice(start, i));\n start = i + 1;\n }\n }\n parts.push(body.slice(start));\n return parts;\n}\n\n/** The index of the `]` closing a class opened at `open`, or -1 when none does within the segment. */\nfunction classEnd(pattern: string, open: number, escapes: boolean): number {\n let i = open + 1;\n if (pattern.charAt(i) === '!' || pattern.charAt(i) === '^') i += 1;\n // The first member is always a member, even `]`.\n if (pattern.charAt(i) === ']') i += 1;\n for (; i < pattern.length; i += 1) {\n const ch = pattern.charAt(i);\n if (ch === '\\\\' && escapes) {\n i += 1;\n continue;\n }\n if (ch === '/') return -1;\n if (ch === ']') return i;\n }\n return -1;\n}\n\n/* ---------------------------------------------------------------- segments */\n\nfunction parseAlternative(text: string, escapes: boolean): Alternative | string {\n const segments: Segment[] = [];\n const raw = text.split('/');\n for (const part of raw) {\n if (part === '' || part === '.') continue;\n if (part === '..') return 'a pattern cannot climb out of its root with \"..\"';\n if (part === '**') {\n if (segments[segments.length - 1]?.kind !== 'globstar') segments.push({ kind: 'globstar' });\n continue;\n }\n const tokens = tokenize(part, escapes);\n if (typeof tokens === 'string') return tokens;\n segments.push({ kind: 'name', tokens });\n }\n if (segments.length === 0) return 'the pattern names no path';\n return { segments, slashed: raw.filter((part) => part !== '' && part !== '.').length > 1 };\n}\n\nconst EXTGLOB = 'extended globs such as \"+(a|b)\" are not supported: write alternatives as \"{a,b}\", and a literal parenthesis as \"[(]\"';\nconst GLOBSTAR_IN_NAME = '\"**\" means any number of directories only as a whole segment: write \"docs/**/*.md\" for any depth, or \"*.md\" for one level';\n\nfunction tokenize(segment: string, escapes: boolean): Token[] | string {\n const tokens: Token[] = [];\n const chars = Array.from(segment);\n for (let i = 0; i < chars.length; i += 1) {\n const ch = chars[i] as string;\n if (ch === '\\\\' && escapes) {\n const next = chars[i + 1];\n if (next === undefined || /[A-Za-z0-9]/.test(next)) {\n return '\"\\\\\" escapes glob syntax; separate directories with \"/\"';\n }\n tokens.push({ kind: 'literal', point: next.codePointAt(0) as number });\n i += 1;\n } else if (ch === '*') {\n // Two stars inside a name are refused rather than read as one. The\n // tools this replaces read `docs/**.md` three ways - recursive, one\n // level, and as ripgrep does - and reading it as one level silently\n // dropped every nested document from a run that used to include them.\n if (chars[i + 1] === '*') return GLOBSTAR_IN_NAME;\n tokens.push({ kind: 'star' });\n } else if (ch === '?') {\n tokens.push({ kind: 'any' });\n } else if (ch === '[') {\n const parsed = readClass(chars, i, escapes);\n if (typeof parsed === 'string') return parsed;\n tokens.push(parsed.token);\n i = parsed.end;\n } else {\n tokens.push({ kind: 'literal', point: ch.codePointAt(0) as number });\n }\n }\n return tokens;\n}\n\nfunction readClass(chars: readonly string[], open: number, escapes: boolean): { token: Token; end: number } | string {\n let i = open + 1;\n let negated = false;\n if (chars[i] === '!' || chars[i] === '^') {\n negated = true;\n i += 1;\n }\n const ranges: CodeRange[] = [];\n let first = true;\n for (; i < chars.length; i += 1) {\n const ch = chars[i] as string;\n if (ch === ']' && !first) return { token: { kind: 'class', negated, ranges }, end: i };\n first = false;\n let low = ch;\n if (ch === '\\\\' && escapes && chars[i + 1] !== undefined) {\n i += 1;\n low = chars[i] as string;\n }\n let high = low;\n if (chars[i + 1] === '-' && chars[i + 2] !== undefined && chars[i + 2] !== ']') {\n i += 2;\n high = chars[i] as string;\n if (high === '\\\\' && escapes && chars[i + 1] !== undefined) {\n i += 1;\n high = chars[i] as string;\n }\n }\n const from = low.codePointAt(0) as number;\n const to = high.codePointAt(0) as number;\n if (to < from) return `the range \"${low}-${high}\" runs backwards`;\n ranges.push([from, to]);\n }\n return 'a \"[\" is never closed';\n}\n\n/* --------------------------------------------------------------- compiling */\n\nfunction literalText(segments: readonly Segment[]): string | null {\n const names: string[] = [];\n for (const segment of segments) {\n if (segment.kind !== 'name') return null;\n let name = '';\n for (const token of segment.tokens) {\n if (token.kind !== 'literal') return null;\n name += String.fromCodePoint(token.point);\n }\n names.push(name);\n }\n return names.join('/');\n}\n\n/** One segment name: at least one character, none of them `/`. */\nfunction name(b: Builder): Fragment {\n return b.plus(b.char(ANY));\n}\n\n/** Zero or more whole directories: `(name/)*`. */\nfunction anyDirectories(b: Builder): Fragment {\n return b.star(b.sequence([name(b), b.char(SEPARATOR)]));\n}\n\n/** One or more whole segments below a path: `/name(/name)*`. */\nfunction beneath(b: Builder): Fragment {\n return b.sequence([b.char(SEPARATOR), name(b), b.star(b.sequence([b.char(SEPARATOR), name(b)]))]);\n}\n\nfunction tokens(b: Builder, list: readonly Token[]): Fragment {\n return b.sequence(\n list.map((token) => {\n switch (token.kind) {\n case 'literal':\n return b.char(literalSet(token.point));\n case 'any':\n return b.char(ANY);\n case 'star':\n return b.star(b.char(ANY));\n case 'class':\n return b.char(classSet(token.ranges, token.negated));\n }\n }),\n );\n}\n\nfunction segmentsFragment(b: Builder, segments: readonly Segment[]): Fragment {\n const parts: Fragment[] = [];\n segments.forEach((segment, i) => {\n const last = i === segments.length - 1;\n if (segment.kind === 'globstar') {\n // Inside a path a globstar is any number of whole directories, the\n // separator after them included; at its end, at least one segment.\n parts.push(last ? b.sequence([name(b), b.star(b.sequence([b.char(SEPARATOR), name(b)]))]) : anyDirectories(b));\n return;\n }\n parts.push(tokens(b, segment.tokens));\n if (!last) parts.push(b.char(SEPARATOR));\n });\n return b.sequence(parts);\n}\n\nfunction compileAlternative(\n b: Builder,\n alternative: Alternative,\n options: GlobOptions,\n rooted: boolean,\n anchored: boolean,\n): { fragment: Fragment; base: string } {\n const { segments } = alternative;\n const body = segmentsFragment(b, segments);\n const root = rooted ? '/' : '';\n const literal = literalText(segments);\n const leading = leadingLiteral(segments);\n\n if (options.dialect === 'gitignore') {\n const floating = !anchored && !alternative.slashed;\n const parts = [body, b.optional(beneath(b))];\n if (floating) parts.unshift(anyDirectories(b));\n const base = literal !== null ? leading.slice(0, -1) : leading;\n return { fragment: b.sequence(parts), base: floating ? '' : base.join('/') };\n }\n\n if (options.dialect === 'ripgrep' && !rooted && !alternative.slashed) {\n return { fragment: b.sequence([anyDirectories(b), body]), base: '' };\n }\n\n const parts = rooted ? [b.char(SEPARATOR), body] : [body];\n if (options.dialect === 'path' && literal !== null) {\n const reading = typeof options.literal === 'function' ? options.literal(root + literal) : options.literal ?? 'either';\n if (reading === 'directory') {\n parts.push(beneath(b));\n return { fragment: b.sequence(parts), base: root + literal };\n }\n if (reading === 'either') parts.push(b.optional(beneath(b)));\n }\n // A literal path may be a file, whose base is the directory holding it.\n const base = literal !== null ? leading.slice(0, -1) : leading;\n return { fragment: b.sequence(parts), base: root + base.join('/') };\n}\n\nfunction leadingLiteral(segments: readonly Segment[]): string[] {\n const out: string[] = [];\n for (const segment of segments) {\n const text = literalText([segment]);\n if (text === null) break;\n out.push(text);\n }\n return out;\n}\n\n/* ---------------------------------------------------------------- questions */\n\nfunction assertComparable(globs: readonly Glob[]): void {\n for (const glob of globs) {\n if (!glob.caseSensitive) throw new Error(`\"${glob.source}\" ignores case; scopes are compared case-sensitively`);\n }\n}\n\n/**\n * A shortest path every glob in `include` matches and no glob in `exclude`\n * does: the file two scopes would both write, less what either protects.\n * `none` is a proof that there is no such path. Case-sensitive globs only.\n */\nexport function globWitness(\n include: readonly Glob[],\n exclude: readonly Glob[] = [],\n budget: number = WITNESS_BUDGET,\n): Witness {\n assertComparable([...include, ...exclude]);\n return findWitness(\n include.map((glob) => glob.automaton),\n exclude.map((glob) => glob.automaton),\n budget,\n );\n}\n\n/**\n * Whether every path `inner` matches is matched by one of `outer`: `true`,\n * `false`, or `undecided` when the search met its budget.\n */\nexport function globCovers(\n outer: readonly Glob[],\n inner: Glob,\n budget: number = WITNESS_BUDGET,\n): boolean | 'undecided' {\n const witness = globWitness([inner], outer, budget);\n return witness.kind === 'undecided' ? 'undecided' : witness.kind === 'none';\n}\n\n/* -------------------------------------------------------------------- lists */\n\nexport interface GlobList {\n /** Whether a path is in: the last entry that matches it decides, and a `!` entry takes it out. */\n match(path: string): boolean;\n readonly entries: readonly { readonly negated: boolean; readonly glob: Glob }[];\n}\n\nexport type GlobListParse = { readonly ok: true; readonly list: GlobList } | { readonly ok: false; readonly error: string };\n\n/**\n * A list of patterns read the way a `.gitignore` reads: in order, each entry\n * deciding the paths it matches, a leading `!` taking them back out.\n */\nexport function parseGlobList(patterns: readonly string[], options: GlobOptions): GlobListParse {\n const entries: { negated: boolean; glob: Glob }[] = [];\n for (const pattern of patterns) {\n const trimmed = pattern.trim();\n const negated = trimmed.startsWith('!');\n const parsed = parseGlob(negated ? trimmed.slice(1) : trimmed, options);\n if (!parsed.ok) return { ok: false, error: `\"${pattern}\": ${parsed.error}` };\n entries.push({ negated, glob: parsed.glob });\n }\n return {\n ok: true,\n list: {\n entries,\n match(path: string): boolean {\n let included = false;\n for (const entry of entries) if (entry.glob.match(path)) included = !entry.negated;\n return included;\n },\n },\n };\n}\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { compileGlob, globCovers, globWitness, isGlobSyntax, parseGlob, parseGlobList, GlobError, MAX_ALTERNATIVES } from './glob.js';
|
|
2
|
+
export type { Glob, GlobDialect, GlobList, GlobListParse, GlobOptions, GlobParse, LiteralReading } from './glob.js';
|
|
3
|
+
export { AutomatonTooLarge, MAX_STATES, WITNESS_BUDGET } from './automaton.js';
|
|
4
|
+
export type { Witness } from './automaton.js';
|
|
5
|
+
export { compileRegex, RegexError } from './regex.js';
|
|
6
|
+
export type { RegexMatcher, RegexOptions } from './regex.js';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { compileGlob, globCovers, globWitness, isGlobSyntax, parseGlob, parseGlobList, GlobError, MAX_ALTERNATIVES } from './glob.js';
|
|
2
|
+
export { AutomatonTooLarge, MAX_STATES, WITNESS_BUDGET } from './automaton.js';
|
|
3
|
+
export { compileRegex, RegexError } from './regex.js';
|
|
4
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/vendor/spec-core/pattern/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAEtI,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAE/E,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC","sourcesContent":["export { compileGlob, globCovers, globWitness, isGlobSyntax, parseGlob, parseGlobList, GlobError, MAX_ALTERNATIVES } from './glob.js';\nexport type { Glob, GlobDialect, GlobList, GlobListParse, GlobOptions, GlobParse, LiteralReading } from './glob.js';\nexport { AutomatonTooLarge, MAX_STATES, WITNESS_BUDGET } from './automaton.js';\nexport type { Witness } from './automaton.js';\nexport { compileRegex, RegexError } from './regex.js';\nexport type { RegexMatcher, RegexOptions } from './regex.js';\n"]}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A regular-expression matcher that cannot backtrack.
|
|
3
|
+
*
|
|
4
|
+
* Written for spec-graph, whose `~=` selector used to hand a user-supplied
|
|
5
|
+
* string to `RegExp` and wait (spec-graph ADR-0017), and moved here so that
|
|
6
|
+
* every tool that accepts a pattern from configuration or from a document can
|
|
7
|
+
* run it unattended in CI without a pattern deciding how long CI takes.
|
|
8
|
+
*
|
|
9
|
+
* The cost is neither theoretical nor exotic. `^([A-Za-z0-9_]+[ ]?)+$` is what
|
|
10
|
+
* somebody writes to say "the title is words separated by single spaces", and
|
|
11
|
+
* against a title that does not match, V8 tries one branch per way of cutting
|
|
12
|
+
* each word into pieces:
|
|
13
|
+
*
|
|
14
|
+
* ```text
|
|
15
|
+
* RegExp here
|
|
16
|
+
* the quick brown fox jumps over the lazy dog! 0.9s 11us
|
|
17
|
+
* the quick brown fox jumps over the lazy dog and! 5.4s 12us
|
|
18
|
+
* the quick brown fox jumps over the lazy dog and keeps! 103s 13us
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* So a pattern here is compiled to a non-deterministic finite automaton and
|
|
22
|
+
* simulated over the subject one character at a time (Thompson, 1968), keeping
|
|
23
|
+
* a set of live states instead of a stack of choices. Each state is visited at
|
|
24
|
+
* most once per position, which makes the work O(pattern x subject), growing
|
|
25
|
+
* with the subject and not with the pattern's ambiguity.
|
|
26
|
+
*
|
|
27
|
+
* What it costs is a dialect. Backreferences and lookaround are not regular and
|
|
28
|
+
* have no place in a linear automaton, so they are rejected while compiling,
|
|
29
|
+
* with a message and an offset, rather than accepted and then slow.
|
|
30
|
+
*
|
|
31
|
+
* The dialect is JavaScript's without the `u` flag, character for character,
|
|
32
|
+
* and is held to that by a differential test against `RegExp`: code units,
|
|
33
|
+
* not code points, and `i` folding by the specification's `Canonicalize`.
|
|
34
|
+
* Matching is unanchored and, unless `ignoreCase: false` is passed,
|
|
35
|
+
* case-insensitive, which is what spec-graph's `~=` has always been. There
|
|
36
|
+
* are no captures: nothing asks where a match was, only whether there was one.
|
|
37
|
+
*/
|
|
38
|
+
/** A pattern that will not compile, and where in it the problem starts. */
|
|
39
|
+
export declare class RegexError extends Error {
|
|
40
|
+
/** Offset into the pattern source. */
|
|
41
|
+
readonly offset: number;
|
|
42
|
+
constructor(message: string, offset: number);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* A compiled pattern. Reusable and safe to cache.
|
|
46
|
+
*
|
|
47
|
+
* Not reentrant, which nothing can ask of it: `test` is synchronous and calls
|
|
48
|
+
* out to nothing, and the buffers it keeps between subjects are what make it
|
|
49
|
+
* cheap enough to run against every path a walk visits.
|
|
50
|
+
*/
|
|
51
|
+
export interface RegexMatcher {
|
|
52
|
+
/** True when the pattern matches anywhere in the subject. */
|
|
53
|
+
test(subject: string): boolean;
|
|
54
|
+
/** State count. Published for the size test, and for nothing else. */
|
|
55
|
+
readonly size: number;
|
|
56
|
+
}
|
|
57
|
+
export interface RegexOptions {
|
|
58
|
+
/** Fold case the way the `i` flag does. On unless set to `false`. */
|
|
59
|
+
readonly ignoreCase?: boolean | undefined;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Compiles a pattern into a matcher.
|
|
63
|
+
*
|
|
64
|
+
* Throws {@link RegexError} on anything it cannot run in linear time, which
|
|
65
|
+
* is the point: the alternative to a message here is a build that stops.
|
|
66
|
+
*/
|
|
67
|
+
export declare function compileRegex(source: string, options?: RegexOptions): RegexMatcher;
|