spec-up-t 1.6.11 → 1.6.13
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 +1 -1
- package/src/freeze-spec-data.js +10 -2
- package/src/install-from-boilerplate/boilerplate/.github/workflows/menu.yml +9 -2
- package/src/install-from-boilerplate/boilerplate/.github/workflows/render-and-deploy.yml +18 -0
- package/src/install-from-boilerplate/boilerplate-templates/boilerplate-template-01/spec/spec-body.md +52 -0
- package/src/install-from-boilerplate/boilerplate-templates/boilerplate-template-01/spec/spec-coda.md +25 -0
- package/src/install-from-boilerplate/boilerplate-templates/boilerplate-template-01/spec/spec-head.md +33 -0
- package/src/install-from-boilerplate/boilerplate-templates/boilerplate-template-01/spec/terms-and-definitions-intro.md +5 -0
- package/src/install-from-boilerplate/boilerplate-templates/boilerplate-template-01/spec/terms-definitions/access-control.md +5 -0
- package/src/install-from-boilerplate/boilerplate-templates/boilerplate-template-01/spec/terms-definitions/decentralized-identifier.md +7 -0
- package/src/install-from-boilerplate/boilerplate-templates/boilerplate-template-01/spec/terms-definitions/trust-registry.md +7 -0
- package/src/install-from-boilerplate/boilerplate-templates/boilerplate-template-01/spec/terms-definitions/verifiable-credential.md +7 -0
- package/src/install-from-boilerplate/boilerplate-templates/boilerplate-template-01/specs.json +35 -0
- package/src/install-from-boilerplate/boilerplate-templates/boilerplate-template-02/spec/spec-part-1.md +17 -0
- package/src/install-from-boilerplate/boilerplate-templates/boilerplate-template-02/spec/spec-part-2.md +65 -0
- package/src/install-from-boilerplate/boilerplate-templates/boilerplate-template-02/spec/spec-part-3.md +17 -0
- package/src/install-from-boilerplate/boilerplate-templates/boilerplate-template-02/spec/terms-and-definitions-intro.md +5 -0
- package/src/install-from-boilerplate/boilerplate-templates/boilerplate-template-02/spec/terms-definitions/composability.md +5 -0
- package/src/install-from-boilerplate/boilerplate-templates/boilerplate-template-02/spec/terms-definitions/compost.md +3 -0
- package/src/install-from-boilerplate/boilerplate-templates/boilerplate-template-02/spec/terms-definitions/dormancy.md +5 -0
- package/src/install-from-boilerplate/boilerplate-templates/boilerplate-template-02/spec/terms-definitions/fertilizer.md +3 -0
- package/src/install-from-boilerplate/boilerplate-templates/boilerplate-template-02/spec/terms-definitions/greenhouse.md +5 -0
- package/src/install-from-boilerplate/boilerplate-templates/boilerplate-template-02/spec/terms-definitions/mulch.md +3 -0
- package/src/install-from-boilerplate/boilerplate-templates/boilerplate-template-02/spec/terms-definitions/pruning.md +3 -0
- package/src/install-from-boilerplate/boilerplate-templates/boilerplate-template-02/spec/terms-definitions/seedling.md +3 -0
- package/src/install-from-boilerplate/boilerplate-templates/boilerplate-template-02/spec/terms-definitions/soil.md +13 -0
- package/src/install-from-boilerplate/boilerplate-templates/boilerplate-template-02/spec/terms-definitions/watering.md +3 -0
- package/src/install-from-boilerplate/boilerplate-templates/boilerplate-template-02/specs.json +40 -0
- package/src/install-from-boilerplate/config-templates.js +39 -0
- package/src/install-from-boilerplate/copy-boilerplate.js +61 -8
- package/src/install-from-boilerplate/copy-system-files.js +6 -0
- package/src/install-from-boilerplate/custom-update.js +14 -2
- package/src/install-from-boilerplate/install.js +11 -1
- package/src/install-from-boilerplate/migrate-versions-to-spec-versions.js +85 -0
- package/src/install-from-boilerplate/select-template.js +51 -0
- package/src/pipeline/configuration/prepare-spec-configuration.js +6 -0
- package/src/pipeline/configuration/sync-spec-versions.js +38 -0
- package/src/pipeline/rendering/render-spec-document.js +8 -0
- package/templates/template.html +8 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spec-up-t",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.13",
|
|
4
4
|
"description": "Technical specification drafting tool that generates rich specification documents from markdown. Forked from https://github.com/decentralized-identity/spec-up by Daniel Buchner (https://github.com/csuwildcat)",
|
|
5
5
|
"main": "./index",
|
|
6
6
|
"repository": {
|
package/src/freeze-spec-data.js
CHANGED
|
@@ -16,7 +16,11 @@ const config = fs.readJsonSync('specs.json');
|
|
|
16
16
|
const outputPath = config.specs[0].output_path;
|
|
17
17
|
|
|
18
18
|
const sourceFile = path.join(outputPath, 'index.html');
|
|
19
|
-
|
|
19
|
+
|
|
20
|
+
// spec-versions/ lives at the repo root and is committed to the main branch.
|
|
21
|
+
// This is the source of truth — it survives gh-pages resets and fresh CI checkouts.
|
|
22
|
+
// docs/versions/ is the derived, deployed copy and is always rebuilt from here.
|
|
23
|
+
const destDir = 'spec-versions';
|
|
20
24
|
|
|
21
25
|
// A snapshot can only be created when the specification has been built at least once.
|
|
22
26
|
// If index.html is missing, the user must run `npm run menu 1` (or `npm run menu 4`) first.
|
|
@@ -117,7 +121,11 @@ async function run() {
|
|
|
117
121
|
|
|
118
122
|
Logger.success(`Created a freezed specification version in ${destFile}`);
|
|
119
123
|
|
|
120
|
-
//
|
|
124
|
+
// Sync spec-versions/ → docs/versions/ so the local preview reflects the
|
|
125
|
+
// new snapshot immediately, then regenerate the versions index page.
|
|
126
|
+
const syncSpecVersions = require('./pipeline/configuration/sync-spec-versions.js');
|
|
127
|
+
syncSpecVersions(outputPath);
|
|
128
|
+
|
|
121
129
|
const createVersionsIndex = require('./pipeline/configuration/create-versions-index.js');
|
|
122
130
|
createVersionsIndex(outputPath);
|
|
123
131
|
}
|
|
@@ -85,8 +85,13 @@ jobs:
|
|
|
85
85
|
npm run todocx
|
|
86
86
|
;;
|
|
87
87
|
freeze)
|
|
88
|
-
#
|
|
89
|
-
#
|
|
88
|
+
# A fresh CI checkout has no docs/ (gitignored), so we must render
|
|
89
|
+
# first to give freeze-spec-data.js the docs/index.html it needs.
|
|
90
|
+
# freeze-spec-data.js then writes the snapshot to spec-versions/,
|
|
91
|
+
# which is tracked in git. The commit+push step below commits
|
|
92
|
+
# spec-versions/ to the main branch, which triggers
|
|
93
|
+
# render-and-deploy.yml to deploy the full spec (including versions).
|
|
94
|
+
npm run collectExternalReferences
|
|
90
95
|
FREEZE_LABEL="${{ github.event.inputs.freeze_label }}" npm run freeze
|
|
91
96
|
;;
|
|
92
97
|
custom-update)
|
|
@@ -126,6 +131,8 @@ jobs:
|
|
|
126
131
|
git commit -m "Collect external references" || echo "No changes to commit"
|
|
127
132
|
;;
|
|
128
133
|
freeze)
|
|
134
|
+
# spec-versions/ is tracked in git — committing it triggers
|
|
135
|
+
# render-and-deploy.yml, which deploys the full spec with versions.
|
|
129
136
|
git commit -m "Freeze specification" || echo "No changes to commit"
|
|
130
137
|
;;
|
|
131
138
|
custom-update)
|
|
@@ -61,9 +61,27 @@ jobs:
|
|
|
61
61
|
|
|
62
62
|
# Collect external references — this also renders the specification and
|
|
63
63
|
# writes output to the path defined in specs.json (output_path, typically ./docs/).
|
|
64
|
+
# The render pipeline (prepare-spec-configuration.js) automatically copies
|
|
65
|
+
# spec-versions/ → docs/versions/ so frozen snapshots are always included.
|
|
64
66
|
- name: Collect external references and render
|
|
65
67
|
run: npm run collectExternalReferences
|
|
66
68
|
|
|
69
|
+
# Preserve the CNAME file from gh-pages before deploying.
|
|
70
|
+
# peaceiris/actions-gh-pages replaces the entire gh-pages branch with the
|
|
71
|
+
# contents of ./docs. A fresh CI checkout of main never contains docs/CNAME
|
|
72
|
+
# (docs/ is gitignored), so without this step any previously committed CNAME
|
|
73
|
+
# would be silently deleted on every render.
|
|
74
|
+
- name: Preserve CNAME from gh-pages
|
|
75
|
+
run: |
|
|
76
|
+
git fetch origin gh-pages 2>/dev/null || true
|
|
77
|
+
CNAME_CONTENT=$(git show origin/gh-pages:CNAME 2>/dev/null || echo "")
|
|
78
|
+
if [ -n "$CNAME_CONTENT" ]; then
|
|
79
|
+
echo "$CNAME_CONTENT" > docs/CNAME
|
|
80
|
+
echo "CNAME preserved: $CNAME_CONTENT"
|
|
81
|
+
else
|
|
82
|
+
echo "No CNAME found on gh-pages — nothing to preserve"
|
|
83
|
+
fi
|
|
84
|
+
|
|
67
85
|
# Push the rendered ./docs output to the gh-pages branch.
|
|
68
86
|
# peaceiris/actions-gh-pages creates the branch on first run when it
|
|
69
87
|
# does not yet exist — no manual branch setup is required.
|
package/src/install-from-boilerplate/boilerplate-templates/boilerplate-template-01/spec/spec-body.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
## Requirements
|
|
2
|
+
|
|
3
|
+
*This section contains the normative requirements of the specification. Replace the examples below with your actual requirements.*
|
|
4
|
+
|
|
5
|
+
### General Requirements
|
|
6
|
+
|
|
7
|
+
The following requirements apply to all conforming implementations:
|
|
8
|
+
|
|
9
|
+
1. Implementations MUST ...
|
|
10
|
+
2. Implementations SHOULD ...
|
|
11
|
+
3. Implementations MAY ...
|
|
12
|
+
|
|
13
|
+
### Protocol Requirements
|
|
14
|
+
|
|
15
|
+
*Add detailed technical or protocol requirements here.*
|
|
16
|
+
|
|
17
|
+
::: note Informative Note
|
|
18
|
+
Requirements marked with MUST are normative. Requirements marked with SHOULD are recommended but not mandatory. Requirements marked with MAY are optional.
|
|
19
|
+
:::
|
|
20
|
+
|
|
21
|
+
::: todo Open Issue
|
|
22
|
+
Placeholder — replace with actual open items or remove this block before publication.
|
|
23
|
+
:::
|
|
24
|
+
|
|
25
|
+
## Architecture Overview
|
|
26
|
+
|
|
27
|
+
*Provide an architectural description of the system or protocol defined by this specification. Diagrams and tables are encouraged.*
|
|
28
|
+
|
|
29
|
+
### The ToIP Stack Context
|
|
30
|
+
|
|
31
|
+
This specification operates within the [ToIP Technology Architecture Specification](https://trustoverip.github.io/TechArch/) layered model. The ToIP stack comprises four layers:
|
|
32
|
+
|
|
33
|
+
| Layer | Name | Description |
|
|
34
|
+
|------:|:-----|:------------|
|
|
35
|
+
| 4 | Application Ecosystem | Trust applications and governance frameworks |
|
|
36
|
+
| 3 | Trust Task | Credential exchange and trust negotiation |
|
|
37
|
+
| 2 | Trust Spanning | Peer-to-peer messaging between agents |
|
|
38
|
+
| 1 | Trust Support | Verifiable data registries and DID infrastructure |
|
|
39
|
+
|
|
40
|
+
*Indicate which layer(s) this specification addresses.*
|
|
41
|
+
|
|
42
|
+
## Security Considerations
|
|
43
|
+
|
|
44
|
+
*Describe relevant security properties, threat models, and mitigations.*
|
|
45
|
+
|
|
46
|
+
::: warning Security Note
|
|
47
|
+
Implementers MUST carefully review the security considerations before deployment.
|
|
48
|
+
:::
|
|
49
|
+
|
|
50
|
+
## Privacy Considerations
|
|
51
|
+
|
|
52
|
+
*Describe how privacy is preserved and any data-minimization requirements.*
|
package/src/install-from-boilerplate/boilerplate-templates/boilerplate-template-01/spec/spec-coda.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
## Appendix
|
|
2
|
+
|
|
3
|
+
### Revision History
|
|
4
|
+
|
|
5
|
+
| Version | Date | Changes |
|
|
6
|
+
|--------:|:-----|:--------|
|
|
7
|
+
| 0.1 | [Date] | Initial draft |
|
|
8
|
+
|
|
9
|
+
### References
|
|
10
|
+
|
|
11
|
+
#### Normative References
|
|
12
|
+
|
|
13
|
+
- ToIP Technical Architecture Specification — [https://trustoverip.github.io/TechArch/](https://trustoverip.github.io/TechArch/)
|
|
14
|
+
- W3C Verifiable Credentials Data Model — [https://www.w3.org/TR/vc-data-model/](https://www.w3.org/TR/vc-data-model/)
|
|
15
|
+
- W3C Decentralized Identifiers (DIDs) — [https://www.w3.org/TR/did-core/](https://www.w3.org/TR/did-core/)
|
|
16
|
+
|
|
17
|
+
#### Informative References
|
|
18
|
+
|
|
19
|
+
- Trust over IP Foundation — [https://trustoverip.org/](https://trustoverip.org/)
|
|
20
|
+
- ToIP Technical Architecture — [https://trustoverip.org/our-work/technical-architecture/](https://trustoverip.org/our-work/technical-architecture/)
|
|
21
|
+
- Spec-Up-T Documentation — [https://trustoverip.github.io/spec-up-t-website/](https://trustoverip.github.io/spec-up-t-website/)
|
|
22
|
+
|
|
23
|
+
### Acknowledgements
|
|
24
|
+
|
|
25
|
+
This specification was developed with contributions from members of the [Trust over IP Foundation](https://trustoverip.org/) and reviewed by the ToIP Steering Committee.
|
package/src/install-from-boilerplate/boilerplate-templates/boilerplate-template-01/spec/spec-head.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# [Your Specification Title]
|
|
2
|
+
|
|
3
|
+
::: warning Warning Notice
|
|
4
|
+
This content is created with Artificial Intelligence, based on information about ToIP available online.
|
|
5
|
+
:::
|
|
6
|
+
|
|
7
|
+
## Introduction
|
|
8
|
+
|
|
9
|
+
*This is a template for [Trust over IP (ToIP)](https://trustoverip.org/) specifications. Replace all placeholder text with your own content. See the [Spec-Up-T documentation](https://trustoverip.github.io/spec-up-t-website/) for authoring guidance.*
|
|
10
|
+
|
|
11
|
+
This specification is developed under the auspices of the [Trust over IP Foundation](https://trustoverip.org/) and follows the structure recommended by the ToIP Steering Committee.
|
|
12
|
+
|
|
13
|
+
## Abstract
|
|
14
|
+
|
|
15
|
+
*Provide a brief abstract summarizing the purpose, scope, and intended audience of this specification. One to three paragraphs is typical.*
|
|
16
|
+
|
|
17
|
+
## Scope
|
|
18
|
+
|
|
19
|
+
This document defines the normative requirements for ...
|
|
20
|
+
|
|
21
|
+
The following topics are **within scope**:
|
|
22
|
+
|
|
23
|
+
- ...
|
|
24
|
+
|
|
25
|
+
The following topics are **out of scope**:
|
|
26
|
+
|
|
27
|
+
- ...
|
|
28
|
+
|
|
29
|
+
## Conformance
|
|
30
|
+
|
|
31
|
+
As well as sections marked as non-normative, all authoring guidelines, diagrams, examples, and notes in this specification are non-normative. Everything else in this specification is normative.
|
|
32
|
+
|
|
33
|
+
The key words *MAY*, *MUST*, *MUST NOT*, *OPTIONAL*, *RECOMMENDED*, *REQUIRED*, *SHOULD*, and *SHOULD NOT* in this document are to be interpreted as described in [BCP 14](https://www.rfc-editor.org/info/bcp14) when, and only when, they appear in all capitals, as shown here.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
[//]: # (This file, named "terms-and-definitions-intro.md" is mandatory and should not be deleted. However, you can safely delete this comment and replace it with text of your choice.)
|
|
2
|
+
|
|
3
|
+
## Terms and definitions
|
|
4
|
+
|
|
5
|
+
This section defines key terms used throughout this specification. Terms marked with cross-references (xref) or term-references (tref) link to definitions in other ToIP specifications.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
[[tref: toipglos, access-control]]
|
|
2
|
+
|
|
3
|
+
~ *Note: This is a **tref** example — the definition of "access-control" is imported from the ToIP Glossary rather than defined locally. Use `tref` when you want to reuse the exact definition from another specification. Replace `toipglos` with the external spec key configured in your `specs.json`.*
|
|
4
|
+
|
|
5
|
+
~ See also: [[ref: trust registry]], [[xref: toipglos, controller]].
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
[[def: decentralized identifier, decentralized identifiers, DID, DIDs]]
|
|
2
|
+
|
|
3
|
+
~ A **decentralized identifier** (DID) is a globally unique, persistent identifier that does not require a centralized registration authority. A DID resolves to a DID document containing cryptographic material that allows the [[ref: controller]] to authenticate and prove control.
|
|
4
|
+
|
|
5
|
+
~ *Note: This is an example term included for demonstration purposes. Replace this definition with precise, normative language appropriate to your specification.*
|
|
6
|
+
|
|
7
|
+
~ See also: [[ref: verifiable credential]], [[xref: toipglos, controller]].
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
[[def: trust registry, trust registries]]
|
|
2
|
+
|
|
3
|
+
~ A **trust registry** is an authoritative source that an ecosystem uses to determine whether a party (such as an [[ref: issuer]] or [[ref: verifier]]) is trusted within the constraints of a given [[ref: governance framework]]. It enables automated trust decisions without relying on out-of-band verification.
|
|
4
|
+
|
|
5
|
+
~ *Note: This is an example term included for demonstration purposes. Replace this definition with precise, normative language appropriate to your specification.*
|
|
6
|
+
|
|
7
|
+
~ See also: [[ref: governance framework]], [[xref: toipglos, issuer]].
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
[[def: verifiable credential, verifiable credentials, VC, VCs]]
|
|
2
|
+
|
|
3
|
+
~ A **verifiable credential** (VC) is a tamper-evident digital credential whose authorship can be cryptographically verified. It contains claims made by an [[ref: issuer]] about a [[ref: holder]], and is presented to a [[ref: verifier]] as proof.
|
|
4
|
+
|
|
5
|
+
~ *Note: This is an example term included for demonstration purposes. Replace this definition with precise, normative language appropriate to your specification.*
|
|
6
|
+
|
|
7
|
+
~ See also: [[xref: toipglos, issuer]], [[xref: toipglos, holder]] for how these roles are defined in the ToIP Glossary.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"specs": [
|
|
3
|
+
{
|
|
4
|
+
"title": "[Your Specification Title]",
|
|
5
|
+
"description": "A Trust over IP Foundation specification. Replace this description with a summary of your specification.",
|
|
6
|
+
"author": "Trust over IP Foundation",
|
|
7
|
+
"spec_directory": "./spec",
|
|
8
|
+
"spec_terms_directory": "terms-definitions",
|
|
9
|
+
"output_path": "./docs",
|
|
10
|
+
"markdown_paths": [
|
|
11
|
+
"spec-head.md",
|
|
12
|
+
"terms-and-definitions-intro.md",
|
|
13
|
+
"spec-body.md",
|
|
14
|
+
"spec-coda.md"
|
|
15
|
+
],
|
|
16
|
+
"logo": "https://raw.githubusercontent.com/trustoverip/spec-up-t/refs/heads/master/src/install-from-boilerplate/boilerplate/static/logo.svg",
|
|
17
|
+
"logo_link": "https://github.com/trustoverip/spec-up-t",
|
|
18
|
+
"favicon": "https://raw.githubusercontent.com/trustoverip/spec-up-t/refs/heads/master/src/install-from-boilerplate/boilerplate/static/favicon.ico",
|
|
19
|
+
"source": {
|
|
20
|
+
"host": "github",
|
|
21
|
+
"account": "trustoverip",
|
|
22
|
+
"repo": "your-spec-repo"
|
|
23
|
+
},
|
|
24
|
+
"external_specs": [
|
|
25
|
+
{
|
|
26
|
+
"external_spec": "toipglos",
|
|
27
|
+
"gh_page": "https://glossary.trustoverip.org/",
|
|
28
|
+
"url": "https://github.com/trustoverip/ctwg-main-glossary"
|
|
29
|
+
}
|
|
30
|
+
],
|
|
31
|
+
"katex": false,
|
|
32
|
+
"anchor_symbol": "§"
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Spec-Up-T Specification
|
|
2
|
+
|
|
3
|
+
## Part 1: Introduction and Background
|
|
4
|
+
|
|
5
|
+
### About This Specification
|
|
6
|
+
|
|
7
|
+
This is a default Spec-Up-T installation using the "Multi-Part" content template. Find information on the [Spec-Up-T documentation website](https://trustoverip.github.io/spec-up-t-website/).
|
|
8
|
+
|
|
9
|
+
This is a demo site for Spec-Up-T. The subject matter – gardening and related terms – is used purely as an example to demonstrate how the system works. You can replace these demo terms and definitions with your own content to suit your documentation needs.
|
|
10
|
+
|
|
11
|
+
### Background
|
|
12
|
+
|
|
13
|
+
Provide background information and context for your specification here. Explain the problem space, motivation, and any relevant history that helps readers understand the purpose of this document.
|
|
14
|
+
|
|
15
|
+
### Scope and Purpose
|
|
16
|
+
|
|
17
|
+
Define the boundaries of what this specification covers and what it does not. Clearly stating the scope helps readers understand the applicability of the specification.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
## Part 2: Technical Details
|
|
2
|
+
|
|
3
|
+
This section contains the core technical content of the specification. Add your detailed requirements, algorithms, data formats, and protocols here.
|
|
4
|
+
|
|
5
|
+
### Blockquote
|
|
6
|
+
|
|
7
|
+
> To be, or not to be, that is the question:
|
|
8
|
+
Whether 'tis nobler in the mind to suffer
|
|
9
|
+
The slings and arrows of outrageous fortune,
|
|
10
|
+
Or to take arms against a sea of troubles
|
|
11
|
+
And by opposing end them. To die—to sleep,
|
|
12
|
+
No more;
|
|
13
|
+
|
|
14
|
+
### Notices
|
|
15
|
+
|
|
16
|
+
::: note Basic Note
|
|
17
|
+
Check this out.
|
|
18
|
+
:::
|
|
19
|
+
|
|
20
|
+
::: warning Warning Notice
|
|
21
|
+
Houston, I think we have a problem
|
|
22
|
+
:::
|
|
23
|
+
|
|
24
|
+
::: todo Really Important
|
|
25
|
+
Get this done!
|
|
26
|
+
:::
|
|
27
|
+
|
|
28
|
+
::: example Code Example
|
|
29
|
+
|
|
30
|
+
```json
|
|
31
|
+
// Some comment in JSON
|
|
32
|
+
{
|
|
33
|
+
"foo": "bar",
|
|
34
|
+
"baz": 2
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
:::
|
|
39
|
+
|
|
40
|
+
### Content from External Files
|
|
41
|
+
|
|
42
|
+
Use the following format to pull in content from other files in your project:
|
|
43
|
+
|
|
44
|
+
This text has been inserted here from another file: [[insert: assets/test.text]]
|
|
45
|
+
|
|
46
|
+
::: example Code Example
|
|
47
|
+
|
|
48
|
+
```json
|
|
49
|
+
[[insert: assets/test.json]]
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
:::
|
|
53
|
+
|
|
54
|
+
### Tables
|
|
55
|
+
|
|
56
|
+
| Stage | Direct Products | ATP Yields |
|
|
57
|
+
| -----------------: | --------------: | ---------: |
|
|
58
|
+
| Glycolysis | 2 ATP | |
|
|
59
|
+
| ^^ | 2 NADH | 3--5 ATP |
|
|
60
|
+
| Pyruvaye oxidation | 2 NADH | 5 ATP |
|
|
61
|
+
| Citric acid cycle | 2 ATP | |
|
|
62
|
+
| ^^ | 6 NADH | 15 ATP |
|
|
63
|
+
| ^^ | 2 FADH2 | 3 ATP |
|
|
64
|
+
| **30--32** ATP | | |
|
|
65
|
+
[Net ATP yields per hexose]
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
## Part 3: Summary and Implementation Notes
|
|
2
|
+
|
|
3
|
+
### Summary
|
|
4
|
+
|
|
5
|
+
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?
|
|
6
|
+
|
|
7
|
+
### Implementation Notes
|
|
8
|
+
|
|
9
|
+
Include implementation guidance, best practices, and notes for implementers here. This section helps bridge the gap between the specification and practical implementation.
|
|
10
|
+
|
|
11
|
+
### Future Work
|
|
12
|
+
|
|
13
|
+
Describe planned extensions, improvements, or areas for further development here.
|
|
14
|
+
|
|
15
|
+
### References
|
|
16
|
+
|
|
17
|
+
This section can contain references to other documents, standards, and resources used in this specification.
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
[[def: compost, composting, Compost]]
|
|
2
|
+
|
|
3
|
+
~ Compost is a mixture of decayed organic matter used to fertilize soil. It is created through the process of composting, where materials like leaves, food scraps, and grass clippings break down over time. Compost improves soil structure and provides nutrients for plants. See also [[ref: Mulch]], [[ref: Soil]], [[ref: Fertilizer]], [[ref: Seedling]], [[ref: Watering]].
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
[[def: fertilizer, fertilizing, Fertilizer]]
|
|
2
|
+
|
|
3
|
+
~ Fertilizer is a substance added to soil or plants to supply essential nutrients and promote growth. Fertilizers can be organic, like compost, or synthetic. Proper fertilizing ensures healthy plant development. See also [[ref: Compost]], [[ref: Mulch]], [[ref: Soil]], [[ref: Watering]], [[ref: Seedling]].
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
[[def: mulch, mulching, Mulch]]
|
|
2
|
+
|
|
3
|
+
~ Mulch is a layer of material, such as wood chips or straw, spread on the surface of soil to retain moisture, suppress weeds, and regulate temperature. Mulching helps improve plant health and soil quality. Related terms: [[ref: Compost]], [[ref: Soil]], [[ref: Fertilizer]].
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
[[def: soil, soils, Soil]]
|
|
2
|
+
|
|
3
|
+
~ Soil is the upper layer of earth in which plants grow. It consists of a mixture of organic matter, minerals, gases, liquids, and organisms that together support life. Healthy soil is essential for gardening and agriculture.
|
|
4
|
+
|
|
5
|
+
~ Refs examples: [[ref: Compost]], [[ref: Mulch]], [[ref: Fertilizer]].
|
|
6
|
+
|
|
7
|
+
~ Xref examples from external gardening glossaries:
|
|
8
|
+
~ - From ExtRef1 (greenhouse focus): [[xref: ExtRef1, greenhouse]], [[xref: ExtRef1, irrigation]]
|
|
9
|
+
~ - From ExtRef2 (lifecycle focus): [[xref: ExtRef2, dormancy]], [[xref: ExtRef2, propagation]]
|
|
10
|
+
|
|
11
|
+
~ Note: The term "soil" exists in ExtRef1 and ExtRef2 with different definitions focused on their respective themes.
|
|
12
|
+
|
|
13
|
+
~ Soil quality affects water retention, nutrient availability, and plant health. Amending soil with compost or mulch can improve its structure and fertility. Fertilizer may be added to supplement nutrients as needed.
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
[[def: watering, Watering]]
|
|
2
|
+
|
|
3
|
+
~ Watering is the act of supplying water to plants to help them grow. Proper watering is essential for healthy roots and overall plant development. Overwatering or underwatering can harm plants. See also [[ref: Soil]], [[ref: Seedling]], [[ref: Mulch]].
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"specs": [
|
|
3
|
+
{
|
|
4
|
+
"title": "Spec-Up-T Starterpack",
|
|
5
|
+
"description": "Create technical specifications in markdown. Based on the original Spec-Up, extended with Terminology tooling",
|
|
6
|
+
"author": "Trust over IP Foundation",
|
|
7
|
+
"spec_directory": "./spec",
|
|
8
|
+
"spec_terms_directory": "terms-definitions",
|
|
9
|
+
"output_path": "./docs",
|
|
10
|
+
"markdown_paths": [
|
|
11
|
+
"spec-part-1.md",
|
|
12
|
+
"terms-and-definitions-intro.md",
|
|
13
|
+
"spec-part-2.md",
|
|
14
|
+
"spec-part-3.md"
|
|
15
|
+
],
|
|
16
|
+
"logo": "https://raw.githubusercontent.com/trustoverip/spec-up-t/refs/heads/master/src/install-from-boilerplate/boilerplate/static/logo.svg",
|
|
17
|
+
"logo_link": "https://github.com/trustoverip/spec-up-t",
|
|
18
|
+
"favicon": "https://raw.githubusercontent.com/trustoverip/spec-up-t/refs/heads/master/src/install-from-boilerplate/boilerplate/static/favicon.ico",
|
|
19
|
+
"source": {
|
|
20
|
+
"host": "github",
|
|
21
|
+
"account": "trustoverip",
|
|
22
|
+
"repo": "spec-up-t-starter-pack"
|
|
23
|
+
},
|
|
24
|
+
"external_specs": [
|
|
25
|
+
{
|
|
26
|
+
"external_spec": "ExtRef1",
|
|
27
|
+
"gh_page": "https://trustoverip.github.io/spec-up-t-demo-external-ref-1/",
|
|
28
|
+
"url": "https://github.com/trustoverip/spec-up-t-demo-external-ref-1"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"external_spec": "ExtRef2",
|
|
32
|
+
"gh_page": "https://trustoverip.github.io/spec-up-t-demo-external-ref-2/",
|
|
33
|
+
"url": "https://github.com/trustoverip/spec-up-t-demo-external-ref-2"
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
"katex": false,
|
|
37
|
+
"anchor_symbol": "§"
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration for available content templates.
|
|
3
|
+
*
|
|
4
|
+
* Each template provides a different structure for specification markdown files.
|
|
5
|
+
* The assets/ and static/ directories remain the same across all templates
|
|
6
|
+
* and are always sourced from the original boilerplate.
|
|
7
|
+
*
|
|
8
|
+
* - id: unique identifier used in env var SPEC_UP_T_TEMPLATE and GitHubUi
|
|
9
|
+
* - name: human-readable name shown during selection
|
|
10
|
+
* - description: brief explanation of the template structure
|
|
11
|
+
* - directory: folder name inside boilerplate-templates/, or null for default
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* IMPORTANT: When adding new templates, also update the template selection logic in the GitHubUi file `CreateSpecUpProject.vue`.
|
|
17
|
+
*/
|
|
18
|
+
const templates = [
|
|
19
|
+
{
|
|
20
|
+
id: 'default',
|
|
21
|
+
name: 'Default (Starter Pack)',
|
|
22
|
+
description: 'Standard boilerplate with head, body, and example markup files',
|
|
23
|
+
directory: null
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
id: 'boilerplate-template-01',
|
|
27
|
+
name: 'Trust over IP Specification (Intro, Body, Coda)',
|
|
28
|
+
description: 'Structured with introduction, body, and concluding sections',
|
|
29
|
+
directory: 'boilerplate-template-01'
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: 'boilerplate-template-02',
|
|
33
|
+
name: 'Multi-Part Specification (Part 1, 2, 3)',
|
|
34
|
+
description: 'Organized in sequential parts for longer specifications',
|
|
35
|
+
directory: 'boilerplate-template-02'
|
|
36
|
+
}
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
module.exports = { templates };
|
|
@@ -1,23 +1,76 @@
|
|
|
1
1
|
const fs = require('fs-extra');
|
|
2
|
-
const path = require('path');
|
|
2
|
+
const path = require('node:path');
|
|
3
3
|
const Logger = require('../utils/logger');
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Copies the boilerplate files to the consuming project root.
|
|
7
|
+
* If a template is specified (non-default), the template's spec/ directory
|
|
8
|
+
* and specs.json overwrite those from the default boilerplate.
|
|
9
|
+
* The assets/ and static/ directories always come from the original boilerplate.
|
|
10
|
+
*
|
|
11
|
+
* @param {Object|null} template - Template object from config-templates.js, or null/undefined for default.
|
|
12
|
+
*/
|
|
13
|
+
function copyBoilerplate(template) {
|
|
6
14
|
const sourceDir = path.join(__dirname, './', 'boilerplate');
|
|
15
|
+
// // Use process.cwd() so the destination is always the consuming project root,
|
|
16
|
+
// // regardless of whether spec-up-t is installed from npm or via `npm link`.
|
|
17
|
+
// // I am not sure if this works in all cases. Needs testing.
|
|
18
|
+
// const projectRoot = process.cwd();
|
|
19
|
+
|
|
20
|
+
const projectRoot = path.join(__dirname, '../../../../');
|
|
21
|
+
|
|
22
|
+
// Step 1: Copy everything from the default boilerplate
|
|
7
23
|
const items = fs.readdirSync(sourceDir);
|
|
8
|
-
|
|
24
|
+
for (const item of items) {
|
|
9
25
|
const srcPath = path.join(sourceDir, item);
|
|
10
|
-
|
|
11
|
-
const destPath = path.join(__dirname, '../../../../', item);
|
|
26
|
+
const destPath = path.join(projectRoot, item);
|
|
12
27
|
fs.cpSync(srcPath, destPath, { recursive: true });
|
|
13
|
-
}
|
|
28
|
+
}
|
|
14
29
|
|
|
15
30
|
// Rename the copied gitignore file to .gitignore
|
|
16
|
-
const gitignorePath = path.join(
|
|
17
|
-
const gitignoreDestPath = path.join(
|
|
31
|
+
const gitignorePath = path.join(projectRoot, 'gitignore');
|
|
32
|
+
const gitignoreDestPath = path.join(projectRoot, '.gitignore');
|
|
18
33
|
fs.renameSync(gitignorePath, gitignoreDestPath);
|
|
19
34
|
|
|
20
35
|
Logger.success('Copied spec-up-t-boilerplate to current directory');
|
|
36
|
+
|
|
37
|
+
// Step 2: If a non-default template was selected, overlay template-specific files
|
|
38
|
+
if (template?.directory) {
|
|
39
|
+
applyTemplate(template, projectRoot);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Overlays template-specific spec/ and specs.json onto the project root,
|
|
45
|
+
* replacing the default boilerplate versions.
|
|
46
|
+
*
|
|
47
|
+
* @param {Object} template - Template object with a directory property.
|
|
48
|
+
* @param {string} projectRoot - Absolute path to the consuming project root.
|
|
49
|
+
*/
|
|
50
|
+
function applyTemplate(template, projectRoot) {
|
|
51
|
+
const templateDir = path.join(__dirname, 'boilerplate-templates', template.directory);
|
|
52
|
+
|
|
53
|
+
if (!fs.existsSync(templateDir)) {
|
|
54
|
+
Logger.error(`Template directory not found: ${template.directory}`);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Replace spec/ directory with the template's version
|
|
59
|
+
const destSpecDir = path.join(projectRoot, 'spec');
|
|
60
|
+
const templateSpecDir = path.join(templateDir, 'spec');
|
|
61
|
+
|
|
62
|
+
if (fs.existsSync(templateSpecDir)) {
|
|
63
|
+
fs.rmSync(destSpecDir, { recursive: true, force: true });
|
|
64
|
+
fs.cpSync(templateSpecDir, destSpecDir, { recursive: true });
|
|
65
|
+
Logger.success(`Applied template spec/ from: ${template.name}`);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Replace specs.json with the template's version
|
|
69
|
+
const templateSpecsJson = path.join(templateDir, 'specs.json');
|
|
70
|
+
if (fs.existsSync(templateSpecsJson)) {
|
|
71
|
+
fs.cpSync(templateSpecsJson, path.join(projectRoot, 'specs.json'));
|
|
72
|
+
Logger.success(`Applied template specs.json from: ${template.name}`);
|
|
73
|
+
}
|
|
21
74
|
}
|
|
22
75
|
|
|
23
76
|
module.exports = copyBoilerplate;
|
|
@@ -14,9 +14,15 @@ function copySystemFiles() {
|
|
|
14
14
|
systemFiles.forEach(item => {
|
|
15
15
|
const srcPath = path.join(sourceDir, item);
|
|
16
16
|
|
|
17
|
+
// // Use process.cwd() so the destination is always the consuming project root,
|
|
18
|
+
// // regardless of whether spec-up-t is installed from npm or via `npm link`.
|
|
19
|
+
// // I am not sure if this works in all cases. Needs testing.
|
|
20
|
+
// const destPath = path.join(process.cwd(), item);
|
|
21
|
+
|
|
17
22
|
// Root of the project
|
|
18
23
|
const destPath = path.join(__dirname, '../../../../', item);
|
|
19
24
|
|
|
25
|
+
|
|
20
26
|
try {
|
|
21
27
|
fs.cpSync(srcPath, destPath, { recursive: true });
|
|
22
28
|
Logger.success(`Copied ${item} to ${destPath}`);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const fs = require('fs-extra');
|
|
1
2
|
const { configScriptsKeys } = require('./config-scripts-keys');
|
|
2
3
|
const { configOverwriteScriptsKeys } = require('./config-scripts-keys');
|
|
3
4
|
const addScriptsKeys = require('./add-scripts-keys');
|
|
@@ -5,6 +6,7 @@ const copySystemFiles = require('./copy-system-files');
|
|
|
5
6
|
const { gitIgnoreEntries } = require('./config-gitignore-entries');
|
|
6
7
|
const { updateGitignore } = require('./add-gitignore-entries');
|
|
7
8
|
const updateDependencies = require('./update-dependencies');
|
|
9
|
+
const migrateVersionsToSpecVersions = require('./migrate-versions-to-spec-versions');
|
|
8
10
|
const Logger = require('../utils/logger');
|
|
9
11
|
|
|
10
12
|
|
|
@@ -17,8 +19,18 @@ const customUpdate = () => {
|
|
|
17
19
|
// Update dependencies based on package.spec-up-t.json
|
|
18
20
|
updateDependencies();
|
|
19
21
|
|
|
20
|
-
//
|
|
21
|
-
//
|
|
22
|
+
// One-time migration: repos that stored snapshots in docs/versions/ (the old
|
|
23
|
+
// "commit docs/" regime) need their snapshots moved to spec-versions/ so they
|
|
24
|
+
// survive after docs/ is removed from git tracking. Safe to run on every
|
|
25
|
+
// custom-update — already-migrated versions are not overwritten.
|
|
26
|
+
try {
|
|
27
|
+
const config = fs.readJsonSync('specs.json');
|
|
28
|
+
const outputPath = config.specs[0].output_path;
|
|
29
|
+
migrateVersionsToSpecVersions(outputPath);
|
|
30
|
+
} catch (error) {
|
|
31
|
+
// specs.json missing or malformed — skip migration silently.
|
|
32
|
+
Logger.info('Skipping versions migration: could not read specs.json');
|
|
33
|
+
}
|
|
22
34
|
}
|
|
23
35
|
|
|
24
36
|
// Call custom update
|
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
const copyBoilerplate = require('./copy-boilerplate');
|
|
2
2
|
const { configScriptsKeys } = require('./config-scripts-keys');
|
|
3
3
|
const addScriptsKeys = require('./add-scripts-keys');
|
|
4
|
+
const { templates } = require('./config-templates');
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
// Resolve template from SPEC_UP_T_TEMPLATE environment variable.
|
|
7
|
+
// If not set or set to 'default', uses the original boilerplate (backward compatible).
|
|
8
|
+
const envTemplateId = process.env.SPEC_UP_T_TEMPLATE;
|
|
9
|
+
let selectedTemplate = null;
|
|
10
|
+
|
|
11
|
+
if (envTemplateId && envTemplateId !== 'default') {
|
|
12
|
+
selectedTemplate = templates.find(t => t.id === envTemplateId) || null;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
copyBoilerplate(selectedTemplate);
|
|
6
16
|
addScriptsKeys(configScriptsKeys);
|
|
7
17
|
|
|
8
18
|
require('./postinstall-message');
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file migrate-versions-to-spec-versions.js
|
|
3
|
+
* @description One-time migration helper for repositories that were created under the
|
|
4
|
+
* old "commit docs/" regime. Those repos store frozen snapshots inside docs/versions/.
|
|
5
|
+
*
|
|
6
|
+
* Starting with the issue270 changes, snapshots are stored in spec-versions/ (tracked,
|
|
7
|
+
* at the repo root) instead of docs/versions/ (gitignored, ephemeral). This migration
|
|
8
|
+
* copies any snapshots found in docs/versions/ into spec-versions/ so they are not
|
|
9
|
+
* lost when the user eventually removes docs/ from git tracking.
|
|
10
|
+
*
|
|
11
|
+
* - Safe to run more than once: already-migrated versions are not overwritten.
|
|
12
|
+
* - Does nothing when docs/versions/ does not exist (new repos or repos that never froze).
|
|
13
|
+
* - Does not delete docs/versions/ — git history is preserved; the user decides when
|
|
14
|
+
* to run `git rm -r --cached docs/`.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
const fs = require('fs-extra');
|
|
18
|
+
const path = require('path');
|
|
19
|
+
const Logger = require('../utils/logger');
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Migrates frozen snapshots from docs/versions/ to spec-versions/.
|
|
23
|
+
* @param {string} outputPath - The output directory defined in specs.json (e.g. './docs').
|
|
24
|
+
*/
|
|
25
|
+
function migrateVersionsToSpecVersions(outputPath) {
|
|
26
|
+
const src = path.join(outputPath, 'versions');
|
|
27
|
+
const dest = 'spec-versions';
|
|
28
|
+
|
|
29
|
+
if (!fs.existsSync(src)) {
|
|
30
|
+
// No old snapshots to migrate — nothing to do.
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Check whether there are any version subdirectories (v1, v2, …) to migrate.
|
|
35
|
+
// We skip labels.json and index.html — those are regenerated automatically.
|
|
36
|
+
const versionDirs = fs.readdirSync(src).filter(entry =>
|
|
37
|
+
fs.statSync(path.join(src, entry)).isDirectory()
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
if (versionDirs.length === 0) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
fs.ensureDirSync(dest);
|
|
45
|
+
|
|
46
|
+
let migratedCount = 0;
|
|
47
|
+
|
|
48
|
+
// Copy each version directory that does not already exist in spec-versions/.
|
|
49
|
+
versionDirs.forEach(dir => {
|
|
50
|
+
const srcDir = path.join(src, dir);
|
|
51
|
+
const destDir = path.join(dest, dir);
|
|
52
|
+
|
|
53
|
+
if (!fs.existsSync(destDir)) {
|
|
54
|
+
fs.copySync(srcDir, destDir);
|
|
55
|
+
migratedCount++;
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
// Always keep labels.json up to date in spec-versions/.
|
|
60
|
+
const srcLabels = path.join(src, 'labels.json');
|
|
61
|
+
const destLabels = path.join(dest, 'labels.json');
|
|
62
|
+
|
|
63
|
+
if (fs.existsSync(srcLabels)) {
|
|
64
|
+
if (!fs.existsSync(destLabels)) {
|
|
65
|
+
// No labels.json in spec-versions/ yet — copy the whole file.
|
|
66
|
+
fs.copySync(srcLabels, destLabels);
|
|
67
|
+
} else {
|
|
68
|
+
// Merge: preserve any entries already in spec-versions/labels.json
|
|
69
|
+
// and add any entries from docs/versions/labels.json that are missing.
|
|
70
|
+
const existing = fs.readJsonSync(destLabels);
|
|
71
|
+
const legacy = fs.readJsonSync(srcLabels);
|
|
72
|
+
const merged = { ...legacy, ...existing }; // spec-versions wins on conflict
|
|
73
|
+
fs.writeJsonSync(destLabels, merged, { spaces: 2 });
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (migratedCount > 0) {
|
|
78
|
+
Logger.success(
|
|
79
|
+
`Migrated ${migratedCount} snapshot(s) from ${src} to ${dest}/. ` +
|
|
80
|
+
`You can now safely run: git rm -r --cached ${outputPath}`
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
module.exports = migrateVersionsToSpecVersions;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
const readline = require('node:readline');
|
|
2
|
+
const { templates } = require('./config-templates');
|
|
3
|
+
const Logger = require('../utils/logger');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Prompts the user to select a content template interactively.
|
|
7
|
+
* If the SPEC_UP_T_TEMPLATE environment variable is set, uses that value
|
|
8
|
+
* without prompting (for non-interactive use, e.g., GitHubUi or CI).
|
|
9
|
+
*
|
|
10
|
+
* @returns {Promise<Object>} The selected template object from config-templates.js
|
|
11
|
+
*/
|
|
12
|
+
function selectTemplate() {
|
|
13
|
+
// Check environment variable first (non-interactive use)
|
|
14
|
+
const envTemplate = process.env.SPEC_UP_T_TEMPLATE;
|
|
15
|
+
if (envTemplate) {
|
|
16
|
+
const found = templates.find(t => t.id === envTemplate);
|
|
17
|
+
if (found) {
|
|
18
|
+
Logger.info(`Using content template from environment: ${found.name}`);
|
|
19
|
+
return Promise.resolve(found);
|
|
20
|
+
}
|
|
21
|
+
Logger.warn(`Unknown template "${envTemplate}", falling back to default`);
|
|
22
|
+
return Promise.resolve(templates[0]);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return new Promise((resolve) => {
|
|
26
|
+
const rl = readline.createInterface({
|
|
27
|
+
input: process.stdin,
|
|
28
|
+
output: process.stdout
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
console.log('\n📄 Available content templates:\n');
|
|
32
|
+
for (const [i, t] of templates.entries()) {
|
|
33
|
+
console.log(` [${i}] ${t.name}`);
|
|
34
|
+
console.log(` ${t.description}\n`);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
rl.question('Select a content template (number) [0]: ', (answer) => {
|
|
38
|
+
rl.close();
|
|
39
|
+
const index = Number.parseInt(answer, 10);
|
|
40
|
+
if (!Number.isNaN(index) && index >= 0 && index < templates.length) {
|
|
41
|
+
Logger.info(`Selected template: ${templates[index].name}`);
|
|
42
|
+
resolve(templates[index]);
|
|
43
|
+
} else {
|
|
44
|
+
Logger.info('Using default template');
|
|
45
|
+
resolve(templates[0]);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
module.exports = { selectTemplate, templates };
|
|
@@ -34,6 +34,12 @@ async function initializeConfig(options = {}) {
|
|
|
34
34
|
const createExternalSpecsList = require('./create-external-specs-list.js');
|
|
35
35
|
const externalSpecsList = createExternalSpecsList(config);
|
|
36
36
|
|
|
37
|
+
// Copy any frozen snapshots from the tracked spec-versions/ directory into
|
|
38
|
+
// the output path before regenerating the versions index. This is what makes
|
|
39
|
+
// locally-created or CI-created freezes survive a fresh checkout and redeploy.
|
|
40
|
+
const syncSpecVersions = require('./sync-spec-versions.js');
|
|
41
|
+
syncSpecVersions(config.specs[0].output_path);
|
|
42
|
+
|
|
37
43
|
const createVersionsIndex = require('./create-versions-index.js');
|
|
38
44
|
createVersionsIndex(config.specs[0].output_path);
|
|
39
45
|
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file sync-spec-versions.js
|
|
3
|
+
* @description Copies the tracked spec-versions/ directory (at the consuming repo's
|
|
4
|
+
* root) into the output path's versions/ folder before the spec is rendered and
|
|
5
|
+
* deployed. This ensures that snapshots committed to the main branch are always
|
|
6
|
+
* included in the deployed specification, even after a completely fresh CI checkout
|
|
7
|
+
* where docs/ does not yet exist.
|
|
8
|
+
*
|
|
9
|
+
* spec-versions/ is the source of truth for frozen snapshots.
|
|
10
|
+
* docs/versions/ is the derived, deployable copy (gitignored, rebuilt every render).
|
|
11
|
+
*
|
|
12
|
+
* Does nothing when spec-versions/ does not exist — so repositories that have
|
|
13
|
+
* never run `npm run freeze` are not affected.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
const fs = require('fs-extra');
|
|
17
|
+
const path = require('path');
|
|
18
|
+
const Logger = require('../../utils/logger.js');
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Copies all contents of spec-versions/ into outputPath/versions/.
|
|
22
|
+
* The destination is created if it does not already exist.
|
|
23
|
+
* @param {string} outputPath - The output directory defined in specs.json (e.g. './docs').
|
|
24
|
+
*/
|
|
25
|
+
function syncSpecVersions(outputPath) {
|
|
26
|
+
const src = 'spec-versions';
|
|
27
|
+
const dest = path.join(outputPath, 'versions');
|
|
28
|
+
|
|
29
|
+
if (!fs.existsSync(src)) {
|
|
30
|
+
// No snapshots have been created yet — nothing to sync.
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
fs.copySync(src, dest);
|
|
35
|
+
Logger.info(`Synced spec-versions/ → ${dest}`);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
module.exports = syncSpecVersions;
|
|
@@ -40,6 +40,12 @@ async function render(spec, assets, sharedVars, config, template, assetsGlobal,
|
|
|
40
40
|
// Get the branch name from which the index.html was generated
|
|
41
41
|
const buildBranch = getCurrentBranch();
|
|
42
42
|
|
|
43
|
+
// Read spec-up-t version from its own package.json for build info display
|
|
44
|
+
const specUpTVersion = require('../../../package.json').version;
|
|
45
|
+
|
|
46
|
+
// Capture Node.js runtime version for build info display
|
|
47
|
+
const nodeVersion = process.version;
|
|
48
|
+
|
|
43
49
|
// Read all markdown files into an array
|
|
44
50
|
const docs = await Promise.all(
|
|
45
51
|
(spec.markdown_paths || ['spec.md']).map(_path =>
|
|
@@ -166,6 +172,8 @@ async function render(spec, assets, sharedVars, config, template, assetsGlobal,
|
|
|
166
172
|
currentDate: currentDate,
|
|
167
173
|
universalTimestamp: universalTimestamp,
|
|
168
174
|
buildBranch: buildBranch,
|
|
175
|
+
specUpTVersion: specUpTVersion,
|
|
176
|
+
nodeVersion: nodeVersion,
|
|
169
177
|
githubRepoInfo: getGithubRepoInfo(spec)
|
|
170
178
|
});
|
|
171
179
|
|
package/templates/template.html
CHANGED
|
@@ -325,6 +325,14 @@
|
|
|
325
325
|
<i class="bi bi-signpost-split me-2"></i>
|
|
326
326
|
<span>Source branch: <strong>${buildBranch}</strong></span>
|
|
327
327
|
</div>
|
|
328
|
+
<div class="d-flex align-items-center mb-1">
|
|
329
|
+
<i class="bi bi-box me-2"></i>
|
|
330
|
+
<span>spec-up-t: <strong>v${specUpTVersion}</strong></span>
|
|
331
|
+
</div>
|
|
332
|
+
<div class="d-flex align-items-center mb-1">
|
|
333
|
+
<i class="bi bi-cpu me-2"></i>
|
|
334
|
+
<span>Node.js: <strong>${nodeVersion}</strong></span>
|
|
335
|
+
</div>
|
|
328
336
|
</div>
|
|
329
337
|
</div>
|
|
330
338
|
<hr>
|