@rex0220/print-craft-authoring-tools 0.1.0 → 1.0.0
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/SECURITY.md +2 -2
- package/dist/cli.mjs +13 -11
- package/package.json +2 -2
package/SECURITY.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
## 脆弱性の報告
|
|
4
4
|
|
|
5
5
|
- GitHub リポジトリ [rex0220/print-craft-authoring](https://github.com/rex0220/print-craft-authoring) の **Security → Report a vulnerability**(非公開の報告)で知らせてください。公開の Issue には書かないでください
|
|
6
|
-
- 報告には、tools の版(`npx
|
|
6
|
+
- 報告には、tools の版(`npx @rex0220/print-craft-authoring-tools version`)、再現する設定 JSON(レコードの値と認証情報を除いたもの)、期待した動きを添えてください
|
|
7
7
|
- 対応するのは tools の最新の版です。修正は新しい版として npm と GitHub に出し、`tools/README.md` の履歴に書きます
|
|
8
8
|
|
|
9
9
|
## 範囲
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
## 前提(信頼の境界)
|
|
18
18
|
|
|
19
|
-
- テンプレートでは AI(Claude Code)が `npx
|
|
19
|
+
- テンプレートでは AI(Claude Code)が `npx @rex0220/print-craft-authoring-tools …` を確認なしに実行でき、`settings/` `fields/` `records/` `out/` `temp/` に書けます。AI は `.env` と `policy/` を書けません(`.claude/settings.json`)。tools はこの前提で、**AI が書けるファイルを認証情報・承認・実行コードとして読まない**ように作ってあります
|
|
20
20
|
- 利用者が置く印刷屋プラグインの zip の中のコード(計算式エンジン、設定画面・帳票のコード)は、tools を動かした **OS ユーザーと同じ権限の Node のプロセスで実行**されます。happy-dom の window は DOM の代用で、セキュリティの境界(sandbox)ではありません
|
|
21
21
|
|
|
22
22
|
## tools が守ること
|
package/dist/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
/*! @rex0220/print-craft-authoring-tools
|
|
2
|
+
/*! @rex0220/print-craft-authoring-tools 1.0.0 (c) rex0220. MIT License. 計算式エンジンと印刷屋のコードは利用者の印刷屋プラグインの zip から読む(このファイルには含まれない)。commit d662e0b. */
|
|
3
3
|
|
|
4
4
|
// src/cli.ts
|
|
5
5
|
import { existsSync as existsSync7, mkdirSync as mkdirSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
@@ -1529,7 +1529,7 @@ async function normalizeSettings(input) {
|
|
|
1529
1529
|
}
|
|
1530
1530
|
const model = buildModel(input.fields, api, input.baseUrl);
|
|
1531
1531
|
if (input.baseUrl && typeof input.fields.baseUrl === "string" && input.fields.baseUrl && model.fieldsBaseUrl !== input.baseUrl) {
|
|
1532
|
-
f.warning("fields.baseUrl", where, `fields の baseUrl(${input.fields.baseUrl.slice(0, 60)})が .env の KINTONE_BASE_URL と違う。iframe の判定は .env の接続先で行う。fields を取り直すなら npx
|
|
1532
|
+
f.warning("fields.baseUrl", where, `fields の baseUrl(${input.fields.baseUrl.slice(0, 60)})が .env の KINTONE_BASE_URL と違う。iframe の判定は .env の接続先で行う。fields を取り直すなら npx @rex0220/print-craft-authoring-tools fields --app ${input.fields.appId}`);
|
|
1533
1533
|
}
|
|
1534
1534
|
const body = deriveBody(JSON.parse(JSON.stringify(inputClean)), model, input.engine, f);
|
|
1535
1535
|
const policy = input.policy ?? { allowExternal: [] };
|
|
@@ -2256,7 +2256,8 @@ async function pullSettings(client2, engine, opt) {
|
|
|
2256
2256
|
return { envelope, appName: app.name, revision: String(res.revision ?? ""), format };
|
|
2257
2257
|
}
|
|
2258
2258
|
function defaultPullName(appName, appId) {
|
|
2259
|
-
|
|
2259
|
+
const name = safeFileName(appName, "");
|
|
2260
|
+
return name ? `APP${appId}-${name}.json` : `APP${appId}.json`;
|
|
2260
2261
|
}
|
|
2261
2262
|
|
|
2262
2263
|
// src/engine.ts
|
|
@@ -2544,7 +2545,7 @@ function devMeta() {
|
|
|
2544
2545
|
return { toolsVersion: pkg.version, supportedPluginVersions: SUPPORTED_PLUGIN_VERSIONS, supportedApiVersion: SUPPORTED_API_VERSION, commit: gitCommit(AUTHORING_ROOT), builtAt: "", mode: "dev" };
|
|
2545
2546
|
}
|
|
2546
2547
|
function toolsMeta() {
|
|
2547
|
-
if (true) return JSON.parse('{"toolsVersion":"
|
|
2548
|
+
if (true) return JSON.parse('{"toolsVersion":"1.0.0","supportedPluginVersions":["6"],"supportedApiVersion":1,"commit":"d662e0b","builtAt":"2026-10-06T05:47:45.315Z","mode":"build"}');
|
|
2548
2549
|
return devMeta();
|
|
2549
2550
|
}
|
|
2550
2551
|
|
|
@@ -2892,7 +2893,8 @@ async function runPreview(input) {
|
|
|
2892
2893
|
}
|
|
2893
2894
|
|
|
2894
2895
|
// src/cli.ts
|
|
2895
|
-
var USAGE = `使い方:
|
|
2896
|
+
var USAGE = `使い方: npx @rex0220/print-craft-authoring-tools <command> [options]
|
|
2897
|
+
(短い npx pcraft-authoring は使わない。npm ci の前だと npm の公開レジストリの同じ名前のパッケージを取りに行く)
|
|
2896
2898
|
|
|
2897
2899
|
version [--expect <印刷屋の版>] [--json]
|
|
2898
2900
|
tools の版と、印刷屋の zip から読んだプラグインの版・authoring API の版・計算式エンジンの SHA-256・設定スキーマの版。
|
|
@@ -2902,7 +2904,7 @@ var USAGE = `使い方: pcraft-authoring <command> [options]
|
|
|
2902
2904
|
fields --app N --summary
|
|
2903
2905
|
取得済みの fields/<N>.json を 1 項目 1 行で(レイアウトの順。型・ラベル・書式・単位・選択肢・ルックアップ)。通信しない。
|
|
2904
2906
|
pull --app N [--preview] [--guest <spaceId>] [--out settings/<file>] [--force] [--plugin-id <ID>]
|
|
2905
|
-
アプリに入っている印刷屋の今の設定を取って、設定画面の「設定をダウンロード」と同じ封筒形式で settings
|
|
2907
|
+
アプリに入っている印刷屋の今の設定を取って、設定画面の「設定をダウンロード」と同じ封筒形式で settings/APP<N>-<アプリ名>.json に保存(GET だけ)。
|
|
2906
2908
|
kintone の API ラボ「アプリに追加されているプラグインの設定情報を取得する」を有効にした環境だけ。権限は運用中の設定がレコード閲覧+追加、
|
|
2907
2909
|
--preview(動作テスト環境 = 保存して未反映の設定)がアプリ管理。プラグイン ID は印刷屋の zip から。既にあるファイルは --force で上書き。
|
|
2908
2910
|
record --app N --id R [--fields-from <settings.json>] [--guest <spaceId>] [--out records/<file>]
|
|
@@ -3053,7 +3055,7 @@ function appOf(args, ctx) {
|
|
|
3053
3055
|
}
|
|
3054
3056
|
function existingAppDir(ctx, appId) {
|
|
3055
3057
|
const dir = findAppDir(process.cwd(), ctx.env, appId);
|
|
3056
|
-
if (!dir) throw new InputError(`アプリ ${appId} のフォルダー(kintone/${ctx.env.host}/${appId}-…)が無い。先に npx
|
|
3058
|
+
if (!dir) throw new InputError(`アプリ ${appId} のフォルダー(kintone/${ctx.env.host}/${appId}-…)が無い。先に npx @rex0220/print-craft-authoring-tools fields --app ${appId}${envFlag(ctx)}`);
|
|
3057
3059
|
return dir;
|
|
3058
3060
|
}
|
|
3059
3061
|
function noOutInWorkspace(args, ctx) {
|
|
@@ -3061,7 +3063,7 @@ function noOutInWorkspace(args, ctx) {
|
|
|
3061
3063
|
}
|
|
3062
3064
|
function existingFile(rel, howToFetch) {
|
|
3063
3065
|
const file = resolveRead(rel);
|
|
3064
|
-
if (!existsSync7(file)) throw new InputError(`${shown(file)} が無い。先に npx
|
|
3066
|
+
if (!existsSync7(file)) throw new InputError(`${shown(file)} が無い。先に npx @rex0220/print-craft-authoring-tools ${howToFetch}`);
|
|
3065
3067
|
return file;
|
|
3066
3068
|
}
|
|
3067
3069
|
function folderDefaults(settingsFile) {
|
|
@@ -3134,7 +3136,7 @@ async function normalize(args) {
|
|
|
3134
3136
|
const fieldsFile = fieldsFileOf(args, folder);
|
|
3135
3137
|
const write = !flag(args, "dry-run");
|
|
3136
3138
|
if (write && folder && !option(args, "out") && SNAPSHOT_RE.test(path10.basename(settingsFile))) {
|
|
3137
|
-
throw new UsageError(`ダウンロード / pull のファイルは書き換えない。npx
|
|
3139
|
+
throw new UsageError(`ダウンロード / pull のファイルは書き換えない。npx @rex0220/print-craft-authoring-tools edit ${shown(settingsFile)} で -edit.json に写してから直す(検査だけなら --dry-run)`);
|
|
3138
3140
|
}
|
|
3139
3141
|
const out = write ? resolveWrite(option(args, "out") ?? settingsFile, WRITE_ROOTS.settings) : void 0;
|
|
3140
3142
|
const fieldsData = await readFieldsFile(fieldsFile);
|
|
@@ -3251,7 +3253,7 @@ async function edit(args) {
|
|
|
3251
3253
|
writeText(dest, readTextLimited(file));
|
|
3252
3254
|
console.log(`${shown(file)} → ${shown(dest)}(ここを直す。ダウンロードのファイルは書き換えない)`);
|
|
3253
3255
|
}
|
|
3254
|
-
console.log(`次: 直したら npx
|
|
3256
|
+
console.log(`次: 直したら npx @rex0220/print-craft-authoring-tools normalize ${shown(dest)} → diff ${shown(file)} ${shown(dest)}`);
|
|
3255
3257
|
return 0;
|
|
3256
3258
|
}
|
|
3257
3259
|
async function files(args) {
|
|
@@ -3261,7 +3263,7 @@ async function files(args) {
|
|
|
3261
3263
|
const l = listAppFolder(existingAppDir(ctx, app));
|
|
3262
3264
|
const lines = [
|
|
3263
3265
|
`${shown(l.dir)}(環境 ${ctx.env.name}、${ctx.env.baseUrl})`,
|
|
3264
|
-
`fields.json: ${l.hasFields ? "あり" : `無い(npx
|
|
3266
|
+
`fields.json: ${l.hasFields ? "あり" : `無い(npx @rex0220/print-craft-authoring-tools fields --app ${app}${envFlag(ctx)})`}`,
|
|
3265
3267
|
`ダウンロード / pull(新しい順。先頭が今の設定): ${l.snapshots.length ? "" : "無い"}`,
|
|
3266
3268
|
...l.snapshots.map((n, i) => ` ${n}${i === 0 ? " ← 今の設定" : ""}`),
|
|
3267
3269
|
`直したもの(-edit.json): ${l.edits.length ? "" : "無い"}`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rex0220/print-craft-authoring-tools",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "rex0220 印刷屋プラグイン(kintone)の設定 JSON を AI で作る・確かめるための tools(fields / record / pull / normalize / preview / diff / buttons / version)。計算式エンジンと印刷屋のコードは利用者の印刷屋プラグインの zip から読む",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"repository": {
|
|
32
32
|
"type": "git",
|
|
33
|
-
"url": "https://github.com/rex0220/print-craft-authoring.git",
|
|
33
|
+
"url": "git+https://github.com/rex0220/print-craft-authoring.git",
|
|
34
34
|
"directory": "tools"
|
|
35
35
|
},
|
|
36
36
|
"bugs": {
|