@intra-mart/accel 0.4.0-dev.202607270235 → 0.4.0-rc.202607300434
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 +2 -2
- package/dist/asset/deployer.d.ts +2 -0
- package/dist/asset/deployer.js +7 -1
- package/dist/asset/messages.d.ts +11 -0
- package/dist/asset/messages.js +29 -0
- package/dist/asset/updater.d.ts +2 -1
- package/dist/asset/updater.js +2 -2
- package/dist/asset/walker.d.ts +2 -1
- package/dist/asset/walker.js +7 -4
- package/dist/commands/update.js +5 -1
- package/dist/core/constants.d.ts +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/types.d.ts +7 -0
- package/dist/interactive/asset-messages.d.ts +3 -0
- package/dist/interactive/asset-messages.js +15 -0
- package/dist/interactive/progress.js +2 -0
- package/dist/utils/sanitize-text.d.ts +2 -0
- package/dist/utils/sanitize-text.js +11 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -68,7 +68,7 @@ accel init my-project \
|
|
|
68
68
|
| `--no-git-init` | boolean | git initをスキップ | `false`(git initする) |
|
|
69
69
|
| `--skip-install` | boolean | 依存インストールをスキップ | `false` |
|
|
70
70
|
| `--asset-server-url` | string | 資材を取得するgitリポジトリのURL(HTTP(S) のみ。デフォルトの取得先を上書き) | `https://github.com/accelplatform/skills` |
|
|
71
|
-
| `--asset-ref` | string | 資材リポジトリから取得するブランチ/タグ | `
|
|
71
|
+
| `--asset-ref` | string | 資材リポジトリから取得するブランチ/タグ | `2026-08-01-release` |
|
|
72
72
|
|
|
73
73
|
### `accel attach`
|
|
74
74
|
|
|
@@ -109,7 +109,7 @@ accel attach --non-interactive --accelplatform-version 2026-spring
|
|
|
109
109
|
| `--non-interactive` | boolean | 非対話モード | `false` |
|
|
110
110
|
| `--skip-install` | boolean | 依存インストールをスキップ | `false` |
|
|
111
111
|
| `--asset-server-url` | string | 資材を取得するgitリポジトリのURL(HTTP(S) のみ。デフォルトの取得先を上書き) | `https://github.com/accelplatform/skills` |
|
|
112
|
-
| `--asset-ref` | string | 資材リポジトリから取得するブランチ/タグ | `
|
|
112
|
+
| `--asset-ref` | string | 資材リポジトリから取得するブランチ/タグ | `2026-08-01-release` |
|
|
113
113
|
|
|
114
114
|
### `accel update`
|
|
115
115
|
|
package/dist/asset/deployer.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { AssetProvider, AccelSettings, HashsumEntry } from "../core/types.js";
|
|
2
|
+
import { type AssetMessage } from "./messages.js";
|
|
2
3
|
export { getInstallCmds } from "./installer.js";
|
|
3
4
|
export type OverwriteDecision = "overwrite" | "skip";
|
|
4
5
|
export type ExistingFileHandler = (relativePath: string) => Promise<OverwriteDecision>;
|
|
@@ -6,6 +7,7 @@ export type ProgressCallbacks = {
|
|
|
6
7
|
onFetchStart?: () => void;
|
|
7
8
|
onDownloadStart?: () => void;
|
|
8
9
|
onSectionDeploy?: (section: string, files: string[]) => void;
|
|
10
|
+
onMessages?: (messages: AssetMessage[]) => void;
|
|
9
11
|
onInstallStart?: (command: string) => void;
|
|
10
12
|
onBuildStart?: (command: string) => void;
|
|
11
13
|
};
|
package/dist/asset/deployer.js
CHANGED
|
@@ -2,6 +2,7 @@ import { writeFile, mkdir, stat } from "node:fs/promises";
|
|
|
2
2
|
import { join, dirname, resolve, sep } from "node:path";
|
|
3
3
|
import { buildEvalContext } from "../core/eval-context.js";
|
|
4
4
|
import { walkAssetRepo } from "./walker.js";
|
|
5
|
+
import { createMessageCollector } from "./messages.js";
|
|
5
6
|
import { renderAssetContent } from "./renderer.js";
|
|
6
7
|
import { runInstallBuild } from "./installer.js";
|
|
7
8
|
import { computeSha1 } from "../utils/hash.js";
|
|
@@ -66,7 +67,8 @@ export const deployAssets = async (options) => {
|
|
|
66
67
|
};
|
|
67
68
|
const semver = settings.accelplatformVersion.semver;
|
|
68
69
|
const context = buildEvalContext(settings);
|
|
69
|
-
const
|
|
70
|
+
const messageCollector = createMessageCollector();
|
|
71
|
+
const allEntries = await walkAssetRepo(tree, semver, context, messageCollector.collect);
|
|
70
72
|
const entries = allEntries.filter((entry) => {
|
|
71
73
|
if (!isWithinDir(projectDir, join(projectDir, entry.relativePath))) {
|
|
72
74
|
console.warn(`Warning: skipping asset with path escaping project directory: ${entry.relativePath}`);
|
|
@@ -134,6 +136,10 @@ export const deployAssets = async (options) => {
|
|
|
134
136
|
};
|
|
135
137
|
await writeSettings(projectDir, updatedSettings);
|
|
136
138
|
await writeHashsum(projectDir, hashEntries);
|
|
139
|
+
const assetMessages = messageCollector.drain();
|
|
140
|
+
if (assetMessages.length > 0) {
|
|
141
|
+
progress?.onMessages?.(assetMessages);
|
|
142
|
+
}
|
|
137
143
|
if (!noInstall) {
|
|
138
144
|
runInstallBuild(projectDir, settings.packageManager, progress);
|
|
139
145
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { EvalContext, Message, MessageLevel } from "../core/types.js";
|
|
2
|
+
export type AssetMessage = {
|
|
3
|
+
level: MessageLevel;
|
|
4
|
+
text: string;
|
|
5
|
+
};
|
|
6
|
+
export type MessageSink = (messages: Message[], context: EvalContext) => void;
|
|
7
|
+
export type MessageCollector = {
|
|
8
|
+
collect: MessageSink;
|
|
9
|
+
drain: () => AssetMessage[];
|
|
10
|
+
};
|
|
11
|
+
export declare const createMessageCollector: () => MessageCollector;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { evaluateCondition } from "../core/condition-evaluator.js";
|
|
2
|
+
import { interpolateVariables } from "../core/variable-interpolator.js";
|
|
3
|
+
export const createMessageCollector = () => {
|
|
4
|
+
const collected = [];
|
|
5
|
+
const seen = new Set();
|
|
6
|
+
const collect = (messages, context) => {
|
|
7
|
+
if (!Array.isArray(messages))
|
|
8
|
+
return;
|
|
9
|
+
for (const message of messages) {
|
|
10
|
+
if (typeof message?.text !== "string")
|
|
11
|
+
continue;
|
|
12
|
+
const { condition } = message;
|
|
13
|
+
if (condition != null) {
|
|
14
|
+
if (typeof condition !== "object")
|
|
15
|
+
continue;
|
|
16
|
+
if (!evaluateCondition(condition, context))
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
const level = message.level === "warn" ? "warn" : "info";
|
|
20
|
+
const text = interpolateVariables(message.text, context);
|
|
21
|
+
const key = `${level}\n${text}`;
|
|
22
|
+
if (seen.has(key))
|
|
23
|
+
continue;
|
|
24
|
+
seen.add(key);
|
|
25
|
+
collected.push({ level, text });
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
return { collect, drain: () => [...collected] };
|
|
29
|
+
};
|
package/dist/asset/updater.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AccelSettings, HashsumEntry } from "../core/types.js";
|
|
2
2
|
import type { AssetTree } from "./asset-tree.js";
|
|
3
|
+
import type { MessageSink } from "./messages.js";
|
|
3
4
|
import type { MergeFn } from "../utils/merge-file.js";
|
|
4
5
|
export type RenderedAsset = {
|
|
5
6
|
relativePath: string;
|
|
@@ -8,7 +9,7 @@ export type RenderedAsset = {
|
|
|
8
9
|
sha1: string;
|
|
9
10
|
};
|
|
10
11
|
export type RenderedPlan = Map<string, RenderedAsset>;
|
|
11
|
-
export declare const buildRenderedPlan: (tree: AssetTree, settings: AccelSettings, materialize?: (files: string[]) => Promise<void
|
|
12
|
+
export declare const buildRenderedPlan: (tree: AssetTree, settings: AccelSettings, materialize?: (files: string[]) => Promise<void>, collect?: MessageSink) => Promise<RenderedPlan>;
|
|
12
13
|
export type FileState = {
|
|
13
14
|
relativePath: string;
|
|
14
15
|
base: RenderedAsset | null;
|
package/dist/asset/updater.js
CHANGED
|
@@ -5,9 +5,9 @@ import { walkAssetRepo } from "./walker.js";
|
|
|
5
5
|
import { renderAssetContent } from "./renderer.js";
|
|
6
6
|
import { computeSha1 } from "../utils/hash.js";
|
|
7
7
|
const isSafeRelPath = (p) => !p.startsWith("/") && !p.split("/").includes("..");
|
|
8
|
-
export const buildRenderedPlan = async (tree, settings, materialize) => {
|
|
8
|
+
export const buildRenderedPlan = async (tree, settings, materialize, collect) => {
|
|
9
9
|
const context = buildEvalContext(settings);
|
|
10
|
-
const entries = await walkAssetRepo(tree, settings.accelplatformVersion.semver, context);
|
|
10
|
+
const entries = await walkAssetRepo(tree, settings.accelplatformVersion.semver, context, collect);
|
|
11
11
|
const safeEntries = entries.filter((entry) => {
|
|
12
12
|
if (!isSafeRelPath(entry.relativePath) || !isSafeRelPath(entry.sourceRelPath)) {
|
|
13
13
|
console.warn(`Warning: skipping asset with unsafe path: ${entry.relativePath} (source: ${entry.sourceRelPath})`);
|
package/dist/asset/walker.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { MetaJson, EvalContext } from "../core/types.js";
|
|
2
2
|
import type { AssetTree } from "./asset-tree.js";
|
|
3
|
+
import type { MessageSink } from "./messages.js";
|
|
3
4
|
export type AssetEntry = {
|
|
4
5
|
sourceRelPath: string;
|
|
5
6
|
relativePath: string;
|
|
6
7
|
meta: MetaJson | null;
|
|
7
8
|
};
|
|
8
9
|
export declare const walkAssetDir: (tree: AssetTree, context: EvalContext) => Promise<AssetEntry[]>;
|
|
9
|
-
export declare const walkAssetRepo: (tree: AssetTree, targetSemver: string, context: EvalContext) => Promise<AssetEntry[]>;
|
|
10
|
+
export declare const walkAssetRepo: (tree: AssetTree, targetSemver: string, context: EvalContext, collect?: MessageSink) => Promise<AssetEntry[]>;
|
package/dist/asset/walker.js
CHANGED
|
@@ -77,7 +77,7 @@ const findMatchingVersionDirs = async (tree, vtree, targetSemver) => {
|
|
|
77
77
|
}
|
|
78
78
|
return matched;
|
|
79
79
|
};
|
|
80
|
-
const walkDirectory = async (tree, vtree, dir, baseDir, parentMeta, context) => {
|
|
80
|
+
const walkDirectory = async (tree, vtree, dir, baseDir, parentMeta, context, collect) => {
|
|
81
81
|
const entries = [];
|
|
82
82
|
const node = vtree.get(dir);
|
|
83
83
|
if (!node)
|
|
@@ -89,6 +89,9 @@ const walkDirectory = async (tree, vtree, dir, baseDir, parentMeta, context) =>
|
|
|
89
89
|
return [];
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
|
+
if (collect && ownMeta?.messages) {
|
|
93
|
+
collect(ownMeta.messages, context);
|
|
94
|
+
}
|
|
92
95
|
const relativeOf = (p) => p === baseDir ? "" : baseDir === "" ? p : p.slice(baseDir.length + 1);
|
|
93
96
|
if (ownMeta?.type === "file") {
|
|
94
97
|
const parentRelative = relativeOf(dirnamePosix(dir));
|
|
@@ -122,7 +125,7 @@ const walkDirectory = async (tree, vtree, dir, baseDir, parentMeta, context) =>
|
|
|
122
125
|
}
|
|
123
126
|
const fullPath = joinPosix(dir, name);
|
|
124
127
|
if (node.subdirs.has(name)) {
|
|
125
|
-
const children = await walkDirectory(tree, vtree, fullPath, baseDir, effectiveMeta, context);
|
|
128
|
+
const children = await walkDirectory(tree, vtree, fullPath, baseDir, effectiveMeta, context, collect);
|
|
126
129
|
entries.push(...children);
|
|
127
130
|
}
|
|
128
131
|
else {
|
|
@@ -158,7 +161,7 @@ export const walkAssetDir = async (tree, context) => {
|
|
|
158
161
|
const entries = await walkDirectory(tree, vtree, "", "", meta, context);
|
|
159
162
|
return deduplicateByPath(entries);
|
|
160
163
|
};
|
|
161
|
-
export const walkAssetRepo = async (tree, targetSemver, context) => {
|
|
164
|
+
export const walkAssetRepo = async (tree, targetSemver, context, collect) => {
|
|
162
165
|
const rootFiles = await tree.listRootEntries();
|
|
163
166
|
const rootVtree = buildVirtualTree(rootFiles);
|
|
164
167
|
const versionDirs = await findMatchingVersionDirs(tree, rootVtree, targetSemver);
|
|
@@ -169,7 +172,7 @@ export const walkAssetRepo = async (tree, targetSemver, context) => {
|
|
|
169
172
|
const allEntries = [];
|
|
170
173
|
for (const versionDir of versionDirs) {
|
|
171
174
|
const meta = await readMetaJson(tree, vtree, versionDir);
|
|
172
|
-
const entries = await walkDirectory(tree, vtree, versionDir, versionDir, meta, context);
|
|
175
|
+
const entries = await walkDirectory(tree, vtree, versionDir, versionDir, meta, context, collect);
|
|
173
176
|
allEntries.push(...entries);
|
|
174
177
|
}
|
|
175
178
|
return deduplicateByPath(allEntries);
|
package/dist/commands/update.js
CHANGED
|
@@ -9,6 +9,8 @@ import { runPrompts, collectSettingsErrors, printIntro, } from "../interactive/p
|
|
|
9
9
|
import { withHint } from "../interactive/format.js";
|
|
10
10
|
import { createGitAssetProvider } from "../asset/git-provider.js";
|
|
11
11
|
import { buildRenderedPlan, collectFileStates, classifyAll, applyUpdateActions, buildUpdatedRecords, } from "../asset/updater.js";
|
|
12
|
+
import { createMessageCollector } from "../asset/messages.js";
|
|
13
|
+
import { printAssetMessages } from "../interactive/asset-messages.js";
|
|
12
14
|
import { mergeFile } from "../utils/merge-file.js";
|
|
13
15
|
import { getInstallCmds, runInstallBuild } from "../asset/installer.js";
|
|
14
16
|
import { readSettingsSafe, readHashsum, writeSettings, writeHashsum, } from "../utils/settings-io.js";
|
|
@@ -380,7 +382,8 @@ export const updateCommand = defineCommand({
|
|
|
380
382
|
from: shortSha(source.commit),
|
|
381
383
|
to: shortSha(newCommit),
|
|
382
384
|
}));
|
|
383
|
-
const
|
|
385
|
+
const messageCollector = createMessageCollector();
|
|
386
|
+
const theirsPlan = await buildRenderedPlan(provider.asTree(), newSettings, provider.materialize, messageCollector.collect);
|
|
384
387
|
let baseTree = null;
|
|
385
388
|
let baseError = null;
|
|
386
389
|
try {
|
|
@@ -425,6 +428,7 @@ export const updateCommand = defineCommand({
|
|
|
425
428
|
};
|
|
426
429
|
await writeSettings(projectDir, updatedSettings);
|
|
427
430
|
await writeHashsum(projectDir, hashEntries);
|
|
431
|
+
printAssetMessages(messageCollector.drain());
|
|
428
432
|
const skipInstall = args["skip-install"];
|
|
429
433
|
const hasConflicts = summary.conflicts.length > 0;
|
|
430
434
|
if (summary.changedFileCount > 0 && !hasConflicts && !skipInstall) {
|
package/dist/core/constants.d.ts
CHANGED
|
@@ -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 = "
|
|
12
|
+
export declare const DEFAULT_ASSET_REF = "2026-08-01-release";
|
|
13
13
|
export declare const DEFAULT_SETTINGS: Omit<AccelSettings, "cliVersion" | "createdAt" | "deployedAssets" | "assetSource">;
|
package/dist/core/constants.js
CHANGED
|
@@ -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 = "
|
|
14
|
+
export const DEFAULT_ASSET_REF = "2026-08-01-release";
|
|
15
15
|
export const DEFAULT_SETTINGS = {
|
|
16
16
|
name: "my-accel-project",
|
|
17
17
|
artifactId: "",
|
package/dist/core/types.d.ts
CHANGED
|
@@ -60,12 +60,19 @@ export type RenameRule = {
|
|
|
60
60
|
from: string;
|
|
61
61
|
to: string;
|
|
62
62
|
};
|
|
63
|
+
export type MessageLevel = "info" | "warn";
|
|
64
|
+
export type Message = {
|
|
65
|
+
condition?: Condition;
|
|
66
|
+
level?: MessageLevel;
|
|
67
|
+
text: string;
|
|
68
|
+
};
|
|
63
69
|
export type MetaJson = {
|
|
64
70
|
version: string;
|
|
65
71
|
type: "file" | "directory";
|
|
66
72
|
conditions?: Condition;
|
|
67
73
|
rename?: RenameRule[];
|
|
68
74
|
replacements?: Replacement[];
|
|
75
|
+
messages?: Message[];
|
|
69
76
|
};
|
|
70
77
|
export type AccelplatformVersion = {
|
|
71
78
|
label: string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as p from "@clack/prompts";
|
|
2
|
+
import { sanitizeDisplayText } from "../utils/sanitize-text.js";
|
|
3
|
+
export const buildAssetMessageLines = (messages) => messages
|
|
4
|
+
.map((m) => ({ level: m.level, text: sanitizeDisplayText(m.text) }))
|
|
5
|
+
.filter((m) => m.text !== "");
|
|
6
|
+
export const printAssetMessages = (messages) => {
|
|
7
|
+
for (const message of buildAssetMessageLines(messages)) {
|
|
8
|
+
if (message.level === "warn") {
|
|
9
|
+
p.log.warn(message.text);
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
p.log.info(message.text);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as p from "@clack/prompts";
|
|
2
2
|
import { ROOT_SECTION } from "../asset/deployer.js";
|
|
3
3
|
import { getMessage } from "../i18n/index.js";
|
|
4
|
+
import { printAssetMessages } from "./asset-messages.js";
|
|
4
5
|
const MAX_FILES_SHOWN = 3;
|
|
5
6
|
const formatFileList = (files) => {
|
|
6
7
|
if (files.length <= MAX_FILES_SHOWN)
|
|
@@ -17,6 +18,7 @@ export const buildProgressCallbacks = (locale) => ({
|
|
|
17
18
|
: "progress.deploying.section";
|
|
18
19
|
p.log.info(getMessage(key, locale, { section, files: filesStr }));
|
|
19
20
|
},
|
|
21
|
+
onMessages: (messages) => printAssetMessages(messages),
|
|
20
22
|
onInstallStart: (command) => p.log.info(getMessage("progress.installing", locale, { command })),
|
|
21
23
|
onBuildStart: (command) => p.log.info(getMessage("progress.building", locale, { command })),
|
|
22
24
|
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { stripVTControlCharacters } from "node:util";
|
|
2
|
+
export const MAX_DISPLAY_TEXT_LENGTH = 500;
|
|
3
|
+
export const sanitizeDisplayText = (input) => {
|
|
4
|
+
const stripped = stripVTControlCharacters(input);
|
|
5
|
+
const spaced = stripped.replace(/\r\n|[\n\t]/g, " ");
|
|
6
|
+
const cleaned = spaced.replace(/[\u0000-\u001f\u007f-\u009f]/g, "");
|
|
7
|
+
const codePoints = Array.from(cleaned);
|
|
8
|
+
if (codePoints.length <= MAX_DISPLAY_TEXT_LENGTH)
|
|
9
|
+
return cleaned;
|
|
10
|
+
return codePoints.slice(0, MAX_DISPLAY_TEXT_LENGTH).join("") + "...";
|
|
11
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intra-mart/accel",
|
|
3
|
-
"version": "0.4.0-
|
|
3
|
+
"version": "0.4.0-rc.202607300434",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "CLI tool for intra-mart Accel Platform development",
|
|
6
6
|
"author": "NTT DATA INTRAMART",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
},
|
|
17
17
|
"homepage": "http://oss.intra-mart.org",
|
|
18
18
|
"bin": {
|
|
19
|
-
"accel": "
|
|
19
|
+
"accel": "dist/index.js"
|
|
20
20
|
},
|
|
21
21
|
"files": [
|
|
22
22
|
"dist",
|