threadlines 0.1.8 → 0.1.10
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 +69 -2
- package/dist/commands/init.js +1 -0
- package/dist/git/repo.js +10 -2
- package/dist/index.js +15 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -24,16 +24,43 @@ Getting teams to follow consistent quality standards is **hard**. Really hard.
|
|
|
24
24
|
|
|
25
25
|
## Installation
|
|
26
26
|
|
|
27
|
+
### Option 1: Global Installation (Recommended for Regular Use)
|
|
28
|
+
|
|
27
29
|
```bash
|
|
28
30
|
npm install -g threadlines
|
|
29
31
|
```
|
|
30
32
|
|
|
31
|
-
|
|
33
|
+
Then use directly:
|
|
34
|
+
```bash
|
|
35
|
+
threadlines check
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Option 2: Use with npx (No Installation)
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npx threadlines check
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**For non-interactive environments** (CI/CD, AI assistants like Cursor):
|
|
45
|
+
```bash
|
|
46
|
+
npx --yes threadlines check
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
The `--yes` flag auto-confirms package installation, preventing prompts that block automation.
|
|
50
|
+
|
|
51
|
+
### Option 3: Local Project Dependency (Recommended for Teams)
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
npm install --save-dev threadlines
|
|
55
|
+
```
|
|
32
56
|
|
|
57
|
+
Then use:
|
|
33
58
|
```bash
|
|
34
59
|
npx threadlines check
|
|
35
60
|
```
|
|
36
61
|
|
|
62
|
+
This ensures everyone on your team uses the same version.
|
|
63
|
+
|
|
37
64
|
## Quick Start
|
|
38
65
|
|
|
39
66
|
### 1. Initialize Your First Threadline
|
|
@@ -88,10 +115,50 @@ Creates a template threadline file to get you started. The command will:
|
|
|
88
115
|
threadlines check
|
|
89
116
|
```
|
|
90
117
|
|
|
91
|
-
|
|
118
|
+
By default, analyzes your staged/unstaged git changes against all threadlines in the `/threadlines` directory.
|
|
119
|
+
|
|
120
|
+
**Common Use Cases:**
|
|
121
|
+
|
|
122
|
+
**Check latest commit locally:**
|
|
123
|
+
```bash
|
|
124
|
+
threadlines check --commit HEAD
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
**Check a specific commit:**
|
|
128
|
+
```bash
|
|
129
|
+
threadlines check --commit abc123def
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**Check all commits in a branch:**
|
|
133
|
+
```bash
|
|
134
|
+
threadlines check --branch feature/new-feature
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
**Check entire file(s):**
|
|
138
|
+
```bash
|
|
139
|
+
threadlines check --file src/api/users.ts
|
|
140
|
+
threadlines check --files src/api/users.ts src/api/posts.ts
|
|
141
|
+
threadlines check --folder src/api
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
**Show all results (not just violations):**
|
|
145
|
+
```bash
|
|
146
|
+
threadlines check --full
|
|
147
|
+
```
|
|
92
148
|
|
|
93
149
|
**Options:**
|
|
94
150
|
- `--api-url <url>` - Override the server URL (default: http://localhost:3000)
|
|
151
|
+
- `--commit <ref>` - Review specific commit. Accepts commit SHA or git reference (e.g., `HEAD`, `HEAD~1`, `abc123`)
|
|
152
|
+
- `--branch <name>` - Review all commits in branch vs base
|
|
153
|
+
- `--file <path>` - Review entire file (all lines as additions)
|
|
154
|
+
- `--folder <path>` - Review all files in folder recursively
|
|
155
|
+
- `--files <paths...>` - Review multiple specified files
|
|
156
|
+
- `--full` - Show all results (compliant, attention, not_relevant). Default: only attention items
|
|
157
|
+
|
|
158
|
+
**Auto-detection in CI:**
|
|
159
|
+
- CI with branch detected → reviews all commits in branch vs base
|
|
160
|
+
- CI with commit SHA detected → reviews specific commit
|
|
161
|
+
- Local development → reviews staged/unstaged changes
|
|
95
162
|
|
|
96
163
|
## Configuration
|
|
97
164
|
|
package/dist/commands/init.js
CHANGED
|
@@ -105,6 +105,7 @@ async function initCommand() {
|
|
|
105
105
|
console.log(chalk_1.default.white(' Make sure .env.local is in your .gitignore file!'));
|
|
106
106
|
console.log('');
|
|
107
107
|
console.log(chalk_1.default.gray(' 3. Run: npx threadlines check'));
|
|
108
|
+
console.log(chalk_1.default.gray(' (Use npx --yes threadlines check in non-interactive environments)'));
|
|
108
109
|
}
|
|
109
110
|
catch (error) {
|
|
110
111
|
console.error(chalk_1.default.red(`\n❌ Error: ${error.message}`));
|
package/dist/git/repo.js
CHANGED
|
@@ -16,10 +16,16 @@ async function getRepoName(repoRoot) {
|
|
|
16
16
|
try {
|
|
17
17
|
const remotes = await git.getRemotes(true);
|
|
18
18
|
const origin = remotes.find(r => r.name === 'origin');
|
|
19
|
-
if (!origin
|
|
19
|
+
if (!origin) {
|
|
20
|
+
console.log(' [DEBUG] No origin remote found');
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
if (!origin.refs?.fetch) {
|
|
24
|
+
console.log(' [DEBUG] Origin remote found but no fetch URL');
|
|
20
25
|
return null;
|
|
21
26
|
}
|
|
22
27
|
const url = origin.refs.fetch;
|
|
28
|
+
console.log(` [DEBUG] Git remote URL: ${url}`);
|
|
23
29
|
// Parse repo name from common URL formats:
|
|
24
30
|
// - https://github.com/user/repo.git
|
|
25
31
|
// - git@github.com:user/repo.git
|
|
@@ -32,13 +38,15 @@ async function getRepoName(repoRoot) {
|
|
|
32
38
|
for (const pattern of patterns) {
|
|
33
39
|
const match = url.match(pattern);
|
|
34
40
|
if (match && match[1]) {
|
|
41
|
+
console.log(` [DEBUG] Matched repo name: ${match[1]}`);
|
|
35
42
|
return match[1];
|
|
36
43
|
}
|
|
37
44
|
}
|
|
45
|
+
console.log(' [DEBUG] No pattern matched the remote URL');
|
|
38
46
|
return null;
|
|
39
47
|
}
|
|
40
48
|
catch (error) {
|
|
41
|
-
|
|
49
|
+
console.log(` [DEBUG] Error getting repo name: ${error.message}`);
|
|
42
50
|
return null;
|
|
43
51
|
}
|
|
44
52
|
}
|
package/dist/index.js
CHANGED
|
@@ -63,10 +63,23 @@ program
|
|
|
63
63
|
.description('Check code against your threadlines')
|
|
64
64
|
.option('--api-url <url>', 'Threadline server URL', process.env.THREADLINE_API_URL || (process.env.VERCEL_URL ? `https://${process.env.VERCEL_URL}` : 'http://localhost:3000'))
|
|
65
65
|
.option('--full', 'Show all results (compliant, attention, not_relevant). Default: only attention items')
|
|
66
|
-
.option('--branch <name>', 'Review all commits in branch vs base')
|
|
67
|
-
.option('--commit <
|
|
66
|
+
.option('--branch <name>', 'Review all commits in branch vs base (e.g., --branch feature/new-feature)')
|
|
67
|
+
.option('--commit <ref>', 'Review specific commit. Accepts commit SHA or git reference (e.g., HEAD, HEAD~1, abc123). Example: --commit HEAD')
|
|
68
68
|
.option('--file <path>', 'Review entire file (all lines as additions)')
|
|
69
69
|
.option('--folder <path>', 'Review all files in folder recursively')
|
|
70
70
|
.option('--files <paths...>', 'Review multiple specified files')
|
|
71
|
+
.addHelpText('after', `
|
|
72
|
+
Examples:
|
|
73
|
+
$ threadlines check # Check staged/unstaged changes (local dev)
|
|
74
|
+
$ threadlines check --commit HEAD # Check latest commit locally
|
|
75
|
+
$ threadlines check --branch main # Check all commits in branch vs base
|
|
76
|
+
$ threadlines check --file src/api.ts # Check entire file
|
|
77
|
+
$ threadlines check --full # Show all results (not just attention items)
|
|
78
|
+
|
|
79
|
+
Auto-detection in CI:
|
|
80
|
+
- CI with branch detected → reviews all commits in branch vs base
|
|
81
|
+
- CI with commit SHA detected → reviews specific commit
|
|
82
|
+
- Local development → reviews staged/unstaged changes
|
|
83
|
+
`)
|
|
71
84
|
.action(check_1.checkCommand);
|
|
72
85
|
program.parse();
|