@aws/agentcore 0.3.0-preview.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 (213) hide show
  1. package/LICENSE +175 -0
  2. package/README.md +147 -0
  3. package/dist/assets/README.md +79 -0
  4. package/dist/assets/__tests__/__snapshots__/assets.snapshot.test.ts.snap +2862 -0
  5. package/dist/assets/__tests__/assets.snapshot.test.ts +139 -0
  6. package/dist/assets/agents/AGENTS.md +102 -0
  7. package/dist/assets/cdk/.prettierrc +8 -0
  8. package/dist/assets/cdk/README.md +14 -0
  9. package/dist/assets/cdk/bin/cdk.ts +50 -0
  10. package/dist/assets/cdk/cdk.json +88 -0
  11. package/dist/assets/cdk/gitignore.template +9 -0
  12. package/dist/assets/cdk/jest.config.js +9 -0
  13. package/dist/assets/cdk/lib/cdk-stack.ts +38 -0
  14. package/dist/assets/cdk/npmignore.template +6 -0
  15. package/dist/assets/cdk/package.json +30 -0
  16. package/dist/assets/cdk/test/cdk.test.ts +16 -0
  17. package/dist/assets/cdk/tsconfig.json +28 -0
  18. package/dist/assets/mcp/python/README.md +27 -0
  19. package/dist/assets/mcp/python/pyproject.toml +22 -0
  20. package/dist/assets/mcp/python/server.py +117 -0
  21. package/dist/assets/mcp/python-lambda/README.md +22 -0
  22. package/dist/assets/mcp/python-lambda/handler.py +144 -0
  23. package/dist/assets/mcp/python-lambda/pyproject.toml +15 -0
  24. package/dist/assets/python/autogen/base/README.md +41 -0
  25. package/dist/assets/python/autogen/base/gitignore.template +40 -0
  26. package/dist/assets/python/autogen/base/main.py +52 -0
  27. package/dist/assets/python/autogen/base/mcp_client/client.py +18 -0
  28. package/dist/assets/python/autogen/base/model/load.py +136 -0
  29. package/dist/assets/python/autogen/base/pyproject.toml +35 -0
  30. package/dist/assets/python/crewai/base/README.md +41 -0
  31. package/dist/assets/python/crewai/base/gitignore.template +40 -0
  32. package/dist/assets/python/crewai/base/main.py +55 -0
  33. package/dist/assets/python/crewai/base/model/load.py +133 -0
  34. package/dist/assets/python/crewai/base/pyproject.toml +32 -0
  35. package/dist/assets/python/googleadk/base/README.md +39 -0
  36. package/dist/assets/python/googleadk/base/gitignore.template +40 -0
  37. package/dist/assets/python/googleadk/base/main.py +84 -0
  38. package/dist/assets/python/googleadk/base/mcp_client/client.py +15 -0
  39. package/dist/assets/python/googleadk/base/model/load.py +41 -0
  40. package/dist/assets/python/googleadk/base/pyproject.toml +21 -0
  41. package/dist/assets/python/langchain_langgraph/base/README.md +41 -0
  42. package/dist/assets/python/langchain_langgraph/base/gitignore.template +40 -0
  43. package/dist/assets/python/langchain_langgraph/base/main.py +51 -0
  44. package/dist/assets/python/langchain_langgraph/base/mcp_client/client.py +19 -0
  45. package/dist/assets/python/langchain_langgraph/base/model/load.py +123 -0
  46. package/dist/assets/python/langchain_langgraph/base/pyproject.toml +37 -0
  47. package/dist/assets/python/openaiagents/base/README.md +39 -0
  48. package/dist/assets/python/openaiagents/base/gitignore.template +40 -0
  49. package/dist/assets/python/openaiagents/base/main.py +56 -0
  50. package/dist/assets/python/openaiagents/base/mcp_client/client.py +14 -0
  51. package/dist/assets/python/openaiagents/base/model/load.py +37 -0
  52. package/dist/assets/python/openaiagents/base/pyproject.toml +20 -0
  53. package/dist/assets/python/strands/base/README.md +41 -0
  54. package/dist/assets/python/strands/base/gitignore.template +41 -0
  55. package/dist/assets/python/strands/base/main.py +76 -0
  56. package/dist/assets/python/strands/base/mcp_client/client.py +12 -0
  57. package/dist/assets/python/strands/base/model/load.py +123 -0
  58. package/dist/assets/python/strands/base/pyproject.toml +23 -0
  59. package/dist/assets/python/strands/capabilities/memory/session.py +39 -0
  60. package/dist/assets/typescript/.gitkeep +0 -0
  61. package/dist/cli/index.mjs +985 -0
  62. package/dist/index.d.ts +9 -0
  63. package/dist/index.d.ts.map +1 -0
  64. package/dist/index.js +27 -0
  65. package/dist/index.js.map +1 -0
  66. package/dist/lib/constants.d.ts +25 -0
  67. package/dist/lib/constants.d.ts.map +1 -0
  68. package/dist/lib/constants.js +49 -0
  69. package/dist/lib/constants.js.map +1 -0
  70. package/dist/lib/errors/config.d.ts +49 -0
  71. package/dist/lib/errors/config.d.ts.map +1 -0
  72. package/dist/lib/errors/config.js +167 -0
  73. package/dist/lib/errors/config.js.map +1 -0
  74. package/dist/lib/errors/index.d.ts +2 -0
  75. package/dist/lib/errors/index.d.ts.map +1 -0
  76. package/dist/lib/errors/index.js +18 -0
  77. package/dist/lib/errors/index.js.map +1 -0
  78. package/dist/lib/index.d.ts +7 -0
  79. package/dist/lib/index.d.ts.map +1 -0
  80. package/dist/lib/index.js +39 -0
  81. package/dist/lib/index.js.map +1 -0
  82. package/dist/lib/packaging/errors.d.ts +16 -0
  83. package/dist/lib/packaging/errors.d.ts.map +1 -0
  84. package/dist/lib/packaging/errors.js +36 -0
  85. package/dist/lib/packaging/errors.js.map +1 -0
  86. package/dist/lib/packaging/helpers.d.ts +54 -0
  87. package/dist/lib/packaging/helpers.d.ts.map +1 -0
  88. package/dist/lib/packaging/helpers.js +461 -0
  89. package/dist/lib/packaging/helpers.js.map +1 -0
  90. package/dist/lib/packaging/index.d.ts +36 -0
  91. package/dist/lib/packaging/index.d.ts.map +1 -0
  92. package/dist/lib/packaging/index.js +89 -0
  93. package/dist/lib/packaging/index.js.map +1 -0
  94. package/dist/lib/packaging/node.d.ts +17 -0
  95. package/dist/lib/packaging/node.d.ts.map +1 -0
  96. package/dist/lib/packaging/node.js +108 -0
  97. package/dist/lib/packaging/node.js.map +1 -0
  98. package/dist/lib/packaging/python.d.ts +17 -0
  99. package/dist/lib/packaging/python.d.ts.map +1 -0
  100. package/dist/lib/packaging/python.js +162 -0
  101. package/dist/lib/packaging/python.js.map +1 -0
  102. package/dist/lib/packaging/types/index.d.ts +2 -0
  103. package/dist/lib/packaging/types/index.d.ts.map +1 -0
  104. package/dist/lib/packaging/types/index.js +3 -0
  105. package/dist/lib/packaging/types/index.js.map +1 -0
  106. package/dist/lib/packaging/types/packaging.d.ts +57 -0
  107. package/dist/lib/packaging/types/packaging.d.ts.map +1 -0
  108. package/dist/lib/packaging/types/packaging.js +3 -0
  109. package/dist/lib/packaging/types/packaging.js.map +1 -0
  110. package/dist/lib/packaging/uv.d.ts +7 -0
  111. package/dist/lib/packaging/uv.d.ts.map +1 -0
  112. package/dist/lib/packaging/uv.js +40 -0
  113. package/dist/lib/packaging/uv.js.map +1 -0
  114. package/dist/lib/schemas/io/config-io.d.ts +106 -0
  115. package/dist/lib/schemas/io/config-io.d.ts.map +1 -0
  116. package/dist/lib/schemas/io/config-io.js +293 -0
  117. package/dist/lib/schemas/io/config-io.js.map +1 -0
  118. package/dist/lib/schemas/io/index.d.ts +3 -0
  119. package/dist/lib/schemas/io/index.d.ts.map +1 -0
  120. package/dist/lib/schemas/io/index.js +17 -0
  121. package/dist/lib/schemas/io/index.js.map +1 -0
  122. package/dist/lib/schemas/io/path-resolver.d.ts +112 -0
  123. package/dist/lib/schemas/io/path-resolver.d.ts.map +1 -0
  124. package/dist/lib/schemas/io/path-resolver.js +195 -0
  125. package/dist/lib/schemas/io/path-resolver.js.map +1 -0
  126. package/dist/lib/utils/aws-account.d.ts +7 -0
  127. package/dist/lib/utils/aws-account.d.ts.map +1 -0
  128. package/dist/lib/utils/aws-account.js +24 -0
  129. package/dist/lib/utils/aws-account.js.map +1 -0
  130. package/dist/lib/utils/credentials.d.ts +86 -0
  131. package/dist/lib/utils/credentials.d.ts.map +1 -0
  132. package/dist/lib/utils/credentials.js +153 -0
  133. package/dist/lib/utils/credentials.js.map +1 -0
  134. package/dist/lib/utils/env.d.ts +22 -0
  135. package/dist/lib/utils/env.d.ts.map +1 -0
  136. package/dist/lib/utils/env.js +65 -0
  137. package/dist/lib/utils/env.js.map +1 -0
  138. package/dist/lib/utils/index.d.ts +7 -0
  139. package/dist/lib/utils/index.d.ts.map +1 -0
  140. package/dist/lib/utils/index.js +23 -0
  141. package/dist/lib/utils/index.js.map +1 -0
  142. package/dist/lib/utils/platform.d.ts +63 -0
  143. package/dist/lib/utils/platform.d.ts.map +1 -0
  144. package/dist/lib/utils/platform.js +88 -0
  145. package/dist/lib/utils/platform.js.map +1 -0
  146. package/dist/lib/utils/subprocess.d.ts +29 -0
  147. package/dist/lib/utils/subprocess.d.ts.map +1 -0
  148. package/dist/lib/utils/subprocess.js +94 -0
  149. package/dist/lib/utils/subprocess.js.map +1 -0
  150. package/dist/lib/utils/zod.d.ts +14 -0
  151. package/dist/lib/utils/zod.d.ts.map +1 -0
  152. package/dist/lib/utils/zod.js +32 -0
  153. package/dist/lib/utils/zod.js.map +1 -0
  154. package/dist/schema/constants.d.ts +82 -0
  155. package/dist/schema/constants.d.ts.map +1 -0
  156. package/dist/schema/constants.js +117 -0
  157. package/dist/schema/constants.js.map +1 -0
  158. package/dist/schema/index.d.ts +4 -0
  159. package/dist/schema/index.d.ts.map +1 -0
  160. package/dist/schema/index.js +21 -0
  161. package/dist/schema/index.js.map +1 -0
  162. package/dist/schema/schemas/agent-env.d.ts +75 -0
  163. package/dist/schema/schemas/agent-env.d.ts.map +1 -0
  164. package/dist/schema/schemas/agent-env.js +84 -0
  165. package/dist/schema/schemas/agent-env.js.map +1 -0
  166. package/dist/schema/schemas/agentcore-project.d.ts +88 -0
  167. package/dist/schema/schemas/agentcore-project.d.ts.map +1 -0
  168. package/dist/schema/schemas/agentcore-project.js +83 -0
  169. package/dist/schema/schemas/agentcore-project.js.map +1 -0
  170. package/dist/schema/schemas/aws-targets.d.ts +50 -0
  171. package/dist/schema/schemas/aws-targets.d.ts.map +1 -0
  172. package/dist/schema/schemas/aws-targets.js +49 -0
  173. package/dist/schema/schemas/aws-targets.js.map +1 -0
  174. package/dist/schema/schemas/deployed-state.d.ts +260 -0
  175. package/dist/schema/schemas/deployed-state.d.ts.map +1 -0
  176. package/dist/schema/schemas/deployed-state.js +100 -0
  177. package/dist/schema/schemas/deployed-state.js.map +1 -0
  178. package/dist/schema/schemas/index.d.ts +8 -0
  179. package/dist/schema/schemas/index.d.ts.map +1 -0
  180. package/dist/schema/schemas/index.js +25 -0
  181. package/dist/schema/schemas/index.js.map +1 -0
  182. package/dist/schema/schemas/mcp-defs.d.ts +52 -0
  183. package/dist/schema/schemas/mcp-defs.d.ts.map +1 -0
  184. package/dist/schema/schemas/mcp-defs.js +50 -0
  185. package/dist/schema/schemas/mcp-defs.js.map +1 -0
  186. package/dist/schema/schemas/mcp.d.ts +659 -0
  187. package/dist/schema/schemas/mcp.d.ts.map +1 -0
  188. package/dist/schema/schemas/mcp.js +283 -0
  189. package/dist/schema/schemas/mcp.js.map +1 -0
  190. package/dist/schema/schemas/primitives/index.d.ts +3 -0
  191. package/dist/schema/schemas/primitives/index.d.ts.map +1 -0
  192. package/dist/schema/schemas/primitives/index.js +9 -0
  193. package/dist/schema/schemas/primitives/index.js.map +1 -0
  194. package/dist/schema/schemas/primitives/memory.d.ts +42 -0
  195. package/dist/schema/schemas/primitives/memory.d.ts.map +1 -0
  196. package/dist/schema/schemas/primitives/memory.js +50 -0
  197. package/dist/schema/schemas/primitives/memory.js.map +1 -0
  198. package/dist/schema/schemas/zod-util.d.ts +10 -0
  199. package/dist/schema/schemas/zod-util.d.ts.map +1 -0
  200. package/dist/schema/schemas/zod-util.js +23 -0
  201. package/dist/schema/schemas/zod-util.js.map +1 -0
  202. package/dist/schema/types/index.d.ts +2 -0
  203. package/dist/schema/types/index.d.ts.map +1 -0
  204. package/dist/schema/types/index.js +18 -0
  205. package/dist/schema/types/index.js.map +1 -0
  206. package/dist/schema/types/path.d.ts +27 -0
  207. package/dist/schema/types/path.d.ts.map +1 -0
  208. package/dist/schema/types/path.js +13 -0
  209. package/dist/schema/types/path.js.map +1 -0
  210. package/package.json +111 -0
  211. package/scripts/bump-version.ts +442 -0
  212. package/scripts/check-old-cli.mjs +26 -0
  213. package/scripts/copy-assets.mjs +50 -0
package/package.json ADDED
@@ -0,0 +1,111 @@
1
+ {
2
+ "name": "@aws/agentcore",
3
+ "version": "0.3.0-preview.1.0",
4
+ "description": "CLI for Amazon Bedrock AgentCore",
5
+ "main": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "bin": {
8
+ "agentcore": "dist/cli/index.mjs"
9
+ },
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "require": "./dist/index.js"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist",
18
+ "scripts"
19
+ ],
20
+ "scripts": {
21
+ "preinstall": "node scripts/check-old-cli.mjs",
22
+ "build": "npm run build:lib && npm run build:cli && npm run build:assets",
23
+ "build:lib": "tsc -p tsconfig.build.json",
24
+ "build:cli": "node esbuild.config.mjs",
25
+ "build:assets": "node scripts/copy-assets.mjs",
26
+ "cli": "npx tsx src/cli/index.ts",
27
+ "typecheck": "tsc --noEmit",
28
+ "lint": "eslint src/",
29
+ "lint:fix": "eslint src/ --fix",
30
+ "format": "prettier --write .",
31
+ "format:check": "prettier --check .",
32
+ "secrets:check": "secretlint '**/*'",
33
+ "security:audit": "npm audit --audit-level=high",
34
+ "clean": "node -e \"require('fs').rmSync('dist', {recursive: true, force: true})\"",
35
+ "prepare": "husky",
36
+ "test": "vitest run --project unit",
37
+ "test:all": "vitest run",
38
+ "test:watch": "vitest --project unit",
39
+ "test:integ": "vitest run --project integ",
40
+ "test:unit": "vitest run --project unit --coverage",
41
+ "test:update-snapshots": "vitest run --project unit --update"
42
+ },
43
+ "dependencies": {
44
+ "@aws-cdk/toolkit-lib": "^1.13.0",
45
+ "@aws-sdk/client-bedrock-agentcore": "^3.893.0",
46
+ "@aws-sdk/client-bedrock-agentcore-control": "^3.893.0",
47
+ "@aws-sdk/client-bedrock-runtime": "^3.893.0",
48
+ "@aws-sdk/client-cloudformation": "^3.893.0",
49
+ "@aws-sdk/client-resource-groups-tagging-api": "^3.893.0",
50
+ "@aws-sdk/client-sts": "^3.893.0",
51
+ "@aws-sdk/credential-providers": "^3.893.0",
52
+ "@commander-js/extra-typings": "^14.0.0",
53
+ "@smithy/shared-ini-file-loader": "^4.4.2",
54
+ "commander": "^14.0.2",
55
+ "dotenv": "^17.2.3",
56
+ "fflate": "^0.8.2",
57
+ "handlebars": "^4.7.8",
58
+ "ink": "^6.6.0",
59
+ "ink-link": "5.0.0",
60
+ "ink-spinner": "^5.0.0",
61
+ "react": "^19.2.3",
62
+ "zod": "^4.3.5"
63
+ },
64
+ "peerDependencies": {
65
+ "aws-cdk-lib": "^2.234.1",
66
+ "constructs": "^10.0.0"
67
+ },
68
+ "devDependencies": {
69
+ "@eslint/js": "^9.39.2",
70
+ "@secretlint/secretlint-rule-preset-recommend": "^11.3.0",
71
+ "@trivago/prettier-plugin-sort-imports": "6.0.0",
72
+ "@types/node": "^25.0.3",
73
+ "@types/react": "^19.2.7",
74
+ "@typescript-eslint/eslint-plugin": "^8.50.0",
75
+ "@typescript-eslint/parser": "^8.50.0",
76
+ "@vitest/coverage-v8": "^4.0.18",
77
+ "aws-cdk-lib": "^2.234.1",
78
+ "constructs": "^10.4.4",
79
+ "esbuild": "^0.27.2",
80
+ "eslint": "^9.39.2",
81
+ "eslint-config-prettier": "^10.1.8",
82
+ "eslint-import-resolver-typescript": "^4.4.4",
83
+ "eslint-plugin-import": "^2.32.0",
84
+ "eslint-plugin-react": "^7.37.5",
85
+ "eslint-plugin-react-hooks": "^7.0.1",
86
+ "eslint-plugin-react-refresh": "^0.4.26",
87
+ "eslint-plugin-security": "^3.0.1",
88
+ "husky": "^9.1.7",
89
+ "lint-staged": "^16.2.7",
90
+ "prettier": "^3.7.4",
91
+ "secretlint": "^11.3.0",
92
+ "tsx": "^4.21.0",
93
+ "typescript": "^5",
94
+ "typescript-eslint": "^8.50.1",
95
+ "vitest": "^4.0.18"
96
+ },
97
+ "engines": {
98
+ "node": ">=20"
99
+ },
100
+ "lint-staged": {
101
+ "*.{ts,tsx}": [
102
+ "eslint --max-warnings=10"
103
+ ],
104
+ "*.{ts,tsx,js,jsx,json,md,css,html,yml,yaml}": [
105
+ "prettier --check"
106
+ ],
107
+ "*": [
108
+ "secretlint"
109
+ ]
110
+ }
111
+ }
@@ -0,0 +1,442 @@
1
+ #!/usr/bin/env npx tsx
2
+
3
+ /**
4
+ * Version bump script for AgentCore CLI
5
+ *
6
+ * Usage:
7
+ * npx tsx scripts/bump-version.ts <bump_type> [options]
8
+ *
9
+ * Arguments:
10
+ * bump_type: major | minor | patch | prerelease | preview
11
+ *
12
+ * Options:
13
+ * --changelog <text> Custom changelog entry
14
+ * --prerelease-tag <tag> Prerelease identifier (default: beta)
15
+ * --dry-run Show what would be done without making changes
16
+ *
17
+ * Preview bumps (internal format):
18
+ * - 0.3.0 -> 0.3.0-preview.1.0
19
+ * - 0.3.0-preview.1.0 -> 0.3.0-preview.1.1
20
+ */
21
+ import { execSync } from 'child_process';
22
+ import { existsSync, readFileSync, writeFileSync } from 'fs';
23
+
24
+ // ===========================
25
+ // Types
26
+ // ===========================
27
+
28
+ type BumpType = 'major' | 'minor' | 'patch' | 'prerelease' | 'preview';
29
+
30
+ interface ParsedVersion {
31
+ major: number;
32
+ minor: number;
33
+ patch: number;
34
+ prerelease?: string;
35
+ prereleaseNum?: number;
36
+ // For preview format: X.Y.Z-previewN.M
37
+ previewMajor?: number;
38
+ previewMinor?: number;
39
+ }
40
+
41
+ interface PackageJson {
42
+ version: string;
43
+ [key: string]: unknown;
44
+ }
45
+
46
+ interface PackageLockJson {
47
+ version: string;
48
+ packages?: {
49
+ ''?: { version: string };
50
+ [key: string]: unknown;
51
+ };
52
+ [key: string]: unknown;
53
+ }
54
+
55
+ // ===========================
56
+ // Version Parsing & Bumping
57
+ // ===========================
58
+
59
+ function parseVersion(version: string): ParsedVersion {
60
+ // First try to match preview format: X.Y.Z-preview.N.M (e.g., 0.3.0-preview.1.0)
61
+ const previewMatch = /^(\d+)\.(\d+)\.(\d+)-preview\.(\d+)\.(\d+)$/.exec(version);
62
+ if (previewMatch) {
63
+ return {
64
+ major: parseInt(previewMatch[1]!, 10),
65
+ minor: parseInt(previewMatch[2]!, 10),
66
+ patch: parseInt(previewMatch[3]!, 10),
67
+ previewMajor: parseInt(previewMatch[4]!, 10),
68
+ previewMinor: parseInt(previewMatch[5]!, 10),
69
+ };
70
+ }
71
+
72
+ // Match standard versions like: 1.2.3, 1.2.3-beta.1, 1.2.3-rc.0
73
+ const match = /^(\d+)\.(\d+)\.(\d+)(?:-([a-zA-Z]+)\.(\d+))?$/.exec(version);
74
+
75
+ if (!match) {
76
+ throw new Error(`Invalid version format: ${version}`);
77
+ }
78
+
79
+ return {
80
+ major: parseInt(match[1]!, 10),
81
+ minor: parseInt(match[2]!, 10),
82
+ patch: parseInt(match[3]!, 10),
83
+ prerelease: match[4],
84
+ prereleaseNum: match[5] ? parseInt(match[5], 10) : undefined,
85
+ };
86
+ }
87
+
88
+ function formatVersion(parsed: ParsedVersion): string {
89
+ const base = `${parsed.major}.${parsed.minor}.${parsed.patch}`;
90
+
91
+ // Handle preview format: X.Y.Z-preview.N.M
92
+ if (parsed.previewMajor !== undefined && parsed.previewMinor !== undefined) {
93
+ return `${base}-preview.${parsed.previewMajor}.${parsed.previewMinor}`;
94
+ }
95
+
96
+ // Handle standard prerelease format: X.Y.Z-tag.N
97
+ if (parsed.prerelease !== undefined && parsed.prereleaseNum !== undefined) {
98
+ return `${base}-${parsed.prerelease}.${parsed.prereleaseNum}`;
99
+ }
100
+
101
+ return base;
102
+ }
103
+
104
+ function bumpVersion(current: string, bumpType: BumpType, prereleaseTag = 'beta'): string {
105
+ const parsed = parseVersion(current);
106
+
107
+ switch (bumpType) {
108
+ case 'major':
109
+ return formatVersion({
110
+ major: parsed.major + 1,
111
+ minor: 0,
112
+ patch: 0,
113
+ });
114
+
115
+ case 'minor':
116
+ return formatVersion({
117
+ major: parsed.major,
118
+ minor: parsed.minor + 1,
119
+ patch: 0,
120
+ });
121
+
122
+ case 'patch':
123
+ // If currently a prerelease or preview, just remove the suffix
124
+ if (parsed.prerelease || parsed.previewMajor !== undefined) {
125
+ return formatVersion({
126
+ major: parsed.major,
127
+ minor: parsed.minor,
128
+ patch: parsed.patch,
129
+ });
130
+ }
131
+ return formatVersion({
132
+ major: parsed.major,
133
+ minor: parsed.minor,
134
+ patch: parsed.patch + 1,
135
+ });
136
+
137
+ case 'prerelease':
138
+ // If already a prerelease with same tag, increment the number
139
+ if (parsed.prerelease === prereleaseTag && parsed.prereleaseNum !== undefined) {
140
+ return formatVersion({
141
+ major: parsed.major,
142
+ minor: parsed.minor,
143
+ patch: parsed.patch,
144
+ prerelease: prereleaseTag,
145
+ prereleaseNum: parsed.prereleaseNum + 1,
146
+ });
147
+ }
148
+ // Otherwise, bump patch and start new prerelease
149
+ return formatVersion({
150
+ major: parsed.major,
151
+ minor: parsed.minor,
152
+ patch: parsed.prerelease ? parsed.patch : parsed.patch + 1,
153
+ prerelease: prereleaseTag,
154
+ prereleaseNum: 0,
155
+ });
156
+
157
+ case 'preview':
158
+ // Handle preview format: X.Y.Z-previewN.M
159
+ // If already a preview, increment the minor preview number
160
+ if (parsed.previewMajor !== undefined && parsed.previewMinor !== undefined) {
161
+ return formatVersion({
162
+ major: parsed.major,
163
+ minor: parsed.minor,
164
+ patch: parsed.patch,
165
+ previewMajor: parsed.previewMajor,
166
+ previewMinor: parsed.previewMinor + 1,
167
+ });
168
+ }
169
+ // Otherwise, start at preview.1.0
170
+ return formatVersion({
171
+ major: parsed.major,
172
+ minor: parsed.minor,
173
+ patch: parsed.patch,
174
+ previewMajor: 1,
175
+ previewMinor: 0,
176
+ });
177
+
178
+ default: {
179
+ const exhaustiveCheck: never = bumpType;
180
+ throw new Error(`Unknown bump type: ${exhaustiveCheck as string}`);
181
+ }
182
+ }
183
+ }
184
+
185
+ // ===========================
186
+ // File Operations
187
+ // ===========================
188
+
189
+ function getCurrentVersion(): string {
190
+ const packageJson = JSON.parse(readFileSync('package.json', 'utf-8')) as PackageJson;
191
+ return packageJson.version;
192
+ }
193
+
194
+ function updatePackageJson(newVersion: string): void {
195
+ const packageJson = JSON.parse(readFileSync('package.json', 'utf-8')) as PackageJson;
196
+ packageJson.version = newVersion;
197
+ writeFileSync('package.json', JSON.stringify(packageJson, null, 2) + '\n');
198
+ console.log('✓ Updated package.json');
199
+ }
200
+
201
+ function updatePackageLockJson(newVersion: string): void {
202
+ if (!existsSync('package-lock.json')) {
203
+ return;
204
+ }
205
+
206
+ const packageLock = JSON.parse(readFileSync('package-lock.json', 'utf-8')) as PackageLockJson;
207
+ packageLock.version = newVersion;
208
+
209
+ // Also update the root package in packages
210
+ if (packageLock.packages?.['']) {
211
+ packageLock.packages[''].version = newVersion;
212
+ }
213
+
214
+ writeFileSync('package-lock.json', JSON.stringify(packageLock, null, 2) + '\n');
215
+ console.log('✓ Updated package-lock.json');
216
+ }
217
+
218
+ // ===========================
219
+ // Git Log & Changelog
220
+ // ===========================
221
+
222
+ function getGitLog(sinceTag?: string): string {
223
+ try {
224
+ let cmd = 'git log --pretty=format:"- %s (%h)"';
225
+
226
+ if (sinceTag) {
227
+ cmd += ` ${sinceTag}..HEAD`;
228
+ } else {
229
+ // Try to get the last tag
230
+ try {
231
+ const lastTag = execSync('git describe --tags --abbrev=0', { encoding: 'utf-8' }).trim();
232
+ cmd += ` ${lastTag}..HEAD`;
233
+ } catch {
234
+ // No tags exist, get last 20 commits
235
+ cmd += ' -n 20';
236
+ }
237
+ }
238
+
239
+ return execSync(cmd, { encoding: 'utf-8' });
240
+ } catch {
241
+ return '';
242
+ }
243
+ }
244
+
245
+ interface CategorizedChanges {
246
+ features: string[];
247
+ fixes: string[];
248
+ docs: string[];
249
+ other: string[];
250
+ }
251
+
252
+ function categorizeCommits(gitLog: string): CategorizedChanges {
253
+ const result: CategorizedChanges = {
254
+ features: [],
255
+ fixes: [],
256
+ docs: [],
257
+ other: [],
258
+ };
259
+
260
+ for (const line of gitLog.split('\n')) {
261
+ const trimmed = line.trim();
262
+ if (!trimmed?.startsWith('-')) continue;
263
+
264
+ const msg = trimmed.slice(2).trim();
265
+
266
+ if (msg.startsWith('feat:') || msg.startsWith('feature:')) {
267
+ result.features.push(msg);
268
+ } else if (msg.startsWith('fix:') || msg.startsWith('bugfix:')) {
269
+ result.fixes.push(msg);
270
+ } else if (msg.startsWith('docs:') || msg.startsWith('doc:')) {
271
+ result.docs.push(msg);
272
+ } else {
273
+ result.other.push(msg);
274
+ }
275
+ }
276
+
277
+ return result;
278
+ }
279
+
280
+ function formatChangelog(changes: CategorizedChanges): string {
281
+ const sections: string[] = [];
282
+
283
+ if (changes.features.length > 0) {
284
+ sections.push('### Added\n' + changes.features.map(m => `- ${m}`).join('\n'));
285
+ }
286
+
287
+ if (changes.fixes.length > 0) {
288
+ sections.push('### Fixed\n' + changes.fixes.map(m => `- ${m}`).join('\n'));
289
+ }
290
+
291
+ if (changes.docs.length > 0) {
292
+ sections.push('### Documentation\n' + changes.docs.map(m => `- ${m}`).join('\n'));
293
+ }
294
+
295
+ if (changes.other.length > 0) {
296
+ sections.push('### Other Changes\n' + changes.other.map(m => `- ${m}`).join('\n'));
297
+ }
298
+
299
+ return sections.join('\n\n');
300
+ }
301
+
302
+ function updateChangelog(newVersion: string, customChanges?: string): void {
303
+ const changelogPath = 'CHANGELOG.md';
304
+ const date = new Date().toISOString().split('T')[0];
305
+
306
+ // Build the new entry
307
+ let entryContent = '';
308
+ if (customChanges) {
309
+ entryContent = `### Changes\n\n${customChanges}`;
310
+ } else {
311
+ console.log('\n⚠️ No changelog provided. Auto-generating from commits.');
312
+ console.log('💡 Tip: Use --changelog to provide meaningful release notes');
313
+
314
+ const gitLog = getGitLog();
315
+ if (gitLog) {
316
+ const categorized = categorizeCommits(gitLog);
317
+ const formatted = formatChangelog(categorized);
318
+ entryContent = formatted || `### Changes\n\n${gitLog}`;
319
+ }
320
+ }
321
+
322
+ const entry = `## [${newVersion}] - ${date}\n\n${entryContent}`;
323
+
324
+ let content: string;
325
+ if (existsSync(changelogPath)) {
326
+ content = readFileSync(changelogPath, 'utf-8');
327
+
328
+ // Find where to insert (after # Changelog header line)
329
+ const lines = content.split('\n');
330
+ const headerIndex = lines.findIndex(line => line.startsWith('# Changelog'));
331
+
332
+ if (headerIndex !== -1) {
333
+ // Find the next ## or end of preamble (first non-empty line after a blank line)
334
+ let insertAt = headerIndex + 1;
335
+
336
+ // Skip blank lines and description text until we hit an existing ## or end
337
+ while (insertAt < lines.length && !lines[insertAt]?.startsWith('## ')) {
338
+ insertAt++;
339
+ }
340
+
341
+ // Insert the new entry
342
+ lines.splice(insertAt, 0, '', entry, '');
343
+ content = lines.join('\n');
344
+ } else {
345
+ // No header found, prepend everything
346
+ content = `# Changelog\n\n${entry}\n\n${content}`;
347
+ }
348
+ } else {
349
+ content = `# Changelog\n\nAll notable changes to this project will be documented in this file.\n\n${entry}\n`;
350
+ }
351
+
352
+ // Clean up multiple consecutive blank lines
353
+ content = content.replace(/\n{3,}/g, '\n\n');
354
+
355
+ // Ensure single trailing newline
356
+ content = content.trimEnd() + '\n';
357
+
358
+ writeFileSync(changelogPath, content);
359
+ console.log('✓ Updated CHANGELOG.md');
360
+ }
361
+
362
+ // ===========================
363
+ // CLI
364
+ // ===========================
365
+
366
+ function parseArgs(): { bumpType: BumpType; changelog?: string; prereleaseTag: string; dryRun: boolean } {
367
+ const args = process.argv.slice(2);
368
+
369
+ if (args.length === 0 || args[0] === '--help' || args[0] === '-h') {
370
+ console.log(`
371
+ Usage: npx tsx scripts/bump-version.ts <bump_type> [options]
372
+
373
+ Arguments:
374
+ bump_type: major | minor | patch | prerelease | preview
375
+
376
+ Options:
377
+ --changelog <text> Custom changelog entry
378
+ --prerelease-tag <tag> Prerelease identifier (default: beta)
379
+ --dry-run Show what would be done without making changes
380
+ --help, -h Show this help message
381
+
382
+ Preview bumps:
383
+ - 0.3.0 -> 0.3.0-preview.1.0
384
+ - 0.3.0-preview.1.0 -> 0.3.0-preview.1.1
385
+ `);
386
+ process.exit(0);
387
+ }
388
+
389
+ const bumpType = args[0] as BumpType;
390
+ if (!['major', 'minor', 'patch', 'prerelease', 'preview'].includes(bumpType)) {
391
+ console.error(`Error: Invalid bump type '${bumpType}'. Must be one of: major, minor, patch, prerelease, preview`);
392
+ process.exit(1);
393
+ }
394
+
395
+ let changelog: string | undefined;
396
+ let prereleaseTag = 'beta';
397
+ let dryRun = false;
398
+
399
+ for (let i = 1; i < args.length; i++) {
400
+ if (args[i] === '--changelog' && args[i + 1]) {
401
+ changelog = args[++i];
402
+ } else if (args[i] === '--prerelease-tag' && args[i + 1]) {
403
+ prereleaseTag = args[++i]!;
404
+ } else if (args[i] === '--dry-run') {
405
+ dryRun = true;
406
+ }
407
+ }
408
+
409
+ return { bumpType, changelog, prereleaseTag, dryRun };
410
+ }
411
+
412
+ function main(): void {
413
+ const { bumpType, changelog, prereleaseTag, dryRun } = parseArgs();
414
+
415
+ try {
416
+ const currentVersion = getCurrentVersion();
417
+ const newVersion = bumpVersion(currentVersion, bumpType, prereleaseTag);
418
+
419
+ console.log(`Current version: ${currentVersion}`);
420
+ console.log(`New version: ${newVersion}`);
421
+
422
+ if (dryRun) {
423
+ console.log('\nDry run - no changes made');
424
+ return;
425
+ }
426
+
427
+ updatePackageJson(newVersion);
428
+ updatePackageLockJson(newVersion);
429
+ updateChangelog(newVersion, changelog);
430
+
431
+ console.log(`\n✓ Version bumped from ${currentVersion} to ${newVersion}`);
432
+ console.log('\nNext steps:');
433
+ console.log('1. Review changes: git diff');
434
+ console.log(`2. Commit: git add -A && git commit -m 'chore: bump version to ${newVersion}'`);
435
+ console.log('3. Create PR or push to trigger release workflow');
436
+ } catch (error) {
437
+ console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);
438
+ process.exit(1);
439
+ }
440
+ }
441
+
442
+ main();
@@ -0,0 +1,26 @@
1
+ import { execSync } from 'node:child_process';
2
+ import { platform } from 'node:os';
3
+
4
+ try {
5
+ // Check if an `agentcore` binary exists on PATH
6
+ const whichCmd = platform() === 'win32' ? 'where agentcore' : 'command -v agentcore';
7
+ execSync(whichCmd, { stdio: 'ignore' });
8
+
9
+ // Binary exists — check if it supports --version (the new CLI does, the old Python one does not)
10
+ try {
11
+ execSync('agentcore --version', { stdio: 'ignore' });
12
+ } catch {
13
+ // --version failed → likely the old Python CLI
14
+ console.warn(
15
+ [
16
+ '',
17
+ '\x1b[33m⚠ WARNING: We detected an older version of the AgentCore CLI.\x1b[0m',
18
+ '\x1b[33mFor the best experience, we recommend uninstalling it using:\x1b[0m',
19
+ '\x1b[33m pip uninstall bedrock-agentcore-starter-toolkit\x1b[0m',
20
+ '',
21
+ ].join('\n')
22
+ );
23
+ }
24
+ } catch {
25
+ // No agentcore binary found or unexpected error — nothing to do
26
+ }
@@ -0,0 +1,50 @@
1
+ import * as fs from 'fs';
2
+ import * as path from 'path';
3
+ import { fileURLToPath } from 'url';
4
+
5
+ const __filename = fileURLToPath(import.meta.url);
6
+ const __dirname = path.dirname(__filename);
7
+
8
+ const srcDir = path.join(__dirname, '..', 'src', 'assets');
9
+ const destDir = path.join(__dirname, '..', 'dist', 'assets');
10
+
11
+ /**
12
+ * Recursively copy directory contents, excluding specified files at root level only
13
+ * @param {string} src - Source directory
14
+ * @param {string} dest - Destination directory
15
+ * @param {string[]} excludeAtRoot - Files to exclude only at the root level (e.g., 'AGENTS.md')
16
+ * @param {boolean} isRoot - Whether this is the root level call
17
+ */
18
+ function copyDir(src, dest, excludeAtRoot = [], isRoot = true) {
19
+ // Create destination directory if it doesn't exist
20
+ if (!fs.existsSync(dest)) {
21
+ fs.mkdirSync(dest, { recursive: true });
22
+ }
23
+
24
+ const entries = fs.readdirSync(src, { withFileTypes: true });
25
+
26
+ for (const entry of entries) {
27
+ const srcPath = path.join(src, entry.name);
28
+ const destPath = path.join(dest, entry.name);
29
+
30
+ // Skip excluded files only at root level
31
+ if (isRoot && excludeAtRoot.includes(entry.name)) {
32
+ continue;
33
+ }
34
+
35
+ if (entry.isDirectory()) {
36
+ copyDir(srcPath, destPath, excludeAtRoot, false);
37
+ } else {
38
+ fs.copyFileSync(srcPath, destPath);
39
+ }
40
+ }
41
+ }
42
+
43
+ try {
44
+ console.log('Copying assets...');
45
+ copyDir(srcDir, destDir, ['AGENTS.md']);
46
+ console.log('Assets copied successfully!');
47
+ } catch (error) {
48
+ console.error('Error copying assets:', error);
49
+ process.exit(1);
50
+ }