@noir-ai/adapters 1.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +21 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/package.json +55 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 agaaaptr
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# @noir-ai/adapters
|
|
2
|
+
|
|
3
|
+
The host abstraction (`HostAdapter`) that decouples Noir from any specific agentic CLI. v1 ships the Claude Code adapter (`.mcp.json` wiring, `CLAUDE.md` `@import`, and `.claude/skills/` emission). Additional hosts arrive in later slices via a `resolveAdapter(host)` registry.
|
|
4
|
+
|
|
5
|
+
Part of the **[Noir](https://github.com/agaaaptr/noir#readme)** toolkit — the discipline, context, and memory layer for any agentic CLI.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @noir-ai/adapters
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
> Most users install the CLI instead, which wires the host adapter via `noir init`:
|
|
14
|
+
>
|
|
15
|
+
> ```bash
|
|
16
|
+
> npm install -g @noir-ai/cli
|
|
17
|
+
> ```
|
|
18
|
+
|
|
19
|
+
## License
|
|
20
|
+
|
|
21
|
+
MIT © agaaaptr
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
interface EmitContext {
|
|
2
|
+
root: string;
|
|
3
|
+
}
|
|
4
|
+
interface McpConfigOptions {
|
|
5
|
+
transport: 'stdio' | 'streamable-http';
|
|
6
|
+
url?: string;
|
|
7
|
+
}
|
|
8
|
+
interface HostAdapter {
|
|
9
|
+
readonly id: string;
|
|
10
|
+
/** Full contents of the host's MCP config file (e.g. .mcp.json). */
|
|
11
|
+
emitMcpConfig(ctx: EmitContext, opts: McpConfigOptions): string;
|
|
12
|
+
/** Managed block to insert into the host's context file (e.g. CLAUDE.md). */
|
|
13
|
+
emitContext(ctx: EmitContext): string;
|
|
14
|
+
/** Host's skill directory (e.g. .claude/skills). Absent ⇒ host has no skill concept. */
|
|
15
|
+
skillsDir?(ctx: EmitContext): string;
|
|
16
|
+
install?(ctx: EmitContext): Promise<void>;
|
|
17
|
+
healthCheck?(ctx: EmitContext): Promise<boolean>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
declare const claudeAdapter: HostAdapter;
|
|
21
|
+
|
|
22
|
+
export { type EmitContext, type HostAdapter, type McpConfigOptions, claudeAdapter };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// src/claude.ts
|
|
2
|
+
import { join } from "path";
|
|
3
|
+
import { CONTEXT_BLOCK_BEGIN, CONTEXT_BLOCK_END } from "@noir-ai/core";
|
|
4
|
+
var claudeAdapter = {
|
|
5
|
+
id: "claude",
|
|
6
|
+
emitMcpConfig(_ctx, opts) {
|
|
7
|
+
const server = opts.transport === "stdio" ? { command: "noir", args: ["mcp", "serve", "--stdio"] } : { type: "http", url: opts.url ?? "http://127.0.0.1:0/mcp" };
|
|
8
|
+
return JSON.stringify({ mcpServers: { noir: server } }, null, 2);
|
|
9
|
+
},
|
|
10
|
+
emitContext(_ctx) {
|
|
11
|
+
return `${CONTEXT_BLOCK_BEGIN}
|
|
12
|
+
@import ".noir/NOIR.md"
|
|
13
|
+
${CONTEXT_BLOCK_END}
|
|
14
|
+
`;
|
|
15
|
+
},
|
|
16
|
+
skillsDir(ctx) {
|
|
17
|
+
return join(ctx.root, ".claude", "skills");
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
claudeAdapter
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/claude.ts"],"sourcesContent":["import { join } from 'node:path';\nimport { CONTEXT_BLOCK_BEGIN, CONTEXT_BLOCK_END } from '@noir-ai/core';\nimport type { EmitContext, HostAdapter, McpConfigOptions } from './types.js';\n\nexport const claudeAdapter: HostAdapter = {\n id: 'claude',\n emitMcpConfig(_ctx, opts: McpConfigOptions): string {\n const server =\n opts.transport === 'stdio'\n ? { command: 'noir', args: ['mcp', 'serve', '--stdio'] }\n : { type: 'http', url: opts.url ?? 'http://127.0.0.1:0/mcp' };\n return JSON.stringify({ mcpServers: { noir: server } }, null, 2);\n },\n emitContext(_ctx: EmitContext): string {\n return `${CONTEXT_BLOCK_BEGIN}\\n@import \".noir/NOIR.md\"\\n${CONTEXT_BLOCK_END}\\n`;\n },\n skillsDir(ctx: EmitContext): string {\n return join(ctx.root, '.claude', 'skills');\n },\n};\n"],"mappings":";AAAA,SAAS,YAAY;AACrB,SAAS,qBAAqB,yBAAyB;AAGhD,IAAM,gBAA6B;AAAA,EACxC,IAAI;AAAA,EACJ,cAAc,MAAM,MAAgC;AAClD,UAAM,SACJ,KAAK,cAAc,UACf,EAAE,SAAS,QAAQ,MAAM,CAAC,OAAO,SAAS,SAAS,EAAE,IACrD,EAAE,MAAM,QAAQ,KAAK,KAAK,OAAO,yBAAyB;AAChE,WAAO,KAAK,UAAU,EAAE,YAAY,EAAE,MAAM,OAAO,EAAE,GAAG,MAAM,CAAC;AAAA,EACjE;AAAA,EACA,YAAY,MAA2B;AACrC,WAAO,GAAG,mBAAmB;AAAA;AAAA,EAA8B,iBAAiB;AAAA;AAAA,EAC9E;AAAA,EACA,UAAU,KAA0B;AAClC,WAAO,KAAK,IAAI,MAAM,WAAW,QAAQ;AAAA,EAC3C;AACF;","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@noir-ai/adapters",
|
|
3
|
+
"version": "1.0.0-beta.1",
|
|
4
|
+
"description": "Noir adapters — the HostAdapter abstraction and the Claude Code adapter (the v1 host).",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "agaaaptr",
|
|
7
|
+
"homepage": "https://github.com/agaaaptr/noir#readme",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/agaaaptr/noir.git",
|
|
11
|
+
"directory": "packages/adapters"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/agaaaptr/noir/issues"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"noir",
|
|
18
|
+
"adapter",
|
|
19
|
+
"host",
|
|
20
|
+
"claude",
|
|
21
|
+
"claude-code",
|
|
22
|
+
"mcp",
|
|
23
|
+
"agent"
|
|
24
|
+
],
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": ">=20"
|
|
27
|
+
},
|
|
28
|
+
"publishConfig": {
|
|
29
|
+
"access": "public",
|
|
30
|
+
"provenance": true
|
|
31
|
+
},
|
|
32
|
+
"type": "module",
|
|
33
|
+
"main": "./dist/index.js",
|
|
34
|
+
"types": "./dist/index.d.ts",
|
|
35
|
+
"exports": {
|
|
36
|
+
".": {
|
|
37
|
+
"types": "./dist/index.d.ts",
|
|
38
|
+
"import": "./dist/index.js"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"files": [
|
|
42
|
+
"dist",
|
|
43
|
+
"README.md"
|
|
44
|
+
],
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@noir-ai/core": "1.0.0-beta.1"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@types/node": "^26.1.1"
|
|
50
|
+
},
|
|
51
|
+
"scripts": {
|
|
52
|
+
"build": "tsup",
|
|
53
|
+
"typecheck": "tsc --noEmit"
|
|
54
|
+
}
|
|
55
|
+
}
|