imdone-cli 0.1.7 → 0.2.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 CHANGED
@@ -3,7 +3,8 @@
3
3
  Imdone CLI is a command-line tool that integrates with Jira to manage your tasks and issues directly from markdown files and your terminal. It allows you to pull issues from Jira, edit them as markdown files, and push changes back to Jira.
4
4
  This tool is designed to serve as a bridge between your local development environment and Jira, making it easier and more efficient to manage tasks without switching contexts.
5
5
 
6
- If you're looking for a more visual experience, check out the [Imdone Desktop App](https://imdone.io).
6
+ ## How it works
7
+ ![Imdone With Jira](./docs/images/imdone-with-jira.png)
7
8
 
8
9
  ## Installation
9
10
 
package/dist/README.md ADDED
@@ -0,0 +1,61 @@
1
+ # imdone-jira Backlog
2
+
3
+ ## Getting started
4
+
5
+ ### Clone this repo into your project's backlog directory
6
+
7
+ From your project root:
8
+
9
+ ```bash
10
+ git clone <repository-url> backlog
11
+ cd backlog
12
+ ```
13
+
14
+ ### Create your own tracking branch
15
+
16
+ Create a branch for your work. This should stay local. (e.g. `your-name-work`)
17
+
18
+ ```bash
19
+ git checkout -b <your-branch-name>
20
+ ```
21
+
22
+ ### Install imdone-cli
23
+
24
+ ```bash
25
+ npm install -g imdone-cli
26
+ ```
27
+
28
+ ### Set up your environment
29
+
30
+ Copy the environment template file:
31
+
32
+ ```bash
33
+ cp .env.temp .env
34
+ ```
35
+
36
+ ### Add your Jira credentials to your `.env` file
37
+
38
+ **JIRA_USERNAME** is the email on your Jira profile
39
+
40
+ **JIRA_TOKEN** Create a Jira personal access token in your Jira account settings
41
+
42
+ ### Working with Jira and imdone
43
+
44
+ Run `imdone pull` from the backlog folder to get the latest content from Jira stories in the current sprint
45
+
46
+ Now you can see the current sprint stories in the `backlog/current-sprint` folder
47
+
48
+ Workflow for making changes to backlog items:
49
+
50
+ 1. Run `imdone pull` to get the latest changes from Jira
51
+ 2. Make your story updates in the local files
52
+ 3. Run `imdone push` to push your changes to Jira
53
+
54
+ **What happens during push/pull:**
55
+
56
+ 1. Your local changes are stashed
57
+ 2. Latest changes are pulled from Jira
58
+ 3. Changes are committed to your local branch
59
+ 4. Your stashed changes are applied on top of the latest changes
60
+ 5. Your updates are pushed to Jira
61
+ 6. All changes are committed to your local branch
package/dist/index.cjs CHANGED
@@ -78462,6 +78462,114 @@ function gitInstanceFactory(baseDir, options2) {
78462
78462
  init_git_response_error();
78463
78463
  var simpleGit = gitInstanceFactory;
78464
78464
 
78465
+ // node_modules/imdone-core/lib/adapters/logger.js
78466
+ var import_console = require("console");
78467
+ var LogLevel = {
78468
+ ERROR: 0,
78469
+ WARN: 1,
78470
+ INFO: 2,
78471
+ DEBUG: 3,
78472
+ TRACE: 4,
78473
+ NONE: -1
78474
+ // Use this to disable all logging
78475
+ };
78476
+ function getCallerInfo() {
78477
+ const err2 = new Error();
78478
+ const stack = err2.stack?.split("\n");
78479
+ if (!stack || stack.length < 5) return {};
78480
+ const callerLine = stack[4] || stack[3];
78481
+ const match2 = callerLine.match(/at (.+?) \((.+):(\d+):(\d+)\)/) || callerLine.match(/at (.+):(\d+):(\d+)/);
78482
+ if (match2) {
78483
+ if (match2.length === 5) {
78484
+ return {
78485
+ functionName: match2[1],
78486
+ file: match2[2],
78487
+ line: parseInt(match2[3], 10),
78488
+ column: parseInt(match2[4], 10)
78489
+ };
78490
+ } else if (match2.length === 4) {
78491
+ return {
78492
+ functionName: "<anonymous>",
78493
+ file: match2[1],
78494
+ line: parseInt(match2[2], 10),
78495
+ column: parseInt(match2[3], 10)
78496
+ };
78497
+ }
78498
+ }
78499
+ return {};
78500
+ }
78501
+ var Logger = class {
78502
+ constructor() {
78503
+ this.level = LogLevel.INFO;
78504
+ }
78505
+ // Setter for log level
78506
+ setLevel(level) {
78507
+ if (level in LogLevel) {
78508
+ this.level = LogLevel[level];
78509
+ } else if (typeof level === "number" && level >= -1 && level <= 4) {
78510
+ this.level = level;
78511
+ } else {
78512
+ (0, import_console.warn)(`Invalid log level: ${level}. Using default INFO level.`);
78513
+ }
78514
+ return this;
78515
+ }
78516
+ // Check if the provided level should be logged
78517
+ shouldLog(level) {
78518
+ return level <= this.level;
78519
+ }
78520
+ formatMessage(args) {
78521
+ const info3 = getCallerInfo();
78522
+ const prefix = info3.file ? `[${info3.file}:${info3.line}] ${info3.functionName} - ` : "";
78523
+ if (typeof args[0] === "string") {
78524
+ args[0] = prefix + args[0];
78525
+ } else {
78526
+ args.unshift(prefix);
78527
+ }
78528
+ return args;
78529
+ }
78530
+ log(...args) {
78531
+ if (this.shouldLog(LogLevel.INFO)) {
78532
+ (0, import_console.info)(...this.formatMessage(args));
78533
+ }
78534
+ }
78535
+ error(...args) {
78536
+ if (this.shouldLog(LogLevel.ERROR)) {
78537
+ (0, import_console.error)(...this.formatMessage(args));
78538
+ }
78539
+ }
78540
+ warn(...args) {
78541
+ if (this.shouldLog(LogLevel.WARN)) {
78542
+ (0, import_console.warn)(...this.formatMessage(args));
78543
+ }
78544
+ }
78545
+ info(...args) {
78546
+ if (this.shouldLog(LogLevel.INFO)) {
78547
+ (0, import_console.info)(...this.formatMessage(args));
78548
+ }
78549
+ }
78550
+ debug(...args) {
78551
+ if (this.shouldLog(LogLevel.DEBUG)) {
78552
+ (0, import_console.info)(`[DEBUG]`, ...this.formatMessage(args));
78553
+ }
78554
+ }
78555
+ trace(...args) {
78556
+ if (this.shouldLog(LogLevel.TRACE)) {
78557
+ (0, import_console.info)(`[TRACE]`, ...this.formatMessage(args));
78558
+ }
78559
+ }
78560
+ time(label) {
78561
+ if (this.shouldLog(LogLevel.DEBUG)) {
78562
+ console.time(label);
78563
+ }
78564
+ }
78565
+ timeEnd(label) {
78566
+ if (this.shouldLog(LogLevel.DEBUG)) {
78567
+ console.timeEnd(label);
78568
+ }
78569
+ }
78570
+ };
78571
+ var logger = new Logger();
78572
+
78465
78573
  // node_modules/imdone-core/lib/constants.js
78466
78574
  var import_path = __toESM(require("path"), 1);
78467
78575
 
@@ -78753,116 +78861,6 @@ __export(file_gateway_exports, {
78753
78861
  var import_path2 = __toESM(require("path"), 1);
78754
78862
  var import_fs = __toESM(require("fs"), 1);
78755
78863
  var import_sanitize_filename = __toESM(require_sanitize_filename(), 1);
78756
-
78757
- // node_modules/imdone-core/lib/adapters/logger.js
78758
- var import_console = require("console");
78759
- var LogLevel = {
78760
- ERROR: 0,
78761
- WARN: 1,
78762
- INFO: 2,
78763
- DEBUG: 3,
78764
- TRACE: 4,
78765
- NONE: -1
78766
- // Use this to disable all logging
78767
- };
78768
- function getCallerInfo() {
78769
- const err2 = new Error();
78770
- const stack = err2.stack?.split("\n");
78771
- if (!stack || stack.length < 5) return {};
78772
- const callerLine = stack[4] || stack[3];
78773
- const match2 = callerLine.match(/at (.+?) \((.+):(\d+):(\d+)\)/) || callerLine.match(/at (.+):(\d+):(\d+)/);
78774
- if (match2) {
78775
- if (match2.length === 5) {
78776
- return {
78777
- functionName: match2[1],
78778
- file: match2[2],
78779
- line: parseInt(match2[3], 10),
78780
- column: parseInt(match2[4], 10)
78781
- };
78782
- } else if (match2.length === 4) {
78783
- return {
78784
- functionName: "<anonymous>",
78785
- file: match2[1],
78786
- line: parseInt(match2[2], 10),
78787
- column: parseInt(match2[3], 10)
78788
- };
78789
- }
78790
- }
78791
- return {};
78792
- }
78793
- var Logger = class {
78794
- constructor() {
78795
- this.level = LogLevel.INFO;
78796
- }
78797
- // Setter for log level
78798
- setLevel(level) {
78799
- if (level in LogLevel) {
78800
- this.level = LogLevel[level];
78801
- } else if (typeof level === "number" && level >= -1 && level <= 4) {
78802
- this.level = level;
78803
- } else {
78804
- (0, import_console.warn)(`Invalid log level: ${level}. Using default INFO level.`);
78805
- }
78806
- return this;
78807
- }
78808
- // Check if the provided level should be logged
78809
- shouldLog(level) {
78810
- return level <= this.level;
78811
- }
78812
- formatMessage(args) {
78813
- const info3 = getCallerInfo();
78814
- const prefix = info3.file ? `[${info3.file}:${info3.line}] ${info3.functionName} - ` : "";
78815
- if (typeof args[0] === "string") {
78816
- args[0] = prefix + args[0];
78817
- } else {
78818
- args.unshift(prefix);
78819
- }
78820
- return args;
78821
- }
78822
- log(...args) {
78823
- if (this.shouldLog(LogLevel.INFO)) {
78824
- (0, import_console.info)(...this.formatMessage(args));
78825
- }
78826
- }
78827
- error(...args) {
78828
- if (this.shouldLog(LogLevel.ERROR)) {
78829
- (0, import_console.error)(...this.formatMessage(args));
78830
- }
78831
- }
78832
- warn(...args) {
78833
- if (this.shouldLog(LogLevel.WARN)) {
78834
- (0, import_console.warn)(...this.formatMessage(args));
78835
- }
78836
- }
78837
- info(...args) {
78838
- if (this.shouldLog(LogLevel.INFO)) {
78839
- (0, import_console.info)(...this.formatMessage(args));
78840
- }
78841
- }
78842
- debug(...args) {
78843
- if (this.shouldLog(LogLevel.DEBUG)) {
78844
- (0, import_console.info)(`[DEBUG]`, ...this.formatMessage(args));
78845
- }
78846
- }
78847
- trace(...args) {
78848
- if (this.shouldLog(LogLevel.TRACE)) {
78849
- (0, import_console.info)(`[TRACE]`, ...this.formatMessage(args));
78850
- }
78851
- }
78852
- time(label) {
78853
- if (this.shouldLog(LogLevel.DEBUG)) {
78854
- console.time(label);
78855
- }
78856
- }
78857
- timeEnd(label) {
78858
- if (this.shouldLog(LogLevel.DEBUG)) {
78859
- console.timeEnd(label);
78860
- }
78861
- }
78862
- };
78863
- var logger = new Logger();
78864
-
78865
- // node_modules/imdone-core/lib/adapters/file-gateway.js
78866
78864
  var fs = import_fs.default;
78867
78865
  async function exists2(path13) {
78868
78866
  try {
@@ -79068,7 +79066,9 @@ async function expectNoChanges(projectPath, message) {
79068
79066
  }
79069
79067
  async function addAndCommitChanges(projectPath, message, add2 = ["."]) {
79070
79068
  const git = gitRepo(projectPath);
79069
+ logger.debug("addAndCommitChanges before status: ", { message, add: add2 });
79071
79070
  const files = await status();
79071
+ logger.debug("addAndCommitChanges after status: ", { message, files });
79072
79072
  if (files.length === 0) {
79073
79073
  return;
79074
79074
  }
@@ -79076,8 +79076,12 @@ async function addAndCommitChanges(projectPath, message, add2 = ["."]) {
79076
79076
  if (toAdd.length === 0) {
79077
79077
  return;
79078
79078
  }
79079
- await git.add(toAdd);
79080
- await git.commit(message);
79079
+ logger.debug("addAndCommitChanges before add : ", { message, toAdd });
79080
+ const addResponse = await git.add(toAdd);
79081
+ logger.debug("addAndCommitChanges after add: ", { message, toAdd, addResponse });
79082
+ logger.debug("addAndCommitChanges before commit: ", { message });
79083
+ const commitResponse = await git.commit(message);
79084
+ logger.debug("addAndCommitChanges after commit: ", { message, commitResponse });
79081
79085
  }
79082
79086
  async function stashChanges(projectPath) {
79083
79087
  const git = gitRepo(projectPath);
@@ -99296,7 +99300,7 @@ async function getJiraAdapter({ _fetch = fetch3, projectKeys, issueType, jiraUrl
99296
99300
  async function getIssueTypes() {
99297
99301
  const project2 = await getProject2();
99298
99302
  logger2.debug("PROJECT:", project2);
99299
- return project2.issueTypes.map((type) => type.name);
99303
+ return project2.issueTypes?.map((type) => type.name);
99300
99304
  }
99301
99305
  function getTaskUrl(key2) {
99302
99306
  return `${jiraUrl}/browse/${key2}`;
@@ -99803,7 +99807,7 @@ var JiraPlugin = class extends import_imdone_api8.default {
99803
99807
  return this.getSettings().jql;
99804
99808
  }
99805
99809
  get projectKeys() {
99806
- return this.getSettings().projectKeys.map((p) => p.key);
99810
+ return this.getSettings().projectKeys?.map((p) => p.key);
99807
99811
  }
99808
99812
  get issueType() {
99809
99813
  return this.getSettings().issueType;
@@ -99853,6 +99857,9 @@ ${task.interpretedContent}`;
99853
99857
  plugin: "JiraPlugin"
99854
99858
  };
99855
99859
  }
99860
+ get defaultIssueType() {
99861
+ return this.issueTypes && this.issueTypes.length > 0 && this.issueTypes[0];
99862
+ }
99856
99863
  getBoardActions() {
99857
99864
  const project2 = this.project;
99858
99865
  const jiraAdapter = this.jiraAdapter;
@@ -99992,7 +99999,7 @@ ${e2.stack}`, "Error updating project from Jira. Copied to clipboard.");
99992
99999
  new import_settings.ArrayProperty().setTitle("Metadata Mappings").itemTitle("Metadata Mapping").addItemProperty("jira", new import_settings.StringProperty().setTitle("Jira Field")).addItemProperty("imdone", new import_settings.StringProperty().setTitle("Imdone Metadata"))
99993
100000
  ).addProperty(
99994
100001
  "issueType",
99995
- new import_settings.StringProperty().setTitle("Default Issue Type").allowedValues(this.issueTypes).setDefault(this.issueTypes[0])
100002
+ new import_settings.StringProperty().setTitle("Default Issue Type").allowedValues(this.issueTypes).setDefault(this.defaultIssueType)
99996
100003
  );
99997
100004
  return this.settingSchema;
99998
100005
  }
@@ -102760,7 +102767,7 @@ async function imdoneInit(projectPath, { name: name2, jiraUrl, jiraProjectKey, j
102760
102767
  // package.json
102761
102768
  var package_default = {
102762
102769
  name: "imdone-cli",
102763
- version: "0.1.7",
102770
+ version: "0.2.1",
102764
102771
  author: "Jesse Piascik",
102765
102772
  description: "An imdone cli that automates your jira updates with markdown files.",
102766
102773
  license: "Proprietary",
@@ -102773,6 +102780,12 @@ var package_default = {
102773
102780
  imdone: "dist/index.min.cjs",
102774
102781
  "imdone-debug": "dist/index.cjs"
102775
102782
  },
102783
+ files: [
102784
+ "dist",
102785
+ "docs",
102786
+ "LICENSE",
102787
+ "README.md"
102788
+ ],
102776
102789
  scripts: {
102777
102790
  prepublishOnly: "npm --prefix ../ install && npm --prefix ../ run build && npm i && npm test && npm run build",
102778
102791
  link: "npm link ../../imdone-core-2 ../../imdone-api",