@descix/cli 1.0.0 → 1.0.3

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.
Files changed (103) hide show
  1. package/LICENSE.md +671 -0
  2. package/README.md +43 -4
  3. package/agent-assets/guides/README.md +2 -2
  4. package/agent-assets/guides/dynamic-site-pattern.md +29 -14
  5. package/agent-assets/guides/knowledge-only-pattern.md +5 -5
  6. package/agent-assets/guides/microservice-pattern.md +48 -4
  7. package/agent-assets/guides/static-site-pattern.md +8 -0
  8. package/agent-assets/instructions/app-asset-validation.md +5 -5
  9. package/agent-assets/instructions/onboarding-flow.md +4 -4
  10. package/agent-assets/instructions/standard-folder-structure.md +20 -11
  11. package/agent-assets/reference/app-creation.md +42 -20
  12. package/agent-assets/reference/architecture.md +24 -22
  13. package/agent-assets/reference/local-dev.md +230 -67
  14. package/agent-assets/reference/mcp-integration.md +9 -9
  15. package/agent-assets/reference/platform-api-consumer.md +244 -0
  16. package/agent-assets/reference/workspace-config.md +7 -7
  17. package/agent-assets/rules/descix_mcp.template.mdc +8 -8
  18. package/bin/descix.js +2559 -1435
  19. package/bin/kb-deny-lint.mjs +91 -0
  20. package/bin/mcp-server.js +175 -91
  21. package/lib/agent-files.js +37 -25
  22. package/lib/api-client.js +223 -56
  23. package/lib/auth-guard.js +13 -3
  24. package/lib/chat-session.js +187 -0
  25. package/lib/cli-version.js +59 -0
  26. package/lib/commands/airdrop.js +251 -0
  27. package/lib/commands/auth.js +254 -72
  28. package/lib/commands/briefer/errors.js +88 -0
  29. package/lib/commands/briefer/index.js +319 -0
  30. package/lib/commands/briefer/sources/canonical-sources.js +129 -0
  31. package/lib/commands/briefer/sources/entitlements.js +209 -0
  32. package/lib/commands/briefer/sources/environments.js +205 -0
  33. package/lib/commands/briefer/sources/identifiers.js +214 -0
  34. package/lib/commands/briefer/sources/microservice-deploy.js +267 -0
  35. package/lib/commands/briefer/sources/routing.js +275 -0
  36. package/lib/commands/briefer/sources/what-is-not.js +223 -0
  37. package/lib/commands/briefer/stitcher.js +134 -0
  38. package/lib/commands/briefer/util/source-reader.js +502 -0
  39. package/lib/commands/config.js +210 -90
  40. package/lib/commands/corpus.js +978 -0
  41. package/lib/commands/credits.js +122 -0
  42. package/lib/commands/health.js +627 -0
  43. package/lib/commands/kb-list-render.js +32 -0
  44. package/lib/commands/kb.js +190 -413
  45. package/lib/commands/mcp.js +5 -5
  46. package/lib/commands/microservice-restart.js +359 -0
  47. package/lib/commands/model-config.js +313 -0
  48. package/lib/commands/retired-kb-sync.js +134 -0
  49. package/lib/commands/serve.js +26 -1
  50. package/lib/commands/status.js +23 -51
  51. package/lib/commands/update.js +36 -107
  52. package/lib/core/Chunker.js +491 -17
  53. package/lib/core/CorpusDenyLint.js +326 -0
  54. package/lib/core/CorpusWalker.js +357 -0
  55. package/lib/core/Hydrator.js +75 -29
  56. package/lib/core/ManifestLoader.js +533 -0
  57. package/lib/core/SiteWalker.js +218 -0
  58. package/lib/core/Syncer.js +163 -11
  59. package/lib/diagnostic-log.js +41 -0
  60. package/lib/environment-report.js +100 -0
  61. package/lib/global-config.js +4 -1
  62. package/lib/oauth-client.js +164 -0
  63. package/lib/origin.js +143 -0
  64. package/lib/service-api-client.js +95 -0
  65. package/lib/wallet-environment.js +49 -0
  66. package/lib/wallet-file.js +16 -2
  67. package/lib/wizard/setup.js +10 -9
  68. package/lib/workspace-config.js +380 -235
  69. package/lib/workspace-identity.js +92 -0
  70. package/lib/workspace-utils.js +41 -61
  71. package/package.json +29 -9
  72. package/templates/agent-claude.md +157 -9
  73. package/templates/agent-cline.md +68 -8
  74. package/templates/agent-copilot.md +68 -8
  75. package/templates/agent-cursor.md +68 -8
  76. package/templates/alignment-schema.json +20 -0
  77. package/templates/cloud-brain-hook.sh +20 -0
  78. package/templates/drive/README.md +1 -1
  79. package/templates/drive_templates/README.md +2 -2
  80. package/templates/scaffolds/README.md +6 -10
  81. package/templates/scaffolds/microservice/SERVICE_README_sdk.md +30 -0
  82. package/templates/scaffolds/microservice/app.js +51 -10
  83. package/templates/scaffolds/microservice/app.yaml +2 -2
  84. package/templates/scaffolds/microservice/defaults-config-dev.json +4 -0
  85. package/templates/scaffolds/microservice/dev-overrides.example.json +5 -0
  86. package/templates/scaffolds/microservice/manifest.json +0 -1
  87. package/templates/scaffolds/microservice/package.json +3 -3
  88. package/templates/scaffolds/microservice/scripts/register.js +56 -41
  89. package/templates/scaffolds/microservice/services/mcpClient.js +55 -65
  90. package/templates/scaffolds/microservice/services/utils.js +20 -238
  91. package/templates/scaffolds/microservice/templates/SERVICE_README_TEMPLATE.md +24 -0
  92. package/SERVICE_README_sdk.md +0 -399
  93. package/descix-cli-1.0.0.tgz +0 -0
  94. package/lib/commands/app-wizard.js +0 -627
  95. package/lib/commands/folder.js +0 -291
  96. package/lib/core/PathContext.js +0 -335
  97. package/templates/scaffolds/microservice/dev-overrides.json.example +0 -5
  98. package/templates/scaffolds/site/DeSciXAppSDK.js +0 -62
  99. package/templates/scaffolds/site/README.md +0 -51
  100. package/templates/scaffolds/site/app.js +0 -22
  101. package/templates/scaffolds/site/index.html +0 -42
  102. package/templates/scaffolds/site/styles.css +0 -123
  103. package/test-hydration.js +0 -150
@@ -1,51 +0,0 @@
1
- # Site Folder
2
-
3
- This folder contains your app's static site files that are deployed to the web.
4
-
5
- ## Structure
6
-
7
- ```
8
- site/
9
- ├── index.html # Main entry point
10
- ├── styles.css # Stylesheet
11
- ├── app.js # Client-side JavaScript
12
- └── README.md # This file
13
- ```
14
-
15
- ## Deployment
16
-
17
- Your site is deployed when you run:
18
-
19
- ```bash
20
- descix site upload
21
- ```
22
-
23
- The site files are uploaded to Google Cloud Storage and served within the DeSciX PWA.
24
-
25
- ## Using the DeSciX SDK
26
-
27
- The DeSciX SDK is automatically injected into your CodeSite when running within the PWA App Shell. You can access it via the global `DeSciX` object.
28
-
29
- ```javascript
30
- // 1. Access global application data
31
- const stats = await DeSciX.AppData.getCommunityStats();
32
-
33
- // 2. Call DeSciX API (uses parent PWA session)
34
- const result = await DeSciX.call('ask_question_to_app', {
35
- community_id: 'egpt',
36
- app_id: 'agent',
37
- user_input: 'Explain the platform architecture'
38
- });
39
- ```
40
-
41
- ## Adding More Files
42
-
43
- Add any static assets (images, fonts, additional JS/CSS) to this folder. All files in `site/` are deployed together.
44
-
45
- ## Local Development
46
-
47
- To test your site within the DeSciX PWA, use the `servelocal` command:
48
-
49
- ```bash
50
- descix site servelocal 3000
51
- ```
@@ -1,22 +0,0 @@
1
- /**
2
- * {{APP_NAME}} - Site JavaScript
3
- *
4
- * Add your client-side logic here.
5
- *
6
- * For DeSciX SDK integration, use the global DeSciX object:
7
- *
8
- * Example:
9
- * const stats = await DeSciX.AppData.getCommunityStats();
10
- * console.log('My Community Stats:', stats);
11
- *
12
- * // Call backend API directly
13
- * const result = await DeSciX.call('get_app', { app_id: 'myapp' });
14
- */
15
-
16
- document.addEventListener('DOMContentLoaded', async () => {
17
- console.log('{{APP_NAME}} site loaded');
18
-
19
- if (window.DeSciX) {
20
- console.log('[App] DeSciX SDK detected. Mode:', window.DeSciX.mode);
21
- }
22
- });
@@ -1,42 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>{{APP_NAME}}</title>
7
- <link rel="stylesheet" href="styles.css">
8
- </head>
9
- <body>
10
- <div class="container">
11
- <header>
12
- <h1>{{APP_NAME}}</h1>
13
- <p class="tagline">Your DeSciX App</p>
14
- </header>
15
-
16
- <main>
17
- <section class="hero">
18
- <h2>Welcome</h2>
19
- <p>This is your app's static site. Edit this page to create your user interface.</p>
20
- </section>
21
-
22
- <section class="features">
23
- <h3>Getting Started</h3>
24
- <ul>
25
- <li>Edit <code>index.html</code> to customize your page</li>
26
- <li>Add styles in <code>styles.css</code></li>
27
- <li>Add JavaScript in <code>app.js</code></li>
28
- <li>Deploy with <code>descix kb sync</code></li>
29
- </ul>
30
- </section>
31
- </main>
32
-
33
- <footer>
34
- <p>Powered by <a href="https://descix.net">DeSciX</a></p>
35
- </footer>
36
- </div>
37
-
38
- <!-- DeSciX App SDK -->
39
- <script src="DeSciXAppSDK.js"></script>
40
- <script src="app.js"></script>
41
- </body>
42
- </html>
@@ -1,123 +0,0 @@
1
- /* DeSciX App Styles */
2
-
3
- :root {
4
- --primary-color: #6366f1;
5
- --background-color: #f8fafc;
6
- --text-color: #1e293b;
7
- --text-muted: #64748b;
8
- --border-color: #e2e8f0;
9
- --card-background: #ffffff;
10
- }
11
-
12
- * {
13
- margin: 0;
14
- padding: 0;
15
- box-sizing: border-box;
16
- }
17
-
18
- body {
19
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
20
- background-color: var(--background-color);
21
- color: var(--text-color);
22
- line-height: 1.6;
23
- }
24
-
25
- .container {
26
- max-width: 800px;
27
- margin: 0 auto;
28
- padding: 2rem;
29
- }
30
-
31
- header {
32
- text-align: center;
33
- margin-bottom: 3rem;
34
- }
35
-
36
- header h1 {
37
- font-size: 2.5rem;
38
- color: var(--primary-color);
39
- margin-bottom: 0.5rem;
40
- }
41
-
42
- .tagline {
43
- color: var(--text-muted);
44
- font-size: 1.1rem;
45
- }
46
-
47
- main {
48
- background: var(--card-background);
49
- border-radius: 12px;
50
- padding: 2rem;
51
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
52
- }
53
-
54
- section {
55
- margin-bottom: 2rem;
56
- }
57
-
58
- section:last-child {
59
- margin-bottom: 0;
60
- }
61
-
62
- h2 {
63
- font-size: 1.5rem;
64
- margin-bottom: 1rem;
65
- }
66
-
67
- h3 {
68
- font-size: 1.2rem;
69
- margin-bottom: 0.75rem;
70
- color: var(--text-muted);
71
- }
72
-
73
- ul {
74
- list-style: none;
75
- padding: 0;
76
- }
77
-
78
- li {
79
- padding: 0.5rem 0;
80
- border-bottom: 1px solid var(--border-color);
81
- }
82
-
83
- li:last-child {
84
- border-bottom: none;
85
- }
86
-
87
- code {
88
- background: var(--background-color);
89
- padding: 0.2rem 0.4rem;
90
- border-radius: 4px;
91
- font-family: 'Monaco', 'Menlo', monospace;
92
- font-size: 0.9em;
93
- }
94
-
95
- footer {
96
- text-align: center;
97
- margin-top: 3rem;
98
- color: var(--text-muted);
99
- }
100
-
101
- footer a {
102
- color: var(--primary-color);
103
- text-decoration: none;
104
- }
105
-
106
- footer a:hover {
107
- text-decoration: underline;
108
- }
109
-
110
- /* Responsive */
111
- @media (max-width: 600px) {
112
- .container {
113
- padding: 1rem;
114
- }
115
-
116
- header h1 {
117
- font-size: 2rem;
118
- }
119
-
120
- main {
121
- padding: 1.5rem;
122
- }
123
- }
package/test-hydration.js DELETED
@@ -1,150 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Test Drive Hydration
4
- */
5
-
6
- import { google } from 'googleapis';
7
- import GoogleStorage from './lib/google-storage-adc.js';
8
- import * as fs from 'fs/promises';
9
- import * as path from 'path';
10
- import { fileURLToPath } from 'url';
11
-
12
- const __dirname = path.dirname(fileURLToPath(import.meta.url));
13
- const DRIVE_FOLDER_MIME = 'application/vnd.google-apps.folder';
14
-
15
- async function getAuth() {
16
- return new google.auth.GoogleAuth({
17
- scopes: ['https://www.googleapis.com/auth/drive', 'https://www.googleapis.com/auth/drive.file']
18
- });
19
- }
20
-
21
- async function main() {
22
- console.log('=== Drive Hydration Test ===\n');
23
-
24
- // Step 1: Verify ADC
25
- console.log('1. Verifying ADC authentication...');
26
- const user = await GoogleStorage.verifyDriveAuth();
27
- console.log(` ✓ Authenticated as: ${user.emailAddress}\n`);
28
-
29
- // Step 2: Find DeSciX base folder
30
- console.log('2. Looking for DeSciX base folder...');
31
- const auth = await getAuth();
32
- const drive = google.drive({ version: 'v3', auth });
33
-
34
- const possibleNames = ['DeSciX', 'DeSciX_Apps', 'descix-apps', 'descix'];
35
- let baseFolder = null;
36
-
37
- for (const name of possibleNames) {
38
- const res = await drive.files.list({
39
- q: `name='${name}' and mimeType='${DRIVE_FOLDER_MIME}' and trashed=false`,
40
- fields: 'files(id, name)'
41
- });
42
- if (res.data.files?.length) {
43
- baseFolder = res.data.files[0];
44
- console.log(` ✓ Found base folder: "${name}" (ID: ${baseFolder.id})\n`);
45
- break;
46
- }
47
- }
48
-
49
- if (!baseFolder) {
50
- console.log(' ✗ Could not find DeSciX base folder');
51
- const rootRes = await drive.files.list({
52
- q: `'root' in parents and mimeType='${DRIVE_FOLDER_MIME}' and trashed=false`,
53
- fields: 'files(id, name)',
54
- pageSize: 20
55
- });
56
- console.log(' Root folders:');
57
- for (const f of rootRes.data.files || []) {
58
- console.log(` - ${f.name} (${f.id})`);
59
- }
60
- return;
61
- }
62
-
63
- // Step 3: Find descix/agent
64
- console.log('3. Locating descix/agent folder...');
65
- const agentFolderId = await GoogleStorage.findFolderByPath(baseFolder.id, 'descix/agent');
66
-
67
- if (!agentFolderId) {
68
- console.log(' ✗ Could not find descix/agent folder');
69
- console.log(' Contents of base folder:');
70
- const contents = await GoogleStorage.listFolderWithMeta(baseFolder.id);
71
- for (const f of contents) {
72
- console.log(` - ${f.name} (${f.mimeType === DRIVE_FOLDER_MIME ? 'folder' : 'file'})`);
73
- }
74
- return;
75
- }
76
-
77
- console.log(` ✓ Found descix/agent folder (ID: ${agentFolderId})\n`);
78
-
79
- // Step 4: List contents
80
- console.log('4. Contents of descix/agent in Drive:');
81
- const agentContents = await GoogleStorage.listFolderWithMeta(agentFolderId);
82
- for (const f of agentContents) {
83
- const type = f.mimeType === DRIVE_FOLDER_MIME ? '📁' : '📄';
84
- console.log(` ${type} ${f.name}`);
85
-
86
- // List subfolders
87
- if (f.mimeType === DRIVE_FOLDER_MIME) {
88
- const subContents = await GoogleStorage.listFolderWithMeta(f.id);
89
- for (const sf of subContents) {
90
- const subType = sf.mimeType === DRIVE_FOLDER_MIME ? '📁' : '📄';
91
- console.log(` ${subType} ${sf.name}`);
92
- }
93
- }
94
- }
95
- console.log('');
96
-
97
- // Step 5: Pull content using the new downloadFileFromDrive function
98
- const targetDir = '/Users/essam/Documents/Code/DaitaERC20/descix/agent';
99
- console.log(`5. Pulling content to ${targetDir}...`);
100
-
101
- const pullRecursive = async (localPath, folderId, indent = ' ') => {
102
- await fs.mkdir(localPath, { recursive: true });
103
- const files = await GoogleStorage.listFolderWithMeta(folderId);
104
- let count = 0;
105
-
106
- for (const file of files) {
107
- const targetPath = path.join(localPath, file.name);
108
-
109
- if (file.mimeType === DRIVE_FOLDER_MIME) {
110
- console.log(`${indent}📁 ${file.name}/`);
111
- count += await pullRecursive(targetPath, file.id, indent + ' ');
112
- } else {
113
- console.log(`${indent}📄 Downloading: ${file.name}`);
114
- await GoogleStorage.downloadFileFromDrive(file.id, targetPath);
115
- count++;
116
- }
117
- }
118
- return count;
119
- };
120
-
121
- const downloaded = await pullRecursive(targetDir, agentFolderId);
122
- console.log(`\n ✓ Downloaded ${downloaded} files\n`);
123
-
124
- // Step 6: Verify
125
- console.log('6. Verifying local content:');
126
- const verifyDir = async (dir, indent = '') => {
127
- try {
128
- const entries = await fs.readdir(dir, { withFileTypes: true });
129
- for (const e of entries) {
130
- const type = e.isDirectory() ? '📁' : '📄';
131
- console.log(` ${indent}${type} ${e.name}`);
132
- if (e.isDirectory()) {
133
- await verifyDir(path.join(dir, e.name), indent + ' ');
134
- }
135
- }
136
- } catch {
137
- console.log(` ${indent}(empty)`);
138
- }
139
- };
140
- await verifyDir(targetDir);
141
-
142
- console.log('\n=== Test Complete ===');
143
- console.log(`\nBase folder ID for workspace.json: ${baseFolder.id}`);
144
- }
145
-
146
- main().catch(err => {
147
- console.error('Error:', err.message);
148
- console.error(err.stack);
149
- process.exit(1);
150
- });