@we-scrum/cli 6.9.6 → 6.10.1
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.
|
|
3
|
+
"version": "6.10.1",
|
|
4
4
|
"description": "Cli tool for we-scrum application",
|
|
5
5
|
"main": "dist/cli.js",
|
|
6
6
|
"bin": {
|
|
@@ -37,11 +37,11 @@
|
|
|
37
37
|
"@types/node": "^24.13.3",
|
|
38
38
|
"tsup": "^8.5.1",
|
|
39
39
|
"typescript": "^6.0.3",
|
|
40
|
-
"@my-devkit/cli": "2.1.0",
|
|
41
40
|
"@my-devkit/core": "1.0.0",
|
|
41
|
+
"@my-devkit/cli": "2.1.0",
|
|
42
42
|
"@we-scrum/commands": "1.0.0",
|
|
43
|
-
"@we-scrum/models": "1.0.0",
|
|
44
43
|
"@we-scrum/enums": "1.0.0",
|
|
44
|
+
"@we-scrum/models": "1.0.0",
|
|
45
45
|
"@we-scrum/utils": "1.0.0"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { dirname, join, relative } from 'node:path';
|
|
3
|
+
import { ProjectHelper } from './project-helper';
|
|
4
|
+
|
|
5
|
+
const STORAGE_LINK_REGEX = /(!?)\[([^\]]*)\]\((https?:\/\/[^/\s)]+\/v0\/b\/[^/\s)]+\/o\/([^?\s)]+)[^\s)]*)\)/g;
|
|
6
|
+
|
|
7
|
+
export class AttachmentHelper {
|
|
8
|
+
/**
|
|
9
|
+
* Replicates the Firebase Cloud Storage files linked in a markdown text to the project cache directory
|
|
10
|
+
* and replaces their links by the path of the local copy (relative to the project root).
|
|
11
|
+
* A link whose file cannot be downloaded is left untouched.
|
|
12
|
+
*/
|
|
13
|
+
public static async localize(text: string): Promise<string> {
|
|
14
|
+
if (!text) return text;
|
|
15
|
+
|
|
16
|
+
const root = ProjectHelper.requireRoot();
|
|
17
|
+
const cacheDirectory = join(root, ProjectHelper.getCachePath(root));
|
|
18
|
+
|
|
19
|
+
const links = [...text.matchAll(STORAGE_LINK_REGEX)];
|
|
20
|
+
let result = text;
|
|
21
|
+
|
|
22
|
+
for (const [match, imageMark, label, url, encodedPath] of links) {
|
|
23
|
+
const localPath = await this.download(url, decodeURIComponent(encodedPath), label, cacheDirectory);
|
|
24
|
+
if (localPath) {
|
|
25
|
+
result = result.replace(match, `${imageMark}[${label}](${relative(root, localPath)})`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return result;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
private static async download(url: string, storagePath: string, label: string, cacheDirectory: string): Promise<string | null> {
|
|
33
|
+
if (storagePath.split('/').includes('..')) return null;
|
|
34
|
+
|
|
35
|
+
const localPath = join(cacheDirectory, storagePath, this.toFileName(label));
|
|
36
|
+
if (existsSync(localPath)) return localPath;
|
|
37
|
+
|
|
38
|
+
try {
|
|
39
|
+
const response = await fetch(url);
|
|
40
|
+
if (!response.ok) return null;
|
|
41
|
+
|
|
42
|
+
mkdirSync(dirname(localPath), { recursive: true });
|
|
43
|
+
writeFileSync(localPath, Buffer.from(await response.arrayBuffer()));
|
|
44
|
+
return localPath;
|
|
45
|
+
} catch {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
private static toFileName(label: string): string {
|
|
51
|
+
return label.trim().replace(/[^\w.-]+/g, '-') || 'attachment';
|
|
52
|
+
}
|
|
53
|
+
}
|
package/src/helpers/index.ts
CHANGED
|
@@ -6,11 +6,13 @@ import { version as cliVersion } from '../../package.json';
|
|
|
6
6
|
import { renderTemplate } from './template.helper';
|
|
7
7
|
|
|
8
8
|
const CONFIG_FILE = 'we-scrum.json';
|
|
9
|
+
const DEFAULT_CACHE_PATH = '.claude/cache';
|
|
9
10
|
|
|
10
11
|
export interface WeScrumProjectConfig {
|
|
11
12
|
projectId: string;
|
|
12
13
|
version: string;
|
|
13
14
|
developmentPoliciesPath: string;
|
|
15
|
+
cachePath?: string;
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
export class ProjectHelper {
|
|
@@ -35,6 +37,10 @@ export class ProjectHelper {
|
|
|
35
37
|
return JSON.parse(content) as WeScrumProjectConfig;
|
|
36
38
|
}
|
|
37
39
|
|
|
40
|
+
public static getCachePath(root: string): string {
|
|
41
|
+
return this.read(root).cachePath ?? DEFAULT_CACHE_PATH;
|
|
42
|
+
}
|
|
43
|
+
|
|
38
44
|
public static write(root: string, partial: Partial<WeScrumProjectConfig>): void {
|
|
39
45
|
const existing = existsSync(join(root, CONFIG_FILE)) ? this.read(root) : ({} as WeScrumProjectConfig);
|
|
40
46
|
writeFileSync(join(root, CONFIG_FILE), JSON.stringify({ ...existing, ...partial }, null, 4) + '\n');
|
|
@@ -78,7 +84,7 @@ export class ProjectHelper {
|
|
|
78
84
|
? defaultPoliciesPath
|
|
79
85
|
: await input({ message: 'Enter the development policies path (relative to project root):' });
|
|
80
86
|
|
|
81
|
-
this.write(root, { projectId, version: '0.0.0', developmentPoliciesPath });
|
|
87
|
+
this.write(root, { projectId, version: '0.0.0', developmentPoliciesPath, cachePath: DEFAULT_CACHE_PATH });
|
|
82
88
|
return root;
|
|
83
89
|
}
|
|
84
90
|
|
|
@@ -30,8 +30,9 @@ import {
|
|
|
30
30
|
ProjectStorySectionModelTask,
|
|
31
31
|
} from '@we-scrum/models';
|
|
32
32
|
import { AnalysisDsl, DevelopmentPolicyHelper, HtmlToTextHelper, StorySectionHelper, stringifyAnalysisDslChange } from '@we-scrum/utils';
|
|
33
|
-
import {
|
|
33
|
+
import { mkdirSync, rmSync, writeFileSync } from 'node:fs';
|
|
34
34
|
import { join } from 'node:path';
|
|
35
|
+
import { AttachmentHelper } from './attachment-helper';
|
|
35
36
|
import { AuthHelper } from './auth-helper';
|
|
36
37
|
import { FirebaseHelper } from './firebase-helper';
|
|
37
38
|
import { ProjectHelper } from './project-helper';
|
|
@@ -77,7 +78,7 @@ export class WeScrumHelper {
|
|
|
77
78
|
const { guidelinesPath, unitTestsPath } = this.getDevelopmentPolicyPaths(developmentPolicy);
|
|
78
79
|
|
|
79
80
|
return renderTemplate('get-next-task', {
|
|
80
|
-
taskDetails: stringifyAnalysisDslChange(analysisChange),
|
|
81
|
+
taskDetails: await AttachmentHelper.localize(stringifyAnalysisDslChange(analysisChange)),
|
|
81
82
|
guidelinesPath,
|
|
82
83
|
unitTestsPath: developmentPolicy?.areUnitTestsMandatory ? unitTestsPath : null,
|
|
83
84
|
isTodo,
|
|
@@ -224,7 +225,7 @@ export class WeScrumHelper {
|
|
|
224
225
|
if (story.descriptionContentType === ContentType.Html) {
|
|
225
226
|
return HtmlToTextHelper.convert(description);
|
|
226
227
|
}
|
|
227
|
-
return description;
|
|
228
|
+
return AttachmentHelper.localize(description);
|
|
228
229
|
}
|
|
229
230
|
|
|
230
231
|
public static async getStoryAnalysis(identificationNumber: string): Promise<string> {
|
|
@@ -236,7 +237,7 @@ export class WeScrumHelper {
|
|
|
236
237
|
|
|
237
238
|
const ast = StorySectionHelper.mapSectionsToAnalysisAst(sections);
|
|
238
239
|
|
|
239
|
-
return AnalysisDsl.stringify(ast);
|
|
240
|
+
return AttachmentHelper.localize(AnalysisDsl.stringify(ast));
|
|
240
241
|
}
|
|
241
242
|
|
|
242
243
|
public static async getChangeThreads(changeId: string): Promise<string> {
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
we-scrum update-change-thread-status --changeThreadId <changeThreadId> --status Resolved
|
|
21
21
|
```
|
|
22
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
|
+
1. If the task description explicitly refers to the story description or lacks the clarity needed to proceed, run `we-scrum get-story-description --identificationNumber "{{identificationNumber}}"` to retrieve the full story description. Skip this step otherwise.
|
|
23
24
|
1. Implement the task described above.
|
|
24
25
|
1. Commit your changes.
|
|
25
26
|
1. **Pre-completion check — mandatory, answer both questions explicitly before running `complete-task`.** Threads posted after completion are late, so do this now:
|