@arshdelight/practi 0.18.0 → 0.20.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/README.md +79 -136
- package/dist/client.js +6 -6
- package/dist/client.js.map +1 -1
- package/dist/cmd/blob.js +21 -24
- package/dist/cmd/blob.js.map +1 -1
- package/dist/cmd/branch.js +5 -7
- package/dist/cmd/branch.js.map +1 -1
- package/dist/cmd/clone.js +29 -23
- package/dist/cmd/clone.js.map +1 -1
- package/dist/cmd/commit.js +97 -0
- package/dist/cmd/commit.js.map +1 -0
- package/dist/cmd/config.js +1 -17
- package/dist/cmd/config.js.map +1 -1
- package/dist/cmd/edit.js +18 -4
- package/dist/cmd/edit.js.map +1 -1
- package/dist/cmd/embed.js +30 -25
- package/dist/cmd/embed.js.map +1 -1
- package/dist/cmd/export.js +43 -0
- package/dist/cmd/export.js.map +1 -0
- package/dist/cmd/fix.js +9 -153
- package/dist/cmd/fix.js.map +1 -1
- package/dist/cmd/gc.js +6 -5
- package/dist/cmd/gc.js.map +1 -1
- package/dist/cmd/history.js +73 -70
- package/dist/cmd/history.js.map +1 -1
- package/dist/cmd/init.js +10 -5
- package/dist/cmd/init.js.map +1 -1
- package/dist/cmd/lint.js +23 -20
- package/dist/cmd/lint.js.map +1 -1
- package/dist/cmd/log.js +2 -4
- package/dist/cmd/log.js.map +1 -1
- package/dist/cmd/merge.js +13 -10
- package/dist/cmd/merge.js.map +1 -1
- package/dist/cmd/new.js +56 -54
- package/dist/cmd/new.js.map +1 -1
- package/dist/cmd/note.js +27 -42
- package/dist/cmd/note.js.map +1 -1
- package/dist/cmd/pull.js +17 -13
- package/dist/cmd/pull.js.map +1 -1
- package/dist/cmd/push.js +27 -12
- package/dist/cmd/push.js.map +1 -1
- package/dist/cmd/search.js +30 -44
- package/dist/cmd/search.js.map +1 -1
- package/dist/cmd/show.js +5 -4
- package/dist/cmd/show.js.map +1 -1
- package/dist/cmd/similar.js +7 -20
- package/dist/cmd/similar.js.map +1 -1
- package/dist/cmd/skill.js +16 -16
- package/dist/cmd/skill.js.map +1 -1
- package/dist/cmd/switch.js +11 -6
- package/dist/cmd/switch.js.map +1 -1
- package/dist/index.js +245 -447
- package/dist/index.js.map +1 -1
- package/dist/practice.js +120 -97
- package/dist/practice.js.map +1 -1
- package/dist/quality.js +2 -2
- package/dist/quality.js.map +1 -1
- package/dist/state.js +13 -73
- package/dist/state.js.map +1 -1
- package/dist/sync.js +6 -48
- package/dist/sync.js.map +1 -1
- package/dist/web.js +259 -481
- package/dist/web.js.map +1 -1
- package/dist/workspace.js +10 -52
- package/dist/workspace.js.map +1 -1
- package/package.json +1 -1
- package/skills/use-practi/SKILL.md +123 -125
- package/web-default/chain.html +39 -0
- package/web-default/chain.js +56 -0
- package/web-default/detail.js +11 -8
- package/web-default/home.html +36 -0
- package/web-default/home.js +49 -0
- package/web-default/lang.js +17 -23
- package/web-default/style.css +1 -1
- package/web-default/app.js +0 -132
- package/web-default/index.html +0 -28
package/dist/index.js
CHANGED
|
@@ -3,12 +3,10 @@ import { parseArgs } from 'node:util';
|
|
|
3
3
|
import { PracticeError } from '@arshdelight/pop-sdk';
|
|
4
4
|
import { runInit } from './cmd/init.js';
|
|
5
5
|
import { runConfig } from './cmd/config.js';
|
|
6
|
-
import { runRepair } from './cmd/repair.js';
|
|
7
|
-
import { runMigrate } from './cmd/migrate.js';
|
|
8
|
-
import { runLs } from './cmd/ls.js';
|
|
9
6
|
import { runLint } from './cmd/lint.js';
|
|
10
7
|
import { runNew } from './cmd/new.js';
|
|
11
|
-
import {
|
|
8
|
+
import { runCommit } from './cmd/commit.js';
|
|
9
|
+
import { runExport } from './cmd/export.js';
|
|
12
10
|
import { runGc } from './cmd/gc.js';
|
|
13
11
|
import { runShow } from './cmd/show.js';
|
|
14
12
|
import { runWeb } from './web.js';
|
|
@@ -17,20 +15,15 @@ import { runSearch } from './cmd/search.js';
|
|
|
17
15
|
import { runSimilar } from './cmd/similar.js';
|
|
18
16
|
import { runEmbed } from './cmd/embed.js';
|
|
19
17
|
import { runNote } from './cmd/note.js';
|
|
20
|
-
import {
|
|
21
|
-
import { runClaim, runUnclaim } from './cmd/claim.js';
|
|
18
|
+
import { runSkill } from './cmd/skill.js';
|
|
22
19
|
import { runFix } from './cmd/fix.js';
|
|
23
20
|
import { runUpdate } from './cmd/update.js';
|
|
24
21
|
import { runSpec } from './cmd/spec.js';
|
|
25
|
-
import { runSkill } from './cmd/skill.js';
|
|
26
22
|
import { runLogin, runLogout, runMe } from './cmd/login.js';
|
|
27
23
|
import { runRemote } from './cmd/remote.js';
|
|
28
24
|
import { runPush } from './cmd/push.js';
|
|
29
25
|
import { runPull } from './cmd/pull.js';
|
|
30
26
|
import { runClone } from './cmd/clone.js';
|
|
31
|
-
import { runFetch } from './cmd/fetch.js';
|
|
32
|
-
import { runPractice } from './cmd/practice.js';
|
|
33
|
-
import { runPublish } from './cmd/publish.js';
|
|
34
27
|
import { runHistory } from './cmd/history.js';
|
|
35
28
|
import { runBranch } from './cmd/branch.js';
|
|
36
29
|
import { runSwitch } from './cmd/switch.js';
|
|
@@ -42,122 +35,71 @@ function printVersion() {
|
|
|
42
35
|
console.log(`pop-spec ${POP_SPEC_VERSION} (via @arshdelight/pop-sdk)`);
|
|
43
36
|
return 0;
|
|
44
37
|
}
|
|
45
|
-
const USAGE = `practi —
|
|
38
|
+
const USAGE = `practi — practice folders for POP (Protocol of Practice), with a practihub bridge
|
|
39
|
+
|
|
40
|
+
a practice is a self-contained folder:
|
|
41
|
+
<name>.json the pop — a plain document, edit it with any editor
|
|
42
|
+
.practi/ the history (like .git): chain.json (commits + branches)
|
|
43
|
+
and the content-addressed pool of every revision
|
|
46
44
|
|
|
47
|
-
usage:
|
|
48
|
-
practi
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
practi
|
|
45
|
+
usage (run inside a practice folder unless noted):
|
|
46
|
+
practi new <name> [--base <file.json>] [-m <msg>] birth a practice folder in cwd;
|
|
47
|
+
--base seeds the first revision from a pop document
|
|
48
|
+
(hub-side copy is born by the first push)
|
|
49
|
+
practi commit [-m <msg>] [--amend] snapshot the working file as a new revision
|
|
50
|
+
(local only; nothing to commit when it matches the
|
|
51
|
+
head; --amend replaces the head instead)
|
|
52
|
+
practi export <hash> [-o <file>] write any revision back out as a document
|
|
53
|
+
(the current one is the working file already)
|
|
54
|
+
practi push [--force] sync the practice to the hub (first push creates it;
|
|
55
|
+
divergence errors, --force overwrites and the hub
|
|
56
|
+
drops unreachable objects)
|
|
57
|
+
practi pull reconcile with the hub: fetch missing revisions,
|
|
58
|
+
fast-forward the branch, update the working file
|
|
55
59
|
practi clone <owner>/<name>[@branch] [--dir <path>]
|
|
56
|
-
clone a hub practice into a local practice
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
practi
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
[--message <text>] [--keep] practice; the practice keeps its own history
|
|
64
|
-
practi embed status|pull|build|prune optional offline vector model (bge-small-zh-v1.5,
|
|
65
|
-
~24MB int8 ONNX). pull fetches it, build embeds every
|
|
66
|
-
stored node (incrementally), status reports coverage.
|
|
67
|
-
Nothing here is required: without a model practi is
|
|
68
|
-
lexical-only, and search --semantic says so
|
|
69
|
-
practi gc [--apply] free orphan blobs — attachment bytes on disk that no
|
|
70
|
-
stored node references (dry-run by default; --apply removes)
|
|
71
|
-
practi fetch <owner>/<name> <hash>
|
|
72
|
-
pull one revision of that instance into your local registry
|
|
73
|
-
(direct; full sha256 hash — no prefix guessing). Content
|
|
74
|
-
access is repo-scoped: public instances are fetchable by
|
|
75
|
-
anyone, private ones only by their owners
|
|
76
|
-
practi fix <file.json> | <hash> | --all
|
|
77
|
-
migrate POP 1.x documents to 2.0: strip the removed history
|
|
78
|
-
fields (revisions/refines), re-validate, report the new hash.
|
|
79
|
-
<hash> re-stores a workspace node and re-binds direct/claims;
|
|
80
|
-
--all sweeps every direct pop; --dry-run previews
|
|
81
|
-
practi history amend [<pop|file>] [-m <msg>] | reword <seq> -m <msg>
|
|
82
|
-
| practi history squash <seq> | drop <seq> | reset <seq>
|
|
83
|
-
rewrite the practice's local commit chain (git-style);
|
|
84
|
-
push reconciles with the hub — divergence needs --force
|
|
85
|
-
practi instance … RETIRED: practice new <name> creates a local
|
|
86
|
-
practice (the hub copy is born by the first push);
|
|
87
|
-
commands locate it by cwd / --dir / --practice
|
|
60
|
+
clone a hub practice into a local practice folder
|
|
61
|
+
practi branch [name] [-d <name>] [--from <hash>]
|
|
62
|
+
list / create / delete branches (* marks the current one)
|
|
63
|
+
practi switch <branch> switch branches (working file follows the head; refuses
|
|
64
|
+
when it has uncommitted changes)
|
|
65
|
+
practi merge <branch> fast-forward, else a pointer move (same-tree commits
|
|
66
|
+
are identical)
|
|
88
67
|
practi log [--branch <b>] [--limit N] [--json]
|
|
89
|
-
the
|
|
90
|
-
practi
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
practi
|
|
97
|
-
practi
|
|
98
|
-
practi
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
practi
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
practi
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
practi
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
practi pull [--dir <path> | --practice <name>]
|
|
118
|
-
reconcile the practice with the hub: fetch missing
|
|
119
|
-
revisions, fast-forward the branch pointer
|
|
120
|
-
practi remote set <url> | remove point practi at a hub (no implicit default; hub commands
|
|
121
|
-
need a remote)
|
|
122
|
-
practi remove <hash> take a direct pop out of the local directory (registry op;
|
|
123
|
-
GCs nodes unreachable from the rest — shared indirect nodes survive)
|
|
124
|
-
practi repair backfill missing claim timestamps from node file times
|
|
125
|
-
(idempotent; stamped claims are never touched)
|
|
126
|
-
practi search [query...] search the local workspace: every stored node is
|
|
127
|
-
[--limit N] [--json] indexed (name / description / content / declared
|
|
128
|
-
[--notes] [--semantic] inputs+outputs / loop prose), ranked title-first, each hit
|
|
129
|
-
showing why it was recalled. Multiple words are AND (each
|
|
130
|
-
must match, possibly in a different field); field:value
|
|
131
|
-
scopes one word. Pure-hex queries also match hash prefixes.
|
|
132
|
-
--notes also indexes local notes; --semantic fuses vector
|
|
133
|
-
recall (needs practi embed pull + embed build first, else
|
|
134
|
-
it says so and is ignored). Empty query = browse roots
|
|
135
|
-
practi show <hash> [--json] [--doc] inspect one node (hash prefix OK)
|
|
136
|
-
practi similar <hash> content neighbours of a node: same topic, other wording
|
|
137
|
-
[--limit N] [--json] (literal character-bigram similarity — no semantics;
|
|
138
|
-
the subtree is what gets compared)
|
|
139
|
-
practi skill install install the bundled use-practi skill (default: ~/.agents/skills)
|
|
140
|
-
practi skill update refresh the installed use-practi skill (--dir to override)
|
|
141
|
-
practi skill uninstall remove the installed use-practi skill
|
|
142
|
-
practi skill import <dir> replay a practi skill export directory back into a POP (sidecar required;
|
|
143
|
-
foreign skills enter POP by authoring, not import)
|
|
144
|
-
practi skill export <ref> [--dir] project a POP as an installable skill directory (SKILL.md + sidecar)
|
|
145
|
-
practi spec print pop-spec.md (bundled with the SDK; no network)
|
|
146
|
-
practi switch <branch> switch the bound instance's current branch (local pointer;
|
|
147
|
-
bring the content into the workspace with 'practi pull')
|
|
148
|
-
practi unclaim <hash> take a referenced direct pop back to indirect (fails when
|
|
149
|
-
unreferenced — that would orphan it; delete with "remove")
|
|
150
|
-
practi update self-update via npm (checks the registry's latest)
|
|
151
|
-
practi version | --version show CLI + pop-spec versions
|
|
152
|
-
practi web [--port 4317] [--no-open] browse direct pops in a local web UI
|
|
68
|
+
the commit history (tip first)
|
|
69
|
+
practi history reword <seq> -m <msg> | squash <seq> | drop <seq> | reset <seq>
|
|
70
|
+
rewrite the local commit chain (git-style);
|
|
71
|
+
push reconciles with the hub — divergence needs --force
|
|
72
|
+
practi export is the read-back door; the working file is the write door
|
|
73
|
+
|
|
74
|
+
inside a practice folder also:
|
|
75
|
+
practi show <hash> [--json] [--doc] inspect one revision node (hash prefix OK)
|
|
76
|
+
practi search [query...] [--json] search this practice's revisions
|
|
77
|
+
practi note add|list|edit|delete local learning notes pinned to node hashes
|
|
78
|
+
(.practi/notes.json, never uploaded)
|
|
79
|
+
practi lint quality hints on the current branch head
|
|
80
|
+
practi blob add <file-or-url> store an attachment's bytes in the pool
|
|
81
|
+
practi gc [--apply] free orphan blobs (dry-run by default)
|
|
82
|
+
practi web [--port 4317] browse practices in a local web UI
|
|
83
|
+
(a practice folder serves it; anywhere
|
|
84
|
+
else serves the practices home)
|
|
85
|
+
|
|
86
|
+
anywhere:
|
|
87
|
+
practi init [path] create the config home (credentials + remote)
|
|
88
|
+
practi login [--no-open] OAuth sign-in to the hub (browser consent)
|
|
89
|
+
practi logout | me | remote set <url> | remove
|
|
90
|
+
practi config show config home and remote
|
|
91
|
+
practi fix <file.json> [--dry-run] migrate a POP 1.x document file to 2.0
|
|
92
|
+
practi spec print pop-spec.md (bundled with the SDK)
|
|
93
|
+
practi skill install | update | uninstall | import <dir> | export <ref>
|
|
94
|
+
practi update self-update via npm
|
|
95
|
+
practi version | --version show CLI + pop-spec versions
|
|
153
96
|
|
|
154
97
|
options:
|
|
155
|
-
--
|
|
98
|
+
--dir <path> target a practice folder from outside it
|
|
156
99
|
|
|
157
|
-
the
|
|
158
|
-
practi.json
|
|
159
|
-
|
|
160
|
-
'practi login' + 'practi remote set'.
|
|
100
|
+
the config home (default ~/.practi) keeps practi.json (remote) and
|
|
101
|
+
practi.auth.json (OAuth credentials) — practices themselves are plain
|
|
102
|
+
folders, wherever you keep your documents.
|
|
161
103
|
`;
|
|
162
104
|
const COMMON = {
|
|
163
105
|
'data-dir': { type: 'string' },
|
|
@@ -166,6 +108,25 @@ const COMMON = {
|
|
|
166
108
|
function str(v) {
|
|
167
109
|
return v;
|
|
168
110
|
}
|
|
111
|
+
/** 退役命令统一存根:说清去哪了 */
|
|
112
|
+
function retired(cmd) {
|
|
113
|
+
const pointers = {
|
|
114
|
+
edit: 'the working file IS the edit — open <name>.json with any editor, then `practi commit -m "..."`',
|
|
115
|
+
ls: 'practices are folders — use your file manager; `practi log` shows a practice\'s revisions',
|
|
116
|
+
list: 'practices are folders — browse them in your file manager',
|
|
117
|
+
remove: 'a practice folder is self-contained — deleting the folder removes the practice (the hub copy stays)',
|
|
118
|
+
claim: 'the pops registry retired — content lives in practice folders now',
|
|
119
|
+
unclaim: 'the pops registry retired — content lives in practice folders now',
|
|
120
|
+
publish: 'two steps now: `practi commit -m "..."` then `practi push`',
|
|
121
|
+
fetch: 'clone brings the full chain; fetch retired',
|
|
122
|
+
repair: 'the claims ledger retired — nothing to repair',
|
|
123
|
+
migrate: 'the config home is tiny — move the folder and point $PRACTI_HOME at it',
|
|
124
|
+
instance: 'retired by the practice-folder model (2026-10-20)',
|
|
125
|
+
practice: 'commands are flat now: `practi new <name>` / `practi log` / ... (the practice prefix retired)',
|
|
126
|
+
};
|
|
127
|
+
console.error(`\`practi ${cmd}\` was retired — ${pointers[cmd] ?? 'see practi --help'}`);
|
|
128
|
+
return 1;
|
|
129
|
+
}
|
|
169
130
|
async function main(argv) {
|
|
170
131
|
const cmd = argv[0] ?? 'help';
|
|
171
132
|
const rest = argv.slice(1);
|
|
@@ -176,19 +137,19 @@ async function main(argv) {
|
|
|
176
137
|
case 'gc': {
|
|
177
138
|
const { values } = parseArgs({
|
|
178
139
|
args: rest,
|
|
179
|
-
options: { ...COMMON, apply: { type: 'boolean' } },
|
|
140
|
+
options: { ...COMMON, apply: { type: 'boolean' }, dir: { type: 'string' } },
|
|
180
141
|
allowPositionals: true,
|
|
181
142
|
});
|
|
182
143
|
if (values.help) {
|
|
183
144
|
console.log('usage: practi gc [--apply] (free orphan blobs; dry-run by default)');
|
|
184
145
|
return 0;
|
|
185
146
|
}
|
|
186
|
-
return runGc({
|
|
147
|
+
return runGc({ dir: str(values.dir), apply: values.apply === true });
|
|
187
148
|
}
|
|
188
149
|
case 'init': {
|
|
189
150
|
const { values, positionals } = parseArgs({ args: rest, options: COMMON, allowPositionals: true });
|
|
190
151
|
if (values.help) {
|
|
191
|
-
console.log('usage: practi init [path]');
|
|
152
|
+
console.log('usage: practi init [path] (create the config home: credentials + remote)');
|
|
192
153
|
return 0;
|
|
193
154
|
}
|
|
194
155
|
return runInit({ dataDir: str(values['data-dir']), positional: positionals });
|
|
@@ -201,127 +162,62 @@ async function main(argv) {
|
|
|
201
162
|
}
|
|
202
163
|
return runConfig({ dataDir: str(values['data-dir']) });
|
|
203
164
|
}
|
|
204
|
-
case 'repair': {
|
|
205
|
-
const { values } = parseArgs({ args: rest, options: COMMON, allowPositionals: true });
|
|
206
|
-
if (values.help) {
|
|
207
|
-
console.log('usage: practi repair (backfill missing claim timestamps; idempotent)');
|
|
208
|
-
return 0;
|
|
209
|
-
}
|
|
210
|
-
return runRepair({ dataDir: str(values['data-dir']) });
|
|
211
|
-
}
|
|
212
|
-
case 'migrate': {
|
|
213
|
-
const { values, positionals } = parseArgs({
|
|
214
|
-
args: rest,
|
|
215
|
-
options: { ...COMMON, keep: { type: 'boolean' } },
|
|
216
|
-
allowPositionals: true,
|
|
217
|
-
});
|
|
218
|
-
if (values.help) {
|
|
219
|
-
console.log('usage: practi migrate [path] [--keep] (cut: the old directory is removed after per-file verification; --keep retains it as <dir>.bak-<timestamp>; no arg = ~/.practi, a path is recorded in ~/.practi-home as the default)');
|
|
220
|
-
return 0;
|
|
221
|
-
}
|
|
222
|
-
return runMigrate({ dataDir: str(values['data-dir']), positional: positionals, keep: values.keep === true });
|
|
223
|
-
}
|
|
224
165
|
case 'lint': {
|
|
225
166
|
const { values } = parseArgs({
|
|
226
167
|
args: rest,
|
|
227
|
-
options: { ...COMMON, json: { type: 'boolean' },
|
|
168
|
+
options: { ...COMMON, json: { type: 'boolean' }, dir: { type: 'string' } },
|
|
228
169
|
allowPositionals: true,
|
|
229
170
|
});
|
|
230
171
|
if (values.help) {
|
|
231
|
-
console.log('usage: practi lint
|
|
232
|
-
console.log(' audit recording quality across every direct pop: the same W_* hints');
|
|
233
|
-
console.log(' `practi new` prints once, but for the whole workspace, on demand.');
|
|
234
|
-
console.log(' read-only and never blocking (exit code is always 0) — it is a to-do');
|
|
235
|
-
console.log(' list, not a gate. --limit caps how many nodes are listed (default 20).');
|
|
172
|
+
console.log('usage: practi lint (quality hints on the current branch head; read-only, exit 0)');
|
|
236
173
|
return 0;
|
|
237
174
|
}
|
|
238
|
-
|
|
239
|
-
return runLint({
|
|
240
|
-
dataDir: str(values['data-dir']),
|
|
241
|
-
json: values.json === true,
|
|
242
|
-
limit: Number.isInteger(lintLimit) && lintLimit > 0 ? Math.min(lintLimit, 200) : 20,
|
|
243
|
-
});
|
|
175
|
+
return runLint({ dir: str(values.dir), json: values.json === true });
|
|
244
176
|
}
|
|
245
|
-
case '
|
|
177
|
+
case 'new': {
|
|
246
178
|
const { values, positionals } = parseArgs({
|
|
247
179
|
args: rest,
|
|
248
|
-
options: { ...COMMON,
|
|
180
|
+
options: { ...COMMON, base: { type: 'string' }, message: { type: 'string', short: 'm' }, dir: { type: 'string' } },
|
|
249
181
|
allowPositionals: true,
|
|
250
182
|
});
|
|
251
183
|
if (values.help) {
|
|
252
|
-
console.log('usage: practi
|
|
184
|
+
console.log('usage: practi new <name> [--base <file.json>] [-m <msg>] (birth a practice folder in cwd)');
|
|
253
185
|
return 0;
|
|
254
186
|
}
|
|
255
|
-
return
|
|
187
|
+
return await runNew({ positional: positionals, base: values.base, message: values.message });
|
|
256
188
|
}
|
|
257
|
-
case '
|
|
189
|
+
case 'commit': {
|
|
258
190
|
const { values, positionals } = parseArgs({
|
|
259
191
|
args: rest,
|
|
260
|
-
options: {
|
|
261
|
-
...COMMON,
|
|
262
|
-
message: { type: 'string', short: 'm' },
|
|
263
|
-
json: { type: 'boolean' },
|
|
264
|
-
out: { type: 'string' },
|
|
265
|
-
},
|
|
192
|
+
options: { ...COMMON, message: { type: 'string', short: 'm' }, amend: { type: 'boolean' }, dir: { type: 'string' } },
|
|
266
193
|
allowPositionals: true,
|
|
267
194
|
});
|
|
268
195
|
if (values.help) {
|
|
269
|
-
console.log('usage: practi
|
|
196
|
+
console.log('usage: practi commit [-m <msg>] [--amend] (snapshot the working file; local only)');
|
|
270
197
|
return 0;
|
|
271
198
|
}
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
message: values.message,
|
|
276
|
-
json: values.json === true,
|
|
277
|
-
out: values.out,
|
|
278
|
-
});
|
|
279
|
-
}
|
|
280
|
-
case 'new': {
|
|
281
|
-
const { values, positionals } = parseArgs({
|
|
282
|
-
args: rest,
|
|
283
|
-
options: {
|
|
284
|
-
...COMMON,
|
|
285
|
-
json: { type: 'string' },
|
|
286
|
-
file: { type: 'string' },
|
|
287
|
-
},
|
|
288
|
-
allowPositionals: true,
|
|
289
|
-
});
|
|
290
|
-
if (values.help) {
|
|
291
|
-
console.log('usage: practi new <file.json> | practi new --json \'<text>\' | practi new < file.json');
|
|
292
|
-
return 0;
|
|
199
|
+
if (positionals.length > 0) {
|
|
200
|
+
console.error('error: commit takes no arguments — the working file <name>.json is what gets committed');
|
|
201
|
+
return 1;
|
|
293
202
|
}
|
|
294
|
-
return await
|
|
203
|
+
return await runCommit({ positional: positionals, message: values.message, amend: values.amend === true, dir: values.dir });
|
|
295
204
|
}
|
|
296
|
-
case '
|
|
205
|
+
case 'export': {
|
|
297
206
|
const { values, positionals } = parseArgs({
|
|
298
207
|
args: rest,
|
|
299
|
-
options: {
|
|
300
|
-
...COMMON,
|
|
301
|
-
json: { type: 'string' },
|
|
302
|
-
file: { type: 'string' },
|
|
303
|
-
message: { type: 'string', short: 'm' },
|
|
304
|
-
keep: { type: 'boolean' },
|
|
305
|
-
},
|
|
208
|
+
options: { ...COMMON, out: { type: 'string', short: 'o' }, dir: { type: 'string' } },
|
|
306
209
|
allowPositionals: true,
|
|
307
210
|
});
|
|
308
211
|
if (values.help) {
|
|
309
|
-
console.log('usage: practi
|
|
212
|
+
console.log('usage: practi export <hash> [-o <file>] (write a revision back out as a document)');
|
|
310
213
|
return 0;
|
|
311
214
|
}
|
|
312
|
-
return
|
|
313
|
-
dataDir: str(values['data-dir']),
|
|
314
|
-
json: values.json,
|
|
315
|
-
file: values.file,
|
|
316
|
-
message: values.message,
|
|
317
|
-
keep: values.keep === true,
|
|
318
|
-
positional: positionals,
|
|
319
|
-
});
|
|
215
|
+
return runExport({ positional: positionals, out: values.out, dir: values.dir });
|
|
320
216
|
}
|
|
321
217
|
case 'show': {
|
|
322
218
|
const { values, positionals } = parseArgs({
|
|
323
219
|
args: rest,
|
|
324
|
-
options: { ...COMMON, json: { type: 'boolean' }, doc: { type: 'boolean' } },
|
|
220
|
+
options: { ...COMMON, json: { type: 'boolean' }, doc: { type: 'boolean' }, dir: { type: 'string' } },
|
|
325
221
|
allowPositionals: true,
|
|
326
222
|
});
|
|
327
223
|
if (values.help) {
|
|
@@ -332,7 +228,7 @@ async function main(argv) {
|
|
|
332
228
|
console.error('usage: practi show <hash> [--json] [--doc]');
|
|
333
229
|
return 1;
|
|
334
230
|
}
|
|
335
|
-
return runShow({
|
|
231
|
+
return runShow({ hash: positionals[0], json: values.json === true, doc: values.doc === true, dir: values.dir });
|
|
336
232
|
}
|
|
337
233
|
case 'web': {
|
|
338
234
|
const { values } = parseArgs({
|
|
@@ -342,159 +238,30 @@ async function main(argv) {
|
|
|
342
238
|
port: { type: 'string' },
|
|
343
239
|
open: { type: 'boolean', default: true },
|
|
344
240
|
'no-open': { type: 'boolean' },
|
|
241
|
+
dir: { type: 'string' },
|
|
345
242
|
},
|
|
346
243
|
allowPositionals: true,
|
|
347
244
|
});
|
|
348
245
|
if (values.help) {
|
|
349
|
-
console.log('usage: practi web [--port 4317] [--no-open]');
|
|
246
|
+
console.log('usage: practi web [--port 4317] [--no-open] (browse a practice — or the practices home — locally)');
|
|
350
247
|
return 0;
|
|
351
248
|
}
|
|
352
249
|
const port = values.port ? Number(values.port) : 4317;
|
|
353
|
-
return runWeb({
|
|
354
|
-
}
|
|
355
|
-
case 'remove': {
|
|
356
|
-
const { values, positionals } = parseArgs({
|
|
357
|
-
args: rest,
|
|
358
|
-
options: COMMON,
|
|
359
|
-
allowPositionals: true,
|
|
360
|
-
});
|
|
361
|
-
if (values.help) {
|
|
362
|
-
console.log('usage: practi remove <hash> (local directory; unreachable nodes are GCed)');
|
|
363
|
-
return 0;
|
|
364
|
-
}
|
|
365
|
-
if (positionals.length === 0) {
|
|
366
|
-
console.error('usage: practi remove <hash> (local directory; unreachable nodes are GCed)');
|
|
367
|
-
return 1;
|
|
368
|
-
}
|
|
369
|
-
return runRemove({
|
|
370
|
-
dataDir: str(values['data-dir']),
|
|
371
|
-
positional: positionals,
|
|
372
|
-
});
|
|
373
|
-
}
|
|
374
|
-
case 'claim': {
|
|
375
|
-
const { values, positionals } = parseArgs({ args: rest, options: COMMON, allowPositionals: true });
|
|
376
|
-
if (values.help) {
|
|
377
|
-
console.log('usage: practi claim <hash> (register an existing stored node as a direct pop)');
|
|
378
|
-
return 0;
|
|
379
|
-
}
|
|
380
|
-
if (positionals.length === 0) {
|
|
381
|
-
console.error('usage: practi claim <hash>');
|
|
382
|
-
return 1;
|
|
383
|
-
}
|
|
384
|
-
return runClaim({ dataDir: str(values['data-dir']), positional: positionals });
|
|
385
|
-
}
|
|
386
|
-
case 'unclaim': {
|
|
387
|
-
const { values, positionals } = parseArgs({ args: rest, options: COMMON, allowPositionals: true });
|
|
388
|
-
if (values.help) {
|
|
389
|
-
console.log('usage: practi unclaim <hash> (take a referenced direct pop back to indirect)');
|
|
390
|
-
return 0;
|
|
391
|
-
}
|
|
392
|
-
if (positionals.length === 0) {
|
|
393
|
-
console.error('usage: practi unclaim <hash>');
|
|
394
|
-
return 1;
|
|
395
|
-
}
|
|
396
|
-
return runUnclaim({ dataDir: str(values['data-dir']), positional: positionals });
|
|
397
|
-
}
|
|
398
|
-
case 'embed': {
|
|
399
|
-
const { values, positionals } = parseArgs({
|
|
400
|
-
args: rest,
|
|
401
|
-
options: { ...COMMON, json: { type: 'boolean' }, notes: { type: 'boolean' } },
|
|
402
|
-
allowPositionals: true,
|
|
403
|
-
});
|
|
404
|
-
if (values.help) {
|
|
405
|
-
console.log('usage: practi embed status|pull|build|prune [--json] [--notes]');
|
|
406
|
-
console.log(' optional offline vector model (bge-small-zh-v1.5, ~24MB int8 ONNX).');
|
|
407
|
-
console.log(' pull downloads it into <data-dir>/models/, build embeds every stored node');
|
|
408
|
-
console.log(' (incrementally — only new hashes are embedded), status reports coverage.');
|
|
409
|
-
console.log(' nothing here is required: without a model practi is lexical-only.');
|
|
410
|
-
return 0;
|
|
411
|
-
}
|
|
412
|
-
return await runEmbed({
|
|
413
|
-
dataDir: str(values['data-dir']),
|
|
414
|
-
positional: positionals,
|
|
415
|
-
json: values.json === true,
|
|
416
|
-
notes: values.notes === true,
|
|
417
|
-
});
|
|
418
|
-
}
|
|
419
|
-
case 'search': {
|
|
420
|
-
const { values, positionals } = parseArgs({
|
|
421
|
-
args: rest,
|
|
422
|
-
options: {
|
|
423
|
-
...COMMON,
|
|
424
|
-
limit: { type: 'string' },
|
|
425
|
-
json: { type: 'boolean' },
|
|
426
|
-
notes: { type: 'boolean' },
|
|
427
|
-
semantic: { type: 'boolean' },
|
|
428
|
-
},
|
|
429
|
-
allowPositionals: true,
|
|
430
|
-
});
|
|
431
|
-
if (values.help) {
|
|
432
|
-
console.log('usage: practi search [query...] [--limit N] [--json] [--notes] [--semantic]');
|
|
433
|
-
console.log(' words are ANDed — every word must match somewhere, and the words may');
|
|
434
|
-
console.log(' match in different fields (name / description / content / declared');
|
|
435
|
-
console.log(' inputs+outputs / loop). Quote a phrase to search it whole.');
|
|
436
|
-
console.log(' field:value scopes one word — name: desc: content: flow: loop: op: hash:');
|
|
437
|
-
console.log(' pure-hex queries also match node hash prefixes;');
|
|
438
|
-
console.log(' if strict matching finds nothing, results fall back to partial match (labeled).');
|
|
439
|
-
console.log(' --notes also indexes your local notes (off by default); hits show "note".');
|
|
440
|
-
console.log(' --semantic fuses vector recall with the lexical ranking (needs');
|
|
441
|
-
console.log(' `practi embed pull` + `practi embed build`; otherwise it says so and is ignored).');
|
|
442
|
-
console.log(' empty query = browse direct roots');
|
|
443
|
-
return 0;
|
|
444
|
-
}
|
|
445
|
-
const limit = values.limit ? Number(values.limit) : 20;
|
|
446
|
-
return await runSearch({
|
|
447
|
-
dataDir: str(values['data-dir']),
|
|
448
|
-
positional: positionals,
|
|
449
|
-
limit: Number.isInteger(limit) && limit > 0 ? Math.min(limit, 50) : 20,
|
|
450
|
-
json: values.json === true,
|
|
451
|
-
notes: values.notes === true,
|
|
452
|
-
semantic: values.semantic === true,
|
|
453
|
-
});
|
|
454
|
-
}
|
|
455
|
-
case 'similar': {
|
|
456
|
-
const { values, positionals } = parseArgs({
|
|
457
|
-
args: rest,
|
|
458
|
-
options: {
|
|
459
|
-
...COMMON,
|
|
460
|
-
limit: { type: 'string' },
|
|
461
|
-
json: { type: 'boolean' },
|
|
462
|
-
},
|
|
463
|
-
allowPositionals: true,
|
|
464
|
-
});
|
|
465
|
-
if (values.help) {
|
|
466
|
-
console.log('usage: practi similar <hash> [--limit N] [--json]');
|
|
467
|
-
console.log(' content neighbours: the target subtree is treated as a query and every');
|
|
468
|
-
console.log(' stored node is scored against it (character-bigram + latin-word relevance,');
|
|
469
|
-
console.log(' literal — not semantics, so a paraphrase sharing no wording will not surface).');
|
|
470
|
-
console.log(' score 1.0 = identical content; each hit lists the shared terms that carried it.');
|
|
471
|
-
return 0;
|
|
472
|
-
}
|
|
473
|
-
if (positionals.length === 0) {
|
|
474
|
-
console.error('usage: practi similar <hash> [--limit N] [--json]');
|
|
475
|
-
return 1;
|
|
476
|
-
}
|
|
477
|
-
const simLimit = values.limit ? Number(values.limit) : 10;
|
|
478
|
-
return runSimilar({
|
|
479
|
-
dataDir: str(values['data-dir']),
|
|
480
|
-
ref: positionals[0],
|
|
481
|
-
limit: Number.isInteger(simLimit) && simLimit > 0 ? Math.min(simLimit, 50) : 10,
|
|
482
|
-
json: values.json === true,
|
|
483
|
-
});
|
|
250
|
+
return runWeb({ dir: str(values.dir), port: Number.isInteger(port) && port > 0 ? port : 4317, open: values['no-open'] !== true });
|
|
484
251
|
}
|
|
485
252
|
case 'blob': {
|
|
486
253
|
const sub = rest[0];
|
|
487
254
|
const { values, positionals } = parseArgs({
|
|
488
255
|
args: rest.slice(1),
|
|
489
|
-
options: { ...COMMON, name: { type: 'string' } },
|
|
256
|
+
options: { ...COMMON, name: { type: 'string' }, dir: { type: 'string' } },
|
|
490
257
|
allowPositionals: true,
|
|
491
258
|
});
|
|
492
259
|
if (values.help) {
|
|
493
|
-
console.log('usage: practi blob add <file-or-url> [--name <name>]');
|
|
260
|
+
console.log('usage: practi blob add <file-or-url> [--name <name>] (store attachment bytes in this practice)');
|
|
494
261
|
return 0;
|
|
495
262
|
}
|
|
496
263
|
if (sub === 'add') {
|
|
497
|
-
return runBlobAdd({
|
|
264
|
+
return runBlobAdd({ name: values.name, dir: values.dir, positional: positionals });
|
|
498
265
|
}
|
|
499
266
|
console.error('usage: practi blob add <file-or-url> [--name <name>]');
|
|
500
267
|
return 1;
|
|
@@ -510,17 +277,15 @@ async function main(argv) {
|
|
|
510
277
|
const action = known.find((k) => k === sub);
|
|
511
278
|
if (values.help) {
|
|
512
279
|
console.log('usage: practi skill install|update|uninstall [--dir <skills-dir>] (default dir: ~/.agents/skills)');
|
|
513
|
-
console.log(' practi skill import <skill-dir>
|
|
514
|
-
console.log(' practi skill export <ref> [--dir <out-dir>]
|
|
280
|
+
console.log(' practi skill import <skill-dir> replay a `practi skill export` directory (sidecar required)');
|
|
281
|
+
console.log(' practi skill export <ref> [--dir <out-dir>] project a revision as an installable skill directory');
|
|
515
282
|
return 0;
|
|
516
283
|
}
|
|
517
284
|
if (action === undefined) {
|
|
518
285
|
console.error('usage: practi skill install|update|uninstall [--dir <skills-dir>] (default dir: ~/.agents/skills)');
|
|
519
|
-
console.error(' practi skill import <skill-dir> [--data-dir <dir>] replay a `practi skill export` directory (sidecar required)');
|
|
520
|
-
console.error(' practi skill export <ref> [--dir <out-dir>] [--data-dir <dir>] POP → skill directory');
|
|
521
286
|
return 1;
|
|
522
287
|
}
|
|
523
|
-
return runSkill({ action, dir: values.dir,
|
|
288
|
+
return runSkill({ action, dir: values.dir, positional: positionals[0] });
|
|
524
289
|
}
|
|
525
290
|
case 'spec': {
|
|
526
291
|
const { values } = parseArgs({ args: rest, options: COMMON, allowPositionals: true });
|
|
@@ -528,7 +293,7 @@ async function main(argv) {
|
|
|
528
293
|
console.log('usage: practi spec (print the bundled pop-spec.md)');
|
|
529
294
|
return 0;
|
|
530
295
|
}
|
|
531
|
-
return runSpec({
|
|
296
|
+
return runSpec({});
|
|
532
297
|
}
|
|
533
298
|
case 'update': {
|
|
534
299
|
const { values } = parseArgs({ args: rest, options: COMMON, allowPositionals: true });
|
|
@@ -536,7 +301,7 @@ async function main(argv) {
|
|
|
536
301
|
console.log('usage: practi update (self-update via npm; checks the registry\'s latest)');
|
|
537
302
|
return 0;
|
|
538
303
|
}
|
|
539
|
-
return await runUpdate({
|
|
304
|
+
return await runUpdate({});
|
|
540
305
|
}
|
|
541
306
|
case 'login': {
|
|
542
307
|
const { values } = parseArgs({
|
|
@@ -581,203 +346,223 @@ async function main(argv) {
|
|
|
581
346
|
...COMMON,
|
|
582
347
|
force: { type: 'boolean' },
|
|
583
348
|
dir: { type: 'string' },
|
|
584
|
-
practice: { type: 'string' },
|
|
585
349
|
},
|
|
586
350
|
allowPositionals: true,
|
|
587
351
|
});
|
|
588
352
|
if (values.help) {
|
|
589
|
-
console.log('usage: practi push [--force] [--dir <path>
|
|
353
|
+
console.log('usage: practi push [--force] [--dir <path>] (practice → hub; first push creates it; divergence errors, --force overwrites)');
|
|
590
354
|
return 0;
|
|
591
355
|
}
|
|
592
|
-
return await runPush({
|
|
356
|
+
return await runPush({ dir: values.dir, force: values.force === true });
|
|
593
357
|
}
|
|
594
|
-
case '
|
|
595
|
-
const { values
|
|
358
|
+
case 'pull': {
|
|
359
|
+
const { values } = parseArgs({
|
|
596
360
|
args: rest,
|
|
597
|
-
options: {
|
|
598
|
-
...COMMON,
|
|
599
|
-
to: { type: 'string' },
|
|
600
|
-
dir: { type: 'string' },
|
|
601
|
-
message: { type: 'string', short: 'm' },
|
|
602
|
-
keep: { type: 'boolean' },
|
|
603
|
-
},
|
|
361
|
+
options: { ...COMMON, dir: { type: 'string' } },
|
|
604
362
|
allowPositionals: true,
|
|
605
363
|
});
|
|
606
364
|
if (values.help) {
|
|
607
|
-
console.log('usage: practi
|
|
365
|
+
console.log('usage: practi pull [--dir <path>] (reconcile with the hub: fetch missing revisions, fast-forward)');
|
|
608
366
|
return 0;
|
|
609
367
|
}
|
|
610
|
-
return await
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
368
|
+
return await runPull({ dir: values.dir });
|
|
369
|
+
}
|
|
370
|
+
case 'clone': {
|
|
371
|
+
const { values, positionals } = parseArgs({
|
|
372
|
+
args: rest,
|
|
373
|
+
options: { ...COMMON, dir: { type: 'string' } },
|
|
374
|
+
allowPositionals: true,
|
|
617
375
|
});
|
|
376
|
+
if (values.help) {
|
|
377
|
+
console.log('usage: practi clone <owner>/<name>[@branch] [--dir <path>] (clone a hub practice into a local folder)');
|
|
378
|
+
return 0;
|
|
379
|
+
}
|
|
380
|
+
return await runClone({ positional: positionals, dir: values.dir });
|
|
618
381
|
}
|
|
619
|
-
case '
|
|
382
|
+
case 'branch': {
|
|
620
383
|
const { values, positionals } = parseArgs({
|
|
621
384
|
args: rest,
|
|
622
385
|
options: {
|
|
623
386
|
...COMMON,
|
|
387
|
+
from: { type: 'string' },
|
|
388
|
+
delete: { type: 'string', short: 'd' },
|
|
624
389
|
dir: { type: 'string' },
|
|
625
|
-
practice: { type: 'string' },
|
|
626
|
-
message: { type: 'string', short: 'm' },
|
|
627
|
-
file: { type: 'string' },
|
|
628
|
-
json: { type: 'string' },
|
|
629
390
|
},
|
|
630
391
|
allowPositionals: true,
|
|
631
392
|
});
|
|
632
393
|
if (values.help) {
|
|
633
|
-
console.log('usage: practi
|
|
394
|
+
console.log('usage: practi branch [name] [-d <name>] (list / create / delete branches; * marks the current branch)');
|
|
634
395
|
return 0;
|
|
635
396
|
}
|
|
636
|
-
return
|
|
637
|
-
dataDir: str(values['data-dir']),
|
|
638
|
-
positional: positionals,
|
|
639
|
-
dir: values.dir,
|
|
640
|
-
practice: values.practice,
|
|
641
|
-
message: values.message,
|
|
642
|
-
file: values.file,
|
|
643
|
-
json: values.json,
|
|
644
|
-
});
|
|
397
|
+
return runBranch({ positional: positionals, from: values.from, deleteBranch: values.delete, dir: values.dir });
|
|
645
398
|
}
|
|
646
|
-
case '
|
|
399
|
+
case 'switch': {
|
|
647
400
|
const { values, positionals } = parseArgs({
|
|
648
401
|
args: rest,
|
|
649
402
|
options: { ...COMMON, dir: { type: 'string' } },
|
|
650
403
|
allowPositionals: true,
|
|
651
404
|
});
|
|
652
405
|
if (values.help) {
|
|
653
|
-
console.log('usage: practi
|
|
406
|
+
console.log('usage: practi switch <branch> (switch branches; the working file follows the head)');
|
|
654
407
|
return 0;
|
|
655
408
|
}
|
|
656
|
-
return
|
|
409
|
+
return runSwitch({ positional: positionals, dir: values.dir });
|
|
657
410
|
}
|
|
658
|
-
case '
|
|
411
|
+
case 'merge': {
|
|
659
412
|
const { values, positionals } = parseArgs({
|
|
660
413
|
args: rest,
|
|
661
|
-
options: { ...COMMON,
|
|
414
|
+
options: { ...COMMON, dir: { type: 'string' } },
|
|
662
415
|
allowPositionals: true,
|
|
663
416
|
});
|
|
664
417
|
if (values.help) {
|
|
665
|
-
console.log('usage: practi
|
|
418
|
+
console.log('usage: practi merge <branch> (fast-forward, else pointer move)');
|
|
666
419
|
return 0;
|
|
667
420
|
}
|
|
668
|
-
return
|
|
421
|
+
return runMerge({ positional: positionals, dir: values.dir });
|
|
669
422
|
}
|
|
670
|
-
case '
|
|
423
|
+
case 'log': {
|
|
671
424
|
const { values } = parseArgs({
|
|
672
425
|
args: rest,
|
|
673
|
-
options: {
|
|
426
|
+
options: {
|
|
427
|
+
...COMMON,
|
|
428
|
+
branch: { type: 'string' },
|
|
429
|
+
limit: { type: 'string' },
|
|
430
|
+
json: { type: 'boolean' },
|
|
431
|
+
dir: { type: 'string' },
|
|
432
|
+
},
|
|
674
433
|
allowPositionals: true,
|
|
675
434
|
});
|
|
676
435
|
if (values.help) {
|
|
677
|
-
console.log('usage: practi
|
|
436
|
+
console.log('usage: practi log [--branch <b>] [--limit N] [--json] (the commit history, tip first)');
|
|
678
437
|
return 0;
|
|
679
438
|
}
|
|
680
|
-
|
|
439
|
+
const logLimit = values.limit ? Number(values.limit) : undefined;
|
|
440
|
+
return runLog({
|
|
441
|
+
branch: values.branch,
|
|
442
|
+
limit: logLimit !== undefined && Number.isInteger(logLimit) && logLimit > 0 ? logLimit : undefined,
|
|
443
|
+
json: values.json === true,
|
|
444
|
+
dir: values.dir,
|
|
445
|
+
});
|
|
681
446
|
}
|
|
682
|
-
case '
|
|
447
|
+
case 'history': {
|
|
683
448
|
const { values, positionals } = parseArgs({
|
|
684
449
|
args: rest,
|
|
685
|
-
options: {
|
|
450
|
+
options: {
|
|
451
|
+
...COMMON,
|
|
452
|
+
dir: { type: 'string' },
|
|
453
|
+
message: { type: 'string', short: 'm' },
|
|
454
|
+
},
|
|
686
455
|
allowPositionals: true,
|
|
687
456
|
});
|
|
688
457
|
if (values.help) {
|
|
689
|
-
console.log('usage: practi
|
|
458
|
+
console.log('usage: practi history reword <seq> -m <msg> | squash <seq> | drop <seq> | reset <seq> (rewrite the local chain; push reconciles)');
|
|
690
459
|
return 0;
|
|
691
460
|
}
|
|
692
|
-
return await
|
|
461
|
+
return await runHistory({ positional: positionals, dir: values.dir, message: values.message });
|
|
693
462
|
}
|
|
694
|
-
case '
|
|
695
|
-
const { values, positionals } = parseArgs({
|
|
463
|
+
case 'fix': {
|
|
464
|
+
const { values, positionals } = parseArgs({
|
|
465
|
+
args: rest,
|
|
466
|
+
options: { ...COMMON, 'dry-run': { type: 'boolean' } },
|
|
467
|
+
allowPositionals: true,
|
|
468
|
+
});
|
|
696
469
|
if (values.help) {
|
|
697
|
-
console.log('usage: practi
|
|
470
|
+
console.log('usage: practi fix <file.json> [--dry-run] (strip POP 1.x history fields — revisions/refines — from a document file)');
|
|
698
471
|
return 0;
|
|
699
472
|
}
|
|
700
|
-
return
|
|
473
|
+
return runFix({ positional: positionals, dryRun: values['dry-run'] === true });
|
|
701
474
|
}
|
|
702
|
-
case '
|
|
703
|
-
if (rest.join(' ').includes('help')) {
|
|
704
|
-
console.log('practi instance was retired by the two-software model (2026-10-20):');
|
|
705
|
-
console.log(' instance create → `practi practice new <name>` (local first; the hub copy is born by the first push)');
|
|
706
|
-
console.log(' instance bind → retired: commands locate the practice by cwd / --dir / --practice');
|
|
707
|
-
console.log(' instance show → `practi practice list` and `practi log`');
|
|
708
|
-
return 0;
|
|
709
|
-
}
|
|
710
|
-
console.error('error: `practi instance` was retired — use `practi practice new <name>` (local instances), --practice <name> / --dir <path> to locate, `practi push` to put one on the hub');
|
|
711
|
-
return 1;
|
|
712
|
-
}
|
|
713
|
-
case 'branch': {
|
|
475
|
+
case 'search': {
|
|
714
476
|
const { values, positionals } = parseArgs({
|
|
715
477
|
args: rest,
|
|
716
478
|
options: {
|
|
717
479
|
...COMMON,
|
|
718
|
-
|
|
719
|
-
|
|
480
|
+
limit: { type: 'string' },
|
|
481
|
+
json: { type: 'boolean' },
|
|
482
|
+
notes: { type: 'boolean' },
|
|
483
|
+
semantic: { type: 'boolean' },
|
|
720
484
|
dir: { type: 'string' },
|
|
721
|
-
practice: { type: 'string' },
|
|
722
485
|
},
|
|
723
486
|
allowPositionals: true,
|
|
724
487
|
});
|
|
725
488
|
if (values.help) {
|
|
726
|
-
console.log('usage: practi
|
|
489
|
+
console.log('usage: practi search [query...] [--limit N] [--json] [--notes] [--semantic] (search this practice\'s revisions)');
|
|
727
490
|
return 0;
|
|
728
491
|
}
|
|
729
|
-
|
|
492
|
+
const limit = values.limit ? Number(values.limit) : 20;
|
|
493
|
+
return await runSearch({
|
|
494
|
+
positional: positionals,
|
|
495
|
+
limit: Number.isInteger(limit) && limit > 0 ? Math.min(limit, 50) : 20,
|
|
496
|
+
json: values.json === true,
|
|
497
|
+
notes: values.notes === true,
|
|
498
|
+
semantic: values.semantic === true,
|
|
499
|
+
dir: values.dir,
|
|
500
|
+
});
|
|
730
501
|
}
|
|
731
|
-
case '
|
|
502
|
+
case 'similar': {
|
|
732
503
|
const { values, positionals } = parseArgs({
|
|
733
504
|
args: rest,
|
|
734
|
-
options: {
|
|
505
|
+
options: {
|
|
506
|
+
...COMMON,
|
|
507
|
+
limit: { type: 'string' },
|
|
508
|
+
json: { type: 'boolean' },
|
|
509
|
+
dir: { type: 'string' },
|
|
510
|
+
},
|
|
735
511
|
allowPositionals: true,
|
|
736
512
|
});
|
|
737
513
|
if (values.help) {
|
|
738
|
-
console.log('usage: practi
|
|
514
|
+
console.log('usage: practi similar <hash> [--limit N] [--json] (content neighbours within this practice)');
|
|
739
515
|
return 0;
|
|
740
516
|
}
|
|
741
|
-
|
|
517
|
+
if (positionals.length === 0) {
|
|
518
|
+
console.error('usage: practi similar <hash> [--limit N] [--json]');
|
|
519
|
+
return 1;
|
|
520
|
+
}
|
|
521
|
+
const simLimit = values.limit ? Number(values.limit) : 10;
|
|
522
|
+
return runSimilar({
|
|
523
|
+
ref: positionals[0],
|
|
524
|
+
limit: Number.isInteger(simLimit) && simLimit > 0 ? Math.min(simLimit, 50) : 10,
|
|
525
|
+
json: values.json === true,
|
|
526
|
+
dir: values.dir,
|
|
527
|
+
});
|
|
742
528
|
}
|
|
743
|
-
case '
|
|
529
|
+
case 'note': {
|
|
744
530
|
const { values, positionals } = parseArgs({
|
|
745
531
|
args: rest,
|
|
746
|
-
options: {
|
|
532
|
+
options: {
|
|
533
|
+
...COMMON,
|
|
534
|
+
message: { type: 'string', short: 'm' },
|
|
535
|
+
json: { type: 'boolean' },
|
|
536
|
+
dir: { type: 'string' },
|
|
537
|
+
},
|
|
747
538
|
allowPositionals: true,
|
|
748
539
|
});
|
|
749
540
|
if (values.help) {
|
|
750
|
-
console.log('usage: practi
|
|
541
|
+
console.log('usage: practi note add|list|edit|delete (local notes pinned to node hashes; see `practi note` help)');
|
|
751
542
|
return 0;
|
|
752
543
|
}
|
|
753
|
-
return
|
|
544
|
+
return runNote({
|
|
545
|
+
positional: positionals,
|
|
546
|
+
message: values.message,
|
|
547
|
+
json: values.json === true,
|
|
548
|
+
dir: values.dir,
|
|
549
|
+
});
|
|
754
550
|
}
|
|
755
|
-
case '
|
|
756
|
-
const { values } = parseArgs({
|
|
551
|
+
case 'embed': {
|
|
552
|
+
const { values, positionals } = parseArgs({
|
|
757
553
|
args: rest,
|
|
758
|
-
options: {
|
|
759
|
-
...COMMON,
|
|
760
|
-
branch: { type: 'string' },
|
|
761
|
-
limit: { type: 'string' },
|
|
762
|
-
json: { type: 'boolean' },
|
|
763
|
-
dir: { type: 'string' },
|
|
764
|
-
practice: { type: 'string' },
|
|
765
|
-
},
|
|
554
|
+
options: { ...COMMON, json: { type: 'boolean' }, notes: { type: 'boolean' }, dir: { type: 'string' } },
|
|
766
555
|
allowPositionals: true,
|
|
767
556
|
});
|
|
768
557
|
if (values.help) {
|
|
769
|
-
console.log('usage: practi
|
|
558
|
+
console.log('usage: practi embed status|pull|build|prune [--json] [--notes] (optional offline vector model, scoped to this practice)');
|
|
770
559
|
return 0;
|
|
771
560
|
}
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
dataDir: str(values['data-dir']),
|
|
775
|
-
positional: [],
|
|
776
|
-
branch: values.branch,
|
|
777
|
-
limit: logLimit !== undefined && Number.isInteger(logLimit) && logLimit > 0 ? logLimit : undefined,
|
|
561
|
+
return await runEmbed({
|
|
562
|
+
positional: positionals,
|
|
778
563
|
json: values.json === true,
|
|
564
|
+
notes: values.notes === true,
|
|
779
565
|
dir: values.dir,
|
|
780
|
-
practice: values.practice,
|
|
781
566
|
});
|
|
782
567
|
}
|
|
783
568
|
case 'help':
|
|
@@ -785,6 +570,19 @@ async function main(argv) {
|
|
|
785
570
|
case '-h':
|
|
786
571
|
console.log(USAGE);
|
|
787
572
|
return 0;
|
|
573
|
+
case 'edit':
|
|
574
|
+
case 'ls':
|
|
575
|
+
case 'list':
|
|
576
|
+
case 'remove':
|
|
577
|
+
case 'claim':
|
|
578
|
+
case 'unclaim':
|
|
579
|
+
case 'publish':
|
|
580
|
+
case 'fetch':
|
|
581
|
+
case 'repair':
|
|
582
|
+
case 'migrate':
|
|
583
|
+
case 'instance':
|
|
584
|
+
case 'practice':
|
|
585
|
+
return retired(cmd);
|
|
788
586
|
default:
|
|
789
587
|
console.error(`unknown command: ${cmd}`);
|
|
790
588
|
console.error(USAGE);
|