@metmirr/prlen 0.1.0 → 1.0.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metmirr/prlen",
3
- "version": "0.1.0",
3
+ "version": "1.0.0",
4
4
  "description": "CLI for publishing PR Lens posts from pull requests",
5
5
  "type": "module",
6
6
  "files": [
@@ -7,94 +7,71 @@ description: Publish or create PR Lens posts for a GitHub pull request. Use when
7
7
 
8
8
  Use this skill when the user wants an agent to publish a PR Lens post for a pull request.
9
9
 
10
- ## Goal
10
+ ## Critical rule
11
11
 
12
- Use the fastest reliable workflow:
13
-
14
- 1. Resolve the PR reference (`#12`, `12`, or a full GitHub PR URL)
15
- 2. Read enough PR context to draft a good short post
16
- 3. Draft the PR Lens post text yourself
17
- 4. Publish non-interactively via the CLI using stdin
18
-
19
- The agent is already an LLM, so do **not** wait for the CLI to generate the text.
20
-
21
- ## Preferred publish command
12
+ **You MUST fetch the PR Lens system prompt before writing any post text.** Run:
22
13
 
23
14
  ```bash
24
- printf '%s' "<draft post text>" | prlen post 12 --prompt-stdin --yes
15
+ prlen template
25
16
  ```
26
17
 
27
- ## PR Lens post style
28
-
29
- Write like a real developer talking to Claude/Cursor/Copilot:
18
+ The system prompt defines the exact style, tone, length, and rules for every post. Do not skip this step. Do not rely on your own judgment for post style. The template is the authority.
30
19
 
31
- - casual and direct
32
- - 2–3 sentences max
33
- - specific technologies, file paths, and decisions when visible
34
- - under 500 chars
35
- - instruction-style wording, not release notes
36
- - no quotes, no labels
37
-
38
- Good:
20
+ ## Workflow
39
21
 
40
- ```text
41
- Add CLI publishing for PR Lens with browser-approved login, backend-fetched PR metadata, and non-interactive posting for agents. Keep it simple: login in the browser once, then let the CLI publish directly from the terminal.
42
- ```
22
+ Follow these steps in order. Do not skip or reorder them.
43
23
 
44
- Bad:
24
+ ### Step 1: Fetch the system prompt
45
25
 
46
- ```text
47
- This PR adds several new features to improve the PR Lens platform.
26
+ ```bash
27
+ prlen template
48
28
  ```
49
29
 
50
- ## Workflow
30
+ Read the output carefully. It contains:
31
+ - the voice and tone to use
32
+ - the maximum character limit
33
+ - what to include and what to avoid
51
34
 
52
- ### 1. Resolve the PR
35
+ You must follow every rule in the system prompt when drafting the post.
53
36
 
54
- Prefer the user's PR reference directly.
37
+ ### Step 2: Resolve the PR
55
38
 
56
- - `#12`
57
- - `12`
58
- - `https://github.com/org/repo/pull/12`
39
+ Use the PR reference the user gave you:
59
40
 
60
- ### 2. Inspect the PR
41
+ - `#12`, `12`, or `https://github.com/org/repo/pull/12`
61
42
 
62
- Read enough context to write a high-quality short post:
43
+ ### Step 3: Inspect the PR
63
44
 
64
- - PR title
65
- - PR description/body
66
- - changed files
67
- - important parts of the diff
68
- - notable implementation constraints or design choices
45
+ Read enough context to write a high-quality post:
69
46
 
70
- ### 3. Optionally fetch the PR Lens prompt template
47
+ - PR title and description
48
+ - changed files and important parts of the diff
49
+ - notable design decisions or constraints
71
50
 
72
- If you want style guidance, fetch:
51
+ ### Step 4: Draft the post following the system prompt
73
52
 
74
- ```text
75
- GET /api/v1/prompt-template
76
- ```
53
+ Write the post text applying every rule from the system prompt you fetched in step 1.
77
54
 
78
- Do not block on this if you already have enough context to write the post.
55
+ Key rules from the template (these may change always re-read the actual output):
56
+ - sound like a developer typing in a chat box
57
+ - ~280 characters, never exceed 500, 2-3 sentences max
58
+ - name specific technologies, file paths, patterns from the diff
59
+ - write the INSTRUCTION that produced the code, not a description of what it does
60
+ - output only the prompt text, no quotes, no labels
79
61
 
80
- ### 4. Publish via CLI
62
+ ### Step 5: Publish
81
63
 
82
- Use stdin to avoid shell-escaping problems.
64
+ Use stdin to avoid shell-escaping problems:
83
65
 
84
66
  ```bash
85
- printf '%s' "<draft post text>" | prlen post 12 --prompt-stdin --yes
67
+ printf '%s' "<your drafted post text>" | prlen post 12 --prompt-stdin --yes
86
68
  ```
87
69
 
88
- ### 5. Report the result
70
+ ### Step 6: Report
89
71
 
90
72
  Tell the user the post was published and include the returned URL.
91
73
 
92
- ## Auth expectations
93
-
94
- PR Lens CLI auth usually comes from:
95
-
96
- - `~/.config/prlen/auth.json`
97
- - `PRLEN_TOKEN`
74
+ ## Auth
98
75
 
99
76
  If auth is missing, tell the user to run:
100
77
 
@@ -102,12 +79,10 @@ If auth is missing, tell the user to run:
102
79
  prlen login
103
80
  ```
104
81
 
105
- `prlen login` opens a browser approval page on PR Lens. If the user is already signed in on the website, they can approve the CLI login there without manually handling GitHub tokens.
106
-
107
82
  ## Notes
108
83
 
109
- - `prlen post` fetches PR metadata through PR Lens using the user's connected GitHub account.
110
- - The target repository must already be connected in PR Lens.
84
+ - `prlen post` auto-connects repos that aren't connected yet.
111
85
  - The pull request must not already have a PR Lens post.
86
+ - The daily post limit is enforced server-side.
112
87
 
113
88
  See [reference.md](reference.md) for examples and fallback behavior.
@@ -1,25 +1,41 @@
1
1
  # PR Lens Skill Reference
2
2
 
3
+ ## Full workflow example
4
+
5
+ ```bash
6
+ # 1. Always fetch the system prompt first
7
+ prlen template
8
+
9
+ # 2. Read the output and draft a post that follows its rules
10
+
11
+ # 3. Publish
12
+ printf '%s' "Add browser-approved CLI login that replaces GitHub device flow. The backend issues a challenge URL, the CLI opens it, and the user clicks approve — no tokens needed in the terminal." | prlen post 12 --prompt-stdin --yes
13
+ ```
14
+
3
15
  ## Common commands
4
16
 
5
- ### Log in once
17
+ ### Fetch the system prompt (mandatory before every post)
6
18
 
7
19
  ```bash
8
- prlen login
20
+ prlen template
9
21
  ```
10
22
 
11
- This opens a browser approval page on PR Lens.
23
+ ### Log in
24
+
25
+ ```bash
26
+ prlen login
27
+ ```
12
28
 
13
- ### Publish PR #12 with agent-authored text
29
+ ### Publish a post
14
30
 
15
31
  ```bash
16
- printf '%s' "Add API-backed PR Lens publishing for pull requests with browser-approved login and non-interactive agent mode." | prlen post 12 --prompt-stdin --yes
32
+ printf '%s' "<post text following the system prompt rules>" | prlen post 12 --prompt-stdin --yes
17
33
  ```
18
34
 
19
35
  ### Full PR URL instead of number
20
36
 
21
37
  ```bash
22
- printf '%s' "Add API-backed PR Lens publishing for pull requests with browser-approved login and non-interactive agent mode." | prlen post https://github.com/org/repo/pull/12 --prompt-stdin --yes
38
+ printf '%s' "<post text>" | prlen post https://github.com/org/repo/pull/12 --prompt-stdin --yes
23
39
  ```
24
40
 
25
41
  ## Fallbacks
@@ -27,27 +43,26 @@ printf '%s' "Add API-backed PR Lens publishing for pull requests with browser-ap
27
43
  ### If prompt text is already available as a string
28
44
 
29
45
  ```bash
30
- prlen post 12 --prompt "<draft post text>" --yes
46
+ prlen post 12 --prompt "<post text>" --yes
31
47
  ```
32
48
 
33
49
  `--prompt-stdin` is still safer for agents.
34
50
 
35
51
  ## What to write
36
52
 
37
- Aim for:
53
+ Follow the system prompt from `prlen template`. The key points:
38
54
 
39
- - the instruction that produced the code
40
- - constraints or design choices
41
- - names of files/tech when relevant
42
- - no markdown formatting
43
- - no surrounding quotes
55
+ - write the instruction that produced the code
56
+ - sound like a developer in a chat box
57
+ - be specific about technologies, file paths, design choices
58
+ - ~280 chars target, never exceed 500
59
+ - no markdown, no quotes, no labels
44
60
 
45
61
  ## If publishing fails
46
62
 
47
63
  Check:
48
64
 
49
65
  1. PR Lens auth exists (`prlen login`)
50
- 2. the repo is connected in PR Lens
51
- 3. the PR does not already have a post
52
- 4. the daily post limit has not been reached
53
- 5. the PR Lens server URL is correct if using a local instance (`PRLEN_BASE_URL`)
66
+ 2. the PR does not already have a post
67
+ 3. the daily post limit has not been reached
68
+ 4. the PR Lens server URL is correct if using a local instance (`PRLEN_BASE_URL`)