@abuswami1996/agent-md 0.1.0 → 0.1.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/README.md +8 -0
- package/agent-md-preview.vsix +0 -0
- package/dist/index.js +38 -3
- package/package.json +22 -5
package/README.md
CHANGED
|
@@ -16,6 +16,14 @@ npx agent-md init --agent cursor
|
|
|
16
16
|
|
|
17
17
|
This creates local configuration, an agent skill file, schema metadata, starter examples, and VSCode/Cursor extension recommendations for `AbhinavSwaminathan.agent-md-preview`.
|
|
18
18
|
|
|
19
|
+
Use the `--agent` flag to install the skill in the project-local location for your tool:
|
|
20
|
+
|
|
21
|
+
- `cursor`: `.cursor/skills/agent-markdown/SKILL.md`
|
|
22
|
+
- `claude-code`: `.claude/skills/agent-markdown/SKILL.md`
|
|
23
|
+
- `codex`: `.agents/skills/agent-markdown/SKILL.md`
|
|
24
|
+
- `opencode`: `.opencode/skills/agent-markdown/SKILL.md`
|
|
25
|
+
- `all`: all supported project-local skill locations
|
|
26
|
+
|
|
19
27
|
Install the published editor extension:
|
|
20
28
|
|
|
21
29
|
```bash
|
package/agent-md-preview.vsix
CHANGED
|
Binary file
|
package/dist/index.js
CHANGED
|
@@ -308,7 +308,14 @@ function splitPropsAndBody(lines, sourcePath, startLine, diagnostics) {
|
|
|
308
308
|
}
|
|
309
309
|
|
|
310
310
|
// ../skill/src/index.ts
|
|
311
|
-
var
|
|
311
|
+
var skillName = "agent-markdown";
|
|
312
|
+
var skillMarkdown = `---
|
|
313
|
+
name: agent-markdown
|
|
314
|
+
description: Create, validate, and revise local-first Agent Markdown .agent.md documents with charts, tables, maps, diagrams, metrics, tabs, local data, and safe workspace file references.
|
|
315
|
+
license: MIT
|
|
316
|
+
---
|
|
317
|
+
|
|
318
|
+
# Agent Markdown Skill
|
|
312
319
|
|
|
313
320
|
Use Agent Markdown when the user asks for interactive reports, dashboards, visual analysis, charts or tables in Markdown, or local visualization documents.
|
|
314
321
|
|
|
@@ -626,16 +633,19 @@ var vsixCandidates = [
|
|
|
626
633
|
program.name("agent-md").description("Local-first Agent Markdown runtime").version("0.1.0");
|
|
627
634
|
program.command("init").option("--agent <agent>", "agent skill flavor", "generic").action(async (options) => {
|
|
628
635
|
const root = process.cwd();
|
|
636
|
+
const agent = normalizeAgent(String(options.agent));
|
|
629
637
|
await writeIfMissing(path2.join(root, "agent-md.config.json"), configJson());
|
|
630
638
|
await fs2.mkdir(path2.join(root, ".agent-md"), { recursive: true });
|
|
631
639
|
await fs2.mkdir(path2.join(root, "examples"), { recursive: true });
|
|
632
640
|
await writeIfMissing(path2.join(root, ".agent-md", "skill.md"), skillMarkdown);
|
|
641
|
+
const installedSkillPaths = await installAgentSkill(root, agent);
|
|
633
642
|
await writeIfMissing(path2.join(root, ".agent-md", "schema.json"), schemaJson());
|
|
634
643
|
await writeIfMissing(path2.join(root, ".agent-md", "components.json"), componentsJson());
|
|
635
644
|
await writeIfMissing(path2.join(root, "examples", "example.agent.md"), exampleAgentMarkdown);
|
|
636
|
-
if (["cursor", "vscode"].includes(
|
|
645
|
+
if (["cursor", "vscode"].includes(agent)) await mergeVsCodeRecommendation(root);
|
|
637
646
|
console.log(pc.green("Agent Markdown project initialized."));
|
|
638
|
-
|
|
647
|
+
for (const installedPath of installedSkillPaths) console.log(pc.gray(`Agent skill installed: ${path2.relative(root, installedPath)}`));
|
|
648
|
+
if (["cursor", "vscode"].includes(agent)) {
|
|
639
649
|
console.log(pc.gray(`Recommended extension added: ${extensionId}`));
|
|
640
650
|
console.log(pc.gray("Open an .agent.md file and run: Agent Markdown: Open Preview"));
|
|
641
651
|
console.log(pc.gray("Browser fallback: npx agent-md serve"));
|
|
@@ -710,6 +720,31 @@ async function writeIfMissing(file, content) {
|
|
|
710
720
|
if (error.code !== "EEXIST") throw error;
|
|
711
721
|
}
|
|
712
722
|
}
|
|
723
|
+
async function installAgentSkill(root, agent) {
|
|
724
|
+
const skillPaths = skillInstallPaths(root, agent);
|
|
725
|
+
for (const skillPath of skillPaths) {
|
|
726
|
+
await fs2.mkdir(path2.dirname(skillPath), { recursive: true });
|
|
727
|
+
await writeIfMissing(skillPath, skillMarkdown);
|
|
728
|
+
}
|
|
729
|
+
return skillPaths;
|
|
730
|
+
}
|
|
731
|
+
function normalizeAgent(agent) {
|
|
732
|
+
return agent.toLowerCase().trim().replace(/[\s_]+/g, "-");
|
|
733
|
+
}
|
|
734
|
+
function skillInstallPaths(root, agent) {
|
|
735
|
+
const relativeRoots = {
|
|
736
|
+
cursor: [".cursor/skills"],
|
|
737
|
+
vscode: [".agents/skills"],
|
|
738
|
+
"claude-code": [".claude/skills"],
|
|
739
|
+
claude: [".claude/skills"],
|
|
740
|
+
codex: [".agents/skills"],
|
|
741
|
+
opencode: [".opencode/skills"],
|
|
742
|
+
generic: [".agents/skills"],
|
|
743
|
+
all: [".cursor/skills", ".claude/skills", ".agents/skills", ".opencode/skills"]
|
|
744
|
+
};
|
|
745
|
+
const roots = relativeRoots[agent] ?? relativeRoots.generic;
|
|
746
|
+
return roots.map((relativeRoot) => path2.join(root, relativeRoot, skillName, "SKILL.md"));
|
|
747
|
+
}
|
|
713
748
|
async function mergeVsCodeRecommendation(root) {
|
|
714
749
|
const vscodeDir = path2.join(root, ".vscode");
|
|
715
750
|
const extensionsPath = path2.join(vscodeDir, "extensions.json");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abuswami1996/agent-md",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Local-first Agent Markdown runtime, validator, browser viewer, and agent skill installer.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Abhinav Swaminathan",
|
|
@@ -22,12 +22,29 @@
|
|
|
22
22
|
"cursor"
|
|
23
23
|
],
|
|
24
24
|
"type": "module",
|
|
25
|
-
"engines": {
|
|
26
|
-
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": ">=20"
|
|
27
|
+
},
|
|
28
|
+
"bin": {
|
|
29
|
+
"agent-md": "dist/index.js"
|
|
30
|
+
},
|
|
27
31
|
"main": "dist/index.js",
|
|
28
32
|
"types": "dist/index.d.ts",
|
|
29
|
-
"exports": {
|
|
30
|
-
|
|
33
|
+
"exports": {
|
|
34
|
+
".": {
|
|
35
|
+
"types": "./dist/index.d.ts",
|
|
36
|
+
"import": "./dist/index.js"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"files": [
|
|
40
|
+
"dist",
|
|
41
|
+
"viewer-dist",
|
|
42
|
+
"agent-md-preview.vsix",
|
|
43
|
+
"README.md",
|
|
44
|
+
"LICENSE",
|
|
45
|
+
"CHANGELOG.md",
|
|
46
|
+
"package.json"
|
|
47
|
+
],
|
|
31
48
|
"scripts": {
|
|
32
49
|
"build": "tsup src/index.ts --format esm --external commander --external picocolors --external fast-glob --external chokidar --external ws --external yaml --external papaparse --external zod && tsc src/index.ts --ignoreConfig --emitDeclarationOnly --declaration --outDir dist --module ESNext --moduleResolution Bundler --target ES2022 --skipLibCheck --strict && rm -rf viewer-dist && cp -R ../viewer/dist viewer-dist && if [ -f ../vscode-extension/dist/agent-md-preview.vsix ]; then cp ../vscode-extension/dist/agent-md-preview.vsix agent-md-preview.vsix; fi",
|
|
33
50
|
"prepack": "node -e \"const fs=require('fs'); for (const p of ['dist/index.js','dist/index.d.ts','viewer-dist/index.html','agent-md-preview.vsix','README.md','LICENSE','CHANGELOG.md']) if (!fs.existsSync(p)) { console.error('Missing publish artifact: '+p); process.exit(1); }\""
|