agentsmesh 0.5.0 → 0.7.0
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/CHANGELOG.md +86 -5
- package/README.md +160 -78
- package/dist/canonical.d.ts +22 -4
- package/dist/canonical.js +12920 -94
- package/dist/canonical.js.map +1 -1
- package/dist/cli.js +477 -17042
- package/dist/engine.d.ts +205 -15
- package/dist/engine.js +6878 -3228
- package/dist/engine.js.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.js +14885 -0
- package/dist/index.js.map +1 -0
- package/dist/{canonical-types-gdrUi3bD.d.ts → schema-B7ZSqkrS.d.ts} +110 -1
- package/dist/{target-descriptor-D64xD0C2.d.ts → target-descriptor-COp3nil6.d.ts} +13 -111
- package/dist/targets.d.ts +4 -3
- package/dist/targets.js +4612 -2967
- package/dist/targets.js.map +1 -1
- package/package.json +14 -4
- package/schemas/agentsmesh.json +122 -8
- package/dist/cli.js.map +0 -1
package/dist/engine.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { G as GenerateResult,
|
|
1
|
+
import { V as ValidatedConfig, b as CanonicalFiles } from './schema-B7ZSqkrS.js';
|
|
2
|
+
import { G as GenerateResult, h as TargetLayoutScope, L as LintDiagnostic, d as ImportResult } from './target-descriptor-COp3nil6.js';
|
|
3
3
|
import 'zod';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -31,26 +31,216 @@ interface GenerateContext {
|
|
|
31
31
|
declare function generate(ctx: GenerateContext): Promise<GenerateResult[]>;
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
|
-
*
|
|
34
|
+
* Typed error taxonomy for agentsmesh programmatic consumers.
|
|
35
35
|
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
* All public-API errors inherit from AgentsMeshError and carry a stable `code`
|
|
37
|
+
* property. Consumers can branch on `err instanceof AgentsMeshError && err.code === 'AM_...'`
|
|
38
|
+
* without relying on error message strings.
|
|
39
|
+
*/
|
|
40
|
+
type AgentsMeshErrorCode = 'AM_CONFIG_NOT_FOUND' | 'AM_CONFIG_INVALID' | 'AM_TARGET_NOT_FOUND' | 'AM_TARGET_UNSUPPORTED' | 'AM_IMPORT_FAILED' | 'AM_GENERATION_FAILED' | 'AM_REMOTE_FETCH_FAILED' | 'AM_LOCK_ACQUISITION_FAILED' | 'AM_LOCK_CONFLICT' | 'AM_FILESYSTEM';
|
|
41
|
+
declare class AgentsMeshError extends Error {
|
|
42
|
+
readonly code: AgentsMeshErrorCode;
|
|
43
|
+
constructor(code: AgentsMeshErrorCode, message: string, options?: {
|
|
44
|
+
cause?: unknown;
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
declare class ConfigNotFoundError extends AgentsMeshError {
|
|
48
|
+
readonly path: string;
|
|
49
|
+
constructor(path: string, options?: {
|
|
50
|
+
cause?: unknown;
|
|
51
|
+
message?: string;
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
declare class ConfigValidationError extends AgentsMeshError {
|
|
55
|
+
readonly issues: readonly string[];
|
|
56
|
+
constructor(path: string, issues: readonly string[], options?: {
|
|
57
|
+
cause?: unknown;
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
declare class TargetNotFoundError extends AgentsMeshError {
|
|
61
|
+
readonly target: string;
|
|
62
|
+
constructor(target: string, options?: {
|
|
63
|
+
cause?: unknown;
|
|
64
|
+
supported?: readonly string[];
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
declare class ImportError extends AgentsMeshError {
|
|
68
|
+
readonly target: string;
|
|
69
|
+
constructor(target: string, message: string, options?: {
|
|
70
|
+
cause?: unknown;
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
declare class GenerationError extends AgentsMeshError {
|
|
74
|
+
constructor(message: string, options?: {
|
|
75
|
+
cause?: unknown;
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
declare class RemoteFetchError extends AgentsMeshError {
|
|
79
|
+
readonly source: string;
|
|
80
|
+
constructor(source: string, message: string, options?: {
|
|
81
|
+
cause?: unknown;
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
declare class LockAcquisitionError extends AgentsMeshError {
|
|
85
|
+
readonly lockPath: string;
|
|
86
|
+
readonly holder: string;
|
|
87
|
+
constructor(lockPath: string, holder: string, options?: {
|
|
88
|
+
cause?: unknown;
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
declare class FileSystemError extends AgentsMeshError {
|
|
92
|
+
readonly path: string;
|
|
93
|
+
readonly errnoCode?: string;
|
|
94
|
+
constructor(path: string, message: string, options?: {
|
|
95
|
+
cause?: unknown;
|
|
96
|
+
errnoCode?: string;
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Diff engine: produces unified diffs between generated content and on-disk files.
|
|
42
102
|
*/
|
|
43
|
-
declare const TARGET_IDS: readonly ["claude-code", "cursor", "copilot", "continue", "junie", "kiro", "gemini-cli", "cline", "codex-cli", "windsurf", "antigravity", "roo-code"];
|
|
44
|
-
type BuiltinTargetId = (typeof TARGET_IDS)[number];
|
|
45
103
|
|
|
104
|
+
interface DiffEntry {
|
|
105
|
+
path: string;
|
|
106
|
+
patch: string;
|
|
107
|
+
}
|
|
108
|
+
interface DiffSummary {
|
|
109
|
+
new: number;
|
|
110
|
+
updated: number;
|
|
111
|
+
unchanged: number;
|
|
112
|
+
deleted: number;
|
|
113
|
+
}
|
|
114
|
+
interface ComputeDiffResult {
|
|
115
|
+
diffs: DiffEntry[];
|
|
116
|
+
summary: DiffSummary;
|
|
117
|
+
}
|
|
46
118
|
/**
|
|
47
|
-
*
|
|
48
|
-
*
|
|
119
|
+
* Format diff summary for user display.
|
|
120
|
+
* @param summary - Counts from computeDiff
|
|
121
|
+
* @returns Human-readable string
|
|
49
122
|
*/
|
|
123
|
+
declare function formatDiffSummary(summary: DiffSummary): string;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Pure lock-vs-current drift detection used by `agentsmesh check` and the
|
|
127
|
+
* public Programmatic API. The CLI command formats and exits; this helper
|
|
128
|
+
* returns a structured report.
|
|
129
|
+
*/
|
|
130
|
+
|
|
131
|
+
interface LockSyncReport {
|
|
132
|
+
/** True when the canonical state matches the lock file and no extend drifted. */
|
|
133
|
+
readonly inSync: boolean;
|
|
134
|
+
/** True when a `.lock` file was found at the canonical directory. */
|
|
135
|
+
readonly hasLock: boolean;
|
|
136
|
+
/** Canonical files whose checksum differs from the lock. */
|
|
137
|
+
readonly modified: readonly string[];
|
|
138
|
+
/** Canonical files present now but not in the lock. */
|
|
139
|
+
readonly added: readonly string[];
|
|
140
|
+
/** Canonical files in the lock but missing now. */
|
|
141
|
+
readonly removed: readonly string[];
|
|
142
|
+
/** Extend names whose pinned version/checksum differs from the lock. */
|
|
143
|
+
readonly extendsModified: readonly string[];
|
|
144
|
+
/**
|
|
145
|
+
* Subset of `modified ∪ added ∪ removed` that violates
|
|
146
|
+
* `collaboration.lock_features`. Empty when no `lock_features` are configured.
|
|
147
|
+
*/
|
|
148
|
+
readonly lockedViolations: readonly string[];
|
|
149
|
+
}
|
|
150
|
+
interface CheckLockSyncOptions {
|
|
151
|
+
readonly config: ValidatedConfig;
|
|
152
|
+
/** Directory containing `agentsmesh.yaml` (used to resolve relative extends). */
|
|
153
|
+
readonly configDir: string;
|
|
154
|
+
/** Directory containing `.agentsmesh/.lock` and canonical files. */
|
|
155
|
+
readonly canonicalDir: string;
|
|
156
|
+
}
|
|
50
157
|
|
|
51
|
-
declare function importFrom(target:
|
|
158
|
+
declare function importFrom(target: string, opts: {
|
|
52
159
|
root: string;
|
|
53
160
|
scope?: 'project' | 'global';
|
|
54
161
|
}): Promise<ImportResult[]>;
|
|
162
|
+
/**
|
|
163
|
+
* Load and validate `agentsmesh.yaml` from a project root, merging
|
|
164
|
+
* `agentsmesh.local.yaml` if present. Searches upward from `projectRoot` for
|
|
165
|
+
* the config file (matches CLI behaviour).
|
|
166
|
+
*
|
|
167
|
+
* Throws `ConfigNotFoundError` when no config is found, or
|
|
168
|
+
* `ConfigValidationError` when YAML parses but fails schema validation.
|
|
169
|
+
*/
|
|
170
|
+
declare function loadConfig(projectRoot: string): Promise<{
|
|
171
|
+
config: ValidatedConfig;
|
|
172
|
+
configDir: string;
|
|
173
|
+
}>;
|
|
174
|
+
/**
|
|
175
|
+
* Like {@link loadConfig} but does not search upward — reads
|
|
176
|
+
* `<configDir>/agentsmesh.yaml` directly. Used by global scope where the
|
|
177
|
+
* canonical directory is `~/.agentsmesh/`.
|
|
178
|
+
*/
|
|
179
|
+
declare function loadConfigFromDirectory(configDir: string): Promise<{
|
|
180
|
+
config: ValidatedConfig;
|
|
181
|
+
configDir: string;
|
|
182
|
+
}>;
|
|
183
|
+
interface LoadProjectContextOptions {
|
|
184
|
+
/** Defaults to `'project'`. Use `'global'` to load `~/.agentsmesh/`. */
|
|
185
|
+
readonly scope?: TargetLayoutScope;
|
|
186
|
+
/** Refresh remote extend cache before loading canonical content. */
|
|
187
|
+
readonly refreshRemoteCache?: boolean;
|
|
188
|
+
}
|
|
189
|
+
interface ProjectContext {
|
|
190
|
+
readonly config: ValidatedConfig;
|
|
191
|
+
readonly canonical: CanonicalFiles;
|
|
192
|
+
/** Root base used for generated paths: project config dir or user home for global scope. */
|
|
193
|
+
readonly projectRoot: string;
|
|
194
|
+
readonly scope: TargetLayoutScope;
|
|
195
|
+
readonly configDir: string;
|
|
196
|
+
readonly canonicalDir: string;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Load the same execution context the CLI uses: scoped config, plugin
|
|
200
|
+
* descriptors, extends, packs, and local canonical content. The returned object
|
|
201
|
+
* is directly usable as a `GenerateContext` because it contains
|
|
202
|
+
* `{ config, canonical, projectRoot, scope }`.
|
|
203
|
+
*/
|
|
204
|
+
declare function loadProjectContext(projectRoot: string, options?: LoadProjectContextOptions): Promise<ProjectContext>;
|
|
205
|
+
interface LintOptions {
|
|
206
|
+
readonly config: ValidatedConfig;
|
|
207
|
+
readonly canonical: CanonicalFiles;
|
|
208
|
+
/** Directory used for project-file glob matching (typically the project root). */
|
|
209
|
+
readonly projectRoot: string;
|
|
210
|
+
/** Optional whitelist of target IDs to lint. Defaults to all enabled. */
|
|
211
|
+
readonly targetFilter?: readonly string[];
|
|
212
|
+
/** Defaults to `'project'`. */
|
|
213
|
+
readonly scope?: TargetLayoutScope;
|
|
214
|
+
}
|
|
215
|
+
interface LintResult {
|
|
216
|
+
readonly diagnostics: readonly LintDiagnostic[];
|
|
217
|
+
readonly hasErrors: boolean;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Run lint across all enabled targets and return diagnostics. Pure: no I/O,
|
|
221
|
+
* no logging. Equivalent to `agentsmesh lint` minus formatting and exit code.
|
|
222
|
+
*/
|
|
223
|
+
declare function lint(opts: LintOptions): Promise<LintResult>;
|
|
224
|
+
/**
|
|
225
|
+
* Compute unified diffs from a generate-result set. Use this when you already
|
|
226
|
+
* have results in hand (e.g. from {@link import('./engine.js').generate})
|
|
227
|
+
* and want to display drift without re-running generation.
|
|
228
|
+
*/
|
|
229
|
+
declare function computeDiff(results: readonly GenerateResult[]): ComputeDiffResult;
|
|
230
|
+
/**
|
|
231
|
+
* Run generation and return the unified diff against on-disk content.
|
|
232
|
+
* Equivalent to `agentsmesh diff` minus formatting. Calls {@link generate}
|
|
233
|
+
* internally; returns both the raw results and the diff.
|
|
234
|
+
*/
|
|
235
|
+
declare function diff(ctx: GenerateContext): Promise<ComputeDiffResult & {
|
|
236
|
+
results: readonly GenerateResult[];
|
|
237
|
+
}>;
|
|
238
|
+
/**
|
|
239
|
+
* Compare the lock file at `canonicalDir/.lock` against the current canonical
|
|
240
|
+
* state and resolved extends. Equivalent to `agentsmesh check` minus
|
|
241
|
+
* formatting and exit code. Returns `hasLock: false` and `inSync: false` when
|
|
242
|
+
* no lock is present.
|
|
243
|
+
*/
|
|
244
|
+
declare function check(opts: CheckLockSyncOptions): Promise<LockSyncReport>;
|
|
55
245
|
|
|
56
|
-
export { type GenerateContext, GenerateResult, ImportResult, generate, importFrom, resolveOutputCollisions };
|
|
246
|
+
export { AgentsMeshError, type AgentsMeshErrorCode, CanonicalFiles, type CheckLockSyncOptions, type ComputeDiffResult, ConfigNotFoundError, ConfigValidationError, type DiffEntry, type DiffSummary, FileSystemError, type GenerateContext, GenerateResult, GenerationError, ImportError, ImportResult, LintDiagnostic, type LintOptions, type LintResult, type LoadProjectContextOptions, LockAcquisitionError, type LockSyncReport, type ProjectContext, RemoteFetchError, TargetLayoutScope, TargetNotFoundError, ValidatedConfig, check, computeDiff, diff, formatDiffSummary, generate, importFrom, lint, loadConfig, loadConfigFromDirectory, loadProjectContext, resolveOutputCollisions };
|