@infolang/connectors
v0.1.0
Published
InfoLang source connectors (GitHub full-repo sync, Notion scaffold) — same wire contract as @infolang/setup-core's vault sync
Maintainers
Readme
@infolang/connectors
Source connectors that push external content into InfoLang hosted memory
(https://api.infolang.ai). Currently ships a working GitHub full-repo
connector and a Notion connector that's built and unit-tested but not yet
wired into the CLI.
Not published to npm yet. Install from source until it is.
Install
git clone https://github.com/InfoLang-Inc/infolang-connectors.git
cd infolang-connectors
npm install
npm link # optional: puts `infolang-connectors` on your PATHRequires Node 18+.
Usage
infolang-connectors github sync <owner/repo> [--dry-run] [--confirm]or, without npm link:
node bin/cli.mjs github sync <owner/repo> [--dry-run] [--confirm]Example:
export INFOLANG_API_KEY=il_live_...
export INFOLANG_WORKSPACE_ID=3f9c1a2e-...
infolang-connectors github sync my-org/my-repo --dry-run
# review the file/chunk/byte summary and destination, then:
infolang-connectors github sync my-org/my-repo --confirmThe first confirmed sync always previews before sending, regardless of
--confirm — you need one extra --confirm (or --yes/-y) run to
actually push. --dry-run previews on every run, including later syncs.
On each run, the connector clones (first run) or fetches and diffs (later
runs) the target repo, applies .gitignore plus a fixed set of
always-excluded directories (node_modules, .git, dist, build, ...),
skips detected binaries, chunks the rest (heading-aware for Markdown,
boundary-aware for code), and pushes the chunks.
Programmatic use
import { syncGithubRepo } from "@infolang/connectors";
const result = await syncGithubRepo({
ownerRepo: "my-org/my-repo",
apiKey: process.env.INFOLANG_API_KEY,
workspaceId: process.env.INFOLANG_WORKSPACE_ID,
confirm: true,
});Other exports (lib/index.mjs): pushChunks / pushViaExecute /
pushViaRemember (transport layer), chunkFile / chunkMarkdown /
chunkCode (chunking), resolveGithubToken / buildCloneUrl (GitHub auth),
and the Notion scaffold (syncNotionWorkspace, richTextToMarkdown,
blockToMarkdown, pageToMarkdown, buildAuthorizeUrl,
exchangeCodeForToken).
Configuration
| Variable / flag | Required | Notes |
| --- | --- | --- |
| GITHUB_TOKEN / GITHUB_APP_TOKEN / GH_TOKEN / --token | No | GitHub PAT (classic: repo scope; fine-grained: Contents: Read-only) or App installation token. Public repos work with no token. |
| INFOLANG_API_KEY / --api-key | Yes | il_live_* or il_test_* InfoLang API key. |
| INFOLANG_WORKSPACE_ID / --workspace-id | Yes | Real workspace UUID — see below. |
| --api-base | No | Defaults to https://api.infolang.ai. |
Workspace ID
Every sync needs an explicit, real, account-owned InfoLang workspace ID.
There's currently no way for a connector to create or discover a workspace
on its own: log into the InfoLang console, create (or pick) a workspace, and
copy its UUID into INFOLANG_WORKSPACE_ID or --workspace-id.
An arbitrary string here returns 401 Unauthorized — the API only accepts a
workspace the calling key is actually scoped to. Omitting the value entirely
is also rejected rather than silently falling back to a default namespace,
since that would defeat per-source isolation.
Notion connector
Everything under lib/notion/ (OAuth token exchange, block-children fetch
with pagination, rich-text/block → Markdown conversion) is implemented and
unit-tested against Notion's REST API, but there's no CLI verb for it yet
and it makes no live calls. syncNotionWorkspace() returns
{ mode: "inactive", reason } until NOTION_CLIENT_ID / NOTION_CLIENT_SECRET
are set (create an integration at
notion.so/my-integrations) and a
token from lib/notion/oauth.mjs's OAuth flow is passed as NOTION_TOKEN /
--token.
Tests
npm testRuns node --test test/*.test.mjs. Everything is mocked — no live network
or git calls.
License
MIT — see LICENSE.md.
