linear-github-cli 1.0.1 → 1.0.3
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/dist/cli.js +12 -5
- package/dist/commands/commit-first.js +3 -5
- package/dist/env-utils.js +43 -0
- package/dist/lgcmf.js +11 -4
- package/package.json +4 -2
package/dist/cli.js
CHANGED
|
@@ -1,19 +1,26 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
3
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
7
|
const commander_1 = require("commander");
|
|
5
|
-
const
|
|
8
|
+
const fs_1 = require("fs");
|
|
6
9
|
const path_1 = require("path");
|
|
10
|
+
const update_notifier_1 = __importDefault(require("update-notifier"));
|
|
7
11
|
const create_parent_1 = require("./commands/create-parent");
|
|
8
12
|
const create_sub_1 = require("./commands/create-sub");
|
|
9
|
-
|
|
10
|
-
//
|
|
11
|
-
(0,
|
|
13
|
+
const env_utils_1 = require("./env-utils");
|
|
14
|
+
// Load .env file from current working directory, parent directories, or home directory
|
|
15
|
+
(0, env_utils_1.loadEnvFile)();
|
|
16
|
+
// Check for updates
|
|
17
|
+
const pkg = JSON.parse((0, fs_1.readFileSync)((0, path_1.resolve)(__dirname, '..', 'package.json'), 'utf-8'));
|
|
18
|
+
(0, update_notifier_1.default)({ pkg }).notify();
|
|
12
19
|
const program = new commander_1.Command();
|
|
13
20
|
program
|
|
14
21
|
.name('lg')
|
|
15
22
|
.description('Linear + GitHub Integration CLI - Create GitHub issues with Linear sync')
|
|
16
|
-
.version('1.0.
|
|
23
|
+
.version('1.0.3');
|
|
17
24
|
program
|
|
18
25
|
.command('create-parent')
|
|
19
26
|
.alias('parent')
|
|
@@ -2,13 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.commitFirst = commitFirst;
|
|
4
4
|
const child_process_1 = require("child_process");
|
|
5
|
-
const dotenv_1 = require("dotenv");
|
|
6
|
-
const path_1 = require("path");
|
|
7
5
|
const branch_utils_1 = require("../branch-utils");
|
|
8
6
|
const linear_client_1 = require("../linear-client");
|
|
9
|
-
|
|
10
|
-
//
|
|
11
|
-
(0,
|
|
7
|
+
const env_utils_1 = require("../env-utils");
|
|
8
|
+
// Load .env file from current working directory, parent directories, or home directory
|
|
9
|
+
(0, env_utils_1.loadEnvFile)();
|
|
12
10
|
/**
|
|
13
11
|
* Creates the first commit with proper message format
|
|
14
12
|
* - Extracts branch prefix (commit type) and Linear issue ID from current branch name
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.loadEnvFile = loadEnvFile;
|
|
4
|
+
const dotenv_1 = require("dotenv");
|
|
5
|
+
const fs_1 = require("fs");
|
|
6
|
+
const path_1 = require("path");
|
|
7
|
+
const os_1 = require("os");
|
|
8
|
+
/**
|
|
9
|
+
* Finds and loads .env file from multiple locations:
|
|
10
|
+
* 1. Current working directory and parent directories (up to filesystem root)
|
|
11
|
+
* 2. Home directory (~/.env)
|
|
12
|
+
*
|
|
13
|
+
* This allows the CLI to work both when:
|
|
14
|
+
* - Installed globally (user can create .env in their project or home directory)
|
|
15
|
+
* - Installed locally (works with project's .env file)
|
|
16
|
+
*/
|
|
17
|
+
function loadEnvFile() {
|
|
18
|
+
// First, try to find .env in current working directory and parent directories
|
|
19
|
+
let currentDir = process.cwd();
|
|
20
|
+
const root = process.platform === 'win32' ? currentDir.split('\\')[0] + '\\' : '/';
|
|
21
|
+
while (currentDir !== root) {
|
|
22
|
+
const envPath = (0, path_1.resolve)(currentDir, '.env');
|
|
23
|
+
if ((0, fs_1.existsSync)(envPath)) {
|
|
24
|
+
(0, dotenv_1.config)({ path: envPath });
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const parentDir = (0, path_1.dirname)(currentDir);
|
|
28
|
+
// Stop if we've reached the filesystem root (parent is same as current)
|
|
29
|
+
if (parentDir === currentDir) {
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
currentDir = parentDir;
|
|
33
|
+
}
|
|
34
|
+
// Fallback: try home directory
|
|
35
|
+
const homeEnvPath = (0, path_1.resolve)((0, os_1.homedir)(), '.env');
|
|
36
|
+
if ((0, fs_1.existsSync)(homeEnvPath)) {
|
|
37
|
+
(0, dotenv_1.config)({ path: homeEnvPath });
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
// If no .env file found, dotenv will use environment variables
|
|
41
|
+
// This is fine - we don't need to throw an error here
|
|
42
|
+
(0, dotenv_1.config)();
|
|
43
|
+
}
|
package/dist/lgcmf.js
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
3
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
const
|
|
7
|
+
const fs_1 = require("fs");
|
|
5
8
|
const path_1 = require("path");
|
|
9
|
+
const update_notifier_1 = __importDefault(require("update-notifier"));
|
|
6
10
|
const commit_first_1 = require("./commands/commit-first");
|
|
7
|
-
|
|
8
|
-
//
|
|
9
|
-
(0,
|
|
11
|
+
const env_utils_1 = require("./env-utils");
|
|
12
|
+
// Load .env file from current working directory, parent directories, or home directory
|
|
13
|
+
(0, env_utils_1.loadEnvFile)();
|
|
14
|
+
// Check for updates
|
|
15
|
+
const pkg = JSON.parse((0, fs_1.readFileSync)((0, path_1.resolve)(__dirname, '..', 'package.json'), 'utf-8'));
|
|
16
|
+
(0, update_notifier_1.default)({ pkg }).notify();
|
|
10
17
|
(0, commit_first_1.commitFirst)().catch((error) => {
|
|
11
18
|
console.error('❌ Error:', error instanceof Error ? error.message : error);
|
|
12
19
|
process.exit(1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "linear-github-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "CLI tool for creating GitHub issues with Linear integration",
|
|
5
5
|
"main": "dist/cli.js",
|
|
6
6
|
"bin": {
|
|
@@ -45,11 +45,13 @@
|
|
|
45
45
|
"commander": "^11.0.0",
|
|
46
46
|
"date-fns": "^3.0.0",
|
|
47
47
|
"dotenv": "^16.4.5",
|
|
48
|
-
"inquirer": "^9.2.0"
|
|
48
|
+
"inquirer": "^9.2.0",
|
|
49
|
+
"update-notifier": "^6.0.1"
|
|
49
50
|
},
|
|
50
51
|
"devDependencies": {
|
|
51
52
|
"@types/inquirer": "^9.0.9",
|
|
52
53
|
"@types/node": "^20.0.0",
|
|
54
|
+
"@types/update-notifier": "^6.0.8",
|
|
53
55
|
"tsx": "^4.0.0",
|
|
54
56
|
"typescript": "^5.0.0"
|
|
55
57
|
}
|