@intra-mart/accel 0.2.0-dev.202605280431 → 0.2.0-dev.202606100307

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 (50) hide show
  1. package/README.md +138 -4
  2. package/dist/asset/deployer.js +2 -3
  3. package/dist/asset/github-provider.d.ts +2 -0
  4. package/dist/asset/github-provider.js +37 -0
  5. package/dist/asset/local-provider.js +1 -22
  6. package/dist/commands/attach.d.ts +9 -1
  7. package/dist/commands/attach.js +21 -10
  8. package/dist/commands/deploy.d.ts +62 -0
  9. package/dist/commands/deploy.js +293 -0
  10. package/dist/commands/init.d.ts +9 -1
  11. package/dist/commands/init.js +21 -10
  12. package/dist/commands/login.d.ts +31 -0
  13. package/dist/commands/login.js +75 -0
  14. package/dist/core/constants.d.ts +2 -0
  15. package/dist/core/constants.js +3 -1
  16. package/dist/core/types.d.ts +41 -1
  17. package/dist/core/version-map.d.ts +2 -1
  18. package/dist/core/version-map.js +9 -22
  19. package/dist/deploy/api-client.d.ts +16 -0
  20. package/dist/deploy/api-client.js +105 -0
  21. package/dist/deploy/target-scanner.d.ts +5 -0
  22. package/dist/deploy/target-scanner.js +20 -0
  23. package/dist/deploy/target-selector.d.ts +11 -0
  24. package/dist/deploy/target-selector.js +16 -0
  25. package/dist/i18n/en.js +46 -0
  26. package/dist/i18n/ja.js +46 -0
  27. package/dist/i18n/zh_CN.js +46 -0
  28. package/dist/index.js +4 -0
  29. package/dist/interactive/credential-auth.d.ts +15 -0
  30. package/dist/interactive/credential-auth.js +61 -0
  31. package/dist/interactive/credentials-prompts.d.ts +4 -0
  32. package/dist/interactive/credentials-prompts.js +85 -0
  33. package/dist/interactive/prompts.js +56 -6
  34. package/dist/interactive/summary.js +8 -0
  35. package/dist/utils/args.d.ts +1 -0
  36. package/dist/utils/args.js +4 -0
  37. package/dist/utils/credentials.d.ts +12 -0
  38. package/dist/utils/credentials.js +46 -0
  39. package/dist/utils/date-formatter.d.ts +1 -0
  40. package/dist/utils/date-formatter.js +23 -0
  41. package/dist/utils/gitignore.d.ts +1 -0
  42. package/dist/utils/gitignore.js +23 -0
  43. package/dist/utils/https.d.ts +2 -0
  44. package/dist/utils/https.js +44 -0
  45. package/dist/utils/settings-io.d.ts +1 -0
  46. package/dist/utils/settings-io.js +8 -0
  47. package/package.json +2 -3
  48. package/assets/assets.tar.gz +0 -0
  49. package/dist/asset/default-source.d.ts +0 -1
  50. package/dist/asset/default-source.js +0 -6
@@ -0,0 +1,293 @@
1
+ import { defineCommand } from "citty";
2
+ import * as p from "@clack/prompts";
3
+ import { readFile, stat } from "node:fs/promises";
4
+ import { basename, resolve } from "node:path";
5
+ import { detectLocale } from "../utils/locale-detect.js";
6
+ import { formatEpochMillis } from "../utils/date-formatter.js";
7
+ import { readSettings, readSettingsSafe } from "../utils/settings-io.js";
8
+ import { persistCredentials as defaultPersistCredentials, resolveCredentialInputs, } from "../utils/credentials.js";
9
+ import { getMessage } from "../i18n/index.js";
10
+ import { lastFlagValue } from "../utils/args.js";
11
+ import { ensureCredentials as defaultEnsureCredentials, repromptCredentials as defaultRepromptCredentials, resolveCredentialsOrThrow as defaultResolveCredentialsOrThrow, } from "../interactive/credentials-prompts.js";
12
+ import { scanTargets as defaultScanTargets } from "../deploy/target-scanner.js";
13
+ import { selectDeployTarget } from "../deploy/target-selector.js";
14
+ import { verifyCredentialsLoop } from "../interactive/credential-auth.js";
15
+ import { createApiClient as defaultApiClientFactory, isDeployError, } from "../deploy/api-client.js";
16
+ export const toImmFileName = (zipPath) => {
17
+ const base = basename(zipPath);
18
+ return base.replace(/\.zip$/i, "") + ".imm";
19
+ };
20
+ const defaultPrompts = {
21
+ selectStaging: async (stagings, locale) => {
22
+ const res = await p.select({
23
+ message: getMessage("deploy.selectStaging", locale),
24
+ options: stagings.map((s) => ({
25
+ value: s.stagingId,
26
+ label: s.description
27
+ ? `${s.stagingId} (${s.description})`
28
+ : s.stagingId,
29
+ })),
30
+ });
31
+ if (p.isCancel(res))
32
+ process.exit(0);
33
+ return res;
34
+ },
35
+ selectZip: async (zips, locale) => {
36
+ const res = await p.select({
37
+ message: getMessage("deploy.selectZip", locale),
38
+ options: zips.map((z) => ({ value: z, label: basename(z) })),
39
+ });
40
+ if (p.isCancel(res))
41
+ process.exit(0);
42
+ return res;
43
+ },
44
+ description: async (locale) => {
45
+ const res = await p.text({
46
+ message: getMessage("deploy.descriptionPrompt", locale),
47
+ defaultValue: "",
48
+ initialValue: "",
49
+ });
50
+ if (p.isCancel(res))
51
+ process.exit(0);
52
+ return res;
53
+ },
54
+ confirm: async (info, locale) => {
55
+ p.note([
56
+ `${getMessage("deploy.confirm.endpoint", locale)}: ${info.endpoint}`,
57
+ `${getMessage("deploy.confirm.stagingId", locale)}: ${info.stagingId}`,
58
+ `${getMessage("deploy.confirm.sourceFile", locale)}: ${info.sourceFile}`,
59
+ `${getMessage("deploy.confirm.sentAs", locale)}: ${info.sentAs}`,
60
+ ].join("\n"));
61
+ const res = await p.confirm({
62
+ message: getMessage("deploy.confirm", locale),
63
+ initialValue: true,
64
+ });
65
+ if (p.isCancel(res))
66
+ process.exit(0);
67
+ return res;
68
+ },
69
+ };
70
+ const resolveLocale = async (projectDir) => {
71
+ try {
72
+ const settings = await readSettings(projectDir);
73
+ return settings.locale ?? detectLocale();
74
+ }
75
+ catch {
76
+ return detectLocale();
77
+ }
78
+ };
79
+ const formatDeployError = (err, locale) => {
80
+ if (err.kind === "network") {
81
+ return getMessage("deploy.error.network", locale, {
82
+ message: err.serverMessage ?? "",
83
+ });
84
+ }
85
+ if (err.serverMessage) {
86
+ return getMessage("deploy.error.server", locale, {
87
+ message: err.serverMessage,
88
+ });
89
+ }
90
+ switch (err.status) {
91
+ case 401:
92
+ return getMessage("deploy.error.unauthorized", locale);
93
+ case 403:
94
+ return getMessage("deploy.error.forbidden", locale);
95
+ case 404:
96
+ return getMessage("deploy.error.notFound", locale);
97
+ case 400:
98
+ return getMessage("deploy.error.badRequest", locale);
99
+ case 500:
100
+ return getMessage("deploy.error.serverError", locale);
101
+ default:
102
+ return getMessage("deploy.error.unexpectedResponse", locale, {
103
+ status: String(err.status ?? "?"),
104
+ });
105
+ }
106
+ };
107
+ const resolveZipPath = async (opts) => {
108
+ const { projectDir, locale, nonInteractive, fileArg, scan, selectZip } = opts;
109
+ if (fileArg && fileArg.length > 0) {
110
+ const filePath = resolve(projectDir, fileArg);
111
+ try {
112
+ const s = await stat(filePath);
113
+ if (!s.isFile())
114
+ throw new Error("not a file");
115
+ }
116
+ catch {
117
+ p.log.error(getMessage("deploy.error.fileNotFound", locale, { path: fileArg }));
118
+ throw new Error("file not found");
119
+ }
120
+ return filePath;
121
+ }
122
+ const zips = await scan(projectDir);
123
+ if (zips.length === 0) {
124
+ p.log.error(getMessage("deploy.error.noTargetZip", locale));
125
+ throw new Error("no target zip");
126
+ }
127
+ const settings = await readSettingsSafe(projectDir);
128
+ const selection = selectDeployTarget(zips, settings
129
+ ? { artifactId: settings.artifactId, projectVersion: settings.projectVersion }
130
+ : null);
131
+ if ("auto" in selection)
132
+ return selection.auto;
133
+ if (nonInteractive) {
134
+ p.log.error(getMessage("deploy.error.zipNotResolved", locale));
135
+ throw new Error("zip not resolved");
136
+ }
137
+ return selection.candidates.length === 1
138
+ ? selection.candidates[0]
139
+ : await selectZip(selection.candidates, locale);
140
+ };
141
+ export const runDeploy = async (deps) => {
142
+ const { projectDir } = deps;
143
+ const locale = deps.locale ?? (await resolveLocale(projectDir));
144
+ const ensureCreds = deps.ensureCredentials ?? defaultEnsureCredentials;
145
+ const reprompt = deps.repromptCredentials ?? defaultRepromptCredentials;
146
+ const resolveOrThrow = deps.resolveCredentialsOrThrow ?? defaultResolveCredentialsOrThrow;
147
+ const persist = deps.persistCredentials ?? defaultPersistCredentials;
148
+ const scan = deps.scanTargets ?? defaultScanTargets;
149
+ const apiClientFactory = deps.apiClientFactory ?? defaultApiClientFactory;
150
+ const prompts = deps.prompts ?? defaultPrompts;
151
+ const env = deps.env ?? process.env;
152
+ const nonInteractive = deps.nonInteractive ?? false;
153
+ const seed = resolveCredentialInputs({ endpoint: deps.endpoint, apiKey: deps.apiKey }, env);
154
+ const fileArg = deps.file?.trim();
155
+ const stagingArg = deps.stagingId?.trim();
156
+ p.intro(getMessage("deploy.intro", locale));
157
+ const spin = p.spinner();
158
+ const initialCreds = nonInteractive
159
+ ? await resolveOrThrow(projectDir, locale, seed)
160
+ : await ensureCreds(projectDir, locale, seed);
161
+ const { creds, api } = await verifyCredentialsLoop(projectDir, locale, initialCreds, { dirty: false, interactive: !nonInteractive }, {
162
+ apiClientFactory,
163
+ repromptCredentials: reprompt,
164
+ persistCredentials: persist,
165
+ });
166
+ let stagingId;
167
+ if (stagingArg && stagingArg.length > 0) {
168
+ stagingId = stagingArg;
169
+ }
170
+ else if (nonInteractive) {
171
+ p.log.error(getMessage("deploy.error.missingStagingId", locale));
172
+ throw new Error("missing staging id");
173
+ }
174
+ else {
175
+ let stagings;
176
+ spin.start(getMessage("deploy.progress.fetchingStagings", locale));
177
+ try {
178
+ stagings = await api.listStagings();
179
+ spin.stop(getMessage("deploy.progress.fetchingStagings", locale));
180
+ }
181
+ catch (err) {
182
+ spin.stop(getMessage("deploy.progress.fetchingStagings", locale));
183
+ throw logAndRethrow(err, locale);
184
+ }
185
+ if (stagings.length === 0) {
186
+ p.log.error(getMessage("deploy.error.noStagings", locale));
187
+ throw new Error("no stagings");
188
+ }
189
+ stagingId = await prompts.selectStaging(stagings, locale);
190
+ }
191
+ const zipPath = await resolveZipPath({
192
+ projectDir,
193
+ locale,
194
+ nonInteractive,
195
+ fileArg,
196
+ scan,
197
+ selectZip: prompts.selectZip,
198
+ });
199
+ const description = (deps.description !== undefined
200
+ ? deps.description
201
+ : nonInteractive
202
+ ? ""
203
+ : await prompts.description(locale)).trim();
204
+ const immName = toImmFileName(zipPath);
205
+ if (!nonInteractive) {
206
+ const confirmed = await prompts.confirm({
207
+ endpoint: creds.endpoint,
208
+ stagingId,
209
+ sourceFile: basename(zipPath),
210
+ sentAs: immName,
211
+ }, locale);
212
+ if (!confirmed) {
213
+ p.log.info(getMessage("deploy.cancelled", locale));
214
+ return;
215
+ }
216
+ }
217
+ const bytes = await readFile(zipPath);
218
+ spin.start(getMessage("deploy.progress.deploying", locale));
219
+ let result;
220
+ try {
221
+ result = await api.createDeployment(stagingId, bytes, immName, description.length > 0 ? description : undefined);
222
+ }
223
+ catch (err) {
224
+ spin.stop(getMessage("deploy.progress.deploying", locale));
225
+ throw logAndRethrow(err, locale);
226
+ }
227
+ spin.stop(getMessage("deploy.progress.deploying", locale));
228
+ p.note([
229
+ `${getMessage("deploy.result.deployId", locale)}: ${result.deployId}`,
230
+ `${getMessage("deploy.result.stagingId", locale)}: ${result.stagingId}`,
231
+ `${getMessage("deploy.result.status", locale)}: ${result.status}`,
232
+ `${getMessage("deploy.result.createDate", locale)}: ${formatEpochMillis(result.createDate, locale)}`,
233
+ ].join("\n"));
234
+ p.outro(getMessage("deploy.success", locale));
235
+ };
236
+ const logAndRethrow = (err, locale) => {
237
+ if (isDeployError(err)) {
238
+ p.log.error(formatDeployError(err, locale));
239
+ }
240
+ else {
241
+ p.log.error(err instanceof Error ? err.message : String(err));
242
+ }
243
+ return err;
244
+ };
245
+ export const deployCommand = defineCommand({
246
+ meta: {
247
+ name: "deploy",
248
+ description: "Deploy build artifacts to an iAP staging environment",
249
+ },
250
+ args: {
251
+ endpoint: {
252
+ type: "string",
253
+ description: "iAP base URL (or set ACCEL_ENDPOINT)",
254
+ },
255
+ "api-key": {
256
+ type: "string",
257
+ description: "OAuth Bearer token. Prefer the ACCEL_API_KEY env var (argv leaks to process listings / CI logs)",
258
+ },
259
+ "staging-id": {
260
+ type: "string",
261
+ description: "Target staging ID (required in non-interactive mode)",
262
+ },
263
+ file: {
264
+ type: "string",
265
+ description: "Path to the zip to deploy (not restricted to ./target/)",
266
+ },
267
+ description: {
268
+ type: "string",
269
+ description: "Deployment description",
270
+ },
271
+ "non-interactive": {
272
+ type: "boolean",
273
+ description: "Non-interactive mode (no prompts; exits non-zero on failure)",
274
+ default: false,
275
+ },
276
+ },
277
+ run: async ({ args }) => {
278
+ try {
279
+ await runDeploy({
280
+ projectDir: process.cwd(),
281
+ nonInteractive: args["non-interactive"],
282
+ endpoint: lastFlagValue(args.endpoint),
283
+ apiKey: lastFlagValue(args["api-key"]),
284
+ stagingId: lastFlagValue(args["staging-id"]),
285
+ file: lastFlagValue(args.file),
286
+ description: lastFlagValue(args.description),
287
+ });
288
+ }
289
+ catch {
290
+ process.exit(1);
291
+ }
292
+ },
293
+ });
@@ -67,11 +67,19 @@ export declare const initCommand: import("citty").CommandDef<{
67
67
  description: string;
68
68
  default: false;
69
69
  };
70
+ "asset-server-url": {
71
+ type: "string";
72
+ description: string;
73
+ };
74
+ "asset-ref": {
75
+ type: "string";
76
+ description: string;
77
+ };
70
78
  "asset-source": {
71
79
  type: "string";
72
80
  description: string;
73
81
  };
74
- "asset-server-url": {
82
+ "debug-server-url": {
75
83
  type: "string";
76
84
  description: string;
77
85
  };
@@ -3,12 +3,12 @@ import * as p from "@clack/prompts";
3
3
  import { mkdir, stat } from "node:fs/promises";
4
4
  import { execSync } from "node:child_process";
5
5
  import { resolve } from "node:path";
6
- import { CLI_VERSION } from "../core/constants.js";
6
+ import { CLI_VERSION, DEFAULT_ASSET_REPO_URL, DEFAULT_ASSET_REF, } from "../core/constants.js";
7
7
  import { runPrompts } from "../interactive/prompts.js";
8
8
  import { deployAssets } from "../asset/deployer.js";
9
9
  import { createLocalAssetProvider } from "../asset/local-provider.js";
10
10
  import { createFileAssetProvider } from "../asset/file-provider.js";
11
- import { defaultAssetSourcePath } from "../asset/default-source.js";
11
+ import { createGitHubAssetProvider } from "../asset/github-provider.js";
12
12
  import { getMessage } from "../i18n/index.js";
13
13
  import { detectLocale } from "../utils/locale-detect.js";
14
14
  import { commandExists } from "../utils/command-exists.js";
@@ -89,13 +89,21 @@ export const initCommand = defineCommand({
89
89
  description: "Non-interactive mode",
90
90
  default: false,
91
91
  },
92
+ "asset-server-url": {
93
+ type: "string",
94
+ description: "GitHub repository URL to fetch assets from (overrides the default repository)",
95
+ },
96
+ "asset-ref": {
97
+ type: "string",
98
+ description: "Git ref (branch/tag/commit) to fetch from the GitHub asset repository. Default: master",
99
+ },
92
100
  "asset-source": {
93
101
  type: "string",
94
- description: "Local asset source path (tar archive or extracted directory). Defaults to the bundled assets/assets.tar.gz.",
102
+ description: "(debug) Local asset source path (tar archive or extracted directory)",
95
103
  },
96
- "asset-server-url": {
104
+ "debug-server-url": {
97
105
  type: "string",
98
- description: "Asset server URL (takes precedence over --asset-source when explicitly set)",
106
+ description: "(debug) Local asset server URL serving GET /archive",
99
107
  },
100
108
  },
101
109
  run: async ({ args }) => {
@@ -165,11 +173,14 @@ export const initCommand = defineCommand({
165
173
  if (isInteractive) {
166
174
  printSummary(settings, projectDir, locale);
167
175
  }
168
- const serverUrl = args["asset-server-url"];
169
- const assetSource = args["asset-source"] ?? defaultAssetSourcePath();
170
- const provider = serverUrl
171
- ? createLocalAssetProvider(serverUrl)
172
- : createFileAssetProvider(assetSource);
176
+ const assetSource = args["asset-source"];
177
+ const debugServerUrl = args["debug-server-url"];
178
+ const provider = assetSource
179
+ ? createFileAssetProvider(assetSource)
180
+ : debugServerUrl
181
+ ? createLocalAssetProvider(debugServerUrl)
182
+ : createGitHubAssetProvider(args["asset-server-url"] ??
183
+ DEFAULT_ASSET_REPO_URL, args["asset-ref"] ?? DEFAULT_ASSET_REF);
173
184
  await deployAssets({
174
185
  projectDir,
175
186
  settings,
@@ -0,0 +1,31 @@
1
+ import type { AccelCredentials } from "../core/types.js";
2
+ import { type ApiClient } from "../deploy/api-client.js";
3
+ export type RunLoginDeps = {
4
+ projectDir: string;
5
+ locale?: string;
6
+ nonInteractive?: boolean;
7
+ endpoint?: string;
8
+ apiKey?: string;
9
+ env?: Record<string, string | undefined>;
10
+ readCredentials?: (projectDir: string) => Promise<Partial<AccelCredentials>>;
11
+ repromptCredentials?: (current: AccelCredentials, locale: string, seed?: Partial<AccelCredentials>) => Promise<AccelCredentials>;
12
+ resolveCredentialsOrThrow?: (projectDir: string, locale: string, seed: Partial<AccelCredentials>) => Promise<AccelCredentials>;
13
+ persistCredentials?: (projectDir: string, creds: AccelCredentials) => Promise<void>;
14
+ apiClientFactory?: (endpoint: string, apiKey: string) => ApiClient;
15
+ };
16
+ export declare const runLogin: (deps: RunLoginDeps) => Promise<void>;
17
+ export declare const loginCommand: import("citty").CommandDef<{
18
+ endpoint: {
19
+ type: "string";
20
+ description: string;
21
+ };
22
+ "api-key": {
23
+ type: "string";
24
+ description: string;
25
+ };
26
+ "non-interactive": {
27
+ type: "boolean";
28
+ description: string;
29
+ default: false;
30
+ };
31
+ }>;
@@ -0,0 +1,75 @@
1
+ import { defineCommand } from "citty";
2
+ import * as p from "@clack/prompts";
3
+ import { detectLocale } from "../utils/locale-detect.js";
4
+ import { readSettingsSafe } from "../utils/settings-io.js";
5
+ import { readCredentials as defaultReadCredentials, persistCredentials as defaultPersistCredentials, resolveCredentialInputs, } from "../utils/credentials.js";
6
+ import { repromptCredentials as defaultRepromptCredentials, resolveCredentialsOrThrow as defaultResolveCredentialsOrThrow, } from "../interactive/credentials-prompts.js";
7
+ import { verifyCredentialsLoop } from "../interactive/credential-auth.js";
8
+ import { createApiClient as defaultApiClientFactory, } from "../deploy/api-client.js";
9
+ import { getMessage } from "../i18n/index.js";
10
+ import { lastFlagValue } from "../utils/args.js";
11
+ const resolveLocale = async (projectDir) => {
12
+ const settings = await readSettingsSafe(projectDir);
13
+ return settings?.locale ?? detectLocale();
14
+ };
15
+ export const runLogin = async (deps) => {
16
+ const { projectDir } = deps;
17
+ const locale = deps.locale ?? (await resolveLocale(projectDir));
18
+ const read = deps.readCredentials ?? defaultReadCredentials;
19
+ const reprompt = deps.repromptCredentials ?? defaultRepromptCredentials;
20
+ const resolveOrThrow = deps.resolveCredentialsOrThrow ?? defaultResolveCredentialsOrThrow;
21
+ const persist = deps.persistCredentials ?? defaultPersistCredentials;
22
+ const apiClientFactory = deps.apiClientFactory ?? defaultApiClientFactory;
23
+ const env = deps.env ?? process.env;
24
+ const seed = resolveCredentialInputs({ endpoint: deps.endpoint, apiKey: deps.apiKey }, env);
25
+ p.intro(getMessage("login.intro", locale));
26
+ let initial;
27
+ if (deps.nonInteractive) {
28
+ initial = await resolveOrThrow(projectDir, locale, seed);
29
+ }
30
+ else {
31
+ const existing = await read(projectDir);
32
+ initial = await reprompt({ endpoint: existing.endpoint ?? "", apiKey: existing.apiKey ?? "" }, locale, seed);
33
+ }
34
+ const { creds } = await verifyCredentialsLoop(projectDir, locale, initial, { dirty: true, interactive: !deps.nonInteractive }, {
35
+ apiClientFactory,
36
+ repromptCredentials: reprompt,
37
+ persistCredentials: persist,
38
+ });
39
+ p.log.success(`endpoint: ${creds.endpoint}`);
40
+ p.outro(getMessage("login.complete", locale));
41
+ };
42
+ export const loginCommand = defineCommand({
43
+ meta: {
44
+ name: "login",
45
+ description: "Configure and verify iAP connection credentials",
46
+ },
47
+ args: {
48
+ endpoint: {
49
+ type: "string",
50
+ description: "iAP base URL (or set ACCEL_ENDPOINT)",
51
+ },
52
+ "api-key": {
53
+ type: "string",
54
+ description: "OAuth Bearer token. Prefer the ACCEL_API_KEY env var (argv leaks to process listings / CI logs)",
55
+ },
56
+ "non-interactive": {
57
+ type: "boolean",
58
+ description: "Non-interactive mode (no prompts; exits non-zero on failure)",
59
+ default: false,
60
+ },
61
+ },
62
+ run: async ({ args }) => {
63
+ try {
64
+ await runLogin({
65
+ projectDir: process.cwd(),
66
+ nonInteractive: args["non-interactive"],
67
+ endpoint: lastFlagValue(args.endpoint),
68
+ apiKey: lastFlagValue(args["api-key"]),
69
+ });
70
+ }
71
+ catch {
72
+ process.exit(1);
73
+ }
74
+ },
75
+ });
@@ -10,4 +10,6 @@ export declare const LOCALE_OPTIONS: readonly ["ja", "en", "zh_CN"];
10
10
  export type LocaleOption = (typeof LOCALE_OPTIONS)[number];
11
11
  export declare const PACKAGE_MANAGER_OPTIONS: readonly ["bun", "npm", "yarn", "pnpm"];
12
12
  export type PackageManagerOption = (typeof PACKAGE_MANAGER_OPTIONS)[number];
13
+ export declare const DEFAULT_ASSET_REPO_URL = "https://github.com/accelplatform/skills";
14
+ export declare const DEFAULT_ASSET_REF = "experiment";
13
15
  export declare const DEFAULT_SETTINGS: Omit<AccelSettings, "cliVersion" | "createdAt" | "deployedAssets">;
@@ -16,13 +16,15 @@ export const PACKAGE_MANAGER_OPTIONS = [
16
16
  "yarn",
17
17
  "pnpm",
18
18
  ];
19
+ export const DEFAULT_ASSET_REPO_URL = "https://github.com/accelplatform/skills";
20
+ export const DEFAULT_ASSET_REF = "experiment";
19
21
  export const DEFAULT_SETTINGS = {
20
22
  name: "my-accel-project",
21
23
  artifactId: "",
22
24
  group: "com.example",
23
25
  projectVersion: "0.1.0",
24
26
  description: "",
25
- accelplatformVersion: "2025-Autumn",
27
+ accelplatformVersion: { label: "2026-Spring", semver: "8.0.39" },
26
28
  modules: [],
27
29
  database: "postgresql",
28
30
  agents: ["claude-code", "github-copilot"],
@@ -61,6 +61,7 @@ export type IapVersion = {
61
61
  label: string;
62
62
  codename: string;
63
63
  };
64
+ export type AccelplatformVersion = Pick<IapVersion, "label" | "semver">;
64
65
  export type AccelSettings = {
65
66
  cliVersion: string;
66
67
  createdAt: string;
@@ -69,7 +70,7 @@ export type AccelSettings = {
69
70
  group: string;
70
71
  projectVersion: string;
71
72
  description: string;
72
- accelplatformVersion: string;
73
+ accelplatformVersion: AccelplatformVersion;
73
74
  modules: string[];
74
75
  database: string;
75
76
  agents: string[];
@@ -111,3 +112,42 @@ export declare const isLocaleCondition: (c: Condition) => c is LocaleCondition;
111
112
  export declare const isAgentCondition: (c: Condition) => c is AgentCondition;
112
113
  export declare const isPackageManagerCondition: (c: Condition) => c is PackageManagerCondition;
113
114
  export declare const isJavascriptCondition: (c: Condition) => c is JavascriptCondition;
115
+ export type AccelCredentials = {
116
+ endpoint: string;
117
+ apiKey: string;
118
+ };
119
+ export type StagingResponse = {
120
+ stagingId: string;
121
+ description?: string | null;
122
+ currentDeployId?: string | null;
123
+ createUserCd: string;
124
+ createDate: number;
125
+ };
126
+ export type StagingListResponse = {
127
+ totalCount: number;
128
+ offset: number;
129
+ limit: number;
130
+ records: StagingResponse[];
131
+ };
132
+ export type DeploymentResponse = {
133
+ deployId: string;
134
+ stagingId: string;
135
+ status: "STAGED" | "UNDEPLOYED";
136
+ description?: string | null;
137
+ createUserCd: string;
138
+ createDate: number;
139
+ };
140
+ export type ApiSuccess<T> = {
141
+ error: false;
142
+ data: T;
143
+ };
144
+ export type ApiErrorBody = {
145
+ error: true;
146
+ errorMessage: string;
147
+ };
148
+ export type DeployError = {
149
+ _tag: "DeployError";
150
+ kind: "network" | "http";
151
+ status?: number;
152
+ serverMessage?: string;
153
+ };
@@ -1,7 +1,8 @@
1
- import type { IapVersion } from "./types.js";
1
+ import type { AccelplatformVersion, IapVersion } from "./types.js";
2
2
  export declare const IAP_VERSIONS: readonly IapVersion[];
3
3
  export declare const SELECTABLE_VERSIONS: readonly IapVersion[];
4
4
  export declare const labelToSemver: (label: string) => string;
5
5
  export declare const semverToLabel: (semver: string) => string;
6
6
  export declare const findByLabel: (label: string) => IapVersion | undefined;
7
+ export declare const resolveAccelplatformVersion: (label: string) => AccelplatformVersion;
7
8
  export declare const findBySemver: (semver: string) => IapVersion | undefined;
@@ -1,30 +1,10 @@
1
1
  export const IAP_VERSIONS = [
2
- { semver: "8.0.19", label: "2018-Spring", codename: "Skylark" },
3
- { semver: "8.0.20", label: "2018-Summer", codename: "Tiffany" },
4
- { semver: "8.0.21", label: "2018-Winter", codename: "Urara" },
5
- { semver: "8.0.22", label: "2019-Spring", codename: "Violette" },
6
- { semver: "8.0.23", label: "2019-Summer", codename: "Waltz" },
7
- { semver: "8.0.24", label: "2019-Winter", codename: "Xanadu" },
8
- { semver: "8.0.25", label: "2020-Spring", codename: "Yorkshire" },
9
- { semver: "8.0.26", label: "2020-Summer", codename: "Zephirine" },
10
- { semver: "8.0.27", label: "2020-Winter", codename: "Azalea" },
11
- { semver: "8.0.28", label: "2021-Spring", codename: "Bergamot" },
12
- { semver: "8.0.29", label: "2021-Summer", codename: "Cattleya" },
13
- { semver: "8.0.30", label: "2021-Winter", codename: "Dandelion" },
14
- { semver: "8.0.31", label: "2022-Spring", codename: "Eustoma" },
15
- { semver: "8.0.32", label: "2022-Winter", codename: "Freesia" },
16
- { semver: "8.0.33", label: "2023-Spring", codename: "Gerbera" },
17
- { semver: "8.0.34", label: "2023-Autumn", codename: "Hollyhock" },
18
- { semver: "8.0.35", label: "2024-Spring", codename: "Iris" },
19
- { semver: "8.0.36", label: "2024-Autumn", codename: "Jasmine" },
20
2
  { semver: "8.0.37", label: "2025-Spring", codename: "Kamille" },
21
3
  { semver: "8.0.38", label: "2025-Autumn", codename: "Lilac" },
22
4
  { semver: "8.0.39", label: "2026-Spring", codename: "Mimosa" },
5
+ { semver: "8.0.40", label: "2026-Autumn", codename: "" },
23
6
  ];
24
- export const SELECTABLE_VERSIONS = IAP_VERSIONS.filter((v) => {
25
- const minor = parseInt(v.semver.split(".")[2], 10);
26
- return minor >= 35;
27
- });
7
+ export const SELECTABLE_VERSIONS = IAP_VERSIONS;
28
8
  const labelToVersionMap = new Map(IAP_VERSIONS.map((v) => [v.label, v]));
29
9
  const semverToVersionMap = new Map(IAP_VERSIONS.map((v) => [v.semver, v]));
30
10
  export const labelToSemver = (label) => {
@@ -42,4 +22,11 @@ export const semverToLabel = (semver) => {
42
22
  return version.label;
43
23
  };
44
24
  export const findByLabel = (label) => labelToVersionMap.get(label);
25
+ export const resolveAccelplatformVersion = (label) => {
26
+ const version = labelToVersionMap.get(label);
27
+ if (!version) {
28
+ throw new Error(`Unknown iAP version label: ${label}`);
29
+ }
30
+ return { label: version.label, semver: version.semver };
31
+ };
45
32
  export const findBySemver = (semver) => semverToVersionMap.get(semver);
@@ -0,0 +1,16 @@
1
+ import type { StagingResponse, DeploymentResponse, DeployError } from "../core/types.js";
2
+ type FetchFn = typeof globalThis.fetch;
3
+ export declare const makeDeployError: (kind: DeployError["kind"], extra?: {
4
+ status?: number;
5
+ serverMessage?: string;
6
+ }) => DeployError;
7
+ export declare const isDeployError: (e: unknown) => e is DeployError;
8
+ export type ApiClient = {
9
+ verifyToken: () => Promise<void>;
10
+ listStagings: () => Promise<StagingResponse[]>;
11
+ createDeployment: (stagingId: string, bytes: Uint8Array, immFileName: string, description?: string) => Promise<DeploymentResponse>;
12
+ };
13
+ export declare const createApiClient: (endpoint: string, apiKey: string, deps?: {
14
+ fetch?: FetchFn;
15
+ }) => ApiClient;
16
+ export {};