@cogineai/clawpacker 0.1.0 → 0.2.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/README.md +76 -38
- package/dist/cli.js +10 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/export.d.ts +2 -0
- package/dist/commands/export.js +28 -7
- package/dist/commands/export.js.map +1 -1
- package/dist/commands/import.d.ts +2 -0
- package/dist/commands/import.js +121 -23
- package/dist/commands/import.js.map +1 -1
- package/dist/commands/inspect.js +9 -7
- package/dist/commands/inspect.js.map +1 -1
- package/dist/commands/validate.d.ts +1 -0
- package/dist/commands/validate.js +12 -1
- package/dist/commands/validate.js.map +1 -1
- package/dist/core/agent-extract.js.map +1 -1
- package/dist/core/archive.d.ts +5 -0
- package/dist/core/archive.js +83 -0
- package/dist/core/archive.js.map +1 -0
- package/dist/core/constants.d.ts +10 -4
- package/dist/core/constants.js +25 -8
- package/dist/core/constants.js.map +1 -1
- package/dist/core/import-exec.d.ts +2 -2
- package/dist/core/import-exec.js +0 -3
- package/dist/core/import-exec.js.map +1 -1
- package/dist/core/import-plan.js +35 -17
- package/dist/core/import-plan.js.map +1 -1
- package/dist/core/manifest.d.ts +8 -0
- package/dist/core/manifest.js +28 -4
- package/dist/core/manifest.js.map +1 -1
- package/dist/core/openclaw-config.d.ts +34 -10
- package/dist/core/openclaw-config.js +133 -29
- package/dist/core/openclaw-config.js.map +1 -1
- package/dist/core/package-read.d.ts +5 -0
- package/dist/core/package-read.js +66 -3
- package/dist/core/package-read.js.map +1 -1
- package/dist/core/package-write.d.ts +14 -1
- package/dist/core/package-write.js +45 -4
- package/dist/core/package-write.js.map +1 -1
- package/dist/core/types.d.ts +82 -9
- package/dist/core/validate.js +14 -18
- package/dist/core/validate.js.map +1 -1
- package/dist/core/workspace-scan.js +46 -37
- package/dist/core/workspace-scan.js.map +1 -1
- package/dist/renderable-cli-error.d.ts +6 -0
- package/dist/renderable-cli-error.js +14 -0
- package/dist/renderable-cli-error.js.map +1 -0
- package/dist/utils/fs.d.ts +1 -0
- package/dist/utils/fs.js +14 -0
- package/dist/utils/fs.js.map +1 -0
- package/dist/utils/output.d.ts +5 -0
- package/dist/utils/output.js +14 -0
- package/dist/utils/output.js.map +1 -0
- package/package.json +12 -3
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ This is **template portability**, not full-instance backup.
|
|
|
19
19
|
|
|
20
20
|
## Status
|
|
21
21
|
|
|
22
|
-
**Internal alpha.** The current CLI is usable for
|
|
22
|
+
**Internal alpha.** The current CLI is usable for early experiments (package format v2), but the format and UX should still be treated as early-stage.
|
|
23
23
|
|
|
24
24
|
Use it when you want to:
|
|
25
25
|
|
|
@@ -29,21 +29,19 @@ Use it when you want to:
|
|
|
29
29
|
|
|
30
30
|
Do **not** treat it as a production-grade backup, archival, or disaster-recovery tool yet.
|
|
31
31
|
|
|
32
|
-
## What Clawpacker does
|
|
32
|
+
## What Clawpacker does
|
|
33
33
|
|
|
34
34
|
### Included
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
Clawpacker uses a **blacklist model** — it includes all files in the workspace (including subdirectories) except those matching explicit exclusion rules.
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
- `SOUL.md`
|
|
40
|
-
- `IDENTITY.md`
|
|
41
|
-
- `USER.md`
|
|
42
|
-
- `TOOLS.md`
|
|
43
|
-
- `MEMORY.md`
|
|
44
|
-
- `HEARTBEAT.md` if present
|
|
38
|
+
The following files are recognized as **bootstrap files** and flagged in the manifest:
|
|
45
39
|
|
|
46
|
-
|
|
40
|
+
`AGENTS.md`, `SOUL.md`, `IDENTITY.md`, `USER.md`, `TOOLS.md`, `MEMORY.md`, `HEARTBEAT.md`, `BOOTSTRAP.md`
|
|
41
|
+
|
|
42
|
+
All other workspace files are included as well, preserving directory structure.
|
|
43
|
+
|
|
44
|
+
The package also contains metadata:
|
|
47
45
|
|
|
48
46
|
- `manifest.json`
|
|
49
47
|
- `config/agent.json`
|
|
@@ -54,27 +52,38 @@ It also writes package metadata:
|
|
|
54
52
|
|
|
55
53
|
### Excluded
|
|
56
54
|
|
|
57
|
-
Clawpacker
|
|
55
|
+
Clawpacker excludes the following subdirectories if they appear inside the workspace:
|
|
56
|
+
|
|
57
|
+
- `.git`
|
|
58
|
+
- `.openclaw`
|
|
59
|
+
- `node_modules`
|
|
60
|
+
|
|
61
|
+
And these file patterns:
|
|
58
62
|
|
|
59
63
|
- `memory/*.md` daily logs
|
|
64
|
+
|
|
65
|
+
These rules only apply to contents **within** the scanned workspace directory. The parent `~/.openclaw/` installation and its config files are not part of the workspace scan — OpenClaw config is read separately via `--config` or config discovery.
|
|
66
|
+
|
|
67
|
+
Beyond file-level exclusions, Clawpacker never exports or restores:
|
|
68
|
+
|
|
60
69
|
- secrets, auth state, cookies, API keys, credentials
|
|
61
70
|
- session/runtime state
|
|
62
71
|
- channel bindings / routing state
|
|
63
72
|
- globally installed skills or extensions
|
|
64
73
|
- machine-specific absolute-path behavior that is not portable
|
|
65
74
|
|
|
66
|
-
### Skills model
|
|
75
|
+
### Skills model
|
|
67
76
|
|
|
68
77
|
Skills are **manifest-only** right now.
|
|
69
78
|
|
|
70
|
-
That means Clawpacker records detected skill references, but it does not bundle or install skill implementations for you.
|
|
79
|
+
That means Clawpacker records detected skill references (using backtick-quoted references like `` `skill-name` ``), but it does not bundle or install skill implementations for you.
|
|
71
80
|
|
|
72
81
|
## Install
|
|
73
82
|
|
|
74
83
|
### Published package
|
|
75
84
|
|
|
76
85
|
```bash
|
|
77
|
-
npm install -g clawpacker
|
|
86
|
+
npm install -g @cogineai/clawpacker
|
|
78
87
|
clawpacker --help
|
|
79
88
|
```
|
|
80
89
|
|
|
@@ -100,7 +109,7 @@ node dist/cli.js --help
|
|
|
100
109
|
After building, the CLI exposes four commands:
|
|
101
110
|
|
|
102
111
|
- `inspect` — analyze a workspace before packaging
|
|
103
|
-
- `export` — write a `.ocpkg/` directory
|
|
112
|
+
- `export` — write a `.ocpkg/` directory or `.ocpkg.tar.gz` archive
|
|
104
113
|
- `import` — restore a package into a target workspace
|
|
105
114
|
- `validate` — verify an imported workspace target
|
|
106
115
|
|
|
@@ -143,10 +152,12 @@ What `inspect` tells you:
|
|
|
143
152
|
- whether a portable agent definition could be derived
|
|
144
153
|
- which fields are portable vs import-time inputs
|
|
145
154
|
- which skills were detected
|
|
146
|
-
-
|
|
155
|
+
- warnings you should expect on export/import
|
|
147
156
|
|
|
148
157
|
### 2) Export a package
|
|
149
158
|
|
|
159
|
+
Directory package:
|
|
160
|
+
|
|
150
161
|
```bash
|
|
151
162
|
node dist/cli.js export \
|
|
152
163
|
--workspace ./tests/fixtures/source-workspace \
|
|
@@ -155,7 +166,20 @@ node dist/cli.js export \
|
|
|
155
166
|
--name supercoder-template
|
|
156
167
|
```
|
|
157
168
|
|
|
158
|
-
|
|
169
|
+
Single-file archive:
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
node dist/cli.js export \
|
|
173
|
+
--workspace ./tests/fixtures/source-workspace \
|
|
174
|
+
--config ./tests/fixtures/openclaw-config/source-config.jsonc \
|
|
175
|
+
--out ./tests/tmp/example-supercoder.ocpkg \
|
|
176
|
+
--name supercoder-template \
|
|
177
|
+
--archive
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
The `--archive` flag produces a `.ocpkg.tar.gz` file for easier transport.
|
|
181
|
+
|
|
182
|
+
Output defaults to human-readable text. Add `--json` for machine-readable output:
|
|
159
183
|
|
|
160
184
|
```json
|
|
161
185
|
{
|
|
@@ -168,6 +192,8 @@ Current output is JSON, for example:
|
|
|
168
192
|
|
|
169
193
|
### 3) Import a package
|
|
170
194
|
|
|
195
|
+
Accepts both `.ocpkg/` directories and `.ocpkg.tar.gz` archives:
|
|
196
|
+
|
|
171
197
|
```bash
|
|
172
198
|
node dist/cli.js import \
|
|
173
199
|
./tests/tmp/example-supercoder.ocpkg \
|
|
@@ -176,10 +202,21 @@ node dist/cli.js import \
|
|
|
176
202
|
--config ./tests/tmp/target-openclaw-config.json
|
|
177
203
|
```
|
|
178
204
|
|
|
205
|
+
Preview the import plan without writing anything:
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
node dist/cli.js import \
|
|
209
|
+
./tests/tmp/example-supercoder.ocpkg \
|
|
210
|
+
--target-workspace ./tests/tmp/workspace-supercoder-imported \
|
|
211
|
+
--agent-id supercoder-imported \
|
|
212
|
+
--dry-run
|
|
213
|
+
```
|
|
214
|
+
|
|
179
215
|
Notes:
|
|
180
216
|
|
|
181
217
|
- `--target-workspace` is required
|
|
182
218
|
- `--agent-id` is strongly recommended and becomes required in practice for collision-safe import planning
|
|
219
|
+
- `--dry-run` prints the import plan and exits without writing files
|
|
183
220
|
- if the target workspace or target agent already exists, import blocks unless you pass `--force`
|
|
184
221
|
- if no config is found, import can still restore workspace files, but config registration becomes limited
|
|
185
222
|
|
|
@@ -192,7 +229,7 @@ node dist/cli.js validate \
|
|
|
192
229
|
--config ./tests/tmp/target-openclaw-config.json
|
|
193
230
|
```
|
|
194
231
|
|
|
195
|
-
|
|
232
|
+
Output defaults to human-readable text. Add `--json` for a structured report with:
|
|
196
233
|
|
|
197
234
|
- `passed`
|
|
198
235
|
- `warnings`
|
|
@@ -212,24 +249,23 @@ When you provide `--config`, or when import can discover a nearby OpenClaw confi
|
|
|
212
249
|
|
|
213
250
|
### Config discovery behavior
|
|
214
251
|
|
|
215
|
-
|
|
252
|
+
Config is resolved in this order:
|
|
216
253
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
- `~/.openclaw/config.jsonc`
|
|
254
|
+
1. explicit `--config` flag
|
|
255
|
+
2. `OPENCLAW_CONFIG_PATH` environment variable
|
|
256
|
+
3. `~/.openclaw/openclaw.json` (default)
|
|
221
257
|
|
|
222
258
|
### Portable config philosophy
|
|
223
259
|
|
|
224
260
|
Clawpacker does **not** export raw OpenClaw config wholesale.
|
|
225
261
|
|
|
226
|
-
Instead, it extracts a
|
|
262
|
+
Instead, it extracts a portable slice of agent config, including:
|
|
227
263
|
|
|
228
|
-
-
|
|
229
|
-
- suggested display name
|
|
264
|
+
- agent id and display name
|
|
230
265
|
- workspace basename suggestion
|
|
231
266
|
- identity name
|
|
232
267
|
- default model, when present
|
|
268
|
+
- tools, skills, heartbeat, sandbox, and runtime settings
|
|
233
269
|
|
|
234
270
|
And it explicitly excludes things like:
|
|
235
271
|
|
|
@@ -243,8 +279,8 @@ Clawpacker is designed to be conservative.
|
|
|
243
279
|
|
|
244
280
|
### Export safety
|
|
245
281
|
|
|
246
|
-
-
|
|
247
|
-
- daily memory logs are excluded by default
|
|
282
|
+
- all workspace files are included except explicitly excluded directories and patterns
|
|
283
|
+
- daily memory logs (`memory/*.md`) are excluded by default
|
|
248
284
|
- package contents are declared in a manifest instead of hidden in opaque state
|
|
249
285
|
- checksums are generated for integrity verification
|
|
250
286
|
|
|
@@ -267,7 +303,7 @@ Even after a successful import, you should still:
|
|
|
267
303
|
|
|
268
304
|
## Package structure
|
|
269
305
|
|
|
270
|
-
A typical
|
|
306
|
+
A typical package looks like this:
|
|
271
307
|
|
|
272
308
|
```text
|
|
273
309
|
supercoder-template.ocpkg/
|
|
@@ -280,6 +316,9 @@ supercoder-template.ocpkg/
|
|
|
280
316
|
TOOLS.md
|
|
281
317
|
MEMORY.md
|
|
282
318
|
HEARTBEAT.md
|
|
319
|
+
custom-prompts/
|
|
320
|
+
review.md
|
|
321
|
+
... # any other workspace files
|
|
283
322
|
config/
|
|
284
323
|
agent.json
|
|
285
324
|
import-hints.json
|
|
@@ -289,34 +328,33 @@ supercoder-template.ocpkg/
|
|
|
289
328
|
export-report.json
|
|
290
329
|
```
|
|
291
330
|
|
|
292
|
-
|
|
331
|
+
The `workspace/` directory mirrors the source workspace structure. All non-excluded files are included, so the contents vary depending on what lives in the source workspace.
|
|
332
|
+
|
|
333
|
+
Packages can also be distributed as single-file `.ocpkg.tar.gz` archives.
|
|
334
|
+
|
|
335
|
+
## What is intentionally out of scope
|
|
293
336
|
|
|
294
337
|
- full OpenClaw instance backup
|
|
295
338
|
- secret migration
|
|
296
339
|
- auth/session migration
|
|
297
340
|
- channel binding export/import
|
|
298
341
|
- packaging globally installed skill implementations
|
|
299
|
-
- archive transport formats beyond the current directory package flow
|
|
300
342
|
- zero-touch import across mismatched environments
|
|
301
343
|
|
|
302
344
|
## Roadmap / known limitations
|
|
303
345
|
|
|
304
346
|
Near-term likely improvements:
|
|
305
347
|
|
|
306
|
-
- publishable npm package + stable binary release
|
|
307
|
-
- friendlier non-JSON output for `export`, `import`, and `validate`
|
|
308
|
-
- optional archive packaging for transport
|
|
309
348
|
- richer import guidance when models or skills are missing
|
|
310
349
|
- optional packaging for workspace-local skill folders
|
|
311
350
|
- better package compatibility/version negotiation
|
|
312
351
|
|
|
313
352
|
Current limitations to be aware of:
|
|
314
353
|
|
|
315
|
-
- package format should still be treated as
|
|
354
|
+
- package format should still be treated as early-stage (currently v2)
|
|
316
355
|
- skills are detected, but not bundled
|
|
317
356
|
- import assumes conservative file-level replacement semantics via `--force`
|
|
318
357
|
- OpenClaw config support is minimal by design
|
|
319
|
-
- examples currently assume local source usage, not a published global install
|
|
320
358
|
|
|
321
359
|
## Development
|
|
322
360
|
|
|
@@ -359,7 +397,7 @@ npm test
|
|
|
359
397
|
|
|
360
398
|
## Naming
|
|
361
399
|
|
|
362
|
-
The npm package name is
|
|
400
|
+
The npm package name is **`@cogineai/clawpacker`** while the GitHub repository remains **`cogine-ai/clawpack`**.
|
|
363
401
|
|
|
364
402
|
Why this naming split:
|
|
365
403
|
|
package/dist/cli.js
CHANGED
|
@@ -6,6 +6,7 @@ const export_1 = require("./commands/export");
|
|
|
6
6
|
const import_1 = require("./commands/import");
|
|
7
7
|
const inspect_1 = require("./commands/inspect");
|
|
8
8
|
const validate_1 = require("./commands/validate");
|
|
9
|
+
const renderable_cli_error_1 = require("./renderable-cli-error");
|
|
9
10
|
const program = new commander_1.Command();
|
|
10
11
|
program
|
|
11
12
|
.name('clawpacker')
|
|
@@ -16,7 +17,15 @@ program
|
|
|
16
17
|
(0, import_1.registerImportCommand)(program.command('import'));
|
|
17
18
|
(0, validate_1.registerValidateCommand)(program.command('validate'));
|
|
18
19
|
program.parseAsync(process.argv).catch((error) => {
|
|
19
|
-
|
|
20
|
+
if ((0, renderable_cli_error_1.isRenderableCliError)(error)) {
|
|
21
|
+
console.error(error.render());
|
|
22
|
+
}
|
|
23
|
+
else if (error instanceof Error) {
|
|
24
|
+
console.error(error.message);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
console.error(String(error));
|
|
28
|
+
}
|
|
20
29
|
process.exitCode = 1;
|
|
21
30
|
});
|
|
22
31
|
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;AAEA,yCAAoC;AACpC,8CAA0D;AAC1D,8CAA0D;AAC1D,gDAA4D;AAC5D,kDAA8D;AAE9D,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,YAAY,CAAC;KAClB,WAAW,CAAC,2EAA2E,CAAC;KACxF,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,IAAA,gCAAsB,EAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;AACnD,IAAA,8BAAqB,EAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;AACjD,IAAA,8BAAqB,EAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;AACjD,IAAA,kCAAuB,EAAC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;AAErD,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;IACxD,OAAO,CAAC,KAAK,CAAC,KAAK,CA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|
agentId?: string;
|
|
8
|
+
archive?: boolean;
|
|
9
|
+
json?: boolean;
|
|
8
10
|
}
|
|
9
11
|
export declare function runExport(options: ExportOptions): Promise<void>;
|
|
10
12
|
export declare function registerExportCommand(command: Command): void;
|
package/dist/commands/export.js
CHANGED
|
@@ -7,6 +7,7 @@ exports.runExport = runExport;
|
|
|
7
7
|
exports.registerExportCommand = registerExportCommand;
|
|
8
8
|
const node_path_1 = __importDefault(require("node:path"));
|
|
9
9
|
const agent_extract_1 = require("../core/agent-extract");
|
|
10
|
+
const openclaw_config_1 = require("../core/openclaw-config");
|
|
10
11
|
const package_write_1 = require("../core/package-write");
|
|
11
12
|
const skills_detect_1 = require("../core/skills-detect");
|
|
12
13
|
const workspace_scan_1 = require("../core/workspace-scan");
|
|
@@ -20,29 +21,49 @@ async function runExport(options) {
|
|
|
20
21
|
configPath: options.config,
|
|
21
22
|
agentId: options.agentId,
|
|
22
23
|
});
|
|
23
|
-
const
|
|
24
|
-
|
|
24
|
+
const openclawVersion = await (0, openclaw_config_1.detectOpenClawVersion)({
|
|
25
|
+
configPath: options.config,
|
|
26
|
+
cwd: scan.workspacePath,
|
|
27
|
+
});
|
|
28
|
+
const packageName = options.name ?? node_path_1.default.basename(options.out).replace(/\.ocpkg(\.tar\.gz)?$/, '');
|
|
29
|
+
const writeParams = {
|
|
25
30
|
outputPath: node_path_1.default.resolve(options.out),
|
|
26
31
|
packageName,
|
|
27
32
|
scan,
|
|
28
33
|
skills,
|
|
29
34
|
agentDefinition,
|
|
30
|
-
|
|
31
|
-
|
|
35
|
+
openclawVersion,
|
|
36
|
+
};
|
|
37
|
+
const result = options.archive
|
|
38
|
+
? await (0, package_write_1.writePackageArchive)(writeParams)
|
|
39
|
+
: await (0, package_write_1.writePackageDirectory)(writeParams);
|
|
40
|
+
const report = {
|
|
32
41
|
status: 'ok',
|
|
33
42
|
packageRoot: result.packageRoot,
|
|
34
43
|
manifestPath: result.manifestPath,
|
|
35
44
|
fileCount: result.fileCount,
|
|
36
|
-
}
|
|
45
|
+
};
|
|
46
|
+
if (options.json) {
|
|
47
|
+
console.log(JSON.stringify(report, null, 2));
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
console.log([
|
|
51
|
+
'Export complete',
|
|
52
|
+
` Package: ${report.packageRoot}`,
|
|
53
|
+
` Manifest: ${report.manifestPath}`,
|
|
54
|
+
` Files: ${report.fileCount}`,
|
|
55
|
+
].join('\n'));
|
|
37
56
|
}
|
|
38
57
|
function registerExportCommand(command) {
|
|
39
58
|
command
|
|
40
|
-
.description('Export a portable .ocpkg directory from a workspace.')
|
|
59
|
+
.description('Export a portable .ocpkg directory or .ocpkg.tar.gz archive from a workspace.')
|
|
41
60
|
.requiredOption('--workspace <path>', 'Source workspace path')
|
|
42
|
-
.requiredOption('--out <path>', 'Output package
|
|
61
|
+
.requiredOption('--out <path>', 'Output package path')
|
|
43
62
|
.option('--name <package-name>', 'Package name override')
|
|
44
63
|
.option('--config <path>', 'OpenClaw config path')
|
|
45
64
|
.option('--agent-id <id>', 'Source agent id override')
|
|
65
|
+
.option('--archive', 'Produce a .ocpkg.tar.gz single-file archive')
|
|
66
|
+
.option('--json', 'Emit the full machine-readable JSON report')
|
|
46
67
|
.action(runExport);
|
|
47
68
|
}
|
|
48
69
|
//# sourceMappingURL=export.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"export.js","sourceRoot":"","sources":["../../src/commands/export.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"export.js","sourceRoot":"","sources":["../../src/commands/export.ts"],"names":[],"mappings":";;;;;AAkBA,8BAmDC;AAED,sDAWC;AAlFD,0DAA6B;AAE7B,yDAA+D;AAC/D,6DAAgE;AAChE,yDAAmF;AACnF,yDAAqD;AACrD,2DAAuD;AAYhD,KAAK,UAAU,SAAS,CAAC,OAAsB;IACpD,IAAI,CAAC,OAAO,CAAC,SAAS,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;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jB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC7C,OAAO;IACT,CAAC;IAED,OAAO,CAAC,GAAG,CACT;QACE,iBAAiB;QACjB,cAAc,MAAM,CAAC,WAAW,EAAE;QAClC,eAAe,MAAM,CAAC,YAAY,EAAE;QACpC,YAAY,MAAM,CAAC,SAAS,EAAE;KAC/B,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;AACJ,CAAC;AAED,SAAgB,qBAAqB,CAAC,OAAgB;IACpD,OAAO;SACJ,WAAW,CAAC,+EAA+E,CAAC;SAC5F,cAAc,CAAC,oBAAoB,EAAE,uBAAuB,CAAC;SAC7D,cAAc,CAAC,cAAc,EAAE,qBAAqB,CAAC;SACrD,MAAM,CAAC,uBAAuB,EAAE,uBAAuB,CAAC;SACxD,MAAM,CAAC,iBAAiB,EAAE,sBAAsB,CAAC;SACjD,MAAM,CAAC,iBAAiB,EAAE,0BAA0B,CAAC;SACrD,MAAM,CAAC,WAAW,EAAE,6CAA6C,CAAC;SAClE,MAAM,CAAC,QAAQ,EAAE,4CAA4C,CAAC;SAC9D,MAAM,CAAC,SAAS,CAAC,CAAC;AACvB,CAAC"}
|
|
@@ -4,6 +4,8 @@ interface ImportOptions {
|
|
|
4
4
|
agentId?: string;
|
|
5
5
|
config?: string;
|
|
6
6
|
force?: boolean;
|
|
7
|
+
json?: boolean;
|
|
8
|
+
dryRun?: boolean;
|
|
7
9
|
}
|
|
8
10
|
export declare function runImport(packagePath: string, options: ImportOptions): Promise<void>;
|
|
9
11
|
export declare function registerImportCommand(command: Command): void;
|
package/dist/commands/import.js
CHANGED
|
@@ -10,33 +10,129 @@ const import_exec_1 = require("../core/import-exec");
|
|
|
10
10
|
const openclaw_config_1 = require("../core/openclaw-config");
|
|
11
11
|
const import_plan_1 = require("../core/import-plan");
|
|
12
12
|
const package_read_1 = require("../core/package-read");
|
|
13
|
+
const renderable_cli_error_1 = require("../renderable-cli-error");
|
|
14
|
+
const output_1 = require("../utils/output");
|
|
15
|
+
class ImportBlockedError extends Error {
|
|
16
|
+
report;
|
|
17
|
+
asJson;
|
|
18
|
+
[renderable_cli_error_1.renderableCliErrorBrand] = true;
|
|
19
|
+
constructor(report, asJson) {
|
|
20
|
+
super(formatBlockedImportReport(report));
|
|
21
|
+
this.report = report;
|
|
22
|
+
this.asJson = asJson;
|
|
23
|
+
this.name = 'ImportBlockedError';
|
|
24
|
+
}
|
|
25
|
+
render() {
|
|
26
|
+
return this.asJson
|
|
27
|
+
? JSON.stringify(this.report, null, 2)
|
|
28
|
+
: this.message;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function formatRequiredInputKey(key) {
|
|
32
|
+
if (key === 'agentId') {
|
|
33
|
+
return '--agent-id';
|
|
34
|
+
}
|
|
35
|
+
if (key === 'targetWorkspacePath') {
|
|
36
|
+
return '--target-workspace';
|
|
37
|
+
}
|
|
38
|
+
return key;
|
|
39
|
+
}
|
|
40
|
+
function formatBlockedImportReport(report) {
|
|
41
|
+
const { summary } = report.writePlan;
|
|
42
|
+
const lines = ['Import blocked'];
|
|
43
|
+
(0, output_1.pushSection)(lines, 'Blocked by', report.failed);
|
|
44
|
+
(0, output_1.pushSection)(lines, 'Required inputs', report.requiredInputs.map((item) => `${formatRequiredInputKey(item.key)}: ${item.reason}`));
|
|
45
|
+
(0, output_1.pushSection)(lines, 'Warnings', report.warnings);
|
|
46
|
+
(0, output_1.pushSection)(lines, 'Next steps', report.nextSteps);
|
|
47
|
+
lines.push('', 'Planned import:', `- target workspace: ${report.writePlan.targetWorkspacePath}`, `- target agent id: ${report.writePlan.targetAgentId ?? 'not set'}`, `- workspace files: ${summary.fileCount}`);
|
|
48
|
+
if (report.writePlan.targetConfigPath) {
|
|
49
|
+
lines.push(`- target config: ${report.writePlan.targetConfigPath}`);
|
|
50
|
+
}
|
|
51
|
+
if (summary.existingWorkspaceDetected) {
|
|
52
|
+
lines.push('- existing workspace detected: yes');
|
|
53
|
+
}
|
|
54
|
+
if (summary.configAgentCollision) {
|
|
55
|
+
lines.push('- target config agent collision detected: yes');
|
|
56
|
+
}
|
|
57
|
+
return lines.join('\n');
|
|
58
|
+
}
|
|
59
|
+
function formatDryRunImportReport(report) {
|
|
60
|
+
const { summary } = report.writePlan;
|
|
61
|
+
const lines = ['Import dry run'];
|
|
62
|
+
(0, output_1.pushSection)(lines, 'Warnings', report.warnings);
|
|
63
|
+
(0, output_1.pushSection)(lines, 'Next steps', report.nextSteps);
|
|
64
|
+
lines.push('', 'Planned import:', `- target workspace: ${report.writePlan.targetWorkspacePath}`, `- target agent id: ${report.writePlan.targetAgentId ?? 'not set'}`, `- workspace files: ${summary.fileCount}`);
|
|
65
|
+
if (report.writePlan.targetConfigPath) {
|
|
66
|
+
lines.push(`- target config: ${report.writePlan.targetConfigPath}`);
|
|
67
|
+
}
|
|
68
|
+
if (summary.existingWorkspaceDetected) {
|
|
69
|
+
lines.push('- existing workspace detected: yes');
|
|
70
|
+
}
|
|
71
|
+
if (summary.configAgentCollision) {
|
|
72
|
+
lines.push('- target config agent collision detected: yes');
|
|
73
|
+
}
|
|
74
|
+
return lines.join('\n');
|
|
75
|
+
}
|
|
13
76
|
async function runImport(packagePath, options) {
|
|
14
77
|
if (!packagePath || !options.targetWorkspace) {
|
|
15
78
|
throw new Error('import requires <package-path> and --target-workspace <path>');
|
|
16
79
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
80
|
+
let tempDir;
|
|
81
|
+
try {
|
|
82
|
+
const pkg = await (0, package_read_1.readPackage)(node_path_1.default.resolve(packagePath), {
|
|
83
|
+
onTempDir(dir) { tempDir = dir; },
|
|
84
|
+
});
|
|
85
|
+
const configPath = options.config
|
|
86
|
+
? node_path_1.default.resolve(options.config)
|
|
87
|
+
: (await (0, openclaw_config_1.discoverOpenClawConfig)({ cwd: node_path_1.default.resolve(options.targetWorkspace) }).catch(() => undefined))?.configPath;
|
|
88
|
+
const plan = await (0, import_plan_1.planImport)({
|
|
89
|
+
pkg,
|
|
90
|
+
targetWorkspacePath: node_path_1.default.resolve(options.targetWorkspace),
|
|
91
|
+
targetAgentId: options.agentId,
|
|
92
|
+
targetConfigPath: configPath,
|
|
93
|
+
force: options.force,
|
|
94
|
+
});
|
|
95
|
+
if (!plan.canProceed) {
|
|
96
|
+
throw new ImportBlockedError({
|
|
97
|
+
status: 'blocked',
|
|
98
|
+
failed: plan.failed,
|
|
99
|
+
requiredInputs: plan.requiredInputs,
|
|
100
|
+
warnings: plan.warnings,
|
|
101
|
+
nextSteps: plan.nextSteps,
|
|
102
|
+
writePlan: plan.writePlan,
|
|
103
|
+
}, options.json === true);
|
|
104
|
+
}
|
|
105
|
+
if (options.dryRun) {
|
|
106
|
+
const report = {
|
|
107
|
+
status: 'dry-run',
|
|
108
|
+
warnings: plan.warnings,
|
|
109
|
+
nextSteps: plan.nextSteps,
|
|
110
|
+
writePlan: plan.writePlan,
|
|
111
|
+
};
|
|
112
|
+
console.log(options.json ? JSON.stringify(report, null, 2) : formatDryRunImportReport(report));
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
const result = await (0, import_exec_1.executeImport)({ pkg, plan });
|
|
116
|
+
if (options.json) {
|
|
117
|
+
console.log(JSON.stringify(result, null, 2));
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
const lines = [
|
|
121
|
+
'Import complete',
|
|
122
|
+
` Workspace: ${result.targetWorkspacePath}`,
|
|
123
|
+
` Agent id: ${result.agentId}`,
|
|
124
|
+
` Imported files: ${result.importedFiles.length}`,
|
|
125
|
+
` Metadata files: ${result.metadataFiles.length}`,
|
|
126
|
+
];
|
|
127
|
+
(0, output_1.pushSection)(lines, 'Warnings', result.warnings);
|
|
128
|
+
(0, output_1.pushSection)(lines, 'Next steps', result.nextSteps);
|
|
129
|
+
console.log(lines.join('\n'));
|
|
130
|
+
}
|
|
131
|
+
finally {
|
|
132
|
+
if (tempDir) {
|
|
133
|
+
await (0, package_read_1.cleanupTempDir)(tempDir);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
40
136
|
}
|
|
41
137
|
function registerImportCommand(command) {
|
|
42
138
|
command
|
|
@@ -46,6 +142,8 @@ function registerImportCommand(command) {
|
|
|
46
142
|
.option('--agent-id <id>', 'Target agent id override')
|
|
47
143
|
.option('--config <path>', 'Target OpenClaw config path')
|
|
48
144
|
.option('--force', 'Overwrite an existing target workspace')
|
|
145
|
+
.option('--dry-run', 'Print the import plan and exit without writing files')
|
|
146
|
+
.option('--json', 'Emit the full machine-readable JSON report')
|
|
49
147
|
.action(runImport);
|
|
50
148
|
}
|
|
51
149
|
//# sourceMappingURL=import.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import.js","sourceRoot":"","sources":["../../src/commands/import.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"import.js","sourceRoot":"","sources":["../../src/commands/import.ts"],"names":[],"mappings":";;;;;AAiIA,8BAsEC;AAED,sDAWC;AApND,0DAA6B;AAE7B,qDAAoD;AACpD,6DAAiE;AACjE,qDAAiD;AACjD,uDAAmE;AAEnE,kEAGiC;AACjC,4CAA8C;AAsB9C,MAAM,kBAAmB,SAAQ,KAAK;IAIzB;IACQ;IAJV,CAAC,8CAAuB,CAAC,GAAG,IAAI,CAAC;IAE1C,YACW,MAA2B,EACnB,MAAe;QAEhC,KAAK,CAAC,yBAAyB,CAAC,MAAM,CAAC,CAAC,CAAC;QAHhC,WAAM,GAAN,MAAM,CAAqB;QACnB,WAAM,GAAN,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ACnD,CAAC;QAEF,IAAA,oBAAW,EAAC,KAAK,EAAE,UAAU,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;QAChD,IAAA,oBAAW,EAAC,KAAK,EAAE,YAAY,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC;QAEnD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAChC,CAAC;YAAS,CAAC;QACT,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,IAAA,6BAAc,EAAC,OAAO,CAAC,CAAC;QAChC,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAgB,qBAAqB,CAAC,OAAgB;IACpD,OAAO;SACJ,WAAW,CAAC,6DAA6D,CAAC;SAC1E,QAAQ,CAAC,gBAAgB,EAAE,iCAAiC,CAAC;SAC7D,cAAc,CAAC,2BAA2B,EAAE,uBAAuB,CAAC;SACpE,MAAM,CAAC,iBAAiB,EAAE,0BAA0B,CAAC;SACrD,MAAM,CAAC,iBAAiB,EAAE,6BAA6B,CAAC;SACxD,MAAM,CAAC,SAAS,EAAE,wCAAwC,CAAC;SAC3D,MAAM,CAAC,WAAW,EAAE,sDAAsD,CAAC;SAC3E,MAAM,CAAC,QAAQ,EAAE,4CAA4C,CAAC;SAC9D,MAAM,CAAC,SAAS,CAAC,CAAC;AACvB,CAAC"}
|
package/dist/commands/inspect.js
CHANGED
|
@@ -21,15 +21,16 @@ async function runInspect(options) {
|
|
|
21
21
|
agentId: options.agentId,
|
|
22
22
|
});
|
|
23
23
|
const warnings = [
|
|
24
|
-
'Channel bindings are not included in v1 packages.',
|
|
25
24
|
'Skills are manifest-only and may require manual installation.',
|
|
26
25
|
];
|
|
26
|
+
const bootstrapFiles = scan.includedFiles
|
|
27
|
+
.filter((f) => f.isBootstrap)
|
|
28
|
+
.map((f) => f.relativePath);
|
|
27
29
|
const report = {
|
|
28
30
|
workspacePath,
|
|
29
31
|
includedFiles: scan.includedFiles.map((file) => file.relativePath),
|
|
32
|
+
bootstrapFiles,
|
|
30
33
|
excludedFiles: scan.excludedFiles,
|
|
31
|
-
ignoredFiles: scan.ignoredFiles,
|
|
32
|
-
missingOptionalFiles: scan.missingOptionalFiles,
|
|
33
34
|
portableConfig: {
|
|
34
35
|
found: !agentDefinition.notes.some((note) => note.includes('placeholder')),
|
|
35
36
|
agent: agentDefinition.agent,
|
|
@@ -47,9 +48,8 @@ async function runInspect(options) {
|
|
|
47
48
|
const lines = [
|
|
48
49
|
`Workspace: ${report.workspacePath}`,
|
|
49
50
|
`Included files (${report.includedFiles.length}): ${report.includedFiles.join(', ') || 'none'}`,
|
|
51
|
+
`Bootstrap files (${report.bootstrapFiles.length}): ${report.bootstrapFiles.join(', ') || 'none'}`,
|
|
50
52
|
`Excluded files (${report.excludedFiles.length}): ${report.excludedFiles.map((entry) => `${entry.relativePath} [${entry.reason}]`).join(', ') || 'none'}`,
|
|
51
|
-
`Ignored files (${report.ignoredFiles.length}): ${report.ignoredFiles.join(', ') || 'none'}`,
|
|
52
|
-
`Missing optional files (${report.missingOptionalFiles.length}): ${report.missingOptionalFiles.join(', ') || 'none'}`,
|
|
53
53
|
'Portable agent definition:',
|
|
54
54
|
` found: ${report.portableConfig.found ? 'yes' : 'no'}`,
|
|
55
55
|
` suggested id: ${report.portableConfig.agent.suggestedId}`,
|
|
@@ -57,7 +57,9 @@ async function runInspect(options) {
|
|
|
57
57
|
` workspace basename: ${report.portableConfig.agent.workspace.suggestedBasename}`,
|
|
58
58
|
` identity name: ${report.portableConfig.agent.identity.name}`,
|
|
59
59
|
` default model: ${report.portableConfig.agent.model?.default ?? 'not set'}`,
|
|
60
|
-
` portable fields: ${Object.entries(report.portableConfig.fieldClassification)
|
|
60
|
+
` portable fields: ${Object.entries(report.portableConfig.fieldClassification)
|
|
61
|
+
.map(([key, value]) => `${key}=${value}`)
|
|
62
|
+
.join(', ')}`,
|
|
61
63
|
`Skills (workspace): ${skills.workspaceSkills.join(', ') || 'none'}`,
|
|
62
64
|
`Skills (referenced): ${skills.referencedSkills.join(', ') || 'none'}`,
|
|
63
65
|
`Skill notes: ${skills.notes.join(' | ') || 'none'}`,
|
|
@@ -70,7 +72,7 @@ async function runInspect(options) {
|
|
|
70
72
|
}
|
|
71
73
|
function registerInspectCommand(command) {
|
|
72
74
|
command
|
|
73
|
-
.description('Inspect a workspace and report what is portable
|
|
75
|
+
.description('Inspect a workspace and report what is portable.')
|
|
74
76
|
.requiredOption('--workspace <path>', 'Source workspace path')
|
|
75
77
|
.option('--config <path>', 'OpenClaw config path')
|
|
76
78
|
.option('--agent-id <id>', 'Source agent id override')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inspect.js","sourceRoot":"","sources":["../../src/commands/inspect.ts"],"names":[],"mappings":";;;;;AAaA,
|
|
1
|
+
{"version":3,"file":"inspect.js","sourceRoot":"","sources":["../../src/commands/inspect.ts"],"names":[],"mappings":";;;;;AAaA,gCAoEC;AAED,wDAQC;AA3FD,0DAA6B;AAE7B,yDAA+D;AAC/D,yDAAqD;AACrD,2DAAuD;AAShD,KAAK,UAAU,UAAU,CAAC,OAAuB;IACtD,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACzD,CAAC;IAED,MAAM,aAAa,GAAG,mBAAI,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACtD,MAAM,IAAI,GAAG,MAAM,IAAA,8BAAa,EAAC,aAAa,CAAC,CAAC;IAChD,MAAM,MAAM,GAAG,MAAM,IAAA,4BAAY,EAAC,IAAI,CAAC,CAAC;IACxC,MAAM,eAAe,GAAG,MAAM,IAAA,sCAAsB,EAAC,aAAa,EAAE;QAClE,UAAU,EAAE,OAAO,CAAC,MAAM;QAC1B,OAAO,EAAE,OAAO,CAAC,OAAO;KACzB,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAG;QACf,+DAA+D;KAChE,CAAC;I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