@punks/cli 2.1.7 → 2.1.9

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/dist/index.js CHANGED
@@ -51331,185 +51331,6 @@ var runMain2 = runMain;
51331
51331
 
51332
51332
  // ../../node_modules/.bun/@effect+platform-bun@0.89.0+15f69c4693c05b6b/node_modules/@effect/platform-bun/dist/esm/BunRuntime.js
51333
51333
  var runMain3 = runMain2;
51334
- // src/github/issues.ts
51335
- import { execFileSync } from "child_process";
51336
- var githubApiBaseUrl = "https://api.github.com";
51337
- var githubToken = () => {
51338
- const envToken = process.env.GH_TOKEN?.trim() || process.env.GITHUB_TOKEN?.trim();
51339
- if (envToken !== undefined && envToken.length > 0) {
51340
- return envToken;
51341
- }
51342
- try {
51343
- return execFileSync("gh", ["auth", "token"], {
51344
- encoding: "utf8",
51345
- stdio: ["ignore", "pipe", "ignore"]
51346
- }).trim();
51347
- } catch {
51348
- return;
51349
- }
51350
- };
51351
- var githubHeaders = (token) => ({
51352
- accept: "application/vnd.github+json",
51353
- authorization: `Bearer ${token}`,
51354
- "content-type": "application/json",
51355
- "x-github-api-version": "2022-11-28"
51356
- });
51357
- var parseRepository = (repository) => {
51358
- const [owner, repo, extra] = repository.split("/");
51359
- if (owner === undefined || owner.trim().length === 0 || repo === undefined || repo.trim().length === 0 || extra !== undefined) {
51360
- throw new Error("GitHub repository must be in owner/name form.");
51361
- }
51362
- return { owner, repo };
51363
- };
51364
- var labelColor = (label) => {
51365
- if (label === "harness-report") {
51366
- return "5319e7";
51367
- }
51368
- if (label.startsWith("severity:")) {
51369
- return "d93f0b";
51370
- }
51371
- if (label.startsWith("type:")) {
51372
- return "1d76db";
51373
- }
51374
- if (label.startsWith("area:") || label.startsWith("surface:")) {
51375
- return "0e8a16";
51376
- }
51377
- if (label.startsWith("pack:") || label.startsWith("command:")) {
51378
- return "fbca04";
51379
- }
51380
- return "cfd3d7";
51381
- };
51382
- var labelDescription = (label) => label === "harness-report" ? "Created by dp report for Harness maintainer triage." : `dp report classifier: ${label}`;
51383
- var createLabelIfMissing = async ({
51384
- token,
51385
- repository,
51386
- label
51387
- }) => {
51388
- const { owner, repo } = parseRepository(repository);
51389
- const response = await fetch(`${githubApiBaseUrl}/repos/${owner}/${repo}/labels`, {
51390
- method: "POST",
51391
- headers: githubHeaders(token),
51392
- body: JSON.stringify({
51393
- name: label,
51394
- color: labelColor(label),
51395
- description: labelDescription(label)
51396
- })
51397
- });
51398
- if (response.ok || response.status === 422) {
51399
- return;
51400
- }
51401
- throw new Error(`GitHub label setup failed for ${label}: ${response.status}`);
51402
- };
51403
- var createGitHubIssue = async ({
51404
- repository,
51405
- title,
51406
- body,
51407
- labels
51408
- }) => {
51409
- const token = githubToken();
51410
- if (token === undefined || token.length === 0) {
51411
- throw new Error("GitHub auth is required. Run `gh auth login` or set GH_TOKEN/GITHUB_TOKEN.");
51412
- }
51413
- for (const label of labels) {
51414
- await createLabelIfMissing({ token, repository, label });
51415
- }
51416
- const { owner, repo } = parseRepository(repository);
51417
- const response = await fetch(`${githubApiBaseUrl}/repos/${owner}/${repo}/issues`, {
51418
- method: "POST",
51419
- headers: githubHeaders(token),
51420
- body: JSON.stringify({ title, body, labels })
51421
- });
51422
- if (!response.ok) {
51423
- throw new Error(`GitHub issue creation failed: ${response.status}`);
51424
- }
51425
- const issue = await response.json();
51426
- if (typeof issue.number !== "number" || typeof issue.html_url !== "string" || typeof issue.title !== "string") {
51427
- throw new Error("GitHub issue creation returned an unexpected response.");
51428
- }
51429
- return {
51430
- number: issue.number,
51431
- htmlUrl: issue.html_url,
51432
- title: issue.title
51433
- };
51434
- };
51435
-
51436
- // src/telemetry/product.ts
51437
- import { randomUUID } from "crypto";
51438
- import { execFileSync as execFileSync2 } from "child_process";
51439
-
51440
- // src/content/data.ts
51441
- import { existsSync, readFileSync } from "fs";
51442
- import path2 from "path";
51443
- var findFirst8 = (candidates) => candidates.find((candidate) => existsSync(candidate));
51444
- var findBundledPackageRoot = () => {
51445
- let currentDirectory = path2.resolve(import.meta.dirname, "../..");
51446
- while (true) {
51447
- if (existsSync(path2.join(currentDirectory, "package.json"))) {
51448
- return currentDirectory;
51449
- }
51450
- const parentDirectory = path2.dirname(currentDirectory);
51451
- if (parentDirectory === currentDirectory) {
51452
- break;
51453
- }
51454
- currentDirectory = parentDirectory;
51455
- }
51456
- return path2.resolve(import.meta.dirname, "../..");
51457
- };
51458
- var packageRoot = findBundledPackageRoot();
51459
- var runtimeRoot = import.meta.dirname;
51460
- var dataCandidates = [
51461
- path2.join(runtimeRoot, "data"),
51462
- path2.resolve(import.meta.dirname, "../data"),
51463
- path2.join(packageRoot, "src/data"),
51464
- path2.resolve(import.meta.dirname, "../../src/data")
51465
- ];
51466
- var skillCandidates = [
51467
- path2.join(runtimeRoot, "skills"),
51468
- path2.join(packageRoot, "skills"),
51469
- path2.resolve(import.meta.dirname, "../../skills"),
51470
- path2.resolve(import.meta.dirname, "../skills")
51471
- ];
51472
- var resolvedDataRoot = findFirst8(dataCandidates);
51473
- var resolvedSkillsRoot = findFirst8(skillCandidates);
51474
- if (resolvedDataRoot === undefined) {
51475
- throw new Error("Could not locate bundled data directory.");
51476
- }
51477
- if (resolvedSkillsRoot === undefined) {
51478
- throw new Error("Could not locate bundled skills directory.");
51479
- }
51480
- var dataRoot = resolvedDataRoot;
51481
- var skillsRoot = resolvedSkillsRoot;
51482
- var dataPath = (...segments) => path2.join(dataRoot, ...segments);
51483
- var readDataFile = (...segments) => readFileSync(dataPath(...segments), "utf8");
51484
- var readBaselineDataFile = (baselineDataRoot, ...segments) => readFileSync(path2.join(baselineDataRoot, ...segments), "utf8");
51485
- var resolveBaselinePath = ({
51486
- baselineRoot,
51487
- baselineSkillsRoot,
51488
- relativePath
51489
- }) => {
51490
- const resolvedPath = relativePath.startsWith("skills/") ? findFirst8([
51491
- path2.join(baselineSkillsRoot, relativePath.slice("skills/".length)),
51492
- path2.join(baselineRoot, relativePath)
51493
- ]) : findFirst8([path2.join(baselineRoot, relativePath)]);
51494
- if (resolvedPath !== undefined) {
51495
- return resolvedPath;
51496
- }
51497
- throw new Error(`Could not locate baseline asset: ${relativePath}`);
51498
- };
51499
-
51500
- // src/control-plane/config.ts
51501
- var trimTrailingSlashes = (value6) => value6.trim().replace(/\/+$/u, "");
51502
- var bundledControlPlaneUrl = () => {
51503
- if (process.env.DP_DISABLE_BUNDLED_CONTROL_PLANE_URL === "1") {
51504
- return;
51505
- }
51506
- const config2 = JSON.parse(readDataFile("control-plane.json"));
51507
- return typeof config2.defaultUrl === "string" && config2.defaultUrl.trim().length > 0 ? trimTrailingSlashes(config2.defaultUrl) : undefined;
51508
- };
51509
- var resolveControlPlaneUrl = (explicitUrl) => {
51510
- const baseUrl2 = explicitUrl?.trim() || process.env.DP_CONTROL_PLANE_URL?.trim() || bundledControlPlaneUrl();
51511
- return baseUrl2 === undefined || baseUrl2.length === 0 ? undefined : trimTrailingSlashes(baseUrl2);
51512
- };
51513
51334
  // ../../node_modules/.bun/@effect+platform@0.96.1+941c8e2324531656/node_modules/@effect/platform/dist/esm/HttpApiClient.js
51514
51335
  var exports_HttpApiClient = {};
51515
51336
  __export(exports_HttpApiClient, {
@@ -51650,11 +51471,11 @@ var endpoint = (api, options8) => {
51650
51471
  }).pipe(map17(() => client));
51651
51472
  };
51652
51473
  var paramsRegex = /:(\w+)\??/g;
51653
- var compilePath = (path3) => {
51654
- const segments = path3.split(paramsRegex);
51474
+ var compilePath = (path2) => {
51475
+ const segments = path2.split(paramsRegex);
51655
51476
  const len = segments.length;
51656
51477
  if (len === 1) {
51657
- return (_) => path3;
51478
+ return (_) => path2;
51658
51479
  }
51659
51480
  return (params2) => {
51660
51481
  let url2 = segments[0];
@@ -51893,7 +51714,7 @@ var make76 = (method) => (name, ...args2) => {
51893
51714
  });
51894
51715
  }
51895
51716
  return (segments, ...schemas) => {
51896
- let path3 = segments[0].replace(":", "::");
51717
+ let path2 = segments[0].replace(":", "::");
51897
51718
  let pathSchema = none2();
51898
51719
  if (schemas.length > 0) {
51899
51720
  const obj = {};
@@ -51902,13 +51723,13 @@ var make76 = (method) => (name, ...args2) => {
51902
51723
  const key = getParam(schema.ast) ?? String(i);
51903
51724
  const optional5 = schema.ast._tag === "PropertySignatureTransformation" && schema.ast.from.isOptional || schema.ast._tag === "PropertySignatureDeclaration" && schema.ast.isOptional;
51904
51725
  obj[key] = schema;
51905
- path3 += `:${key}${optional5 ? "?" : ""}${segments[i + 1].replace(":", "::")}`;
51726
+ path2 += `:${key}${optional5 ? "?" : ""}${segments[i + 1].replace(":", "::")}`;
51906
51727
  }
51907
51728
  pathSchema = some2(Struct(obj));
51908
51729
  }
51909
51730
  return makeProto3({
51910
51731
  name,
51911
- path: path3,
51732
+ path: path2,
51912
51733
  method,
51913
51734
  pathSchema,
51914
51735
  urlParamsSchema: none2(),
@@ -52247,12 +52068,19 @@ var HarnessReportSeverity = exports_Schema.Literal("low", "medium", "high");
52247
52068
  var HarnessReportStatus = exports_Schema.Literal("new", "triaged", "accepted", "wontfix", "resolved");
52248
52069
 
52249
52070
  class HarnessReportInput extends exports_Schema.Class("HarnessReportInput")({
52250
- title: exports_Schema.String,
52251
- body: exports_Schema.String,
52071
+ title: exports_Schema.optional(exports_Schema.String),
52072
+ body: exports_Schema.optional(exports_Schema.String),
52252
52073
  type: HarnessReportType,
52253
52074
  severity: HarnessReportSeverity,
52254
52075
  createdAt: IsoDateTimeString,
52255
52076
  cliVersion: exports_Schema.String,
52077
+ area: exports_Schema.optional(exports_Schema.String),
52078
+ skillPack: exports_Schema.optional(exports_Schema.String),
52079
+ command: exports_Schema.optional(exports_Schema.String),
52080
+ expected: exports_Schema.optional(exports_Schema.String),
52081
+ actual: exports_Schema.optional(exports_Schema.String),
52082
+ steps: exports_Schema.optional(exports_Schema.String),
52083
+ labels: exports_Schema.optional(exports_Schema.Array(exports_Schema.String)),
52256
52084
  projectUsageId: exports_Schema.optional(exports_Schema.String),
52257
52085
  repository: exports_Schema.optional(ObservedRepositoryInput),
52258
52086
  operator: exports_Schema.optional(OperatorIdentity),
@@ -52263,7 +52091,10 @@ class HarnessReportInput extends exports_Schema.Class("HarnessReportInput")({
52263
52091
  class HarnessReportCreated extends exports_Schema.Class("HarnessReportCreated")({
52264
52092
  reportId: exports_Schema.String,
52265
52093
  status: HarnessReportStatus,
52266
- githubUrl: exports_Schema.optional(exports_Schema.String)
52094
+ githubUrl: exports_Schema.optional(exports_Schema.String),
52095
+ title: exports_Schema.optional(exports_Schema.String),
52096
+ deduplicated: exports_Schema.optional(exports_Schema.Boolean),
52097
+ duplicateOf: exports_Schema.optional(exports_Schema.String)
52267
52098
  }) {
52268
52099
  }
52269
52100
 
@@ -52337,7 +52168,8 @@ class ProjectUsageSummary extends exports_Schema.Class("ProjectUsageSummary")({
52337
52168
  }
52338
52169
 
52339
52170
  class ProjectUsageList extends exports_Schema.Class("ProjectUsageList")({
52340
- projects: exports_Schema.Array(ProjectUsageSummary)
52171
+ projects: exports_Schema.Array(ProjectUsageSummary),
52172
+ reports: exports_Schema.Array(HarnessReportSummary)
52341
52173
  }) {
52342
52174
  }
52343
52175
 
@@ -52403,14 +52235,100 @@ var recordProductTelemetryEvent = (options9) => exports_Effect.gen(function* ()
52403
52235
  payload: options9.event
52404
52236
  });
52405
52237
  });
52238
+ var submitHarnessReport = (options9) => exports_Effect.gen(function* () {
52239
+ const client2 = yield* makeHarnessClient({
52240
+ baseUrl: options9.baseUrl
52241
+ });
52242
+ return yield* client2.reports.submit({
52243
+ payload: options9.report
52244
+ });
52245
+ });
52246
+
52247
+ // src/content/data.ts
52248
+ import { existsSync, readFileSync } from "fs";
52249
+ import path2 from "path";
52250
+ var findFirst8 = (candidates) => candidates.find((candidate) => existsSync(candidate));
52251
+ var findBundledPackageRoot = () => {
52252
+ let currentDirectory = path2.resolve(import.meta.dirname, "../..");
52253
+ while (true) {
52254
+ if (existsSync(path2.join(currentDirectory, "package.json"))) {
52255
+ return currentDirectory;
52256
+ }
52257
+ const parentDirectory = path2.dirname(currentDirectory);
52258
+ if (parentDirectory === currentDirectory) {
52259
+ break;
52260
+ }
52261
+ currentDirectory = parentDirectory;
52262
+ }
52263
+ return path2.resolve(import.meta.dirname, "../..");
52264
+ };
52265
+ var packageRoot = findBundledPackageRoot();
52266
+ var runtimeRoot = import.meta.dirname;
52267
+ var dataCandidates = [
52268
+ path2.join(runtimeRoot, "data"),
52269
+ path2.resolve(import.meta.dirname, "../data"),
52270
+ path2.join(packageRoot, "src/data"),
52271
+ path2.resolve(import.meta.dirname, "../../src/data")
52272
+ ];
52273
+ var skillCandidates = [
52274
+ path2.join(runtimeRoot, "skills"),
52275
+ path2.join(packageRoot, "skills"),
52276
+ path2.resolve(import.meta.dirname, "../../skills"),
52277
+ path2.resolve(import.meta.dirname, "../skills")
52278
+ ];
52279
+ var resolvedDataRoot = findFirst8(dataCandidates);
52280
+ var resolvedSkillsRoot = findFirst8(skillCandidates);
52281
+ if (resolvedDataRoot === undefined) {
52282
+ throw new Error("Could not locate bundled data directory.");
52283
+ }
52284
+ if (resolvedSkillsRoot === undefined) {
52285
+ throw new Error("Could not locate bundled skills directory.");
52286
+ }
52287
+ var dataRoot = resolvedDataRoot;
52288
+ var skillsRoot = resolvedSkillsRoot;
52289
+ var dataPath = (...segments) => path2.join(dataRoot, ...segments);
52290
+ var readDataFile = (...segments) => readFileSync(dataPath(...segments), "utf8");
52291
+ var readBaselineDataFile = (baselineDataRoot, ...segments) => readFileSync(path2.join(baselineDataRoot, ...segments), "utf8");
52292
+ var resolveBaselinePath = ({
52293
+ baselineRoot,
52294
+ baselineSkillsRoot,
52295
+ relativePath
52296
+ }) => {
52297
+ const resolvedPath = relativePath.startsWith("skills/") ? findFirst8([
52298
+ path2.join(baselineSkillsRoot, relativePath.slice("skills/".length)),
52299
+ path2.join(baselineRoot, relativePath)
52300
+ ]) : findFirst8([path2.join(baselineRoot, relativePath)]);
52301
+ if (resolvedPath !== undefined) {
52302
+ return resolvedPath;
52303
+ }
52304
+ throw new Error(`Could not locate baseline asset: ${relativePath}`);
52305
+ };
52306
+
52307
+ // src/control-plane/config.ts
52308
+ var trimTrailingSlashes = (value6) => value6.trim().replace(/\/+$/u, "");
52309
+ var bundledControlPlaneUrl = () => {
52310
+ if (process.env.DP_DISABLE_BUNDLED_CONTROL_PLANE_URL === "1") {
52311
+ return;
52312
+ }
52313
+ const config2 = JSON.parse(readDataFile("control-plane.json"));
52314
+ return typeof config2.defaultUrl === "string" && config2.defaultUrl.trim().length > 0 ? trimTrailingSlashes(config2.defaultUrl) : undefined;
52315
+ };
52316
+ var resolveControlPlaneUrl = (explicitUrl) => {
52317
+ const baseUrl2 = explicitUrl?.trim() || process.env.DP_CONTROL_PLANE_URL?.trim() || bundledControlPlaneUrl();
52318
+ return baseUrl2 === undefined || baseUrl2.length === 0 ? undefined : trimTrailingSlashes(baseUrl2);
52319
+ };
52320
+
52321
+ // src/telemetry/product.ts
52322
+ import { randomUUID } from "crypto";
52323
+ import { execFileSync } from "child_process";
52406
52324
 
52407
52325
  // package.json
52408
52326
  var name = "@punks/cli";
52409
- var version = "2.1.7";
52327
+ var version = "2.1.9";
52410
52328
  // src/telemetry/product.ts
52411
52329
  var git = (cwd, args2) => {
52412
52330
  try {
52413
- return execFileSync2("git", args2, {
52331
+ return execFileSync("git", args2, {
52414
52332
  cwd,
52415
52333
  encoding: "utf8",
52416
52334
  stdio: ["ignore", "pipe", "ignore"]
@@ -52674,8 +52592,8 @@ var renderCommandGuide = () => [
52674
52592
  " \u2022 reconcile the seeded wiki into the real repo layout before writing durable docs",
52675
52593
  " \u2022 use `punks scaffold setup` for repo-aware pack detection after repo boilerplate is ready",
52676
52594
  " \u2022 use `punks update` after setup to pull newer scaffolded skills/prompts/manifests/hooks",
52677
- " \u2022 use `punks report` when reusable Harness friction should enter the support loop",
52678
- " \u2022 reports open GitHub issues; authenticate with `gh auth login` or `GITHUB_TOKEN`",
52595
+ " \u2022 use `punks report` when reusable Harness friction should enter backoffice triage",
52596
+ " \u2022 public reports are stored internally; GitHub issues require authenticated backoffice triage",
52679
52597
  "",
52680
52598
  "operator notes:",
52681
52599
  " \u2022 init copies only requirements/backlog skills, backlog-provider pin, and the initial wiki structure",
@@ -52786,9 +52704,9 @@ var renderJsonLabel = () => paint(`${brandPalette.bold}${brandPalette.lilac}`, "
52786
52704
  var renderDivider = () => paint(`${brandPalette.dim}${brandPalette.border}`, "\u2500".repeat(sectionWidth));
52787
52705
 
52788
52706
  // src/cli/report-command.ts
52789
- var harnessReportsRepository = "wearedevpunks/harness-intelligence";
52790
- var titleOption = exports_Options.text("title").pipe(exports_Options.withDescription("Short GitHub issue title for Harness maintainer triage."));
52791
- var bodyOption = exports_Options.text("body").pipe(exports_Options.withDescription("Narrative report body with the observed friction."));
52707
+ var messageOption = exports_Options.optional(exports_Options.text("message").pipe(exports_Options.withDescription("Raw report text for Harness triage.")));
52708
+ var titleOption = exports_Options.optional(exports_Options.text("title").pipe(exports_Options.withDescription("Deprecated: optional title hint. The API generates the final title.")));
52709
+ var bodyOption = exports_Options.optional(exports_Options.text("body").pipe(exports_Options.withDescription("Deprecated: optional body hint. The API generates the final body.")));
52792
52710
  var typeOption = exports_Options.choice("type", [
52793
52711
  "bug",
52794
52712
  "docs",
@@ -52807,7 +52725,6 @@ var areaOption = exports_Options.choice("area", [
52807
52725
  "other"
52808
52726
  ]).pipe(exports_Options.withDefault("other"), exports_Options.withDescription("Harness area."));
52809
52727
  var repoRootOption = exports_Options.text("repo-root").pipe(exports_Options.withDefault(process.cwd()), exports_Options.withDescription("Repository root used for safe git context."));
52810
- var repositoryOption = exports_Options.text("repository").pipe(exports_Options.withDefault(harnessReportsRepository), exports_Options.withDescription("GitHub repository that receives report issues."));
52811
52728
  var skillPackOption = exports_Options.optional(exports_Options.text("skill-pack").pipe(exports_Options.withDescription("Affected skill pack, for example `dp-cli` or `docs-ingest-phase`.")));
52812
52729
  var commandOption = exports_Options.optional(exports_Options.text("command").pipe(exports_Options.withDescription("Affected CLI command, for example `dp report` or `dp scaffold init`.")));
52813
52730
  var expectedOption = exports_Options.optional(exports_Options.text("expected").pipe(exports_Options.withDescription("Expected behavior.")));
@@ -52828,16 +52745,33 @@ var csvLabels = (value6) => value6 === undefined ? [] : value6.split(",").map((l
52828
52745
  var buildHarnessReport = ({
52829
52746
  title,
52830
52747
  body,
52748
+ message,
52831
52749
  type: type2,
52832
52750
  severity,
52833
- repoRoot
52751
+ area,
52752
+ repoRoot,
52753
+ skillPack,
52754
+ command,
52755
+ expected,
52756
+ actual,
52757
+ steps,
52758
+ labels
52834
52759
  }) => ({
52835
- title: nonEmpty(title, "title"),
52836
- body: nonEmpty(body, "body"),
52760
+ ...title === undefined ? {} : { title },
52761
+ body: nonEmpty(body ?? message ?? [actual, expected, steps].filter(Boolean).join(`
52762
+
52763
+ `), "body"),
52837
52764
  type: type2,
52838
52765
  severity,
52839
52766
  createdAt: new Date().toISOString(),
52840
52767
  cliVersion: version,
52768
+ area,
52769
+ ...skillPack === undefined ? {} : { skillPack },
52770
+ ...command === undefined ? {} : { command },
52771
+ ...expected === undefined ? {} : { expected },
52772
+ ...actual === undefined ? {} : { actual },
52773
+ ...steps === undefined ? {} : { steps },
52774
+ ...labels === undefined ? {} : { labels },
52841
52775
  repository: observedRepository(repoRoot)
52842
52776
  });
52843
52777
  var buildHarnessReportLabels = ({
@@ -52861,76 +52795,14 @@ var buildHarnessReportLabels = ({
52861
52795
  ].filter((label) => label !== undefined && label.length > 0);
52862
52796
  return [...new Set(labels)];
52863
52797
  };
52864
- var buildHarnessReportIssueBody = ({
52865
- report,
52866
- area,
52867
- skillPack,
52868
- command,
52869
- expected,
52870
- actual,
52871
- steps
52872
- }) => {
52873
- const metadata = {
52874
- schema: "harness-report.v1",
52875
- type: report.type,
52876
- severity: report.severity,
52877
- area,
52878
- skillPack,
52879
- command,
52880
- createdAt: report.createdAt,
52881
- cliVersion: report.cliVersion,
52882
- repository: report.repository
52883
- };
52884
- const optionalSections = [
52885
- expected === undefined ? undefined : `## Expected
52886
-
52887
- ${expected}`,
52888
- actual === undefined ? undefined : `## Actual
52889
-
52890
- ${actual}`,
52891
- steps === undefined ? undefined : `## Evidence / Steps
52892
-
52893
- ${steps}`
52894
- ].filter((section) => section !== undefined);
52895
- return [
52896
- "<!-- harness-report",
52897
- JSON.stringify(metadata, null, 2),
52898
- "-->",
52899
- `## Summary
52900
-
52901
- ${report.body}`,
52902
- ...optionalSections,
52903
- "## Classification",
52904
- [
52905
- `- Type: ${report.type}`,
52906
- `- Severity: ${report.severity}`,
52907
- `- Area: ${area}`,
52908
- skillPack === undefined ? undefined : `- Skill pack: ${skillPack}`,
52909
- command === undefined ? undefined : `- Command: ${command}`,
52910
- `- CLI version: ${report.cliVersion}`
52911
- ].filter((line4) => line4 !== undefined).join(`
52912
- `),
52913
- "## Observed Repository",
52914
- [
52915
- `- Remote: ${report.repository?.remoteUrl ?? "unknown"}`,
52916
- `- Host: ${report.repository?.remoteHost ?? "unknown"}`,
52917
- `- Path: ${report.repository?.remotePath ?? "unknown"}`,
52918
- `- Commit: ${report.repository?.commitSha ?? "unknown"}`,
52919
- `- Dirty: ${report.repository?.dirty === undefined ? "unknown" : String(report.repository.dirty)}`
52920
- ].join(`
52921
- `)
52922
- ].join(`
52923
-
52924
- `);
52925
- };
52926
52798
  var reportCommand = exports_Command.make("report", {
52799
+ message: messageOption,
52927
52800
  title: titleOption,
52928
52801
  body: bodyOption,
52929
52802
  type: typeOption,
52930
52803
  severity: severityOption,
52931
52804
  area: areaOption,
52932
52805
  repoRoot: repoRootOption,
52933
- repository: repositoryOption,
52934
52806
  skillPack: skillPackOption,
52935
52807
  command: commandOption,
52936
52808
  expected: expectedOption,
@@ -52939,13 +52811,13 @@ var reportCommand = exports_Command.make("report", {
52939
52811
  labels: labelsOption,
52940
52812
  json: jsonOption
52941
52813
  }, ({
52814
+ message,
52942
52815
  title,
52943
52816
  body,
52944
52817
  type: type2,
52945
52818
  severity,
52946
52819
  area,
52947
52820
  repoRoot,
52948
- repository,
52949
52821
  skillPack,
52950
52822
  command,
52951
52823
  expected,
@@ -52955,7 +52827,9 @@ var reportCommand = exports_Command.make("report", {
52955
52827
  json: json2
52956
52828
  }) => exports_Effect.tryPromise({
52957
52829
  try: async () => {
52958
- const report = buildHarnessReport({ title, body, type: type2, severity, repoRoot });
52830
+ const titleValue = optionalValue(title);
52831
+ const bodyValue = optionalValue(body);
52832
+ const messageValue = optionalValue(message);
52959
52833
  const skillPackValue = optionalValue(skillPack);
52960
52834
  const commandValue = optionalValue(command);
52961
52835
  const expectedValue = optionalValue(expected);
@@ -52970,40 +52844,50 @@ var reportCommand = exports_Command.make("report", {
52970
52844
  ...commandValue === undefined ? {} : { command: commandValue },
52971
52845
  ...extraLabels === undefined ? {} : { extraLabels }
52972
52846
  });
52973
- const issue = await createGitHubIssue({
52974
- repository,
52975
- title: report.title,
52976
- body: buildHarnessReportIssueBody({
52977
- report,
52978
- area,
52979
- ...skillPackValue === undefined ? {} : { skillPack: skillPackValue },
52980
- ...commandValue === undefined ? {} : { command: commandValue },
52981
- ...expectedValue === undefined ? {} : { expected: expectedValue },
52982
- ...actualValue === undefined ? {} : { actual: actualValue },
52983
- ...stepsValue === undefined ? {} : { steps: stepsValue }
52984
- }),
52847
+ const report = buildHarnessReport({
52848
+ ...titleValue === undefined ? {} : { title: titleValue },
52849
+ ...bodyValue === undefined ? {} : { body: bodyValue },
52850
+ ...messageValue === undefined ? {} : { message: messageValue },
52851
+ type: type2,
52852
+ severity,
52853
+ area,
52854
+ repoRoot,
52855
+ ...skillPackValue === undefined ? {} : { skillPack: skillPackValue },
52856
+ ...commandValue === undefined ? {} : { command: commandValue },
52857
+ ...expectedValue === undefined ? {} : { expected: expectedValue },
52858
+ ...actualValue === undefined ? {} : { actual: actualValue },
52859
+ ...stepsValue === undefined ? {} : { steps: stepsValue },
52985
52860
  labels: issueLabels
52986
52861
  });
52862
+ const baseUrl2 = resolveControlPlaneUrl();
52863
+ if (baseUrl2 === undefined) {
52864
+ throw new Error("Harness report API URL is not configured.");
52865
+ }
52866
+ const submitted = await exports_Effect.runPromise(submitHarnessReport({ baseUrl: baseUrl2, report }));
52987
52867
  await exports_Effect.runPromise(submitCliEventEffect("cli.harness.report.submitted", {
52988
52868
  cwd: repoRoot
52989
52869
  }));
52990
52870
  if (json2) {
52991
52871
  console.log(renderJsonLabel());
52992
- console.log(JSON.stringify({ issue, labels: issueLabels }, null, 2));
52872
+ console.log(JSON.stringify(submitted, null, 2));
52993
52873
  return;
52994
52874
  }
52995
- console.log(renderCommandSection("Harness report issue created", [`Issue: ${issue.htmlUrl}`, `Repository: ${repository}`].join(`
52875
+ console.log(renderCommandSection(submitted.deduplicated === true ? "Harness report matched existing issue" : "Harness report submitted", [
52876
+ submitted.githubUrl === undefined ? "Stored: Internal backoffice triage" : `Issue: ${submitted.githubUrl}`,
52877
+ submitted.title === undefined ? undefined : `Title: ${submitted.title}`,
52878
+ `Status: ${submitted.status}`
52879
+ ].filter((line4) => line4 !== undefined).join(`
52996
52880
  `)));
52997
52881
  },
52998
- catch: (cause3) => cause3 instanceof Error ? cause3 : new Error("Harness report issue creation failed.")
52999
- })).pipe(exports_Command.withDescription("Create a GitHub issue in the Harness Intelligence repository for maintainer triage."));
52882
+ catch: (cause3) => cause3 instanceof Error ? cause3 : new Error("Harness report submission failed.")
52883
+ })).pipe(exports_Command.withDescription("Submit reusable Harness friction to the report API for internal backoffice triage."));
53000
52884
 
53001
52885
  // src/cli/scaffold-command.ts
53002
52886
  import path13 from "path";
53003
52887
 
53004
52888
  // src/baseline/resolve.ts
53005
52889
  import { createHash } from "crypto";
53006
- import { execFileSync as execFileSync3 } from "child_process";
52890
+ import { execFileSync as execFileSync2 } from "child_process";
53007
52891
  import { existsSync as existsSync2, mkdirSync, mkdtempSync, readFileSync as readFileSync3, rmSync, writeFileSync } from "fs";
53008
52892
  import { tmpdir as tmpdir2 } from "os";
53009
52893
  import path5 from "path";
@@ -53024,25 +52908,25 @@ var hookCatalog = [
53024
52908
 
53025
52909
  // src/data/catalog/lint.ts
53026
52910
  var sharedReactPlacement = {
53027
- recommendedConfigFile: ".oxlintrc.json",
52911
+ recommendedConfigFile: "oxlint.config.ts",
53028
52912
  recommendedFiles: ["<detected-react-workspace>/**/*.{js,jsx,ts,tsx}"],
53029
52913
  recommendedWorkspaces: ["detected React workspaces"],
53030
52914
  placementNotes: "Add as an override for detected React-rendered code. Keep backend packages outside this override unless they render React."
53031
52915
  };
53032
52916
  var webOnlyPlacement = {
53033
- recommendedConfigFile: ".oxlintrc.json",
52917
+ recommendedConfigFile: "oxlint.config.ts",
53034
52918
  recommendedFiles: ["<detected-nextjs-workspace>/**/*.{js,jsx,ts,tsx}"],
53035
52919
  recommendedWorkspaces: ["detected Next.js workspaces"],
53036
52920
  placementNotes: "Place this in the Next.js app override. If the repo uses a different frontend app path, retarget the file globs to that workspace before composing the final Oxlint config."
53037
52921
  };
53038
52922
  var effectPlacement = {
53039
- recommendedConfigFile: ".oxlintrc.json",
52923
+ recommendedConfigFile: "oxlint.config.ts",
53040
52924
  recommendedFiles: ["<detected-effect-workspace>/**/*.{js,jsx,ts,tsx}"],
53041
52925
  recommendedWorkspaces: ["detected Effect workspaces"],
53042
52926
  placementNotes: "Apply this only where Effect code lives. If the target repo renames or splits backend workspaces, move the override with those code paths instead of broadening it repo-wide."
53043
52927
  };
53044
52928
  var vitestPlacement = {
53045
- recommendedConfigFile: ".oxlintrc.json",
52929
+ recommendedConfigFile: "oxlint.config.ts",
53046
52930
  recommendedFiles: [
53047
52931
  "<detected-test-workspace>/**/*.{test,spec}.{js,jsx,ts,tsx}",
53048
52932
  "<detected-test-workspace>/src/test/**/*.{js,jsx,ts,tsx}"
@@ -53053,38 +52937,19 @@ var vitestPlacement = {
53053
52937
  var lintCatalog = [
53054
52938
  {
53055
52939
  id: "react-core",
53056
- description: "Core React rules for rendered app and shared UI code.",
53057
- plugins: ["unicorn", "typescript", "oxc", "react"],
52940
+ description: "Ultracite React preset for rendered app and shared UI code.",
52941
+ oxlintPresets: ["react"],
52942
+ plugins: [],
53058
52943
  jsPlugins: [],
53059
52944
  settings: {},
53060
- rules: {
53061
- "react/rules-of-hooks": "error",
53062
- "react/exhaustive-deps": "error",
53063
- "react/forward-ref-uses-ref": "error",
53064
- "react/jsx-key": "error",
53065
- "react/jsx-no-comment-textnodes": "error",
53066
- "react/jsx-no-duplicate-props": "error",
53067
- "react/jsx-no-target-blank": "error",
53068
- "react/jsx-no-undef": "error",
53069
- "react/jsx-no-useless-fragment": "error",
53070
- "react/no-children-prop": "error",
53071
- "react/no-danger-with-children": "error",
53072
- "react/no-direct-mutation-state": "error",
53073
- "react/no-find-dom-node": "error",
53074
- "react/no-render-return-value": "error",
53075
- "react/no-string-refs": "error",
53076
- "react/no-this-in-sfc": "error",
53077
- "react/no-unknown-property": "error",
53078
- "react/no-unescaped-entities": "error",
53079
- "react/no-unsafe": "error",
53080
- "react/void-dom-elements-no-children": "error"
53081
- },
52945
+ rules: {},
53082
52946
  requiredDevDependencies: [],
53083
52947
  placement: sharedReactPlacement
53084
52948
  },
53085
52949
  {
53086
52950
  id: "react-hooks",
53087
52951
  description: "React Hooks lint rules via the JS plugin bridge for Oxlint.",
52952
+ oxlintPresets: [],
53088
52953
  plugins: [],
53089
52954
  jsPlugins: [
53090
52955
  {
@@ -53094,6 +52959,7 @@ var lintCatalog = [
53094
52959
  ],
53095
52960
  settings: {},
53096
52961
  rules: {
52962
+ "react-hooks-js/exhaustive-deps": "error",
53097
52963
  "react-hooks-js/component-hook-factories": "error",
53098
52964
  "react-hooks-js/config": "error",
53099
52965
  "react-hooks-js/error-boundaries": "error",
@@ -53104,6 +52970,7 @@ var lintCatalog = [
53104
52970
  "react-hooks-js/preserve-manual-memoization": "error",
53105
52971
  "react-hooks-js/purity": "error",
53106
52972
  "react-hooks-js/refs": "error",
52973
+ "react-hooks-js/rules-of-hooks": "error",
53107
52974
  "react-hooks-js/set-state-in-effect": "error",
53108
52975
  "react-hooks-js/set-state-in-render": "error",
53109
52976
  "react-hooks-js/static-components": "error",
@@ -53116,6 +52983,7 @@ var lintCatalog = [
53116
52983
  {
53117
52984
  id: "react-you-might-not-need-an-effect",
53118
52985
  description: "Guidance rules that push React code away from unnecessary effects.",
52986
+ oxlintPresets: [],
53119
52987
  plugins: [],
53120
52988
  jsPlugins: [
53121
52989
  {
@@ -53128,7 +52996,6 @@ var lintCatalog = [
53128
52996
  "react-you-might-not-need-an-effect-js/no-adjust-state-on-prop-change": "error",
53129
52997
  "react-you-might-not-need-an-effect-js/no-chain-state-updates": "error",
53130
52998
  "react-you-might-not-need-an-effect-js/no-derived-state": "error",
53131
- "react-you-might-not-need-an-effect-js/no-empty-effect": "error",
53132
52999
  "react-you-might-not-need-an-effect-js/no-event-handler": "error",
53133
53000
  "react-you-might-not-need-an-effect-js/no-initialize-state": "error",
53134
53001
  "react-you-might-not-need-an-effect-js/no-pass-data-to-parent": "error",
@@ -53140,31 +53007,12 @@ var lintCatalog = [
53140
53007
  },
53141
53008
  {
53142
53009
  id: "next-core",
53143
- description: "Next.js correctness rules for the main web application.",
53144
- plugins: ["nextjs"],
53010
+ description: "Ultracite Next.js preset for the main web application.",
53011
+ oxlintPresets: ["next"],
53012
+ plugins: [],
53145
53013
  jsPlugins: [],
53146
53014
  settings: {},
53147
- rules: {
53148
- "nextjs/inline-script-id": "error",
53149
- "nextjs/next-script-for-ga": "error",
53150
- "nextjs/no-assign-module-variable": "error",
53151
- "nextjs/no-async-client-component": "error",
53152
- "nextjs/no-before-interactive-script-outside-document": "error",
53153
- "nextjs/no-css-tags": "error",
53154
- "nextjs/no-document-import-in-page": "error",
53155
- "nextjs/no-duplicate-head": "error",
53156
- "nextjs/no-head-element": "error",
53157
- "nextjs/no-head-import-in-document": "error",
53158
- "nextjs/no-html-link-for-pages": "error",
53159
- "nextjs/no-img-element": "error",
53160
- "nextjs/no-page-custom-font": "error",
53161
- "nextjs/no-script-component-in-head": "error",
53162
- "nextjs/no-styled-jsx-in-document": "error",
53163
- "nextjs/no-sync-scripts": "error",
53164
- "nextjs/no-title-in-document-head": "error",
53165
- "nextjs/no-typos": "error",
53166
- "nextjs/no-unwanted-polyfillio": "error"
53167
- },
53015
+ rules: {},
53168
53016
  requiredDevDependencies: [],
53169
53017
  placement: {
53170
53018
  ...webOnlyPlacement,
@@ -53173,25 +53021,13 @@ var lintCatalog = [
53173
53021
  },
53174
53022
  {
53175
53023
  id: "tanstack-query-core",
53176
- description: "TanStack Query rules via the Oxlint JS plugin bridge.",
53024
+ description: "Ultracite TanStack preset for query/router/start framework linting.",
53025
+ oxlintPresets: ["tanstack"],
53177
53026
  plugins: [],
53178
- jsPlugins: [
53179
- {
53180
- name: "tanstack-query-js",
53181
- specifier: "@tanstack/eslint-plugin-query"
53182
- }
53183
- ],
53027
+ jsPlugins: [],
53184
53028
  settings: {},
53185
- rules: {
53186
- "tanstack-query-js/exhaustive-deps": "error",
53187
- "tanstack-query-js/infinite-query-property-order": "error",
53188
- "tanstack-query-js/mutation-property-order": "error",
53189
- "tanstack-query-js/no-rest-destructuring": "warn",
53190
- "tanstack-query-js/no-unstable-deps": "error",
53191
- "tanstack-query-js/no-void-query-fn": "error",
53192
- "tanstack-query-js/stable-query-client": "error"
53193
- },
53194
- requiredDevDependencies: ["@tanstack/eslint-plugin-query"],
53029
+ rules: {},
53030
+ requiredDevDependencies: [],
53195
53031
  placement: {
53196
53032
  ...webOnlyPlacement,
53197
53033
  placementNotes: "Scope this to client code that owns TanStack Query usage. Keep it out of server-only or shared non-query packages unless those paths actually create queries or mutations."
@@ -53200,6 +53036,7 @@ var lintCatalog = [
53200
53036
  {
53201
53037
  id: "effect-no-barrel-imports",
53202
53038
  description: "Effect architectural rule that blocks barrel-package imports.",
53039
+ oxlintPresets: [],
53203
53040
  plugins: [],
53204
53041
  jsPlugins: [
53205
53042
  {
@@ -53221,20 +53058,12 @@ var lintCatalog = [
53221
53058
  },
53222
53059
  {
53223
53060
  id: "vitest-core",
53224
- description: "Vitest-focused test rules for repo-owned test globs.",
53225
- plugins: ["vitest"],
53061
+ description: "Ultracite Vitest preset for repo-owned test globs.",
53062
+ oxlintPresets: ["vitest"],
53063
+ plugins: [],
53226
53064
  jsPlugins: [],
53227
- settings: {
53228
- vitest: {
53229
- typecheck: false
53230
- }
53231
- },
53232
- rules: {
53233
- "vitest/consistent-each-for": "warn",
53234
- "vitest/no-conditional-tests": "error",
53235
- "vitest/no-import-node-test": "error",
53236
- "vitest/warn-todo": "warn"
53237
- },
53065
+ settings: {},
53066
+ rules: {},
53238
53067
  requiredDevDependencies: [],
53239
53068
  placement: vitestPlacement
53240
53069
  }
@@ -53471,7 +53300,7 @@ var packCatalog = [
53471
53300
  triggerPackages: ["react", "react-dom"],
53472
53301
  description: "React guidance pack.",
53473
53302
  skills: ["async-react-patterns", "vercel-composition-patterns", "vercel-react-best-practices"],
53474
- lintAssets: ["react-core", "react-hooks", "react-you-might-not-need-an-effect"],
53303
+ lintAssets: ["react-core", "react-you-might-not-need-an-effect"],
53475
53304
  hooks: [],
53476
53305
  promptSurfaces: ["shared-agents", "root-prompt-spec", "workspace-prompt-spec"],
53477
53306
  promptDetails: ["shared react structure baseline", "workspace react composition rules"]
@@ -53480,8 +53309,8 @@ var packCatalog = [
53480
53309
  id: "research",
53481
53310
  category: "default",
53482
53311
  triggerPackages: [],
53483
- description: "Default research pack: parallel research, review, and architecture inspection.",
53484
- skills: ["parallel-research", "review-phase", "improve-codebase-architecture"],
53312
+ description: "Default research pack: parallel research, structured review, and architecture inspection.",
53313
+ skills: ["parallel-research", "review-phase", "autoreview", "improve-codebase-architecture"],
53485
53314
  lintAssets: [],
53486
53315
  hooks: [],
53487
53316
  promptSurfaces: ["shared-agents", "root-prompt-spec", "workspace-prompt-spec"],
@@ -53895,6 +53724,14 @@ var skillCatalog = [
53895
53724
  framework: null,
53896
53725
  requiresTools: []
53897
53726
  },
53727
+ {
53728
+ id: "autoreview",
53729
+ sourceDirectory: "skills/agnostic/quality/autoreview",
53730
+ tier: "agnostic",
53731
+ language: null,
53732
+ framework: null,
53733
+ requiresTools: []
53734
+ },
53898
53735
  {
53899
53736
  id: "simplify",
53900
53737
  sourceDirectory: "skills/agnostic/quality/simplify",
@@ -54055,6 +53892,7 @@ var assetArchiveName = "scaffold-baseline.tgz";
54055
53892
  var cacheRoot = () => path5.join(process.env.XDG_CACHE_HOME ?? path5.join(process.env.HOME ?? tmpdir2(), ".cache"), "devpunks", "baselines");
54056
53893
  var sha256File = (filePath) => createHash("sha256").update(readFileSync3(filePath)).digest("hex");
54057
53894
  var isSafeTarPath = (entry) => entry.length > 0 && !path5.isAbsolute(entry) && !entry.split("/").includes("..");
53895
+ var isSafePathSegment = (value6) => value6.length > 0 && value6 !== "." && value6 !== ".." && !value6.includes("/") && !value6.includes("\\");
54058
53896
  var isBaselineReleaseTag = (tag6) => tag6.startsWith("baseline/stable/") && !/^v\d+\.\d+\.\d+(?:$|-)/u.test(tag6);
54059
53897
  var fetchJson = async (url2, timeoutMs) => {
54060
53898
  const controller = new AbortController;
@@ -54087,7 +53925,7 @@ var download = async (url2, targetPath, timeoutMs) => {
54087
53925
  }
54088
53926
  };
54089
53927
  var extractSafeTgz = (archivePath, targetDirectory) => {
54090
- const listing = execFileSync3("tar", ["-tzf", archivePath], {
53928
+ const listing = execFileSync2("tar", ["-tzf", archivePath], {
54091
53929
  encoding: "utf8"
54092
53930
  }).split(/\r?\n/u).filter((line4) => line4.length > 0);
54093
53931
  const unsafe = listing.find((entry) => !isSafeTarPath(entry));
@@ -54095,7 +53933,7 @@ var extractSafeTgz = (archivePath, targetDirectory) => {
54095
53933
  throw new Error(`Unsafe baseline archive path: ${unsafe}`);
54096
53934
  }
54097
53935
  mkdirSync(targetDirectory, { recursive: true });
54098
- execFileSync3("tar", ["-xzf", archivePath, "-C", targetDirectory], {
53936
+ execFileSync2("tar", ["-xzf", archivePath, "-C", targetDirectory], {
54099
53937
  stdio: "ignore"
54100
53938
  });
54101
53939
  };
@@ -54116,6 +53954,9 @@ var submitArtifactPullTelemetry = async (baseline, cwd) => {
54116
53954
  }));
54117
53955
  };
54118
53956
  var materializeControlPlaneBaseline = async (resolution, refresh, timeoutMs) => {
53957
+ if (!isSafePathSegment(resolution.version)) {
53958
+ throw new Error(`Unsafe control plane baseline version: ${resolution.version}`);
53959
+ }
54119
53960
  const targetDirectory = path5.join(cacheRoot(), "control-plane", resolution.version);
54120
53961
  if (!refresh && existsSync2(path5.join(targetDirectory, "baseline.json"))) {
54121
53962
  return {
@@ -54692,7 +54533,7 @@ var PromptLive = exports_Effect.acquireRelease(exports_Effect.sync(() => createI
54692
54533
  })));
54693
54534
 
54694
54535
  // src/scaffold/run.ts
54695
- import { execFileSync as execFileSync6 } from "child_process";
54536
+ import { execFileSync as execFileSync5 } from "child_process";
54696
54537
  import { mkdirSync as mkdirSync3, writeFileSync as writeFileSync4 } from "fs";
54697
54538
  import { homedir as homedir2 } from "os";
54698
54539
  import path11 from "path";
@@ -55081,7 +54922,7 @@ var hasBackendSurface = (result) => exports_Array.some(result.detectedTechnologi
55081
54922
  import path8 from "path";
55082
54923
 
55083
54924
  // src/core/tools.ts
55084
- import { execFileSync as execFileSync4 } from "child_process";
54925
+ import { execFileSync as execFileSync3 } from "child_process";
55085
54926
  import { accessSync, constants as constants2 } from "fs";
55086
54927
  import { homedir } from "os";
55087
54928
  import path7 from "path";
@@ -55110,7 +54951,7 @@ var defaultRuntime3 = {
55110
54951
  cwd: homedir(),
55111
54952
  commandExists: commandExistsOnPath,
55112
54953
  execFile: (command, args2, options9) => {
55113
- execFileSync4(command, [...args2], {
54954
+ execFileSync3(command, [...args2], {
55114
54955
  cwd: options9?.cwd,
55115
54956
  stdio: options9?.stdio === "inherit" ? ["ignore", "inherit", "inherit"] : "ignore"
55116
54957
  });
@@ -55374,13 +55215,14 @@ var formatAgentHandoffSummary = (result) => [
55374
55215
  " 4a. Never put phase skills in scoped `AGENTS.md` primary-skill lines. Keep `requirements-phase`, `delivery-phase`, `debugging-phase`, `review-phase`, `resolve-debt-phase`, and `docs-ingest-phase` as global orchestration entrypoints only.",
55375
55216
  " 5. Treat every authored root/docs/workspace `AGENTS.md` file as the neutral scoped prompt source and create a sibling `CLAUDE.md` symlink mirror beside each one.",
55376
55217
  " 6. Keep `.agents/AGENTS.md` as the shared global prompt source behind the scoped prompt tree; `.claude/CLAUDE.md` should mirror that neutral file.",
55377
- " 7. Keep `.agents/hooks/` as the neutral hook source, `.agents/skills/` as the main skill directory, and `.agents/scripts/sync-subagents.mjs` as the harness sync entrypoint. Only `.claude/skills` should mirror `.agents/skills`.",
55378
- " 8. Reconcile `.agents/subagents/manifest.mjs` with both `.agents/subagents/manifest.prompt.md` and `.devpunks/specs/subagents/manifest-spec.json`.",
55379
- " 9. Update owned paths / guidance file references in the subagent manifest to match the real repo shape.",
55380
- " 10. Use `portless` as the local-dev URL baseline. Prefer stable subdomains over raw `localhost:<port>` values in env examples, endpoint defaults, callback URLs, allowed origins, CORS, and app-to-app proxies.",
55381
- " 11. If adopting Oxlint or Oxfmt, replace existing lint/format setup deliberately: package scripts, task pipelines, CI, editor/docs references, and hooks should agree on the new tools.",
55382
- " 12. Before authoring final prompts or implementation plans, identify the core detected libraries whose source behavior matters.",
55383
- " 13. Run `opensrc path <package>` or `opensrc path owner/repo` for those core libraries, then inspect the returned checkout paths. Clone the major framework/runtime libraries you will reason about; do not clone every dependency mechanically."
55218
+ " 7. Before relying on subagents, verify the active harness global/project settings enable subagent execution, then verify `.agents/subagents/manifest.mjs` and selected specialist path/guidance/skill coverage. Repair settings/setup or execute locally if the guard fails.",
55219
+ " 8. Keep `.agents/hooks/` as the neutral hook source, `.agents/skills/` as the main skill directory, and `.agents/scripts/sync-subagents.mjs` as the harness sync entrypoint. Only `.claude/skills` should mirror `.agents/skills`.",
55220
+ " 9. Reconcile `.agents/subagents/manifest.mjs` with both `.agents/subagents/manifest.prompt.md` and `.devpunks/specs/subagents/manifest-spec.json`.",
55221
+ " 10. Update owned paths / guidance file references in the subagent manifest to match the real repo shape.",
55222
+ " 11. Use `portless` as the local-dev URL baseline. Prefer stable subdomains over raw `localhost:<port>` values in env examples, endpoint defaults, callback URLs, allowed origins, CORS, and app-to-app proxies.",
55223
+ " 12. If adopting Oxlint or Oxfmt, replace existing lint/format setup deliberately: package scripts, task pipelines, CI, editor/docs references, and hooks should agree on the new tools.",
55224
+ " 13. Before authoring final prompts or implementation plans, identify the core detected libraries whose source behavior matters.",
55225
+ " 14. Run `opensrc path <package>` or `opensrc path owner/repo` for those core libraries, then inspect the returned checkout paths. Clone the major framework/runtime libraries you will reason about; do not clone every dependency mechanically."
55384
55226
  ].join(`
55385
55227
  `);
55386
55228
  var formatSelectionPreview = (options9) => [
@@ -55532,7 +55374,7 @@ var finalizePackSelection = (resolved, additions, removals) => {
55532
55374
  var canRemovePack = (resolved, packId) => resolved.preselectedPacks.includes(packId) && !resolved.defaultPacks.includes(packId);
55533
55375
 
55534
55376
  // src/scaffold/output.ts
55535
- import { execFileSync as execFileSync5 } from "child_process";
55377
+ import { execFileSync as execFileSync4 } from "child_process";
55536
55378
  import { createHash as createHash2 } from "crypto";
55537
55379
  import {
55538
55380
  cpSync,
@@ -55578,10 +55420,12 @@ When a nested \`AGENTS.md\` lists "Primary skills here", treat those skill names
55578
55420
 
55579
55421
  Do not rely only on the root instructions when a scoped \`AGENTS.md\` exists.
55580
55422
 
55581
- For code review requests, take a review stance: findings first, severity ordered, with precise file/line references. Use \`simplify\` to inspect changed code for clarity, naming, duplication, derivable state, and unnecessary abstraction. Use \`improve-codebase-architecture\` when review uncovers cross-module coupling, shallow-module sprawl, testability friction, or AI-navigation problems; surface grounded candidates and ask before turning them into broader refactor work.
55423
+ For code review requests, take a review stance: findings first, severity ordered, with precise file/line references. Use \`autoreview\` as the core review runtime. \`simplify\`, \`improve-codebase-architecture\`, and scoped \`AGENTS.md\` skills are the mandatory review lenses, not optional extras. For every reviewed path, inspect the nearest scoped \`AGENTS.md\` prompt and verify adherence to every listed primary skill.
55582
55424
 
55583
55425
  Use \`parallel-research\` for readonly repo orientation when the work can be split across independent questions, subsystems, artifacts, or hypotheses. Keep the immediate blocking path local, delegate sidecar reading only, synthesize findings before deciding, and skip it for code-writing or tightly coupled work.
55584
55426
 
55427
+ Before delegating to subagents, verify the active harness global/project settings actually enable subagent execution, then verify repo-local routing. For Codex, \`.codex/config.toml\` should have an \`[agents]\` section with usable thread/depth limits. For Claude Code, OpenCode, Cursor, or other harnesses, check their equivalent global/project agent settings before trusting repo-local mirrors. Then confirm \`.agents/subagents/manifest.mjs\` exists and the selected specialist has matching owned paths, guidance files, and skills. If that guard fails, repair settings or execute locally; do not claim worker coverage from an inactive harness.
55428
+
55585
55429
  When inspecting external library internals, prefer official docs first. If source context is needed, resolve cached read-only sources with \`opensrc path <package>\` for packages or \`opensrc path owner/repo\` for repositories, then inspect the returned absolute path. This applies broadly to third-party dependencies used here.
55586
55430
 
55587
55431
  Use \`portless\` for local development URLs instead of baking raw \`localhost:<port>\` values into docs, env examples, endpoint defaults, callback URLs, allowed origins, CORS lists, or app-to-app proxy targets.
@@ -55843,12 +55687,13 @@ var renderAgentHandoffMarkdown = ({
55843
55687
  "5. Author every root/docs/workspace `AGENTS.md` file as the neutral prompt source of truth and create a sibling `CLAUDE.md` symlink mirror beside each one instead of maintaining duplicated prompt bodies.",
55844
55688
  "6. Keep `.agents/AGENTS.md` as the shared global guidance source behind the scoped prompt tree; `.claude/CLAUDE.md` should stay a symlink mirror of that neutral file.",
55845
55689
  "7. Keep portless as the repo-wide local URL baseline: prefer stable local subdomains over raw localhost ports where env examples, endpoint constants, callback URLs, allowed origins, CORS, or app-to-app proxy targets are configured.",
55846
- "8. Use the lint asset specs to reconcile repo Oxlint config. If the repo has no Oxlint config yet, start from the generated starter config instead of inventing a baseline.",
55690
+ "8. Inspect the applied Oxlint configs and lint asset specs. Scaffold creates or patches nearest package/app configs and adds missing lint dev dependencies; preserve local policy when making follow-up edits.",
55847
55691
  "9. Keep `.agents/hooks/` as the neutral hook source of truth; harness hook mirrors should point back to it.",
55848
- "10. Use `.agents/scripts/sync-subagents.mjs` to regenerate harness-native agents, hook mirrors, shared prompt mirrors, and the `.claude/skills` compatibility mirror when the neutral manifest changes.",
55849
- "11. Populate or reconcile `.agents/subagents/manifest.mjs` using both the manifest spec JSON and the manifest prompt markdown.",
55850
- "12. Adjust owned paths and guidance file references in the subagent manifest to match the real repo layout. Monorepo vs single-repo shape affects these paths.",
55851
- "13. Before authoring final prompts or implementation plans, identify the core detected libraries whose source behavior matters, run `opensrc path <package>` or `opensrc path owner/repo` for those libraries, then inspect the returned checkout paths. Clone the major framework/runtime libraries you will reason about; do not clone every dependency mechanically.",
55692
+ "10. Before relying on subagents, verify the active harness global/project settings enable subagent execution, then verify `.agents/subagents/manifest.mjs` and the selected specialist's owned paths, guidance files, and skills. Repair settings/setup or execute locally when the guard fails.",
55693
+ "11. Use `.agents/scripts/sync-subagents.mjs` to regenerate harness-native agents, hook mirrors, shared prompt mirrors, and the `.claude/skills` compatibility mirror when the neutral manifest changes.",
55694
+ "12. Populate or reconcile `.agents/subagents/manifest.mjs` using both the manifest spec JSON and the manifest prompt markdown.",
55695
+ "13. Adjust owned paths and guidance file references in the subagent manifest to match the real repo layout. Monorepo vs single-repo shape affects these paths.",
55696
+ "14. Before authoring final prompts or implementation plans, identify the core detected libraries whose source behavior matters, run `opensrc path <package>` or `opensrc path owner/repo` for those libraries, then inspect the returned checkout paths. Clone the major framework/runtime libraries you will reason about; do not clone every dependency mechanically.",
55852
55697
  "",
55853
55698
  "## Shared core files",
55854
55699
  "",
@@ -55892,17 +55737,17 @@ var renderLintSpecMarkdown = ({
55892
55737
  }) => [
55893
55738
  "# Lint Asset Handoff",
55894
55739
  "",
55895
- "Use these selected Oxlint assets to fit the target repo's real lint topology.",
55896
- "Treat each asset as an atomic override payload plus placement guidance, not as a pre-merged final `.oxlintrc.json` block.",
55740
+ "Use these selected Oxlint assets to audit the config changes scaffold applied to the target repo.",
55741
+ "Scaffold writes nearest package/app `oxlint.config.ts` files where selected assets apply. Ultracite presets provide the baseline, and asset-specific plugin/rule overlays stay explicit.",
55897
55742
  "If you adopt Oxlint or Oxfmt, replace the repo's existing lint/format entrypoints deliberately: update package scripts, task pipelines, editor/docs references, and agent hooks together so old ESLint/Prettier commands do not remain as stale defaults.",
55898
55743
  "If the repo already has lint/format tooling, preserve project-specific ignores, generated-file exclusions, and CI behavior while migrating; do not overwrite working config wholesale.",
55899
55744
  "",
55900
55745
  "## Baseline",
55901
55746
  "",
55902
- hasExistingOxlintConfig ? "- The target repo already has an Oxlint config. Reconcile these assets into that existing setup instead of replacing it." : `- The target repo does not appear to have an Oxlint config. Start from \`${starterConfigFile}\` as the baseline if you need a fresh root config.`,
55747
+ hasExistingOxlintConfig ? "- The target repo already has a root Oxlint config. Package/app configs may still be created when that is the closest scoped home for selected pack rules." : `- The target repo does not appear to have a root Oxlint config. \`${starterConfigFile}\` remains a root starter reference, while package/app configs are applied where assets are selected.`,
55903
55748
  "- Preserve asset granularity: add or adjust rules asset-by-asset instead of collapsing everything into one opaque override.",
55904
55749
  "- Keep JS plugin aliases stable when composing the final Oxlint config so future regen stays diff-friendly.",
55905
- "- Start from broad ignores for generated/vendor surfaces: all lock files and all dot-directories should stay out of the default root lint scope unless a repo has an explicit reason to opt them back in.",
55750
+ "- Keep `ultracite/oxlint/core` first, then layer framework presets and local asset overlays.",
55906
55751
  "",
55907
55752
  "## Selected assets",
55908
55753
  "",
@@ -55911,6 +55756,7 @@ var renderLintSpecMarkdown = ({
55911
55756
  "",
55912
55757
  `- Description: ${asset.description}`,
55913
55758
  `- Source packs: ${asset.sourcePacks.map((packId) => `\`${packId}\``).join(", ")}`,
55759
+ `- Oxlint presets: ${asset.oxlintPresets.length === 0 ? "`(none)`" : asset.oxlintPresets.map((preset) => `\`ultracite/oxlint/${preset}\``).join(", ")}`,
55914
55760
  `- Recommended config file: \`${asset.placement.recommendedConfigFile}\``,
55915
55761
  `- Recommended workspaces: ${asset.placement.recommendedWorkspaces.length === 0 ? "`(none)`" : asset.placement.recommendedWorkspaces.map((workspace) => `\`${workspace}\``).join(", ")}`,
55916
55762
  `- Recommended files: ${asset.placement.recommendedFiles.length === 0 ? "`(none)`" : asset.placement.recommendedFiles.map((file6) => `\`${file6}\``).join(", ")}`,
@@ -55949,6 +55795,7 @@ var resolveLintAssetsForPacks = (packIds, baseline = bundledBaseline) => {
55949
55795
  id: asset.id,
55950
55796
  description: asset.description,
55951
55797
  sourcePacks: [packId],
55798
+ oxlintPresets: asset.oxlintPresets,
55952
55799
  plugins: asset.plugins,
55953
55800
  jsPlugins: asset.jsPlugins,
55954
55801
  settings: asset.settings,
@@ -56144,32 +55991,315 @@ var migrateLegacySkillDirectories = ({
56144
55991
  }
56145
55992
  };
56146
55993
  var selectedHookIds = (finalPacks, baseline) => uniqueSorted(finalPacks.flatMap((packId) => hooksForPack(packId, baseline)));
56147
- var oxlintConfigCandidates = [".oxlintrc.json", ".oxlintrc.jsonc", "oxlint.config.ts"];
55994
+ var oxlintConfigCandidates = ["oxlint.config.ts", ".oxlintrc.json", ".oxlintrc.jsonc"];
56148
55995
  var existingOxlintConfigFiles = (scanDirectory) => oxlintConfigCandidates.filter((candidate) => existsSync5(path10.join(scanDirectory, candidate)));
56149
55996
  var oxlintStarterConfig = {
56150
- $schema: "./node_modules/oxlint/configuration_schema.json",
56151
- env: {
56152
- builtin: true
56153
- },
56154
- ignorePatterns: [
56155
- "**/.*",
56156
- "**/.*/**",
56157
- "**/*.lock",
56158
- "**/*.lock.*",
56159
- "**/*-lock.*",
56160
- "**/*.lockb",
56161
- "**/package-lock.json",
56162
- "**/pnpm-lock.yaml",
56163
- "**/yarn.lock",
56164
- "**/bun.lock",
56165
- "**/bun.lockb",
56166
- "node_modules/**",
56167
- "opensrc/**",
56168
- "**/.next/**",
56169
- "**/dist/**",
56170
- "**/build/**"
56171
- ],
56172
- overrides: []
55997
+ extends: ["ultracite/oxlint/core"],
55998
+ configFile: "oxlint.config.ts"
55999
+ };
56000
+ var oxlintConfigFileName = "oxlint.config.ts";
56001
+ var ultraciteCorePreset = "core";
56002
+ var defaultDevDependencyVersion = "latest";
56003
+ var isRecord3 = (value6) => typeof value6 === "object" && value6 !== null && !Array.isArray(value6);
56004
+ var stripJsonComments = (content) => {
56005
+ let result = "";
56006
+ let inString = false;
56007
+ let escaped = false;
56008
+ let inLineComment = false;
56009
+ let inBlockComment = false;
56010
+ for (let index = 0;index < content.length; index += 1) {
56011
+ const char4 = content[index];
56012
+ const next = content[index + 1];
56013
+ if (inLineComment) {
56014
+ if (char4 === `
56015
+ `) {
56016
+ inLineComment = false;
56017
+ result += char4;
56018
+ }
56019
+ continue;
56020
+ }
56021
+ if (inBlockComment) {
56022
+ if (char4 === "*" && next === "/") {
56023
+ inBlockComment = false;
56024
+ index += 1;
56025
+ }
56026
+ continue;
56027
+ }
56028
+ if (!inString && char4 === "/" && next === "/") {
56029
+ inLineComment = true;
56030
+ index += 1;
56031
+ continue;
56032
+ }
56033
+ if (!inString && char4 === "/" && next === "*") {
56034
+ inBlockComment = true;
56035
+ index += 1;
56036
+ continue;
56037
+ }
56038
+ result += char4;
56039
+ if (char4 === "\\" && inString) {
56040
+ escaped = !escaped;
56041
+ continue;
56042
+ }
56043
+ if (char4 === '"' && !escaped) {
56044
+ inString = !inString;
56045
+ }
56046
+ if (char4 !== "\\") {
56047
+ escaped = false;
56048
+ }
56049
+ }
56050
+ return result.replace(/,\s*([}\]])/gu, "$1");
56051
+ };
56052
+ var readJsonRecord = (filePath) => {
56053
+ const parsed = JSON.parse(stripJsonComments(readFileSync6(filePath, "utf8")));
56054
+ return isRecord3(parsed) ? parsed : {};
56055
+ };
56056
+ var encodePrettyJson = (value6) => `${JSON.stringify(value6, null, 2)}
56057
+ `;
56058
+ var encodePrettyTsObject = (value6) => JSON.stringify(value6, null, 2);
56059
+ var sourceOrOutputPath = ({
56060
+ scanDirectory,
56061
+ outputDirectory,
56062
+ relativePath
56063
+ }) => {
56064
+ const outputPath = path10.join(outputDirectory, relativePath);
56065
+ if (existsSync5(outputPath)) {
56066
+ return outputPath;
56067
+ }
56068
+ const sourcePath = path10.join(scanDirectory, relativePath);
56069
+ return existsSync5(sourcePath) ? sourcePath : null;
56070
+ };
56071
+ var ensureStringArray = (value6) => Array.isArray(value6) ? value6.filter((entry) => typeof entry === "string") : [];
56072
+ var ensureStringOrStringArray = (value6) => {
56073
+ if (typeof value6 === "string") {
56074
+ return [value6];
56075
+ }
56076
+ return ensureStringArray(value6);
56077
+ };
56078
+ var jsPluginMatches = (value6, plugin) => {
56079
+ if (typeof value6 === "string") {
56080
+ return value6 === plugin.name || value6 === plugin.specifier;
56081
+ }
56082
+ return isRecord3(value6) && (value6.name === plugin.name || value6.specifier === plugin.specifier || value6.name === plugin.name && value6.specifier === plugin.specifier);
56083
+ };
56084
+ var presetImportName = (preset) => preset.replace(/[^a-zA-Z0-9]+/gu, " ").replace(/(?:^|\s)([a-zA-Z0-9])/gu, (_match, char4) => char4.toUpperCase());
56085
+ var oxlintPresetLocalName = (preset) => preset === ultraciteCorePreset ? "core" : `ultracite${presetImportName(preset)}`;
56086
+ var lintPresetsForAssets = (assets) => uniqueSorted([ultraciteCorePreset, ...assets.flatMap((asset) => asset.oxlintPresets)]);
56087
+ var mergeLintAssetsIntoLocalOxlintConfig = (existingConfig, assets) => {
56088
+ const { $schema: _schema, extends: _extends, ...existingLocalConfig } = existingConfig;
56089
+ const nextConfig = { ...existingLocalConfig };
56090
+ const plugins = ensureStringArray(nextConfig.plugins);
56091
+ const jsPlugins = Array.isArray(nextConfig.jsPlugins) ? [...nextConfig.jsPlugins] : [];
56092
+ const settings = isRecord3(nextConfig.settings) ? { ...nextConfig.settings } : {};
56093
+ const rules = isRecord3(nextConfig.rules) ? { ...nextConfig.rules } : {};
56094
+ for (const asset of assets) {
56095
+ for (const plugin of asset.plugins) {
56096
+ if (!plugins.includes(plugin)) {
56097
+ plugins.push(plugin);
56098
+ }
56099
+ }
56100
+ for (const plugin of asset.jsPlugins) {
56101
+ if (!jsPlugins.some((entry) => jsPluginMatches(entry, plugin))) {
56102
+ jsPlugins.push({ name: plugin.name, specifier: plugin.specifier });
56103
+ }
56104
+ }
56105
+ for (const [key, value6] of Object.entries(asset.settings)) {
56106
+ if (!(key in settings)) {
56107
+ settings[key] = value6;
56108
+ }
56109
+ }
56110
+ for (const [key, value6] of Object.entries(asset.rules)) {
56111
+ if (!(key in rules)) {
56112
+ rules[key] = value6;
56113
+ }
56114
+ }
56115
+ }
56116
+ return {
56117
+ ...nextConfig,
56118
+ ...plugins.length > 0 ? { plugins: uniqueSorted(plugins) } : {},
56119
+ ...jsPlugins.length > 0 ? { jsPlugins } : {},
56120
+ ...Object.keys(settings).length > 0 ? { settings } : {},
56121
+ ...Object.keys(rules).length > 0 ? { rules } : {}
56122
+ };
56123
+ };
56124
+ var encodeOxlintConfigTs = ({
56125
+ existingConfig,
56126
+ assets
56127
+ }) => {
56128
+ const presets = lintPresetsForAssets(assets);
56129
+ const imports = presets.map((preset) => `import ${oxlintPresetLocalName(preset)} from "ultracite/oxlint/${preset}";`);
56130
+ const existingExtends = ensureStringOrStringArray(existingConfig.extends);
56131
+ const extendsEntries = [
56132
+ ...existingExtends.map((entry) => JSON.stringify(entry)),
56133
+ ...presets.map(oxlintPresetLocalName)
56134
+ ];
56135
+ const localConfig = mergeLintAssetsIntoLocalOxlintConfig(existingConfig, assets);
56136
+ return [
56137
+ 'import { defineConfig } from "oxlint";',
56138
+ ...imports,
56139
+ "",
56140
+ `const localConfig = ${encodePrettyTsObject(localConfig)};`,
56141
+ "",
56142
+ "export default defineConfig({",
56143
+ ` extends: [${extendsEntries.join(", ")}],`,
56144
+ " ignorePatterns: core.ignorePatterns,",
56145
+ " ...localConfig,",
56146
+ "});",
56147
+ ""
56148
+ ].join(`
56149
+ `);
56150
+ };
56151
+ var rootPackageJsonRecord = ({
56152
+ scanDirectory,
56153
+ outputDirectory
56154
+ }) => {
56155
+ const rootPackageJsonPath = sourceOrOutputPath({
56156
+ scanDirectory,
56157
+ outputDirectory,
56158
+ relativePath: "package.json"
56159
+ });
56160
+ return rootPackageJsonPath === null ? null : readJsonRecord(rootPackageJsonPath);
56161
+ };
56162
+ var dependencyVersionFor = ({
56163
+ rootPackageJson,
56164
+ packageName,
56165
+ isRootWorkspace
56166
+ }) => {
56167
+ const dependencySections = [
56168
+ rootPackageJson?.devDependencies,
56169
+ rootPackageJson?.dependencies,
56170
+ rootPackageJson?.peerDependencies,
56171
+ rootPackageJson?.optionalDependencies
56172
+ ];
56173
+ for (const section2 of dependencySections) {
56174
+ if (isRecord3(section2) && typeof section2[packageName] === "string") {
56175
+ return section2[packageName];
56176
+ }
56177
+ }
56178
+ const workspaces = rootPackageJson?.workspaces;
56179
+ const catalog = isRecord3(workspaces) ? workspaces.catalog : undefined;
56180
+ if (!isRootWorkspace && isRecord3(catalog) && typeof catalog[packageName] === "string") {
56181
+ return "catalog:";
56182
+ }
56183
+ return defaultDevDependencyVersion;
56184
+ };
56185
+ var packageHasDependency = (packageJson, packageName) => [
56186
+ packageJson.dependencies,
56187
+ packageJson.devDependencies,
56188
+ packageJson.peerDependencies,
56189
+ packageJson.optionalDependencies
56190
+ ].filter(isRecord3).some((section2) => typeof section2[packageName] === "string");
56191
+ var patchPackageJsonDependencies = ({
56192
+ packageJson,
56193
+ packageNames,
56194
+ rootPackageJson,
56195
+ isRootWorkspace
56196
+ }) => {
56197
+ const nextPackageJson = { ...packageJson };
56198
+ const devDependencies = isRecord3(nextPackageJson.devDependencies) ? { ...nextPackageJson.devDependencies } : {};
56199
+ for (const packageName of packageNames) {
56200
+ if (packageHasDependency(nextPackageJson, packageName)) {
56201
+ continue;
56202
+ }
56203
+ devDependencies[packageName] = dependencyVersionFor({
56204
+ rootPackageJson,
56205
+ packageName,
56206
+ isRootWorkspace
56207
+ });
56208
+ }
56209
+ nextPackageJson.devDependencies = Object.fromEntries(Object.entries(devDependencies).toSorted(([left3], [right3]) => left3.localeCompare(right3)));
56210
+ return nextPackageJson;
56211
+ };
56212
+ var lintTargetManifests = (detection) => {
56213
+ if (!detection.monorepo) {
56214
+ return detection.manifests;
56215
+ }
56216
+ return detection.manifests.filter((manifest) => path10.posix.dirname(toPosixPath(manifest.relativePath)) !== ".");
56217
+ };
56218
+ var existingJsonOxlintConfigPath = ({
56219
+ scanDirectory,
56220
+ outputDirectory,
56221
+ workspacePath
56222
+ }) => {
56223
+ const candidates = [".oxlintrc.json", ".oxlintrc.jsonc"].map((fileName) => workspacePath === "." ? fileName : path10.posix.join(workspacePath, fileName));
56224
+ for (const candidate of candidates) {
56225
+ const configPath = sourceOrOutputPath({
56226
+ scanDirectory,
56227
+ outputDirectory,
56228
+ relativePath: candidate
56229
+ });
56230
+ if (configPath !== null) {
56231
+ return configPath;
56232
+ }
56233
+ }
56234
+ return null;
56235
+ };
56236
+ var writeAppliedLintConfigs = ({
56237
+ scanDirectory,
56238
+ outputDirectory,
56239
+ detection,
56240
+ finalPacks,
56241
+ baseline
56242
+ }) => {
56243
+ const rootPackageJson = rootPackageJsonRecord({ scanDirectory, outputDirectory });
56244
+ const applied = [];
56245
+ for (const manifest of lintTargetManifests(detection)) {
56246
+ const manifestRelativePath = toPosixPath(manifest.relativePath);
56247
+ const workspacePath = path10.posix.dirname(manifestRelativePath);
56248
+ const normalizedWorkspacePath = workspacePath === "." ? "." : workspacePath;
56249
+ const workspacePacks = packsForWorkspace({
56250
+ relativeWorkspacePath: normalizedWorkspacePath,
56251
+ manifest,
56252
+ finalPacks,
56253
+ baseline
56254
+ });
56255
+ const assets = resolveLintAssetsForPacks(workspacePacks, baseline);
56256
+ if (assets.length === 0) {
56257
+ continue;
56258
+ }
56259
+ const configFile = normalizedWorkspacePath === "." ? oxlintConfigFileName : path10.posix.join(normalizedWorkspacePath, oxlintConfigFileName);
56260
+ const existingConfigPath = existingJsonOxlintConfigPath({
56261
+ scanDirectory,
56262
+ outputDirectory,
56263
+ workspacePath: normalizedWorkspacePath
56264
+ });
56265
+ const existingConfig = existingConfigPath === null ? {} : readJsonRecord(existingConfigPath);
56266
+ writeArtifact({
56267
+ outputDirectory,
56268
+ relativePath: configFile,
56269
+ content: encodeOxlintConfigTs({ existingConfig, assets })
56270
+ });
56271
+ const packageJsonFile = manifestRelativePath;
56272
+ const packageJsonPath = sourceOrOutputPath({
56273
+ scanDirectory,
56274
+ outputDirectory,
56275
+ relativePath: packageJsonFile
56276
+ });
56277
+ const packageJson = packageJsonPath === null ? {} : readJsonRecord(packageJsonPath);
56278
+ const requiredDevDependencies = uniqueSorted([
56279
+ "oxlint",
56280
+ "ultracite",
56281
+ ...assets.flatMap((asset) => asset.requiredDevDependencies)
56282
+ ]);
56283
+ const patchedPackageJson = patchPackageJsonDependencies({
56284
+ packageJson,
56285
+ packageNames: requiredDevDependencies,
56286
+ rootPackageJson,
56287
+ isRootWorkspace: normalizedWorkspacePath === "."
56288
+ });
56289
+ writeArtifact({
56290
+ outputDirectory,
56291
+ relativePath: packageJsonFile,
56292
+ content: encodePrettyJson(patchedPackageJson)
56293
+ });
56294
+ applied.push({
56295
+ workspace: normalizedWorkspacePath,
56296
+ configFile,
56297
+ packageJsonFile,
56298
+ assets: assets.map((asset) => asset.id),
56299
+ requiredDevDependencies
56300
+ });
56301
+ }
56302
+ return applied.toSorted((left3, right3) => left3.workspace.localeCompare(right3.workspace));
56173
56303
  };
56174
56304
  var detectedWorkspaces = (scanDirectory, detection) => detection.manifests.map((manifest) => path10.posix.dirname(relativePosixPath(scanDirectory, manifest.path))).filter((workspace) => workspace !== "" && workspace !== ".").toSorted();
56175
56305
  var packsForWorkspace = ({
@@ -56580,11 +56710,17 @@ var writeScaffoldOutput = ({
56580
56710
  const hookFiles = [];
56581
56711
  const harnessFiles = [];
56582
56712
  const finalSkills = selectedSkills(finalPacks, baseline);
56583
- const hasOxlint = detectionHasPackage(detection, "oxlint");
56584
56713
  const hasOxfmt = detectionHasPackage(detection, "oxfmt");
56585
56714
  const hasPython = detection.detectedLanguages.includes("python");
56586
56715
  const finalHookIds = selectedHookIds(finalPacks, baseline).filter((hookId) => hookId !== "format-edited-file" || hasOxfmt || hasPython);
56587
- const lintAssets = hasOxlint ? resolveLintAssetsForPacks(finalPacks, baseline) : [];
56716
+ const lintAssets = resolveLintAssetsForPacks(finalPacks, baseline);
56717
+ const appliedLintConfigs = writeAppliedLintConfigs({
56718
+ scanDirectory,
56719
+ outputDirectory,
56720
+ detection,
56721
+ finalPacks,
56722
+ baseline
56723
+ });
56588
56724
  const lintAssetIdsByPack = Object.fromEntries(finalPacks.map((packId) => [
56589
56725
  packId,
56590
56726
  lintAssets.filter((asset) => asset.sourcePacks.includes(packId)).map((asset) => asset.id)
@@ -56638,10 +56774,15 @@ var writeScaffoldOutput = ({
56638
56774
  finalPacks,
56639
56775
  selectedAssetIds: lintAssets.map((asset) => asset.id),
56640
56776
  selectedAssetsByPack: lintAssetIdsByPack,
56641
- requiredDevDependencies: uniqueSorted(lintAssets.flatMap((asset) => asset.requiredDevDependencies)),
56777
+ requiredDevDependencies: uniqueSorted([
56778
+ "oxlint",
56779
+ "ultracite",
56780
+ ...lintAssets.flatMap((asset) => asset.requiredDevDependencies)
56781
+ ]),
56642
56782
  existingRootOxlintConfigFiles: rootOxlintConfigFiles,
56643
56783
  starterConfigFile: lintStarterConfigFile,
56644
- recommendedIgnorePatterns: oxlintStarterConfig.ignorePatterns
56784
+ ultraciteCorePreset: "ultracite/oxlint/core",
56785
+ appliedLintConfigs
56645
56786
  })
56646
56787
  }));
56647
56788
  lintSpecFiles.push(lintSelectionFile);
@@ -56727,7 +56868,7 @@ var writeScaffoldOutput = ({
56727
56868
  }));
56728
56869
  hookFiles.push(hook.outputPath);
56729
56870
  }
56730
- execFileSync5(process.execPath, [path10.join(outputDirectory, syncScriptFile)], {
56871
+ execFileSync4(process.execPath, [path10.join(outputDirectory, syncScriptFile)], {
56731
56872
  cwd: outputDirectory,
56732
56873
  stdio: "ignore"
56733
56874
  });
@@ -56801,6 +56942,7 @@ var writeScaffoldOutput = ({
56801
56942
  promptSpecs,
56802
56943
  opensrcReferences,
56803
56944
  lintAssets,
56945
+ appliedLintConfigs,
56804
56946
  subagentManifestSpec,
56805
56947
  baseline: baseline.summary,
56806
56948
  version,
@@ -56843,7 +56985,7 @@ var writeScaffoldOutput = ({
56843
56985
  // src/scaffold/run.ts
56844
56986
  var yesValues = new Set(["", "y", "yes"]);
56845
56987
  var encodeJson2 = encodeSync(parseJson(Unknown));
56846
- var encodePrettyJson = (value6) => JSON.stringify(JSON.parse(encodeJson2(value6)), null, 2);
56988
+ var encodePrettyJson2 = (value6) => JSON.stringify(JSON.parse(encodeJson2(value6)), null, 2);
56847
56989
  var agentSystemPromptFile = ".devpunks/AGENT-SYSTEM-PROMPT.md";
56848
56990
  var clipboardWorkingDirectory = homedir2();
56849
56991
  var writeAgentSystemPrompt = ({
@@ -56876,7 +57018,7 @@ var tryClipboardCommand = ({
56876
57018
  }
56877
57019
  };
56878
57020
  var defaultClipboardExecFile = (command, args2, options9) => {
56879
- execFileSync6(command, [...args2], {
57021
+ execFileSync5(command, [...args2], {
56880
57022
  cwd: options9.cwd,
56881
57023
  input: options9.input,
56882
57024
  stdio: ["pipe", "ignore", "ignore"]
@@ -57155,7 +57297,7 @@ var runScaffold = ({
57155
57297
  yield* prompt4.writeLine("");
57156
57298
  yield* prompt4.writeLine(renderDivider());
57157
57299
  yield* prompt4.writeLine(renderJsonLabel());
57158
- yield* prompt4.writeLine(encodePrettyJson(result));
57300
+ yield* prompt4.writeLine(encodePrettyJson2(result));
57159
57301
  }
57160
57302
  yield* submitCliEventEffect("cli.scaffold.setup.completed", {
57161
57303
  cwd: scanDirectory,
@@ -57180,9 +57322,10 @@ import {
57180
57322
  import path12 from "path";
57181
57323
 
57182
57324
  // src/content/wiki.ts
57183
- var makeWikiScaffoldTemplate = (wikiRoot) => ({
57184
- wikiRoot,
57185
- agentsMarkdown: `# Wiki Schema
57325
+ var makeWikiScaffoldTemplate = (wikiRoot, wikiFramework = "next") => {
57326
+ const template = {
57327
+ wikiRoot,
57328
+ agentsMarkdown: `# Wiki Schema
57186
57329
 
57187
57330
  This file defines how any agent operates within \`${wikiRoot}/\`. Read it before creating or modifying wiki content.
57188
57331
 
@@ -57315,10 +57458,10 @@ When processing source material into routed domain knowledge:
57315
57458
  - \`docs/\` owns implemented architecture and reference (the "how it works now")
57316
57459
  - \`content/docs/project/tech-debt/<domain>/<spec>/<debt-slug>.md\` owns persistent implementation drift tied to one spec; keep temporary execution notes in the spec folder instead
57317
57460
  `,
57318
- files: [
57319
- {
57320
- path: "package.json",
57321
- content: `{
57461
+ files: [
57462
+ {
57463
+ path: "package.json",
57464
+ content: `{
57322
57465
  "name": "@repo/wiki",
57323
57466
  "version": "0.0.0",
57324
57467
  "private": true,
@@ -57355,10 +57498,17 @@ When processing source material into routed domain knowledge:
57355
57498
  }
57356
57499
  }
57357
57500
  `
57358
- },
57359
- {
57360
- path: "next.config.mjs",
57361
- content: `import { createMDX } from "fumadocs-mdx/next";
57501
+ },
57502
+ {
57503
+ path: ".gitignore",
57504
+ content: `node_modules
57505
+ .next
57506
+ .source
57507
+ `
57508
+ },
57509
+ {
57510
+ path: "next.config.mjs",
57511
+ content: `import { createMDX } from "fumadocs-mdx/next";
57362
57512
 
57363
57513
  const withMDX = createMDX();
57364
57514
 
@@ -57377,10 +57527,10 @@ const config = {
57377
57527
 
57378
57528
  export default withMDX(config);
57379
57529
  `
57380
- },
57381
- {
57382
- path: "scripts/sync-content.mjs",
57383
- content: `import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from "node:fs";
57530
+ },
57531
+ {
57532
+ path: "scripts/sync-content.mjs",
57533
+ content: `import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from "node:fs";
57384
57534
  import path from "node:path";
57385
57535
  import { fileURLToPath } from "node:url";
57386
57536
 
@@ -57598,10 +57748,10 @@ if (repoRoot) {
57598
57748
  console.log("No repository root detected; using checked-in wiki content.");
57599
57749
  }
57600
57750
  `
57601
- },
57602
- {
57603
- path: "postcss.config.mjs",
57604
- content: `const config = {
57751
+ },
57752
+ {
57753
+ path: "postcss.config.mjs",
57754
+ content: `const config = {
57605
57755
  plugins: {
57606
57756
  "@tailwindcss/postcss": {},
57607
57757
  },
@@ -57609,10 +57759,10 @@ if (repoRoot) {
57609
57759
 
57610
57760
  export default config;
57611
57761
  `
57612
- },
57613
- {
57614
- path: "source.config.ts",
57615
- content: `import { metaSchema, pageSchema } from "fumadocs-core/source/schema";
57762
+ },
57763
+ {
57764
+ path: "source.config.ts",
57765
+ content: `import { metaSchema, pageSchema } from "fumadocs-core/source/schema";
57616
57766
  import { remarkMdxMermaid } from "fumadocs-core/mdx-plugins";
57617
57767
  import { defineConfig, defineDocs } from "fumadocs-mdx/config";
57618
57768
  import { z } from "zod";
@@ -57641,10 +57791,10 @@ export default defineConfig({
57641
57791
  },
57642
57792
  });
57643
57793
  `
57644
- },
57645
- {
57646
- path: "tsconfig.json",
57647
- content: `{
57794
+ },
57795
+ {
57796
+ path: "tsconfig.json",
57797
+ content: `{
57648
57798
  "compilerOptions": {
57649
57799
  "target": "ESNext",
57650
57800
  "lib": ["dom", "dom.iterable", "esnext"],
@@ -57676,10 +57826,10 @@ export default defineConfig({
57676
57826
  "exclude": ["node_modules"]
57677
57827
  }
57678
57828
  `
57679
- },
57680
- {
57681
- path: "src/app/global.css",
57682
- content: `@import "tailwindcss";
57829
+ },
57830
+ {
57831
+ path: "src/app/global.css",
57832
+ content: `@import "tailwindcss";
57683
57833
  @import "fumadocs-ui/css/neutral.css";
57684
57834
  @import "fumadocs-ui/css/preset.css";
57685
57835
 
@@ -57691,10 +57841,10 @@ body {
57691
57841
  background-color: var(--color-fd-background);
57692
57842
  }
57693
57843
  `
57694
- },
57695
- {
57696
- path: "src/app/layout.tsx",
57697
- content: `import { RootProvider } from "fumadocs-ui/provider/next";
57844
+ },
57845
+ {
57846
+ path: "src/app/layout.tsx",
57847
+ content: `import { RootProvider } from "fumadocs-ui/provider/next";
57698
57848
  import type { Metadata } from "next";
57699
57849
  import { Inter } from "next/font/google";
57700
57850
 
@@ -57724,10 +57874,10 @@ export default function Layout({ children }: LayoutProps<"/">) {
57724
57874
  );
57725
57875
  }
57726
57876
  `
57727
- },
57728
- {
57729
- path: "src/app/(home)/layout.tsx",
57730
- content: `import { HomeLayout } from "fumadocs-ui/layouts/home";
57877
+ },
57878
+ {
57879
+ path: "src/app/(home)/layout.tsx",
57880
+ content: `import { HomeLayout } from "fumadocs-ui/layouts/home";
57731
57881
 
57732
57882
  import { baseOptions } from "@/lib/layout.shared";
57733
57883
 
@@ -57735,10 +57885,10 @@ export default function Layout({ children }: LayoutProps<"/">) {
57735
57885
  return <HomeLayout {...baseOptions()}>{children}</HomeLayout>;
57736
57886
  }
57737
57887
  `
57738
- },
57739
- {
57740
- path: "src/app/(home)/page.tsx",
57741
- content: `import Link from "next/link";
57888
+ },
57889
+ {
57890
+ path: "src/app/(home)/page.tsx",
57891
+ content: `import Link from "next/link";
57742
57892
 
57743
57893
  export default function HomePage() {
57744
57894
  return (
@@ -57755,10 +57905,10 @@ export default function HomePage() {
57755
57905
  );
57756
57906
  }
57757
57907
  `
57758
- },
57759
- {
57760
- path: "src/app/docs/layout.tsx",
57761
- content: `import { DocsLayout } from "fumadocs-ui/layouts/docs";
57908
+ },
57909
+ {
57910
+ path: "src/app/docs/layout.tsx",
57911
+ content: `import { DocsLayout } from "fumadocs-ui/layouts/docs";
57762
57912
 
57763
57913
  import { baseOptions } from "@/lib/layout.shared";
57764
57914
  import { getDocsPageTree } from "@/lib/source";
@@ -57771,16 +57921,16 @@ export default function Layout({ children }: LayoutProps<"/docs">) {
57771
57921
  );
57772
57922
  }
57773
57923
  `
57774
- },
57775
- {
57776
- path: "src/app/docs/[[...slug]]/page.tsx",
57777
- content: `import { DocsBody, DocsDescription, DocsPage, DocsTitle } from "fumadocs-ui/layouts/docs/page";
57924
+ },
57925
+ {
57926
+ path: "src/app/docs/[[...slug]]/page.tsx",
57927
+ content: `import { DocsBody, DocsDescription, DocsPage, DocsTitle } from "fumadocs-ui/layouts/docs/page";
57778
57928
  import { createRelativeLink } from "fumadocs-ui/mdx";
57779
57929
  import type { Metadata } from "next";
57780
57930
  import { notFound, redirect } from "next/navigation";
57781
57931
 
57782
57932
  import { getMDXComponents } from "@/components/mdx";
57783
- import { source } from "@/lib/source";
57933
+ import { getPageImage, source } from "@/lib/source";
57784
57934
 
57785
57935
  export default async function Page(props: PageProps<"/docs/[[...slug]]">) {
57786
57936
  const params = await props.params;
@@ -57818,6 +57968,9 @@ export async function generateMetadata(
57818
57968
  return {
57819
57969
  title: page.data.title,
57820
57970
  description: page.data.description,
57971
+ openGraph: {
57972
+ images: getPageImage(page).url,
57973
+ },
57821
57974
  };
57822
57975
  }
57823
57976
 
@@ -57828,10 +57981,10 @@ function redirectSectionLanding(slug?: string[]) {
57828
57981
  if (joinedSlug === "wiki") redirect("/docs/project");
57829
57982
  }
57830
57983
  `
57831
- },
57832
- {
57833
- path: "src/app/api/search/route.ts",
57834
- content: `import { createFromSource } from "fumadocs-core/search/server";
57984
+ },
57985
+ {
57986
+ path: "src/app/api/search/route.ts",
57987
+ content: `import { createFromSource } from "fumadocs-core/search/server";
57835
57988
 
57836
57989
  import { source } from "@/lib/source";
57837
57990
 
@@ -57839,10 +57992,43 @@ export const { GET } = createFromSource(source, {
57839
57992
  language: "english",
57840
57993
  });
57841
57994
  `
57842
- },
57995
+ },
57996
+ {
57997
+ path: "src/app/og/docs/[...slug]/route.tsx",
57998
+ content: `import { generate as DefaultImage } from "fumadocs-ui/og";
57999
+ import { notFound } from "next/navigation";
58000
+ import { ImageResponse } from "next/og";
58001
+
58002
+ import { appName } from "@/lib/shared";
58003
+ import { getPageImage, source } from "@/lib/source";
58004
+
58005
+ export const revalidate = false;
58006
+
58007
+ export async function GET(_req: Request, { params }: RouteContext<"/og/docs/[...slug]">) {
58008
+ const { slug } = await params;
58009
+ const page = source.getPage(slug.slice(0, -1));
58010
+ if (!page) notFound();
58011
+
58012
+ return new ImageResponse(
58013
+ <DefaultImage title={page.data.title} description={page.data.description} site={appName} />,
57843
58014
  {
57844
- path: "src/components/mdx.tsx",
57845
- content: `import defaultMdxComponents from "fumadocs-ui/mdx";
58015
+ width: 1200,
58016
+ height: 630,
58017
+ },
58018
+ );
58019
+ }
58020
+
58021
+ export function generateStaticParams() {
58022
+ return source.getPages().map((page) => ({
58023
+ lang: page.locale,
58024
+ slug: getPageImage(page).segments,
58025
+ }));
58026
+ }
58027
+ `
58028
+ },
58029
+ {
58030
+ path: "src/components/mdx.tsx",
58031
+ content: `import defaultMdxComponents from "fumadocs-ui/mdx";
57846
58032
  import type { MDXComponents } from "mdx/types";
57847
58033
 
57848
58034
  import { Mermaid } from "@/components/mdx/mermaid";
@@ -57861,10 +58047,10 @@ declare global {
57861
58047
  type MDXProvidedComponents = ReturnType<typeof getMDXComponents>;
57862
58048
  }
57863
58049
  `
57864
- },
57865
- {
57866
- path: "src/components/mdx/mermaid.tsx",
57867
- content: `"use client";
58050
+ },
58051
+ {
58052
+ path: "src/components/mdx/mermaid.tsx",
58053
+ content: `"use client";
57868
58054
 
57869
58055
  import { use, useEffect, useId, useState } from "react";
57870
58056
  import { useTheme } from "next-themes";
@@ -57918,10 +58104,10 @@ function MermaidContent({ chart }: { chart: string }) {
57918
58104
  );
57919
58105
  }
57920
58106
  `
57921
- },
57922
- {
57923
- path: "src/lib/layout.shared.tsx",
57924
- content: `import type { BaseLayoutProps } from "fumadocs-ui/layouts/shared";
58107
+ },
58108
+ {
58109
+ path: "src/lib/layout.shared.tsx",
58110
+ content: `import type { BaseLayoutProps } from "fumadocs-ui/layouts/shared";
57925
58111
 
57926
58112
  import { appName, gitConfig } from "./shared";
57927
58113
 
@@ -57934,10 +58120,10 @@ export function baseOptions(): BaseLayoutProps {
57934
58120
  };
57935
58121
  }
57936
58122
  `
57937
- },
57938
- {
57939
- path: "src/lib/shared.ts",
57940
- content: `export const appName = "Project Wiki";
58123
+ },
58124
+ {
58125
+ path: "src/lib/shared.ts",
58126
+ content: `export const appName = "Project Wiki";
57941
58127
  export const docsRoute = "/docs";
57942
58128
  export const docsImageRoute = "/og/docs";
57943
58129
  export const docsContentRoute = "/llms.mdx/docs";
@@ -57949,10 +58135,10 @@ export const gitConfig = {
57949
58135
  docsPath: "${wikiRoot}/content/docs",
57950
58136
  };
57951
58137
  `
57952
- },
57953
- {
57954
- path: "src/lib/source.ts",
57955
- content: `import { docs } from "collections/server";
58138
+ },
58139
+ {
58140
+ path: "src/lib/source.ts",
58141
+ content: `import { docs } from "collections/server";
57956
58142
  import type { Folder, Item, Node, Root } from "fumadocs-core/page-tree";
57957
58143
  import { loader } from "fumadocs-core/source";
57958
58144
  import { lucideIconsPlugin } from "fumadocs-core/source/lucide-icons";
@@ -58019,18 +58205,18 @@ export function getPageMarkdownUrl(page: (typeof source)["$inferPage"]) {
58019
58205
  };
58020
58206
  }
58021
58207
  `
58022
- },
58023
- {
58024
- path: "content/docs/meta.json",
58025
- content: `{
58208
+ },
58209
+ {
58210
+ path: "content/docs/meta.json",
58211
+ content: `{
58026
58212
  "title": "Project Docs",
58027
58213
  "pages": ["project"]
58028
58214
  }
58029
58215
  `
58030
- },
58031
- {
58032
- path: "content/docs/project/meta.json",
58033
- content: `{
58216
+ },
58217
+ {
58218
+ path: "content/docs/project/meta.json",
58219
+ content: `{
58034
58220
  "title": "Project",
58035
58221
  "description": "Internal project operations",
58036
58222
  "pages": [
@@ -58046,10 +58232,10 @@ export function getPageMarkdownUrl(page: (typeof source)["$inferPage"]) {
58046
58232
  ]
58047
58233
  }
58048
58234
  `
58049
- },
58050
- {
58051
- path: "content/docs/project/index.mdx",
58052
- content: `---
58235
+ },
58236
+ {
58237
+ path: "content/docs/project/index.mdx",
58238
+ content: `---
58053
58239
  title: Project
58054
58240
  description: Internal project operations and guidance
58055
58241
  surface: project
@@ -58058,20 +58244,20 @@ permission: project
58058
58244
 
58059
58245
  This surface is for specs, implementation notes, maintenance logs, decisions, repo guidance, runbooks, and durable project context.
58060
58246
  `
58061
- },
58062
- {
58063
- path: "content/docs/project/domains/meta.json",
58064
- content: `{
58247
+ },
58248
+ {
58249
+ path: "content/docs/project/domains/meta.json",
58250
+ content: `{
58065
58251
  "title": "Domains",
58066
58252
  "pages": [
58067
58253
  "index"
58068
58254
  ]
58069
58255
  }
58070
58256
  `
58071
- },
58072
- {
58073
- path: "content/docs/project/domains/index.mdx",
58074
- content: `---
58257
+ },
58258
+ {
58259
+ path: "content/docs/project/domains/index.mdx",
58260
+ content: `---
58075
58261
  title: Domains
58076
58262
  description: Project-owned domain source index
58077
58263
  surface: project
@@ -58082,166 +58268,549 @@ Use this section for project-side domain source indexes when the repo defines du
58082
58268
 
58083
58269
  Readable domain articles should live at the project-owned routes the repo defines, such as \`/docs/cli\` or \`/docs/harness\`. Do not create \`${wikiRoot}/domains\`; domain source indexes belong here under \`${wikiRoot}/content/docs/project/domains\`.
58084
58270
  `
58085
- },
58086
- {
58087
- path: "content/docs/project/grilling/meta.json",
58088
- content: `{
58271
+ },
58272
+ {
58273
+ path: "content/docs/project/grilling/meta.json",
58274
+ content: `{
58089
58275
  "title": "Grilling",
58090
58276
  "pages": ["index"]
58091
58277
  }
58092
58278
  `
58093
- },
58094
- {
58095
- path: "content/docs/project/grilling/index.mdx",
58096
- content: `---
58279
+ },
58280
+ {
58281
+ path: "content/docs/project/grilling/index.mdx",
58282
+ content: `---
58097
58283
  title: Grilling
58098
58284
  description: Requirements discovery logs and status artifacts
58099
58285
  surface: project
58100
58286
  permission: project
58101
58287
  ---
58102
58288
 
58103
- Use this section for durable requirements-grill outputs that should be discoverable in the wiki.
58104
- `
58105
- },
58106
- {
58107
- path: "content/docs/project/specs/meta.json",
58108
- content: `{
58109
- "title": "Specs",
58110
- "pages": ["index"]
58289
+ Use this section for durable requirements-grill outputs that should be discoverable in the wiki.
58290
+ `
58291
+ },
58292
+ {
58293
+ path: "content/docs/project/specs/meta.json",
58294
+ content: `{
58295
+ "title": "Specs",
58296
+ "pages": ["index"]
58297
+ }
58298
+ `
58299
+ },
58300
+ {
58301
+ path: "content/docs/project/specs/index.mdx",
58302
+ content: `---
58303
+ title: Specs
58304
+ description: Approved specs and implementation notes
58305
+ surface: project
58306
+ permission: project
58307
+ ---
58308
+
58309
+ Use this section for approved specs and implementation notes that should be browsable in the wiki.
58310
+ `
58311
+ },
58312
+ {
58313
+ path: "content/docs/project/tech-debt/meta.json",
58314
+ content: `{
58315
+ "title": "Tech Debts",
58316
+ "pages": ["index"]
58317
+ }
58318
+ `
58319
+ },
58320
+ {
58321
+ path: "content/docs/project/tech-debt/index.mdx",
58322
+ content: `---
58323
+ title: Tech Debts
58324
+ description: Persistent implementation drift tied to specs
58325
+ surface: project
58326
+ permission: project
58327
+ ---
58328
+
58329
+ Use this section for accepted or resolved debt artifacts that need long-lived project visibility.
58330
+ `
58331
+ },
58332
+ {
58333
+ path: "content/docs/project/maintenance/meta.json",
58334
+ content: `{
58335
+ "title": "Maintenance",
58336
+ "pages": ["index"]
58337
+ }
58338
+ `
58339
+ },
58340
+ {
58341
+ path: "content/docs/project/maintenance/index.mdx",
58342
+ content: `---
58343
+ title: Maintenance
58344
+ description: Maintenance logs and operational records
58345
+ surface: project
58346
+ permission: project
58347
+ ---
58348
+
58349
+ Use this section for durable maintenance records.
58350
+ `
58351
+ },
58352
+ {
58353
+ path: "content/docs/project/runbooks/meta.json",
58354
+ content: `{
58355
+ "title": "Runbooks",
58356
+ "pages": ["index"]
58357
+ }
58358
+ `
58359
+ },
58360
+ {
58361
+ path: "content/docs/project/runbooks/index.mdx",
58362
+ content: `---
58363
+ title: Runbooks
58364
+ description: Operator procedures and recovery notes
58365
+ surface: project
58366
+ permission: project
58367
+ ---
58368
+
58369
+ Use this section for operator runbooks.
58370
+ `
58371
+ },
58372
+ {
58373
+ path: "content/docs/project/decisions/meta.json",
58374
+ content: `{
58375
+ "title": "Decisions",
58376
+ "pages": ["index"]
58377
+ }
58378
+ `
58379
+ },
58380
+ {
58381
+ path: "content/docs/project/decisions/index.mdx",
58382
+ content: `---
58383
+ title: Decisions
58384
+ description: Durable project decisions
58385
+ surface: project
58386
+ permission: project
58387
+ ---
58388
+
58389
+ Use this section for decisions that should outlive a single implementation run.
58390
+ `
58391
+ },
58392
+ {
58393
+ path: "content/docs/project/repo-guidance/meta.json",
58394
+ content: `{
58395
+ "title": "Repo Guidance",
58396
+ "pages": ["index"]
58397
+ }
58398
+ `
58399
+ },
58400
+ {
58401
+ path: "content/docs/project/repo-guidance/index.mdx",
58402
+ content: `---
58403
+ title: Repo Guidance
58404
+ description: Repository-specific operating guidance
58405
+ surface: project
58406
+ permission: project
58407
+ ---
58408
+
58409
+ Use this section for durable repository guidance that agents should discover through the wiki.
58410
+ `
58411
+ }
58412
+ ],
58413
+ indexMarkdown: `# Wiki Index
58414
+
58415
+ Use this file as the top-level page map for the wiki.
58416
+
58417
+ Seed sections as the repo grows:
58418
+
58419
+ - Domains
58420
+ - Specs
58421
+ - Decisions
58422
+ - Recent ingest activity
58423
+ `,
58424
+ logMarkdown: `# Wiki Log
58425
+
58426
+ Append ingest activity here. Keep only the most recent 50 entries.
58427
+ `,
58428
+ rawSubdirectories: ["assets", "external", "meetings"],
58429
+ topLevelDirectories: ["content/docs/project", "raw", "specs"]
58430
+ };
58431
+ if (wikiFramework === "next") {
58432
+ return template;
58433
+ }
58434
+ return {
58435
+ ...template,
58436
+ files: [
58437
+ ...template.files.filter((file6) => !tanstackReplacementPaths.has(file6.path)),
58438
+ ...makeTanstackStartWikiFiles()
58439
+ ]
58440
+ };
58441
+ };
58442
+ var tanstackReplacementPaths = new Set([
58443
+ "package.json",
58444
+ ".gitignore",
58445
+ "next.config.mjs",
58446
+ "postcss.config.mjs",
58447
+ "tsconfig.json",
58448
+ "src/app/global.css",
58449
+ "src/app/layout.tsx",
58450
+ "src/app/(home)/layout.tsx",
58451
+ "src/app/(home)/page.tsx",
58452
+ "src/app/docs/layout.tsx",
58453
+ "src/app/docs/[[...slug]]/page.tsx",
58454
+ "src/app/og/docs/[...slug]/route.tsx",
58455
+ "src/app/api/search/route.ts",
58456
+ "src/lib/source.ts"
58457
+ ]);
58458
+ var makeTanstackStartWikiFiles = () => [
58459
+ {
58460
+ path: "package.json",
58461
+ content: `{
58462
+ "name": "@repo/wiki",
58463
+ "version": "0.0.0",
58464
+ "private": true,
58465
+ "type": "module",
58466
+ "sideEffects": false,
58467
+ "scripts": {
58468
+ "build": "node ./scripts/sync-content.mjs && fumadocs-mdx && vite build",
58469
+ "check": "oxlint . && oxfmt --check .",
58470
+ "check-types": "node ./scripts/sync-content.mjs && fumadocs-mdx && tsc --noEmit",
58471
+ "dev": "vite dev --port=4000",
58472
+ "postinstall": "fumadocs-mdx",
58473
+ "preview": "vite preview",
58474
+ "start": "node .output/server/index.mjs"
58475
+ },
58476
+ "dependencies": {
58477
+ "@tanstack/react-router": "1.170.8",
58478
+ "@tanstack/react-start": "1.168.13",
58479
+ "fumadocs-core": "16.8.7",
58480
+ "fumadocs-mdx": "14.3.2",
58481
+ "fumadocs-ui": "16.8.7",
58482
+ "lucide-react": "^1.14.0",
58483
+ "mermaid": "11.15.0",
58484
+ "next-themes": "0.4.6",
58485
+ "react": "^19.2.5",
58486
+ "react-dom": "^19.2.5",
58487
+ "tailwind-merge": "^3.5.0",
58488
+ "zod": "^4.1.13"
58489
+ },
58490
+ "devDependencies": {
58491
+ "@tailwindcss/vite": "^4.3.0",
58492
+ "@types/mdx": "^2.0.13",
58493
+ "@types/node": "^25.6.0",
58494
+ "@types/react": "^19.2.14",
58495
+ "@types/react-dom": "^19.2.3",
58496
+ "@vitejs/plugin-react": "^6.0.2",
58497
+ "nitro": "3.0.260522-beta",
58498
+ "tailwindcss": "^4.2.4",
58499
+ "typescript": "^5.8.3",
58500
+ "vite": "^8.0.14",
58501
+ "vite-tsconfig-paths": "^5.1.4"
58502
+ }
58503
+ }
58504
+ `
58505
+ },
58506
+ {
58507
+ path: ".gitignore",
58508
+ content: `node_modules
58509
+ .cache
58510
+ .vercel
58511
+ .output
58512
+ .nitro
58513
+ .tanstack
58514
+ .next
58515
+ .source
58516
+ /build/
58517
+ /api/
58518
+ /server/build
58519
+ `
58520
+ },
58521
+ {
58522
+ path: "vite.config.ts",
58523
+ content: `import { tanstackStart } from "@tanstack/react-start/plugin/vite";
58524
+ import react from "@vitejs/plugin-react";
58525
+ import mdx from "fumadocs-mdx/vite";
58526
+ import { nitro } from "nitro/vite";
58527
+ import tailwindcss from "@tailwindcss/vite";
58528
+ import { defineConfig } from "vite";
58529
+ import tsconfigPaths from "vite-tsconfig-paths";
58530
+
58531
+ export default defineConfig({
58532
+ server: {
58533
+ port: 4000,
58534
+ },
58535
+ plugins: [
58536
+ mdx(await import("./source.config")),
58537
+ tailwindcss(),
58538
+ tsconfigPaths({
58539
+ projects: ["./tsconfig.json"],
58540
+ }),
58541
+ tanstackStart({
58542
+ prerender: {
58543
+ enabled: true,
58544
+ },
58545
+ }),
58546
+ react(),
58547
+ nitro({
58548
+ preset: "node-server",
58549
+ }),
58550
+ ],
58551
+ });
58552
+ `
58553
+ },
58554
+ {
58555
+ path: "tsconfig.json",
58556
+ content: `{
58557
+ "compilerOptions": {
58558
+ "target": "ESNext",
58559
+ "lib": ["dom", "dom.iterable", "esnext"],
58560
+ "allowJs": true,
58561
+ "skipLibCheck": true,
58562
+ "strict": true,
58563
+ "forceConsistentCasingInFileNames": true,
58564
+ "noEmit": true,
58565
+ "esModuleInterop": true,
58566
+ "module": "esnext",
58567
+ "moduleResolution": "bundler",
58568
+ "resolveJsonModule": true,
58569
+ "isolatedModules": true,
58570
+ "jsx": "react-jsx",
58571
+ "paths": {
58572
+ "@/*": ["./src/*"],
58573
+ "collections/*": ["./.source/*"]
58574
+ }
58575
+ },
58576
+ "include": ["**/*.ts", "**/*.tsx", ".source/**/*.ts"],
58577
+ "exclude": ["node_modules"]
58578
+ }
58579
+ `
58580
+ },
58581
+ {
58582
+ path: "src/styles/app.css",
58583
+ content: `@import "tailwindcss";
58584
+ @import "fumadocs-ui/css/neutral.css";
58585
+ @import "fumadocs-ui/css/preset.css";
58586
+
58587
+ :root {
58588
+ --fd-layout-width: 1680px;
58589
+ }
58590
+
58591
+ html {
58592
+ scrollbar-gutter: stable;
58593
+ }
58594
+
58595
+ body {
58596
+ background-color: var(--color-fd-background);
58111
58597
  }
58112
58598
  `
58113
- },
58114
- {
58115
- path: "content/docs/project/specs/index.mdx",
58116
- content: `---
58117
- title: Specs
58118
- description: Approved specs and implementation notes
58119
- surface: project
58120
- permission: project
58121
- ---
58599
+ },
58600
+ {
58601
+ path: "src/router.tsx",
58602
+ content: `import { createRouter } from "@tanstack/react-router";
58122
58603
 
58123
- Use this section for approved specs and implementation notes that should be browsable in the wiki.
58124
- `
58125
- },
58126
- {
58127
- path: "content/docs/project/tech-debt/meta.json",
58128
- content: `{
58129
- "title": "Tech Debts",
58130
- "pages": ["index"]
58604
+ import { routeTree } from "./routeTree.gen";
58605
+
58606
+ export function getRouter() {
58607
+ return createRouter({
58608
+ routeTree,
58609
+ defaultPreload: "intent",
58610
+ scrollRestoration: true,
58611
+ });
58131
58612
  }
58132
58613
  `
58133
- },
58134
- {
58135
- path: "content/docs/project/tech-debt/index.mdx",
58136
- content: `---
58137
- title: Tech Debts
58138
- description: Persistent implementation drift tied to specs
58139
- surface: project
58140
- permission: project
58141
- ---
58614
+ },
58615
+ {
58616
+ path: "src/routes/__root.tsx",
58617
+ content: `import { createRootRoute, HeadContent, Outlet, Scripts } from "@tanstack/react-router";
58618
+ import { RootProvider } from "fumadocs-ui/provider/tanstack";
58619
+
58620
+ import appCss from "@/styles/app.css?url";
58621
+
58622
+ export const Route = createRootRoute({
58623
+ head: () => ({
58624
+ meta: [
58625
+ { charSet: "utf-8" },
58626
+ { name: "viewport", content: "width=device-width, initial-scale=1" },
58627
+ { title: "Project Wiki" },
58628
+ { name: "robots", content: "noindex, nofollow" },
58629
+ ],
58630
+ links: [{ rel: "stylesheet", href: appCss }],
58631
+ }),
58632
+ component: RootComponent,
58633
+ });
58142
58634
 
58143
- Use this section for accepted or resolved debt artifacts that need long-lived project visibility.
58144
- `
58145
- },
58146
- {
58147
- path: "content/docs/project/maintenance/meta.json",
58148
- content: `{
58149
- "title": "Maintenance",
58150
- "pages": ["index"]
58635
+ function RootComponent() {
58636
+ return (
58637
+ <html lang="en" suppressHydrationWarning>
58638
+ <head>
58639
+ <HeadContent />
58640
+ </head>
58641
+ <body className="flex flex-col min-h-screen">
58642
+ <RootProvider>
58643
+ <Outlet />
58644
+ </RootProvider>
58645
+ <Scripts />
58646
+ </body>
58647
+ </html>
58648
+ );
58151
58649
  }
58152
58650
  `
58153
- },
58154
- {
58155
- path: "content/docs/project/maintenance/index.mdx",
58156
- content: `---
58157
- title: Maintenance
58158
- description: Maintenance logs and operational records
58159
- surface: project
58160
- permission: project
58161
- ---
58651
+ },
58652
+ {
58653
+ path: "src/routes/index.tsx",
58654
+ content: `import { createFileRoute, Link } from "@tanstack/react-router";
58162
58655
 
58163
- Use this section for durable maintenance records.
58164
- `
58165
- },
58166
- {
58167
- path: "content/docs/project/runbooks/meta.json",
58168
- content: `{
58169
- "title": "Runbooks",
58170
- "pages": ["index"]
58656
+ export const Route = createFileRoute("/")({
58657
+ component: HomePage,
58658
+ });
58659
+
58660
+ function HomePage() {
58661
+ return (
58662
+ <main className="flex flex-col justify-center text-center flex-1">
58663
+ <h1 className="text-2xl font-bold mb-4">Project Wiki</h1>
58664
+ <p>
58665
+ Open{" "}
58666
+ <Link to="/docs/$" params={{ _splat: "project" }} className="font-medium underline">
58667
+ /docs/project
58668
+ </Link>
58669
+ .
58670
+ </p>
58671
+ </main>
58672
+ );
58171
58673
  }
58172
58674
  `
58173
- },
58174
- {
58175
- path: "content/docs/project/runbooks/index.mdx",
58176
- content: `---
58177
- title: Runbooks
58178
- description: Operator procedures and recovery notes
58179
- surface: project
58180
- permission: project
58181
- ---
58675
+ },
58676
+ {
58677
+ path: "src/routes/docs/$.tsx",
58678
+ content: `import { createFileRoute, notFound, redirect } from "@tanstack/react-router";
58679
+ import { createServerFn } from "@tanstack/react-start";
58680
+ import browserCollections from "collections/browser";
58681
+ import { useFumadocsLoader } from "fumadocs-core/source/client";
58682
+ import { DocsLayout } from "fumadocs-ui/layouts/docs";
58683
+ import { DocsBody, DocsDescription, DocsPage, DocsTitle } from "fumadocs-ui/layouts/docs/page";
58684
+ import { Suspense } from "react";
58685
+
58686
+ import { useMDXComponents } from "@/components/mdx";
58687
+ import { baseOptions } from "@/lib/layout.shared";
58688
+ import { getDocsPageTree, source } from "@/lib/source";
58182
58689
 
58183
- Use this section for operator runbooks.
58184
- `
58185
- },
58186
- {
58187
- path: "content/docs/project/decisions/meta.json",
58188
- content: `{
58189
- "title": "Decisions",
58190
- "pages": ["index"]
58690
+ export const Route = createFileRoute("/docs/$")({
58691
+ component: Page,
58692
+ loader: async ({ params }) => {
58693
+ const slugs = params._splat?.split("/") ?? [];
58694
+ if (slugs.length === 0 || slugs[0] === "wiki") {
58695
+ throw redirect({ to: "/docs/$", params: { _splat: "project" } });
58696
+ }
58697
+
58698
+ const data = await serverLoader({ data: slugs });
58699
+ await clientLoader.preload(data.path);
58700
+ return data;
58701
+ },
58702
+ });
58703
+
58704
+ const serverLoader = createServerFn({ method: "GET" })
58705
+ .inputValidator((slugs: string[]) => slugs)
58706
+ .handler(async ({ data: slugs }) => {
58707
+ const page = source.getPage(slugs);
58708
+ if (!page) throw notFound();
58709
+
58710
+ return {
58711
+ path: page.path,
58712
+ pageTree: await source.serializePageTree(getDocsPageTree()),
58713
+ };
58714
+ });
58715
+
58716
+ const clientLoader = browserCollections.docs.createClientLoader({
58717
+ component({ toc, frontmatter, default: MDX }) {
58718
+ return (
58719
+ <DocsPage toc={toc}>
58720
+ <DocsTitle>{frontmatter.title}</DocsTitle>
58721
+ <DocsDescription>{frontmatter.description}</DocsDescription>
58722
+ <DocsBody>
58723
+ <MDX components={useMDXComponents()} />
58724
+ </DocsBody>
58725
+ </DocsPage>
58726
+ );
58727
+ },
58728
+ });
58729
+
58730
+ function Page() {
58731
+ const { path, pageTree } = useFumadocsLoader(Route.useLoaderData());
58732
+
58733
+ return (
58734
+ <DocsLayout {...baseOptions()} tree={pageTree}>
58735
+ <Suspense>{clientLoader.useContent(path)}</Suspense>
58736
+ </DocsLayout>
58737
+ );
58191
58738
  }
58192
58739
  `
58193
- },
58194
- {
58195
- path: "content/docs/project/decisions/index.mdx",
58196
- content: `---
58197
- title: Decisions
58198
- description: Durable project decisions
58199
- surface: project
58200
- permission: project
58201
- ---
58740
+ },
58741
+ {
58742
+ path: "src/routes/api/search.ts",
58743
+ content: `import { createFileRoute } from "@tanstack/react-router";
58744
+ import { createFromSource } from "fumadocs-core/search/server";
58202
58745
 
58203
- Use this section for decisions that should outlive a single implementation run.
58204
- `
58746
+ import { source } from "@/lib/source";
58747
+
58748
+ const server = createFromSource(source, {
58749
+ language: "english",
58750
+ });
58751
+
58752
+ export const Route = createFileRoute("/api/search")({
58753
+ server: {
58754
+ handlers: {
58755
+ GET: async ({ request }) => server.GET(request),
58205
58756
  },
58206
- {
58207
- path: "content/docs/project/repo-guidance/meta.json",
58208
- content: `{
58209
- "title": "Repo Guidance",
58210
- "pages": ["index"]
58211
- }
58757
+ },
58758
+ });
58212
58759
  `
58213
- },
58214
- {
58215
- path: "content/docs/project/repo-guidance/index.mdx",
58216
- content: `---
58217
- title: Repo Guidance
58218
- description: Repository-specific operating guidance
58219
- surface: project
58220
- permission: project
58221
- ---
58760
+ },
58761
+ {
58762
+ path: "src/lib/source.ts",
58763
+ content: `import { docs } from "collections/server";
58764
+ import type { Folder, Item, Node, Root } from "fumadocs-core/page-tree";
58765
+ import { loader } from "fumadocs-core/source";
58766
+ import { lucideIconsPlugin } from "fumadocs-core/source/lucide-icons";
58222
58767
 
58223
- Use this section for durable repository guidance that agents should discover through the wiki.
58224
- `
58225
- }
58226
- ],
58227
- indexMarkdown: `# Wiki Index
58768
+ import { docsRoute } from "./shared";
58228
58769
 
58229
- Use this file as the top-level page map for the wiki.
58770
+ export const source = loader({
58771
+ baseUrl: docsRoute,
58772
+ source: docs.toFumadocsSource(),
58773
+ plugins: [lucideIconsPlugin()],
58774
+ });
58230
58775
 
58231
- Seed sections as the repo grows:
58776
+ export function getDocsPageTree(): Root {
58777
+ const tree = source.getPageTree();
58778
+ const project = findTopLevelFolder(tree, "Project");
58779
+ const projectIndex = findPageByUrl(tree.children, "/docs/project");
58232
58780
 
58233
- - Domains
58234
- - Specs
58235
- - Decisions
58236
- - Recent ingest activity
58237
- `,
58238
- logMarkdown: `# Wiki Log
58781
+ return {
58782
+ ...tree,
58783
+ children: [
58784
+ {
58785
+ type: "folder",
58786
+ name: "Internals",
58787
+ description: "Internal project operations, specs, runbooks, and decisions",
58788
+ root: true,
58789
+ index: projectIndex,
58790
+ children: project?.children ?? [],
58791
+ },
58792
+ ],
58793
+ };
58794
+ }
58239
58795
 
58240
- Append ingest activity here. Keep only the most recent 50 entries.
58241
- `,
58242
- rawSubdirectories: ["assets", "external", "meetings"],
58243
- topLevelDirectories: ["content/docs/project", "raw", "specs"]
58244
- });
58796
+ function findTopLevelFolder(tree: Root, name: string): Folder | undefined {
58797
+ return tree.children.find((node): node is Folder => node.type === "folder" && node.name === name);
58798
+ }
58799
+
58800
+ function findPageByUrl(nodes: Node[], url: string): Item | undefined {
58801
+ for (const node of nodes) {
58802
+ if (node.type === "page" && node.url === url) return node;
58803
+ if (node.type === "folder") {
58804
+ if (node.index?.url === url) return node.index;
58805
+
58806
+ const child = findPageByUrl(node.children, url);
58807
+ if (child) return child;
58808
+ }
58809
+ }
58810
+ }
58811
+ `
58812
+ }
58813
+ ];
58245
58814
 
58246
58815
  // src/content/stage-scaffold.ts
58247
58816
  var backlogProviderLabels = {
@@ -58250,6 +58819,10 @@ var backlogProviderLabels = {
58250
58819
  linear: "Linear",
58251
58820
  monday: "monday.com"
58252
58821
  };
58822
+ var wikiFrameworkLabels = {
58823
+ next: "Next.js",
58824
+ "tanstack-start": "TanStack Start"
58825
+ };
58253
58826
  var stageScaffoldCatalog = [
58254
58827
  {
58255
58828
  id: "init",
@@ -58257,7 +58830,8 @@ var stageScaffoldCatalog = [
58257
58830
  skills: ["requirements-grill", "write-backlog"],
58258
58831
  renderPrompt: ({
58259
58832
  wikiRoot,
58260
- backlogProvider
58833
+ backlogProvider,
58834
+ wikiFramework
58261
58835
  }) => `You are the operator agent continuing a \`punks scaffold init\` run.
58262
58836
 
58263
58837
  Do not start requirements discovery by default. First reconcile the generated output with this repository.
@@ -58278,6 +58852,11 @@ Backlog provider:
58278
58852
  - keep this provider pinned unless the user explicitly changes it
58279
58853
  - when backlog writing starts, use the matching \`write-backlog\` provider payload guidance
58280
58854
 
58855
+ Wiki framework:
58856
+ - selected framework: ${wikiFrameworkLabels[wikiFramework]} (\`${wikiFramework}\`)
58857
+ - keep this framework pinned unless the user explicitly changes it
58858
+ - \`punks update\` uses this pinned framework when checking wiki scaffold drift
58859
+
58281
58860
  Post-command guidance:
58282
58861
  1. Read the repository guidance and inspect the generated files.
58283
58862
  2. Move, rename, or refactor the generated wiki and skill output when needed so it matches the actual repo layout.
@@ -58298,6 +58877,10 @@ var backlogProviderLabels2 = {
58298
58877
  linear: "Linear",
58299
58878
  monday: "monday.com"
58300
58879
  };
58880
+ var wikiFrameworkLabels2 = {
58881
+ next: "Next.js",
58882
+ "tanstack-start": "TanStack Start"
58883
+ };
58301
58884
  var promptBacklogProvider = ({
58302
58885
  prompt: prompt4
58303
58886
  }) => exports_Effect.gen(function* () {
@@ -58332,6 +58915,32 @@ Selected backlog provider: ${backlogProviderLabels2[provider]} (\`${provider}\`)
58332
58915
 
58333
58916
  Keep this provider pinned unless the user explicitly changes it. When requirements are ready for backlog writing, use \`write-backlog\` with the matching provider payload guidance.
58334
58917
  `;
58918
+ var promptWikiFramework = ({
58919
+ prompt: prompt4
58920
+ }) => exports_Effect.gen(function* () {
58921
+ const answer = yield* prompt4.singleSelect({
58922
+ message: "Select wiki framework",
58923
+ defaultValue: "next",
58924
+ choices: [
58925
+ {
58926
+ title: "Next.js",
58927
+ value: "next",
58928
+ description: "default"
58929
+ },
58930
+ {
58931
+ title: "TanStack Start",
58932
+ value: "tanstack-start"
58933
+ }
58934
+ ]
58935
+ });
58936
+ return answer;
58937
+ });
58938
+ var renderWikiFrameworkMarkdown = (framework) => `# Wiki Framework
58939
+
58940
+ Selected wiki framework: ${wikiFrameworkLabels2[framework]} (\`${framework}\`).
58941
+
58942
+ Keep this framework pinned unless the user explicitly changes it. \`punks update\` uses this value when checking wiki scaffold drift.
58943
+ `;
58335
58944
  var copySkillDirectory = ({
58336
58945
  outputDirectory,
58337
58946
  skillId,
@@ -58383,39 +58992,118 @@ var withSyncContentPrefix = (script) => {
58383
58992
  return script;
58384
58993
  return `${syncContentPrefix}${script}`;
58385
58994
  };
58995
+ var mergePackageSection = (current, expected) => ({
58996
+ ...current,
58997
+ ...Object.fromEntries(Object.entries(expected).filter(([key, value6]) => current[key] !== value6))
58998
+ });
58999
+ var tanstackStartDependencies = {
59000
+ "@tanstack/react-router": "1.170.8",
59001
+ "@tanstack/react-start": "1.168.13",
59002
+ "fumadocs-core": "16.8.7",
59003
+ "fumadocs-mdx": "14.3.2",
59004
+ "fumadocs-ui": "16.8.7",
59005
+ "lucide-react": "^1.14.0",
59006
+ mermaid: "11.15.0",
59007
+ "next-themes": "0.4.6",
59008
+ react: "^19.2.5",
59009
+ "react-dom": "^19.2.5",
59010
+ "tailwind-merge": "^3.5.0",
59011
+ zod: "^4.1.13"
59012
+ };
59013
+ var tanstackStartDevDependencies = {
59014
+ "@tailwindcss/vite": "^4.3.0",
59015
+ "@types/mdx": "^2.0.13",
59016
+ "@types/node": "^25.6.0",
59017
+ "@types/react": "^19.2.14",
59018
+ "@types/react-dom": "^19.2.3",
59019
+ "@vitejs/plugin-react": "^6.0.2",
59020
+ nitro: "3.0.260522-beta",
59021
+ tailwindcss: "^4.2.4",
59022
+ typescript: "^5.8.3",
59023
+ vite: "^8.0.14",
59024
+ "vite-tsconfig-paths": "^5.1.4"
59025
+ };
58386
59026
  var updateExistingWikiPackage = ({
58387
59027
  outputDirectory,
58388
- packagePath
59028
+ packagePath,
59029
+ wikiFramework
58389
59030
  }) => {
58390
59031
  if (!existsSync6(packagePath))
58391
59032
  return null;
58392
59033
  const packageJson = JSON.parse(readFileSync7(packagePath, "utf8"));
58393
59034
  const scripts = packageJson.scripts;
58394
59035
  const dependencies = packageJson.dependencies ?? {};
58395
- const nextDependencies = {
58396
- ...dependencies,
58397
- mermaid: dependencies.mermaid ?? "11.15.0",
58398
- "next-themes": dependencies["next-themes"] ?? "0.4.6"
58399
- };
58400
- const nextScripts = scripts && {
59036
+ const devDependencies = packageJson.devDependencies ?? {};
59037
+ const expectedDependencies = wikiFramework === "next" ? {
59038
+ mermaid: "11.15.0",
59039
+ "next-themes": "0.4.6"
59040
+ } : tanstackStartDependencies;
59041
+ const expectedDevDependencies = wikiFramework === "next" ? {} : tanstackStartDevDependencies;
59042
+ const nextDependencies = mergePackageSection(dependencies, expectedDependencies);
59043
+ const nextDevDependencies = mergePackageSection(devDependencies, expectedDevDependencies);
59044
+ const nextScripts = wikiFramework === "next" ? scripts === undefined ? undefined : {
58401
59045
  ...scripts,
58402
59046
  build: withSyncContentPrefix(scripts.build),
58403
59047
  "check-types": withSyncContentPrefix(scripts["check-types"]),
58404
59048
  "types:check": withSyncContentPrefix(scripts["types:check"])
59049
+ } : {
59050
+ ...scripts,
59051
+ build: "node ./scripts/sync-content.mjs && fumadocs-mdx && vite build",
59052
+ check: "oxlint . && oxfmt --check .",
59053
+ "check-types": "node ./scripts/sync-content.mjs && fumadocs-mdx && tsc --noEmit",
59054
+ dev: "vite dev --port=4000",
59055
+ postinstall: "fumadocs-mdx",
59056
+ preview: "vite preview",
59057
+ start: "node .output/server/index.mjs"
58405
59058
  };
58406
59059
  const dependenciesChanged = Object.entries(nextDependencies).some(([key, value6]) => dependencies[key] !== value6);
59060
+ const devDependenciesChanged = Object.entries(nextDevDependencies).some(([key, value6]) => devDependencies[key] !== value6);
58407
59061
  const scriptsChanged = nextScripts !== undefined && Object.entries(nextScripts).some(([key, value6]) => scripts?.[key] !== value6);
58408
- const changed = dependenciesChanged || scriptsChanged;
59062
+ const changed = dependenciesChanged || devDependenciesChanged || scriptsChanged;
58409
59063
  if (!changed)
58410
59064
  return null;
58411
59065
  writeFileSync5(packagePath, JSON.stringify({
58412
59066
  ...packageJson,
58413
59067
  dependencies: nextDependencies,
59068
+ ...packageJson.devDependencies === undefined && wikiFramework === "next" ? {} : { devDependencies: nextDevDependencies },
58414
59069
  ...nextScripts === undefined ? {} : { scripts: nextScripts }
58415
59070
  }, null, 2) + `
58416
59071
  `);
58417
59072
  return relativePosixPath2(outputDirectory, packagePath);
58418
59073
  };
59074
+ var updateExistingTanstackViteConfig = ({
59075
+ outputDirectory,
59076
+ viteConfigPath
59077
+ }) => {
59078
+ if (!existsSync6(viteConfigPath))
59079
+ return null;
59080
+ const content = readFileSync7(viteConfigPath, "utf8");
59081
+ const nextContent = content.replace(/preset:\s*["']vercel["']/u, 'preset: "node-server"').replace(/preset:\s*["']node["']/u, 'preset: "node-server"');
59082
+ if (nextContent === content)
59083
+ return null;
59084
+ writeFileSync5(viteConfigPath, nextContent);
59085
+ return relativePosixPath2(outputDirectory, viteConfigPath);
59086
+ };
59087
+ var updateExistingWikiGitignore = ({
59088
+ outputDirectory,
59089
+ gitignorePath,
59090
+ expectedContent
59091
+ }) => {
59092
+ if (expectedContent === undefined || !existsSync6(gitignorePath))
59093
+ return null;
59094
+ const content = readFileSync7(gitignorePath, "utf8");
59095
+ const existingLines = new Set(content.split(/\r?\n/u).map((line4) => line4.trim()).filter(Boolean));
59096
+ const missingLines = expectedContent.split(/\r?\n/u).map((line4) => line4.trim()).filter((line4) => line4 !== "" && !existingLines.has(line4));
59097
+ if (missingLines.length === 0)
59098
+ return null;
59099
+ const contentWithTrailingNewline = content.endsWith(`
59100
+ `) || content === "" ? content : `${content}
59101
+ `;
59102
+ writeFileSync5(gitignorePath, `${contentWithTrailingNewline}${missingLines.join(`
59103
+ `)}
59104
+ `);
59105
+ return relativePosixPath2(outputDirectory, gitignorePath);
59106
+ };
58419
59107
  var hasFlatRoutePage = (directoryPath) => existsSync6(`${directoryPath}.md`) || existsSync6(`${directoryPath}.mdx`);
58420
59108
  var isNestedRouteSeedBlockedByFlatPage = ({
58421
59109
  wikiDirectory,
@@ -58431,9 +59119,10 @@ var scaffoldWiki = ({
58431
59119
  outputDirectory,
58432
59120
  wikiRoot,
58433
59121
  targetRoot,
58434
- backlogProvider
59122
+ backlogProvider,
59123
+ wikiFramework
58435
59124
  }) => {
58436
- const template = makeWikiScaffoldTemplate(wikiRoot);
59125
+ const template = makeWikiScaffoldTemplate(wikiRoot, wikiFramework);
58437
59126
  const createdFiles = [];
58438
59127
  const wikiDirectory = path12.join(outputDirectory, targetRoot);
58439
59128
  for (const directory3 of template.topLevelDirectories) {
@@ -58481,11 +59170,29 @@ var scaffoldWiki = ({
58481
59170
  }
58482
59171
  const updatedPackageFile = updateExistingWikiPackage({
58483
59172
  outputDirectory,
58484
- packagePath: path12.join(wikiDirectory, "package.json")
59173
+ packagePath: path12.join(wikiDirectory, "package.json"),
59174
+ wikiFramework
58485
59175
  });
58486
59176
  if (updatedPackageFile !== null && !createdFiles.includes(updatedPackageFile)) {
58487
59177
  createdFiles.push(updatedPackageFile);
58488
59178
  }
59179
+ const updatedGitignoreFile = updateExistingWikiGitignore({
59180
+ outputDirectory,
59181
+ gitignorePath: path12.join(wikiDirectory, ".gitignore"),
59182
+ expectedContent: template.files.find((file6) => file6.path === ".gitignore")?.content
59183
+ });
59184
+ if (updatedGitignoreFile !== null && !createdFiles.includes(updatedGitignoreFile)) {
59185
+ createdFiles.push(updatedGitignoreFile);
59186
+ }
59187
+ if (wikiFramework === "tanstack-start") {
59188
+ const updatedViteConfig = updateExistingTanstackViteConfig({
59189
+ outputDirectory,
59190
+ viteConfigPath: path12.join(wikiDirectory, "vite.config.ts")
59191
+ });
59192
+ if (updatedViteConfig !== null && !createdFiles.includes(updatedViteConfig)) {
59193
+ createdFiles.push(updatedViteConfig);
59194
+ }
59195
+ }
58489
59196
  const agentsPath = path12.join(wikiDirectory, "AGENTS.md");
58490
59197
  const agentsFile = writeMissingFile({
58491
59198
  outputDirectory,
@@ -58526,11 +59233,20 @@ var scaffoldWiki = ({
58526
59233
  if (backlogProviderFile !== null) {
58527
59234
  createdFiles.push(backlogProviderFile);
58528
59235
  }
59236
+ const wikiFrameworkFile = writeMissingFile({
59237
+ outputDirectory,
59238
+ targetPath: path12.join(wikiDirectory, "wiki-framework.md"),
59239
+ content: renderWikiFrameworkMarkdown(wikiFramework)
59240
+ });
59241
+ if (wikiFrameworkFile !== null) {
59242
+ createdFiles.push(wikiFrameworkFile);
59243
+ }
58529
59244
  return createdFiles.toSorted();
58530
59245
  };
58531
59246
  var scaffoldWikiForDirectory = ({
58532
59247
  outputDirectory,
58533
- monorepo
59248
+ monorepo,
59249
+ wikiFramework = "next"
58534
59250
  }) => {
58535
59251
  const wikiTarget = stageWikiTarget({
58536
59252
  outputDirectory,
@@ -58540,7 +59256,8 @@ var scaffoldWikiForDirectory = ({
58540
59256
  outputDirectory,
58541
59257
  wikiRoot: wikiTarget.wikiRoot,
58542
59258
  targetRoot: wikiTarget.targetRoot,
58543
- backlogProvider: "github"
59259
+ backlogProvider: "github",
59260
+ wikiFramework
58544
59261
  });
58545
59262
  };
58546
59263
  var isWikiOutputDirectory = (outputDirectory) => {
@@ -58571,6 +59288,7 @@ var runStageScaffold = ({
58571
59288
  }) => exports_Effect.gen(function* () {
58572
59289
  const stage = stageScaffoldById[commandId];
58573
59290
  const backlogProvider = yield* promptBacklogProvider({ prompt: prompt4 });
59291
+ const wikiFramework = yield* promptWikiFramework({ prompt: prompt4 });
58574
59292
  const detection = yield* detectRepository(outputDirectory).pipe(exports_Effect.catchAll(() => exports_Effect.succeed(null)));
58575
59293
  const skillFiles = stage.skills.map((skillId) => copySkillDirectory({
58576
59294
  outputDirectory,
@@ -58584,10 +59302,15 @@ var runStageScaffold = ({
58584
59302
  const wikiFiles = scaffoldWiki({
58585
59303
  outputDirectory,
58586
59304
  ...wikiTarget,
58587
- backlogProvider
59305
+ backlogProvider,
59306
+ wikiFramework
58588
59307
  });
58589
59308
  removeHarnessDirectoriesFromGitignore(outputDirectory);
58590
- const operatorPrompt = stage.renderPrompt({ wikiRoot: wikiTarget.wikiRoot, backlogProvider });
59309
+ const operatorPrompt = stage.renderPrompt({
59310
+ wikiRoot: wikiTarget.wikiRoot,
59311
+ backlogProvider,
59312
+ wikiFramework
59313
+ });
58591
59314
  yield* prompt4.writeLine(renderScaffoldTitle());
58592
59315
  yield* prompt4.writeLine("");
58593
59316
  yield* prompt4.writeLine(renderStageIntro({
@@ -58608,6 +59331,8 @@ var runStageScaffold = ({
58608
59331
  yield* prompt4.writeLine("");
58609
59332
  yield* prompt4.writeLine(renderCommandSection("Backlog provider", `${backlogProviderLabels2[backlogProvider]} (${backlogProvider})`));
58610
59333
  yield* prompt4.writeLine("");
59334
+ yield* prompt4.writeLine(renderCommandSection("Wiki framework", `${wikiFrameworkLabels2[wikiFramework]} (${wikiFramework})`));
59335
+ yield* prompt4.writeLine("");
58611
59336
  yield* prompt4.writeLine(renderCommandSection("Operator prompt", operatorPrompt));
58612
59337
  yield* submitCliEventEffect("cli.scaffold.init.completed", {
58613
59338
  cwd: outputDirectory,
@@ -58619,7 +59344,8 @@ var runStageScaffold = ({
58619
59344
  outputDirectory,
58620
59345
  skillFiles,
58621
59346
  wikiFiles,
58622
- backlogProvider
59347
+ backlogProvider,
59348
+ wikiFramework
58623
59349
  };
58624
59350
  });
58625
59351
 
@@ -58695,7 +59421,7 @@ import path15 from "path";
58695
59421
 
58696
59422
  // src/update/run.ts
58697
59423
  import { createHash as createHash3 } from "crypto";
58698
- import { execFileSync as execFileSync7 } from "child_process";
59424
+ import { execFileSync as execFileSync6 } from "child_process";
58699
59425
  import {
58700
59426
  cpSync as cpSync3,
58701
59427
  existsSync as existsSync7,
@@ -59624,7 +60350,7 @@ function splitLines4(text12) {
59624
60350
  var scaffoldManifestFile = ".devpunks/scaffold-manifest.json";
59625
60351
  var yesValues2 = new Set(["", "y", "yes"]);
59626
60352
  var encodeJson3 = encodeSync(parseJson(Unknown));
59627
- var encodePrettyJson2 = (value6) => JSON.stringify(JSON.parse(encodeJson3(value6)), null, 2);
60353
+ var encodePrettyJson3 = (value6) => JSON.stringify(JSON.parse(encodeJson3(value6)), null, 2);
59628
60354
  var managedFileSchema = Struct({
59629
60355
  path: String$,
59630
60356
  sha256: String$,
@@ -59832,13 +60558,15 @@ var buildWikiAlignment = ({
59832
60558
  const wikiRoot = detection.monorepo ? "apps/wiki" : "wiki";
59833
60559
  copyIfExists({ rootDirectory, targetDirectory: expectedDirectory, relativePath: wikiRoot });
59834
60560
  copyIfExists({ rootDirectory, targetDirectory: expectedDirectory, relativePath: "docs" });
60561
+ const wikiFramework = readWikiFrameworkPin(path14.join(expectedDirectory, wikiRoot));
59835
60562
  scaffoldWikiForDirectory({
59836
60563
  outputDirectory: expectedDirectory,
59837
- monorepo: detection.monorepo
60564
+ monorepo: detection.monorepo,
60565
+ wikiFramework
59838
60566
  });
59839
60567
  const syncScript = path14.join(expectedDirectory, wikiRoot, "scripts", "sync-content.mjs");
59840
60568
  if (existsSync7(syncScript)) {
59841
- execFileSync7(process.execPath, [syncScript], {
60569
+ execFileSync6(process.execPath, [syncScript], {
59842
60570
  cwd: expectedDirectory,
59843
60571
  stdio: "ignore"
59844
60572
  });
@@ -59858,6 +60586,17 @@ var buildWikiAlignment = ({
59858
60586
  })
59859
60587
  };
59860
60588
  };
60589
+ var readWikiFrameworkPin = (wikiDirectory) => {
60590
+ const pinPath = path14.join(wikiDirectory, "wiki-framework.md");
60591
+ if (!existsSync7(pinPath))
60592
+ return "next";
60593
+ const content = readFileSync8(pinPath, "utf8");
60594
+ if (content.includes("`tanstack-start`"))
60595
+ return "tanstack-start";
60596
+ if (content.includes("`next`"))
60597
+ return "next";
60598
+ return "next";
60599
+ };
59861
60600
  var buildGitignoreCleanup = ({
59862
60601
  rootDirectory,
59863
60602
  expectedDirectory
@@ -60069,7 +60808,7 @@ var runUpdate = ({
60069
60808
  if (emitJson) {
60070
60809
  yield* prompt4.writeLine("");
60071
60810
  yield* prompt4.writeLine(renderJsonLabel());
60072
- yield* prompt4.writeLine(encodePrettyJson2(result));
60811
+ yield* prompt4.writeLine(encodePrettyJson3(result));
60073
60812
  }
60074
60813
  rmSync4(expectedDirectory, { recursive: true, force: true });
60075
60814
  rmSync4(wikiAlignment.expectedDirectory, { recursive: true, force: true });
@@ -60559,6 +61298,7 @@ var askYesNo = async (question) => {
60559
61298
  readline2.close();
60560
61299
  }
60561
61300
  };
61301
+ var isPromptAbort = (error4) => error4 instanceof Error && error4.name === "AbortError";
60562
61302
  var runInteractiveCliUpdate = async () => {
60563
61303
  if (!shouldAskForSelfUpdate()) {
60564
61304
  return false;
@@ -60696,7 +61436,10 @@ if (process.env[startupCheckWorkerEnv] === "1") {
60696
61436
  startBackgroundStartupChecks();
60697
61437
  cli(process.argv).pipe(exports_Effect.provide(exports_Layer.mergeAll(exports_BunContext.layer)), exports_BunRuntime.runMain);
60698
61438
  }
60699
- } catch {
61439
+ } catch (error4) {
61440
+ if (isPromptAbort(error4)) {
61441
+ process.exit(130);
61442
+ }
60700
61443
  cli(process.argv).pipe(exports_Effect.provide(exports_Layer.mergeAll(exports_BunContext.layer)), exports_BunRuntime.runMain);
60701
61444
  }
60702
61445
  }