@any-nav/cli 0.0.0-stage → 0.2.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/CHANGELOG.md +33 -0
- package/LICENSE +21 -0
- package/README.md +46 -2
- package/dist/cli.d.ts +9 -0
- package/dist/cli.js +331 -0
- package/dist/cli.js.map +1 -0
- package/dist/help-topics/config.d.ts +10 -0
- package/dist/help-topics/config.js +110 -0
- package/dist/help-topics/config.js.map +1 -0
- package/dist/help-topics/telling-agents.d.ts +13 -0
- package/dist/help-topics/telling-agents.js +38 -0
- package/dist/help-topics/telling-agents.js.map +1 -0
- package/dist/help-topics.d.ts +5 -0
- package/dist/help-topics.js +28 -0
- package/dist/help-topics.js.map +1 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.js +5 -0
- package/dist/main.js.map +1 -0
- package/package.json +31 -3
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.2.0 — 2026-10-31
|
|
4
|
+
|
|
5
|
+
- The `config` topic's `[scan]` section opens with the ignore mapping:
|
|
6
|
+
the excludes a reader looks for live here (`excludeDirs` /
|
|
7
|
+
`excludeFiles` / `excludeDotEntries`); the rest — `respectGitignore` /
|
|
8
|
+
`boundaryExempt` / `maxFiles` — is traversal-boundary policy, not
|
|
9
|
+
more excludes. Key names unchanged; the page keeps its 100-line cap
|
|
10
|
+
(three in-page reflows pay for the teaching sentences).
|
|
11
|
+
- The folder-row teaching follows the scan carrier swap: `list --help`,
|
|
12
|
+
the `config` topic, and the `telling-agents` topic now describe a
|
|
13
|
+
folder row as reading the directory's `package.json` /
|
|
14
|
+
`manifest.yml` description, else its README.
|
|
15
|
+
- Rides the lockstep train on the `@any-nav/core` 0.2.0 bump: lazy
|
|
16
|
+
fast-bm25 load, representative-README locators on folder rows, and the
|
|
17
|
+
scan 0.2.0 face flowing through the re-export.
|
|
18
|
+
|
|
19
|
+
## 0.1.0 — 2026-10-21
|
|
20
|
+
|
|
21
|
+
First registry release.
|
|
22
|
+
|
|
23
|
+
- Command roster: `any-nav init / list [path] / help [topic]`, exit ladder
|
|
24
|
+
0 (success — including empty results and rendered help/version) / 1
|
|
25
|
+
(runtime failure) / 2 (usage error).
|
|
26
|
+
- `list` answers rows by default; `--write` materializes the listing into an
|
|
27
|
+
idempotent marked section of the entry file; `--depth` bounds the walk.
|
|
28
|
+
- `--json` — the machine face: the routing projection as pure JSON on
|
|
29
|
+
stdout, diagnostics triaged by audience (maintainer-class notes go to
|
|
30
|
+
stderr, never into the JSON stream).
|
|
31
|
+
- Budget cuts are visible on the surface: `list` rows render ≥N floors
|
|
32
|
+
for cut folders; the `config` help topic's `maxFiles` row states the
|
|
33
|
+
same semantics.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 CatheadOwl
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,47 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @any-nav/cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> Point any-nav at any Markdown folder. No more hand-maintained index files.
|
|
4
|
+
|
|
5
|
+
The Any-Nav CLI integration adapter: it discovers config, answers navigation
|
|
6
|
+
queries, and materializes generated listings into marked file sections. This
|
|
7
|
+
package owns all disk writes and exit codes — the SDK (`@any-nav/core`) it
|
|
8
|
+
wraps is read-only.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
npm install -g @any-nav/cli
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
any-nav init # scaffold an any-nav.toml in the current folder
|
|
20
|
+
any-nav list [path] # render the navigation listing for a folder
|
|
21
|
+
any-nav list --depth N # bound the walk depth
|
|
22
|
+
any-nav list --write # materialize the listing into the marked section
|
|
23
|
+
any-nav list --json # machine face: pure JSON (routing projection) on stdout
|
|
24
|
+
any-nav help [command] # command help, plus non-command help topics
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
- Empty results are legal answers (`exit 0`) — this is a data-presentation
|
|
28
|
+
tool, not a filter.
|
|
29
|
+
- Exit ladder: `0` success (including rendered help/version), `1` runtime
|
|
30
|
+
failure, `2` usage error.
|
|
31
|
+
- `--json` keeps stdout a pure JSON stream: maintainer-class diagnostics go
|
|
32
|
+
to stderr, consumer-facing notes ride the listing itself.
|
|
33
|
+
|
|
34
|
+
## Config
|
|
35
|
+
|
|
36
|
+
`any-nav.toml` — states only exceptions; every key defaults:
|
|
37
|
+
|
|
38
|
+
- `local` — curation list: paths expanded into the default listing.
|
|
39
|
+
- `budget` — the context-budget guard (warns, never silently collapses).
|
|
40
|
+
- `scan` — scan boundary policy, additive over the engine's built-in floor.
|
|
41
|
+
|
|
42
|
+
`list` walks up from the target folder for the nearest `any-nav.toml`;
|
|
43
|
+
without one it lists on pure defaults.
|
|
44
|
+
|
|
45
|
+
## License
|
|
46
|
+
|
|
47
|
+
MIT
|
package/dist/cli.d.ts
ADDED
package/dist/cli.js
ADDED
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* any-nav CLI — integration adapter A1 (L0). The unified list model sets
|
|
3
|
+
* the roster: init /
|
|
4
|
+
* list / help — generate retired into list's --write form, so the write
|
|
5
|
+
* is the very payload the listing prints, spliced between markers.
|
|
6
|
+
*
|
|
7
|
+
* Family rules have a single implementation point here: run(argv, io)
|
|
8
|
+
* routes commander errors by typed code (helpDisplayed/version → 0,
|
|
9
|
+
* other commander.* → usage error 2, runtime → 1); data goes to stdout,
|
|
10
|
+
* diagnostics to stderr; output ends with exactly one newline.
|
|
11
|
+
*/
|
|
12
|
+
import { Command, CommanderError, InvalidArgumentError, Option } from 'commander';
|
|
13
|
+
import { exec } from 'node:child_process';
|
|
14
|
+
import { existsSync } from 'node:fs';
|
|
15
|
+
import { mkdir, readFile, writeFile } from 'node:fs/promises';
|
|
16
|
+
import { promisify } from 'node:util';
|
|
17
|
+
import { createRequire } from 'node:module';
|
|
18
|
+
import { dirname, join, relative, resolve } from 'node:path';
|
|
19
|
+
import { ConfigError, CURATED_OMISSION_CLAUSE, defaultMarkers, estimateTokens, listFolder, materialize, routingViewJson, toolBlockLines, } from '@any-nav/core';
|
|
20
|
+
import { renderHelpTopic, renderHelpTopicsBlock, topicNames } from './help-topics.js';
|
|
21
|
+
const DEFAULT_CONFIG_NAME = 'any-nav.toml';
|
|
22
|
+
// src/ and dist/ sit one level below the package root, so this resolves in
|
|
23
|
+
// dev, packed, and installed forms alike.
|
|
24
|
+
const { version: VERSION } = createRequire(import.meta.url)('../package.json');
|
|
25
|
+
function nonNegativeInt(value) {
|
|
26
|
+
const n = Number.parseInt(value, 10);
|
|
27
|
+
if (!Number.isInteger(n) || n < 0) {
|
|
28
|
+
throw new InvalidArgumentError('must be a non-negative integer');
|
|
29
|
+
}
|
|
30
|
+
return n;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Marker-key sanitizer — the same rule core's formats apply to source
|
|
34
|
+
* paths (fileSafeName), applied here to the listed folder's
|
|
35
|
+
* config-root-relative path so one target file can carry one idempotent
|
|
36
|
+
* section per folder ('' — the config root itself — reads as 'root').
|
|
37
|
+
*/
|
|
38
|
+
function markerKey(relPosix) {
|
|
39
|
+
return relPosix.replace(/[^a-zA-Z0-9-]+/g, '-').replace(/^-+|-+$/g, '') || 'root';
|
|
40
|
+
}
|
|
41
|
+
function emit(io, text) {
|
|
42
|
+
io.stdout.write(text.trimEnd() + '\n');
|
|
43
|
+
}
|
|
44
|
+
function emitDiagnostics(io, diagnostics, suppressWarnings) {
|
|
45
|
+
// no-description rides its own row as an inline marker (terminalLines);
|
|
46
|
+
// every other code keeps one stderr line each.
|
|
47
|
+
for (const diagnostic of diagnostics) {
|
|
48
|
+
if (diagnostic.code === 'no-description')
|
|
49
|
+
continue;
|
|
50
|
+
if (suppressWarnings && diagnostic.severity === 'warning')
|
|
51
|
+
continue;
|
|
52
|
+
io.stderr.write(`${diagnostic.severity}: [${diagnostic.code}] ${diagnostic.message}\n`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
export async function run(argv, io = process) {
|
|
56
|
+
let result = 0;
|
|
57
|
+
const program = new Command();
|
|
58
|
+
program
|
|
59
|
+
.name('any-nav')
|
|
60
|
+
.description('Agent navigation for any Markdown folder — query the live tree.')
|
|
61
|
+
// Long-only version flag: -v/-V stay unassigned (clig.dev route)
|
|
62
|
+
.version(VERSION, '--version', 'output the version number')
|
|
63
|
+
.exitOverride()
|
|
64
|
+
// Reference content rides the help subsystem as non-command
|
|
65
|
+
// topics (gh's HELP TOPICS expression; roster in help-topics.ts). The
|
|
66
|
+
// help command is ours, not commander's builtin: pseudo-topic dispatch
|
|
67
|
+
// needs one place that knows commands, topics, and itself (gh's
|
|
68
|
+
// 'gh help help' renders the help command's own help; the builtin
|
|
69
|
+
// cannot target itself).
|
|
70
|
+
.helpCommand(false)
|
|
71
|
+
.addHelpText('after', renderHelpTopicsBlock())
|
|
72
|
+
.configureOutput({
|
|
73
|
+
writeOut: (s) => io.stdout.write(s),
|
|
74
|
+
writeErr: (s) => io.stderr.write(s),
|
|
75
|
+
});
|
|
76
|
+
const withConfig = (cmd) => cmd.option('-c, --config <path>', 'pin a specific any-nav.toml (paths outside its root then error)');
|
|
77
|
+
program
|
|
78
|
+
.command('init')
|
|
79
|
+
.description('seed a comment-only any-nav.toml — the home for exceptions; list itself runs without one')
|
|
80
|
+
.option('-c, --config <path>', 'config path to write (default: any-nav.toml in the current directory)')
|
|
81
|
+
.action(async (opts) => {
|
|
82
|
+
result = await cmdInit(opts, io);
|
|
83
|
+
});
|
|
84
|
+
withConfig(program
|
|
85
|
+
.command('list')
|
|
86
|
+
.description('list a folder as path | description rows (default: the current directory)')
|
|
87
|
+
.argument('[path]', 'folder to list, any directory (default: the current directory)')
|
|
88
|
+
.option('--depth <n>', 'expand this many levels below the listed folder, ignoring the local list', nonNegativeInt)
|
|
89
|
+
.option('--no-warnings', 'hide [no-description] row markers and warning diagnostics')
|
|
90
|
+
.option('--write <file>', 'write the markdown rendering of the same view into <file> as an idempotent marked section')
|
|
91
|
+
.addOption(
|
|
92
|
+
// JSON and the write artifact are two packagings of one projection;
|
|
93
|
+
// asking for both is a usage error, not a precedence call.
|
|
94
|
+
new Option('--json', 'print the same view as machine-readable JSON (stdout stays pure JSON)').conflicts('write'))
|
|
95
|
+
.addHelpText('after', '\nRows are the interactive format; every row\'s path is relative to the\nfolder you listed. Rows print as "path | description"; folders at the\nboundary print as "[N below] path", with " | description" too when the\nfolder carries one — its package.json description, its manifest.yml, or\nits README (N = the folder\'s recursive .md count); a file\'s description is its own —\nfrontmatter \'description:\' or its first substantive line; a row with no\ndescription prints a trailing " [no-description]" marker instead — off\nwith --no-warnings, and --write output never carries it. Folders on the listed folder\'s\nown local list expand by default — their children print inline and the\nfolder row itself is absorbed; deep entries need no ancestor chain —\nfolders between are transparent corridors whose own rows are omitted,\nand when that omits anything a leading \"# curated\" note says so (every\nfolder still lists by path); --depth overrides. --json prints the same\nprojection as JSON instead of rows — the machine-readable face: stdout is\npure JSON (maintainer-class diagnostics still go to stderr); entries are\nthe view\'s nodes (path, kind, description when present — absent means\nnone; truncated folders carry their exact recursive .md count), and the\nenvelope carries root, depth, routeCount, and truncation facts; row\ntext, markdown, and tool content are not part of it, so declared\ncommands are not executed. A toml\'s top-level\ncommands (tool declarations, e.g. \"mytool instructions\") render their\noutput into the listing ahead of the files — any-nav runs them\ncapture-only (10s timeout, 10,000-char cap); an unavailable tool becomes\na one-line skip note; ANY_NAV_NO_TOOLS=1 skips execution. Strict\nlocality — scan,\nexpansion, budget, and entry commands all belong to the listed folder alone: only its own\nany-nav.toml curates its view and an ancestor\'s never applies; a folder\nwith no toml of its own lists under pure defaults (built-in excludes +\n.gitignore), and nesting tomls is how curation follows directories.\nExcluded names bound the excluding view only — the folder itself stays\nlistable by path (exclusion is not access control). Listings\npast 100 rows are cut with a trailing note, never silently; a --write\nsection that would exceed the budget collapses expanded branches\nfirst, then trims lines, with a note in the section. --write <file>\nsplices the markdown rendering — preamble + tree, self-describing for a\nlife outside the terminal — between any-nav markers; reruns replace only\nthat section, and it requires an any-nav.toml (the section key anchors\nto its root).\n')).action(async (path, opts) => {
|
|
96
|
+
result = await cmdList(path, opts, io);
|
|
97
|
+
});
|
|
98
|
+
// search is unexposed (framework decision 9, owner ruling 2026-10-06:
|
|
99
|
+
// retrieval belongs to the host's tools; the core kernel stays for a
|
|
100
|
+
// future correct pattern). generate retired into list --write; retired
|
|
101
|
+
// commands exit 2 like guide/read.
|
|
102
|
+
const helpCmd = program
|
|
103
|
+
.command('help')
|
|
104
|
+
.description('display help for a command or topic')
|
|
105
|
+
.argument('[target]', 'a command name or a help topic')
|
|
106
|
+
// gh ignores trailing args after a help target ('gh help <topic> extra')
|
|
107
|
+
.allowExcessArguments(true);
|
|
108
|
+
helpCmd.action((target) => {
|
|
109
|
+
if (target === undefined) {
|
|
110
|
+
program.help(); // bare 'help' = program help (stdout, exit 0 via catch)
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
const topic = renderHelpTopic(target);
|
|
114
|
+
if (topic !== null) {
|
|
115
|
+
emit(io, topic); // trailing extra args ignored (gh behaves the same)
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
const command = program.commands.find((c) => c.name() === target);
|
|
119
|
+
if (command !== undefined) {
|
|
120
|
+
command.help(); // HelpRequestError → exit 0 via the catch below
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
const knownCommands = program.commands.map((c) => c.name());
|
|
124
|
+
io.stderr.write(`error: unknown help target '${target}'. Commands: ${knownCommands.join(', ')}; ` +
|
|
125
|
+
`topics: ${topicNames().join(', ')}; run 'any-nav help' to see both.\n`);
|
|
126
|
+
result = 2;
|
|
127
|
+
});
|
|
128
|
+
try {
|
|
129
|
+
await program.parseAsync(argv, { from: 'user' });
|
|
130
|
+
return result;
|
|
131
|
+
}
|
|
132
|
+
catch (err) {
|
|
133
|
+
if (err instanceof CommanderError) {
|
|
134
|
+
// Typed routing: commander declares its own exit intent —
|
|
135
|
+
// help/version carry exitCode 0 (including the builtin `help` command,
|
|
136
|
+
// code 'commander.help'); usage errors carry 1 and are remapped to 2.
|
|
137
|
+
return err.exitCode === 0 ? 0 : 2;
|
|
138
|
+
}
|
|
139
|
+
io.stderr.write(`${err.message}\n`);
|
|
140
|
+
return 1;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
async function cmdInit(opts, io) {
|
|
144
|
+
// init owns its -c flag: it names the write target, not a discovery override.
|
|
145
|
+
const configPath = resolve(opts.config ?? join(process.cwd(), DEFAULT_CONFIG_NAME));
|
|
146
|
+
if (existsSync(configPath)) {
|
|
147
|
+
io.stderr.write(`any-nav: ${configPath} already exists — edit it, or pass --config <path> to write elsewhere; ` +
|
|
148
|
+
`schema: 'any-nav help config'\n`);
|
|
149
|
+
return 1;
|
|
150
|
+
}
|
|
151
|
+
// Minimal config + pointer line — the template is a
|
|
152
|
+
// config, not a documentation carrier; the schema lives in 'help config'.
|
|
153
|
+
// A comment-only file is a complete config: the opt-in and the boundary.
|
|
154
|
+
const text = `# full schema: any-nav help config\n` +
|
|
155
|
+
`# list runs without this file (pure defaults); it exists to state exceptions —\n` +
|
|
156
|
+
`# [scan] excludes, local default-expansion, budget, commands entry-declarations.\n` +
|
|
157
|
+
`# Comment-only is complete.\n`;
|
|
158
|
+
await mkdir(dirname(configPath), { recursive: true });
|
|
159
|
+
await writeFile(configPath, text, 'utf8');
|
|
160
|
+
io.stdout.write(`${configPath} created (comment-only — the home for exceptions)\n`);
|
|
161
|
+
io.stdout.write(`next: 'any-nav list' — the navigation is queryable right away\n`);
|
|
162
|
+
io.stdout.write(`then: 'any-nav help telling-agents' — the two-line entry for AGENTS.md\n`);
|
|
163
|
+
io.stdout.write(`schema: 'any-nav help config'\n`);
|
|
164
|
+
return 0;
|
|
165
|
+
}
|
|
166
|
+
const execAsync = promisify(exec);
|
|
167
|
+
// Execution fuses: a tool that hangs or
|
|
168
|
+
// floods must not hang or flood the listing — timeout, char cap, and a
|
|
169
|
+
// pointer past a head instead of a mid-body truncation.
|
|
170
|
+
const TOOL_TIMEOUT_MS = 10_000;
|
|
171
|
+
const TOOL_MAX_CHARS = 10_000;
|
|
172
|
+
const TOOL_HEAD_CHARS = 2_000;
|
|
173
|
+
// Trust gate: opt-out switch — set to skip tool
|
|
174
|
+
// execution entirely and render the declaration rows instead. The gate
|
|
175
|
+
// lives here (adapter layer); core never reads the environment.
|
|
176
|
+
const NO_TOOLS_ENV = 'ANY_NAV_NO_TOOLS';
|
|
177
|
+
/**
|
|
178
|
+
* The CLI's CommandRunner (full-render ruling, 2026-10-16): runs each
|
|
179
|
+
* declared command through the shell in the governing toml's directory,
|
|
180
|
+
* capture-only — stdout becomes nav content, a failure becomes the
|
|
181
|
+
* one-line skip note (the reason rides stderr, never the payload).
|
|
182
|
+
*/
|
|
183
|
+
async function shellCommandRunner(command, ctx) {
|
|
184
|
+
try {
|
|
185
|
+
const { stdout } = await execAsync(command, {
|
|
186
|
+
cwd: ctx.cwd,
|
|
187
|
+
timeout: TOOL_TIMEOUT_MS,
|
|
188
|
+
maxBuffer: TOOL_MAX_CHARS * 4,
|
|
189
|
+
windowsHide: true,
|
|
190
|
+
encoding: 'utf8',
|
|
191
|
+
});
|
|
192
|
+
const text = stdout.trim();
|
|
193
|
+
return {
|
|
194
|
+
ok: true,
|
|
195
|
+
stdout: text.length > TOOL_MAX_CHARS
|
|
196
|
+
? `${text.slice(0, TOOL_HEAD_CHARS)}\n[capped at ${TOOL_HEAD_CHARS} of ${text.length} chars — run the command for the full output]`
|
|
197
|
+
: text,
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
catch (err) {
|
|
201
|
+
// The tool's own stderr first line says why better than Node's wrapper.
|
|
202
|
+
const e = err;
|
|
203
|
+
return { ok: false, reason: (e.stderr ?? e.message).split('\n')[0]?.trim() || 'failed' };
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Terminal payload: the row rendering with the breadth-guard note appended.
|
|
208
|
+
* Rows are THE interactive format regardless of governance (packaging axis:
|
|
209
|
+
* write, not toml, decides the markdown envelope). Tool blocks declared by
|
|
210
|
+
* the governing toml frame here in the presentation layer from ToolSection
|
|
211
|
+
* data — view.lines keeps its pure row contract. A
|
|
212
|
+
* leading corridor note rides the payload when the curated view actually omitted
|
|
213
|
+
* content — reader knowledge, not a warning, so --no-warnings never hides
|
|
214
|
+
* it (the sentence is canonical in core; only the '# ' sigil is ours).
|
|
215
|
+
*/
|
|
216
|
+
function terminalLines(listed, noDescription) {
|
|
217
|
+
const lines = [
|
|
218
|
+
// Ruling 10: framed blocks come from ToolSection data here in the
|
|
219
|
+
// presentation layer — view.lines stays pure `path | description`.
|
|
220
|
+
...(listed.tools ?? []).flatMap((section) => [...toolBlockLines(section), '']),
|
|
221
|
+
...(listed.view.omittedByCuration !== undefined ? [`# ${CURATED_OMISSION_CLAUSE}`] : []),
|
|
222
|
+
];
|
|
223
|
+
// A description-less file's row is exactly its path (no " | " half), so
|
|
224
|
+
// exact-line membership marks it without touching described rows.
|
|
225
|
+
lines.push(...listed.view.lines.map((line) => noDescription.has(line) ? `${line} [no-description]` : line));
|
|
226
|
+
if (listed.view.rowsTruncated !== undefined) {
|
|
227
|
+
lines.push(`(listing truncated at ${listed.view.rowsTruncated.shown} rows, ${listed.view.rowsTruncated.omitted} omitted — narrow the path, search the folder yourself, or split the folder / nest an any-nav.toml)`);
|
|
228
|
+
}
|
|
229
|
+
return lines.length === 0 ? '(empty)' : lines.join('\n');
|
|
230
|
+
}
|
|
231
|
+
async function cmdList(path, opts, io) {
|
|
232
|
+
// Governance is the listed folder's business (2026-10-07 optionality
|
|
233
|
+
// ruling): nearest toml at or above it, pure defaults when none — cwd
|
|
234
|
+
// never participates. --config pins a specific config instead.
|
|
235
|
+
let listed;
|
|
236
|
+
try {
|
|
237
|
+
// Ruling 12: the opt-out gate decides at injection — a gated run
|
|
238
|
+
// renders the declaration rows (the no-runner fallback), never executes.
|
|
239
|
+
const toolsGated = ['1', 'true'].includes((process.env[NO_TOOLS_ENV] ?? '').toLowerCase());
|
|
240
|
+
// The JSON face v1 carries no tool content: declared commands neither
|
|
241
|
+
// run (no side-effectful spawns for output this face drops) nor
|
|
242
|
+
// re-express — the no-runner fallback rides `lines` only, which the
|
|
243
|
+
// JSON face does not serialize.
|
|
244
|
+
listed = await listFolder(resolve(process.cwd(), path ?? '.'), {
|
|
245
|
+
configPath: opts.config,
|
|
246
|
+
depth: opts.depth,
|
|
247
|
+
commandRunner: toolsGated || opts.json === true ? undefined : shellCommandRunner,
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
catch (err) {
|
|
251
|
+
if (err instanceof ConfigError) {
|
|
252
|
+
// E2 shape: core names the file; the CLI names the action + schema.
|
|
253
|
+
throw new Error(`any-nav: ${err.message}; fix the config or create one with 'any-nav init'; schema: 'any-nav help config'`);
|
|
254
|
+
}
|
|
255
|
+
// SG-4/5 family: prefix + recovery pointer on runtime errors.
|
|
256
|
+
throw new Error(`any-nav: ${err.message}; run 'any-nav list --help' for usage`);
|
|
257
|
+
}
|
|
258
|
+
// Warning switch (--no-warnings): hides row markers and warning-severity
|
|
259
|
+
// stderr lines. Interactive listing defaults to markers ON; --write never
|
|
260
|
+
// marks rows — a materialized section must not carry transient tree state.
|
|
261
|
+
const suppressWarnings = opts.warnings === false;
|
|
262
|
+
if (opts.json === true) {
|
|
263
|
+
// Audience triage (payload discipline): the payload carries
|
|
264
|
+
// consumer-class diagnostics — core's serialization filters them in —
|
|
265
|
+
// while maintainer diagnostics keep the stderr side-channel, so stdout
|
|
266
|
+
// stays pure JSON. `no-description` stays structural here (description
|
|
267
|
+
// absent means none); emitDiagnostics skips it as on rows.
|
|
268
|
+
const maintainer = listed.diagnostics.filter((diagnostic) => diagnostic.audience === 'maintainer' && diagnostic.face !== 'write');
|
|
269
|
+
emitDiagnostics(io, maintainer, suppressWarnings);
|
|
270
|
+
io.stdout.write(routingViewJson(listed.view) + '\n');
|
|
271
|
+
return 0;
|
|
272
|
+
}
|
|
273
|
+
// Packaging triage: write-artifact diagnostics (face 'write') report only
|
|
274
|
+
// where that artifact is produced — the --write flow. The rows answer is
|
|
275
|
+
// never touched by the budget guard, so a plain listing never hears about
|
|
276
|
+
// a section it did not ask for.
|
|
277
|
+
const surfaced = opts.write === undefined
|
|
278
|
+
? listed.diagnostics.filter((diagnostic) => diagnostic.face !== 'write')
|
|
279
|
+
: listed.diagnostics;
|
|
280
|
+
emitDiagnostics(io, surfaced, suppressWarnings);
|
|
281
|
+
// Unavailable tools: the payload carries the canonical skip line; the
|
|
282
|
+
// reason (why it failed) is maintainer-side debugging — stderr, hideable.
|
|
283
|
+
if (!suppressWarnings) {
|
|
284
|
+
for (const section of listed.tools ?? []) {
|
|
285
|
+
if (section.output === undefined) {
|
|
286
|
+
io.stderr.write(`any-nav: tool '${section.command}' unavailable (${section.unavailableReason ?? 'no reason'})` + '\n');
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
if (opts.write === undefined) {
|
|
291
|
+
const noDescription = suppressWarnings
|
|
292
|
+
? new Set()
|
|
293
|
+
: new Set(listed.diagnostics
|
|
294
|
+
.filter((diagnostic) => diagnostic.code === 'no-description')
|
|
295
|
+
.map((diagnostic) => diagnostic.path)
|
|
296
|
+
.filter((path) => path !== undefined));
|
|
297
|
+
emit(io, terminalLines(listed, noDescription));
|
|
298
|
+
return 0;
|
|
299
|
+
}
|
|
300
|
+
// Write form (generate's successor): the markdown rendering — preamble +
|
|
301
|
+
// tree, self-describing for a life outside the terminal — becomes a marked
|
|
302
|
+
// section in the user-named target (any path: writes are user-directed
|
|
303
|
+
// while only scanning is boundary-guarded). Markers key by the listed
|
|
304
|
+
// folder relative to the config root, so each folder owns its own
|
|
305
|
+
// idempotent section per target file — which is why the write axis keeps
|
|
306
|
+
// the toml anchor (optionality ruling, ruling 4).
|
|
307
|
+
if (listed.governingConfig === null) {
|
|
308
|
+
throw new Error(`any-nav: list --write needs an any-nav.toml to anchor the section key; ` +
|
|
309
|
+
`create one with 'any-nav init' (comment-only is enough) or pass --config <path>`);
|
|
310
|
+
}
|
|
311
|
+
const configRoot = dirname(resolve(listed.governingConfig));
|
|
312
|
+
const relPosix = relative(configRoot, listed.root).split('\\').join('/');
|
|
313
|
+
const markers = defaultMarkers(`list:${markerKey(relPosix)}`);
|
|
314
|
+
const fragment = { formatId: 'list', text: listed.markdown, targets: [], markers };
|
|
315
|
+
const target = resolve(process.cwd(), opts.write);
|
|
316
|
+
try {
|
|
317
|
+
const existing = await readFile(target, 'utf8').catch(() => null);
|
|
318
|
+
const next = materialize(existing ?? '', fragment, markers);
|
|
319
|
+
await mkdir(dirname(target), { recursive: true });
|
|
320
|
+
await writeFile(target, next, 'utf8');
|
|
321
|
+
}
|
|
322
|
+
catch (err) {
|
|
323
|
+
// SG-4/5 family: prefix + recovery pointer on runtime write errors too.
|
|
324
|
+
throw new Error(`any-nav: cannot write ${opts.write}: ${err.message}; run 'any-nav list --help' for usage`);
|
|
325
|
+
}
|
|
326
|
+
// Write mode: stdout carries only the report line — the payload's one
|
|
327
|
+
// home is the file; re-printing it would split the data face.
|
|
328
|
+
io.stdout.write(`wrote ${opts.write} (markdown, ~${estimateTokens(listed.markdown)} tokens)\n`);
|
|
329
|
+
return 0;
|
|
330
|
+
}
|
|
331
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAClF,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EACL,WAAW,EACX,uBAAuB,EACvB,cAAc,EACd,cAAc,EACd,UAAU,EACV,W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AAc,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;IAChG,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* help topic text — config: the one-time setup knowledge for any-nav.toml.
|
|
3
|
+
* The schema's canonical home is @any-nav/core parseConfig (core/src/config.ts);
|
|
4
|
+
* this copy restates it and is kept from drifting by guards (example blocks
|
|
5
|
+
* must parse, every accepted key must appear). Four keys total: scan bounds,
|
|
6
|
+
* local curates, budget guards, commands declares. Burden rules keep the
|
|
7
|
+
* page light.
|
|
8
|
+
*/
|
|
9
|
+
declare const _default = "any-nav config \u2014 the any-nav.toml schema\n\nThe complete key set with defaults. The file states only exceptions: an\nabsent key means automatic behavior, and unknown keys are rejected.\nEvery key serves its own file's folder view \u2014 strict locality: a\nfolder's own toml curates its view, an ancestor's never applies, and a\nfolder with no toml of its own lists under pure defaults (built-in\nexcludes + .gitignore).\n\nTop-level keys:\n local optional array \u2014 folders whose rows expand by default\n (config-relative paths)\n budget optional table \u2014 write-face token guard\n scan optional table \u2014 traversal boundary policy\n commands optional array \u2014 tool declarations, e.g. \"mytool\n instructions\": output renders into the listing ahead of\n the files (capture-only; 10s timeout; 10,000-char cap; skip\n note if unavailable; ANY_NAV_NO_TOOLS=1 gates execution).\n\nlocal (default: no expansion \u2014 depth-0 everywhere):\n Plain folder paths relative to the config file, no globs. A listed\n folder's row expands inline; a deep entry needs no ancestor chain \u2014\n folders between are transparent corridors whose own rows are omitted\n (a leading note line says so when that omits anything, and every\n folder still lists by path). Membership says expansion, not\n existence. 'any-nav list <folder> --depth N' overrides the list for\n one query (the escape hatch).\n\n[budget]:\n share optional, number fraction of the assumed 100,000-token\n context window the fragment may\n occupy (default 0.02; 0 < share <= 1)\n maxTokens optional, integer hard cap in estimated tokens\n (default: none \u2014 share rules; share\n 0.02 of 100,000 = 2000 tokens)\n\nThe budget guards the write face: an over-budget section collapses\nexpanded branches first, then trims lines \u2014 always with a note in the\nsection, never a silent cut. The rows face is never collapsed by\nbudget; its own guard is the flat 100-row cut.\n\n[scan]:\n The ignore you are looking for lives here: excludeDirs, excludeFiles,\n excludeDotEntries. The rest \u2014 respectGitignore, boundaryExempt,\n maxFiles \u2014 is traversal boundary policy, not more excludes.\n excludeDirs optional, strings directory names skipped; appends\n to the always-on floor (.git .hg .svn\n node_modules .pnpm dist build lib out)\n \u2014 never removes a default\n excludeFiles optional, strings markdown file names additionally\n excluded (case-insensitive);\n appends to (AGENTS.md, CLAUDE.md)\n excludeDotEntries optional, boolean skip dot-prefixed names (default true)\n respectGitignore optional, boolean respects .gitignore files (default true)\n boundaryExempt optional, strings subtree patterns (gitignore-style,\n view-root anchored, e.g. \"repo/\")\n whose own nested .git no longer cuts\n them; deeper embedded repos still cut\n maxFiles optional, integer markdown files examined per source\n walk (default 2000); past the cap\n entries go unexamined with a\n diagnostic \u2014 cut rows show \u2265N\n\nThe exclude names apply at any depth of this file's own view-walk.\nAn excluded folder stays listable by path, serving its own view.\n\nMinimal example (the whole file can be just comments):\n\n```toml\n# any-nav.toml \u2014 the home for exceptions: [scan] excludes, local\n# default-expansion, budget. list runs without it (pure defaults).\n```\n\nCurated example (the handbooks shelf expands inline; docs is a\ntransparent corridor \u2014 its other children stay off this view but list\nby path):\n\n```toml\nlocal = [\n \"docs/handbooks\",\n]\n\ncommands = [\"mytool entry --kind standard\"]\n```\n\nKey boundaries:\n- '--config <path>' pins a specific toml (paths outside its root then\n error). 'list --write' needs a toml and anchors to the nearest\n any-nav.toml at or above the listed folder (the section key's config root).\n- The file is optional; comment-only is complete.\n- list prints `path | description` rows; descriptions are the files'\n own \u2014 front-matter 'description:' or its first substantive line; a\n folder row carries its package.json / manifest.yml description's, else its README's.\n- 'list --write <file>' wraps the same view as a self-describing\n markdown section. The written target is ordinary navigable content \u2014\n give it a front-matter 'description:' (or gitignore / excludeFiles\n it) or it shows up as a bare row with a warning.\n- A key is only real if this page lists it.\n\nTelling agents about the navigation: 'any-nav help telling-agents'.\n";
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* help topic text — config: the one-time setup knowledge for any-nav.toml.
|
|
3
|
+
* The schema's canonical home is @any-nav/core parseConfig (core/src/config.ts);
|
|
4
|
+
* this copy restates it and is kept from drifting by guards (example blocks
|
|
5
|
+
* must parse, every accepted key must appear). Four keys total: scan bounds,
|
|
6
|
+
* local curates, budget guards, commands declares. Burden rules keep the
|
|
7
|
+
* page light.
|
|
8
|
+
*/
|
|
9
|
+
export default `any-nav config — the any-nav.toml schema
|
|
10
|
+
|
|
11
|
+
The complete key set with defaults. The file states only exceptions: an
|
|
12
|
+
absent key means automatic behavior, and unknown keys are rejected.
|
|
13
|
+
Every key serves its own file's folder view — strict locality: a
|
|
14
|
+
folder's own toml curates its view, an ancestor's never applies, and a
|
|
15
|
+
folder with no toml of its own lists under pure defaults (built-in
|
|
16
|
+
excludes + .gitignore).
|
|
17
|
+
|
|
18
|
+
Top-level keys:
|
|
19
|
+
local optional array — folders whose rows expand by default
|
|
20
|
+
(config-relative paths)
|
|
21
|
+
budget optional table — write-face token guard
|
|
22
|
+
scan optional table — traversal boundary policy
|
|
23
|
+
commands optional array — tool declarations, e.g. "mytool
|
|
24
|
+
instructions": output renders into the listing ahead of
|
|
25
|
+
the files (capture-only; 10s timeout; 10,000-char cap; skip
|
|
26
|
+
note if unavailable; ANY_NAV_NO_TOOLS=1 gates execution).
|
|
27
|
+
|
|
28
|
+
local (default: no expansion — depth-0 everywhere):
|
|
29
|
+
Plain folder paths relative to the config file, no globs. A listed
|
|
30
|
+
folder's row expands inline; a deep entry needs no ancestor chain —
|
|
31
|
+
folders between are transparent corridors whose own rows are omitted
|
|
32
|
+
(a leading note line says so when that omits anything, and every
|
|
33
|
+
folder still lists by path). Membership says expansion, not
|
|
34
|
+
existence. 'any-nav list <folder> --depth N' overrides the list for
|
|
35
|
+
one query (the escape hatch).
|
|
36
|
+
|
|
37
|
+
[budget]:
|
|
38
|
+
share optional, number fraction of the assumed 100,000-token
|
|
39
|
+
context window the fragment may
|
|
40
|
+
occupy (default 0.02; 0 < share <= 1)
|
|
41
|
+
maxTokens optional, integer hard cap in estimated tokens
|
|
42
|
+
(default: none — share rules; share
|
|
43
|
+
0.02 of 100,000 = 2000 tokens)
|
|
44
|
+
|
|
45
|
+
The budget guards the write face: an over-budget section collapses
|
|
46
|
+
expanded branches first, then trims lines — always with a note in the
|
|
47
|
+
section, never a silent cut. The rows face is never collapsed by
|
|
48
|
+
budget; its own guard is the flat 100-row cut.
|
|
49
|
+
|
|
50
|
+
[scan]:
|
|
51
|
+
The ignore you are looking for lives here: excludeDirs, excludeFiles,
|
|
52
|
+
excludeDotEntries. The rest — respectGitignore, boundaryExempt,
|
|
53
|
+
maxFiles — is traversal boundary policy, not more excludes.
|
|
54
|
+
excludeDirs optional, strings directory names skipped; appends
|
|
55
|
+
to the always-on floor (.git .hg .svn
|
|
56
|
+
node_modules .pnpm dist build lib out)
|
|
57
|
+
— never removes a default
|
|
58
|
+
excludeFiles optional, strings markdown file names additionally
|
|
59
|
+
excluded (case-insensitive);
|
|
60
|
+
appends to (AGENTS.md, CLAUDE.md)
|
|
61
|
+
excludeDotEntries optional, boolean skip dot-prefixed names (default true)
|
|
62
|
+
respectGitignore optional, boolean respects .gitignore files (default true)
|
|
63
|
+
boundaryExempt optional, strings subtree patterns (gitignore-style,
|
|
64
|
+
view-root anchored, e.g. "repo/")
|
|
65
|
+
whose own nested .git no longer cuts
|
|
66
|
+
them; deeper embedded repos still cut
|
|
67
|
+
maxFiles optional, integer markdown files examined per source
|
|
68
|
+
walk (default 2000); past the cap
|
|
69
|
+
entries go unexamined with a
|
|
70
|
+
diagnostic — cut rows show ≥N
|
|
71
|
+
|
|
72
|
+
The exclude names apply at any depth of this file's own view-walk.
|
|
73
|
+
An excluded folder stays listable by path, serving its own view.
|
|
74
|
+
|
|
75
|
+
Minimal example (the whole file can be just comments):
|
|
76
|
+
|
|
77
|
+
\`\`\`toml
|
|
78
|
+
# any-nav.toml — the home for exceptions: [scan] excludes, local
|
|
79
|
+
# default-expansion, budget. list runs without it (pure defaults).
|
|
80
|
+
\`\`\`
|
|
81
|
+
|
|
82
|
+
Curated example (the handbooks shelf expands inline; docs is a
|
|
83
|
+
transparent corridor — its other children stay off this view but list
|
|
84
|
+
by path):
|
|
85
|
+
|
|
86
|
+
\`\`\`toml
|
|
87
|
+
local = [
|
|
88
|
+
"docs/handbooks",
|
|
89
|
+
]
|
|
90
|
+
|
|
91
|
+
commands = ["mytool entry --kind standard"]
|
|
92
|
+
\`\`\`
|
|
93
|
+
|
|
94
|
+
Key boundaries:
|
|
95
|
+
- '--config <path>' pins a specific toml (paths outside its root then
|
|
96
|
+
error). 'list --write' needs a toml and anchors to the nearest
|
|
97
|
+
any-nav.toml at or above the listed folder (the section key's config root).
|
|
98
|
+
- The file is optional; comment-only is complete.
|
|
99
|
+
- list prints \`path | description\` rows; descriptions are the files'
|
|
100
|
+
own — front-matter 'description:' or its first substantive line; a
|
|
101
|
+
folder row carries its package.json / manifest.yml description's, else its README's.
|
|
102
|
+
- 'list --write <file>' wraps the same view as a self-describing
|
|
103
|
+
markdown section. The written target is ordinary navigable content —
|
|
104
|
+
give it a front-matter 'description:' (or gitignore / excludeFiles
|
|
105
|
+
it) or it shows up as a bare row with a warning.
|
|
106
|
+
- A key is only real if this page lists it.
|
|
107
|
+
|
|
108
|
+
Telling agents about the navigation: 'any-nav help telling-agents'.
|
|
109
|
+
`;
|
|
110
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/help-topics/config.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoGd,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* help topic text — telling-agents: the context-file entry. The entry is
|
|
3
|
+
* two lines — a capability line + a one-shot procedural line: knowing the
|
|
4
|
+
* entry is not using it, so the entry itself schedules one pull per
|
|
5
|
+
* session, restoring what a hand-written navigation section used to
|
|
6
|
+
* guarantee. Two-line cap, derivation-free, never stale. The
|
|
7
|
+
* materialized section is not taught here: '--write' is a list flag and
|
|
8
|
+
* its teaching stays with 'any-nav help list' (an exception for
|
|
9
|
+
* consumers without command access, not day-one knowledge). Burden
|
|
10
|
+
* rules keep the page light.
|
|
11
|
+
*/
|
|
12
|
+
declare const _default = "any-nav telling-agents \u2014 the AGENTS.md entry\n\nFirst time? Put two lines in AGENTS.md:\n\n This repo's Markdown is dynamically indexed (name + description)\n by 'any-nav list <any-folder>' instead of a hand-written index.\n Run 'any-nav list' once when you start working here \u2014 it replaces\n the navigation this file would otherwise carry.\n\nHandwritten and derivation-free, so it never goes stale. If the\nlines are already there, you are done. The second line restores the\nguarantee a hand-written navigation section used to carry: the map\nis consumed once per session \u2014 pulled fresh instead of injected.\n\nThe rows are only as good as each file's own description: front-matter\n'description:' or the first substantive line (folders: their\npackage.json / manifest.yml description, else their README).\nDocs that matter deserve a real one \u2014 'any-nav help config' has the\nsourcing rules.\n\nNotes:\n- Keep the entry to the two lines. Agents get the rest from\n any-nav --help themselves; anything longer only goes stale.\n- Default expansion, excludes, budget: 'any-nav help config'. No\n config is needed to start.\n";
|
|
13
|
+
export default _default;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* help topic text — telling-agents: the context-file entry. The entry is
|
|
3
|
+
* two lines — a capability line + a one-shot procedural line: knowing the
|
|
4
|
+
* entry is not using it, so the entry itself schedules one pull per
|
|
5
|
+
* session, restoring what a hand-written navigation section used to
|
|
6
|
+
* guarantee. Two-line cap, derivation-free, never stale. The
|
|
7
|
+
* materialized section is not taught here: '--write' is a list flag and
|
|
8
|
+
* its teaching stays with 'any-nav help list' (an exception for
|
|
9
|
+
* consumers without command access, not day-one knowledge). Burden
|
|
10
|
+
* rules keep the page light.
|
|
11
|
+
*/
|
|
12
|
+
export default `any-nav telling-agents — the AGENTS.md entry
|
|
13
|
+
|
|
14
|
+
First time? Put two lines in AGENTS.md:
|
|
15
|
+
|
|
16
|
+
This repo's Markdown is dynamically indexed (name + description)
|
|
17
|
+
by 'any-nav list <any-folder>' instead of a hand-written index.
|
|
18
|
+
Run 'any-nav list' once when you start working here — it replaces
|
|
19
|
+
the navigation this file would otherwise carry.
|
|
20
|
+
|
|
21
|
+
Handwritten and derivation-free, so it never goes stale. If the
|
|
22
|
+
lines are already there, you are done. The second line restores the
|
|
23
|
+
guarantee a hand-written navigation section used to carry: the map
|
|
24
|
+
is consumed once per session — pulled fresh instead of injected.
|
|
25
|
+
|
|
26
|
+
The rows are only as good as each file's own description: front-matter
|
|
27
|
+
'description:' or the first substantive line (folders: their
|
|
28
|
+
package.json / manifest.yml description, else their README).
|
|
29
|
+
Docs that matter deserve a real one — 'any-nav help config' has the
|
|
30
|
+
sourcing rules.
|
|
31
|
+
|
|
32
|
+
Notes:
|
|
33
|
+
- Keep the entry to the two lines. Agents get the rest from
|
|
34
|
+
any-nav --help themselves; anything longer only goes stale.
|
|
35
|
+
- Default expansion, excludes, budget: 'any-nav help config'. No
|
|
36
|
+
config is needed to start.
|
|
37
|
+
`;
|
|
38
|
+
//# sourceMappingURL=telling-agents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telling-agents.js","sourceRoot":"","sources":["../../src/help-topics/telling-agents.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;CAyBd,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const HELP_TOPICS: ReadonlyArray<readonly [topic: string, summary: string]>;
|
|
2
|
+
export declare const topicNames: () => string[];
|
|
3
|
+
/** HELP TOPICS block appended to root help (gh's uppercase section form). */
|
|
4
|
+
export declare function renderHelpTopicsBlock(): string;
|
|
5
|
+
export declare function renderHelpTopic(topic: string): string | null;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* help topics — non-command reference pages rendered through the help
|
|
3
|
+
* subsystem (gh-anchored expression).
|
|
4
|
+
*
|
|
5
|
+
* A topic is not a command: `any-nav help config` and `any-nav help
|
|
6
|
+
* <command>` share one verb, `help` (no arguments) lists topics alongside
|
|
7
|
+
* commands, and unknown help targets list both. Topic texts are static
|
|
8
|
+
* string modules under help-topics/ (product documentation, not
|
|
9
|
+
* navigation-fact text). The config topic restates the schema parsed by
|
|
10
|
+
* @any-nav/core; guards keep that copy from drifting.
|
|
11
|
+
*/
|
|
12
|
+
import config from './help-topics/config.js';
|
|
13
|
+
import tellingAgents from './help-topics/telling-agents.js';
|
|
14
|
+
export const HELP_TOPICS = [
|
|
15
|
+
['config', 'the complete any-nav.toml schema: keys, defaults, the local list'],
|
|
16
|
+
['telling-agents', "first time? the two-line AGENTS.md entry — never goes stale"],
|
|
17
|
+
];
|
|
18
|
+
const TEXTS = { config, 'telling-agents': tellingAgents };
|
|
19
|
+
export const topicNames = () => HELP_TOPICS.map(([topic]) => topic);
|
|
20
|
+
/** HELP TOPICS block appended to root help (gh's uppercase section form). */
|
|
21
|
+
export function renderHelpTopicsBlock() {
|
|
22
|
+
const rows = HELP_TOPICS.map(([topic, summary]) => ` ${topic}: ${summary}`);
|
|
23
|
+
return `\nHELP TOPICS\n${rows.join('\n')}\n`;
|
|
24
|
+
}
|
|
25
|
+
export function renderHelpTopic(topic) {
|
|
26
|
+
return TEXTS[topic] ?? null;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=help-topics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"help-topics.js","sourceRoot":"","sources":["../src/help-topics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,MAAM,MAAM,yBAAyB,CAAC;AAC7C,OAAO,aAAa,MAAM,iCAAiC,CAAC;AAE5D,MAAM,CAAC,MAAM,WAAW,GAA6D;IACnF,CAAC,QAAQ,EAAE,kEAAkE,CAAC;IAC9E,CAAC,gBAAgB,EAAE,6DAA6D,CAAC;CAClF,CAAC;AAEF,MAAM,KAAK,GAAqC,EAAE,MAAM,EAAE,gBAAgB,EAAE,aAAa,EAAE,CAAC;AAE5F,MAAM,CAAC,MAAM,UAAU,GAAG,GAAa,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC;AAE9E,6EAA6E;AAC7E,MAAM,UAAU,qBAAqB;IACnC,MAAM,IAAI,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,MAAM,OAAO,EAAE,CAAC,CAAC;IAC9E,OAAO,kBAAkB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,KAAa;IAC3C,OAAO,KAAK,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC;AAC9B,CAAC"}
|
package/dist/main.d.ts
ADDED
package/dist/main.js
ADDED
package/dist/main.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";AACA,iFAAiF;AACjF,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,OAAO,CAAC,QAAQ,GAAG,MAAM,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@any-nav/cli",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Any-Nav CLI integration adapter (L0): discovers config, materializes generated navigation fragments into agent files (AGENTS.md and other registered formats). Owns all disk writes and exit codes.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/CatheadOwl/any-nav.git"
|
|
9
|
+
},
|
|
10
|
+
"type": "module",
|
|
11
|
+
"bin": {
|
|
12
|
+
"any-nav": "./dist/main.js"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"CHANGELOG.md"
|
|
17
|
+
],
|
|
18
|
+
"publishConfig": {
|
|
19
|
+
"access": "public",
|
|
20
|
+
"provenance": false
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@any-nav/core": "0.2.0",
|
|
24
|
+
"commander": "^15.0.0"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "tsc -p tsconfig.build.json && node scripts/check-bin.mjs",
|
|
28
|
+
"typecheck": "tsc --noEmit",
|
|
29
|
+
"test": "node --test \"test/*.test.ts\"",
|
|
30
|
+
"pretest": "pnpm --filter @any-nav/core run build",
|
|
31
|
+
"pretypecheck": "pnpm --filter @any-nav/core run build",
|
|
32
|
+
"expose-skill": "node scripts/expose-skill.mjs"
|
|
33
|
+
}
|
|
6
34
|
}
|