Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ parts, `create` sets `MIN_EXECUTED` to 1. `MIN_EXECUTED` is the least number of
must run. After the first green run, set it to the real count. When `create` cannot find that
line, it says so and you set it by hand.

The template is the folder `template/` of the kit repo (`agentage/platform:template`); only that
The template is the folder `template/` of the kit repo (`agentage/kit:template`); only that
folder is copied, with no history. `--from <owner/repo>` takes another template repo at its root
(`agentage/extension-template` is the old template), `--from <owner/repo#branch>` one of its
branches, and `:folder` after either one folder of it. For any source other than the kit's
Expand Down
2 changes: 1 addition & 1 deletion docs/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ Makes `./extension-<id>` from a template, with no git history (the author guide,

| `--from` | Takes |
| ----------------------------------------------- | ------------------------------------------------------------------------------------------ |
| not given | `agentage/platform:template`, the folder `template/` of the kit repo |
| not given | `agentage/kit:template`, the folder `template/` of the kit repo |
| `owner/repo` | the root of that repo's default branch (`agentage/extension-template` is the old template) |
| `owner/repo#branch` | the root of that branch |
| `owner/repo:folder`, `owner/repo#branch:folder` | only that folder (dot files included); a missing folder or a link is refused |
Expand Down
4 changes: 2 additions & 2 deletions src/commands/extension/create-install.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,15 @@ describe('extension create --from another repo or a branch', () => {
const NOTICE = (from: string) =>
`template ${from}: code from that repo will be built and run on this machine`;

test.for(['agentage/platform:template', 'agentage/extension-template'])(
test.for(['agentage/kit:template', 'agentage/platform:template', 'agentage/extension-template'])(
'the template itself asks nothing: %s',
async (from) => {
const quiet = await output(() => trustFrom(from, {}, io(false).io));
expect(quiet).toMatchObject({ error: null, stderr: '' });
}
);

test.for(['acme/ext', 'agentage/extension-template#feature/x', 'agentage/platform:packages'])(
test.for(['acme/ext', 'agentage/extension-template#feature/x', 'agentage/kit:packages'])(
'%s with no terminal needs --yes, --no-install or not',
async (from) => {
const refused = await output(() => trustFrom(from, {}, io(false).io));
Expand Down
20 changes: 9 additions & 11 deletions src/commands/extension/create-kit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,12 @@ const listed = (dir: string): string[] =>
);

describe('extension create from the kit repo', () => {
test('the default is the folder template/ of agentage/platform', async () => {
expect(TEMPLATE).toBe('agentage/platform:template');
test('the default is the folder template/ of agentage/kit', async () => {
expect(TEMPLATE).toBe('agentage/kit:template');
const printed = await create();
expect(printed).toMatchObject({ error: null, stderr: '' });
expect(asked.at(-1)).toBe('agentage/platform');
expect(printed.lines[0]).toBe(
' template agentage/platform:template (default branch, kit 0.21.0)'
);
expect(asked.at(-1)).toBe('agentage/kit');
expect(printed.lines[0]).toBe(' template agentage/kit:template (default branch, kit 0.21.0)');
});

test('only template/ is copied, dot files and modes kept, no kit history', async () => {
Expand Down Expand Up @@ -96,14 +94,14 @@ describe('extension create from the kit repo', () => {
git(join(root, 'kit-work'), 'checkout', '-q', '-b', 'feature/t');
put(join(root, 'kit-work', 'other'), { ...TEMPLATE_FILES, 'branch.txt': 'b\n' });
pushKit(root, 'feature/t');
const printed = await create('agentage/platform#feature/t:other');
expect(printed.lines[0]).toMatch(/^ template {2}agentage\/platform:other \(branch feature\/t,/);
const printed = await create('agentage/kit#feature/t:other');
expect(printed.lines[0]).toMatch(/^ template {2}agentage\/kit:other \(branch feature\/t,/);
expect(read('branch.txt')).toBe('b\n');
});

test.for([
['a missing folder', 'agentage/platform:nope'],
['a link', 'agentage/platform:link'],
['a missing folder', 'agentage/kit:nope'],
['a link', 'agentage/kit:link'],
])('refuses %s with one line, no folder and no clone left', async ([, from]) => {
symlinkSync('template', join(root, 'kit-work', 'link'));
pushKit(root);
Expand All @@ -116,7 +114,7 @@ describe('extension create from the kit repo', () => {

test('a clone that fails leaves no clone folder', async () => {
const printed = await create(undefined, () => `file://${root}/none`);
expect(printed.error).toMatch(/^cannot clone template agentage\/platform:template: fatal/);
expect(printed.error).toMatch(/^cannot clone template agentage\/kit:template: fatal/);
expect(existsSync(join(root, made))).toBe(false);
expect(readdirSync(root).sort()).toEqual(['kit-work', 'kit.git']);
});
Expand Down
2 changes: 1 addition & 1 deletion src/commands/extension/create-safety.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ describe('extension create keeps to its own folders', () => {
});

test.for([
['in the folder', 'template/src', 'agentage/platform:template'],
['in the folder', 'template/src', 'agentage/kit:template'],
['at the root', 'src', 'agentage/extension-template'],
])('refuses a template with a symbolic link %s, nothing left', async ([, at = '', from]) => {
mkdirSync(join(root, 'kit-work', at), { recursive: true });
Expand Down
8 changes: 6 additions & 2 deletions src/commands/extension/create-source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ import { holdSignals } from '../../core/loader/dispose.js';

const run = promisify(execFile);
// The kit repo holds the template in its folder template/; the old repo held it at its root.
export const TEMPLATE = 'agentage/platform:template';
export const OWN_TEMPLATES = [TEMPLATE, 'agentage/extension-template'];
export const TEMPLATE = 'agentage/kit:template';
export const OWN_TEMPLATES = [
TEMPLATE,
'agentage/platform:template',
'agentage/extension-template',
];
// owner/repo, then #branch and :folder, each optional: nothing that can pass for a flag or leave the repo.
const FROM = /^[\w.-]+\/[\w.-]+(?:#\w[\w./-]*)?(?::\w[\w.-]*(?:\/\w[\w.-]*)*)?$/;

Expand Down