@tenphi/akno 0.1.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/LICENSE +83 -0
- package/README.md +46 -0
- package/dist/args.d.ts +18 -0
- package/dist/args.d.ts.map +1 -0
- package/dist/args.js +92 -0
- package/dist/args.js.map +1 -0
- package/dist/bin.d.ts +3 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +142 -0
- package/dist/bin.js.map +1 -0
- package/dist/commands/adopt-cmd.d.ts +2 -0
- package/dist/commands/adopt-cmd.d.ts.map +1 -0
- package/dist/commands/adopt-cmd.js +61 -0
- package/dist/commands/adopt-cmd.js.map +1 -0
- package/dist/commands/answer-cmd.d.ts +2 -0
- package/dist/commands/answer-cmd.d.ts.map +1 -0
- package/dist/commands/answer-cmd.js +150 -0
- package/dist/commands/answer-cmd.js.map +1 -0
- package/dist/commands/bench-cmd.d.ts +4 -0
- package/dist/commands/bench-cmd.d.ts.map +1 -0
- package/dist/commands/bench-cmd.js +1542 -0
- package/dist/commands/bench-cmd.js.map +1 -0
- package/dist/commands/config-cmd.d.ts +7 -0
- package/dist/commands/config-cmd.d.ts.map +1 -0
- package/dist/commands/config-cmd.js +80 -0
- package/dist/commands/config-cmd.js.map +1 -0
- package/dist/commands/context-cmd.d.ts +2 -0
- package/dist/commands/context-cmd.d.ts.map +1 -0
- package/dist/commands/context-cmd.js +130 -0
- package/dist/commands/context-cmd.js.map +1 -0
- package/dist/commands/doctor-cmd.d.ts +2 -0
- package/dist/commands/doctor-cmd.d.ts.map +1 -0
- package/dist/commands/doctor-cmd.js +198 -0
- package/dist/commands/doctor-cmd.js.map +1 -0
- package/dist/commands/dream-cmd.d.ts +26 -0
- package/dist/commands/dream-cmd.d.ts.map +1 -0
- package/dist/commands/dream-cmd.js +1167 -0
- package/dist/commands/dream-cmd.js.map +1 -0
- package/dist/commands/dream-model-status.d.ts +5 -0
- package/dist/commands/dream-model-status.d.ts.map +1 -0
- package/dist/commands/dream-model-status.js +33 -0
- package/dist/commands/dream-model-status.js.map +1 -0
- package/dist/commands/dream-notifications.d.ts +24 -0
- package/dist/commands/dream-notifications.d.ts.map +1 -0
- package/dist/commands/dream-notifications.js +168 -0
- package/dist/commands/dream-notifications.js.map +1 -0
- package/dist/commands/dream-schedule.d.ts +55 -0
- package/dist/commands/dream-schedule.d.ts.map +1 -0
- package/dist/commands/dream-schedule.js +160 -0
- package/dist/commands/dream-schedule.js.map +1 -0
- package/dist/commands/folder-cmd.d.ts +2 -0
- package/dist/commands/folder-cmd.d.ts.map +1 -0
- package/dist/commands/folder-cmd.js +84 -0
- package/dist/commands/folder-cmd.js.map +1 -0
- package/dist/commands/graph-cmd.d.ts +2 -0
- package/dist/commands/graph-cmd.d.ts.map +1 -0
- package/dist/commands/graph-cmd.js +126 -0
- package/dist/commands/graph-cmd.js.map +1 -0
- package/dist/commands/inbox-cmd.d.ts +2 -0
- package/dist/commands/inbox-cmd.d.ts.map +1 -0
- package/dist/commands/inbox-cmd.js +69 -0
- package/dist/commands/inbox-cmd.js.map +1 -0
- package/dist/commands/index-cmd.d.ts +2 -0
- package/dist/commands/index-cmd.d.ts.map +1 -0
- package/dist/commands/index-cmd.js +102 -0
- package/dist/commands/index-cmd.js.map +1 -0
- package/dist/commands/ingest-cmd.d.ts +2 -0
- package/dist/commands/ingest-cmd.d.ts.map +1 -0
- package/dist/commands/ingest-cmd.js +167 -0
- package/dist/commands/ingest-cmd.js.map +1 -0
- package/dist/commands/init-cmd.d.ts +292 -0
- package/dist/commands/init-cmd.d.ts.map +1 -0
- package/dist/commands/init-cmd.js +476 -0
- package/dist/commands/init-cmd.js.map +1 -0
- package/dist/commands/init-prompts.d.ts +51 -0
- package/dist/commands/init-prompts.d.ts.map +1 -0
- package/dist/commands/init-prompts.js +192 -0
- package/dist/commands/init-prompts.js.map +1 -0
- package/dist/commands/list-cmd.d.ts +2 -0
- package/dist/commands/list-cmd.d.ts.map +1 -0
- package/dist/commands/list-cmd.js +77 -0
- package/dist/commands/list-cmd.js.map +1 -0
- package/dist/commands/maintenance-policy-output.d.ts +4 -0
- package/dist/commands/maintenance-policy-output.d.ts.map +1 -0
- package/dist/commands/maintenance-policy-output.js +72 -0
- package/dist/commands/maintenance-policy-output.js.map +1 -0
- package/dist/commands/mutate-cmd.d.ts +5 -0
- package/dist/commands/mutate-cmd.d.ts.map +1 -0
- package/dist/commands/mutate-cmd.js +224 -0
- package/dist/commands/mutate-cmd.js.map +1 -0
- package/dist/commands/plan-cmd.d.ts +9 -0
- package/dist/commands/plan-cmd.d.ts.map +1 -0
- package/dist/commands/plan-cmd.js +411 -0
- package/dist/commands/plan-cmd.js.map +1 -0
- package/dist/commands/read-cmd.d.ts +2 -0
- package/dist/commands/read-cmd.d.ts.map +1 -0
- package/dist/commands/read-cmd.js +89 -0
- package/dist/commands/read-cmd.js.map +1 -0
- package/dist/commands/recall-cmd.d.ts +2 -0
- package/dist/commands/recall-cmd.d.ts.map +1 -0
- package/dist/commands/recall-cmd.js +176 -0
- package/dist/commands/recall-cmd.js.map +1 -0
- package/dist/commands/redeploy-cmd.d.ts +43 -0
- package/dist/commands/redeploy-cmd.d.ts.map +1 -0
- package/dist/commands/redeploy-cmd.js +270 -0
- package/dist/commands/redeploy-cmd.js.map +1 -0
- package/dist/commands/rules-cmd.d.ts +2 -0
- package/dist/commands/rules-cmd.d.ts.map +1 -0
- package/dist/commands/rules-cmd.js +72 -0
- package/dist/commands/rules-cmd.js.map +1 -0
- package/dist/commands/serve-cmd.d.ts +23 -0
- package/dist/commands/serve-cmd.d.ts.map +1 -0
- package/dist/commands/serve-cmd.js +415 -0
- package/dist/commands/serve-cmd.js.map +1 -0
- package/dist/commands/timeline-cmd.d.ts +2 -0
- package/dist/commands/timeline-cmd.d.ts.map +1 -0
- package/dist/commands/timeline-cmd.js +67 -0
- package/dist/commands/timeline-cmd.js.map +1 -0
- package/dist/commands/write-cmd.d.ts +49 -0
- package/dist/commands/write-cmd.d.ts.map +1 -0
- package/dist/commands/write-cmd.js +269 -0
- package/dist/commands/write-cmd.js.map +1 -0
- package/dist/ops-handle.d.ts +67 -0
- package/dist/ops-handle.d.ts.map +1 -0
- package/dist/ops-handle.js +196 -0
- package/dist/ops-handle.js.map +1 -0
- package/dist/output.d.ts +28 -0
- package/dist/output.d.ts.map +1 -0
- package/dist/output.js +87 -0
- package/dist/output.js.map +1 -0
- package/dist/serve/http.d.ts +19 -0
- package/dist/serve/http.d.ts.map +1 -0
- package/dist/serve/http.js +135 -0
- package/dist/serve/http.js.map +1 -0
- package/dist/serve/mcp.d.ts +21 -0
- package/dist/serve/mcp.d.ts.map +1 -0
- package/dist/serve/mcp.js +79 -0
- package/dist/serve/mcp.js.map +1 -0
- package/dist/serve/socket.d.ts +15 -0
- package/dist/serve/socket.d.ts.map +1 -0
- package/dist/serve/socket.js +311 -0
- package/dist/serve/socket.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +15 -0
- package/dist/version.js.map +1 -0
- package/package.json +40 -0
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { openOptionsFrom, parse } from "../args.js";
|
|
2
|
+
import { heading, json, line, statusLabel, style, truncate } from "../output.js";
|
|
3
|
+
import { resolveOps } from "../ops-handle.js";
|
|
4
|
+
const RECALL_HELP = `akno recall <query> [options]
|
|
5
|
+
|
|
6
|
+
Search memory. Returns cited page and standalone document results.
|
|
7
|
+
|
|
8
|
+
--mode <m> lookup | question | explore. Inferred from the query by
|
|
9
|
+
default; passing it explicitly always wins.
|
|
10
|
+
--depth <d> summary | lines | full
|
|
11
|
+
--limit <n> Maximum results.
|
|
12
|
+
--budget <n> Token budget for the whole response.
|
|
13
|
+
--include <r,...> Page roles to include, e.g. source. With --depth full
|
|
14
|
+
this lifts the source quote cap.
|
|
15
|
+
--folder <path> Restrict to a folder.
|
|
16
|
+
--type <t> Restrict to a frontmatter type.
|
|
17
|
+
--tag <t,...> Restrict to pages carrying all of these tags.
|
|
18
|
+
--source <s> page | document | both
|
|
19
|
+
--ownership <o> orphan | owned | any
|
|
20
|
+
--no-expand Search the exact words given; useful for filenames.
|
|
21
|
+
--no-graph Disable bounded graph-assisted candidate discovery.
|
|
22
|
+
--json Machine-readable response.`;
|
|
23
|
+
export async function recallCommand(argv) {
|
|
24
|
+
const { values, positionals } = parse(argv, {
|
|
25
|
+
mode: { type: 'string' },
|
|
26
|
+
depth: { type: 'string' },
|
|
27
|
+
limit: { type: 'string' },
|
|
28
|
+
budget: { type: 'string' },
|
|
29
|
+
include: { type: 'string' },
|
|
30
|
+
folder: { type: 'string' },
|
|
31
|
+
type: { type: 'string' },
|
|
32
|
+
tag: { type: 'string' },
|
|
33
|
+
source: { type: 'string' },
|
|
34
|
+
ownership: { type: 'string' },
|
|
35
|
+
expand: { type: 'boolean', default: true },
|
|
36
|
+
graph: { type: 'boolean', default: true },
|
|
37
|
+
});
|
|
38
|
+
if (values.help || positionals.length === 0) {
|
|
39
|
+
line(RECALL_HELP);
|
|
40
|
+
return values.help ? 0 : 1;
|
|
41
|
+
}
|
|
42
|
+
const query = positionals.join(' ');
|
|
43
|
+
const handle = await resolveOps(values, openOptionsFrom(values));
|
|
44
|
+
try {
|
|
45
|
+
const filter = {
|
|
46
|
+
...(values.folder ? { folder: values.folder } : {}),
|
|
47
|
+
...(values.type ? { type: values.type } : {}),
|
|
48
|
+
...(values.tag ? { tags: values.tag.split(',').map((t) => t.trim()) } : {}),
|
|
49
|
+
...(values.source ? { source: values.source } : {}),
|
|
50
|
+
...(values.ownership ? { ownership: values.ownership } : {}),
|
|
51
|
+
};
|
|
52
|
+
const result = await handle.ops.recall({
|
|
53
|
+
query,
|
|
54
|
+
...(values.mode ? { mode: values.mode } : {}),
|
|
55
|
+
...(values.depth ? { depth: values.depth } : {}),
|
|
56
|
+
...(values.limit ? { limit: Number(values.limit) } : {}),
|
|
57
|
+
...(values.budget ? { budget: Number(values.budget) } : {}),
|
|
58
|
+
...(values.include
|
|
59
|
+
? {
|
|
60
|
+
include: values.include.split(',').map((c) => c.trim()),
|
|
61
|
+
}
|
|
62
|
+
: {}),
|
|
63
|
+
expand: values.expand,
|
|
64
|
+
graph: values.graph,
|
|
65
|
+
...(Object.keys(filter).length > 0 ? { filter } : {}),
|
|
66
|
+
});
|
|
67
|
+
if (values.json) {
|
|
68
|
+
json(result);
|
|
69
|
+
return 0;
|
|
70
|
+
}
|
|
71
|
+
printRecall(result);
|
|
72
|
+
return result.status === 'unavailable' ? 1 : 0;
|
|
73
|
+
}
|
|
74
|
+
finally {
|
|
75
|
+
await handle.close();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* The output deliberately foregrounds the three things a reader needs and a
|
|
80
|
+
* pile of ranked chunks cannot give: the status, the coverage, and a line address
|
|
81
|
+
* on every quoted line.
|
|
82
|
+
*/
|
|
83
|
+
function printRecall(result) {
|
|
84
|
+
line(`${statusLabel(result.status)} ${style.grey(`mode=${result.mode}`)} ` +
|
|
85
|
+
`${style.grey(`${result.results.length} result${result.results.length === 1 ? '' : 's'}`)} ` +
|
|
86
|
+
`${style.grey(`${result.budget_used} tokens`)}`);
|
|
87
|
+
if (result.degraded?.length)
|
|
88
|
+
line(style.yellow(` degraded: ${result.degraded.join(', ')}`));
|
|
89
|
+
if (result.note)
|
|
90
|
+
line(style.grey(` ${result.note}`));
|
|
91
|
+
if (result.coverage && Object.keys(result.coverage).length > 0) {
|
|
92
|
+
const parts = Object.entries(result.coverage).map(([concept, covered]) => covered ? style.green(`✓ ${concept}`) : style.red(`✗ ${concept}`));
|
|
93
|
+
line(` ${style.grey('coverage')} ${parts.join(' ')}`);
|
|
94
|
+
const missing = Object.entries(result.coverage).filter(([, covered]) => !covered);
|
|
95
|
+
if (missing.length > 0) {
|
|
96
|
+
// This line is the whole point of coverage: it tells the reader what they
|
|
97
|
+
// are *not* allowed to conclude from what came back.
|
|
98
|
+
line(style.yellow(` nothing returned covers ${missing.map(([c]) => `"${c}"`).join(', ')} — do not answer that part`));
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
for (const resultCard of result.results) {
|
|
102
|
+
if (resultCard.type === 'document') {
|
|
103
|
+
heading(`${resultCard.path} ${style.grey(`(unfiled document, ${resultCard.score.toFixed(3)})`)}`);
|
|
104
|
+
printMatchMetadata(resultCard);
|
|
105
|
+
if (resultCard.summary)
|
|
106
|
+
line(` ${truncate(resultCard.summary, 150)}`);
|
|
107
|
+
const where = resultCard.matched_page ? `page ${resultCard.matched_page}` : 'extracted text';
|
|
108
|
+
line(` ${style.grey(`${resultCard.source.kind} via ${resultCard.source.via}; ${where}`)}`);
|
|
109
|
+
for (const quoted of resultCard.quote?.split('\n') ?? [])
|
|
110
|
+
line(` ${truncate(quoted, 110)}`);
|
|
111
|
+
if (resultCard.parts?.length) {
|
|
112
|
+
line(style.grey(` parts: ${resultCard.parts.map((part) => part.path).join(', ')}`));
|
|
113
|
+
}
|
|
114
|
+
line(style.grey(` read: akno read --document ${resultCard.id}`));
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
const card = resultCard;
|
|
118
|
+
heading(`${card.slug} ${style.grey(`(${card.role}, ${card.score.toFixed(3)})`)}`);
|
|
119
|
+
printMatchMetadata(card);
|
|
120
|
+
if (card.breadcrumb)
|
|
121
|
+
line(` ${style.cyan(card.breadcrumb)}`);
|
|
122
|
+
if (card.summary)
|
|
123
|
+
line(` ${truncate(card.summary, 150)}`);
|
|
124
|
+
for (const bodyLine of card.lines) {
|
|
125
|
+
const confidence = bodyLine.confidence !== undefined ? style.grey(` ~${bodyLine.confidence}`) : '';
|
|
126
|
+
line(` ${style.grey(`${card.slug}:${bodyLine.n}`)} ${truncate(bodyLine.text, 110)}${confidence}`);
|
|
127
|
+
}
|
|
128
|
+
if (card.truncated)
|
|
129
|
+
line(style.grey(' … quote window capped (source page)'));
|
|
130
|
+
for (const entry of card.superseded ?? []) {
|
|
131
|
+
line(style.yellow(` superseded: ${truncate(entry.claim, 90)} (until ${entry.valid_to})`));
|
|
132
|
+
}
|
|
133
|
+
if (card.documents?.length) {
|
|
134
|
+
const matched = card.documents.filter((doc) => doc.quote);
|
|
135
|
+
const rest = card.documents.filter((doc) => !doc.quote);
|
|
136
|
+
// A document that matched is quoted with the page inside it, because that is the
|
|
137
|
+
// citation a reader checks. The rest are listed as what else is attached.
|
|
138
|
+
for (const doc of matched) {
|
|
139
|
+
const where = doc.matched_page ? `p${doc.matched_page}` : 'text';
|
|
140
|
+
const parts = doc.parts ? style.grey(` (${doc.parts} files, ${doc.pages ?? '?'}p)`) : '';
|
|
141
|
+
line(` ${style.grey(`${doc.rel_path ?? doc.id} ${where}`)}${parts}`);
|
|
142
|
+
if (doc.summary)
|
|
143
|
+
line(` ${style.grey(truncate(doc.summary, 106))}`);
|
|
144
|
+
for (const quoted of doc.quote.split('\n'))
|
|
145
|
+
line(` ${truncate(quoted, 106)}`);
|
|
146
|
+
}
|
|
147
|
+
if (rest.length > 0) {
|
|
148
|
+
line(style.grey(` documents: ${rest.map((doc) => `${doc.rel_path ?? doc.id}${doc.pages ? ` (${doc.pages}p)` : ''}`).join(', ')}`));
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
if (card.links?.length)
|
|
152
|
+
line(style.grey(` links: ${card.links.slice(0, 8).join(', ')}`));
|
|
153
|
+
}
|
|
154
|
+
if (result.searched.length > 1 || result.results.length === 0) {
|
|
155
|
+
line(`\n${style.grey(`searched: ${result.searched.map((q) => `"${q}"`).join(', ')}`)}`);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
function printMatchMetadata(result) {
|
|
159
|
+
if (result.matched_by?.length)
|
|
160
|
+
line(style.grey(` matched: ${result.matched_by.join(' + ')}`));
|
|
161
|
+
for (const graphPath of result.graph_paths ?? []) {
|
|
162
|
+
line(style.grey(` graph: ${formatGraphPath(graphPath)}`));
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
function formatGraphPath(path) {
|
|
166
|
+
const parts = [];
|
|
167
|
+
for (let index = 0; index < path.nodes.length; index++) {
|
|
168
|
+
const node = path.nodes[index];
|
|
169
|
+
parts.push(node.slug ?? node.document ?? node.label ?? node.id);
|
|
170
|
+
const relation = path.relations[index];
|
|
171
|
+
if (relation)
|
|
172
|
+
parts.push(`-${relation}->`);
|
|
173
|
+
}
|
|
174
|
+
return parts.join(' ');
|
|
175
|
+
}
|
|
176
|
+
//# sourceMappingURL=recall-cmd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recall-cmd.js","sourceRoot":"","sources":["../../src/commands/recall-cmd.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACjF,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;iDAkB6B,CAAC;AAElD,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,IAAc;IAChD,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,KAAK,CAalC,IAAI,EAAE;QACP,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACxB,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACzB,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACzB,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC1B,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC3B,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC1B,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACxB,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACvB,MAAM,EAAE,EAAE,IAAI,EAA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AE,CAAC;QAChC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,EAAE,CAAC,CAAC;QAChE,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QACvC,IAAI,QAAQ;YAAE,KAAK,CAAC,IAAI,CAAC,IAAI,QAAQ,IAAI,CAAC,CAAC;IAC7C,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export interface RedeployWaitPolicy {
|
|
2
|
+
fastMs: number;
|
|
3
|
+
maximumMs: number;
|
|
4
|
+
}
|
|
5
|
+
/** An explicit timeout is a hard operator choice; the default has a fast and slow handoff tier. */
|
|
6
|
+
export declare function redeployWaitPolicy(timeoutSeconds?: string): RedeployWaitPolicy;
|
|
7
|
+
/** Content-safe launchctl output parser used only after the fast socket deadline expires. */
|
|
8
|
+
export declare function launchdServiceIsRunning(output: string): boolean;
|
|
9
|
+
export interface SocketIdentity {
|
|
10
|
+
device: number;
|
|
11
|
+
inode: number;
|
|
12
|
+
changedAtMs: number;
|
|
13
|
+
}
|
|
14
|
+
/** A pre-restart listener is not evidence that the replacement is ready. */
|
|
15
|
+
export declare function socketWasReplaced(previous: SocketIdentity | null, current: SocketIdentity | null): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* What a redeploy will actually do, before it does any of it.
|
|
18
|
+
*
|
|
19
|
+
* Split out because the interesting part of this command is a decision table, and a decision table
|
|
20
|
+
* that only exists inside a function that shells out to `pnpm` and `launchctl` is a decision table
|
|
21
|
+
* nothing checks. Two of its rows are load-bearing:
|
|
22
|
+
*
|
|
23
|
+
* - **A failed build restarts nothing.** Restarting anyway puts the *previous* code back into
|
|
24
|
+
* service and reports success, which is worse than stopping — the deploy looks done and the
|
|
25
|
+
* change is not there.
|
|
26
|
+
* - **No service installed is not a failure.** A checkout that talks to Akno in-process has
|
|
27
|
+
* nothing to restart, and a launchctl error about an unfamiliar label is not an improvement on
|
|
28
|
+
* saying so.
|
|
29
|
+
*/
|
|
30
|
+
export interface RedeployPlan {
|
|
31
|
+
build: boolean;
|
|
32
|
+
restart: boolean;
|
|
33
|
+
/** Why the restart is not happening, when it is not. Null when it is. */
|
|
34
|
+
skipped: 'asked' | 'not-darwin' | 'no-service' | null;
|
|
35
|
+
}
|
|
36
|
+
export declare function redeployPlan(input: {
|
|
37
|
+
build: boolean;
|
|
38
|
+
restart: boolean;
|
|
39
|
+
darwin: boolean;
|
|
40
|
+
serviceInstalled: boolean;
|
|
41
|
+
}): RedeployPlan;
|
|
42
|
+
export declare function redeployCommand(argv: string[]): Promise<number>;
|
|
43
|
+
//# sourceMappingURL=redeploy-cmd.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redeploy-cmd.d.ts","sourceRoot":"","sources":["../../src/commands/redeploy-cmd.ts"],"names":[],"mappings":"AAgEA,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,mGAAmG;AACnG,wBAAgB,kBAAkB,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,kBAAkB,CAU9E;AAED,6FAA6F;AAC7F,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE/D;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,4EAA4E;AAC5E,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI,EAAE,OAAO,EAAE,cAAc,GAAG,IAAI,GAAG,OAAO,CAQ1G;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,yEAAyE;IACzE,OAAO,EAAE,OAAO,GAAG,YAAY,GAAG,YAAY,GAAG,IAAI,CAAC;CACvD;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE;IAClC,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,gBAAgB,EAAE,OAAO,CAAC;CAC3B,GAAG,YAAY,CAKf;AAQD,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CA+GrE"}
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import net from 'node:net';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { spawnSync } from 'node:child_process';
|
|
5
|
+
import { once } from 'node:events';
|
|
6
|
+
import { AknoError } from '@tenphi/akno-protocol';
|
|
7
|
+
import { openOptionsFrom, parse } from "../args.js";
|
|
8
|
+
import { heading, json, kv, line, style } from "../output.js";
|
|
9
|
+
/**
|
|
10
|
+
* `akno redeploy` — one command to apply local changes end-to-end.
|
|
11
|
+
*
|
|
12
|
+
* The thing to run after editing Akno, so nobody has to remember the sequence. Two steps:
|
|
13
|
+
*
|
|
14
|
+
* 1. `tsc --build`. **The service needs this too, and that is easy to get wrong.** launchd runs
|
|
15
|
+
* `packages/cli/src/bin.ts` and Node strips the types, so the CLI's own files are live at the
|
|
16
|
+
* next start — but everything under `packages/core` reaches it as a *package*: `serve-cmd.ts`
|
|
17
|
+
* imports `@tenphi/akno-core`, whose `exports` field points at `dist/index.js`. So a source edit
|
|
18
|
+
* inside core is invisible to the running service until it is built, however many times the
|
|
19
|
+
* agent is restarted. Hosts need the build for their own reason: anything importing
|
|
20
|
+
* `@tenphi/akno-client` imports the built JavaScript, and skipping it leaves a host calling the previous
|
|
21
|
+
* op registry, where a new op is simply not there and the failure is `unknown op`.
|
|
22
|
+
*
|
|
23
|
+
* This comment used to say the service did not need the build. It cost an afternoon: a fix to
|
|
24
|
+
* `models/client.ts` was committed, the agent restarted, the identical failure reproduced, and
|
|
25
|
+
* the code looked wrong when it was merely not loaded. `vitest` imports `./client.ts` directly,
|
|
26
|
+
* so the tests passed throughout and proved nothing about what was running.
|
|
27
|
+
* 2. Restart the `dev.akno` launchd agent, which holds the index, the watcher and the models, and
|
|
28
|
+
* outlives every host that talks to it. A built change reaches it only here.
|
|
29
|
+
*
|
|
30
|
+
* Then it **waits for the socket**. `launchctl kickstart` returns as soon as launchd has spawned the
|
|
31
|
+
* process, not when the process is listening — so the obvious next command fails with "no Akno
|
|
32
|
+
* service at …", which reads like a broken deploy rather than an impatient one. A normal start gets
|
|
33
|
+
* a 30-second fast path. If launchd says the replacement is still running, redeploy keeps waiting up
|
|
34
|
+
* to a bounded three minutes instead of reporting a false failure during a slow live handoff.
|
|
35
|
+
*
|
|
36
|
+
* akno redeploy
|
|
37
|
+
* akno redeploy --no-build # restart only
|
|
38
|
+
* akno redeploy --no-restart # build only, for a host that has no service installed
|
|
39
|
+
*/
|
|
40
|
+
const REDEPLOY_HELP = `akno redeploy [options]
|
|
41
|
+
|
|
42
|
+
Apply local changes: build, then restart the service, then wait for its socket.
|
|
43
|
+
|
|
44
|
+
The build is not optional for the service either: launchd runs the CLI's TypeScript
|
|
45
|
+
directly, but core reaches it as @tenphi/akno-core, whose exports point at dist. A change
|
|
46
|
+
under packages/core is invisible to a restarted service until it is built.
|
|
47
|
+
|
|
48
|
+
Hosts need it for their own reason — anything importing @tenphi/akno-client imports
|
|
49
|
+
packages/*/dist, and skipping it is how a host ends up calling an op registry one
|
|
50
|
+
version behind.
|
|
51
|
+
|
|
52
|
+
--no-build Restart only.
|
|
53
|
+
--no-restart Build only. For a checkout with no service installed.
|
|
54
|
+
--timeout <s> Hard socket deadline. By default wait 30s, then up to 180s
|
|
55
|
+
while the launchd replacement is still running.
|
|
56
|
+
--json`;
|
|
57
|
+
const LABEL = 'dev.akno';
|
|
58
|
+
const DEFAULT_FAST_SOCKET_WAIT_MS = 30_000;
|
|
59
|
+
const DEFAULT_MAX_SOCKET_WAIT_MS = 180_000;
|
|
60
|
+
/** An explicit timeout is a hard operator choice; the default has a fast and slow handoff tier. */
|
|
61
|
+
export function redeployWaitPolicy(timeoutSeconds) {
|
|
62
|
+
if (timeoutSeconds !== undefined) {
|
|
63
|
+
const seconds = Number(timeoutSeconds);
|
|
64
|
+
if (!Number.isFinite(seconds) || seconds <= 0) {
|
|
65
|
+
throw new AknoError('invalid', '--timeout must be a positive number of seconds');
|
|
66
|
+
}
|
|
67
|
+
const milliseconds = Math.max(1, seconds) * 1000;
|
|
68
|
+
return { fastMs: milliseconds, maximumMs: milliseconds };
|
|
69
|
+
}
|
|
70
|
+
return { fastMs: DEFAULT_FAST_SOCKET_WAIT_MS, maximumMs: DEFAULT_MAX_SOCKET_WAIT_MS };
|
|
71
|
+
}
|
|
72
|
+
/** Content-safe launchctl output parser used only after the fast socket deadline expires. */
|
|
73
|
+
export function launchdServiceIsRunning(output) {
|
|
74
|
+
return /^\s*state = running\s*$/m.test(output) && /^\s*pid = \d+\s*$/m.test(output);
|
|
75
|
+
}
|
|
76
|
+
/** A pre-restart listener is not evidence that the replacement is ready. */
|
|
77
|
+
export function socketWasReplaced(previous, current) {
|
|
78
|
+
if (!current)
|
|
79
|
+
return false;
|
|
80
|
+
if (!previous)
|
|
81
|
+
return true;
|
|
82
|
+
return (current.device !== previous.device ||
|
|
83
|
+
current.inode !== previous.inode ||
|
|
84
|
+
current.changedAtMs !== previous.changedAtMs);
|
|
85
|
+
}
|
|
86
|
+
export function redeployPlan(input) {
|
|
87
|
+
if (!input.restart)
|
|
88
|
+
return { build: input.build, restart: false, skipped: 'asked' };
|
|
89
|
+
if (!input.darwin)
|
|
90
|
+
return { build: input.build, restart: false, skipped: 'not-darwin' };
|
|
91
|
+
if (!input.serviceInstalled)
|
|
92
|
+
return { build: input.build, restart: false, skipped: 'no-service' };
|
|
93
|
+
return { build: input.build, restart: true, skipped: null };
|
|
94
|
+
}
|
|
95
|
+
const SKIP_NOTE = {
|
|
96
|
+
asked: 'the service was left alone',
|
|
97
|
+
'not-darwin': 'restarting a service is macOS-only for now — restart it yourself',
|
|
98
|
+
'no-service': `no service installed (${LABEL}) — nothing to restart. \`akno service install\` sets one up.`,
|
|
99
|
+
};
|
|
100
|
+
export async function redeployCommand(argv) {
|
|
101
|
+
const { values } = parse(argv, {
|
|
102
|
+
build: { type: 'boolean', default: true },
|
|
103
|
+
restart: { type: 'boolean', default: true },
|
|
104
|
+
timeout: { type: 'string' },
|
|
105
|
+
});
|
|
106
|
+
if (values.help) {
|
|
107
|
+
line(REDEPLOY_HELP);
|
|
108
|
+
return 0;
|
|
109
|
+
}
|
|
110
|
+
const result = { built: false, restarted: false, socket: null, ready: false };
|
|
111
|
+
// ── Build ─────────────────────────────────────────────────────────────────
|
|
112
|
+
if (values.build) {
|
|
113
|
+
const root = repoRoot();
|
|
114
|
+
if (!root) {
|
|
115
|
+
fail(values.json, result, 'cannot find the repo root — run this from inside an Akno checkout');
|
|
116
|
+
return 1;
|
|
117
|
+
}
|
|
118
|
+
if (!values.json)
|
|
119
|
+
heading('building');
|
|
120
|
+
const build = spawnSync('pnpm', ['run', 'build'], {
|
|
121
|
+
cwd: root,
|
|
122
|
+
stdio: values.json ? 'pipe' : 'inherit',
|
|
123
|
+
encoding: 'utf8',
|
|
124
|
+
});
|
|
125
|
+
if (build.status !== 0) {
|
|
126
|
+
// Nothing is restarted after a failed build. Restarting anyway would put the *old* code back
|
|
127
|
+
// into service and report success, which is the one outcome worse than stopping.
|
|
128
|
+
fail(values.json, result, `build failed (exit ${build.status ?? 'unknown'})${buildTail(build.stderr)}`);
|
|
129
|
+
return 1;
|
|
130
|
+
}
|
|
131
|
+
result.built = true;
|
|
132
|
+
}
|
|
133
|
+
// ── Restart ───────────────────────────────────────────────────────────────
|
|
134
|
+
const { loadConfig } = await import('@tenphi/akno-core');
|
|
135
|
+
const config = loadConfig(openOptionsFrom(values));
|
|
136
|
+
result.socket = config.socketPath;
|
|
137
|
+
const plist = path.join(process.env.HOME ?? '', 'Library', 'LaunchAgents', `${LABEL}.plist`);
|
|
138
|
+
const plan = redeployPlan({
|
|
139
|
+
build: values.build,
|
|
140
|
+
restart: values.restart,
|
|
141
|
+
darwin: process.platform === 'darwin',
|
|
142
|
+
serviceInstalled: fs.existsSync(plist),
|
|
143
|
+
});
|
|
144
|
+
if (plan.skipped) {
|
|
145
|
+
result.ready = await socketAcceptsConnections(config.socketPath);
|
|
146
|
+
report(values.json, result, SKIP_NOTE[plan.skipped]);
|
|
147
|
+
return 0;
|
|
148
|
+
}
|
|
149
|
+
const previousSocket = socketIdentity(config.socketPath);
|
|
150
|
+
if (!values.json)
|
|
151
|
+
heading('restarting');
|
|
152
|
+
const kick = spawnSync('launchctl', ['kickstart', '-k', `gui/${process.getuid?.() ?? ''}/${LABEL}`], {
|
|
153
|
+
stdio: values.json ? 'pipe' : 'inherit',
|
|
154
|
+
encoding: 'utf8',
|
|
155
|
+
});
|
|
156
|
+
if (kick.status !== 0) {
|
|
157
|
+
fail(values.json, result, `launchctl kickstart failed (exit ${kick.status ?? 'unknown'})${buildTail(kick.stderr)}`);
|
|
158
|
+
return 1;
|
|
159
|
+
}
|
|
160
|
+
result.restarted = true;
|
|
161
|
+
// ── Wait ──────────────────────────────────────────────────────────────────
|
|
162
|
+
const waitPolicy = redeployWaitPolicy(values.timeout);
|
|
163
|
+
result.ready = await waitForSocket(config.socketPath, waitPolicy.fastMs, previousSocket);
|
|
164
|
+
let waitedMs = waitPolicy.fastMs;
|
|
165
|
+
if (!result.ready && waitPolicy.maximumMs > waitPolicy.fastMs && launchdReplacementIsRunning()) {
|
|
166
|
+
if (!values.json) {
|
|
167
|
+
line(style.grey(`replacement is still starting after ${waitPolicy.fastMs / 1000}s; ` +
|
|
168
|
+
`waiting up to ${waitPolicy.maximumMs / 1000}s`));
|
|
169
|
+
}
|
|
170
|
+
result.ready = await waitForSocket(config.socketPath, waitPolicy.maximumMs - waitPolicy.fastMs, previousSocket);
|
|
171
|
+
waitedMs = waitPolicy.maximumMs;
|
|
172
|
+
}
|
|
173
|
+
if (!result.ready) {
|
|
174
|
+
// The restart happened; the process did not come up. Reported as a failure rather than a
|
|
175
|
+
// success with a caveat, because everything the caller does next will fail.
|
|
176
|
+
fail(values.json, result, `restarted, but nothing is listening on ${config.socketPath} after ${waitedMs / 1000}s — ` +
|
|
177
|
+
'check `akno service status` and the log');
|
|
178
|
+
return 1;
|
|
179
|
+
}
|
|
180
|
+
report(values.json, result, null);
|
|
181
|
+
return 0;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Readiness requires a replacement socket that accepts connections. Existence alone can be the
|
|
185
|
+
* outgoing service's still-live path during a launchd handoff.
|
|
186
|
+
*/
|
|
187
|
+
async function waitForSocket(socketPath, timeoutMs, previous) {
|
|
188
|
+
const deadline = Date.now() + timeoutMs;
|
|
189
|
+
while (Date.now() < deadline) {
|
|
190
|
+
if (socketWasReplaced(previous, socketIdentity(socketPath)) &&
|
|
191
|
+
(await socketAcceptsConnections(socketPath))) {
|
|
192
|
+
return true;
|
|
193
|
+
}
|
|
194
|
+
await new Promise((resolve) => setTimeout(resolve, 200));
|
|
195
|
+
}
|
|
196
|
+
return (socketWasReplaced(previous, socketIdentity(socketPath)) && (await socketAcceptsConnections(socketPath)));
|
|
197
|
+
}
|
|
198
|
+
function socketIdentity(socketPath) {
|
|
199
|
+
try {
|
|
200
|
+
const stat = fs.statSync(socketPath);
|
|
201
|
+
if (!stat.isSocket())
|
|
202
|
+
return null;
|
|
203
|
+
return { device: stat.dev, inode: stat.ino, changedAtMs: stat.ctimeMs };
|
|
204
|
+
}
|
|
205
|
+
catch {
|
|
206
|
+
return null;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
async function socketAcceptsConnections(socketPath) {
|
|
210
|
+
if (!fs.existsSync(socketPath))
|
|
211
|
+
return false;
|
|
212
|
+
const socket = net.createConnection(socketPath);
|
|
213
|
+
try {
|
|
214
|
+
await once(socket, 'connect', { signal: AbortSignal.timeout(500) });
|
|
215
|
+
return true;
|
|
216
|
+
}
|
|
217
|
+
catch {
|
|
218
|
+
return false;
|
|
219
|
+
}
|
|
220
|
+
finally {
|
|
221
|
+
socket.destroy();
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
function launchdReplacementIsRunning() {
|
|
225
|
+
const inspected = spawnSync('launchctl', ['print', `gui/${process.getuid?.() ?? ''}/${LABEL}`], {
|
|
226
|
+
encoding: 'utf8',
|
|
227
|
+
});
|
|
228
|
+
return inspected.status === 0 && launchdServiceIsRunning(inspected.stdout ?? '');
|
|
229
|
+
}
|
|
230
|
+
/** Walks up for the workspace marker, so this works from any directory in the checkout. */
|
|
231
|
+
function repoRoot() {
|
|
232
|
+
let dir = import.meta.dirname;
|
|
233
|
+
for (let i = 0; i < 12; i++) {
|
|
234
|
+
if (fs.existsSync(path.join(dir, 'pnpm-workspace.yaml')))
|
|
235
|
+
return dir;
|
|
236
|
+
const parent = path.dirname(dir);
|
|
237
|
+
if (parent === dir)
|
|
238
|
+
return null;
|
|
239
|
+
dir = parent;
|
|
240
|
+
}
|
|
241
|
+
return null;
|
|
242
|
+
}
|
|
243
|
+
function buildTail(stderr) {
|
|
244
|
+
const tail = (stderr ?? '').trim().split('\n').slice(-3).join('\n');
|
|
245
|
+
return tail ? `\n${tail}` : '';
|
|
246
|
+
}
|
|
247
|
+
function report(asJson, result, note) {
|
|
248
|
+
if (note)
|
|
249
|
+
result.note = note;
|
|
250
|
+
if (asJson) {
|
|
251
|
+
json({ ok: true, ...result });
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
line();
|
|
255
|
+
kv([
|
|
256
|
+
['built', result.built ? 'yes' : 'skipped'],
|
|
257
|
+
['restarted', result.restarted ? LABEL : 'no'],
|
|
258
|
+
['socket', result.ready ? `${result.socket} (up)` : (result.socket ?? null)],
|
|
259
|
+
]);
|
|
260
|
+
if (note)
|
|
261
|
+
line(style.grey(`\n ${note}`));
|
|
262
|
+
}
|
|
263
|
+
function fail(asJson, result, message) {
|
|
264
|
+
if (asJson) {
|
|
265
|
+
json({ ok: false, ...result, error: message });
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
line(`\n${style.red('redeploy failed')} ${message}`);
|
|
269
|
+
}
|
|
270
|
+
//# sourceMappingURL=redeploy-cmd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redeploy-cmd.js","sourceRoot":"","sources":["../../src/commands/redeploy-cmd.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAE9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;SAgBb,CAAC;AAEV,MAAM,KAAK,GAAG,UAAU,CAAC;AACzB,MAAM,2BAA2B,GAAG,MAAM,CAAC;AAC3C,MAAM,0BAA0B,GAAG,OAAO,CAAC;AAO3C,mGAAmG;AACnG,MAAM,UAAU,kBAAkB,CAAC,cAAuB;IACxD,IAAI,cAAc,KAAK,SAAS,EAAE,CAAC;QACjC,MAAM,OAAO,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;QACvC,IAAI,CAAC,M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AE,CAAC,CAAC;QAC9B,OAAO;IACT,CAAC;IACD,IAAI,EAAE,CAAC;IACP,EAAE,CAAC;QACD,CAAC,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;QAC3C,CAAC,WAAW,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;QAC9C,CAAC,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC;KAC7E,CAAC,CAAC;IACH,IAAI,IAAI;QAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC;AAC5C,CAAC;AAED,SAAS,IAAI,CAAC,MAA2B,EAAE,MAAc,EAAE,OAAe;IACxE,IAAI,MAAM,EAAE,CAAC;QACX,IAAI,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;QAC/C,OAAO;IACT,CAAC;IACD,IAAI,CAAC,KAAK,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,KAAK,OAAO,EAAE,CAAC,CAAC;AACxD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rules-cmd.d.ts","sourceRoot":"","sources":["../../src/commands/rules-cmd.ts"],"names":[],"mappings":"AAYA,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAiElE"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { openOptionsFrom, parse } from "../args.js";
|
|
2
|
+
import { heading, json, kv, line, style } from "../output.js";
|
|
3
|
+
import { open } from '@tenphi/akno-core';
|
|
4
|
+
import { printMaintenancePathPolicy } from "./maintenance-policy-output.js";
|
|
5
|
+
const RULES_HELP = `akno rules [path]
|
|
6
|
+
|
|
7
|
+
With a path: which rule governs it, why, and the resulting page-specific
|
|
8
|
+
maintenance authority. Without: every rule, most specific first. Specificity
|
|
9
|
+
comes from the shape of the glob, not from declaration order, so reordering
|
|
10
|
+
the config cannot change what applies.`;
|
|
11
|
+
export async function rulesCommand(argv) {
|
|
12
|
+
const { values, positionals } = parse(argv);
|
|
13
|
+
if (values.help) {
|
|
14
|
+
line(RULES_HELP);
|
|
15
|
+
return 0;
|
|
16
|
+
}
|
|
17
|
+
const mem = await open({ ...openOptionsFrom(values), writable: false });
|
|
18
|
+
try {
|
|
19
|
+
if (positionals.length === 0) {
|
|
20
|
+
const rules = mem.config.rules;
|
|
21
|
+
if (values.json) {
|
|
22
|
+
json({ gate: mem.config.gate, rules });
|
|
23
|
+
return 0;
|
|
24
|
+
}
|
|
25
|
+
heading(`${rules.length} rule${rules.length === 1 ? '' : 's'} ${style.grey(`gate=${mem.config.gate}`)}`);
|
|
26
|
+
if (rules.length === 0) {
|
|
27
|
+
line(style.grey(' none — every page defaults to searchable `knowledge`, with fact injection denied.'));
|
|
28
|
+
return 0;
|
|
29
|
+
}
|
|
30
|
+
const width = Math.max(...rules.map((r) => r.glob.length));
|
|
31
|
+
for (const rule of rules) {
|
|
32
|
+
const fields = Object.entries(rule)
|
|
33
|
+
// `description` is a sentence, not a setting. Inline it and the column alignment
|
|
34
|
+
// that makes this list scannable is gone; it gets its own line below instead.
|
|
35
|
+
.filter(([key]) => !['glob', 'source', 'specificity', 'description'].includes(key))
|
|
36
|
+
.map(([key, value]) => `${key}=${String(value)}`)
|
|
37
|
+
.join(' ');
|
|
38
|
+
line(` ${rule.glob.padEnd(width)} ${fields} ${style.grey(rule.source)}`);
|
|
39
|
+
if (rule.description)
|
|
40
|
+
line(` ${' '.repeat(width)} ${style.grey(rule.description)}`);
|
|
41
|
+
}
|
|
42
|
+
return 0;
|
|
43
|
+
}
|
|
44
|
+
const slug = positionals[0].replace(/\.(md|markdown)$/i, '');
|
|
45
|
+
const result = mem.rules(slug);
|
|
46
|
+
const maintenance = mem.maintenancePolicy(positionals[0]);
|
|
47
|
+
if (values.json) {
|
|
48
|
+
json({ slug, ...result, maintenance });
|
|
49
|
+
return 0;
|
|
50
|
+
}
|
|
51
|
+
heading(slug);
|
|
52
|
+
const entries = Object.entries(result.effective);
|
|
53
|
+
if (entries.length === 0) {
|
|
54
|
+
line(style.grey(' no rule matches — defaults apply: role=knowledge, remember=deny, dream=none'));
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
kv(entries.map(([key, value]) => [key, String(value)]));
|
|
58
|
+
}
|
|
59
|
+
if (result.candidates.length > 0) {
|
|
60
|
+
line(`\n ${style.grey('matched, most specific first:')}`);
|
|
61
|
+
for (const candidate of result.candidates) {
|
|
62
|
+
line(` ${candidate.glob} ${style.grey(candidate.source)}`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
printMaintenancePathPolicy(maintenance);
|
|
66
|
+
return 0;
|
|
67
|
+
}
|
|
68
|
+
finally {
|
|
69
|
+
await mem.close();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=rules-cmd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rules-cmd.js","sourceRoot":"","sources":["../../src/commands/rules-cmd.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AAE5E,MAAM,UAAU,GAAG;;;;;yCAKsB,CAAC;AAE1C,MAAM,CAAC,KAAK,UAAU,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M,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACjD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACzB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,+EAA+E,CAAC,CAAC,CAAC;QACpG,CAAC;aAAM,CAAC;YACN,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1D,CAAC;QACD,IAAI,MAAM,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACjC,IAAI,CAAC,OAAO,KAAK,CAAC,IAAI,CAAC,+BAA+B,CAAC,EAAE,CAAC,CAAC;YAC3D,KAAK,MAAM,SAAS,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;gBAC1C,IAAI,CAAC,OAAO,SAAS,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YACjE,CAAC;QACH,CAAC;QACD,0BAA0B,CAAC,WAAW,CAAC,CAAC;QACxC,OAAO,CAAC,CAAC;IACX,CAAC;YAAS,CAAC;QACT,MAAM,GAAG,CAAC,KAAK,EAAE,CAAC;IACpB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare function serveCommand(argv: string[]): Promise<number>;
|
|
2
|
+
export declare function serviceCommand(argv: string[]): Promise<number>;
|
|
3
|
+
export declare function serviceTargetArgs(values: {
|
|
4
|
+
'akno-path'?: string;
|
|
5
|
+
'state-dir'?: string;
|
|
6
|
+
}): string[];
|
|
7
|
+
export interface PlistOptions {
|
|
8
|
+
label: string;
|
|
9
|
+
node: string;
|
|
10
|
+
script: string;
|
|
11
|
+
args: string[];
|
|
12
|
+
logDir: string;
|
|
13
|
+
/** Log basename, so the nightly cycle does not interleave with the service's log. */
|
|
14
|
+
logName?: string;
|
|
15
|
+
/** The service: restarted whenever it stops. */
|
|
16
|
+
keepAlive?: boolean;
|
|
17
|
+
/** The nightly cycle: run once a day at this hour. */
|
|
18
|
+
calendarHour?: number;
|
|
19
|
+
calendarMinute?: number;
|
|
20
|
+
}
|
|
21
|
+
/** Exported for exact scheduler fixture tests; service installation is the only production caller. */
|
|
22
|
+
export declare function plist(options: PlistOptions): string;
|
|
23
|
+
//# sourceMappingURL=serve-cmd.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serve-cmd.d.ts","sourceRoot":"","sources":["../../src/commands/serve-cmd.ts"],"names":[],"mappings":"AA2BA,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAuIlE;AAgFD,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAgJpE;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE;IAAE,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,EAAE,CAKlG;AAYD,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,qFAAqF;IACrF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gDAAgD;IAChD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,sDAAsD;IACtD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,sGAAsG;AACtG,wBAAgB,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM,CA0BnD"}
|