@hippo-digital/hippocampus 1.0.0-rc.3 → 1.0.0-rc.4

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/CHANGELOG.md CHANGED
@@ -56,6 +56,11 @@ journeys and screens they justify, rendered as a viewer inside your prototype.
56
56
  into `.github/skills` and every skill names its `owners` by agent, so either
57
57
  half alone is a set of dangling references. `--no-agents` installs the skills
58
58
  only.
59
+ - A file that already exists in the host and was not written by this command is
60
+ left exactly as it is and named in the output. Only files it had written
61
+ before were protected previously, which is backwards for the first install
62
+ into a repo that already has its own agents - the repo most likely to have
63
+ some. `--force` still overwrites, and now says what that would cost.
59
64
  - Everything the agents and skills reference that is not a repo file is read
60
65
  from the installed package, so those references are version-matched too.
61
66
  - `skills validate` checks both directions between skills and agents: a skill
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hippo-digital/hippocampus",
3
- "version": "1.0.0-rc.3",
3
+ "version": "1.0.0-rc.4",
4
4
  "description": "A design-knowledge base for NHS Prototype Kit projects: research, insights, needs, journeys and screens, traceable end to end.",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -61,6 +61,7 @@ function main () {
61
61
  const trees = TREES.filter((tree) => tree.key === 'files' || withAgents)
62
62
  let wroteAnything = false
63
63
  let anySkipped = false
64
+ let anyForeign = false
64
65
 
65
66
  for (const tree of trees) {
66
67
  manifest[tree.key] = manifest[tree.key] || {}
@@ -79,6 +80,11 @@ function main () {
79
80
  console.log(` left alone because they have been edited here (${result.skipped.length}):`)
80
81
  for (const name of result.skipped) console.log(` ${name}`)
81
82
  }
83
+ if (result.foreign.length) {
84
+ anyForeign = true
85
+ console.log(` already yours, not written (${result.foreign.length}):`)
86
+ for (const name of result.foreign) console.log(` ${name}`)
87
+ }
82
88
 
83
89
  if (tree.key === 'files') {
84
90
  const merged = mergeCatalog(skillsTarget, manifest)
@@ -99,6 +105,12 @@ function main () {
99
105
  console.log('Re-install edited files with --force once you have kept whatever you changed.\n')
100
106
  }
101
107
 
108
+ if (anyForeign) {
109
+ console.log('The files listed as already yours share a name with ours but were not')
110
+ console.log('written by this command, so they have been left exactly as they are.')
111
+ console.log('`--force` would overwrite them - copy anything you want to keep first.\n')
112
+ }
113
+
102
114
  if (!dryRun && wroteAnything) {
103
115
  manifest.version = require('../package.json').version
104
116
  manifest.updatedAt = new Date().toISOString()
@@ -118,6 +130,7 @@ function installTree (sourceDir, targetDir, manifestFiles) {
118
130
  const skipped = []
119
131
  const unchanged = []
120
132
  const kept = []
133
+ const foreign = []
121
134
 
122
135
  for (const name of fs.readdirSync(sourceDir)) {
123
136
  if (name === 'skills.json' || !/\.(skill\.md|md|json)$/.test(name)) continue
@@ -131,6 +144,14 @@ function installTree (sourceDir, targetDir, manifestFiles) {
131
144
  if (current === incoming) { unchanged.push(name); continue }
132
145
  if (NEVER_OVERWRITE.has(name)) { kept.push(name); continue }
133
146
  const installed = manifestFiles[name]
147
+
148
+ // A file we have no record of writing is the host's, not a stale copy of
149
+ // ours that happens to share a name. The hash check above only ever
150
+ // protected files we had written before, which is backwards for the case
151
+ // that matters: the FIRST install into a repo that already has its own
152
+ // agents. Getting this wrong overwrites work nobody had a copy of.
153
+ if (!installed && !force) { foreign.push(name); continue }
154
+
134
155
  if (installed && current !== installed && !force) { skipped.push(name); continue }
135
156
  }
136
157
 
@@ -142,7 +163,7 @@ function installTree (sourceDir, targetDir, manifestFiles) {
142
163
  manifestFiles[name] = incoming
143
164
  }
144
165
 
145
- return { written, skipped, unchanged, kept }
166
+ return { written, skipped, unchanged, kept, foreign }
146
167
  }
147
168
 
148
169
  /**