@punks/cli 2.1.6 → 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
 
@@ -52404,14 +52235,100 @@ var recordProductTelemetryEvent = (options9) => exports_Effect.gen(function* ()
52404
52235
  payload: options9.event
52405
52236
  });
52406
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";
52407
52324
 
52408
52325
  // package.json
52409
52326
  var name = "@punks/cli";
52410
- var version = "2.1.6";
52327
+ var version = "2.1.9";
52411
52328
  // src/telemetry/product.ts
52412
52329
  var git = (cwd, args2) => {
52413
52330
  try {
52414
- return execFileSync2("git", args2, {
52331
+ return execFileSync("git", args2, {
52415
52332
  cwd,
52416
52333
  encoding: "utf8",
52417
52334
  stdio: ["ignore", "pipe", "ignore"]
@@ -52675,8 +52592,8 @@ var renderCommandGuide = () => [
52675
52592
  " \u2022 reconcile the seeded wiki into the real repo layout before writing durable docs",
52676
52593
  " \u2022 use `punks scaffold setup` for repo-aware pack detection after repo boilerplate is ready",
52677
52594
  " \u2022 use `punks update` after setup to pull newer scaffolded skills/prompts/manifests/hooks",
52678
- " \u2022 use `punks report` when reusable Harness friction should enter the support loop",
52679
- " \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",
52680
52597
  "",
52681
52598
  "operator notes:",
52682
52599
  " \u2022 init copies only requirements/backlog skills, backlog-provider pin, and the initial wiki structure",
@@ -52787,9 +52704,9 @@ var renderJsonLabel = () => paint(`${brandPalette.bold}${brandPalette.lilac}`, "
52787
52704
  var renderDivider = () => paint(`${brandPalette.dim}${brandPalette.border}`, "\u2500".repeat(sectionWidth));
52788
52705
 
52789
52706
  // src/cli/report-command.ts
52790
- var harnessReportsRepository = "wearedevpunks/harness-intelligence";
52791
- var titleOption = exports_Options.text("title").pipe(exports_Options.withDescription("Short GitHub issue title for Harness maintainer triage."));
52792
- 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.")));
52793
52710
  var typeOption = exports_Options.choice("type", [
52794
52711
  "bug",
52795
52712
  "docs",
@@ -52808,7 +52725,6 @@ var areaOption = exports_Options.choice("area", [
52808
52725
  "other"
52809
52726
  ]).pipe(exports_Options.withDefault("other"), exports_Options.withDescription("Harness area."));
52810
52727
  var repoRootOption = exports_Options.text("repo-root").pipe(exports_Options.withDefault(process.cwd()), exports_Options.withDescription("Repository root used for safe git context."));
52811
- var repositoryOption = exports_Options.text("repository").pipe(exports_Options.withDefault(harnessReportsRepository), exports_Options.withDescription("GitHub repository that receives report issues."));
52812
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`.")));
52813
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`.")));
52814
52730
  var expectedOption = exports_Options.optional(exports_Options.text("expected").pipe(exports_Options.withDescription("Expected behavior.")));
@@ -52829,16 +52745,33 @@ var csvLabels = (value6) => value6 === undefined ? [] : value6.split(",").map((l
52829
52745
  var buildHarnessReport = ({
52830
52746
  title,
52831
52747
  body,
52748
+ message,
52832
52749
  type: type2,
52833
52750
  severity,
52834
- repoRoot
52751
+ area,
52752
+ repoRoot,
52753
+ skillPack,
52754
+ command,
52755
+ expected,
52756
+ actual,
52757
+ steps,
52758
+ labels
52835
52759
  }) => ({
52836
- title: nonEmpty(title, "title"),
52837
- body: nonEmpty(body, "body"),
52760
+ ...title === undefined ? {} : { title },
52761
+ body: nonEmpty(body ?? message ?? [actual, expected, steps].filter(Boolean).join(`
52762
+
52763
+ `), "body"),
52838
52764
  type: type2,
52839
52765
  severity,
52840
52766
  createdAt: new Date().toISOString(),
52841
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 },
52842
52775
  repository: observedRepository(repoRoot)
52843
52776
  });
52844
52777
  var buildHarnessReportLabels = ({
@@ -52862,76 +52795,14 @@ var buildHarnessReportLabels = ({
52862
52795
  ].filter((label) => label !== undefined && label.length > 0);
52863
52796
  return [...new Set(labels)];
52864
52797
  };
52865
- var buildHarnessReportIssueBody = ({
52866
- report,
52867
- area,
52868
- skillPack,
52869
- command,
52870
- expected,
52871
- actual,
52872
- steps
52873
- }) => {
52874
- const metadata = {
52875
- schema: "harness-report.v1",
52876
- type: report.type,
52877
- severity: report.severity,
52878
- area,
52879
- skillPack,
52880
- command,
52881
- createdAt: report.createdAt,
52882
- cliVersion: report.cliVersion,
52883
- repository: report.repository
52884
- };
52885
- const optionalSections = [
52886
- expected === undefined ? undefined : `## Expected
52887
-
52888
- ${expected}`,
52889
- actual === undefined ? undefined : `## Actual
52890
-
52891
- ${actual}`,
52892
- steps === undefined ? undefined : `## Evidence / Steps
52893
-
52894
- ${steps}`
52895
- ].filter((section) => section !== undefined);
52896
- return [
52897
- "<!-- harness-report",
52898
- JSON.stringify(metadata, null, 2),
52899
- "-->",
52900
- `## Summary
52901
-
52902
- ${report.body}`,
52903
- ...optionalSections,
52904
- "## Classification",
52905
- [
52906
- `- Type: ${report.type}`,
52907
- `- Severity: ${report.severity}`,
52908
- `- Area: ${area}`,
52909
- skillPack === undefined ? undefined : `- Skill pack: ${skillPack}`,
52910
- command === undefined ? undefined : `- Command: ${command}`,
52911
- `- CLI version: ${report.cliVersion}`
52912
- ].filter((line4) => line4 !== undefined).join(`
52913
- `),
52914
- "## Observed Repository",
52915
- [
52916
- `- Remote: ${report.repository?.remoteUrl ?? "unknown"}`,
52917
- `- Host: ${report.repository?.remoteHost ?? "unknown"}`,
52918
- `- Path: ${report.repository?.remotePath ?? "unknown"}`,
52919
- `- Commit: ${report.repository?.commitSha ?? "unknown"}`,
52920
- `- Dirty: ${report.repository?.dirty === undefined ? "unknown" : String(report.repository.dirty)}`
52921
- ].join(`
52922
- `)
52923
- ].join(`
52924
-
52925
- `);
52926
- };
52927
52798
  var reportCommand = exports_Command.make("report", {
52799
+ message: messageOption,
52928
52800
  title: titleOption,
52929
52801
  body: bodyOption,
52930
52802
  type: typeOption,
52931
52803
  severity: severityOption,
52932
52804
  area: areaOption,
52933
52805
  repoRoot: repoRootOption,
52934
- repository: repositoryOption,
52935
52806
  skillPack: skillPackOption,
52936
52807
  command: commandOption,
52937
52808
  expected: expectedOption,
@@ -52940,13 +52811,13 @@ var reportCommand = exports_Command.make("report", {
52940
52811
  labels: labelsOption,
52941
52812
  json: jsonOption
52942
52813
  }, ({
52814
+ message,
52943
52815
  title,
52944
52816
  body,
52945
52817
  type: type2,
52946
52818
  severity,
52947
52819
  area,
52948
52820
  repoRoot,
52949
- repository,
52950
52821
  skillPack,
52951
52822
  command,
52952
52823
  expected,
@@ -52956,7 +52827,9 @@ var reportCommand = exports_Command.make("report", {
52956
52827
  json: json2
52957
52828
  }) => exports_Effect.tryPromise({
52958
52829
  try: async () => {
52959
- const report = buildHarnessReport({ title, body, type: type2, severity, repoRoot });
52830
+ const titleValue = optionalValue(title);
52831
+ const bodyValue = optionalValue(body);
52832
+ const messageValue = optionalValue(message);
52960
52833
  const skillPackValue = optionalValue(skillPack);
52961
52834
  const commandValue = optionalValue(command);
52962
52835
  const expectedValue = optionalValue(expected);
@@ -52971,40 +52844,50 @@ var reportCommand = exports_Command.make("report", {
52971
52844
  ...commandValue === undefined ? {} : { command: commandValue },
52972
52845
  ...extraLabels === undefined ? {} : { extraLabels }
52973
52846
  });
52974
- const issue = await createGitHubIssue({
52975
- repository,
52976
- title: report.title,
52977
- body: buildHarnessReportIssueBody({
52978
- report,
52979
- area,
52980
- ...skillPackValue === undefined ? {} : { skillPack: skillPackValue },
52981
- ...commandValue === undefined ? {} : { command: commandValue },
52982
- ...expectedValue === undefined ? {} : { expected: expectedValue },
52983
- ...actualValue === undefined ? {} : { actual: actualValue },
52984
- ...stepsValue === undefined ? {} : { steps: stepsValue }
52985
- }),
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 },
52986
52860
  labels: issueLabels
52987
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 }));
52988
52867
  await exports_Effect.runPromise(submitCliEventEffect("cli.harness.report.submitted", {
52989
52868
  cwd: repoRoot
52990
52869
  }));
52991
52870
  if (json2) {
52992
52871
  console.log(renderJsonLabel());
52993
- console.log(JSON.stringify({ issue, labels: issueLabels }, null, 2));
52872
+ console.log(JSON.stringify(submitted, null, 2));
52994
52873
  return;
52995
52874
  }
52996
- 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(`
52997
52880
  `)));
52998
52881
  },
52999
- catch: (cause3) => cause3 instanceof Error ? cause3 : new Error("Harness report issue creation failed.")
53000
- })).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."));
53001
52884
 
53002
52885
  // src/cli/scaffold-command.ts
53003
52886
  import path13 from "path";
53004
52887
 
53005
52888
  // src/baseline/resolve.ts
53006
52889
  import { createHash } from "crypto";
53007
- import { execFileSync as execFileSync3 } from "child_process";
52890
+ import { execFileSync as execFileSync2 } from "child_process";
53008
52891
  import { existsSync as existsSync2, mkdirSync, mkdtempSync, readFileSync as readFileSync3, rmSync, writeFileSync } from "fs";
53009
52892
  import { tmpdir as tmpdir2 } from "os";
53010
52893
  import path5 from "path";
@@ -53025,25 +52908,25 @@ var hookCatalog = [
53025
52908
 
53026
52909
  // src/data/catalog/lint.ts
53027
52910
  var sharedReactPlacement = {
53028
- recommendedConfigFile: ".oxlintrc.json",
52911
+ recommendedConfigFile: "oxlint.config.ts",
53029
52912
  recommendedFiles: ["<detected-react-workspace>/**/*.{js,jsx,ts,tsx}"],
53030
52913
  recommendedWorkspaces: ["detected React workspaces"],
53031
52914
  placementNotes: "Add as an override for detected React-rendered code. Keep backend packages outside this override unless they render React."
53032
52915
  };
53033
52916
  var webOnlyPlacement = {
53034
- recommendedConfigFile: ".oxlintrc.json",
52917
+ recommendedConfigFile: "oxlint.config.ts",
53035
52918
  recommendedFiles: ["<detected-nextjs-workspace>/**/*.{js,jsx,ts,tsx}"],
53036
52919
  recommendedWorkspaces: ["detected Next.js workspaces"],
53037
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."
53038
52921
  };
53039
52922
  var effectPlacement = {
53040
- recommendedConfigFile: ".oxlintrc.json",
52923
+ recommendedConfigFile: "oxlint.config.ts",
53041
52924
  recommendedFiles: ["<detected-effect-workspace>/**/*.{js,jsx,ts,tsx}"],
53042
52925
  recommendedWorkspaces: ["detected Effect workspaces"],
53043
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."
53044
52927
  };
53045
52928
  var vitestPlacement = {
53046
- recommendedConfigFile: ".oxlintrc.json",
52929
+ recommendedConfigFile: "oxlint.config.ts",
53047
52930
  recommendedFiles: [
53048
52931
  "<detected-test-workspace>/**/*.{test,spec}.{js,jsx,ts,tsx}",
53049
52932
  "<detected-test-workspace>/src/test/**/*.{js,jsx,ts,tsx}"
@@ -53054,38 +52937,19 @@ var vitestPlacement = {
53054
52937
  var lintCatalog = [
53055
52938
  {
53056
52939
  id: "react-core",
53057
- description: "Core React rules for rendered app and shared UI code.",
53058
- plugins: ["unicorn", "typescript", "oxc", "react"],
52940
+ description: "Ultracite React preset for rendered app and shared UI code.",
52941
+ oxlintPresets: ["react"],
52942
+ plugins: [],
53059
52943
  jsPlugins: [],
53060
52944
  settings: {},
53061
- rules: {
53062
- "react/rules-of-hooks": "error",
53063
- "react/exhaustive-deps": "error",
53064
- "react/forward-ref-uses-ref": "error",
53065
- "react/jsx-key": "error",
53066
- "react/jsx-no-comment-textnodes": "error",
53067
- "react/jsx-no-duplicate-props": "error",
53068
- "react/jsx-no-target-blank": "error",
53069
- "react/jsx-no-undef": "error",
53070
- "react/jsx-no-useless-fragment": "error",
53071
- "react/no-children-prop": "error",
53072
- "react/no-danger-with-children": "error",
53073
- "react/no-direct-mutation-state": "error",
53074
- "react/no-find-dom-node": "error",
53075
- "react/no-render-return-value": "error",
53076
- "react/no-string-refs": "error",
53077
- "react/no-this-in-sfc": "error",
53078
- "react/no-unknown-property": "error",
53079
- "react/no-unescaped-entities": "error",
53080
- "react/no-unsafe": "error",
53081
- "react/void-dom-elements-no-children": "error"
53082
- },
52945
+ rules: {},
53083
52946
  requiredDevDependencies: [],
53084
52947
  placement: sharedReactPlacement
53085
52948
  },
53086
52949
  {
53087
52950
  id: "react-hooks",
53088
52951
  description: "React Hooks lint rules via the JS plugin bridge for Oxlint.",
52952
+ oxlintPresets: [],
53089
52953
  plugins: [],
53090
52954
  jsPlugins: [
53091
52955
  {
@@ -53095,6 +52959,7 @@ var lintCatalog = [
53095
52959
  ],
53096
52960
  settings: {},
53097
52961
  rules: {
52962
+ "react-hooks-js/exhaustive-deps": "error",
53098
52963
  "react-hooks-js/component-hook-factories": "error",
53099
52964
  "react-hooks-js/config": "error",
53100
52965
  "react-hooks-js/error-boundaries": "error",
@@ -53105,6 +52970,7 @@ var lintCatalog = [
53105
52970
  "react-hooks-js/preserve-manual-memoization": "error",
53106
52971
  "react-hooks-js/purity": "error",
53107
52972
  "react-hooks-js/refs": "error",
52973
+ "react-hooks-js/rules-of-hooks": "error",
53108
52974
  "react-hooks-js/set-state-in-effect": "error",
53109
52975
  "react-hooks-js/set-state-in-render": "error",
53110
52976
  "react-hooks-js/static-components": "error",
@@ -53117,6 +52983,7 @@ var lintCatalog = [
53117
52983
  {
53118
52984
  id: "react-you-might-not-need-an-effect",
53119
52985
  description: "Guidance rules that push React code away from unnecessary effects.",
52986
+ oxlintPresets: [],
53120
52987
  plugins: [],
53121
52988
  jsPlugins: [
53122
52989
  {
@@ -53129,7 +52996,6 @@ var lintCatalog = [
53129
52996
  "react-you-might-not-need-an-effect-js/no-adjust-state-on-prop-change": "error",
53130
52997
  "react-you-might-not-need-an-effect-js/no-chain-state-updates": "error",
53131
52998
  "react-you-might-not-need-an-effect-js/no-derived-state": "error",
53132
- "react-you-might-not-need-an-effect-js/no-empty-effect": "error",
53133
52999
  "react-you-might-not-need-an-effect-js/no-event-handler": "error",
53134
53000
  "react-you-might-not-need-an-effect-js/no-initialize-state": "error",
53135
53001
  "react-you-might-not-need-an-effect-js/no-pass-data-to-parent": "error",
@@ -53141,31 +53007,12 @@ var lintCatalog = [
53141
53007
  },
53142
53008
  {
53143
53009
  id: "next-core",
53144
- description: "Next.js correctness rules for the main web application.",
53145
- plugins: ["nextjs"],
53010
+ description: "Ultracite Next.js preset for the main web application.",
53011
+ oxlintPresets: ["next"],
53012
+ plugins: [],
53146
53013
  jsPlugins: [],
53147
53014
  settings: {},
53148
- rules: {
53149
- "nextjs/inline-script-id": "error",
53150
- "nextjs/next-script-for-ga": "error",
53151
- "nextjs/no-assign-module-variable": "error",
53152
- "nextjs/no-async-client-component": "error",
53153
- "nextjs/no-before-interactive-script-outside-document": "error",
53154
- "nextjs/no-css-tags": "error",
53155
- "nextjs/no-document-import-in-page": "error",
53156
- "nextjs/no-duplicate-head": "error",
53157
- "nextjs/no-head-element": "error",
53158
- "nextjs/no-head-import-in-document": "error",
53159
- "nextjs/no-html-link-for-pages": "error",
53160
- "nextjs/no-img-element": "error",
53161
- "nextjs/no-page-custom-font": "error",
53162
- "nextjs/no-script-component-in-head": "error",
53163
- "nextjs/no-styled-jsx-in-document": "error",
53164
- "nextjs/no-sync-scripts": "error",
53165
- "nextjs/no-title-in-document-head": "error",
53166
- "nextjs/no-typos": "error",
53167
- "nextjs/no-unwanted-polyfillio": "error"
53168
- },
53015
+ rules: {},
53169
53016
  requiredDevDependencies: [],
53170
53017
  placement: {
53171
53018
  ...webOnlyPlacement,
@@ -53174,25 +53021,13 @@ var lintCatalog = [
53174
53021
  },
53175
53022
  {
53176
53023
  id: "tanstack-query-core",
53177
- description: "TanStack Query rules via the Oxlint JS plugin bridge.",
53024
+ description: "Ultracite TanStack preset for query/router/start framework linting.",
53025
+ oxlintPresets: ["tanstack"],
53178
53026
  plugins: [],
53179
- jsPlugins: [
53180
- {
53181
- name: "tanstack-query-js",
53182
- specifier: "@tanstack/eslint-plugin-query"
53183
- }
53184
- ],
53027
+ jsPlugins: [],
53185
53028
  settings: {},
53186
- rules: {
53187
- "tanstack-query-js/exhaustive-deps": "error",
53188
- "tanstack-query-js/infinite-query-property-order": "error",
53189
- "tanstack-query-js/mutation-property-order": "error",
53190
- "tanstack-query-js/no-rest-destructuring": "warn",
53191
- "tanstack-query-js/no-unstable-deps": "error",
53192
- "tanstack-query-js/no-void-query-fn": "error",
53193
- "tanstack-query-js/stable-query-client": "error"
53194
- },
53195
- requiredDevDependencies: ["@tanstack/eslint-plugin-query"],
53029
+ rules: {},
53030
+ requiredDevDependencies: [],
53196
53031
  placement: {
53197
53032
  ...webOnlyPlacement,
53198
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."
@@ -53201,6 +53036,7 @@ var lintCatalog = [
53201
53036
  {
53202
53037
  id: "effect-no-barrel-imports",
53203
53038
  description: "Effect architectural rule that blocks barrel-package imports.",
53039
+ oxlintPresets: [],
53204
53040
  plugins: [],
53205
53041
  jsPlugins: [
53206
53042
  {
@@ -53222,20 +53058,12 @@ var lintCatalog = [
53222
53058
  },
53223
53059
  {
53224
53060
  id: "vitest-core",
53225
- description: "Vitest-focused test rules for repo-owned test globs.",
53226
- plugins: ["vitest"],
53061
+ description: "Ultracite Vitest preset for repo-owned test globs.",
53062
+ oxlintPresets: ["vitest"],
53063
+ plugins: [],
53227
53064
  jsPlugins: [],
53228
- settings: {
53229
- vitest: {
53230
- typecheck: false
53231
- }
53232
- },
53233
- rules: {
53234
- "vitest/consistent-each-for": "warn",
53235
- "vitest/no-conditional-tests": "error",
53236
- "vitest/no-import-node-test": "error",
53237
- "vitest/warn-todo": "warn"
53238
- },
53065
+ settings: {},
53066
+ rules: {},
53239
53067
  requiredDevDependencies: [],
53240
53068
  placement: vitestPlacement
53241
53069
  }
@@ -53472,7 +53300,7 @@ var packCatalog = [
53472
53300
  triggerPackages: ["react", "react-dom"],
53473
53301
  description: "React guidance pack.",
53474
53302
  skills: ["async-react-patterns", "vercel-composition-patterns", "vercel-react-best-practices"],
53475
- lintAssets: ["react-core", "react-hooks", "react-you-might-not-need-an-effect"],
53303
+ lintAssets: ["react-core", "react-you-might-not-need-an-effect"],
53476
53304
  hooks: [],
53477
53305
  promptSurfaces: ["shared-agents", "root-prompt-spec", "workspace-prompt-spec"],
53478
53306
  promptDetails: ["shared react structure baseline", "workspace react composition rules"]
@@ -53481,8 +53309,8 @@ var packCatalog = [
53481
53309
  id: "research",
53482
53310
  category: "default",
53483
53311
  triggerPackages: [],
53484
- description: "Default research pack: parallel research, review, and architecture inspection.",
53485
- 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"],
53486
53314
  lintAssets: [],
53487
53315
  hooks: [],
53488
53316
  promptSurfaces: ["shared-agents", "root-prompt-spec", "workspace-prompt-spec"],
@@ -53565,7 +53393,7 @@ var packCatalog = [
53565
53393
  "python-testing-patterns"
53566
53394
  ],
53567
53395
  lintAssets: [],
53568
- hooks: [],
53396
+ hooks: ["format-edited-file"],
53569
53397
  promptSurfaces: [],
53570
53398
  promptDetails: []
53571
53399
  },
@@ -53896,6 +53724,14 @@ var skillCatalog = [
53896
53724
  framework: null,
53897
53725
  requiresTools: []
53898
53726
  },
53727
+ {
53728
+ id: "autoreview",
53729
+ sourceDirectory: "skills/agnostic/quality/autoreview",
53730
+ tier: "agnostic",
53731
+ language: null,
53732
+ framework: null,
53733
+ requiresTools: []
53734
+ },
53899
53735
  {
53900
53736
  id: "simplify",
53901
53737
  sourceDirectory: "skills/agnostic/quality/simplify",
@@ -54056,6 +53892,7 @@ var assetArchiveName = "scaffold-baseline.tgz";
54056
53892
  var cacheRoot = () => path5.join(process.env.XDG_CACHE_HOME ?? path5.join(process.env.HOME ?? tmpdir2(), ".cache"), "devpunks", "baselines");
54057
53893
  var sha256File = (filePath) => createHash("sha256").update(readFileSync3(filePath)).digest("hex");
54058
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("\\");
54059
53896
  var isBaselineReleaseTag = (tag6) => tag6.startsWith("baseline/stable/") && !/^v\d+\.\d+\.\d+(?:$|-)/u.test(tag6);
54060
53897
  var fetchJson = async (url2, timeoutMs) => {
54061
53898
  const controller = new AbortController;
@@ -54088,7 +53925,7 @@ var download = async (url2, targetPath, timeoutMs) => {
54088
53925
  }
54089
53926
  };
54090
53927
  var extractSafeTgz = (archivePath, targetDirectory) => {
54091
- const listing = execFileSync3("tar", ["-tzf", archivePath], {
53928
+ const listing = execFileSync2("tar", ["-tzf", archivePath], {
54092
53929
  encoding: "utf8"
54093
53930
  }).split(/\r?\n/u).filter((line4) => line4.length > 0);
54094
53931
  const unsafe = listing.find((entry) => !isSafeTarPath(entry));
@@ -54096,7 +53933,7 @@ var extractSafeTgz = (archivePath, targetDirectory) => {
54096
53933
  throw new Error(`Unsafe baseline archive path: ${unsafe}`);
54097
53934
  }
54098
53935
  mkdirSync(targetDirectory, { recursive: true });
54099
- execFileSync3("tar", ["-xzf", archivePath, "-C", targetDirectory], {
53936
+ execFileSync2("tar", ["-xzf", archivePath, "-C", targetDirectory], {
54100
53937
  stdio: "ignore"
54101
53938
  });
54102
53939
  };
@@ -54117,6 +53954,9 @@ var submitArtifactPullTelemetry = async (baseline, cwd) => {
54117
53954
  }));
54118
53955
  };
54119
53956
  var materializeControlPlaneBaseline = async (resolution, refresh, timeoutMs) => {
53957
+ if (!isSafePathSegment(resolution.version)) {
53958
+ throw new Error(`Unsafe control plane baseline version: ${resolution.version}`);
53959
+ }
54120
53960
  const targetDirectory = path5.join(cacheRoot(), "control-plane", resolution.version);
54121
53961
  if (!refresh && existsSync2(path5.join(targetDirectory, "baseline.json"))) {
54122
53962
  return {
@@ -54498,6 +54338,156 @@ var localMultiSelect = (options9) => {
54498
54338
  return exports_Prompt.run(prompt4).pipe(exports_Effect.map((values4) => values4.toSorted()));
54499
54339
  };
54500
54340
 
54341
+ // src/scaffold/single-select.ts
54342
+ var Action3 = taggedEnum();
54343
+ var figures3 = {
54344
+ arrowUp: text3("\u2191"),
54345
+ arrowDown: text3("\u2193"),
54346
+ bullet: text3("\u25C7"),
54347
+ pointer: text3("\u25C6"),
54348
+ stem: text3("\u2502"),
54349
+ tick: text3("\u25C6")
54350
+ };
54351
+ var eraseText3 = (text12, columns) => {
54352
+ if (columns === 0) {
54353
+ return cat2(eraseLine3, cursorTo3(0));
54354
+ }
54355
+ let rows = 0;
54356
+ for (const line4 of text12.split(/\r?\n/u)) {
54357
+ rows += 1 + Math.floor(Math.max(line4.length - 1, 0) / columns);
54358
+ }
54359
+ return eraseLines3(rows);
54360
+ };
54361
+ var entriesToDisplay3 = (cursor, total, maxVisible) => {
54362
+ let startIndex = Math.min(total - maxVisible, cursor - Math.floor(maxVisible / 2));
54363
+ if (startIndex < 0) {
54364
+ startIndex = 0;
54365
+ }
54366
+ const endIndex = Math.min(startIndex + maxVisible, total);
54367
+ return { startIndex, endIndex };
54368
+ };
54369
+ var renderOutput9 = (message) => {
54370
+ const lines3 = message.split(/\r?\n/u);
54371
+ const [firstLine, ...rest] = lines3;
54372
+ return vsep2([
54373
+ annotate2(figures3.bullet, cyanBright2).pipe(cat2(space2), cat2(annotate2(text3(firstLine ?? ""), bold2))),
54374
+ ...rest.map((line4) => annotate2(figures3.stem, blackBright2).pipe(cat2(space2), cat2(space2), cat2(text3(line4)))),
54375
+ annotate2(figures3.stem, blackBright2).pipe(cat2(space2), cat2(space2))
54376
+ ]);
54377
+ };
54378
+ var withStem2 = (prefix) => prefix.pipe(cat2(space2), cat2(space2));
54379
+ var renderChoiceDescription4 = (choice4, isHighlighted) => choice4.description && isHighlighted ? char3("-").pipe(cat2(space2), cat2(text3(choice4.description)), annotate2(blackBright2)) : empty38;
54380
+ var renderChoices4 = (state, options9) => {
54381
+ const toDisplay = entriesToDisplay3(state.index, options9.choices.length, options9.maxPerPage);
54382
+ const documents = [];
54383
+ for (let index = toDisplay.startIndex;index < toDisplay.endIndex; index++) {
54384
+ const choice4 = options9.choices[index];
54385
+ const isHighlighted = state.index === index;
54386
+ let prefix = space2;
54387
+ if (index === toDisplay.startIndex && toDisplay.startIndex > 0) {
54388
+ prefix = figures3.arrowUp;
54389
+ } else if (index === toDisplay.endIndex - 1 && toDisplay.endIndex < options9.choices.length) {
54390
+ prefix = figures3.arrowDown;
54391
+ } else if (isHighlighted) {
54392
+ prefix = figures3.pointer;
54393
+ } else {
54394
+ prefix = figures3.stem;
54395
+ }
54396
+ const title = isHighlighted ? annotate2(text3(choice4.title), cyanBright2) : text3(choice4.title);
54397
+ const description = renderChoiceDescription4(choice4, isHighlighted);
54398
+ documents.push(withStem2(prefix).pipe(cat2(title), cat2(space2), cat2(description)));
54399
+ }
54400
+ return vsep2(documents);
54401
+ };
54402
+ var visiblePromptLines2 = (message) => {
54403
+ const lines3 = message.split(/\r?\n/u);
54404
+ const [firstLine, ...rest] = lines3;
54405
+ return [`\u25C7 ${firstLine ?? ""}`, ...rest.map((line4) => `\u2502 ${line4}`), "\u2502 "];
54406
+ };
54407
+ var visibleChoiceLines2 = (state, options9) => {
54408
+ const toDisplay = entriesToDisplay3(state.index, options9.choices.length, options9.maxPerPage);
54409
+ const lines3 = [];
54410
+ for (let index = toDisplay.startIndex;index < toDisplay.endIndex; index++) {
54411
+ const choice4 = options9.choices[index];
54412
+ let prefix = " ";
54413
+ if (index === toDisplay.startIndex && toDisplay.startIndex > 0) {
54414
+ prefix = "\u2191";
54415
+ } else if (index === toDisplay.endIndex - 1 && toDisplay.endIndex < options9.choices.length) {
54416
+ prefix = "\u2193";
54417
+ } else if (state.index === index) {
54418
+ prefix = "\u25C6";
54419
+ } else {
54420
+ prefix = "\u2502";
54421
+ }
54422
+ const description = choice4.description && state.index === index ? ` - ${choice4.description}` : "";
54423
+ lines3.push(`${prefix} ${choice4.title} ${description}`);
54424
+ }
54425
+ return lines3;
54426
+ };
54427
+ var visibleFrameText2 = (state, options9) => [...visiblePromptLines2(options9.message), ...visibleChoiceLines2(state, options9)].join(`
54428
+ `);
54429
+ var renderNextFrame10 = (state, options9) => exports_Effect.gen(function* () {
54430
+ const terminal = yield* Terminal;
54431
+ const columns = yield* terminal.columns;
54432
+ return cursorHide3.pipe(cat2(renderOutput9(options9.message)), cat2(hardLine2), cat2(renderChoices4(state, options9)), render3({ style: "pretty", options: { lineWidth: columns } }));
54433
+ });
54434
+ var renderSubmission10 = (state, options9) => exports_Effect.gen(function* () {
54435
+ const terminal = yield* Terminal;
54436
+ const columns = yield* terminal.columns;
54437
+ const selected = options9.choices[state.index];
54438
+ return renderOutput9(options9.message).pipe(cat2(annotate2(figures3.tick, green3)), cat2(space2), cat2(annotate2(text3(selected.title), white3)), cat2(hardLine2), render3({ style: "pretty", options: { lineWidth: columns } }));
54439
+ });
54440
+ var clearPrompt2 = (state, options9) => exports_Effect.gen(function* () {
54441
+ const terminal = yield* Terminal;
54442
+ const columns = yield* terminal.columns;
54443
+ return eraseText3(visibleFrameText2(state, options9), columns).pipe(cat2(eraseLine3), cat2(cursorLeft3), optimize3(Deep), render3({ style: "pretty", options: { lineWidth: columns } }));
54444
+ });
54445
+ var localSingleSelect = (options9) => {
54446
+ const defaultIndex = Math.max(0, options9.choices.findIndex((choice4) => choice4.value === options9.defaultValue));
54447
+ const resolvedOptions = {
54448
+ defaultValue: options9.choices[defaultIndex]?.value ?? "",
54449
+ maxPerPage: 10,
54450
+ ...options9
54451
+ };
54452
+ const prompt4 = exports_Prompt.custom({
54453
+ index: defaultIndex
54454
+ }, {
54455
+ render: (state, action) => Action3.$match(action, {
54456
+ Beep: () => exports_Effect.succeed(render3(beep3, { style: "pretty" })),
54457
+ NextFrame: ({ state: state2 }) => renderNextFrame10(state2, resolvedOptions),
54458
+ Submit: () => renderSubmission10(state, resolvedOptions)
54459
+ }),
54460
+ process: (input, state) => {
54461
+ switch (input.key.name) {
54462
+ case "k":
54463
+ case "up":
54464
+ return exports_Effect.succeed(Action3.NextFrame({
54465
+ state: {
54466
+ index: state.index === 0 ? resolvedOptions.choices.length - 1 : state.index - 1
54467
+ }
54468
+ }));
54469
+ case "j":
54470
+ case "down":
54471
+ case "tab":
54472
+ return exports_Effect.succeed(Action3.NextFrame({
54473
+ state: {
54474
+ index: (state.index + 1) % resolvedOptions.choices.length
54475
+ }
54476
+ }));
54477
+ case "enter":
54478
+ case "return":
54479
+ return exports_Effect.succeed(Action3.Submit({
54480
+ value: resolvedOptions.choices[state.index].value
54481
+ }));
54482
+ default:
54483
+ return exports_Effect.succeed(Action3.Beep());
54484
+ }
54485
+ },
54486
+ clear: (state) => clearPrompt2(state, resolvedOptions)
54487
+ });
54488
+ return exports_Prompt.run(prompt4);
54489
+ };
54490
+
54501
54491
  // src/scaffold/prompt.ts
54502
54492
  var isPromptQuitSignal = (cause3) => typeof cause3 === "object" && cause3 !== null && ("name" in cause3) && cause3.name === "QuitException";
54503
54493
  var restoreLineInput = (readline2) => {
@@ -54526,6 +54516,14 @@ var PromptLive = exports_Effect.acquireRelease(exports_Effect.sync(() => createI
54526
54516
  cause: cause3,
54527
54517
  message: "Failed to read checklist input."
54528
54518
  }))),
54519
+ singleSelect: ({ message, choices, defaultValue }) => exports_Effect.sync(() => readline2.pause()).pipe(exports_Effect.zipRight(localSingleSelect({
54520
+ message,
54521
+ choices,
54522
+ ...defaultValue ? { defaultValue } : {}
54523
+ })), exports_Effect.ensuring(exports_Effect.sync(() => restoreLineInput(readline2))), exports_Effect.mapError((cause3) => new CliPromptError({
54524
+ cause: cause3,
54525
+ message: "Failed to read selection input."
54526
+ }))),
54529
54527
  writeLine: (line4) => exports_Effect.async((resume2) => {
54530
54528
  output.write(`${line4}
54531
54529
  `, () => {
@@ -54535,7 +54533,7 @@ var PromptLive = exports_Effect.acquireRelease(exports_Effect.sync(() => createI
54535
54533
  })));
54536
54534
 
54537
54535
  // src/scaffold/run.ts
54538
- import { execFileSync as execFileSync6 } from "child_process";
54536
+ import { execFileSync as execFileSync5 } from "child_process";
54539
54537
  import { mkdirSync as mkdirSync3, writeFileSync as writeFileSync4 } from "fs";
54540
54538
  import { homedir as homedir2 } from "os";
54541
54539
  import path11 from "path";
@@ -54924,7 +54922,7 @@ var hasBackendSurface = (result) => exports_Array.some(result.detectedTechnologi
54924
54922
  import path8 from "path";
54925
54923
 
54926
54924
  // src/core/tools.ts
54927
- import { execFileSync as execFileSync4 } from "child_process";
54925
+ import { execFileSync as execFileSync3 } from "child_process";
54928
54926
  import { accessSync, constants as constants2 } from "fs";
54929
54927
  import { homedir } from "os";
54930
54928
  import path7 from "path";
@@ -54953,7 +54951,7 @@ var defaultRuntime3 = {
54953
54951
  cwd: homedir(),
54954
54952
  commandExists: commandExistsOnPath,
54955
54953
  execFile: (command, args2, options9) => {
54956
- execFileSync4(command, [...args2], {
54954
+ execFileSync3(command, [...args2], {
54957
54955
  cwd: options9?.cwd,
54958
54956
  stdio: options9?.stdio === "inherit" ? ["ignore", "inherit", "inherit"] : "ignore"
54959
54957
  });
@@ -55217,13 +55215,14 @@ var formatAgentHandoffSummary = (result) => [
55217
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.",
55218
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.",
55219
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.",
55220
- " 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`.",
55221
- " 8. Reconcile `.agents/subagents/manifest.mjs` with both `.agents/subagents/manifest.prompt.md` and `.devpunks/specs/subagents/manifest-spec.json`.",
55222
- " 9. Update owned paths / guidance file references in the subagent manifest to match the real repo shape.",
55223
- " 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.",
55224
- " 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.",
55225
- " 12. Before authoring final prompts or implementation plans, identify the core detected libraries whose source behavior matters.",
55226
- " 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."
55227
55226
  ].join(`
55228
55227
  `);
55229
55228
  var formatSelectionPreview = (options9) => [
@@ -55375,7 +55374,7 @@ var finalizePackSelection = (resolved, additions, removals) => {
55375
55374
  var canRemovePack = (resolved, packId) => resolved.preselectedPacks.includes(packId) && !resolved.defaultPacks.includes(packId);
55376
55375
 
55377
55376
  // src/scaffold/output.ts
55378
- import { execFileSync as execFileSync5 } from "child_process";
55377
+ import { execFileSync as execFileSync4 } from "child_process";
55379
55378
  import { createHash as createHash2 } from "crypto";
55380
55379
  import {
55381
55380
  cpSync,
@@ -55421,10 +55420,12 @@ When a nested \`AGENTS.md\` lists "Primary skills here", treat those skill names
55421
55420
 
55422
55421
  Do not rely only on the root instructions when a scoped \`AGENTS.md\` exists.
55423
55422
 
55424
- 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.
55425
55424
 
55426
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.
55427
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
+
55428
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.
55429
55430
 
55430
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.
@@ -55686,12 +55687,13 @@ var renderAgentHandoffMarkdown = ({
55686
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.",
55687
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.",
55688
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.",
55689
- "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.",
55690
55691
  "9. Keep `.agents/hooks/` as the neutral hook source of truth; harness hook mirrors should point back to it.",
55691
- "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.",
55692
- "11. Populate or reconcile `.agents/subagents/manifest.mjs` using both the manifest spec JSON and the manifest prompt markdown.",
55693
- "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.",
55694
- "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.",
55695
55697
  "",
55696
55698
  "## Shared core files",
55697
55699
  "",
@@ -55735,17 +55737,17 @@ var renderLintSpecMarkdown = ({
55735
55737
  }) => [
55736
55738
  "# Lint Asset Handoff",
55737
55739
  "",
55738
- "Use these selected Oxlint assets to fit the target repo's real lint topology.",
55739
- "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.",
55740
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.",
55741
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.",
55742
55744
  "",
55743
55745
  "## Baseline",
55744
55746
  "",
55745
- 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.`,
55746
55748
  "- Preserve asset granularity: add or adjust rules asset-by-asset instead of collapsing everything into one opaque override.",
55747
55749
  "- Keep JS plugin aliases stable when composing the final Oxlint config so future regen stays diff-friendly.",
55748
- "- 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.",
55749
55751
  "",
55750
55752
  "## Selected assets",
55751
55753
  "",
@@ -55754,6 +55756,7 @@ var renderLintSpecMarkdown = ({
55754
55756
  "",
55755
55757
  `- Description: ${asset.description}`,
55756
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(", ")}`,
55757
55760
  `- Recommended config file: \`${asset.placement.recommendedConfigFile}\``,
55758
55761
  `- Recommended workspaces: ${asset.placement.recommendedWorkspaces.length === 0 ? "`(none)`" : asset.placement.recommendedWorkspaces.map((workspace) => `\`${workspace}\``).join(", ")}`,
55759
55762
  `- Recommended files: ${asset.placement.recommendedFiles.length === 0 ? "`(none)`" : asset.placement.recommendedFiles.map((file6) => `\`${file6}\``).join(", ")}`,
@@ -55792,6 +55795,7 @@ var resolveLintAssetsForPacks = (packIds, baseline = bundledBaseline) => {
55792
55795
  id: asset.id,
55793
55796
  description: asset.description,
55794
55797
  sourcePacks: [packId],
55798
+ oxlintPresets: asset.oxlintPresets,
55795
55799
  plugins: asset.plugins,
55796
55800
  jsPlugins: asset.jsPlugins,
55797
55801
  settings: asset.settings,
@@ -55987,32 +55991,315 @@ var migrateLegacySkillDirectories = ({
55987
55991
  }
55988
55992
  };
55989
55993
  var selectedHookIds = (finalPacks, baseline) => uniqueSorted(finalPacks.flatMap((packId) => hooksForPack(packId, baseline)));
55990
- var oxlintConfigCandidates = [".oxlintrc.json", ".oxlintrc.jsonc", "oxlint.config.ts"];
55994
+ var oxlintConfigCandidates = ["oxlint.config.ts", ".oxlintrc.json", ".oxlintrc.jsonc"];
55991
55995
  var existingOxlintConfigFiles = (scanDirectory) => oxlintConfigCandidates.filter((candidate) => existsSync5(path10.join(scanDirectory, candidate)));
55992
55996
  var oxlintStarterConfig = {
55993
- $schema: "./node_modules/oxlint/configuration_schema.json",
55994
- env: {
55995
- builtin: true
55996
- },
55997
- ignorePatterns: [
55998
- "**/.*",
55999
- "**/.*/**",
56000
- "**/*.lock",
56001
- "**/*.lock.*",
56002
- "**/*-lock.*",
56003
- "**/*.lockb",
56004
- "**/package-lock.json",
56005
- "**/pnpm-lock.yaml",
56006
- "**/yarn.lock",
56007
- "**/bun.lock",
56008
- "**/bun.lockb",
56009
- "node_modules/**",
56010
- "opensrc/**",
56011
- "**/.next/**",
56012
- "**/dist/**",
56013
- "**/build/**"
56014
- ],
56015
- 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));
56016
56303
  };
56017
56304
  var detectedWorkspaces = (scanDirectory, detection) => detection.manifests.map((manifest) => path10.posix.dirname(relativePosixPath(scanDirectory, manifest.path))).filter((workspace) => workspace !== "" && workspace !== ".").toSorted();
56018
56305
  var packsForWorkspace = ({
@@ -56423,10 +56710,17 @@ var writeScaffoldOutput = ({
56423
56710
  const hookFiles = [];
56424
56711
  const harnessFiles = [];
56425
56712
  const finalSkills = selectedSkills(finalPacks, baseline);
56426
- const hasOxlint = detectionHasPackage(detection, "oxlint");
56427
56713
  const hasOxfmt = detectionHasPackage(detection, "oxfmt");
56428
- const finalHookIds = selectedHookIds(finalPacks, baseline).filter((hookId) => hookId !== "format-edited-file" || hasOxfmt);
56429
- const lintAssets = hasOxlint ? resolveLintAssetsForPacks(finalPacks, baseline) : [];
56714
+ const hasPython = detection.detectedLanguages.includes("python");
56715
+ const finalHookIds = selectedHookIds(finalPacks, baseline).filter((hookId) => hookId !== "format-edited-file" || hasOxfmt || hasPython);
56716
+ const lintAssets = resolveLintAssetsForPacks(finalPacks, baseline);
56717
+ const appliedLintConfigs = writeAppliedLintConfigs({
56718
+ scanDirectory,
56719
+ outputDirectory,
56720
+ detection,
56721
+ finalPacks,
56722
+ baseline
56723
+ });
56430
56724
  const lintAssetIdsByPack = Object.fromEntries(finalPacks.map((packId) => [
56431
56725
  packId,
56432
56726
  lintAssets.filter((asset) => asset.sourcePacks.includes(packId)).map((asset) => asset.id)
@@ -56480,10 +56774,15 @@ var writeScaffoldOutput = ({
56480
56774
  finalPacks,
56481
56775
  selectedAssetIds: lintAssets.map((asset) => asset.id),
56482
56776
  selectedAssetsByPack: lintAssetIdsByPack,
56483
- requiredDevDependencies: uniqueSorted(lintAssets.flatMap((asset) => asset.requiredDevDependencies)),
56777
+ requiredDevDependencies: uniqueSorted([
56778
+ "oxlint",
56779
+ "ultracite",
56780
+ ...lintAssets.flatMap((asset) => asset.requiredDevDependencies)
56781
+ ]),
56484
56782
  existingRootOxlintConfigFiles: rootOxlintConfigFiles,
56485
56783
  starterConfigFile: lintStarterConfigFile,
56486
- recommendedIgnorePatterns: oxlintStarterConfig.ignorePatterns
56784
+ ultraciteCorePreset: "ultracite/oxlint/core",
56785
+ appliedLintConfigs
56487
56786
  })
56488
56787
  }));
56489
56788
  lintSpecFiles.push(lintSelectionFile);
@@ -56569,11 +56868,14 @@ var writeScaffoldOutput = ({
56569
56868
  }));
56570
56869
  hookFiles.push(hook.outputPath);
56571
56870
  }
56572
- execFileSync5(process.execPath, [path10.join(outputDirectory, syncScriptFile)], {
56871
+ execFileSync4(process.execPath, [path10.join(outputDirectory, syncScriptFile)], {
56573
56872
  cwd: outputDirectory,
56574
56873
  stdio: "ignore"
56575
56874
  });
56576
56875
  harnessFiles.push(...collectRelativeFiles(outputDirectory, ".claude"), ...collectRelativeFiles(outputDirectory, ".codex"), ...collectRelativeFiles(outputDirectory, ".cursor"), ...collectRelativeFiles(outputDirectory, ".opencode"));
56876
+ if (existsSync5(path10.join(outputDirectory, "opencode.json"))) {
56877
+ harnessFiles.push("opencode.json");
56878
+ }
56577
56879
  generatedFiles.push(...harnessFiles);
56578
56880
  const requiredToolsFile = ".devpunks/required-tools.json";
56579
56881
  generatedFiles.push(writeArtifact({
@@ -56640,6 +56942,7 @@ var writeScaffoldOutput = ({
56640
56942
  promptSpecs,
56641
56943
  opensrcReferences,
56642
56944
  lintAssets,
56945
+ appliedLintConfigs,
56643
56946
  subagentManifestSpec,
56644
56947
  baseline: baseline.summary,
56645
56948
  version,
@@ -56682,7 +56985,7 @@ var writeScaffoldOutput = ({
56682
56985
  // src/scaffold/run.ts
56683
56986
  var yesValues = new Set(["", "y", "yes"]);
56684
56987
  var encodeJson2 = encodeSync(parseJson(Unknown));
56685
- var encodePrettyJson = (value6) => JSON.stringify(JSON.parse(encodeJson2(value6)), null, 2);
56988
+ var encodePrettyJson2 = (value6) => JSON.stringify(JSON.parse(encodeJson2(value6)), null, 2);
56686
56989
  var agentSystemPromptFile = ".devpunks/AGENT-SYSTEM-PROMPT.md";
56687
56990
  var clipboardWorkingDirectory = homedir2();
56688
56991
  var writeAgentSystemPrompt = ({
@@ -56715,7 +57018,7 @@ var tryClipboardCommand = ({
56715
57018
  }
56716
57019
  };
56717
57020
  var defaultClipboardExecFile = (command, args2, options9) => {
56718
- execFileSync6(command, [...args2], {
57021
+ execFileSync5(command, [...args2], {
56719
57022
  cwd: options9.cwd,
56720
57023
  input: options9.input,
56721
57024
  stdio: ["pipe", "ignore", "ignore"]
@@ -56994,7 +57297,7 @@ var runScaffold = ({
56994
57297
  yield* prompt4.writeLine("");
56995
57298
  yield* prompt4.writeLine(renderDivider());
56996
57299
  yield* prompt4.writeLine(renderJsonLabel());
56997
- yield* prompt4.writeLine(encodePrettyJson(result));
57300
+ yield* prompt4.writeLine(encodePrettyJson2(result));
56998
57301
  }
56999
57302
  yield* submitCliEventEffect("cli.scaffold.setup.completed", {
57000
57303
  cwd: scanDirectory,
@@ -57019,9 +57322,10 @@ import {
57019
57322
  import path12 from "path";
57020
57323
 
57021
57324
  // src/content/wiki.ts
57022
- var makeWikiScaffoldTemplate = (wikiRoot) => ({
57023
- wikiRoot,
57024
- agentsMarkdown: `# Wiki Schema
57325
+ var makeWikiScaffoldTemplate = (wikiRoot, wikiFramework = "next") => {
57326
+ const template = {
57327
+ wikiRoot,
57328
+ agentsMarkdown: `# Wiki Schema
57025
57329
 
57026
57330
  This file defines how any agent operates within \`${wikiRoot}/\`. Read it before creating or modifying wiki content.
57027
57331
 
@@ -57154,10 +57458,10 @@ When processing source material into routed domain knowledge:
57154
57458
  - \`docs/\` owns implemented architecture and reference (the "how it works now")
57155
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
57156
57460
  `,
57157
- files: [
57158
- {
57159
- path: "package.json",
57160
- content: `{
57461
+ files: [
57462
+ {
57463
+ path: "package.json",
57464
+ content: `{
57161
57465
  "name": "@repo/wiki",
57162
57466
  "version": "0.0.0",
57163
57467
  "private": true,
@@ -57194,10 +57498,17 @@ When processing source material into routed domain knowledge:
57194
57498
  }
57195
57499
  }
57196
57500
  `
57197
- },
57198
- {
57199
- path: "next.config.mjs",
57200
- 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";
57201
57512
 
57202
57513
  const withMDX = createMDX();
57203
57514
 
@@ -57216,10 +57527,10 @@ const config = {
57216
57527
 
57217
57528
  export default withMDX(config);
57218
57529
  `
57219
- },
57220
- {
57221
- path: "scripts/sync-content.mjs",
57222
- 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";
57223
57534
  import path from "node:path";
57224
57535
  import { fileURLToPath } from "node:url";
57225
57536
 
@@ -57437,10 +57748,10 @@ if (repoRoot) {
57437
57748
  console.log("No repository root detected; using checked-in wiki content.");
57438
57749
  }
57439
57750
  `
57440
- },
57441
- {
57442
- path: "postcss.config.mjs",
57443
- content: `const config = {
57751
+ },
57752
+ {
57753
+ path: "postcss.config.mjs",
57754
+ content: `const config = {
57444
57755
  plugins: {
57445
57756
  "@tailwindcss/postcss": {},
57446
57757
  },
@@ -57448,10 +57759,10 @@ if (repoRoot) {
57448
57759
 
57449
57760
  export default config;
57450
57761
  `
57451
- },
57452
- {
57453
- path: "source.config.ts",
57454
- 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";
57455
57766
  import { remarkMdxMermaid } from "fumadocs-core/mdx-plugins";
57456
57767
  import { defineConfig, defineDocs } from "fumadocs-mdx/config";
57457
57768
  import { z } from "zod";
@@ -57480,10 +57791,10 @@ export default defineConfig({
57480
57791
  },
57481
57792
  });
57482
57793
  `
57483
- },
57484
- {
57485
- path: "tsconfig.json",
57486
- content: `{
57794
+ },
57795
+ {
57796
+ path: "tsconfig.json",
57797
+ content: `{
57487
57798
  "compilerOptions": {
57488
57799
  "target": "ESNext",
57489
57800
  "lib": ["dom", "dom.iterable", "esnext"],
@@ -57515,10 +57826,10 @@ export default defineConfig({
57515
57826
  "exclude": ["node_modules"]
57516
57827
  }
57517
57828
  `
57518
- },
57519
- {
57520
- path: "src/app/global.css",
57521
- content: `@import "tailwindcss";
57829
+ },
57830
+ {
57831
+ path: "src/app/global.css",
57832
+ content: `@import "tailwindcss";
57522
57833
  @import "fumadocs-ui/css/neutral.css";
57523
57834
  @import "fumadocs-ui/css/preset.css";
57524
57835
 
@@ -57530,10 +57841,10 @@ body {
57530
57841
  background-color: var(--color-fd-background);
57531
57842
  }
57532
57843
  `
57533
- },
57534
- {
57535
- path: "src/app/layout.tsx",
57536
- 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";
57537
57848
  import type { Metadata } from "next";
57538
57849
  import { Inter } from "next/font/google";
57539
57850
 
@@ -57563,10 +57874,10 @@ export default function Layout({ children }: LayoutProps<"/">) {
57563
57874
  );
57564
57875
  }
57565
57876
  `
57566
- },
57567
- {
57568
- path: "src/app/(home)/layout.tsx",
57569
- 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";
57570
57881
 
57571
57882
  import { baseOptions } from "@/lib/layout.shared";
57572
57883
 
@@ -57574,10 +57885,10 @@ export default function Layout({ children }: LayoutProps<"/">) {
57574
57885
  return <HomeLayout {...baseOptions()}>{children}</HomeLayout>;
57575
57886
  }
57576
57887
  `
57577
- },
57578
- {
57579
- path: "src/app/(home)/page.tsx",
57580
- content: `import Link from "next/link";
57888
+ },
57889
+ {
57890
+ path: "src/app/(home)/page.tsx",
57891
+ content: `import Link from "next/link";
57581
57892
 
57582
57893
  export default function HomePage() {
57583
57894
  return (
@@ -57594,10 +57905,10 @@ export default function HomePage() {
57594
57905
  );
57595
57906
  }
57596
57907
  `
57597
- },
57598
- {
57599
- path: "src/app/docs/layout.tsx",
57600
- 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";
57601
57912
 
57602
57913
  import { baseOptions } from "@/lib/layout.shared";
57603
57914
  import { getDocsPageTree } from "@/lib/source";
@@ -57610,16 +57921,16 @@ export default function Layout({ children }: LayoutProps<"/docs">) {
57610
57921
  );
57611
57922
  }
57612
57923
  `
57613
- },
57614
- {
57615
- path: "src/app/docs/[[...slug]]/page.tsx",
57616
- 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";
57617
57928
  import { createRelativeLink } from "fumadocs-ui/mdx";
57618
57929
  import type { Metadata } from "next";
57619
57930
  import { notFound, redirect } from "next/navigation";
57620
57931
 
57621
57932
  import { getMDXComponents } from "@/components/mdx";
57622
- import { source } from "@/lib/source";
57933
+ import { getPageImage, source } from "@/lib/source";
57623
57934
 
57624
57935
  export default async function Page(props: PageProps<"/docs/[[...slug]]">) {
57625
57936
  const params = await props.params;
@@ -57657,6 +57968,9 @@ export async function generateMetadata(
57657
57968
  return {
57658
57969
  title: page.data.title,
57659
57970
  description: page.data.description,
57971
+ openGraph: {
57972
+ images: getPageImage(page).url,
57973
+ },
57660
57974
  };
57661
57975
  }
57662
57976
 
@@ -57667,10 +57981,10 @@ function redirectSectionLanding(slug?: string[]) {
57667
57981
  if (joinedSlug === "wiki") redirect("/docs/project");
57668
57982
  }
57669
57983
  `
57670
- },
57671
- {
57672
- path: "src/app/api/search/route.ts",
57673
- 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";
57674
57988
 
57675
57989
  import { source } from "@/lib/source";
57676
57990
 
@@ -57678,10 +57992,43 @@ export const { GET } = createFromSource(source, {
57678
57992
  language: "english",
57679
57993
  });
57680
57994
  `
57681
- },
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} />,
57682
58014
  {
57683
- path: "src/components/mdx.tsx",
57684
- 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";
57685
58032
  import type { MDXComponents } from "mdx/types";
57686
58033
 
57687
58034
  import { Mermaid } from "@/components/mdx/mermaid";
@@ -57700,10 +58047,10 @@ declare global {
57700
58047
  type MDXProvidedComponents = ReturnType<typeof getMDXComponents>;
57701
58048
  }
57702
58049
  `
57703
- },
57704
- {
57705
- path: "src/components/mdx/mermaid.tsx",
57706
- content: `"use client";
58050
+ },
58051
+ {
58052
+ path: "src/components/mdx/mermaid.tsx",
58053
+ content: `"use client";
57707
58054
 
57708
58055
  import { use, useEffect, useId, useState } from "react";
57709
58056
  import { useTheme } from "next-themes";
@@ -57757,10 +58104,10 @@ function MermaidContent({ chart }: { chart: string }) {
57757
58104
  );
57758
58105
  }
57759
58106
  `
57760
- },
57761
- {
57762
- path: "src/lib/layout.shared.tsx",
57763
- 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";
57764
58111
 
57765
58112
  import { appName, gitConfig } from "./shared";
57766
58113
 
@@ -57773,10 +58120,10 @@ export function baseOptions(): BaseLayoutProps {
57773
58120
  };
57774
58121
  }
57775
58122
  `
57776
- },
57777
- {
57778
- path: "src/lib/shared.ts",
57779
- content: `export const appName = "Project Wiki";
58123
+ },
58124
+ {
58125
+ path: "src/lib/shared.ts",
58126
+ content: `export const appName = "Project Wiki";
57780
58127
  export const docsRoute = "/docs";
57781
58128
  export const docsImageRoute = "/og/docs";
57782
58129
  export const docsContentRoute = "/llms.mdx/docs";
@@ -57788,10 +58135,10 @@ export const gitConfig = {
57788
58135
  docsPath: "${wikiRoot}/content/docs",
57789
58136
  };
57790
58137
  `
57791
- },
57792
- {
57793
- path: "src/lib/source.ts",
57794
- content: `import { docs } from "collections/server";
58138
+ },
58139
+ {
58140
+ path: "src/lib/source.ts",
58141
+ content: `import { docs } from "collections/server";
57795
58142
  import type { Folder, Item, Node, Root } from "fumadocs-core/page-tree";
57796
58143
  import { loader } from "fumadocs-core/source";
57797
58144
  import { lucideIconsPlugin } from "fumadocs-core/source/lucide-icons";
@@ -57858,18 +58205,18 @@ export function getPageMarkdownUrl(page: (typeof source)["$inferPage"]) {
57858
58205
  };
57859
58206
  }
57860
58207
  `
57861
- },
57862
- {
57863
- path: "content/docs/meta.json",
57864
- content: `{
58208
+ },
58209
+ {
58210
+ path: "content/docs/meta.json",
58211
+ content: `{
57865
58212
  "title": "Project Docs",
57866
58213
  "pages": ["project"]
57867
58214
  }
57868
58215
  `
57869
- },
57870
- {
57871
- path: "content/docs/project/meta.json",
57872
- content: `{
58216
+ },
58217
+ {
58218
+ path: "content/docs/project/meta.json",
58219
+ content: `{
57873
58220
  "title": "Project",
57874
58221
  "description": "Internal project operations",
57875
58222
  "pages": [
@@ -57885,10 +58232,10 @@ export function getPageMarkdownUrl(page: (typeof source)["$inferPage"]) {
57885
58232
  ]
57886
58233
  }
57887
58234
  `
57888
- },
57889
- {
57890
- path: "content/docs/project/index.mdx",
57891
- content: `---
58235
+ },
58236
+ {
58237
+ path: "content/docs/project/index.mdx",
58238
+ content: `---
57892
58239
  title: Project
57893
58240
  description: Internal project operations and guidance
57894
58241
  surface: project
@@ -57897,20 +58244,20 @@ permission: project
57897
58244
 
57898
58245
  This surface is for specs, implementation notes, maintenance logs, decisions, repo guidance, runbooks, and durable project context.
57899
58246
  `
57900
- },
57901
- {
57902
- path: "content/docs/project/domains/meta.json",
57903
- content: `{
58247
+ },
58248
+ {
58249
+ path: "content/docs/project/domains/meta.json",
58250
+ content: `{
57904
58251
  "title": "Domains",
57905
58252
  "pages": [
57906
58253
  "index"
57907
58254
  ]
57908
58255
  }
57909
58256
  `
57910
- },
57911
- {
57912
- path: "content/docs/project/domains/index.mdx",
57913
- content: `---
58257
+ },
58258
+ {
58259
+ path: "content/docs/project/domains/index.mdx",
58260
+ content: `---
57914
58261
  title: Domains
57915
58262
  description: Project-owned domain source index
57916
58263
  surface: project
@@ -57921,18 +58268,18 @@ Use this section for project-side domain source indexes when the repo defines du
57921
58268
 
57922
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\`.
57923
58270
  `
57924
- },
57925
- {
57926
- path: "content/docs/project/grilling/meta.json",
57927
- content: `{
58271
+ },
58272
+ {
58273
+ path: "content/docs/project/grilling/meta.json",
58274
+ content: `{
57928
58275
  "title": "Grilling",
57929
58276
  "pages": ["index"]
57930
58277
  }
57931
58278
  `
57932
- },
57933
- {
57934
- path: "content/docs/project/grilling/index.mdx",
57935
- content: `---
58279
+ },
58280
+ {
58281
+ path: "content/docs/project/grilling/index.mdx",
58282
+ content: `---
57936
58283
  title: Grilling
57937
58284
  description: Requirements discovery logs and status artifacts
57938
58285
  surface: project
@@ -57941,146 +58288,529 @@ permission: project
57941
58288
 
57942
58289
  Use this section for durable requirements-grill outputs that should be discoverable in the wiki.
57943
58290
  `
57944
- },
57945
- {
57946
- path: "content/docs/project/specs/meta.json",
57947
- content: `{
58291
+ },
58292
+ {
58293
+ path: "content/docs/project/specs/meta.json",
58294
+ content: `{
57948
58295
  "title": "Specs",
57949
58296
  "pages": ["index"]
57950
58297
  }
57951
58298
  `
57952
- },
57953
- {
57954
- path: "content/docs/project/specs/index.mdx",
57955
- content: `---
57956
- title: Specs
57957
- description: Approved specs and implementation notes
57958
- surface: project
57959
- permission: project
57960
- ---
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);
58597
+ }
58598
+ `
58599
+ },
58600
+ {
58601
+ path: "src/router.tsx",
58602
+ content: `import { createRouter } from "@tanstack/react-router";
57961
58603
 
57962
- Use this section for approved specs and implementation notes that should be browsable in the wiki.
57963
- `
57964
- },
57965
- {
57966
- path: "content/docs/project/tech-debt/meta.json",
57967
- content: `{
57968
- "title": "Tech Debts",
57969
- "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
+ });
57970
58612
  }
57971
58613
  `
57972
- },
57973
- {
57974
- path: "content/docs/project/tech-debt/index.mdx",
57975
- content: `---
57976
- title: Tech Debts
57977
- description: Persistent implementation drift tied to specs
57978
- surface: project
57979
- permission: project
57980
- ---
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
+ });
57981
58634
 
57982
- Use this section for accepted or resolved debt artifacts that need long-lived project visibility.
57983
- `
57984
- },
57985
- {
57986
- path: "content/docs/project/maintenance/meta.json",
57987
- content: `{
57988
- "title": "Maintenance",
57989
- "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
+ );
57990
58649
  }
57991
58650
  `
57992
- },
57993
- {
57994
- path: "content/docs/project/maintenance/index.mdx",
57995
- content: `---
57996
- title: Maintenance
57997
- description: Maintenance logs and operational records
57998
- surface: project
57999
- permission: project
58000
- ---
58651
+ },
58652
+ {
58653
+ path: "src/routes/index.tsx",
58654
+ content: `import { createFileRoute, Link } from "@tanstack/react-router";
58001
58655
 
58002
- Use this section for durable maintenance records.
58003
- `
58004
- },
58005
- {
58006
- path: "content/docs/project/runbooks/meta.json",
58007
- content: `{
58008
- "title": "Runbooks",
58009
- "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
+ );
58010
58673
  }
58011
58674
  `
58012
- },
58013
- {
58014
- path: "content/docs/project/runbooks/index.mdx",
58015
- content: `---
58016
- title: Runbooks
58017
- description: Operator procedures and recovery notes
58018
- surface: project
58019
- permission: project
58020
- ---
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";
58021
58689
 
58022
- Use this section for operator runbooks.
58023
- `
58024
- },
58025
- {
58026
- path: "content/docs/project/decisions/meta.json",
58027
- content: `{
58028
- "title": "Decisions",
58029
- "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
+ );
58030
58738
  }
58031
58739
  `
58032
- },
58033
- {
58034
- path: "content/docs/project/decisions/index.mdx",
58035
- content: `---
58036
- title: Decisions
58037
- description: Durable project decisions
58038
- surface: project
58039
- permission: project
58040
- ---
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";
58041
58745
 
58042
- Use this section for decisions that should outlive a single implementation run.
58043
- `
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),
58044
58756
  },
58045
- {
58046
- path: "content/docs/project/repo-guidance/meta.json",
58047
- content: `{
58048
- "title": "Repo Guidance",
58049
- "pages": ["index"]
58050
- }
58757
+ },
58758
+ });
58051
58759
  `
58052
- },
58053
- {
58054
- path: "content/docs/project/repo-guidance/index.mdx",
58055
- content: `---
58056
- title: Repo Guidance
58057
- description: Repository-specific operating guidance
58058
- surface: project
58059
- permission: project
58060
- ---
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";
58061
58767
 
58062
- Use this section for durable repository guidance that agents should discover through the wiki.
58063
- `
58064
- }
58065
- ],
58066
- indexMarkdown: `# Wiki Index
58768
+ import { docsRoute } from "./shared";
58067
58769
 
58068
- 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
+ });
58069
58775
 
58070
- 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");
58071
58780
 
58072
- - Domains
58073
- - Specs
58074
- - Decisions
58075
- - Recent ingest activity
58076
- `,
58077
- 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
+ }
58078
58795
 
58079
- Append ingest activity here. Keep only the most recent 50 entries.
58080
- `,
58081
- rawSubdirectories: ["assets", "external", "meetings"],
58082
- topLevelDirectories: ["content/docs/project", "raw", "specs"]
58083
- });
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
+ ];
58084
58814
 
58085
58815
  // src/content/stage-scaffold.ts
58086
58816
  var backlogProviderLabels = {
@@ -58089,6 +58819,10 @@ var backlogProviderLabels = {
58089
58819
  linear: "Linear",
58090
58820
  monday: "monday.com"
58091
58821
  };
58822
+ var wikiFrameworkLabels = {
58823
+ next: "Next.js",
58824
+ "tanstack-start": "TanStack Start"
58825
+ };
58092
58826
  var stageScaffoldCatalog = [
58093
58827
  {
58094
58828
  id: "init",
@@ -58096,7 +58830,8 @@ var stageScaffoldCatalog = [
58096
58830
  skills: ["requirements-grill", "write-backlog"],
58097
58831
  renderPrompt: ({
58098
58832
  wikiRoot,
58099
- backlogProvider
58833
+ backlogProvider,
58834
+ wikiFramework
58100
58835
  }) => `You are the operator agent continuing a \`punks scaffold init\` run.
58101
58836
 
58102
58837
  Do not start requirements discovery by default. First reconcile the generated output with this repository.
@@ -58117,6 +58852,11 @@ Backlog provider:
58117
58852
  - keep this provider pinned unless the user explicitly changes it
58118
58853
  - when backlog writing starts, use the matching \`write-backlog\` provider payload guidance
58119
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
+
58120
58860
  Post-command guidance:
58121
58861
  1. Read the repository guidance and inspect the generated files.
58122
58862
  2. Move, rename, or refactor the generated wiki and skill output when needed so it matches the actual repo layout.
@@ -58137,34 +58877,37 @@ var backlogProviderLabels2 = {
58137
58877
  linear: "Linear",
58138
58878
  monday: "monday.com"
58139
58879
  };
58140
- var backlogProviderAliases = {
58141
- "1": "github",
58142
- "2": "linear",
58143
- "3": "azure-devops",
58144
- "4": "monday",
58145
- ado: "azure-devops",
58146
- azure: "azure-devops",
58147
- "azure devops": "azure-devops",
58148
- "azure-devops": "azure-devops",
58149
- gh: "github",
58150
- github: "github",
58151
- "github projects": "github",
58152
- linear: "linear",
58153
- monday: "monday",
58154
- "monday.com": "monday"
58155
- };
58156
- var parseBacklogProvider = (value6) => backlogProviderAliases[value6.trim().toLowerCase()] ?? null;
58880
+ var wikiFrameworkLabels2 = {
58881
+ next: "Next.js",
58882
+ "tanstack-start": "TanStack Start"
58883
+ };
58157
58884
  var promptBacklogProvider = ({
58158
58885
  prompt: prompt4
58159
58886
  }) => exports_Effect.gen(function* () {
58160
- const answer = yield* prompt4.readLine("Backlog provider? [1 github/projects, 2 linear, 3 azure-devops, 4 monday] (default: 1): ");
58161
- const parsed = parseBacklogProvider(answer);
58162
- if (parsed !== null)
58163
- return parsed;
58164
- if (answer.trim() !== "") {
58165
- yield* prompt4.writeLine("Unknown backlog provider. Defaulting to GitHub Projects and Issues.");
58166
- }
58167
- return "github";
58887
+ const answer = yield* prompt4.singleSelect({
58888
+ message: "Select backlog provider",
58889
+ defaultValue: "github",
58890
+ choices: [
58891
+ {
58892
+ title: "GitHub Projects and Issues",
58893
+ value: "github",
58894
+ description: "default"
58895
+ },
58896
+ {
58897
+ title: "Linear",
58898
+ value: "linear"
58899
+ },
58900
+ {
58901
+ title: "Azure DevOps",
58902
+ value: "azure-devops"
58903
+ },
58904
+ {
58905
+ title: "monday.com",
58906
+ value: "monday"
58907
+ }
58908
+ ]
58909
+ });
58910
+ return answer;
58168
58911
  });
58169
58912
  var renderBacklogProviderMarkdown = (provider) => `# Backlog Provider
58170
58913
 
@@ -58172,6 +58915,32 @@ Selected backlog provider: ${backlogProviderLabels2[provider]} (\`${provider}\`)
58172
58915
 
58173
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.
58174
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
+ `;
58175
58944
  var copySkillDirectory = ({
58176
58945
  outputDirectory,
58177
58946
  skillId,
@@ -58223,39 +58992,118 @@ var withSyncContentPrefix = (script) => {
58223
58992
  return script;
58224
58993
  return `${syncContentPrefix}${script}`;
58225
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
+ };
58226
59026
  var updateExistingWikiPackage = ({
58227
59027
  outputDirectory,
58228
- packagePath
59028
+ packagePath,
59029
+ wikiFramework
58229
59030
  }) => {
58230
59031
  if (!existsSync6(packagePath))
58231
59032
  return null;
58232
59033
  const packageJson = JSON.parse(readFileSync7(packagePath, "utf8"));
58233
59034
  const scripts = packageJson.scripts;
58234
59035
  const dependencies = packageJson.dependencies ?? {};
58235
- const nextDependencies = {
58236
- ...dependencies,
58237
- mermaid: dependencies.mermaid ?? "11.15.0",
58238
- "next-themes": dependencies["next-themes"] ?? "0.4.6"
58239
- };
58240
- 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 : {
58241
59045
  ...scripts,
58242
59046
  build: withSyncContentPrefix(scripts.build),
58243
59047
  "check-types": withSyncContentPrefix(scripts["check-types"]),
58244
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"
58245
59058
  };
58246
59059
  const dependenciesChanged = Object.entries(nextDependencies).some(([key, value6]) => dependencies[key] !== value6);
59060
+ const devDependenciesChanged = Object.entries(nextDevDependencies).some(([key, value6]) => devDependencies[key] !== value6);
58247
59061
  const scriptsChanged = nextScripts !== undefined && Object.entries(nextScripts).some(([key, value6]) => scripts?.[key] !== value6);
58248
- const changed = dependenciesChanged || scriptsChanged;
59062
+ const changed = dependenciesChanged || devDependenciesChanged || scriptsChanged;
58249
59063
  if (!changed)
58250
59064
  return null;
58251
59065
  writeFileSync5(packagePath, JSON.stringify({
58252
59066
  ...packageJson,
58253
59067
  dependencies: nextDependencies,
59068
+ ...packageJson.devDependencies === undefined && wikiFramework === "next" ? {} : { devDependencies: nextDevDependencies },
58254
59069
  ...nextScripts === undefined ? {} : { scripts: nextScripts }
58255
59070
  }, null, 2) + `
58256
59071
  `);
58257
59072
  return relativePosixPath2(outputDirectory, packagePath);
58258
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
+ };
58259
59107
  var hasFlatRoutePage = (directoryPath) => existsSync6(`${directoryPath}.md`) || existsSync6(`${directoryPath}.mdx`);
58260
59108
  var isNestedRouteSeedBlockedByFlatPage = ({
58261
59109
  wikiDirectory,
@@ -58271,9 +59119,10 @@ var scaffoldWiki = ({
58271
59119
  outputDirectory,
58272
59120
  wikiRoot,
58273
59121
  targetRoot,
58274
- backlogProvider
59122
+ backlogProvider,
59123
+ wikiFramework
58275
59124
  }) => {
58276
- const template = makeWikiScaffoldTemplate(wikiRoot);
59125
+ const template = makeWikiScaffoldTemplate(wikiRoot, wikiFramework);
58277
59126
  const createdFiles = [];
58278
59127
  const wikiDirectory = path12.join(outputDirectory, targetRoot);
58279
59128
  for (const directory3 of template.topLevelDirectories) {
@@ -58321,11 +59170,29 @@ var scaffoldWiki = ({
58321
59170
  }
58322
59171
  const updatedPackageFile = updateExistingWikiPackage({
58323
59172
  outputDirectory,
58324
- packagePath: path12.join(wikiDirectory, "package.json")
59173
+ packagePath: path12.join(wikiDirectory, "package.json"),
59174
+ wikiFramework
58325
59175
  });
58326
59176
  if (updatedPackageFile !== null && !createdFiles.includes(updatedPackageFile)) {
58327
59177
  createdFiles.push(updatedPackageFile);
58328
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
+ }
58329
59196
  const agentsPath = path12.join(wikiDirectory, "AGENTS.md");
58330
59197
  const agentsFile = writeMissingFile({
58331
59198
  outputDirectory,
@@ -58366,11 +59233,20 @@ var scaffoldWiki = ({
58366
59233
  if (backlogProviderFile !== null) {
58367
59234
  createdFiles.push(backlogProviderFile);
58368
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
+ }
58369
59244
  return createdFiles.toSorted();
58370
59245
  };
58371
59246
  var scaffoldWikiForDirectory = ({
58372
59247
  outputDirectory,
58373
- monorepo
59248
+ monorepo,
59249
+ wikiFramework = "next"
58374
59250
  }) => {
58375
59251
  const wikiTarget = stageWikiTarget({
58376
59252
  outputDirectory,
@@ -58380,7 +59256,8 @@ var scaffoldWikiForDirectory = ({
58380
59256
  outputDirectory,
58381
59257
  wikiRoot: wikiTarget.wikiRoot,
58382
59258
  targetRoot: wikiTarget.targetRoot,
58383
- backlogProvider: "github"
59259
+ backlogProvider: "github",
59260
+ wikiFramework
58384
59261
  });
58385
59262
  };
58386
59263
  var isWikiOutputDirectory = (outputDirectory) => {
@@ -58411,6 +59288,7 @@ var runStageScaffold = ({
58411
59288
  }) => exports_Effect.gen(function* () {
58412
59289
  const stage = stageScaffoldById[commandId];
58413
59290
  const backlogProvider = yield* promptBacklogProvider({ prompt: prompt4 });
59291
+ const wikiFramework = yield* promptWikiFramework({ prompt: prompt4 });
58414
59292
  const detection = yield* detectRepository(outputDirectory).pipe(exports_Effect.catchAll(() => exports_Effect.succeed(null)));
58415
59293
  const skillFiles = stage.skills.map((skillId) => copySkillDirectory({
58416
59294
  outputDirectory,
@@ -58424,10 +59302,15 @@ var runStageScaffold = ({
58424
59302
  const wikiFiles = scaffoldWiki({
58425
59303
  outputDirectory,
58426
59304
  ...wikiTarget,
58427
- backlogProvider
59305
+ backlogProvider,
59306
+ wikiFramework
58428
59307
  });
58429
59308
  removeHarnessDirectoriesFromGitignore(outputDirectory);
58430
- const operatorPrompt = stage.renderPrompt({ wikiRoot: wikiTarget.wikiRoot, backlogProvider });
59309
+ const operatorPrompt = stage.renderPrompt({
59310
+ wikiRoot: wikiTarget.wikiRoot,
59311
+ backlogProvider,
59312
+ wikiFramework
59313
+ });
58431
59314
  yield* prompt4.writeLine(renderScaffoldTitle());
58432
59315
  yield* prompt4.writeLine("");
58433
59316
  yield* prompt4.writeLine(renderStageIntro({
@@ -58448,6 +59331,8 @@ var runStageScaffold = ({
58448
59331
  yield* prompt4.writeLine("");
58449
59332
  yield* prompt4.writeLine(renderCommandSection("Backlog provider", `${backlogProviderLabels2[backlogProvider]} (${backlogProvider})`));
58450
59333
  yield* prompt4.writeLine("");
59334
+ yield* prompt4.writeLine(renderCommandSection("Wiki framework", `${wikiFrameworkLabels2[wikiFramework]} (${wikiFramework})`));
59335
+ yield* prompt4.writeLine("");
58451
59336
  yield* prompt4.writeLine(renderCommandSection("Operator prompt", operatorPrompt));
58452
59337
  yield* submitCliEventEffect("cli.scaffold.init.completed", {
58453
59338
  cwd: outputDirectory,
@@ -58459,7 +59344,8 @@ var runStageScaffold = ({
58459
59344
  outputDirectory,
58460
59345
  skillFiles,
58461
59346
  wikiFiles,
58462
- backlogProvider
59347
+ backlogProvider,
59348
+ wikiFramework
58463
59349
  };
58464
59350
  });
58465
59351
 
@@ -58535,7 +59421,7 @@ import path15 from "path";
58535
59421
 
58536
59422
  // src/update/run.ts
58537
59423
  import { createHash as createHash3 } from "crypto";
58538
- import { execFileSync as execFileSync7 } from "child_process";
59424
+ import { execFileSync as execFileSync6 } from "child_process";
58539
59425
  import {
58540
59426
  cpSync as cpSync3,
58541
59427
  existsSync as existsSync7,
@@ -59464,7 +60350,7 @@ function splitLines4(text12) {
59464
60350
  var scaffoldManifestFile = ".devpunks/scaffold-manifest.json";
59465
60351
  var yesValues2 = new Set(["", "y", "yes"]);
59466
60352
  var encodeJson3 = encodeSync(parseJson(Unknown));
59467
- var encodePrettyJson2 = (value6) => JSON.stringify(JSON.parse(encodeJson3(value6)), null, 2);
60353
+ var encodePrettyJson3 = (value6) => JSON.stringify(JSON.parse(encodeJson3(value6)), null, 2);
59468
60354
  var managedFileSchema = Struct({
59469
60355
  path: String$,
59470
60356
  sha256: String$,
@@ -59672,13 +60558,15 @@ var buildWikiAlignment = ({
59672
60558
  const wikiRoot = detection.monorepo ? "apps/wiki" : "wiki";
59673
60559
  copyIfExists({ rootDirectory, targetDirectory: expectedDirectory, relativePath: wikiRoot });
59674
60560
  copyIfExists({ rootDirectory, targetDirectory: expectedDirectory, relativePath: "docs" });
60561
+ const wikiFramework = readWikiFrameworkPin(path14.join(expectedDirectory, wikiRoot));
59675
60562
  scaffoldWikiForDirectory({
59676
60563
  outputDirectory: expectedDirectory,
59677
- monorepo: detection.monorepo
60564
+ monorepo: detection.monorepo,
60565
+ wikiFramework
59678
60566
  });
59679
60567
  const syncScript = path14.join(expectedDirectory, wikiRoot, "scripts", "sync-content.mjs");
59680
60568
  if (existsSync7(syncScript)) {
59681
- execFileSync7(process.execPath, [syncScript], {
60569
+ execFileSync6(process.execPath, [syncScript], {
59682
60570
  cwd: expectedDirectory,
59683
60571
  stdio: "ignore"
59684
60572
  });
@@ -59698,6 +60586,17 @@ var buildWikiAlignment = ({
59698
60586
  })
59699
60587
  };
59700
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
+ };
59701
60600
  var buildGitignoreCleanup = ({
59702
60601
  rootDirectory,
59703
60602
  expectedDirectory
@@ -59909,7 +60808,7 @@ var runUpdate = ({
59909
60808
  if (emitJson) {
59910
60809
  yield* prompt4.writeLine("");
59911
60810
  yield* prompt4.writeLine(renderJsonLabel());
59912
- yield* prompt4.writeLine(encodePrettyJson2(result));
60811
+ yield* prompt4.writeLine(encodePrettyJson3(result));
59913
60812
  }
59914
60813
  rmSync4(expectedDirectory, { recursive: true, force: true });
59915
60814
  rmSync4(wikiAlignment.expectedDirectory, { recursive: true, force: true });
@@ -60399,6 +61298,7 @@ var askYesNo = async (question) => {
60399
61298
  readline2.close();
60400
61299
  }
60401
61300
  };
61301
+ var isPromptAbort = (error4) => error4 instanceof Error && error4.name === "AbortError";
60402
61302
  var runInteractiveCliUpdate = async () => {
60403
61303
  if (!shouldAskForSelfUpdate()) {
60404
61304
  return false;
@@ -60536,7 +61436,10 @@ if (process.env[startupCheckWorkerEnv] === "1") {
60536
61436
  startBackgroundStartupChecks();
60537
61437
  cli(process.argv).pipe(exports_Effect.provide(exports_Layer.mergeAll(exports_BunContext.layer)), exports_BunRuntime.runMain);
60538
61438
  }
60539
- } catch {
61439
+ } catch (error4) {
61440
+ if (isPromptAbort(error4)) {
61441
+ process.exit(130);
61442
+ }
60540
61443
  cli(process.argv).pipe(exports_Effect.provide(exports_Layer.mergeAll(exports_BunContext.layer)), exports_BunRuntime.runMain);
60541
61444
  }
60542
61445
  }