@niujiajie/freespec 0.0.0-stage → 1.15.0
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/LICENSE +22 -0
- package/README.md +58 -2
- package/bin/freespec.js +5 -0
- package/dist/cli/index.d.ts +25 -0
- package/dist/cli/index.js +359 -0
- package/dist/commands/shared-output.d.ts +18 -0
- package/dist/commands/shared-output.js +61 -0
- package/dist/commands/workflow/default-schema.d.ts +2 -0
- package/dist/commands/workflow/default-schema.js +4 -0
- package/dist/commands/workflow/index.d.ts +13 -0
- package/dist/commands/workflow/index.js +10 -0
- package/dist/commands/workflow/instructions.d.ts +39 -0
- package/dist/commands/workflow/instructions.js +565 -0
- package/dist/commands/workflow/new-change.d.ts +19 -0
- package/dist/commands/workflow/new-change.js +135 -0
- package/dist/commands/workflow/shared.d.ts +94 -0
- package/dist/commands/workflow/shared.js +169 -0
- package/dist/commands/workflow/status.d.ts +18 -0
- package/dist/commands/workflow/status.js +201 -0
- package/dist/core/artifact-graph/graph.d.ts +72 -0
- package/dist/core/artifact-graph/graph.js +165 -0
- package/dist/core/artifact-graph/index.d.ts +9 -0
- package/dist/core/artifact-graph/index.js +14 -0
- package/dist/core/artifact-graph/instruction-loader.d.ts +208 -0
- package/dist/core/artifact-graph/instruction-loader.js +268 -0
- package/dist/core/artifact-graph/outputs.d.ts +19 -0
- package/dist/core/artifact-graph/outputs.js +351 -0
- package/dist/core/artifact-graph/resolver.d.ts +89 -0
- package/dist/core/artifact-graph/resolver.js +342 -0
- package/dist/core/artifact-graph/schema.d.ts +27 -0
- package/dist/core/artifact-graph/schema.js +160 -0
- package/dist/core/artifact-graph/state.d.ts +12 -0
- package/dist/core/artifact-graph/state.js +31 -0
- package/dist/core/artifact-graph/types.d.ts +40 -0
- package/dist/core/artifact-graph/types.js +59 -0
- package/dist/core/available-tools.d.ts +18 -0
- package/dist/core/available-tools.js +49 -0
- package/dist/core/change-layout.d.ts +17 -0
- package/dist/core/change-layout.js +30 -0
- package/dist/core/change-metadata/index.d.ts +2 -0
- package/dist/core/change-metadata/index.js +2 -0
- package/dist/core/change-metadata/schema.d.ts +23 -0
- package/dist/core/change-metadata/schema.js +46 -0
- package/dist/core/change-status-policy.d.ts +49 -0
- package/dist/core/change-status-policy.js +50 -0
- package/dist/core/command-generation/adapters/amazon-q.d.ts +17 -0
- package/dist/core/command-generation/adapters/amazon-q.js +32 -0
- package/dist/core/command-generation/adapters/antigravity.d.ts +13 -0
- package/dist/core/command-generation/adapters/antigravity.js +27 -0
- package/dist/core/command-generation/adapters/atomcode.d.ts +24 -0
- package/dist/core/command-generation/adapters/atomcode.js +46 -0
- package/dist/core/command-generation/adapters/auggie.d.ts +13 -0
- package/dist/core/command-generation/adapters/auggie.js +28 -0
- package/dist/core/command-generation/adapters/bob.d.ts +18 -0
- package/dist/core/command-generation/adapters/bob.js +33 -0
- package/dist/core/command-generation/adapters/claude.d.ts +13 -0
- package/dist/core/command-generation/adapters/claude.js +32 -0
- package/dist/core/command-generation/adapters/cline.d.ts +14 -0
- package/dist/core/command-generation/adapters/cline.js +27 -0
- package/dist/core/command-generation/adapters/codeassistant.d.ts +15 -0
- package/dist/core/command-generation/adapters/codeassistant.js +29 -0
- package/dist/core/command-generation/adapters/codebuddy.d.ts +13 -0
- package/dist/core/command-generation/adapters/codebuddy.js +29 -0
- package/dist/core/command-generation/adapters/codestudio.d.ts +13 -0
- package/dist/core/command-generation/adapters/codestudio.js +27 -0
- package/dist/core/command-generation/adapters/command-code.d.ts +19 -0
- package/dist/core/command-generation/adapters/command-code.js +34 -0
- package/dist/core/command-generation/adapters/continue.d.ts +13 -0
- package/dist/core/command-generation/adapters/continue.js +33 -0
- package/dist/core/command-generation/adapters/costrict.d.ts +13 -0
- package/dist/core/command-generation/adapters/costrict.js +28 -0
- package/dist/core/command-generation/adapters/crush.d.ts +13 -0
- package/dist/core/command-generation/adapters/crush.js +30 -0
- package/dist/core/command-generation/adapters/cursor.d.ts +14 -0
- package/dist/core/command-generation/adapters/cursor.js +31 -0
- package/dist/core/command-generation/adapters/devin.d.ts +19 -0
- package/dist/core/command-generation/adapters/devin.js +36 -0
- package/dist/core/command-generation/adapters/easycode.d.ts +17 -0
- package/dist/core/command-generation/adapters/easycode.js +28 -0
- package/dist/core/command-generation/adapters/factory.d.ts +13 -0
- package/dist/core/command-generation/adapters/factory.js +28 -0
- package/dist/core/command-generation/adapters/gemini.d.ts +13 -0
- package/dist/core/command-generation/adapters/gemini.js +27 -0
- package/dist/core/command-generation/adapters/gigacode.d.ts +17 -0
- package/dist/core/command-generation/adapters/gigacode.js +31 -0
- package/dist/core/command-generation/adapters/github-copilot.d.ts +13 -0
- package/dist/core/command-generation/adapters/github-copilot.js +27 -0
- package/dist/core/command-generation/adapters/iflow.d.ts +13 -0
- package/dist/core/command-generation/adapters/iflow.js +30 -0
- package/dist/core/command-generation/adapters/index.d.ts +40 -0
- package/dist/core/command-generation/adapters/index.js +40 -0
- package/dist/core/command-generation/adapters/junie.d.ts +13 -0
- package/dist/core/command-generation/adapters/junie.js +27 -0
- package/dist/core/command-generation/adapters/kilocode.d.ts +14 -0
- package/dist/core/command-generation/adapters/kilocode.js +23 -0
- package/dist/core/command-generation/adapters/kiro.d.ts +13 -0
- package/dist/core/command-generation/adapters/kiro.js +27 -0
- package/dist/core/command-generation/adapters/lingma.d.ts +13 -0
- package/dist/core/command-generation/adapters/lingma.js +30 -0
- package/dist/core/command-generation/adapters/oh-my-pi.d.ts +21 -0
- package/dist/core/command-generation/adapters/oh-my-pi.js +42 -0
- package/dist/core/command-generation/adapters/opencode.d.ts +14 -0
- package/dist/core/command-generation/adapters/opencode.js +38 -0
- package/dist/core/command-generation/adapters/pi.d.ts +18 -0
- package/dist/core/command-generation/adapters/pi.js +39 -0
- package/dist/core/command-generation/adapters/qoder.d.ts +13 -0
- package/dist/core/command-generation/adapters/qoder.js +30 -0
- package/dist/core/command-generation/adapters/qwen.d.ts +17 -0
- package/dist/core/command-generation/adapters/qwen.js +31 -0
- package/dist/core/command-generation/adapters/roocode.d.ts +14 -0
- package/dist/core/command-generation/adapters/roocode.js +27 -0
- package/dist/core/command-generation/adapters/trae.d.ts +13 -0
- package/dist/core/command-generation/adapters/trae.js +28 -0
- package/dist/core/command-generation/adapters/zcode.d.ts +16 -0
- package/dist/core/command-generation/adapters/zcode.js +33 -0
- package/dist/core/command-generation/generator.d.ts +29 -0
- package/dist/core/command-generation/generator.js +43 -0
- package/dist/core/command-generation/index.d.ts +22 -0
- package/dist/core/command-generation/index.js +24 -0
- package/dist/core/command-generation/invocation.d.ts +73 -0
- package/dist/core/command-generation/invocation.js +77 -0
- package/dist/core/command-generation/registry.d.ts +36 -0
- package/dist/core/command-generation/registry.js +114 -0
- package/dist/core/command-generation/toml.d.ts +19 -0
- package/dist/core/command-generation/toml.js +39 -0
- package/dist/core/command-generation/types.d.ts +63 -0
- package/dist/core/command-generation/types.js +8 -0
- package/dist/core/command-generation/yaml.d.ts +36 -0
- package/dist/core/command-generation/yaml.js +48 -0
- package/dist/core/command-surface.d.ts +15 -0
- package/dist/core/command-surface.js +33 -0
- package/dist/core/config-prompts.d.ts +9 -0
- package/dist/core/config-prompts.js +56 -0
- package/dist/core/config-schema.d.ts +98 -0
- package/dist/core/config-schema.js +308 -0
- package/dist/core/config.d.ts +50 -0
- package/dist/core/config.js +122 -0
- package/dist/core/file-state.d.ts +36 -0
- package/dist/core/file-state.js +144 -0
- package/dist/core/file-view.d.ts +13 -0
- package/dist/core/file-view.js +14 -0
- package/dist/core/global-config.d.ts +101 -0
- package/dist/core/global-config.js +182 -0
- package/dist/core/id.d.ts +17 -0
- package/dist/core/id.js +30 -0
- package/dist/core/index.d.ts +6 -0
- package/dist/core/index.js +7 -0
- package/dist/core/init.d.ts +57 -0
- package/dist/core/init.js +836 -0
- package/dist/core/list.d.ts +11 -0
- package/dist/core/list.js +197 -0
- package/dist/core/migration.d.ts +121 -0
- package/dist/core/migration.js +540 -0
- package/dist/core/onboarding-commands.d.ts +30 -0
- package/dist/core/onboarding-commands.js +38 -0
- package/dist/core/openspec-root.d.ts +47 -0
- package/dist/core/openspec-root.js +196 -0
- package/dist/core/planning-home.d.ts +16 -0
- package/dist/core/planning-home.js +67 -0
- package/dist/core/profile-sync-drift.d.ts +31 -0
- package/dist/core/profile-sync-drift.js +201 -0
- package/dist/core/profiles.d.ts +19 -0
- package/dist/core/profiles.js +33 -0
- package/dist/core/project-config.d.ts +132 -0
- package/dist/core/project-config.js +519 -0
- package/dist/core/references.d.ts +10 -0
- package/dist/core/references.js +46 -0
- package/dist/core/root-selection.d.ts +59 -0
- package/dist/core/root-selection.js +132 -0
- package/dist/core/shared/allowed-tools.d.ts +12 -0
- package/dist/core/shared/allowed-tools.js +12 -0
- package/dist/core/shared/ide-restart.d.ts +26 -0
- package/dist/core/shared/ide-restart.js +42 -0
- package/dist/core/shared/index.d.ts +11 -0
- package/dist/core/shared/index.js +11 -0
- package/dist/core/shared/skill-content-equivalence.d.ts +7 -0
- package/dist/core/shared/skill-content-equivalence.js +45 -0
- package/dist/core/shared/skill-files.d.ts +7 -0
- package/dist/core/shared/skill-files.js +43 -0
- package/dist/core/shared/skill-generation.d.ts +49 -0
- package/dist/core/shared/skill-generation.js +125 -0
- package/dist/core/shared/skill-paths.d.ts +13 -0
- package/dist/core/shared/skill-paths.js +23 -0
- package/dist/core/shared/tool-detection.d.ts +99 -0
- package/dist/core/shared/tool-detection.js +318 -0
- package/dist/core/shared-skill-target.d.ts +51 -0
- package/dist/core/shared-skill-target.js +239 -0
- package/dist/core/store/errors.d.ts +20 -0
- package/dist/core/store/errors.js +22 -0
- package/dist/core/store/index.d.ts +2 -0
- package/dist/core/store/index.js +2 -0
- package/dist/core/styles/palette.d.ts +7 -0
- package/dist/core/styles/palette.js +8 -0
- package/dist/core/templates/optional-workflow.d.ts +69 -0
- package/dist/core/templates/optional-workflow.js +140 -0
- package/dist/core/templates/types.d.ts +19 -0
- package/dist/core/templates/types.js +5 -0
- package/dist/core/templates/workflows/personal.d.ts +22 -0
- package/dist/core/templates/workflows/personal.js +225 -0
- package/dist/core/update-plan.d.ts +127 -0
- package/dist/core/update-plan.js +390 -0
- package/dist/core/update.d.ts +154 -0
- package/dist/core/update.js +723 -0
- package/dist/core/version-check.d.ts +188 -0
- package/dist/core/version-check.js +906 -0
- package/dist/core/zod-issues.d.ts +4 -0
- package/dist/core/zod-issues.js +10 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/prompts/searchable-multi-select.d.ts +35 -0
- package/dist/prompts/searchable-multi-select.js +188 -0
- package/dist/telemetry/config.d.ts +37 -0
- package/dist/telemetry/config.js +148 -0
- package/dist/telemetry/index.d.ts +39 -0
- package/dist/telemetry/index.js +217 -0
- package/dist/telemetry/opt-out.d.ts +17 -0
- package/dist/telemetry/opt-out.js +27 -0
- package/dist/ui/ascii-patterns.d.ts +16 -0
- package/dist/ui/ascii-patterns.js +133 -0
- package/dist/ui/welcome-screen.d.ts +18 -0
- package/dist/ui/welcome-screen.js +199 -0
- package/dist/utils/change-metadata.d.ts +116 -0
- package/dist/utils/change-metadata.js +324 -0
- package/dist/utils/change-utils.d.ts +79 -0
- package/dist/utils/change-utils.js +121 -0
- package/dist/utils/ci.d.ts +12 -0
- package/dist/utils/ci.js +16 -0
- package/dist/utils/command-references.d.ts +104 -0
- package/dist/utils/command-references.js +190 -0
- package/dist/utils/date.d.ts +8 -0
- package/dist/utils/date.js +13 -0
- package/dist/utils/executable-path.d.ts +5 -0
- package/dist/utils/executable-path.js +44 -0
- package/dist/utils/file-system.d.ts +58 -0
- package/dist/utils/file-system.js +432 -0
- package/dist/utils/index.d.ts +6 -0
- package/dist/utils/index.js +9 -0
- package/dist/utils/interactive.d.ts +85 -0
- package/dist/utils/interactive.js +174 -0
- package/dist/utils/item-discovery.d.ts +15 -0
- package/dist/utils/item-discovery.js +33 -0
- package/dist/utils/line-endings.d.ts +34 -0
- package/dist/utils/line-endings.js +46 -0
- package/dist/utils/match.d.ts +3 -0
- package/dist/utils/match.js +22 -0
- package/dist/utils/nested-change.d.ts +35 -0
- package/dist/utils/nested-change.js +185 -0
- package/dist/utils/shell-detection.d.ts +20 -0
- package/dist/utils/shell-detection.js +94 -0
- package/dist/utils/task-progress.d.ts +67 -0
- package/dist/utils/task-progress.js +184 -0
- package/package.json +74 -4
- package/schemas//351/273/230/350/256/244/schema.yaml +68 -0
- package/schemas//351/273/230/350/256/244/templates//344/273/273/345/212/241/346/270/205/345/215/225.md +25 -0
- package/schemas//351/273/230/350/256/244/templates//346/265/213/350/257/225/347/224/250/344/276/213.md +34 -0
- package/schemas//351/273/230/350/256/244/templates//350/256/276/350/256/241/346/226/207/346/241/243.md +172 -0
- package/schemas//351/273/230/350/256/244/templates//351/234/200/346/261/202/346/226/207/346/241/243.md +19 -0
- package/skill-files//344/273/273/345/212/241/references//346/212/244/346/240/217.md +43 -0
- package/skill-files//344/273/273/345/212/241/references//347/262/222/345/272/246.md +23 -0
- package/skill-files//344/273/273/345/212/241/references//347/272/246/346/235/237.md +8 -0
- package/skill-files//344/273/273/345/212/241/scripts/check-tasks.mjs +83 -0
- package/skill-files//345/206/231Java/references/Java/350/247/204/350/214/203.md +25 -0
- package/skill-files//345/206/231Java/references//345/215/261/351/231/251/345/206/231/346/263/225.md +27 -0
- package/skill-files//345/206/231Java/references//345/256/214/346/210/220/345/257/271/347/205/247.md +15 -0
- package/skill-files//345/206/231Java/references//346/212/244/346/240/217.md +35 -0
- package/skill-files//345/206/231Java/references//347/272/246/346/235/237.md +8 -0
- package/skill-files//345/206/231Java/references//350/270/251/345/235/221.md +17 -0
- package/skill-files//345/256/241Java/references//346/212/244/346/240/217.md +19 -0
- package/skill-files//345/256/241Java/references//347/244/272/344/276/213.md +23 -0
- package/skill-files//345/256/241Java/references//347/272/246/346/235/237.md +7 -0
- package/skill-files//345/256/241Java/references//350/247/204/345/210/231.md +23 -0
- package/skill-files//345/256/241Java/references//351/242/206/345/237/237/346/243/200/351/241/271.md +58 -0
- package/skill-files//345/256/241/346/226/207/346/241/243/references//346/212/244/346/240/217.md +18 -0
- package/skill-files//345/256/241/346/226/207/346/241/243/references//347/272/246/346/235/237.md +8 -0
- package/skill-files//345/256/241/346/226/207/346/241/243/references//347/273/264/345/272/246.md +17 -0
- package/skill-files//345/256/241/346/226/207/346/241/243/references//350/270/251/345/235/221.md +11 -0
- package/skill-files//346/226/260/345/273/272/references//344/272/244/346/216/245.md +11 -0
- package/skill-files//346/226/260/345/273/272/references//346/212/244/346/240/217.md +14 -0
- package/skill-files//346/226/260/345/273/272/references//347/272/246/346/235/237.md +7 -0
- package/skill-files//346/267/261/346/200/235/config/prompts.yaml +114 -0
- package/skill-files//346/267/261/346/200/235/references//344/270/211/346/226/271/346/240/270/345/257/271.md +72 -0
- package/skill-files//346/267/261/346/200/235/references//344/276/213/345/255/220.md +39 -0
- package/skill-files//346/267/261/346/200/235/references//346/200/216/344/271/210/346/203/263.md +61 -0
- package/skill-files//346/267/261/346/200/235/references//346/212/244/346/240/217.md +26 -0
- package/skill-files//346/267/261/346/200/235/references//347/202/271/351/200/211/346/217/220/351/227/256.md +66 -0
- package/skill-files//346/267/261/346/200/235/references//347/231/273/350/256/260.md +45 -0
- package/skill-files//346/267/261/346/200/235/references//347/272/246/346/235/237.md +9 -0
- package/skill-files//347/224/250/344/276/213/references//346/200/216/344/271/210/345/206/231.md +13 -0
- package/skill-files//347/224/250/344/276/213/references//346/212/244/346/240/217.md +42 -0
- package/skill-files//347/224/250/344/276/213/references//347/272/246/346/235/237.md +5 -0
- package/skill-files//347/224/250/344/276/213/scripts/check-cases.mjs +70 -0
- package/skill-files//350/256/276/350/256/241/references//345/207/206/345/244/207.md +25 -0
- package/skill-files//350/256/276/350/256/241/references//346/212/244/346/240/217.md +134 -0
- package/skill-files//350/256/276/350/256/241/references//346/226/207/351/243/216.md +17 -0
- package/skill-files//350/256/276/350/256/241/references//347/225/214/351/235/242.md +18 -0
- package/skill-files//350/256/276/350/256/241/references//347/261/273/345/236/213.md +19 -0
- package/skill-files//350/256/276/350/256/241/references//347/272/246/346/235/237.md +25 -0
- package/skill-files//350/256/276/350/256/241/scripts/_smoke.mjs +72 -0
- package/skill-files//350/256/276/350/256/241/scripts/check-design.mjs +331 -0
- package/skill-files//351/234/200/346/261/202/references//346/212/244/346/240/217.md +26 -0
- package/skill-files//351/234/200/346/261/202/references//346/226/207/351/243/216.md +23 -0
- package/skill-files//351/234/200/346/261/202/references//346/267/261/346/200/235/346/221/204/345/205/245.md +21 -0
- package/skill-files//351/234/200/346/261/202/references//347/272/246/346/235/237.md +8 -0
- package/skill-files//351/234/200/346/261/202/references//351/234/200/346/261/202/345/276/205/345/256/232.md +13 -0
- package/skill-files//351/234/200/346/261/202/scripts/check-requirements.mjs +60 -0
- package/skill-files//351/252/214/346/224/266/references//346/212/244/346/240/217.md +27 -0
- package/skill-files//351/252/214/346/224/266/references//346/240/270/345/257/271.md +17 -0
- package/skill-files//351/252/214/346/224/266/references//347/272/246/346/235/237.md +7 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export interface ParsedTask {
|
|
2
|
+
/** Checkbox state: `[x]`/`[X]` is done, every other marker (and none) is not. */
|
|
3
|
+
done: boolean;
|
|
4
|
+
/** Task text after the checkbox, trimmed (may be empty). */
|
|
5
|
+
description: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Parses every task line in a tasks file, in document order.
|
|
9
|
+
*
|
|
10
|
+
* Every line matching the pattern counts, wherever it sits - inside a code
|
|
11
|
+
* fence, an HTML comment or an indented block, as before. Skipping fenced
|
|
12
|
+
* checkboxes was tried and dropped: every rule for deciding which fence is
|
|
13
|
+
* "real" has an input where a stray or unbalanced ``` swallows genuine tasks.
|
|
14
|
+
* Counting a documented example as work is a loud, bypassable false positive;
|
|
15
|
+
* losing a real task is a silent one.
|
|
16
|
+
*/
|
|
17
|
+
export declare function parseTaskLines(content: string): ParsedTask[];
|
|
18
|
+
export interface TaskProgress {
|
|
19
|
+
total: number;
|
|
20
|
+
completed: number;
|
|
21
|
+
}
|
|
22
|
+
export declare function countTasksFromContent(content: string): TaskProgress;
|
|
23
|
+
/**
|
|
24
|
+
* Run-scoped memo mapping a schema name to its tracked-tasks `generates` glob.
|
|
25
|
+
* When one command resolves progress for many changes under a constant
|
|
26
|
+
* `projectRoot` — e.g. `validate --archived` over an append-only archive — this
|
|
27
|
+
* avoids re-reading and re-parsing (YAML + Zod) the same `schema.yaml` once per
|
|
28
|
+
* change. Keyed by schema name alone, which is safe *only* because a single run
|
|
29
|
+
* holds `projectRoot` constant; never reuse one cache across differing roots.
|
|
30
|
+
*/
|
|
31
|
+
export type SchemaGlobCache = Map<string, string | undefined>;
|
|
32
|
+
/** Resolves the task files selected by the schema's apply tracking rule. */
|
|
33
|
+
export declare function resolveTaskFilesForChange(changeDir: string, projectRoot: string, schemaGlobCache?: SchemaGlobCache): string[];
|
|
34
|
+
export interface TaskProgressDetail extends TaskProgress {
|
|
35
|
+
/**
|
|
36
|
+
* Task files that exist but could not be read (any error other than ENOENT).
|
|
37
|
+
* `getTaskProgressForChange` discards this list to preserve its behavior;
|
|
38
|
+
* callers that must fail loudly on an unreadable tasks file — e.g.
|
|
39
|
+
* `freespec validate --archived` — read it so an unreadable file is never
|
|
40
|
+
* silently counted as "no tasks" (#205).
|
|
41
|
+
*/
|
|
42
|
+
unreadable: string[];
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Computes a change's task progress by resolving its tracked-tasks artifact and
|
|
46
|
+
* counting checkboxes across every file matched by that artifact's `generates`
|
|
47
|
+
* glob — the same file-resolution `freespec status` uses to detect the tasks
|
|
48
|
+
* artifact (`resolveArtifactOutputs`) — so progress is no longer blind to nested
|
|
49
|
+
* `tasks.md` files (#1202). Falls back to a single top-level `tasks.md` (exactly
|
|
50
|
+
* as before) when the schema is unresolvable, no tracked-tasks artifact is found,
|
|
51
|
+
* or the glob matches no file. Also reports task files that exist but could not
|
|
52
|
+
* be read. Per-file read errors are captured (never thrown); the only throw path
|
|
53
|
+
* is a malformed/unsafe schema whose glob resolution rejects (path traversal or
|
|
54
|
+
* a linked-directory cycle in `resolveArtifactOutputs`). Pass `schemaGlobCache`
|
|
55
|
+
* to memoize schema→glob resolution across many changes in one run.
|
|
56
|
+
*/
|
|
57
|
+
export declare function getTaskProgressDetailForChange(changesDir: string, changeName: string, projectRoot: string, schemaGlobCache?: SchemaGlobCache): Promise<TaskProgressDetail>;
|
|
58
|
+
/**
|
|
59
|
+
* The task-completion counter `status`, `list`, and `archive` share. Delegates
|
|
60
|
+
* to `getTaskProgressDetailForChange` and drops the `unreadable` detail, so its
|
|
61
|
+
* returned totals are unchanged. Throws only on the same malformed/unsafe-schema
|
|
62
|
+
* glob-resolution path as that function (existing behavior; callers guard it as
|
|
63
|
+
* they did before).
|
|
64
|
+
*/
|
|
65
|
+
export declare function getTaskProgressForChange(changesDir: string, changeName: string, projectRoot: string): Promise<TaskProgress>;
|
|
66
|
+
export declare function formatTaskStatus(progress: TaskProgress): string;
|
|
67
|
+
//# sourceMappingURL=task-progress.d.ts.map
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { promises as fs } from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { resolveArtifactOutputs, resolveSchema } from '../core/artifact-graph/index.js';
|
|
4
|
+
import { resolveSchemaForChange } from './change-metadata.js';
|
|
5
|
+
/**
|
|
6
|
+
* A Markdown task line: a list item carrying a checkbox that holds at most one
|
|
7
|
+
* non-whitespace marker - `[ ]`, `[x]`, `[]`, `[~]`, `[ x ]` all qualify - under
|
|
8
|
+
* any CommonMark list marker - `-`, `*`, `+`, or an ordered `1.` / `1)` of up
|
|
9
|
+
* to nine digits. Reading only `-` and `*` left an unchecked `1. [ ]` or
|
|
10
|
+
* `+ [ ]` task out of every count, so archive reported "✓ Complete" over it.
|
|
11
|
+
*
|
|
12
|
+
* Leading whitespace is allowed so nested sub-tasks count like their parents.
|
|
13
|
+
* Anchoring at column 0 made ` - [ ] 1.1.1 ...` invisible to progress, to the
|
|
14
|
+
* apply task list, and to archive's incomplete-task check, so a change with
|
|
15
|
+
* unfinished sub-tasks reported "✓ Complete" and archived without a warning.
|
|
16
|
+
*
|
|
17
|
+
* The marker is no longer restricted to ` `/`x`/`X`, because a checkbox this
|
|
18
|
+
* pattern rejects is a line that counts toward neither the numerator nor the
|
|
19
|
+
* denominator: a tasks.md whose remaining work was written `- [~] ...`
|
|
20
|
+
* reported "✓ Complete" and archived with no incomplete-task warning, and
|
|
21
|
+
* marking items `[~]` *shrank* the denominator instead of leaving them counted
|
|
22
|
+
* as not-done (#1761). An empty `[]` and a padded `[ x]` were lost the same
|
|
23
|
+
* silent way. Only `x`/`X` means done, so every unrecognised marker reads as
|
|
24
|
+
* not-done - the conservative default, and no new concept: FreeSpec does not
|
|
25
|
+
* adopt `[~]` or any other marker's meaning, it just stops dropping the line.
|
|
26
|
+
*
|
|
27
|
+
* Permissive on purpose, and safe to keep that way: any character class
|
|
28
|
+
* tightened here drops lines that used to count, and a task this parser drops
|
|
29
|
+
* is a task `freespec archive` stops warning about. The cost of the wide class
|
|
30
|
+
* is over-counting - `- [1] ...` in a tasks file now reads as one unfinished
|
|
31
|
+
* task - which is a loud, correctable false positive, unlike the silent loss.
|
|
32
|
+
*
|
|
33
|
+
* Where the width stops, and why: the marker is one token, so a *multi*
|
|
34
|
+
* character bracket stays unmatched. Widening to `[^\]]*` would swallow the
|
|
35
|
+
* commonest bullet in Markdown - `- [Some doc](./doc.md)`, whose `]` is
|
|
36
|
+
* followed by `(`, not by a space - and turn every link list into phantom
|
|
37
|
+
* unfinished work. A dropped `- [WIP] ...` is the accepted residue of keeping
|
|
38
|
+
* link bullets out; report it as a bug in this trade, not in the marker set.
|
|
39
|
+
*
|
|
40
|
+
* One-character labels need the same guard, which the width alone does not
|
|
41
|
+
* give: `- [A](https://example.com)` and `- [1](./one)` are a link bullet and
|
|
42
|
+
* a reference-link bullet, not tasks, yet their label is a single token and
|
|
43
|
+
* would match. So the closing bracket may not be followed by `(` or `[`, the
|
|
44
|
+
* only two characters that continue Markdown link syntax. A checkbox is
|
|
45
|
+
* followed by its description or by end of line, and `- [x]done` still parses.
|
|
46
|
+
* The one exception is a whitespace-only box: `- [ ](...)` and `- [ ][...]`
|
|
47
|
+
* matched the strict pattern as unfinished tasks, so they still count. The guard
|
|
48
|
+
* may drop only lines that could never hide open work.
|
|
49
|
+
*
|
|
50
|
+
* Deliberately unanchored at the end: `.` does not match `\r`, so writing the
|
|
51
|
+
* description group as `(.*)$` would reject every line of a CRLF tasks.md.
|
|
52
|
+
*/
|
|
53
|
+
const TASK_LINE_PATTERN = /^\s*(?:[-*+]|\d{1,9}[.)])\s*\[(?:\s*([^\]\s]?)\s*\](?![([])|\s+\])\s*(.*)/;
|
|
54
|
+
/**
|
|
55
|
+
* Parses every task line in a tasks file, in document order.
|
|
56
|
+
*
|
|
57
|
+
* Every line matching the pattern counts, wherever it sits - inside a code
|
|
58
|
+
* fence, an HTML comment or an indented block, as before. Skipping fenced
|
|
59
|
+
* checkboxes was tried and dropped: every rule for deciding which fence is
|
|
60
|
+
* "real" has an input where a stray or unbalanced ``` swallows genuine tasks.
|
|
61
|
+
* Counting a documented example as work is a loud, bypassable false positive;
|
|
62
|
+
* losing a real task is a silent one.
|
|
63
|
+
*/
|
|
64
|
+
export function parseTaskLines(content) {
|
|
65
|
+
const tasks = [];
|
|
66
|
+
for (const line of content.split('\n')) {
|
|
67
|
+
const match = line.match(TASK_LINE_PATTERN);
|
|
68
|
+
if (match) {
|
|
69
|
+
tasks.push({ done: (match[1] ?? '').toLowerCase() === 'x', description: match[2].trim() });
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return tasks;
|
|
73
|
+
}
|
|
74
|
+
export function countTasksFromContent(content) {
|
|
75
|
+
const tasks = parseTaskLines(content);
|
|
76
|
+
return {
|
|
77
|
+
total: tasks.length,
|
|
78
|
+
completed: tasks.filter((task) => task.done).length,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Identifies the change's tracked-tasks artifact: the artifact whose `generates`
|
|
83
|
+
* equals the schema's `apply.tracks` value, falling back to the artifact with id
|
|
84
|
+
* `tasks` when no `apply` block declares what it tracks. (`apply.tracks` is a
|
|
85
|
+
* filename that *selects* the artifact; the glob is that artifact's `generates`.)
|
|
86
|
+
*/
|
|
87
|
+
function findTrackedTasksArtifact(schema) {
|
|
88
|
+
const tracks = schema.apply?.tracks;
|
|
89
|
+
if (tracks != null) {
|
|
90
|
+
return schema.artifacts.find((a) => a.generates === tracks);
|
|
91
|
+
}
|
|
92
|
+
return schema.artifacts.find((a) => a.id === 'tasks');
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Resolves the tracked-tasks artifact's output glob for a change, or undefined
|
|
96
|
+
* when the schema cannot be resolved or no tracked-tasks artifact exists.
|
|
97
|
+
* `resolveSchema` throws on an unresolvable/misnamed schema; we swallow that so
|
|
98
|
+
* the caller falls back to a single top-level `tasks.md` and never crashes.
|
|
99
|
+
* A `schemaGlobCache`, when supplied, memoizes the schema-name → glob lookup for
|
|
100
|
+
* the duration of one run.
|
|
101
|
+
*/
|
|
102
|
+
function resolveTrackedTasksGlob(changeDir, projectRoot, schemaGlobCache) {
|
|
103
|
+
try {
|
|
104
|
+
const schemaName = resolveSchemaForChange(changeDir, undefined, projectRoot);
|
|
105
|
+
if (schemaGlobCache?.has(schemaName))
|
|
106
|
+
return schemaGlobCache.get(schemaName);
|
|
107
|
+
const schema = resolveSchema(schemaName, projectRoot);
|
|
108
|
+
const generates = findTrackedTasksArtifact(schema)?.generates;
|
|
109
|
+
schemaGlobCache?.set(schemaName, generates);
|
|
110
|
+
return generates;
|
|
111
|
+
}
|
|
112
|
+
catch {
|
|
113
|
+
return undefined;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/** Resolves the task files selected by the schema's apply tracking rule. */
|
|
117
|
+
export function resolveTaskFilesForChange(changeDir, projectRoot, schemaGlobCache) {
|
|
118
|
+
const generates = resolveTrackedTasksGlob(changeDir, projectRoot, schemaGlobCache);
|
|
119
|
+
return generates ? resolveArtifactOutputs(changeDir, generates) : [];
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Reads one task file and counts its checkboxes. ENOENT (a glob file that
|
|
123
|
+
* vanished between resolve and read, or the absent single top-level `tasks.md`)
|
|
124
|
+
* means zero tasks, exactly as before. Any other error (permissions, I/O,
|
|
125
|
+
* ENOTDIR) is recorded in `unreadable` so a caller can surface it; the count
|
|
126
|
+
* still contributes zero, so existing callers see no change.
|
|
127
|
+
*/
|
|
128
|
+
async function countTaskFile(file, unreadable) {
|
|
129
|
+
try {
|
|
130
|
+
const content = await fs.readFile(file, 'utf-8');
|
|
131
|
+
return countTasksFromContent(content);
|
|
132
|
+
}
|
|
133
|
+
catch (error) {
|
|
134
|
+
if (error?.code !== 'ENOENT')
|
|
135
|
+
unreadable.push(file);
|
|
136
|
+
return { total: 0, completed: 0 };
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Computes a change's task progress by resolving its tracked-tasks artifact and
|
|
141
|
+
* counting checkboxes across every file matched by that artifact's `generates`
|
|
142
|
+
* glob — the same file-resolution `freespec status` uses to detect the tasks
|
|
143
|
+
* artifact (`resolveArtifactOutputs`) — so progress is no longer blind to nested
|
|
144
|
+
* `tasks.md` files (#1202). Falls back to a single top-level `tasks.md` (exactly
|
|
145
|
+
* as before) when the schema is unresolvable, no tracked-tasks artifact is found,
|
|
146
|
+
* or the glob matches no file. Also reports task files that exist but could not
|
|
147
|
+
* be read. Per-file read errors are captured (never thrown); the only throw path
|
|
148
|
+
* is a malformed/unsafe schema whose glob resolution rejects (path traversal or
|
|
149
|
+
* a linked-directory cycle in `resolveArtifactOutputs`). Pass `schemaGlobCache`
|
|
150
|
+
* to memoize schema→glob resolution across many changes in one run.
|
|
151
|
+
*/
|
|
152
|
+
export async function getTaskProgressDetailForChange(changesDir, changeName, projectRoot, schemaGlobCache) {
|
|
153
|
+
const changeDir = path.join(changesDir, changeName);
|
|
154
|
+
const files = resolveTaskFilesForChange(changeDir, projectRoot, schemaGlobCache);
|
|
155
|
+
const targets = files;
|
|
156
|
+
const unreadable = [];
|
|
157
|
+
let total = 0;
|
|
158
|
+
let completed = 0;
|
|
159
|
+
for (const file of targets) {
|
|
160
|
+
const progress = await countTaskFile(file, unreadable);
|
|
161
|
+
total += progress.total;
|
|
162
|
+
completed += progress.completed;
|
|
163
|
+
}
|
|
164
|
+
return { total, completed, unreadable };
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* The task-completion counter `status`, `list`, and `archive` share. Delegates
|
|
168
|
+
* to `getTaskProgressDetailForChange` and drops the `unreadable` detail, so its
|
|
169
|
+
* returned totals are unchanged. Throws only on the same malformed/unsafe-schema
|
|
170
|
+
* glob-resolution path as that function (existing behavior; callers guard it as
|
|
171
|
+
* they did before).
|
|
172
|
+
*/
|
|
173
|
+
export async function getTaskProgressForChange(changesDir, changeName, projectRoot) {
|
|
174
|
+
const { total, completed } = await getTaskProgressDetailForChange(changesDir, changeName, projectRoot);
|
|
175
|
+
return { total, completed };
|
|
176
|
+
}
|
|
177
|
+
export function formatTaskStatus(progress) {
|
|
178
|
+
if (progress.total === 0)
|
|
179
|
+
return 'No tasks';
|
|
180
|
+
if (progress.completed === progress.total)
|
|
181
|
+
return '✓ Complete';
|
|
182
|
+
return `${progress.completed}/${progress.total} tasks`;
|
|
183
|
+
}
|
|
184
|
+
//# sourceMappingURL=task-progress.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,76 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@niujiajie/freespec",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.15.0",
|
|
4
|
+
"description": "AI-native system for spec-driven development",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"freespec",
|
|
7
|
+
"specs",
|
|
8
|
+
"cli",
|
|
9
|
+
"ai",
|
|
10
|
+
"development"
|
|
11
|
+
],
|
|
12
|
+
"homepage": "https://gitee.com/niu_jiajie/openspec.git",
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "https://gitee.com/niu_jiajie/openspec.git"
|
|
16
|
+
},
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"author": "FreeSpec Contributors",
|
|
19
|
+
"type": "module",
|
|
20
|
+
"packageManager": "pnpm@10.34.5",
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"access": "public"
|
|
23
|
+
},
|
|
24
|
+
"exports": {
|
|
25
|
+
".": {
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"default": "./dist/index.js"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"bin": {
|
|
31
|
+
"freespec": "./bin/freespec.js"
|
|
32
|
+
},
|
|
33
|
+
"files": [
|
|
34
|
+
"dist",
|
|
35
|
+
"bin",
|
|
36
|
+
"schemas",
|
|
37
|
+
"skill-files",
|
|
38
|
+
"!dist/**/*.test.js",
|
|
39
|
+
"!dist/**/__tests__",
|
|
40
|
+
"!dist/**/*.map"
|
|
41
|
+
],
|
|
42
|
+
"scripts": {
|
|
43
|
+
"lint": "eslint src/",
|
|
44
|
+
"build": "node build.js",
|
|
45
|
+
"generate:skills": "node scripts/generate-skillssh.mjs",
|
|
46
|
+
"dev": "tsc --watch",
|
|
47
|
+
"dev:cli": "pnpm build && node bin/freespec.js",
|
|
48
|
+
"prepare": "node build.js",
|
|
49
|
+
"prepublishOnly": "pnpm run build",
|
|
50
|
+
"check:pack-version": "node scripts/pack-version-check.mjs"
|
|
51
|
+
},
|
|
52
|
+
"engines": {
|
|
53
|
+
"node": ">=20.19.0"
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@types/node": "^20.19.43",
|
|
57
|
+
"@types/picomatch": "^4.0.3",
|
|
58
|
+
"eslint": "^10.5.0",
|
|
59
|
+
"typescript": "^6.0.3",
|
|
60
|
+
"typescript-eslint": "^8.65.0"
|
|
61
|
+
},
|
|
62
|
+
"dependencies": {
|
|
63
|
+
"@inquirer/core": "^12.0.0",
|
|
64
|
+
"@inquirer/prompts": "^8.5.2",
|
|
65
|
+
"brace-expansion": "^5.0.12",
|
|
66
|
+
"chalk": "^5.6.2",
|
|
67
|
+
"commander": "^14.0.0",
|
|
68
|
+
"cross-spawn": "7.0.6",
|
|
69
|
+
"diff": "^9.0.0",
|
|
70
|
+
"ora": "^9.4.1",
|
|
71
|
+
"picomatch": "^4.0.4",
|
|
72
|
+
"tinyglobby": "^0.2.17",
|
|
73
|
+
"yaml": "^2.8.3",
|
|
74
|
+
"zod": "^4.4.3"
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
name: 默认
|
|
2
|
+
version: 1
|
|
3
|
+
description: 四份中文文档都可选,没有先后依赖
|
|
4
|
+
artifacts:
|
|
5
|
+
- id: requirements
|
|
6
|
+
generates: 需求文档.md
|
|
7
|
+
description: 给人看的需求说明
|
|
8
|
+
template: 需求文档.md
|
|
9
|
+
instruction: |
|
|
10
|
+
写 `需求文档.md`。文件可以没有。这次要写,就用模板里的四个标题,顺序不要换,都保留。需求待定没有项就写「无」。
|
|
11
|
+
|
|
12
|
+
每节写什么、句子多长、哪些词不能出现,以技能目录的 `references/文风.md` 为准。需求待定里写什么,以 `references/需求待定.md` 为准。
|
|
13
|
+
|
|
14
|
+
已经说清的写进背景、描述或功能点。会改功能点但还没定的,写进需求待定,把这份文档写完。不要编一个结果来填功能点,也不要为了这些缺口停下来重问。
|
|
15
|
+
有深思记录时,已定的写进对应的节,未决写进需求待定。句子用白话。
|
|
16
|
+
requires: []
|
|
17
|
+
|
|
18
|
+
- id: design
|
|
19
|
+
generates: 设计文档.md
|
|
20
|
+
description: 按章写的设计说明
|
|
21
|
+
template: 设计文档.md
|
|
22
|
+
instruction: |
|
|
23
|
+
写 `设计文档.md`。没有需求文档也可以写。章名、节名、表头都按 template 写,不要改成别的结构,不要把表写成段落。
|
|
24
|
+
|
|
25
|
+
模板是前后端的最大集合。用哪些章、标题下的「涉及:」留哪一个,只按技能目录的 `references/类型.md`。用到的章才写,从第一章连续编号。没用到的章整章删掉。
|
|
26
|
+
先看仓库里的真实代码再写变更方案。需求待定里会改变做法的,停下来问,不要在设计里补。
|
|
27
|
+
表、追溯和页面是否对得上,由技能目录的 `scripts/check-design.mjs` 判定。脚本未通过就不能交。护栏里写明脚本查不到的几条,人还要对过。
|
|
28
|
+
requires: []
|
|
29
|
+
|
|
30
|
+
- id: tasks
|
|
31
|
+
generates: 任务清单.md
|
|
32
|
+
description: 可勾选的执行清单
|
|
33
|
+
template: 任务清单.md
|
|
34
|
+
instruction: |
|
|
35
|
+
写 `任务清单.md`。没有需求文档或设计文档也可以写。有设计时按模板分组,没有对应章节的组整组删掉。
|
|
36
|
+
|
|
37
|
+
每条用简体中文写清做什么。禁止黑话和电报句。禁止:优化、完善、提升、大概、可能、后续再看,以及「实现某模块」「完成后端」。
|
|
38
|
+
一条对应一个接口加它的服务,或一张表,或一页。
|
|
39
|
+
|
|
40
|
+
每条任务用 `- [ ]` 开头。勾选只改成 `- [x]`,不要换别的符号。
|
|
41
|
+
一条里写清包含什么,以及对应哪条功能点、怎样算做完。没有需求文档时,写明这条对应这次说的哪一件事。
|
|
42
|
+
缓存、开关、线程池不要吞进一句模糊的话。
|
|
43
|
+
脚本写进仓库,和已经在数据库里执行过,要分开写。
|
|
44
|
+
已勾选的条目保留。
|
|
45
|
+
落盘前跑技能目录的 `scripts/check-tasks.mjs`。脚本未通过就不能交。
|
|
46
|
+
requires: []
|
|
47
|
+
|
|
48
|
+
- id: cases
|
|
49
|
+
generates: 测试用例.md
|
|
50
|
+
description: 要断言什么
|
|
51
|
+
template: 测试用例.md
|
|
52
|
+
instruction: |
|
|
53
|
+
写 `测试用例.md`。只写输入、操作、期望,不写某种语言的测试代码,不生成接口平台导入文件。
|
|
54
|
+
|
|
55
|
+
说明必须是简体中文,写清测什么、期望什么,不靠黑话。不要写 Given、When、Then。方法、路径、JSON 键保留原文。
|
|
56
|
+
|
|
57
|
+
一条行为一条用例。有接口时分开写正常、业务不允许、参数不合法;涉及登录或权限再写未登录、无权限。
|
|
58
|
+
期望要和已经写过的功能点一致。没有功能点就按这次说的写,并标明哪些是假设。需求待定里还没定的结果,不要写成用例里的期望。
|
|
59
|
+
可以跑的失败测试由「写Java」或以后的语言技能来落成文件并运行。
|
|
60
|
+
落盘前跑技能目录的 `scripts/check-cases.mjs`。脚本未通过就不能交。
|
|
61
|
+
requires: []
|
|
62
|
+
|
|
63
|
+
apply:
|
|
64
|
+
requires: []
|
|
65
|
+
instruction: |
|
|
66
|
+
已有的需求文档、设计文档、任务清单、用例都可以当上下文。缺的文件不用补齐。
|
|
67
|
+
用用户点名的语言技能实现。有用例时,先把用例变成会失败的测试再写实现。
|
|
68
|
+
设计里某个方法没有步骤时,不要编算法,停下来问。
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# 任务清单 · <变更名>
|
|
2
|
+
|
|
3
|
+
> 对齐设计涉及范围:
|
|
4
|
+
|
|
5
|
+
没有对应设计章节的组整组删掉,不要留空标题。已勾选的条目保留,不要重排后弄丢。
|
|
6
|
+
|
|
7
|
+
## 1. 数据与配置
|
|
8
|
+
|
|
9
|
+
- [ ] 1.1 (写清包含什么。缓存、开关、线程池、定时任务要单独能看出来,不要吞进一句「相关配置」。交付默认是仓库里的脚本,不是已经在库里执行过。对应功能点:)完成:
|
|
10
|
+
|
|
11
|
+
## 2. 前端页面
|
|
12
|
+
|
|
13
|
+
- [ ] 2.1 (对应设计里的哪一页。对应功能点:)完成:
|
|
14
|
+
|
|
15
|
+
## 3. 接口
|
|
16
|
+
|
|
17
|
+
- [ ] 3.1 (写明方法和路径。停用的接口写明删掉哪些调用。对应功能点:)完成:
|
|
18
|
+
|
|
19
|
+
## 4. 服务
|
|
20
|
+
|
|
21
|
+
- [ ] 4.1 (对应设计里该方法的步骤。设计只写了方法名、没有步骤时,不要在这里编算法。对应功能点:)完成:
|
|
22
|
+
|
|
23
|
+
## 5. 测试
|
|
24
|
+
|
|
25
|
+
- [ ] 5.1 (有用例时,对应哪几条用例。对应功能点:)完成:
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# 用例 · <变更名>
|
|
2
|
+
|
|
3
|
+
每条只写输入、操作、期望。不写某种语言的测试代码,不写接口平台导入文件。
|
|
4
|
+
|
|
5
|
+
一条行为一条用例,不要合并。有接口时分开写:正常、业务不允许、参数不合法。需要登录或权限时再加未登录、无权限。
|
|
6
|
+
|
|
7
|
+
## 核算
|
|
8
|
+
|
|
9
|
+
| 验收条目 | 对应用例 | 还缺什么 |
|
|
10
|
+
| :--- | :--- | :--- |
|
|
11
|
+
| | | |
|
|
12
|
+
|
|
13
|
+
## 用例
|
|
14
|
+
|
|
15
|
+
### 正常
|
|
16
|
+
|
|
17
|
+
#### C1
|
|
18
|
+
|
|
19
|
+
- 输入:
|
|
20
|
+
- 操作:
|
|
21
|
+
- 期望:
|
|
22
|
+
- 对应验收:
|
|
23
|
+
|
|
24
|
+
### 业务不允许
|
|
25
|
+
|
|
26
|
+
### 参数不合法
|
|
27
|
+
|
|
28
|
+
### 未登录
|
|
29
|
+
|
|
30
|
+
不涉及登录时删除本组。
|
|
31
|
+
|
|
32
|
+
### 无权限
|
|
33
|
+
|
|
34
|
+
不涉及权限时删除本组。
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
# <变更名> · 设计说明
|
|
2
|
+
|
|
3
|
+
涉及:(纯前端、前后端、纯后端、仅数据或配置,只留一个)
|
|
4
|
+
|
|
5
|
+
## 第一章 概述
|
|
6
|
+
|
|
7
|
+
### 1.1 技术现状
|
|
8
|
+
|
|
9
|
+
| 现在在哪 | 现在怎么做 | 依据文件 |
|
|
10
|
+
| :--- | :--- | :--- |
|
|
11
|
+
| | | |
|
|
12
|
+
|
|
13
|
+
### 1.2 目的与边界
|
|
14
|
+
|
|
15
|
+
| 类别 | 内容 | 对应功能点 |
|
|
16
|
+
| :--- | :--- | :--- |
|
|
17
|
+
| 要完成 | | |
|
|
18
|
+
| 不做 | | |
|
|
19
|
+
|
|
20
|
+
## 第二章 变更方案
|
|
21
|
+
|
|
22
|
+
### 2.1 改动清单
|
|
23
|
+
|
|
24
|
+
```text
|
|
25
|
+
订单
|
|
26
|
+
├── 改 订单接口
|
|
27
|
+
├── 新 退款服务
|
|
28
|
+
└── 前端
|
|
29
|
+
└── 改 订单详情页
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
| 层 | 文件 | 新/改/不动 | 动什么 | 追溯自 | 对应页面节 |
|
|
33
|
+
| :--- | :--- | :--- | :--- | :--- | :--- |
|
|
34
|
+
| Controller | | | | | 无 |
|
|
35
|
+
| 前端 api | | | | | |
|
|
36
|
+
| 组件 | | | | | |
|
|
37
|
+
|
|
38
|
+
### 2.2 影响与测试关注
|
|
39
|
+
|
|
40
|
+
| 影响谁 | 代码改没改 | 测试要盯什么 | 对应功能点 |
|
|
41
|
+
| :--- | :--- | :--- | :--- |
|
|
42
|
+
| | | | |
|
|
43
|
+
|
|
44
|
+
### 2.3 取舍
|
|
45
|
+
|
|
46
|
+
| 选了什么 | 另一个为什么不用 | 怎么回滚 |
|
|
47
|
+
| :--- | :--- | :--- |
|
|
48
|
+
| | | |
|
|
49
|
+
|
|
50
|
+
## 第三章 数据与配置
|
|
51
|
+
|
|
52
|
+
### 3.1 表结构
|
|
53
|
+
|
|
54
|
+
| 库的种类 | |
|
|
55
|
+
| :--- | :--- |
|
|
56
|
+
| | |
|
|
57
|
+
|
|
58
|
+
| 表 | 动作 | 索引 |
|
|
59
|
+
| :--- | :--- | :--- |
|
|
60
|
+
| | 新建或修改 | |
|
|
61
|
+
|
|
62
|
+
```sql
|
|
63
|
+
-- 每张表一块可执行语句。索引和上面的表写同一套。
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
| 顺序 | 目标表 | 写入什么 |
|
|
67
|
+
| :---: | :--- | :--- |
|
|
68
|
+
| | | |
|
|
69
|
+
|
|
70
|
+
### 3.2 文件
|
|
71
|
+
|
|
72
|
+
| 文件 | 用途 | 列(按顺序) | 格式 |
|
|
73
|
+
| :--- | :--- | :--- | :--- |
|
|
74
|
+
| | | | |
|
|
75
|
+
|
|
76
|
+
### 3.3 其他配置
|
|
77
|
+
|
|
78
|
+
| 类型 | 标识 | 默认值 | 环境差异 | 说明 |
|
|
79
|
+
| :--- | :--- | :--- | :--- | :--- |
|
|
80
|
+
| | | | | |
|
|
81
|
+
|
|
82
|
+
## 第四章 前端页面原型设计
|
|
83
|
+
|
|
84
|
+
### 4.1 (页面名)
|
|
85
|
+
|
|
86
|
+
| 本页改动 | 引用接口 | 接口本次变化 |
|
|
87
|
+
| :--- | :--- | :--- |
|
|
88
|
+
| | | |
|
|
89
|
+
|
|
90
|
+
```text
|
|
91
|
+
┌─────────────────────┐
|
|
92
|
+
│ 区域 │
|
|
93
|
+
│ [按钮] │
|
|
94
|
+
└─────────────────────┘
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
| 控件 | 选项文案 | 存库的码 |
|
|
98
|
+
| :--- | :--- | :--- |
|
|
99
|
+
| | | |
|
|
100
|
+
|
|
101
|
+
| # | 规则 |
|
|
102
|
+
| :---: | :--- |
|
|
103
|
+
| 1 | |
|
|
104
|
+
|
|
105
|
+
| 操作 | 方法 | 路径 |
|
|
106
|
+
| :--- | :--- | :--- |
|
|
107
|
+
| | | |
|
|
108
|
+
|
|
109
|
+
## 第五章 接口设计
|
|
110
|
+
|
|
111
|
+
### 5.1 接口清单
|
|
112
|
+
|
|
113
|
+
| 请求方式 | 路径 | 作用 | 新增/修改 | 权限或登录 | 入口 | 所属改动点 |
|
|
114
|
+
| :--- | :--- | :--- | :--- | :--- | :--- | :--- |
|
|
115
|
+
| | | | | | | |
|
|
116
|
+
|
|
117
|
+
### 5.2 接口详细设计
|
|
118
|
+
|
|
119
|
+
#### 接口 N:方法 路径(新增或修改)
|
|
120
|
+
|
|
121
|
+
| 对应功能点 | 数据范围 |
|
|
122
|
+
| :--- | :--- |
|
|
123
|
+
| | |
|
|
124
|
+
|
|
125
|
+
请求参数:
|
|
126
|
+
|
|
127
|
+
| 字段 | 位置 | 类型 | 长度 | 必填 | 默认值 | 规则 | 校验失败提示 |
|
|
128
|
+
| :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- |
|
|
129
|
+
| | | | | | | | |
|
|
130
|
+
|
|
131
|
+
成功响应:
|
|
132
|
+
|
|
133
|
+
| 字段 | 类型 | 说明 |
|
|
134
|
+
| :--- | :--- | :--- |
|
|
135
|
+
| | | |
|
|
136
|
+
|
|
137
|
+
业务错误:
|
|
138
|
+
|
|
139
|
+
| 场景 | 错误码 | 提示信息 | 触发条件 |
|
|
140
|
+
| :--- | :--- | :--- | :--- |
|
|
141
|
+
| | | | |
|
|
142
|
+
|
|
143
|
+
## 第六章 服务层设计
|
|
144
|
+
|
|
145
|
+
### 6.1 接口与服务映射
|
|
146
|
+
|
|
147
|
+
| 接口(或定时任务、消息) | 服务 | 方法 | 所属改动点 |
|
|
148
|
+
| :--- | :--- | :--- | :--- |
|
|
149
|
+
| | | | |
|
|
150
|
+
|
|
151
|
+
### 6.2 方法详细设计
|
|
152
|
+
|
|
153
|
+
#### (方法名)
|
|
154
|
+
|
|
155
|
+
| 步骤 | 做什么 | 分支 |
|
|
156
|
+
| :---: | :--- | :--- |
|
|
157
|
+
| 1 | 校验参数是否齐全 | 缺了就停下,不保存 |
|
|
158
|
+
| 2 | 校验这条用户记录是否已经存在 | 已存在则不再新增 |
|
|
159
|
+
| 3 | 把登录密钥加密 | |
|
|
160
|
+
| 4 | 把手机号加密 | |
|
|
161
|
+
| 5 | 保存用户信息 | |
|
|
162
|
+
| 6 | 保存用户关联的账户信息 | |
|
|
163
|
+
|
|
164
|
+
| 事务 | 副作用 | 状态变化 |
|
|
165
|
+
| :--- | :--- | :--- |
|
|
166
|
+
| | | |
|
|
167
|
+
|
|
168
|
+
## 修订记录
|
|
169
|
+
|
|
170
|
+
| 版本 | 日期 | 修订人 | 修订内容 |
|
|
171
|
+
| :---: | :--- | :--- | :--- |
|
|
172
|
+
| v1.0 | | | 初稿 |
|