create-plico 0.0.0-stage → 0.1.1

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/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,4 @@
1
+ Plico
2
+ Copyright 2026 Plico contributors
3
+
4
+ This product includes software developed by the Plico contributors.
package/README.md CHANGED
@@ -1,3 +1,13 @@
1
- # Temporary Holding Version
1
+ # create-plico
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Scaffold generator for the internal-ops starter project. Part of [Plico](https://github.com/ITZSHOAIB/plico).
4
+
5
+ ## Usage
6
+
7
+ - `npm create plico@latest my-plico`
8
+ - `npx create-plico` asks for the folder name
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` and pass `plico eval` (it ships `evals/smoke.script.json`) after `npm install`.
package/dist/cli.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import { type ScaffoldPrompts } from "./prompts.js";
3
+ export declare function main(argv: string[], prompts?: ScaffoldPrompts): Promise<number>;
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
+ }
@@ -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,150 @@
1
+ import { PROVIDER_SETUP } from "./providers.js";
2
+ /** Matches the adapter ranges `@plico-ai/runtime` accepts as optional peer dependencies. */
3
+ const ADAPTER_RANGE = "^4.0.0";
4
+ export function configFile(projectName, provider) {
5
+ const setup = provider ? PROVIDER_SETUP[provider] : undefined;
6
+ return [
7
+ 'import { defineConfig } from "@plico-ai/sdk";',
8
+ "",
9
+ "export default defineConfig({",
10
+ " schemaVersion: 1,",
11
+ ` name: ${JSON.stringify(projectName)},`,
12
+ ' template: "internal-ops",',
13
+ ...(provider && setup
14
+ ? [
15
+ " model: {",
16
+ ` provider: ${JSON.stringify(provider)},`,
17
+ ` name: ${JSON.stringify(setup.model)},`,
18
+ ...(setup.baseURL
19
+ ? [
20
+ ` baseURL: ${JSON.stringify(setup.baseURL)},`,
21
+ ` apiKeyEnv: ${JSON.stringify(setup.apiKeyEnv)},`,
22
+ ]
23
+ : []),
24
+ " },",
25
+ ]
26
+ : []),
27
+ "});",
28
+ "",
29
+ ].join("\n");
30
+ }
31
+ export function packageFile(version, provider) {
32
+ const adapter = provider ? PROVIDER_SETUP[provider].adapter : undefined;
33
+ return `${JSON.stringify({
34
+ private: true,
35
+ type: "module",
36
+ scripts: {
37
+ dev: "plico serve --studio .",
38
+ validate: "plico validate .",
39
+ eval: "plico eval .",
40
+ },
41
+ dependencies: {
42
+ "@plico-ai/sdk": `^${version}`,
43
+ ...(adapter ? { [adapter]: ADAPTER_RANGE } : {}),
44
+ },
45
+ devDependencies: { "@plico-ai/cli": `^${version}` },
46
+ }, null, 2)}\n`;
47
+ }
48
+ export function envExampleFile(provider) {
49
+ const setup = provider ? PROVIDER_SETUP[provider] : undefined;
50
+ if (!setup)
51
+ return "# Copy to .env and add a model provider key when you configure one in plico.config.ts.\n";
52
+ return [
53
+ "# Copy to .env. Plico loads it for `plico run`, `plico serve` and `plico readiness`.",
54
+ ...(setup.placeholderKey
55
+ ? [`# ${setup.label} ignores the key, but the adapter needs a value.`]
56
+ : []),
57
+ `${setup.apiKeyEnv}=${setup.placeholderKey ?? ""}`,
58
+ "",
59
+ ].join("\n");
60
+ }
61
+ export function gitignoreFile() {
62
+ return [".plico/", ".env", "node_modules/", ""].join("\n");
63
+ }
64
+ export function agentFile(projectName) {
65
+ return [
66
+ `# ${projectName}`,
67
+ "",
68
+ "This project is organized file-first.",
69
+ "",
70
+ "## Working Principles",
71
+ "",
72
+ "- Start from the Markdown instructions in this repository.",
73
+ "- Use the project files as the source of truth.",
74
+ "- Keep changes scoped and easy to validate.",
75
+ "",
76
+ "## First Pass",
77
+ "",
78
+ "- Read `plico.config.ts` and `agent.md`.",
79
+ "- Inspect `skills/`, `tools/`, `evals/`, `artifacts/`, and `memory/`.",
80
+ "- Add project-specific instructions before expanding the scaffold.",
81
+ "",
82
+ ].join("\n");
83
+ }
84
+ export function triageSkillFile() {
85
+ return [
86
+ "---",
87
+ "description: Review incoming work items and choose the smallest safe next step.",
88
+ "---",
89
+ "# Triage",
90
+ "",
91
+ "Review incoming work items, identify the smallest safe next step, and record the outcome.",
92
+ "",
93
+ "Focus on the project files first, then the surrounding context.",
94
+ "",
95
+ ].join("\n");
96
+ }
97
+ export function toolsReadmeFile() {
98
+ return [
99
+ "# Tools",
100
+ "",
101
+ "Add TypeScript tool modules here when the project needs executable helpers.",
102
+ "",
103
+ "Keep the public contract file-first until tools are explicitly required.",
104
+ "",
105
+ "A tool handler receives `(input, { signal, idempotencyKey })`. A run that is interrupted can repeat",
106
+ "the tool call that was in flight, so pass `idempotencyKey` to any API that takes one. The key is",
107
+ "stable for a call, and `signal` aborts when the run is cancelled.",
108
+ "",
109
+ "Set `inputSchema` to a JSON Schema object or a Zod 3 or 4 schema. Plico validates each call and",
110
+ "sends JSON Schema to the model. Parsed Zod values, including defaults, reach the handler. Add",
111
+ "`zod` to this project's dependencies before importing it in a tool.",
112
+ "",
113
+ 'Wrap a tool in `defineTool` from `"@plico-ai/sdk"` to type the handler `input` from its `inputSchema`.',
114
+ "",
115
+ ].join("\n");
116
+ }
117
+ export function smokeEvalFile() {
118
+ return `${JSON.stringify({
119
+ description: "Scripted smoke case. It needs no model and no key, so it passes in CI. Replace the steps with calls to your own tools.",
120
+ script: [{ type: "assistant.output", content: "The project boots." }],
121
+ expect: { status: "completed", outputContains: "boots" },
122
+ }, null, 2)}
123
+ `;
124
+ }
125
+ export function memoryReadmeFile() {
126
+ return [
127
+ "# Memory",
128
+ "",
129
+ "Use this folder for durable project notes, decisions, and recurring context.",
130
+ "",
131
+ ].join("\n");
132
+ }
133
+ export function artifactsReadmeFile() {
134
+ return [
135
+ "# Artifacts",
136
+ "",
137
+ "Use this folder for generated outputs that belong to the project.",
138
+ "",
139
+ ].join("\n");
140
+ }
141
+ export function projectReadmeFile(projectName) {
142
+ return [
143
+ `# ${projectName}`,
144
+ "",
145
+ "Canonical internal-ops starter project generated by create-plico.",
146
+ "",
147
+ "Start with `agent.md`, then inspect `skills/`, `tools/`, `evals/`, `memory/`, and `artifacts/`.",
148
+ "",
149
+ ].join("\n");
150
+ }
@@ -0,0 +1,2 @@
1
+ export { createInternalOpsScaffold } from "./scaffold.js";
2
+ export type { ScaffoldOptions } from "./types.js";
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;
@@ -0,0 +1,10 @@
1
+ import { cancel, intro, isCancel, outro, select, spinner, text } from "@clack/prompts";
2
+ export const defaultScaffoldPrompts = {
3
+ intro,
4
+ outro,
5
+ text,
6
+ select: (options) => select(options),
7
+ spinner,
8
+ cancel,
9
+ isCancel,
10
+ };
@@ -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
+ }
@@ -0,0 +1,2 @@
1
+ import type { ScaffoldOptions } from "./types.js";
2
+ export declare function createInternalOpsScaffold(options: ScaffoldOptions): Promise<void>;
@@ -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.script.json"), 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
+ }
@@ -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 {};
@@ -0,0 +1,2 @@
1
+ export declare const USAGE: string;
2
+ export declare function readVersion(): string;
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,6 +1,56 @@
1
1
  {
2
2
  "name": "create-plico",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.1",
4
+ "description": "Scaffold a Plico agent project",
5
+ "license": "Apache-2.0",
6
+ "homepage": "https://plico.sohab.dev",
7
+ "repository": {
8
+ "type": "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"
20
+ },
21
+ "type": "module",
22
+ "bin": {
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.1"
44
+ },
45
+ "devDependencies": {
46
+ "@plico-ai/runtime": "0.1.1"
47
+ },
48
+ "engines": {
49
+ "node": ">=22.18.0"
50
+ },
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
+ }
6
56
  }