@intra-mart/accel 0.1.0-dev-20260420
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/assets/assets.tar.gz +0 -0
- package/dist/asset/default-source.d.ts +1 -0
- package/dist/asset/default-source.js +9 -0
- package/dist/asset/deployer.d.ts +14 -0
- package/dist/asset/deployer.js +109 -0
- package/dist/asset/file-provider.d.ts +2 -0
- package/dist/asset/file-provider.js +25 -0
- package/dist/asset/local-provider.d.ts +2 -0
- package/dist/asset/local-provider.js +45 -0
- package/dist/asset/regex-replacement.d.ts +2 -0
- package/dist/asset/regex-replacement.js +12 -0
- package/dist/asset/types.d.ts +1 -0
- package/dist/asset/types.js +1 -0
- package/dist/asset/walker.d.ts +10 -0
- package/dist/asset/walker.js +165 -0
- package/dist/commands/attach.d.ts +64 -0
- package/dist/commands/attach.js +163 -0
- package/dist/commands/detach.d.ts +1 -0
- package/dist/commands/detach.js +74 -0
- package/dist/commands/init.d.ts +70 -0
- package/dist/commands/init.js +178 -0
- package/dist/core/condition-evaluator.d.ts +2 -0
- package/dist/core/condition-evaluator.js +26 -0
- package/dist/core/constants.d.ts +11 -0
- package/dist/core/constants.js +30 -0
- package/dist/core/module-map.d.ts +7 -0
- package/dist/core/module-map.js +12 -0
- package/dist/core/types.d.ts +100 -0
- package/dist/core/types.js +8 -0
- package/dist/core/variable-interpolator.d.ts +10 -0
- package/dist/core/variable-interpolator.js +37 -0
- package/dist/core/version-map.d.ts +7 -0
- package/dist/core/version-map.js +45 -0
- package/dist/i18n/en.d.ts +1 -0
- package/dist/i18n/en.js +47 -0
- package/dist/i18n/index.d.ts +2 -0
- package/dist/i18n/index.js +19 -0
- package/dist/i18n/ja.d.ts +1 -0
- package/dist/i18n/ja.js +47 -0
- package/dist/i18n/zh_CN.d.ts +1 -0
- package/dist/i18n/zh_CN.js +47 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +18 -0
- package/dist/interactive/agent-detect.d.ts +8 -0
- package/dist/interactive/agent-detect.js +31 -0
- package/dist/interactive/prompts.d.ts +22 -0
- package/dist/interactive/prompts.js +226 -0
- package/dist/juggling/extractor.d.ts +4 -0
- package/dist/juggling/extractor.js +15 -0
- package/dist/juggling/parser.d.ts +13 -0
- package/dist/juggling/parser.js +66 -0
- package/dist/markdown/processor.d.ts +3 -0
- package/dist/markdown/processor.js +16 -0
- package/dist/markdown/section-replacement.d.ts +2 -0
- package/dist/markdown/section-replacement.js +68 -0
- package/dist/markdown/text-replacement.d.ts +8 -0
- package/dist/markdown/text-replacement.js +32 -0
- package/dist/utils/archive.d.ts +3 -0
- package/dist/utils/archive.js +20 -0
- package/dist/utils/hash.d.ts +1 -0
- package/dist/utils/hash.js +6 -0
- package/dist/utils/locale-detect.d.ts +2 -0
- package/dist/utils/locale-detect.js +35 -0
- package/dist/utils/settings-io.d.ts +7 -0
- package/dist/utils/settings-io.js +54 -0
- package/package.json +60 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { defineCommand } from "citty";
|
|
2
|
+
import * as p from "@clack/prompts";
|
|
3
|
+
import { readFile, rm, unlink, stat } from "node:fs/promises";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import { readSettings, readHashsum } from "../utils/settings-io.js";
|
|
6
|
+
import { computeSha1 } from "../utils/hash.js";
|
|
7
|
+
import { getMessage } from "../i18n/index.js";
|
|
8
|
+
import { detectLocale } from "../utils/locale-detect.js";
|
|
9
|
+
export const detachCommand = defineCommand({
|
|
10
|
+
meta: {
|
|
11
|
+
name: "detach",
|
|
12
|
+
description: "Detach Accel CLI from this project",
|
|
13
|
+
},
|
|
14
|
+
args: {},
|
|
15
|
+
run: async () => {
|
|
16
|
+
const projectDir = process.cwd();
|
|
17
|
+
const locale = detectLocale();
|
|
18
|
+
// Check .accel exists
|
|
19
|
+
try {
|
|
20
|
+
await stat(join(projectDir, ".accel"));
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
p.log.error(getMessage("error.accelNotFound", locale));
|
|
24
|
+
process.exit(1);
|
|
25
|
+
}
|
|
26
|
+
const settings = await readSettings(projectDir);
|
|
27
|
+
const effectiveLocale = settings.locale ?? locale;
|
|
28
|
+
const hashEntries = await readHashsum(projectDir);
|
|
29
|
+
p.intro("Accel CLI - detach");
|
|
30
|
+
const confirmed = await p.confirm({
|
|
31
|
+
message: getMessage("detach.confirm", effectiveLocale),
|
|
32
|
+
initialValue: false,
|
|
33
|
+
});
|
|
34
|
+
if (p.isCancel(confirmed) || !confirmed) {
|
|
35
|
+
p.log.info(getMessage("detach.cancelled", effectiveLocale));
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
let skipped = 0;
|
|
39
|
+
let deleted = 0;
|
|
40
|
+
for (const entry of hashEntries) {
|
|
41
|
+
const filePath = join(projectDir, entry.filePath);
|
|
42
|
+
try {
|
|
43
|
+
const content = await readFile(filePath, "utf-8");
|
|
44
|
+
const currentHash = computeSha1(content);
|
|
45
|
+
if (currentHash === entry.sha1) {
|
|
46
|
+
await unlink(filePath);
|
|
47
|
+
p.log.success(getMessage("detach.deleted", effectiveLocale, {
|
|
48
|
+
path: entry.filePath,
|
|
49
|
+
}));
|
|
50
|
+
deleted++;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
p.log.warning(getMessage("detach.skipped", effectiveLocale, {
|
|
54
|
+
path: entry.filePath,
|
|
55
|
+
}));
|
|
56
|
+
skipped++;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
// File doesn't exist — already removed
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
// Delete .accel directory
|
|
64
|
+
await rm(join(projectDir, ".accel"), { recursive: true, force: true });
|
|
65
|
+
if (skipped > 0) {
|
|
66
|
+
p.outro(getMessage("detach.complete", effectiveLocale, {
|
|
67
|
+
skipped: String(skipped),
|
|
68
|
+
}));
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
p.outro(getMessage("detach.completeAll", effectiveLocale));
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
});
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export declare const initCommand: import("citty").CommandDef<{
|
|
2
|
+
name: {
|
|
3
|
+
type: "positional";
|
|
4
|
+
description: string;
|
|
5
|
+
required: false;
|
|
6
|
+
};
|
|
7
|
+
"juggling-project": {
|
|
8
|
+
type: "string";
|
|
9
|
+
description: string;
|
|
10
|
+
};
|
|
11
|
+
"accelplatform-version": {
|
|
12
|
+
type: "string";
|
|
13
|
+
description: string;
|
|
14
|
+
};
|
|
15
|
+
module: {
|
|
16
|
+
type: "string";
|
|
17
|
+
description: string;
|
|
18
|
+
};
|
|
19
|
+
group: {
|
|
20
|
+
type: "string";
|
|
21
|
+
description: string;
|
|
22
|
+
};
|
|
23
|
+
"project-version": {
|
|
24
|
+
type: "string";
|
|
25
|
+
description: string;
|
|
26
|
+
};
|
|
27
|
+
description: {
|
|
28
|
+
type: "string";
|
|
29
|
+
description: string;
|
|
30
|
+
};
|
|
31
|
+
database: {
|
|
32
|
+
type: "string";
|
|
33
|
+
description: string;
|
|
34
|
+
};
|
|
35
|
+
javascript: {
|
|
36
|
+
type: "boolean";
|
|
37
|
+
description: string;
|
|
38
|
+
};
|
|
39
|
+
agent: {
|
|
40
|
+
type: "string";
|
|
41
|
+
description: string;
|
|
42
|
+
};
|
|
43
|
+
locale: {
|
|
44
|
+
type: "string";
|
|
45
|
+
description: string;
|
|
46
|
+
};
|
|
47
|
+
"git-init": {
|
|
48
|
+
type: "boolean";
|
|
49
|
+
description: string;
|
|
50
|
+
default: true;
|
|
51
|
+
};
|
|
52
|
+
"skip-install": {
|
|
53
|
+
type: "boolean";
|
|
54
|
+
description: string;
|
|
55
|
+
default: false;
|
|
56
|
+
};
|
|
57
|
+
"non-interactive": {
|
|
58
|
+
type: "boolean";
|
|
59
|
+
description: string;
|
|
60
|
+
default: false;
|
|
61
|
+
};
|
|
62
|
+
"asset-source": {
|
|
63
|
+
type: "string";
|
|
64
|
+
description: string;
|
|
65
|
+
};
|
|
66
|
+
"asset-server-url": {
|
|
67
|
+
type: "string";
|
|
68
|
+
description: string;
|
|
69
|
+
};
|
|
70
|
+
}>;
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { defineCommand } from "citty";
|
|
2
|
+
import * as p from "@clack/prompts";
|
|
3
|
+
import { mkdir, stat } from "node:fs/promises";
|
|
4
|
+
import { execSync } from "node:child_process";
|
|
5
|
+
import { resolve } from "node:path";
|
|
6
|
+
import { CLI_VERSION } from "../core/constants.js";
|
|
7
|
+
import { runPrompts } from "../interactive/prompts.js";
|
|
8
|
+
import { deployAssets } from "../asset/deployer.js";
|
|
9
|
+
import { createLocalAssetProvider } from "../asset/local-provider.js";
|
|
10
|
+
import { createFileAssetProvider } from "../asset/file-provider.js";
|
|
11
|
+
import { defaultAssetSourcePath } from "../asset/default-source.js";
|
|
12
|
+
import { getMessage } from "../i18n/index.js";
|
|
13
|
+
import { detectLocale } from "../utils/locale-detect.js";
|
|
14
|
+
export const initCommand = defineCommand({
|
|
15
|
+
meta: {
|
|
16
|
+
name: "init",
|
|
17
|
+
description: "Initialize a new Accel project",
|
|
18
|
+
},
|
|
19
|
+
args: {
|
|
20
|
+
name: {
|
|
21
|
+
type: "positional",
|
|
22
|
+
description: "Project name (directory name)",
|
|
23
|
+
required: false,
|
|
24
|
+
},
|
|
25
|
+
"juggling-project": {
|
|
26
|
+
type: "string",
|
|
27
|
+
description: "Path to IM-Juggling project",
|
|
28
|
+
},
|
|
29
|
+
"accelplatform-version": {
|
|
30
|
+
type: "string",
|
|
31
|
+
description: "iAP version (e.g., 2026-Spring)",
|
|
32
|
+
},
|
|
33
|
+
module: {
|
|
34
|
+
type: "string",
|
|
35
|
+
description: "Modules to use (comma-separated)",
|
|
36
|
+
},
|
|
37
|
+
group: {
|
|
38
|
+
type: "string",
|
|
39
|
+
description: "Group name",
|
|
40
|
+
},
|
|
41
|
+
"project-version": {
|
|
42
|
+
type: "string",
|
|
43
|
+
description: "Project version",
|
|
44
|
+
},
|
|
45
|
+
description: {
|
|
46
|
+
type: "string",
|
|
47
|
+
description: "Project description",
|
|
48
|
+
},
|
|
49
|
+
database: {
|
|
50
|
+
type: "string",
|
|
51
|
+
description: "Database type",
|
|
52
|
+
},
|
|
53
|
+
javascript: {
|
|
54
|
+
type: "boolean",
|
|
55
|
+
description: "Use JavaScript",
|
|
56
|
+
},
|
|
57
|
+
agent: {
|
|
58
|
+
type: "string",
|
|
59
|
+
description: "Agent type",
|
|
60
|
+
},
|
|
61
|
+
locale: {
|
|
62
|
+
type: "string",
|
|
63
|
+
description: "Locale (ja, en, zh_CN)",
|
|
64
|
+
},
|
|
65
|
+
"git-init": {
|
|
66
|
+
type: "boolean",
|
|
67
|
+
description: "Initialize git repository (use --no-git-init to disable)",
|
|
68
|
+
default: true,
|
|
69
|
+
},
|
|
70
|
+
"skip-install": {
|
|
71
|
+
type: "boolean",
|
|
72
|
+
description: "Skip dependency installation",
|
|
73
|
+
default: false,
|
|
74
|
+
},
|
|
75
|
+
"non-interactive": {
|
|
76
|
+
type: "boolean",
|
|
77
|
+
description: "Non-interactive mode",
|
|
78
|
+
default: false,
|
|
79
|
+
},
|
|
80
|
+
"asset-source": {
|
|
81
|
+
type: "string",
|
|
82
|
+
description: "Local asset source path (tar archive or extracted directory). Defaults to the bundled assets/assets.tar.gz.",
|
|
83
|
+
},
|
|
84
|
+
"asset-server-url": {
|
|
85
|
+
type: "string",
|
|
86
|
+
description: "Asset server URL (takes precedence over --asset-source when explicitly set)",
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
run: async ({ args }) => {
|
|
90
|
+
const locale = args.locale ?? detectLocale();
|
|
91
|
+
const projectName = args.name;
|
|
92
|
+
// Parse module option (comma-separated or repeated)
|
|
93
|
+
const moduleArg = args.module;
|
|
94
|
+
const modules = moduleArg
|
|
95
|
+
? moduleArg.split(",").map((m) => m.trim())
|
|
96
|
+
: undefined;
|
|
97
|
+
const agentArg = args.agent;
|
|
98
|
+
const promptOpts = {
|
|
99
|
+
name: projectName,
|
|
100
|
+
jugglingProject: args["juggling-project"],
|
|
101
|
+
accelplatformVersion: args["accelplatform-version"],
|
|
102
|
+
module: modules,
|
|
103
|
+
group: args.group,
|
|
104
|
+
projectVersion: args["project-version"],
|
|
105
|
+
description: args.description,
|
|
106
|
+
database: args.database,
|
|
107
|
+
javascript: args.javascript,
|
|
108
|
+
agent: agentArg
|
|
109
|
+
? agentArg.split(",").map((a) => a.trim())
|
|
110
|
+
: undefined,
|
|
111
|
+
locale,
|
|
112
|
+
withGit: args["git-init"],
|
|
113
|
+
noInteraction: args["non-interactive"],
|
|
114
|
+
isInit: true,
|
|
115
|
+
};
|
|
116
|
+
let resolved;
|
|
117
|
+
try {
|
|
118
|
+
resolved = await runPrompts(promptOpts);
|
|
119
|
+
}
|
|
120
|
+
catch (err) {
|
|
121
|
+
p.log.error(err instanceof Error ? err.message : String(err));
|
|
122
|
+
process.exit(1);
|
|
123
|
+
}
|
|
124
|
+
// Resolve final project directory from interactive result and create it
|
|
125
|
+
const projectDir = resolve(process.cwd(), resolved.name);
|
|
126
|
+
try {
|
|
127
|
+
await stat(projectDir);
|
|
128
|
+
p.log.error(getMessage("error.directoryExists", locale, { path: projectDir }));
|
|
129
|
+
process.exit(1);
|
|
130
|
+
}
|
|
131
|
+
catch {
|
|
132
|
+
// Directory doesn't exist — good
|
|
133
|
+
}
|
|
134
|
+
await mkdir(projectDir, { recursive: true });
|
|
135
|
+
// Build settings
|
|
136
|
+
const settings = {
|
|
137
|
+
cliVersion: CLI_VERSION,
|
|
138
|
+
createdAt: new Date().toISOString(),
|
|
139
|
+
name: resolved.name,
|
|
140
|
+
group: resolved.group,
|
|
141
|
+
projectVersion: resolved.projectVersion,
|
|
142
|
+
description: resolved.description,
|
|
143
|
+
accelplatformVersion: resolved.accelplatformVersion,
|
|
144
|
+
modules: resolved.modules,
|
|
145
|
+
database: resolved.database,
|
|
146
|
+
agents: resolved.agents,
|
|
147
|
+
javascript: resolved.javascript,
|
|
148
|
+
locale: resolved.locale,
|
|
149
|
+
jugglingProject: resolved.jugglingProject,
|
|
150
|
+
deployedAssets: {},
|
|
151
|
+
};
|
|
152
|
+
// Deploy assets
|
|
153
|
+
const serverUrl = args["asset-server-url"];
|
|
154
|
+
const assetSource = args["asset-source"] ?? defaultAssetSourcePath();
|
|
155
|
+
const provider = serverUrl
|
|
156
|
+
? createLocalAssetProvider(serverUrl)
|
|
157
|
+
: createFileAssetProvider(assetSource);
|
|
158
|
+
p.log.info(getMessage("progress.deploying", locale));
|
|
159
|
+
await deployAssets({
|
|
160
|
+
projectDir,
|
|
161
|
+
settings,
|
|
162
|
+
provider,
|
|
163
|
+
noInstall: args["skip-install"],
|
|
164
|
+
});
|
|
165
|
+
// Git init
|
|
166
|
+
if (resolved.withGit) {
|
|
167
|
+
try {
|
|
168
|
+
execSync("which git", { stdio: "pipe" });
|
|
169
|
+
p.log.info(getMessage("progress.gitInit", locale));
|
|
170
|
+
execSync("git init", { cwd: projectDir, stdio: "pipe" });
|
|
171
|
+
}
|
|
172
|
+
catch {
|
|
173
|
+
p.log.warning(getMessage("warning.gitNotFound", locale));
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
p.log.success(getMessage("progress.complete", locale));
|
|
177
|
+
},
|
|
178
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { satisfies } from "semver";
|
|
2
|
+
import { isAndCondition, isOrCondition, isVersionCondition, isModuleCondition, isLocaleCondition, isAgentCondition, } from "./types.js";
|
|
3
|
+
export const evaluateCondition = (condition, context) => {
|
|
4
|
+
if (condition === undefined) {
|
|
5
|
+
return true;
|
|
6
|
+
}
|
|
7
|
+
if (isAndCondition(condition)) {
|
|
8
|
+
return condition.and.every((c) => evaluateCondition(c, context));
|
|
9
|
+
}
|
|
10
|
+
if (isOrCondition(condition)) {
|
|
11
|
+
return condition.or.some((c) => evaluateCondition(c, context));
|
|
12
|
+
}
|
|
13
|
+
if (isVersionCondition(condition)) {
|
|
14
|
+
return satisfies(context.version, condition.version);
|
|
15
|
+
}
|
|
16
|
+
if (isModuleCondition(condition)) {
|
|
17
|
+
return context.modules.includes(condition.module);
|
|
18
|
+
}
|
|
19
|
+
if (isLocaleCondition(condition)) {
|
|
20
|
+
return context.locale === condition.locale;
|
|
21
|
+
}
|
|
22
|
+
if (isAgentCondition(condition)) {
|
|
23
|
+
return context.agents.includes(condition.agent);
|
|
24
|
+
}
|
|
25
|
+
return false;
|
|
26
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { AccelSettings } from "./types.js";
|
|
2
|
+
export declare const CLI_VERSION = "0.1.0";
|
|
3
|
+
export declare const DATABASE_OPTIONS: readonly ["postgresql", "oracle", "sqlserver"];
|
|
4
|
+
export type DatabaseOption = (typeof DATABASE_OPTIONS)[number];
|
|
5
|
+
export declare const AGENT_OPTIONS: readonly ["claude-code", "github-copilot"];
|
|
6
|
+
export type AgentOption = (typeof AGENT_OPTIONS)[number];
|
|
7
|
+
export declare const MODULE_OPTIONS: readonly ["workflow", "bpm", "copilot", "imbox", "pdfd", "kaiden"];
|
|
8
|
+
export type ModuleOption = (typeof MODULE_OPTIONS)[number];
|
|
9
|
+
export declare const LOCALE_OPTIONS: readonly ["ja", "en", "zh_CN"];
|
|
10
|
+
export type LocaleOption = (typeof LOCALE_OPTIONS)[number];
|
|
11
|
+
export declare const DEFAULT_SETTINGS: Omit<AccelSettings, "cliVersion" | "createdAt" | "deployedAssets">;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export const CLI_VERSION = "0.1.0";
|
|
2
|
+
// --- Database options ---
|
|
3
|
+
export const DATABASE_OPTIONS = ["postgresql", "oracle", "sqlserver"];
|
|
4
|
+
// --- Agent options ---
|
|
5
|
+
export const AGENT_OPTIONS = ["claude-code", "github-copilot"];
|
|
6
|
+
// --- Module options ---
|
|
7
|
+
export const MODULE_OPTIONS = [
|
|
8
|
+
"workflow",
|
|
9
|
+
"bpm",
|
|
10
|
+
"copilot",
|
|
11
|
+
"imbox",
|
|
12
|
+
"pdfd",
|
|
13
|
+
"kaiden",
|
|
14
|
+
];
|
|
15
|
+
// --- Locale options ---
|
|
16
|
+
export const LOCALE_OPTIONS = ["ja", "en", "zh_CN"];
|
|
17
|
+
// --- Default settings ---
|
|
18
|
+
export const DEFAULT_SETTINGS = {
|
|
19
|
+
name: "my-accel-project",
|
|
20
|
+
group: "my-group",
|
|
21
|
+
projectVersion: "0.1.0",
|
|
22
|
+
description: "",
|
|
23
|
+
accelplatformVersion: "2026-Spring",
|
|
24
|
+
modules: [],
|
|
25
|
+
database: "postgresql",
|
|
26
|
+
agents: ["claude-code", "github-copilot"],
|
|
27
|
+
javascript: false,
|
|
28
|
+
locale: "ja",
|
|
29
|
+
jugglingProject: null,
|
|
30
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mapping from CLI module names to juggling.im XML module IDs.
|
|
3
|
+
* This map will be extended as more modules are added.
|
|
4
|
+
*/
|
|
5
|
+
export declare const MODULE_ID_MAP: Record<string, string>;
|
|
6
|
+
export declare const xmlIdToModuleName: (xmlId: string) => string | undefined;
|
|
7
|
+
export declare const moduleNameToXmlId: (moduleName: string) => string | undefined;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mapping from CLI module names to juggling.im XML module IDs.
|
|
3
|
+
* This map will be extended as more modules are added.
|
|
4
|
+
*/
|
|
5
|
+
export const MODULE_ID_MAP = {
|
|
6
|
+
workflow: "jp.co.intra_mart.im_workflow",
|
|
7
|
+
copilot: "jp.co.intra_mart.im_copilot",
|
|
8
|
+
// TODO: Add mappings for bpm, imbox, pdfd, kaiden
|
|
9
|
+
};
|
|
10
|
+
const reverseMap = new Map(Object.entries(MODULE_ID_MAP).map(([key, value]) => [value, key]));
|
|
11
|
+
export const xmlIdToModuleName = (xmlId) => reverseMap.get(xmlId);
|
|
12
|
+
export const moduleNameToXmlId = (moduleName) => MODULE_ID_MAP[moduleName];
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
export type AndCondition = {
|
|
2
|
+
and: Condition[];
|
|
3
|
+
};
|
|
4
|
+
export type OrCondition = {
|
|
5
|
+
or: Condition[];
|
|
6
|
+
};
|
|
7
|
+
export type VersionCondition = {
|
|
8
|
+
version: string;
|
|
9
|
+
};
|
|
10
|
+
export type ModuleCondition = {
|
|
11
|
+
module: string;
|
|
12
|
+
};
|
|
13
|
+
export type LocaleCondition = {
|
|
14
|
+
locale: string;
|
|
15
|
+
};
|
|
16
|
+
export type AgentCondition = {
|
|
17
|
+
agent: string;
|
|
18
|
+
};
|
|
19
|
+
export type LeafCondition = VersionCondition | ModuleCondition | LocaleCondition | AgentCondition;
|
|
20
|
+
export type Condition = AndCondition | OrCondition | LeafCondition;
|
|
21
|
+
export type TextReplacement = {
|
|
22
|
+
type: "text";
|
|
23
|
+
target: string;
|
|
24
|
+
values: {
|
|
25
|
+
condition: Condition;
|
|
26
|
+
value: string;
|
|
27
|
+
}[];
|
|
28
|
+
};
|
|
29
|
+
export type SectionReplacement = {
|
|
30
|
+
type: "section";
|
|
31
|
+
heading: string;
|
|
32
|
+
condition: Condition;
|
|
33
|
+
};
|
|
34
|
+
export type RegexReplacement = {
|
|
35
|
+
type: "regex";
|
|
36
|
+
pattern: string;
|
|
37
|
+
replacement: string;
|
|
38
|
+
condition: Condition;
|
|
39
|
+
};
|
|
40
|
+
export type Replacement = TextReplacement | SectionReplacement | RegexReplacement;
|
|
41
|
+
export type RenameRule = {
|
|
42
|
+
condition: Condition;
|
|
43
|
+
from: string;
|
|
44
|
+
to: string;
|
|
45
|
+
};
|
|
46
|
+
export type MetaJson = {
|
|
47
|
+
version: string;
|
|
48
|
+
type: "file" | "directory";
|
|
49
|
+
conditions?: Condition;
|
|
50
|
+
rename?: RenameRule[];
|
|
51
|
+
replacements?: Replacement[];
|
|
52
|
+
};
|
|
53
|
+
export type IapVersion = {
|
|
54
|
+
semver: string;
|
|
55
|
+
label: string;
|
|
56
|
+
codename: string;
|
|
57
|
+
};
|
|
58
|
+
export type AccelSettings = {
|
|
59
|
+
cliVersion: string;
|
|
60
|
+
createdAt: string;
|
|
61
|
+
name: string;
|
|
62
|
+
group: string;
|
|
63
|
+
projectVersion: string;
|
|
64
|
+
description: string;
|
|
65
|
+
accelplatformVersion: string;
|
|
66
|
+
modules: string[];
|
|
67
|
+
database: string;
|
|
68
|
+
agents: string[];
|
|
69
|
+
javascript: boolean;
|
|
70
|
+
locale: string;
|
|
71
|
+
jugglingProject: string | null;
|
|
72
|
+
deployedAssets: Record<string, string>;
|
|
73
|
+
};
|
|
74
|
+
export type HashsumEntry = {
|
|
75
|
+
filePath: string;
|
|
76
|
+
version: string;
|
|
77
|
+
sha1: string;
|
|
78
|
+
};
|
|
79
|
+
export type AssetProvider = {
|
|
80
|
+
fetch: () => Promise<string>;
|
|
81
|
+
cleanup: () => Promise<void>;
|
|
82
|
+
};
|
|
83
|
+
export type EvalContext = {
|
|
84
|
+
version: string;
|
|
85
|
+
modules: string[];
|
|
86
|
+
locale: string;
|
|
87
|
+
agents: string[];
|
|
88
|
+
name: string;
|
|
89
|
+
group: string;
|
|
90
|
+
description: string;
|
|
91
|
+
accelplatformVersion: string;
|
|
92
|
+
database: string;
|
|
93
|
+
projectVersion: string;
|
|
94
|
+
};
|
|
95
|
+
export declare const isAndCondition: (c: Condition) => c is AndCondition;
|
|
96
|
+
export declare const isOrCondition: (c: Condition) => c is OrCondition;
|
|
97
|
+
export declare const isVersionCondition: (c: Condition) => c is VersionCondition;
|
|
98
|
+
export declare const isModuleCondition: (c: Condition) => c is ModuleCondition;
|
|
99
|
+
export declare const isLocaleCondition: (c: Condition) => c is LocaleCondition;
|
|
100
|
+
export declare const isAgentCondition: (c: Condition) => c is AgentCondition;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// --- Condition types ---
|
|
2
|
+
// --- Condition type guards ---
|
|
3
|
+
export const isAndCondition = (c) => "and" in c;
|
|
4
|
+
export const isOrCondition = (c) => "or" in c;
|
|
5
|
+
export const isVersionCondition = (c) => "version" in c && !("and" in c) && !("or" in c);
|
|
6
|
+
export const isModuleCondition = (c) => "module" in c;
|
|
7
|
+
export const isLocaleCondition = (c) => "locale" in c;
|
|
8
|
+
export const isAgentCondition = (c) => "agent" in c;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { EvalContext } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Interpolate {{$variable}} placeholders in a string using EvalContext values.
|
|
4
|
+
*
|
|
5
|
+
* - Known variables are replaced with their EvalContext value (empty string if value is "").
|
|
6
|
+
* - Unknown variables (not in the allowlist) are left unchanged.
|
|
7
|
+
* - Array-type fields (modules, agents) are not available as variables.
|
|
8
|
+
* - No recursive expansion: if a variable's value contains {{$...}}, it is NOT re-expanded.
|
|
9
|
+
*/
|
|
10
|
+
export declare const interpolateVariables: (template: string, context: EvalContext) => string;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Allowlist of variable names that can be interpolated.
|
|
3
|
+
* Maps {{$varName}} to the corresponding EvalContext field.
|
|
4
|
+
* Array fields (modules, agents) are deliberately excluded.
|
|
5
|
+
*/
|
|
6
|
+
const VARIABLE_MAP = new Map([
|
|
7
|
+
["name", "name"],
|
|
8
|
+
["group", "group"],
|
|
9
|
+
["description", "description"],
|
|
10
|
+
["version", "version"],
|
|
11
|
+
["accelplatformVersion", "accelplatformVersion"],
|
|
12
|
+
["locale", "locale"],
|
|
13
|
+
["database", "database"],
|
|
14
|
+
["projectVersion", "projectVersion"],
|
|
15
|
+
]);
|
|
16
|
+
const INTERPOLATION_PATTERN = /\{\{\$(\w+)\}\}/g;
|
|
17
|
+
/**
|
|
18
|
+
* Interpolate {{$variable}} placeholders in a string using EvalContext values.
|
|
19
|
+
*
|
|
20
|
+
* - Known variables are replaced with their EvalContext value (empty string if value is "").
|
|
21
|
+
* - Unknown variables (not in the allowlist) are left unchanged.
|
|
22
|
+
* - Array-type fields (modules, agents) are not available as variables.
|
|
23
|
+
* - No recursive expansion: if a variable's value contains {{$...}}, it is NOT re-expanded.
|
|
24
|
+
*/
|
|
25
|
+
export const interpolateVariables = (template, context) => {
|
|
26
|
+
return template.replace(INTERPOLATION_PATTERN, (match, varName) => {
|
|
27
|
+
const field = VARIABLE_MAP.get(varName);
|
|
28
|
+
if (field === undefined) {
|
|
29
|
+
return match;
|
|
30
|
+
}
|
|
31
|
+
const value = context[field];
|
|
32
|
+
if (typeof value !== "string") {
|
|
33
|
+
return match;
|
|
34
|
+
}
|
|
35
|
+
return value;
|
|
36
|
+
});
|
|
37
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { IapVersion } from "./types.js";
|
|
2
|
+
export declare const IAP_VERSIONS: readonly IapVersion[];
|
|
3
|
+
export declare const SELECTABLE_VERSIONS: readonly IapVersion[];
|
|
4
|
+
export declare const labelToSemver: (label: string) => string;
|
|
5
|
+
export declare const semverToLabel: (semver: string) => string;
|
|
6
|
+
export declare const findByLabel: (label: string) => IapVersion | undefined;
|
|
7
|
+
export declare const findBySemver: (semver: string) => IapVersion | undefined;
|
|
@@ -0,0 +1,45 @@
|
|
|
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
|
+
{ semver: "8.0.37", label: "2025-Spring", codename: "Kamille" },
|
|
21
|
+
{ semver: "8.0.38", label: "2025-Autumn", codename: "Lilac" },
|
|
22
|
+
{ semver: "8.0.39", label: "2026-Spring", codename: "Mimosa" },
|
|
23
|
+
];
|
|
24
|
+
export const SELECTABLE_VERSIONS = IAP_VERSIONS.filter((v) => {
|
|
25
|
+
const minor = parseInt(v.semver.split(".")[2], 10);
|
|
26
|
+
return minor >= 35; // 2024-Spring (8.0.35) and later
|
|
27
|
+
});
|
|
28
|
+
const labelToVersionMap = new Map(IAP_VERSIONS.map((v) => [v.label, v]));
|
|
29
|
+
const semverToVersionMap = new Map(IAP_VERSIONS.map((v) => [v.semver, v]));
|
|
30
|
+
export const labelToSemver = (label) => {
|
|
31
|
+
const version = labelToVersionMap.get(label);
|
|
32
|
+
if (!version) {
|
|
33
|
+
throw new Error(`Unknown iAP version label: ${label}`);
|
|
34
|
+
}
|
|
35
|
+
return version.semver;
|
|
36
|
+
};
|
|
37
|
+
export const semverToLabel = (semver) => {
|
|
38
|
+
const version = semverToVersionMap.get(semver);
|
|
39
|
+
if (!version) {
|
|
40
|
+
throw new Error(`Unknown iAP semver: ${semver}`);
|
|
41
|
+
}
|
|
42
|
+
return version.label;
|
|
43
|
+
};
|
|
44
|
+
export const findByLabel = (label) => labelToVersionMap.get(label);
|
|
45
|
+
export const findBySemver = (semver) => semverToVersionMap.get(semver);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const messages: Record<string, string>;
|