@audiodn/agent-kit 0.1.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.
Files changed (59) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +74 -0
  3. package/assets/content/instructions.md +48 -0
  4. package/assets/content/partials/auth.md +17 -0
  5. package/assets/content/partials/compatibility.md +10 -0
  6. package/assets/content/partials/playback.md +14 -0
  7. package/assets/content/partials/processing.md +17 -0
  8. package/assets/content/partials/security.md +14 -0
  9. package/assets/content/partials/upload.md +17 -0
  10. package/assets/content/partials/webhooks.md +13 -0
  11. package/assets/skill/SKILL.md +52 -0
  12. package/assets/skill/references/authentication.md +27 -0
  13. package/assets/skill/references/playback.md +29 -0
  14. package/assets/skill/references/processing.md +23 -0
  15. package/assets/skill/references/security.md +30 -0
  16. package/assets/skill/references/upload-flow.md +29 -0
  17. package/assets/skill/references/webhooks.md +19 -0
  18. package/assets/skill/scripts/known-endpoints.json +28 -0
  19. package/assets/skill/scripts/validate.mjs +287 -0
  20. package/assets/skill/templates/cloudflare-worker.md +39 -0
  21. package/assets/skill/templates/nextjs.md +47 -0
  22. package/assets/skill/templates/node-server.md +44 -0
  23. package/assets/skill/templates/vue-nuxt.md +49 -0
  24. package/assets/snapshots/llms-full.txt +347 -0
  25. package/assets/snapshots/openapi.json +1416 -0
  26. package/assets/snapshots/sources.json +19 -0
  27. package/dist/cli.d.ts +2 -0
  28. package/dist/cli.js +101 -0
  29. package/dist/commands/init.d.ts +8 -0
  30. package/dist/commands/init.js +35 -0
  31. package/dist/commands/list.d.ts +1 -0
  32. package/dist/commands/list.js +28 -0
  33. package/dist/commands/uninstall.d.ts +6 -0
  34. package/dist/commands/uninstall.js +20 -0
  35. package/dist/commands/validate.d.ts +5 -0
  36. package/dist/commands/validate.js +18 -0
  37. package/dist/core/formats.d.ts +23 -0
  38. package/dist/core/formats.js +43 -0
  39. package/dist/core/fsutil.d.ts +5 -0
  40. package/dist/core/fsutil.js +34 -0
  41. package/dist/core/install.d.ts +16 -0
  42. package/dist/core/install.js +76 -0
  43. package/dist/core/markers.d.ts +5 -0
  44. package/dist/core/markers.js +13 -0
  45. package/dist/core/merge.d.ts +21 -0
  46. package/dist/core/merge.js +38 -0
  47. package/dist/core/prompt.d.ts +2 -0
  48. package/dist/core/prompt.js +23 -0
  49. package/dist/core/render.d.ts +5 -0
  50. package/dist/core/render.js +21 -0
  51. package/dist/core/report.d.ts +10 -0
  52. package/dist/core/report.js +35 -0
  53. package/dist/core/skill.d.ts +13 -0
  54. package/dist/core/skill.js +117 -0
  55. package/dist/paths.d.ts +5 -0
  56. package/dist/paths.js +10 -0
  57. package/dist/version.d.ts +1 -0
  58. package/dist/version.js +12 -0
  59. package/package.json +61 -0
@@ -0,0 +1,117 @@
1
+ import { existsSync, readdirSync, rmSync, rmdirSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ import { SKILL_DIR } from '../paths.js';
4
+ import { readIfExists, relativeFiles, sha256, writeFileEnsuringDir } from './fsutil.js';
5
+ export const SKILL_TARGET_DIR = '.agents/skills/audiodn';
6
+ const MANIFEST_NAME = '.audiodn-manifest.json';
7
+ function manifestPath(base) {
8
+ return join(base, MANIFEST_NAME);
9
+ }
10
+ function readManifest(base) {
11
+ const raw = readIfExists(manifestPath(base));
12
+ if (!raw)
13
+ return null;
14
+ try {
15
+ return JSON.parse(raw);
16
+ }
17
+ catch {
18
+ return null;
19
+ }
20
+ }
21
+ /**
22
+ * Install the Skill payload directory. Kit-owned files are tracked in a
23
+ * manifest so re-runs are idempotent and user edits are never clobbered.
24
+ */
25
+ export function installSkill(cwd, version, opts = {}) {
26
+ const base = join(cwd, SKILL_TARGET_DIR);
27
+ const prevManifest = readManifest(base);
28
+ const entries = [];
29
+ const nextFiles = {};
30
+ for (const rel of relativeFiles(SKILL_DIR)) {
31
+ const srcContent = readIfExists(join(SKILL_DIR, rel));
32
+ if (srcContent === null)
33
+ continue;
34
+ const srcHash = sha256(srcContent);
35
+ const targetPath = join(base, rel);
36
+ const displayPath = `${SKILL_TARGET_DIR}/${rel}`;
37
+ const existing = readIfExists(targetPath);
38
+ if (existing === null) {
39
+ if (!opts.dryRun)
40
+ writeFileEnsuringDir(targetPath, srcContent);
41
+ entries.push({ path: displayPath, action: 'create' });
42
+ nextFiles[rel] = srcHash;
43
+ continue;
44
+ }
45
+ const existingHash = sha256(existing);
46
+ const tracked = prevManifest?.files?.[rel];
47
+ const userModified = tracked === undefined || tracked !== existingHash;
48
+ if (userModified && !opts.force) {
49
+ if (!opts.dryRun)
50
+ writeFileEnsuringDir(`${targetPath}.audiodn.new`, srcContent);
51
+ entries.push({ path: displayPath, action: 'conflict', note: 'wrote .audiodn.new' });
52
+ nextFiles[rel] = tracked ?? existingHash;
53
+ continue;
54
+ }
55
+ if (existingHash === srcHash) {
56
+ entries.push({ path: displayPath, action: 'unchanged' });
57
+ nextFiles[rel] = srcHash;
58
+ continue;
59
+ }
60
+ if (!opts.dryRun)
61
+ writeFileEnsuringDir(targetPath, srcContent);
62
+ entries.push({ path: displayPath, action: 'update' });
63
+ nextFiles[rel] = srcHash;
64
+ }
65
+ if (!opts.dryRun) {
66
+ const manifest = { version, files: nextFiles };
67
+ writeFileEnsuringDir(manifestPath(base), `${JSON.stringify(manifest, null, 2)}\n`);
68
+ }
69
+ return entries;
70
+ }
71
+ function pruneEmptyDirs(base, cwd) {
72
+ let dir = base;
73
+ while (dir.startsWith(cwd) && dir !== cwd) {
74
+ try {
75
+ if (existsSync(dir) && readdirSync(dir).length === 0) {
76
+ rmdirSync(dir);
77
+ dir = join(dir, '..');
78
+ }
79
+ else
80
+ break;
81
+ }
82
+ catch {
83
+ break;
84
+ }
85
+ }
86
+ }
87
+ export function uninstallSkill(cwd, opts = {}) {
88
+ const base = join(cwd, SKILL_TARGET_DIR);
89
+ const manifest = readManifest(base);
90
+ const entries = [];
91
+ if (!manifest)
92
+ return entries;
93
+ for (const [rel, hash] of Object.entries(manifest.files)) {
94
+ const targetPath = join(base, rel);
95
+ const displayPath = `${SKILL_TARGET_DIR}/${rel}`;
96
+ const existing = readIfExists(targetPath);
97
+ if (existing === null)
98
+ continue;
99
+ if (sha256(existing) !== hash) {
100
+ entries.push({ path: displayPath, action: 'skipped', note: 'modified by you' });
101
+ continue;
102
+ }
103
+ if (!opts.dryRun)
104
+ rmSync(targetPath);
105
+ entries.push({ path: displayPath, action: 'removed' });
106
+ }
107
+ if (!opts.dryRun) {
108
+ const mp = manifestPath(base);
109
+ if (existsSync(mp))
110
+ rmSync(mp);
111
+ pruneEmptyDirs(join(base, 'scripts'), cwd);
112
+ pruneEmptyDirs(join(base, 'references'), cwd);
113
+ pruneEmptyDirs(join(base, 'templates'), cwd);
114
+ pruneEmptyDirs(base, cwd);
115
+ }
116
+ return entries;
117
+ }
@@ -0,0 +1,5 @@
1
+ export declare const PACKAGE_ROOT: string;
2
+ export declare const ASSETS_DIR: string;
3
+ export declare const CONTENT_DIR: string;
4
+ export declare const SKILL_DIR: string;
5
+ export declare const SNAPSHOTS_DIR: string;
package/dist/paths.js ADDED
@@ -0,0 +1,10 @@
1
+ import { fileURLToPath } from 'node:url';
2
+ import { dirname, join } from 'node:path';
3
+ // Resolves the package root in both dev (src/paths.ts) and build (dist/paths.js):
4
+ // in both cases the file sits one directory below the package root.
5
+ const here = dirname(fileURLToPath(import.meta.url));
6
+ export const PACKAGE_ROOT = join(here, '..');
7
+ export const ASSETS_DIR = join(PACKAGE_ROOT, 'assets');
8
+ export const CONTENT_DIR = join(ASSETS_DIR, 'content');
9
+ export const SKILL_DIR = join(ASSETS_DIR, 'skill');
10
+ export const SNAPSHOTS_DIR = join(ASSETS_DIR, 'snapshots');
@@ -0,0 +1 @@
1
+ export declare function getVersion(): string;
@@ -0,0 +1,12 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ import { PACKAGE_ROOT } from './paths.js';
4
+ export function getVersion() {
5
+ try {
6
+ const pkg = JSON.parse(readFileSync(join(PACKAGE_ROOT, 'package.json'), 'utf8'));
7
+ return typeof pkg.version === 'string' ? pkg.version : '0.0.0';
8
+ }
9
+ catch {
10
+ return '0.0.0';
11
+ }
12
+ }
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "@audiodn/agent-kit",
3
+ "version": "0.1.0",
4
+ "description": "Install AudioDN coding-agent guidance (AGENTS.md, CLAUDE.md, Copilot, Cursor, Skill) and validate AudioDN integrations.",
5
+ "type": "module",
6
+ "bin": {
7
+ "audiodn-agent-kit": "dist/cli.js"
8
+ },
9
+ "files": [
10
+ "dist",
11
+ "assets",
12
+ "README.md",
13
+ "LICENSE"
14
+ ],
15
+ "keywords": [
16
+ "audiodn",
17
+ "audio",
18
+ "agents",
19
+ "coding-agent",
20
+ "claude",
21
+ "copilot",
22
+ "cursor",
23
+ "skill",
24
+ "cli",
25
+ "scaffold"
26
+ ],
27
+ "author": {
28
+ "name": "AudioDN",
29
+ "url": "https://github.com/audiodn"
30
+ },
31
+ "license": "MIT",
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "git+https://github.com/audiodn/audiodn-agent-kit.git"
35
+ },
36
+ "bugs": {
37
+ "url": "https://github.com/audiodn/audiodn-agent-kit/issues"
38
+ },
39
+ "homepage": "https://github.com/audiodn/audiodn-agent-kit#readme",
40
+ "publishConfig": {
41
+ "access": "public"
42
+ },
43
+ "engines": {
44
+ "node": ">=18"
45
+ },
46
+ "scripts": {
47
+ "build": "tsc",
48
+ "dev": "tsc --watch",
49
+ "lint": "tsc --noEmit",
50
+ "test": "vitest run",
51
+ "test:watch": "vitest",
52
+ "sync": "node scripts/sync-canonical.mjs",
53
+ "smoke": "node scripts/smoke.mjs",
54
+ "prepublishOnly": "npm run test && npm run build"
55
+ },
56
+ "devDependencies": {
57
+ "@types/node": "^20.11.0",
58
+ "typescript": "^5.4.0",
59
+ "vitest": "^2.1.8"
60
+ }
61
+ }