i-repo 2.6.0 → 2.7.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.
@@ -106,9 +106,17 @@ pluginCommand
106
106
  if (Array.isArray(row.platforms)) {
107
107
  row.platforms = row.platforms.join(", ");
108
108
  }
109
+ if (Array.isArray(row.input)) {
110
+ row.input = row.input.join(", ");
111
+ }
109
112
  if (Array.isArray(row.subcommands)) {
110
113
  row.subcommands = row.subcommands
111
- .map((s) => (s.description ? `${String(s.name)} (${String(s.description)})` : String(s.name)))
114
+ .map((s) => {
115
+ const intake = Array.isArray(s.input) ? ` [${s.input.join("/")}]` : "";
116
+ return s.description
117
+ ? `${String(s.name)}${intake} (${String(s.description)})`
118
+ : `${String(s.name)}${intake}`;
119
+ })
112
120
  .join(", ");
113
121
  }
114
122
  }
@@ -21,6 +21,15 @@ export declare const KNOWN_PLATFORMS: readonly ["macos", "linux", "windows"];
21
21
  export type PluginPlatform = (typeof KNOWN_PLATFORMS)[number];
22
22
  /** process.platform → platforms 語彙。未知の OS は null (= ゲート対象外) */
23
23
  export declare function platformKeywordFor(p: NodeJS.Platform): PluginPlatform | null;
24
+ /**
25
+ * input (intake = データの受け取り方) の閉じた語彙 (要望書v2)。
26
+ * 「どう渡すか」を実行前に機械可読にする — sink にディレクトリを渡す等の
27
+ * 取り違えを連携側 (GUI/Connector) が起動前に検出できるようにする。
28
+ * CLI 本体はこれでゲートしない (宣言した意図を伝えるヒント。成否の判定は
29
+ * あくまで receipt の verified)。
30
+ */
31
+ export declare const KNOWN_INPUTS: readonly ["stdin-ndjson", "files", "dir", "none"];
32
+ export type PluginInput = (typeof KNOWN_INPUTS)[number];
24
33
  /** params の1エントリ。GUI/ink がフォーム部品へ写像できる最小集合に絞る */
25
34
  export interface PluginParam {
26
35
  /** フラグ名 (例: "--bucket") */
@@ -44,6 +53,8 @@ export interface PluginParam {
44
53
  export interface PluginSubcommand {
45
54
  name: string;
46
55
  description?: string;
56
+ /** このサブコマンドの intake。プラグインレベルの input を上書きする (要望書v2 §3.2) */
57
+ input?: PluginInput[];
47
58
  }
48
59
  /** --plugin-schema 応答の全体形 (基本 + 拡張。未知フィールドは無視) */
49
60
  export interface PluginDescribe {
@@ -59,6 +70,11 @@ export interface PluginDescribe {
59
70
  /** 対応 OS。未宣言 = 制限なし。宣言があり現在の OS が含まれない場合、dispatch は実行を拒否する */
60
71
  platforms?: PluginPlatform[];
61
72
  subcommands?: PluginSubcommand[];
73
+ /**
74
+ * intake = データの受け取り方 (要望書v2)。未宣言 = 不明 (連携側は安全側 =
75
+ * 渡し方を推測しない)。subcommands[].input がある場合はそちらが優先。
76
+ */
77
+ input?: PluginInput[];
62
78
  }
63
79
  /**
64
80
  * plugin describe の表示行を組む。plugin/path は CLI が解決した事実 —
@@ -31,6 +31,14 @@ export function platformKeywordFor(p) {
31
31
  return "linux";
32
32
  return null;
33
33
  }
34
+ /**
35
+ * input (intake = データの受け取り方) の閉じた語彙 (要望書v2)。
36
+ * 「どう渡すか」を実行前に機械可読にする — sink にディレクトリを渡す等の
37
+ * 取り違えを連携側 (GUI/Connector) が起動前に検出できるようにする。
38
+ * CLI 本体はこれでゲートしない (宣言した意図を伝えるヒント。成否の判定は
39
+ * あくまで receipt の verified)。
40
+ */
41
+ export const KNOWN_INPUTS = ["stdin-ndjson", "files", "dir", "none"];
34
42
  const PARAM_TYPES = new Set(["string", "number", "boolean", "select"]);
35
43
  /**
36
44
  * plugin describe の表示行を組む。plugin/path は CLI が解決した事実 —
@@ -112,7 +120,23 @@ export async function probePlatforms(bin, timeoutMs = 1500) {
112
120
  }
113
121
  /** 拡張フィールドのいずれかを宣言しているか */
114
122
  export function hasDescribeFields(row) {
115
- return ["name", "version", "description", "phases", "params", "platforms", "subcommands"].some((k) => k in row);
123
+ return ["name", "version", "description", "phases", "params", "platforms", "subcommands", "input"].some((k) => k in row);
124
+ }
125
+ /**
126
+ * input (intake) 宣言の検査。閉じた語彙の非空配列であること。
127
+ * "none" は「データ入力なし」なので他の値との併記は矛盾 — 受理すると
128
+ * 連携側が「渡さなくてよいのか stdin で渡すのか」を判断できない。
129
+ */
130
+ function validateInputList(value, field) {
131
+ if (!Array.isArray(value) ||
132
+ value.length === 0 ||
133
+ !value.every((v) => typeof v === "string" && KNOWN_INPUTS.includes(v))) {
134
+ return `${field} must be a non-empty array of ${KNOWN_INPUTS.map((k) => `"${k}"`).join(" | ")}`;
135
+ }
136
+ if (value.includes("none") && value.length > 1) {
137
+ return `${field} must not combine "none" with other intake values`;
138
+ }
139
+ return null;
116
140
  }
117
141
  /**
118
142
  * 宣言の形式検査。問題の説明文を返す (空配列 = 適合)。
@@ -142,6 +166,11 @@ export function validateDescribe(row) {
142
166
  problems.push(`platforms must be a non-empty array of ${KNOWN_PLATFORMS.map((k) => `"${k}"`).join(" | ")}`);
143
167
  }
144
168
  }
169
+ if ("input" in row) {
170
+ const problem = validateInputList(row.input, "input");
171
+ if (problem)
172
+ problems.push(problem);
173
+ }
145
174
  let declaredSubs = null;
146
175
  if ("subcommands" in row) {
147
176
  const subs = row.subcommands;
@@ -168,6 +197,11 @@ export function validateDescribe(row) {
168
197
  if ("description" in s && typeof s.description !== "string") {
169
198
  problems.push(`subcommands[${i}].description must be a string`);
170
199
  }
200
+ if ("input" in s) {
201
+ const problem = validateInputList(s.input, `subcommands[${i}].input`);
202
+ if (problem)
203
+ problems.push(problem);
204
+ }
171
205
  });
172
206
  }
173
207
  }
@@ -25,7 +25,7 @@ case "\${1:-}" in
25
25
  exit 0 ;;
26
26
  --plugin-schema)
27
27
  # 自己記述 (PLUGINS.md §3)。params は GUI/ink のフォーム生成に使われる
28
- printf '{"pluginApi":["1"],"schemaVersions":["1.0"],"recordTypes":["*"],"name":"i-repo-${name}","version":"0.1.0","description":"TODO: what this plugin does","phases":["write","verify"],"platforms":["macos","linux"],"params":[{"name":"--dry-run","type":"boolean","label":"Dry run","description":"Validate without writing"}]}\\n'
28
+ printf '{"pluginApi":["1"],"schemaVersions":["1.0"],"recordTypes":["*"],"name":"i-repo-${name}","version":"0.1.0","description":"TODO: what this plugin does","phases":["write","verify"],"platforms":["macos","linux"],"input":["stdin-ndjson"],"params":[{"name":"--dry-run","type":"boolean","label":"Dry run","description":"Validate without writing"}]}\\n'
29
29
  exit 0 ;;
30
30
  esac
31
31
 
@@ -115,6 +115,7 @@ if (arg0 === "--plugin-schema") {
115
115
  description: "TODO: what this plugin does",
116
116
  phases: ["write", "verify"],
117
117
  platforms: ["macos", "linux", "windows"],
118
+ input: ["stdin-ndjson"],
118
119
  params: [
119
120
  { name: "--dry-run", type: "boolean", label: "Dry run", description: "Validate without writing" },
120
121
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "i-repo",
3
- "version": "2.6.0",
3
+ "version": "2.7.0",
4
4
  "description": "Modern CLI for ConMas i-Reporter - Built for humans and AI",
5
5
  "type": "module",
6
6
  "bin": {