bmad-method 6.3.1-next.21 → 6.3.1-next.23
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 +1 -1
- package/src/bmm-skills/4-implementation/bmad-checkpoint-preview/SKILL.md +46 -7
- package/src/bmm-skills/4-implementation/bmad-checkpoint-preview/customize.toml +41 -0
- package/src/bmm-skills/4-implementation/bmad-checkpoint-preview/step-05-wrapup.md +6 -0
- package/src/bmm-skills/4-implementation/bmad-code-review/SKILL.md +85 -1
- package/src/bmm-skills/4-implementation/bmad-code-review/customize.toml +41 -0
- package/src/bmm-skills/4-implementation/bmad-code-review/steps/step-04-present.md +6 -0
- package/src/bmm-skills/4-implementation/bmad-dev-story/SKILL.md +480 -1
- package/src/bmm-skills/4-implementation/bmad-dev-story/customize.toml +41 -0
- package/src/bmm-skills/4-implementation/bmad-quick-dev/SKILL.md +106 -1
- package/src/bmm-skills/4-implementation/bmad-quick-dev/customize.toml +41 -0
- package/src/bmm-skills/4-implementation/bmad-quick-dev/step-05-present.md +6 -0
- package/src/bmm-skills/4-implementation/bmad-quick-dev/step-oneshot.md +6 -0
- package/src/bmm-skills/4-implementation/bmad-sprint-planning/SKILL.md +294 -1
- package/src/bmm-skills/4-implementation/bmad-sprint-planning/customize.toml +41 -0
- package/src/bmm-skills/4-implementation/bmad-sprint-status/SKILL.md +292 -1
- package/src/bmm-skills/4-implementation/bmad-sprint-status/customize.toml +41 -0
- package/tools/installer/core/manifest.js +38 -22
- package/tools/installer/ui.js +159 -21
- package/src/bmm-skills/4-implementation/bmad-code-review/workflow.md +0 -55
- package/src/bmm-skills/4-implementation/bmad-dev-story/workflow.md +0 -450
- package/src/bmm-skills/4-implementation/bmad-quick-dev/workflow.md +0 -76
- package/src/bmm-skills/4-implementation/bmad-sprint-planning/workflow.md +0 -263
- package/src/bmm-skills/4-implementation/bmad-sprint-status/workflow.md +0 -261
|
@@ -3,4 +3,295 @@ name: bmad-sprint-status
|
|
|
3
3
|
description: 'Summarize sprint status and surface risks. Use when the user says "check sprint status" or "show sprint status"'
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
# Sprint Status Workflow
|
|
7
|
+
|
|
8
|
+
**Goal:** Summarize sprint status, surface risks, and recommend the next workflow action.
|
|
9
|
+
|
|
10
|
+
**Your Role:** You are a Developer providing clear, actionable sprint visibility. No time estimates — focus on status, risks, and next steps.
|
|
11
|
+
|
|
12
|
+
## Conventions
|
|
13
|
+
|
|
14
|
+
- Bare paths (e.g. `checklist.md`) resolve from the skill root.
|
|
15
|
+
- `{skill-root}` resolves to this skill's installed directory (where `customize.toml` lives).
|
|
16
|
+
- `{project-root}`-prefixed paths resolve from the project working directory.
|
|
17
|
+
- `{skill-name}` resolves to the skill directory's basename.
|
|
18
|
+
|
|
19
|
+
## On Activation
|
|
20
|
+
|
|
21
|
+
### Step 1: Resolve the Workflow Block
|
|
22
|
+
|
|
23
|
+
Run: `python3 {project-root}/_bmad/scripts/resolve_customization.py --skill {skill-root} --key workflow`
|
|
24
|
+
|
|
25
|
+
**If the script fails**, resolve the `workflow` block yourself by reading these three files in base → team → user order and applying the same structural merge rules as the resolver:
|
|
26
|
+
|
|
27
|
+
1. `{skill-root}/customize.toml` — defaults
|
|
28
|
+
2. `{project-root}/_bmad/custom/{skill-name}.toml` — team overrides
|
|
29
|
+
3. `{project-root}/_bmad/custom/{skill-name}.user.toml` — personal overrides
|
|
30
|
+
|
|
31
|
+
Any missing file is skipped. Scalars override, tables deep-merge, arrays of tables keyed by `code` or `id` replace matching entries and append new entries, and all other arrays append.
|
|
32
|
+
|
|
33
|
+
### Step 2: Execute Prepend Steps
|
|
34
|
+
|
|
35
|
+
Execute each entry in `{workflow.activation_steps_prepend}` in order before proceeding.
|
|
36
|
+
|
|
37
|
+
### Step 3: Load Persistent Facts
|
|
38
|
+
|
|
39
|
+
Treat every entry in `{workflow.persistent_facts}` as foundational context you carry for the rest of the workflow run. Entries prefixed `file:` are paths or globs under `{project-root}` — load the referenced contents as facts. All other entries are facts verbatim.
|
|
40
|
+
|
|
41
|
+
### Step 4: Load Config
|
|
42
|
+
|
|
43
|
+
Load config from `{project-root}/_bmad/bmm/config.yaml` and resolve:
|
|
44
|
+
|
|
45
|
+
- `project_name`, `user_name`
|
|
46
|
+
- `communication_language`, `document_output_language`
|
|
47
|
+
- `implementation_artifacts`
|
|
48
|
+
- `date` as system-generated current datetime
|
|
49
|
+
- YOU MUST ALWAYS SPEAK OUTPUT in your Agent communication style with the config `{communication_language}`
|
|
50
|
+
|
|
51
|
+
### Step 5: Greet the User
|
|
52
|
+
|
|
53
|
+
Greet `{user_name}`, speaking in `{communication_language}`.
|
|
54
|
+
|
|
55
|
+
### Step 6: Execute Append Steps
|
|
56
|
+
|
|
57
|
+
Execute each entry in `{workflow.activation_steps_append}` in order.
|
|
58
|
+
|
|
59
|
+
Activation is complete. Begin the workflow below.
|
|
60
|
+
|
|
61
|
+
## Paths
|
|
62
|
+
|
|
63
|
+
- `sprint_status_file` = `{implementation_artifacts}/sprint-status.yaml`
|
|
64
|
+
|
|
65
|
+
## Input Files
|
|
66
|
+
|
|
67
|
+
| Input | Path | Load Strategy |
|
|
68
|
+
|-------|------|---------------|
|
|
69
|
+
| Sprint status | `{sprint_status_file}` | FULL_LOAD |
|
|
70
|
+
|
|
71
|
+
## Execution
|
|
72
|
+
|
|
73
|
+
<workflow>
|
|
74
|
+
|
|
75
|
+
<step n="0" goal="Determine execution mode">
|
|
76
|
+
<action>Set mode = {{mode}} if provided by caller; otherwise mode = "interactive"</action>
|
|
77
|
+
|
|
78
|
+
<check if="mode == data">
|
|
79
|
+
<action>Jump to Step 20</action>
|
|
80
|
+
</check>
|
|
81
|
+
|
|
82
|
+
<check if="mode == validate">
|
|
83
|
+
<action>Jump to Step 30</action>
|
|
84
|
+
</check>
|
|
85
|
+
|
|
86
|
+
<check if="mode == interactive">
|
|
87
|
+
<action>Continue to Step 1</action>
|
|
88
|
+
</check>
|
|
89
|
+
</step>
|
|
90
|
+
|
|
91
|
+
<step n="1" goal="Locate sprint status file">
|
|
92
|
+
<action>Load {project_context} for project-wide patterns and conventions (if exists)</action>
|
|
93
|
+
<action>Try {sprint_status_file}</action>
|
|
94
|
+
<check if="file not found">
|
|
95
|
+
<output>sprint-status.yaml not found.
|
|
96
|
+
Run `/bmad:bmm:workflows:sprint-planning` to generate it, then rerun sprint-status.</output>
|
|
97
|
+
<action>Exit workflow</action>
|
|
98
|
+
</check>
|
|
99
|
+
<action>Continue to Step 2</action>
|
|
100
|
+
</step>
|
|
101
|
+
|
|
102
|
+
<step n="2" goal="Read and parse sprint-status.yaml">
|
|
103
|
+
<action>Read the FULL file: {sprint_status_file}</action>
|
|
104
|
+
<action>Parse fields: generated, last_updated, project, project_key, tracking_system, story_location</action>
|
|
105
|
+
<action>Parse development_status map. Classify keys:</action>
|
|
106
|
+
- Epics: keys starting with "epic-" (and not ending with "-retrospective")
|
|
107
|
+
- Retrospectives: keys ending with "-retrospective"
|
|
108
|
+
- Stories: everything else (e.g., 1-2-login-form)
|
|
109
|
+
<action>Map legacy story status "drafted" → "ready-for-dev"</action>
|
|
110
|
+
<action>Count story statuses: backlog, ready-for-dev, in-progress, review, done</action>
|
|
111
|
+
<action>Map legacy epic status "contexted" → "in-progress"</action>
|
|
112
|
+
<action>Count epic statuses: backlog, in-progress, done</action>
|
|
113
|
+
<action>Count retrospective statuses: optional, done</action>
|
|
114
|
+
|
|
115
|
+
<action>Validate all statuses against known values:</action>
|
|
116
|
+
|
|
117
|
+
- Valid story statuses: backlog, ready-for-dev, in-progress, review, done, drafted (legacy)
|
|
118
|
+
- Valid epic statuses: backlog, in-progress, done, contexted (legacy)
|
|
119
|
+
- Valid retrospective statuses: optional, done
|
|
120
|
+
|
|
121
|
+
<check if="any status is unrecognized">
|
|
122
|
+
<output>
|
|
123
|
+
**Unknown status detected:**
|
|
124
|
+
{{#each invalid_entries}}
|
|
125
|
+
|
|
126
|
+
- `{{key}}`: "{{status}}" (not recognized)
|
|
127
|
+
{{/each}}
|
|
128
|
+
|
|
129
|
+
**Valid statuses:**
|
|
130
|
+
|
|
131
|
+
- Stories: backlog, ready-for-dev, in-progress, review, done
|
|
132
|
+
- Epics: backlog, in-progress, done
|
|
133
|
+
- Retrospectives: optional, done
|
|
134
|
+
</output>
|
|
135
|
+
<ask>How should these be corrected?
|
|
136
|
+
{{#each invalid_entries}}
|
|
137
|
+
{{@index}}. {{key}}: "{{status}}" → [select valid status]
|
|
138
|
+
{{/each}}
|
|
139
|
+
|
|
140
|
+
Enter corrections (e.g., "1=in-progress, 2=backlog") or "skip" to continue without fixing:</ask>
|
|
141
|
+
<check if="user provided corrections">
|
|
142
|
+
<action>Update sprint-status.yaml with corrected values</action>
|
|
143
|
+
<action>Re-parse the file with corrected statuses</action>
|
|
144
|
+
</check>
|
|
145
|
+
</check>
|
|
146
|
+
|
|
147
|
+
<action>Detect risks:</action>
|
|
148
|
+
|
|
149
|
+
- IF any story has status "review": suggest `/bmad:bmm:workflows:code-review`
|
|
150
|
+
- IF any story has status "in-progress" AND no stories have status "ready-for-dev": recommend staying focused on active story
|
|
151
|
+
- IF all epics have status "backlog" AND no stories have status "ready-for-dev": prompt `/bmad:bmm:workflows:create-story`
|
|
152
|
+
- IF `last_updated` timestamp is more than 7 days old (or `last_updated` is missing, fall back to `generated`): warn "sprint-status.yaml may be stale"
|
|
153
|
+
- IF any story key doesn't match an epic pattern (e.g., story "5-1-..." but no "epic-5"): warn "orphaned story detected"
|
|
154
|
+
- IF any epic has status in-progress but has no associated stories: warn "in-progress epic has no stories"
|
|
155
|
+
</step>
|
|
156
|
+
|
|
157
|
+
<step n="3" goal="Select next action recommendation">
|
|
158
|
+
<action>Pick the next recommended workflow using priority:</action>
|
|
159
|
+
<note>When selecting "first" story: sort by epic number, then story number (e.g., 1-1 before 1-2 before 2-1)</note>
|
|
160
|
+
1. If any story status == in-progress → recommend `dev-story` for the first in-progress story
|
|
161
|
+
2. Else if any story status == review → recommend `code-review` for the first review story
|
|
162
|
+
3. Else if any story status == ready-for-dev → recommend `dev-story`
|
|
163
|
+
4. Else if any story status == backlog → recommend `create-story`
|
|
164
|
+
5. Else if any retrospective status == optional → recommend `retrospective`
|
|
165
|
+
6. Else → All implementation items done; congratulate the user - you both did amazing work together!
|
|
166
|
+
<action>Store selected recommendation as: next_story_id, next_workflow_id, next_agent (DEV)</action>
|
|
167
|
+
</step>
|
|
168
|
+
|
|
169
|
+
<step n="4" goal="Display summary">
|
|
170
|
+
<output>
|
|
171
|
+
## Sprint Status
|
|
172
|
+
|
|
173
|
+
- Project: {{project}} ({{project_key}})
|
|
174
|
+
- Tracking: {{tracking_system}}
|
|
175
|
+
- Status file: {sprint_status_file}
|
|
176
|
+
|
|
177
|
+
**Stories:** backlog {{count_backlog}}, ready-for-dev {{count_ready}}, in-progress {{count_in_progress}}, review {{count_review}}, done {{count_done}}
|
|
178
|
+
|
|
179
|
+
**Epics:** backlog {{epic_backlog}}, in-progress {{epic_in_progress}}, done {{epic_done}}
|
|
180
|
+
|
|
181
|
+
**Next Recommendation:** /bmad:bmm:workflows:{{next_workflow_id}} ({{next_story_id}})
|
|
182
|
+
|
|
183
|
+
{{#if risks}}
|
|
184
|
+
**Risks:**
|
|
185
|
+
{{#each risks}}
|
|
186
|
+
|
|
187
|
+
- {{this}}
|
|
188
|
+
{{/each}}
|
|
189
|
+
{{/if}}
|
|
190
|
+
|
|
191
|
+
</output>
|
|
192
|
+
</step>
|
|
193
|
+
|
|
194
|
+
<step n="5" goal="Offer actions">
|
|
195
|
+
<ask>Pick an option:
|
|
196
|
+
1) Run recommended workflow now
|
|
197
|
+
2) Show all stories grouped by status
|
|
198
|
+
3) Show raw sprint-status.yaml
|
|
199
|
+
4) Exit
|
|
200
|
+
Choice:</ask>
|
|
201
|
+
|
|
202
|
+
<check if="choice == 1">
|
|
203
|
+
<output>Run `/bmad:bmm:workflows:{{next_workflow_id}}`.
|
|
204
|
+
If the command targets a story, set `story_key={{next_story_id}}` when prompted.</output>
|
|
205
|
+
</check>
|
|
206
|
+
|
|
207
|
+
<check if="choice == 2">
|
|
208
|
+
<output>
|
|
209
|
+
### Stories by Status
|
|
210
|
+
- In Progress: {{stories_in_progress}}
|
|
211
|
+
- Review: {{stories_in_review}}
|
|
212
|
+
- Ready for Dev: {{stories_ready_for_dev}}
|
|
213
|
+
- Backlog: {{stories_backlog}}
|
|
214
|
+
- Done: {{stories_done}}
|
|
215
|
+
</output>
|
|
216
|
+
</check>
|
|
217
|
+
|
|
218
|
+
<check if="choice == 3">
|
|
219
|
+
<action>Display the full contents of {sprint_status_file}</action>
|
|
220
|
+
</check>
|
|
221
|
+
|
|
222
|
+
<check if="choice == 4">
|
|
223
|
+
<action>Run: `python3 {project-root}/_bmad/scripts/resolve_customization.py --skill {skill-root} --key workflow.on_complete` — if the resolved value is non-empty, follow it as the final terminal instruction before exiting.</action>
|
|
224
|
+
<action>Exit workflow</action>
|
|
225
|
+
</check>
|
|
226
|
+
</step>
|
|
227
|
+
|
|
228
|
+
<!-- ========================= -->
|
|
229
|
+
<!-- Data mode for other flows -->
|
|
230
|
+
<!-- ========================= -->
|
|
231
|
+
|
|
232
|
+
<step n="20" goal="Data mode output">
|
|
233
|
+
<action>Load and parse {sprint_status_file} same as Step 2</action>
|
|
234
|
+
<action>Compute recommendation same as Step 3</action>
|
|
235
|
+
<template-output>next_workflow_id = {{next_workflow_id}}</template-output>
|
|
236
|
+
<template-output>next_story_id = {{next_story_id}}</template-output>
|
|
237
|
+
<template-output>count_backlog = {{count_backlog}}</template-output>
|
|
238
|
+
<template-output>count_ready = {{count_ready}}</template-output>
|
|
239
|
+
<template-output>count_in_progress = {{count_in_progress}}</template-output>
|
|
240
|
+
<template-output>count_review = {{count_review}}</template-output>
|
|
241
|
+
<template-output>count_done = {{count_done}}</template-output>
|
|
242
|
+
<template-output>epic_backlog = {{epic_backlog}}</template-output>
|
|
243
|
+
<template-output>epic_in_progress = {{epic_in_progress}}</template-output>
|
|
244
|
+
<template-output>epic_done = {{epic_done}}</template-output>
|
|
245
|
+
<template-output>risks = {{risks}}</template-output>
|
|
246
|
+
<action>Return to caller</action>
|
|
247
|
+
</step>
|
|
248
|
+
|
|
249
|
+
<!-- ========================= -->
|
|
250
|
+
<!-- Validate mode -->
|
|
251
|
+
<!-- ========================= -->
|
|
252
|
+
|
|
253
|
+
<step n="30" goal="Validate sprint-status file">
|
|
254
|
+
<action>Check that {sprint_status_file} exists</action>
|
|
255
|
+
<check if="missing">
|
|
256
|
+
<template-output>is_valid = false</template-output>
|
|
257
|
+
<template-output>error = "sprint-status.yaml missing"</template-output>
|
|
258
|
+
<template-output>suggestion = "Run sprint-planning to create it"</template-output>
|
|
259
|
+
<action>Return</action>
|
|
260
|
+
</check>
|
|
261
|
+
|
|
262
|
+
<action>Read and parse {sprint_status_file}</action>
|
|
263
|
+
|
|
264
|
+
<action>Validate required metadata fields exist: generated, project, project_key, tracking_system, story_location (last_updated is optional for backward compatibility)</action>
|
|
265
|
+
<check if="any required field missing">
|
|
266
|
+
<template-output>is_valid = false</template-output>
|
|
267
|
+
<template-output>error = "Missing required field(s): {{missing_fields}}"</template-output>
|
|
268
|
+
<template-output>suggestion = "Re-run sprint-planning or add missing fields manually"</template-output>
|
|
269
|
+
<action>Return</action>
|
|
270
|
+
</check>
|
|
271
|
+
|
|
272
|
+
<action>Verify development_status section exists with at least one entry</action>
|
|
273
|
+
<check if="development_status missing or empty">
|
|
274
|
+
<template-output>is_valid = false</template-output>
|
|
275
|
+
<template-output>error = "development_status missing or empty"</template-output>
|
|
276
|
+
<template-output>suggestion = "Re-run sprint-planning or repair the file manually"</template-output>
|
|
277
|
+
<action>Return</action>
|
|
278
|
+
</check>
|
|
279
|
+
|
|
280
|
+
<action>Validate all status values against known valid statuses:</action>
|
|
281
|
+
|
|
282
|
+
- Stories: backlog, ready-for-dev, in-progress, review, done (legacy: drafted)
|
|
283
|
+
- Epics: backlog, in-progress, done (legacy: contexted)
|
|
284
|
+
- Retrospectives: optional, done
|
|
285
|
+
<check if="any invalid status found">
|
|
286
|
+
<template-output>is_valid = false</template-output>
|
|
287
|
+
<template-output>error = "Invalid status values: {{invalid_entries}}"</template-output>
|
|
288
|
+
<template-output>suggestion = "Fix invalid statuses in sprint-status.yaml"</template-output>
|
|
289
|
+
<action>Return</action>
|
|
290
|
+
</check>
|
|
291
|
+
|
|
292
|
+
<template-output>is_valid = true</template-output>
|
|
293
|
+
<template-output>message = "sprint-status.yaml valid: metadata complete, all statuses recognized"</template-output>
|
|
294
|
+
<action>Run: `python3 {project-root}/_bmad/scripts/resolve_customization.py --skill {skill-root} --key workflow.on_complete` — if the resolved value is non-empty, follow it as the final terminal instruction before exiting.</action>
|
|
295
|
+
</step>
|
|
296
|
+
|
|
297
|
+
</workflow>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# DO NOT EDIT -- overwritten on every update.
|
|
2
|
+
#
|
|
3
|
+
# Workflow customization surface for bmad-sprint-status. Mirrors the
|
|
4
|
+
# agent customization shape under the [workflow] namespace.
|
|
5
|
+
|
|
6
|
+
[workflow]
|
|
7
|
+
|
|
8
|
+
# --- Configurable below. Overrides merge per BMad structural rules: ---
|
|
9
|
+
# scalars: override wins • arrays (persistent_facts, activation_steps_*): append
|
|
10
|
+
# arrays-of-tables with `code`/`id`: replace matching items, append new ones.
|
|
11
|
+
|
|
12
|
+
# Steps to run before the standard activation (config load, greet).
|
|
13
|
+
# Overrides append. Use for pre-flight loads, compliance checks, etc.
|
|
14
|
+
|
|
15
|
+
activation_steps_prepend = []
|
|
16
|
+
|
|
17
|
+
# Steps to run after greet but before the workflow begins.
|
|
18
|
+
# Overrides append. Use for context-heavy setup that should happen
|
|
19
|
+
# once the user has been acknowledged.
|
|
20
|
+
|
|
21
|
+
activation_steps_append = []
|
|
22
|
+
|
|
23
|
+
# Persistent facts the workflow keeps in mind for the whole run
|
|
24
|
+
# (standards, compliance constraints, stylistic guardrails).
|
|
25
|
+
# Distinct from the runtime memory sidecar — these are static context
|
|
26
|
+
# loaded on activation. Overrides append.
|
|
27
|
+
#
|
|
28
|
+
# Each entry is either:
|
|
29
|
+
# - a literal sentence, e.g. "All stories must include testable acceptance criteria."
|
|
30
|
+
# - a file reference prefixed with `file:`, e.g. "file:{project-root}/docs/standards.md"
|
|
31
|
+
# (glob patterns are supported; the file's contents are loaded and treated as facts).
|
|
32
|
+
|
|
33
|
+
persistent_facts = [
|
|
34
|
+
"file:{project-root}/**/project-context.md",
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
# Scalar: executed when the workflow reaches its final step,
|
|
38
|
+
# after sprint status is summarized and risks are surfaced. Override wins.
|
|
39
|
+
# Leave empty for no custom post-completion behavior.
|
|
40
|
+
|
|
41
|
+
on_complete = ""
|
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
const path = require('node:path');
|
|
2
|
+
const https = require('node:https');
|
|
3
|
+
const { execFile } = require('node:child_process');
|
|
4
|
+
const { promisify } = require('node:util');
|
|
2
5
|
const fs = require('../fs-native');
|
|
3
6
|
const crypto = require('node:crypto');
|
|
4
7
|
const { resolveModuleVersion } = require('../modules/version-resolver');
|
|
5
8
|
const prompts = require('../prompts');
|
|
6
9
|
|
|
10
|
+
const execFileAsync = promisify(execFile);
|
|
11
|
+
const NPM_LOOKUP_TIMEOUT_MS = 10_000;
|
|
12
|
+
const NPM_PACKAGE_NAME_PATTERN = /^(?:@[a-z0-9][a-z0-9._~-]*\/)?[a-z0-9][a-z0-9._~-]*$/;
|
|
13
|
+
|
|
14
|
+
function isValidNpmPackageName(packageName) {
|
|
15
|
+
return typeof packageName === 'string' && NPM_PACKAGE_NAME_PATTERN.test(packageName);
|
|
16
|
+
}
|
|
17
|
+
|
|
7
18
|
class Manifest {
|
|
8
19
|
/**
|
|
9
20
|
* Create a new manifest
|
|
@@ -362,35 +373,40 @@ class Manifest {
|
|
|
362
373
|
* @returns {string|null} Latest version or null
|
|
363
374
|
*/
|
|
364
375
|
async fetchNpmVersion(packageName) {
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
376
|
+
if (!isValidNpmPackageName(packageName)) {
|
|
377
|
+
return null;
|
|
378
|
+
}
|
|
368
379
|
|
|
380
|
+
try {
|
|
369
381
|
// Try using npm view first (more reliable)
|
|
370
382
|
try {
|
|
371
|
-
const
|
|
383
|
+
const { stdout } = await execFileAsync('npm', ['view', packageName, 'version'], {
|
|
372
384
|
encoding: 'utf8',
|
|
373
|
-
|
|
374
|
-
timeout: 10_000,
|
|
385
|
+
timeout: NPM_LOOKUP_TIMEOUT_MS,
|
|
375
386
|
});
|
|
376
|
-
return
|
|
387
|
+
return stdout.trim();
|
|
377
388
|
} catch {
|
|
378
389
|
// Fallback to npm registry API
|
|
379
|
-
return new Promise((resolve
|
|
380
|
-
https
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
390
|
+
return new Promise((resolve) => {
|
|
391
|
+
const request = https.get(`https://registry.npmjs.org/${encodeURIComponent(packageName)}`, (res) => {
|
|
392
|
+
let data = '';
|
|
393
|
+
res.on('data', (chunk) => (data += chunk));
|
|
394
|
+
res.on('end', () => {
|
|
395
|
+
try {
|
|
396
|
+
const pkg = JSON.parse(data);
|
|
397
|
+
resolve(pkg['dist-tags']?.latest || pkg.version || null);
|
|
398
|
+
} catch {
|
|
399
|
+
resolve(null);
|
|
400
|
+
}
|
|
401
|
+
});
|
|
402
|
+
});
|
|
403
|
+
|
|
404
|
+
request.setTimeout(NPM_LOOKUP_TIMEOUT_MS, () => {
|
|
405
|
+
request.destroy();
|
|
406
|
+
resolve(null);
|
|
407
|
+
});
|
|
408
|
+
|
|
409
|
+
request.on('error', () => resolve(null));
|
|
394
410
|
});
|
|
395
411
|
}
|
|
396
412
|
} catch {
|