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

@c4a/context

v0.7.106

Published

Declarative SDK for Context knowledge sources, workflows, review, and package outputs

Readme

Context SDK

English

@c4a/context 是 Context 知识工作区使用的声明式 SDK。多数用户通过 Context Agent 和 CLI 工作;项目作者使用本包声明来源采集与知识包输出。

知识生产只有一条路径,即 Indexer 生命周期。src/indexers.yaml 只保存已确认的 读者需求、授权来源与排除项;已安装的 Indexer 技能按任务在临时生产计划中选用。 src/index.ts 中的项目阶段不再负责生产代码或 Markdown 知识。

项目边界

sources/{repo,file,lark}/index.yaml   已登记的来源边界
sources/{note,sessions}/YYYYMMDD/*.md 保存的笔记与会话总结
src/index.ts               采集与知识包声明
src/indexers.yaml          知识生产的唯一权威配置
knowledge/                 已批准、可读的知识
dist/                      面向读者的知识包产物
.tmp/context-runtime/      可恢复运行态(不提交)

src/index.ts 可以声明:

  • source() / allSources() 来源引用;
  • captureFile()、captureLark() 文档快照阶段;
  • 不发布知识的 customPhase() 项目编排;
  • kbPackage()、llmsPackage() 输出。

示例:

import {
  captureFile,
  defineProject,
  kbPackage,
  source,
} from "@c4a/context";

const docs = source("20260901/product-docs", { type: "file" });

export default defineProject({
  sources: [docs],
  phases: [captureFile({ source: docs })],
  packages: [
    kbPackage({
      name: "product-kb",
      template: "src/package-templates/kb",
      select: { collections: ["product", "architecture"] },
    }),
  ],
});

Context 生命周期负责发现或更新 src/indexers.yaml,以有界批次运行彼此独立、可恢复 的语义任务,展示可读 Candidate 供审核,只写入批准后的知识,最后构建声明的知识包。 批次标识和运行耗时不会进入知识身份或知识包产物。

主要 API

| API | 用途 | |---|---| | defineProject() | 声明项目边界。 | | source() / allSources() | 引用已登记的代码/文件/飞书来源,或明确选择保存的 Note/Sessions。 | | captureFile() / captureLark() | 生成确定性的文档快照。 | | mdxJsonDocs() | 配置 MDX/JSON 文档采集处理器。 | | customPhase() | 执行不生产知识的项目编排。 | | kbPackage() | 构建 Agent 可读的知识包。 | | llmsPackage() | 构建供模型或检索使用的文本包。 |

本包也导出 Provider 作者和 Context 运行时使用的 Indexer Schema 与校验器。它们 描述的仍是同一套 src/indexers.yaml 生命周期,不是第二条用户流程。

@c4a/extract-ts、@c4a/extract-go、@c4a/extract-rush 等解析包属于 Indexer Provider 的实现依赖,工作区不再把它们包装成项目阶段。

知识与知识包

批准后的知识位于 knowledge/<collection>/,目录和文件名面向人阅读,例如:

knowledge/codeindex/ui-kit/avatar.md
knowledge/architecture/product-guides/component-input-fields.md

工作区页面只保留后续重建或更新所需的元数据。dist/ 中的知识包页面使用更小的 读者投影:有用的标题、类型、摘要/标签(存在时)和正文。内部证据 ID 与摘要除非 恢复需要,否则只留在运行时 Artifact 中。

知识包模板位于 src/package-templates/;安装后的示例位于 node_modules/@c4a/context/templates/package-templates/。

状态边界

不要直接修改 .tmp/context-runtime/ 下的生命周期文件。Candidate 状态、审核应用、 恢复、close、验证与构建由 CLI 管理。来源注册表、src/index.ts、 src/indexers.yaml、批准后的 knowledge/、保存的 Note/Sessions 和知识包模板是长期项目输入。 structure.yaml 保留范围级更新基线;会话的可选 commit/MR 关联放在来源文件, 不重复添加到知识页头部。保存来源不会自动开始索引。

参考文档