@intra-mart/accel 0.4.0 → 0.5.0-dev.202608030656

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.
@@ -0,0 +1,74 @@
1
+ import { rm } from "node:fs/promises";
2
+ import { defineCommand } from "citty";
3
+ import * as p from "@clack/prompts";
4
+ import { cacheReposDir, directorySize, listCacheRepos, resolveCacheRoot, } from "../git/object-cache.js";
5
+ import { getMessage } from "../i18n/index.js";
6
+ import { detectLocale } from "../utils/locale-detect.js";
7
+ import { sanitizeDisplayText } from "../utils/sanitize-text.js";
8
+ const formatBytes = (bytes) => {
9
+ if (bytes >= 1024 ** 3)
10
+ return `${(bytes / 1024 ** 3).toFixed(1)} GB`;
11
+ if (bytes >= 1024 ** 2)
12
+ return `${(bytes / 1024 ** 2).toFixed(1)} MB`;
13
+ if (bytes >= 1024)
14
+ return `${(bytes / 1024).toFixed(1)} KB`;
15
+ return `${bytes} B`;
16
+ };
17
+ const infoCommand = defineCommand({
18
+ meta: {
19
+ name: "info",
20
+ description: "Show the asset cache location and disk usage",
21
+ },
22
+ run: async () => {
23
+ const locale = detectLocale();
24
+ const root = resolveCacheRoot();
25
+ let dirLine = getMessage("cache.info.dir", locale, { path: root });
26
+ if (process.env["ACCEL_CACHE_DIR"]) {
27
+ dirLine += ` ${getMessage("cache.info.overridden", locale)}`;
28
+ }
29
+ p.log.info(dirLine);
30
+ const repos = await listCacheRepos(root);
31
+ if (repos.length === 0) {
32
+ p.log.info(getMessage("cache.info.empty", locale));
33
+ return;
34
+ }
35
+ const total = repos.reduce((sum, repo) => sum + repo.size, 0);
36
+ p.log.info(getMessage("cache.info.total", locale, { size: formatBytes(total) }));
37
+ for (const repo of repos) {
38
+ p.log.info(` ${sanitizeDisplayText(repo.url ?? repo.dir)} — ${formatBytes(repo.size)}`);
39
+ }
40
+ },
41
+ });
42
+ const clearCommand = defineCommand({
43
+ meta: {
44
+ name: "clear",
45
+ description: "Delete the asset cache (it will be re-downloaded on demand)",
46
+ },
47
+ run: async () => {
48
+ const locale = detectLocale();
49
+ const reposDir = cacheReposDir(resolveCacheRoot());
50
+ try {
51
+ const size = await directorySize(reposDir);
52
+ if (size === 0) {
53
+ p.log.info(getMessage("cache.clear.empty", locale));
54
+ return;
55
+ }
56
+ await rm(reposDir, { recursive: true, force: true });
57
+ p.log.success(getMessage("cache.clear.done", locale, { size: formatBytes(size) }));
58
+ }
59
+ catch (err) {
60
+ p.log.error(err instanceof Error ? err.message : String(err));
61
+ process.exit(1);
62
+ }
63
+ },
64
+ });
65
+ export const cacheCommand = defineCommand({
66
+ meta: {
67
+ name: "cache",
68
+ description: "Manage the persistent asset object cache",
69
+ },
70
+ subCommands: {
71
+ info: infoCommand,
72
+ clear: clearCommand,
73
+ },
74
+ });
@@ -0,0 +1,24 @@
1
+ export declare const switchCommand: import("citty").CommandDef<{
2
+ module: {
3
+ type: "string";
4
+ description: string;
5
+ };
6
+ feature: {
7
+ type: "string";
8
+ description: string;
9
+ };
10
+ agent: {
11
+ type: "string";
12
+ description: string;
13
+ };
14
+ "non-interactive": {
15
+ type: "boolean";
16
+ description: string;
17
+ default: false;
18
+ };
19
+ "skip-install": {
20
+ type: "boolean";
21
+ description: string;
22
+ default: false;
23
+ };
24
+ }>;
@@ -0,0 +1,203 @@
1
+ import { defineCommand } from "citty";
2
+ import * as p from "@clack/prompts";
3
+ import { CLI_VERSION } from "../core/constants.js";
4
+ import { findReleaseById } from "../core/catalog.js";
5
+ import { collectSettingsErrors, printIntro, promptAgents, promptFeatures, promptModules, } from "../interactive/prompts.js";
6
+ import { createGitAssetProvider } from "../asset/git-provider.js";
7
+ import { applyUpdateActions, buildRenderedPlan, buildUpdatedRecords, classifySwitch, collectFileStates, } from "../asset/updater.js";
8
+ import { createMessageCollector } from "../asset/messages.js";
9
+ import { printAssetMessages } from "../interactive/asset-messages.js";
10
+ import { installTriggerChanged, runInstallBuild } from "../asset/installer.js";
11
+ import { readSettingsSafe, readHashsum, writeSettings, writeHashsum, } from "../utils/settings-io.js";
12
+ import { getMessage } from "../i18n/index.js";
13
+ import { detectLocale } from "../utils/locale-detect.js";
14
+ import { printSummary } from "../interactive/summary.js";
15
+ import { buildProgressCallbacks } from "../interactive/progress.js";
16
+ const shortSha = (sha) => sha.slice(0, 7);
17
+ const SKIP_MESSAGE_KEYS = {
18
+ edited: "switch.result.skippedEdited",
19
+ deleted: "switch.result.skippedDeleted",
20
+ "out-of-scope": "switch.result.skippedOutOfScope",
21
+ unmanaged: "switch.result.skippedUnmanaged",
22
+ };
23
+ const printSwitchResult = (summary, actions, locale) => {
24
+ const lines = [
25
+ [summary.updated, "switch.result.updated"],
26
+ [summary.added, "switch.result.added"],
27
+ [summary.adopted, "switch.result.adopted"],
28
+ [summary.deleted, "switch.result.deleted"],
29
+ ];
30
+ for (const [paths, key] of lines) {
31
+ for (const path of paths) {
32
+ p.log.info(getMessage(key, locale, { path }));
33
+ }
34
+ }
35
+ for (const action of actions) {
36
+ if (action.outcome !== "skipped-switch" || !action.skipReason)
37
+ continue;
38
+ p.log.info(getMessage(SKIP_MESSAGE_KEYS[action.skipReason], locale, {
39
+ path: action.relativePath,
40
+ }));
41
+ }
42
+ const changedCount = summary.updated.length +
43
+ summary.added.length +
44
+ summary.adopted.length +
45
+ summary.deleted.length;
46
+ if (changedCount === 0 && summary.skippedSwitch.length === 0) {
47
+ p.log.success(getMessage("switch.upToDate", locale));
48
+ }
49
+ else {
50
+ p.log.success(getMessage("switch.complete", locale, {
51
+ updated: String(summary.updated.length),
52
+ added: String(summary.added.length),
53
+ deleted: String(summary.deleted.length),
54
+ }));
55
+ }
56
+ if (summary.skippedSwitch.length > 0) {
57
+ const list = summary.skippedSwitch.map((c) => ` - ${c}`).join("\n");
58
+ p.log.warning(`${getMessage("switch.skippedSummary", locale, {
59
+ count: String(summary.skippedSwitch.length),
60
+ })}\n${list}`);
61
+ }
62
+ };
63
+ export const switchCommand = defineCommand({
64
+ meta: {
65
+ name: "switch",
66
+ description: "Switch the deployed asset configuration (modules / features / agents) without downloading",
67
+ },
68
+ args: {
69
+ module: {
70
+ type: "string",
71
+ description: "Modules to use (comma-separated artifactIds, e.g., im_workflow)",
72
+ },
73
+ feature: {
74
+ type: "string",
75
+ description: "Features to use (comma-separated function ids, e.g., jssp)",
76
+ },
77
+ agent: {
78
+ type: "string",
79
+ description: "Agent type",
80
+ },
81
+ "non-interactive": {
82
+ type: "boolean",
83
+ description: "Non-interactive mode",
84
+ default: false,
85
+ },
86
+ "skip-install": {
87
+ type: "boolean",
88
+ description: "Skip install / build even when dependency files changed",
89
+ default: false,
90
+ },
91
+ },
92
+ run: async ({ args }) => {
93
+ const projectDir = process.cwd();
94
+ let locale = detectLocale();
95
+ const settings = await readSettingsSafe(projectDir);
96
+ if (!settings) {
97
+ p.log.error(getMessage("error.accelNotFound", locale));
98
+ process.exit(1);
99
+ }
100
+ locale = settings.locale ?? locale;
101
+ const assetSource = settings.assetSource;
102
+ if (!assetSource) {
103
+ p.log.error(getMessage("switch.error.legacyProject", locale));
104
+ process.exit(1);
105
+ }
106
+ if (assetSource.type !== "git" || !assetSource.commit || !assetSource.ref) {
107
+ p.log.error(getMessage("switch.error.notGitSource", locale));
108
+ process.exit(1);
109
+ }
110
+ const source = {
111
+ ...assetSource,
112
+ commit: assetSource.commit,
113
+ ref: assetSource.ref,
114
+ };
115
+ const isInteractive = !args["non-interactive"];
116
+ const cliOnlyOpts = {
117
+ module: args.module
118
+ ?.split(",")
119
+ .map((m) => m.trim()),
120
+ feature: args.feature
121
+ ?.split(",")
122
+ .map((f) => f.trim()),
123
+ agent: args.agent
124
+ ?.split(",")
125
+ .map((a) => a.trim()),
126
+ locale,
127
+ isInit: false,
128
+ };
129
+ const cliErrors = collectSettingsErrors(cliOnlyOpts, locale, settings.accelplatformVersion.label);
130
+ if (cliErrors.length > 0) {
131
+ p.log.error(cliErrors.join("\n"));
132
+ process.exit(1);
133
+ }
134
+ let modules = cliOnlyOpts.module ?? settings.modules;
135
+ let features = cliOnlyOpts.feature ?? settings.features ?? [];
136
+ let agents = cliOnlyOpts.agent ?? settings.agents;
137
+ if (isInteractive) {
138
+ printIntro("switch", locale);
139
+ const release = findReleaseById(settings.accelplatformVersion.label);
140
+ if (!release) {
141
+ p.log.error(getMessage("error.invalidVersion", locale, {
142
+ version: settings.accelplatformVersion.label,
143
+ }));
144
+ process.exit(1);
145
+ }
146
+ modules = await promptModules(release, modules, locale);
147
+ features = await promptFeatures(release, features, locale);
148
+ agents = await promptAgents(agents, locale);
149
+ }
150
+ const newSettings = {
151
+ ...settings,
152
+ cliVersion: CLI_VERSION,
153
+ modules,
154
+ features,
155
+ agents,
156
+ };
157
+ if (isInteractive) {
158
+ printSummary(newSettings, projectDir, locale);
159
+ const ok = await p.confirm({
160
+ message: getMessage("switch.confirmApply", locale),
161
+ });
162
+ if (p.isCancel(ok) || ok !== true) {
163
+ p.log.info(getMessage("switch.cancelled", locale));
164
+ process.exit(0);
165
+ }
166
+ }
167
+ const provider = createGitAssetProvider(source.url, source.ref, { locale });
168
+ try {
169
+ p.log.info(getMessage("switch.progress", locale, { sha: shortSha(source.commit) }));
170
+ const tree = await provider.openCommit(source.commit);
171
+ const messageCollector = createMessageCollector();
172
+ const theirsPlan = await buildRenderedPlan(tree, newSettings, tree.materialize, messageCollector.collect);
173
+ const basePlan = await buildRenderedPlan(tree, settings, tree.materialize);
174
+ const oldHashsum = await readHashsum(projectDir);
175
+ const states = await collectFileStates(projectDir, basePlan, theirsPlan, oldHashsum);
176
+ const actions = classifySwitch(states);
177
+ const summary = await applyUpdateActions(projectDir, actions);
178
+ const { hashEntries, deployedAssets } = buildUpdatedRecords(oldHashsum, actions);
179
+ await writeSettings(projectDir, { ...newSettings, deployedAssets });
180
+ await writeHashsum(projectDir, hashEntries);
181
+ printAssetMessages(messageCollector.drain());
182
+ const skipInstall = args["skip-install"];
183
+ const changedPaths = actions
184
+ .filter((a) => a.op !== "none")
185
+ .map((a) => a.relativePath);
186
+ if (!skipInstall && installTriggerChanged(changedPaths)) {
187
+ const { success } = runInstallBuild(projectDir, newSettings.packageManager, buildProgressCallbacks(locale));
188
+ if (!success && summary.skippedSwitch.length > 0) {
189
+ const list = summary.skippedSwitch.map((c) => ` - ${c}`).join("\n");
190
+ p.log.warning(`${getMessage("switch.installFailedHint", locale)}\n${list}`);
191
+ }
192
+ }
193
+ printSwitchResult(summary, actions, locale);
194
+ }
195
+ catch (err) {
196
+ p.log.error(err instanceof Error ? err.message : String(err));
197
+ process.exit(1);
198
+ }
199
+ finally {
200
+ await provider.cleanup().catch(() => { });
201
+ }
202
+ },
203
+ });
@@ -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-08-01-release";
12
+ export declare const DEFAULT_ASSET_REF = "experiment";
13
13
  export declare const DEFAULT_SETTINGS: Omit<AccelSettings, "cliVersion" | "createdAt" | "deployedAssets" | "assetSource">;
@@ -11,7 +11,7 @@ export const PACKAGE_MANAGER_OPTIONS = [
11
11
  "pnpm",
12
12
  ];
13
13
  export const DEFAULT_ASSET_REPO_URL = "https://github.com/accelplatform/skills";
14
- export const DEFAULT_ASSET_REF = "2026-08-01-release";
14
+ export const DEFAULT_ASSET_REF = "experiment";
15
15
  export const DEFAULT_SETTINGS = {
16
16
  name: "my-accel-project",
17
17
  artifactId: "",
@@ -0,0 +1,12 @@
1
+ export declare const normalizeRepoUrl: (url: string) => string;
2
+ export declare const resolveCacheRoot: (env?: NodeJS.ProcessEnv) => string;
3
+ export declare const cacheReposDir: (cacheRoot: string) => string;
4
+ export declare const repoStoreDir: (cacheRoot: string, repoUrl: string) => string;
5
+ export declare const ensureUrlSidecar: (storeDir: string, repoUrl: string) => Promise<void>;
6
+ export type CacheRepoEntry = {
7
+ dir: string;
8
+ url: string | null;
9
+ size: number;
10
+ };
11
+ export declare const directorySize: (dir: string) => Promise<number>;
12
+ export declare const listCacheRepos: (cacheRoot: string) => Promise<CacheRepoEntry[]>;
@@ -0,0 +1,95 @@
1
+ import { randomBytes } from "node:crypto";
2
+ import { lstat, mkdir, readdir, readFile, rename, stat, writeFile, } from "node:fs/promises";
3
+ import { homedir } from "node:os";
4
+ import { join, resolve } from "node:path";
5
+ import { computeSha256 } from "../utils/hash.js";
6
+ const REPOS_DIR = "repos";
7
+ const URL_SIDECAR = "url";
8
+ const STORE_KEY_PATTERN = /^[0-9a-f]{16}$/;
9
+ export const normalizeRepoUrl = (url) => {
10
+ let normalized = url.replace(/\/+$/, "").replace(/\.git$/, "");
11
+ try {
12
+ const parsed = new URL(normalized);
13
+ if (parsed.username || parsed.password) {
14
+ parsed.username = "";
15
+ parsed.password = "";
16
+ normalized = parsed.toString().replace(/\/+$/, "");
17
+ }
18
+ }
19
+ catch {
20
+ }
21
+ return normalized;
22
+ };
23
+ export const resolveCacheRoot = (env = process.env) => {
24
+ const override = env["ACCEL_CACHE_DIR"];
25
+ if (override && override.trim() !== "")
26
+ return resolve(override);
27
+ return join(homedir(), ".accel", "cache");
28
+ };
29
+ export const cacheReposDir = (cacheRoot) => join(cacheRoot, REPOS_DIR);
30
+ export const repoStoreDir = (cacheRoot, repoUrl) => join(cacheReposDir(cacheRoot), computeSha256(normalizeRepoUrl(repoUrl)).slice(0, 16));
31
+ export const ensureUrlSidecar = async (storeDir, repoUrl) => {
32
+ const target = join(storeDir, URL_SIDECAR);
33
+ try {
34
+ await stat(target);
35
+ return;
36
+ }
37
+ catch {
38
+ }
39
+ await mkdir(storeDir, { recursive: true, mode: 0o700 });
40
+ const tmp = `${target}.tmp-${randomBytes(4).toString("hex")}`;
41
+ await writeFile(tmp, normalizeRepoUrl(repoUrl) + "\n", "utf-8");
42
+ await rename(tmp, target);
43
+ };
44
+ export const directorySize = async (dir) => {
45
+ let entries;
46
+ try {
47
+ entries = await readdir(dir, { recursive: true, withFileTypes: true });
48
+ }
49
+ catch {
50
+ return 0;
51
+ }
52
+ let total = 0;
53
+ for (const entry of entries) {
54
+ if (!entry.isFile())
55
+ continue;
56
+ try {
57
+ total += (await stat(join(entry.parentPath, entry.name))).size;
58
+ }
59
+ catch {
60
+ }
61
+ }
62
+ return total;
63
+ };
64
+ export const listCacheRepos = async (cacheRoot) => {
65
+ const reposDir = cacheReposDir(cacheRoot);
66
+ let names;
67
+ try {
68
+ names = await readdir(reposDir);
69
+ }
70
+ catch {
71
+ return [];
72
+ }
73
+ const entries = [];
74
+ for (const name of names.sort()) {
75
+ if (!STORE_KEY_PATTERN.test(name))
76
+ continue;
77
+ const dir = join(reposDir, name);
78
+ try {
79
+ if (!(await lstat(dir)).isDirectory())
80
+ continue;
81
+ }
82
+ catch {
83
+ continue;
84
+ }
85
+ let url = null;
86
+ try {
87
+ url = (await readFile(join(dir, URL_SIDECAR), "utf-8")).trim() || null;
88
+ }
89
+ catch {
90
+ url = null;
91
+ }
92
+ entries.push({ dir, url, size: await directorySize(dir) });
93
+ }
94
+ return entries;
95
+ };
@@ -12,4 +12,6 @@ export type ObjectStore = {
12
12
  hasObject: (oid: string) => boolean;
13
13
  cleanup: () => Promise<void>;
14
14
  };
15
- export declare const createObjectStore: () => Promise<ObjectStore>;
15
+ export declare const createObjectStore: (options?: {
16
+ dir?: string;
17
+ }) => Promise<ObjectStore>;
@@ -1,5 +1,6 @@
1
1
  import fs from "node:fs";
2
- import { mkdtemp, mkdir, rm, writeFile } from "node:fs/promises";
2
+ import { randomBytes } from "node:crypto";
3
+ import { mkdtemp, mkdir, readdir, readFile, rename, rm, writeFile, } from "node:fs/promises";
3
4
  import { tmpdir } from "node:os";
4
5
  import { join } from "node:path";
5
6
  import git, { Errors } from "isomorphic-git";
@@ -8,13 +9,38 @@ const topSegmentOf = (filepath) => {
8
9
  const slash = filepath.indexOf("/");
9
10
  return slash === -1 ? filepath : filepath.slice(0, slash);
10
11
  };
11
- export const createObjectStore = async () => {
12
- const dir = await mkdtemp(join(tmpdir(), "accel-assets-"));
13
- await git.init({ fs, dir, defaultBranch: "main" });
14
- await mkdir(join(dir, ".git", "objects", "pack"), { recursive: true });
12
+ export const createObjectStore = async (options = {}) => {
13
+ const persistent = options.dir !== undefined;
14
+ const dir = options.dir ?? (await mkdtemp(join(tmpdir(), "accel-assets-")));
15
+ const packDir = join(dir, ".git", "objects", "pack");
16
+ if (persistent) {
17
+ await mkdir(dir, { recursive: true, mode: 0o700 });
18
+ }
19
+ if (!fs.existsSync(join(dir, ".git", "config"))) {
20
+ await git.init({ fs, dir, defaultBranch: "main" });
21
+ }
22
+ await mkdir(packDir, { recursive: true });
23
+ const storeUid = `${process.pid.toString(36)}-${randomBytes(4).toString("hex")}`;
24
+ let packSeq = 0;
15
25
  const cache = {};
16
26
  const indexByCommit = new Map();
17
27
  const knownOids = new Set();
28
+ if (persistent) {
29
+ const names = await readdir(packDir).catch(() => []);
30
+ for (const name of names) {
31
+ if (!name.endsWith(".oids"))
32
+ continue;
33
+ try {
34
+ const content = await readFile(join(packDir, name), "utf-8");
35
+ for (const line of content.split("\n")) {
36
+ if (line.length === 40)
37
+ knownOids.add(line);
38
+ }
39
+ }
40
+ catch {
41
+ }
42
+ }
43
+ }
18
44
  const indexOf = (commitOid) => {
19
45
  let index = indexByCommit.get(commitOid);
20
46
  if (!index) {
@@ -128,9 +154,21 @@ export const createObjectStore = async () => {
128
154
  return {
129
155
  dir,
130
156
  writePack: async (pack, label) => {
131
- const rel = join(".git", "objects", "pack", `pack-${label}.pack`);
132
- await writeFile(join(dir, rel), pack);
133
- const { oids } = await git.indexPack({ fs, dir, filepath: rel });
157
+ const name = `pack-${label}-${storeUid}-${packSeq++}`;
158
+ const stagingRel = join(".git", "objects", "accel-tmp", name);
159
+ const stagingDir = join(dir, stagingRel);
160
+ await mkdir(stagingDir, { recursive: true });
161
+ await writeFile(join(stagingDir, `${name}.pack`), pack);
162
+ const { oids } = await git.indexPack({
163
+ fs,
164
+ dir,
165
+ filepath: join(stagingRel, `${name}.pack`),
166
+ });
167
+ await writeFile(join(stagingDir, `${name}.oids`), oids.join("\n") + "\n", "utf-8");
168
+ for (const ext of [".pack", ".idx", ".oids"]) {
169
+ await rename(join(stagingDir, `${name}${ext}`), join(packDir, `${name}${ext}`));
170
+ }
171
+ await rm(stagingDir, { recursive: true, force: true }).catch(() => { });
134
172
  for (const oid of oids)
135
173
  knownOids.add(oid);
136
174
  },
@@ -155,7 +193,9 @@ export const createObjectStore = async () => {
155
193
  },
156
194
  hasObject: (oid) => knownOids.has(oid),
157
195
  cleanup: async () => {
158
- await rm(dir, { recursive: true, force: true }).catch(() => { });
196
+ if (!persistent) {
197
+ await rm(dir, { recursive: true, force: true }).catch(() => { });
198
+ }
159
199
  },
160
200
  };
161
201
  };
package/dist/i18n/en.js CHANGED
@@ -89,6 +89,30 @@ export const messages = {
89
89
  "update.result.redeployedWarn": "Redeployed: {path} (you had deleted it, but upstream changes could not be determined without the base commit)",
90
90
  "update.result.skippedEdited": "Kept: {path} (edited; skipped without applying upstream changes)",
91
91
  "update.fallback.skippedSummary": "Skipped {count} edited file(s) without applying upstream changes:",
92
+ "intro.switch": "Switches only the module / feature / agent configuration while keeping the recorded commit pinned.\nNo download occurs and repository-side updates are not pulled in.\nFiles you have edited are never modified.",
93
+ "switch.error.legacyProject": "This project was created with a CLI version that does not support switch.",
94
+ "switch.error.notGitSource": "Only projects deployed from a git source can be switched (this project was deployed from a local directory).",
95
+ "switch.confirmApply": "Switch assets with these settings?",
96
+ "switch.cancelled": "Switch cancelled.",
97
+ "switch.progress": "Switching assets... ({sha})",
98
+ "switch.result.updated": "Updated: {path}",
99
+ "switch.result.added": "Added: {path}",
100
+ "switch.result.deleted": "Deleted: {path} (out of configuration)",
101
+ "switch.result.adopted": "Adopted: {path}",
102
+ "switch.result.skippedEdited": "Skipped: {path} (edited by user)",
103
+ "switch.result.skippedDeleted": "Skipped: {path} (user deletion respected)",
104
+ "switch.result.skippedOutOfScope": "Skipped: {path} (out of configuration but edited, kept)",
105
+ "switch.result.skippedUnmanaged": "Skipped: {path} (unmanaged existing file kept)",
106
+ "switch.upToDate": "Nothing to change.",
107
+ "switch.complete": "Switch completed. Updated {updated}, added {added}, deleted {deleted} file(s).",
108
+ "switch.skippedSummary": "Skipped {count} edited file(s). The switch has not been applied to them:",
109
+ "switch.installFailedHint": "install / build failed. The skipped edited files may be incompatible with the new configuration.",
110
+ "cache.info.dir": "Cache directory: {path}",
111
+ "cache.info.overridden": "(overridden by the ACCEL_CACHE_DIR environment variable)",
112
+ "cache.info.total": "Total size: {size}",
113
+ "cache.info.empty": "The cache is empty.",
114
+ "cache.clear.done": "Cache cleared. Freed {size}.",
115
+ "cache.clear.empty": "There is no cache to clear.",
92
116
  "error.directoryExists": "Directory already exists: {path}",
93
117
  "error.accelExists": ".accel directory already exists",
94
118
  "error.accelNotFound": ".accel directory not found",
package/dist/i18n/ja.js CHANGED
@@ -89,6 +89,30 @@ export const messages = {
89
89
  "update.result.redeployedWarn": "再配置: {path} (ユーザーが削除していましたが、上流変更の有無を判定できないため再配置しました)",
90
90
  "update.result.skippedEdited": "保持: {path} (編集済みのためスキップ。上流の変更は取り込まれていません)",
91
91
  "update.fallback.skippedSummary": "{count}件の編集済みファイルをスキップしました。上流の変更は取り込まれていません:",
92
+ "intro.switch": "記録されたコミットを固定したまま、モジュール・機能・エージェントの構成のみを切り替えます。\nリポジトリからのダウンロードは発生せず、リポジトリ側の更新も取り込みません。\nユーザーが編集したファイルには変更を加えません。",
93
+ "switch.error.legacyProject": "このプロジェクトは switch 未対応のCLIバージョンで作成されています。",
94
+ "switch.error.notGitSource": "gitソースから配備されたプロジェクトのみ switch できます(このプロジェクトはローカルディレクトリから配備されています)。",
95
+ "switch.confirmApply": "この設定で資材を切り替えますか?",
96
+ "switch.cancelled": "switchをキャンセルしました。",
97
+ "switch.progress": "資材を切り替えています... ({sha})",
98
+ "switch.result.updated": "更新: {path}",
99
+ "switch.result.added": "追加: {path}",
100
+ "switch.result.deleted": "削除: {path} (構成対象外)",
101
+ "switch.result.adopted": "取り込み: {path}",
102
+ "switch.result.skippedEdited": "スキップ: {path} (ユーザー編集あり)",
103
+ "switch.result.skippedDeleted": "スキップ: {path} (ユーザー削除を尊重)",
104
+ "switch.result.skippedOutOfScope": "スキップ: {path} (構成対象外だが編集済みのため保持)",
105
+ "switch.result.skippedUnmanaged": "スキップ: {path} (管理外の既存ファイルを保持)",
106
+ "switch.upToDate": "変更はありません。",
107
+ "switch.complete": "switchが完了しました。{updated}件を更新、{added}件を追加、{deleted}件を削除しました。",
108
+ "switch.skippedSummary": "{count}件の編集済みファイルをスキップしました。切り替えは適用されていません:",
109
+ "switch.installFailedHint": "install / build が失敗しました。スキップされた編集済みファイルが新しい構成と互換でない可能性があります。",
110
+ "cache.info.dir": "キャッシュディレクトリ: {path}",
111
+ "cache.info.overridden": "(環境変数 ACCEL_CACHE_DIR で上書きされています)",
112
+ "cache.info.total": "合計サイズ: {size}",
113
+ "cache.info.empty": "キャッシュは空です。",
114
+ "cache.clear.done": "キャッシュを削除しました。{size} を解放しました。",
115
+ "cache.clear.empty": "削除対象のキャッシュはありません。",
92
116
  "error.directoryExists": "ディレクトリが既に存在します: {path}",
93
117
  "error.accelExists": ".accelディレクトリが既に存在します",
94
118
  "error.accelNotFound": ".accelディレクトリが見つかりません",
@@ -89,6 +89,30 @@ export const messages = {
89
89
  "update.result.redeployedWarn": "重新部署: {path}(您已删除该文件,但由于缺少基准提交无法判定上游变更)",
90
90
  "update.result.skippedEdited": "保留: {path}(已编辑,跳过且未应用上游变更)",
91
91
  "update.fallback.skippedSummary": "已跳过{count}个已编辑的文件,未应用上游变更:",
92
+ "intro.switch": "在固定已记录提交的前提下,仅切换模块・功能・代理的配置。\n不会发生下载,也不会引入仓库端的更新。\n不会修改您编辑过的文件。",
93
+ "switch.error.legacyProject": "此项目由不支持 switch 的CLI版本创建。",
94
+ "switch.error.notGitSource": "仅可切换从git源部署的项目(此项目从本地目录部署)。",
95
+ "switch.confirmApply": "使用这些设置切换资源吗?",
96
+ "switch.cancelled": "切换已取消。",
97
+ "switch.progress": "正在切换资源... ({sha})",
98
+ "switch.result.updated": "更新: {path}",
99
+ "switch.result.added": "添加: {path}",
100
+ "switch.result.deleted": "删除: {path}(不在配置范围内)",
101
+ "switch.result.adopted": "纳入管理: {path}",
102
+ "switch.result.skippedEdited": "跳过: {path}(用户已编辑)",
103
+ "switch.result.skippedDeleted": "跳过: {path}(尊重用户删除)",
104
+ "switch.result.skippedOutOfScope": "跳过: {path}(不在配置范围内但已编辑,予以保留)",
105
+ "switch.result.skippedUnmanaged": "跳过: {path}(保留未管理的现有文件)",
106
+ "switch.upToDate": "没有变更。",
107
+ "switch.complete": "switch已完成。更新{updated}个、添加{added}个、删除{deleted}个文件。",
108
+ "switch.skippedSummary": "已跳过{count}个已编辑的文件。切换未应用于这些文件:",
109
+ "switch.installFailedHint": "install / build 失败。跳过的已编辑文件可能与新配置不兼容。",
110
+ "cache.info.dir": "缓存目录: {path}",
111
+ "cache.info.overridden": "(已被环境变量 ACCEL_CACHE_DIR 覆盖)",
112
+ "cache.info.total": "总大小: {size}",
113
+ "cache.info.empty": "缓存为空。",
114
+ "cache.clear.done": "缓存已删除。释放了 {size}。",
115
+ "cache.clear.empty": "没有可删除的缓存。",
92
116
  "error.directoryExists": "目录已存在: {path}",
93
117
  "error.accelExists": ".accel目录已存在",
94
118
  "error.accelNotFound": "未找到.accel目录",
package/dist/index.js CHANGED
@@ -4,6 +4,8 @@ import { initCommand } from "./commands/init.js";
4
4
  import { attachCommand } from "./commands/attach.js";
5
5
  import { detachCommand } from "./commands/detach.js";
6
6
  import { updateCommand } from "./commands/update.js";
7
+ import { switchCommand } from "./commands/switch.js";
8
+ import { cacheCommand } from "./commands/cache.js";
7
9
  import { loginCommand } from "./commands/login.js";
8
10
  import { deployCommand } from "./commands/deploy.js";
9
11
  import { CLI_VERSION } from "./core/constants.js";
@@ -18,6 +20,8 @@ const main = defineCommand({
18
20
  attach: attachCommand,
19
21
  detach: detachCommand,
20
22
  update: updateCommand,
23
+ switch: switchCommand,
24
+ cache: cacheCommand,
21
25
  login: loginCommand,
22
26
  deploy: deployCommand,
23
27
  },
@@ -31,5 +31,8 @@ export declare const validateNonInteractive: (opts: PromptOptions) => string[];
31
31
  export declare const validateCliValues: (opts: PromptOptions, validators: Validators) => void;
32
32
  export declare const validateCatalogValues: (opts: PromptOptions, release: Release, locale: string) => void;
33
33
  export declare const collectSettingsErrors: (opts: PromptOptions, locale: string, releaseIdFallback?: string) => string[];
34
- export declare const printIntro: (mode: "init" | "attach" | "update", locale: string) => void;
34
+ export declare const printIntro: (mode: "init" | "attach" | "update" | "switch", locale: string) => void;
35
+ export declare const promptModules: (release: Release, initialValues: string[], locale: string) => Promise<string[]>;
36
+ export declare const promptFeatures: (release: Release, initialValues: string[] | undefined, locale: string) => Promise<string[]>;
37
+ export declare const promptAgents: (initialValues: string[] | undefined, locale: string) => Promise<string[]>;
35
38
  export declare const runPrompts: (opts: PromptOptions) => Promise<ResolvedOptions>;