@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/README.md +2 -2
- package/dist/cli.js +52 -37
- package/package.json +3 -3
- package/src/commands/policy.ts +4 -3
- package/src/helpers/project-helper.ts +13 -9
- package/src/helpers/we-scrum.helper.ts +29 -9
- package/templates/develop-story-skill.hbs +4 -2
- package/templates/review-analysis-skill.hbs +11 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@we-scrum/cli",
|
|
3
|
-
"version": "6.
|
|
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
|
},
|
package/src/commands/policy.ts
CHANGED
|
@@ -5,12 +5,13 @@ import { Command } from 'commander';
|
|
|
5
5
|
|
|
6
6
|
export function registerPolicyCommands(program: Command): void {
|
|
7
7
|
program
|
|
8
|
-
.command('synchronize-
|
|
9
|
-
.
|
|
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}
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
78
|
-
|
|
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
|
|
84
|
-
?
|
|
85
|
-
: await input({ message: 'Enter the
|
|
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',
|
|
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 {
|
|
213
|
-
const
|
|
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:
|
|
216
|
-
unitTestsPath:
|
|
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
|
-
|
|
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 {
|
|
342
|
-
const policiesDir = join(this.projectRoot,
|
|
356
|
+
const { guidelinesPath: guidelinesDir } = this.projectConfig;
|
|
357
|
+
const policiesDir = join(this.projectRoot, guidelinesDir);
|
|
343
358
|
|
|
344
359
|
rmSync(policiesDir, { recursive: true, force: true });
|
|
345
|
-
|
|
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
|
|
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-
|
|
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
|