@przeprogramowani/10x-cli 0.6.0 → 1.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 +9 -1
- package/dist/index.mjs +311 -122
- package/package.json +1 -1
- package/skills/10x-cli-guide/SKILL.md +220 -0
package/README.md
CHANGED
|
@@ -3,10 +3,18 @@
|
|
|
3
3
|
CLI tool for [10xDevs](https://10xdevs.pl) course content. Fetch and apply AI coding skills,
|
|
4
4
|
prompts, and configs directly into your workspace.
|
|
5
5
|
|
|
6
|
+
## Requirements
|
|
7
|
+
|
|
8
|
+
- **Node 20+** — this is the only runtime dependency.
|
|
9
|
+
|
|
6
10
|
## Install
|
|
7
11
|
|
|
8
12
|
```bash
|
|
9
|
-
#
|
|
13
|
+
# Zero-install — run directly with npx (no global install needed)
|
|
14
|
+
npx @przeprogramowani/10x-cli auth
|
|
15
|
+
npx @przeprogramowani/10x-cli get m1l1
|
|
16
|
+
|
|
17
|
+
# Or install globally for shorter commands
|
|
10
18
|
npm install -g @przeprogramowani/10x-cli
|
|
11
19
|
|
|
12
20
|
# Or download a standalone binary from GitHub Releases
|
package/dist/index.mjs
CHANGED
|
@@ -2271,7 +2271,7 @@ var cac = (name = "") => new CAC(name);
|
|
|
2271
2271
|
// package.json
|
|
2272
2272
|
var package_default = {
|
|
2273
2273
|
name: "@przeprogramowani/10x-cli",
|
|
2274
|
-
version: "
|
|
2274
|
+
version: "1.2.0",
|
|
2275
2275
|
description: "Open-source CLI for 10xDevs course content",
|
|
2276
2276
|
repository: {
|
|
2277
2277
|
type: "git",
|
|
@@ -3565,6 +3565,8 @@ async function fetchLesson(course, lessonId, token, options = {}) {
|
|
|
3565
3565
|
const params = new URLSearchParams;
|
|
3566
3566
|
if (options.lang)
|
|
3567
3567
|
params.set("lang", options.lang);
|
|
3568
|
+
if (options.tool)
|
|
3569
|
+
params.set("tool", options.tool);
|
|
3568
3570
|
const qs = params.toString();
|
|
3569
3571
|
const path = `/api/lessons/${encodeURIComponent(course)}/${encodeURIComponent(lessonId)}${qs ? `?${qs}` : ""}`;
|
|
3570
3572
|
const result = await apiGet(path, { token, signal: options.signal });
|
|
@@ -3699,10 +3701,89 @@ function formatReleaseAt(iso, now = new Date) {
|
|
|
3699
3701
|
return `${absolute} (in ${days} days)`;
|
|
3700
3702
|
}
|
|
3701
3703
|
|
|
3704
|
+
// src/lib/tool-profile.ts
|
|
3705
|
+
var SENTINEL_BEGIN = "<!-- BEGIN @przeprogramowani/10x-cli -->";
|
|
3706
|
+
var SENTINEL_END = "<!-- END @przeprogramowani/10x-cli -->";
|
|
3707
|
+
var PROFILES = {
|
|
3708
|
+
"claude-code": {
|
|
3709
|
+
toolId: "claude-code",
|
|
3710
|
+
displayName: "Claude Code",
|
|
3711
|
+
skillPath: (n) => `.claude/skills/${n}/SKILL.md`,
|
|
3712
|
+
skillDir: (n) => `.claude/skills/${n}`,
|
|
3713
|
+
promptPath: (n) => `.claude/prompts/${n}.md`,
|
|
3714
|
+
configPath: (n) => `.claude/config-templates/${n}`,
|
|
3715
|
+
rulesFile: "CLAUDE.md",
|
|
3716
|
+
manifestDir: ".claude",
|
|
3717
|
+
sentinelBegin: SENTINEL_BEGIN,
|
|
3718
|
+
sentinelEnd: SENTINEL_END
|
|
3719
|
+
},
|
|
3720
|
+
cursor: {
|
|
3721
|
+
toolId: "cursor",
|
|
3722
|
+
displayName: "Cursor",
|
|
3723
|
+
skillPath: (n) => `.cursor/skills/${n}/SKILL.md`,
|
|
3724
|
+
skillDir: (n) => `.cursor/skills/${n}`,
|
|
3725
|
+
promptPath: (n) => `.cursor/prompts/${n}.md`,
|
|
3726
|
+
configPath: (n) => `.cursor/config-templates/${n}`,
|
|
3727
|
+
rulesFile: ".cursor/rules/10x-course.mdc",
|
|
3728
|
+
manifestDir: ".cursor",
|
|
3729
|
+
sentinelBegin: SENTINEL_BEGIN,
|
|
3730
|
+
sentinelEnd: SENTINEL_END
|
|
3731
|
+
},
|
|
3732
|
+
copilot: {
|
|
3733
|
+
toolId: "copilot",
|
|
3734
|
+
displayName: "GitHub Copilot",
|
|
3735
|
+
skillPath: (n) => `.github/skills/${n}/SKILL.md`,
|
|
3736
|
+
skillDir: (n) => `.github/skills/${n}`,
|
|
3737
|
+
promptPath: (n) => `.github/prompts/${n}.md`,
|
|
3738
|
+
configPath: (n) => `.github/config-templates/${n}`,
|
|
3739
|
+
rulesFile: ".github/copilot-instructions.md",
|
|
3740
|
+
manifestDir: ".github",
|
|
3741
|
+
sentinelBegin: SENTINEL_BEGIN,
|
|
3742
|
+
sentinelEnd: SENTINEL_END
|
|
3743
|
+
},
|
|
3744
|
+
codex: {
|
|
3745
|
+
toolId: "codex",
|
|
3746
|
+
displayName: "Codex CLI",
|
|
3747
|
+
skillPath: (n) => `.agents/skills/${n}/SKILL.md`,
|
|
3748
|
+
skillDir: (n) => `.agents/skills/${n}`,
|
|
3749
|
+
promptPath: (n) => `.agents/prompts/${n}.md`,
|
|
3750
|
+
configPath: (n) => `.agents/config-templates/${n}`,
|
|
3751
|
+
rulesFile: "AGENTS.md",
|
|
3752
|
+
manifestDir: ".agents",
|
|
3753
|
+
sentinelBegin: SENTINEL_BEGIN,
|
|
3754
|
+
sentinelEnd: SENTINEL_END
|
|
3755
|
+
},
|
|
3756
|
+
windsurf: {
|
|
3757
|
+
toolId: "windsurf",
|
|
3758
|
+
displayName: "Windsurf",
|
|
3759
|
+
skillPath: (n) => `.windsurf/skills/${n}/SKILL.md`,
|
|
3760
|
+
skillDir: (n) => `.windsurf/skills/${n}`,
|
|
3761
|
+
promptPath: (n) => `.windsurf/prompts/${n}.md`,
|
|
3762
|
+
configPath: (n) => `.windsurf/config-templates/${n}`,
|
|
3763
|
+
rulesFile: ".windsurfrules",
|
|
3764
|
+
manifestDir: ".windsurf",
|
|
3765
|
+
sentinelBegin: SENTINEL_BEGIN,
|
|
3766
|
+
sentinelEnd: SENTINEL_END
|
|
3767
|
+
},
|
|
3768
|
+
generic: {
|
|
3769
|
+
toolId: "generic",
|
|
3770
|
+
displayName: "Other / Generic",
|
|
3771
|
+
skillPath: (n) => `.ai/skills/${n}/SKILL.md`,
|
|
3772
|
+
skillDir: (n) => `.ai/skills/${n}`,
|
|
3773
|
+
promptPath: (n) => `.ai/prompts/${n}.md`,
|
|
3774
|
+
configPath: (n) => `.ai/config-templates/${n}`,
|
|
3775
|
+
rulesFile: "AGENTS.md",
|
|
3776
|
+
manifestDir: ".ai",
|
|
3777
|
+
sentinelBegin: SENTINEL_BEGIN,
|
|
3778
|
+
sentinelEnd: SENTINEL_END
|
|
3779
|
+
}
|
|
3780
|
+
};
|
|
3781
|
+
var DEFAULT_TOOL = "claude-code";
|
|
3782
|
+
|
|
3702
3783
|
// src/commands/doctor.ts
|
|
3703
3784
|
var EX_CONFIG = 78;
|
|
3704
3785
|
function registerDoctorCommand(cli) {
|
|
3705
|
-
cli.command("doctor", "Diagnose auth, API, config, and
|
|
3786
|
+
cli.command("doctor", "Diagnose auth, API, config, and tool directory state").action(async (options) => {
|
|
3706
3787
|
const ctx = resolveContext(options);
|
|
3707
3788
|
await runDoctor(ctx);
|
|
3708
3789
|
});
|
|
@@ -3714,7 +3795,7 @@ async function runDoctor(ctx) {
|
|
|
3714
3795
|
checks.push(await checkApiConnectivity());
|
|
3715
3796
|
checks.push(checkConfigDirectory());
|
|
3716
3797
|
checks.push(checkCliVersion());
|
|
3717
|
-
checks.push(
|
|
3798
|
+
checks.push(checkToolDirectory());
|
|
3718
3799
|
const failed = checks.filter((c2) => c2.status === "fail").length;
|
|
3719
3800
|
const passed = checks.filter((c2) => c2.status === "pass").length;
|
|
3720
3801
|
const warned = checks.filter((c2) => c2.status === "warn").length;
|
|
@@ -3871,36 +3952,39 @@ function checkCliVersion() {
|
|
|
3871
3952
|
details: { version: package_default.version }
|
|
3872
3953
|
};
|
|
3873
3954
|
}
|
|
3874
|
-
function
|
|
3955
|
+
function checkToolDirectory() {
|
|
3875
3956
|
const cwd = process.cwd();
|
|
3876
|
-
const
|
|
3877
|
-
|
|
3957
|
+
const toolId = readToolConfig()?.tool ?? DEFAULT_TOOL;
|
|
3958
|
+
const profile = PROFILES[toolId] ?? PROFILES[DEFAULT_TOOL];
|
|
3959
|
+
const dirName = profile.manifestDir;
|
|
3960
|
+
const toolDir = join2(cwd, dirName);
|
|
3961
|
+
if (!existsSync2(toolDir)) {
|
|
3878
3962
|
return {
|
|
3879
|
-
name: "
|
|
3880
|
-
label:
|
|
3963
|
+
name: "tool-dir",
|
|
3964
|
+
label: profile.displayName,
|
|
3881
3965
|
status: "fail",
|
|
3882
|
-
message:
|
|
3883
|
-
hint:
|
|
3884
|
-
details: { path:
|
|
3966
|
+
message: `${dirName}/ was not found in ${cwd}.`,
|
|
3967
|
+
hint: `Run '10x doctor' from a project directory that already has a ${dirName}/ folder.`,
|
|
3968
|
+
details: { path: toolDir, exists: false, tool: toolId }
|
|
3885
3969
|
};
|
|
3886
3970
|
}
|
|
3887
3971
|
try {
|
|
3888
|
-
accessSync(
|
|
3972
|
+
accessSync(toolDir, constants.W_OK);
|
|
3889
3973
|
return {
|
|
3890
|
-
name: "
|
|
3891
|
-
label:
|
|
3974
|
+
name: "tool-dir",
|
|
3975
|
+
label: profile.displayName,
|
|
3892
3976
|
status: "pass",
|
|
3893
|
-
message: `${
|
|
3894
|
-
details: { path:
|
|
3977
|
+
message: `${toolDir} is writable.`,
|
|
3978
|
+
details: { path: toolDir, exists: true, tool: toolId }
|
|
3895
3979
|
};
|
|
3896
3980
|
} catch (err) {
|
|
3897
3981
|
return {
|
|
3898
|
-
name: "
|
|
3899
|
-
label:
|
|
3982
|
+
name: "tool-dir",
|
|
3983
|
+
label: profile.displayName,
|
|
3900
3984
|
status: "fail",
|
|
3901
|
-
message: `${
|
|
3985
|
+
message: `${toolDir} is not writable.`,
|
|
3902
3986
|
hint: `Fix directory permissions, then run '10x doctor' again. (${err instanceof Error ? err.message : String(err)})`,
|
|
3903
|
-
details: { path:
|
|
3987
|
+
details: { path: toolDir, exists: true, tool: toolId }
|
|
3904
3988
|
};
|
|
3905
3989
|
}
|
|
3906
3990
|
}
|
|
@@ -3949,6 +4033,7 @@ import { existsSync as existsSync3, mkdirSync as mkdirSync3, readFileSync as rea
|
|
|
3949
4033
|
import { dirname as dirname2, join as join3 } from "node:path";
|
|
3950
4034
|
var MANIFEST_FILENAME = ".10x-cli-manifest.json";
|
|
3951
4035
|
var CLI_PACKAGE_NAME = "@przeprogramowani/10x-cli";
|
|
4036
|
+
var MANIFEST_VERSION = 2;
|
|
3952
4037
|
function readManifest(dir) {
|
|
3953
4038
|
const manifestPath = join3(dir, MANIFEST_FILENAME);
|
|
3954
4039
|
if (!existsSync3(manifestPath))
|
|
@@ -3986,6 +4071,8 @@ function isManifest(value) {
|
|
|
3986
4071
|
return false;
|
|
3987
4072
|
if (typeof v2["version"] !== "string")
|
|
3988
4073
|
return false;
|
|
4074
|
+
if (v2["manifestVersion"] !== MANIFEST_VERSION)
|
|
4075
|
+
return false;
|
|
3989
4076
|
if (typeof v2["lastApplied"] !== "string")
|
|
3990
4077
|
return false;
|
|
3991
4078
|
if (typeof v2["lessonId"] !== "string")
|
|
@@ -3996,74 +4083,24 @@ function isManifest(value) {
|
|
|
3996
4083
|
if (typeof files !== "object" || files === null)
|
|
3997
4084
|
return false;
|
|
3998
4085
|
const f2 = files;
|
|
3999
|
-
return
|
|
4086
|
+
return isSkillsRecord(f2["skills"]) && isStringArray(f2["prompts"]) && isStringArray(f2["configs"]);
|
|
4087
|
+
}
|
|
4088
|
+
function isSkillsRecord(value) {
|
|
4089
|
+
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
4090
|
+
return false;
|
|
4091
|
+
for (const entry of Object.values(value)) {
|
|
4092
|
+
if (typeof entry !== "object" || entry === null)
|
|
4093
|
+
return false;
|
|
4094
|
+
const e2 = entry;
|
|
4095
|
+
if (!isStringArray(e2["files"]))
|
|
4096
|
+
return false;
|
|
4097
|
+
}
|
|
4098
|
+
return true;
|
|
4000
4099
|
}
|
|
4001
4100
|
function isStringArray(value) {
|
|
4002
4101
|
return Array.isArray(value) && value.every((item) => typeof item === "string");
|
|
4003
4102
|
}
|
|
4004
4103
|
|
|
4005
|
-
// src/lib/tool-profile.ts
|
|
4006
|
-
var SENTINEL_BEGIN = "<!-- BEGIN @przeprogramowani/10x-cli -->";
|
|
4007
|
-
var SENTINEL_END = "<!-- END @przeprogramowani/10x-cli -->";
|
|
4008
|
-
var PROFILES = {
|
|
4009
|
-
"claude-code": {
|
|
4010
|
-
toolId: "claude-code",
|
|
4011
|
-
displayName: "Claude Code",
|
|
4012
|
-
skillPath: (n) => `.claude/skills/${n}/SKILL.md`,
|
|
4013
|
-
promptPath: (n) => `.claude/prompts/${n}.md`,
|
|
4014
|
-
configPath: (n) => `.claude/config-templates/${n}`,
|
|
4015
|
-
rulesFile: "CLAUDE.md",
|
|
4016
|
-
manifestDir: ".claude",
|
|
4017
|
-
sentinelBegin: SENTINEL_BEGIN,
|
|
4018
|
-
sentinelEnd: SENTINEL_END
|
|
4019
|
-
},
|
|
4020
|
-
cursor: {
|
|
4021
|
-
toolId: "cursor",
|
|
4022
|
-
displayName: "Cursor",
|
|
4023
|
-
skillPath: (n) => `.cursor/skills/${n}/SKILL.md`,
|
|
4024
|
-
promptPath: (n) => `.cursor/prompts/${n}.md`,
|
|
4025
|
-
configPath: (n) => `.cursor/config-templates/${n}`,
|
|
4026
|
-
rulesFile: ".cursor/rules/10x-course.mdc",
|
|
4027
|
-
manifestDir: ".cursor",
|
|
4028
|
-
sentinelBegin: SENTINEL_BEGIN,
|
|
4029
|
-
sentinelEnd: SENTINEL_END
|
|
4030
|
-
},
|
|
4031
|
-
copilot: {
|
|
4032
|
-
toolId: "copilot",
|
|
4033
|
-
displayName: "GitHub Copilot",
|
|
4034
|
-
skillPath: (n) => `.github/skills/${n}/SKILL.md`,
|
|
4035
|
-
promptPath: (n) => `.github/prompts/${n}.md`,
|
|
4036
|
-
configPath: (n) => `.github/config-templates/${n}`,
|
|
4037
|
-
rulesFile: ".github/copilot-instructions.md",
|
|
4038
|
-
manifestDir: ".github",
|
|
4039
|
-
sentinelBegin: SENTINEL_BEGIN,
|
|
4040
|
-
sentinelEnd: SENTINEL_END
|
|
4041
|
-
},
|
|
4042
|
-
codex: {
|
|
4043
|
-
toolId: "codex",
|
|
4044
|
-
displayName: "Codex CLI",
|
|
4045
|
-
skillPath: (n) => `.agents/skills/${n}/SKILL.md`,
|
|
4046
|
-
promptPath: (n) => `.agents/prompts/${n}.md`,
|
|
4047
|
-
configPath: (n) => `.agents/config-templates/${n}`,
|
|
4048
|
-
rulesFile: "AGENTS.md",
|
|
4049
|
-
manifestDir: ".agents",
|
|
4050
|
-
sentinelBegin: SENTINEL_BEGIN,
|
|
4051
|
-
sentinelEnd: SENTINEL_END
|
|
4052
|
-
},
|
|
4053
|
-
generic: {
|
|
4054
|
-
toolId: "generic",
|
|
4055
|
-
displayName: "Other / Generic",
|
|
4056
|
-
skillPath: (n) => `.ai/skills/${n}/SKILL.md`,
|
|
4057
|
-
promptPath: (n) => `.ai/prompts/${n}.md`,
|
|
4058
|
-
configPath: (n) => `.ai/config-templates/${n}`,
|
|
4059
|
-
rulesFile: "AGENTS.md",
|
|
4060
|
-
manifestDir: ".ai",
|
|
4061
|
-
sentinelBegin: SENTINEL_BEGIN,
|
|
4062
|
-
sentinelEnd: SENTINEL_END
|
|
4063
|
-
}
|
|
4064
|
-
};
|
|
4065
|
-
var DEFAULT_TOOL = "claude-code";
|
|
4066
|
-
|
|
4067
4104
|
// src/lib/tool-detect.ts
|
|
4068
4105
|
function detectTools(projectRoot) {
|
|
4069
4106
|
const hit = (rel) => existsSync4(join4(projectRoot, rel));
|
|
@@ -4120,6 +4157,17 @@ function detectTools(projectRoot) {
|
|
|
4120
4157
|
} else if (hit("AGENTS.md") && !hit(".ai")) {
|
|
4121
4158
|
signals.push({ profileId: "codex", confidence: "medium", reason: "AGENTS.md" });
|
|
4122
4159
|
}
|
|
4160
|
+
if (hit(".windsurf/" + MANIFEST_FILENAME)) {
|
|
4161
|
+
signals.push({
|
|
4162
|
+
profileId: "windsurf",
|
|
4163
|
+
confidence: "strong",
|
|
4164
|
+
reason: ".windsurf/.10x-cli-manifest.json"
|
|
4165
|
+
});
|
|
4166
|
+
} else if (hit(".windsurfrules")) {
|
|
4167
|
+
signals.push({ profileId: "windsurf", confidence: "strong", reason: ".windsurfrules" });
|
|
4168
|
+
} else if (hit(".windsurf")) {
|
|
4169
|
+
signals.push({ profileId: "windsurf", confidence: "medium", reason: ".windsurf/ directory" });
|
|
4170
|
+
}
|
|
4123
4171
|
if (hit(".ai/" + MANIFEST_FILENAME)) {
|
|
4124
4172
|
signals.push({
|
|
4125
4173
|
profileId: "generic",
|
|
@@ -4134,7 +4182,7 @@ function detectTools(projectRoot) {
|
|
|
4134
4182
|
return rankSignals(signals);
|
|
4135
4183
|
}
|
|
4136
4184
|
var CONFIDENCE_ORDER = { strong: 3, medium: 2, weak: 1 };
|
|
4137
|
-
var PROFILE_ORDER = ["claude-code", "cursor", "copilot", "codex", "generic"];
|
|
4185
|
+
var PROFILE_ORDER = ["claude-code", "cursor", "copilot", "codex", "windsurf", "generic"];
|
|
4138
4186
|
function rankSignals(signals) {
|
|
4139
4187
|
return [...signals].sort((a2, b2) => {
|
|
4140
4188
|
const c2 = CONFIDENCE_ORDER[b2.confidence] - CONFIDENCE_ORDER[a2.confidence];
|
|
@@ -4157,7 +4205,7 @@ import {
|
|
|
4157
4205
|
mkdirSync as mkdirSync5,
|
|
4158
4206
|
readFileSync as readFileSync5,
|
|
4159
4207
|
renameSync as renameSync2,
|
|
4160
|
-
rmdirSync,
|
|
4208
|
+
rmdirSync as rmdirSync2,
|
|
4161
4209
|
rmSync as rmSync3,
|
|
4162
4210
|
statSync,
|
|
4163
4211
|
writeFileSync as writeFileSync4
|
|
@@ -4243,9 +4291,12 @@ function stripBlock(content, begin, end, label, warnings) {
|
|
|
4243
4291
|
|
|
4244
4292
|
// src/lib/writer.ts
|
|
4245
4293
|
import {
|
|
4294
|
+
chmodSync as chmodSync2,
|
|
4246
4295
|
existsSync as existsSync5,
|
|
4247
4296
|
mkdirSync as mkdirSync4,
|
|
4248
4297
|
readFileSync as readFileSync4,
|
|
4298
|
+
readdirSync,
|
|
4299
|
+
rmdirSync,
|
|
4249
4300
|
rmSync as rmSync2,
|
|
4250
4301
|
writeFileSync as writeFileSync3
|
|
4251
4302
|
} from "node:fs";
|
|
@@ -4259,19 +4310,30 @@ function applyBundle(bundle, projectRoot, options = {}) {
|
|
|
4259
4310
|
const profile = options.profile ?? PROFILES[DEFAULT_TOOL];
|
|
4260
4311
|
const manifestDir = join5(projectRoot, profile.manifestDir);
|
|
4261
4312
|
const prevManifest = readManifest(manifestDir);
|
|
4262
|
-
for (const skill of bundle.skills)
|
|
4313
|
+
for (const skill of bundle.skills) {
|
|
4263
4314
|
assertSafeName(skill.name, "skill");
|
|
4315
|
+
for (const file of skill.files) {
|
|
4316
|
+
assertSafeSkillFilePath(file.path, skill.name);
|
|
4317
|
+
}
|
|
4318
|
+
}
|
|
4264
4319
|
for (const prompt of bundle.prompts)
|
|
4265
4320
|
assertSafeName(prompt.name, "prompt");
|
|
4266
4321
|
for (const config of bundle.configs)
|
|
4267
4322
|
assertSafeName(config.name, "config");
|
|
4268
4323
|
const skills = bundle.skills.map((skill) => {
|
|
4269
|
-
const
|
|
4270
|
-
const
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4324
|
+
const skillDir = join5(projectRoot, profile.skillDir(skill.name));
|
|
4325
|
+
const fileWrites = skill.files.map((file) => {
|
|
4326
|
+
const target = join5(skillDir, file.path);
|
|
4327
|
+
const action = computeFileAction(target, file.content);
|
|
4328
|
+
if (!dryRun && action !== "unchanged") {
|
|
4329
|
+
writeFileAt(target, file.content);
|
|
4330
|
+
}
|
|
4331
|
+
if (!dryRun && file.executable === true && action !== "unchanged") {
|
|
4332
|
+
chmodSync2(target, 493);
|
|
4333
|
+
}
|
|
4334
|
+
return { path: file.path, absolutePath: target, action };
|
|
4335
|
+
});
|
|
4336
|
+
return { name: skill.name, files: fileWrites };
|
|
4275
4337
|
});
|
|
4276
4338
|
const prompts = bundle.prompts.map((prompt) => {
|
|
4277
4339
|
const target = join5(projectRoot, profile.promptPath(prompt.name));
|
|
@@ -4312,8 +4374,12 @@ function applyBundle(bundle, projectRoot, options = {}) {
|
|
|
4312
4374
|
});
|
|
4313
4375
|
if (!dryRun && !partial) {
|
|
4314
4376
|
const removed = computeRemovals(prevManifest, bundle, profile, projectRoot);
|
|
4315
|
-
for (const entry of removed.
|
|
4377
|
+
for (const entry of removed.skillDirs)
|
|
4316
4378
|
rmSync2(entry.path, { recursive: true, force: true });
|
|
4379
|
+
for (const entry of removed.skillFiles) {
|
|
4380
|
+
rmSync2(entry.path, { force: true });
|
|
4381
|
+
removeEmptyParentDirs(entry.path, entry.skillDirAbs);
|
|
4382
|
+
}
|
|
4317
4383
|
for (const entry of removed.prompts)
|
|
4318
4384
|
rmSync2(entry.path, { force: true });
|
|
4319
4385
|
for (const entry of removed.configs)
|
|
@@ -4323,12 +4389,13 @@ function applyBundle(bundle, projectRoot, options = {}) {
|
|
|
4323
4389
|
const nextManifest = {
|
|
4324
4390
|
package: CLI_PACKAGE_NAME,
|
|
4325
4391
|
version: CLI_VERSION,
|
|
4392
|
+
manifestVersion: MANIFEST_VERSION,
|
|
4326
4393
|
lastApplied: new Date().toISOString(),
|
|
4327
4394
|
lessonId: bundle.lessonId,
|
|
4328
4395
|
course,
|
|
4329
4396
|
tool: profile.toolId,
|
|
4330
4397
|
files: {
|
|
4331
|
-
skills: bundle.skills.map((s) => s.name),
|
|
4398
|
+
skills: Object.fromEntries(bundle.skills.map((s) => [s.name, { files: s.files.map((f2) => f2.path) }])),
|
|
4332
4399
|
prompts: bundle.prompts.map((p2) => `${p2.name}.md`),
|
|
4333
4400
|
configs: bundle.configs.map((c2) => c2.name)
|
|
4334
4401
|
}
|
|
@@ -4367,20 +4434,43 @@ function writeFileAt(filePath, content) {
|
|
|
4367
4434
|
writeFileSync3(filePath, content);
|
|
4368
4435
|
}
|
|
4369
4436
|
function computeRemovals(prevManifest, bundle, profile, projectRoot) {
|
|
4370
|
-
const empty = {
|
|
4437
|
+
const empty = {
|
|
4438
|
+
skillDirs: [],
|
|
4439
|
+
skillFiles: [],
|
|
4440
|
+
prompts: [],
|
|
4441
|
+
configs: []
|
|
4442
|
+
};
|
|
4371
4443
|
if (!prevManifest)
|
|
4372
4444
|
return empty;
|
|
4373
|
-
const currentSkills = new
|
|
4445
|
+
const currentSkills = new Map(bundle.skills.map((s) => [s.name, new Set(s.files.map((f2) => f2.path))]));
|
|
4374
4446
|
const currentPrompts = new Set(bundle.prompts.map((p2) => `${p2.name}.md`));
|
|
4375
4447
|
const currentConfigs = new Set(bundle.configs.map((c2) => c2.name));
|
|
4376
|
-
const removed = {
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
|
|
4448
|
+
const removed = {
|
|
4449
|
+
skillDirs: [],
|
|
4450
|
+
skillFiles: [],
|
|
4451
|
+
prompts: [],
|
|
4452
|
+
configs: []
|
|
4453
|
+
};
|
|
4454
|
+
for (const [skillName, entry] of Object.entries(prevManifest.files.skills)) {
|
|
4380
4455
|
if (!isSafeName(skillName))
|
|
4381
4456
|
continue;
|
|
4382
|
-
const
|
|
4383
|
-
|
|
4457
|
+
const skillDirAbs = join5(projectRoot, profile.skillDir(skillName));
|
|
4458
|
+
if (!currentSkills.has(skillName)) {
|
|
4459
|
+
removed.skillDirs.push({ name: skillName, path: skillDirAbs });
|
|
4460
|
+
continue;
|
|
4461
|
+
}
|
|
4462
|
+
const currentFiles = currentSkills.get(skillName);
|
|
4463
|
+
for (const relPath of entry.files) {
|
|
4464
|
+
if (currentFiles.has(relPath))
|
|
4465
|
+
continue;
|
|
4466
|
+
if (!isSafeSkillFilePath(relPath))
|
|
4467
|
+
continue;
|
|
4468
|
+
removed.skillFiles.push({
|
|
4469
|
+
name: `${skillName}/${relPath}`,
|
|
4470
|
+
path: join5(skillDirAbs, relPath),
|
|
4471
|
+
skillDirAbs
|
|
4472
|
+
});
|
|
4473
|
+
}
|
|
4384
4474
|
}
|
|
4385
4475
|
for (const promptFile of prevManifest.files.prompts) {
|
|
4386
4476
|
if (currentPrompts.has(promptFile))
|
|
@@ -4405,6 +4495,19 @@ function computeRemovals(prevManifest, bundle, profile, projectRoot) {
|
|
|
4405
4495
|
}
|
|
4406
4496
|
return removed;
|
|
4407
4497
|
}
|
|
4498
|
+
function removeEmptyParentDirs(filePath, skillDirAbs) {
|
|
4499
|
+
let dir = dirname3(filePath);
|
|
4500
|
+
while (dir.startsWith(skillDirAbs) && dir !== skillDirAbs) {
|
|
4501
|
+
try {
|
|
4502
|
+
if (readdirSync(dir).length > 0)
|
|
4503
|
+
return;
|
|
4504
|
+
rmdirSync(dir);
|
|
4505
|
+
} catch {
|
|
4506
|
+
return;
|
|
4507
|
+
}
|
|
4508
|
+
dir = dirname3(dir);
|
|
4509
|
+
}
|
|
4510
|
+
}
|
|
4408
4511
|
function findOrphanedManifests(projectRoot, currentProfile) {
|
|
4409
4512
|
const out = [];
|
|
4410
4513
|
for (const profile of Object.values(PROFILES)) {
|
|
@@ -4433,6 +4536,29 @@ function assertSafeName(name, kind) {
|
|
|
4433
4536
|
throw new Error(`refused to write unsafe ${kind} name ${JSON.stringify(name)} — must not be empty, contain path separators, or start with '.'`);
|
|
4434
4537
|
}
|
|
4435
4538
|
}
|
|
4539
|
+
function assertSafeSkillFilePath(relPath, skillName) {
|
|
4540
|
+
if (!isSafeSkillFilePath(relPath)) {
|
|
4541
|
+
throw new Error(`refused to write unsafe file path ${JSON.stringify(relPath)} inside skill ${JSON.stringify(skillName)}`);
|
|
4542
|
+
}
|
|
4543
|
+
}
|
|
4544
|
+
function isSafeSkillFilePath(relPath) {
|
|
4545
|
+
if (typeof relPath !== "string" || relPath.length === 0)
|
|
4546
|
+
return false;
|
|
4547
|
+
if (relPath.startsWith("/") || relPath.startsWith("\\"))
|
|
4548
|
+
return false;
|
|
4549
|
+
if (/^[a-zA-Z]:/.test(relPath))
|
|
4550
|
+
return false;
|
|
4551
|
+
const segments = relPath.split(/[/\\]/);
|
|
4552
|
+
if (segments.length === 0)
|
|
4553
|
+
return false;
|
|
4554
|
+
for (const seg of segments) {
|
|
4555
|
+
if (seg === "" || seg === "." || seg === "..")
|
|
4556
|
+
return false;
|
|
4557
|
+
if (!isSafeName(seg))
|
|
4558
|
+
return false;
|
|
4559
|
+
}
|
|
4560
|
+
return true;
|
|
4561
|
+
}
|
|
4436
4562
|
function isSafeName(name) {
|
|
4437
4563
|
if (typeof name !== "string" || name.length === 0)
|
|
4438
4564
|
return false;
|
|
@@ -4464,16 +4590,30 @@ function migrateArtifacts(projectRoot, orphan, newProfile) {
|
|
|
4464
4590
|
skipped: []
|
|
4465
4591
|
};
|
|
4466
4592
|
const oldProfile = orphan.profile;
|
|
4467
|
-
for (const skillName of orphan.manifest.files.skills) {
|
|
4593
|
+
for (const [skillName, entry] of Object.entries(orphan.manifest.files.skills)) {
|
|
4468
4594
|
if (!isSafeName(skillName)) {
|
|
4469
4595
|
summary.skipped.push({ path: skillName, reason: "unsafe name in manifest" });
|
|
4470
4596
|
continue;
|
|
4471
4597
|
}
|
|
4472
|
-
const
|
|
4473
|
-
const
|
|
4474
|
-
|
|
4475
|
-
|
|
4598
|
+
const fromSkillDir = join6(projectRoot, oldProfile.skillDir(skillName));
|
|
4599
|
+
const toSkillDir = join6(projectRoot, newProfile.skillDir(skillName));
|
|
4600
|
+
let anyMoved = false;
|
|
4601
|
+
for (const relPath of entry.files) {
|
|
4602
|
+
if (!isSafeSkillFilePath(relPath)) {
|
|
4603
|
+
summary.skipped.push({
|
|
4604
|
+
path: `${skillName}/${relPath}`,
|
|
4605
|
+
reason: "unsafe path in manifest"
|
|
4606
|
+
});
|
|
4607
|
+
continue;
|
|
4608
|
+
}
|
|
4609
|
+
const from = join6(fromSkillDir, relPath);
|
|
4610
|
+
const to = join6(toSkillDir, relPath);
|
|
4611
|
+
if (moveIfSafe(from, to, summary.skipped))
|
|
4612
|
+
anyMoved = true;
|
|
4476
4613
|
}
|
|
4614
|
+
tryRemoveEmptyDir(fromSkillDir);
|
|
4615
|
+
if (anyMoved)
|
|
4616
|
+
summary.movedOrRemoved.skills.push(skillName);
|
|
4477
4617
|
}
|
|
4478
4618
|
for (const promptFile of orphan.manifest.files.prompts) {
|
|
4479
4619
|
if (!isSafeName(promptFile)) {
|
|
@@ -4512,15 +4652,23 @@ function deleteArtifacts(projectRoot, orphan) {
|
|
|
4512
4652
|
skipped: []
|
|
4513
4653
|
};
|
|
4514
4654
|
const oldProfile = orphan.profile;
|
|
4515
|
-
for (const skillName of orphan.manifest.files.skills) {
|
|
4655
|
+
for (const [skillName, entry] of Object.entries(orphan.manifest.files.skills)) {
|
|
4516
4656
|
if (!isSafeName(skillName)) {
|
|
4517
4657
|
summary.skipped.push({ path: skillName, reason: "unsafe name in manifest" });
|
|
4518
4658
|
continue;
|
|
4519
4659
|
}
|
|
4520
|
-
const
|
|
4521
|
-
const
|
|
4522
|
-
|
|
4523
|
-
|
|
4660
|
+
const skillDir = join6(projectRoot, oldProfile.skillDir(skillName));
|
|
4661
|
+
for (const relPath of entry.files) {
|
|
4662
|
+
if (!isSafeSkillFilePath(relPath)) {
|
|
4663
|
+
summary.skipped.push({
|
|
4664
|
+
path: `${skillName}/${relPath}`,
|
|
4665
|
+
reason: "unsafe path in manifest"
|
|
4666
|
+
});
|
|
4667
|
+
continue;
|
|
4668
|
+
}
|
|
4669
|
+
rmSync3(join6(skillDir, relPath), { force: true });
|
|
4670
|
+
}
|
|
4671
|
+
rmSync3(skillDir, { recursive: true, force: true });
|
|
4524
4672
|
summary.movedOrRemoved.skills.push(skillName);
|
|
4525
4673
|
}
|
|
4526
4674
|
for (const promptFile of orphan.manifest.files.prompts) {
|
|
@@ -4623,7 +4771,7 @@ function tryRemoveEmptyDir(dir) {
|
|
|
4623
4771
|
if (!existsSync6(dir))
|
|
4624
4772
|
return;
|
|
4625
4773
|
try {
|
|
4626
|
-
|
|
4774
|
+
rmdirSync2(dir);
|
|
4627
4775
|
} catch {}
|
|
4628
4776
|
}
|
|
4629
4777
|
|
|
@@ -4784,7 +4932,10 @@ async function runGet(ctx, ref, options) {
|
|
|
4784
4932
|
return;
|
|
4785
4933
|
}
|
|
4786
4934
|
verbose(ctx, `fetching lesson ${course}/${parsed.lessonId}`);
|
|
4787
|
-
const result = await fetchLesson(course, parsed.lessonId, auth.access_token, {
|
|
4935
|
+
const result = await fetchLesson(course, parsed.lessonId, auth.access_token, {
|
|
4936
|
+
lang,
|
|
4937
|
+
tool: profile.toolId
|
|
4938
|
+
});
|
|
4788
4939
|
if (!result.ok) {
|
|
4789
4940
|
handleLessonError(ctx, result.status, result.code, result.error, result.payload);
|
|
4790
4941
|
}
|
|
@@ -4853,25 +5004,55 @@ async function runPrintMode(ctx, lessonId, course, profile, token, lang, options
|
|
|
4853
5004
|
if (ctx.json) {
|
|
4854
5005
|
output(ctx, "", result.data);
|
|
4855
5006
|
} else {
|
|
4856
|
-
|
|
5007
|
+
const data = result.data;
|
|
5008
|
+
if (data.type === "skills") {
|
|
5009
|
+
const skillMd = data.files.find((f2) => f2.path === "SKILL.md");
|
|
5010
|
+
process.stdout.write(skillMd?.content ?? "");
|
|
5011
|
+
emitMultiFileSkillNotice(data.name, data.files);
|
|
5012
|
+
} else {
|
|
5013
|
+
process.stdout.write(data.content);
|
|
5014
|
+
}
|
|
4857
5015
|
}
|
|
4858
5016
|
} else {
|
|
4859
5017
|
verbose(ctx, `fetching lesson ${course}/${lessonId} (filtering by ${options.type})`);
|
|
4860
|
-
const result = await fetchLesson(course, lessonId, token, { lang });
|
|
5018
|
+
const result = await fetchLesson(course, lessonId, token, { lang, tool: profile.toolId });
|
|
4861
5019
|
if (!result.ok) {
|
|
4862
5020
|
handleLessonError(ctx, result.status, result.code, result.error, result.payload);
|
|
4863
5021
|
}
|
|
4864
|
-
const
|
|
4865
|
-
if (
|
|
4866
|
-
|
|
5022
|
+
const type = options.type;
|
|
5023
|
+
if (type === "skills") {
|
|
5024
|
+
const skills = result.data.skills;
|
|
5025
|
+
if (ctx.json) {
|
|
5026
|
+
output(ctx, "", skills);
|
|
5027
|
+
} else {
|
|
5028
|
+
const contents = skills.map((s) => s.files.find((f2) => f2.path === "SKILL.md")?.content ?? "");
|
|
5029
|
+
process.stdout.write(contents.join(`
|
|
5030
|
+
---
|
|
5031
|
+
`));
|
|
5032
|
+
for (const skill of skills)
|
|
5033
|
+
emitMultiFileSkillNotice(skill.name, skill.files);
|
|
5034
|
+
}
|
|
4867
5035
|
} else {
|
|
4868
|
-
const
|
|
4869
|
-
|
|
5036
|
+
const artifacts = result.data[type];
|
|
5037
|
+
if (ctx.json) {
|
|
5038
|
+
output(ctx, "", artifacts);
|
|
5039
|
+
} else {
|
|
5040
|
+
const contents = artifacts.map((a2) => a2.content);
|
|
5041
|
+
process.stdout.write(contents.join(`
|
|
4870
5042
|
---
|
|
4871
5043
|
`));
|
|
5044
|
+
}
|
|
4872
5045
|
}
|
|
4873
5046
|
}
|
|
4874
5047
|
}
|
|
5048
|
+
function emitMultiFileSkillNotice(skillName, files) {
|
|
5049
|
+
const extras = files.filter((f2) => f2.path !== "SKILL.md").map((f2) => f2.path);
|
|
5050
|
+
if (extras.length === 0)
|
|
5051
|
+
return;
|
|
5052
|
+
process.stderr.write(`Note: skill "${skillName}" has ${extras.length} additional file${extras.length === 1 ? "" : "s"} not shown in --print: ${extras.join(", ")}.
|
|
5053
|
+
` + `Run without --print to materialize all files.
|
|
5054
|
+
`);
|
|
5055
|
+
}
|
|
4875
5056
|
function handleLessonError(ctx, status, code, error, payload) {
|
|
4876
5057
|
verbose(ctx, `lesson fetch failed: status=${status} code=${code}`);
|
|
4877
5058
|
if (status === 403) {
|
|
@@ -4938,7 +5119,15 @@ function renderGetResult(ctx, bundle, writeResult, dryRun, profile, langMeta = {
|
|
|
4938
5119
|
lines.push("");
|
|
4939
5120
|
lines.push(dryRun ? `Would write to ${targetDir}/:` : `Wrote to ${targetDir}/:`);
|
|
4940
5121
|
for (const skill of writeResult.skills) {
|
|
4941
|
-
|
|
5122
|
+
if (skill.files.length === 1) {
|
|
5123
|
+
const f2 = skill.files[0];
|
|
5124
|
+
lines.push(` [${f2.action}] skill ${f2.absolutePath}`);
|
|
5125
|
+
} else {
|
|
5126
|
+
lines.push(` skill ${skill.name} (${skill.files.length} files)`);
|
|
5127
|
+
for (const f2 of skill.files) {
|
|
5128
|
+
lines.push(` [${f2.action}] ${f2.path}`);
|
|
5129
|
+
}
|
|
5130
|
+
}
|
|
4942
5131
|
}
|
|
4943
5132
|
for (const prompt of writeResult.prompts) {
|
|
4944
5133
|
lines.push(` [${prompt.action}] prompt ${prompt.path}`);
|
package/package.json
CHANGED
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: 10x-cli-guide
|
|
3
|
+
description: Invoke this skill when the user asks how to USE the 10x-cli day-to-day — fetching lessons, listing modules, switching AI tools, troubleshooting errors, understanding where artifacts land, or working on a specific OS (Windows, Linux, macOS). Covers commands (get, list, doctor, auth --status/--logout), tool profiles, artifact locations, common errors, and platform-specific tips. Excludes: first-time installation and onboarding (use 10x-cli-setup instead), developing or contributing to 10x-cli source code, and general programming help.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# 10x-cli Daily Usage Guide
|
|
7
|
+
|
|
8
|
+
This skill helps users work with `@przeprogramowani/10x-cli` after it is already installed and authenticated. If the user has not installed or authenticated yet, hand off to the **10x-cli-setup** skill instead.
|
|
9
|
+
|
|
10
|
+
## Step 1: Detect the user's environment
|
|
11
|
+
|
|
12
|
+
Before giving any guidance, gather context silently — run these checks and remember the results. Do not print raw output to the user.
|
|
13
|
+
|
|
14
|
+
### Operating system
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
echo "$OSTYPE" 2>/dev/null || echo "win32"
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Use the result to tailor path separators, shell syntax, and clipboard commands throughout your answers:
|
|
21
|
+
|
|
22
|
+
| OS | Shell | Home var | Clipboard | Temp dir |
|
|
23
|
+
|----|-------|----------|-----------|----------|
|
|
24
|
+
| macOS (`darwin*`) | zsh / bash | `$HOME` | `pbcopy` | `$TMPDIR` |
|
|
25
|
+
| Linux (`linux-gnu*`) | bash / zsh | `$HOME` | `xclip -selection clipboard` or `xsel --clipboard` | `/tmp` |
|
|
26
|
+
| Windows (`win32` / MSYS / Git Bash) | PowerShell / cmd | `%USERPROFILE%` | `clip.exe` | `%TEMP%` |
|
|
27
|
+
|
|
28
|
+
### Active AI tool
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
10x doctor --json 2>/dev/null | head -1
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Also check which tool profile is configured:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
cat ~/.config/10x-cli/config.json 2>/dev/null || cat "$APPDATA/10x-cli/config.json" 2>/dev/null || echo "{}"
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
If the config contains a `"tool"` key, that is the active profile. If not, the default is `claude-code`.
|
|
41
|
+
|
|
42
|
+
### CLI version
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
10x --version
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Step 2: Answer the user's question using the reference below
|
|
49
|
+
|
|
50
|
+
Use the environment context from Step 1 to personalize every answer. Always use the OS-appropriate shell syntax, paths, and commands. Never show macOS-specific commands to a Windows user or vice versa.
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Command Reference
|
|
55
|
+
|
|
56
|
+
### `10x get <ref>` — Fetch and apply lesson artifacts
|
|
57
|
+
|
|
58
|
+
The primary daily command. Fetches a lesson bundle from the API and writes skills, prompts, rules, and config templates to the project directory.
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
10x get m1l1 # Fetch module 1, lesson 1
|
|
62
|
+
10x get m2l3 # Fetch module 2, lesson 3
|
|
63
|
+
10x get m1l1 --dry-run # Preview what would be written
|
|
64
|
+
10x get m1l1 --tool cursor # Use a different AI tool profile
|
|
65
|
+
10x get m1l1 --lang pl # Fetch Polish content
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**Filtering artifacts:**
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
10x get m1l1 --type skills # Only skills
|
|
72
|
+
10x get m1l1 --type skills --name code-review # One specific skill
|
|
73
|
+
10x get m1l1 --print --type skills --name code-review # Print to stdout
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
**Where artifacts land** (depends on the active tool profile):
|
|
77
|
+
|
|
78
|
+
| Tool | Skills | Prompts | Rules file | Config templates |
|
|
79
|
+
|------|--------|---------|------------|------------------|
|
|
80
|
+
| Claude Code | `.claude/skills/<name>/SKILL.md` | `.claude/prompts/<name>.md` | `CLAUDE.md` | `.claude/config-templates/<name>` |
|
|
81
|
+
| Cursor | `.cursor/skills/<name>/SKILL.md` | `.cursor/prompts/<name>.md` | `.cursor/rules/10x-course.mdc` | `.cursor/config-templates/<name>` |
|
|
82
|
+
| GitHub Copilot | `.github/skills/<name>/SKILL.md` | `.github/prompts/<name>.md` | `.github/copilot-instructions.md` | `.github/config-templates/<name>` |
|
|
83
|
+
| Codex CLI | `.agents/skills/<name>/SKILL.md` | `.agents/prompts/<name>.md` | `AGENTS.md` | `.agents/config-templates/<name>` |
|
|
84
|
+
| Generic | `.ai/skills/<name>/SKILL.md` | `.ai/prompts/<name>.md` | `AGENTS.md` | `.ai/config-templates/<name>` |
|
|
85
|
+
|
|
86
|
+
**Re-applying a lesson** overwrites skills and prompts if content changed, updates the rules sentinel block, but never overwrites config templates (they may contain user edits).
|
|
87
|
+
|
|
88
|
+
**Switching lessons** cleans up artifacts from the previous lesson that are not in the new one, keeps shared artifacts, and adds new ones.
|
|
89
|
+
|
|
90
|
+
### `10x list [module]` — Browse available content
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
10x list # Show all modules with lock state
|
|
94
|
+
10x list m1 # Show lessons in module 1
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Locked modules show their unlock date. Use this to see what is available before fetching.
|
|
98
|
+
|
|
99
|
+
### `10x doctor` — Diagnose problems
|
|
100
|
+
|
|
101
|
+
Runs 5 checks: Auth status, API connectivity, Config directory, CLI version, and tool directory presence.
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
10x doctor # Human-readable output
|
|
105
|
+
10x doctor --json # Machine-readable for scripting
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Exit code 78 means at least one check failed.
|
|
109
|
+
|
|
110
|
+
### `10x auth` — Session management
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
10x auth # Start magic-link login
|
|
114
|
+
10x auth --status # Check current session
|
|
115
|
+
10x auth --logout # Clear credentials
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Sessions refresh transparently — if a token is near expiry, the next command refreshes it automatically. You only need to re-auth manually if the session has fully expired.
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## Switching Tools
|
|
123
|
+
|
|
124
|
+
To change your AI tool (e.g., from Claude Code to Cursor):
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
10x get m1l1 --tool cursor
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
The CLI will detect that artifacts from the old tool exist and offer two options:
|
|
131
|
+
|
|
132
|
+
1. **Migrate** (default) — move all artifacts to the new tool's directories, remove the sentinel block from the old rules file.
|
|
133
|
+
2. **Delete** — remove only 10x-managed artifacts from the old tool's directories. Your own files (e.g., `.github/workflows/`) are never touched.
|
|
134
|
+
|
|
135
|
+
The tool choice is saved in the config file (`~/.config/10x-cli/config.json` on macOS/Linux, `%APPDATA%/10x-cli/config.json` on Windows). Future `get` commands will use the new tool without needing `--tool` again.
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## Platform-Specific Tips
|
|
140
|
+
|
|
141
|
+
### Windows
|
|
142
|
+
|
|
143
|
+
- **Use PowerShell** (not cmd.exe). The CLI outputs ANSI colors and Unicode symbols that render correctly in Windows Terminal + PowerShell but may garble in legacy cmd.
|
|
144
|
+
- **npx works fine**: `npx @przeprogramowani/10x-cli get m1l1` — no global install needed. Node 20+ is the only prerequisite.
|
|
145
|
+
- **Clipboard**: Skills that copy to clipboard use `clip.exe` on Windows. If a skill outputs a clipboard command, it will fall back silently if `clip.exe` is unavailable.
|
|
146
|
+
- **Config location**: `%APPDATA%\10x-cli\config.json` and `%APPDATA%\10x-cli\auth.json`. The CLI creates these automatically.
|
|
147
|
+
- **Path separators**: The CLI uses Node's `path.join()` internally, so forward slashes in command output (like `.claude/skills/code-review/SKILL.md`) work fine on Windows — no need to convert them.
|
|
148
|
+
|
|
149
|
+
### Linux
|
|
150
|
+
|
|
151
|
+
- **Clipboard**: Skills use `xclip -selection clipboard` or `xsel --clipboard`. If neither is installed, clipboard operations fail silently. Install with `sudo apt install xclip` (Debian/Ubuntu) or `sudo dnf install xclip` (Fedora).
|
|
152
|
+
- **Config location**: `~/.config/10x-cli/` (respects `$XDG_CONFIG_HOME` if set).
|
|
153
|
+
|
|
154
|
+
### macOS
|
|
155
|
+
|
|
156
|
+
- **Clipboard**: Skills use `pbcopy` — works out of the box.
|
|
157
|
+
- **Config location**: `~/.config/10x-cli/`.
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## Troubleshooting
|
|
162
|
+
|
|
163
|
+
When the user reports a problem, follow this sequence:
|
|
164
|
+
|
|
165
|
+
### 1. Run doctor first
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
10x doctor
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
This catches the most common issues. Read the output and address each failing check.
|
|
172
|
+
|
|
173
|
+
### 2. Common problems and fixes
|
|
174
|
+
|
|
175
|
+
| Symptom | Likely cause | Fix |
|
|
176
|
+
|---------|-------------|-----|
|
|
177
|
+
| "You're not signed in" | No auth or expired session | `10x auth` |
|
|
178
|
+
| "Session expired" | Token past expiry and auto-refresh failed | `10x auth` (re-login) |
|
|
179
|
+
| API unreachable / timeout | Network issue or API outage | Check internet; retry in a few minutes |
|
|
180
|
+
| "Module is locked" | Content not yet released | `10x list` to see unlock date |
|
|
181
|
+
| `.claude/` not found (doctor fail) | Running from wrong directory or wrong tool profile | `cd` to project root; check `10x doctor --json` for which tool is configured |
|
|
182
|
+
| "403 Forbidden" on `10x get` | Module locked or no membership | Check `10x list` for module state; verify enrollment |
|
|
183
|
+
| Orphaned artifact prompt on `get` | Switching tools mid-lesson | Choose "migrate" to move files, or "delete" to clean up |
|
|
184
|
+
| Permission denied writing files | Directory not writable | Check directory permissions; on POSIX: `chmod u+w <dir>` |
|
|
185
|
+
|
|
186
|
+
### 3. Verbose mode for deeper debugging
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
10x get m1l1 --verbose
|
|
190
|
+
10x doctor --verbose
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
This prints request/response diagnostics to stderr, useful for diagnosing API or network issues.
|
|
194
|
+
|
|
195
|
+
### 4. Nuclear reset
|
|
196
|
+
|
|
197
|
+
If config is corrupted:
|
|
198
|
+
|
|
199
|
+
On macOS/Linux:
|
|
200
|
+
```bash
|
|
201
|
+
rm -rf ~/.config/10x-cli
|
|
202
|
+
10x auth
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
On Windows (PowerShell):
|
|
206
|
+
```powershell
|
|
207
|
+
Remove-Item -Recurse -Force "$env:APPDATA\10x-cli"
|
|
208
|
+
10x auth
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
This clears auth and tool preference. The next `10x auth` recreates everything.
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
## Important Principles
|
|
216
|
+
|
|
217
|
+
- **Answer with the user's OS and tool in mind.** Never show `pbcopy` to a Windows user. Never show `%APPDATA%` to a macOS user.
|
|
218
|
+
- **Run `10x doctor` before speculating.** It catches 80% of issues.
|
|
219
|
+
- **Don't guess command syntax from memory.** If unsure about a flag or behavior, fetch the latest README: `https://raw.githubusercontent.com/przeprogramowani/10x-cli/refs/heads/master/README.md`
|
|
220
|
+
- **Distinguish tool profile issues from CLI issues.** If artifacts land in the wrong directory, it is a tool profile question. If the command itself fails, it is a CLI/auth/network question.
|