chore: effect pattern lint infrastructure (#35210)

This commit is contained in:
Kit Langton 2026-07-03 13:58:26 -04:00 committed by GitHub
commit 1401901529
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
70 changed files with 524 additions and 234 deletions

View file

@ -1,4 +1,4 @@
import { create as createIdentifier } from "@opencode-ai/schema/identifier"
import { create } from "@opencode-ai/schema/identifier"
const prefixes = {
job: "job",
@ -23,7 +23,7 @@ export function descending(prefix: keyof typeof prefixes, given?: string) {
function generateID(prefix: keyof typeof prefixes, direction: "descending" | "ascending", given?: string): string {
if (!given) {
return create(prefixes[prefix], direction)
return createID(prefixes[prefix], direction)
}
if (!given.startsWith(prefixes[prefix])) {
@ -32,10 +32,12 @@ function generateID(prefix: keyof typeof prefixes, direction: "descending" | "as
return given
}
export function create(prefix: string, direction: "descending" | "ascending", timestamp?: number): string {
return prefix + "_" + createIdentifier(direction === "descending", timestamp)
function createID(prefix: string, direction: "descending" | "ascending", timestamp?: number): string {
return prefix + "_" + create(direction === "descending", timestamp)
}
export { createID as create }
/** Extract timestamp from an ascending ID. Does not work with descending IDs. */
export function timestamp(id: string): number {
const prefix = id.split("_")[0]