agentsmesh 0.14.0 → 0.16.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 +32 -0
- package/README.md +27 -2
- package/dist/canonical.d.ts +2 -2
- package/dist/canonical.js +305 -104
- package/dist/canonical.js.map +1 -1
- package/dist/cli.js +190 -188
- package/dist/engine.d.ts +2 -2
- package/dist/engine.js +343 -111
- package/dist/engine.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +343 -111
- package/dist/index.js.map +1 -1
- package/dist/{schema-o4oXUVBP.d.ts → schema-CD2qcmDL.d.ts} +1 -0
- package/dist/{target-descriptor--Nw5i4v3.d.ts → target-descriptor-CvB1qzPn.d.ts} +1 -1
- package/dist/targets.d.ts +3 -3
- package/dist/targets.js +129 -98
- package/dist/targets.js.map +1 -1
- package/package.json +1 -1
- package/schemas/agentsmesh.json +3 -0
|
@@ -259,6 +259,7 @@ declare const configSchema: z.ZodObject<{
|
|
|
259
259
|
id: z.ZodString;
|
|
260
260
|
source: z.ZodString;
|
|
261
261
|
version: z.ZodOptional<z.ZodString>;
|
|
262
|
+
strict: z.ZodOptional<z.ZodBoolean>;
|
|
262
263
|
}, z.core.$strict>>>;
|
|
263
264
|
pluginTargets: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
264
265
|
}, z.core.$strip>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as CanonicalFiles, c as CanonicalRule, V as ValidatedConfig } from './schema-
|
|
1
|
+
import { b as CanonicalFiles, c as CanonicalRule, V as ValidatedConfig } from './schema-CD2qcmDL.js';
|
|
2
2
|
|
|
3
3
|
/** Result of generating files for a target */
|
|
4
4
|
interface GenerateResult {
|
package/dist/targets.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { e as TargetDescriptor, h as TargetLayoutScope, C as ContentNormalizer, d as ImportResult } from './target-descriptor
|
|
2
|
-
export { E as ExtraRuleOutputContext, a as ExtraRuleOutputResolver, F as FeatureLinter, b as GeneratedOutputMerger, c as GlobalTargetSupport, I as ImportPathBuilder, R as RuleLinter, S as ScopeExtrasFn, T as TargetCapabilities, f as TargetGenerators, g as TargetLayout, i as TargetLintHooks, j as TargetManagedOutputs, k as TargetOutputFamily, l as TargetPathResolvers } from './target-descriptor
|
|
3
|
-
import './schema-
|
|
1
|
+
import { e as TargetDescriptor, h as TargetLayoutScope, C as ContentNormalizer, d as ImportResult } from './target-descriptor-CvB1qzPn.js';
|
|
2
|
+
export { E as ExtraRuleOutputContext, a as ExtraRuleOutputResolver, F as FeatureLinter, b as GeneratedOutputMerger, c as GlobalTargetSupport, I as ImportPathBuilder, R as RuleLinter, S as ScopeExtrasFn, T as TargetCapabilities, f as TargetGenerators, g as TargetLayout, i as TargetLintHooks, j as TargetManagedOutputs, k as TargetOutputFamily, l as TargetPathResolvers } from './target-descriptor-CvB1qzPn.js';
|
|
3
|
+
import './schema-CD2qcmDL.js';
|
|
4
4
|
import 'zod';
|
|
5
5
|
|
|
6
6
|
/** Register a full target descriptor (for plugins). */
|
package/dist/targets.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { stringify, parse } from 'yaml';
|
|
3
|
-
import { readFile, readdir, stat, mkdir, lstat, unlink, writeFile, rename, rm, realpath, access } from 'fs/promises';
|
|
4
3
|
import { basename, join, win32, posix, relative, dirname, extname } from 'path';
|
|
4
|
+
import { readFile, readdir, stat, mkdir, lstat, unlink, writeFile, rename, chmod, rm, realpath, access } from 'fs/promises';
|
|
5
5
|
import { existsSync, realpathSync, constants, statSync } from 'fs';
|
|
6
6
|
import { parse as parse$1 } from 'smol-toml';
|
|
7
7
|
import { Buffer } from 'buffer';
|
|
@@ -531,6 +531,104 @@ function shouldNormalizeLineEndings(path) {
|
|
|
531
531
|
function normalizeLineEndings(content) {
|
|
532
532
|
return content.replace(/\r\n?/g, "\n");
|
|
533
533
|
}
|
|
534
|
+
function executableModeFor(path) {
|
|
535
|
+
return EXECUTABLE_SCRIPT_EXTENSIONS.has(extname(path).toLowerCase()) ? 493 : void 0;
|
|
536
|
+
}
|
|
537
|
+
var UTF8_BOM, TEXT_EXTENSIONS, TEXT_DOTFILES, EXECUTABLE_SCRIPT_EXTENSIONS;
|
|
538
|
+
var init_fs_text_encoding = __esm({
|
|
539
|
+
"src/utils/filesystem/fs-text-encoding.ts"() {
|
|
540
|
+
UTF8_BOM = "\uFEFF";
|
|
541
|
+
TEXT_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
542
|
+
".md",
|
|
543
|
+
".mdc",
|
|
544
|
+
".mdx",
|
|
545
|
+
".markdown",
|
|
546
|
+
".txt",
|
|
547
|
+
".json",
|
|
548
|
+
".jsonc",
|
|
549
|
+
".yaml",
|
|
550
|
+
".yml",
|
|
551
|
+
".toml",
|
|
552
|
+
".ini",
|
|
553
|
+
".sh",
|
|
554
|
+
".bash",
|
|
555
|
+
".zsh",
|
|
556
|
+
".ps1",
|
|
557
|
+
".js",
|
|
558
|
+
".mjs",
|
|
559
|
+
".cjs",
|
|
560
|
+
".ts",
|
|
561
|
+
".tsx",
|
|
562
|
+
".html",
|
|
563
|
+
".css"
|
|
564
|
+
]);
|
|
565
|
+
TEXT_DOTFILES = /* @__PURE__ */ new Set([
|
|
566
|
+
".gitignore",
|
|
567
|
+
".cursorignore",
|
|
568
|
+
".cursorindexingignore",
|
|
569
|
+
".aiignore",
|
|
570
|
+
".agentignore",
|
|
571
|
+
".clineignore",
|
|
572
|
+
".geminiignore",
|
|
573
|
+
".codeiumignore",
|
|
574
|
+
".continueignore",
|
|
575
|
+
".copilotignore",
|
|
576
|
+
".windsurfignore",
|
|
577
|
+
".junieignore",
|
|
578
|
+
".kiroignore",
|
|
579
|
+
".rooignore",
|
|
580
|
+
".antigravityignore"
|
|
581
|
+
]);
|
|
582
|
+
EXECUTABLE_SCRIPT_EXTENSIONS = /* @__PURE__ */ new Set([".sh", ".bash", ".zsh"]);
|
|
583
|
+
}
|
|
584
|
+
});
|
|
585
|
+
async function readDirRecursive(dir, visited) {
|
|
586
|
+
let canonicalDir;
|
|
587
|
+
try {
|
|
588
|
+
canonicalDir = await realpath(dir);
|
|
589
|
+
} catch (err) {
|
|
590
|
+
const e = err;
|
|
591
|
+
if (e.code === "ENOENT" || e.code === "ENOTDIR" || e.code === "ELOOP") return [];
|
|
592
|
+
throw new FileSystemError(
|
|
593
|
+
dir,
|
|
594
|
+
`Failed to read directory ${dir}: ${e.message}. Check permissions.`,
|
|
595
|
+
{ cause: err, errnoCode: e.code }
|
|
596
|
+
);
|
|
597
|
+
}
|
|
598
|
+
const seen = visited ?? /* @__PURE__ */ new Set();
|
|
599
|
+
if (seen.has(canonicalDir)) return [];
|
|
600
|
+
seen.add(canonicalDir);
|
|
601
|
+
try {
|
|
602
|
+
const entries = await readdir(dir, { withFileTypes: true });
|
|
603
|
+
const files = [];
|
|
604
|
+
for (const ent of entries) {
|
|
605
|
+
const full = join(dir, ent.name);
|
|
606
|
+
const walkChild = ent.isDirectory() || ent.isSymbolicLink() && await stat(full).then(
|
|
607
|
+
(s) => s.isDirectory(),
|
|
608
|
+
() => false
|
|
609
|
+
);
|
|
610
|
+
if (walkChild) {
|
|
611
|
+
files.push(...await readDirRecursive(full, seen));
|
|
612
|
+
} else {
|
|
613
|
+
files.push(full);
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
return files;
|
|
617
|
+
} catch (err) {
|
|
618
|
+
const e = err;
|
|
619
|
+
if (e.code === "ENOENT" || e.code === "ENOTDIR" || e.code === "EACCES") return [];
|
|
620
|
+
throw new FileSystemError(
|
|
621
|
+
dir,
|
|
622
|
+
`Failed to read directory ${dir}: ${e.message}. Check permissions.`,
|
|
623
|
+
{ cause: err, errnoCode: e.code }
|
|
624
|
+
);
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
var init_fs_traverse = __esm({
|
|
628
|
+
"src/utils/filesystem/fs-traverse.ts"() {
|
|
629
|
+
init_errors();
|
|
630
|
+
}
|
|
631
|
+
});
|
|
534
632
|
async function readFileSafe(path) {
|
|
535
633
|
try {
|
|
536
634
|
const data = await readFile(path, "utf-8");
|
|
@@ -545,7 +643,7 @@ async function readFileSafe(path) {
|
|
|
545
643
|
);
|
|
546
644
|
}
|
|
547
645
|
}
|
|
548
|
-
async function writeFileAtomic(path, content) {
|
|
646
|
+
async function writeFileAtomic(path, content, options) {
|
|
549
647
|
const dir = dirname(path);
|
|
550
648
|
await mkdir(dir, { recursive: true });
|
|
551
649
|
try {
|
|
@@ -569,6 +667,7 @@ async function writeFileAtomic(path, content) {
|
|
|
569
667
|
}
|
|
570
668
|
const tmpPath = `${path}.tmp`;
|
|
571
669
|
const payload = shouldNormalizeLineEndings(path) ? normalizeLineEndings(content) : content;
|
|
670
|
+
const mode = executableModeFor(path);
|
|
572
671
|
try {
|
|
573
672
|
try {
|
|
574
673
|
const tmpInfo = await lstat(tmpPath);
|
|
@@ -578,8 +677,16 @@ async function writeFileAtomic(path, content) {
|
|
|
578
677
|
} catch (tmpErr) {
|
|
579
678
|
if (tmpErr.code !== "ENOENT") throw tmpErr;
|
|
580
679
|
}
|
|
581
|
-
|
|
680
|
+
const writeOpts = {
|
|
681
|
+
encoding: "utf-8",
|
|
682
|
+
flag: "w"
|
|
683
|
+
};
|
|
684
|
+
if (mode !== void 0) writeOpts.mode = mode;
|
|
685
|
+
await writeFile(tmpPath, payload, writeOpts);
|
|
582
686
|
await rename(tmpPath, path);
|
|
687
|
+
if (mode !== void 0) {
|
|
688
|
+
await chmod(path, mode);
|
|
689
|
+
}
|
|
583
690
|
} catch (err) {
|
|
584
691
|
await rm(tmpPath, { force: true }).catch(() => {
|
|
585
692
|
});
|
|
@@ -602,94 +709,12 @@ async function exists(path) {
|
|
|
602
709
|
async function mkdirp(path) {
|
|
603
710
|
await mkdir(path, { recursive: true });
|
|
604
711
|
}
|
|
605
|
-
async function readDirRecursive(dir, visited) {
|
|
606
|
-
let canonicalDir;
|
|
607
|
-
try {
|
|
608
|
-
canonicalDir = await realpath(dir);
|
|
609
|
-
} catch (err) {
|
|
610
|
-
const e = err;
|
|
611
|
-
if (e.code === "ENOENT" || e.code === "ENOTDIR" || e.code === "ELOOP") return [];
|
|
612
|
-
throw new FileSystemError(
|
|
613
|
-
dir,
|
|
614
|
-
`Failed to read directory ${dir}: ${e.message}. Check permissions.`,
|
|
615
|
-
{ cause: err, errnoCode: e.code }
|
|
616
|
-
);
|
|
617
|
-
}
|
|
618
|
-
const seen = visited ?? /* @__PURE__ */ new Set();
|
|
619
|
-
if (seen.has(canonicalDir)) return [];
|
|
620
|
-
seen.add(canonicalDir);
|
|
621
|
-
try {
|
|
622
|
-
const entries = await readdir(dir, { withFileTypes: true });
|
|
623
|
-
const files = [];
|
|
624
|
-
for (const ent of entries) {
|
|
625
|
-
const full = join(dir, ent.name);
|
|
626
|
-
const walkChild = ent.isDirectory() || ent.isSymbolicLink() && await stat(full).then(
|
|
627
|
-
(s) => s.isDirectory(),
|
|
628
|
-
() => false
|
|
629
|
-
);
|
|
630
|
-
if (walkChild) {
|
|
631
|
-
files.push(...await readDirRecursive(full, seen));
|
|
632
|
-
} else {
|
|
633
|
-
files.push(full);
|
|
634
|
-
}
|
|
635
|
-
}
|
|
636
|
-
return files;
|
|
637
|
-
} catch (err) {
|
|
638
|
-
const e = err;
|
|
639
|
-
if (e.code === "ENOENT" || e.code === "ENOTDIR" || e.code === "EACCES") return [];
|
|
640
|
-
throw new FileSystemError(
|
|
641
|
-
dir,
|
|
642
|
-
`Failed to read directory ${dir}: ${e.message}. Check permissions.`,
|
|
643
|
-
{ cause: err, errnoCode: e.code }
|
|
644
|
-
);
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
var UTF8_BOM, TEXT_EXTENSIONS, TEXT_DOTFILES;
|
|
648
712
|
var init_fs = __esm({
|
|
649
713
|
"src/utils/filesystem/fs.ts"() {
|
|
650
714
|
init_errors();
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
".mdc",
|
|
655
|
-
".mdx",
|
|
656
|
-
".markdown",
|
|
657
|
-
".txt",
|
|
658
|
-
".json",
|
|
659
|
-
".jsonc",
|
|
660
|
-
".yaml",
|
|
661
|
-
".yml",
|
|
662
|
-
".toml",
|
|
663
|
-
".ini",
|
|
664
|
-
".sh",
|
|
665
|
-
".bash",
|
|
666
|
-
".zsh",
|
|
667
|
-
".ps1",
|
|
668
|
-
".js",
|
|
669
|
-
".mjs",
|
|
670
|
-
".cjs",
|
|
671
|
-
".ts",
|
|
672
|
-
".tsx",
|
|
673
|
-
".html",
|
|
674
|
-
".css"
|
|
675
|
-
]);
|
|
676
|
-
TEXT_DOTFILES = /* @__PURE__ */ new Set([
|
|
677
|
-
".gitignore",
|
|
678
|
-
".cursorignore",
|
|
679
|
-
".cursorindexingignore",
|
|
680
|
-
".aiignore",
|
|
681
|
-
".agentignore",
|
|
682
|
-
".clineignore",
|
|
683
|
-
".geminiignore",
|
|
684
|
-
".codeiumignore",
|
|
685
|
-
".continueignore",
|
|
686
|
-
".copilotignore",
|
|
687
|
-
".windsurfignore",
|
|
688
|
-
".junieignore",
|
|
689
|
-
".kiroignore",
|
|
690
|
-
".rooignore",
|
|
691
|
-
".antigravityignore"
|
|
692
|
-
]);
|
|
715
|
+
init_fs_text_encoding();
|
|
716
|
+
init_fs_traverse();
|
|
717
|
+
init_fs_text_encoding();
|
|
693
718
|
}
|
|
694
719
|
});
|
|
695
720
|
function escapeRegExp(value) {
|
|
@@ -5049,13 +5074,16 @@ function generateAgents4(canonical) {
|
|
|
5049
5074
|
function safeEventName(event) {
|
|
5050
5075
|
return event.replace(/[^a-zA-Z0-9]/g, "-").toLowerCase();
|
|
5051
5076
|
}
|
|
5077
|
+
function safeShellLine(value) {
|
|
5078
|
+
return value.replace(/[\r\n]+/g, " ");
|
|
5079
|
+
}
|
|
5052
5080
|
function buildHookScript(event, command, matcher) {
|
|
5053
5081
|
return [
|
|
5054
5082
|
"#!/usr/bin/env bash",
|
|
5055
|
-
`# agentsmesh-event: ${event}`,
|
|
5056
|
-
`# agentsmesh-matcher: ${matcher}`,
|
|
5057
|
-
`# agentsmesh-command: ${command}`,
|
|
5058
|
-
"set -
|
|
5083
|
+
`# agentsmesh-event: ${safeShellLine(event)}`,
|
|
5084
|
+
`# agentsmesh-matcher: ${safeShellLine(matcher)}`,
|
|
5085
|
+
`# agentsmesh-command: ${safeShellLine(command)}`,
|
|
5086
|
+
"set -eu",
|
|
5059
5087
|
command,
|
|
5060
5088
|
""
|
|
5061
5089
|
].join("\n");
|
|
@@ -7512,7 +7540,7 @@ function extractMatcher(comment) {
|
|
|
7512
7540
|
function extractWrapperCommand(content) {
|
|
7513
7541
|
const metadataMatch = content.match(/^# agentsmesh-command:\s*(.+)$/m);
|
|
7514
7542
|
if (metadataMatch?.[1]) return metadataMatch[1].trim();
|
|
7515
|
-
return content.replace(/^#!.*\n/, "").replace(/^#.*\n/gm, "").replace(/^HOOK_DIR=.*\n/gm, "").replace(/^set -e
|
|
7543
|
+
return content.replace(/^#!.*\n/, "").replace(/^#.*\n/gm, "").replace(/^HOOK_DIR=.*\n/gm, "").replace(/^set -e[u]?\n?/m, "").trim();
|
|
7516
7544
|
}
|
|
7517
7545
|
async function importHooks(projectRoot, results) {
|
|
7518
7546
|
const hooksDir = join(projectRoot, COPILOT_HOOKS_DIR);
|
|
@@ -7834,12 +7862,15 @@ async function buildAssetOutput(projectRoot, command) {
|
|
|
7834
7862
|
function wrapperPath(event, index) {
|
|
7835
7863
|
return `${COPILOT_HOOKS_DIR}/scripts/${safePhaseName(event)}-${index}.sh`;
|
|
7836
7864
|
}
|
|
7865
|
+
function safeShellLine2(value) {
|
|
7866
|
+
return value.replace(/[\r\n]+/g, " ");
|
|
7867
|
+
}
|
|
7837
7868
|
function buildWrapper(command, matcher) {
|
|
7838
7869
|
return [
|
|
7839
7870
|
"#!/usr/bin/env bash",
|
|
7840
|
-
`# agentsmesh-matcher: ${matcher}`,
|
|
7841
|
-
`# agentsmesh-command: ${command}`,
|
|
7842
|
-
"set -
|
|
7871
|
+
`# agentsmesh-matcher: ${safeShellLine2(matcher)}`,
|
|
7872
|
+
`# agentsmesh-command: ${safeShellLine2(command)}`,
|
|
7873
|
+
"set -eu",
|
|
7843
7874
|
command,
|
|
7844
7875
|
""
|
|
7845
7876
|
].join("\n");
|
|
@@ -7863,8 +7894,8 @@ async function addHookScriptAssets(projectRoot, canonical, outputs) {
|
|
|
7863
7894
|
}
|
|
7864
7895
|
}
|
|
7865
7896
|
const wrapper = buildWrapper(command, entry.matcher).replace(
|
|
7866
|
-
"set -
|
|
7867
|
-
'set -
|
|
7897
|
+
"set -eu\n",
|
|
7898
|
+
'set -eu\nHOOK_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"\n'
|
|
7868
7899
|
);
|
|
7869
7900
|
wrapperOutputs.push({ path: scriptPath, content: wrapper });
|
|
7870
7901
|
index++;
|