@we-scrum/cli 6.9.3 → 6.9.5

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": "@we-scrum/cli",
3
- "version": "6.9.3",
3
+ "version": "6.9.5",
4
4
  "description": "Cli tool for we-scrum application",
5
5
  "main": "dist/cli.js",
6
6
  "bin": {
@@ -39,9 +39,9 @@
39
39
  "typescript": "^6.0.3",
40
40
  "@my-devkit/cli": "2.1.0",
41
41
  "@we-scrum/enums": "1.0.0",
42
+ "@my-devkit/core": "1.0.0",
42
43
  "@we-scrum/commands": "1.0.0",
43
44
  "@we-scrum/models": "1.0.0",
44
- "@my-devkit/core": "1.0.0",
45
45
  "@we-scrum/utils": "1.0.0"
46
46
  },
47
47
  "scripts": {
@@ -7,11 +7,11 @@ import { Command, Option } from 'commander';
7
7
  export function registerChangeThreadCommands(program: Command): void {
8
8
  program
9
9
  .command('get-change-threads')
10
- .description('Get the open change threads for a change')
10
+ .description('Get all the change threads (any status) for a change')
11
11
  .requiredOption('-c, --changeId <id>', 'Unique identifier of the change')
12
12
  .action(
13
13
  runProjectCommand<{ changeId: string }>(async (options) => {
14
- return WeScrumHelper.getOpenChangeThreads(options.changeId);
14
+ return WeScrumHelper.getChangeThreads(options.changeId);
15
15
  }),
16
16
  );
17
17
 
@@ -25,6 +25,9 @@ export function registerTaskCommands(program: Command): void {
25
25
  runProjectCommand<{ identificationNumber: string; changeId: string }>(async (options) => {
26
26
  await WeScrumHelper.completeTask(options.identificationNumber, options.changeId);
27
27
  Logger.info('Task completed successfully.');
28
+ Logger.info(
29
+ 'Reminder: if the result deviates from the task description (including changes requested by the developer), or if the development guidelines were missing or incomplete, post the matching change thread(s) now with "we-scrum create-change-thread".',
30
+ );
28
31
  }),
29
32
  );
30
33
  }
@@ -37,6 +37,8 @@ import { FirebaseHelper } from './firebase-helper';
37
37
  import { ProjectHelper } from './project-helper';
38
38
  import { renderTemplate } from './template.helper';
39
39
 
40
+ const CHANGE_THREAD_STATUS_DISPLAY_ORDER = [ChangeThreadStatus.Open, ChangeThreadStatus.Resolved, ChangeThreadStatus.Archived];
41
+
40
42
  export class WeScrumHelper {
41
43
  private static readonly backendUrl = 'https://europe-west1-we-scrum-prod.cloudfunctions.net';
42
44
  constructor(private userId: string) {}
@@ -67,7 +69,7 @@ export class WeScrumHelper {
67
69
  });
68
70
  }
69
71
 
70
- this.appendOpenThreadsHint(nextChange);
72
+ this.appendThreadsHint(nextChange);
71
73
 
72
74
  const analysisChange = StorySectionHelper.mapSingleChange(nextChange);
73
75
  const isTodo = nextChange.progress.status === ProgressStatus.ToDo;
@@ -230,26 +232,29 @@ export class WeScrumHelper {
230
232
  assert(!!story, `Story "${identificationNumber}" not found in the active project.`);
231
233
 
232
234
  const sections = await this.getStorySections(story.storyId);
233
- this.getAllChanges(sections).forEach((change) => this.appendOpenThreadsHint(change));
235
+ this.getAllChanges(sections).forEach((change) => this.appendThreadsHint(change));
234
236
 
235
237
  const ast = StorySectionHelper.mapSectionsToAnalysisAst(sections);
236
238
 
237
239
  return AnalysisDsl.stringify(ast);
238
240
  }
239
241
 
240
- public static async getOpenChangeThreads(changeId: string): Promise<string> {
242
+ public static async getChangeThreads(changeId: string): Promise<string> {
241
243
  const threads = await FirebaseHelper.getCollection<ProjectChangeThreadModel>(`/projects/${this.projectId}/change-threads`, {
242
- where: [
243
- ['changeId', '==', changeId],
244
- ['status', '==', ChangeThreadStatus.Open],
245
- ],
244
+ where: [['changeId', '==', changeId]],
246
245
  });
247
246
 
248
247
  if (threads.length === 0) {
249
- return `No open threads for change "${changeId}".`;
248
+ return `No threads for change "${changeId}".`;
250
249
  }
251
250
 
252
- return threads.map((thread) => this.formatChangeThread(thread)).join('\n\n---\n\n');
251
+ return _sortBy(
252
+ threads,
253
+ (thread) => CHANGE_THREAD_STATUS_DISPLAY_ORDER.indexOf(thread.status),
254
+ (thread) => thread.comments[0]?.createdAt,
255
+ )
256
+ .map((thread) => this.formatChangeThread(thread))
257
+ .join('\n\n---\n\n');
253
258
  }
254
259
 
255
260
  public static async createChangeThread(changeId: string, comment: string): Promise<string> {
@@ -302,12 +307,18 @@ export class WeScrumHelper {
302
307
  return change.taskId;
303
308
  }
304
309
 
305
- private static appendOpenThreadsHint(change: DevelopmentPolicyHelper.Change): void {
306
- const openThreadCount = change.threads.filter((t) => t.status === ChangeThreadStatus.Open).length;
307
- if (openThreadCount === 0) return;
310
+ private static appendThreadsHint(change: DevelopmentPolicyHelper.Change): void {
311
+ const synthesis = CHANGE_THREAD_STATUS_DISPLAY_ORDER.map((status) => ({
312
+ status,
313
+ count: change.threads.filter((t) => t.status === status).length,
314
+ }))
315
+ .filter(({ count }) => count > 0)
316
+ .map(({ status, count }) => `${count} ${status}`)
317
+ .join(' • ');
318
+ if (!synthesis) return;
308
319
 
309
320
  const changeId = this.getChangeIdentifier(change);
310
- const hint = `${openThreadCount} open ${openThreadCount === 1 ? 'thread' : 'threads'} on this change — run \`we-scrum get-change-threads --changeId "${changeId}"\` to view them.`;
321
+ const hint = `Threads: ${synthesis} — run \`we-scrum get-change-threads --changeId "${changeId}"\` to view them.`;
311
322
  change.description = change.description ? `${change.description}\n\n${hint}` : hint;
312
323
  }
313
324
 
@@ -56,3 +56,5 @@ Before committing any task, run ESLint on every modified file and fix all report
56
56
  ```bash
57
57
  npx eslint <file1> <file2> ...
58
58
  ```
59
+
60
+ Every task ends with a mandatory pre-completion check (deviation thread and development guidelines feedback thread, see the task's "Next steps"). Adjustments requested by the developer during or after a task count as deviations. If a thread is needed, post it before running `we-scrum complete-task`; if you realize afterwards that one was missed, post it right away.
@@ -5,7 +5,7 @@
5
5
  {{{taskDetails}}}
6
6
 
7
7
  ## Development guidelines
8
- {{#if guidelinesPath}}Refer to `{{{guidelinesPath}}}` for coding conventions and project-specific instructions.{{else}}_No development guidelines file configured for this task._{{/if}}
8
+ {{#if guidelinesPath}}Refer to `{{{guidelinesPath}}}` for coding conventions and project-specific instructions.{{else}}_No development guidelines file configured for this task._ **You must therefore open a development guidelines feedback thread before completing the task (see the pre-completion check below).**{{/if}}
9
9
 
10
10
  ## Unit tests
11
11
  {{#if unitTestsPath}}Unit tests are required. Refer to `{{{unitTestsPath}}}` for test writing guidelines.{{else}}No unit tests required.{{/if}}
@@ -14,23 +14,25 @@
14
14
  {{#if isTodo}}
15
15
  1. Run `we-scrum start-task --identificationNumber "{{identificationNumber}}" --changeId "{{changeId}}"` before making any changes.
16
16
  {{/if}}
17
- 1. If the task above mentions open threads, run `we-scrum get-change-threads --changeId "{{changeId}}"` before implementing. If a thread requests an adjustment to this task, make it part of the implementation below, then resolve the thread once done:
17
+ 1. If the task above mentions threads, run `we-scrum get-change-threads --changeId "{{changeId}}"` before implementing. It returns **all** threads of the change (Open, Resolved, Archived) so you have the complete history. If an **open** thread requests an adjustment to this task, make it part of the implementation below, then resolve the thread once done:
18
18
  ```bash
19
19
  we-scrum add-comment-to-change-thread --changeThreadId <changeThreadId> --comment "<markdown explaining what was done>"
20
20
  we-scrum update-change-thread-status --changeThreadId <changeThreadId> --status Resolved
21
21
  ```
22
- Leave a thread open (with a reply explaining why) if it does not call for a change to this task, or if you disagree with the request.
22
+ Leave a thread open (with a reply explaining why) if it does not call for a change to this task, or if you disagree with the request. Resolved and Archived threads are history only: do not act on them.
23
23
  1. Implement the task described above.
24
- 1. If your implementation deviates in any way from what this task describes (different naming, different location, a sub-step skipped or altered, a workaround for a blocker, a mistake you had to correct mid-way, etc.), post a comment explaining the deviation and why, before completing the task:
25
- ```bash
26
- we-scrum create-change-thread --changeId "{{changeId}}" --comment "<markdown explaining the deviation>"
27
- ```
28
- Group related deviations into a single thread. If there are several unrelated deviations, a few separate threads is fine, but do not open one thread per minor deviation — use judgment to keep the count reasonable. Skip this step entirely if the task was implemented exactly as described.
29
- 1. If the development guidelines or the unit tests guidelines referenced above were incomplete, outdated, or missing for this kind of task — meaning you had to spend extra effort figuring out conventions they should have covered — open a change thread with a concrete suggested addition or correction:
30
- ```bash
31
- we-scrum create-change-thread --changeId "{{changeId}}" --comment "<markdown: what was missing/outdated, and a suggested fix>"
32
- ```
33
- Use at most one thread for all development guidelines feedback, and, separately, at most one thread for all unit tests guidelines feedback — do not mix the two guidelines together, and do not mix guideline feedback into the deviation thread above. Skip whichever guideline was accurate and sufficient.
34
24
  1. Commit your changes.
25
+ 1. **Pre-completion check — mandatory, answer both questions explicitly before running `complete-task`.** Threads posted after completion are late, so do this now:
26
+ - **Deviations:** does the final result differ in any way from what this task describes (different naming, different location, a sub-step skipped or altered, a workaround for a blocker, a mistake you had to correct mid-way)? Changes made at the developer's request during the session (after feedback, redesigns, extra options or components added) count as deviations too. If yes, first run `we-scrum get-change-threads` and check the existing threads. If a thread already covers the deviation (whatever its status), reply to it with `we-scrum add-comment-to-change-thread` instead of creating a duplicate; otherwise post **one** thread explaining what differs and why:
27
+ ```bash
28
+ we-scrum create-change-thread --changeId "{{changeId}}" --comment "<markdown explaining the deviation>"
29
+ ```
30
+ Group related deviations into a single thread; use a few separate threads only for several unrelated deviations, and never one thread per minor deviation. Skip only if the task was implemented exactly as described.
31
+ - **Guidelines:** was the development guidelines section above "No development guidelines file configured", or were the development / unit tests guidelines incomplete, outdated, or missing for this kind of task (you had to spend extra effort figuring out conventions)? If yes, check the existing threads first (same rule: reply to an existing guidelines thread rather than creating a duplicate), otherwise open a thread with a concrete suggested addition or correction:
32
+ ```bash
33
+ we-scrum create-change-thread --changeId "{{changeId}}" --comment "<markdown: what was missing/outdated, and a suggested fix>"
34
+ ```
35
+ Use at most one thread for all development guidelines feedback and, separately, at most one for all unit tests guidelines feedback; do not mix them together, and do not mix guideline feedback into the deviation thread. Skip whichever guideline was accurate and sufficient.
36
+ - If the developer asks for adjustments **after** the task is completed, add them to the deviation thread (reply with `we-scrum add-comment-to-change-thread`, or open one if none exists).
35
37
  1. Run `we-scrum complete-task --identificationNumber "{{identificationNumber}}" --changeId "{{changeId}}"` when done.
36
38
  1. Call `get_next_task` to continue with the next task.
@@ -36,7 +36,7 @@ we-scrum get-story-analysis --identificationNumber <identificationNumber>
36
36
 
37
37
  ## Step 2 — Review existing threads
38
38
 
39
- The analysis DSL may annotate a change with a note such as _"N open thread(s) — run `we-scrum get-change-threads --changeId <id>` to view them."_ This means earlier review comments are already open on that change.
39
+ The analysis DSL may annotate a change with a note such as _"Threads: 3 Open • 2 Resolved — run `we-scrum get-change-threads --changeId <id>` to view them."_ This means earlier review comments exist on that change (statuses with no thread are omitted).
40
40
 
41
41
  For every change annotated this way:
42
42
 
@@ -44,7 +44,9 @@ For every change annotated this way:
44
44
  we-scrum get-change-threads --changeId <changeId>
45
45
  ```
46
46
 
47
- For each thread returned:
47
+ The command returns **all** threads of the change (Open, Resolved, Archived), so you have the complete history. Resolved and Archived threads are history only: read them to avoid repeating a concern that was already handled, but do not act on them.
48
+
49
+ For each **open** thread returned:
48
50
  - If the current state of the analysis addresses the concern raised in the thread, resolve it and explain why:
49
51
  ```bash
50
52
  we-scrum add-comment-to-change-thread --changeThreadId <changeThreadId> --comment "<markdown explaining why this is resolved>"
@@ -92,6 +94,6 @@ we-scrum create-change-thread --changeId <changeId> --comment "<markdown-formatt
92
94
 
93
95
  - The comment body supports Markdown (headings, lists, bold, code spans) — it renders as such in the we-scrum UI.
94
96
  - Group every finding for a given change into a single thread/comment rather than opening one thread per bullet point.
95
- - Skip changes that already have an open thread covering the same concern (see Step 2) — reply on the existing thread instead of duplicating it.
97
+ - Skip changes that already have a thread covering the same concern, whatever its status (see Step 2) — reply on the existing thread instead of duplicating it.
96
98
 
97
99
  Once threads are created or resolved, give the user a short summary in the chat: what was found, what was posted or resolved, and why — do not skip this summary just because the details live in we-scrum.