@detergent-software/atk 0.12.1-dev.2
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/build/cli.d.ts +3 -0
- package/build/cli.d.ts.map +1 -0
- package/build/cli.js +35 -0
- package/build/cli.js.map +1 -0
- package/build/commands/_app.d.ts +3 -0
- package/build/commands/_app.d.ts.map +1 -0
- package/build/commands/_app.js +12 -0
- package/build/commands/_app.js.map +1 -0
- package/build/commands/audit.d.ts +12 -0
- package/build/commands/audit.d.ts.map +1 -0
- package/build/commands/audit.js +78 -0
- package/build/commands/audit.js.map +1 -0
- package/build/commands/browse.d.ts +15 -0
- package/build/commands/browse.d.ts.map +1 -0
- package/build/commands/browse.js +284 -0
- package/build/commands/browse.js.map +1 -0
- package/build/commands/cache.d.ts +13 -0
- package/build/commands/cache.d.ts.map +1 -0
- package/build/commands/cache.js +67 -0
- package/build/commands/cache.js.map +1 -0
- package/build/commands/config.d.ts +13 -0
- package/build/commands/config.d.ts.map +1 -0
- package/build/commands/config.js +62 -0
- package/build/commands/config.js.map +1 -0
- package/build/commands/diff.d.ts +16 -0
- package/build/commands/diff.d.ts.map +1 -0
- package/build/commands/diff.js +158 -0
- package/build/commands/diff.js.map +1 -0
- package/build/commands/doctor.d.ts +11 -0
- package/build/commands/doctor.d.ts.map +1 -0
- package/build/commands/doctor.js +30 -0
- package/build/commands/doctor.js.map +1 -0
- package/build/commands/index.d.ts +3 -0
- package/build/commands/index.d.ts.map +1 -0
- package/build/commands/index.js +30 -0
- package/build/commands/index.js.map +1 -0
- package/build/commands/info.d.ts +25 -0
- package/build/commands/info.d.ts.map +1 -0
- package/build/commands/info.js +198 -0
- package/build/commands/info.js.map +1 -0
- package/build/commands/init.d.ts +17 -0
- package/build/commands/init.d.ts.map +1 -0
- package/build/commands/init.js +504 -0
- package/build/commands/init.js.map +1 -0
- package/build/commands/install.d.ts +18 -0
- package/build/commands/install.d.ts.map +1 -0
- package/build/commands/install.js +186 -0
- package/build/commands/install.js.map +1 -0
- package/build/commands/list.d.ts +20 -0
- package/build/commands/list.d.ts.map +1 -0
- package/build/commands/list.js +61 -0
- package/build/commands/list.js.map +1 -0
- package/build/commands/outdated.d.ts +21 -0
- package/build/commands/outdated.d.ts.map +1 -0
- package/build/commands/outdated.js +81 -0
- package/build/commands/outdated.js.map +1 -0
- package/build/commands/pin.d.ts +22 -0
- package/build/commands/pin.d.ts.map +1 -0
- package/build/commands/pin.js +94 -0
- package/build/commands/pin.js.map +1 -0
- package/build/commands/prune.d.ts +14 -0
- package/build/commands/prune.d.ts.map +1 -0
- package/build/commands/prune.js +203 -0
- package/build/commands/prune.js.map +1 -0
- package/build/commands/publish.d.ts +14 -0
- package/build/commands/publish.d.ts.map +1 -0
- package/build/commands/publish.js +345 -0
- package/build/commands/publish.js.map +1 -0
- package/build/commands/search.d.ts +16 -0
- package/build/commands/search.d.ts.map +1 -0
- package/build/commands/search.js +80 -0
- package/build/commands/search.js.map +1 -0
- package/build/commands/sync.d.ts +15 -0
- package/build/commands/sync.d.ts.map +1 -0
- package/build/commands/sync.js +209 -0
- package/build/commands/sync.js.map +1 -0
- package/build/commands/uninstall.d.ts +18 -0
- package/build/commands/uninstall.d.ts.map +1 -0
- package/build/commands/uninstall.js +304 -0
- package/build/commands/uninstall.js.map +1 -0
- package/build/commands/unpin.d.ts +22 -0
- package/build/commands/unpin.d.ts.map +1 -0
- package/build/commands/unpin.js +79 -0
- package/build/commands/unpin.js.map +1 -0
- package/build/commands/update.d.ts +17 -0
- package/build/commands/update.d.ts.map +1 -0
- package/build/commands/update.js +151 -0
- package/build/commands/update.js.map +1 -0
- package/build/commands/why.d.ts +23 -0
- package/build/commands/why.d.ts.map +1 -0
- package/build/commands/why.js +108 -0
- package/build/commands/why.js.map +1 -0
- package/build/components/AssetDetail.d.ts +32 -0
- package/build/components/AssetDetail.d.ts.map +1 -0
- package/build/components/AssetDetail.js +45 -0
- package/build/components/AssetDetail.js.map +1 -0
- package/build/components/AssetTable.d.ts +25 -0
- package/build/components/AssetTable.d.ts.map +1 -0
- package/build/components/AssetTable.js +96 -0
- package/build/components/AssetTable.js.map +1 -0
- package/build/components/BrowseExpandedBundle.d.ts +26 -0
- package/build/components/BrowseExpandedBundle.d.ts.map +1 -0
- package/build/components/BrowseExpandedBundle.js +59 -0
- package/build/components/BrowseExpandedBundle.js.map +1 -0
- package/build/components/BrowseExpandedRow.d.ts +14 -0
- package/build/components/BrowseExpandedRow.d.ts.map +1 -0
- package/build/components/BrowseExpandedRow.js +9 -0
- package/build/components/BrowseExpandedRow.js.map +1 -0
- package/build/components/BrowseList.d.ts +26 -0
- package/build/components/BrowseList.d.ts.map +1 -0
- package/build/components/BrowseList.js +101 -0
- package/build/components/BrowseList.js.map +1 -0
- package/build/components/BundleDetail.d.ts +7 -0
- package/build/components/BundleDetail.d.ts.map +1 -0
- package/build/components/BundleDetail.js +12 -0
- package/build/components/BundleDetail.js.map +1 -0
- package/build/components/DependencyTree.d.ts +19 -0
- package/build/components/DependencyTree.d.ts.map +1 -0
- package/build/components/DependencyTree.js +21 -0
- package/build/components/DependencyTree.js.map +1 -0
- package/build/components/DiagnosticList.d.ts +19 -0
- package/build/components/DiagnosticList.d.ts.map +1 -0
- package/build/components/DiagnosticList.js +17 -0
- package/build/components/DiagnosticList.js.map +1 -0
- package/build/components/DiffView.d.ts +30 -0
- package/build/components/DiffView.d.ts.map +1 -0
- package/build/components/DiffView.js +32 -0
- package/build/components/DiffView.js.map +1 -0
- package/build/components/DryRunBanner.d.ts +11 -0
- package/build/components/DryRunBanner.d.ts.map +1 -0
- package/build/components/DryRunBanner.js +6 -0
- package/build/components/DryRunBanner.js.map +1 -0
- package/build/components/Field.d.ts +12 -0
- package/build/components/Field.d.ts.map +1 -0
- package/build/components/Field.js +9 -0
- package/build/components/Field.js.map +1 -0
- package/build/components/FilterBar.d.ts +18 -0
- package/build/components/FilterBar.d.ts.map +1 -0
- package/build/components/FilterBar.js +21 -0
- package/build/components/FilterBar.js.map +1 -0
- package/build/components/Header.d.ts +13 -0
- package/build/components/Header.d.ts.map +1 -0
- package/build/components/Header.js +20 -0
- package/build/components/Header.js.map +1 -0
- package/build/components/HelpBar.d.ts +11 -0
- package/build/components/HelpBar.d.ts.map +1 -0
- package/build/components/HelpBar.js +9 -0
- package/build/components/HelpBar.js.map +1 -0
- package/build/components/InstallConfirmBar.d.ts +9 -0
- package/build/components/InstallConfirmBar.d.ts.map +1 -0
- package/build/components/InstallConfirmBar.js +23 -0
- package/build/components/InstallConfirmBar.js.map +1 -0
- package/build/components/InstallSummary.d.ts +29 -0
- package/build/components/InstallSummary.d.ts.map +1 -0
- package/build/components/InstallSummary.js +12 -0
- package/build/components/InstallSummary.js.map +1 -0
- package/build/components/SectionDivider.d.ts +5 -0
- package/build/components/SectionDivider.d.ts.map +1 -0
- package/build/components/SectionDivider.js +11 -0
- package/build/components/SectionDivider.js.map +1 -0
- package/build/components/Spinner.d.ts +13 -0
- package/build/components/Spinner.d.ts.map +1 -0
- package/build/components/Spinner.js +11 -0
- package/build/components/Spinner.js.map +1 -0
- package/build/components/StatusBadge.d.ts +23 -0
- package/build/components/StatusBadge.d.ts.map +1 -0
- package/build/components/StatusBadge.js +43 -0
- package/build/components/StatusBadge.js.map +1 -0
- package/build/components/index.d.ts +20 -0
- package/build/components/index.d.ts.map +1 -0
- package/build/components/index.js +20 -0
- package/build/components/index.js.map +1 -0
- package/build/hooks/useBrowseState.d.ts +122 -0
- package/build/hooks/useBrowseState.d.ts.map +1 -0
- package/build/hooks/useBrowseState.js +315 -0
- package/build/hooks/useBrowseState.js.map +1 -0
- package/build/hooks/useCommand.d.ts +23 -0
- package/build/hooks/useCommand.d.ts.map +1 -0
- package/build/hooks/useCommand.js +43 -0
- package/build/hooks/useCommand.js.map +1 -0
- package/build/lib/adapter.d.ts +40 -0
- package/build/lib/adapter.d.ts.map +1 -0
- package/build/lib/adapter.js +112 -0
- package/build/lib/adapter.js.map +1 -0
- package/build/lib/auth.d.ts +31 -0
- package/build/lib/auth.d.ts.map +1 -0
- package/build/lib/auth.js +101 -0
- package/build/lib/auth.js.map +1 -0
- package/build/lib/breakpoints.d.ts +3 -0
- package/build/lib/breakpoints.d.ts.map +1 -0
- package/build/lib/breakpoints.js +8 -0
- package/build/lib/breakpoints.js.map +1 -0
- package/build/lib/checksum.d.ts +31 -0
- package/build/lib/checksum.d.ts.map +1 -0
- package/build/lib/checksum.js +78 -0
- package/build/lib/checksum.js.map +1 -0
- package/build/lib/config.d.ts +42 -0
- package/build/lib/config.d.ts.map +1 -0
- package/build/lib/config.js +123 -0
- package/build/lib/config.js.map +1 -0
- package/build/lib/detector.d.ts +35 -0
- package/build/lib/detector.d.ts.map +1 -0
- package/build/lib/detector.js +125 -0
- package/build/lib/detector.js.map +1 -0
- package/build/lib/diagnostics.d.ts +10 -0
- package/build/lib/diagnostics.d.ts.map +1 -0
- package/build/lib/diagnostics.js +195 -0
- package/build/lib/diagnostics.js.map +1 -0
- package/build/lib/diff.d.ts +34 -0
- package/build/lib/diff.d.ts.map +1 -0
- package/build/lib/diff.js +78 -0
- package/build/lib/diff.js.map +1 -0
- package/build/lib/fetch-retry.d.ts +43 -0
- package/build/lib/fetch-retry.d.ts.map +1 -0
- package/build/lib/fetch-retry.js +137 -0
- package/build/lib/fetch-retry.js.map +1 -0
- package/build/lib/github.d.ts +57 -0
- package/build/lib/github.d.ts.map +1 -0
- package/build/lib/github.js +96 -0
- package/build/lib/github.js.map +1 -0
- package/build/lib/gitignore.d.ts +37 -0
- package/build/lib/gitignore.d.ts.map +1 -0
- package/build/lib/gitignore.js +142 -0
- package/build/lib/gitignore.js.map +1 -0
- package/build/lib/init.d.ts +100 -0
- package/build/lib/init.d.ts.map +1 -0
- package/build/lib/init.js +295 -0
- package/build/lib/init.js.map +1 -0
- package/build/lib/installer.d.ts +50 -0
- package/build/lib/installer.d.ts.map +1 -0
- package/build/lib/installer.js +435 -0
- package/build/lib/installer.js.map +1 -0
- package/build/lib/lockfile.d.ts +170 -0
- package/build/lib/lockfile.d.ts.map +1 -0
- package/build/lib/lockfile.js +437 -0
- package/build/lib/lockfile.js.map +1 -0
- package/build/lib/markdown.d.ts +9 -0
- package/build/lib/markdown.d.ts.map +1 -0
- package/build/lib/markdown.js +67 -0
- package/build/lib/markdown.js.map +1 -0
- package/build/lib/parse-json.d.ts +34 -0
- package/build/lib/parse-json.d.ts.map +1 -0
- package/build/lib/parse-json.js +52 -0
- package/build/lib/parse-json.js.map +1 -0
- package/build/lib/paths.d.ts +28 -0
- package/build/lib/paths.d.ts.map +1 -0
- package/build/lib/paths.js +68 -0
- package/build/lib/paths.js.map +1 -0
- package/build/lib/publisher.d.ts +49 -0
- package/build/lib/publisher.d.ts.map +1 -0
- package/build/lib/publisher.js +388 -0
- package/build/lib/publisher.js.map +1 -0
- package/build/lib/registry.d.ts +97 -0
- package/build/lib/registry.d.ts.map +1 -0
- package/build/lib/registry.js +248 -0
- package/build/lib/registry.js.map +1 -0
- package/build/lib/resolver.d.ts +50 -0
- package/build/lib/resolver.d.ts.map +1 -0
- package/build/lib/resolver.js +110 -0
- package/build/lib/resolver.js.map +1 -0
- package/build/lib/schemas/adapter.d.ts +33 -0
- package/build/lib/schemas/adapter.d.ts.map +1 -0
- package/build/lib/schemas/adapter.js +27 -0
- package/build/lib/schemas/adapter.js.map +1 -0
- package/build/lib/schemas/bundle.d.ts +38 -0
- package/build/lib/schemas/bundle.d.ts.map +1 -0
- package/build/lib/schemas/bundle.js +19 -0
- package/build/lib/schemas/bundle.js.map +1 -0
- package/build/lib/schemas/config.d.ts +12 -0
- package/build/lib/schemas/config.d.ts.map +1 -0
- package/build/lib/schemas/config.js +14 -0
- package/build/lib/schemas/config.js.map +1 -0
- package/build/lib/schemas/index.d.ts +7 -0
- package/build/lib/schemas/index.d.ts.map +1 -0
- package/build/lib/schemas/index.js +7 -0
- package/build/lib/schemas/index.js.map +1 -0
- package/build/lib/schemas/lockfile.d.ts +102 -0
- package/build/lib/schemas/lockfile.d.ts.map +1 -0
- package/build/lib/schemas/lockfile.js +50 -0
- package/build/lib/schemas/lockfile.js.map +1 -0
- package/build/lib/schemas/manifest.d.ts +91 -0
- package/build/lib/schemas/manifest.d.ts.map +1 -0
- package/build/lib/schemas/manifest.js +42 -0
- package/build/lib/schemas/manifest.js.map +1 -0
- package/build/lib/schemas/registry.d.ts +225 -0
- package/build/lib/schemas/registry.d.ts.map +1 -0
- package/build/lib/schemas/registry.js +59 -0
- package/build/lib/schemas/registry.js.map +1 -0
- package/build/lib/search.d.ts +23 -0
- package/build/lib/search.d.ts.map +1 -0
- package/build/lib/search.js +139 -0
- package/build/lib/search.js.map +1 -0
- package/build/lib/tool-resolver.d.ts +12 -0
- package/build/lib/tool-resolver.d.ts.map +1 -0
- package/build/lib/tool-resolver.js +24 -0
- package/build/lib/tool-resolver.js.map +1 -0
- package/build/lib/uninstaller.d.ts +109 -0
- package/build/lib/uninstaller.d.ts.map +1 -0
- package/build/lib/uninstaller.js +368 -0
- package/build/lib/uninstaller.js.map +1 -0
- package/build/lib/updater.d.ts +68 -0
- package/build/lib/updater.d.ts.map +1 -0
- package/build/lib/updater.js +230 -0
- package/build/lib/updater.js.map +1 -0
- package/build/lib/version.d.ts +13 -0
- package/build/lib/version.d.ts.map +1 -0
- package/build/lib/version.js +30 -0
- package/build/lib/version.js.map +1 -0
- package/build/windows-esm-loader.d.ts +15 -0
- package/build/windows-esm-loader.d.ts.map +1 -0
- package/build/windows-esm-loader.js +11 -0
- package/build/windows-esm-loader.js.map +1 -0
- package/package.json +67 -0
- package/tool-adapters/claude-code.json +34 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { fetchWithRetry } from './fetch-retry.js';
|
|
2
|
+
import { isPreRelease } from './version.js';
|
|
3
|
+
export const DEFAULT_REGISTRY_REPO = 'EmergentSoftware/agentic-toolkit';
|
|
4
|
+
export const DEFAULT_REGISTRY_BRANCH = 'main';
|
|
5
|
+
export const DEFAULT_REGISTRY_BRANCH_DEV = 'develop';
|
|
6
|
+
/**
|
|
7
|
+
* Determine the effective registry branch based on explicit override or pre-release detection.
|
|
8
|
+
* Pre-release builds (e.g., 0.4.0-dev.5) default to the develop branch.
|
|
9
|
+
*/
|
|
10
|
+
export function getEffectiveBranch(registryBranch) {
|
|
11
|
+
return registryBranch ?? (isPreRelease() ? DEFAULT_REGISTRY_BRANCH_DEV : DEFAULT_REGISTRY_BRANCH);
|
|
12
|
+
}
|
|
13
|
+
/** GitHub API version used for all API requests. */
|
|
14
|
+
export const GITHUB_API_VERSION = '2022-11-28';
|
|
15
|
+
/** Accept header value for standard JSON responses from GitHub API. */
|
|
16
|
+
export const GITHUB_ACCEPT_JSON = 'application/vnd.github+json';
|
|
17
|
+
/** Accept header value for raw file content responses from GitHub API. */
|
|
18
|
+
export const GITHUB_ACCEPT_RAW = 'application/vnd.github.raw+json';
|
|
19
|
+
/**
|
|
20
|
+
* Build a GitHub Contents API URL for a file or directory in the registry repo.
|
|
21
|
+
*/
|
|
22
|
+
export function buildGitHubContentsUrl(path, branch) {
|
|
23
|
+
const ref = branch ?? DEFAULT_REGISTRY_BRANCH;
|
|
24
|
+
return `https://api.github.com/repos/${DEFAULT_REGISTRY_REPO}/contents/${path}?ref=${ref}`;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Build standard GitHub API request headers.
|
|
28
|
+
*
|
|
29
|
+
* @param token - GitHub authentication token (Bearer)
|
|
30
|
+
* @param accept - Accept header value; defaults to GITHUB_ACCEPT_JSON
|
|
31
|
+
* @returns HeadersInit with Accept, Authorization, and X-GitHub-Api-Version
|
|
32
|
+
*/
|
|
33
|
+
export function buildGitHubHeaders(token, accept) {
|
|
34
|
+
return {
|
|
35
|
+
Accept: accept ?? GITHUB_ACCEPT_JSON,
|
|
36
|
+
Authorization: `Bearer ${token}`,
|
|
37
|
+
'X-GitHub-Api-Version': GITHUB_API_VERSION,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Fetch raw file content from the GitHub Contents API.
|
|
42
|
+
*
|
|
43
|
+
* @param token - GitHub authentication token
|
|
44
|
+
* @param path - Repository-relative file path (e.g. "assets/skills/my-skill/1.0.0/skill.md")
|
|
45
|
+
* @param branch - Optional branch override; defaults to the registry default branch
|
|
46
|
+
*/
|
|
47
|
+
export async function fetchFileContent(token, path, branch) {
|
|
48
|
+
const url = buildGitHubContentsUrl(path, branch);
|
|
49
|
+
const response = await fetchWithRetry(url, {
|
|
50
|
+
headers: buildGitHubHeaders(token, GITHUB_ACCEPT_RAW),
|
|
51
|
+
});
|
|
52
|
+
if (!response.ok) {
|
|
53
|
+
throw new Error(httpErrorMessage(response.status, `file ${path}`));
|
|
54
|
+
}
|
|
55
|
+
return response.text();
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Return a user-friendly error message for common GitHub API HTTP status codes.
|
|
59
|
+
*/
|
|
60
|
+
export function httpErrorMessage(status, resource) {
|
|
61
|
+
switch (status) {
|
|
62
|
+
case 401:
|
|
63
|
+
case 403:
|
|
64
|
+
return 'Authentication failed. Check your GitHub token or run `gh auth login`.';
|
|
65
|
+
case 404:
|
|
66
|
+
return `File not found at ${resource}.`;
|
|
67
|
+
case 429:
|
|
68
|
+
return 'GitHub API rate limit exceeded. Try again later.';
|
|
69
|
+
default:
|
|
70
|
+
return `Failed to fetch ${resource}: HTTP ${status}`;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* List installable files in an asset's versioned directory on GitHub.
|
|
75
|
+
* Filters out directories, `manifest.json`, and `README.md`.
|
|
76
|
+
*
|
|
77
|
+
* @param token - GitHub authentication token
|
|
78
|
+
* @param asset - Object with `name` and `type` identifying the asset
|
|
79
|
+
* @param version - Semver version string
|
|
80
|
+
* @param branch - Optional branch override
|
|
81
|
+
*/
|
|
82
|
+
export async function listAssetDirectoryFiles(token, asset, version, branch) {
|
|
83
|
+
const assetDir = `assets/${asset.type}s/${asset.name}/${version}`;
|
|
84
|
+
const url = buildGitHubContentsUrl(assetDir, branch);
|
|
85
|
+
const response = await fetchWithRetry(url, {
|
|
86
|
+
headers: buildGitHubHeaders(token),
|
|
87
|
+
});
|
|
88
|
+
if (!response.ok) {
|
|
89
|
+
throw new Error(httpErrorMessage(response.status, 'asset file list'));
|
|
90
|
+
}
|
|
91
|
+
const contents = (await response.json());
|
|
92
|
+
return contents
|
|
93
|
+
.filter((item) => item.type === 'file' && item.name !== 'manifest.json' && item.name !== 'README.md')
|
|
94
|
+
.map((item) => ({ name: item.name, path: item.path }));
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=github.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github.js","sourceRoot":"","sources":["../../src/lib/github.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,MAAM,CAAC,MAAM,qBAAqB,GAAG,kCAAkC,CAAC;AACxE,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC;AAC9C,MAAM,CAAC,MAAM,2BAA2B,GAAG,SAAS,CAAC;AAErD;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAAC,cAAuB;IACxD,OAAO,cAAc,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,2BAA2B,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC;AACpG,CAAC;AAED,oDAAoD;AACpD,MAAM,CAAC,MAAM,kBAAkB,GAAG,YAAY,CAAC;AAE/C,uEAAuE;AACvE,MAAM,CAAC,MAAM,kBAAkB,GAAG,6BAA6B,CAAC;AAEhE,0EAA0E;AAC1E,MAAM,CAAC,MAAM,iBAAiB,GAAG,iCAAiC,CAAC;AAQnE;;GAEG;AACH,MAAM,UAAU,sBAAsB,CAAC,IAAY,EAAE,MAAe;IAClE,MAAM,GAAG,GAAG,MAAM,IAAI,uBAAuB,CAA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,OAAe,EACf,MAAe;IAEf,MAAM,QAAQ,GAAG,UAAU,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI,IAAI,OAAO,EAAE,CAAC;IAClE,MAAM,GAAG,GAAG,sBAAsB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAErD,MAAM,QAAQ,GAAG,MAAM,cAAc,CAAC,GAAG,EAAE;QACzC,OAAO,EAAE,kBAAkB,CAAC,KAAK,CAAC;KACnC,CAAC,CAAC;IAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC,CAAC;IACxE,CAAC;IAED,MAAM,QAAQ,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAIrC,CAAC;IAEH,OAAO,QAAQ;SACZ,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM,IAAI,IAAI,CAAC,IAAI,KAAK,eAAe,IAAI,IAAI,CAAC,IAAI,KAAK,WAAW,CAAC;SACpG,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;AAC3D,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Adapter } from './schemas/adapter.js';
|
|
2
|
+
/**
|
|
3
|
+
* Ensure that all required gitignore entries for an adapter's placements
|
|
4
|
+
* are present in the project's `.gitignore` file.
|
|
5
|
+
*
|
|
6
|
+
* - Reads `.gitignore` from `projectDir` (creates it if missing)
|
|
7
|
+
* - Determines which placement path patterns should be gitignored
|
|
8
|
+
* - Checks which patterns are already present
|
|
9
|
+
* - Appends missing entries under a `# ATK managed assets` comment header
|
|
10
|
+
*
|
|
11
|
+
* Returns which entries were added vs already present.
|
|
12
|
+
*/
|
|
13
|
+
export declare function ensureGitignoreEntries(projectDir: string, adapter: Adapter): Promise<{
|
|
14
|
+
added: string[];
|
|
15
|
+
alreadyPresent: string[];
|
|
16
|
+
}>;
|
|
17
|
+
/**
|
|
18
|
+
* Extract gitignore patterns from an adapter's placements.
|
|
19
|
+
*
|
|
20
|
+
* Includes directory-based placements where assets are placed into dedicated
|
|
21
|
+
* per-asset paths (identified by `{name}` in the path template).
|
|
22
|
+
*
|
|
23
|
+
* Excludes:
|
|
24
|
+
* - `fileless` placements (e.g., mcp-config) — no files are placed on disk
|
|
25
|
+
* - Shared-file placements without `{name}` in the path (e.g., memory-template
|
|
26
|
+
* targeting `.claude/CLAUDE.md`) — these target user-managed files that should
|
|
27
|
+
* not be gitignored
|
|
28
|
+
*/
|
|
29
|
+
export declare function getGitignorePatterns(adapter: Adapter): string[];
|
|
30
|
+
/**
|
|
31
|
+
* Check if a gitignore pattern (or its equivalent) is already present
|
|
32
|
+
* in the gitignore content.
|
|
33
|
+
*
|
|
34
|
+
* Handles minor variations such as trailing slashes and leading slashes.
|
|
35
|
+
*/
|
|
36
|
+
export declare function isEntryPresent(gitignoreContent: string, pattern: string): boolean;
|
|
37
|
+
//# sourceMappingURL=gitignore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gitignore.d.ts","sourceRoot":"","sources":["../../src/lib/gitignore.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAIpD;;;;;;;;;;GAUG;AACH,wBAAsB,sBAAsB,CAC1C,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,OAAO,GACf,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAAC,cAAc,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CA6DxD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,EAAE,CA+B/D;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,gBAAgB,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAYjF"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import { readFile, writeFile } from 'node:fs/promises';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
const ATK_HEADER = '# ATK managed assets';
|
|
5
|
+
/**
|
|
6
|
+
* Ensure that all required gitignore entries for an adapter's placements
|
|
7
|
+
* are present in the project's `.gitignore` file.
|
|
8
|
+
*
|
|
9
|
+
* - Reads `.gitignore` from `projectDir` (creates it if missing)
|
|
10
|
+
* - Determines which placement path patterns should be gitignored
|
|
11
|
+
* - Checks which patterns are already present
|
|
12
|
+
* - Appends missing entries under a `# ATK managed assets` comment header
|
|
13
|
+
*
|
|
14
|
+
* Returns which entries were added vs already present.
|
|
15
|
+
*/
|
|
16
|
+
export async function ensureGitignoreEntries(projectDir, adapter) {
|
|
17
|
+
const gitignorePath = join(projectDir, '.gitignore');
|
|
18
|
+
const patterns = getGitignorePatterns(adapter);
|
|
19
|
+
if (patterns.length === 0) {
|
|
20
|
+
return { added: [], alreadyPresent: [] };
|
|
21
|
+
}
|
|
22
|
+
// Read existing content or start with empty string
|
|
23
|
+
let content = '';
|
|
24
|
+
if (existsSync(gitignorePath)) {
|
|
25
|
+
content = await readFile(gitignorePath, 'utf-8');
|
|
26
|
+
}
|
|
27
|
+
const added = [];
|
|
28
|
+
const alreadyPresent = [];
|
|
29
|
+
for (const pattern of patterns) {
|
|
30
|
+
if (isEntryPresent(content, pattern)) {
|
|
31
|
+
alreadyPresent.push(pattern);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
added.push(pattern);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (added.length === 0) {
|
|
38
|
+
return { added, alreadyPresent };
|
|
39
|
+
}
|
|
40
|
+
// Build the new entries block
|
|
41
|
+
const newEntries = added.join('\n');
|
|
42
|
+
// Determine whether the ATK header already exists in the file
|
|
43
|
+
const hasHeader = content.includes(ATK_HEADER);
|
|
44
|
+
let updatedContent;
|
|
45
|
+
if (hasHeader) {
|
|
46
|
+
// Append new entries after the existing ATK section.
|
|
47
|
+
// Find the header and insert after the last contiguous non-empty line
|
|
48
|
+
// following it (i.e., at the end of the ATK block).
|
|
49
|
+
const lines = content.split('\n');
|
|
50
|
+
const headerIndex = lines.findIndex((line) => line.trim() === ATK_HEADER);
|
|
51
|
+
let insertIndex = headerIndex + 1;
|
|
52
|
+
// Walk past existing entries in the ATK block
|
|
53
|
+
while (insertIndex < lines.length && lines[insertIndex].trim() !== '' && !lines[insertIndex].startsWith('#')) {
|
|
54
|
+
insertIndex++;
|
|
55
|
+
}
|
|
56
|
+
lines.splice(insertIndex, 0, newEntries);
|
|
57
|
+
updatedContent = lines.join('\n');
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
// Append a new ATK section at the end of the file
|
|
61
|
+
const separator = content.length > 0 && !content.endsWith('\n') ? '\n\n' : content.length > 0 ? '\n' : '';
|
|
62
|
+
updatedContent = `${content}${separator}${ATK_HEADER}\n${newEntries}\n`;
|
|
63
|
+
}
|
|
64
|
+
await writeFile(gitignorePath, updatedContent, 'utf-8');
|
|
65
|
+
return { added, alreadyPresent };
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Extract gitignore patterns from an adapter's placements.
|
|
69
|
+
*
|
|
70
|
+
* Includes directory-based placements where assets are placed into dedicated
|
|
71
|
+
* per-asset paths (identified by `{name}` in the path template).
|
|
72
|
+
*
|
|
73
|
+
* Excludes:
|
|
74
|
+
* - `fileless` placements (e.g., mcp-config) — no files are placed on disk
|
|
75
|
+
* - Shared-file placements without `{name}` in the path (e.g., memory-template
|
|
76
|
+
* targeting `.claude/CLAUDE.md`) — these target user-managed files that should
|
|
77
|
+
* not be gitignored
|
|
78
|
+
*/
|
|
79
|
+
export function getGitignorePatterns(adapter) {
|
|
80
|
+
const patterns = [];
|
|
81
|
+
for (const placement of Object.values(adapter.placements ?? {})) {
|
|
82
|
+
if (!placement)
|
|
83
|
+
continue;
|
|
84
|
+
// Skip fileless placements (e.g., mcp-config)
|
|
85
|
+
if (placement.fileless)
|
|
86
|
+
continue;
|
|
87
|
+
// Skip shared-file placements that don't have a per-asset path template.
|
|
88
|
+
// These target shared config files (e.g., .claude/CLAUDE.md) that may
|
|
89
|
+
// contain user-managed content and should not be gitignored.
|
|
90
|
+
if (!placement.path.includes('{name}'))
|
|
91
|
+
continue;
|
|
92
|
+
// Extract the directory portion before the {name} template variable.
|
|
93
|
+
// For ".claude/skills/{name}/" → ".claude/skills/"
|
|
94
|
+
// For ".claude/agents/{name}.md" → ".claude/agents/"
|
|
95
|
+
const nameIndex = placement.path.indexOf('{name}');
|
|
96
|
+
const dirPath = placement.path.slice(0, nameIndex);
|
|
97
|
+
if (dirPath.length === 0)
|
|
98
|
+
continue;
|
|
99
|
+
// Normalize to forward slashes for gitignore compatibility
|
|
100
|
+
const normalized = dirPath.split('\\').join('/');
|
|
101
|
+
if (!patterns.includes(normalized)) {
|
|
102
|
+
patterns.push(normalized);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return patterns.sort();
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Check if a gitignore pattern (or its equivalent) is already present
|
|
109
|
+
* in the gitignore content.
|
|
110
|
+
*
|
|
111
|
+
* Handles minor variations such as trailing slashes and leading slashes.
|
|
112
|
+
*/
|
|
113
|
+
export function isEntryPresent(gitignoreContent, pattern) {
|
|
114
|
+
const lines = gitignoreContent.split('\n').map((line) => line.trim());
|
|
115
|
+
// Normalize the target pattern for comparison
|
|
116
|
+
const normalized = normalizePattern(pattern);
|
|
117
|
+
return lines.some((line) => {
|
|
118
|
+
// Skip comments and empty lines
|
|
119
|
+
if (line === '' || line.startsWith('#'))
|
|
120
|
+
return false;
|
|
121
|
+
return normalizePattern(line) === normalized;
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Normalize a gitignore pattern for comparison.
|
|
126
|
+
* Strips leading `/`, trailing whitespace, and normalizes trailing slashes.
|
|
127
|
+
*/
|
|
128
|
+
function normalizePattern(pattern) {
|
|
129
|
+
let normalized = pattern.trim();
|
|
130
|
+
// Normalize path separators first so trailing `\` becomes `/`
|
|
131
|
+
normalized = normalized.split('\\').join('/');
|
|
132
|
+
// Remove leading slash (gitignore treats `/foo` and `foo` similarly for root patterns)
|
|
133
|
+
if (normalized.startsWith('/')) {
|
|
134
|
+
normalized = normalized.slice(1);
|
|
135
|
+
}
|
|
136
|
+
// Remove trailing slash for comparison (`.claude/skills/` === `.claude/skills`)
|
|
137
|
+
if (normalized.endsWith('/')) {
|
|
138
|
+
normalized = normalized.slice(0, -1);
|
|
139
|
+
}
|
|
140
|
+
return normalized;
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=gitignore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gitignore.js","sourceRoot":"","sources":["../../src/lib/gitignore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIjC,MAAM,UAAU,GAAG,sBAAsB,CAAC;AAE1C;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,UAAkB,EAClB,OAAgB;IAEhB,MAAM,aAAa,GAAG,IAAI,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;IACrD,MAAM,QAAQ,GAAG,oBAAoB,CAAC,OAAO,CAAC,CAAC;IAE/C,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,EAAE,KAAK,EAAE,EA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;IAC9D,UAAU,GAAG,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAE9C,uFAAuF;IACvF,IAAI,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC/B,UAAU,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACnC,CAAC;IAED,gFAAgF;IAChF,IAAI,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAC7B,UAAU,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACvC,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import type { Lockfile } from './schemas/lockfile.js';
|
|
2
|
+
import type { Registry } from './schemas/registry.js';
|
|
3
|
+
export declare const SCHEMA_BASE_URL = "https://raw.githubusercontent.com/EmergentSoftware/agentic-toolkit/main/schemas";
|
|
4
|
+
export declare const INIT_TYPES: readonly ["skill", "agent", "rule", "hook", "memory-template", "mcp-config", "bundle"];
|
|
5
|
+
export interface InitOptions {
|
|
6
|
+
/** Author name. */
|
|
7
|
+
author: string;
|
|
8
|
+
/** Assets to include in a bundle (only used when type is 'bundle'). */
|
|
9
|
+
bundleAssets?: string[];
|
|
10
|
+
/** Short description. */
|
|
11
|
+
description: string;
|
|
12
|
+
/** Fork from an existing installed asset. */
|
|
13
|
+
from?: string;
|
|
14
|
+
/** Asset name (kebab-case). */
|
|
15
|
+
name: string;
|
|
16
|
+
/** Skip registry name availability check. */
|
|
17
|
+
offline: boolean;
|
|
18
|
+
/** Comma-separated tags. */
|
|
19
|
+
tags: string[];
|
|
20
|
+
/** Compatible tool identifiers. */
|
|
21
|
+
tools: string[];
|
|
22
|
+
/** Init type (asset type or 'bundle'). */
|
|
23
|
+
type: InitType;
|
|
24
|
+
}
|
|
25
|
+
export interface InitResult {
|
|
26
|
+
/** List of files created (relative to outputDir). */
|
|
27
|
+
filesCreated: string[];
|
|
28
|
+
/** Asset name. */
|
|
29
|
+
name: string;
|
|
30
|
+
/** Absolute path to the created directory. */
|
|
31
|
+
outputDir: string;
|
|
32
|
+
/** Init type. */
|
|
33
|
+
type: InitType;
|
|
34
|
+
}
|
|
35
|
+
export type InitType = (typeof INIT_TYPES)[number];
|
|
36
|
+
/**
|
|
37
|
+
* Check if a name+type combination already exists in the registry.
|
|
38
|
+
* Checks both the assets and bundles sections.
|
|
39
|
+
*/
|
|
40
|
+
export declare function checkNameAvailability(name: string, type: InitType, registry: Registry): {
|
|
41
|
+
available: boolean;
|
|
42
|
+
existingVersion?: string;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Detect which tools support the given asset type by checking all loaded adapters.
|
|
46
|
+
* For 'bundle' type, returns an empty array (bundles are not placed by adapters).
|
|
47
|
+
*/
|
|
48
|
+
export declare function detectCompatibleTools(assetType: InitType): Promise<string[]>;
|
|
49
|
+
/**
|
|
50
|
+
* Look up an installed asset in the lockfile and read its files from disk.
|
|
51
|
+
* Returns the manifest data and file contents for pre-filling a new scaffold.
|
|
52
|
+
* Returns undefined if the asset is not found in the lockfile.
|
|
53
|
+
*/
|
|
54
|
+
export declare function forkFromInstalled(fromName: string, lockfile: Lockfile, projectDir: string): Promise<undefined | {
|
|
55
|
+
files: Map<string, string>;
|
|
56
|
+
manifest: Record<string, unknown>;
|
|
57
|
+
}>;
|
|
58
|
+
/**
|
|
59
|
+
* Generate minimal stub content for an asset entrypoint file.
|
|
60
|
+
* Returns an empty string for types that have no entrypoint (mcp-config, bundle).
|
|
61
|
+
*/
|
|
62
|
+
export declare function generateEntrypointContent(type: InitType, name: string, description: string): string;
|
|
63
|
+
/**
|
|
64
|
+
* Generate a manifest JSON object for the given init options.
|
|
65
|
+
* Produces a manifest.json structure for assets or bundle.json structure for bundles.
|
|
66
|
+
*/
|
|
67
|
+
export declare function generateManifest(options: InitOptions): Record<string, unknown>;
|
|
68
|
+
/**
|
|
69
|
+
* Generate README.md content for an asset.
|
|
70
|
+
* Includes type-specific sections for hooks and MCP configs.
|
|
71
|
+
*/
|
|
72
|
+
export declare function generateReadmeContent(type: InitType, name: string, description: string): string;
|
|
73
|
+
/**
|
|
74
|
+
* Get the entrypoint filename for a given asset type and name.
|
|
75
|
+
* Returns undefined for fileless types (mcp-config) and bundles.
|
|
76
|
+
*/
|
|
77
|
+
export declare function getEntrypointName(type: InitType, name: string): string | undefined;
|
|
78
|
+
/**
|
|
79
|
+
* Attempt to read the git user.name config value.
|
|
80
|
+
* Returns undefined if git is not available or the value is not set.
|
|
81
|
+
*/
|
|
82
|
+
export declare function getGitUserName(): Promise<string | undefined>;
|
|
83
|
+
/**
|
|
84
|
+
* Scaffold a new asset or bundle directory with manifest and starter files.
|
|
85
|
+
*
|
|
86
|
+
* Creates `${outputBaseDir}/${options.name}/` with:
|
|
87
|
+
* - manifest.json (or bundle.json for bundle type)
|
|
88
|
+
* - Entrypoint file (if applicable)
|
|
89
|
+
* - README.md
|
|
90
|
+
*/
|
|
91
|
+
export declare function scaffoldAsset(options: InitOptions, outputBaseDir: string): Promise<InitResult>;
|
|
92
|
+
/**
|
|
93
|
+
* Validate an asset name is in kebab-case format.
|
|
94
|
+
* Rules: lowercase letters, numbers, and hyphens; must start with a letter; min 2 chars.
|
|
95
|
+
*/
|
|
96
|
+
export declare function validateAssetName(name: string): {
|
|
97
|
+
error?: string;
|
|
98
|
+
valid: boolean;
|
|
99
|
+
};
|
|
100
|
+
//# sourceMappingURL=init.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/lib/init.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAUtD,eAAO,MAAM,eAAe,oFAAoF,CAAC;AA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