@agent-facets/adapter-claude-code 0.2.0 → 0.2.2

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/dist/index.d.mts CHANGED
@@ -1,10 +1,91 @@
1
- import * as _$_agent_facets_adapter0 from "@agent-facets/adapter";
2
-
1
+ //#region ../../common/src/types.d.ts
2
+ /**
3
+ * A structured validation error decoupled from any specific validation library.
4
+ * Used across all packages to report schema and parsing failures.
5
+ */
6
+ interface ValidationError {
7
+ /** Dot-separated path to the invalid field (e.g., "agents.reviewer.prompt") */
8
+ path: string;
9
+ /** Human-readable error message */
10
+ message: string;
11
+ /** What was expected at this location */
12
+ expected: string;
13
+ /** What was actually found */
14
+ actual: string;
15
+ }
16
+ /**
17
+ * Discriminated result type for validation operations.
18
+ * Callers check `ok` to determine success or failure.
19
+ *
20
+ * Replaces the previous `Result<T>` (which required a type parameter)
21
+ * and `ValidationResult` (which was `Result<void>`). Every validation
22
+ * operation returns data on success — `T` is always required.
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * const result: Validated<FacetManifest> = loadManifest(dir)
27
+ * if (result.ok) {
28
+ * console.log(result.data) // FacetManifest
29
+ * } else {
30
+ * console.error(result.errors) // ValidationError[]
31
+ * }
32
+ * ```
33
+ */
34
+ type Validated<T> = {
35
+ ok: true;
36
+ data: T;
37
+ } | {
38
+ ok: false;
39
+ errors: ValidationError[];
40
+ };
41
+ /**
42
+ * The canonical asset type — singular form.
43
+ * Code that needs the plural/manifest-key form should derive it.
44
+ */
45
+ type AssetType = 'skill' | 'agent' | 'command';
46
+ /**
47
+ * Classifies the scope for adapter interactions
48
+ */
49
+ type Scope = 'system' | 'user' | 'project';
50
+ //#endregion
51
+ //#region ../../adapter/src/types.d.ts
52
+ /**
53
+ * Opaque record type for adapter-specific asset metadata.
54
+ * Each adapter defines its own schema — this is the generic container.
55
+ */
56
+ type AdapterMetadata = Record<string, unknown>;
57
+ /**
58
+ * The full adapter contract. Returned by `defineAdapter()`.
59
+ *
60
+ * An adapter is an AI coding tool (OpenCode, Claude Code, Codex, etc.)
61
+ * that wraps around an LLM. The adapter is a full abstraction layer
62
+ * over its tool's storage and configuration.
63
+ */
64
+ interface Adapter {
65
+ /** Unique adapter name (e.g., "opencode", "claude-code", "codex") */
66
+ readonly name: string;
67
+ /**
68
+ * Validate and enrich per-asset adapter metadata from a facet manifest.
69
+ * Takes raw metadata, validates it against the adapter's schema,
70
+ * applies adapter-specific defaults, and returns the enriched object.
71
+ */
72
+ buildAssetMetadata(data: unknown): Validated<AdapterMetadata>;
73
+ /** Install an asset at the given scope */
74
+ installAsset(scope: Scope, assetType: AssetType, name: string, content: string, metadata: unknown): Promise<void>;
75
+ /** Read an asset's content from the given scope */
76
+ readAsset(scope: Scope, assetType: AssetType, name: string): Promise<{
77
+ content: string;
78
+ metadata?: AdapterMetadata;
79
+ }>;
80
+ /** Delete an asset from the given scope */
81
+ deleteAsset(scope: Scope, assetType: AssetType, name: string): Promise<void>;
82
+ }
83
+ //#endregion
3
84
  //#region src/index.d.ts
4
85
  /**
5
86
  * Claude Code adapter — defines the conventions for Claude Code,
6
87
  * Anthropic's AI coding tool.
7
88
  */
8
- declare const _default: _$_agent_facets_adapter0.Adapter;
89
+ declare const _default: Adapter;
9
90
  //#endregion
10
91
  export { _default as default };