@ggdna/dna-helix 0.1.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 +21 -0
- package/README.md +54 -0
- package/dna/_dna.json +11 -0
- package/dna/_generated.json +40 -0
- package/dna/_vars.json +3 -0
- package/dna/doc/guides/dna-guide.md +122 -0
- package/dna/dot-claude/skills/dna/SKILL.md +43 -0
- package/package.json +41 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) ggdna
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# dna_helix
|
|
2
|
+
|
|
3
|
+
The DNA layer that tells a repo how to author a DNA layer of its own.
|
|
4
|
+
|
|
5
|
+
It carries only that one topic and is one of the layers
|
|
6
|
+
[dna_ggdna](https://github.com/ggdna/dna_ggdna) composes, so a repo gets
|
|
7
|
+
it by taking the umbrella rather than by naming it.
|
|
8
|
+
|
|
9
|
+
## Guides
|
|
10
|
+
|
|
11
|
+
- `dna/doc/guides/dna-guide.md` — the `dna/` layout and the `dot-`
|
|
12
|
+
escape, what belongs in `_dna.json` and `_vars.json`, the three
|
|
13
|
+
override mechanisms, and publishing one layer to both registries
|
|
14
|
+
|
|
15
|
+
## Skills
|
|
16
|
+
|
|
17
|
+
- `/dna` — checks a layer against the DNA guide: paths that would not
|
|
18
|
+
instantiate, layers that are not dependencies, variables nothing
|
|
19
|
+
declares, and manifests that drifted apart
|
|
20
|
+
|
|
21
|
+
## Layers
|
|
22
|
+
|
|
23
|
+
Orthogonal, and parent-less like every topic layer of this organization.
|
|
24
|
+
|
|
25
|
+
## Variables
|
|
26
|
+
|
|
27
|
+
- `dnaCopyrightHolder` — the name in the license header of every file,
|
|
28
|
+
set to `ggdna` here
|
|
29
|
+
|
|
30
|
+
## Usage
|
|
31
|
+
|
|
32
|
+
Reach it through the umbrella:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
pnpm add -D @ggdna/dna-ggdna # TypeScript projects
|
|
36
|
+
dart pub add dev:dna_ggdna # Dart projects
|
|
37
|
+
gg dna init
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Naming this layer directly is for a repo that wants the authoring topic
|
|
41
|
+
and nothing else:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
pnpm add -D @ggdna/dna-helix
|
|
45
|
+
dart pub add dev:dna_helix
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
The placed test instantiates and verifies the DNA on every test run.
|
|
49
|
+
|
|
50
|
+
## Development
|
|
51
|
+
|
|
52
|
+
The `dna/` folder is hand-authored source and is never generated. The repo
|
|
53
|
+
instantiates its own DNA — run `dart test` after changes; commit first, a
|
|
54
|
+
file the DNA would overwrite must not carry uncommitted work.
|
package/dna/_dna.json
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
// This package is a DNA layer: dna/ is hand-authored source and is the
|
|
3
|
+
// last layer of its own instantiation.
|
|
4
|
+
"version": 1,
|
|
5
|
+
|
|
6
|
+
// No parent DNA. This layer is orthogonal: it carries only its own topic
|
|
7
|
+
// and is combined with dna_ggdna and other layers by the consumer. It
|
|
8
|
+
// stays parent-less on purpose — every other ggdna layer consumes it, so
|
|
9
|
+
// a parent here would close a cycle back through the umbrella.
|
|
10
|
+
"layers": []
|
|
11
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"layers": [
|
|
4
|
+
{
|
|
5
|
+
"name": "base",
|
|
6
|
+
"package": "helix",
|
|
7
|
+
"ecosystem": null,
|
|
8
|
+
"resolvedVersion": "1.3.0",
|
|
9
|
+
"via": null,
|
|
10
|
+
"hash": "0x705e486e88a93125"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"name": "self",
|
|
14
|
+
"package": null,
|
|
15
|
+
"ecosystem": null,
|
|
16
|
+
"resolvedVersion": null,
|
|
17
|
+
"via": null,
|
|
18
|
+
"hash": "0x3ef515a6d58f3d14"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"claude": {
|
|
22
|
+
"claudeMdInclude": null
|
|
23
|
+
},
|
|
24
|
+
"baseVersion": "1.3.0",
|
|
25
|
+
"baseHash": "0x705e486e88a93125",
|
|
26
|
+
"instances": [
|
|
27
|
+
{
|
|
28
|
+
"path": ".claude/skills/dna/SKILL.md",
|
|
29
|
+
"hash": "0x0f192faea6dd65ab"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"path": "doc/guides/dna-guide.md",
|
|
33
|
+
"hash": "0x53f3df7f1bb005b3"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"path": "doc/hello_world.md",
|
|
37
|
+
"hash": "0x0903f7fc5224f6f1"
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
}
|
package/dna/_vars.json
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
@license
|
|
3
|
+
Copyright (c) dnaCopyrightHolder
|
|
4
|
+
|
|
5
|
+
Use of this source code is governed by terms that can be
|
|
6
|
+
found in the LICENSE file in the root of this package.
|
|
7
|
+
-->
|
|
8
|
+
|
|
9
|
+
# DNA Guide
|
|
10
|
+
|
|
11
|
+
How a DNA layer is built in this organization. A layer is an ordinary
|
|
12
|
+
package whose `dna/` folder is hand-authored source; the engine merges it
|
|
13
|
+
with the layers below and instantiates the result into the consuming
|
|
14
|
+
repo.
|
|
15
|
+
|
|
16
|
+
## Start a layer
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
mkdir dna_<topic> && cd dna_<topic>
|
|
20
|
+
gg dna init
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
`gg dna init` places `dna/_dna.json` and the test that runs the engine.
|
|
24
|
+
Everything else you write yourself.
|
|
25
|
+
|
|
26
|
+
A new topic layer declares no parent, for two reasons. `dna_ggdna` lists
|
|
27
|
+
every topic layer, so a layer that took the umbrella back would close a
|
|
28
|
+
cycle and the engine refuses that. And a layer's parents reach every
|
|
29
|
+
consumer of that layer — a parent here would push its content into every
|
|
30
|
+
repo downstream, whether that repo asked for the topic or not. Keep the
|
|
31
|
+
topic orthogonal; composing is what the umbrella is for.
|
|
32
|
+
|
|
33
|
+
A repo that is not itself a topic layer takes the whole set in one go:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
gg dna add dna_ggdna
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Lay out `dna/`
|
|
40
|
+
|
|
41
|
+
`dna/` mirrors the root of the consuming repo — what sits at `dna/x/y`
|
|
42
|
+
is instantiated to `x/y`:
|
|
43
|
+
|
|
44
|
+
| In the layer | Instantiated to |
|
|
45
|
+
| --- | --- |
|
|
46
|
+
| `dna/LICENSE` | `LICENSE` |
|
|
47
|
+
| `dna/doc/guides/x-guide.md` | `doc/guides/x-guide.md` |
|
|
48
|
+
| `dna/dot-vscode/settings.json` | `.vscode/settings.json` |
|
|
49
|
+
| `dna/dot-claude/skills/x/SKILL.md` | `.claude/skills/x/SKILL.md` |
|
|
50
|
+
| `dna/_vars.json` | — private, stays inside |
|
|
51
|
+
|
|
52
|
+
A leading dot is escaped as `dot-`, because publishing to pub drops every
|
|
53
|
+
path that starts with a dot. Any path segment starting with `_` is
|
|
54
|
+
private and never becomes an instance.
|
|
55
|
+
|
|
56
|
+
## Declare what it inherits
|
|
57
|
+
|
|
58
|
+
`dna/_dna.json` is the only place DNA configuration lives:
|
|
59
|
+
|
|
60
|
+
```jsonc
|
|
61
|
+
{
|
|
62
|
+
"version": 1,
|
|
63
|
+
// Application order — later layers win.
|
|
64
|
+
"layers": ["dna_readme", "dna_guides"]
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
A layer with no parents declares `"layers": []`. Keep a topic layer
|
|
69
|
+
orthogonal where you can: it is the umbrella layers that compose.
|
|
70
|
+
|
|
71
|
+
## Name the variables
|
|
72
|
+
|
|
73
|
+
Every variable starts with `dna` and is substituted as raw text, in any
|
|
74
|
+
file type. Declare the defaults in `dna/_vars.json` and let the consumer
|
|
75
|
+
override them:
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
{ "dnaCopyrightHolder": "ggdna" }
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Because substitution is textual, a variable also works inside a JSON
|
|
82
|
+
string or a code fence — `dnaCompany` in a settings file is replaced the
|
|
83
|
+
same way it is in prose.
|
|
84
|
+
|
|
85
|
+
## Let consumers adapt it
|
|
86
|
+
|
|
87
|
+
- A same-path file in a later layer replaces yours whole
|
|
88
|
+
- `X.overrides.json` merges field-wise: objects deep-merge, `"key!"`
|
|
89
|
+
replaces without merging, `"key+"` appends to an array, `"key": null`
|
|
90
|
+
deletes
|
|
91
|
+
- `X.overrides.md` replaces only the sections a markdown file marks with
|
|
92
|
+
`## @tag Title`
|
|
93
|
+
|
|
94
|
+
Mark the sections of your guides that another organization will plausibly
|
|
95
|
+
want to change — that is what makes a layer reusable instead of forkable.
|
|
96
|
+
|
|
97
|
+
## Ship it to both registries
|
|
98
|
+
|
|
99
|
+
A layer is consumed from Dart and from TypeScript, so it is published
|
|
100
|
+
twice from the same repo:
|
|
101
|
+
|
|
102
|
+
- `pubspec.yaml` — `name: dna_<topic>`, published to pub.dev
|
|
103
|
+
- `package.json` — `name: @<scope>/dna-<topic>`, published to npm
|
|
104
|
+
- `files: ["dna", "README.md", "LICENSE"]` — the tarball carries the
|
|
105
|
+
source folder, nothing built
|
|
106
|
+
|
|
107
|
+
Keep both versions in step: the engine warns when the two copies of one
|
|
108
|
+
layer differ, and uses the npm one.
|
|
109
|
+
|
|
110
|
+
## Verify it
|
|
111
|
+
|
|
112
|
+
The placed test instantiates the layer into its own repo on every run, so
|
|
113
|
+
the layer is always exercised by the repo that ships it:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
dart test # or: pnpm test
|
|
117
|
+
gg dna build # the same run, without a test framework
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Commit before a run that writes: every existing file the engine would
|
|
121
|
+
overwrite has to be committed, so each overwrite stays recoverable
|
|
122
|
+
through git.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dna
|
|
3
|
+
description: Checks this DNA layer against the DNA guide and reports what would break for a consumer. Use when the user says "/dna" or asks whether the layer is in shape.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<!--
|
|
7
|
+
@license
|
|
8
|
+
Copyright (c) dnaCopyrightHolder
|
|
9
|
+
|
|
10
|
+
Use of this source code is governed by terms that can be
|
|
11
|
+
found in the LICENSE file in the root of this package.
|
|
12
|
+
-->
|
|
13
|
+
|
|
14
|
+
# DNA
|
|
15
|
+
|
|
16
|
+
Read `doc/guides/dna-guide.md` and follow it.
|
|
17
|
+
|
|
18
|
+
## 1. Check the layout
|
|
19
|
+
|
|
20
|
+
Report a path below `dna/` that starts with a literal dot instead of
|
|
21
|
+
`dot-`, a private `_` file that the layer expects to be instantiated, and
|
|
22
|
+
a file that would land somewhere the consumer does not expect.
|
|
23
|
+
|
|
24
|
+
## 2. Check the config
|
|
25
|
+
|
|
26
|
+
Report a `dna/_dna.json` whose `layers` name something that is not a
|
|
27
|
+
declared dependency, and a dependency that ships a `dna/` folder but is
|
|
28
|
+
missing from `layers` — a dependency that is not listed is not a layer.
|
|
29
|
+
|
|
30
|
+
## 3. Check the variables
|
|
31
|
+
|
|
32
|
+
Report an identifier starting with `dna` that no `_vars.json` gives a
|
|
33
|
+
value, and a value in `_vars.json` that nothing uses.
|
|
34
|
+
|
|
35
|
+
## 4. Check both manifests
|
|
36
|
+
|
|
37
|
+
Report a version mismatch between `pubspec.yaml` and `package.json`, and
|
|
38
|
+
a layer listed in one manifest but not in the other — the engine warns
|
|
39
|
+
when the two published copies differ.
|
|
40
|
+
|
|
41
|
+
## 5. Report before fixing
|
|
42
|
+
|
|
43
|
+
List the findings first. Fix only what the user confirms.
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ggdna/dna-helix",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "DNA layer: how a DNA layer itself is built, configured and published",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"dna",
|
|
7
|
+
"helix",
|
|
8
|
+
"conventions",
|
|
9
|
+
"scaffolding"
|
|
10
|
+
],
|
|
11
|
+
"homepage": "https://github.com/ggdna/dna_helix",
|
|
12
|
+
"bugs": "https://github.com/ggdna/dna_helix/issues",
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/ggdna/dna_helix.git"
|
|
17
|
+
},
|
|
18
|
+
"type": "module",
|
|
19
|
+
"files": [
|
|
20
|
+
"dna",
|
|
21
|
+
"README.md",
|
|
22
|
+
"LICENSE"
|
|
23
|
+
],
|
|
24
|
+
"engines": {
|
|
25
|
+
"node": ">=22"
|
|
26
|
+
},
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public"
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"test:dart": "dart test",
|
|
32
|
+
"test": "pnpm run test:dart",
|
|
33
|
+
"prepublishOnly": "pnpm run test",
|
|
34
|
+
"format": "prettier --write .",
|
|
35
|
+
"format:check": "prettier --check ."
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@types/node": "^26.4.1",
|
|
39
|
+
"prettier": "^3.9.6"
|
|
40
|
+
}
|
|
41
|
+
}
|