import { type Diagnostic } from './diagnostic'; import type { FrozenResolvedCliOptions } from '../utils/config/cli-options'; import type { DocumentManifestOutputEntry, DynatraceApplicationManifest } from '../interfaces/manifest'; /** * Description written to the manifest entry of every skill-derived document. The * description a skill author writes in the `SKILL.md` frontmatter is meant for the AI * agent - it is bundled with the file content and is not repeated in the manifest, so * the manifest carries this fixed description instead of an author-supplied one. */ export declare const SKILL_DOCUMENT_DESCRIPTION = "This is a skill document to extend the context of Dynatrace Intelligence"; /** A single skill-derived document (either a SKILL.md or a references/* file) */ export interface SkillDocument { /** Unique document id, used both as the manifest key and the bundled filename under documents/ */ id: string; /** Logical path surfaced as the manifest entry's `name`, e.g. /skills//SKILL.md */ name: string; /** Absolute path to the raw source file to bundle unchanged */ contentPath: string; } export interface CollectSkillDocumentsResult { documents: SkillDocument[]; diagnostics: Diagnostic[]; } export interface ApplySkillDocumentsOptions { options: Pick; distDir: string; manifest: DynatraceApplicationManifest; } export type SkillFileKind = 'skill' | 'reference'; /** A skill/reference file discovered on disk, before validation */ export interface SkillFileCandidate { kind: SkillFileKind; id: string; name: string; /** Name of the owning skill directory, e.g. `fetch-jira` */ skill: string; relativePath: string; absolutePath: string; } /** * Collects, validates, and bundles the SKILL.md and references/* files authored under * `/dynatrace-intelligence/skills/`, merging their manifest entries into * `manifest.documents`. This is a no-op when no skill files are present. */ export declare function applySkillDocuments({ options, distDir, manifest, }: ApplySkillDocumentsOptions): Promise; /** * Collects, validates, and derives manifest metadata for the SKILL.md and references/* files * authored under `/dynatrace-intelligence/skills/`. * Does not write anything to disk. Returns an empty result (no-op) when no skill files exist. * @param options CLI options (root + build.sourceRoot are required) * @param existingDocumentIds Ids of documents already present in `manifest.documents` * (manually-configured ready-made documents), used to flag a skill id that would otherwise * silently overwrite one of them. Defaults to an empty set. */ export declare function collectSkillDocuments(options: Pick, existingDocumentIds?: ReadonlySet): Promise; /** * Discovers the SKILL.md and references/* files authored under * `/dynatrace-intelligence/skills/`, without validating or reading their * content. Returns an empty array (no-op) when no skill files exist. * * Deliberately validation-free: unlike {@link collectSkillDocuments}, this does not * consult `distDir` for id collisions, so it stays accurate even after * `bundleSkillDocuments` has already written every document to * `/documents/` - which is exactly the case for a post-deploy/publish * reporter that must see everything that was actually bundled. * @param options CLI options (root + build.sourceRoot are required) */ export declare function collectSkillFileCandidates(options: Pick): Promise; /** * Writes the raw content (including frontmatter) of each collected skill document to * `/documents/`. Written directly via `fs` rather than the `fileMapManagerSingleton`, * because by the time `prepareArtifact` runs the singleton has either already been flushed to * disk (regular build) or was never populated (`--skip-build`). */ export declare function bundleSkillDocuments(distDir: string, documents: SkillDocument[]): void; /** * Builds the `documents:` manifest entries for the collected skill documents. Every * entry carries the same {@link SKILL_DOCUMENT_DESCRIPTION}, regardless of what the * skill author wrote in the `SKILL.md` frontmatter. */ export declare function getSkillDocumentsManifest(documents: SkillDocument[]): Record; /** * Coerces a raw skill document id into the constraints the app registry enforces on the * bundled filename: the {@link ALLOWED_PART_CHARS} character set and at most * {@link DOCUMENT_ID_MAX_LENGTH} characters. Skill and reference names themselves are * deliberately unrestricted in length, so an id that would be too long is shortened * rather than rejected - the full path stays visible in the manifest entry's `name` * (`/skills//...`). * * A shortened id ends in a hash of the raw id, so it stays stable across builds and two * names sharing a long common prefix still derive different ids. An id that already fits * is returned unchanged, so ids of existing skills never shift. */ export declare function toBundledDocumentId(rawId: string): string;