ikanban 0.3.0 → 0.3.2
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/lib/pipeline.js +16 -2
- package/lib/roadmap.js +12 -3
- package/package.json +1 -1
package/lib/pipeline.js
CHANGED
|
@@ -45,9 +45,17 @@ function parse(args) {
|
|
|
45
45
|
return opts;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
const PLAN_NOTE = "Pipelines need Pro: this workspace's plan does not include them, so nothing was sent. The build goes on.";
|
|
49
|
+
|
|
48
50
|
async function api(path, { base, token, method = "GET", body }) {
|
|
49
51
|
const res = await ikanbanFetch(path, { base, token, method, body });
|
|
50
52
|
const data = await res.json().catch(() => ({}));
|
|
53
|
+
if (res.status === 402) {
|
|
54
|
+
// Three-products pricing D7: Pipelines are Pro and up. Never fail a build over the plan.
|
|
55
|
+
const e = new Error(PLAN_NOTE);
|
|
56
|
+
e.plan = true;
|
|
57
|
+
throw e;
|
|
58
|
+
}
|
|
51
59
|
if (!res.ok || data.success === false) throw new Error(`HTTP ${res.status}: ${data.message || "refused"}`);
|
|
52
60
|
return data.data;
|
|
53
61
|
}
|
|
@@ -185,8 +193,14 @@ async function run(args) {
|
|
|
185
193
|
const conn = connection(opts);
|
|
186
194
|
if (!opts.status) throw new Error("set --status (queued, running, passed, failed, skipped, held, cancelled)");
|
|
187
195
|
const tid = await teamId(conn, conn.team);
|
|
188
|
-
|
|
189
|
-
|
|
196
|
+
try {
|
|
197
|
+
for (const t of conn.tasks) {
|
|
198
|
+
await postEvent(conn, tid, t, { stage: opts.stage, status: opts.status, url: opts.url, commit_sha: opts.sha, detail: opts.detail });
|
|
199
|
+
}
|
|
200
|
+
} catch (e) {
|
|
201
|
+
if (!e.plan) throw e;
|
|
202
|
+
console.error(`ikanban: ${e.message}`);
|
|
203
|
+
return 0;
|
|
190
204
|
}
|
|
191
205
|
console.log(`${opts.stage} ${opts.status}: ${conn.tasks.map((t) => (t.run ? `${t.task}@${t.run}` : t.task)).join(", ")}`);
|
|
192
206
|
return 0;
|
package/lib/roadmap.js
CHANGED
|
@@ -156,6 +156,9 @@ if command -v npx >/dev/null 2>&1; then
|
|
|
156
156
|
fi
|
|
157
157
|
`;
|
|
158
158
|
const AGENT_COMMAND = "node .iKanban/hooks/roadmap-sync.js";
|
|
159
|
+
// IKA-2244: Claude Code runs a hook in the session's working folder, which is often not the
|
|
160
|
+
// repository root; $CLAUDE_PROJECT_DIR is the root (Claude Code hooks reference).
|
|
161
|
+
const CLAUDE_COMMAND = 'node "$CLAUDE_PROJECT_DIR/.iKanban/hooks/roadmap-sync.js"';
|
|
159
162
|
|
|
160
163
|
function mergeJson(file, update) {
|
|
161
164
|
const cur = fs.existsSync(file) ? JSON.parse(fs.readFileSync(file, "utf8")) : {};
|
|
@@ -164,18 +167,21 @@ function mergeJson(file, update) {
|
|
|
164
167
|
fs.writeFileSync(file, JSON.stringify(next, null, 2) + "\n");
|
|
165
168
|
}
|
|
166
169
|
|
|
167
|
-
/** Adds one entry to hooks[event]
|
|
170
|
+
/** Adds one entry to hooks[event]; an entry that already runs roadmap-sync.js is replaced
|
|
171
|
+
* by it (IKA-2244: so a re-install fixes an older install's command), never doubled. */
|
|
168
172
|
function addHook(settings, event, entry) {
|
|
169
173
|
settings.hooks = settings.hooks || {};
|
|
170
174
|
const list = (settings.hooks[event] = settings.hooks[event] || []);
|
|
171
|
-
|
|
175
|
+
const at = list.findIndex((e) => JSON.stringify(e).includes("roadmap-sync.js"));
|
|
176
|
+
if (at < 0) list.push(entry);
|
|
177
|
+
else list[at] = entry;
|
|
172
178
|
return settings;
|
|
173
179
|
}
|
|
174
180
|
|
|
175
181
|
const AGENTS = {
|
|
176
182
|
claude: (root) => {
|
|
177
183
|
mergeJson(path.join(root, ".claude", "settings.json"), (s) =>
|
|
178
|
-
addHook(s, "PostToolUse", { matcher: "Write|Edit|MultiEdit", hooks: [{ type: "command", command:
|
|
184
|
+
addHook(s, "PostToolUse", { matcher: "Write|Edit|MultiEdit", hooks: [{ type: "command", command: CLAUDE_COMMAND, timeout: 90 }] }));
|
|
179
185
|
return ".claude/settings.json (PostToolUse)";
|
|
180
186
|
},
|
|
181
187
|
gemini: (root) => {
|
|
@@ -224,6 +230,9 @@ function installHooks(opts) {
|
|
|
224
230
|
}
|
|
225
231
|
for (const d of done) console.log(` installed: ${d}`);
|
|
226
232
|
console.log("Plan files (JSON with a top-level \"roadmap\" block) now reach the Roadmap on every agent write and every git push.");
|
|
233
|
+
// IKA-2244: the sync's default server is prod; say which one this repository will use.
|
|
234
|
+
const base = connection({}, path.join(root, "plan.json")).base;
|
|
235
|
+
console.log(` server: ${base} (set api_url in .iKanban/settings-local.json, or IKANBAN_BASE_URL, to use another)`);
|
|
227
236
|
return 0;
|
|
228
237
|
}
|
|
229
238
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ikanban",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "iKanban CLI: AI and security scans of your own repo, with results filed into iKanban",
|
|
5
5
|
"bin": { "ikanban": "bin/ikanban.js" },
|
|
6
6
|
"files": ["bin", "lib", "hooks", "scanners", "README.md"],
|