@rbbtsn0w/adg 0.1.0-alpha.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/LICENSE +21 -0
- package/README.md +308 -0
- package/bin/adg.ts +758 -0
- package/docs/agents-spec.md +132 -0
- package/docs/authoring.md +352 -0
- package/package.json +50 -0
- package/schemas/adg-plugin.schema.json +77 -0
- package/schemas/marketplace.schema.json +86 -0
- package/schemas/plugin-lock.schema.json +90 -0
- package/src/adapters/anthropic.ts +54 -0
- package/src/adapters/index.ts +24 -0
- package/src/adapters/openai.ts +37 -0
- package/src/adapters/reverse.ts +60 -0
- package/src/agents/claude.ts +124 -0
- package/src/agents/codex.ts +67 -0
- package/src/agents/index.ts +12 -0
- package/src/agents/registry.ts +30 -0
- package/src/agents/types.ts +47 -0
- package/src/commands/adapt.ts +36 -0
- package/src/commands/import.ts +69 -0
- package/src/commands/init.ts +146 -0
- package/src/commands/install.ts +411 -0
- package/src/commands/link.ts +61 -0
- package/src/commands/list.ts +28 -0
- package/src/commands/marketplace.ts +198 -0
- package/src/commands/migrate.ts +84 -0
- package/src/commands/multiselect-skills.ts +137 -0
- package/src/commands/remove.ts +136 -0
- package/src/commands/select-agents.ts +45 -0
- package/src/commands/select-components.ts +66 -0
- package/src/commands/select-plugins.ts +28 -0
- package/src/commands/select-scope.ts +21 -0
- package/src/commands/update.ts +85 -0
- package/src/commands/validate.ts +57 -0
- package/src/components.ts +90 -0
- package/src/deps.ts +64 -0
- package/src/fsutil.ts +38 -0
- package/src/hash.ts +61 -0
- package/src/lock.ts +57 -0
- package/src/manifest.ts +113 -0
- package/src/marketplace.ts +41 -0
- package/src/package.ts +74 -0
- package/src/paths.ts +129 -0
- package/src/semver.ts +67 -0
- package/src/skills.ts +88 -0
- package/src/sources.ts +159 -0
- package/src/types.ts +140 -0
- package/vendor/skills/LICENSE +29 -0
- package/vendor/skills/PROVENANCE.md +60 -0
- package/vendor/skills/ThirdPartyNoticeText.txt +117 -0
- package/vendor/skills/package.json +143 -0
- package/vendor/skills/src/add.ts +1999 -0
- package/vendor/skills/src/agents.ts +755 -0
- package/vendor/skills/src/blob.ts +567 -0
- package/vendor/skills/src/cli.ts +387 -0
- package/vendor/skills/src/constants.ts +3 -0
- package/vendor/skills/src/detect-agent.ts +62 -0
- package/vendor/skills/src/find.ts +357 -0
- package/vendor/skills/src/frontmatter.ts +16 -0
- package/vendor/skills/src/git-tree.ts +36 -0
- package/vendor/skills/src/git.ts +277 -0
- package/vendor/skills/src/install.ts +91 -0
- package/vendor/skills/src/installer.ts +1097 -0
- package/vendor/skills/src/list.ts +231 -0
- package/vendor/skills/src/local-lock.ts +182 -0
- package/vendor/skills/src/plugin-manifest.ts +183 -0
- package/vendor/skills/src/prompts/search-multiselect.ts +387 -0
- package/vendor/skills/src/providers/index.ts +14 -0
- package/vendor/skills/src/providers/registry.ts +51 -0
- package/vendor/skills/src/providers/types.ts +97 -0
- package/vendor/skills/src/providers/wellknown.ts +804 -0
- package/vendor/skills/src/remove.ts +323 -0
- package/vendor/skills/src/sanitize.ts +65 -0
- package/vendor/skills/src/self-cli.ts +20 -0
- package/vendor/skills/src/skill-lock.ts +329 -0
- package/vendor/skills/src/skills.ts +316 -0
- package/vendor/skills/src/source-parser.ts +438 -0
- package/vendor/skills/src/sync.ts +478 -0
- package/vendor/skills/src/telemetry.ts +186 -0
- package/vendor/skills/src/test-utils.ts +73 -0
- package/vendor/skills/src/types.ts +128 -0
- package/vendor/skills/src/update-source.ts +90 -0
- package/vendor/skills/src/update.ts +749 -0
- package/vendor/skills/src/use.ts +675 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { execSync } from 'child_process';
|
|
2
|
+
import { join } from 'path';
|
|
3
|
+
import { stripTerminalEscapes } from './sanitize.ts';
|
|
4
|
+
|
|
5
|
+
// const PROJECT_ROOT = join(import.meta.dirname, '..');
|
|
6
|
+
const CLI_PATH = join(import.meta.dirname, 'cli.ts');
|
|
7
|
+
|
|
8
|
+
export function stripAnsi(str: string): string {
|
|
9
|
+
return stripTerminalEscapes(str);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function stripLogo(str: string): string {
|
|
13
|
+
return str
|
|
14
|
+
.split('\n')
|
|
15
|
+
.filter((line) => !line.includes('███') && !line.includes('╔') && !line.includes('╚'))
|
|
16
|
+
.join('\n')
|
|
17
|
+
.replace(/^\n+/, '');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function hasLogo(str: string): boolean {
|
|
21
|
+
return str.includes('███') || str.includes('╔') || str.includes('╚');
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function runCli(
|
|
25
|
+
args: string[],
|
|
26
|
+
cwd?: string,
|
|
27
|
+
env?: Record<string, string>,
|
|
28
|
+
timeout?: number
|
|
29
|
+
): { stdout: string; stderr: string; exitCode: number } {
|
|
30
|
+
try {
|
|
31
|
+
const output = execSync(`node "${CLI_PATH}" ${args.join(' ')}`, {
|
|
32
|
+
encoding: 'utf-8',
|
|
33
|
+
cwd,
|
|
34
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
35
|
+
env: env ? { ...process.env, ...env } : undefined,
|
|
36
|
+
timeout: timeout ?? 30000,
|
|
37
|
+
});
|
|
38
|
+
return { stdout: stripAnsi(output), stderr: '', exitCode: 0 };
|
|
39
|
+
} catch (error: any) {
|
|
40
|
+
return {
|
|
41
|
+
stdout: stripAnsi(error.stdout || ''),
|
|
42
|
+
stderr: stripAnsi(error.stderr || ''),
|
|
43
|
+
exitCode: error.status || 1,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function runCliOutput(args: string[], cwd?: string): string {
|
|
49
|
+
const result = runCli(args, cwd);
|
|
50
|
+
return result.stdout || result.stderr;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function runCliWithInput(
|
|
54
|
+
args: string[],
|
|
55
|
+
input: string,
|
|
56
|
+
cwd?: string
|
|
57
|
+
): { stdout: string; stderr: string; exitCode: number } {
|
|
58
|
+
try {
|
|
59
|
+
const output = execSync(`node "${CLI_PATH}" ${args.join(' ')}`, {
|
|
60
|
+
encoding: 'utf-8',
|
|
61
|
+
cwd,
|
|
62
|
+
input: input + '\n',
|
|
63
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
64
|
+
});
|
|
65
|
+
return { stdout: stripAnsi(output), stderr: '', exitCode: 0 };
|
|
66
|
+
} catch (error: any) {
|
|
67
|
+
return {
|
|
68
|
+
stdout: stripAnsi(error.stdout || ''),
|
|
69
|
+
stderr: stripAnsi(error.stderr || ''),
|
|
70
|
+
exitCode: error.status || 1,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
export type AgentType =
|
|
2
|
+
| 'aider-desk'
|
|
3
|
+
| 'amp'
|
|
4
|
+
| 'antigravity'
|
|
5
|
+
| 'antigravity-cli'
|
|
6
|
+
| 'astrbot'
|
|
7
|
+
| 'autohand-code'
|
|
8
|
+
| 'augment'
|
|
9
|
+
| 'bob'
|
|
10
|
+
| 'claude-code'
|
|
11
|
+
| 'openclaw'
|
|
12
|
+
| 'cline'
|
|
13
|
+
| 'codearts-agent'
|
|
14
|
+
| 'codebuddy'
|
|
15
|
+
| 'codemaker'
|
|
16
|
+
| 'codestudio'
|
|
17
|
+
| 'codex'
|
|
18
|
+
| 'command-code'
|
|
19
|
+
| 'continue'
|
|
20
|
+
| 'cortex'
|
|
21
|
+
| 'crush'
|
|
22
|
+
| 'cursor'
|
|
23
|
+
| 'deepagents'
|
|
24
|
+
| 'devin'
|
|
25
|
+
| 'dexto'
|
|
26
|
+
| 'droid'
|
|
27
|
+
| 'firebender'
|
|
28
|
+
| 'forgecode'
|
|
29
|
+
| 'gemini-cli'
|
|
30
|
+
| 'github-copilot'
|
|
31
|
+
| 'goose'
|
|
32
|
+
| 'hermes-agent'
|
|
33
|
+
| 'inference-sh'
|
|
34
|
+
| 'iflow-cli'
|
|
35
|
+
| 'jazz'
|
|
36
|
+
| 'junie'
|
|
37
|
+
| 'kilo'
|
|
38
|
+
| 'kimi-code-cli'
|
|
39
|
+
| 'kiro-cli'
|
|
40
|
+
| 'kode'
|
|
41
|
+
| 'lingma'
|
|
42
|
+
| 'loaf'
|
|
43
|
+
| 'mcpjam'
|
|
44
|
+
| 'mistral-vibe'
|
|
45
|
+
| 'moxby'
|
|
46
|
+
| 'mux'
|
|
47
|
+
| 'neovate'
|
|
48
|
+
| 'opencode'
|
|
49
|
+
| 'openhands'
|
|
50
|
+
| 'ona'
|
|
51
|
+
| 'pi'
|
|
52
|
+
| 'qoder'
|
|
53
|
+
| 'qoder-cn'
|
|
54
|
+
| 'qwen-code'
|
|
55
|
+
| 'replit'
|
|
56
|
+
| 'reasonix'
|
|
57
|
+
| 'roo'
|
|
58
|
+
| 'rovodev'
|
|
59
|
+
| 'tabnine-cli'
|
|
60
|
+
| 'terramind'
|
|
61
|
+
| 'tinycloud'
|
|
62
|
+
| 'trae'
|
|
63
|
+
| 'trae-cn'
|
|
64
|
+
| 'warp'
|
|
65
|
+
| 'windsurf'
|
|
66
|
+
| 'zed'
|
|
67
|
+
| 'zencoder'
|
|
68
|
+
| 'zenflow'
|
|
69
|
+
| 'pochi'
|
|
70
|
+
| 'promptscript'
|
|
71
|
+
| 'adal'
|
|
72
|
+
| 'universal';
|
|
73
|
+
|
|
74
|
+
export interface Skill {
|
|
75
|
+
name: string;
|
|
76
|
+
description: string;
|
|
77
|
+
path: string;
|
|
78
|
+
/** Raw SKILL.md content for hashing */
|
|
79
|
+
rawContent?: string;
|
|
80
|
+
/** Name of the plugin this skill belongs to (if any) */
|
|
81
|
+
pluginName?: string;
|
|
82
|
+
metadata?: Record<string, unknown>;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export interface AgentConfig {
|
|
86
|
+
name: string;
|
|
87
|
+
displayName: string;
|
|
88
|
+
skillsDir: string;
|
|
89
|
+
/** Global skills directory. Set to undefined if the agent doesn't support global installation. */
|
|
90
|
+
globalSkillsDir: string | undefined;
|
|
91
|
+
detectInstalled: () => Promise<boolean>;
|
|
92
|
+
/** Whether to show this agent in the universal agents list. Defaults to true. */
|
|
93
|
+
showInUniversalList?: boolean;
|
|
94
|
+
/** Whether to display this universal agent in the interactive locked section. Defaults to true. */
|
|
95
|
+
showInUniversalPrompt?: boolean;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export interface ParsedSource {
|
|
99
|
+
type: 'github' | 'gitlab' | 'git' | 'local' | 'well-known';
|
|
100
|
+
url: string;
|
|
101
|
+
subpath?: string;
|
|
102
|
+
localPath?: string;
|
|
103
|
+
ref?: string;
|
|
104
|
+
/** Skill name extracted from @skill syntax (e.g., owner/repo@skill-name) */
|
|
105
|
+
skillFilter?: string;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Represents a skill fetched from a remote host provider.
|
|
110
|
+
*/
|
|
111
|
+
export interface RemoteSkill {
|
|
112
|
+
/** Display name of the skill (from frontmatter) */
|
|
113
|
+
name: string;
|
|
114
|
+
/** Description of the skill (from frontmatter) */
|
|
115
|
+
description: string;
|
|
116
|
+
/** Full markdown content including frontmatter */
|
|
117
|
+
content: string;
|
|
118
|
+
/** The identifier used for installation directory name */
|
|
119
|
+
installName: string;
|
|
120
|
+
/** The original source URL */
|
|
121
|
+
sourceUrl: string;
|
|
122
|
+
/** The provider that fetched this skill */
|
|
123
|
+
providerId: string;
|
|
124
|
+
/** Source identifier for telemetry (e.g., "mintlify.com") */
|
|
125
|
+
sourceIdentifier: string;
|
|
126
|
+
/** Any additional metadata from frontmatter */
|
|
127
|
+
metadata?: Record<string, unknown>;
|
|
128
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
export interface UpdateSourceEntry {
|
|
2
|
+
source: string;
|
|
3
|
+
sourceUrl: string;
|
|
4
|
+
ref?: string;
|
|
5
|
+
skillPath?: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface LocalUpdateSourceEntry {
|
|
9
|
+
source: string;
|
|
10
|
+
ref?: string;
|
|
11
|
+
skillPath?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function formatSourceInput(sourceUrl: string, ref?: string): string {
|
|
15
|
+
if (!ref) {
|
|
16
|
+
return sourceUrl;
|
|
17
|
+
}
|
|
18
|
+
return `${sourceUrl}#${ref}`;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Derive the skill's folder path from a SKILL.md-terminated skillPath.
|
|
23
|
+
* Returns '' when the skill lives at the repo root.
|
|
24
|
+
*/
|
|
25
|
+
function deriveSkillFolder(skillPath: string): string {
|
|
26
|
+
let folder = skillPath;
|
|
27
|
+
if (folder.endsWith('/SKILL.md')) {
|
|
28
|
+
folder = folder.slice(0, -9);
|
|
29
|
+
} else if (folder.endsWith('SKILL.md')) {
|
|
30
|
+
folder = folder.slice(0, -8);
|
|
31
|
+
}
|
|
32
|
+
if (folder.endsWith('/')) {
|
|
33
|
+
folder = folder.slice(0, -1);
|
|
34
|
+
}
|
|
35
|
+
return folder;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Whether a skill folder can be safely appended to the given source as a
|
|
40
|
+
* subpath. Only true for sources the source-parser can resolve as a
|
|
41
|
+
* GitHub/GitLab tree URL — owner/repo shorthand or an HTTPS URL on those
|
|
42
|
+
* hosts. Full SSH URLs (`git@host:owner/repo.git`) and generic Git URLs
|
|
43
|
+
* (anything ending in `.git`, or hosts other than github.com/gitlab.com)
|
|
44
|
+
* cannot have a subpath appended without producing an unclonable URL.
|
|
45
|
+
*/
|
|
46
|
+
function supportsAppendedSubpath(source: string): boolean {
|
|
47
|
+
if (source.startsWith('git@')) return false;
|
|
48
|
+
if (source.endsWith('.git')) return false;
|
|
49
|
+
if (source.startsWith('http://') || source.startsWith('https://')) {
|
|
50
|
+
try {
|
|
51
|
+
const host = new URL(source).hostname;
|
|
52
|
+
return host === 'github.com' || host === 'gitlab.com';
|
|
53
|
+
} catch {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function appendFolderAndRef(source: string, skillPath: string, ref?: string): string {
|
|
61
|
+
if (!supportsAppendedSubpath(source)) {
|
|
62
|
+
return formatSourceInput(source, ref);
|
|
63
|
+
}
|
|
64
|
+
const folder = deriveSkillFolder(skillPath);
|
|
65
|
+
const withFolder = folder ? `${source}/${folder}` : source;
|
|
66
|
+
return ref ? `${withFolder}#${ref}` : withFolder;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Build the source argument for `skills add` during update.
|
|
71
|
+
* Uses shorthand form for path-targeted updates to avoid branch/path ambiguity.
|
|
72
|
+
*/
|
|
73
|
+
export function buildUpdateInstallSource(entry: UpdateSourceEntry): string {
|
|
74
|
+
if (!entry.skillPath) {
|
|
75
|
+
return formatSourceInput(entry.sourceUrl, entry.ref);
|
|
76
|
+
}
|
|
77
|
+
return appendFolderAndRef(entry.source, entry.skillPath, entry.ref);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Build the source argument for `skills add` during project-level update.
|
|
82
|
+
* Local lock entries don't carry `sourceUrl`, so we fall back to the bare
|
|
83
|
+
* `source` identifier when no `skillPath` is available.
|
|
84
|
+
*/
|
|
85
|
+
export function buildLocalUpdateSource(entry: LocalUpdateSourceEntry): string {
|
|
86
|
+
if (!entry.skillPath) {
|
|
87
|
+
return formatSourceInput(entry.source, entry.ref);
|
|
88
|
+
}
|
|
89
|
+
return appendFolderAndRef(entry.source, entry.skillPath, entry.ref);
|
|
90
|
+
}
|