@peter.naydenov/morph 3.1.5 → 3.3.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/.mocharc.json +1 -0
- package/.opencode/command/speckit.analyze.md +184 -0
- package/.opencode/command/speckit.checklist.md +294 -0
- package/.opencode/command/speckit.clarify.md +181 -0
- package/.opencode/command/speckit.constitution.md +82 -0
- package/.opencode/command/speckit.implement.md +135 -0
- package/.opencode/command/speckit.plan.md +89 -0
- package/.opencode/command/speckit.specify.md +257 -0
- package/.opencode/command/speckit.tasks.md +137 -0
- package/.opencode/command/speckit.taskstoissues.md +28 -0
- package/.specify/memory/constitution.md +43 -0
- package/.specify/scripts/bash/check-prerequisites.sh +166 -0
- package/.specify/scripts/bash/common.sh +156 -0
- package/.specify/scripts/bash/create-new-feature.sh +305 -0
- package/.specify/scripts/bash/setup-plan.sh +61 -0
- package/.specify/scripts/bash/update-agent-context.sh +790 -0
- package/.specify/templates/agent-file-template.md +28 -0
- package/.specify/templates/checklist-template.md +40 -0
- package/.specify/templates/plan-template.md +104 -0
- package/.specify/templates/spec-template.md +115 -0
- package/.specify/templates/tasks-template.md +251 -0
- package/Changelog.md +17 -0
- package/README.md +184 -13
- package/dist/methods/build.d.ts +28 -2
- package/dist/methods/render.d.ts +9 -20
- package/dist/morph.cjs +1 -1
- package/dist/morph.esm.mjs +1 -1
- package/dist/morph.umd.js +1 -1
- package/morph.png +0 -0
- package/package.json +3 -2
- package/simple.js +17 -0
- package/specs/001-extend-templates/checklists/requirements.md +35 -0
- package/specs/001-extend-templates/contracts/set-method.json +39 -0
- package/specs/001-extend-templates/data-model.md +76 -0
- package/specs/001-extend-templates/plan.md +90 -0
- package/specs/001-extend-templates/quickstart.md +56 -0
- package/specs/001-extend-templates/research.md +18 -0
- package/specs/001-extend-templates/spec.md +139 -0
- package/specs/001-extend-templates/tasks.md +255 -0
- package/src/methods/_readTemplate.js +22 -46
- package/src/methods/_renderHolder.js +13 -7
- package/src/methods/_setupActions.js +1 -8
- package/src/methods/build.js +458 -321
- package/src/methods/render.js +23 -46
|
@@ -52,52 +52,28 @@ function _readTemplate ( tpl ) {
|
|
|
52
52
|
|
|
53
53
|
if ( typeof chop === 'string' ) hasError = chop
|
|
54
54
|
else {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
// Check helpers - sanity check
|
|
81
|
-
placeholders.forEach ( holder => {
|
|
82
|
-
if ( !holder.action ) return
|
|
83
|
-
holder.action.every ( act => {
|
|
84
|
-
if ( act === '#' ) return true
|
|
85
|
-
if ( act === '^^' ) return true
|
|
86
|
-
if ( act.startsWith('^') && act !== '^^' ) return true
|
|
87
|
-
if ( act.startsWith ( '?' )) act = act.replace ( '?', '' )
|
|
88
|
-
if ( act.startsWith ( '+' )) act = act.replace ( '+', '' )
|
|
89
|
-
if ( act.startsWith ( '[]' )) act = act.replace ( '[]', '' )
|
|
90
|
-
if ( act.startsWith ( '>' )) act = act.replace ( '>', '' )
|
|
91
|
-
if ( act === '' ) return true
|
|
92
|
-
if ( helpers[act] ) return true
|
|
93
|
-
else {
|
|
94
|
-
hasError = `Error: Missing helper: ${act}`
|
|
95
|
-
return false
|
|
96
|
-
}
|
|
97
|
-
}) // every action
|
|
98
|
-
}) // forEach placeholders
|
|
99
|
-
|
|
100
|
-
|
|
55
|
+
chop.forEach ( (item,i) => {
|
|
56
|
+
const
|
|
57
|
+
// Placeholder contains: Opening tag(TG_PRX), dataName, delimiter(:), list of operations, placeholder's name, closing tag(TG_SFX)
|
|
58
|
+
finding = RegExp ( TG_PRX + '\\s*(.*?)\\s*(?::\\s*(.*?)\\s*)?(?::\\s*(.*?)\\s*)?' + TG_SFX, 'g' )
|
|
59
|
+
, isPlaceholder = item.includes( TG_PRX )
|
|
60
|
+
;
|
|
61
|
+
|
|
62
|
+
if ( isPlaceholder ) {
|
|
63
|
+
const x = finding.exec ( item )
|
|
64
|
+
if ( !x ) return
|
|
65
|
+
let holder = {
|
|
66
|
+
index: i
|
|
67
|
+
, data : readData ( x[1] )
|
|
68
|
+
, action : x[2] ? x[2].split(',').map ( x => x.trim()) : null
|
|
69
|
+
, name : x[3] ? x[3].trim() : null
|
|
70
|
+
}
|
|
71
|
+
placeholders.push ( holder )
|
|
72
|
+
snippets[placeholders.length-1] = holder
|
|
73
|
+
if ( holder.name ) snippets[holder.name] = holder
|
|
74
|
+
} // if isPlaceholder
|
|
75
|
+
}) // forEach chop
|
|
76
|
+
} // else error
|
|
101
77
|
|
|
102
78
|
return {
|
|
103
79
|
hasError
|
|
@@ -26,17 +26,23 @@ function _renderHolder ( template, data ) {
|
|
|
26
26
|
chop = _chopTemplate (settings)( template )
|
|
27
27
|
, set = settings
|
|
28
28
|
;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
29
|
+
if ( typeof chop === 'string' ) return chop
|
|
30
|
+
chop.forEach ( ( item, i ) => {
|
|
31
|
+
const isPlaceholder = item.includes ( set.TG_PRX )
|
|
32
|
+
if ( isPlaceholder ) {
|
|
33
|
+
const field = item.replace(set.TG_PRX, '').replace(set.TG_SFX, '').trim();
|
|
34
|
+
if (data.hasOwnProperty(field) && data[field] != null) {
|
|
35
|
+
let val = data [ field ]
|
|
36
|
+
if ( typeof val === 'object' && val.text ) val = val.text
|
|
37
|
+
chop[i] = val
|
|
38
|
+
}
|
|
39
|
+
} // if isPlaceholder
|
|
40
|
+
}) // forEach chop
|
|
36
41
|
return chop.join ( '' )
|
|
37
42
|
} // _renderHolder func.
|
|
38
43
|
|
|
39
44
|
|
|
45
|
+
|
|
40
46
|
export default _renderHolder
|
|
41
47
|
|
|
42
48
|
|
|
@@ -40,14 +40,7 @@ function _setupActions ( actions, dataDeepLevel=10 ) {
|
|
|
40
40
|
if ( actLevel > dataDeepLevel ) return false
|
|
41
41
|
return true
|
|
42
42
|
}
|
|
43
|
-
|
|
44
|
-
actSetup[actLevel].push ({
|
|
45
|
-
type: 'route'
|
|
46
|
-
, name: act.replace ( '?', '' )
|
|
47
|
-
, level: actLevel
|
|
48
|
-
})
|
|
49
|
-
return true
|
|
50
|
-
}
|
|
43
|
+
|
|
51
44
|
if ( act.startsWith ('^') && act !== '^^' ) {
|
|
52
45
|
actSetup[actLevel].push ({
|
|
53
46
|
type: 'save'
|