create-plico 0.0.0-reserved.0 → 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/NOTICE +4 -0
- package/README.md +10 -3
- package/dist/cli.d.ts +3 -0
- package/dist/cli.js +131 -0
- package/dist/direct-run.d.ts +5 -0
- package/dist/direct-run.js +16 -0
- package/dist/files.d.ts +12 -0
- package/dist/files.js +145 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/prompts.d.ts +23 -0
- package/dist/prompts.js +10 -0
- package/dist/providers.d.ts +16 -0
- package/dist/providers.js +32 -0
- package/dist/scaffold.d.ts +2 -0
- package/dist/scaffold.js +38 -0
- package/dist/types.d.ts +7 -0
- package/dist/types.js +1 -0
- package/dist/usage.d.ts +2 -0
- package/dist/usage.js +9 -0
- package/package.json +46 -7
- package/cli.js +0 -3
package/NOTICE
ADDED
package/README.md
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
# create-plico
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Scaffold generator for the internal-ops starter project.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
- `pnpm --filter create-plico exec create-plico my-plico`
|
|
8
|
+
- `pnpm --filter create-plico exec create-plico`
|
|
9
|
+
- `create-plico --help` prints usage and `create-plico --version` prints the version. Any other argument that starts with `-` is rejected, so a typo never becomes a directory name.
|
|
10
|
+
|
|
11
|
+
`create-plico my-plico --provider anthropic|openai|google|openai-compatible` configures a model and writes the matching `.env.example` and adapter dependency. The interactive flow asks for the provider; without `--provider`, a non-interactive run configures none. The scaffold also writes a `package.json` with `dev`, `validate` and `eval` scripts, `@plico-ai/cli` as a dev dependency, and a `.gitignore` for `.plico/` and `.env`.
|
|
12
|
+
|
|
13
|
+
The generated scaffold includes the required Plico project files and directories so it is immediately valid and can complete `plico run --dry` without extra setup.
|
package/dist/cli.d.ts
ADDED
package/dist/cli.js
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { basename } from "node:path";
|
|
3
|
+
import { isDirectRun } from "./direct-run.js";
|
|
4
|
+
import { createInternalOpsScaffold } from "./index.js";
|
|
5
|
+
import { defaultScaffoldPrompts } from "./prompts.js";
|
|
6
|
+
import { isScaffoldProvider, PROVIDER_CHOICES, PROVIDER_SETUP, } from "./providers.js";
|
|
7
|
+
import { readVersion, USAGE } from "./usage.js";
|
|
8
|
+
function deriveProjectName(targetDir) {
|
|
9
|
+
const baseName = basename(targetDir).trim();
|
|
10
|
+
if (!baseName || baseName === "." || baseName === "/") {
|
|
11
|
+
return "Internal Ops Agent";
|
|
12
|
+
}
|
|
13
|
+
return baseName
|
|
14
|
+
.replace(/[-_]+/g, " ")
|
|
15
|
+
.replace(/\s+/g, " ")
|
|
16
|
+
.trim()
|
|
17
|
+
.replace(/\b\w/g, (character) => character.toUpperCase());
|
|
18
|
+
}
|
|
19
|
+
async function promptForText(prompts, options) {
|
|
20
|
+
const value = await prompts.text(options);
|
|
21
|
+
if (prompts.isCancel(value)) {
|
|
22
|
+
prompts.cancel("Scaffold creation cancelled.");
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
return String(value);
|
|
26
|
+
}
|
|
27
|
+
function formatError(error) {
|
|
28
|
+
return error instanceof Error ? error.message : String(error);
|
|
29
|
+
}
|
|
30
|
+
export async function main(argv, prompts = defaultScaffoldPrompts) {
|
|
31
|
+
const args = argv.slice(2);
|
|
32
|
+
if (args.some((arg) => arg === "--help" || arg === "-h")) {
|
|
33
|
+
console.log(USAGE);
|
|
34
|
+
return 0;
|
|
35
|
+
}
|
|
36
|
+
if (args.some((arg) => arg === "--version" || arg === "-v")) {
|
|
37
|
+
console.log(readVersion());
|
|
38
|
+
return 0;
|
|
39
|
+
}
|
|
40
|
+
let providerName;
|
|
41
|
+
const positional = [];
|
|
42
|
+
const unknownOptions = [];
|
|
43
|
+
for (let index = 0; index < args.length; index++) {
|
|
44
|
+
const arg = args[index];
|
|
45
|
+
if (arg === "--provider")
|
|
46
|
+
providerName = args[++index] ?? "";
|
|
47
|
+
else if (arg.startsWith("--provider="))
|
|
48
|
+
providerName = arg.slice("--provider=".length);
|
|
49
|
+
else if (arg.startsWith("-"))
|
|
50
|
+
unknownOptions.push(arg);
|
|
51
|
+
else
|
|
52
|
+
positional.push(arg);
|
|
53
|
+
}
|
|
54
|
+
const unknownOption = unknownOptions[0];
|
|
55
|
+
if (unknownOption !== undefined) {
|
|
56
|
+
console.error(`Unknown option: ${unknownOption}`);
|
|
57
|
+
console.error(USAGE);
|
|
58
|
+
return 1;
|
|
59
|
+
}
|
|
60
|
+
if (providerName !== undefined && !isScaffoldProvider(providerName)) {
|
|
61
|
+
console.error(`Unknown provider: ${providerName}. Use ${PROVIDER_CHOICES.join(", ")}.`);
|
|
62
|
+
return 1;
|
|
63
|
+
}
|
|
64
|
+
const provider = providerName;
|
|
65
|
+
const [targetDir, projectName] = positional;
|
|
66
|
+
if (targetDir) {
|
|
67
|
+
try {
|
|
68
|
+
await createInternalOpsScaffold({
|
|
69
|
+
targetDir,
|
|
70
|
+
projectName: projectName ?? deriveProjectName(targetDir),
|
|
71
|
+
...(provider ? { provider } : {}),
|
|
72
|
+
});
|
|
73
|
+
console.log(`Created Plico scaffold in ${targetDir}`);
|
|
74
|
+
return 0;
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
console.error(formatError(error));
|
|
78
|
+
return 1;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
prompts.intro("Create a Plico scaffold");
|
|
82
|
+
const promptedTargetDir = await promptForText(prompts, {
|
|
83
|
+
message: "Where should I create it?",
|
|
84
|
+
placeholder: "my-plico",
|
|
85
|
+
defaultValue: "my-plico",
|
|
86
|
+
});
|
|
87
|
+
if (promptedTargetDir === null) {
|
|
88
|
+
return 1;
|
|
89
|
+
}
|
|
90
|
+
const promptedProjectName = await promptForText(prompts, {
|
|
91
|
+
message: "Project name?",
|
|
92
|
+
defaultValue: deriveProjectName(promptedTargetDir),
|
|
93
|
+
});
|
|
94
|
+
if (promptedProjectName === null) {
|
|
95
|
+
return 1;
|
|
96
|
+
}
|
|
97
|
+
const choice = provider ??
|
|
98
|
+
(await prompts.select({
|
|
99
|
+
message: "Which model provider?",
|
|
100
|
+
options: [
|
|
101
|
+
...PROVIDER_CHOICES.map((value) => ({ value, label: PROVIDER_SETUP[value].label })),
|
|
102
|
+
{ value: "none", label: "None yet (dry runs only)" },
|
|
103
|
+
],
|
|
104
|
+
}));
|
|
105
|
+
if (prompts.isCancel(choice)) {
|
|
106
|
+
prompts.cancel("Scaffold creation cancelled.");
|
|
107
|
+
return 1;
|
|
108
|
+
}
|
|
109
|
+
const task = prompts.spinner();
|
|
110
|
+
task.start("Creating scaffold...");
|
|
111
|
+
try {
|
|
112
|
+
await createInternalOpsScaffold({
|
|
113
|
+
targetDir: promptedTargetDir,
|
|
114
|
+
projectName: promptedProjectName,
|
|
115
|
+
...(typeof choice === "string" && isScaffoldProvider(choice) ? { provider: choice } : {}),
|
|
116
|
+
});
|
|
117
|
+
task.stop(`Created scaffold in ${promptedTargetDir}`);
|
|
118
|
+
prompts.outro(`Generated ${promptedProjectName}`);
|
|
119
|
+
return 0;
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
task.stop("Scaffold creation failed.");
|
|
123
|
+
prompts.cancel(formatError(error));
|
|
124
|
+
return 1;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
if (isDirectRun(import.meta.url, process.argv[1])) {
|
|
128
|
+
main(process.argv).then((code) => {
|
|
129
|
+
process.exitCode = code;
|
|
130
|
+
});
|
|
131
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* True when this module is the script node was started with. npm and pnpm reach a bin through a
|
|
3
|
+
* symlink, so compare resolved paths rather than the raw `argv[1]` and module URL.
|
|
4
|
+
*/
|
|
5
|
+
export declare function isDirectRun(moduleUrl: string, entry: string | undefined): boolean;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { realpathSync } from "node:fs";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
/**
|
|
4
|
+
* True when this module is the script node was started with. npm and pnpm reach a bin through a
|
|
5
|
+
* symlink, so compare resolved paths rather than the raw `argv[1]` and module URL.
|
|
6
|
+
*/
|
|
7
|
+
export function isDirectRun(moduleUrl, entry) {
|
|
8
|
+
if (!entry)
|
|
9
|
+
return false;
|
|
10
|
+
try {
|
|
11
|
+
return realpathSync.native(entry) === realpathSync.native(fileURLToPath(moduleUrl));
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
}
|
package/dist/files.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ScaffoldProvider } from "./providers.js";
|
|
2
|
+
export declare function configFile(projectName: string, provider?: ScaffoldProvider): string;
|
|
3
|
+
export declare function packageFile(version: string, provider?: ScaffoldProvider): string;
|
|
4
|
+
export declare function envExampleFile(provider?: ScaffoldProvider): string;
|
|
5
|
+
export declare function gitignoreFile(): string;
|
|
6
|
+
export declare function agentFile(projectName: string): string;
|
|
7
|
+
export declare function triageSkillFile(): string;
|
|
8
|
+
export declare function toolsReadmeFile(): string;
|
|
9
|
+
export declare function smokeEvalFile(): string;
|
|
10
|
+
export declare function memoryReadmeFile(): string;
|
|
11
|
+
export declare function artifactsReadmeFile(): string;
|
|
12
|
+
export declare function projectReadmeFile(projectName: string): string;
|
package/dist/files.js
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { PROVIDER_SETUP } from "./providers.js";
|
|
2
|
+
export function configFile(projectName, provider) {
|
|
3
|
+
const setup = provider ? PROVIDER_SETUP[provider] : undefined;
|
|
4
|
+
return [
|
|
5
|
+
'import { defineConfig } from "@plico-ai/sdk";',
|
|
6
|
+
"",
|
|
7
|
+
"export default defineConfig({",
|
|
8
|
+
" schemaVersion: 1,",
|
|
9
|
+
` name: ${JSON.stringify(projectName)},`,
|
|
10
|
+
' template: "internal-ops",',
|
|
11
|
+
...(provider && setup
|
|
12
|
+
? [
|
|
13
|
+
" model: {",
|
|
14
|
+
` provider: ${JSON.stringify(provider)},`,
|
|
15
|
+
` name: ${JSON.stringify(setup.model)},`,
|
|
16
|
+
...(setup.baseURL
|
|
17
|
+
? [
|
|
18
|
+
` baseURL: ${JSON.stringify(setup.baseURL)},`,
|
|
19
|
+
` apiKeyEnv: ${JSON.stringify(setup.apiKeyEnv)},`,
|
|
20
|
+
]
|
|
21
|
+
: []),
|
|
22
|
+
" },",
|
|
23
|
+
]
|
|
24
|
+
: []),
|
|
25
|
+
"});",
|
|
26
|
+
"",
|
|
27
|
+
].join("\n");
|
|
28
|
+
}
|
|
29
|
+
export function packageFile(version, provider) {
|
|
30
|
+
const adapter = provider ? PROVIDER_SETUP[provider].adapter : undefined;
|
|
31
|
+
return `${JSON.stringify({
|
|
32
|
+
private: true,
|
|
33
|
+
type: "module",
|
|
34
|
+
scripts: {
|
|
35
|
+
dev: "plico serve --studio .",
|
|
36
|
+
validate: "plico validate .",
|
|
37
|
+
eval: "plico eval .",
|
|
38
|
+
},
|
|
39
|
+
dependencies: { "@plico-ai/sdk": `^${version}`, ...(adapter ? { [adapter]: "latest" } : {}) },
|
|
40
|
+
devDependencies: { "@plico-ai/cli": `^${version}` },
|
|
41
|
+
}, null, 2)}\n`;
|
|
42
|
+
}
|
|
43
|
+
export function envExampleFile(provider) {
|
|
44
|
+
const setup = provider ? PROVIDER_SETUP[provider] : undefined;
|
|
45
|
+
if (!setup)
|
|
46
|
+
return "# Copy to .env and add a model provider key when you configure one in plico.config.ts.\n";
|
|
47
|
+
return [
|
|
48
|
+
"# Copy to .env. Plico loads it for `plico run`, `plico serve` and `plico readiness`.",
|
|
49
|
+
...(setup.placeholderKey
|
|
50
|
+
? [`# ${setup.label} ignores the key, but the adapter needs a value.`]
|
|
51
|
+
: []),
|
|
52
|
+
`${setup.apiKeyEnv}=${setup.placeholderKey ?? ""}`,
|
|
53
|
+
"",
|
|
54
|
+
].join("\n");
|
|
55
|
+
}
|
|
56
|
+
export function gitignoreFile() {
|
|
57
|
+
return [".plico/", ".env", "node_modules/", ""].join("\n");
|
|
58
|
+
}
|
|
59
|
+
export function agentFile(projectName) {
|
|
60
|
+
return [
|
|
61
|
+
`# ${projectName}`,
|
|
62
|
+
"",
|
|
63
|
+
"This project is organized file-first.",
|
|
64
|
+
"",
|
|
65
|
+
"## Working Principles",
|
|
66
|
+
"",
|
|
67
|
+
"- Start from the Markdown instructions in this repository.",
|
|
68
|
+
"- Use the project files as the source of truth.",
|
|
69
|
+
"- Keep changes scoped and easy to validate.",
|
|
70
|
+
"",
|
|
71
|
+
"## First Pass",
|
|
72
|
+
"",
|
|
73
|
+
"- Read `plico.config.ts` and `agent.md`.",
|
|
74
|
+
"- Inspect `skills/`, `tools/`, `evals/`, `artifacts/`, and `memory/`.",
|
|
75
|
+
"- Add project-specific instructions before expanding the scaffold.",
|
|
76
|
+
"",
|
|
77
|
+
].join("\n");
|
|
78
|
+
}
|
|
79
|
+
export function triageSkillFile() {
|
|
80
|
+
return [
|
|
81
|
+
"---",
|
|
82
|
+
"description: Review incoming work items and choose the smallest safe next step.",
|
|
83
|
+
"---",
|
|
84
|
+
"# Triage",
|
|
85
|
+
"",
|
|
86
|
+
"Review incoming work items, identify the smallest safe next step, and record the outcome.",
|
|
87
|
+
"",
|
|
88
|
+
"Focus on the project files first, then the surrounding context.",
|
|
89
|
+
"",
|
|
90
|
+
].join("\n");
|
|
91
|
+
}
|
|
92
|
+
export function toolsReadmeFile() {
|
|
93
|
+
return [
|
|
94
|
+
"# Tools",
|
|
95
|
+
"",
|
|
96
|
+
"Add TypeScript tool modules here when the project needs executable helpers.",
|
|
97
|
+
"",
|
|
98
|
+
"Keep the public contract file-first until tools are explicitly required.",
|
|
99
|
+
"",
|
|
100
|
+
"A tool handler receives `(input, { signal, idempotencyKey })`. A run that is interrupted can repeat",
|
|
101
|
+
"the tool call that was in flight, so pass `idempotencyKey` to any API that takes one. The key is",
|
|
102
|
+
"stable for a call, and `signal` aborts when the run is cancelled.",
|
|
103
|
+
"",
|
|
104
|
+
"Set `inputSchema` to a JSON Schema object or a Zod 3 or 4 schema. Plico validates each call and",
|
|
105
|
+
"sends JSON Schema to the model. Parsed Zod values, including defaults, reach the handler. Add",
|
|
106
|
+
"`zod` to this project's dependencies before importing it in a tool.",
|
|
107
|
+
"",
|
|
108
|
+
'Wrap a tool in `defineTool` from `"@plico-ai/sdk"` to type the handler `input` from its `inputSchema`.',
|
|
109
|
+
"",
|
|
110
|
+
].join("\n");
|
|
111
|
+
}
|
|
112
|
+
export function smokeEvalFile() {
|
|
113
|
+
return [
|
|
114
|
+
"# Smoke Eval",
|
|
115
|
+
"",
|
|
116
|
+
"Verify the scaffold boots, validates, and presents a clear starting point.",
|
|
117
|
+
"",
|
|
118
|
+
].join("\n");
|
|
119
|
+
}
|
|
120
|
+
export function memoryReadmeFile() {
|
|
121
|
+
return [
|
|
122
|
+
"# Memory",
|
|
123
|
+
"",
|
|
124
|
+
"Use this folder for durable project notes, decisions, and recurring context.",
|
|
125
|
+
"",
|
|
126
|
+
].join("\n");
|
|
127
|
+
}
|
|
128
|
+
export function artifactsReadmeFile() {
|
|
129
|
+
return [
|
|
130
|
+
"# Artifacts",
|
|
131
|
+
"",
|
|
132
|
+
"Use this folder for generated outputs that belong to the project.",
|
|
133
|
+
"",
|
|
134
|
+
].join("\n");
|
|
135
|
+
}
|
|
136
|
+
export function projectReadmeFile(projectName) {
|
|
137
|
+
return [
|
|
138
|
+
`# ${projectName}`,
|
|
139
|
+
"",
|
|
140
|
+
"Canonical internal-ops starter project generated by create-plico.",
|
|
141
|
+
"",
|
|
142
|
+
"Start with `agent.md`, then inspect `skills/`, `tools/`, `evals/`, `memory/`, and `artifacts/`.",
|
|
143
|
+
"",
|
|
144
|
+
].join("\n");
|
|
145
|
+
}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createInternalOpsScaffold } from "./scaffold.js";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface ScaffoldPrompts {
|
|
2
|
+
intro(message: string): void;
|
|
3
|
+
outro(message: string): void;
|
|
4
|
+
text(options: {
|
|
5
|
+
message: string;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
defaultValue?: string;
|
|
8
|
+
}): Promise<string | symbol>;
|
|
9
|
+
select(options: {
|
|
10
|
+
message: string;
|
|
11
|
+
options: Array<{
|
|
12
|
+
value: string;
|
|
13
|
+
label: string;
|
|
14
|
+
}>;
|
|
15
|
+
}): Promise<string | symbol>;
|
|
16
|
+
spinner(): {
|
|
17
|
+
start(message: string): void;
|
|
18
|
+
stop(message?: string): void;
|
|
19
|
+
};
|
|
20
|
+
cancel(message: string): void;
|
|
21
|
+
isCancel(value: unknown): boolean;
|
|
22
|
+
}
|
|
23
|
+
export declare const defaultScaffoldPrompts: ScaffoldPrompts;
|
package/dist/prompts.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const PROVIDER_CHOICES: readonly ["anthropic", "openai", "google", "openai-compatible"];
|
|
2
|
+
export type ScaffoldProvider = (typeof PROVIDER_CHOICES)[number];
|
|
3
|
+
interface ProviderSetup {
|
|
4
|
+
label: string;
|
|
5
|
+
model: string;
|
|
6
|
+
/** The environment variable the provider reads its key from. Absent for a local server. */
|
|
7
|
+
apiKeyEnv?: string;
|
|
8
|
+
/** A value to prefill in `.env.example`, for a server that ignores the key. */
|
|
9
|
+
placeholderKey?: string;
|
|
10
|
+
baseURL?: string;
|
|
11
|
+
/** The AI SDK adapter package the project installs. Absent when none is needed. */
|
|
12
|
+
adapter?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare const PROVIDER_SETUP: Record<ScaffoldProvider, ProviderSetup>;
|
|
15
|
+
export declare function isScaffoldProvider(value: string): value is ScaffoldProvider;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export const PROVIDER_CHOICES = ["anthropic", "openai", "google", "openai-compatible"];
|
|
2
|
+
export const PROVIDER_SETUP = {
|
|
3
|
+
anthropic: {
|
|
4
|
+
label: "Anthropic",
|
|
5
|
+
model: "claude-sonnet-5-5",
|
|
6
|
+
apiKeyEnv: "ANTHROPIC_API_KEY",
|
|
7
|
+
adapter: "@ai-sdk/anthropic",
|
|
8
|
+
},
|
|
9
|
+
openai: {
|
|
10
|
+
label: "OpenAI",
|
|
11
|
+
model: "gpt-5",
|
|
12
|
+
apiKeyEnv: "OPENAI_API_KEY",
|
|
13
|
+
adapter: "@ai-sdk/openai",
|
|
14
|
+
},
|
|
15
|
+
google: {
|
|
16
|
+
label: "Google",
|
|
17
|
+
model: "gemini-2.5-flash",
|
|
18
|
+
apiKeyEnv: "GOOGLE_GENERATIVE_AI_API_KEY",
|
|
19
|
+
adapter: "@ai-sdk/google",
|
|
20
|
+
},
|
|
21
|
+
"openai-compatible": {
|
|
22
|
+
label: "OpenAI-compatible server (Ollama, OpenRouter, LiteLLM)",
|
|
23
|
+
model: "llama3.1",
|
|
24
|
+
// The adapter needs some key. Ollama ignores it, so the scaffold supplies a placeholder.
|
|
25
|
+
apiKeyEnv: "OLLAMA_API_KEY",
|
|
26
|
+
placeholderKey: "ollama",
|
|
27
|
+
baseURL: "http://localhost:11434/v1",
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
export function isScaffoldProvider(value) {
|
|
31
|
+
return PROVIDER_CHOICES.includes(value);
|
|
32
|
+
}
|
package/dist/scaffold.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { mkdir, readdir, writeFile } from "node:fs/promises";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { getProjectPaths, REQUIRED_PROJECT_DIRECTORIES } from "@plico-ai/core";
|
|
4
|
+
import { agentFile, artifactsReadmeFile, configFile, envExampleFile, gitignoreFile, memoryReadmeFile, packageFile, projectReadmeFile, smokeEvalFile, toolsReadmeFile, triageSkillFile, } from "./files.js";
|
|
5
|
+
import { readVersion } from "./usage.js";
|
|
6
|
+
export async function createInternalOpsScaffold(options) {
|
|
7
|
+
const root = options.targetDir;
|
|
8
|
+
const projectName = options.projectName ?? "Internal Ops Agent";
|
|
9
|
+
const projectPaths = getProjectPaths(root);
|
|
10
|
+
await ensureEmptyTarget(root);
|
|
11
|
+
await mkdir(root, { recursive: true });
|
|
12
|
+
await Promise.all(REQUIRED_PROJECT_DIRECTORIES.map((directoryRole) => mkdir(projectPaths.directories[directoryRole], { recursive: true })));
|
|
13
|
+
await writeFile(projectPaths.configFile, configFile(projectName, options.provider), "utf8");
|
|
14
|
+
await writeFile(join(root, "package.json"), packageFile(readVersion(), options.provider), "utf8");
|
|
15
|
+
await writeFile(join(root, ".env.example"), envExampleFile(options.provider), "utf8");
|
|
16
|
+
await writeFile(join(root, ".gitignore"), gitignoreFile(), "utf8");
|
|
17
|
+
await writeFile(projectPaths.agentFile, agentFile(projectName), "utf8");
|
|
18
|
+
await mkdir(join(projectPaths.directories.skills, "triage"), { recursive: true });
|
|
19
|
+
await writeFile(join(projectPaths.directories.skills, "triage", "SKILL.md"), triageSkillFile(), "utf8");
|
|
20
|
+
await writeFile(join(projectPaths.directories.tools, "readme.md"), toolsReadmeFile(), "utf8");
|
|
21
|
+
await writeFile(join(projectPaths.directories.evals, "smoke.md"), smokeEvalFile(), "utf8");
|
|
22
|
+
await writeFile(join(projectPaths.directories.memory, "README.md"), memoryReadmeFile(), "utf8");
|
|
23
|
+
await writeFile(join(projectPaths.directories.artifacts, "README.md"), artifactsReadmeFile(), "utf8");
|
|
24
|
+
await writeFile(join(root, "README.md"), projectReadmeFile(projectName), "utf8");
|
|
25
|
+
}
|
|
26
|
+
async function ensureEmptyTarget(root) {
|
|
27
|
+
let entries;
|
|
28
|
+
try {
|
|
29
|
+
entries = await readdir(root);
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
if (error && typeof error === "object" && "code" in error && error.code === "ENOENT")
|
|
33
|
+
return;
|
|
34
|
+
throw error;
|
|
35
|
+
}
|
|
36
|
+
if (entries.length > 0)
|
|
37
|
+
throw new Error(`Target directory is not empty: ${root}`);
|
|
38
|
+
}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ScaffoldProvider } from "./providers.js";
|
|
2
|
+
export interface ScaffoldOptions {
|
|
3
|
+
targetDir: string;
|
|
4
|
+
projectName?: string;
|
|
5
|
+
/** The model provider to configure. Without one the project has no model and runs `--dry`. */
|
|
6
|
+
provider?: ScaffoldProvider;
|
|
7
|
+
}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/usage.d.ts
ADDED
package/dist/usage.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
export const USAGE = [
|
|
3
|
+
"Usage: create-plico [directory] [project name] [--provider anthropic|openai|google|openai-compatible]",
|
|
4
|
+
" create-plico --help | --version",
|
|
5
|
+
].join("\n");
|
|
6
|
+
export function readVersion() {
|
|
7
|
+
const pkg = createRequire(import.meta.url)("../package.json");
|
|
8
|
+
return pkg.version;
|
|
9
|
+
}
|
package/package.json
CHANGED
|
@@ -1,17 +1,56 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-plico",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Scaffold a Plico agent project",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://plico.sohab.dev",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
|
-
"url": "git+https://github.com/ITZSHOAIB/plico.git"
|
|
9
|
+
"url": "git+https://github.com/ITZSHOAIB/plico.git",
|
|
10
|
+
"directory": "packages/create-plico"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"plico",
|
|
14
|
+
"agent",
|
|
15
|
+
"scaffold",
|
|
16
|
+
"create"
|
|
17
|
+
],
|
|
18
|
+
"publishConfig": {
|
|
19
|
+
"access": "public"
|
|
10
20
|
},
|
|
11
|
-
"keywords": ["plico", "create", "agent"],
|
|
12
21
|
"type": "module",
|
|
13
22
|
"bin": {
|
|
14
|
-
"create-plico": "./cli.js"
|
|
23
|
+
"create-plico": "./dist/cli.js"
|
|
24
|
+
},
|
|
25
|
+
"main": "./dist/index.js",
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"exports": {
|
|
28
|
+
".": {
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"default": "./dist/index.js"
|
|
31
|
+
},
|
|
32
|
+
"./cli": {
|
|
33
|
+
"types": "./dist/cli.d.ts",
|
|
34
|
+
"default": "./dist/cli.js"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"files": [
|
|
38
|
+
"NOTICE",
|
|
39
|
+
"dist"
|
|
40
|
+
],
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@clack/prompts": "^1.6.0",
|
|
43
|
+
"@plico-ai/core": "0.1.0"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@plico-ai/runtime": "0.1.0"
|
|
47
|
+
},
|
|
48
|
+
"engines": {
|
|
49
|
+
"node": ">=22.18.0"
|
|
15
50
|
},
|
|
16
|
-
"
|
|
17
|
-
|
|
51
|
+
"scripts": {
|
|
52
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
53
|
+
"build": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\" && tsc -p tsconfig.build.json",
|
|
54
|
+
"test": "vitest run"
|
|
55
|
+
}
|
|
56
|
+
}
|
package/cli.js
DELETED