@yaks/cli 0.0.0-stage → 0.2.36
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/LICENSE +202 -0
- package/README.md +1059 -2
- package/_dist/account-forward.d.ts +12 -0
- package/_dist/account-forward.d.ts.map +1 -0
- package/_dist/accounts.d.ts +23 -0
- package/_dist/accounts.d.ts.map +1 -0
- package/_dist/answer.d.ts +88 -0
- package/_dist/answer.d.ts.map +1 -0
- package/_dist/apply.d.ts +17 -0
- package/_dist/apply.d.ts.map +1 -0
- package/_dist/args.d.ts +86 -0
- package/_dist/args.d.ts.map +1 -0
- package/_dist/commands.d.ts +15 -0
- package/_dist/commands.d.ts.map +1 -0
- package/_dist/complete.d.ts +15 -0
- package/_dist/complete.d.ts.map +1 -0
- package/_dist/config.d.ts +37 -0
- package/_dist/config.d.ts.map +1 -0
- package/_dist/dependencies.d.ts +6 -0
- package/_dist/dependencies.d.ts.map +1 -0
- package/_dist/facets.d.ts +71 -0
- package/_dist/facets.d.ts.map +1 -0
- package/_dist/grammar.d.ts +5 -0
- package/_dist/grammar.d.ts.map +1 -0
- package/_dist/host.d.ts +164 -0
- package/_dist/host.d.ts.map +1 -0
- package/_dist/install.d.ts +43 -0
- package/_dist/install.d.ts.map +1 -0
- package/_dist/main.d.ts +16 -0
- package/_dist/main.d.ts.map +1 -0
- package/_dist/memo.d.ts +60 -0
- package/_dist/memo.d.ts.map +1 -0
- package/_dist/mod.d.ts +46 -0
- package/_dist/mod.d.ts.map +1 -0
- package/_dist/page.d.ts +73 -0
- package/_dist/page.d.ts.map +1 -0
- package/_dist/platform.d.ts +27 -0
- package/_dist/platform.d.ts.map +1 -0
- package/_dist/reader.d.ts +10 -0
- package/_dist/reader.d.ts.map +1 -0
- package/_dist/release.d.ts +48 -0
- package/_dist/release.d.ts.map +1 -0
- package/_dist/remote.d.ts +13 -0
- package/_dist/remote.d.ts.map +1 -0
- package/_dist/reported.d.ts +11 -0
- package/_dist/reported.d.ts.map +1 -0
- package/_dist/roles.d.ts +2 -0
- package/_dist/roles.d.ts.map +1 -0
- package/_dist/roster.d.ts +41 -0
- package/_dist/roster.d.ts.map +1 -0
- package/_dist/rpc.d.ts +29 -0
- package/_dist/rpc.d.ts.map +1 -0
- package/_dist/run.d.ts +164 -0
- package/_dist/run.d.ts.map +1 -0
- package/_dist/runtime.d.ts +4 -0
- package/_dist/runtime.d.ts.map +1 -0
- package/_dist/searching.d.ts +7 -0
- package/_dist/searching.d.ts.map +1 -0
- package/_dist/show.d.ts +22 -0
- package/_dist/show.d.ts.map +1 -0
- package/_dist/store.d.ts +25 -0
- package/_dist/store.d.ts.map +1 -0
- package/_dist/terminal.d.ts +17 -0
- package/_dist/terminal.d.ts.map +1 -0
- package/_dist/tool.d.ts +55 -0
- package/_dist/tool.d.ts.map +1 -0
- package/_dist/tty.d.ts +3 -0
- package/_dist/tty.d.ts.map +1 -0
- package/_dist/vault.d.ts +9 -0
- package/_dist/vault.d.ts.map +1 -0
- package/_dist/words.d.ts +11 -0
- package/_dist/words.d.ts.map +1 -0
- package/_dist/yak.d.ts +10 -0
- package/_dist/yak.d.ts.map +1 -0
- package/account-forward.js +40 -0
- package/account-forward.js.map +1 -0
- package/account-forward.ts +50 -0
- package/accounts.js +162 -0
- package/accounts.js.map +1 -0
- package/accounts.ts +228 -0
- package/answer.js +394 -0
- package/answer.js.map +1 -0
- package/answer.ts +569 -0
- package/apply.js +49 -0
- package/apply.js.map +1 -0
- package/apply.ts +54 -0
- package/args.js +420 -0
- package/args.js.map +1 -0
- package/args.ts +494 -0
- package/code.js +209 -0
- package/code.js.map +1 -0
- package/code.ts +227 -0
- package/commands.js +131 -0
- package/commands.js.map +1 -0
- package/commands.ts +142 -0
- package/complete.js +104 -0
- package/complete.js.map +1 -0
- package/complete.ts +152 -0
- package/config.js +125 -0
- package/config.js.map +1 -0
- package/config.ts +180 -0
- package/declarations.js +67 -0
- package/declarations.js.map +1 -0
- package/declarations.ts +84 -0
- package/deno.json +1 -0
- package/dependencies.js +126 -0
- package/dependencies.js.map +1 -0
- package/dependencies.ts +141 -0
- package/derive.js +102 -0
- package/derive.js.map +1 -0
- package/derive.ts +125 -0
- package/drain.js +83 -0
- package/drain.js.map +1 -0
- package/drain.ts +115 -0
- package/duties.ts +17 -0
- package/exports.json +1486 -0
- package/external.js +373 -0
- package/external.js.map +1 -0
- package/external.ts +435 -0
- package/facets.js +214 -0
- package/facets.js.map +1 -0
- package/facets.ts +232 -0
- package/feedback.js +54 -0
- package/feedback.js.map +1 -0
- package/feedback.ts +57 -0
- package/files.js +84 -0
- package/files.js.map +1 -0
- package/files.ts +112 -0
- package/get_starts.js +31 -0
- package/get_starts.js.map +1 -0
- package/get_starts.ts +34 -0
- package/git-credential.js +79 -0
- package/git-credential.js.map +1 -0
- package/git-credential.ts +77 -0
- package/grammar.js +4 -0
- package/grammar.js.map +1 -0
- package/grammar.ts +5 -0
- package/held.js +51 -0
- package/held.js.map +1 -0
- package/held.ts +66 -0
- package/host.js +1174 -0
- package/host.js.map +1 -0
- package/host.ts +1343 -0
- package/init.js +138 -0
- package/init.js.map +1 -0
- package/init.ts +139 -0
- package/install.js +216 -0
- package/install.js.map +1 -0
- package/install.ts +223 -0
- package/lifetime.js +56 -0
- package/lifetime.js.map +1 -0
- package/lifetime.ts +66 -0
- package/local-page.ts +114 -0
- package/local.js +417 -0
- package/local.js.map +1 -0
- package/local.ts +537 -0
- package/lockfile.js +20 -0
- package/lockfile.js.map +1 -0
- package/lockfile.ts +32 -0
- package/machines.js +33 -0
- package/machines.js.map +1 -0
- package/machines.ts +51 -0
- package/made/4f855610bdabcd736100d34e4e467ea5.json +1 -0
- package/main.js +534 -0
- package/main.js.map +1 -0
- package/main.ts +547 -0
- package/mcp.js +108 -0
- package/mcp.js.map +1 -0
- package/mcp.ts +113 -0
- package/member.js +103 -0
- package/member.js.map +1 -0
- package/member.ts +133 -0
- package/memo.js +503 -0
- package/memo.js.map +1 -0
- package/memo.ts +634 -0
- package/mod.js +46 -0
- package/mod.js.map +1 -0
- package/mod.ts +99 -0
- package/operations.js +53 -0
- package/operations.js.map +1 -0
- package/operations.ts +68 -0
- package/package.json +115 -4
- package/page.js +211 -0
- package/page.js.map +1 -0
- package/page.ts +308 -0
- package/parser.js +45 -0
- package/parser.js.map +1 -0
- package/parser.ts +77 -0
- package/people-search.js +112 -0
- package/people-search.js.map +1 -0
- package/people-search.ts +162 -0
- package/platform.js +184 -0
- package/platform.js.map +1 -0
- package/platform.ts +224 -0
- package/platform_effects.js +5 -0
- package/platform_effects.js.map +1 -0
- package/platform_effects.ts +13 -0
- package/prepare.js +40 -0
- package/prepare.js.map +1 -0
- package/prepare.ts +46 -0
- package/read_activity.js +54 -0
- package/read_activity.js.map +1 -0
- package/read_activity.ts +61 -0
- package/read_thread.js +387 -0
- package/read_thread.js.map +1 -0
- package/read_thread.ts +506 -0
- package/read_worker.ts +164 -0
- package/reader.js +48 -0
- package/reader.js.map +1 -0
- package/reader.ts +57 -0
- package/release.js +82 -0
- package/release.js.map +1 -0
- package/release.json +127 -0
- package/release.ts +98 -0
- package/remote-page.ts +70 -0
- package/remote.js +96 -0
- package/remote.js.map +1 -0
- package/remote.ts +153 -0
- package/report.js +83 -0
- package/report.js.map +1 -0
- package/report.ts +101 -0
- package/reported.js +32 -0
- package/reported.js.map +1 -0
- package/reported.ts +38 -0
- package/restart.js +349 -0
- package/restart.js.map +1 -0
- package/restart.ts +478 -0
- package/restore.js +32 -0
- package/restore.js.map +1 -0
- package/restore.ts +38 -0
- package/roles.js +32 -0
- package/roles.js.map +1 -0
- package/roles.ts +49 -0
- package/roster.js +65 -0
- package/roster.js.map +1 -0
- package/roster.ts +84 -0
- package/rpc.js +113 -0
- package/rpc.js.map +1 -0
- package/rpc.ts +159 -0
- package/run.js +533 -0
- package/run.js.map +1 -0
- package/run.ts +741 -0
- package/runtime.js +381 -0
- package/runtime.js.map +1 -0
- package/runtime.ts +433 -0
- package/sandboxes.js +26 -0
- package/sandboxes.js.map +1 -0
- package/sandboxes.ts +30 -0
- package/searching.js +33 -0
- package/searching.js.map +1 -0
- package/searching.ts +50 -0
- package/show.js +109 -0
- package/show.js.map +1 -0
- package/show.ts +144 -0
- package/shown.js +13 -0
- package/shown.js.map +1 -0
- package/shown.ts +44 -0
- package/stall.js +90 -0
- package/stall.js.map +1 -0
- package/stall.ts +156 -0
- package/stall_profile.js +113 -0
- package/stall_profile.js.map +1 -0
- package/stall_profile.ts +142 -0
- package/stall_wait.js +183 -0
- package/stall_wait.js.map +1 -0
- package/stall_wait.ts +249 -0
- package/stall_wait_worker.ts +11 -0
- package/start.js +349 -0
- package/start.js.map +1 -0
- package/start.ts +343 -0
- package/starvation.js +147 -0
- package/starvation.js.map +1 -0
- package/starvation.ts +224 -0
- package/store.js +118 -0
- package/store.js.map +1 -0
- package/store.ts +193 -0
- package/subcommands.js +62 -0
- package/subcommands.js.map +1 -0
- package/subcommands.ts +77 -0
- package/terminal.js +93 -0
- package/terminal.js.map +1 -0
- package/terminal.ts +128 -0
- package/text.js +20 -0
- package/text.js.map +1 -0
- package/text.ts +37 -0
- package/tool.js +76 -0
- package/tool.js.map +1 -0
- package/tool.ts +157 -0
- package/trace_control.js +231 -0
- package/trace_control.js.map +1 -0
- package/trace_control.ts +233 -0
- package/traces.js +138 -0
- package/traces.js.map +1 -0
- package/traces.ts +160 -0
- package/tracker.js +22 -0
- package/tracker.js.map +1 -0
- package/tracker.ts +27 -0
- package/tty.js +82 -0
- package/tty.js.map +1 -0
- package/tty.ts +142 -0
- package/unit_failure.js +178 -0
- package/unit_failure.js.map +1 -0
- package/unit_failure.ts +191 -0
- package/upkeep_thread.js +32 -0
- package/upkeep_thread.js.map +1 -0
- package/upkeep_thread.ts +35 -0
- package/upkeep_worker.ts +27 -0
- package/vault.js +186 -0
- package/vault.js.map +1 -0
- package/vault.ts +220 -0
- package/vocab-ids.js +63 -0
- package/vocab-ids.js.map +1 -0
- package/vocab-ids.ts +62 -0
- package/vocab.json +35 -0
- package/warm.js +138 -0
- package/warm.js.map +1 -0
- package/warm.ts +171 -0
- package/watch_revision.js +25 -0
- package/watch_revision.js.map +1 -0
- package/watch_revision.ts +30 -0
- package/words.js +29 -0
- package/words.js.map +1 -0
- package/words.ts +41 -0
- package/workspaces.js +40 -0
- package/workspaces.js.map +1 -0
- package/workspaces.ts +58 -0
- package/yak-unit-failure.conf +6 -0
- package/yak-unit-handoff.conf +2 -0
- package/yak.js +123 -0
- package/yak.js.map +1 -0
- package/yak.ts +136 -0
package/yak.ts
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
// The `yak` command: ./main.ts is what it runs, and this module is where it
|
|
2
|
+
// starts.
|
|
3
|
+
//
|
|
4
|
+
// A checkout changes under a running command: a landing rewrites main's
|
|
5
|
+
// checkout file by file, and Deno reads a module when something first imports
|
|
6
|
+
// it. A command loading from the checkout as it moved would join modules of
|
|
7
|
+
// two commits, one importing a name the other has yet to export. So a command
|
|
8
|
+
// started from a checkout loads only the land lock (@yaks/git/hold, whose one
|
|
9
|
+
// import is @yaks/file/io, which imports Node's alone), waits out a landing,
|
|
10
|
+
// loads the launcher and reads the checkout under that lock, held shared
|
|
11
|
+
// (`yak serve` first mints the vocabulary's missing ids into it), and
|
|
12
|
+
// runs, in this process, the copy of this module in a snapshot of it
|
|
13
|
+
// (./runtime.ts `launch`), a tree nothing rewrites while a process runs from
|
|
14
|
+
// it. A release from JSR, an install without `.git`, and the snapshot itself
|
|
15
|
+
// never change, and run here.
|
|
16
|
+
//
|
|
17
|
+
// yak task list # the command, from its checkout's snapshot
|
|
18
|
+
// yak serve --config yak.json
|
|
19
|
+
|
|
20
|
+
import { hold } from '@yaks/git/hold'
|
|
21
|
+
import { readFile, stat } from 'node:fs/promises'
|
|
22
|
+
import { resolve } from 'node:path'
|
|
23
|
+
import { fileURLToPath } from 'node:url'
|
|
24
|
+
|
|
25
|
+
/** The Git directory every worktree of the checkout at `root` shares, read as
|
|
26
|
+
* Git reads it: `.git` is that directory, or a file naming the worktree's
|
|
27
|
+
* own, whose `commondir` names the shared one. Undefined when `root` is no
|
|
28
|
+
* Git checkout. */
|
|
29
|
+
export let common = async (root: string): Promise<string | undefined> => {
|
|
30
|
+
let dot = resolve(root, '.git')
|
|
31
|
+
let found = await stat(dot).catch(() => undefined)
|
|
32
|
+
if (!found?.isFile()) return found && dot
|
|
33
|
+
let own = resolve(root, (await readFile(dot, 'utf8')).slice(8).trim())
|
|
34
|
+
let shared = await readFile(`${own}/commondir`, 'utf8').catch(() => '.')
|
|
35
|
+
return resolve(own, shared.trim())
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** Wait until no landing writes the checkout at `root`, and keep the next
|
|
39
|
+
* from writing it until the returned release. Undefined when `root` is no Git
|
|
40
|
+
* checkout. */
|
|
41
|
+
export let steady = async (
|
|
42
|
+
root: string,
|
|
43
|
+
): Promise<(() => void) | undefined> => {
|
|
44
|
+
let dir = await common(root)
|
|
45
|
+
return dir ? hold(dir, false) : undefined
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// The command, from argv to its exit.
|
|
49
|
+
//
|
|
50
|
+
// An interrupt winds the command down rather than cutting it off
|
|
51
|
+
// (@yaks/process/wind). The command holds the process open: the first
|
|
52
|
+
// interrupt stops every graph it opened (./held.ts `stop`), so `yak serve`
|
|
53
|
+
// takes no new request, no new effect and no new step, and the command
|
|
54
|
+
// finishes what it started and closes the way it always does, for as long as
|
|
55
|
+
// that takes. A command with nothing open has nothing to finish, and ends at
|
|
56
|
+
// once. A second interrupt ends its duty threads where they stand (./held.ts
|
|
57
|
+
// `cut`), closes with the interrupt's code, and exits.
|
|
58
|
+
export let start = async (argv: string[]): Promise<void> => {
|
|
59
|
+
let root = new URL('../../', import.meta.url)
|
|
60
|
+
let pinned = Deno.env.get('YAK_RUNTIME_ROOT') == root.href.replace(/\/$/, '')
|
|
61
|
+
let release = root.protocol == 'file:' && !pinned
|
|
62
|
+
? await steady(fileURLToPath(root))
|
|
63
|
+
: undefined
|
|
64
|
+
if (release) {
|
|
65
|
+
// `yak serve` mints a `$id` for each word its checkout's vocab.json files
|
|
66
|
+
// lack (./vocab-ids.ts), with no landing under way, before the snapshot
|
|
67
|
+
// takes the checkout. A failure leaves the words held by their labels.
|
|
68
|
+
if (argv[0] == 'serve') {
|
|
69
|
+
await import('./vocab-ids.js').then(({ mintIds }) => mintIds(root))
|
|
70
|
+
.catch((error) => console.error('yak serve: vocab ids:', error))
|
|
71
|
+
}
|
|
72
|
+
let { launch } = await import('./runtime.js').catch((error) => {
|
|
73
|
+
release()
|
|
74
|
+
throw error
|
|
75
|
+
})
|
|
76
|
+
return launch(argv, release)
|
|
77
|
+
}
|
|
78
|
+
let [system, { listen, wind }, { inspector }] = await Promise.all([
|
|
79
|
+
import('@yaks/process/system'),
|
|
80
|
+
import('@yaks/process/wind'),
|
|
81
|
+
import('./runtime.js'),
|
|
82
|
+
])
|
|
83
|
+
listen()
|
|
84
|
+
let port = system.env.get('YAK_WORK_INSPECT')
|
|
85
|
+
if (port && argv.includes('work')) {
|
|
86
|
+
let { open } = await import('node:inspector')
|
|
87
|
+
open(inspector(port), '127.0.0.1')
|
|
88
|
+
}
|
|
89
|
+
// A supervised process keeps what it runs beside its ready file, for the
|
|
90
|
+
// next restart to compare (./code.ts).
|
|
91
|
+
let ready = flag(argv, 'ready')
|
|
92
|
+
let forget = async () => {}
|
|
93
|
+
if (ready) {
|
|
94
|
+
let { codeFile, record } = await import('./code.js')
|
|
95
|
+
forget = record(codeFile(ready), flag(argv, 'config')).stop
|
|
96
|
+
}
|
|
97
|
+
// Resolve the repository's default from the same frozen tree as the CLI.
|
|
98
|
+
// Children inherit it, and a new launcher can select its own tree's pin.
|
|
99
|
+
if (pinned && !Deno.env.has('DENO_SQLITE_PATH')) {
|
|
100
|
+
let { importing } = await import('@yaks/fp/imports')
|
|
101
|
+
let { library } = await importing(new URL('bin/sqlite.ts', root).href)
|
|
102
|
+
Deno.env.set('YAK_SQLITE_PATH', await library())
|
|
103
|
+
}
|
|
104
|
+
let [{ closeAccounts }, held, { main }] = await Promise.all([
|
|
105
|
+
import('./accounts.js'),
|
|
106
|
+
import('./held.js'),
|
|
107
|
+
import('./main.js'),
|
|
108
|
+
])
|
|
109
|
+
let ran = main(argv)
|
|
110
|
+
wind.hold({
|
|
111
|
+
drain: () => held.stop() ? ran : undefined,
|
|
112
|
+
force: () => held.cut(),
|
|
113
|
+
})
|
|
114
|
+
wind.done.then(async (code) => {
|
|
115
|
+
await held.close(code)
|
|
116
|
+
await closeAccounts()
|
|
117
|
+
await forget()
|
|
118
|
+
system.exit(code)
|
|
119
|
+
})
|
|
120
|
+
ran.then(async (code) => {
|
|
121
|
+
await forget()
|
|
122
|
+
system.exit(code)
|
|
123
|
+
})
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/// flag(['work', '--ready', '/r/a.ready'], 'ready') -> '/r/a.ready'
|
|
127
|
+
/// flag(['serve', '--config=yak.json'], 'config') -> 'yak.json'
|
|
128
|
+
/// flag(['serve'], 'ready') -> undefined
|
|
129
|
+
/** The value a command line gives `--name`. */
|
|
130
|
+
export let flag = (argv: string[], name: string): string | undefined => {
|
|
131
|
+
let at = argv.indexOf(`--${name}`)
|
|
132
|
+
if (at >= 0) return argv[at + 1]
|
|
133
|
+
return argv.find((a) => a.startsWith(`--${name}=`))?.slice(name.length + 3)
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (import.meta.main) start(Deno.args)
|