@nulab/bee 1.0.0 → 1.1.1
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 +6 -3
- package/dist/chunks/activities.mjs +12 -29
- package/dist/chunks/activities2.mjs +12 -29
- package/dist/chunks/activities3.mjs +12 -29
- package/dist/chunks/add-user.mjs +9 -11
- package/dist/chunks/add.mjs +9 -11
- package/dist/chunks/add2.mjs +9 -11
- package/dist/chunks/api.mjs +51 -18
- package/dist/chunks/attachments.mjs +11 -13
- package/dist/chunks/attachments2.mjs +11 -13
- package/dist/chunks/attachments3.mjs +11 -13
- package/dist/chunks/browse.mjs +7 -9
- package/dist/chunks/clone.mjs +9 -11
- package/dist/chunks/close.mjs +9 -11
- package/dist/chunks/comment.mjs +8 -10
- package/dist/chunks/comment2.mjs +11 -13
- package/dist/chunks/comments.mjs +9 -11
- package/dist/chunks/completion.mjs +52 -57
- package/dist/chunks/count.mjs +11 -18
- package/dist/chunks/count2.mjs +9 -11
- package/dist/chunks/count3.mjs +10 -12
- package/dist/chunks/count4.mjs +9 -11
- package/dist/chunks/count5.mjs +9 -11
- package/dist/chunks/create.mjs +6 -8
- package/dist/chunks/create2.mjs +10 -12
- package/dist/chunks/create3.mjs +8 -10
- package/dist/chunks/create4.mjs +7 -9
- package/dist/chunks/create5.mjs +8 -10
- package/dist/chunks/create6.mjs +6 -8
- package/dist/chunks/create7.mjs +6 -8
- package/dist/chunks/create8.mjs +6 -8
- package/dist/chunks/create9.mjs +6 -8
- package/dist/chunks/dashboard.mjs +11 -13
- package/dist/chunks/delete.mjs +6 -8
- package/dist/chunks/delete2.mjs +6 -8
- package/dist/chunks/delete3.mjs +6 -8
- package/dist/chunks/delete4.mjs +6 -8
- package/dist/chunks/delete5.mjs +6 -8
- package/dist/chunks/delete6.mjs +6 -8
- package/dist/chunks/delete7.mjs +6 -8
- package/dist/chunks/delete8.mjs +6 -8
- package/dist/chunks/delete9.mjs +6 -8
- package/dist/chunks/edit.mjs +9 -11
- package/dist/chunks/edit2.mjs +10 -12
- package/dist/chunks/edit3.mjs +10 -12
- package/dist/chunks/edit4.mjs +9 -11
- package/dist/chunks/edit5.mjs +6 -8
- package/dist/chunks/edit6.mjs +9 -11
- package/dist/chunks/edit7.mjs +9 -11
- package/dist/chunks/edit8.mjs +9 -11
- package/dist/chunks/history.mjs +11 -13
- package/dist/chunks/index.mjs +1 -1
- package/dist/chunks/index10.mjs +1 -1
- package/dist/chunks/index11.mjs +1 -1
- package/dist/chunks/index12.mjs +1 -1
- package/dist/chunks/index13.mjs +1 -1
- package/dist/chunks/index14.mjs +1 -1
- package/dist/chunks/index15.mjs +1 -1
- package/dist/chunks/index16.mjs +1 -1
- package/dist/chunks/index17.mjs +1 -1
- package/dist/chunks/index2.mjs +1 -1
- package/dist/chunks/index3.mjs +1 -1
- package/dist/chunks/index4.mjs +1 -1
- package/dist/chunks/index5.mjs +1 -1
- package/dist/chunks/index6.mjs +1 -1
- package/dist/chunks/index7.mjs +1 -1
- package/dist/chunks/index8.mjs +1 -1
- package/dist/chunks/index9.mjs +1 -1
- package/dist/chunks/list.mjs +11 -13
- package/dist/chunks/list10.mjs +11 -13
- package/dist/chunks/list11.mjs +11 -13
- package/dist/chunks/list12.mjs +11 -13
- package/dist/chunks/list13.mjs +11 -13
- package/dist/chunks/list14.mjs +11 -13
- package/dist/chunks/list15.mjs +11 -13
- package/dist/chunks/list2.mjs +13 -20
- package/dist/chunks/list3.mjs +12 -14
- package/dist/chunks/list4.mjs +11 -13
- package/dist/chunks/list5.mjs +12 -14
- package/dist/chunks/list6.mjs +11 -13
- package/dist/chunks/list7.mjs +11 -13
- package/dist/chunks/list8.mjs +11 -13
- package/dist/chunks/list9.mjs +11 -13
- package/dist/chunks/login.mjs +18 -9
- package/dist/chunks/logout.mjs +9 -5
- package/dist/chunks/me.mjs +11 -13
- package/dist/chunks/read-all.mjs +9 -11
- package/dist/chunks/read.mjs +9 -11
- package/dist/chunks/read2.mjs +9 -11
- package/dist/chunks/refresh.mjs +5 -7
- package/dist/chunks/remove-user.mjs +9 -11
- package/dist/chunks/remove.mjs +9 -11
- package/dist/chunks/reopen.mjs +9 -11
- package/dist/chunks/status.mjs +9 -6
- package/dist/chunks/status2.mjs +9 -11
- package/dist/chunks/status3.mjs +9 -11
- package/dist/chunks/switch.mjs +8 -4
- package/dist/chunks/tags.mjs +9 -11
- package/dist/chunks/token.mjs +9 -5
- package/dist/chunks/tree.mjs +9 -11
- package/dist/chunks/users.mjs +11 -13
- package/dist/chunks/view.mjs +11 -13
- package/dist/chunks/view2.mjs +14 -15
- package/dist/chunks/view3.mjs +12 -14
- package/dist/chunks/view4.mjs +11 -13
- package/dist/chunks/view5.mjs +11 -13
- package/dist/chunks/view6.mjs +11 -13
- package/dist/chunks/view7.mjs +11 -13
- package/dist/chunks/view8.mjs +11 -13
- package/dist/chunks/view9.mjs +11 -13
- package/dist/index.mjs +37751 -37
- package/dist/shared/{bee.PF8hrVKn.mjs → bee.084B_7FC.mjs} +1 -1
- package/dist/shared/{bee.D6yQ6Pqf.mjs → bee.C4p7W8_P.mjs} +1 -1
- package/dist/shared/{bee.DxRKWv6n.mjs → bee.CAARNIp6.mjs} +1 -1
- package/dist/shared/{bee.Bt1TK6yh.mjs → bee.CHtg3F43.mjs} +46 -7
- package/dist/shared/{bee.CCNmDHVv.mjs → bee.CirccSk2.mjs} +19 -1
- package/dist/shared/{bee.Ds2l-nTJ.mjs → bee.DFnSWb6q.mjs} +101 -13
- package/dist/shared/{bee.bmiIlr9W.mjs → bee.KteAW2rM.mjs} +12 -2
- package/dist/shared/{bee.OJ0vqxJN.mjs → bee.RsR9yniy.mjs} +10 -4
- package/dist/shared/{bee.IM3QELRf.mjs → bee.a05kNWpn.mjs} +1 -1
- package/dist/shared/{bee.G4d7izLe.mjs → bee.q93n012-.mjs} +1 -1
- package/package.json +12 -10
- package/dist/shared/bee.BYqxm3yG.mjs +0 -24
- package/dist/shared/bee.BeQSH2t0.mjs +0 -25
- package/dist/shared/bee.BtxMsVL4.mjs +0 -35104
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import 'consola';
|
|
2
2
|
import 'node:stream/consumers';
|
|
3
3
|
import * as v from 'valibot';
|
|
4
|
-
import { v as vInteger } from '
|
|
4
|
+
import { v as vInteger } from '../index.mjs';
|
|
5
5
|
|
|
6
6
|
const resolveProjectIds = async (client, values) => {
|
|
7
7
|
if (values.length === 0) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import consola from 'consola';
|
|
2
|
-
import { s as stringWidth, w as widthPadEnd } from './bee.
|
|
2
|
+
import { s as stringWidth, w as widthPadEnd } from './bee.DFnSWb6q.mjs';
|
|
3
3
|
|
|
4
4
|
const printDefinitionList = (items, indent = 4) => {
|
|
5
5
|
const filtered = items.filter(
|
|
@@ -2,10 +2,9 @@ import { existsSync, readFileSync, writeFileSync, chmodSync } from 'node:fs';
|
|
|
2
2
|
import { resolve } from 'node:path';
|
|
3
3
|
import { homedir } from 'node:os';
|
|
4
4
|
import consola from 'consola';
|
|
5
|
-
import { U as UserError, p as parseArg, v as vInteger } from '
|
|
5
|
+
import { U as UserError, b as RcSchema, p as parseArg, v as vInteger } from '../index.mjs';
|
|
6
6
|
import 'node:stream/consumers';
|
|
7
7
|
import * as v from 'valibot';
|
|
8
|
-
import { R as RcSchema } from './bee.BeQSH2t0.mjs';
|
|
9
8
|
import { Option } from 'commander';
|
|
10
9
|
|
|
11
10
|
const promptRequired = async (label, existing, options) => {
|
|
@@ -197,6 +196,9 @@ function destr(value, options = {}) {
|
|
|
197
196
|
//#region src/index.ts
|
|
198
197
|
const RE_KEY_VAL = /^\s*([^\s=]+)\s*=\s*(.*)?\s*$/;
|
|
199
198
|
const RE_LINES = /\n|\r|\r\n/;
|
|
199
|
+
/**
|
|
200
|
+
* The default options for the configuration file.
|
|
201
|
+
*/
|
|
200
202
|
const defaults = {
|
|
201
203
|
name: ".conf",
|
|
202
204
|
dir: process.cwd(),
|
|
@@ -227,26 +229,59 @@ function parse(contents, options = {}) {
|
|
|
227
229
|
}
|
|
228
230
|
return options.flat ? config : unflatten(config, { overwrite: true });
|
|
229
231
|
}
|
|
232
|
+
/**
|
|
233
|
+
* Parses a configuration string into an object.
|
|
234
|
+
* @param {string} contents - The configuration data as a raw string.
|
|
235
|
+
* @param {RCOptions} [options={}] - Options to control the parsing behaviour. See {@link RCOptions}.
|
|
236
|
+
* @returns {RC} - The parsed configuration object. See {@link RC}.
|
|
237
|
+
*/
|
|
230
238
|
function parseFile(path, options) {
|
|
231
239
|
if (!existsSync(path)) return {};
|
|
232
240
|
return parse(readFileSync(path, "utf8"), options);
|
|
233
241
|
}
|
|
242
|
+
/**
|
|
243
|
+
* Reads a configuration file from a default or specified location and parses its contents.
|
|
244
|
+
* @param {RCOptions|string} [options] - Options for reading the configuration file, or the name of the configuration file. See {@link RCOptions}.
|
|
245
|
+
* @returns {RC} - The parsed configuration object. See {@link RC}.
|
|
246
|
+
*/
|
|
234
247
|
function read(options) {
|
|
235
248
|
options = withDefaults(options);
|
|
236
249
|
return parseFile(resolve(options.dir, options.name), options);
|
|
237
250
|
}
|
|
251
|
+
/**
|
|
252
|
+
* Reads a custom configuration file from a default or specified location and parses its contents.
|
|
253
|
+
* @param {RCOptions|string} [options] - Options for reading the configuration file, or the name of the configuration file. See {@link RCOptions}.
|
|
254
|
+
* @returns {RC} - The parsed configuration object.
|
|
255
|
+
* @deprecated Use {@link readUserConfig} instead, which uses `~/.config` following XDG conventions.
|
|
256
|
+
*/
|
|
238
257
|
function readUser(options) {
|
|
239
258
|
options = withDefaults(options);
|
|
240
259
|
options.dir = process.env.XDG_CONFIG_HOME || homedir();
|
|
241
260
|
return read(options);
|
|
242
261
|
}
|
|
262
|
+
/**
|
|
263
|
+
* Serialises a configuration object to a string format.
|
|
264
|
+
* @param {RC} config - The configuration object to serialise. See {@link RC}.
|
|
265
|
+
* @returns {string} - The serialised configuration string.
|
|
266
|
+
*/
|
|
243
267
|
function serialize(config) {
|
|
244
268
|
return Object.entries(flatten(config)).map(([key, value]) => `${key}=${JSON.stringify(value)}`).join("\n");
|
|
245
269
|
}
|
|
270
|
+
/**
|
|
271
|
+
* Writes a configuration object to a file in a default or specified location.
|
|
272
|
+
* @param {RC} config - The configuration object to write. See {@link RC}.
|
|
273
|
+
* @param {RCOptions|string} [options] - Options for writing the configuration file, or the name of the configuration file. See {@link RCOptions}.
|
|
274
|
+
*/
|
|
246
275
|
function write(config, options) {
|
|
247
276
|
options = withDefaults(options);
|
|
248
277
|
writeFileSync(resolve(options.dir, options.name), serialize(config), { encoding: "utf8" });
|
|
249
278
|
}
|
|
279
|
+
/**
|
|
280
|
+
* Writes a custom configuration object to a file in a default or specified location.
|
|
281
|
+
* @param {RC} config - The configuration object to write. See {@link RC}.
|
|
282
|
+
* @param {RCOptions|string} [options] - Options for writing the configuration file, or the name of the configuration file. See {@link RCOptions}.
|
|
283
|
+
* @deprecated Use {@link writeUserConfig} instead, which uses `~/.config` following XDG conventions.
|
|
284
|
+
*/
|
|
250
285
|
function writeUser(config, options) {
|
|
251
286
|
options = withDefaults(options);
|
|
252
287
|
options.dir = process.env.XDG_CONFIG_HOME || homedir();
|
|
@@ -254,8 +289,7 @@ function writeUser(config, options) {
|
|
|
254
289
|
}
|
|
255
290
|
|
|
256
291
|
const CONFIG_FILE_NAME = ".beerc";
|
|
257
|
-
const
|
|
258
|
-
const raw = readUser(CONFIG_FILE_NAME);
|
|
292
|
+
const parseConfig = (raw) => {
|
|
259
293
|
const result = v.safeParse(RcSchema, raw);
|
|
260
294
|
if (!result.success) {
|
|
261
295
|
const details = result.issues.map((issue) => issue.message).join("\n");
|
|
@@ -264,9 +298,10 @@ ${details}`);
|
|
|
264
298
|
}
|
|
265
299
|
return result.output;
|
|
266
300
|
};
|
|
301
|
+
const loadConfig = () => parseConfig(readUser(CONFIG_FILE_NAME));
|
|
267
302
|
const configFilePath = () => resolve(process.env.XDG_CONFIG_HOME || homedir(), CONFIG_FILE_NAME);
|
|
268
303
|
const writeConfig = (config) => {
|
|
269
|
-
writeUser(config, CONFIG_FILE_NAME);
|
|
304
|
+
writeUser(parseConfig(config), CONFIG_FILE_NAME);
|
|
270
305
|
chmodSync(configFilePath(), 384);
|
|
271
306
|
};
|
|
272
307
|
const updateConfig = (updater) => {
|
|
@@ -299,6 +334,7 @@ const collectNum = (val, prev) => [
|
|
|
299
334
|
parseArg(vInteger, val, "value")
|
|
300
335
|
];
|
|
301
336
|
const project = () => new RequiredOption("-p, --project <id>", "Project ID or project key").env("BACKLOG_PROJECT");
|
|
337
|
+
const projectOptional = (description = "Project ID or project key") => new Option("-p, --project <id>", description).env("BACKLOG_PROJECT");
|
|
302
338
|
const repo = () => new RequiredOption("-R, --repo <name>", "Repository name or ID").env("BACKLOG_REPO");
|
|
303
339
|
const count = () => new Option("-L, --count <n>", "Number of results (default: 20)");
|
|
304
340
|
const offset = () => new Option("--offset <n>", "Offset for pagination");
|
|
@@ -317,10 +353,13 @@ const milestone = () => new Option("--milestone <id>", "Milestone IDs (repeatabl
|
|
|
317
353
|
const comment = () => new Option("-c, --comment <text>", "Comment to add with the update");
|
|
318
354
|
const web = (resource) => new Option("-w, --web", `Open the ${resource} in the browser`);
|
|
319
355
|
const noBrowser = () => new Option("-n, --no-browser", "Print the URL instead of opening the browser");
|
|
320
|
-
const space = () => new Option(
|
|
356
|
+
const space = () => new Option(
|
|
357
|
+
"-s, --space <hostname>",
|
|
358
|
+
"Space hostname (e.g. xxx.backlog.com, or your own domain)"
|
|
359
|
+
).env("BACKLOG_SPACE");
|
|
321
360
|
const json = () => new Option(
|
|
322
361
|
"--json [fields]",
|
|
323
362
|
"Output as JSON (optionally filter by field names, comma-separated)"
|
|
324
363
|
).preset("");
|
|
325
364
|
|
|
326
|
-
export {
|
|
365
|
+
export { minId as A, maxId as B, repo as C, issue as D, RequiredOption as R, promptRequired as a, writeConfig as b, collect as c, project as d, confirmOrExit as e, collectNum as f, count as g, assigneeList as h, offset as i, json as j, keyword as k, loadConfig as l, assignee as m, noBrowser as n, order as o, projectOptional as p, category as q, resolveOptions as r, space as s, milestone as t, updateConfig as u, version as v, web as w, notify as x, attachment as y, comment as z };
|
|
@@ -30,4 +30,22 @@ const ACTIVITY_LABELS = {
|
|
|
30
30
|
47: "Issue Multi-Created"
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
const STATUS_DELETED_TYPE = 34;
|
|
34
|
+
const getActivitySummary = (activity) => {
|
|
35
|
+
const { content } = activity;
|
|
36
|
+
if (activity.type === STATUS_DELETED_TYPE && "deletedStatus" in content && content.deletedStatus.name) {
|
|
37
|
+
return content.deletedStatus.name;
|
|
38
|
+
}
|
|
39
|
+
if ("summary" in content && content.summary) {
|
|
40
|
+
return content.summary;
|
|
41
|
+
}
|
|
42
|
+
if ("link" in content && content.link.length > 0) {
|
|
43
|
+
return content.link.map((item) => item.key_id ? `#${item.key_id}` : item.title ?? "").filter(Boolean).join(", ");
|
|
44
|
+
}
|
|
45
|
+
if ("key_id" in content && content.key_id) {
|
|
46
|
+
return `#${content.key_id}`;
|
|
47
|
+
}
|
|
48
|
+
return "";
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export { ACTIVITY_LABELS as A, getActivitySummary as g };
|
|
@@ -168,19 +168,22 @@ function eastAsianWidth(codePoint, {ambiguousAsWide = false} = {}) {
|
|
|
168
168
|
Logic:
|
|
169
169
|
- Segment graphemes to match how terminals render clusters.
|
|
170
170
|
- Width rules:
|
|
171
|
-
1. Skip non-printing clusters (Default_Ignorable, Control, pure Mark, lone Surrogates). Tabs are ignored by design.
|
|
171
|
+
1. Skip non-printing clusters (Default_Ignorable, Control, pure nonspacing/enclosing Mark, lone Surrogates). Tabs are ignored by design.
|
|
172
172
|
2. RGI emoji clusters (\p{RGI_Emoji}) are double-width.
|
|
173
173
|
3. Minimally-qualified/unqualified emoji clusters (ZWJ sequences with 2+ Extended_Pictographic, or keycap sequences) are double-width.
|
|
174
|
-
4.
|
|
174
|
+
4. Hangul jamo collapse each standard modern Hangul L+V or L+V+T syllable piece to width 2.
|
|
175
|
+
Unmatched repeated leading/vowel/trailing jamo stay additive because that matches how the terminals we target render them.
|
|
176
|
+
5. Otherwise use East Asian Width of the cluster's first visible code point, and add widths for trailing spacing marks and Halfwidth/Fullwidth Forms within the same cluster (e.g., dakuten/handakuten/prolonged sound mark).
|
|
175
177
|
*/
|
|
176
178
|
|
|
177
179
|
const segmenter = new Intl.Segmenter();
|
|
178
180
|
|
|
179
181
|
// Whole-cluster zero-width
|
|
180
|
-
const zeroWidthClusterRegex = /^(?:\p{Default_Ignorable_Code_Point}|\p{Control}|\p{Format}|\p{
|
|
182
|
+
const zeroWidthClusterRegex = /^(?:\p{Default_Ignorable_Code_Point}|\p{Control}|\p{Format}|\p{Nonspacing_Mark}|\p{Enclosing_Mark}|\p{Surrogate})+$/v;
|
|
181
183
|
|
|
182
184
|
// Pick the base scalar if the cluster starts with Prepend/Format/Marks
|
|
183
|
-
const leadingNonPrintingRegex = /^[\p{Default_Ignorable_Code_Point}\p{Control}\p{Format}\p{
|
|
185
|
+
const leadingNonPrintingRegex = /^[\p{Default_Ignorable_Code_Point}\p{Control}\p{Format}\p{Nonspacing_Mark}\p{Enclosing_Mark}\p{Surrogate}]+/v;
|
|
186
|
+
const spacingMarkRegex = /\p{Spacing_Mark}/v;
|
|
184
187
|
|
|
185
188
|
// RGI emoji sequences
|
|
186
189
|
const rgiEmojiRegex = /^\p{RGI_Emoji}$/v;
|
|
@@ -216,13 +219,91 @@ function isZeroWidthCluster(segment) {
|
|
|
216
219
|
return zeroWidthClusterRegex.test(segment);
|
|
217
220
|
}
|
|
218
221
|
|
|
219
|
-
function
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
222
|
+
function isHangulLeadingJamo(codePoint) {
|
|
223
|
+
return (codePoint >= 0x11_00 && codePoint <= 0x11_5F)
|
|
224
|
+
|| (codePoint >= 0xA9_60 && codePoint <= 0xA9_7C);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
function isHangulVowelJamo(codePoint) {
|
|
228
|
+
return (codePoint >= 0x11_60 && codePoint <= 0x11_A7)
|
|
229
|
+
|| (codePoint >= 0xD7_B0 && codePoint <= 0xD7_C6);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
function isHangulTrailingJamo(codePoint) {
|
|
233
|
+
return (codePoint >= 0x11_A8 && codePoint <= 0x11_FF)
|
|
234
|
+
|| (codePoint >= 0xD7_CB && codePoint <= 0xD7_FB);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
function isHangulJamo(codePoint) {
|
|
238
|
+
return isHangulLeadingJamo(codePoint)
|
|
239
|
+
|| isHangulVowelJamo(codePoint)
|
|
240
|
+
|| isHangulTrailingJamo(codePoint);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
function hangulClusterWidth(visibleSegment, eastAsianWidthOptions) {
|
|
244
|
+
const codePoints = [];
|
|
245
|
+
|
|
246
|
+
for (const character of visibleSegment) {
|
|
247
|
+
if (zeroWidthClusterRegex.test(character)) {
|
|
248
|
+
continue;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
codePoints.push(character.codePointAt(0));
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
if (codePoints.length === 0) {
|
|
255
|
+
return undefined;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
let width = 0;
|
|
259
|
+
|
|
260
|
+
for (let index = 0; index < codePoints.length; index++) {
|
|
261
|
+
const codePoint = codePoints[index];
|
|
262
|
+
if (!isHangulJamo(codePoint)) {
|
|
263
|
+
if (width === 0) {
|
|
264
|
+
return undefined;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
// Mixed cluster (e.g., L + precomposed syllable): use EAW for non-jamo remainder
|
|
268
|
+
for (let remaining = index; remaining < codePoints.length; remaining++) {
|
|
269
|
+
width += eastAsianWidth(codePoints[remaining], eastAsianWidthOptions);
|
|
225
270
|
}
|
|
271
|
+
|
|
272
|
+
return width;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
// Modern Hangul L+V(+T) shapes as one syllable block. Unmatched jamo stay additive:
|
|
276
|
+
// U+1100 U+1100 U+1161 => U+1100 + (U+1100 U+1161) => 2 + 2.
|
|
277
|
+
if (
|
|
278
|
+
isHangulLeadingJamo(codePoint)
|
|
279
|
+
&& isHangulVowelJamo(codePoints[index + 1])
|
|
280
|
+
) {
|
|
281
|
+
width += 2;
|
|
282
|
+
index += isHangulTrailingJamo(codePoints[index + 2]) ? 2 : 1;
|
|
283
|
+
continue;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
width += eastAsianWidth(codePoint, eastAsianWidthOptions);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
return width;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
function trailingWidth(visibleSegment, eastAsianWidthOptions) {
|
|
293
|
+
let extra = 0;
|
|
294
|
+
let first = true;
|
|
295
|
+
|
|
296
|
+
for (const character of visibleSegment) {
|
|
297
|
+
if (first) {
|
|
298
|
+
first = false;
|
|
299
|
+
continue;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
if (
|
|
303
|
+
spacingMarkRegex.test(character)
|
|
304
|
+
|| (character >= '\uFF00' && character <= '\uFFEF')
|
|
305
|
+
) {
|
|
306
|
+
extra += eastAsianWidth(character.codePointAt(0), eastAsianWidthOptions);
|
|
226
307
|
}
|
|
227
308
|
}
|
|
228
309
|
|
|
@@ -270,12 +351,19 @@ function stringWidth(input, options = {}) {
|
|
|
270
351
|
continue;
|
|
271
352
|
}
|
|
272
353
|
|
|
354
|
+
const visibleSegment = baseVisible(segment);
|
|
355
|
+
const hangulWidth = hangulClusterWidth(visibleSegment, eastAsianWidthOptions);
|
|
356
|
+
if (hangulWidth !== undefined) {
|
|
357
|
+
width += hangulWidth;
|
|
358
|
+
continue;
|
|
359
|
+
}
|
|
360
|
+
|
|
273
361
|
// Everything else: EAW of the cluster’s first visible scalar
|
|
274
|
-
const codePoint =
|
|
362
|
+
const codePoint = visibleSegment.codePointAt(0);
|
|
275
363
|
width += eastAsianWidth(codePoint, eastAsianWidthOptions);
|
|
276
364
|
|
|
277
|
-
// Add width for trailing
|
|
278
|
-
width +=
|
|
365
|
+
// Add width for trailing spacing marks and Halfwidth/Fullwidth Forms (e.g., ゙, ゚, ー)
|
|
366
|
+
width += trailingWidth(visibleSegment, eastAsianWidthOptions);
|
|
279
367
|
}
|
|
280
368
|
|
|
281
369
|
return width;
|
|
@@ -45,7 +45,14 @@ ${lines.join("\n")}`;
|
|
|
45
45
|
}
|
|
46
46
|
_renderEnvVars() {
|
|
47
47
|
const fromOptions = this.options.filter((opt) => opt.envVar).map((opt) => [opt.envVar, opt.description ?? ""]);
|
|
48
|
-
const
|
|
48
|
+
const seen = /* @__PURE__ */ new Set();
|
|
49
|
+
const vars = [...fromOptions, ...this.beeEnvVars].filter(([name]) => {
|
|
50
|
+
if (seen.has(name)) {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
seen.add(name);
|
|
54
|
+
return true;
|
|
55
|
+
});
|
|
49
56
|
if (vars.length === 0) {
|
|
50
57
|
return "";
|
|
51
58
|
}
|
|
@@ -56,7 +63,10 @@ ${colorize("bold", "ENVIRONMENT VARIABLES")}
|
|
|
56
63
|
${lines.join("\n")}`;
|
|
57
64
|
}
|
|
58
65
|
}
|
|
59
|
-
const ENV_AUTH = [
|
|
66
|
+
const ENV_AUTH = [
|
|
67
|
+
["BACKLOG_API_KEY", "Authenticate with an API key"],
|
|
68
|
+
["BACKLOG_SPACE", "Space hostname"]
|
|
69
|
+
];
|
|
60
70
|
const ENV_PROJECT = ["BACKLOG_PROJECT", "Default project ID or project key"];
|
|
61
71
|
const ENV_REPO = ["BACKLOG_REPO", "Default repository name"];
|
|
62
72
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import consola from 'consola';
|
|
2
|
-
import { U as UserError, a as vFiniteNumber } from '
|
|
2
|
+
import { U as UserError, a as vFiniteNumber } from '../index.mjs';
|
|
3
3
|
import 'node:stream/consumers';
|
|
4
4
|
import * as v from 'valibot';
|
|
5
5
|
import { Backlog } from 'backlog-js';
|
|
6
6
|
import { r as refreshAccessToken } from './bee.CktwmH8R.mjs';
|
|
7
|
-
import { l as loadConfig } from './bee.
|
|
8
|
-
import { f as findSpace, u as updateSpaceAuth } from './bee.
|
|
7
|
+
import { l as loadConfig } from './bee.CHtg3F43.mjs';
|
|
8
|
+
import { f as findSpace, u as updateSpaceAuth } from './bee.CAARNIp6.mjs';
|
|
9
9
|
|
|
10
10
|
const formatResetTime = (epochSeconds) => {
|
|
11
11
|
const date = new Date(epochSeconds * 1e3);
|
|
@@ -14,12 +14,18 @@ const formatResetTime = (epochSeconds) => {
|
|
|
14
14
|
|
|
15
15
|
const getClient = async (host) => {
|
|
16
16
|
const config = loadConfig();
|
|
17
|
-
const
|
|
17
|
+
const envApiKey = process.env.BACKLOG_API_KEY;
|
|
18
|
+
const envSpace = process.env.BACKLOG_SPACE;
|
|
19
|
+
const resolvedHost = host ?? envSpace ?? config.defaultSpace;
|
|
18
20
|
if (!resolvedHost) {
|
|
19
21
|
throw new UserError("No space configured. Run `bee auth login` to authenticate.");
|
|
20
22
|
}
|
|
21
23
|
const resolved = findSpace(config.spaces, resolvedHost);
|
|
22
24
|
if (!resolved) {
|
|
25
|
+
if (envApiKey) {
|
|
26
|
+
const client = new Backlog({ host: resolvedHost, apiKey: envApiKey });
|
|
27
|
+
return { client, host: resolvedHost };
|
|
28
|
+
}
|
|
23
29
|
throw new UserError(
|
|
24
30
|
`Space "${resolvedHost}" not found. Run \`bee auth login\` to authenticate.`
|
|
25
31
|
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import consola from 'consola';
|
|
2
|
-
import { s as stringWidth, w as widthPadEnd, a as widthTruncate } from './bee.
|
|
2
|
+
import { s as stringWidth, w as widthPadEnd, a as widthTruncate } from './bee.DFnSWb6q.mjs';
|
|
3
3
|
|
|
4
4
|
const printTable = (rows) => {
|
|
5
5
|
if (rows.length === 0) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import 'consola';
|
|
2
2
|
import 'node:stream/consumers';
|
|
3
3
|
import 'valibot';
|
|
4
|
-
import { p as parseArg, v as vInteger } from '
|
|
4
|
+
import { p as parseArg, v as vInteger } from '../index.mjs';
|
|
5
5
|
|
|
6
6
|
const resolveUserId = async (client, value) => {
|
|
7
7
|
if (value === "@me") {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nulab/bee",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Bring Backlog to your command line",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"backlog",
|
|
@@ -31,22 +31,22 @@
|
|
|
31
31
|
"access": "public"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"backlog-js": "^0.
|
|
34
|
+
"backlog-js": "^0.19.1",
|
|
35
35
|
"commander": "^14.0.3",
|
|
36
36
|
"consola": "^3.4.2",
|
|
37
37
|
"is-unicode-supported": "^2.1.0",
|
|
38
|
-
"open": "^11.0.
|
|
39
|
-
"valibot": "^1.2
|
|
38
|
+
"open": "^11.0.1",
|
|
39
|
+
"valibot": "^1.4.2"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"tsx": "^4.
|
|
43
|
-
"unbuild": "^3.
|
|
44
|
-
"vitest": "^4.
|
|
45
|
-
"@repo/cli-utils": "0.0.0",
|
|
46
|
-
"@repo/test-utils": "0.0.0",
|
|
42
|
+
"tsx": "^4.23.12",
|
|
43
|
+
"unbuild": "^3.6.1",
|
|
44
|
+
"vitest": "^4.1.11",
|
|
47
45
|
"@repo/backlog-utils": "0.0.0",
|
|
48
46
|
"@repo/config": "0.0.0",
|
|
49
|
-
"@repo/tsconfigs": "0.0.0"
|
|
47
|
+
"@repo/tsconfigs": "0.0.0",
|
|
48
|
+
"@repo/test-utils": "0.0.0",
|
|
49
|
+
"@repo/cli-utils": "0.0.0"
|
|
50
50
|
},
|
|
51
51
|
"engines": {
|
|
52
52
|
"node": ">=20.18"
|
|
@@ -54,6 +54,8 @@
|
|
|
54
54
|
"scripts": {
|
|
55
55
|
"build": "unbuild",
|
|
56
56
|
"dev": "tsx --env-file=.env.development src/index.ts",
|
|
57
|
+
"generate:skill": "tsx src/scripts/generate-skill.ts",
|
|
58
|
+
"generate:skill:check": "tsx src/scripts/generate-skill.ts --check",
|
|
57
59
|
"test": "vitest run",
|
|
58
60
|
"typecheck": "tsc --noEmit"
|
|
59
61
|
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import * as v from 'valibot';
|
|
2
|
-
import consola from 'consola';
|
|
3
|
-
|
|
4
|
-
class UserError extends Error {
|
|
5
|
-
constructor(message) {
|
|
6
|
-
super(message);
|
|
7
|
-
this.name = "UserError";
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const vFiniteNumber = v.pipe(v.string(), v.transform(Number), v.number(), v.finite());
|
|
12
|
-
const vInteger = v.pipe(v.string(), v.transform(Number), v.number(), v.integer());
|
|
13
|
-
const parseArg = (schema, value, label) => {
|
|
14
|
-
const result = v.safeParse(schema, value);
|
|
15
|
-
if (result.success) {
|
|
16
|
-
return result.output;
|
|
17
|
-
}
|
|
18
|
-
const reason = result.issues[0]?.message;
|
|
19
|
-
const message = reason ? `Invalid value for "${label}": "${value}" \u2014 ${reason}` : `Invalid value for "${label}": "${value}"`;
|
|
20
|
-
consola.debug("parseArg validation issues:", result.issues);
|
|
21
|
-
throw new UserError(message);
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export { UserError as U, vFiniteNumber as a, parseArg as p, vInteger as v };
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import * as v from 'valibot';
|
|
2
|
-
|
|
3
|
-
const ApiKeyAuthSchema = v.object({
|
|
4
|
-
method: v.literal("api-key"),
|
|
5
|
-
apiKey: v.string()
|
|
6
|
-
});
|
|
7
|
-
const OAuthAuthSchema = v.object({
|
|
8
|
-
method: v.literal("oauth"),
|
|
9
|
-
accessToken: v.string(),
|
|
10
|
-
refreshToken: v.string(),
|
|
11
|
-
clientId: v.optional(v.string()),
|
|
12
|
-
clientSecret: v.optional(v.string())
|
|
13
|
-
});
|
|
14
|
-
const RcAuthSchema = v.variant("method", [ApiKeyAuthSchema, OAuthAuthSchema]);
|
|
15
|
-
const RcSpaceSchema = v.object({
|
|
16
|
-
host: v.pipe(v.string(), v.regex(/^[a-z0-9-]+\.backlog\.(com|jp)$/)),
|
|
17
|
-
auth: RcAuthSchema
|
|
18
|
-
});
|
|
19
|
-
const RcSchema = v.object({
|
|
20
|
-
defaultSpace: v.optional(v.string()),
|
|
21
|
-
spaces: v.optional(v.array(RcSpaceSchema), []),
|
|
22
|
-
aliases: v.optional(v.record(v.string(), v.string()), {})
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
export { RcSchema as R };
|