@mono-lit/utility 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/LICENSE.md +54 -54
  2. package/README.md +156 -156
  3. package/dist/{app-roots-BJsIxzjk.d.ts → app-roots-DK41xMWj.d.ts} +1 -2
  4. package/dist/config-node.d.ts +134 -188
  5. package/dist/config-node.js +1 -1
  6. package/dist/config.d.ts +1 -1
  7. package/dist/{create-config-D3m6xTaQ.d.ts → create-config-B8IhX4ht.d.ts} +5 -3
  8. package/dist/fetching.d.ts +51 -46
  9. package/dist/fetching.js +163 -15
  10. package/dist/{index-C2hZeNkq.d.ts → index-BAy6tbOG.d.ts} +12 -6
  11. package/dist/{index-ClrZbU7n.d.ts → index-DYlzhHq7.d.ts} +83 -87
  12. package/dist/index.d.ts +3 -7
  13. package/dist/index.js +5 -3
  14. package/dist/{merge-file-C5nzi_MY.d.ts → merge-file-CLc3wxY4.d.ts} +5 -28
  15. package/dist/{mock-db-5mJTObSC.js → mock-db-4tTWrF-P.js} +12 -12
  16. package/dist/mock-db.d.ts +1 -1
  17. package/dist/mock-db.js +1 -1
  18. package/dist/mono-db.d.ts +1 -1
  19. package/dist/mono-db.js +115 -108
  20. package/dist/mono-prepare.d.ts +1 -1
  21. package/dist/mono-prepare.js +3 -2
  22. package/dist/mono-skills.d.ts +1 -1
  23. package/dist/mono-skills.js +39 -32
  24. package/dist/nuxt-layers.d.ts +4 -2
  25. package/dist/nuxt-runtime.d.ts +4 -5
  26. package/dist/nuxt-runtime.js +1 -1
  27. package/dist/nuxt.d.ts +42 -38
  28. package/dist/nuxt.js +153 -6
  29. package/dist/{runtime-C_IWNrAG.js → runtime-vs7U9Ed4.js} +394 -157
  30. package/dist/runtime.d.ts +68 -133
  31. package/dist/runtime.js +2 -2
  32. package/dist/{session-Bk985AIM.js → session-Bcig-rPi.js} +4 -4
  33. package/dist/{universal-B2eD9xho.d.ts → universal-BR0O7Qwk.d.ts} +8 -46
  34. package/dist/{universal-BNTo_83u.js → universal-DIVEzCvN.js} +3 -2
  35. package/dist/vite.d.ts +44 -41
  36. package/package.json +11 -15
@@ -1,13 +1,12 @@
1
- import { S as MonoSkillConfig, c as MonoConfig, o as MonoAppType, w as MonoTemplate } from "./create-config-D3m6xTaQ.js";
2
- import { a as ResolveAppRootsOptions, c as isMissingPathError, d as pathAppRoots, f as resetAppPathWarnings, i as MonoMissingPathPolicy, l as linkedAppRoots, n as MonoAppRootInput, o as appRootDirs, p as resolveAppRoots, r as MonoAppRootSource, s as hasUrl, t as MonoAppRoot, u as missingPathMessage } from "./app-roots-BJsIxzjk.js";
1
+ import { S as MonoSkillConfig, c as MonoConfig, o as MonoAppType, w as MonoTemplate } from "./create-config-B8IhX4ht.js";
2
+ import { a as ResolveAppRootsOptions, c as isMissingPathError, d as pathAppRoots, f as resetAppPathWarnings, i as MonoMissingPathPolicy, l as linkedAppRoots, n as MonoAppRootInput, o as appRootDirs, p as resolveAppRoots, r as MonoAppRootSource, s as hasUrl, t as MonoAppRoot, u as missingPathMessage } from "./app-roots-DK41xMWj.js";
3
3
  import { LoadConfigOptions } from "c12";
4
4
  import { TSConfig } from "pkg-types";
5
-
6
5
  //#region src/composables/config-node.d.ts
7
- interface LoadMonoConfigOptions extends Partial<LoadConfigOptions<MonoConfig>> {
6
+ export interface LoadMonoConfigOptions extends Partial<LoadConfigOptions<MonoConfig>> {
8
7
  cwd?: string;
9
8
  }
10
- declare function loadMonoConfig(options?: LoadMonoConfigOptions): Promise<{
9
+ export declare function loadMonoConfig(options?: LoadMonoConfigOptions): Promise<{
11
10
  config: MonoConfig;
12
11
  layers?: import("c12").ConfigLayer<MonoConfig, import("c12").ConfigLayerMeta>[] | undefined;
13
12
  cwd?: string;
@@ -17,10 +16,10 @@ declare function loadMonoConfig(options?: LoadMonoConfigOptions): Promise<{
17
16
  meta?: import("c12").ConfigLayerMeta | undefined;
18
17
  configFile?: string;
19
18
  }>;
20
- declare function getMonoConfig(options?: LoadMonoConfigOptions): Promise<MonoConfig>;
19
+ export declare function getMonoConfig(options?: LoadMonoConfigOptions): Promise<MonoConfig>;
21
20
  //#endregion
22
21
  //#region src/composables/mono-alias.d.ts
23
- interface MonoAliasOptions {
22
+ export interface MonoAliasOptions {
24
23
  /** App root (absolute). Pass `fileURLToPath(new URL('.', import.meta.url))`. */
25
24
  dirname: string;
26
25
  /** Override the own name instead of reading it from mono.config.ts. */
@@ -47,18 +46,18 @@ interface MonoAliasOptions {
47
46
  *
48
47
  * Ported verbatim from `bin/mono-clone.mjs`.
49
48
  */
50
- declare function stripCommentsSafe(code: string): string;
49
+ export declare function stripCommentsSafe(code: string): string;
51
50
  /**
52
51
  * Absolute path of the mono config file in `dir`, or `null`. The same lookup
53
52
  * order every static reader here uses.
54
53
  */
55
- declare function monoConfigFileFor(dir: string): string | null;
54
+ export declare function monoConfigFileFor(dir: string): string | null;
56
55
  /**
57
56
  * Read the top-level `name: '...'` literal from mono.config.ts text without
58
57
  * executing it. The first lowercase `name:` string literal is the config name —
59
58
  * `apps[].name` entries appear later in the file.
60
59
  */
61
- declare function extractConfigName(dir: string): string | null;
60
+ export declare function extractConfigName(dir: string): string | null;
62
61
  /**
63
62
  * Read the top-level `template: 'host' | 'remote'` literal from mono.config.ts
64
63
  * text without executing it — the same trick `extractConfigName` uses, and for
@@ -70,9 +69,9 @@ declare function extractConfigName(dir: string): string | null;
70
69
  * mistaken for the top-level one. `null` when absent — which, per `MonoTemplate`,
71
70
  * reads as `'remote'`.
72
71
  */
73
- declare function extractTemplate(dir: string): MonoTemplate | null;
72
+ export declare function extractTemplate(dir: string): MonoTemplate | null;
74
73
  /** A statically-parsed `apps[]` entry (only fields we rely on here). */
75
- interface ExtractedApp {
74
+ export interface ExtractedApp {
76
75
  name: string;
77
76
  type?: MonoAppType;
78
77
  /** Where `mono sync` clones from — optional when `path` is set. */
@@ -82,7 +81,7 @@ interface ExtractedApp {
82
81
  [key: string]: unknown;
83
82
  }
84
83
  /** Statically read `{ name, type }` of a config without executing it. */
85
- interface ExtractedConfig {
84
+ export interface ExtractedConfig {
86
85
  name: string | null;
87
86
  type: MonoAppType;
88
87
  apps: ExtractedApp[];
@@ -97,7 +96,7 @@ interface ExtractedConfig {
97
96
  * shadowed by an `apps[].type` (or a `fetching.api.*.type`). Declare the
98
97
  * config's own `type` above `apps`.
99
98
  */
100
- declare function extractConfig(dir: string): ExtractedConfig;
99
+ export declare function extractConfig(dir: string): ExtractedConfig;
101
100
  /**
102
101
  * Statically read the top-level `skill: { url, envToken? }` literal of a
103
102
  * mono.config.ts WITHOUT executing it — the `mono skills` CLI runs in a bare
@@ -112,7 +111,7 @@ declare function extractConfig(dir: string): ExtractedConfig;
112
111
  * present but is not a static object literal with a string `url` — a present
113
112
  * but broken `skill` must surface as an error, not silently read as "off".
114
113
  */
115
- declare function extractSkill(dir: string): MonoSkillConfig | null;
114
+ export declare function extractSkill(dir: string): MonoSkillConfig | null;
116
115
  /**
117
116
  * Every `apps[]` entry must say where it comes from: a `url` (`mono sync`
118
117
  * clones it), a `path` (read in place), or both (`path` wins, `url` is the
@@ -122,8 +121,8 @@ declare function extractSkill(dir: string): MonoSkillConfig | null;
122
121
  * Run on the ROOT config only — a sibling's config is that sibling's business
123
122
  * and is validated when IT runs.
124
123
  */
125
- declare function assertAppSources(apps: ExtractedApp[], file: string): void;
126
- interface ResolveFederatedRootsOptions {
124
+ export declare function assertAppSources(apps: ExtractedApp[], file: string): void;
125
+ export interface ResolveFederatedRootsOptions {
127
126
  /** App root (absolute). */
128
127
  dirname: string;
129
128
  /** Folder holding the clones. @default './.mono/apps' */
@@ -148,7 +147,7 @@ interface ResolveFederatedRootsOptions {
148
147
  * sibling's missing `path` is skipped silently (`onMissingPath: 'ignore'`):
149
148
  * that sibling reports it when it runs.
150
149
  */
151
- declare function resolveFederatedRoots(opts: ResolveFederatedRootsOptions): MonoAppRoot[];
150
+ export declare function resolveFederatedRoots(opts: ResolveFederatedRootsOptions): MonoAppRoot[];
152
151
  /**
153
152
  * Build the mono alias map for both Vite's `resolve.alias` and the jiti alias
154
153
  * that `getMonoConfig` needs to parse `mono.config.ts`.
@@ -170,9 +169,9 @@ declare function resolveFederatedRoots(opts: ResolveFederatedRootsOptions): Mono
170
169
  * — in which case `@<remote>` resolves THERE, in every command — plus the
171
170
  * `path` apps those apps declare themselves. Returns absolute paths.
172
171
  */
173
- declare function monoAlias(opts: MonoAliasOptions): Record<string, string>;
172
+ export declare function monoAlias(opts: MonoAliasOptions): Record<string, string>;
174
173
  /** An app some config federates that has no directory under `.mono/apps/`. */
175
- interface MonoMissingApp {
174
+ export interface MonoMissingApp {
176
175
  /** The app's `name` — the thing `@<name>` / `@<name>-root` is keyed on. */
177
176
  name: string;
178
177
  /** Which config asked for it: this app's own name, or a cloned app's. */
@@ -180,7 +179,7 @@ interface MonoMissingApp {
180
179
  /** Its `apps[].envToken`, when it was declared — what to set for a private repo. */
181
180
  envToken?: string;
182
181
  }
183
- interface MonoMissingAppsOptions {
182
+ export interface MonoMissingAppsOptions {
184
183
  /** App root (absolute). */
185
184
  dirname: string;
186
185
  /** Folder scanned for remotes. Default './.mono/apps'. */
@@ -213,12 +212,12 @@ interface MonoMissingAppsOptions {
213
212
  * imports are syntactically identical to `@app/file`, and mistaking `@vueuse/core`
214
213
  * for a mono app would stub a real dependency out of the build.
215
214
  */
216
- declare function monoMissingApps(opts: MonoMissingAppsOptions): MonoMissingApp[];
217
- interface MonoStubAliasesOptions extends MonoMissingAppsOptions {
215
+ export declare function monoMissingApps(opts: MonoMissingAppsOptions): MonoMissingApp[];
216
+ export interface MonoStubAliasesOptions extends MonoMissingAppsOptions {
218
217
  /** Pre-computed missing apps (else discovered via {@link monoMissingApps}). */
219
218
  missing?: MonoMissingApp[];
220
219
  }
221
- interface MonoStubAliases {
220
+ export interface MonoStubAliases {
222
221
  /** Alias entries to merge ON TOP of {@link monoAlias}'s map. Empty when nothing is missing. */
223
222
  alias: Record<string, string>;
224
223
  /** What was stubbed — feed to {@link formatMissingApps}. */
@@ -248,21 +247,21 @@ interface MonoStubAliases {
248
247
  * in an app's `main.ts` — stub only jiti and the dev server starts, then dies on
249
248
  * first page load).
250
249
  */
251
- declare function monoStubAliases(opts: MonoStubAliasesOptions): MonoStubAliases;
250
+ export declare function monoStubAliases(opts: MonoStubAliasesOptions): MonoStubAliases;
252
251
  /**
253
252
  * The warning for stubbed apps — names them, says what was lost, and gives the
254
253
  * command that fixes it. `envToken` is the actionable part: a private repo fails to
255
254
  * sync silently until someone knows which variable to set.
256
255
  */
257
- declare function formatMissingApps(missing: MonoMissingApp[]): string;
256
+ export declare function formatMissingApps(missing: MonoMissingApp[]): string;
258
257
  //#endregion
259
258
  //#region src/composables/mono-tsconfig.d.ts
260
259
  /** Folder (relative to an app root) that holds the generated tsconfig. */
261
- declare const MONO_DIR = ".mono";
260
+ export declare const MONO_DIR = ".mono";
262
261
  /** Reference to the generated tsconfig, as written into the root `extends`. */
263
- declare const MONO_TSCONFIG_REF = "./.mono/tsconfig.json";
262
+ export declare const MONO_TSCONFIG_REF = "./.mono/tsconfig.json";
264
263
  /** Folder (relative to an app root) that holds the cloned remotes. */
265
- declare const MONO_APPS_DIR = ".mono/apps";
264
+ export declare const MONO_APPS_DIR = ".mono/apps";
266
265
  /**
267
266
  * Build the `compilerOptions.paths` map for `.mono/tsconfig.json` from the mono
268
267
  * alias map.
@@ -275,14 +274,14 @@ declare const MONO_APPS_DIR = ".mono/apps";
275
274
  * All alias/type/srcDir rules are inherited from `monoAlias` — nothing is
276
275
  * re-implemented here.
277
276
  */
278
- declare function monoTsconfigPaths(opts: MonoAliasOptions): Record<string, string[]>;
277
+ export declare function monoTsconfigPaths(opts: MonoAliasOptions): Record<string, string[]>;
279
278
  /** The object written to `<dirname>/.mono/tsconfig.json`. */
280
- declare function buildMonoTsconfig(opts: MonoAliasOptions): TSConfig;
281
- interface RunMonoPrepareOptions {
279
+ export declare function buildMonoTsconfig(opts: MonoAliasOptions): TSConfig;
280
+ export interface RunMonoPrepareOptions {
282
281
  /** App root (absolute) containing `mono.config.ts` and `tsconfig.json`. */
283
282
  dirname: string;
284
283
  }
285
- interface RunMonoPrepareResult {
284
+ export interface RunMonoPrepareResult {
286
285
  /** Absolute path of the generated `.mono/tsconfig.json`. */
287
286
  monoTsconfigPath: string;
288
287
  /** Absolute path of the root `tsconfig.json` that was wired. */
@@ -312,21 +311,29 @@ interface RunMonoPrepareResult {
312
311
  * into the root `tsconfig.json` via `extends`, stripping the now-redundant
313
312
  * inline `@mono-*` paths. Idempotent: safe to run repeatedly.
314
313
  */
315
- declare function runMonoPrepare(opts: RunMonoPrepareOptions): Promise<RunMonoPrepareResult>;
314
+ export declare function runMonoPrepare(opts: RunMonoPrepareOptions): Promise<RunMonoPrepareResult>;
316
315
  //#endregion
317
316
  //#region src/skills/config.d.ts
318
317
  /**
319
318
  * Built-in behavioural defaults. Users never configure these — they only set
320
319
  * `skill.url` / `skill.envToken`.
321
320
  */
322
- declare const SKILLS_DEFAULTS: Readonly<{
323
- /** Local staging + clone directory (under the already-gitignored `.mono/`). */stagingDir: ".mono/skills"; /** Subfolder of `stagingDir` holding the working clone of the skills repo. */
324
- repoDir: "repo"; /** Conversation chunk size before splitting into `part-NNNN.jsonl`. 750 KB. */
325
- chunkSizeBytes: number; /** Remove the local staging dir after a successful upload. */
326
- cleanupAfterSuccess: true; /** Move a failed session from `pending/` to `failed/`. */
327
- moveFailedSessions: true; /** `read`/`search` re-fetch the clone when its last fetch is older than this. */
328
- refreshTtlMs: number; /** How many times a rejected (non-fast-forward) push is replayed on a fresh tip. */
329
- pushAttempts: 3; /** Timeout for a single remote git operation (probe, fetch, push). */
321
+ export declare const SKILLS_DEFAULTS: Readonly<{
322
+ /** Local staging + clone directory (under the already-gitignored `.mono/`). */
323
+ stagingDir: ".mono/skills";
324
+ /** Subfolder of `stagingDir` holding the working clone of the skills repo. */
325
+ repoDir: "repo";
326
+ /** Conversation chunk size before splitting into `part-NNNN.jsonl`. 750 KB. */
327
+ chunkSizeBytes: number;
328
+ /** Remove the local staging dir after a successful upload. */
329
+ cleanupAfterSuccess: true;
330
+ /** Move a failed session from `pending/` to `failed/`. */
331
+ moveFailedSessions: true;
332
+ /** `read`/`search` re-fetch the clone when its last fetch is older than this. */
333
+ refreshTtlMs: number;
334
+ /** How many times a rejected (non-fast-forward) push is replayed on a fresh tip. */
335
+ pushAttempts: 3;
336
+ /** Timeout for a single remote git operation (probe, fetch, push). */
330
337
  gitTimeoutMs: number;
331
338
  }>;
332
339
  /**
@@ -335,7 +342,7 @@ declare const SKILLS_DEFAULTS: Readonly<{
335
342
  * `--branch`, `--url`, `--destination`, etc. — so the AI can never (accidentally
336
343
  * or otherwise) retarget the repo or leak a token via argv.
337
344
  */
338
- declare const ALLOWED_FLAGS: readonly string[];
345
+ export declare const ALLOWED_FLAGS: readonly string[];
339
346
  /**
340
347
  * Default/generic template app names. While an app still carries one of these
341
348
  * placeholder names, `save`/`retry` are skipped — we don't want session history
@@ -343,25 +350,25 @@ declare const ALLOWED_FLAGS: readonly string[];
343
350
  * (see Template Rule 1 — "confirm the app name"). Comparison is case-insensitive
344
351
  * against the normalized app id.
345
352
  */
346
- declare const GENERIC_APP_NAMES: readonly string[];
353
+ export declare const GENERIC_APP_NAMES: readonly string[];
347
354
  /** True when `id` is still a default/generic template name. */
348
- declare function isGenericAppName(id: string): boolean;
355
+ export declare function isGenericAppName(id: string): boolean;
349
356
  /**
350
357
  * Load `.env` (and `.env.dev` if present) from `cwd` into `process.env` without
351
358
  * overriding values already set in the real environment, so `skill.envToken`
352
359
  * can name a variable kept in a dotenv file — exactly like `apps[].envToken`
353
360
  * for `mono sync`. Missing files are ignored silently.
354
361
  */
355
- declare function loadSkillsEnv(cwd?: string): void;
362
+ export declare function loadSkillsEnv(cwd?: string): void;
356
363
  /**
357
364
  * Read `skill` from the `mono.config.ts` in `cwd`. `null` = not configured (the
358
365
  * feature is off). Throws when the key is present but malformed.
359
366
  */
360
- declare function loadSkillConfig(cwd?: string): MonoSkillConfig | null;
367
+ export declare function loadSkillConfig(cwd?: string): MonoSkillConfig | null;
361
368
  /** How `skill.url` was recognised. Decides token support and probing. */
362
- type SkillUrlKind = 'github' | 'https' | 'ssh' | 'local';
369
+ export type SkillUrlKind = 'github' | 'https' | 'ssh' | 'local';
363
370
  /** `skill.url` parsed into what the git layer needs. Pure data, no I/O. */
364
- interface SkillTarget {
371
+ export interface SkillTarget {
365
372
  kind: SkillUrlKind;
366
373
  /** Plain, credential-free clone URL — the ONLY form that is ever logged or stored. */
367
374
  remoteUrl: string;
@@ -394,24 +401,24 @@ interface SkillTarget {
394
401
  * for anything that is not a repository (`/blob/` file links, an owner with no
395
402
  * repo, garbage).
396
403
  */
397
- declare function resolveSkillTarget(cfg: MonoSkillConfig): SkillTarget;
404
+ export declare function resolveSkillTarget(cfg: MonoSkillConfig): SkillTarget;
398
405
  //#endregion
399
406
  //#region src/skills/types.d.ts
400
407
  /** Outcome status a session can carry. */
401
- type SessionStatus = 'completed' | 'partial' | 'failed';
408
+ export type SessionStatus = 'completed' | 'partial' | 'failed';
402
409
  /** A file the session touched — METADATA ONLY; contents are never uploaded. */
403
- interface ChangedFile {
410
+ export interface ChangedFile {
404
411
  path: string;
405
412
  operation: 'added' | 'modified' | 'deleted' | 'renamed';
406
413
  }
407
414
  /** A technical/business decision recorded during the session. */
408
- interface SessionDecision {
415
+ export interface SessionDecision {
409
416
  title: string;
410
417
  decision: string;
411
418
  reason?: string;
412
419
  }
413
420
  /** Shape of `metadata.json` the AI (or a human) writes before `mono skills save`. */
414
- interface SessionMetadata {
421
+ export interface SessionMetadata {
415
422
  schemaVersion: number;
416
423
  sessionId: string;
417
424
  status: SessionStatus;
@@ -433,14 +440,14 @@ interface SessionMetadata {
433
440
  [key: string]: unknown;
434
441
  }
435
442
  /** The effective local git identity used for attribution (`whoami`). */
436
- interface Actor {
443
+ export interface Actor {
437
444
  name: string;
438
445
  email: string;
439
446
  /** `<name-slug>__<6 hex>` — the per-actor folder under `<app>/history/`. */
440
447
  actorFolder: string;
441
448
  }
442
449
  /** Result of a successful `mono skills save` / `retry`. */
443
- interface SaveResult {
450
+ export interface SaveResult {
444
451
  success: true;
445
452
  sessionId: string;
446
453
  /** The configured repository (plain URL, never a token). */
@@ -463,14 +470,14 @@ interface SaveResult {
463
470
  localCleanup: boolean;
464
471
  }
465
472
  /** Result when `skill` is not configured in mono.config.ts — NOT an error. */
466
- interface SkippedResult {
473
+ export interface SkippedResult {
467
474
  success: true;
468
475
  skipped: true;
469
476
  reason: 'MONO_SKILLS_NOT_CONFIGURED';
470
477
  hint?: string;
471
478
  }
472
479
  /** Generic failure payload. */
473
- interface FailureResult {
480
+ export interface FailureResult {
474
481
  success: false;
475
482
  error: string;
476
483
  [key: string]: unknown;
@@ -482,10 +489,10 @@ interface FailureResult {
482
489
  * stop Git Credential Manager from popping a dialog, keep LF so the tree is
483
490
  * byte-identical across machines, no symlinks/submodules, long paths, no gc.
484
491
  */
485
- declare const BASE_ARGS: string[];
492
+ export declare const BASE_ARGS: string[];
486
493
  /** Environment for every git child process. */
487
- declare function gitEnv(extra?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
488
- interface GitResult {
494
+ export declare function gitEnv(extra?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
495
+ export interface GitResult {
489
496
  ok: boolean;
490
497
  code: number | null;
491
498
  signal: NodeJS.Signals | null;
@@ -494,26 +501,22 @@ interface GitResult {
494
501
  error?: NodeJS.ErrnoException;
495
502
  timedOut: boolean;
496
503
  }
497
- interface RunGitOptions {
504
+ export interface RunGitOptions {
498
505
  cwd?: string;
499
506
  timeoutMs?: number;
500
507
  env?: NodeJS.ProcessEnv;
501
508
  }
502
- type GitRunner = (args: string[], opts?: RunGitOptions) => GitResult;
509
+ export type GitRunner = (args: string[], opts?: RunGitOptions) => GitResult;
503
510
  /**
504
511
  * Run git. NEVER throws — returns a record for the caller to classify.
505
512
  * `shell: false` so a path like `C:\Program Files\…` needs no quoting.
506
513
  */
507
- declare function runGit(args: string[], {
508
- cwd,
509
- timeoutMs,
510
- env
511
- }?: RunGitOptions): GitResult;
514
+ export declare function runGit(args: string[], { cwd, timeoutMs, env }?: RunGitOptions): GitResult;
512
515
  /** First `fatal:`/`error:`/`remote:` line of stderr, tag stripped — and redacted. */
513
- declare function firstFatal(stderr: string): string;
514
- type GitFailureKind = 'no-git' | 'timeout' | 'ref-missing' | 'network' | 'no-access' | 'unknown';
515
- type GitNoAccessWhy = 'not-invited' | 'bad-credential' | 'no-credential';
516
- interface GitFailure {
516
+ export declare function firstFatal(stderr: string): string;
517
+ export type GitFailureKind = 'no-git' | 'timeout' | 'ref-missing' | 'network' | 'no-access' | 'unknown';
518
+ export type GitNoAccessWhy = 'not-invited' | 'bad-credential' | 'no-credential';
519
+ export interface GitFailure {
517
520
  kind: GitFailureKind;
518
521
  why?: GitNoAccessWhy;
519
522
  detail?: string;
@@ -523,44 +526,44 @@ interface GitFailure {
523
526
  * `bad-credential` split matters: GitHub answers 404 for private repos you
524
527
  * cannot see, but a STALE cached credential answers "Authentication failed".
525
528
  */
526
- declare function classifyGitFailure(res: GitResult | undefined): GitFailure;
529
+ export declare function classifyGitFailure(res: GitResult | undefined): GitFailure;
527
530
  /** Strip any embedded credential before a URL (or a line containing one) reaches a log or an error. */
528
- declare function redactUrl(text: string): string;
531
+ export declare function redactUrl(text: string): string;
529
532
  /**
530
533
  * Put a token on an https clone URL for ONE fetch/push. GitHub authenticates a
531
534
  * PAT as user `x-access-token`; GitLab-style hosts as `oauth2`; Azure DevOps
532
535
  * accepts any user name with a PAT password. Never store the result — pass it
533
536
  * as the positional remote argument only, so `.git/config` stays clean.
534
537
  */
535
- declare function tokenRemote(remoteUrl: string, token: string): string;
538
+ export declare function tokenRemote(remoteUrl: string, token: string): string;
536
539
  /**
537
540
  * Every legal split of a `/tree/<refAndDir>` URL remainder into ref + folder,
538
541
  * longest ref first — `release/v2/app` may be branch `release/v2` + `app` or
539
542
  * branch `release` + `v2/app`. Only the remote can tell, so the caller probes
540
543
  * each candidate in this order. (Ported from `bin/mono-git.mjs`.)
541
544
  */
542
- declare function refDirCandidates(refAndDir: string): Array<{
545
+ export declare function refDirCandidates(refAndDir: string): Array<{
543
546
  ref: string;
544
547
  dir: string;
545
548
  }>;
546
549
  /** Refs to ask `ls-remote` about for a branch-or-tag name. */
547
- declare function refPatterns(ref: string): string[];
550
+ export declare function refPatterns(ref: string): string[];
548
551
  /** Pick the SHA for `ref` out of `ls-remote` output. Branch beats tag. */
549
- declare function parseLsRemote(stdout: string, ref: string): string | null;
552
+ export declare function parseLsRemote(stdout: string, ref: string): string | null;
550
553
  /**
551
554
  * The default branch from `git ls-remote --symref <url> HEAD`:
552
555
  * `ref: refs/heads/main\tHEAD` → `main`. `null` for an empty (unborn) remote.
553
556
  */
554
- declare function parseSymref(stdout: string): string | null;
557
+ export declare function parseSymref(stdout: string): string | null;
555
558
  /** The SHA that `ls-remote … HEAD` reports (second line of a `--symref` answer). */
556
- declare function parseHeadSha(stdout: string): string | null;
559
+ export declare function parseHeadSha(stdout: string): string | null;
557
560
  /** Did a push get rejected because the remote moved on (someone else pushed first)? */
558
- declare function isNonFastForward(stderr: string): boolean;
561
+ export declare function isNonFastForward(stderr: string): boolean;
559
562
  //#endregion
560
563
  //#region src/skills/repo.d.ts
561
- type SkillTransport = 'git' | 'token';
564
+ export type SkillTransport = 'git' | 'token';
562
565
  /** `skill.url` resolved against the live remote: which URL works, which branch, which folder. */
563
- interface ResolvedRemote {
566
+ export interface ResolvedRemote {
564
567
  target: SkillTarget;
565
568
  transport: SkillTransport;
566
569
  /** The URL that reached the remote. MAY CARRY THE TOKEN — never log or store; `redactUrl()` it. */
@@ -575,7 +578,7 @@ interface ResolvedRemote {
575
578
  emptyRemote: boolean;
576
579
  }
577
580
  /** The remote could not be reached with any transport we were allowed to try. */
578
- declare class SkillsAccessError extends Error {
581
+ export declare class SkillsAccessError extends Error {
579
582
  kind: GitFailureKind;
580
583
  why?: GitNoAccessWhy;
581
584
  transportTried: SkillTransport[];
@@ -586,21 +589,16 @@ declare class SkillsAccessError extends Error {
586
589
  * Throws {@link SkillsAccessError} (message already redacted) when neither the
587
590
  * machine's credentials nor the configured token get through.
588
591
  */
589
- declare function resolveRemote({
590
- target,
591
- env,
592
- run,
593
- timeoutMs
594
- }: {
592
+ export declare function resolveRemote({ target, env, run, timeoutMs }: {
595
593
  target: SkillTarget;
596
594
  env?: NodeJS.ProcessEnv;
597
595
  run?: GitRunner;
598
596
  timeoutMs?: number;
599
597
  }): ResolvedRemote;
600
598
  /** Absolute path of the working clone: `<cwd>/.mono/skills/repo`. */
601
- declare function repoDir(cwd?: string): string;
602
- type RepoRefresh = 'always' | 'if-stale' | 'never';
603
- interface EnsureRepoResult {
599
+ export declare function repoDir(cwd?: string): string;
600
+ export type RepoRefresh = 'always' | 'if-stale' | 'never';
601
+ export interface EnsureRepoResult {
604
602
  repoDir: string;
605
603
  /** A fetch ran and the working tree now matches the remote tip. */
606
604
  refreshed: boolean;
@@ -624,20 +622,14 @@ interface EnsureRepoResult {
624
622
  * A failed refresh of an EXISTING clone degrades to `stale: true` — offline
625
623
  * reads still work. A failed FIRST fetch throws, since there is nothing to serve.
626
624
  */
627
- declare function ensureRepo({
628
- cwd,
629
- remote,
630
- refresh,
631
- run,
632
- timeoutMs
633
- }: {
625
+ export declare function ensureRepo({ cwd, remote, refresh, run, timeoutMs }: {
634
626
  cwd?: string;
635
627
  remote: ResolvedRemote;
636
628
  refresh: RepoRefresh;
637
629
  run?: GitRunner;
638
630
  timeoutMs?: number;
639
631
  }): EnsureRepoResult;
640
- interface CommitAndPushResult {
632
+ export interface CommitAndPushResult {
641
633
  /** SHA of the commit that landed on the remote. */
642
634
  sha: string;
643
635
  /** 1 = pushed first time; 2+ = replayed after someone else pushed first. */
@@ -649,16 +641,7 @@ interface CommitAndPushResult {
649
641
  * `apply` again (it re-checks immutability on the fresh tree), commit, push —
650
642
  * up to `attempts` times.
651
643
  */
652
- declare function commitAndPush({
653
- repoDir: dir,
654
- remote,
655
- actor,
656
- message,
657
- apply,
658
- attempts,
659
- run,
660
- timeoutMs
661
- }: {
644
+ export declare function commitAndPush({ repoDir: dir, remote, actor, message, apply, attempts, run, timeoutMs }: {
662
645
  repoDir: string;
663
646
  remote: ResolvedRemote;
664
647
  actor: Actor;
@@ -669,14 +652,14 @@ declare function commitAndPush({
669
652
  timeoutMs?: number;
670
653
  }): CommitAndPushResult;
671
654
  /** Absolute path of the skills root inside the clone (`repoDir/<dir>`). */
672
- declare function skillsRoot(dir: string, sub: string): string;
655
+ export declare function skillsRoot(dir: string, sub: string): string;
673
656
  /** Read one file under `<repoDir>/<dir>/<rel>`; `null` when absent or a directory. */
674
- declare function readRepoFile(dir: string, sub: string, rel: string): string | null;
657
+ export declare function readRepoFile(dir: string, sub: string, rel: string): string | null;
675
658
  /**
676
659
  * List files under `<repoDir>/<dir>/<prefix>` recursively, as forward-slash
677
660
  * paths relative to `<repoDir>/<dir>`. `.git` is never entered.
678
661
  */
679
- declare function listRepoFiles(dir: string, sub: string, prefix?: string): string[];
662
+ export declare function listRepoFiles(dir: string, sub: string, prefix?: string): string[];
680
663
  //#endregion
681
664
  //#region src/skills/actor.d.ts
682
665
  /**
@@ -686,32 +669,29 @@ declare function listRepoFiles(dir: string, sub: string, prefix?: string): strin
686
669
  * the email (stable per identity, so the same person always maps to the same
687
670
  * folder). Example: `John Doe` / `john.doe@company.com` -> `john_doe__8f219a`.
688
671
  */
689
- declare function detectActor(cwd?: string): Actor;
672
+ export declare function detectActor(cwd?: string): Actor;
690
673
  //#endregion
691
674
  //#region src/skills/appid.d.ts
692
675
  /**
693
676
  * Normalize an app id: lowercase, keep only `[a-z0-9_-]`, collapse the rest to
694
677
  * `-`, trim separators. Rejects path-traversal / separators outright.
695
678
  */
696
- declare function normalizeAppId(raw: string): string;
679
+ export declare function normalizeAppId(raw: string): string;
697
680
  /**
698
681
  * Resolve the effective app id for a command. `app` is the explicit `--app`
699
682
  * value (if any); `cwd` is the working directory.
700
683
  */
701
- declare function resolveAppId({
702
- app,
703
- cwd
704
- }: {
684
+ export declare function resolveAppId({ app, cwd }: {
705
685
  app?: string;
706
686
  cwd?: string;
707
687
  }): string;
708
688
  //#endregion
709
689
  //#region src/skills/staging.d.ts
710
690
  /** Absolute `.mono/skills` for a given project root. */
711
- declare function stagingRoot(cwd?: string): string;
712
- declare const REQUIRED_FILES: readonly ["metadata.json", "summary.md"];
691
+ export declare function stagingRoot(cwd?: string): string;
692
+ export declare const REQUIRED_FILES: readonly ["metadata.json", "summary.md"];
713
693
  /** A single staged session on disk. */
714
- interface StagedSession {
694
+ export interface StagedSession {
715
695
  sessionId: string;
716
696
  dir: string;
717
697
  files: string[];
@@ -723,15 +703,15 @@ interface StagedSession {
723
703
  * doesn't match the template standard — so the caller (save/retry) refuses to
724
704
  * upload a session that doesn't conform, and nothing reaches GitHub.
725
705
  */
726
- declare function loadStagedSession(dir: string): StagedSession;
706
+ export declare function loadStagedSession(dir: string): StagedSession;
727
707
  /** List session ids under `pending/` (or `failed/`). */
728
- declare function listSessions(cwd: string, kind: 'pending' | 'failed'): string[];
708
+ export declare function listSessions(cwd: string, kind: 'pending' | 'failed'): string[];
729
709
  /** Move a session directory from `pending/` to `failed/` (spec §22). Returns the new path. */
730
- declare function moveToFailed(cwd: string, sessionId: string): string;
710
+ export declare function moveToFailed(cwd: string, sessionId: string): string;
731
711
  /** Remove a staged session directory after a successful upload (spec §20 cleanup). */
732
- declare function removeSession(dir: string): void;
712
+ export declare function removeSession(dir: string): void;
733
713
  /** Cache directory for remote reads (`knowledge` / `skills` / `search`). */
734
- declare function cacheDir(cwd: string, kind: 'knowledge' | 'skills' | 'search'): string;
714
+ export declare function cacheDir(cwd: string, kind: 'knowledge' | 'skills' | 'search'): string;
735
715
  //#endregion
736
716
  //#region src/skills/validate.d.ts
737
717
  /**
@@ -739,22 +719,22 @@ declare function cacheDir(cwd: string, kind: 'knowledge' | 'skills' | 'search'):
739
719
  * single error listing every problem when the session doesn't conform, so
740
720
  * `save`/`retry` refuse to upload it. A conforming session returns silently.
741
721
  */
742
- declare function validateStagedSession(dir: string, metadata: SessionMetadata): void;
722
+ export declare function validateStagedSession(dir: string, metadata: SessionMetadata): void;
743
723
  //#endregion
744
724
  //#region src/skills/redact.d.ts
745
725
  /**
746
726
  * Redact a string. Returns the cleaned text. Safe to run on any text content
747
727
  * (summaries, conversation lines, decisions, metadata serialized to JSON).
748
728
  */
749
- declare function redact(input: string): string;
729
+ export declare function redact(input: string): string;
750
730
  /**
751
731
  * Redact a Buffer (e.g. a conversation chunk before upload) by round-tripping
752
732
  * through UTF-8. Returns a new Buffer.
753
733
  */
754
- declare function redactBuffer(buf: Buffer): Buffer;
734
+ export declare function redactBuffer(buf: Buffer): Buffer;
755
735
  //#endregion
756
736
  //#region src/skills/chunk.d.ts
757
- interface ConversationPart {
737
+ export interface ConversationPart {
758
738
  /** `part-0001.jsonl` */
759
739
  name: string;
760
740
  /** The chunk's raw bytes (already newline-joined). */
@@ -764,7 +744,7 @@ interface ConversationPart {
764
744
  * Chunk newline-delimited `jsonl` text into parts. Blank lines are dropped.
765
745
  * Returns `[]` for empty input.
766
746
  */
767
- declare function chunkConversation(jsonl: string, chunkSizeBytes?: number): ConversationPart[];
747
+ export declare function chunkConversation(jsonl: string, chunkSizeBytes?: number): ConversationPart[];
768
748
  //#endregion
769
749
  //#region src/skills/save.d.ts
770
750
  /** A single file to write into the permanent session folder. */
@@ -774,7 +754,7 @@ interface PlannedFile {
774
754
  /** Already-redacted bytes. */
775
755
  content: Buffer;
776
756
  }
777
- interface SavePlan {
757
+ export interface SavePlan {
778
758
  appId: string;
779
759
  actor: Actor;
780
760
  sessionId: string;
@@ -789,12 +769,7 @@ interface SavePlan {
789
769
  * Build the full upload plan from a staged session WITHOUT touching the network.
790
770
  * `--dry-run` returns exactly this. Everything textual is redacted here.
791
771
  */
792
- declare function buildSavePlan({
793
- cwd,
794
- app,
795
- dir,
796
- target
797
- }: {
772
+ export declare function buildSavePlan({ cwd, app, dir, target }: {
798
773
  cwd?: string;
799
774
  app?: string;
800
775
  dir: string;
@@ -807,25 +782,19 @@ declare function buildSavePlan({
807
782
  * edits to them survive), and an existing session folder is REFUSED (sessions
808
783
  * are immutable).
809
784
  */
810
- declare function applyPlan(plan: SavePlan, root: string): void;
785
+ export declare function applyPlan(plan: SavePlan, root: string): void;
811
786
  /**
812
787
  * Execute a save: resolve the remote, refresh the clone, apply, commit, push.
813
788
  * On any failure the local staging dir is preserved / moved to `failed/` and
814
789
  * the error is rethrown (already redacted).
815
790
  */
816
- declare function runSave({
817
- cwd,
818
- app,
819
- dir,
820
- target,
821
- remote,
822
- env,
823
- run
824
- }: {
791
+ export declare function runSave({ cwd, app, dir, target, remote, env, run }: {
825
792
  cwd?: string;
826
793
  app?: string;
827
- dir: string; /** Pre-parsed `skill` (the CLI parses it once). */
828
- target?: SkillTarget; /** Pre-resolved remote (skips the probe). */
794
+ dir: string;
795
+ /** Pre-parsed `skill` (the CLI parses it once). */
796
+ target?: SkillTarget;
797
+ /** Pre-resolved remote (skips the probe). */
829
798
  remote?: ResolvedRemote;
830
799
  env?: NodeJS.ProcessEnv;
831
800
  run?: GitRunner;
@@ -833,14 +802,14 @@ declare function runSave({
833
802
  //#endregion
834
803
  //#region src/skills/read.d.ts
835
804
  /** Where the answer came from — every read result carries this. */
836
- interface ReadSource {
805
+ export interface ReadSource {
837
806
  source: 'local-clone';
838
807
  /** The clone could not be refreshed and may be behind the remote. */
839
808
  stale: boolean;
840
809
  ref: string;
841
810
  dir: string;
842
811
  }
843
- interface ReadResult extends ReadSource {
812
+ export interface ReadResult extends ReadSource {
844
813
  app: string;
845
814
  type?: 'knowledge' | 'skills';
846
815
  /** Files returned: skills-root-relative path + text. */
@@ -858,25 +827,18 @@ interface RepoAccess {
858
827
  * Read either a whole `--type knowledge|skills` folder for an app, or a single
859
828
  * safe `--path` under that app. Returns the matched files' text.
860
829
  */
861
- declare function runRead({
862
- cwd,
863
- app,
864
- type,
865
- path: relPath,
866
- remote,
867
- run
868
- }: RepoAccess & {
830
+ export declare function runRead({ cwd, app, type, path: relPath, remote, run }: RepoAccess & {
869
831
  app?: string;
870
832
  type?: 'knowledge' | 'skills';
871
833
  path?: string;
872
834
  }): ReadResult;
873
- interface SearchHit {
835
+ export interface SearchHit {
874
836
  path: string;
875
837
  score: number;
876
838
  /** A short snippet around the first match. */
877
839
  snippet: string;
878
840
  }
879
- interface SearchResult extends ReadSource {
841
+ export interface SearchResult extends ReadSource {
880
842
  app: string;
881
843
  query: string;
882
844
  hits: SearchHit[];
@@ -886,21 +848,14 @@ interface SearchResult extends ReadSource {
886
848
  * query. Returns the top `limit` matches with snippets. Conversation chunks are
887
849
  * intentionally excluded from the scan (too large / low signal).
888
850
  */
889
- declare function runSearch({
890
- cwd,
891
- app,
892
- query,
893
- limit,
894
- remote,
895
- run
896
- }: RepoAccess & {
851
+ export declare function runSearch({ cwd, app, query, limit, remote, run }: RepoAccess & {
897
852
  app?: string;
898
853
  query: string;
899
854
  limit?: number;
900
855
  }): SearchResult;
901
856
  //#endregion
902
857
  //#region src/skills/check.d.ts
903
- interface CheckReport {
858
+ export interface CheckReport {
904
859
  /** `skill` is present (and parseable) in mono.config.ts. */
905
860
  configured: boolean;
906
861
  /** Plain repository URL, never a token. */
@@ -922,7 +877,8 @@ interface CheckReport {
922
877
  localClone: {
923
878
  path: string;
924
879
  exists: boolean;
925
- headSha: string | null; /** ISO time of the last successful fetch, if any. */
880
+ headSha: string | null;
881
+ /** ISO time of the last successful fetch, if any. */
926
882
  lastFetchAt: string | null;
927
883
  };
928
884
  /** The resolved current app id, and whether it's still a generic template name. */
@@ -937,18 +893,14 @@ interface CheckReport {
937
893
  * an absent `skill` reports `configured: false`; an unreachable remote reports
938
894
  * `null`s plus a note.
939
895
  */
940
- declare function runCheck({
941
- cwd,
942
- env,
943
- run
944
- }?: {
896
+ export declare function runCheck({ cwd, env, run }?: {
945
897
  cwd?: string;
946
898
  env?: NodeJS.ProcessEnv;
947
899
  run?: GitRunner;
948
900
  }): CheckReport;
949
901
  //#endregion
950
902
  //#region src/skills/session.d.ts
951
- interface SessionShowResult extends ReadSource {
903
+ export interface SessionShowResult extends ReadSource {
952
904
  app: string;
953
905
  sessionId: string;
954
906
  /** Skills-root-relative session folder, if found. */
@@ -960,13 +912,7 @@ interface SessionShowResult extends ReadSource {
960
912
  * Locate `<app>/history/**​/HH-mm-ss_<sessionId>/` in the clone, then return its
961
913
  * `metadata.json` + `summary.md`. Returns nulls when the session isn't found.
962
914
  */
963
- declare function runSessionShow({
964
- cwd,
965
- app,
966
- sessionId,
967
- remote,
968
- run
969
- }: {
915
+ export declare function runSessionShow({ cwd, app, sessionId, remote, run }: {
970
916
  cwd?: string;
971
917
  app?: string;
972
918
  sessionId: string;
@@ -974,4 +920,4 @@ declare function runSessionShow({
974
920
  run?: GitRunner;
975
921
  }): SessionShowResult;
976
922
  //#endregion
977
- export { ALLOWED_FLAGS, Actor, BASE_ARGS, ChangedFile, CheckReport, CommitAndPushResult, ConversationPart, EnsureRepoResult, ExtractedApp, ExtractedConfig, FailureResult, GENERIC_APP_NAMES, GitFailure, GitFailureKind, GitNoAccessWhy, GitResult, GitRunner, LoadMonoConfigOptions, MONO_APPS_DIR, MONO_DIR, MONO_TSCONFIG_REF, MonoAliasOptions, MonoAppRoot, MonoAppRootInput, MonoAppRootSource, MonoMissingApp, MonoMissingAppsOptions, MonoMissingPathPolicy, type MonoSkillConfig, MonoStubAliases, MonoStubAliasesOptions, REQUIRED_FILES, ReadResult, ReadSource, RepoRefresh, ResolveAppRootsOptions, ResolveFederatedRootsOptions, ResolvedRemote, RunGitOptions, RunMonoPrepareOptions, RunMonoPrepareResult, SKILLS_DEFAULTS, SavePlan, SaveResult, SearchHit, SearchResult, SessionDecision, SessionMetadata, SessionShowResult, SessionStatus, SkillTarget, SkillTransport, SkillUrlKind, SkillsAccessError, SkippedResult, StagedSession, appRootDirs, applyPlan, assertAppSources, buildMonoTsconfig, buildSavePlan, cacheDir, chunkConversation, classifyGitFailure, commitAndPush, detectActor, ensureRepo, extractConfig, extractConfigName, extractSkill, extractTemplate, firstFatal, formatMissingApps, getMonoConfig, gitEnv, hasUrl, isGenericAppName, isMissingPathError, isNonFastForward, linkedAppRoots, listRepoFiles, listSessions, loadMonoConfig, loadSkillConfig, loadSkillsEnv, loadStagedSession, missingPathMessage, monoAlias, monoConfigFileFor, monoMissingApps, monoStubAliases, monoTsconfigPaths, moveToFailed, normalizeAppId, parseHeadSha, parseLsRemote, parseSymref, pathAppRoots, readRepoFile, redact, redactBuffer, redactUrl, refDirCandidates, refPatterns, removeSession, repoDir, resetAppPathWarnings, resolveAppId, resolveAppRoots, resolveFederatedRoots, resolveRemote, resolveSkillTarget, runCheck, runGit, runMonoPrepare, runRead, runSave, runSearch, runSessionShow, skillsRoot, stagingRoot, stripCommentsSafe, tokenRemote, validateStagedSession };
923
+ export { MonoAppRoot, MonoAppRootInput, MonoAppRootSource, MonoMissingPathPolicy, type MonoSkillConfig, ResolveAppRootsOptions, appRootDirs, hasUrl, isMissingPathError, linkedAppRoots, missingPathMessage, pathAppRoots, resetAppPathWarnings, resolveAppRoots };