@punks/cli 5.2.0 → 5.2.1

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 (31) hide show
  1. package/dist/BASELINE_CHANGELOG.md +9 -1
  2. package/dist/CHANGELOG.md +17 -0
  3. package/dist/baseline/scaffold-baseline/baseline.json +5 -5
  4. package/dist/baseline/scaffold-baseline/data/hooks/format-edited-file.mjs +408 -309
  5. package/dist/baseline/scaffold-baseline/data/scripts/commit-gate-runner.d.ts +1 -0
  6. package/dist/baseline/scaffold-baseline/data/scripts/commit-gate-runner.mjs +98 -27
  7. package/dist/baseline/scaffold-baseline/data/scripts/commit-gate-runner.test.ts +156 -8
  8. package/dist/baseline/scaffold-baseline/data/scripts/managed-lint-runner.d.mts +55 -0
  9. package/dist/baseline/scaffold-baseline/data/scripts/managed-lint-runner.mjs +323 -0
  10. package/dist/baseline/scaffold-baseline/data/scripts/managed-lint-runner.test.ts +821 -0
  11. package/dist/baseline/scaffold-baseline/data/scripts/managed-lint.d.mts +97 -0
  12. package/dist/baseline/scaffold-baseline/data/scripts/managed-lint.mjs +658 -0
  13. package/dist/baseline/scaffold-baseline/data/scripts/managed-lint.test.ts +614 -0
  14. package/dist/baseline/scaffold-baseline/skills/agnostic/cli/hi-cli/SKILL.md +2 -0
  15. package/dist/baseline/scaffold-baseline/skills/agnostic/cli/hi-cli/references/commands.md +6 -7
  16. package/dist/baseline/scaffold-baseline/skills/agnostic/cli/hi-cli/references/managed-lint.md +165 -0
  17. package/dist/baseline/scaffold-baseline/skills/agnostic/cli/hi-cli/references/post-command-flow.md +20 -19
  18. package/dist/baseline/scaffold-baseline.json +5 -5
  19. package/dist/baseline/scaffold-baseline.tgz +0 -0
  20. package/dist/data/hooks/format-edited-file.mjs +237 -325
  21. package/dist/data/scripts/commit-gate-runner.mjs +98 -27
  22. package/dist/data/scripts/managed-lint-runner.d.mts +55 -0
  23. package/dist/data/scripts/managed-lint-runner.mjs +323 -0
  24. package/dist/data/scripts/managed-lint.d.mts +97 -0
  25. package/dist/data/scripts/managed-lint.mjs +658 -0
  26. package/dist/index.js +72 -97
  27. package/dist/skills/agnostic/cli/hi-cli/SKILL.md +2 -0
  28. package/dist/skills/agnostic/cli/hi-cli/references/commands.md +6 -7
  29. package/dist/skills/agnostic/cli/hi-cli/references/managed-lint.md +165 -0
  30. package/dist/skills/agnostic/cli/hi-cli/references/post-command-flow.md +6 -5
  31. package/package.json +1 -1
@@ -27,6 +27,8 @@ Read [references/commands.md](references/commands.md) when choosing or explainin
27
27
 
28
28
  ## Workflow
29
29
 
30
+ For managed lint setup, scope changes, policy migration, conflicting commands, or stale-policy findings, read [references/managed-lint.md](references/managed-lint.md). Complete explicit scope selection before dependent lint adoption; `--yes` does not supply that decision.
31
+
30
32
  1. Run the bounded command requested by the user.
31
33
  2. Classify its result as init, scaffold, check, ensure, update, tools ensure, report, upgrade, or operator.
32
34
  3. Follow only that branch in [references/post-command-flow.md](references/post-command-flow.md).
@@ -12,17 +12,17 @@ Activate `$docs-onboarding` after the command. Reconcile a generated wiki root w
12
12
 
13
13
  Use for repo-aware AI setup. It detects the repository, resolves packs, and writes managed `.agents/`, `.devpunks/`, skill, prompt, lint, subagent, tool, and scaffold-manifest assets.
14
14
 
15
- The command does not finish repo-specific authoring. Reconcile its generated instructions with the real repository. Use `hi scaffold --yes` only when a non-interactive harness must accept the resolved default pack selection; it does not select optional packs or resolve policy choices.
15
+ The command does not finish repo-specific authoring. Reconcile its generated instructions with the real repository. Use `hi scaffold --yes` only when a non-interactive harness must accept the resolved default pack selection; it does not select optional packs or resolve policy choices. Managed lint requires saved `lint.scopes`; missing selection is actionable work, while `[]` deliberately selects none. Follow [managed-lint.md](managed-lint.md) for candidate inventory, settings authoring, and policy reconciliation.
16
16
 
17
17
  ## `hi check`
18
18
 
19
- Use as the preferred read-only drift command. It checks managed scaffold, baseline, and CLI drift without writing files.
19
+ Use as the preferred read-only drift command. It checks managed scaffold, baseline, CLI, and managed lint selection/route health without writing files. An installed baseline identity alone does not establish correct live lint policy.
20
20
 
21
- Report the current findings. A clean result needs no update follow-through.
21
+ Report the current findings. For missing selection, stale policy, or command/config conflicts, use the matching next action in [managed-lint.md](managed-lint.md#interpret-the-result). A clean result needs no update follow-through; basic health inspection is not a whole-repository lint run.
22
22
 
23
23
  ## `hi ensure`
24
24
 
25
- Use to reconfigure repository manager, backlog provider, asset provider, and backlog project URL settings in an existing Harness setup.
25
+ Use to reconfigure repository manager, backlog provider, asset provider, backlog project URL, and managed lint ownership in an existing Harness setup. The managed lint choice keeps saved selection or accepts JSON arrays of exact Software Scopes and Excluded Paths. Inventory candidates through [managed-lint.md](managed-lint.md#select-software-scopes) before entering those arrays; preserve unrelated settings.
26
26
 
27
27
  It does not install, repair, validate, or refresh external tools. Use `hi tools ensure` for tools.
28
28
 
@@ -30,11 +30,10 @@ It does not install, repair, validate, or refresh external tools. Use `hi tools
30
30
 
31
31
  Use to refresh scaffold-managed files recorded in `.devpunks/scaffold-manifest.json`.
32
32
 
33
- - `--write` applies accepted managed-file updates.
34
- - `--yes` applies them non-interactively.
33
+ - Normal `hi update` applies updates; `--write` and `--yes` are compatibility apply aliases.
35
34
  - `--check` remains a supported compatibility preview, but prefer `hi check` for read-only drift inspection.
36
35
 
37
- After a write, follow only the changed categories in [post-command-flow.md](post-command-flow.md).
36
+ For lint changes, follow [managed-lint.md](managed-lint.md#reconcile-lint-adoption): preview the complete dependent change, preserve project policy, and distinguish source findings from failures that block activation. After a write, follow only the changed categories in [post-command-flow.md](post-command-flow.md).
38
37
 
39
38
  ## `hi tools ensure`
40
39
 
@@ -0,0 +1,165 @@
1
+ # Managed lint
2
+
3
+ Use this flow for lint setup, changed software ownership, policy migration, or a
4
+ lint selection/route finding from scaffold, update, or check. Keep the work within
5
+ the current command's scope. Existing accepted decisions remain authoritative.
6
+
7
+ ## Select Software Scopes
8
+
9
+ 1. Inventory shallow `apps/*` and `packages/*` packages, declared workspaces,
10
+ and any deliberately selected root or custom package layout. Inspect each
11
+ candidate's manifest, source, and command/install context. Candidates are
12
+ evidence; a workspace glob or recursively found manifest is not permission to
13
+ lint a project. Record which candidates own application/library software and
14
+ which are documentation or embedded example/fixture projects.
15
+ 2. Save exact repository-relative package roots in `.devpunks/settings.json`
16
+ under `lint.scopes`, with repository-relative file/directory glob exclusions
17
+ under `lint.exclude`. Use the existing init/ensure settings flow or authorized
18
+ settings authoring, preserving unrelated fields. `hi ensure` accepts JSON
19
+ arrays for both. Complete this step when every selected owner has a contained
20
+ `package.json` and a supported JavaScript/TypeScript command/install context.
21
+ 3. Validate the selection through the normal scaffold/update/check flow. Resolve
22
+ invalid, missing, moved, escaping, or aliased owners before dependent lint
23
+ activation. `--yes` supplies neither a missing selection nor permission to
24
+ select all candidates. Keep derived framework and route data out of settings.
25
+
26
+ Merge the `lint` object into existing settings; this is an example, not a default
27
+ selection:
28
+
29
+ ```json
30
+ {
31
+ "lint": {
32
+ "scopes": ["apps/api", "apps/web", "packages/core"],
33
+ "exclude": ["apps/api/fixtures/embedded/**", "examples/demo/**"]
34
+ }
35
+ }
36
+ ```
37
+
38
+ | Setting or layout | Meaning |
39
+ | --- | --- |
40
+ | Missing `lint` or `lint.scopes` | Selection is required; do not infer an empty list or recursive enrollment. |
41
+ | `"scopes": []` | Intentionally no managed JavaScript/TypeScript ownership; existing Python/Ruff routing remains independent. |
42
+ | Omitted `lint.exclude` | Empty exclusion list; hard boundaries still apply. |
43
+ | `"scopes": ["."]` | Root application explicitly owns eligible root software. Root tooling dependencies alone do not justify this choice. |
44
+ | `"scopes": ["app/backend/core"]` | Exact custom package root; execution is not limited to conventional layouts. |
45
+ | No root `package.json` | Select supported nested packages; do not create a root package just to qualify. |
46
+
47
+ Use normalized paths with deterministic ordering and deduplication. Absolute or
48
+ escaping paths, unresolved manifest roots, and canonical aliases that escape or
49
+ duplicate an owner are invalid.
50
+
51
+ `wiki`, `app/wiki`, and `apps/wiki`, including descendants, are hard exclusions.
52
+ Selecting one is invalid even when a workspace declaration includes it. Save
53
+ other documentation and embedded project exclusions explicitly. An unselected
54
+ nested package/project boundary is outside its ancestor's source ownership;
55
+ enumerating boundaries for exclusion does not enroll or analyze those projects.
56
+ Ordinary `test`, `tests`, `.test`, and `.spec` source stays eligible. A directory
57
+ name containing `wiki` or `test` is not by itself a universal exclusion.
58
+
59
+ Each eligible file belongs to the most-specific selected owner once. A selected
60
+ `.` excludes nested boundaries and more-specific owners; an unselected root only
61
+ dispatches. Persistent exclusions win over selections and rule overrides. New
62
+ source within an owner is covered; new packages require deliberate selection.
63
+
64
+ ## Preserve Project Lint Policy
65
+
66
+ Inventory existing configs, explicit script config arguments, parent policy,
67
+ renamed shared inputs such as `oxlint.base.json`, and transitive `extends`.
68
+ Retain compatible authored JSON/JSONC at its original project-owned path and
69
+ compose it as an explicit input. `oxlint.project.json` is the convention for
70
+ **new** policy, not a mandatory rename or a generated copy of existing policy.
71
+
72
+ One `<scope>/oxlint.config.ts` is the owner's effective execution target. It
73
+ composes applicable Harness defaults and local framework assets, then deliberate
74
+ project choices. The resulting rules, settings, exclusions, and failure semantics
75
+ are the Effective Lint Policy. Shared policy remains reusable input. Preserve severities and
76
+ options, categories, overrides, ignores, environments, globals, plugin/settings
77
+ references, and applicable typed settings throughout the inherited chain.
78
+ Relative extends, globs, and plugin paths must retain their meaning; copying
79
+ bytes to a new directory is insufficient. Preview added defaults and semantic
80
+ differences. Preserve opaque/dynamic policy and report a migration conflict when
81
+ composition cannot be verified safely.
82
+
83
+ Framework lint needs owner-local evidence: manifest, source usage, framework/test
84
+ config, or an explicit command relationship to shared tooling. Root installation,
85
+ hoisted/transitive dependencies, a frontend-like name, and broad agent guidance
86
+ packs do not authorize execution. React email use may justify React without
87
+ Next/TanStack; Jest does not establish Vitest. Keep reasons in derived selection
88
+ evidence, not a second settings registry.
89
+
90
+ ## Verify Lint Routes
91
+
92
+ Read the affected derived routes in `.devpunks/specs/lint/selection.json` alongside the
93
+ command's evidence. Each Lint Route binds owner, cwd, explicit effective config,
94
+ project-local supported tool/version, exclusions, and failure threshold.
95
+ Regenerate through normal reconciliation; do not hand-author these routes.
96
+
97
+ Package scripts, root dispatch, CI invoking those scripts, Lefthook, edited-file
98
+ verification, and update validation must consume the same route. Managed Oxlint
99
+ uses the explicit config with nested discovery disabled. Root dispatch adds no
100
+ second `.` or recursive lint pass. Resolve tool failures in the named local
101
+ context; never substitute a global or freshly downloaded latest binary.
102
+
103
+ Compare verification on identical bytes, file sets, toolchain, and check mode.
104
+ Edited-file formatting and safe fixes can change bytes, so compare the subsequent
105
+ verification stage. Diagnostic severity and failure threshold are separate:
106
+ new generated lint retains `--max-warnings 0`; represented project thresholds
107
+ must agree across routes. An unrepresentable threshold is a migration conflict.
108
+ Keep precommit format checks read-only and edited-file safety/retry limits intact.
109
+
110
+ Apply exclusions before coverage or empty-work detection. Excluded-only changes
111
+ run no managed lint or formatter; mixed changes check eligible work once per
112
+ owner and check kind. Renames affect both endpoints; deletion checks use the
113
+ owner without passing nonexistent files. Shared settings, policy, routing, and
114
+ toolchain inputs trigger their dependent owners even outside owned source.
115
+ Existing Python tooling keeps its own routing while honoring shared exclusions.
116
+
117
+ ## Reconcile Lint Adoption
118
+
119
+ 1. Preview selected scopes/exclusions, preserved policy inputs, effective configs,
120
+ scripts/hooks, dependency changes, and proposed retirements together. Inventory
121
+ known lint/check aliases, repository checks, and CI commands. Keep compatible
122
+ custom commands only when their canonical route and threshold are verified;
123
+ preserve incompatible or opaque commands and report the exact conflict.
124
+ 2. Validate the complete isolated candidate through the route intended for live
125
+ use. Configuration, local-tool, process, authority, containment, or incomplete
126
+ candidate failures block dependent activation. Source lint findings remain
127
+ preview findings; they neither prove broken configuration nor authorize bulk
128
+ autofixes. Independent completed work retains its own truthful receipt.
129
+ 3. Apply through normal scaffold/update reconciliation and recovery. Retire only
130
+ receipt-owned, unmodified obsolete assets or owned script fragments after
131
+ verifying preserved project policy. Exclusion alone never authorizes deletion.
132
+ Keep modified and unowned policy intact. Preserve `commitGate: "disabled"`,
133
+ consumer hooks, and other hook-manager coexistence decisions.
134
+ 4. Run affected validation and a fresh read-only `hi check --json`. Record actual
135
+ adoption and remaining conflicts; candidate success or planned writes alone
136
+ are insufficient. Check repeat reconciliation for recreated wiki/fixture lint
137
+ output. Follow the bounded update retry rule in
138
+ [post-command-flow.md](post-command-flow.md#update).
139
+
140
+ Proof depends on scopes/exclusions, routes, transitive policy, generated configs,
141
+ presets/plugins, lockfile/toolchain, and relevant source/typed/runtime inputs.
142
+ Changed inputs invalidate affected proof. Installation reuse does not establish
143
+ validation reuse; incomplete reuse identity requires fresh validation.
144
+
145
+ ## Interpret the result
146
+
147
+ | State | Next action |
148
+ | --- | --- |
149
+ | Missing selection | Inventory candidates and save the deliberate scopes/exclusions; dependent lint activation stays pending. |
150
+ | Invalid/moved owner or stale route | Correct the named settings/path issue and reconcile derived output; preserve unsupported content. |
151
+ | Intentional exclusion or no eligible work | Report the excluded path or empty work; this is not proof of repository-wide cleanliness. |
152
+ | Explicit `lint.scopes: []` | Report disabled JavaScript/TypeScript ownership; preserve independent Python/Ruff routing. |
153
+ | Stale Project Lint Policy | Retain the changed input paths; use normal reconciliation to recompile before route execution. Do not edit derived hashes or revert policy merely to pass. |
154
+ | Lint findings | Retain file/rule/severity/location and threshold; repair only authorized source targets. Preview findings do not mean adoption failed operationally. |
155
+ | Config/tool/process failure | Report exact owner, cwd, config, tool/version, command, and diagnostics; repair that boundary before dependent adoption. |
156
+ | Command/policy/ownership conflict | Preserve the named command or file, explain competing authority, and resolve only the outstanding decision within existing authorization. |
157
+ | Healthy routes | Report the observed health scope. Matching installed baseline identity alone is insufficient, and lightweight health is not full lint proof. |
158
+
159
+ `hi check` stays read-only: report the smallest next action and affected paths.
160
+ Run mutations only within the user's authorization. Keep actual diagnostics and
161
+ execution context so the next agent can continue without guessing configs.
162
+
163
+ For a process failure, retain the original exit status, signal, and bounded stdout/stderr alongside the route context. A recognized empty-source JSON report is empty work; malformed output, output overflow, and config/tool failures require repair before dependent adoption.
164
+
165
+ In rootless repositories, assess lint-route health separately from outstanding prompt-authoring findings. A valid selected nested owner does not erase another incomplete scaffold obligation.
@@ -47,6 +47,7 @@ Then:
47
47
  entrypoints and are excluded from scoped tables
48
48
  - always link `opensrc/README.md` from scoped prompts and read it when work depends on third-party library behavior
49
49
  - reconcile only the generated skills, prompts, lint, hooks, scripts, subagents, tools, and wiki assets in scope
50
+ - for lint output, complete [managed lint selection and adoption](managed-lint.md); saved owners and verified routes are the completion evidence
50
51
  - preserve repo-owned edits and ask before changing project policy
51
52
  - run targeted validation for the outputs reconciled
52
53
 
@@ -54,7 +55,7 @@ Do not stop merely because generated files exist.
54
55
 
55
56
  ### Check
56
57
 
57
- Read the current summary only. Report CLI, baseline, managed-file, settings, pack, or tool drift without writing.
58
+ Read the current summary. Report CLI, baseline, managed-file, settings, pack, tool, or managed lint route drift without writing. For lint selection, policy, or command conflicts, follow [result interpretation](managed-lint.md#interpret-the-result) and retain the named owner, paths, and execution context.
58
59
 
59
60
  A clean result is complete. If drift exists, name the matching `hi update`, `hi ensure`, `hi tools ensure`, or `hi upgrade` action without running a mutation unless authorized.
60
61
 
@@ -62,7 +63,7 @@ A clean result is complete. If drift exists, name the matching `hi update`, `hi
62
63
 
63
64
  ### Ensure
64
65
 
65
- Verify only the repository manager, backlog provider, asset provider, backlog project URL, and resulting settings summary.
66
+ Verify the repository manager, backlog provider, asset provider, backlog project URL, and resulting settings summary. When managed lint ownership is in scope, confirm the exact `lint.scopes` and `lint.exclude` arrays using [scope selection](managed-lint.md#select-software-scopes). Saving settings is not evidence that dependent lint routes have been adopted.
66
67
 
67
68
  Do not inspect or mutate external tools. A settings failure is complete when its exact validation or write blocker is reported.
68
69
 
@@ -70,20 +71,20 @@ Do not inspect or mutate external tools. A settings failure is complete when its
70
71
 
71
72
  Apply [Project Verifier preservation](#project-verifier-preservation) before reconciliation.
72
73
 
73
- Read the command summary before any generated artifact. If it reports no diff, report success and stop.
74
+ Read the command summary before any generated artifact. If it reports no diff and no unresolved health or adoption finding, report that result and stop. A matching baseline pin or empty changed-file list alone does not prove live route health.
74
75
 
75
76
  For a diff, inspect only paths changed or flagged by this run. Apply every matching row:
76
77
 
77
78
  | Changed category | Required follow-through |
78
79
  | --- | --- |
79
- | Settings or manifest pins only | Confirm accepted pins. |
80
+ | Settings or manifest pins only | Confirm accepted pins; changed lint settings require scope/route reconciliation in [managed-lint.md](managed-lint.md). |
80
81
  | Skill content; IDs unchanged | Inspect affected skills and active mirrors only. |
81
82
  | Skill added, removed, or renamed | Reconcile affected IDs and their mirrors. |
82
83
  | `local-edited` conflict | Preserve local intent; ask when project and baseline intent conflict. |
83
84
  | Missing or stale path | Confirm the named recreation or deletion and direct references. |
84
85
  | Prompt or Rule Registry input | Activate `$writing-for-agents`, then `$rule-authoring`; reconcile only affected scopes and mirrors. |
85
86
  | Subagent input | Reconcile only generated and final subagent manifests. |
86
- | Lint, hook, or script input | Validate the affected config or command; ask before changing policy. |
87
+ | Lint, hook, or script input | Follow [managed lint adoption](managed-lint.md#reconcile-lint-adoption); validate affected routes and preserve accepted project policy. |
87
88
  | Required tools | Check only added, changed, or failed tools. |
88
89
  | Source-guide content | Inspect only affected guide files. |
89
90
  | Wiki input | Reconcile affected routes or documents, then validate them. |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@punks/cli",
3
- "version": "5.2.0",
3
+ "version": "5.2.1",
4
4
  "description": "Harness Intelligence scaffolding CLI",
5
5
  "homepage": "https://github.com/wearedevpunks/harness-intelligence/tree/main/apps/cli#readme",
6
6
  "bugs": {