gipity 1.1.28 → 1.1.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/skill.js +23 -12
- package/dist/commands/update.js +8 -2
- package/dist/commands/workflow.js +16 -6
- package/dist/index.js +172 -130
- package/dist/updater/bootstrap.js +4 -9
- package/dist/updater/check.js +29 -3
- package/dist/updater/install.js +13 -0
- package/dist/updater/shim.js +45 -25
- package/dist/updater/state.js +27 -1
- package/package.json +1 -1
package/dist/commands/skill.js
CHANGED
|
@@ -107,18 +107,29 @@ function filterContent(content, sections, opts) {
|
|
|
107
107
|
return { text: tocText(sections) };
|
|
108
108
|
let hits = [];
|
|
109
109
|
let note;
|
|
110
|
-
if (opts.section) {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
110
|
+
if (opts.section?.length) {
|
|
111
|
+
// Repeatable: each --section adds its section(s), in the order asked for.
|
|
112
|
+
const notes = [];
|
|
113
|
+
for (const asked of opts.section) {
|
|
114
|
+
const want = slugify(asked);
|
|
115
|
+
let found = sections.filter(s => s.slug === want);
|
|
116
|
+
if (found.length === 0)
|
|
117
|
+
found = sections.filter(s => s.slug.includes(want));
|
|
118
|
+
if (found.length === 0) {
|
|
119
|
+
const closest = closestSection(sections, want);
|
|
120
|
+
if (closest) {
|
|
121
|
+
found = [closest];
|
|
122
|
+
notes.push(`No section "${asked}"; showing the closest match "${closest.slug}" (all slugs: --toc).`);
|
|
123
|
+
}
|
|
120
124
|
}
|
|
125
|
+
if (found.length === 0)
|
|
126
|
+
notes.push(`No section "${asked}" (all slugs: --toc).`);
|
|
127
|
+
for (const f of found)
|
|
128
|
+
if (!hits.includes(f))
|
|
129
|
+
hits.push(f);
|
|
121
130
|
}
|
|
131
|
+
if (notes.length)
|
|
132
|
+
note = notes.join(' ');
|
|
122
133
|
}
|
|
123
134
|
else if (opts.grep) {
|
|
124
135
|
let re;
|
|
@@ -165,7 +176,7 @@ skillCommand
|
|
|
165
176
|
.command('read <names...>')
|
|
166
177
|
.description('Read one or more skills (whole doc, or one part with --toc/--section/--grep)')
|
|
167
178
|
.option('--toc', 'Print the doc outline (section slugs + line numbers) instead of the content')
|
|
168
|
-
.option('--section <slug>', 'Print only this section (slug or heading text; subsections included). A guess that clearly matches one section by its words prints that section')
|
|
179
|
+
.option('--section <slug>', 'Print only this section (slug or heading text; subsections included). Repeat for several. A guess that clearly matches one section by its words prints that section', (v, prev = []) => [...prev, v])
|
|
169
180
|
.option('--grep <term>', 'Print only the sections matching this term (case-insensitive regex)')
|
|
170
181
|
.option('--json', 'Output as JSON')
|
|
171
182
|
.action((names, opts) => run('Read', async () => {
|
|
@@ -200,7 +211,7 @@ skillCommand
|
|
|
200
211
|
const sections = parseSections(lines);
|
|
201
212
|
const filtered = filterContent(content, sections, opts);
|
|
202
213
|
if (filtered === null) {
|
|
203
|
-
const what = opts.section ? `section
|
|
214
|
+
const what = opts.section?.length ? `section ${opts.section.map(x => `"${x}"`).join(' / ')}` : `match for "${opts.grep}"`;
|
|
204
215
|
console.error(clrError(`No ${what} in "${name}". Sections: ${sections.map(s => s.slug).join(', ') || '(none)'}`));
|
|
205
216
|
failed = true;
|
|
206
217
|
continue;
|
package/dist/commands/update.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
import { runCheck } from '../updater/check.js';
|
|
3
|
+
import { PKG_ROOT } from '../updater/state.js';
|
|
3
4
|
import { success, warning, info, dim } from '../colors.js';
|
|
4
5
|
export const updateCommand = new Command('update')
|
|
5
6
|
.description('Update the CLI')
|
|
@@ -15,9 +16,10 @@ export const updateCommand = new Command('update')
|
|
|
15
16
|
upToDate: result.reason === 'up-to-date',
|
|
16
17
|
from: result.from ?? null,
|
|
17
18
|
to: result.to ?? null,
|
|
18
|
-
|
|
19
|
+
devLink: result.reason === 'dev-link',
|
|
20
|
+
reason: result.updated || result.reason === 'up-to-date' || result.reason === 'dev-link' ? null : result.reason ?? null,
|
|
19
21
|
}));
|
|
20
|
-
if (!result.updated && result.reason !== 'up-to-date')
|
|
22
|
+
if (!result.updated && result.reason !== 'up-to-date' && result.reason !== 'dev-link')
|
|
21
23
|
process.exitCode = 1;
|
|
22
24
|
return;
|
|
23
25
|
}
|
|
@@ -26,6 +28,10 @@ export const updateCommand = new Command('update')
|
|
|
26
28
|
console.log(success(`Updated ${result.from} → ${result.to}`));
|
|
27
29
|
console.log(dim(`Installed. This command ran on ${result.from}; everything from here on uses ${result.to}.`));
|
|
28
30
|
}
|
|
31
|
+
else if (result.reason === 'dev-link') {
|
|
32
|
+
console.log(info(`This gipity is linked to a source checkout (${PKG_ROOT}) and runs its build, so it never auto-updates.`));
|
|
33
|
+
console.log(dim('To update it, pull that checkout and run `just cli-link` there.'));
|
|
34
|
+
}
|
|
29
35
|
else if (result.reason === 'up-to-date') {
|
|
30
36
|
console.log(success('Already on the latest version.'));
|
|
31
37
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Command, Option } from 'commander';
|
|
2
|
-
import { existsSync, mkdirSync, writeFileSync } from 'fs';
|
|
3
|
-
import { join } from 'path';
|
|
2
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
|
|
3
|
+
import { isAbsolute, join, resolve } from 'path';
|
|
4
4
|
import { get, post, put, del } from '../api.js';
|
|
5
5
|
import { getConfig, requireConfig, getProjectRoot } from '../config.js';
|
|
6
6
|
import { pushFile } from '../sync.js';
|
|
@@ -312,10 +312,20 @@ steps:
|
|
|
312
312
|
then return { summary, needs_attention } where needs_attention is a list of short strings.
|
|
313
313
|
tools: [memory, db_query]
|
|
314
314
|
`;
|
|
315
|
+
/** Read a workflow YAML from disk: an absolute path, a path from the cwd, or
|
|
316
|
+
* a project-relative one. The text is sent to the server, so the file need not
|
|
317
|
+
* be synced (a probe in tmp/ works). */
|
|
318
|
+
function readWorkflowYaml(from) {
|
|
319
|
+
const candidates = isAbsolute(from) ? [from] : [resolve(from), ...(getProjectRoot() ? [join(getProjectRoot(), from)] : [])];
|
|
320
|
+
const found = candidates.find((p) => existsSync(p));
|
|
321
|
+
if (!found)
|
|
322
|
+
throw new Error(`No workflow file at ${from}.`);
|
|
323
|
+
return readFileSync(found, 'utf-8');
|
|
324
|
+
}
|
|
315
325
|
workflowCommand
|
|
316
326
|
.command('create')
|
|
317
327
|
.description('Create a workflow from a YAML file in the project (e.g. workflows/foo.yaml)')
|
|
318
|
-
.option('--from <path>', '
|
|
328
|
+
.option('--from <path>', 'Workflow YAML file (any local path, e.g. workflows/foo.yaml)')
|
|
319
329
|
.option('--heartbeat', `Scaffold ${HEARTBEAT_PATH} (a daily check-in that keeps notes in project memory) and create it`)
|
|
320
330
|
.option('--name <name>', 'Override the name in the YAML')
|
|
321
331
|
.option('--json', 'Output as JSON')
|
|
@@ -339,7 +349,7 @@ workflowCommand
|
|
|
339
349
|
await pushFile(local);
|
|
340
350
|
}
|
|
341
351
|
const body = {
|
|
342
|
-
|
|
352
|
+
config_yaml: readWorkflowYaml(from),
|
|
343
353
|
project_guid: config.projectGuid,
|
|
344
354
|
};
|
|
345
355
|
if (opts.name)
|
|
@@ -352,14 +362,14 @@ workflowCommand
|
|
|
352
362
|
.command('edit <name>')
|
|
353
363
|
.alias('update')
|
|
354
364
|
.description('Update a workflow from a YAML file')
|
|
355
|
-
.requiredOption('--from <path>', '
|
|
365
|
+
.requiredOption('--from <path>', 'Workflow YAML file (any local path, e.g. workflows/foo.yaml)')
|
|
356
366
|
.option('--json', 'Output as JSON')
|
|
357
367
|
.action((name, _opts, cmd) => run('Edit', async () => {
|
|
358
368
|
const opts = mergedOpts(cmd);
|
|
359
369
|
const config = requireConfig();
|
|
360
370
|
const wf = await resolveWorkflow(name);
|
|
361
371
|
await put(`/workflows/${wf.short_guid}`, {
|
|
362
|
-
|
|
372
|
+
config_yaml: readWorkflowYaml(opts.from),
|
|
363
373
|
project_guid: config.projectGuid,
|
|
364
374
|
});
|
|
365
375
|
printResult(`Updated "${wf.name}" from ${opts.from}.`, opts, { updated: wf.name });
|