@flydocs/cli 0.6.0-alpha.34 → 0.6.0-alpha.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +110 -18
- package/package.json +1 -1
- package/template/.flydocs/config.json +1 -1
- package/template/.flydocs/version +1 -1
- package/template/manifest.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -15,7 +15,7 @@ var CLI_VERSION, CLI_NAME, PACKAGE_NAME, POSTHOG_API_KEY;
|
|
|
15
15
|
var init_constants = __esm({
|
|
16
16
|
"src/lib/constants.ts"() {
|
|
17
17
|
"use strict";
|
|
18
|
-
CLI_VERSION = "0.6.0-alpha.
|
|
18
|
+
CLI_VERSION = "0.6.0-alpha.35";
|
|
19
19
|
CLI_NAME = "flydocs";
|
|
20
20
|
PACKAGE_NAME = "@flydocs/cli";
|
|
21
21
|
POSTHOG_API_KEY = "phc_v1MSJTQDFkMS90CBh3mxIz3v8bYCCnKU6v1ir6bz0Xn";
|
|
@@ -1418,6 +1418,17 @@ async function checkLegacyFolder(targetDir) {
|
|
|
1418
1418
|
}
|
|
1419
1419
|
return null;
|
|
1420
1420
|
}
|
|
1421
|
+
async function autoCleanup(targetDir, paths) {
|
|
1422
|
+
let cleaned = 0;
|
|
1423
|
+
for (const p of paths) {
|
|
1424
|
+
await rm3(join10(targetDir, p), { recursive: true, force: true });
|
|
1425
|
+
cleaned++;
|
|
1426
|
+
}
|
|
1427
|
+
if (cleaned > 0) {
|
|
1428
|
+
printStatus(`Cleaned ${cleaned} deprecated file(s)`);
|
|
1429
|
+
}
|
|
1430
|
+
return cleaned;
|
|
1431
|
+
}
|
|
1421
1432
|
async function promptCleanup(targetDir, paths) {
|
|
1422
1433
|
if (paths.length === 0) {
|
|
1423
1434
|
printStatus("No deprecated files found");
|
|
@@ -3895,7 +3906,14 @@ __export(init_exports, {
|
|
|
3895
3906
|
default: () => init_default
|
|
3896
3907
|
});
|
|
3897
3908
|
import { defineCommand as defineCommand4 } from "citty";
|
|
3898
|
-
import {
|
|
3909
|
+
import {
|
|
3910
|
+
text as text2,
|
|
3911
|
+
confirm as confirm3,
|
|
3912
|
+
select as select2,
|
|
3913
|
+
multiselect as multiselect2,
|
|
3914
|
+
isCancel as isCancel4,
|
|
3915
|
+
cancel as cancel3
|
|
3916
|
+
} from "@clack/prompts";
|
|
3899
3917
|
import pc9 from "picocolors";
|
|
3900
3918
|
import { join as join24 } from "path";
|
|
3901
3919
|
import { mkdir as mkdir12, writeFile as writeFile16 } from "fs/promises";
|
|
@@ -4266,19 +4284,61 @@ async function isParentDirectory(dir) {
|
|
|
4266
4284
|
}
|
|
4267
4285
|
async function runMultiRepoInit(parentDir, keyArg) {
|
|
4268
4286
|
const repos = await detectSiblingRepos(parentDir);
|
|
4269
|
-
const
|
|
4270
|
-
printInfo(`Detected ${
|
|
4271
|
-
for (const name of repoNames) {
|
|
4272
|
-
console.log(` ${pc9.cyan(name)}`);
|
|
4273
|
-
}
|
|
4287
|
+
const allRepoNames = Object.keys(repos).sort();
|
|
4288
|
+
printInfo(`Detected ${allRepoNames.length} repos:`);
|
|
4274
4289
|
console.log();
|
|
4275
|
-
const
|
|
4276
|
-
|
|
4290
|
+
const existingInstalls = [];
|
|
4291
|
+
for (const name of allRepoNames) {
|
|
4292
|
+
const repoDir = join24(parentDir, name);
|
|
4293
|
+
const hasSkills = await pathExists(join24(repoDir, ".claude", "skills"));
|
|
4294
|
+
const hasConfig = await pathExists(
|
|
4295
|
+
join24(repoDir, ".flydocs", "config.json")
|
|
4296
|
+
);
|
|
4297
|
+
if (hasSkills && hasConfig) {
|
|
4298
|
+
existingInstalls.push(name);
|
|
4299
|
+
}
|
|
4300
|
+
}
|
|
4301
|
+
if (existingInstalls.length > 0) {
|
|
4302
|
+
printWarning(
|
|
4303
|
+
`${existingInstalls.length} repo(s) have existing single-repo FlyDocs installs:`
|
|
4304
|
+
);
|
|
4305
|
+
for (const name of existingInstalls) {
|
|
4306
|
+
console.log(` ${pc9.yellow(name)}`);
|
|
4307
|
+
}
|
|
4308
|
+
console.log();
|
|
4309
|
+
console.log(` Multi-repo init will migrate these to workspace mode:`);
|
|
4310
|
+
console.log(
|
|
4311
|
+
` ${pc9.dim("- IDE configs (skills, hooks, commands) move to workspace root")}`
|
|
4312
|
+
);
|
|
4313
|
+
console.log(
|
|
4314
|
+
` ${pc9.dim("- Per-repo context (project.md, service.json) preserved")}`
|
|
4315
|
+
);
|
|
4316
|
+
console.log(
|
|
4317
|
+
` ${pc9.dim("- Existing IDE configs archived to flydocs/knowledge/archived/")}`
|
|
4318
|
+
);
|
|
4319
|
+
console.log();
|
|
4320
|
+
}
|
|
4321
|
+
const selectedRepos = await multiselect2({
|
|
4322
|
+
message: "Which repos would you like to initialize?",
|
|
4323
|
+
options: allRepoNames.map((name) => ({
|
|
4324
|
+
value: name,
|
|
4325
|
+
label: name,
|
|
4326
|
+
hint: existingInstalls.includes(name) ? "has existing install" : void 0
|
|
4327
|
+
})),
|
|
4328
|
+
initialValues: allRepoNames,
|
|
4329
|
+
required: true
|
|
4277
4330
|
});
|
|
4278
|
-
if (isCancel4(
|
|
4331
|
+
if (isCancel4(selectedRepos)) {
|
|
4279
4332
|
cancel3("Init cancelled.");
|
|
4280
4333
|
process.exit(0);
|
|
4281
4334
|
}
|
|
4335
|
+
const repoNames = selectedRepos;
|
|
4336
|
+
if (repoNames.length === 0) {
|
|
4337
|
+
cancel3("No repos selected.");
|
|
4338
|
+
process.exit(0);
|
|
4339
|
+
}
|
|
4340
|
+
printInfo(`Initializing ${repoNames.length} of ${allRepoNames.length} repos`);
|
|
4341
|
+
console.log();
|
|
4282
4342
|
const firstRepoDir = join24(parentDir, repoNames[0]);
|
|
4283
4343
|
const { apiKey, workspaceId } = await resolveAndValidateKey(
|
|
4284
4344
|
keyArg,
|
|
@@ -4337,9 +4397,13 @@ async function runMultiRepoInit(parentDir, keyArg) {
|
|
|
4337
4397
|
if (existing) {
|
|
4338
4398
|
allSkipped.push(".flydocs-workspace.json (already exists)");
|
|
4339
4399
|
} else {
|
|
4400
|
+
const selectedRepoEntries = {};
|
|
4401
|
+
for (const name of repoNames) {
|
|
4402
|
+
if (repos[name]) selectedRepoEntries[name] = repos[name];
|
|
4403
|
+
}
|
|
4340
4404
|
const workspaceFile = buildWorkspaceFile(
|
|
4341
4405
|
firstResponse.workspaceId,
|
|
4342
|
-
|
|
4406
|
+
selectedRepoEntries
|
|
4343
4407
|
);
|
|
4344
4408
|
await writeWorkspaceFile(parentDir, workspaceFile);
|
|
4345
4409
|
allActions.push(`.flydocs-workspace.json (${repoNames.length} repos)`);
|
|
@@ -4756,7 +4820,10 @@ async function runSync(targetDir) {
|
|
|
4756
4820
|
}
|
|
4757
4821
|
let serverResponse;
|
|
4758
4822
|
try {
|
|
4759
|
-
serverResponse = await fetchConfigV2(apiKey, {
|
|
4823
|
+
serverResponse = await fetchConfigV2(apiKey, {
|
|
4824
|
+
workspaceId,
|
|
4825
|
+
includeContext: true
|
|
4826
|
+
});
|
|
4760
4827
|
} catch (err) {
|
|
4761
4828
|
if (err instanceof RelayError) {
|
|
4762
4829
|
printWarning(`Server unavailable (${err.status}), using cached config.`);
|
|
@@ -4867,6 +4934,33 @@ async function runSync(targetDir) {
|
|
|
4867
4934
|
changes.push(`Deleted ${conflicts.deleted} non-core skill(s)`);
|
|
4868
4935
|
}
|
|
4869
4936
|
}
|
|
4937
|
+
const deprecated = await scanDeprecated(targetDir);
|
|
4938
|
+
if (deprecated.length > 0) {
|
|
4939
|
+
const cleaned = await autoCleanup(targetDir, deprecated);
|
|
4940
|
+
changes.push(`Removed ${cleaned} deprecated file(s)`);
|
|
4941
|
+
}
|
|
4942
|
+
if (serverResponse.context?.projectMd) {
|
|
4943
|
+
const { writeFile: fsWriteFile } = await import("fs/promises");
|
|
4944
|
+
const contextDir = join26(targetDir, "flydocs", "context");
|
|
4945
|
+
await mkdir14(contextDir, { recursive: true });
|
|
4946
|
+
await fsWriteFile(
|
|
4947
|
+
join26(contextDir, "project.md"),
|
|
4948
|
+
serverResponse.context.projectMd,
|
|
4949
|
+
"utf-8"
|
|
4950
|
+
);
|
|
4951
|
+
changes.push("Updated flydocs/context/project.md from server");
|
|
4952
|
+
}
|
|
4953
|
+
if (serverResponse.context?.serviceJson) {
|
|
4954
|
+
const { writeFile: fsWriteFile } = await import("fs/promises");
|
|
4955
|
+
const contextDir = join26(targetDir, "flydocs", "context");
|
|
4956
|
+
await mkdir14(contextDir, { recursive: true });
|
|
4957
|
+
await fsWriteFile(
|
|
4958
|
+
join26(contextDir, "service.json"),
|
|
4959
|
+
JSON.stringify(serverResponse.context.serviceJson, null, 2) + "\n",
|
|
4960
|
+
"utf-8"
|
|
4961
|
+
);
|
|
4962
|
+
changes.push("Updated flydocs/context/service.json from server");
|
|
4963
|
+
}
|
|
4870
4964
|
await migrateGitignore(targetDir);
|
|
4871
4965
|
return changes;
|
|
4872
4966
|
}
|
|
@@ -4895,10 +4989,11 @@ var init_sync = __esm({
|
|
|
4895
4989
|
init_workspace();
|
|
4896
4990
|
init_relay_client();
|
|
4897
4991
|
init_skill_conflicts();
|
|
4992
|
+
init_deprecated();
|
|
4898
4993
|
sync_default = defineCommand5({
|
|
4899
4994
|
meta: {
|
|
4900
4995
|
name: "sync",
|
|
4901
|
-
description: "
|
|
4996
|
+
description: "Sync files from server (alias for update)"
|
|
4902
4997
|
},
|
|
4903
4998
|
args: {
|
|
4904
4999
|
path: {
|
|
@@ -4909,6 +5004,7 @@ var init_sync = __esm({
|
|
|
4909
5004
|
async run({ args }) {
|
|
4910
5005
|
const targetDir = args.path ?? process.cwd();
|
|
4911
5006
|
console.log();
|
|
5007
|
+
printInfo("Note: flydocs sync is now an alias for flydocs update");
|
|
4912
5008
|
const changes = await runSync(targetDir);
|
|
4913
5009
|
if (changes.length === 0) {
|
|
4914
5010
|
printStatus("Already up to date.");
|
|
@@ -4958,7 +5054,7 @@ var init_update = __esm({
|
|
|
4958
5054
|
update_default = defineCommand6({
|
|
4959
5055
|
meta: {
|
|
4960
5056
|
name: "update",
|
|
4961
|
-
description: "Update
|
|
5057
|
+
description: "Update CLI and sync all managed files from server"
|
|
4962
5058
|
},
|
|
4963
5059
|
args: {
|
|
4964
5060
|
path: {
|
|
@@ -5114,10 +5210,6 @@ var init_update = __esm({
|
|
|
5114
5210
|
printStatus(change);
|
|
5115
5211
|
}
|
|
5116
5212
|
}
|
|
5117
|
-
console.log();
|
|
5118
|
-
console.log(
|
|
5119
|
-
` ${pc11.dim("Tip: use")} ${pc11.cyan("flydocs sync")} ${pc11.dim("for file-only refresh (no CLI update).")}`
|
|
5120
|
-
);
|
|
5121
5213
|
await capture("update_completed", {
|
|
5122
5214
|
current_version: currentVersion,
|
|
5123
5215
|
version,
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.6.0-alpha.
|
|
1
|
+
0.6.0-alpha.35
|
package/template/manifest.json
CHANGED