@we-scrum/cli 6.10.5 → 6.11.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@we-scrum/cli",
3
- "version": "6.10.5",
3
+ "version": "6.11.3",
4
4
  "description": "Cli tool for we-scrum application",
5
5
  "main": "dist/cli.js",
6
6
  "bin": {
@@ -37,10 +37,10 @@
37
37
  "@types/node": "^24.19.2",
38
38
  "tsup": "^8.5.1",
39
39
  "typescript": "^6.0.3",
40
+ "@we-scrum/enums": "1.0.0",
41
+ "@we-scrum/commands": "1.0.0",
40
42
  "@my-devkit/cli": "2.1.0",
41
43
  "@my-devkit/core": "1.0.0",
42
- "@we-scrum/commands": "1.0.0",
43
- "@we-scrum/enums": "1.0.0",
44
44
  "@we-scrum/models": "1.0.0",
45
45
  "@we-scrum/utils": "1.0.0"
46
46
  },
@@ -5,12 +5,13 @@ import { Command } from 'commander';
5
5
 
6
6
  export function registerPolicyCommands(program: Command): void {
7
7
  program
8
- .command('synchronize-development-policies')
9
- .description('Sync development guidelines from we-scrum into the project')
8
+ .command('synchronize-guidelines')
9
+ .alias('synchronize-development-policies')
10
+ .description('Sync guidelines from we-scrum into the project')
10
11
  .action(
11
12
  runProjectCommand(async () => {
12
13
  const count = await WeScrumHelper.synchronizeDevelopmentPolicies();
13
- Logger.info(`Synchronized ${count} development ${count === 1 ? 'policy' : 'policies'}.`);
14
+ Logger.info(`Synchronized ${count} ${count === 1 ? 'guideline' : 'guidelines'}.`);
14
15
  }),
15
16
  );
16
17
  }
@@ -7,11 +7,14 @@ import { renderTemplate } from './template.helper';
7
7
 
8
8
  const CONFIG_FILE = 'we-scrum.json';
9
9
  const DEFAULT_CACHE_PATH = '.claude/cache';
10
+ const DEFAULT_GUIDELINES_PATH = '.claude/guidelines';
10
11
 
11
12
  export interface WeScrumProjectConfig {
12
13
  projectId: string;
13
14
  version: string;
14
- developmentPoliciesPath: string;
15
+ guidelinesPath: string;
16
+ /** @deprecated Replaced by guidelinesPath, still read as a fallback. */
17
+ developmentPoliciesPath?: string;
15
18
  cachePath?: string;
16
19
  }
17
20
 
@@ -34,7 +37,9 @@ export class ProjectHelper {
34
37
 
35
38
  public static read(root: string): WeScrumProjectConfig {
36
39
  const content = readFileSync(join(root, CONFIG_FILE), 'utf8');
37
- return JSON.parse(content) as WeScrumProjectConfig;
40
+ const config = JSON.parse(content) as WeScrumProjectConfig;
41
+ config.guidelinesPath ??= config.developmentPoliciesPath ?? DEFAULT_GUIDELINES_PATH;
42
+ return config;
38
43
  }
39
44
 
40
45
  public static getCachePath(root: string): string {
@@ -74,17 +79,16 @@ export class ProjectHelper {
74
79
 
75
80
  assert(existsSync(root), `Directory "${root}" does not exist.`);
76
81
 
77
- const defaultPoliciesPath = '.claude/development-policies';
78
- const confirmPolicies = await confirm({
79
- message: `Store development policies in "${defaultPoliciesPath}"?`,
82
+ const confirmGuidelines = await confirm({
83
+ message: `Store guidelines in "${DEFAULT_GUIDELINES_PATH}"?`,
80
84
  default: true,
81
85
  });
82
86
 
83
- const developmentPoliciesPath = confirmPolicies
84
- ? defaultPoliciesPath
85
- : await input({ message: 'Enter the development policies path (relative to project root):' });
87
+ const guidelinesPath = confirmGuidelines
88
+ ? DEFAULT_GUIDELINES_PATH
89
+ : await input({ message: 'Enter the guidelines path (relative to project root):' });
86
90
 
87
- this.write(root, { projectId, version: '0.0.0', developmentPoliciesPath, cachePath: DEFAULT_CACHE_PATH });
91
+ this.write(root, { projectId, version: '0.0.0', guidelinesPath, cachePath: DEFAULT_CACHE_PATH });
88
92
  return root;
89
93
  }
90
94
 
@@ -208,12 +208,15 @@ export class WeScrumHelper {
208
208
  public static getDevelopmentPolicyPaths(policy: DevelopmentPolicyModel | null): {
209
209
  guidelinesPath: string | null;
210
210
  unitTestsPath: string | null;
211
+ analysisPath: string | null;
211
212
  } {
212
- const { developmentPoliciesPath } = this.projectConfig;
213
- const policiesDir = join(this.projectRoot, developmentPoliciesPath);
213
+ const { guidelinesPath: guidelinesDir } = this.projectConfig;
214
+ const rootDir = join(this.projectRoot, guidelinesDir);
215
+ const getPath = (kind: 'development' | 'tests' | 'analysis') => (policy?.slug ? join(rootDir, kind, `${policy.slug}.md`) : null);
214
216
  return {
215
- guidelinesPath: policy?.slug ? join(policiesDir, `develop-${policy.slug}.md`) : null,
216
- unitTestsPath: policy?.slug ? join(policiesDir, `test-${policy.slug}.md`) : null,
217
+ guidelinesPath: getPath('development'),
218
+ unitTestsPath: getPath('tests'),
219
+ analysisPath: getPath('analysis'),
217
220
  };
218
221
  }
219
222
 
@@ -233,7 +236,11 @@ export class WeScrumHelper {
233
236
  assert(!!story, `Story "${identificationNumber}" not found in the active project.`);
234
237
 
235
238
  const sections = await this.getStorySections(story.storyId);
236
- this.getAllChanges(sections).forEach((change) => this.appendThreadsHint(change));
239
+ const policies = await this.getDevelopmentPolicies();
240
+ this.getAllChanges(sections).forEach((change) => {
241
+ this.appendThreadsHint(change);
242
+ this.appendAnalysisGuidelinesHint(change, policies);
243
+ });
237
244
 
238
245
  const ast = StorySectionHelper.mapSectionsToAnalysisAst(sections);
239
246
 
@@ -323,6 +330,14 @@ export class WeScrumHelper {
323
330
  change.description = change.description ? `${change.description}\n\n${hint}` : hint;
324
331
  }
325
332
 
333
+ private static appendAnalysisGuidelinesHint(change: DevelopmentPolicyHelper.Change, policies: DevelopmentPolicyModel[]): void {
334
+ const policy = DevelopmentPolicyHelper.getMatchingAnalysisPolicy(change, policies);
335
+ if (!policy) return;
336
+
337
+ const hint = `Analysis guidelines: \`${this.getDevelopmentPolicyPaths(policy).analysisPath}\``;
338
+ change.description = change.description ? `${change.description}\n\n${hint}` : hint;
339
+ }
340
+
326
341
  private static async findStoryByIterationNumber(identificationNumber: string) {
327
342
  return FirebaseHelper.findDocument<ProjectStoryModel>(`/projects/${this.projectId}/stories`, [
328
343
  ['identificationNumber', '==', identificationNumber],
@@ -338,22 +353,27 @@ export class WeScrumHelper {
338
353
  }
339
354
 
340
355
  public static async synchronizeDevelopmentPolicies(): Promise<number> {
341
- const { developmentPoliciesPath } = this.projectConfig;
342
- const policiesDir = join(this.projectRoot, developmentPoliciesPath);
356
+ const { guidelinesPath: guidelinesDir } = this.projectConfig;
357
+ const policiesDir = join(this.projectRoot, guidelinesDir);
343
358
 
344
359
  rmSync(policiesDir, { recursive: true, force: true });
345
- mkdirSync(policiesDir, { recursive: true });
360
+ for (const kind of ['development', 'tests', 'analysis']) {
361
+ mkdirSync(join(policiesDir, kind), { recursive: true });
362
+ }
346
363
 
347
364
  const policies = await this.getDevelopmentPolicies();
348
365
 
349
366
  for (const policy of policies) {
350
- const { guidelinesPath, unitTestsPath } = this.getDevelopmentPolicyPaths(policy);
367
+ const { guidelinesPath, unitTestsPath, analysisPath } = this.getDevelopmentPolicyPaths(policy);
351
368
  if (policy.codeGuidelines && guidelinesPath) {
352
369
  writeFileSync(guidelinesPath, policy.codeGuidelines);
353
370
  }
354
371
  if (policy.unitTestsGuidelines && unitTestsPath) {
355
372
  writeFileSync(unitTestsPath, policy.unitTestsGuidelines);
356
373
  }
374
+ if (policy.analysisGuidelines && analysisPath) {
375
+ writeFileSync(analysisPath, policy.analysisGuidelines);
376
+ }
357
377
  }
358
378
 
359
379
  return policies.length;
@@ -24,14 +24,16 @@ Do not proceed until a number is provided.
24
24
 
25
25
  ---
26
26
 
27
- ## Step 1 — Synchronize development policies
27
+ ## Step 1 — Synchronize guidelines
28
28
 
29
29
  Pull the latest development guidelines into the project before starting any work:
30
30
 
31
31
  ```bash
32
- we-scrum synchronize-development-policies
32
+ we-scrum synchronize-guidelines
33
33
  ```
34
34
 
35
+ Then read `development/global.md` in the guidelines folder (when present) once: it holds the project-wide development guidelines and applies to every task of the story.
36
+
35
37
  ---
36
38
 
37
39
  ## Step 2 — Fetch and implement tasks
@@ -32,6 +32,12 @@ we-scrum get-story-description --identificationNumber <identificationNumber>
32
32
  we-scrum get-story-analysis --identificationNumber <identificationNumber>
33
33
  ```
34
34
 
35
+ Then pull the latest guidelines into the project:
36
+
37
+ ```bash
38
+ we-scrum synchronize-guidelines
39
+ ```
40
+
35
41
  ---
36
42
 
37
43
  ## Step 2 — Review existing threads
@@ -78,6 +84,11 @@ Review the story description and analysis DSL together. Check for:
78
84
  - Flag any analysis change where the proposed name would likely create a discontinuity or force a translation at any layer
79
85
  - Renames or aliases between layers are a sign of a poorly chosen name — the right name should need no translation
80
86
 
87
+ **Guidelines**
88
+ - Read `analysis/global.md` in the guidelines folder (when present) and apply it to the whole analysis
89
+ - For every change annotated "Analysis guidelines: `<path>`", read that file and check the change against it
90
+ - When a finding comes from a guideline, quote the guideline in the comment so the author can see its source
91
+
81
92
  **Migrations**
82
93
  - Any change that adds, removes, or renames a field on an Aggregate or a Model must be accompanied by a migration script task in the analysis
83
94
  - If such a structural change is present but no corresponding migration task exists, raise it as a blocking issue — shipping without a migration will corrupt existing data or break reads