@intra-mart/accel 0.3.1 → 0.4.0-dev.202607170346

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 (75) hide show
  1. package/README.md +72 -12
  2. package/assets/githooks/.githooks/.gitattributes +2 -0
  3. package/assets/githooks/.githooks/pre-commit/_meta.json +24 -0
  4. package/assets/githooks/.githooks/pre-commit/pre-commit_en +268 -0
  5. package/assets/githooks/.githooks/pre-commit/pre-commit_ja +255 -0
  6. package/assets/githooks/.githooks/pre-commit/pre-commit_zh_CN +255 -0
  7. package/dist/asset/asset-tree.d.ts +5 -0
  8. package/dist/asset/asset-tree.js +7 -0
  9. package/dist/asset/deployer.d.ts +2 -1
  10. package/dist/asset/deployer.js +28 -59
  11. package/dist/asset/file-provider.js +19 -18
  12. package/dist/asset/git-provider.d.ts +14 -0
  13. package/dist/asset/git-provider.js +163 -0
  14. package/dist/asset/installer.d.ts +6 -0
  15. package/dist/asset/installer.js +31 -0
  16. package/dist/asset/renderer.d.ts +2 -0
  17. package/dist/asset/renderer.js +22 -0
  18. package/dist/asset/types.d.ts +1 -1
  19. package/dist/asset/updater.d.ts +52 -0
  20. package/dist/asset/updater.js +297 -0
  21. package/dist/asset/walker.d.ts +4 -2
  22. package/dist/asset/walker.js +74 -45
  23. package/dist/commands/asset-provider.d.ts +7 -0
  24. package/dist/commands/asset-provider.js +9 -0
  25. package/dist/commands/attach.d.ts +0 -4
  26. package/dist/commands/attach.js +11 -20
  27. package/dist/commands/deploy.d.ts +11 -6
  28. package/dist/commands/deploy.js +77 -23
  29. package/dist/commands/init.d.ts +0 -4
  30. package/dist/commands/init.js +11 -20
  31. package/dist/commands/update.d.ts +86 -0
  32. package/dist/commands/update.js +448 -0
  33. package/dist/core/constants.d.ts +3 -3
  34. package/dist/core/constants.js +4 -2
  35. package/dist/core/types.d.ts +13 -1
  36. package/dist/deploy/api-client.d.ts +6 -2
  37. package/dist/deploy/api-client.js +8 -4
  38. package/dist/deploy/deploy-files.d.ts +20 -0
  39. package/dist/deploy/deploy-files.js +37 -0
  40. package/dist/git/errors.d.ts +6 -0
  41. package/dist/git/errors.js +9 -0
  42. package/dist/git/http.d.ts +3 -0
  43. package/dist/git/http.js +58 -0
  44. package/dist/git/object-store.d.ts +13 -0
  45. package/dist/git/object-store.js +79 -0
  46. package/dist/git/pkt-line.d.ts +13 -0
  47. package/dist/git/pkt-line.js +41 -0
  48. package/dist/git/smart-http.d.ts +18 -0
  49. package/dist/git/smart-http.js +109 -0
  50. package/dist/i18n/en.js +53 -6
  51. package/dist/i18n/ja.js +53 -6
  52. package/dist/i18n/zh_CN.js +53 -6
  53. package/dist/index.js +4 -1
  54. package/dist/interactive/progress.js +1 -0
  55. package/dist/interactive/prompts.d.ts +7 -1
  56. package/dist/interactive/prompts.js +63 -64
  57. package/dist/markdown/section-replacement.js +34 -8
  58. package/dist/utils/args.d.ts +1 -0
  59. package/dist/utils/args.js +4 -0
  60. package/dist/utils/fs-list.d.ts +1 -0
  61. package/dist/utils/fs-list.js +11 -0
  62. package/dist/utils/githooks-sync.d.ts +1 -0
  63. package/dist/utils/githooks-sync.js +91 -0
  64. package/dist/utils/mcp-sync.js +6 -0
  65. package/dist/utils/merge-file.d.ts +6 -0
  66. package/dist/utils/merge-file.js +20 -0
  67. package/package.json +8 -9
  68. package/dist/asset/github-provider.d.ts +0 -2
  69. package/dist/asset/github-provider.js +0 -37
  70. package/dist/asset/local-provider.d.ts +0 -2
  71. package/dist/asset/local-provider.js +0 -24
  72. package/dist/utils/archive.d.ts +0 -3
  73. package/dist/utils/archive.js +0 -20
  74. package/dist/utils/https.d.ts +0 -2
  75. package/dist/utils/https.js +0 -44
@@ -0,0 +1,86 @@
1
+ export declare const updateCommand: import("citty").CommandDef<{
2
+ "juggling-project": {
3
+ type: "string";
4
+ description: string;
5
+ };
6
+ "accelplatform-version": {
7
+ type: "string";
8
+ description: string;
9
+ };
10
+ module: {
11
+ type: "string";
12
+ description: string;
13
+ };
14
+ feature: {
15
+ type: "string";
16
+ description: string;
17
+ };
18
+ name: {
19
+ type: "string";
20
+ description: string;
21
+ };
22
+ group: {
23
+ type: "string";
24
+ description: string;
25
+ };
26
+ "project-version": {
27
+ type: "string";
28
+ description: string;
29
+ };
30
+ description: {
31
+ type: "string";
32
+ description: string;
33
+ };
34
+ database: {
35
+ type: "string";
36
+ description: string;
37
+ };
38
+ javascript: {
39
+ type: "boolean";
40
+ description: string;
41
+ };
42
+ agent: {
43
+ type: "string";
44
+ description: string;
45
+ };
46
+ locale: {
47
+ type: "string";
48
+ description: string;
49
+ };
50
+ "artifact-id": {
51
+ type: "string";
52
+ description: string;
53
+ };
54
+ "package-manager": {
55
+ type: "string";
56
+ description: string;
57
+ };
58
+ "skip-install": {
59
+ type: "boolean";
60
+ description: string;
61
+ default: false;
62
+ };
63
+ "non-interactive": {
64
+ type: "boolean";
65
+ description: string;
66
+ default: false;
67
+ };
68
+ "asset-server-url": {
69
+ type: "string";
70
+ description: string;
71
+ };
72
+ "asset-ref": {
73
+ type: "string";
74
+ description: string;
75
+ };
76
+ "allow-missing-base": {
77
+ type: "boolean";
78
+ description: string;
79
+ default: false;
80
+ };
81
+ "keep-edited": {
82
+ type: "boolean";
83
+ description: string;
84
+ default: false;
85
+ };
86
+ }>;
@@ -0,0 +1,448 @@
1
+ import fs from "node:fs";
2
+ import { access } from "node:fs/promises";
3
+ import { join } from "node:path";
4
+ import { defineCommand } from "citty";
5
+ import * as p from "@clack/prompts";
6
+ import git from "isomorphic-git";
7
+ import { CLI_VERSION } from "../core/constants.js";
8
+ import { runPrompts, collectSettingsErrors, printIntro, } from "../interactive/prompts.js";
9
+ import { withHint } from "../interactive/format.js";
10
+ import { createGitAssetProvider } from "../asset/git-provider.js";
11
+ import { buildRenderedPlan, collectFileStates, classifyAll, applyUpdateActions, buildUpdatedRecords, } from "../asset/updater.js";
12
+ import { mergeFile } from "../utils/merge-file.js";
13
+ import { getInstallCmds, runInstallBuild } from "../asset/installer.js";
14
+ import { readSettingsSafe, readHashsum, writeSettings, writeHashsum, } from "../utils/settings-io.js";
15
+ import { getMessage } from "../i18n/index.js";
16
+ import { detectLocale } from "../utils/locale-detect.js";
17
+ import { printSummary } from "../interactive/summary.js";
18
+ import { buildProgressCallbacks } from "../interactive/progress.js";
19
+ const shortSha = (sha) => sha.slice(0, 7);
20
+ const confirmDirtyWorktree = async (projectDir, locale, isInteractive) => {
21
+ try {
22
+ await access(join(projectDir, ".git"));
23
+ const matrix = await git.statusMatrix({ fs, dir: projectDir });
24
+ const isClean = matrix.every(([, head, workdir, stage]) => head === 1 && workdir === 1 && stage === 1);
25
+ if (isClean)
26
+ return true;
27
+ }
28
+ catch {
29
+ return true;
30
+ }
31
+ p.log.warning(getMessage("update.warning.dirty", locale));
32
+ if (!isInteractive)
33
+ return true;
34
+ const cont = await p.confirm({
35
+ message: getMessage("update.confirmDirty", locale),
36
+ });
37
+ return !p.isCancel(cont) && cont === true;
38
+ };
39
+ const resolveFallbackMode = async (opts) => {
40
+ const { baseError, editedCount, commit, locale } = opts;
41
+ const baseFetchMessage = getMessage("update.error.baseFetch", locale, {
42
+ commit,
43
+ message: baseError instanceof Error ? baseError.message : String(baseError),
44
+ });
45
+ if (opts.allowMissingBase) {
46
+ p.log.warning(baseFetchMessage);
47
+ p.log.warning(getMessage("update.fallback.continuing", locale));
48
+ return { keepEdited: opts.keepEditedFlag };
49
+ }
50
+ if (!opts.isInteractive) {
51
+ p.log.error(`${baseFetchMessage}\n${getMessage("update.error.baseFetchHint", locale)}`);
52
+ process.exit(1);
53
+ }
54
+ p.log.warning(baseFetchMessage);
55
+ p.log.warning(getMessage("update.fallback.editedCount", locale, {
56
+ count: String(editedCount),
57
+ }));
58
+ const choice = await p.select({
59
+ message: getMessage("update.fallback.choice", locale),
60
+ options: [
61
+ { value: "abort", label: getMessage("update.fallback.choice.abort", locale) },
62
+ {
63
+ value: "conflict",
64
+ label: getMessage("update.fallback.choice.conflict", locale),
65
+ },
66
+ { value: "keep", label: getMessage("update.fallback.choice.keep", locale) },
67
+ ],
68
+ });
69
+ if (p.isCancel(choice) || choice === "abort") {
70
+ p.log.info(getMessage("update.fallback.aborted", locale));
71
+ process.exit(1);
72
+ }
73
+ return { keepEdited: choice === "keep" };
74
+ };
75
+ const resolveInteractiveSettings = async (promptOpts, cliOnlyOpts, releaseIdFallback) => {
76
+ const locale = promptOpts.locale;
77
+ const cliErrors = collectSettingsErrors(cliOnlyOpts, locale, releaseIdFallback);
78
+ if (cliErrors.length > 0) {
79
+ throw new Error(cliErrors.join("\n"));
80
+ }
81
+ printIntro("update", locale);
82
+ const settingsErrors = collectSettingsErrors(promptOpts, locale);
83
+ if (settingsErrors.length > 0) {
84
+ p.log.warning(getMessage("update.invalidSettings", locale, {
85
+ errors: settingsErrors.map((e) => ` - ${e}`).join("\n"),
86
+ }));
87
+ return runPrompts({ ...promptOpts, skipIntro: true, skipValidation: true });
88
+ }
89
+ const useExisting = await p.confirm({
90
+ message: withHint("prompt.useExistingSettings", locale),
91
+ initialValue: true,
92
+ });
93
+ if (p.isCancel(useExisting))
94
+ process.exit(0);
95
+ return useExisting
96
+ ?
97
+ runPrompts({
98
+ ...promptOpts,
99
+ jugglingProject: cliOnlyOpts.jugglingProject,
100
+ noInteraction: true,
101
+ })
102
+ : runPrompts({ ...promptOpts, skipIntro: true });
103
+ };
104
+ const printResult = (summary, locale, installGuide) => {
105
+ const lines = [
106
+ [summary.updated, "update.result.updated"],
107
+ [summary.merged, "update.result.merged"],
108
+ [summary.redeployed, "update.result.redeployed"],
109
+ [summary.redeployedWarn, "update.result.redeployedWarn"],
110
+ [summary.added, "update.result.added"],
111
+ [summary.adopted, "update.result.adopted"],
112
+ [summary.keptEdited, "update.result.kept"],
113
+ [summary.keptDeleted, "update.result.keptDeleted"],
114
+ [summary.skippedEdited, "update.result.skippedEdited"],
115
+ [summary.deleted, "update.result.deleted"],
116
+ [summary.warnings, "update.result.keptWarn"],
117
+ [summary.conflicts, "update.result.conflict"],
118
+ ];
119
+ for (const [paths, key] of lines) {
120
+ for (const path of paths) {
121
+ p.log.info(getMessage(key, locale, { path }));
122
+ }
123
+ }
124
+ const updatedCount = summary.updated.length +
125
+ summary.merged.length +
126
+ summary.redeployed.length +
127
+ summary.redeployedWarn.length +
128
+ summary.added.length +
129
+ summary.conflicts.length;
130
+ const keptCount = summary.keptEdited.length +
131
+ summary.keptDeleted.length +
132
+ summary.skippedEdited.length +
133
+ summary.warnings.length;
134
+ const deletedCount = summary.deleted.length;
135
+ if (updatedCount === 0 && deletedCount === 0 && summary.adopted.length === 0) {
136
+ p.log.success(getMessage("update.upToDate", locale));
137
+ }
138
+ else {
139
+ p.log.success(getMessage("update.complete", locale, {
140
+ updated: String(updatedCount),
141
+ kept: String(keptCount),
142
+ deleted: String(deletedCount),
143
+ }));
144
+ }
145
+ if (summary.conflicts.length > 0) {
146
+ const list = summary.conflicts.map((c) => ` - ${c}`).join("\n");
147
+ p.log.warning(`${getMessage("update.conflictSummary", locale, {
148
+ count: String(summary.conflicts.length),
149
+ })}\n${list}`);
150
+ if (installGuide) {
151
+ p.log.warning(getMessage("update.installSkippedConflict", locale, installGuide));
152
+ }
153
+ }
154
+ if (summary.skippedEdited.length > 0) {
155
+ const list = summary.skippedEdited.map((c) => ` - ${c}`).join("\n");
156
+ p.log.warning(`${getMessage("update.fallback.skippedSummary", locale, {
157
+ count: String(summary.skippedEdited.length),
158
+ })}\n${list}`);
159
+ }
160
+ };
161
+ export const updateCommand = defineCommand({
162
+ meta: {
163
+ name: "update",
164
+ description: "Update deployed assets to the latest asset repository revision",
165
+ },
166
+ args: {
167
+ "juggling-project": {
168
+ type: "string",
169
+ description: "Path to IM-Juggling project",
170
+ },
171
+ "accelplatform-version": {
172
+ type: "string",
173
+ description: "iAP version (e.g., 2026-spring)",
174
+ },
175
+ module: {
176
+ type: "string",
177
+ description: "Modules to use (comma-separated artifactIds, e.g., im_workflow)",
178
+ },
179
+ feature: {
180
+ type: "string",
181
+ description: "Features to use (comma-separated function ids, e.g., jssp)",
182
+ },
183
+ name: {
184
+ type: "string",
185
+ description: "Project name",
186
+ },
187
+ group: {
188
+ type: "string",
189
+ description: "Group name",
190
+ },
191
+ "project-version": {
192
+ type: "string",
193
+ description: "Project version",
194
+ },
195
+ description: {
196
+ type: "string",
197
+ description: "Project description",
198
+ },
199
+ database: {
200
+ type: "string",
201
+ description: "Database type",
202
+ },
203
+ javascript: {
204
+ type: "boolean",
205
+ description: "Use JavaScript",
206
+ },
207
+ agent: {
208
+ type: "string",
209
+ description: "Agent type",
210
+ },
211
+ locale: {
212
+ type: "string",
213
+ description: "Locale (ja, en, zh_CN)",
214
+ },
215
+ "artifact-id": {
216
+ type: "string",
217
+ description: "Maven artifactId",
218
+ },
219
+ "package-manager": {
220
+ type: "string",
221
+ description: "Package manager (bun, npm, yarn, pnpm)",
222
+ },
223
+ "skip-install": {
224
+ type: "boolean",
225
+ description: "Skip dependency installation after the update",
226
+ default: false,
227
+ },
228
+ "non-interactive": {
229
+ type: "boolean",
230
+ description: "Non-interactive mode",
231
+ default: false,
232
+ },
233
+ "asset-server-url": {
234
+ type: "string",
235
+ description: "Git repository URL to fetch assets from (overrides the recorded assetSource)",
236
+ },
237
+ "asset-ref": {
238
+ type: "string",
239
+ description: "Git branch/tag to fetch from the asset repository (overrides the recorded assetSource)",
240
+ },
241
+ "allow-missing-base": {
242
+ type: "boolean",
243
+ description: "Continue in fallback mode when the recorded base commit cannot be fetched",
244
+ default: false,
245
+ },
246
+ "keep-edited": {
247
+ type: "boolean",
248
+ description: "In fallback mode, keep edited files and skip them instead of inserting conflict markers (requires --allow-missing-base)",
249
+ default: false,
250
+ },
251
+ },
252
+ run: async ({ args }) => {
253
+ const projectDir = process.cwd();
254
+ let locale = args.locale ?? detectLocale();
255
+ const settings = await readSettingsSafe(projectDir);
256
+ if (!settings) {
257
+ p.log.error(getMessage("error.accelNotFound", locale));
258
+ process.exit(1);
259
+ }
260
+ locale = args.locale ?? settings.locale ?? locale;
261
+ const allowMissingBase = args["allow-missing-base"];
262
+ const keepEditedFlag = args["keep-edited"];
263
+ if (keepEditedFlag && !allowMissingBase) {
264
+ p.log.error(getMessage("update.error.keepEditedWithoutAllow", locale));
265
+ process.exit(1);
266
+ }
267
+ const assetSource = settings.assetSource;
268
+ if (!assetSource) {
269
+ p.log.error(getMessage("update.error.legacyProject", locale));
270
+ process.exit(1);
271
+ }
272
+ if (assetSource.type !== "git" || !assetSource.commit || !assetSource.ref) {
273
+ p.log.error(getMessage("update.error.notGitSource", locale));
274
+ process.exit(1);
275
+ }
276
+ const source = {
277
+ ...assetSource,
278
+ commit: assetSource.commit,
279
+ ref: assetSource.ref,
280
+ };
281
+ const targetUrl = args["asset-server-url"] ?? source.url;
282
+ const targetRef = args["asset-ref"] ?? source.ref;
283
+ const isInteractive = !args["non-interactive"];
284
+ if (!(await confirmDirtyWorktree(projectDir, locale, isInteractive))) {
285
+ p.log.info(getMessage("update.cancelled", locale));
286
+ process.exit(0);
287
+ }
288
+ const cliOnlyOpts = {
289
+ name: args.name,
290
+ artifactId: args["artifact-id"],
291
+ jugglingProject: args["juggling-project"],
292
+ accelplatformVersion: args["accelplatform-version"],
293
+ module: args.module
294
+ ?.split(",")
295
+ .map((m) => m.trim()),
296
+ feature: args.feature
297
+ ?.split(",")
298
+ .map((f) => f.trim()),
299
+ group: args.group,
300
+ projectVersion: args["project-version"],
301
+ description: args.description,
302
+ database: args.database,
303
+ javascript: args.javascript,
304
+ agent: args.agent
305
+ ?.split(",")
306
+ .map((a) => a.trim()),
307
+ packageManager: args["package-manager"],
308
+ locale,
309
+ isInit: false,
310
+ };
311
+ const promptOpts = {
312
+ ...cliOnlyOpts,
313
+ name: cliOnlyOpts.name ?? settings.name,
314
+ artifactId: cliOnlyOpts.artifactId ?? settings.artifactId,
315
+ jugglingProject: isInteractive
316
+ ? (cliOnlyOpts.jugglingProject ?? settings.jugglingProject ?? undefined)
317
+ : cliOnlyOpts.jugglingProject,
318
+ accelplatformVersion: cliOnlyOpts.accelplatformVersion ?? settings.accelplatformVersion.label,
319
+ module: cliOnlyOpts.module ?? settings.modules,
320
+ feature: cliOnlyOpts.feature ?? settings.features ?? [],
321
+ group: cliOnlyOpts.group ?? settings.group,
322
+ projectVersion: cliOnlyOpts.projectVersion ?? settings.projectVersion,
323
+ description: cliOnlyOpts.description ?? settings.description,
324
+ database: cliOnlyOpts.database ?? settings.database,
325
+ javascript: cliOnlyOpts.javascript ?? settings.javascript,
326
+ agent: cliOnlyOpts.agent ?? settings.agents,
327
+ packageManager: cliOnlyOpts.packageManager ?? settings.packageManager,
328
+ noInteraction: args["non-interactive"],
329
+ mode: "update",
330
+ };
331
+ let resolved;
332
+ try {
333
+ resolved = isInteractive
334
+ ? await resolveInteractiveSettings(promptOpts, cliOnlyOpts, settings.accelplatformVersion.label)
335
+ : await runPrompts(promptOpts);
336
+ }
337
+ catch (err) {
338
+ p.log.error(err instanceof Error ? err.message : String(err));
339
+ process.exit(1);
340
+ }
341
+ const newSettings = {
342
+ ...settings,
343
+ cliVersion: CLI_VERSION,
344
+ name: resolved.name,
345
+ artifactId: resolved.artifactId,
346
+ group: resolved.group,
347
+ projectVersion: resolved.projectVersion,
348
+ description: resolved.description,
349
+ accelplatformVersion: resolved.accelplatformVersion,
350
+ modules: resolved.modules,
351
+ features: resolved.features,
352
+ database: resolved.database,
353
+ agents: resolved.agents,
354
+ javascript: resolved.javascript,
355
+ locale: resolved.locale,
356
+ packageManager: resolved.packageManager,
357
+ jugglingProject: resolved.jugglingProject === undefined
358
+ ? settings.jugglingProject
359
+ : resolved.jugglingProject,
360
+ };
361
+ if (isInteractive) {
362
+ printSummary(newSettings, projectDir, locale);
363
+ const ok = await p.confirm({
364
+ message: getMessage("update.confirmApply", locale),
365
+ });
366
+ if (p.isCancel(ok) || ok !== true) {
367
+ p.log.info(getMessage("update.cancelled", locale));
368
+ process.exit(0);
369
+ }
370
+ }
371
+ const provider = createGitAssetProvider(targetUrl, targetRef, { locale });
372
+ try {
373
+ p.log.info(getMessage("progress.fetching", locale));
374
+ await provider.fetch();
375
+ const newCommit = provider.sourceInfo().commit;
376
+ if (!newCommit) {
377
+ throw new Error("Failed to resolve the fetched commit");
378
+ }
379
+ p.log.info(getMessage("update.progress.range", locale, {
380
+ from: shortSha(source.commit),
381
+ to: shortSha(newCommit),
382
+ }));
383
+ const theirsPlan = await buildRenderedPlan(provider.asTree(), newSettings, provider.materialize);
384
+ let baseTree = null;
385
+ let baseError = null;
386
+ try {
387
+ baseTree = await provider.openCommit(source.commit);
388
+ }
389
+ catch (err) {
390
+ baseError = err;
391
+ }
392
+ const oldHashsum = await readHashsum(projectDir);
393
+ let actions;
394
+ if (baseTree) {
395
+ const basePlan = await buildRenderedPlan(baseTree, settings, baseTree.materialize);
396
+ const states = await collectFileStates(projectDir, basePlan, theirsPlan, oldHashsum);
397
+ actions = await classifyAll(states, mergeFile);
398
+ }
399
+ else {
400
+ const states = await collectFileStates(projectDir, new Map(), theirsPlan, oldHashsum);
401
+ const preview = await classifyAll(states, mergeFile, {
402
+ keepEdited: true,
403
+ });
404
+ const editedCount = preview.filter((a) => a.outcome === "skipped-edited").length;
405
+ const { keepEdited } = await resolveFallbackMode({
406
+ baseError,
407
+ editedCount,
408
+ commit: source.commit,
409
+ locale,
410
+ isInteractive,
411
+ allowMissingBase,
412
+ keepEditedFlag,
413
+ });
414
+ actions = keepEdited
415
+ ? preview
416
+ : await classifyAll(states, mergeFile, { keepEdited: false });
417
+ }
418
+ const summary = await applyUpdateActions(projectDir, actions);
419
+ const { hashEntries, deployedAssets } = buildUpdatedRecords(oldHashsum, actions);
420
+ const updatedSettings = {
421
+ ...newSettings,
422
+ createdAt: settings.createdAt,
423
+ assetSource: { ...source, url: targetUrl, ref: targetRef, commit: newCommit },
424
+ deployedAssets,
425
+ };
426
+ await writeSettings(projectDir, updatedSettings);
427
+ await writeHashsum(projectDir, hashEntries);
428
+ const skipInstall = args["skip-install"];
429
+ const hasConflicts = summary.conflicts.length > 0;
430
+ if (summary.changedFileCount > 0 && !hasConflicts && !skipInstall) {
431
+ runInstallBuild(projectDir, newSettings.packageManager, buildProgressCallbacks(locale));
432
+ }
433
+ let installGuide;
434
+ if (hasConflicts && !skipInstall) {
435
+ const [installCommand, buildCommand] = getInstallCmds(newSettings.packageManager);
436
+ installGuide = { installCommand, buildCommand };
437
+ }
438
+ printResult(summary, locale, installGuide);
439
+ }
440
+ catch (err) {
441
+ p.log.error(err instanceof Error ? err.message : String(err));
442
+ process.exit(1);
443
+ }
444
+ finally {
445
+ await provider.cleanup().catch(() => { });
446
+ }
447
+ },
448
+ });
@@ -1,5 +1,5 @@
1
1
  import type { AccelSettings } from "./types.js";
2
- export declare const CLI_VERSION = "0.1.0";
2
+ export declare const CLI_VERSION: string;
3
3
  export declare const DATABASE_OPTIONS: readonly ["postgresql", "oracle", "sqlserver"];
4
4
  export type DatabaseOption = (typeof DATABASE_OPTIONS)[number];
5
5
  export declare const AGENT_OPTIONS: readonly ["claude-code", "codex", "github-copilot"];
@@ -9,5 +9,5 @@ export type LocaleOption = (typeof LOCALE_OPTIONS)[number];
9
9
  export declare const PACKAGE_MANAGER_OPTIONS: readonly ["bun", "npm", "yarn", "pnpm"];
10
10
  export type PackageManagerOption = (typeof PACKAGE_MANAGER_OPTIONS)[number];
11
11
  export declare const DEFAULT_ASSET_REPO_URL = "https://github.com/accelplatform/skills";
12
- export declare const DEFAULT_ASSET_REF = "2026-07-01-release";
13
- export declare const DEFAULT_SETTINGS: Omit<AccelSettings, "cliVersion" | "createdAt" | "deployedAssets">;
12
+ export declare const DEFAULT_ASSET_REF = "experiment";
13
+ export declare const DEFAULT_SETTINGS: Omit<AccelSettings, "cliVersion" | "createdAt" | "deployedAssets" | "assetSource">;
@@ -1,4 +1,6 @@
1
- export const CLI_VERSION = "0.1.0";
1
+ import { createRequire } from "node:module";
2
+ const pkg = createRequire(import.meta.url)("../../package.json");
3
+ export const CLI_VERSION = pkg.version;
2
4
  export const DATABASE_OPTIONS = ["postgresql", "oracle", "sqlserver"];
3
5
  export const AGENT_OPTIONS = ["claude-code", "codex", "github-copilot"];
4
6
  export const LOCALE_OPTIONS = ["ja", "en", "zh_CN"];
@@ -9,7 +11,7 @@ export const PACKAGE_MANAGER_OPTIONS = [
9
11
  "pnpm",
10
12
  ];
11
13
  export const DEFAULT_ASSET_REPO_URL = "https://github.com/accelplatform/skills";
12
- export const DEFAULT_ASSET_REF = "2026-07-01-release";
14
+ export const DEFAULT_ASSET_REF = "experiment";
13
15
  export const DEFAULT_SETTINGS = {
14
16
  name: "my-accel-project",
15
17
  artifactId: "",
@@ -56,7 +56,7 @@ export type ForeachReplacement = {
56
56
  };
57
57
  export type Replacement = TextReplacement | SectionReplacement | RegexReplacement | ForeachReplacement;
58
58
  export type RenameRule = {
59
- condition: Condition;
59
+ condition?: Condition;
60
60
  from: string;
61
61
  to: string;
62
62
  };
@@ -100,7 +100,9 @@ export type AccelSettings = {
100
100
  javascript: boolean;
101
101
  locale: string;
102
102
  packageManager: string;
103
+ gitHooks?: boolean;
103
104
  jugglingProject: string | null;
105
+ assetSource?: AssetSourceInfo;
104
106
  deployedAssets: Record<string, string>;
105
107
  };
106
108
  export type HashsumEntry = {
@@ -108,9 +110,19 @@ export type HashsumEntry = {
108
110
  version: string;
109
111
  sha1: string;
110
112
  };
113
+ export type AssetSourceInfo = {
114
+ type: "git" | "directory";
115
+ url: string;
116
+ ref: string | null;
117
+ commit: string | null;
118
+ };
111
119
  export type AssetProvider = {
112
120
  fetch: () => Promise<string>;
121
+ listFiles: () => Promise<string[]>;
122
+ materialize: (files: string[]) => Promise<void>;
123
+ readFile: (relPath: string) => Promise<string>;
113
124
  cleanup: () => Promise<void>;
125
+ sourceInfo: () => AssetSourceInfo;
114
126
  };
115
127
  export type EvalContext = {
116
128
  accelplatformVersion: AccelplatformVersion;
@@ -5,12 +5,16 @@ export declare const makeDeployError: (kind: DeployError["kind"], extra?: {
5
5
  serverMessage?: string;
6
6
  }) => DeployError;
7
7
  export declare const isDeployError: (e: unknown) => e is DeployError;
8
+ export type DeployArchive = {
9
+ bytes: Uint8Array;
10
+ fileName: string;
11
+ };
8
12
  export type ApiClient = {
9
13
  verifyToken: () => Promise<void>;
10
14
  listStagings: () => Promise<StagingResponse[]>;
11
- createDeployment: (stagingId: string, bytes: Uint8Array, immFileName: string, description?: string) => Promise<DeploymentCreateResponse>;
15
+ createDeployment: (stagingId: string, archives: DeployArchive[], description?: string) => Promise<DeploymentCreateResponse>;
12
16
  executeSetup: (stagingId: string) => Promise<SetupExecuteResponse>;
13
- executeSetupConfig: (stagingId: string, configNumber: number) => Promise<SetupExecuteResponse>;
17
+ executeSetupConfig: (stagingId: string, moduleId: string, configNumber: number) => Promise<SetupExecuteResponse>;
14
18
  };
15
19
  export declare const createApiClient: (endpoint: string, apiKey: string, deps?: {
16
20
  fetch?: FetchFn;
@@ -88,9 +88,13 @@ export const createApiClient = (endpoint, apiKey, deps = {}) => {
88
88
  }
89
89
  return records;
90
90
  };
91
- const createDeployment = async (stagingId, bytes, immFileName, description) => {
91
+ const createDeployment = async (stagingId, archives, description) => {
92
92
  const form = new FormData();
93
- form.append("archiveFile", new File([bytes], immFileName, { type: "application/zip" }));
93
+ for (const archive of archives) {
94
+ form.append("archiveFile", new File([archive.bytes], archive.fileName, {
95
+ type: "application/zip",
96
+ }));
97
+ }
94
98
  if (description && description.length > 0) {
95
99
  form.append("description", description);
96
100
  }
@@ -109,8 +113,8 @@ export const createApiClient = (endpoint, apiKey, deps = {}) => {
109
113
  body: JSON.stringify({}),
110
114
  });
111
115
  };
112
- const executeSetupConfig = async (stagingId, configNumber) => {
113
- const url = `${endpoint}${STAGING_PATH}/${encodeURIComponent(stagingId)}/setup/configs/${configNumber}/execute`;
116
+ const executeSetupConfig = async (stagingId, moduleId, configNumber) => {
117
+ const url = `${endpoint}${STAGING_PATH}/${encodeURIComponent(stagingId)}/setup/configs/${encodeURIComponent(moduleId)}/${configNumber}/execute`;
114
118
  return request(url, {
115
119
  method: "POST",
116
120
  headers: { ...baseHeaders, "Content-Type": "application/json" },
@@ -0,0 +1,20 @@
1
+ export declare const toImmFileName: (zipPath: string) => string;
2
+ export declare const sentAsName: (path: string) => string;
3
+ export type DeployFile = {
4
+ path: string;
5
+ display: string;
6
+ sentAs: string;
7
+ };
8
+ export type AdditionalFileError = {
9
+ kind: "notFound" | "invalidExtension" | "duplicate";
10
+ path: string;
11
+ };
12
+ export type ValidateAdditionalFilesResult = {
13
+ ok: true;
14
+ paths: string[];
15
+ } | {
16
+ ok: false;
17
+ error: AdditionalFileError;
18
+ };
19
+ export declare const validateAdditionalFiles: (projectDir: string, args: string[], mainPath: string) => Promise<ValidateAdditionalFilesResult>;
20
+ export declare const buildDeployFiles: (additionalPaths: string[], mainPath: string, projectDir: string) => DeployFile[];