@punks/cli 5.2.1 → 5.2.2

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.
Files changed (76) hide show
  1. package/README.md +2 -2
  2. package/dist/BASELINE_CHANGELOG.md +37 -0
  3. package/dist/CHANGELOG.md +20 -0
  4. package/dist/baseline/scaffold-baseline/baseline.json +15 -5
  5. package/dist/baseline/scaffold-baseline/data/catalog/packs.json +2 -0
  6. package/dist/baseline/scaffold-baseline/data/catalog/skills.json +16 -0
  7. package/dist/baseline/scaffold-baseline/data/hooks/format-edited-file.mjs +59 -17
  8. package/dist/baseline/scaffold-baseline/data/scripts/managed-lint-runner.mjs +7 -1
  9. package/dist/baseline/scaffold-baseline/data/scripts/managed-lint-runner.test.ts +43 -0
  10. package/dist/baseline/scaffold-baseline/skills/agnostic/cli/hi-cli/references/commands.md +2 -2
  11. package/dist/baseline/scaffold-baseline/skills/agnostic/cli/hi-cli/references/post-command-flow.md +24 -21
  12. package/dist/baseline/scaffold-baseline/skills/agnostic/cli/hi-cli/references/wiki-structure.md +16 -0
  13. package/dist/baseline/scaffold-baseline/skills/agnostic/docs/docs-onboarding/SKILL.md +21 -16
  14. package/dist/baseline/scaffold-baseline/skills/agnostic/docs/docs-onboarding/agents/openai.yaml +1 -1
  15. package/dist/baseline/scaffold-baseline/skills/agnostic/docs/docs-onboarding/references/artifact-contract.md +16 -4
  16. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/create-architecture/SKILL.md +65 -0
  17. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/create-architecture/assets/ARCHITECTURE-TEMPLATE.md +119 -0
  18. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/create-architecture/references/artifact-contract.md +200 -0
  19. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/create-plan/SKILL.md +11 -3
  20. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/create-plan/references/architecture-convergence.md +19 -4
  21. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/create-plan/references/plan-schema.md +17 -3
  22. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/create-spec/SKILL.md +38 -20
  23. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/create-spec/assets/SPEC-TEMPLATE.md +11 -0
  24. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/create-spec/references/readiness.md +40 -0
  25. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/create-spec/references/spec-quality-bar.md +8 -0
  26. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/implement-spec/SKILL.md +4 -2
  27. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/implement-spec/references/architecture-conformance.md +10 -6
  28. package/dist/baseline/scaffold-baseline/skills/agnostic/planning/implement-spec/references/lifecycle.md +23 -10
  29. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/brainstorm/SKILL.md +22 -0
  30. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/requirements-grill/SKILL.md +2 -1
  31. package/dist/baseline/scaffold-baseline/skills/agnostic/requirements/requirements-grill/references/artifact-output.md +3 -2
  32. package/dist/baseline/scaffold-baseline/skills/phases/delivery-phase/SKILL.md +6 -3
  33. package/dist/baseline/scaffold-baseline/skills/phases/delivery-phase/phases/plan.md +4 -2
  34. package/dist/baseline/scaffold-baseline/skills/phases/delivery-phase/phases/review.md +5 -1
  35. package/dist/baseline/scaffold-baseline/skills/phases/delivery-phase/phases/router.md +15 -9
  36. package/dist/baseline/scaffold-baseline/skills/phases/delivery-phase/phases/spec.md +13 -26
  37. package/dist/baseline/scaffold-baseline/skills/phases/delivery-phase/references/artifact-state.md +39 -1
  38. package/dist/baseline/scaffold-baseline/skills/phases/requirements-phase/SKILL.md +31 -14
  39. package/dist/baseline/scaffold-baseline/skills/phases/review-phase/phases/prepare-review.md +12 -4
  40. package/dist/baseline/scaffold-baseline.json +5 -5
  41. package/dist/baseline/scaffold-baseline.tgz +0 -0
  42. package/dist/data/hooks/format-edited-file.d.mts +5 -0
  43. package/dist/data/hooks/format-edited-file.mjs +52 -15
  44. package/dist/data/scripts/managed-lint-runner.mjs +7 -1
  45. package/dist/index.js +56 -1129
  46. package/dist/skills/agnostic/cli/hi-cli/references/commands.md +2 -2
  47. package/dist/skills/agnostic/cli/hi-cli/references/post-command-flow.md +9 -6
  48. package/dist/skills/agnostic/cli/hi-cli/references/wiki-structure.md +16 -0
  49. package/dist/skills/agnostic/docs/docs-onboarding/SKILL.md +21 -16
  50. package/dist/skills/agnostic/docs/docs-onboarding/agents/openai.yaml +1 -1
  51. package/dist/skills/agnostic/docs/docs-onboarding/references/artifact-contract.md +16 -4
  52. package/dist/skills/agnostic/planning/create-architecture/SKILL.md +65 -0
  53. package/dist/skills/agnostic/planning/create-architecture/assets/ARCHITECTURE-TEMPLATE.md +119 -0
  54. package/dist/skills/agnostic/planning/create-architecture/references/artifact-contract.md +200 -0
  55. package/dist/skills/agnostic/planning/create-plan/SKILL.md +11 -3
  56. package/dist/skills/agnostic/planning/create-plan/references/architecture-convergence.md +19 -4
  57. package/dist/skills/agnostic/planning/create-plan/references/plan-schema.md +17 -3
  58. package/dist/skills/agnostic/planning/create-spec/SKILL.md +38 -20
  59. package/dist/skills/agnostic/planning/create-spec/assets/SPEC-TEMPLATE.md +11 -0
  60. package/dist/skills/agnostic/planning/create-spec/references/readiness.md +40 -0
  61. package/dist/skills/agnostic/planning/create-spec/references/spec-quality-bar.md +8 -0
  62. package/dist/skills/agnostic/planning/implement-spec/SKILL.md +4 -2
  63. package/dist/skills/agnostic/planning/implement-spec/references/architecture-conformance.md +10 -6
  64. package/dist/skills/agnostic/planning/implement-spec/references/lifecycle.md +23 -10
  65. package/dist/skills/agnostic/requirements/brainstorm/SKILL.md +22 -0
  66. package/dist/skills/agnostic/requirements/requirements-grill/SKILL.md +2 -1
  67. package/dist/skills/agnostic/requirements/requirements-grill/references/artifact-output.md +3 -2
  68. package/dist/skills/phases/delivery-phase/SKILL.md +6 -3
  69. package/dist/skills/phases/delivery-phase/phases/plan.md +4 -2
  70. package/dist/skills/phases/delivery-phase/phases/review.md +5 -1
  71. package/dist/skills/phases/delivery-phase/phases/router.md +15 -9
  72. package/dist/skills/phases/delivery-phase/phases/spec.md +13 -26
  73. package/dist/skills/phases/delivery-phase/references/artifact-state.md +39 -1
  74. package/dist/skills/phases/requirements-phase/SKILL.md +31 -14
  75. package/dist/skills/phases/review-phase/phases/prepare-review.md +12 -4
  76. package/package.json +3 -2
package/README.md CHANGED
@@ -9,7 +9,7 @@ At runtime, stable and exact scaffold requests resolve through the verified cont
9
9
  - `hi`
10
10
  show the command guide
11
11
  - `hi init`
12
- choose a backlog provider, scaffold requirements/backlog skills, and seed the initial wiki tree
12
+ choose project providers and backlog project URL, then scaffold the default Harness context
13
13
  - `hi scaffold`
14
14
  detect the target repo, confirm or auto-accept pack selection, and write repo-aware scaffold output
15
15
  - `hi tools ensure`
@@ -39,7 +39,7 @@ bun run baseline:build
39
39
 
40
40
  `bun run sync:skills` updates a local cache clone of `wearedevpunks/skills` and then replaces only `skills/`, overwriting any local changes there.
41
41
 
42
- `hi init` asks for the backlog provider, defaults to GitHub Projects/Issues, copies `.agents/skills/requirements-grill` and `.agents/skills/write-backlog`, seeds an initial Mermaid-enabled wiki tree at `apps/wiki` for monorepos or `wiki` for single-repo layouts, writes `<wiki-root>/backlog-provider.md`, and then prints a fixed post-command prompt. Agents should activate `$hi-cli`, reconcile generated init output with the real repo layout, keep the pinned backlog provider unless the user changes it, and only start requirements/backlog generation when the user asks for that workflow.
42
+ `hi init` asks for the backlog, asset, and repository providers and an absolute HTTP(S) backlog project URL, stores those settings in `.devpunks/settings.json`, distributes the default-pack scaffold, and prints the post-command handoff. Agents should activate `$hi-cli`, read `.devpunks/AGENT-SYSTEM-PROMPT.md`, and check the existing project-owned wiki structure before starting `$docs-onboarding`. If no wiki exists, the wiki check is `not-applicable` and onboarding stays pending until the user authorizes project-owned wiki creation or selects an existing wiki. Init does not generate a wiki or write a wiki provider page; settings remain authoritative. Keep selected providers unless the user changes them.
43
43
 
44
44
  `hi scaffold` scans the target repo from `cwd` or `-i`, resolves the active scaffold baseline, writes scaffold output into the scan root or `-o`, copies the selected baseline skills, resolves pack-owned lint assets into `.devpunks/specs/lint/`, and ensures required global tool prerequisites for those skills. Use `--yes` in non-interactive harnesses to accept the resolved default pack selection without prompts.
45
45
 
@@ -6,6 +6,43 @@ Compatibility: `>=5.2.1 <5.3.0`
6
6
 
7
7
  ### Added
8
8
 
9
+ - Add `create-architecture` to the default planning pack. Requirements now retain
10
+ `ARCHITECTURE.md` before `SPEC.md`, preserving exact accepted implementation
11
+ choices, source traceability, and visual explanations. Every delivery entrypoint,
12
+ including resumed and local work, requires the current retained artifact pair.
13
+ Spec outcome/acceptance codes map to architecture blocks, flow steps, and source grill questions.
14
+ Install the shared `brainstorm` dependency in the default requirements pack.
15
+ Canonical source: `wearedevpunks/skills@1991389066f56e7297bacc5fe2cafd3858ca0ee4`
16
+ (`sync/create-architecture-1991389066f5`).
17
+
18
+ ### Fixed
19
+
20
+ - Adopt managed lint for the eleven selected app and package roots while
21
+ preserving their inherited Oxlint policy and the repository check graph.
22
+ - Keep required root static verification scoped to root code while affected
23
+ - Validate affected workspace lint through the saved managed route and enforce its warning limit on changed lines.
24
+ - Keep CLI skills, build output, and cache paths excluded from managed lint enumeration as they already are in the CLI Oxlint config; this bounds the Windows command line.
25
+ - Match installed-consumer validation to the four current `hi init` prompts.
26
+ verification checks changed files under each selected lint route.
27
+ - Keep the wiki app project-owned; the baseline no longer aligns its package,
28
+ routes, content, or metadata during scaffold and update.
29
+ - Sync the shared `hi-cli` post-command wiki structure check from canonical
30
+ `wearedevpunks/skills@e9ffa55393dae12ffb061125575a2053bb49a7eb`
31
+ (`sync/hi-cli-wiki-onboarding-e9ffa55`).
32
+
33
+ - Centralize architectural failure lenses in `brainstorm`; run its checkpoint
34
+ initially and after every requirements-grill response set, including an incomplete
35
+ frontier response, after recording supplied answers and before computing and
36
+ persisting the next frontier or requesting closure (#226).
37
+
38
+ ## Published 2026-09-23
39
+
40
+ Published as [baseline/stable/2026.09.23-66535546](https://github.com/wearedevpunks/harness-intelligence/releases/tag/baseline/stable/2026.09.23-66535546).
41
+
42
+ Compatibility: `>=5.2.1 <5.3.0`
43
+
44
+ ### Added
45
+
9
46
  - Distribute `verify-behavior`, `create-verification-skill`, and
10
47
  `update-verification-skill` together in the default verification pack while
11
48
  preserving project-owned verifier reference bytes (#207).
package/dist/CHANGELOG.md CHANGED
@@ -2,6 +2,26 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 5.2.2 - 2026-09-24
6
+
7
+ ### Changed
8
+
9
+ - Leave wiki package setup, routes, content, and metadata to the owning project;
10
+ `hi init`, `hi scaffold`, and `hi update` no longer create or align a wiki.
11
+ - Check an existing wiki against the project structure during the shared
12
+ `hi-cli` post-command handoff.
13
+
14
+ ### Fixed
15
+
16
+ - Recognize the repository's Turbo check route and read-only format commands
17
+ when adopting managed lint, and preserve disjoint inherited Oxlint policy.
18
+ - Accept the scoped root static gate while retaining the full managed lint
19
+ dispatcher for operator runs and linting changed files in CI.
20
+ - Find Node when the managed lint runner validates tools from a scoped runtime.
21
+ - Keep edited-file lint available when an unrelated repository symlink points outside the root, while rejecting external required lint inputs.
22
+ - Preserve update preparation evidence when publication readiness fails after a lint preview.
23
+ - Plan the edited-file hook when managed quality setup will add Oxfmt during the same update.
24
+
5
25
  ## 5.2.1 - 2026-09-23
6
26
 
7
27
  ### Fixed
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "schemaVersion": 2,
3
3
  "channel": "stable",
4
- "version": "2026.09.23-66535546",
5
- "tag": "baseline/stable/2026.09.23-66535546",
6
- "commit": "66535546af2cdfab73f8fe1438ee8295ebee45f1",
4
+ "version": "2026.09.24-84dd3d24",
5
+ "tag": "baseline/stable/2026.09.24-84dd3d24",
6
+ "commit": "84dd3d249f6a9a9e420e48c940c9629337314a5e",
7
7
  "sha256": null,
8
8
  "compatibility": {
9
- "cliVersionRange": ">=5.2.1 <5.3.0"
9
+ "cliVersionRange": ">=5.2.2 <5.3.0"
10
10
  },
11
- "generatedAt": "2026-09-23T12:18:32.000Z",
11
+ "generatedAt": "2026-09-24T14:01:29.000Z",
12
12
  "capabilities": {
13
13
  "scopedAuthoring": {
14
14
  "revision": "1",
@@ -58,6 +58,16 @@
58
58
  "authoringRevision": "1",
59
59
  "id": "better-auth-security-best-practices"
60
60
  },
61
+ {
62
+ "activationRevision": "1",
63
+ "authoringRevision": "1",
64
+ "id": "brainstorm"
65
+ },
66
+ {
67
+ "activationRevision": "1",
68
+ "authoringRevision": "1",
69
+ "id": "create-architecture"
70
+ },
61
71
  {
62
72
  "activationRevision": "1",
63
73
  "authoringRevision": "1",
@@ -250,6 +250,7 @@
250
250
  "goalify",
251
251
  "grilling",
252
252
  "handoff",
253
+ "create-architecture",
253
254
  "create-spec",
254
255
  "create-plan",
255
256
  "implement-spec",
@@ -358,6 +359,7 @@
358
359
  "skills": [
359
360
  "requirements-phase",
360
361
  "requirements-grill",
362
+ "brainstorm",
361
363
  "domain-modeling",
362
364
  "repo-asset-management",
363
365
  "write-backlog"
@@ -71,6 +71,22 @@
71
71
  "sourceDirectory": "skills/frameworks/better-auth/better-auth-security-best-practices",
72
72
  "tier": "framework"
73
73
  },
74
+ {
75
+ "framework": null,
76
+ "id": "brainstorm",
77
+ "language": null,
78
+ "requiresTools": [],
79
+ "sourceDirectory": "skills/agnostic/requirements/brainstorm",
80
+ "tier": "agnostic"
81
+ },
82
+ {
83
+ "framework": null,
84
+ "id": "create-architecture",
85
+ "language": null,
86
+ "requiresTools": [],
87
+ "sourceDirectory": "skills/agnostic/planning/create-architecture",
88
+ "tier": "agnostic"
89
+ },
74
90
  {
75
91
  "framework": null,
76
92
  "id": "create-plan",
@@ -42,6 +42,7 @@ const formattableSuffixes = new Set([
42
42
  ]);
43
43
  const ignoredParts = new Set([".git", "node_modules", ".next", "dist"]);
44
44
  const scaffoldManifestPath = ".devpunks/scaffold-manifest.json";
45
+ const managedHookPathsPath = ".devpunks/managed-hook-paths.json";
45
46
  const productRoots = new Set(["apps", "packages"]);
46
47
  const backendWorkspaceSegments = new Set(["api", "backend", "server", "services"]);
47
48
 
@@ -292,23 +293,52 @@ function normalizeManagedPath(filePath) {
292
293
  }
293
294
 
294
295
  function loadManagedPaths(root, caseInsensitivePaths) {
295
- const manifest = loadJson(path.join(root, scaffoldManifestPath));
296
- if (!manifest || typeof manifest !== "object" || !Array.isArray(manifest.managedFiles)) {
297
- return null;
298
- }
299
-
300
- const managedPaths = new Set();
301
- for (const entry of manifest.managedFiles) {
302
- if (!entry || typeof entry !== "object" || Array.isArray(entry)) {
296
+ let paths;
297
+ let usesTrackedIndex = false;
298
+ try {
299
+ if (!lstatSync(path.join(root, managedHookPathsPath)).isFile()) {
300
+ return null;
301
+ }
302
+ const index = loadJson(path.join(root, managedHookPathsPath));
303
+ if (!index || index.version !== 1 || !Array.isArray(index.paths)) {
303
304
  return null;
304
305
  }
306
+ paths = index.paths;
307
+ usesTrackedIndex = true;
308
+ } catch (error) {
309
+ if (error?.code !== "ENOENT") {
310
+ return null;
311
+ }
312
+ const manifest = loadJson(path.join(root, scaffoldManifestPath));
313
+ if (!manifest || typeof manifest !== "object" || !Array.isArray(manifest.managedFiles)) {
314
+ return null;
315
+ }
316
+ paths = [];
317
+ for (const entry of manifest.managedFiles) {
318
+ if (!entry || typeof entry !== "object" || Array.isArray(entry)) {
319
+ return null;
320
+ }
321
+ paths.push(entry.path);
322
+ }
323
+ }
305
324
 
306
- const normalizedPath = normalizeManagedPath(entry.path);
325
+ const managedPaths = new Set();
326
+ for (const filePath of paths) {
327
+ const normalizedPath = normalizeManagedPath(filePath);
307
328
  if (!normalizedPath) {
308
329
  return null;
309
330
  }
310
331
  managedPaths.add(managedPathKey(normalizedPath, caseInsensitivePaths));
311
332
  }
333
+ if (
334
+ usesTrackedIndex &&
335
+ [managedHookPathsPath, scaffoldManifestPath].some(
336
+ (filePath) => !managedPaths.has(managedPathKey(filePath, caseInsensitivePaths)),
337
+ )
338
+ ) {
339
+ return null;
340
+ }
341
+ managedPaths.add(managedPathKey(managedHookPathsPath, caseInsensitivePaths));
312
342
 
313
343
  return managedPaths;
314
344
  }
@@ -541,8 +571,8 @@ async function selectedQuality(root, filePaths) {
541
571
  failure: emptyLintSummary("operational_failure", [
542
572
  {
543
573
  stage: "config-load",
544
- command: scaffoldManifestPath,
545
- message: "Managed scaffold manifest is invalid",
574
+ command: managedHookPathsPath,
575
+ message: `Managed hook ownership metadata is missing or invalid (${managedHookPathsPath}; legacy fallback: ${scaffoldManifestPath})`,
546
576
  },
547
577
  ]),
548
578
  };
@@ -590,7 +620,20 @@ async function selectedQuality(root, filePaths) {
590
620
  }
591
621
  }
592
622
 
593
- function copyLintMirror(root, mirror) {
623
+ function copyLintMirror(root, mirror, requiredInputs) {
624
+ const physicalRoot = realpathSync(root);
625
+ for (const input of requiredInputs) {
626
+ const source = path.join(root, input);
627
+ if (!existsSync(source)) continue;
628
+ const relativeTarget = path.relative(physicalRoot, realpathSync(source));
629
+ if (
630
+ relativeTarget === ".." ||
631
+ relativeTarget.startsWith(`..${path.sep}`) ||
632
+ path.isAbsolute(relativeTarget)
633
+ ) {
634
+ throw new Error(`Cannot prove temporary lint parity for external repository input: ${input}`);
635
+ }
636
+ }
594
637
  const visit = (source, destination) => {
595
638
  mkdirSync(destination, { recursive: true });
596
639
  for (const entry of readdirSync(source, { withFileTypes: true })) {
@@ -612,15 +655,13 @@ function copyLintMirror(root, mirror) {
612
655
  }
613
656
  if (entry.isSymbolicLink()) {
614
657
  const resolved = realpathSync(from);
615
- const relativeTarget = path.relative(root, resolved);
658
+ const relativeTarget = path.relative(physicalRoot, resolved);
616
659
  if (
617
660
  relativeTarget === ".." ||
618
661
  relativeTarget.startsWith(`..${path.sep}`) ||
619
662
  path.isAbsolute(relativeTarget)
620
663
  )
621
- throw new Error(
622
- `Cannot prove temporary lint parity for external repository symlink: ${path.relative(root, from)}`,
623
- );
664
+ continue;
624
665
  const link = readlinkSync(from);
625
666
  symlinkSync(path.isAbsolute(link) ? path.resolve(mirror, relativeTarget) : link, to);
626
667
  continue;
@@ -638,7 +679,7 @@ async function runSafeJavascriptLint(workspace, root, relativePath, content, rou
638
679
  const mirror = mkdtempSync(path.join(os.tmpdir(), "hi-lint-mirror-"));
639
680
  let command;
640
681
  try {
641
- copyLintMirror(root, mirror);
682
+ copyLintMirror(root, mirror, [relativePath, route.config, ...route.inputs]);
642
683
  for (const input of [route.config, ...route.inputs]) {
643
684
  if (existsSync(path.join(root, input)) && !existsSync(path.join(mirror, input)))
644
685
  throw new Error(`Required lint input is excluded from safe mirror: ${input}`);
@@ -1714,6 +1755,7 @@ export const FormatAndLintPlugin = async ({ client, worktree }) => {
1714
1755
  };
1715
1756
 
1716
1757
  export const testHooks = {
1758
+ copyLintMirror,
1717
1759
  codexStateFilePath,
1718
1760
  formatCommandForPath,
1719
1761
  lintCommandForPath,
@@ -73,7 +73,13 @@ export const managedLintEnvironment = (root, cwd) => {
73
73
  }
74
74
  current = parent;
75
75
  }
76
- return { ...process.env, PATH: [...bins, path.dirname(process.execPath)].join(path.delimiter) };
76
+ bins.push(path.dirname(process.execPath));
77
+ const node = spawnSync("node", ["--print", "process.execPath"], { encoding: "utf-8" });
78
+ const nodePath = node.stdout?.trim();
79
+ if (node.status === 0 && nodePath !== undefined && path.isAbsolute(nodePath)) {
80
+ bins.push(path.dirname(nodePath));
81
+ }
82
+ return { ...process.env, PATH: [...new Set(bins)].join(path.delimiter) };
77
83
  };
78
84
  /** @param {import("./managed-lint-runner.mjs").ManagedLintRunOptions} options @returns {Promise<import("./managed-lint-runner.mjs").ManagedLintRunResult>} */
79
85
  export const runManagedLint = async (options) => {
@@ -86,6 +86,49 @@ const withEmptyOwner = (run: (root: string, version: string) => void) => {
86
86
  }
87
87
  };
88
88
  describe("managed lint execution", () => {
89
+ it("runs Node-shebang tools under Bun without exposing unrelated PATH entries", () => {
90
+ withEmptyOwner((root, version) => {
91
+ const ambient = path.join(root, "ambient-bin");
92
+ mkdirSync(ambient);
93
+ symlinkSync(process.execPath, path.join(ambient, "node"));
94
+ writeFileSync(path.join(ambient, "unrelated-lint-tool"), "#!/bin/sh\nexit 0\n", {
95
+ mode: 0o755,
96
+ });
97
+ rmSync(path.join(root, "node_modules"));
98
+ mkdirSync(path.join(root, "node_modules/oxlint/bin"), { recursive: true });
99
+ writeFileSync(
100
+ path.join(root, "node_modules/oxlint/package.json"),
101
+ JSON.stringify({ bin: "bin/oxlint", name: "oxlint", type: "module", version }),
102
+ );
103
+ writeFileSync(
104
+ path.join(root, "node_modules/oxlint/bin/oxlint"),
105
+ `#!/usr/bin/env node
106
+ import { spawnSync } from "node:child_process";
107
+ if (process.versions.bun || spawnSync("unrelated-lint-tool").error?.code !== "ENOENT") {
108
+ process.exit(2);
109
+ }
110
+ process.stdout.write('{"diagnostics":[]}');
111
+ `,
112
+ { mode: 0o755 },
113
+ );
114
+ const result = spawnSync(
115
+ // oxlint-disable-next-line effecttsgo/process-env -- Test selects the installed Bun executable.
116
+ process.env.HI_TEST_BUN_PATH ?? "bun",
117
+ [runner, "--root", root, "--format", "json"],
118
+ {
119
+ encoding: "utf-8",
120
+ // oxlint-disable-next-line effecttsgo/process-env -- Test controls the child process environment.
121
+ env: { ...process.env, PATH: [ambient, process.env.PATH].join(path.delimiter) },
122
+ },
123
+ );
124
+ expect({ status: result.status, stderr: result.stderr }).toStrictEqual({
125
+ status: 0,
126
+ stderr: "",
127
+ });
128
+ expect(decoded(result.stdout)).toMatchObject({ code: 0, status: "clean" });
129
+ });
130
+ });
131
+
89
132
  it.each(["missing", "conflict", "stale", "no-scopes"])(
90
133
  "skips excluded-only work with %s selection",
91
134
  (state) => {
@@ -4,9 +4,9 @@ The command is `hi`; `hint` is an alias. The npm package remains `@punks/cli`.
4
4
 
5
5
  ## `hi init`
6
6
 
7
- Use before repo-aware setup. It seeds docs onboarding, requirements/backlog/spec skills, and the initial wiki structure.
7
+ Use before repo-aware setup. It seeds docs onboarding and requirements/backlog/spec skills.
8
8
 
9
- Activate `$docs-onboarding` after the command. Reconcile a generated wiki root with the real repository layout before writing durable specs or routed docs.
9
+ Activate `$docs-onboarding` after the command. Follow the [existing wiki structure check](wiki-structure.md) before writing durable specs or routed docs. Wiki structure is project-owned; CLI commands do not create or update it.
10
10
 
11
11
  ## `hi scaffold`
12
12
 
@@ -10,9 +10,11 @@ Existing `.devpunks/` artifacts describe project state. Read an artifact only wh
10
10
 
11
11
  ### Init
12
12
 
13
- - inspect the generated docs-onboarding, requirements/backlog/spec skills, and wiki root
14
- - activate `$docs-onboarding`
15
- - reconcile the wiki root with the real repository before durable docs are written
13
+ - inspect the generated docs-onboarding and requirements/backlog/spec skills
14
+ - complete the [existing wiki structure check](wiki-structure.md)
15
+ - when the check reports `pass` for an existing wiki root, activate `$docs-onboarding` against that root
16
+ - when the check reports `not-applicable`, defer onboarding and hand off project-owned wiki creation or selection; resume onboarding after an authorized setup produces an existing wiki that passes the check
17
+ - when the check reports `fail` or a blocker, report the required correction before onboarding can proceed
16
18
  - reconcile pre-existing skills only when the command reports relevant evidence
17
19
  - do not start requirements discovery unless the user asks for it
18
20
  - run `hi scaffold` only when the repository is ready for repo-aware setup
@@ -46,7 +48,8 @@ Then:
46
48
  - keep root `AGENTS.md` table-free; phase wrappers remain global orchestration
47
49
  entrypoints and are excluded from scoped tables
48
50
  - always link `opensrc/README.md` from scoped prompts and read it when work depends on third-party library behavior
49
- - reconcile only the generated skills, prompts, lint, hooks, scripts, subagents, tools, and wiki assets in scope
51
+ - reconcile only the generated skills, prompts, lint, hooks, scripts, subagents, and tools in scope
52
+ - complete the [existing wiki structure check](wiki-structure.md)
50
53
  - for lint output, complete [managed lint selection and adoption](managed-lint.md); saved owners and verified routes are the completion evidence
51
54
  - preserve repo-owned edits and ask before changing project policy
52
55
  - run targeted validation for the outputs reconciled
@@ -75,22 +78,22 @@ Read the command summary before any generated artifact. If it reports no diff an
75
78
 
76
79
  For a diff, inspect only paths changed or flagged by this run. Apply every matching row:
77
80
 
78
- | Changed category | Required follow-through |
79
- | ---------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
80
- | Settings or manifest pins only | Confirm accepted pins; changed lint settings require scope/route reconciliation in [managed-lint.md](managed-lint.md). |
81
- | Skill content; IDs unchanged | Inspect affected skills and active mirrors only. |
82
- | Skill added, removed, or renamed | Reconcile affected IDs and their mirrors. |
83
- | `local-edited` conflict | Preserve local intent; ask when project and baseline intent conflict. |
84
- | Missing or stale path | Confirm the named recreation or deletion and direct references. |
85
- | Prompt or Rule Registry input | Activate `$writing-for-agents`, then `$rule-authoring`; reconcile only affected scopes and mirrors. |
86
- | Subagent input | Reconcile only generated and final subagent manifests. |
87
- | Lint, hook, or script input | Follow [managed lint adoption](managed-lint.md#reconcile-lint-adoption); validate affected routes and preserve accepted project policy. |
88
- | Required tools | Check only added, changed, or failed tools. |
89
- | Source-guide content | Inspect only affected guide files. |
90
- | Wiki input | Reconcile affected routes or documents, then validate them. |
91
- | Default or detected pack addition | Follow only categories changed by that addition. |
92
- | Optional/removal/policy/surface decision | Ask for the unresolved decision. |
93
- | First adoption or missing final output | Run applicable scaffold follow-through. |
81
+ | Changed category | Required follow-through |
82
+ | ----------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
83
+ | Settings or manifest pins only | Confirm accepted pins; changed lint settings require scope/route reconciliation in [managed-lint.md](managed-lint.md). |
84
+ | Skill content; IDs unchanged | Inspect affected skills and active mirrors only. |
85
+ | Skill added, removed, or renamed | Reconcile affected IDs and their mirrors. |
86
+ | `local-edited` conflict | Preserve local intent; ask when project and baseline intent conflict. |
87
+ | Missing or stale path | Confirm the named recreation or deletion and direct references. |
88
+ | Prompt or Rule Registry input | Activate `$writing-for-agents`, then `$rule-authoring`; reconcile only affected scopes and mirrors. |
89
+ | Subagent input | Reconcile only generated and final subagent manifests. |
90
+ | Lint, hook, or script input | Follow [managed lint adoption](managed-lint.md#reconcile-lint-adoption); validate affected routes and preserve accepted project policy. |
91
+ | Required tools | Check only added, changed, or failed tools. |
92
+ | Source-guide content | Inspect only affected guide files. |
93
+ | Wiki guidance, routes, content schema, source documents, or sync inputs | Complete the [existing wiki structure check](wiki-structure.md) for the affected paths and their routed copies. |
94
+ | Default or detected pack addition | Follow only categories changed by that addition. |
95
+ | Optional/removal/policy/surface decision | Ask for the unresolved decision. |
96
+ | First adoption or missing final output | Run applicable scaffold follow-through. |
94
97
 
95
98
  After write modes, run targeted validation and one fresh `hi check --json`. Rerun `hi update` once only when that check detects new CLI or baseline drift, then finish with one final `hi check --json`.
96
99
 
@@ -146,7 +149,7 @@ Before completing reconciliation, compare existing project-owned paths and bytes
146
149
 
147
150
  ## 3. Complete the Branch
148
151
 
149
- - init: generated onboarding/skills/wiki state is reported and the next bounded action is clear
152
+ - init: generated skills and existing wiki check are reported; onboarding runs only after a passing check, otherwise the wiki setup or correction handoff is clear
150
153
  - scaffold: applicable generated instructions are reconciled, targeted validation ran, and unresolved policy choices are named
151
154
  - check: current drift is reported without writes
152
155
  - ensure: settings were reconfigured or the exact blocker is reported
@@ -0,0 +1,16 @@
1
+ # Existing Wiki Structure Check
2
+
3
+ Run after `hi init` and `hi scaffold`. After `hi update`, run when changed or flagged paths affect wiki guidance, routes, content schema, canonical source documents, or content synchronization. Limit update checks to those paths and their routed copies.
4
+
5
+ 1. Resolve the existing wiki root from project guidance and the repository. If no wiki exists, report `not-applicable`; creating a wiki is separate project work.
6
+ 2. Read the nearest `AGENTS.md`, matching Rule Registry entries, and the project's docs/wiki runbook. Use its current content configuration and sync script to resolve source ownership. These project standards define the expected structure; a baseline template does not.
7
+ 3. Check the applicable standards:
8
+ - routed pages belong to the project's accepted article tree and navigation metadata;
9
+ - pages have schema-valid frontmatter and resolved links;
10
+ - source specifications, raw inputs, and ingest bookkeeping use their declared locations;
11
+ - canonical documentation and generated wiki copies have clear ownership and remain synchronized;
12
+ - deliberate project/domain routes and authored content remain intact.
13
+ 4. Run the project's documented checks for content, links, navigation, and source synchronization. Use a check or dry-run mode for sync scripts. Inspect the proposed diff for loss of durable pages before any separately authorized synchronization.
14
+ 5. Report `pass`, `fail`, or `not-applicable`, the wiki root, standards consulted, commands and results, and each concrete mismatch with its path and required correction. If a required check cannot run, report the exact blocker; do not call the structure verified.
15
+
16
+ This handoff inspects project-owned wiki structure. Preserve its files, route decisions, and framework configuration unless the current task already authorizes a specific repair. CLI scaffold/update ownership does not extend to wiki creation, replacement, or cleanup.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: docs-onboarding
3
- description: Onboard an existing project into a scaffolded Harness wiki by inspecting code, docs, and backlog context, building a Project Map, closing a targeted requirements grill, compiling specs, then projecting them to the backlog. Use immediately after hi init or when an existing repository needs initial wiki/spec context reconstructed.
3
+ description: Onboard an existing project into the scaffolded Harness wiki by inspecting code, docs and backlog, closing reconstruction decisions, then compiling architecture/spec pairs through requirements-phase. Use after hi init or when initial wiki/spec context must be reconstructed.
4
4
  ---
5
5
 
6
6
  # Docs Onboarding
@@ -14,8 +14,9 @@ routed `requirements-grill` status artifact. Preserve its canonical terms;
14
14
  route proposed terminology changes through `requirements-grill` instead of
15
15
  silently renaming them.
16
16
 
17
- 1. Read repo guidance and the scaffolded wiki guidance.
18
- 2. Read `<wiki-root>/backlog-provider.md` and `<wiki-root>/wiki-framework.md`.
17
+ 1. Read repo guidance and the existing project-owned wiki guidance.
18
+ 2. Read any existing backlog provider and wiki framework decisions. Resolve
19
+ their locations from project guidance; `hi init` does not generate those files.
19
20
  3. Discover backlog context:
20
21
  - Probe the pinned remote backlog provider first when connector/tool/auth access exists.
21
22
  - Inspect local backlog clues after that: existing specs, issue matrices, backlog markdown, project docs, and `.devpunks` metadata.
@@ -28,16 +29,17 @@ silently renaming them.
28
29
  Product/Backlog Root, Product Areas, Initiatives, `V*` context, and saved
29
30
  views from accepted wiki and provider evidence.
30
31
  7. For every candidate existing flow accepted by the onboarding grill, invoke
31
- `create-spec` and record its readiness result. Project an agent-ready spec
32
- with `write-backlog` only when the reconstructed evidence already supplies
33
- the exact existing Epic/Story and accepted projection authority required by
34
- that branch. Otherwise record the missing authority and exact human Finder
35
- invocation; retain the compiled spec without provider mutation.
36
- 8. Leave new feature work to explicit human invocation of Business or
37
- Functional Finder. Onboarding never invokes a Finder
38
- implicitly.
39
-
40
- For the required Project Map sections, onboarding artifacts, evidence labels, and spec reconstruction rules, read [references/artifact-contract.md](references/artifact-contract.md).
32
+ `requirements-phase` with its confirmed status/log and Project Map evidence.
33
+ Require `create-architecture` before `create-spec`, then record the retained
34
+ pair and its readiness result. Pass the onboarding projection boundary:
35
+ an agent-ready spec and its mapped architecture may reach `write-backlog`
36
+ only when reconstructed evidence already supplies the exact existing Epic/Story
37
+ and accepted projection authority required by that branch. Otherwise record
38
+ the missing authority and exact human Finder invocation; retain the compiled
39
+ pair and return a blocked backlog delta without provider mutation. Onboarding
40
+ never invokes a Finder implicitly and does not create higher-level placement.
41
+ 8. Update onboarding navigation and indexes using
42
+ [references/artifact-contract.md](references/artifact-contract.md).
41
43
 
42
44
  ## Discovery Depth
43
45
 
@@ -47,9 +49,12 @@ Do not deep-read every implementation file by default. Deep-read implementation
47
49
 
48
50
  ## Targeted Grill
49
51
 
50
- Grill contradictions, missing backlog location, unclear feature ownership, and high-impact inferred requirements before `create-spec` runs.
51
-
52
- Low-risk current-state facts can proceed into `create-spec` as `Inferred`. Keep code-only low-risk facts `Inferred` unless the developer confirms them or unambiguous docs/backlog intent backs them.
52
+ Grill contradictions, missing backlog location, unclear feature ownership and
53
+ inferred requirements before either compiler runs. Observed code-only facts may
54
+ remain `Inferred` in the Project Map as evidence; they become accepted requirements
55
+ or design choices only through confirmed intent and the recorded grill decisions.
56
+ Pass unresolved material decisions back to `requirements-phase`; an inferred
57
+ current implementation is not permission to choose architecture or requirements.
53
58
 
54
59
  ## Resumability
55
60
 
@@ -1,4 +1,4 @@
1
1
  interface:
2
2
  display_name: "Docs Onboarding"
3
3
  short_description: "Reconstruct project wiki/spec context"
4
- default_prompt: "Use $docs-onboarding to inspect code, docs, and backlog context, build the Project Map, close the targeted requirements grill, compile agent-ready specs with create-spec, then project written specs with write-backlog."
4
+ default_prompt: "Use $docs-onboarding to inspect code, docs, and backlog context, build the Project Map, close the targeted requirements grill, pass confirmed sources through requirements-phase for create-architecture then create-spec, then project written specs with write-backlog within accepted onboarding placement authority."
@@ -46,7 +46,7 @@ The targeted grill can close when every blocking contradiction, missing backlog
46
46
 
47
47
  Do not grill every low-risk current-state fact. Carry those into the reconstruction record as `Inferred`, but do not claim agent readiness while a required product decision remains inferred.
48
48
 
49
- ## Reconstructed Specs
49
+ ## Reconstructed Architecture/SPEC Pairs
50
50
 
51
51
  Group reconstructed specs:
52
52
 
@@ -64,6 +64,18 @@ Evidence levels:
64
64
  - `Contradicted`: source evidence conflicts and needs resolution before the spec can be trusted.
65
65
  - `Missing`: expected context was not found, and the spec must ask a follow-up.
66
66
 
67
- Reconstructed specs must link back to relevant Project Map sections and onboarding grill decisions.
68
-
69
- Only specs that pass `create-spec` readiness and return a verified stable blob URL may be projected by `write-backlog`. A `spec-not-ready` result returns its named gaps to onboarding; it produces neither a partial spec nor backlog mutations.
67
+ Reconstructed architecture/spec pairs must link back to relevant Project Map sections and onboarding grill decisions.
68
+
69
+ Pass confirmed candidates to `requirements-phase`, which compiles architecture
70
+ before spec and completes the canonical spec-to-architecture-to-question mapping.
71
+ Retain both immutable artifact URLs, the final architecture identity in the spec,
72
+ and links to the relevant Project Map evidence and exact grill question entries.
73
+ `Inferred` facts remain attributed evidence, not accepted design or requirements.
74
+ `Contradicted` or `Missing` material inputs block compilation until resolved.
75
+
76
+ Only specs that pass `create-spec` readiness, resolve their complete architecture
77
+ mapping and return a verified stable blob URL may be projected by `write-backlog`,
78
+ within onboarding's existing placement authority. Missing authority blocks only
79
+ projection; retain the compiled pair and name the exact human Finder invocation.
80
+ An `architecture-not-ready` or `spec-not-ready` result returns its named gaps to
81
+ onboarding; it produces neither partial canonical artifacts nor backlog mutations.