codebase-snapshot 0.0.0-stage → 4.5.0

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/cli.d.cts ADDED
@@ -0,0 +1,124 @@
1
+ import { O as OutputFormat, D as DiscoveryMode } from './types-Ca4PmkiQ.cjs';
2
+
3
+ type Command = "generate" | "validate" | "report" | "init" | "setup" | "explain" | "diff" | "describe" | "skill";
4
+ /** A user-input problem: printed without a stack trace, exits 2. */
5
+ declare class UsageError extends Error {
6
+ }
7
+ interface ParsedInvocation {
8
+ command: Command;
9
+ /** Positional arguments that follow the command name. */
10
+ args: string[];
11
+ format: OutputFormat;
12
+ dryRun: boolean;
13
+ watch: boolean;
14
+ /** Ignore any config file and run on the built-in defaults. */
15
+ noConfig: boolean;
16
+ preset?: string;
17
+ /** The size exactly as typed, so the generated config can keep `120k`. */
18
+ maxPartBytesRaw?: string;
19
+ include?: string;
20
+ exclude?: string;
21
+ yes: boolean;
22
+ force: boolean;
23
+ /** `setup` only: skip the dependency install. */
24
+ noInstall: boolean;
25
+ /** `skill` only: write the skill into the repository instead of printing it. */
26
+ install: boolean;
27
+ /** `skill` only: which location(s) to write. */
28
+ target?: string;
29
+ cwd: string;
30
+ outDir?: string;
31
+ includeMonolith?: boolean;
32
+ includeSensitiveFiles?: boolean;
33
+ maxPartBytes?: number;
34
+ largeFileBytes?: number;
35
+ maxMonolithBytes?: number | null;
36
+ skipArtifacts?: string[];
37
+ /** How candidates are discovered; `auto` when unset. */
38
+ discovery?: DiscoveryMode;
39
+ }
40
+ declare function parsePositiveInteger(raw: string | undefined, optionName: string, minimum: number): number | undefined;
41
+ /**
42
+ * Parses a byte-budget option, accepting human-readable units (`120k`, `1.5mb`)
43
+ * as well as raw byte counts.
44
+ */
45
+ declare function parseByteOption(raw: string | undefined, optionName: string, minimum: number): number | undefined;
46
+ /**
47
+ * Parses argv.
48
+ *
49
+ * Uses `node:util.parseArgs` in strict mode, so `--option=value` works, unknown
50
+ * flags are rejected instead of silently ignored, and a typo can no longer fall
51
+ * through to the writable `generate` command.
52
+ */
53
+ declare function parseCliArgs(argv: string[]): ParsedInvocation;
54
+ /**
55
+ * The environment a nested package-manager run gets: the caller's, minus npm's own config.
56
+ *
57
+ * Running `setup` through `npx`/`npm exec` puts the parent npm's resolved config into
58
+ * `npm_config_*` variables, and a child that inherits them is not the `npm install` a user would
59
+ * type — with an npm that supports an `allowScripts` switch, the child aborted with
60
+ * `EALLOWSCRIPTS: --allow-scripts is not allowed in project-scoped installs`. Stripping them makes
61
+ * the child read the project's own `.npmrc` and flags, which is the whole point of using the
62
+ * project's package manager.
63
+ */
64
+ declare function cleanInstallEnv(env?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
65
+ /** Runs the CLI and returns the process exit code. */
66
+ declare function main(argv?: string[]): Promise<number>;
67
+ /** Coalesce bursts of filesystem events into one run. */
68
+ declare const WATCH_DEBOUNCE_MS = 250;
69
+ /**
70
+ * Unattributed watcher events (no filename) are ignored this long after a run.
71
+ * Named source events are never ignored: that is how an edit in the quiet
72
+ * window or during a run reaches the loop.
73
+ */
74
+ declare const WATCH_SETTLE_MS = 1500;
75
+ interface WatchState {
76
+ running: boolean;
77
+ pending: boolean;
78
+ settleUntil: number;
79
+ }
80
+ interface WatchPaths {
81
+ cwd: string;
82
+ outDir: string;
83
+ tmpDir: string;
84
+ }
85
+ interface WatchEvent {
86
+ /** Absolute path, or null when `fs.watch` did not attribute the event. */
87
+ path: string | null;
88
+ /** `performance.now()` at delivery. */
89
+ now: number;
90
+ }
91
+ type WatchAction = "ignore" | "pending" | "schedule";
92
+ interface WatchDecision {
93
+ state: WatchState;
94
+ action: WatchAction;
95
+ }
96
+ declare function initialWatchState(): WatchState;
97
+ declare function beginWatchRun(state: WatchState): WatchState;
98
+ /**
99
+ * Finish one run. `schedule` is true when a source event arrived while the run
100
+ * was in flight, so exactly one follow-up run is owed.
101
+ */
102
+ declare function finishWatchRun(state: WatchState, now: number): {
103
+ state: WatchState;
104
+ schedule: boolean;
105
+ };
106
+ /**
107
+ * True only for the resolved output/staging paths and their contents.
108
+ *
109
+ * This deliberately does not match a directory just because its basename is
110
+ * `docs`: a source directory `src/docs` is not the output directory `docs`.
111
+ */
112
+ declare function isGeneratedWatchPath(candidate: string, paths: WatchPaths): boolean;
113
+ /**
114
+ * Decide what one watcher event means.
115
+ *
116
+ * - generated paths are always ignored;
117
+ * - a named source event is `pending` during a run and `schedule` otherwise,
118
+ * including inside the settle window (an edit is never swallowed);
119
+ * - an unattributed event is ignored during a run and for the settle window,
120
+ * because Windows does not always name the path our own writes produced.
121
+ */
122
+ declare function decideWatchEvent(state: WatchState, event: WatchEvent, paths: WatchPaths): WatchDecision;
123
+
124
+ export { UsageError, WATCH_DEBOUNCE_MS, WATCH_SETTLE_MS, type WatchAction, type WatchDecision, type WatchEvent, type WatchPaths, type WatchState, beginWatchRun, cleanInstallEnv, decideWatchEvent, finishWatchRun, initialWatchState, isGeneratedWatchPath, main, parseByteOption, parseCliArgs, parsePositiveInteger };
package/dist/cli.d.ts ADDED
@@ -0,0 +1,124 @@
1
+ import { O as OutputFormat, D as DiscoveryMode } from './types-Ca4PmkiQ.js';
2
+
3
+ type Command = "generate" | "validate" | "report" | "init" | "setup" | "explain" | "diff" | "describe" | "skill";
4
+ /** A user-input problem: printed without a stack trace, exits 2. */
5
+ declare class UsageError extends Error {
6
+ }
7
+ interface ParsedInvocation {
8
+ command: Command;
9
+ /** Positional arguments that follow the command name. */
10
+ args: string[];
11
+ format: OutputFormat;
12
+ dryRun: boolean;
13
+ watch: boolean;
14
+ /** Ignore any config file and run on the built-in defaults. */
15
+ noConfig: boolean;
16
+ preset?: string;
17
+ /** The size exactly as typed, so the generated config can keep `120k`. */
18
+ maxPartBytesRaw?: string;
19
+ include?: string;
20
+ exclude?: string;
21
+ yes: boolean;
22
+ force: boolean;
23
+ /** `setup` only: skip the dependency install. */
24
+ noInstall: boolean;
25
+ /** `skill` only: write the skill into the repository instead of printing it. */
26
+ install: boolean;
27
+ /** `skill` only: which location(s) to write. */
28
+ target?: string;
29
+ cwd: string;
30
+ outDir?: string;
31
+ includeMonolith?: boolean;
32
+ includeSensitiveFiles?: boolean;
33
+ maxPartBytes?: number;
34
+ largeFileBytes?: number;
35
+ maxMonolithBytes?: number | null;
36
+ skipArtifacts?: string[];
37
+ /** How candidates are discovered; `auto` when unset. */
38
+ discovery?: DiscoveryMode;
39
+ }
40
+ declare function parsePositiveInteger(raw: string | undefined, optionName: string, minimum: number): number | undefined;
41
+ /**
42
+ * Parses a byte-budget option, accepting human-readable units (`120k`, `1.5mb`)
43
+ * as well as raw byte counts.
44
+ */
45
+ declare function parseByteOption(raw: string | undefined, optionName: string, minimum: number): number | undefined;
46
+ /**
47
+ * Parses argv.
48
+ *
49
+ * Uses `node:util.parseArgs` in strict mode, so `--option=value` works, unknown
50
+ * flags are rejected instead of silently ignored, and a typo can no longer fall
51
+ * through to the writable `generate` command.
52
+ */
53
+ declare function parseCliArgs(argv: string[]): ParsedInvocation;
54
+ /**
55
+ * The environment a nested package-manager run gets: the caller's, minus npm's own config.
56
+ *
57
+ * Running `setup` through `npx`/`npm exec` puts the parent npm's resolved config into
58
+ * `npm_config_*` variables, and a child that inherits them is not the `npm install` a user would
59
+ * type — with an npm that supports an `allowScripts` switch, the child aborted with
60
+ * `EALLOWSCRIPTS: --allow-scripts is not allowed in project-scoped installs`. Stripping them makes
61
+ * the child read the project's own `.npmrc` and flags, which is the whole point of using the
62
+ * project's package manager.
63
+ */
64
+ declare function cleanInstallEnv(env?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
65
+ /** Runs the CLI and returns the process exit code. */
66
+ declare function main(argv?: string[]): Promise<number>;
67
+ /** Coalesce bursts of filesystem events into one run. */
68
+ declare const WATCH_DEBOUNCE_MS = 250;
69
+ /**
70
+ * Unattributed watcher events (no filename) are ignored this long after a run.
71
+ * Named source events are never ignored: that is how an edit in the quiet
72
+ * window or during a run reaches the loop.
73
+ */
74
+ declare const WATCH_SETTLE_MS = 1500;
75
+ interface WatchState {
76
+ running: boolean;
77
+ pending: boolean;
78
+ settleUntil: number;
79
+ }
80
+ interface WatchPaths {
81
+ cwd: string;
82
+ outDir: string;
83
+ tmpDir: string;
84
+ }
85
+ interface WatchEvent {
86
+ /** Absolute path, or null when `fs.watch` did not attribute the event. */
87
+ path: string | null;
88
+ /** `performance.now()` at delivery. */
89
+ now: number;
90
+ }
91
+ type WatchAction = "ignore" | "pending" | "schedule";
92
+ interface WatchDecision {
93
+ state: WatchState;
94
+ action: WatchAction;
95
+ }
96
+ declare function initialWatchState(): WatchState;
97
+ declare function beginWatchRun(state: WatchState): WatchState;
98
+ /**
99
+ * Finish one run. `schedule` is true when a source event arrived while the run
100
+ * was in flight, so exactly one follow-up run is owed.
101
+ */
102
+ declare function finishWatchRun(state: WatchState, now: number): {
103
+ state: WatchState;
104
+ schedule: boolean;
105
+ };
106
+ /**
107
+ * True only for the resolved output/staging paths and their contents.
108
+ *
109
+ * This deliberately does not match a directory just because its basename is
110
+ * `docs`: a source directory `src/docs` is not the output directory `docs`.
111
+ */
112
+ declare function isGeneratedWatchPath(candidate: string, paths: WatchPaths): boolean;
113
+ /**
114
+ * Decide what one watcher event means.
115
+ *
116
+ * - generated paths are always ignored;
117
+ * - a named source event is `pending` during a run and `schedule` otherwise,
118
+ * including inside the settle window (an edit is never swallowed);
119
+ * - an unattributed event is ignored during a run and for the settle window,
120
+ * because Windows does not always name the path our own writes produced.
121
+ */
122
+ declare function decideWatchEvent(state: WatchState, event: WatchEvent, paths: WatchPaths): WatchDecision;
123
+
124
+ export { UsageError, WATCH_DEBOUNCE_MS, WATCH_SETTLE_MS, type WatchAction, type WatchDecision, type WatchEvent, type WatchPaths, type WatchState, beginWatchRun, cleanInstallEnv, decideWatchEvent, finishWatchRun, initialWatchState, isGeneratedWatchPath, main, parseByteOption, parseCliArgs, parsePositiveInteger };