@agentage/cli 0.81.3 → 0.82.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/dist/commands/extension/create-blank.d.ts +2 -0
- package/dist/commands/extension/create-blank.js +36 -0
- package/dist/commands/extension/create-command.d.ts +3 -0
- package/dist/commands/extension/create-command.js +14 -0
- package/dist/commands/extension/create-floor.d.ts +1 -0
- package/dist/commands/extension/create-floor.js +17 -0
- package/dist/commands/extension/create-into.d.ts +3 -0
- package/dist/commands/extension/create-into.js +46 -0
- package/dist/commands/extension/create-lib.d.ts +1 -0
- package/dist/commands/extension/create-lib.js +58 -0
- package/dist/commands/extension/create-source.js +2 -2
- package/dist/commands/extension/create.d.ts +2 -2
- package/dist/commands/extension/create.js +23 -34
- package/dist/commands/extension/list.js +2 -1
- package/package.json +2 -2
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { cpSync, existsSync, readFileSync, rmSync } from 'node:fs';
|
|
2
|
+
import { isAbsolute, join, relative, resolve } from 'node:path';
|
|
3
|
+
import { CliError } from '../../lib/json-output.js';
|
|
4
|
+
export const BLANK = 'blank';
|
|
5
|
+
const REMOVE = 'remove.json';
|
|
6
|
+
const inside = (dir, path) => {
|
|
7
|
+
const rel = relative(resolve(dir), resolve(dir, path));
|
|
8
|
+
return rel !== '' && !rel.startsWith('..') && !isAbsolute(path) && !isAbsolute(rel);
|
|
9
|
+
};
|
|
10
|
+
// A JSON list of template paths; an unreadable list or a path outside the folder stops the run.
|
|
11
|
+
const removals = (overlay) => {
|
|
12
|
+
const file = join(overlay, REMOVE);
|
|
13
|
+
if (!existsSync(file))
|
|
14
|
+
return [];
|
|
15
|
+
const list = JSON.parse(readFileSync(file, 'utf8'));
|
|
16
|
+
if (!Array.isArray(list) || list.some((item) => typeof item !== 'string'))
|
|
17
|
+
throw new Error(`${BLANK}/${REMOVE}: expected a list of paths`);
|
|
18
|
+
return list;
|
|
19
|
+
};
|
|
20
|
+
// Runs first: blank/ is a template overlay, never part of the extension that is made.
|
|
21
|
+
export const applyBlank = (dir, blank) => {
|
|
22
|
+
const overlay = join(dir, BLANK);
|
|
23
|
+
const found = existsSync(overlay);
|
|
24
|
+
if (blank && !found)
|
|
25
|
+
throw new CliError('invalid_argument', '--blank: this template has no blank variant');
|
|
26
|
+
if (blank) {
|
|
27
|
+
for (const path of removals(overlay)) {
|
|
28
|
+
if (!inside(dir, path))
|
|
29
|
+
throw new Error(`${BLANK}/${REMOVE}: ${path} is outside the template`);
|
|
30
|
+
rmSync(join(dir, path), { recursive: true, force: true });
|
|
31
|
+
}
|
|
32
|
+
rmSync(join(overlay, REMOVE), { force: true });
|
|
33
|
+
cpSync(overlay, dir, { recursive: true, force: true });
|
|
34
|
+
}
|
|
35
|
+
rmSync(overlay, { recursive: true, force: true });
|
|
36
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {} from 'commander';
|
|
2
|
+
import { addJson } from '../../lib/json-output.js';
|
|
3
|
+
import { PARTS, TEMPLATE } from './create.js';
|
|
4
|
+
export const addCreate = (group, create) => addJson(group
|
|
5
|
+
.command('create')
|
|
6
|
+
.description('Create ./extension-<id> from the extension template with the parts named')
|
|
7
|
+
.argument('<id>', 'the extension id, also its host and contract name')
|
|
8
|
+
.argument('[parts...]', `parts to keep (default: all eight): ${PARTS.join(', ')}`)
|
|
9
|
+
.option('--from <owner/repo[#branch][:folder]>', `the template repo and folder (default: ${TEMPLATE})`)
|
|
10
|
+
.option('--no-install', 'build the folder, but do not give it to the daemon')
|
|
11
|
+
.option('--blank', 'keep the parts but not the notes example (the template needs a blank/ folder)')
|
|
12
|
+
.option('--into <dir>', 'write <dir>/<id> for a shared repo (no repo files of its own); <dir> is its extensions folder')
|
|
13
|
+
.option('--yes', 'run code from another --from repo or branch without asking')
|
|
14
|
+
.addHelpText('after', '\nExample:\n agentage extension create my-ext app api (parts may also be app,api)')).action((id, parts, o) => create({ id, parts, ...o }));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const lowerFloor: (dir: string, kept: string[], all: number) => string | undefined;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
const CI = join('.github', 'workflows', 'ci.yml');
|
|
4
|
+
const FLOOR = /MIN_EXECUTED: '\d+'/;
|
|
5
|
+
const LOWERED = " ci MIN_EXECUTED is 1: after the first green run, set it to the gate's count";
|
|
6
|
+
const BY_HAND = ` ci no MIN_EXECUTED line found in ${CI}: set it by hand to the gate's count`;
|
|
7
|
+
// The template's floor counts the gate's tests for all eight parts; a subset's count is unknown.
|
|
8
|
+
export const lowerFloor = (dir, kept, all) => {
|
|
9
|
+
if (kept.length === all)
|
|
10
|
+
return undefined;
|
|
11
|
+
const file = join(dir, CI);
|
|
12
|
+
const text = existsSync(file) ? readFileSync(file, 'utf8') : '';
|
|
13
|
+
if (!FLOOR.test(text))
|
|
14
|
+
return BY_HAND;
|
|
15
|
+
writeFileSync(file, text.replace(FLOOR, "MIN_EXECUTED: '1'"));
|
|
16
|
+
return LOWERED;
|
|
17
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { execFileSync } from 'node:child_process';
|
|
2
|
+
import { existsSync, readFileSync, rmSync, statSync, writeFileSync } from 'node:fs';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
// What the template has for a repo of its own: workflows, dependabot and the repo-class files.
|
|
5
|
+
const OWN_REPO = ['.github', '.repo-class', '.repo-doctor.yml'];
|
|
6
|
+
export const intoRefusal = (into, id) => {
|
|
7
|
+
if (!existsSync(into) || !statSync(into).isDirectory())
|
|
8
|
+
return `--into ${into}: not a folder (the extensions folder of the shared repo)`;
|
|
9
|
+
return existsSync(join(into, id)) ? `${join(into, id)} exists: pick another id or remove it` : '';
|
|
10
|
+
};
|
|
11
|
+
const git = (dir, ...args) => {
|
|
12
|
+
try {
|
|
13
|
+
return execFileSync('git', ['-C', dir, ...args], { encoding: 'utf8', stdio: 'pipe' }).trim();
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
return '';
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
// The shared repo: its GitHub owner/repo from origin, and where the folder sits in it.
|
|
20
|
+
const sharedRepo = (into, id) => {
|
|
21
|
+
const slug = /github\.com[:/]([\w.-]+\/[\w.-]+?)(?:\.git)?$/.exec(git(into, 'remote', 'get-url', 'origin'))?.[1];
|
|
22
|
+
return slug ? { slug, directory: `${git(into, 'rev-parse', '--show-prefix')}${id}` } : undefined;
|
|
23
|
+
};
|
|
24
|
+
// The shape of host-core, host-platform and examples: no repo files of its own, the repo points at the shared repo.
|
|
25
|
+
export const shapeShared = (dir, into, id) => {
|
|
26
|
+
for (const name of OWN_REPO)
|
|
27
|
+
rmSync(join(dir, name), { recursive: true, force: true });
|
|
28
|
+
const repo = sharedRepo(into, id);
|
|
29
|
+
if (!repo)
|
|
30
|
+
return ' package no github origin found: set repository and bugs in package.json by hand';
|
|
31
|
+
const file = join(dir, 'package.json');
|
|
32
|
+
const pkg = JSON.parse(readFileSync(file, 'utf8'));
|
|
33
|
+
pkg['repository'] = {
|
|
34
|
+
type: 'git',
|
|
35
|
+
url: `git+https://github.com/${repo.slug}.git`,
|
|
36
|
+
directory: repo.directory,
|
|
37
|
+
};
|
|
38
|
+
pkg['bugs'] = { url: `https://github.com/${repo.slug}/issues` };
|
|
39
|
+
writeFileSync(file, `${JSON.stringify(pkg, null, 2)}\n`);
|
|
40
|
+
return undefined;
|
|
41
|
+
};
|
|
42
|
+
// Root files the shared repo keeps for each extension; create never edits them.
|
|
43
|
+
export const rootEdits = (id) => [
|
|
44
|
+
` root edit in the shared repo root: ci.yml gets "${id}" in the MIN_EXECUTED map (start at 1)`,
|
|
45
|
+
` root README.md and CLAUDE.md list ${id}; agentage/e2e extensions.json needs a row for ${id}`,
|
|
46
|
+
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const pruneLib: (dir: string) => string[];
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { existsSync, readdirSync, readFileSync, rmdirSync, rmSync } from 'node:fs';
|
|
2
|
+
import { dirname, join, relative, resolve } from 'node:path';
|
|
3
|
+
const LIB = join('src', 'lib');
|
|
4
|
+
const CODE = /\.(?:[cm]?[jt]sx?)$/;
|
|
5
|
+
const TEST = /^(.*)\.(?:test|spec)(\.[cm]?[jt]sx?)$/;
|
|
6
|
+
const SKIP = new Set(['node_modules', '.git', 'dist', 'coverage']);
|
|
7
|
+
// from '..', import '..', import('..'), require('..'), vi.mock('..')
|
|
8
|
+
const SPEC = /(?:\bfrom\s*|\bimport\s*\(?\s*|\brequire\s*\(\s*|\bmock\s*\(\s*)(['"])(\.{1,2}\/[^'"]*|\.{1,2})\1/g;
|
|
9
|
+
const walk = (dir) => readdirSync(dir, { withFileTypes: true }).flatMap((entry) => {
|
|
10
|
+
if (SKIP.has(entry.name))
|
|
11
|
+
return [];
|
|
12
|
+
const path = join(dir, entry.name);
|
|
13
|
+
return entry.isDirectory() ? walk(path) : CODE.test(entry.name) ? [path] : [];
|
|
14
|
+
});
|
|
15
|
+
// `./a.js` names a.ts, a.tsx or a/index.ts in a nodenext repo.
|
|
16
|
+
const target = (from, spec, files) => {
|
|
17
|
+
const base = resolve(dirname(from), spec);
|
|
18
|
+
const bare = base.replace(/\.[cm]?js$/, '');
|
|
19
|
+
return [base, ...['.ts', '.tsx', '.mts', '.cts'].map((ext) => bare + ext)]
|
|
20
|
+
.concat(['.ts', '.tsx'].map((ext) => join(base, `index${ext}`)))
|
|
21
|
+
.find((path) => files.has(path));
|
|
22
|
+
};
|
|
23
|
+
const importsOf = (file, files) => [...readFileSync(file, 'utf8').matchAll(SPEC)].flatMap((m) => target(file, m[2] ?? '', files) ?? []);
|
|
24
|
+
// Every file outside src/lib is a root; a lib test is no root, it goes with the file it tests.
|
|
25
|
+
const reachable = (files, lib) => {
|
|
26
|
+
const seen = new Set();
|
|
27
|
+
const todo = [...files].filter((path) => !path.startsWith(lib));
|
|
28
|
+
for (let path = todo.pop(); path; path = todo.pop()) {
|
|
29
|
+
if (seen.has(path))
|
|
30
|
+
continue;
|
|
31
|
+
seen.add(path);
|
|
32
|
+
todo.push(...importsOf(path, files));
|
|
33
|
+
}
|
|
34
|
+
return seen;
|
|
35
|
+
};
|
|
36
|
+
const emptyDirs = (dir) => {
|
|
37
|
+
for (const entry of readdirSync(dir, { withFileTypes: true }))
|
|
38
|
+
if (entry.isDirectory())
|
|
39
|
+
emptyDirs(join(dir, entry.name));
|
|
40
|
+
if (readdirSync(dir).length === 0)
|
|
41
|
+
rmdirSync(dir);
|
|
42
|
+
};
|
|
43
|
+
// Removes the src/lib files (and their tests) that no kept file imports, so no dead file lowers the coverage.
|
|
44
|
+
export const pruneLib = (dir) => {
|
|
45
|
+
const lib = `${resolve(dir, LIB)}/`;
|
|
46
|
+
if (!existsSync(lib))
|
|
47
|
+
return [];
|
|
48
|
+
const files = new Set(walk(resolve(dir)));
|
|
49
|
+
const used = reachable(files, lib);
|
|
50
|
+
const inLib = [...files].filter((path) => path.startsWith(lib));
|
|
51
|
+
const dead = inLib.filter((path) => !TEST.test(path) && !used.has(path));
|
|
52
|
+
const gone = new Set(dead.map((path) => path.replace(CODE, '')));
|
|
53
|
+
const tests = inLib.filter((path) => gone.has(TEST.exec(path)?.[1] ?? '\0'));
|
|
54
|
+
for (const path of [...dead, ...tests])
|
|
55
|
+
rmSync(path, { force: true });
|
|
56
|
+
emptyDirs(lib);
|
|
57
|
+
return [...dead, ...tests].map((path) => relative(resolve(dir), path));
|
|
58
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { execFile } from 'node:child_process';
|
|
2
2
|
import { lstatSync, mkdtempSync, readdirSync, renameSync, rmSync } from 'node:fs';
|
|
3
|
-
import { join } from 'node:path';
|
|
3
|
+
import { basename, dirname, join } from 'node:path';
|
|
4
4
|
import { promisify } from 'node:util';
|
|
5
5
|
import { holdSignals } from '../../core/loader/dispose.js';
|
|
6
6
|
const run = promisify(execFile);
|
|
@@ -55,7 +55,7 @@ const refuseLinks = (dir, from) => {
|
|
|
55
55
|
// Removes only what this run made; also the Ctrl-C path, so it never throws.
|
|
56
56
|
export const removeOwn = (path) => rmSync(path, { recursive: true, force: true });
|
|
57
57
|
// A fresh name beside the new folder (a rename across disks fails), so no folder of yours is reused.
|
|
58
|
-
const cloneFolder = (dir, folder) => folder ? mkdtempSync(`.${dir}.clone-`) : dir;
|
|
58
|
+
const cloneFolder = (dir, folder) => folder ? mkdtempSync(join(dirname(dir), `.${basename(dir)}.clone-`)) : dir;
|
|
59
59
|
// With :folder only that folder stays; a signal during the clone removes this run's folders, then exits as it would.
|
|
60
60
|
export const clone = async (url, from, dir) => {
|
|
61
61
|
const { folder } = repoRef(from);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type Command } from 'commander';
|
|
2
1
|
import { installCreated } from './create-install.js';
|
|
3
2
|
import { TEMPLATE } from './create-source.js';
|
|
4
3
|
import { type ConfirmIo } from './lifecycle.js';
|
|
@@ -10,8 +9,9 @@ export interface ExtensionCreateOptions {
|
|
|
10
9
|
from?: string;
|
|
11
10
|
install?: boolean;
|
|
12
11
|
yes?: boolean;
|
|
12
|
+
blank?: boolean;
|
|
13
|
+
into?: string;
|
|
13
14
|
json?: boolean;
|
|
14
15
|
}
|
|
15
16
|
export declare const splitParts: (parts: string[]) => string[];
|
|
16
17
|
export declare const runExtensionCreate: (opts: ExtensionCreateOptions, url?: (from: string) => string, after?: typeof installCreated, io?: ConfirmIo) => Promise<unknown>;
|
|
17
|
-
export declare const addCreate: (group: Command, create: (o: ExtensionCreateOptions) => Promise<void>) => Command;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { existsSync, readdirSync, readFileSync, renameSync, rmSync, writeFileSync } from 'node:fs';
|
|
2
2
|
import { join, resolve } from 'node:path';
|
|
3
|
-
import {} from '
|
|
4
|
-
import { addJson, CliError } from '../../lib/json-output.js';
|
|
3
|
+
import { CliError } from '../../lib/json-output.js';
|
|
5
4
|
import { siteFqdn } from '../../lib/net/origins.js';
|
|
6
5
|
import { installCreated, trustFrom } from './create-install.js';
|
|
6
|
+
import { applyBlank } from './create-blank.js';
|
|
7
|
+
import { pruneLib } from './create-lib.js';
|
|
8
|
+
import { lowerFloor } from './create-floor.js';
|
|
9
|
+
import { intoRefusal, rootEdits, shapeShared } from './create-into.js';
|
|
7
10
|
import { markFolder } from './create-markers.js';
|
|
8
11
|
import { devDropped, PRUNE, syncLockRoot } from './create-prune.js';
|
|
9
12
|
import { clone, fromRefusal, repoRef, TEMPLATE } from './create-source.js';
|
|
@@ -16,7 +19,7 @@ const WORD = /(?<![A-Za-z0-9])template(?![A-Za-z0-9])/g;
|
|
|
16
19
|
const LOCK = 'package-lock.json';
|
|
17
20
|
// Parts come as separate words, comma lists or both: `app,api`, `app api`, `app, api`.
|
|
18
21
|
export const splitParts = (parts) => parts.flatMap((part) => part.split(/[\s,]+/)).filter(Boolean);
|
|
19
|
-
const refusal = ({ id, parts, from = TEMPLATE }, kept) => {
|
|
22
|
+
const refusal = ({ id, parts, from = TEMPLATE, into }, kept) => {
|
|
20
23
|
const unknown = parts.find((part) => !PARTS.includes(part));
|
|
21
24
|
if (unknown)
|
|
22
25
|
return `unknown part ${unknown}: one of ${PARTS.join(', ')}`;
|
|
@@ -28,6 +31,8 @@ const refusal = ({ id, parts, from = TEMPLATE }, kept) => {
|
|
|
28
31
|
return `an extension needs at least one of ${ROUTED.join(', ')}`;
|
|
29
32
|
if (fromRefusal(from))
|
|
30
33
|
return fromRefusal(from);
|
|
34
|
+
if (into)
|
|
35
|
+
return intoRefusal(into, id);
|
|
31
36
|
return existsSync(`extension-${id}`)
|
|
32
37
|
? `extension-${id} exists: pick another id or remove it`
|
|
33
38
|
: '';
|
|
@@ -82,32 +87,21 @@ const renameLock = (dir, id) => {
|
|
|
82
87
|
syncLockRoot(root, json(join(dir, 'package.json'))['devDependencies'] ?? {});
|
|
83
88
|
save(join(dir, LOCK), lock);
|
|
84
89
|
};
|
|
85
|
-
const CI = join('.github', 'workflows', 'ci.yml');
|
|
86
|
-
const FLOOR = /MIN_EXECUTED: '\d+'/;
|
|
87
|
-
const LOWERED = " ci MIN_EXECUTED is 1: after the first green run, set it to the gate's count";
|
|
88
|
-
const BY_HAND = ` ci no MIN_EXECUTED line found in ${CI}: set it by hand to the gate's count`;
|
|
89
|
-
// The template's floor counts the gate's tests for all eight parts; a subset's count is unknown.
|
|
90
|
-
const lowerFloor = (dir, kept) => {
|
|
91
|
-
if (kept.length === PARTS.length)
|
|
92
|
-
return undefined;
|
|
93
|
-
const file = join(dir, CI);
|
|
94
|
-
const text = existsSync(file) ? readFileSync(file, 'utf8') : '';
|
|
95
|
-
if (!FLOOR.test(text))
|
|
96
|
-
return BY_HAND;
|
|
97
|
-
writeFileSync(file, text.replace(FLOOR, "MIN_EXECUTED: '1'"));
|
|
98
|
-
return LOWERED;
|
|
99
|
-
};
|
|
100
90
|
// A half-made folder is removed, so a re-run is not refused as "exists".
|
|
101
|
-
const shape = (dir, from, id, kept) => {
|
|
91
|
+
const shape = (dir, from, id, kept, { blank, into }) => {
|
|
102
92
|
try {
|
|
93
|
+
applyBlank(dir, blank);
|
|
103
94
|
drop(dir, kept);
|
|
95
|
+
pruneLib(dir);
|
|
104
96
|
markFolder(dir, kept, PARTS);
|
|
105
97
|
rewrite(dir, id);
|
|
106
98
|
renameLock(dir, id);
|
|
107
|
-
return lowerFloor(dir, kept);
|
|
99
|
+
return into ? shapeShared(dir, into, id) : lowerFloor(dir, kept, PARTS.length);
|
|
108
100
|
}
|
|
109
101
|
catch (err) {
|
|
110
102
|
rmSync(dir, { recursive: true, force: true });
|
|
103
|
+
if (err instanceof CliError)
|
|
104
|
+
throw err;
|
|
111
105
|
throw new Error(`template ${from}: ${err.message}`);
|
|
112
106
|
}
|
|
113
107
|
};
|
|
@@ -115,7 +109,9 @@ const shape = (dir, from, id, kept) => {
|
|
|
115
109
|
const hostLine = (id) => process.env['AGENTAGE_SITE_FQDN']?.trim()
|
|
116
110
|
? `host ${id}.${siteFqdn()}`
|
|
117
111
|
: `host ${id} on your site (set AGENTAGE_SITE_FQDN to print its address)`;
|
|
118
|
-
|
|
112
|
+
// With no install, the folder has no node_modules: npm ci comes first, and npx runs the pinned cli.
|
|
113
|
+
const nextStep = (dir, install) => `cd ${dir} && ${install ? '' : 'npm ci && '}npx agentage extension up`;
|
|
114
|
+
const printNext = (dir, from, id, kept, install) => {
|
|
119
115
|
const kit = String(json(join(dir, 'package.json'))['dependencies']?.['@agentage/extension'] ?? '?');
|
|
120
116
|
const { repo, ref, folder } = repoRef(from);
|
|
121
117
|
const branch = ref ? `branch ${ref}` : 'default branch';
|
|
@@ -124,7 +120,7 @@ const printNext = (dir, from, id, kept) => {
|
|
|
124
120
|
const contract = kept.includes('mcp') ? ` · contract ${id}.mcpc.json` : '';
|
|
125
121
|
console.log(` folder ${resolve(dir)}`);
|
|
126
122
|
console.log(` id ${id} · ${hostLine(id)}${contract}`);
|
|
127
|
-
console.log(` next
|
|
123
|
+
console.log(` next ${nextStep(dir, install)}`);
|
|
128
124
|
};
|
|
129
125
|
// Clones the template's default branch (or the #branch of --from; only its :folder) into ./extension-<id>, no history;
|
|
130
126
|
// then installs its dependencies, builds it and (unless --no-install) gives it to the daemon.
|
|
@@ -136,20 +132,13 @@ export const runExtensionCreate = async (opts, url = (from) => `https://github.c
|
|
|
136
132
|
if (refused)
|
|
137
133
|
throw new CliError('invalid_argument', refused);
|
|
138
134
|
await trustFrom(from, opts, opts.json ? { ...io, isTTY: false } : io);
|
|
139
|
-
const dir = `extension-${id}`;
|
|
135
|
+
const dir = opts.into ? join(opts.into, id) : `extension-${id}`;
|
|
140
136
|
await clone(url(repoRef(from).repo), from, dir);
|
|
141
|
-
const ci = shape(dir, from, id, kept);
|
|
142
|
-
printNext(dir, from, id, kept);
|
|
137
|
+
const ci = shape(dir, from, id, kept, opts);
|
|
138
|
+
printNext(dir, from, id, kept, opts.install !== false);
|
|
143
139
|
if (ci)
|
|
144
140
|
console.log(ci);
|
|
141
|
+
if (opts.into)
|
|
142
|
+
rootEdits(id).forEach((line) => console.log(line));
|
|
145
143
|
return { id, dir, from, kept, ...(await after(dir, opts.install !== false)) };
|
|
146
144
|
};
|
|
147
|
-
export const addCreate = (group, create) => addJson(group
|
|
148
|
-
.command('create')
|
|
149
|
-
.description('Create ./extension-<id> from the extension template with the parts named')
|
|
150
|
-
.argument('<id>', 'the extension id, also its host and contract name')
|
|
151
|
-
.argument('[parts...]', `parts to keep (default: all eight): ${PARTS.join(', ')}`)
|
|
152
|
-
.option('--from <owner/repo[#branch][:folder]>', `the template repo and folder (default: ${TEMPLATE})`)
|
|
153
|
-
.option('--no-install', 'build the folder, but do not give it to the daemon')
|
|
154
|
-
.option('--yes', 'run code from another --from repo or branch without asking')
|
|
155
|
-
.addHelpText('after', '\nExample:\n agentage extension create my-ext app api (parts may also be app,api)')).action((id, parts, o) => create({ id, parts, ...o }));
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import {} from 'commander';
|
|
2
2
|
import { addBuild } from './build.js';
|
|
3
3
|
import { addRelease } from './release.js';
|
|
4
|
-
import { addCreate } from './create.js';
|
|
4
|
+
import { addCreate } from './create-command.js';
|
|
5
|
+
import {} from './create.js';
|
|
5
6
|
import {} from './doctor.js';
|
|
6
7
|
import { addLifecycle } from './lifecycle-commands.js';
|
|
7
8
|
import { addMarket } from './market-commands.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentage/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.82.0",
|
|
4
4
|
"description": "The agentage CLI - connect this machine to agentage from the terminal",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"@agentage/apphost": "0.8.5",
|
|
58
|
-
"@agentage/extension": "0.25.
|
|
58
|
+
"@agentage/extension": "0.25.10",
|
|
59
59
|
"@electric-sql/pglite": "^0.6.0",
|
|
60
60
|
"@tailwindcss/postcss": "^4.3.5",
|
|
61
61
|
"chalk": "^6.0.0",
|