tokrepo 3.1.2 → 3.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/bin/tokrepo.js +28 -4
- package/package.json +2 -2
package/bin/tokrepo.js
CHANGED
|
@@ -25,7 +25,7 @@ const CONFIG_FILE = path.join(CONFIG_DIR, 'config.json');
|
|
|
25
25
|
const SYNC_STATE_FILE = path.join(CONFIG_DIR, 'sync-state.json');
|
|
26
26
|
const PROJECT_CONFIG = '.tokrepo.json';
|
|
27
27
|
const DEFAULT_API = 'https://api.tokrepo.com';
|
|
28
|
-
const CLI_VERSION = '3.
|
|
28
|
+
const CLI_VERSION = '3.2.0';
|
|
29
29
|
const VERSION_CHECK_FILE = path.join(require('os').homedir(), '.tokrepo', '.version-check');
|
|
30
30
|
|
|
31
31
|
// ─── Helpers ───
|
|
@@ -944,12 +944,38 @@ function computeHash(files) {
|
|
|
944
944
|
return h.digest('hex');
|
|
945
945
|
}
|
|
946
946
|
|
|
947
|
+
function isProjectDirectory(dirPath) {
|
|
948
|
+
const PROJECT_MARKERS = [
|
|
949
|
+
'package.json', '.tokrepo.json', 'go.mod', 'Cargo.toml',
|
|
950
|
+
'pyproject.toml', 'setup.py', 'Gemfile', 'pom.xml',
|
|
951
|
+
'build.gradle', 'Makefile', 'CMakeLists.txt', 'deno.json',
|
|
952
|
+
];
|
|
953
|
+
return PROJECT_MARKERS.some(m => fs.existsSync(path.join(dirPath, m)));
|
|
954
|
+
}
|
|
955
|
+
|
|
947
956
|
function scanDirectory(dirPath) {
|
|
948
957
|
const assets = [];
|
|
949
958
|
const SKIP_DIRS = new Set(['node_modules', '.git', '__pycache__', '.venv', 'dist', 'build']);
|
|
950
959
|
const SKIP_FILES = new Set(['.DS_Store', 'Thumbs.db', 'package-lock.json', 'yarn.lock']);
|
|
951
960
|
|
|
952
|
-
//
|
|
961
|
+
// If the directory itself is a project, treat the whole thing as one asset
|
|
962
|
+
if (isProjectDirectory(dirPath)) {
|
|
963
|
+
const files = collectAssetFiles(dirPath);
|
|
964
|
+
if (files.length > 0) {
|
|
965
|
+
const title = guessAssetTitle(files, path.basename(dirPath));
|
|
966
|
+
const hash = computeHash(files);
|
|
967
|
+
const detectedTags = new Set();
|
|
968
|
+
for (const f of files) {
|
|
969
|
+
const ft = detectFileType(f.name);
|
|
970
|
+
const tag = guessTag(ft);
|
|
971
|
+
if (tag) detectedTags.add(tag);
|
|
972
|
+
}
|
|
973
|
+
assets.push({ title, files, hash, tags: Array.from(detectedTags), sourcePath: dirPath });
|
|
974
|
+
}
|
|
975
|
+
return assets;
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
// Non-project directory: each subdirectory = one asset; loose files = one asset per file
|
|
953
979
|
let entries;
|
|
954
980
|
try { entries = fs.readdirSync(dirPath, { withFileTypes: true }); } catch { return assets; }
|
|
955
981
|
|
|
@@ -965,8 +991,6 @@ function scanDirectory(dirPath) {
|
|
|
965
991
|
const files = collectAssetFiles(fullPath);
|
|
966
992
|
if (files.length === 0) continue;
|
|
967
993
|
|
|
968
|
-
// Use directory name as title (matches what `push` uses for remote title)
|
|
969
|
-
// NOT the markdown heading, which can be completely different
|
|
970
994
|
const title = entry.name;
|
|
971
995
|
const hash = computeHash(files);
|
|
972
996
|
const detectedTags = new Set();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tokrepo",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "AI assets for humans and agents — sync, search, install, push. Like git push for your AI skills.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"tokrepo": "bin/tokrepo.js"
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"repository": {
|
|
13
13
|
"type": "git",
|
|
14
|
-
"url": "git+https://github.com/tokrepo
|
|
14
|
+
"url": "git+https://github.com/henu-wang/tokrepo-cli.git"
|
|
15
15
|
},
|
|
16
16
|
"homepage": "https://tokrepo.com",
|
|
17
17
|
"keywords": [
|