npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

agentic-domain-document

v0.7.0

Published

Agentic Platform document domain package

Readme

agentic-domain-document

agentic-domain-document는 Agentic Platform의 문서 도메인 패키지입니다.

이 패키지는 Document, TOC Node, Content, Typed Block을 관리하기 위한 하위 도메인 패키지입니다. artifact-standard, artifact, methodology, knowledge 계열 패키지는 이 패키지를 참조해서 문서 구조와 본문 block을 사용할 수 있습니다.

Adoc은 이 패키지가 관리하는 Agentic Document의 공식 약칭입니다. Adoc은 Document/Node/Content/Block 기반으로 저장되며, Adoc TreeAdoc Markdown Projection으로 조회할 수 있습니다.

현재 범위

Iteration 1에서는 문서 도메인 SQLite schema baseline과 최소 Repository/Service/Validator API를 제공합니다.

| 구분 | 상태 | | --- | --- | | 패키지 skeleton | 포함 | | 기본 문서 | 포함 | | build/typecheck | 포함 | | pack dry-run | 포함 | | Document DB migration | 포함 | | Repository/Service/Validator | 포함 | | Document Reader | 포함 | | Adoc Markdown Projection | 기본 조회용 projection 포함, table/figure/diagram 복원 포함 | | Markdown Import | 기본 전체 문서/챕터 import 포함, table/figure caption binding 포함 | | Public wrapper API | 포함 | | Document Agent contribution | 포함 | | CLI | 1차 구현 제외, 전체 lifecycle 검토 대상 | | Adapter | 1차 구현 제외, 전체 lifecycle 검토 대상 |

도메인 책임

agentic-domain-document
  - Document
  - TOC Node
  - Content
  - Typed Block
  - Document validation
  - Document fixture
  - Document repository/service
  - Document reader/query
  - Markdown import
  - Document migration/schema docs
  - Document Agent manifest/instruction contribution

제외 범위

| 제외 항목 | 담당 후보 | | --- | --- | | Artifact | agentic-domain-artifact | | Artifact Standard Package | agentic-domain-artifact-standard | | Knowledge | agentic-domain-knowledge | | Methodology | agentic-domain-methodology | | Render | agentic-support-render 후보 | | Agent Routing | runtime/router 계열 |

DB 명명 기준

| 구분 | 기준 | | --- | --- | | logical schema | document | | SQLite table prefix | document_ | | PostgreSQL mapping | document.*, 단 실제 적용은 향후 별도 프로세스 |

초기 테이블:

document_code_groups
document_codes
document_node_taxonomies
document_node_taxonomy_levels
document_documents
document_nodes
document_contents
document_blocks
document_annotations
document_revisions
document_change_events
document_versions

개발 검증

npm run build --workspace agentic-domain-document
npm run typecheck --workspace agentic-domain-document
npm run dev:test:agentic-domain-document
npm pack --workspace agentic-domain-document --dry-run --cache /private/tmp/agentic-npm-cache

기본 API 예시

import { createDocumentService } from "agentic-domain-document";

const service = createDocumentService({
  databasePath: ".agentic/platform.sqlite"
});

try {
  const document = service.createDocument({
    title: "요구사항 정의서",
    documentTypeCode: "default",
    taxonomyCode: "default"
  });

  const chapter = service.createNode({
    documentId: document.documentId,
    nodeLevel: 1,
    title: "개요"
  });

  const content = service.ensureContent(chapter.nodeId);
  service.addBlock({
    contentId: content.contentId,
    blockTypeCode: "paragraph",
    contentText: "문서 본문을 작성합니다."
  });

  const validation = service.validateDocument(document.documentId);
  console.log(validation.valid);
} finally {
  service.close();
}

Import Profile

agentic-domain-document는 외부 산출물 표준 패키지가 제공하는 문서 작성 기준을 직접 하드코딩하지 않습니다. 대신 DocumentImportProfile contract와 DefaultMarkdownImportProfile을 제공하고, Markdown importer가 optional profile을 입력으로 받습니다.

import {
  DefaultMarkdownImportProfile,
  createDocumentMarkdownImporter
} from "agentic-domain-document";

const importer = createDocumentMarkdownImporter({
  databasePath: ".agentic/platform.sqlite"
});

try {
  const result = importer.importMarkdownDocument({
    title: "문서 제목",
    markdown,
    profile: DefaultMarkdownImportProfile
  });

  console.log(result.document.documentId);
} finally {
  importer.close();
}

artifact-standard 같은 외부 모듈은 DocumentImportProfile 형식에 맞는 profile을 제공하고, consumer 또는 integration layer가 이를 document importer에 전달합니다.

Adoc 조회 API 예시

Adoc 조회는 직접 SQL보다 DocumentReader public API를 우선 사용합니다.

import { createDocumentReader } from "agentic-domain-document";

const reader = createDocumentReader({
  databasePath: ".agentic/platform.sqlite"
});

try {
  const latest = reader.getLatestDocument({
    documentTypeCode: "architecture_specification"
  });

  if (latest !== undefined) {
    const tree = reader.getDocumentTree(latest.documentId);
    const blocks = reader.findBlocks(latest.documentId, {
      contains: "Contract API"
    });
    const markdown = reader.toMarkdown(latest.documentId);

    console.log(tree.length);
    console.log(blocks.length);
    console.log(markdown);
  }
} finally {
  reader.close();
}

toMarkdown()은 본격 렌더링 엔진이 아니라 Adoc을 사람이 읽기 쉽게 보여주기 위한 기본 Markdown Projection입니다. Projection은 조회용 파생물이며 원천이 아닙니다. Markdown 파일 저장, checksum, stale 검증, PDF/PPTX/HTML 렌더링은 후속 agentic-capability-render 책임입니다.

기본 Markdown Projection은 paragraph, quote, list, code, table, figure, diagram block을 Markdown으로 복원합니다. tablecolumnsrows를 Markdown table로 출력하고, figure는 image reference와 visible caption으로 출력하며, diagram은 mermaid/plantuml source block을 fenced code block으로 출력합니다.

Adoc Markdown Import 예시

Adoc 작성의 1차 import 대상은 Markdown입니다. 전체 문서 생성과 기존 문서에 대한 챕터 append를 지원합니다.

import { createDocumentMarkdownImporter } from "agentic-domain-document";

const importer = createDocumentMarkdownImporter({
  databasePath: ".agentic/platform.sqlite"
});

try {
  const document = importer.importMarkdownDocument({
    title: "아키텍처 명세서",
    documentTypeCode: "architecture_specification",
    taxonomyCode: "architecture_specification",
    markdown,
    sourcePath: "chapters/chapter-01.md",
    policy: {
      validateAfterImport: true
    }
  });

  importer.importMarkdownChapter({
    documentId: document.document.documentId,
    markdown: chapterMarkdown,
    sourcePath: "chapters/chapter-02.md",
    policy: {
      validateAfterImport: true
    }
  });
} finally {
  importer.close();
}

Markdown Import는 draft Adoc 생성과 챕터 append를 위한 작성 진입점입니다. PDF/PPTX/HTML import, BlockFlow YAML import, merge/reconcile은 1차 범위에서 제외합니다.

Markdown Import는 다음 기본 구조화를 수행합니다.

- Markdown heading -> Document Node
- paragraph, quote, list, code -> Typed Block
- Markdown table -> table block
- `표 N. 제목 - 요약` + table -> caption이 결합된 table block
- Markdown image -> figure block
- image alt와 visible `그림 N. 제목 - 요약` caption -> caption이 결합된 figure block
- mermaid/plantuml fenced code -> diagram block

Document Agent Contribution

agentic-domain-document는 문서 작성 agent가 사용할 manifest와 resource index를 제공합니다. 이 contribution은 agentic-capability-agent-client의 공통 계약을 따르며, runtime/router가 설치된 패키지의 agent 기여분을 일관되게 등록하고 선택할 수 있게 합니다.

Agent manifest, routing, capability, resource index, instruction, guide, example, validation rule, source mapping은 TypeScript inline 문자열이 아니라 package root의 agent/ 리소스를 원천으로 관리합니다.

agentic-domain-document/
  agent/
    agent.manifest.json
    routing.json
    resource-index.json
    resource-selection.json
    capabilities/
      document-authoring.json
      document-block.json
      document-toc.json
      document-validation.json
    instructions/
      00-runtime-behavior.md
      10-scope-and-boundary.md
      20-task-procedures.md
      30-must-and-must-not.md
    guides/
      10-document-authoring-guide.md
      20-domain-boundary-guide.md
      30-authoring-policy-guide.md
      40-toc-authoring-guide.md
      50-content-block-guide.md
      51-paragraph-authoring-guide.md
      52-table-authoring-guide.md
      53-diagram-figure-authoring-guide.md
      70-korean-writing-style-guide.md
    validation/
      document-validation-rules.md
    examples/
      examples.md
      document-quality-examples.md
    sources/
      reference-mapping.md
import { documentAgentContribution } from "agentic-domain-document";

console.log(documentAgentContribution.manifest.agentId);
console.log(documentAgentContribution.resourceIndex?.instructions[0].path);

resource index는 다음 리소스를 구분해 제공합니다.

| 순서 | 구분 | 내용 | | --- | --- | | 1 | instructions | Agent가 반드시 따르는 작동 규칙 | | 2 | guides | 작성 품질을 높이는 상세 기준 | | 3 | examples | 좋은/나쁜 결과 예시와 payload 예시 | | 4 | validationRules | 기계적으로 검증할 수 있는 기준 | | 5 | sources | 규칙의 출처와 반영 근거 |

resourceGroups.order는 위 분류 간 적용 순서를 나타내고, 각 리소스의 priority는 같은 분류 안에서의 파일 적용 순서를 나타냅니다.

resource-selection.json은 사용자 요청에 따라 위 resource 중 어떤 묶음을 agent context에 포함할지 정의합니다. 예를 들어 “표 컬럼 헤더를 설계해줘” 요청은 공통 instruction, authoring guide, Korean writing guide, content block guide, table guide, quality example, validation rule을 함께 선택합니다.

import {
  assembleDocumentAgentContext,
  documentAgentContribution,
  documentResourceSelectionRules,
  selectDocumentAgentResources
} from "agentic-domain-document";
import { selectAgentResources } from "agentic-capability-agent-client";

const bundle = selectAgentResources(documentAgentContribution, {
  requestText: "표 컬럼 헤더를 설계해줘"
});

console.log(documentResourceSelectionRules.length);
console.log(bundle.bundleType);
console.log(bundle.resourceIds);

const documentBundle = selectDocumentAgentResources("표 컬럼 헤더를 설계해줘");
const context = assembleDocumentAgentContext("표 컬럼 헤더를 설계해줘");

console.log(documentBundle.bundleType);
console.log(context.contentText);

Korean writing guide는 문체 요청에만 쓰는 부가 guide가 아니라 문서 작성, 수정, 검토의 baseline guide로 취급합니다. Source mapping은 평상시 작성 context에는 항상 포함하지 않고, 출처 확인이나 규칙 보완 요청에서 선택합니다.

문서

| 문서 | 내용 | | --- | --- | | docs/usage.md | 사용 기준 | | docs/configuration.md | 설정 책임 | | docs/build.md | 구축 담당자 빌드/검증 | | docs/publishing.md | publish 절차 | | docs/delivery.md | 운영환경 전달 기준 | | docs/operations.md | 운영환경 설치/검증 | | docs/schema/migrations.md | migration 계획 | | docs/validation-rules.md | validator rule 설명 |