@fission-ai/openspec 1.10.0 → 1.11.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/dist/cli/index.js +11 -2
- package/dist/commands/change.d.ts +24 -0
- package/dist/commands/change.js +223 -0
- package/dist/commands/schema.d.ts +5 -0
- package/dist/commands/schema.js +201 -35
- package/dist/commands/show.js +1 -1
- package/dist/commands/workflow/index.d.ts +1 -1
- package/dist/commands/workflow/index.js +1 -1
- package/dist/commands/workflow/status.d.ts +2 -0
- package/dist/commands/workflow/status.js +76 -12
- package/dist/core/artifact-graph/resolver.js +15 -9
- package/dist/core/available-tools.js +16 -1
- package/dist/core/command-generation/adapters/antigravity.d.ts +1 -1
- package/dist/core/command-generation/adapters/antigravity.js +2 -2
- package/dist/core/completions/command-registry.js +15 -0
- package/dist/core/completions/generators/fish-generator.d.ts +12 -0
- package/dist/core/completions/generators/fish-generator.js +79 -47
- package/dist/core/completions/templates/fish-templates.d.ts +1 -1
- package/dist/core/completions/templates/fish-templates.js +107 -10
- package/dist/core/completions/types.d.ts +4 -0
- package/dist/core/config.js +6 -1
- package/dist/core/init.js +50 -31
- package/dist/core/legacy-cleanup.js +6 -0
- package/dist/core/migration.js +42 -12
- package/dist/core/parsers/requirement-blocks.d.ts +1 -0
- package/dist/core/parsers/requirement-blocks.js +2 -0
- package/dist/core/shared/tool-detection.js +9 -3
- package/dist/core/shared-skill-target.d.ts +13 -0
- package/dist/core/shared-skill-target.js +43 -1
- package/dist/core/specs-apply.js +16 -8
- package/dist/core/templates/workflows/explore.js +79 -73
- package/dist/core/update.js +24 -22
- package/dist/core/validation/constants.d.ts +3 -0
- package/dist/core/validation/constants.js +12 -0
- package/dist/core/validation/purpose-placeholder.d.ts +45 -0
- package/dist/core/validation/purpose-placeholder.js +117 -0
- package/dist/core/validation/validator.js +16 -1
- package/dist/utils/requirement-diff.d.ts +42 -0
- package/dist/utils/requirement-diff.js +61 -0
- package/package.json +2 -1
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { formatPatch, OMIT_HEADERS, structuredPatch } from 'diff';
|
|
2
|
+
import { extractRequirementsSection, foldRequirementName, normalizeRequirementName, } from '../core/parsers/requirement-blocks.js';
|
|
3
|
+
/**
|
|
4
|
+
* Find the raw markdown block for a requirement by name in a spec file.
|
|
5
|
+
*
|
|
6
|
+
* Delegates to extractRequirementsSection() which already handles code fences,
|
|
7
|
+
* section boundaries, and requirement header parsing. We just look up by name:
|
|
8
|
+
* exactly first, then falling back to the shared case/whitespace fold so a
|
|
9
|
+
* header that differs only in spelling still shows its diff, flagged inexact.
|
|
10
|
+
*
|
|
11
|
+
* Returns null if no requirement header matches either way.
|
|
12
|
+
*/
|
|
13
|
+
export function extractRequirementBlock(specContent, requirementName) {
|
|
14
|
+
const parts = extractRequirementsSection(specContent);
|
|
15
|
+
const targetName = normalizeRequirementName(requirementName);
|
|
16
|
+
const foldedTarget = foldRequirementName(targetName);
|
|
17
|
+
let folded = null;
|
|
18
|
+
for (const block of parts.bodyBlocks) {
|
|
19
|
+
const name = normalizeRequirementName(block.name);
|
|
20
|
+
if (name === targetName) {
|
|
21
|
+
return { raw: block.raw, name, exact: true };
|
|
22
|
+
}
|
|
23
|
+
if (!folded && foldRequirementName(name) === foldedTarget) {
|
|
24
|
+
folded = { raw: block.raw, name, exact: false };
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return folded;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Compute a unified diff between a main-spec requirement block and the delta
|
|
31
|
+
* block that replaces it. A null main block (new capability) diffs against the
|
|
32
|
+
* empty string, so every line reads as an addition.
|
|
33
|
+
*
|
|
34
|
+
* Uses structuredPatch to retain unified-diff hunk ranges while omitting the
|
|
35
|
+
* synthetic file headers, since the caller provides its own labeling.
|
|
36
|
+
*/
|
|
37
|
+
export function diffRequirementBlock(baseBlock, deltaBlock, label) {
|
|
38
|
+
const base = ensureTrailingNewline(baseBlock ?? '');
|
|
39
|
+
const delta = ensureTrailingNewline(deltaBlock);
|
|
40
|
+
const patch = structuredPatch(label, label, base, delta);
|
|
41
|
+
return formatPatch(patch, OMIT_HEADERS).trimEnd();
|
|
42
|
+
}
|
|
43
|
+
function ensureTrailingNewline(s) {
|
|
44
|
+
return s.endsWith('\n') ? s : s + '\n';
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Build a map from folded RENAMED TO name to the original main-spec name.
|
|
48
|
+
* Renames apply in source order, so a chain such as A -> B -> C maps C back to
|
|
49
|
+
* A. That is the block a later MODIFIED C replaces.
|
|
50
|
+
*/
|
|
51
|
+
export function buildRenameMap(renames) {
|
|
52
|
+
const map = new Map();
|
|
53
|
+
for (const r of renames) {
|
|
54
|
+
const from = foldRequirementName(r.from);
|
|
55
|
+
const original = map.get(from) ?? normalizeRequirementName(r.from);
|
|
56
|
+
map.delete(from);
|
|
57
|
+
map.set(foldRequirementName(r.to), original);
|
|
58
|
+
}
|
|
59
|
+
return map;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=requirement-diff.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fission-ai/openspec",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.0",
|
|
4
4
|
"description": "AI-native system for spec-driven development",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"openspec",
|
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
"@inquirer/prompts": "^8.5.2",
|
|
57
57
|
"chalk": "^5.6.2",
|
|
58
58
|
"commander": "^14.0.0",
|
|
59
|
+
"diff": "^9.0.0",
|
|
59
60
|
"cross-spawn": "7.0.6",
|
|
60
61
|
"fast-glob": "^3.3.3",
|
|
61
62
|
"ora": "^9.4.1",
|