@intra-mart/accel 1.0.0-rc.202609290758 → 2.0.0-dev.202610210621
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/README.md +93 -6
- package/dist/asset/deployer.js +1 -2
- package/dist/asset/fetch-once.d.ts +2 -0
- package/dist/asset/fetch-once.js +14 -0
- package/dist/asset/mobile-meta.d.ts +15 -0
- package/dist/asset/mobile-meta.js +86 -0
- package/dist/asset/root-selection.d.ts +12 -0
- package/dist/asset/root-selection.js +78 -0
- package/dist/asset/updater.js +1 -1
- package/dist/asset/walker.d.ts +1 -1
- package/dist/asset/walker.js +3 -26
- package/dist/commands/attach-existing-files.d.ts +12 -0
- package/dist/commands/attach-existing-files.js +76 -0
- package/dist/commands/attach.d.ts +20 -0
- package/dist/commands/attach.js +77 -77
- package/dist/commands/deploy.js +16 -13
- package/dist/commands/detach.js +7 -3
- package/dist/commands/init.d.ts +20 -0
- package/dist/commands/init.js +71 -4
- package/dist/commands/login.js +12 -6
- package/dist/commands/mobile/attach.d.ts +7 -0
- package/dist/commands/mobile/attach.js +60 -0
- package/dist/commands/mobile/init.d.ts +4 -0
- package/dist/commands/mobile/init.js +95 -0
- package/dist/commands/mobile/shared.d.ts +65 -0
- package/dist/commands/mobile/shared.js +254 -0
- package/dist/commands/mobile/update.d.ts +8 -0
- package/dist/commands/mobile/update.js +109 -0
- package/dist/commands/mobile-sdk-options.d.ts +10 -0
- package/dist/commands/mobile-sdk-options.js +19 -0
- package/dist/commands/preset.d.ts +1 -1
- package/dist/commands/preset.js +35 -13
- package/dist/commands/project-type-select.d.ts +17 -0
- package/dist/commands/project-type-select.js +26 -0
- package/dist/commands/switch.d.ts +1 -1
- package/dist/commands/switch.js +118 -48
- package/dist/commands/update.d.ts +22 -0
- package/dist/commands/update.js +179 -106
- package/dist/core/condition-evaluator.js +4 -1
- package/dist/core/constants.d.ts +12 -2
- package/dist/core/constants.js +16 -0
- package/dist/core/eval-context.js +27 -0
- package/dist/core/project-type.d.ts +20 -0
- package/dist/core/project-type.js +49 -0
- package/dist/core/types.d.ts +28 -9
- package/dist/core/types.js +2 -0
- package/dist/core/validation.d.ts +2 -2
- package/dist/core/validators.d.ts +7 -0
- package/dist/core/validators.js +38 -1
- package/dist/core/variable-interpolator.js +2 -0
- package/dist/i18n/en.js +59 -0
- package/dist/i18n/ja.js +59 -0
- package/dist/i18n/zh_CN.js +59 -0
- package/dist/interactive/agent-detect.d.ts +1 -1
- package/dist/interactive/agent-detect.js +6 -6
- package/dist/interactive/mobile-prompts.d.ts +15 -0
- package/dist/interactive/mobile-prompts.js +45 -0
- package/dist/interactive/next-steps.d.ts +4 -0
- package/dist/interactive/next-steps.js +11 -0
- package/dist/interactive/prompts.d.ts +5 -2
- package/dist/interactive/prompts.js +23 -19
- package/dist/interactive/summary.d.ts +5 -3
- package/dist/interactive/summary.js +38 -0
- package/dist/lib.d.ts +11 -5
- package/dist/lib.js +6 -3
- package/dist/utils/args.d.ts +1 -0
- package/dist/utils/args.js +16 -0
- package/dist/utils/expo-project.d.ts +8 -0
- package/dist/utils/expo-project.js +54 -0
- package/dist/utils/external-command.d.ts +68 -0
- package/dist/utils/external-command.js +238 -0
- package/dist/utils/preset-io.d.ts +1 -0
- package/dist/utils/preset-io.js +18 -1
- package/dist/utils/settings-io.d.ts +1 -0
- package/dist/utils/settings-io.js +12 -0
- package/package.json +1 -1
package/dist/commands/attach.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { defineCommand } from "citty";
|
|
2
|
-
import * as p from "@clack/prompts";
|
|
3
2
|
import { stat } from "node:fs/promises";
|
|
4
3
|
import { basename, join } from "node:path";
|
|
5
|
-
import {
|
|
4
|
+
import { normalizeAbort } from "../core/errors.js";
|
|
6
5
|
import { getCliVersion } from "../core/paths.js";
|
|
7
|
-
import { runPrompts } from "../interactive/prompts.js";
|
|
6
|
+
import { printIntroNote, runPrompts } from "../interactive/prompts.js";
|
|
8
7
|
import { deployAssets, } from "../asset/deployer.js";
|
|
9
8
|
import { selectAssetProvider } from "./asset-provider.js";
|
|
10
9
|
import { withExitCode } from "./run-wrapper.js";
|
|
@@ -17,48 +16,12 @@ import { createClackLogger } from "../interactive/clack-logger.js";
|
|
|
17
16
|
import { printSummary } from "../interactive/summary.js";
|
|
18
17
|
import { printNextSteps } from "../interactive/next-steps.js";
|
|
19
18
|
import { buildProgressCallbacks } from "../interactive/progress.js";
|
|
20
|
-
import {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if (sticky === "skipAll")
|
|
27
|
-
return "skip";
|
|
28
|
-
const choice = await p.select({
|
|
29
|
-
message: getMessage("attach.overwritePrompt", locale, { path }),
|
|
30
|
-
options: [
|
|
31
|
-
{
|
|
32
|
-
value: "yes",
|
|
33
|
-
label: getMessage("attach.overwritePrompt.yes", locale),
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
value: "no",
|
|
37
|
-
label: getMessage("attach.overwritePrompt.no", locale),
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
value: "all",
|
|
41
|
-
label: getMessage("attach.overwritePrompt.all", locale),
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
value: "skipAll",
|
|
45
|
-
label: getMessage("attach.overwritePrompt.skipAll", locale),
|
|
46
|
-
},
|
|
47
|
-
],
|
|
48
|
-
});
|
|
49
|
-
if (p.isCancel(choice))
|
|
50
|
-
throw createCancelledError();
|
|
51
|
-
if (choice === "all") {
|
|
52
|
-
sticky = "all";
|
|
53
|
-
return "overwrite";
|
|
54
|
-
}
|
|
55
|
-
if (choice === "skipAll") {
|
|
56
|
-
sticky = "skipAll";
|
|
57
|
-
return "skip";
|
|
58
|
-
}
|
|
59
|
-
return choice === "yes" ? "overwrite" : "skip";
|
|
60
|
-
};
|
|
61
|
-
};
|
|
19
|
+
import { defaultMobilePrompts, } from "../interactive/mobile-prompts.js";
|
|
20
|
+
import { runExternalCommand as defaultRunExternalCommand, } from "../utils/external-command.js";
|
|
21
|
+
import { readExpoVersionRange } from "../utils/expo-project.js";
|
|
22
|
+
import { resolveProjectType } from "./project-type-select.js";
|
|
23
|
+
import { projectTypeOptionValues } from "../core/project-type.js";
|
|
24
|
+
import { reportExistingFiles, resolveExistingFilePolicy, } from "./attach-existing-files.js";
|
|
62
25
|
export const runAttach = async (deps) => {
|
|
63
26
|
try {
|
|
64
27
|
return await runAttachInner(deps);
|
|
@@ -76,6 +39,50 @@ const runAttachInner = async (deps) => {
|
|
|
76
39
|
if (accelExists) {
|
|
77
40
|
throw new Error(getMessage("error.accelExists", locale));
|
|
78
41
|
}
|
|
42
|
+
const mobilePrompts = { ...defaultMobilePrompts, ...deps.mobilePrompts };
|
|
43
|
+
const { projectType, introShown } = await resolveProjectType({
|
|
44
|
+
mode: "attach",
|
|
45
|
+
projectType: deps.projectType,
|
|
46
|
+
nonInteractive: deps.nonInteractive ?? false,
|
|
47
|
+
iapPromptsReplaced: deps.resolveOptions !== undefined &&
|
|
48
|
+
deps.mobilePrompts?.selectProjectType === undefined,
|
|
49
|
+
initial: async () => (await readExpoVersionRange(projectDir)) !== undefined ? "mobile" : "iap",
|
|
50
|
+
optionValues: projectTypeOptionValues(deps),
|
|
51
|
+
locale,
|
|
52
|
+
logger,
|
|
53
|
+
selectProjectType: mobilePrompts.selectProjectType,
|
|
54
|
+
});
|
|
55
|
+
if (projectType === "mobile") {
|
|
56
|
+
const { runMobileAttach } = await import("./mobile/attach.js");
|
|
57
|
+
return runMobileAttach({
|
|
58
|
+
projectDir,
|
|
59
|
+
overwrite: deps.overwrite,
|
|
60
|
+
onExistingFile: deps.onExistingFile,
|
|
61
|
+
locale,
|
|
62
|
+
logger,
|
|
63
|
+
nonInteractive: deps.nonInteractive ?? false,
|
|
64
|
+
introShown,
|
|
65
|
+
name: deps.name,
|
|
66
|
+
accelplatformVersion: deps.accelplatformVersion,
|
|
67
|
+
expoSdk: deps.expoSdk,
|
|
68
|
+
agents: deps.agents,
|
|
69
|
+
packageManager: deps.packageManager,
|
|
70
|
+
expoSkills: deps.expoSkills,
|
|
71
|
+
skipInstall: deps.skipInstall ?? false,
|
|
72
|
+
assetServerUrl: deps.assetServerUrl,
|
|
73
|
+
assetRef: deps.assetRef,
|
|
74
|
+
assetSource: deps.assetSource,
|
|
75
|
+
progress: deps.progress ?? buildProgressCallbacks(locale, logger),
|
|
76
|
+
signal: deps.signal,
|
|
77
|
+
runExternalCommand: deps.runExternalCommand ?? defaultRunExternalCommand,
|
|
78
|
+
prompts: mobilePrompts,
|
|
79
|
+
generateMcpConfigs: deps.generateMcpConfigs,
|
|
80
|
+
syncDependencyArtifacts: deps.syncDependencyArtifacts,
|
|
81
|
+
runEnsure: deps.runEnsure,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
if (introShown)
|
|
85
|
+
printIntroNote("attach", locale, logger);
|
|
79
86
|
const promptOpts = {
|
|
80
87
|
name: deps.name ?? basename(projectDir),
|
|
81
88
|
artifactId: deps.artifactId,
|
|
@@ -93,9 +100,11 @@ const runAttachInner = async (deps) => {
|
|
|
93
100
|
locale,
|
|
94
101
|
noInteraction: deps.nonInteractive,
|
|
95
102
|
isInit: false,
|
|
103
|
+
skipIntro: introShown,
|
|
96
104
|
};
|
|
97
105
|
const resolved = await resolveOptions(promptOpts);
|
|
98
106
|
const settings = {
|
|
107
|
+
projectType: "iap",
|
|
99
108
|
cliVersion: getCliVersion(),
|
|
100
109
|
createdAt: new Date().toISOString(),
|
|
101
110
|
name: resolved.name,
|
|
@@ -122,18 +131,12 @@ const runAttachInner = async (deps) => {
|
|
|
122
131
|
if (!deps.nonInteractive) {
|
|
123
132
|
printSummary(settings, projectDir, locale, logger);
|
|
124
133
|
}
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
(deps.nonInteractive
|
|
132
|
-
? undefined
|
|
133
|
-
: createDefaultExistingFileHandler(locale));
|
|
134
|
-
if (!onExistingFile)
|
|
135
|
-
skipExistingFiles = true;
|
|
136
|
-
}
|
|
134
|
+
const { skipExistingFiles, onExistingFile } = resolveExistingFilePolicy({
|
|
135
|
+
overwrite: deps.overwrite,
|
|
136
|
+
onExistingFile: deps.onExistingFile,
|
|
137
|
+
nonInteractive: deps.nonInteractive,
|
|
138
|
+
locale,
|
|
139
|
+
});
|
|
137
140
|
const result = await deployAssets({
|
|
138
141
|
projectDir,
|
|
139
142
|
settings,
|
|
@@ -144,26 +147,7 @@ const runAttachInner = async (deps) => {
|
|
|
144
147
|
progress: deps.progress ?? buildProgressCallbacks(locale, logger),
|
|
145
148
|
signal: deps.signal,
|
|
146
149
|
});
|
|
147
|
-
|
|
148
|
-
logger.info(getMessage("attach.overwritten", locale, {
|
|
149
|
-
path: sanitizeDisplayText(path),
|
|
150
|
-
}));
|
|
151
|
-
}
|
|
152
|
-
for (const path of result.skippedFiles) {
|
|
153
|
-
logger.warn(getMessage("warning.fileExists", locale, {
|
|
154
|
-
path: sanitizeDisplayText(path),
|
|
155
|
-
}));
|
|
156
|
-
}
|
|
157
|
-
if (result.overwrittenFiles.length > 0) {
|
|
158
|
-
logger.info(getMessage("attach.overwriteSummary", locale, {
|
|
159
|
-
count: String(result.overwrittenFiles.length),
|
|
160
|
-
}));
|
|
161
|
-
}
|
|
162
|
-
if (result.skippedFiles.length > 0) {
|
|
163
|
-
logger.info(getMessage("attach.skipSummary", locale, {
|
|
164
|
-
count: String(result.skippedFiles.length),
|
|
165
|
-
}));
|
|
166
|
-
}
|
|
150
|
+
reportExistingFiles(result, logger, locale);
|
|
167
151
|
const { hasDeps } = await syncDependencyArtifactsAndEnsureBestEffort(projectDir, logger, {
|
|
168
152
|
skipInstall: deps.skipInstall ?? false,
|
|
169
153
|
syncImpl: deps.syncDependencyArtifacts,
|
|
@@ -186,6 +170,19 @@ export const attachCommand = defineCommand({
|
|
|
186
170
|
description: "Attach Accel CLI to an existing project",
|
|
187
171
|
},
|
|
188
172
|
args: {
|
|
173
|
+
"project-type": {
|
|
174
|
+
type: "string",
|
|
175
|
+
description: "Project type (iap, mobile). Default: iap (interactive: mobile for Expo projects)",
|
|
176
|
+
},
|
|
177
|
+
"expo-sdk": {
|
|
178
|
+
type: "string",
|
|
179
|
+
description: "(mobile) Expo SDK major version (e.g., 56). Default: detected from package.json",
|
|
180
|
+
},
|
|
181
|
+
"expo-skills": {
|
|
182
|
+
type: "boolean",
|
|
183
|
+
description: "(mobile) Install the official Expo skills for Codex",
|
|
184
|
+
negativeDescription: "(mobile) Do not install the official Expo skills",
|
|
185
|
+
},
|
|
189
186
|
"juggling-project": {
|
|
190
187
|
type: "string",
|
|
191
188
|
description: "Path to IM-Juggling project",
|
|
@@ -275,6 +272,7 @@ export const attachCommand = defineCommand({
|
|
|
275
272
|
projectDir: process.cwd(),
|
|
276
273
|
locale: args.locale,
|
|
277
274
|
nonInteractive: args["non-interactive"],
|
|
275
|
+
projectType: args["project-type"],
|
|
278
276
|
name: args.name,
|
|
279
277
|
artifactId: args["artifact-id"],
|
|
280
278
|
jugglingProject: args["juggling-project"],
|
|
@@ -289,6 +287,8 @@ export const attachCommand = defineCommand({
|
|
|
289
287
|
agents: splitList(args.agent),
|
|
290
288
|
packageManager: args["package-manager"],
|
|
291
289
|
overwrite: args.overwrite,
|
|
290
|
+
expoSdk: args["expo-sdk"],
|
|
291
|
+
expoSkills: args["expo-skills"],
|
|
292
292
|
skipInstall: args["skip-install"],
|
|
293
293
|
assetServerUrl: args["asset-server-url"],
|
|
294
294
|
assetRef: args["asset-ref"],
|
package/dist/commands/deploy.js
CHANGED
|
@@ -2,12 +2,13 @@ import { defineCommand } from "citty";
|
|
|
2
2
|
import * as p from "@clack/prompts";
|
|
3
3
|
import { readFile, stat } from "node:fs/promises";
|
|
4
4
|
import { basename, resolve } from "node:path";
|
|
5
|
+
import { isMobileSettings } from "../core/types.js";
|
|
5
6
|
import { detectLocale } from "../utils/locale-detect.js";
|
|
6
7
|
import { createCancelledError, isCancelledError, markReported, normalizeAbort, } from "../core/errors.js";
|
|
7
8
|
import { createClackLogger } from "../interactive/clack-logger.js";
|
|
8
9
|
import { withExitCode } from "./run-wrapper.js";
|
|
9
10
|
import { formatEpochMillis } from "../utils/date-formatter.js";
|
|
10
|
-
import {
|
|
11
|
+
import { readProjectSettings, readSettingsSafe, } from "../utils/settings-io.js";
|
|
11
12
|
import { resolveCredentialInputs } from "../utils/credentials.js";
|
|
12
13
|
import { sanitizeDisplayText } from "../utils/sanitize-text.js";
|
|
13
14
|
import { createPersistCredentialsWithMcp } from "../utils/mcp-generate.js";
|
|
@@ -167,15 +168,6 @@ const defaultPrompts = {
|
|
|
167
168
|
return configs.filter((c) => selected.has(c.moduleId));
|
|
168
169
|
},
|
|
169
170
|
};
|
|
170
|
-
const resolveLocale = async (projectDir) => {
|
|
171
|
-
try {
|
|
172
|
-
const settings = await readSettings(projectDir);
|
|
173
|
-
return settings.locale ?? detectLocale();
|
|
174
|
-
}
|
|
175
|
-
catch {
|
|
176
|
-
return detectLocale();
|
|
177
|
-
}
|
|
178
|
-
};
|
|
179
171
|
const formatDeployError = (err, locale) => {
|
|
180
172
|
if (err.kind === "network") {
|
|
181
173
|
return getMessage("deploy.error.network", locale, {
|
|
@@ -230,7 +222,7 @@ const resolveZipPath = async (opts) => {
|
|
|
230
222
|
throw new Error("no target zip");
|
|
231
223
|
}
|
|
232
224
|
const settings = await readSettingsSafe(projectDir);
|
|
233
|
-
const selection = selectDeployTarget(zips, settings
|
|
225
|
+
const selection = selectDeployTarget(zips, settings && !isMobileSettings(settings)
|
|
234
226
|
? { artifactId: settings.artifactId, projectVersion: settings.projectVersion }
|
|
235
227
|
: null);
|
|
236
228
|
if ("auto" in selection)
|
|
@@ -253,11 +245,22 @@ export const runDeploy = async (deps) => {
|
|
|
253
245
|
};
|
|
254
246
|
const runDeployInner = async (deps) => {
|
|
255
247
|
const { projectDir } = deps;
|
|
256
|
-
const
|
|
248
|
+
const logger = deps.logger ?? createClackLogger();
|
|
249
|
+
const fallbackLocale = deps.locale ?? detectLocale();
|
|
250
|
+
let settings;
|
|
251
|
+
try {
|
|
252
|
+
settings = await readProjectSettings(projectDir, fallbackLocale);
|
|
253
|
+
}
|
|
254
|
+
catch (err) {
|
|
255
|
+
throw logAndRethrow(err, fallbackLocale, logger);
|
|
256
|
+
}
|
|
257
|
+
const locale = deps.locale ?? settings?.locale ?? fallbackLocale;
|
|
258
|
+
if (settings && isMobileSettings(settings)) {
|
|
259
|
+
throw logAndRethrow(new Error(getMessage("deploy.error.mobileProject", locale)), locale, logger);
|
|
260
|
+
}
|
|
257
261
|
const ensureCreds = deps.ensureCredentials ?? defaultEnsureCredentials;
|
|
258
262
|
const reprompt = deps.repromptCredentials ?? defaultRepromptCredentials;
|
|
259
263
|
const resolveOrThrow = deps.resolveCredentialsOrThrow ?? defaultResolveCredentialsOrThrow;
|
|
260
|
-
const logger = deps.logger ?? createClackLogger();
|
|
261
264
|
const persist = deps.persistCredentials ?? createPersistCredentialsWithMcp(logger);
|
|
262
265
|
const scan = deps.scanTargets ?? defaultScanTargets;
|
|
263
266
|
const apiClientFactory = deps.apiClientFactory ??
|
package/dist/commands/detach.js
CHANGED
|
@@ -4,7 +4,7 @@ import { readFile, rm, unlink, stat } from "node:fs/promises";
|
|
|
4
4
|
import { join } from "node:path";
|
|
5
5
|
import { createCancelledError } from "../core/errors.js";
|
|
6
6
|
import { createClackLogger } from "../interactive/clack-logger.js";
|
|
7
|
-
import {
|
|
7
|
+
import { readProjectSettings, readHashsum } from "../utils/settings-io.js";
|
|
8
8
|
import { computeSha1 } from "../utils/hash.js";
|
|
9
9
|
import { getMessage } from "../i18n/index.js";
|
|
10
10
|
import { detectLocale } from "../utils/locale-detect.js";
|
|
@@ -30,8 +30,12 @@ export const runDetach = async (deps) => {
|
|
|
30
30
|
catch {
|
|
31
31
|
throw new Error(getMessage("error.accelNotFound", deps.locale ?? detectLocale()));
|
|
32
32
|
}
|
|
33
|
-
const
|
|
34
|
-
const
|
|
33
|
+
const fallbackLocale = deps.locale ?? detectLocale();
|
|
34
|
+
const settings = await readProjectSettings(projectDir, fallbackLocale);
|
|
35
|
+
if (!settings) {
|
|
36
|
+
throw new Error(getMessage("error.accelNotFound", fallbackLocale));
|
|
37
|
+
}
|
|
38
|
+
const locale = deps.locale ?? settings.locale ?? fallbackLocale;
|
|
35
39
|
const hashEntries = await readHashsum(projectDir);
|
|
36
40
|
logger.intro("Accel CLI - detach");
|
|
37
41
|
const prompts = deps.prompts ?? createDefaultPrompts(locale);
|
package/dist/commands/init.d.ts
CHANGED
|
@@ -3,10 +3,13 @@ import { type PromptOptions, type ResolvedOptions } from "../core/validation.js"
|
|
|
3
3
|
import { type ProgressCallbacks } from "../asset/deployer.js";
|
|
4
4
|
import { type generateMcpConfigs } from "../utils/mcp-generate.js";
|
|
5
5
|
import { type runEnsure, type syncDependencyArtifacts } from "../utils/runtime-ensure.js";
|
|
6
|
+
import { type MobilePrompts } from "../interactive/mobile-prompts.js";
|
|
7
|
+
import { type RunExternalCommand } from "../utils/external-command.js";
|
|
6
8
|
export type RunInitDeps = {
|
|
7
9
|
baseDir: string;
|
|
8
10
|
locale?: string;
|
|
9
11
|
nonInteractive?: boolean;
|
|
12
|
+
projectType?: string;
|
|
10
13
|
name?: string;
|
|
11
14
|
artifactId?: string;
|
|
12
15
|
jugglingProject?: string;
|
|
@@ -21,6 +24,8 @@ export type RunInitDeps = {
|
|
|
21
24
|
agents?: string[];
|
|
22
25
|
packageManager?: string;
|
|
23
26
|
gitInit?: boolean;
|
|
27
|
+
expoSdk?: string;
|
|
28
|
+
expoSkills?: boolean;
|
|
24
29
|
skipInstall?: boolean;
|
|
25
30
|
assetServerUrl?: string;
|
|
26
31
|
assetRef?: string;
|
|
@@ -33,6 +38,8 @@ export type RunInitDeps = {
|
|
|
33
38
|
generateMcpConfigs?: typeof generateMcpConfigs;
|
|
34
39
|
syncDependencyArtifacts?: typeof syncDependencyArtifacts;
|
|
35
40
|
runEnsure?: typeof runEnsure;
|
|
41
|
+
runExternalCommand?: RunExternalCommand;
|
|
42
|
+
mobilePrompts?: Partial<MobilePrompts>;
|
|
36
43
|
};
|
|
37
44
|
export declare const runInit: (deps: RunInitDeps) => Promise<void>;
|
|
38
45
|
export declare const initCommand: import("citty").CommandDef<{
|
|
@@ -41,6 +48,10 @@ export declare const initCommand: import("citty").CommandDef<{
|
|
|
41
48
|
readonly description: "Project name (directory name)";
|
|
42
49
|
readonly required: false;
|
|
43
50
|
};
|
|
51
|
+
readonly "project-type": {
|
|
52
|
+
readonly type: "string";
|
|
53
|
+
readonly description: "Project type (iap, mobile). Default: iap";
|
|
54
|
+
};
|
|
44
55
|
readonly "juggling-project": {
|
|
45
56
|
readonly type: "string";
|
|
46
57
|
readonly description: "Path to IM-Juggling project";
|
|
@@ -98,6 +109,15 @@ export declare const initCommand: import("citty").CommandDef<{
|
|
|
98
109
|
readonly description: "Initialize git repository (use --no-git-init to disable)";
|
|
99
110
|
readonly default: true;
|
|
100
111
|
};
|
|
112
|
+
readonly "expo-sdk": {
|
|
113
|
+
readonly type: "string";
|
|
114
|
+
readonly description: "(mobile) Expo SDK major version (e.g., 56). Default: latest available";
|
|
115
|
+
};
|
|
116
|
+
readonly "expo-skills": {
|
|
117
|
+
readonly type: "boolean";
|
|
118
|
+
readonly description: "(mobile) Install the official Expo skills for Codex";
|
|
119
|
+
readonly negativeDescription: "(mobile) Do not install the official Expo skills";
|
|
120
|
+
};
|
|
101
121
|
readonly "skip-install": {
|
|
102
122
|
readonly type: "boolean";
|
|
103
123
|
readonly description: "Skip dependency installation";
|
package/dist/commands/init.js
CHANGED
|
@@ -4,7 +4,7 @@ import { execSync } from "node:child_process";
|
|
|
4
4
|
import { resolve } from "node:path";
|
|
5
5
|
import { normalizeAbort } from "../core/errors.js";
|
|
6
6
|
import { getCliVersion } from "../core/paths.js";
|
|
7
|
-
import { runPrompts } from "../interactive/prompts.js";
|
|
7
|
+
import { printIntroNote, runPrompts } from "../interactive/prompts.js";
|
|
8
8
|
import { checkProjectDirAvailable, } from "../core/validation.js";
|
|
9
9
|
import { deployAssets } from "../asset/deployer.js";
|
|
10
10
|
import { selectAssetProvider } from "./asset-provider.js";
|
|
@@ -14,11 +14,15 @@ import { detectLocale } from "../utils/locale-detect.js";
|
|
|
14
14
|
import { generateMcpConfigsBestEffort, } from "../utils/mcp-generate.js";
|
|
15
15
|
import { syncDependencyArtifactsAndEnsureBestEffort, } from "../utils/runtime-ensure.js";
|
|
16
16
|
import { commandExists } from "../utils/command-exists.js";
|
|
17
|
-
import { splitList } from "../utils/args.js";
|
|
17
|
+
import { splitList, wasFlagSpecified } from "../utils/args.js";
|
|
18
18
|
import { createClackLogger } from "../interactive/clack-logger.js";
|
|
19
19
|
import { printSummary } from "../interactive/summary.js";
|
|
20
20
|
import { printNextSteps } from "../interactive/next-steps.js";
|
|
21
21
|
import { buildProgressCallbacks } from "../interactive/progress.js";
|
|
22
|
+
import { defaultMobilePrompts, } from "../interactive/mobile-prompts.js";
|
|
23
|
+
import { runExternalCommand as defaultRunExternalCommand, } from "../utils/external-command.js";
|
|
24
|
+
import { resolveProjectType } from "./project-type-select.js";
|
|
25
|
+
import { projectTypeOptionValues } from "../core/project-type.js";
|
|
22
26
|
export const runInit = async (deps) => {
|
|
23
27
|
try {
|
|
24
28
|
await runInitInner(deps);
|
|
@@ -30,6 +34,49 @@ export const runInit = async (deps) => {
|
|
|
30
34
|
const runInitInner = async (deps) => {
|
|
31
35
|
const locale = deps.locale ?? detectLocale();
|
|
32
36
|
const logger = deps.logger ?? createClackLogger();
|
|
37
|
+
const mobilePrompts = { ...defaultMobilePrompts, ...deps.mobilePrompts };
|
|
38
|
+
const { projectType, introShown } = await resolveProjectType({
|
|
39
|
+
mode: "init",
|
|
40
|
+
projectType: deps.projectType,
|
|
41
|
+
nonInteractive: deps.nonInteractive ?? false,
|
|
42
|
+
iapPromptsReplaced: deps.resolveOptions !== undefined &&
|
|
43
|
+
deps.mobilePrompts?.selectProjectType === undefined,
|
|
44
|
+
initial: async () => "iap",
|
|
45
|
+
optionValues: projectTypeOptionValues(deps),
|
|
46
|
+
locale,
|
|
47
|
+
logger,
|
|
48
|
+
selectProjectType: mobilePrompts.selectProjectType,
|
|
49
|
+
});
|
|
50
|
+
if (projectType === "mobile") {
|
|
51
|
+
const { runMobileInit } = await import("./mobile/init.js");
|
|
52
|
+
await runMobileInit({
|
|
53
|
+
baseDir: deps.baseDir,
|
|
54
|
+
locale,
|
|
55
|
+
logger,
|
|
56
|
+
nonInteractive: deps.nonInteractive ?? false,
|
|
57
|
+
introShown,
|
|
58
|
+
name: deps.name,
|
|
59
|
+
accelplatformVersion: deps.accelplatformVersion,
|
|
60
|
+
expoSdk: deps.expoSdk,
|
|
61
|
+
agents: deps.agents,
|
|
62
|
+
packageManager: deps.packageManager,
|
|
63
|
+
expoSkills: deps.expoSkills,
|
|
64
|
+
skipInstall: deps.skipInstall ?? false,
|
|
65
|
+
assetServerUrl: deps.assetServerUrl,
|
|
66
|
+
assetRef: deps.assetRef,
|
|
67
|
+
assetSource: deps.assetSource,
|
|
68
|
+
progress: deps.progress ?? buildProgressCallbacks(locale, logger),
|
|
69
|
+
signal: deps.signal,
|
|
70
|
+
runExternalCommand: deps.runExternalCommand ?? defaultRunExternalCommand,
|
|
71
|
+
prompts: mobilePrompts,
|
|
72
|
+
generateMcpConfigs: deps.generateMcpConfigs,
|
|
73
|
+
syncDependencyArtifacts: deps.syncDependencyArtifacts,
|
|
74
|
+
runEnsure: deps.runEnsure,
|
|
75
|
+
});
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
if (introShown)
|
|
79
|
+
printIntroNote("init", locale, logger);
|
|
33
80
|
const resolveOptions = deps.resolveOptions ?? runPrompts;
|
|
34
81
|
const initGitRepo = deps.initGitRepo ??
|
|
35
82
|
((dir) => execSync("git init", { cwd: dir, stdio: "pipe" }));
|
|
@@ -51,6 +98,7 @@ const runInitInner = async (deps) => {
|
|
|
51
98
|
withGit: deps.gitInit,
|
|
52
99
|
noInteraction: deps.nonInteractive,
|
|
53
100
|
isInit: true,
|
|
101
|
+
skipIntro: introShown,
|
|
54
102
|
};
|
|
55
103
|
const resolved = await resolveOptions(promptOpts);
|
|
56
104
|
const projectDir = resolve(deps.baseDir, resolved.name);
|
|
@@ -60,6 +108,7 @@ const runInitInner = async (deps) => {
|
|
|
60
108
|
}
|
|
61
109
|
await mkdir(projectDir, { recursive: true });
|
|
62
110
|
const settings = {
|
|
111
|
+
projectType: "iap",
|
|
63
112
|
cliVersion: getCliVersion(),
|
|
64
113
|
createdAt: new Date().toISOString(),
|
|
65
114
|
name: resolved.name,
|
|
@@ -134,6 +183,10 @@ export const initCommand = defineCommand({
|
|
|
134
183
|
description: "Project name (directory name)",
|
|
135
184
|
required: false,
|
|
136
185
|
},
|
|
186
|
+
"project-type": {
|
|
187
|
+
type: "string",
|
|
188
|
+
description: "Project type (iap, mobile). Default: iap",
|
|
189
|
+
},
|
|
137
190
|
"juggling-project": {
|
|
138
191
|
type: "string",
|
|
139
192
|
description: "Path to IM-Juggling project",
|
|
@@ -191,6 +244,15 @@ export const initCommand = defineCommand({
|
|
|
191
244
|
description: "Initialize git repository (use --no-git-init to disable)",
|
|
192
245
|
default: true,
|
|
193
246
|
},
|
|
247
|
+
"expo-sdk": {
|
|
248
|
+
type: "string",
|
|
249
|
+
description: "(mobile) Expo SDK major version (e.g., 56). Default: latest available",
|
|
250
|
+
},
|
|
251
|
+
"expo-skills": {
|
|
252
|
+
type: "boolean",
|
|
253
|
+
description: "(mobile) Install the official Expo skills for Codex",
|
|
254
|
+
negativeDescription: "(mobile) Do not install the official Expo skills",
|
|
255
|
+
},
|
|
194
256
|
"skip-install": {
|
|
195
257
|
type: "boolean",
|
|
196
258
|
description: "Skip dependency installation",
|
|
@@ -214,9 +276,10 @@ export const initCommand = defineCommand({
|
|
|
214
276
|
description: "(debug) Local asset source directory",
|
|
215
277
|
},
|
|
216
278
|
},
|
|
217
|
-
run: withExitCode(async ({ args }) => {
|
|
279
|
+
run: withExitCode(async ({ args, rawArgs }) => {
|
|
218
280
|
await runInit({
|
|
219
281
|
baseDir: process.cwd(),
|
|
282
|
+
projectType: args["project-type"],
|
|
220
283
|
locale: args.locale,
|
|
221
284
|
nonInteractive: args["non-interactive"],
|
|
222
285
|
name: args.name,
|
|
@@ -232,7 +295,11 @@ export const initCommand = defineCommand({
|
|
|
232
295
|
javascript: args.javascript,
|
|
233
296
|
agents: splitList(args.agent),
|
|
234
297
|
packageManager: args["package-manager"],
|
|
235
|
-
gitInit:
|
|
298
|
+
gitInit: wasFlagSpecified(rawArgs, "git-init")
|
|
299
|
+
? args["git-init"]
|
|
300
|
+
: undefined,
|
|
301
|
+
expoSdk: args["expo-sdk"],
|
|
302
|
+
expoSkills: args["expo-skills"],
|
|
236
303
|
skipInstall: args["skip-install"],
|
|
237
304
|
assetServerUrl: args["asset-server-url"],
|
|
238
305
|
assetRef: args["asset-ref"],
|
package/dist/commands/login.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineCommand } from "citty";
|
|
2
2
|
import { createClackLogger } from "../interactive/clack-logger.js";
|
|
3
3
|
import { detectLocale } from "../utils/locale-detect.js";
|
|
4
|
-
import {
|
|
4
|
+
import { readProjectSettings } from "../utils/settings-io.js";
|
|
5
5
|
import { readCredentials as defaultReadCredentials, resolveCredentialInputs, } from "../utils/credentials.js";
|
|
6
6
|
import { createPersistCredentialsWithMcp } from "../utils/mcp-generate.js";
|
|
7
7
|
import { repromptCredentials as defaultRepromptCredentials, resolveCredentialsOrThrow as defaultResolveCredentialsOrThrow, } from "../interactive/credentials-prompts.js";
|
|
@@ -11,14 +11,20 @@ import { getMessage } from "../i18n/index.js";
|
|
|
11
11
|
import { lastFlagValue } from "../utils/args.js";
|
|
12
12
|
import { markReported } from "../core/errors.js";
|
|
13
13
|
import { withExitCode } from "./run-wrapper.js";
|
|
14
|
-
const resolveLocale = async (projectDir) => {
|
|
15
|
-
const settings = await readSettingsSafe(projectDir);
|
|
16
|
-
return settings?.locale ?? detectLocale();
|
|
17
|
-
};
|
|
18
14
|
export const runLogin = async (deps) => {
|
|
19
15
|
const { projectDir } = deps;
|
|
20
|
-
const locale = deps.locale ?? (await resolveLocale(projectDir));
|
|
21
16
|
const logger = deps.logger ?? createClackLogger();
|
|
17
|
+
const fallbackLocale = deps.locale ?? detectLocale();
|
|
18
|
+
let settingsLocale;
|
|
19
|
+
try {
|
|
20
|
+
settingsLocale = (await readProjectSettings(projectDir, fallbackLocale))
|
|
21
|
+
?.locale;
|
|
22
|
+
}
|
|
23
|
+
catch (err) {
|
|
24
|
+
logger.error(err instanceof Error ? err.message : String(err));
|
|
25
|
+
throw err;
|
|
26
|
+
}
|
|
27
|
+
const locale = deps.locale ?? settingsLocale ?? fallbackLocale;
|
|
22
28
|
const read = deps.readCredentials ?? defaultReadCredentials;
|
|
23
29
|
const reprompt = deps.repromptCredentials ?? defaultRepromptCredentials;
|
|
24
30
|
const resolveOrThrow = deps.resolveCredentialsOrThrow ?? defaultResolveCredentialsOrThrow;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type DeployResult, type ExistingFileHandler } from "../../asset/deployer.js";
|
|
2
|
+
import { type MobileRunInput } from "./shared.js";
|
|
3
|
+
export declare const runMobileAttach: (input: MobileRunInput & {
|
|
4
|
+
projectDir: string;
|
|
5
|
+
overwrite?: boolean;
|
|
6
|
+
onExistingFile?: ExistingFileHandler;
|
|
7
|
+
}) => Promise<DeployResult>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { basename } from "node:path";
|
|
2
|
+
import { DEFAULT_SETTINGS } from "../../core/constants.js";
|
|
3
|
+
import { getMessage } from "../../i18n/index.js";
|
|
4
|
+
import { deployAssets, } from "../../asset/deployer.js";
|
|
5
|
+
import { detectProjectExpoSdk, readExpoVersionRange, } from "../../utils/expo-project.js";
|
|
6
|
+
import { printMobileSummary } from "../../interactive/summary.js";
|
|
7
|
+
import { reportExistingFiles, resolveExistingFilePolicy, } from "../attach-existing-files.js";
|
|
8
|
+
import { buildMobileSettings, confirmOrCancel, finishMobile, formatSkillsCommandLine, listSdkCandidates, openMobileProvider, printMobileIntro, resolveAgents, resolveExpoSdk, resolveExpoSkills, resolveNameAndTarget, validateMobileCliValues, } from "./shared.js";
|
|
9
|
+
export const runMobileAttach = async (input) => {
|
|
10
|
+
const { locale, logger, projectDir } = input;
|
|
11
|
+
validateMobileCliValues(input, "attach");
|
|
12
|
+
if ((await readExpoVersionRange(projectDir)) === undefined) {
|
|
13
|
+
throw new Error(getMessage("attach.error.notExpoProject", locale));
|
|
14
|
+
}
|
|
15
|
+
printMobileIntro(input, "attach");
|
|
16
|
+
const provider = await openMobileProvider(input);
|
|
17
|
+
try {
|
|
18
|
+
const { name, targetReleaseId } = await resolveNameAndTarget(input, "attach", basename(projectDir));
|
|
19
|
+
const detectedSdk = await detectProjectExpoSdk(projectDir);
|
|
20
|
+
const candidates = await listSdkCandidates(provider, targetReleaseId, locale);
|
|
21
|
+
const selected = await resolveExpoSdk(input, candidates, detectedSdk);
|
|
22
|
+
const agents = await resolveAgents(input);
|
|
23
|
+
const packageManager = input.packageManager ?? DEFAULT_SETTINGS.packageManager;
|
|
24
|
+
const plan = await resolveExpoSkills(input, selected.mobile, agents, packageManager, projectDir);
|
|
25
|
+
const settings = buildMobileSettings({
|
|
26
|
+
name,
|
|
27
|
+
targetReleaseId,
|
|
28
|
+
expoSdk: selected.mobile.expoSdk,
|
|
29
|
+
agents,
|
|
30
|
+
locale,
|
|
31
|
+
packageManager,
|
|
32
|
+
});
|
|
33
|
+
if (!input.nonInteractive) {
|
|
34
|
+
printMobileSummary(settings, projectDir, plan?.install
|
|
35
|
+
? [formatSkillsCommandLine(plan, projectDir, packageManager)]
|
|
36
|
+
: [], locale, logger);
|
|
37
|
+
}
|
|
38
|
+
await confirmOrCancel(input, "attach");
|
|
39
|
+
const result = await deployAssets({
|
|
40
|
+
projectDir,
|
|
41
|
+
settings,
|
|
42
|
+
provider,
|
|
43
|
+
noInstall: true,
|
|
44
|
+
...resolveExistingFilePolicy({
|
|
45
|
+
overwrite: input.overwrite,
|
|
46
|
+
onExistingFile: input.onExistingFile,
|
|
47
|
+
nonInteractive: input.nonInteractive,
|
|
48
|
+
locale,
|
|
49
|
+
}),
|
|
50
|
+
progress: { ...input.progress, onFetchStart: undefined },
|
|
51
|
+
signal: input.signal,
|
|
52
|
+
});
|
|
53
|
+
reportExistingFiles(result, logger, locale);
|
|
54
|
+
await finishMobile(input, "attach", projectDir, settings, plan);
|
|
55
|
+
return result;
|
|
56
|
+
}
|
|
57
|
+
finally {
|
|
58
|
+
await provider.cleanup().catch(() => { });
|
|
59
|
+
}
|
|
60
|
+
};
|