joplo 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,55 @@
1
+ Apache License
2
+
3
+ Version 2.0, January 2004
4
+
5
+ http://www.apache.org/licenses/
6
+
7
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8
+
9
+ 1. Definitions.
10
+
11
+ "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
16
+
17
+ "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
18
+
19
+ "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
20
+
21
+ "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
22
+
23
+ "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
24
+
25
+ "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
26
+
27
+ "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
28
+
29
+ "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
30
+
31
+ 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
32
+
33
+ 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
34
+
35
+ 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
36
+
37
+ You must give any other recipients of the Work or Derivative Works a copy of this License; and
38
+
39
+ You must cause any modified files to carry prominent notices stating that You changed the files; and
40
+
41
+ You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
42
+
43
+ If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
44
+
45
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
46
+
47
+ 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
48
+
49
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
50
+
51
+ 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
52
+
53
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
54
+
55
+ END OF TERMS AND CONDITIONS
package/README.md CHANGED
@@ -1,3 +1,18 @@
1
- # Temporary Holding Version
1
+ <p align="center"><img src="https://raw.githubusercontent.com/Joplo-app/Joplo/main/assets/brand/joplo-logo.svg" alt="Joplo" width="300"></p>
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
+ # joplo
4
+
5
+ 先把功能做成低保真、可点击、可演示的原型,再让编码 Agent 去写代码。
6
+
7
+ ```sh
8
+ npx joplo@latest init my-demo
9
+ cd my-demo && npm install
10
+ npx joplo dev # 本地看板:http://127.0.0.1:4790/
11
+ npx joplo skill install # 让 Claude Code / Codex 按需读取 Joplo 的用法
12
+ ```
13
+
14
+ - 用 TSX 描述页面、方案、情况、规则和演示步骤;看板里按情况比较方案,⌥+单击元素拿到 `文件:行`。
15
+ - 层级、导演镜头、架构图(`Diagram` + `trace()`)、终端和手机外框、自定义主题。
16
+ - `npx joplo build` 生成可直接部署的静态演示站。
17
+
18
+ 文档与示例:<https://github.com/Joplo-app/Joplo>。许可证:Apache-2.0。
package/bin/joplo.cjs ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env node
2
+ /*
3
+ * joplo 命令入口。先检查 Node 版本(ES5 语法,不加载其他模块),通过后才载入 lib/main.cjs。
4
+ */
5
+ 'use strict';
6
+
7
+ var message = require('../lib/node-check.cjs').checkNode(process.versions.node);
8
+ if (message) {
9
+ process.stderr.write(message + '\n');
10
+ process.exit(1);
11
+ }
12
+ require('../lib/main.cjs').main();
package/lib/main.cjs ADDED
@@ -0,0 +1,102 @@
1
+ /**
2
+ * 选择并运行 @joplo-app/cli(只在 Node ≥ 22 上载入):
3
+ * 1. 当前目录(向上)所在项目的 node_modules 里有 @joplo-app/cli → 用项目内的版本(项目内版本优先)。
4
+ * pnpm 布局下项目只直接依赖 joplo,就从 node_modules/joplo 的真实位置再找它的 @joplo-app/cli。
5
+ * 2. 否则用本包自己依赖的 @joplo-app/cli。
6
+ * 例外:init 总是用本包的版本——用户用 `npx joplo@<版本> init` 明确指定了要生成哪个版本的项目。
7
+ *
8
+ * 转发方式:读取所选 @joplo-app/cli 的 package.json 的 bin['joplo-cli'],用 import() 运行它(参数沿用 process.argv)。
9
+ * @joplo-app/cli 的命令名故意不叫 joplo:否则 npm 安装时它会占掉 node_modules/.bin/joplo,绕过本入口。
10
+ */
11
+ 'use strict';
12
+
13
+ const fs = require('node:fs');
14
+ const path = require('node:path');
15
+ const { pathToFileURL } = require('node:url');
16
+
17
+ const readJson = (file) => {
18
+ try {
19
+ return JSON.parse(fs.readFileSync(file, 'utf8'));
20
+ } catch {
21
+ return null;
22
+ }
23
+ };
24
+
25
+ /** 从 dir 起向上找 node_modules/<name>/package.json。 */
26
+ function findUp(dir, name) {
27
+ let cur = path.resolve(dir);
28
+ for (;;) {
29
+ const f = path.join(cur, 'node_modules', name, 'package.json');
30
+ if (fs.existsSync(f)) return f;
31
+ const parent = path.dirname(cur);
32
+ if (parent === cur) return null;
33
+ cur = parent;
34
+ }
35
+ }
36
+
37
+ /** 读取一份 @joplo-app/cli;package.json 坏掉或没有 bin['joplo-cli'] 时返回 null。 */
38
+ function describeCli(pkgFile) {
39
+ if (!pkgFile) return null;
40
+ const pkg = readJson(pkgFile);
41
+ if (!pkg || typeof pkg.version !== 'string') return null;
42
+ const bin = typeof pkg.bin === 'string' ? pkg.bin : pkg.bin && typeof pkg.bin['joplo-cli'] === 'string' ? pkg.bin['joplo-cli'] : null;
43
+ if (!bin) return null;
44
+ const dir = fs.realpathSync(path.dirname(pkgFile));
45
+ const file = path.resolve(dir, bin);
46
+ if (!fs.existsSync(file)) return null;
47
+ return { dir, version: pkg.version, bin: file };
48
+ }
49
+
50
+ /** 项目内的 @joplo-app/cli:先找直接安装的,再经由项目里的 joplo 包找。 */
51
+ function localCli(cwd) {
52
+ const direct = describeCli(findUp(cwd, '@joplo-app/cli'));
53
+ if (direct) return direct;
54
+ const joplo = findUp(cwd, 'joplo');
55
+ if (!joplo) return null;
56
+ return describeCli(findUp(fs.realpathSync(path.dirname(joplo)), '@joplo-app/cli'));
57
+ }
58
+
59
+ function packageManager(env) {
60
+ const name = /^(npm|pnpm|yarn|bun)\//.exec(String(env.npm_config_user_agent || ''));
61
+ return name ? name[1] : 'npm';
62
+ }
63
+ const ADD_DEV = { npm: 'npm i -D', pnpm: 'pnpm add -D', yarn: 'yarn add -D', bun: 'bun add -d' };
64
+
65
+ /**
66
+ * 决定用哪份 CLI。selfDir 是本包(joplo)的目录。
67
+ * 返回 { dir, version, bin, local, notes };哪里都找不到时返回 null。notes 写到 stderr。
68
+ */
69
+ function pickCli({ cwd, selfDir, argv, env }) {
70
+ const own = describeCli(findUp(selfDir, '@joplo-app/cli'));
71
+ const command = argv[0];
72
+ const local = command === 'init' ? null : localCli(cwd);
73
+ const notes = [];
74
+ if (local) {
75
+ const same = own && own.dir === local.dir;
76
+ if (!same && own && own.version !== local.version)
77
+ notes.push(
78
+ `! 已改用项目内的 joplo ${local.version} 执行(npx 拉到的是 ${own.version})。` +
79
+ `要升级:${ADD_DEV[packageManager(env)]} joplo@${own.version} @joplo-app/kit@${own.version}`,
80
+ );
81
+ if (command === 'dev') {
82
+ const kit = readJson(findUp(cwd, '@joplo-app/kit') || '');
83
+ notes.push(`[joplo] 使用项目内的 joplo ${local.version}(@joplo-app/kit ${kit && kit.version ? kit.version : '未安装'})`);
84
+ }
85
+ return { ...local, local: true, notes };
86
+ }
87
+ if (!own) return null;
88
+ return { ...own, local: false, notes };
89
+ }
90
+
91
+ async function main() {
92
+ const choice = pickCli({ cwd: process.cwd(), selfDir: path.resolve(__dirname, '..'), argv: process.argv.slice(2), env: process.env });
93
+ if (!choice) {
94
+ process.stderr.write('✗ 找不到 @joplo-app/cli。请重新安装:npm i -D joplo,或运行 npx joplo@latest\n');
95
+ process.exitCode = 1;
96
+ return;
97
+ }
98
+ for (const n of choice.notes) process.stderr.write(n + '\n');
99
+ await import(pathToFileURL(choice.bin).href);
100
+ }
101
+
102
+ module.exports = { main, pickCli, findUp };
@@ -0,0 +1,18 @@
1
+ /*
2
+ * Node 版本检查。这个文件和 bin/joplo.cjs 只用 ES5 语法,旧版 Node 也能解析并打印要求,
3
+ * 不会先因为新语法报出看不懂的堆栈。
4
+ */
5
+ 'use strict';
6
+
7
+ var REQUIRED_MAJOR = 22;
8
+
9
+ /** 返回需要打印的说明;版本满足要求时返回 null。 */
10
+ function checkNode(version) {
11
+ var match = /^v?(\d+)\./.exec(String(version || ''));
12
+ var major = match ? parseInt(match[1], 10) : 0;
13
+ if (major >= REQUIRED_MAJOR) return null;
14
+ return '✗ Joplo 需要 Node.js ' + REQUIRED_MAJOR + ' 或更高版本,当前是 ' + (version || '未知') + '。\n' +
15
+ ' 升级:nvm install ' + REQUIRED_MAJOR + ',或从 https://nodejs.org 下载。';
16
+ }
17
+
18
+ module.exports = { checkNode: checkNode, REQUIRED_MAJOR: REQUIRED_MAJOR };
package/package.json CHANGED
@@ -1,6 +1,38 @@
1
1
  {
2
2
  "name": "joplo",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.1",
4
+ "description": "Joplo 命令入口:npx joplo init / dev / check / build。转发到项目内安装的 @joplo-app/cli",
5
+ "license": "Apache-2.0",
6
+ "bin": {
7
+ "joplo": "./bin/joplo.cjs"
8
+ },
9
+ "files": [
10
+ "bin",
11
+ "lib"
12
+ ],
13
+ "keywords": [
14
+ "joplo",
15
+ "prototype",
16
+ "design",
17
+ "tsx",
18
+ "agent"
19
+ ],
20
+ "dependencies": {
21
+ "@joplo-app/cli": "0.1.1"
22
+ },
23
+ "engines": {
24
+ "node": ">=22"
25
+ },
26
+ "publishConfig": {
27
+ "access": "public"
28
+ },
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "git+https://github.com/Joplo-app/Joplo.git",
32
+ "directory": "packages/joplo"
33
+ },
34
+ "homepage": "https://github.com/Joplo-app/Joplo#readme",
35
+ "bugs": {
36
+ "url": "https://github.com/Joplo-app/Joplo/issues"
37
+ }
6
38
  }