@zweer/dev 1.0.3 → 1.1.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.
@@ -50,6 +50,7 @@ export const bootstrap = new Command()
50
50
  'lint:format': 'biome check --write',
51
51
  'lint:lockfile': 'lockfile-lint --path package-lock.json',
52
52
  'lint:engines': 'ls-engines',
53
+ 'lint:package': 'npmPkgJsonLint .',
53
54
  'lint:publish': 'publint --strict',
54
55
  test: 'vitest run',
55
56
  'test:coverage': 'vitest run --coverage',
@@ -93,6 +94,8 @@ export const bootstrap = new Command()
93
94
  'lint-staged': '^16.2.6',
94
95
  'lockfile-lint': '^4.14.1',
95
96
  'ls-engines': '^0.9.3',
97
+ 'npm-package-json-lint': '^8.0.0',
98
+ 'npm-package-json-lint-config-default': '^7.0.1',
96
99
  publint: '^0.3.15',
97
100
  rimraf: '^6.1.0',
98
101
  'semantic-release': '^25.0.2',
@@ -244,6 +247,48 @@ trim_trailing_whitespace = false
244
247
  indent_style = tab
245
248
  `;
246
249
  await writeFile('.editorconfig', editorconfig);
250
+ // Create .npmpackagejsonlintrc.json
251
+ const npmPackageJsonLintrc = {
252
+ rules: {
253
+ 'require-author': 'error',
254
+ 'require-description': 'error',
255
+ 'require-engines': 'error',
256
+ 'require-license': 'error',
257
+ 'require-name': 'error',
258
+ 'require-repository': 'error',
259
+ 'require-version': 'error',
260
+ 'require-bugs': 'error',
261
+ 'require-homepage': 'error',
262
+ 'require-keywords': 'error',
263
+ 'bin-type': 'error',
264
+ 'config-type': 'error',
265
+ 'description-type': 'error',
266
+ 'devDependencies-type': 'error',
267
+ 'directories-type': 'error',
268
+ 'engines-type': 'error',
269
+ 'files-type': 'error',
270
+ 'homepage-type': 'error',
271
+ 'keywords-type': 'error',
272
+ 'license-type': 'error',
273
+ 'main-type': 'error',
274
+ 'man-type': 'error',
275
+ 'name-type': 'error',
276
+ 'preferGlobal-type': 'error',
277
+ 'private-type': 'error',
278
+ 'repository-type': 'error',
279
+ 'scripts-type': 'error',
280
+ 'version-type': 'error',
281
+ 'valid-values-author': ['error', [answers.author]],
282
+ 'valid-values-private': ['error', [false]],
283
+ 'no-restricted-dependencies': ['error', ['gulping-npm-package-json-lint']],
284
+ 'no-restricted-pre-release-dependencies': ['error', ['gulping-npm-package-json-lint']],
285
+ 'no-restricted-devDependencies': ['error', ['gulping-npm-package-json-lint']],
286
+ 'no-restricted-pre-release-devDependencies': ['error', ['gulping-npm-package-json-lint']],
287
+ 'name-format': 'error',
288
+ 'version-format': 'error',
289
+ },
290
+ };
291
+ await writeFile('.npmpackagejsonlintrc.json', JSON.stringify(npmPackageJsonLintrc, null, 2));
247
292
  // Create directories
248
293
  await mkdir('src', { recursive: true });
249
294
  await mkdir('test', { recursive: true });
@@ -18,6 +18,8 @@ const DEV_DEPENDENCIES = {
18
18
  'lint-staged': '^16.2.6',
19
19
  'lockfile-lint': '^4.14.1',
20
20
  'ls-engines': '^0.9.3',
21
+ 'npm-package-json-lint': '^8.0.0',
22
+ 'npm-package-json-lint-config-default': '^7.0.1',
21
23
  publint: '^0.3.15',
22
24
  rimraf: '^6.1.0',
23
25
  'semantic-release': '^25.0.2',
@@ -29,6 +31,7 @@ const SCRIPTS = {
29
31
  'lint:format': 'biome check --write',
30
32
  'lint:lockfile': 'lockfile-lint --path package-lock.json',
31
33
  'lint:engines': 'ls-engines',
34
+ 'lint:package': 'npmPkgJsonLint .',
32
35
  'lint:publish': 'publint --strict',
33
36
  test: 'vitest run',
34
37
  'test:coverage': 'vitest run --coverage',
@@ -67,6 +70,7 @@ export const setup = new Command()
67
70
  { name: 'Vitest (vitest.config.ts)', value: 'vitest' },
68
71
  { name: 'Lint-staged (.lintstagedrc)', value: 'lintstaged' },
69
72
  { name: 'EditorConfig (.editorconfig)', value: 'editorconfig' },
73
+ { name: 'Package JSON Lint (.npmpackagejsonlintrc.json)', value: 'packagejsonlint' },
70
74
  { name: 'Husky (.husky/pre-commit)', value: 'husky' },
71
75
  { name: 'Dependencies', value: 'deps' },
72
76
  { name: 'Scripts', value: 'scripts' },
@@ -74,7 +78,17 @@ export const setup = new Command()
74
78
  },
75
79
  ]);
76
80
  const selected = answers.configs.includes('all')
77
- ? ['typescript', 'biome', 'vitest', 'lintstaged', 'editorconfig', 'husky', 'deps', 'scripts']
81
+ ? [
82
+ 'typescript',
83
+ 'biome',
84
+ 'vitest',
85
+ 'lintstaged',
86
+ 'editorconfig',
87
+ 'packagejsonlint',
88
+ 'husky',
89
+ 'deps',
90
+ 'scripts',
91
+ ]
78
92
  : answers.configs;
79
93
  const spinner = ora('Setting up project...').start();
80
94
  try {
@@ -222,6 +236,67 @@ indent_style = tab
222
236
  `;
223
237
  await writeFile('.editorconfig', editorconfig);
224
238
  }
239
+ // Package JSON Lint
240
+ if (selected.includes('packagejsonlint') &&
241
+ !(await fileExists('.npmpackagejsonlintrc.json'))) {
242
+ spinner.text = 'Creating .npmpackagejsonlintrc.json...';
243
+ // Get author from package.json if it exists
244
+ let author = 'Your Name <your.email@example.com>';
245
+ try {
246
+ const pkgContent = await readFile('package.json', 'utf-8');
247
+ const pkg = JSON.parse(pkgContent);
248
+ if (pkg.author) {
249
+ author = pkg.author;
250
+ }
251
+ }
252
+ catch {
253
+ // Ignore if package.json doesn't exist or can't be read
254
+ }
255
+ const npmPackageJsonLintrc = {
256
+ rules: {
257
+ 'require-author': 'error',
258
+ 'require-description': 'error',
259
+ 'require-engines': 'error',
260
+ 'require-license': 'error',
261
+ 'require-name': 'error',
262
+ 'require-repository': 'error',
263
+ 'require-version': 'error',
264
+ 'require-bugs': 'error',
265
+ 'require-homepage': 'error',
266
+ 'require-keywords': 'error',
267
+ 'bin-type': 'error',
268
+ 'config-type': 'error',
269
+ 'description-type': 'error',
270
+ 'devDependencies-type': 'error',
271
+ 'directories-type': 'error',
272
+ 'engines-type': 'error',
273
+ 'files-type': 'error',
274
+ 'homepage-type': 'error',
275
+ 'keywords-type': 'error',
276
+ 'license-type': 'error',
277
+ 'main-type': 'error',
278
+ 'man-type': 'error',
279
+ 'name-type': 'error',
280
+ 'preferGlobal-type': 'error',
281
+ 'private-type': 'error',
282
+ 'repository-type': 'error',
283
+ 'scripts-type': 'error',
284
+ 'version-type': 'error',
285
+ 'valid-values-author': ['error', [author]],
286
+ 'valid-values-private': ['error', [false]],
287
+ 'no-restricted-dependencies': ['error', ['gulping-npm-package-json-lint']],
288
+ 'no-restricted-pre-release-dependencies': ['error', ['gulping-npm-package-json-lint']],
289
+ 'no-restricted-devDependencies': ['error', ['gulping-npm-package-json-lint']],
290
+ 'no-restricted-pre-release-devDependencies': [
291
+ 'error',
292
+ ['gulping-npm-package-json-lint'],
293
+ ],
294
+ 'name-format': 'error',
295
+ 'version-format': 'error',
296
+ },
297
+ };
298
+ await writeFile('.npmpackagejsonlintrc.json', JSON.stringify(npmPackageJsonLintrc, null, 2));
299
+ }
225
300
  // Husky
226
301
  if (selected.includes('husky')) {
227
302
  spinner.text = 'Creating .husky/pre-commit...';
@@ -254,6 +329,8 @@ git update-index --again
254
329
  console.log(chalk.cyan(' ✓ .lintstagedrc'));
255
330
  if (selected.includes('editorconfig'))
256
331
  console.log(chalk.cyan(' ✓ .editorconfig'));
332
+ if (selected.includes('packagejsonlint'))
333
+ console.log(chalk.cyan(' ✓ .npmpackagejsonlintrc.json'));
257
334
  if (selected.includes('husky'))
258
335
  console.log(chalk.cyan(' ✓ .husky/pre-commit'));
259
336
  if (selected.includes('deps'))
@@ -2,6 +2,7 @@ export declare function runCommand(command: string): Promise<{
2
2
  stdout: string;
3
3
  stderr: string;
4
4
  }>;
5
+ export declare function runInteractiveCommand(command: string): Promise<void>;
5
6
  export declare function installCao(): Promise<void>;
6
7
  export declare function installAgent(agentPath: string): Promise<void>;
7
8
  export declare function launchAgent(agentName: string): Promise<void>;
package/cli/utils/cao.js CHANGED
@@ -1,23 +1,40 @@
1
- import { exec } from 'node:child_process';
1
+ import { exec, spawn } from 'node:child_process';
2
2
  import { promisify } from 'node:util';
3
3
  const execAsync = promisify(exec);
4
4
  export async function runCommand(command) {
5
5
  return execAsync(command);
6
6
  }
7
+ export async function runInteractiveCommand(command) {
8
+ return new Promise((resolve, reject) => {
9
+ const child = spawn(command, {
10
+ shell: true,
11
+ stdio: 'inherit',
12
+ });
13
+ child.on('close', (code) => {
14
+ if (code === 0) {
15
+ resolve();
16
+ }
17
+ else {
18
+ reject(new Error(`Command failed with exit code ${code}`));
19
+ }
20
+ });
21
+ child.on('error', reject);
22
+ });
23
+ }
7
24
  export async function installCao() {
8
25
  // Install tmux config
9
- await runCommand('curl -s https://raw.githubusercontent.com/awslabs/cli-agent-orchestrator/refs/heads/main/tmux-install.sh -o /tmp/tmux-install.sh && bash /tmp/tmux-install.sh || true');
26
+ await runInteractiveCommand('curl -s https://raw.githubusercontent.com/awslabs/cli-agent-orchestrator/refs/heads/main/tmux-install.sh -o /tmp/tmux-install.sh && bash /tmp/tmux-install.sh || true');
10
27
  // Install uv
11
- await runCommand('curl -LsSf https://astral.sh/uv/install.sh | sh');
28
+ await runInteractiveCommand('curl -LsSf https://astral.sh/uv/install.sh | sh');
12
29
  // Install CAO
13
- await runCommand('uv tool install git+https://github.com/awslabs/cli-agent-orchestrator.git@main --upgrade');
30
+ await runInteractiveCommand('uv tool install git+https://github.com/awslabs/cli-agent-orchestrator.git@main --upgrade');
14
31
  }
15
32
  export async function installAgent(agentPath) {
16
- await runCommand(`cao install "${agentPath}"`);
33
+ await runInteractiveCommand(`cao install "${agentPath}"`);
17
34
  }
18
35
  export async function launchAgent(agentName) {
19
- await runCommand(`cao launch --agents ${agentName}`);
36
+ await runInteractiveCommand(`cao launch --agents ${agentName}`);
20
37
  }
21
38
  export async function startServer() {
22
- await runCommand('cao-server');
39
+ await runInteractiveCommand('cao-server');
23
40
  }
package/package.json CHANGED
@@ -1,20 +1,48 @@
1
1
  {
2
2
  "name": "@zweer/dev",
3
- "version": "1.0.3",
3
+ "version": "1.1.0",
4
4
  "description": "Shared configurations & AI agents for software projects",
5
- "type": "module",
6
- "bin": "./cli/index.js",
5
+ "keywords": [
6
+ "ai",
7
+ "agents",
8
+ "cao",
9
+ "cli",
10
+ "development"
11
+ ],
12
+ "homepage": "https://github.com/Zweer/dev#readme",
13
+ "bugs": {
14
+ "url": "https://github.com/Zweer/dev/issues"
15
+ },
16
+ "license": "MIT",
17
+ "author": "Zweer <n.olivieriachille@gmail.com>",
7
18
  "files": [
8
19
  "cli/**/*.js",
9
20
  "cli/**/*.d.ts",
10
21
  "agents",
11
22
  "templates"
12
23
  ],
24
+ "bin": "./cli/index.js",
25
+ "release": {
26
+ "plugins": [
27
+ "@semantic-release/commit-analyzer",
28
+ "@semantic-release/release-notes-generator",
29
+ "@semantic-release/changelog",
30
+ "@semantic-release/npm",
31
+ "@semantic-release/github",
32
+ "@semantic-release/git"
33
+ ]
34
+ },
35
+ "repository": {
36
+ "type": "git",
37
+ "url": "git+https://github.com/Zweer/dev.git"
38
+ },
39
+ "type": "module",
13
40
  "scripts": {
14
41
  "lint": "concurrently npm:lint:* --prefixColors auto",
15
42
  "lint:format": "biome check --write",
16
43
  "lint:lockfile": "lockfile-lint --path package-lock.json",
17
44
  "lint:engines": "ls-engines",
45
+ "lint:package": "npmPkgJsonLint .",
18
46
  "lint:publish": "publint --strict",
19
47
  "test": "vitest run",
20
48
  "test:coverage": "vitest run --coverage",
@@ -25,36 +53,6 @@
25
53
  "build": "tsc",
26
54
  "release": "semantic-release"
27
55
  },
28
- "engines": {
29
- "node": ">= 20.17"
30
- },
31
- "publishConfig": {
32
- "access": "public",
33
- "provenance": true
34
- },
35
- "release": {
36
- "plugins": [
37
- "@semantic-release/commit-analyzer",
38
- "@semantic-release/release-notes-generator",
39
- "@semantic-release/changelog",
40
- "@semantic-release/npm",
41
- "@semantic-release/github",
42
- "@semantic-release/git"
43
- ]
44
- },
45
- "keywords": [
46
- "ai",
47
- "agents",
48
- "cao",
49
- "cli",
50
- "development"
51
- ],
52
- "repository": {
53
- "type": "git",
54
- "url": "https://github.com/Zweer/dev"
55
- },
56
- "author": "Zweer <n.olivieriachille@gmail.com>",
57
- "license": "MIT",
58
56
  "dependencies": {
59
57
  "@commander-js/extra-typings": "^12.1.0",
60
58
  "chalk": "^5.3.0",
@@ -74,10 +72,19 @@
74
72
  "lint-staged": "^16.2.6",
75
73
  "lockfile-lint": "^4.14.1",
76
74
  "ls-engines": "^0.9.3",
75
+ "npm-package-json-lint": "^9.0.0",
76
+ "npm-package-json-lint-config-default": "^8.0.1",
77
77
  "publint": "^0.3.15",
78
78
  "rimraf": "^6.1.0",
79
79
  "semantic-release": "^25.0.2",
80
80
  "typescript": "^5.9.3",
81
81
  "vitest": "^4.0.8"
82
+ },
83
+ "engines": {
84
+ "node": ">= 20.17"
85
+ },
86
+ "publishConfig": {
87
+ "access": "public",
88
+ "provenance": true
82
89
  }
83
90
  }