Files
accounted/extensions/general/mcp-server/skills/index.ts
T
f266c386f3 chore: repo-wide bloat sweep, remove dead code and fold duplicate helpers (#2150)
* chore: repo-wide bloat sweep, remove dead code and fold duplicate helpers

Remove 33 dead files, ~270 unreferenced exports/types, 13 dead i18n
namespaces and 4 unused dependencies; fold byte-identical helper copies
into one canonical home each (lib/utils chunk/sleep/utcDateStamp,
lib/dates/iso, lib/invariants/uuid, lib/xml/escape, lib/reports/sru/format,
lib/pdf/number-text, lib/browser/panel-request, lib/api/v1/body +
v1ValidationError rolled out to ~55 v1 routes, booking-template schemas).

No behaviour change: v1 bodies and status codes, MCP tool schemas, DB
writes and money math are untouched. Naive ore rounding was deliberately
not swapped for roundOre; see DECISIONS.md 2026-09-02 for the full list
of things left alone on purpose.

tsc, lint, 19588 unit tests and check:guards green; antipattern baseline
ratcheted (naive-ore-round 622 -> 620, hand-rolled-invariant 115 -> 113).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* test(transactions): import RawTransaction from @/types after the ingest re-export removal

CI's type ratchet (check:types, full tsconfig) caught the one test file
that still imported the type through lib/transactions/ingest.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

---------

Co-authored-by: Jakob Wennberg <311770904+jakobwennberg-oss@users.noreply.github.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-02 11:51:16 +02:00

56 lines
2.3 KiB
TypeScript

import type { SupabaseClient } from '@supabase/supabase-js'
import type { Skill } from './types'
import { monthEndCloseSkill } from './month-end-close'
import { quarterlyVatReviewSkill } from './quarterly-vat-review'
import { yearEndCloseSkill } from './year-end-close'
import { invoicingRulesSkill } from './invoicing-rules'
import { payrollMonthlySkill } from './payroll-monthly'
import { bankReconciliationSkill } from './bank-reconciliation'
import { kreditfakturaProcessSkill } from './kreditfaktura-process'
import { customerOnboardingSkill } from './customer-onboarding'
import { reconcileMonthSkill } from './reconcile-month'
import { onboardingSkill } from './onboarding'
import { loadAtomsAsSkills, loadReferenceById } from './atoms'
/** Static workflow skills the server ships with. Tier: 'workflow'. */
export const workflowSkills: Skill[] = [
monthEndCloseSkill,
quarterlyVatReviewSkill,
yearEndCloseSkill,
invoicingRulesSkill,
payrollMonthlySkill,
bankReconciliationSkill,
kreditfakturaProcessSkill,
customerOnboardingSkill,
reconcileMonthSkill,
onboardingSkill,
]
/**
* Resolve a skill by slug. Checks the static workflow array first (synchronous,
* always available), then falls back to the registry-backed atom set
* (asynchronous, supabase-bound).
*/
export async function findSkill(slug: string, supabase?: SupabaseClient): Promise<Skill | null> {
const wf = workflowSkills.find((s) => s.slug === slug)
if (wf) return wf
if (!supabase) return null
const atoms = await loadAtomsAsSkills(supabase)
const atom = atoms.find((s) => s.slug === slug)
if (atom) return atom
// Reference children (e.g. "horizontal/swedish-vat/vat-compliance-reference")
// are excluded from the listed atom set above, so resolve them directly. This
// is what makes a SKILL.md footer's gnubok_load_skill(<reference id>) work.
return loadReferenceById(supabase, slug)
}
/** Workflow skills + registry-loaded atoms in one list. */
export async function loadAllSkills(supabase: SupabaseClient): Promise<Skill[]> {
const atoms = await loadAtomsAsSkills(supabase)
return [...workflowSkills, ...atoms]
}
export type { Skill, SkillTier } from './types'
export { SKILL_MIME_TYPE, SKILL_URI_PREFIX, skillUri, skillSlugFromUri } from './types'
export { loadAtomsAsSkills, toSummary, __resetAtomCache } from './atoms'