agent-package-manager 0.4.4 → 0.4.5
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/README.md +0 -4
- package/cli-contract.yaml +12 -112
- package/dist/cli/index.js +15 -185
- package/dist/cli/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -40,7 +40,6 @@ npm install -D agent-package-manager
|
|
|
40
40
|
| `agent-pkg sync` | Restore `agent_modules/` from lock file |
|
|
41
41
|
| `agent-pkg update [pkg]` | Update packages to newer versions |
|
|
42
42
|
| `agent-pkg diff <pkg>` | Show semantic diff between versions |
|
|
43
|
-
| `agent-pkg materialize` | Build resolved DSL and generate runtime artifacts |
|
|
44
43
|
| `agent-pkg check` | Run full CI verification pipeline |
|
|
45
44
|
| `agent-pkg publish <path>` | Publish a package to a registry |
|
|
46
45
|
|
|
@@ -59,9 +58,6 @@ agent-pkg add backend-api@1.0.0
|
|
|
59
58
|
mkdir -p agent_overrides
|
|
60
59
|
# Edit agent_overrides/backend-api.yaml
|
|
61
60
|
|
|
62
|
-
# Rebuild
|
|
63
|
-
agent-pkg materialize
|
|
64
|
-
|
|
65
61
|
# CI check
|
|
66
62
|
agent-pkg check
|
|
67
63
|
```
|
package/cli-contract.yaml
CHANGED
|
@@ -7,7 +7,7 @@ info:
|
|
|
7
7
|
description: >-
|
|
8
8
|
Package manager for agent-contracts DSL. Manages shared agent team
|
|
9
9
|
definitions stored in GitHub private repositories with npm-like UX.
|
|
10
|
-
Supports add, sync, update, diff,
|
|
10
|
+
Supports add, sync, update, diff, check, and publish
|
|
11
11
|
workflows backed by git tags and content hashing.
|
|
12
12
|
license:
|
|
13
13
|
name: MIT
|
|
@@ -48,14 +48,11 @@ commandSets:
|
|
|
48
48
|
Creates the initial configuration files and directory structure
|
|
49
49
|
for managing agent-contracts DSL packages. Generates
|
|
50
50
|
agent-pkg.json, agent-pkg.lock.json, agent-contracts.yaml,
|
|
51
|
-
|
|
52
|
-
agent_overrides/, and .agent-pkg/build/ directories.
|
|
51
|
+
and the agent_modules/ and agent_overrides/ directories.
|
|
53
52
|
usage:
|
|
54
53
|
- agent-pkg init
|
|
55
54
|
- agent-pkg init --registry github:foo/agent-pkg-registry
|
|
56
55
|
- agent-pkg init --modules-dir agent_modules
|
|
57
|
-
- agent-pkg init --build-dir .agent-pkg/build
|
|
58
|
-
|
|
59
56
|
options:
|
|
60
57
|
- name: registry
|
|
61
58
|
aliases: [r]
|
|
@@ -72,13 +69,6 @@ commandSets:
|
|
|
72
69
|
type: string
|
|
73
70
|
default: agent_modules
|
|
74
71
|
|
|
75
|
-
- name: build-dir
|
|
76
|
-
description: Directory for build artifacts.
|
|
77
|
-
valueName: path
|
|
78
|
-
schema:
|
|
79
|
-
type: string
|
|
80
|
-
default: .agent-pkg/build
|
|
81
|
-
|
|
82
72
|
exits:
|
|
83
73
|
"0":
|
|
84
74
|
description: Project initialized successfully.
|
|
@@ -106,12 +96,10 @@ commandSets:
|
|
|
106
96
|
Fetches a package from a GitHub registry repository by resolving
|
|
107
97
|
the git tag, clones/fetches into the local cache, extracts the
|
|
108
98
|
package into agent_modules/, updates agent-pkg.json and
|
|
109
|
-
agent-pkg.lock.json, adds extends entry to agent-contracts.yaml
|
|
110
|
-
and runs materialize.
|
|
99
|
+
agent-pkg.lock.json, and adds extends entry to agent-contracts.yaml.
|
|
111
100
|
usage:
|
|
112
101
|
- agent-pkg add backend-api@1.2.3
|
|
113
102
|
- "agent-pkg add github:foo/agent-pkg-registry//packages/backend-api@1.2.3"
|
|
114
|
-
- agent-pkg add backend-api@1.2.3 --no-materialize
|
|
115
103
|
- agent-pkg add backend-api@1.2.3 --alias api
|
|
116
104
|
|
|
117
105
|
arguments:
|
|
@@ -139,15 +127,9 @@ commandSets:
|
|
|
139
127
|
schema:
|
|
140
128
|
type: string
|
|
141
129
|
|
|
142
|
-
- name: no-materialize
|
|
143
|
-
description: Skip the materialize step after adding.
|
|
144
|
-
schema:
|
|
145
|
-
type: boolean
|
|
146
|
-
default: false
|
|
147
|
-
|
|
148
130
|
exits:
|
|
149
131
|
"0":
|
|
150
|
-
description: Package added
|
|
132
|
+
description: Package added successfully.
|
|
151
133
|
stdout:
|
|
152
134
|
format: json
|
|
153
135
|
schema:
|
|
@@ -156,7 +138,7 @@ commandSets:
|
|
|
156
138
|
"1":
|
|
157
139
|
description: >-
|
|
158
140
|
Add failed — package not found, tag resolution failed,
|
|
159
|
-
git fetch error
|
|
141
|
+
or git fetch error.
|
|
160
142
|
stderr:
|
|
161
143
|
format: text
|
|
162
144
|
|
|
@@ -174,9 +156,8 @@ commandSets:
|
|
|
174
156
|
description: >-
|
|
175
157
|
Reads agent-pkg.lock.json and restores all packages into
|
|
176
158
|
agent_modules/ at the exact commits recorded in the lock file.
|
|
177
|
-
Verifies content hashes
|
|
178
|
-
|
|
179
|
-
any drift without modifying files.
|
|
159
|
+
Verifies content hashes. Use --check for CI to detect any
|
|
160
|
+
drift without modifying files.
|
|
180
161
|
usage:
|
|
181
162
|
- agent-pkg sync
|
|
182
163
|
- agent-pkg sync --check
|
|
@@ -219,8 +200,8 @@ commandSets:
|
|
|
219
200
|
summary: Update packages to newer versions.
|
|
220
201
|
description: >-
|
|
221
202
|
Fetches the latest tags from the registry repository, selects
|
|
222
|
-
update candidates based on semver range, updates
|
|
223
|
-
|
|
203
|
+
update candidates based on semver range, and updates
|
|
204
|
+
agent_modules/. Without arguments, updates all packages.
|
|
224
205
|
With a package name, updates only that package. With --dry-run,
|
|
225
206
|
shows what would be updated without making changes.
|
|
226
207
|
usage:
|
|
@@ -283,8 +264,7 @@ commandSets:
|
|
|
283
264
|
|
|
284
265
|
"1":
|
|
285
266
|
description: >-
|
|
286
|
-
Update failed — registry fetch error
|
|
287
|
-
or materialize error.
|
|
267
|
+
Update failed — registry fetch error or no update candidates.
|
|
288
268
|
stderr:
|
|
289
269
|
format: text
|
|
290
270
|
|
|
@@ -357,74 +337,14 @@ commandSets:
|
|
|
357
337
|
sideEffects:
|
|
358
338
|
- git_fetch
|
|
359
339
|
|
|
360
|
-
# ── materialize ────────────────────────────────────
|
|
361
|
-
materialize:
|
|
362
|
-
summary: Build resolved DSL and generate runtime artifacts.
|
|
363
|
-
description: >-
|
|
364
|
-
Reads agent-pkg.json and agent_modules/ package manifests,
|
|
365
|
-
resolves agent-contracts.yaml with extends and overrides,
|
|
366
|
-
applies vars, writes the resolved DSL to .agent-pkg/build/,
|
|
367
|
-
runs agent-contracts validate and lint, then runs
|
|
368
|
-
agent-runtime generate to produce typed contracts and hooks.
|
|
369
|
-
usage:
|
|
370
|
-
- agent-pkg materialize
|
|
371
|
-
- agent-pkg materialize --no-generate
|
|
372
|
-
- agent-pkg materialize --no-lint
|
|
373
|
-
- agent-pkg materialize --clean
|
|
374
|
-
|
|
375
|
-
options:
|
|
376
|
-
- name: no-generate
|
|
377
|
-
description: Skip agent-runtime generate step.
|
|
378
|
-
schema:
|
|
379
|
-
type: boolean
|
|
380
|
-
default: false
|
|
381
|
-
|
|
382
|
-
- name: no-lint
|
|
383
|
-
description: Skip agent-contracts lint step.
|
|
384
|
-
schema:
|
|
385
|
-
type: boolean
|
|
386
|
-
default: false
|
|
387
|
-
|
|
388
|
-
- name: clean
|
|
389
|
-
description: Clean build directory before materializing.
|
|
390
|
-
schema:
|
|
391
|
-
type: boolean
|
|
392
|
-
default: false
|
|
393
|
-
|
|
394
|
-
exits:
|
|
395
|
-
"0":
|
|
396
|
-
description: Materialize completed successfully.
|
|
397
|
-
stdout:
|
|
398
|
-
format: json
|
|
399
|
-
schema:
|
|
400
|
-
$ref: "#/components/schemas/MaterializeResult"
|
|
401
|
-
|
|
402
|
-
"1":
|
|
403
|
-
description: >-
|
|
404
|
-
Materialize failed — DSL resolution error, validation
|
|
405
|
-
error, lint error, or generation error.
|
|
406
|
-
stderr:
|
|
407
|
-
format: text
|
|
408
|
-
|
|
409
|
-
x-agent:
|
|
410
|
-
riskLevel: medium
|
|
411
|
-
requiresConfirmation: false
|
|
412
|
-
idempotent: true
|
|
413
|
-
sideEffects:
|
|
414
|
-
- filesystem_write
|
|
415
|
-
recommendedBeforeUse:
|
|
416
|
-
- Ensure agent_modules/ is populated (run sync or add first).
|
|
417
|
-
|
|
418
340
|
# ── check ──────────────────────────────────────────
|
|
419
341
|
check:
|
|
420
342
|
summary: Run full verification pipeline for CI.
|
|
421
343
|
description: >-
|
|
422
344
|
Executes the complete verification pipeline: validates
|
|
423
345
|
agent-pkg.json and lock file schemas, checks version/lock
|
|
424
|
-
consistency, verifies agent_modules content hashes
|
|
425
|
-
|
|
426
|
-
--strict, runs agent-runtime generate --check, and runs
|
|
427
|
-
agent-runtime doctor. Returns non-zero on any failure.
|
|
346
|
+
consistency, and verifies agent_modules content hashes.
|
|
347
|
+
Returns non-zero on any failure.
|
|
428
348
|
usage:
|
|
429
349
|
- agent-pkg check
|
|
430
350
|
|
|
@@ -572,9 +492,6 @@ components:
|
|
|
572
492
|
installedTo:
|
|
573
493
|
type: string
|
|
574
494
|
description: Path where the package was installed.
|
|
575
|
-
materialized:
|
|
576
|
-
type: boolean
|
|
577
|
-
description: Whether materialize was run after install.
|
|
578
495
|
|
|
579
496
|
SyncResult:
|
|
580
497
|
type: object
|
|
@@ -628,23 +545,6 @@ components:
|
|
|
628
545
|
hasBreakingChanges:
|
|
629
546
|
type: boolean
|
|
630
547
|
|
|
631
|
-
MaterializeResult:
|
|
632
|
-
type: object
|
|
633
|
-
required: [resolvedDslPath]
|
|
634
|
-
properties:
|
|
635
|
-
resolvedDslPath:
|
|
636
|
-
type: string
|
|
637
|
-
description: Path to the resolved DSL file.
|
|
638
|
-
resolvedDslHash:
|
|
639
|
-
type: string
|
|
640
|
-
description: SHA-256 hash of the resolved DSL.
|
|
641
|
-
validated:
|
|
642
|
-
type: boolean
|
|
643
|
-
linted:
|
|
644
|
-
type: boolean
|
|
645
|
-
generated:
|
|
646
|
-
type: boolean
|
|
647
|
-
|
|
648
548
|
CheckResult:
|
|
649
549
|
type: object
|
|
650
550
|
required: [checks, allPassed]
|
package/dist/cli/index.js
CHANGED
|
@@ -10,10 +10,10 @@ function createProgram(handlers2, version) {
|
|
|
10
10
|
const program2 = new Command();
|
|
11
11
|
program2.name("agent-pkg").version(version, "-V, --version").description("Manage agent-contracts DSL packages from GitHub registries.");
|
|
12
12
|
program2.option("-v, --verbose", "Enable verbose output.", false);
|
|
13
|
-
program2.command("init").description("Initialize a project for agent-pkg package management.").option("-r, --registry <url>", "Default registry in the format github:<owner>/<repo>.").option("--modules-dir <path>", "Directory to store fetched packages.", "agent_modules").
|
|
13
|
+
program2.command("init").description("Initialize a project for agent-pkg package management.").option("-r, --registry <url>", "Default registry in the format github:<owner>/<repo>.").option("--modules-dir <path>", "Directory to store fetched packages.", "agent_modules").action(async (opts, cmd) => {
|
|
14
14
|
await handlers2.init(opts, cmd.optsWithGlobals());
|
|
15
15
|
});
|
|
16
|
-
program2.command("add").description("Add a package from a registry.").argument("<package>", "Package specifier in the format <name>@<version> or github:<owner>/<repo>//<path>@<version>.").option("-r, --registry <name>", "Registry name to use (from agent-pkg.json registries).", "default").option("--alias <name>", "Install under an alternative directory name.").
|
|
16
|
+
program2.command("add").description("Add a package from a registry.").argument("<package>", "Package specifier in the format <name>@<version> or github:<owner>/<repo>//<path>@<version>.").option("-r, --registry <name>", "Registry name to use (from agent-pkg.json registries).", "default").option("--alias <name>", "Install under an alternative directory name.").action(async (packageArg, opts, cmd) => {
|
|
17
17
|
await handlers2.add(packageArg, opts, cmd.optsWithGlobals());
|
|
18
18
|
});
|
|
19
19
|
program2.command("sync").description("Restore agent_modules from lock file.").option("--check", "Dry-run mode for CI. Exits with code 1 if agent_modules would change (drift detected).", false).action(async (opts, cmd) => {
|
|
@@ -25,9 +25,6 @@ function createProgram(handlers2, version) {
|
|
|
25
25
|
program2.command("diff").description("Show semantic diff between current and target package versions.").argument("<package>", "Package name, or name@version to compare against a specific version.").option("--format <format>", "Output format.", "text").action(async (packageArg, opts, cmd) => {
|
|
26
26
|
await handlers2.diff(packageArg, opts, cmd.optsWithGlobals());
|
|
27
27
|
});
|
|
28
|
-
program2.command("materialize").description("Build resolved DSL and generate runtime artifacts.").option("--no-generate", "Skip agent-runtime generate step.", false).option("--no-lint", "Skip agent-contracts lint step.", false).option("--clean", "Clean build directory before materializing.", false).action(async (opts, cmd) => {
|
|
29
|
-
await handlers2.materialize(opts, cmd.optsWithGlobals());
|
|
30
|
-
});
|
|
31
28
|
program2.command("check").description("Run full verification pipeline for CI.").action(async (opts, cmd) => {
|
|
32
29
|
await handlers2.check({}, cmd.optsWithGlobals());
|
|
33
30
|
});
|
|
@@ -4180,8 +4177,6 @@ var PackageManifestSchema = external_exports.strictObject({
|
|
|
4180
4177
|
var CONFIG_FILE = "agent-pkg.json";
|
|
4181
4178
|
var LOCK_FILE = "agent-pkg.lock.json";
|
|
4182
4179
|
var DEFAULT_MODULES_DIR = "agent_modules";
|
|
4183
|
-
var DEFAULT_BUILD_DIR = ".agent-pkg/build";
|
|
4184
|
-
var DEFAULT_CACHE_DIR = ".agent-pkg/cache";
|
|
4185
4180
|
var PACKAGE_MANIFEST_FILE = "agent-pkg.package.json";
|
|
4186
4181
|
var REGISTRY_MANIFEST_FILE = "agent-pkg.registry.json";
|
|
4187
4182
|
var DEFAULT_ENTRYPOINT = "agent-contracts.yaml";
|
|
@@ -4193,8 +4188,6 @@ async function runInit(opts, projectDir) {
|
|
|
4193
4188
|
throw new Error(`${CONFIG_FILE} already exists. Aborting init.`);
|
|
4194
4189
|
}
|
|
4195
4190
|
const modulesDir = opts.modulesDir || DEFAULT_MODULES_DIR;
|
|
4196
|
-
const buildDir = opts.buildDir || DEFAULT_BUILD_DIR;
|
|
4197
|
-
const cacheDir = DEFAULT_CACHE_DIR;
|
|
4198
4191
|
const filesCreated = [];
|
|
4199
4192
|
const dirsCreated = [];
|
|
4200
4193
|
const registries = {};
|
|
@@ -4211,15 +4204,9 @@ async function runInit(opts, projectDir) {
|
|
|
4211
4204
|
const config = {
|
|
4212
4205
|
schemaVersion: 1,
|
|
4213
4206
|
registries,
|
|
4214
|
-
install: { modulesDir
|
|
4207
|
+
install: { modulesDir },
|
|
4215
4208
|
packages: {},
|
|
4216
|
-
vars: {}
|
|
4217
|
-
materialize: {
|
|
4218
|
-
writeResolvedDsl: true,
|
|
4219
|
-
runValidate: true,
|
|
4220
|
-
runLint: true,
|
|
4221
|
-
runRuntimeGenerate: true
|
|
4222
|
-
}
|
|
4209
|
+
vars: {}
|
|
4223
4210
|
};
|
|
4224
4211
|
await writeFile(configPath, JSON.stringify(config, null, 2) + "\n", "utf8");
|
|
4225
4212
|
filesCreated.push(CONFIG_FILE);
|
|
@@ -4243,22 +4230,7 @@ async function runInit(opts, projectDir) {
|
|
|
4243
4230
|
filesCreated.push("agent-contracts.yaml");
|
|
4244
4231
|
log.success("Created agent-contracts.yaml");
|
|
4245
4232
|
}
|
|
4246
|
-
|
|
4247
|
-
await writeFile(
|
|
4248
|
-
join(projectDir, "agent-runtime.config.yaml"),
|
|
4249
|
-
`dsl: ./${buildDir}/resolved.agent-contracts.yaml
|
|
4250
|
-
generated_dir: ./agent/generated
|
|
4251
|
-
|
|
4252
|
-
bindings: []
|
|
4253
|
-
|
|
4254
|
-
active_guardrail_policy: default
|
|
4255
|
-
`,
|
|
4256
|
-
"utf8"
|
|
4257
|
-
);
|
|
4258
|
-
filesCreated.push("agent-runtime.config.yaml");
|
|
4259
|
-
log.success("Created agent-runtime.config.yaml");
|
|
4260
|
-
}
|
|
4261
|
-
for (const dir of [modulesDir, "agent_overrides", buildDir, cacheDir]) {
|
|
4233
|
+
for (const dir of [modulesDir, "agent_overrides"]) {
|
|
4262
4234
|
const full = join(projectDir, dir);
|
|
4263
4235
|
if (!existsSync(full)) {
|
|
4264
4236
|
await mkdir(full, { recursive: true });
|
|
@@ -4539,9 +4511,6 @@ async function collectFiles(dir) {
|
|
|
4539
4511
|
}
|
|
4540
4512
|
return results;
|
|
4541
4513
|
}
|
|
4542
|
-
function hashString(content) {
|
|
4543
|
-
return `sha256:${createHash("sha256").update(content, "utf8").digest("hex")}`;
|
|
4544
|
-
}
|
|
4545
4514
|
|
|
4546
4515
|
// src/lib/commands/add.ts
|
|
4547
4516
|
async function runAdd(input, projectDir) {
|
|
@@ -4613,8 +4582,7 @@ async function runAdd(input, projectDir) {
|
|
|
4613
4582
|
version: spec.version,
|
|
4614
4583
|
commit: lock.packages[packageName]?.commit,
|
|
4615
4584
|
installedTo: `${config.install.modulesDir}/${packageName}`,
|
|
4616
|
-
dependencies: ctx.installOrder.filter((p) => p !== packageName)
|
|
4617
|
-
materialized: false
|
|
4585
|
+
dependencies: ctx.installOrder.filter((p) => p !== packageName)
|
|
4618
4586
|
};
|
|
4619
4587
|
log.success(`Added ${packageName}@${spec.version}`);
|
|
4620
4588
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -5155,136 +5123,9 @@ function compareSemverSimple(a, b) {
|
|
|
5155
5123
|
return a[2] - b[2];
|
|
5156
5124
|
}
|
|
5157
5125
|
|
|
5158
|
-
// src/lib/commands/
|
|
5126
|
+
// src/lib/commands/check.ts
|
|
5159
5127
|
import { existsSync as existsSync8 } from "fs";
|
|
5160
|
-
import { mkdir as mkdir6, rm as rm6, readFile as readFile6, writeFile as writeFile5 } from "fs/promises";
|
|
5161
5128
|
import { join as join10 } from "path";
|
|
5162
|
-
import { execFile } from "child_process";
|
|
5163
|
-
async function runMaterialize(input, projectDir) {
|
|
5164
|
-
const config = await readProjectConfig(projectDir);
|
|
5165
|
-
const buildDir = join10(projectDir, config.install.buildDir);
|
|
5166
|
-
if (input.clean && existsSync8(buildDir)) {
|
|
5167
|
-
await rm6(buildDir, { recursive: true, force: true });
|
|
5168
|
-
log.step("Cleaned build directory");
|
|
5169
|
-
}
|
|
5170
|
-
await mkdir6(buildDir, { recursive: true });
|
|
5171
|
-
log.step("Resolving agent-contracts.yaml");
|
|
5172
|
-
const yamlPath = join10(projectDir, "agent-contracts.yaml");
|
|
5173
|
-
if (!existsSync8(yamlPath)) {
|
|
5174
|
-
throw new Error("agent-contracts.yaml not found in project root");
|
|
5175
|
-
}
|
|
5176
|
-
const { parse, stringify } = await import("yaml");
|
|
5177
|
-
const rootDoc = parse(await readFile6(yamlPath, "utf8"));
|
|
5178
|
-
const resolved = await resolveExtends(rootDoc, projectDir);
|
|
5179
|
-
if (config.vars) {
|
|
5180
|
-
resolved.vars = { ...resolved.vars || {}, ...config.vars };
|
|
5181
|
-
}
|
|
5182
|
-
const resolvedYaml = stringify(resolved, { lineWidth: 0 });
|
|
5183
|
-
const resolvedPath = join10(buildDir, "resolved.agent-contracts.yaml");
|
|
5184
|
-
await writeFile5(resolvedPath, resolvedYaml, "utf8");
|
|
5185
|
-
log.success(`Wrote ${resolvedPath}`);
|
|
5186
|
-
const resolvedHash = hashString(resolvedYaml);
|
|
5187
|
-
let validated = false;
|
|
5188
|
-
let linted = false;
|
|
5189
|
-
let generated = false;
|
|
5190
|
-
if (config.materialize?.runValidate !== false) {
|
|
5191
|
-
validated = await runExternalTool("agent-contracts", ["validate", "-f", resolvedPath], projectDir);
|
|
5192
|
-
}
|
|
5193
|
-
if (!input.noLint && config.materialize?.runLint !== false) {
|
|
5194
|
-
linted = await runExternalTool("agent-contracts", ["lint", "--strict", "-f", resolvedPath], projectDir);
|
|
5195
|
-
}
|
|
5196
|
-
if (!input.noGenerate && config.materialize?.runRuntimeGenerate !== false) {
|
|
5197
|
-
generated = await runExternalTool("agent-runtime", ["generate"], projectDir);
|
|
5198
|
-
}
|
|
5199
|
-
const buildManifest = {
|
|
5200
|
-
resolvedDsl: resolvedPath,
|
|
5201
|
-
resolvedDslHash: resolvedHash,
|
|
5202
|
-
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5203
|
-
packages: Object.keys(config.packages)
|
|
5204
|
-
};
|
|
5205
|
-
await writeFile5(join10(buildDir, "package-manifest.json"), JSON.stringify(buildManifest, null, 2) + "\n", "utf8");
|
|
5206
|
-
const result = {
|
|
5207
|
-
resolvedDslPath: resolvedPath,
|
|
5208
|
-
resolvedDslHash: resolvedHash,
|
|
5209
|
-
validated,
|
|
5210
|
-
linted,
|
|
5211
|
-
generated
|
|
5212
|
-
};
|
|
5213
|
-
log.success("Materialize completed");
|
|
5214
|
-
console.log(JSON.stringify(result, null, 2));
|
|
5215
|
-
}
|
|
5216
|
-
async function resolveExtends(doc, baseDir) {
|
|
5217
|
-
const extends_ = doc.extends;
|
|
5218
|
-
if (!extends_ || extends_.length === 0) return doc;
|
|
5219
|
-
const { parse } = await import("yaml");
|
|
5220
|
-
let merged = {};
|
|
5221
|
-
for (const ext of extends_) {
|
|
5222
|
-
const extPath = join10(baseDir, ext);
|
|
5223
|
-
if (!existsSync8(extPath)) {
|
|
5224
|
-
log.warn(`Extended file not found: ${extPath}`);
|
|
5225
|
-
continue;
|
|
5226
|
-
}
|
|
5227
|
-
const extContent = await readFile6(extPath, "utf8");
|
|
5228
|
-
const extDoc = parse(extContent);
|
|
5229
|
-
if (extDoc) {
|
|
5230
|
-
merged = deepMerge(merged, extDoc);
|
|
5231
|
-
}
|
|
5232
|
-
}
|
|
5233
|
-
const { extends: _removed, ...rest } = doc;
|
|
5234
|
-
merged = deepMerge(merged, rest);
|
|
5235
|
-
const refs = doc["$refs"];
|
|
5236
|
-
if (refs) {
|
|
5237
|
-
for (const ref of refs) {
|
|
5238
|
-
const refPath = join10(baseDir, ref);
|
|
5239
|
-
if (!existsSync8(refPath)) {
|
|
5240
|
-
log.warn(`Override file not found: ${refPath}`);
|
|
5241
|
-
continue;
|
|
5242
|
-
}
|
|
5243
|
-
const refContent = await readFile6(refPath, "utf8");
|
|
5244
|
-
const refDoc = parse(refContent);
|
|
5245
|
-
if (refDoc) {
|
|
5246
|
-
merged = deepMerge(merged, refDoc);
|
|
5247
|
-
}
|
|
5248
|
-
}
|
|
5249
|
-
delete merged["$refs"];
|
|
5250
|
-
}
|
|
5251
|
-
return merged;
|
|
5252
|
-
}
|
|
5253
|
-
function deepMerge(target, source) {
|
|
5254
|
-
const result = { ...target };
|
|
5255
|
-
for (const key of Object.keys(source)) {
|
|
5256
|
-
const tVal = result[key];
|
|
5257
|
-
const sVal = source[key];
|
|
5258
|
-
if (isPlainObject(tVal) && isPlainObject(sVal)) {
|
|
5259
|
-
result[key] = deepMerge(tVal, sVal);
|
|
5260
|
-
} else {
|
|
5261
|
-
result[key] = sVal;
|
|
5262
|
-
}
|
|
5263
|
-
}
|
|
5264
|
-
return result;
|
|
5265
|
-
}
|
|
5266
|
-
function isPlainObject(val) {
|
|
5267
|
-
return typeof val === "object" && val !== null && !Array.isArray(val);
|
|
5268
|
-
}
|
|
5269
|
-
function runExternalTool(cmd, args, cwd2) {
|
|
5270
|
-
return new Promise((resolve2) => {
|
|
5271
|
-
execFile(cmd, args, { cwd: cwd2 }, (err, stdout, stderr) => {
|
|
5272
|
-
if (err) {
|
|
5273
|
-
log.warn(`${cmd} ${args.join(" ")} \u2014 skipped (not available or failed)`);
|
|
5274
|
-
log.debug(stderr || err.message);
|
|
5275
|
-
resolve2(false);
|
|
5276
|
-
return;
|
|
5277
|
-
}
|
|
5278
|
-
if (stdout) log.debug(stdout);
|
|
5279
|
-
log.success(`${cmd} ${args.join(" ")} \u2014 ok`);
|
|
5280
|
-
resolve2(true);
|
|
5281
|
-
});
|
|
5282
|
-
});
|
|
5283
|
-
}
|
|
5284
|
-
|
|
5285
|
-
// src/lib/commands/check.ts
|
|
5286
|
-
import { existsSync as existsSync9 } from "fs";
|
|
5287
|
-
import { join as join11 } from "path";
|
|
5288
5129
|
async function runCheck(projectDir) {
|
|
5289
5130
|
const checks = [];
|
|
5290
5131
|
checks.push(await checkConfigSchema(projectDir));
|
|
@@ -5368,8 +5209,8 @@ async function checkContentHashes(projectDir) {
|
|
|
5368
5209
|
try {
|
|
5369
5210
|
const lock = await readLockFile(projectDir);
|
|
5370
5211
|
for (const [name, entry] of Object.entries(lock.packages)) {
|
|
5371
|
-
const installDir =
|
|
5372
|
-
if (!
|
|
5212
|
+
const installDir = join10(projectDir, entry.installedTo);
|
|
5213
|
+
if (!existsSync8(installDir)) {
|
|
5373
5214
|
items.push({
|
|
5374
5215
|
name: `content_hash:${name}`,
|
|
5375
5216
|
status: "fail",
|
|
@@ -5395,12 +5236,12 @@ async function checkContentHashes(projectDir) {
|
|
|
5395
5236
|
}
|
|
5396
5237
|
|
|
5397
5238
|
// src/lib/commands/publish.ts
|
|
5398
|
-
import { existsSync as
|
|
5239
|
+
import { existsSync as existsSync9 } from "fs";
|
|
5399
5240
|
import { cp } from "fs/promises";
|
|
5400
|
-
import { join as
|
|
5241
|
+
import { join as join11, resolve, basename } from "path";
|
|
5401
5242
|
async function runPublish(input, projectDir) {
|
|
5402
5243
|
const sourceDir = resolve(projectDir, input.path);
|
|
5403
|
-
if (!
|
|
5244
|
+
if (!existsSync9(sourceDir)) {
|
|
5404
5245
|
throw new Error(`Source directory not found: ${input.path}`);
|
|
5405
5246
|
}
|
|
5406
5247
|
const pkgJson = await readPackageJson(sourceDir);
|
|
@@ -5477,7 +5318,7 @@ async function runPublish(input, projectDir) {
|
|
|
5477
5318
|
}
|
|
5478
5319
|
const packageRoot = "packages";
|
|
5479
5320
|
const packagePath = `${packageRoot}/${packageName}`;
|
|
5480
|
-
const destDir =
|
|
5321
|
+
const destDir = join11(workDir, packagePath);
|
|
5481
5322
|
await cp(sourceDir, destDir, {
|
|
5482
5323
|
recursive: true,
|
|
5483
5324
|
filter: (src) => {
|
|
@@ -5541,12 +5382,10 @@ var handlers = {
|
|
|
5541
5382
|
console.error("\u2717 Package specifier is required. Usage: agent-pkg add <name>@<version>");
|
|
5542
5383
|
process.exit(1);
|
|
5543
5384
|
}
|
|
5544
|
-
const o = opts;
|
|
5545
5385
|
await runAdd({
|
|
5546
5386
|
packageSpec: pkg,
|
|
5547
5387
|
registry: opts.registry,
|
|
5548
|
-
alias: opts.alias
|
|
5549
|
-
noMaterialize: o.materialize === false
|
|
5388
|
+
alias: opts.alias
|
|
5550
5389
|
}, cwd).catch(handleError);
|
|
5551
5390
|
},
|
|
5552
5391
|
sync: async (opts, globals) => {
|
|
@@ -5575,16 +5414,7 @@ var handlers = {
|
|
|
5575
5414
|
format: opts.format
|
|
5576
5415
|
}, cwd).catch(handleError);
|
|
5577
5416
|
},
|
|
5578
|
-
|
|
5579
|
-
setupGlobals(globals);
|
|
5580
|
-
const o = opts;
|
|
5581
|
-
await runMaterialize({
|
|
5582
|
-
noGenerate: o.generate === false,
|
|
5583
|
-
noLint: o.lint === false,
|
|
5584
|
-
clean: opts.clean
|
|
5585
|
-
}, cwd).catch(handleError);
|
|
5586
|
-
},
|
|
5587
|
-
check: async (globals) => {
|
|
5417
|
+
check: async (_opts, globals) => {
|
|
5588
5418
|
setupGlobals(globals);
|
|
5589
5419
|
await runCheck(cwd).catch(handleError);
|
|
5590
5420
|
},
|