oc-harness-setup 0.4.2 → 0.4.3

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
@@ -11,6 +11,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
11
11
 
12
12
  - README uses the house centered header, public “agents” wording, and Releases/Issues links; no shipped behavior change.
13
13
 
14
+ ## [0.4.3] - 2026-10-20
15
+
16
+ ### Fixed
17
+
18
+ - Fresh installs from the registry no longer fail the doctor: npm renames a
19
+ shipped root `.gitignore` to `.npmignore` on install, so the pack now ships
20
+ `gitignore.template` and the installer writes it to `.gitignore`. A test now
21
+ packs the tarball, installs it, and runs setup from the installed copy.
22
+
14
23
  ## [0.4.2] - 2026-10-20
15
24
 
16
25
  ### Fixed
package/bin/cli.js CHANGED
@@ -37,7 +37,11 @@ const PKG_NAME = 'oc-harness-setup';
37
37
  const PKG_ROOT = path.resolve(import.meta.dirname, '..');
38
38
  const MANIFEST_FILE = 'oc-harness-setup.manifest.json';
39
39
  const COPY_DIRS = ['agents', 'commands', 'skills', 'reference', 'scripts', '.docs', 'state-seed'];
40
- const COPY_FILES = ['AGENTS.md', 'GLOSSARY.md', '.gitignore'];
40
+ const COPY_FILES = ['AGENTS.md', 'GLOSSARY.md', 'gitignore.template'];
41
+ // npm renames a shipped root dotfile (`.gitignore` → `.npmignore`) on pack/
42
+ // install, so the pack ships `gitignore.template` and the installer aliases it
43
+ // back to `.gitignore` at the destination.
44
+ const FILE_ALIASES = { 'gitignore.template': '.gitignore' };
41
45
  // Source→destination aliases: the pack ships `state-seed/` (tracked) but the
42
46
  // live tree owns `state/` (git-ignored runtime), so every incoming
43
47
  // `state-seed/...` file lands at `state/...`. `rel` is ALWAYS the
@@ -67,6 +71,8 @@ const DISTRO_PLUGIN_IDS = ['oc-flight-deck'];
67
71
  // genuinely adopter-edited one is kept. The template is a controlled copy
68
72
  // graded by the doctor, so adopter edits are archived then overwritten.
69
73
  const PRESERVE_IF_EXISTS = new Set(['reference/models.md', 'AGENTS.md', '.gitignore', 'state/lessons.md']);
74
+ // Keyed on forward slashes; matched through norm() because rel is platform-native
75
+ // (path.join yields backslashes on Windows).
70
76
  // Leak markers — generic shapes, never a concrete machine. They catch the
71
77
  // maintainer's workstation leaking into the shipped tree (an absolute
72
78
  // user-profile path, a session id). They are linted against the package
@@ -314,7 +320,8 @@ function collectIncoming(configDir) {
314
320
  log('staging', `note: ${f} not present in this package — nothing to copy`);
315
321
  continue;
316
322
  }
317
- files.push({ rel: f, src, dest: path.join(configDir, f) });
323
+ const rel = FILE_ALIASES[f] ?? f;
324
+ files.push({ rel, src, dest: path.join(configDir, rel) });
318
325
  }
319
326
  return files;
320
327
  }
@@ -365,7 +372,7 @@ function stageFiles(files, manifest, prior, configDir) {
365
372
  if (destHash === srcHash) {
366
373
  action = 'skip';
367
374
  log('staging', `skip ${f.rel} (already identical — rerun-safe)`);
368
- } else if (PRESERVE_IF_EXISTS.has(f.rel)) {
375
+ } else if (PRESERVE_IF_EXISTS.has(norm(f.rel))) {
369
376
  // Upgrade rule: preserve only a GENUINELY adopter-edited file, i.e.
370
377
  // one that differs from the prior manifest hash. A destination that
371
378
  // still matches the prior installed hash is unmodified pack content —
@@ -1046,10 +1053,12 @@ function writeManifest(configDir, manifest) {
1046
1053
  // preserved stays preserved.
1047
1054
  function carryForwardJournal(manifest, prior) {
1048
1055
  if (!prior || !Array.isArray(prior.files)) return;
1049
- const before = new Map(prior.files.map((f) => [String(f.path), f]));
1056
+ // Prior manifests may spell paths with either separator.
1057
+ const norm = (p) => String(p).replace(/\\/g, '/');
1058
+ const before = new Map(prior.files.map((f) => [norm(f.path), f]));
1050
1059
  for (const e of manifest.files) {
1051
1060
  if (e.action === 'retired' || e.action === 'archived') continue; // a retirement/archive is this run's truth, never downgraded
1052
- const p = before.get(String(e.path));
1061
+ const p = before.get(norm(e.path));
1053
1062
  if (!p) continue;
1054
1063
  if (p.action === 'retired' || p.action === 'archived') continue; // a path the prior run settled that this run re-ships is fresh staging, not a settlement
1055
1064
  if (p.action === 'overwritten') {
@@ -1063,11 +1072,11 @@ function carryForwardJournal(manifest, prior) {
1063
1072
  // already deleted or archived and absent from this run's staging, but
1064
1073
  // --uninstall still needs them to restore the pre-install originals from
1065
1074
  // the backup chain.
1066
- const now = new Set(manifest.files.map((f) => String(f.path)));
1075
+ const now = new Set(manifest.files.map((f) => norm(f.path)));
1067
1076
  for (const p of prior.files) {
1068
- if ((p.action === 'retired' || p.action === 'archived') && !now.has(String(p.path))) {
1077
+ if ((p.action === 'retired' || p.action === 'archived') && !now.has(norm(p.path))) {
1069
1078
  manifest.files.push(p);
1070
- now.add(String(p.path));
1079
+ now.add(norm(p.path));
1071
1080
  }
1072
1081
  }
1073
1082
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oc-harness-setup",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "oc-harness-setup": "bin/cli.js"
@@ -17,7 +17,7 @@
17
17
  "AGENTS.md",
18
18
  "GLOSSARY.md",
19
19
  "CHANGELOG.md",
20
- ".gitignore",
20
+ "gitignore.template",
21
21
  "opencode.jsonc",
22
22
  "README.md",
23
23
  "LICENSE"
File without changes