// @bun
// src/features/docs.feature.ts
var DocsFeature = {
  meta: {
    key: "contractspec.docs",
    version: "1.0.0",
    title: "Documentation",
    description: "Comprehensive documentation system for ContractSpec",
    domain: "platform",
    owners: ["@platform.docs"],
    tags: ["documentation", "guides", "api-reference"],
    stability: "stable"
  },
  operations: [
    { key: "docs.search", version: "1.0.0" },
    { key: "docs.navigate", version: "1.0.0" }
  ],
  events: [
    { key: "docs.page_viewed", version: "1.0.0" },
    { key: "docs.search_performed", version: "1.0.0" }
  ],
  presentations: [
    { key: "docs.landing", version: "1.0.0" },
    { key: "docs.getting-started", version: "1.0.0" },
    { key: "docs.architecture", version: "1.0.0" }
  ],
  capabilities: {
    provides: [{ key: "contracts.docs", version: "1.0.0" }],
    requires: []
  }
};

// src/features/mcp.feature.ts
var MCPFeature = {
  meta: {
    key: "contractspec.mcp",
    version: "1.0.0",
    title: "MCP Integration",
    description: "Model Context Protocol server for AI agent integration",
    domain: "platform",
    owners: ["@platform.mcp"],
    tags: ["mcp", "ai-agents", "tooling"],
    stability: "beta"
  },
  operations: [
    { key: "mcp.tool.register", version: "1.0.0" },
    { key: "mcp.resource.register", version: "1.0.0" },
    { key: "mcp.prompt.register", version: "1.0.0" }
  ],
  events: [
    { key: "mcp.tool_invoked", version: "1.0.0" },
    { key: "mcp.resource_accessed", version: "1.0.0" }
  ],
  presentations: [],
  capabilities: {
    provides: [{ key: "contracts.mcp", version: "1.0.0" }],
    requires: [{ key: "contracts.operations", version: "1.0.0" }]
  }
};

// src/features/presentations.feature.ts
var PresentationsFeature = {
  meta: {
    key: "contractspec.presentations",
    version: "1.0.0",
    title: "Presentation Runtime",
    description: "Cross-platform rendering of contract-driven UI",
    domain: "platform",
    owners: ["@platform.presentations"],
    tags: ["presentations", "ui", "rendering", "cross-platform"],
    stability: "beta"
  },
  operations: [
    { key: "presentation.render", version: "1.0.0" },
    { key: "presentation.transform", version: "1.0.0" }
  ],
  events: [
    { key: "presentation.rendered", version: "1.0.0" },
    { key: "presentation.transformed", version: "1.0.0" }
  ],
  presentations: [
    { key: "form.standard", version: "1.0.0" },
    { key: "list.standard", version: "1.0.0" },
    { key: "detail.standard", version: "1.0.0" }
  ],
  capabilities: {
    provides: [{ key: "contracts.presentations", version: "1.0.0" }],
    requires: []
  }
};

// src/features/registry.ts
import { FeatureRegistry } from "@contractspec/lib.contracts-spec/features";
import { AppConfigFeature } from "@contractspec/lib.contracts-spec/app-config";
function createContractSpecFeatureRegistry() {
  const features = new FeatureRegistry;
  features.register(DocsFeature);
  features.register(MCPFeature);
  features.register(PresentationsFeature);
  features.register(AppConfigFeature);
  return features;
}
var registryInstance = null;
function getContractSpecFeatureRegistry() {
  if (!registryInstance) {
    registryInstance = createContractSpecFeatureRegistry();
  }
  return registryInstance;
}
function resetContractSpecFeatureRegistry() {
  registryInstance = null;
}

// src/presentation/features/hooks/useFeatureRegistry.ts
import { useMemo } from "react";
"use client";
function useFeatureRegistry() {
  const registry = useMemo(() => getContractSpecFeatureRegistry(), []);
  return useMemo(() => {
    const features = registry.list();
    return {
      features,
      getFeature: (key) => registry.get(key),
      getByTag: (tag) => registry.listByTag(tag),
      getByOwner: (owner) => registry.listByOwner(owner),
      getUniqueTags: () => registry.getUniqueTags(),
      getUniqueDomains: () => {
        const domains = new Set;
        for (const f of features) {
          if (f.meta.domain)
            domains.add(f.meta.domain);
        }
        return [...domains].sort();
      },
      getUniqueStabilities: () => {
        const stabilities = new Set;
        for (const f of features) {
          if (f.meta.stability)
            stabilities.add(f.meta.stability);
        }
        return [...stabilities].sort();
      }
    };
  }, [registry]);
}
export {
  useFeatureRegistry
};
